22 #ifndef ULTIMA8_USECODE_INTRINSICS_H 23 #define ULTIMA8_USECODE_INTRINSICS_H 25 #include "common/scummsys.h" 30 typedef uint32(*Intrinsic)(
const uint8 *args,
unsigned int argsize);
32 #define INTRINSIC(x) static uint32 x (const uint8* args, unsigned int argsize) 38 #define ARG_UINT8(x) uint8 x = (*args++); args++; 39 #define ARG_UINT16(x) uint16 x = (*args++); x += ((*args++) << 8); 40 #define ARG_UINT32(x) uint32 x = (*args++); x += ((*args++) << 8); \ 41 x+= ((*args++) << 16); x += ((*args++) << 24); 42 #define ARG_SINT8(x) int8 x = (*args++); 43 #define ARG_SINT16(x) int16 x = (*args++); x += ((*args++) << 8); 44 #define ARG_SINT32(x) int32 x = (*args++); x += ((*args++) << 8); \ 45 x+= ((*args++) << 16); x += ((*args++) << 24); 46 #define ARG_UC_PTR(x) uint32 x = (*args++); x += ((*args++) << 8); \ 47 x+= ((*args++) << 16); x += ((*args++) << 24); 48 #define ARG_OBJID(x) ObjId x = (*args++); x += ((*args++) << 8); 49 #define ARG_PROCID(x) ProcId x = (*args++); x += ((*args++) << 8); 51 #define ARG_OBJECT_FROM_PTR(x) ARG_UC_PTR(ucptr_##x); \ 52 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 53 Object* x = getObject(id_##x); 54 #define ARG_OBJECT_FROM_ID(x) ARG_OBJID(id_##x); \ 55 Object* x = getObject(id_##x); 57 #define ARG_ITEM_FROM_PTR(x) ARG_UC_PTR(ucptr_##x); \ 58 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 59 Item* x = getItem(id_##x); 60 #define ARG_ITEM_FROM_ID(x) ARG_OBJID(id_##x); \ 61 Item* x = getItem(id_##x); 63 #define ARG_CONTAINER_FROM_PTR(x) ARG_UC_PTR(ucptr_##x); \ 64 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 65 Container* x = getContainer(id_##x); 66 #define ARG_CONTAINER_FROM_ID(x) ARG_OBJID(id_##x); \ 67 Container* x = getContainer(id_##x); 69 #define ARG_ACTOR_FROM_PTR(x) ARG_UC_PTR(ucptr_##x); \ 70 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 71 Actor* x = getActor(id_##x); 72 #define ARG_ACTOR_FROM_ID(x) ARG_OBJID(id_##x); \ 73 Actor* x = getActor(id_##x); 75 #define ARG_EGG_FROM_PTR(x) ARG_UC_PTR(ucptr_##x); \ 76 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 77 Egg* x = dynamic_cast<Egg*>(getObject(id_##x)); 78 #define ARG_EGG_FROM_ID(x) ARG_OBJID(id_##x); \ 79 Egg* x = dynamic_cast<Egg*>(getObject(id_##x)); 81 #define ARG_STRING(x) ARG_UC_PTR(ucptr_##x); \ 82 uint16 id_##x = UCMachine::ptrToObject(ucptr_##x); \ 83 Std::string x = UCMachine::get_instance()->getString(id_##x); 85 #define ARG_LIST(x) ARG_UINT16(id_##x); \ 86 UCList* x = UCMachine::get_instance()->getList(id_##x); 88 #define ARG_WORLDPOINT(x) ARG_UC_PTR(ucptr_##x); \ 90 UCMachine::get_instance()->dereferencePointer(ucptr_##x, x._buf, 5); 93 #define ARG_NULL8() args+=2; 94 #define ARG_NULL16() args+=2; 95 #define ARG_NULL32() args+=4; Definition: detection.h:27