From 1d310eb6266308138e653bd9d3a31cbd4d536f0f Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 22 Jul 2023 14:58:47 +0300 Subject: [PATCH] Add proto_tile_init --- src/proto.cc | 19 +++++++++++++++++++ src/proto.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/proto.cc b/src/proto.cc index 33a505a..b6d544f 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -828,6 +828,25 @@ int _proto_dude_init(const char* path) return 0; } +// 0x49FD84 +int proto_tile_init(Proto* proto, int a2) +{ + int v1 = a2 & 0xFFFFFF; + + proto->tile.pid = -1; + proto->tile.messageId = 100 * v1; + proto->tile.fid = buildFid(OBJ_TYPE_TILE, v1 - 1, 0, 0, 0); + if (!artExists(proto->tile.fid)) { + proto->tile.fid = buildFid(OBJ_TYPE_TILE, 0, 0, 0, 0); + } + proto->tile.flags = 0; + proto->tile.extendedFlags = 0x2000; + proto->tile.sid = -1; + proto->tile.material = 1; + + return 0; +} + // 0x49FDFC int proto_misc_init(Proto* proto, int a2) { diff --git a/src/proto.h b/src/proto.h index 5573a87..e771b8d 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); +int proto_tile_init(Proto* proto, int a2); int proto_misc_init(Proto* proto, int a2); int proto_copy_proto(int srcPid, int dstPid); bool proto_is_subtype(Proto* proto, int subtype);