Add proto_item_init

This commit is contained in:
Alexander Batalov 2023-07-22 15:34:32 +03:00
parent fd9fa80204
commit 3c7248af5f
2 changed files with 29 additions and 0 deletions

View File

@ -370,6 +370,34 @@ char* protoGetDescription(int pid)
return protoGetMessage(pid, PROTOTYPE_MESSAGE_DESCRIPTION); return protoGetMessage(pid, PROTOTYPE_MESSAGE_DESCRIPTION);
} }
// 0x49EB2C
int proto_item_init(Proto* proto, int a2)
{
int v1 = a2 & 0xFFFFFF;
proto->item.pid = -1;
proto->item.messageId = 100 * v1;
proto->item.fid = buildFid(OBJ_TYPE_ITEM, v1 - 1, 0, 0, 0);
if (!artExists(proto->item.fid)) {
proto->item.fid = buildFid(OBJ_TYPE_ITEM, 0, 0, 0, 0);
}
proto->item.lightDistance = 0;
proto->item.lightIntensity = 0;
proto->item.flags = 0xA0000008;
proto->item.extendedFlags = 0xA000;
proto->item.sid = -1;
proto->item.type = ITEM_TYPE_MISC;
proto_item_subdata_init(proto, proto->item.type);
proto->item.material = 1;
proto->item.size = 1;
proto->item.weight = 10;
proto->item.cost = 0;
proto->item.inventoryFid = -1;
proto->item.field_80 = '0';
return 0;
}
// 0x49EBFC // 0x49EBFC
int proto_item_subdata_init(Proto* proto, int type) int proto_item_subdata_init(Proto* proto, int type)
{ {

View File

@ -112,6 +112,7 @@ int _proto_action_can_pickup(int pid);
char* protoGetMessage(int pid, int message); char* protoGetMessage(int pid, int message);
char* protoGetName(int pid); char* protoGetName(int pid);
char* protoGetDescription(int pid); char* protoGetDescription(int pid);
int proto_item_init(Proto* proto, int a2);
int proto_item_subdata_init(Proto* proto, int type); int proto_item_subdata_init(Proto* proto, int type);
void objectDataReset(Object* obj); void objectDataReset(Object* obj);
int objectDataRead(Object* obj, File* stream); int objectDataRead(Object* obj, File* stream);