diff --git a/src/proto.cc b/src/proto.cc index efb05b0..421939e 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -828,6 +828,23 @@ int _proto_dude_init(const char* path) return 0; } +// 0x49FEDC +bool proto_is_subtype(Proto* proto, int subtype) +{ + if (subtype == -1) { + return true; + } + + switch (PID_TYPE(proto->pid)) { + case OBJ_TYPE_ITEM: + return proto->item.type == subtype; + case OBJ_TYPE_SCENERY: + return proto->scenery.type == subtype; + } + + return false; +} + // proto_data_member // 0x49FFD8 int protoGetDataMember(int pid, int member, ProtoDataMemberValue* value) diff --git a/src/proto.h b/src/proto.h index d6f13e6..e68140f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -118,6 +118,7 @@ int objectDataWrite(Object* obj, File* stream); int _proto_update_init(Object* obj); int _proto_dude_update_gender(); int _proto_dude_init(const char* path); +bool proto_is_subtype(Proto* proto, int subtype); int protoGetDataMember(int pid, int member, ProtoDataMemberValue* value); int protoInit(); void protoReset();