From 3d5cb4c3f435fdac4048d2d7f504b7582edf8354 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 22 Jul 2023 15:07:39 +0300 Subject: [PATCH] Add proto_scenery_init --- src/proto.cc | 24 ++++++++++++++++++++++++ src/proto.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/proto.cc b/src/proto.cc index 597af60..312aa05 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -828,6 +828,30 @@ int _proto_dude_init(const char* path) return 0; } +// 0x49FBBC +int proto_scenery_init(Proto* proto, int a2) +{ + int v1 = a2 & 0xFFFFFF; + + proto->scenery.pid = -1; + proto->scenery.messageId = 100 * v1; + proto->scenery.fid = buildFid(OBJ_TYPE_SCENERY, v1 - 1, 0, 0, 0); + if (!artExists(proto->scenery.fid)) { + proto->scenery.fid = buildFid(OBJ_TYPE_SCENERY, 0, 0, 0, 0); + } + proto->scenery.lightDistance = 0; + proto->scenery.lightIntensity = 0; + proto->scenery.flags = 0; + proto->scenery.extendedFlags = 0x2000; + proto->scenery.sid = -1; + proto->scenery.type = SCENERY_TYPE_GENERIC; + proto_scenery_subdata_init(proto, proto->scenery.type); + proto->scenery.field_2C = -1; + proto->scenery.field_34 = '0'; + + return 0; +} + // 0x49FC74 int proto_scenery_subdata_init(Proto* proto, int type) { diff --git a/src/proto.h b/src/proto.h index 982af88..4b09e3b 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_scenery_init(Proto* proto, int a2); int proto_scenery_subdata_init(Proto* proto, int type); int proto_wall_init(Proto* proto, int a2); int proto_tile_init(Proto* proto, int a2);