From 01a68af4a4db88feb1c8235d6467896078a2c4d6 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 22 Jul 2023 15:05:00 +0300 Subject: [PATCH] Add proto_scenery_subdata_init --- src/proto.cc | 31 +++++++++++++++++++++++++++++++ src/proto.h | 1 + 2 files changed, 32 insertions(+) diff --git a/src/proto.cc b/src/proto.cc index cf4af89..597af60 100644 --- a/src/proto.cc +++ b/src/proto.cc @@ -828,6 +828,37 @@ int _proto_dude_init(const char* path) return 0; } +// 0x49FC74 +int proto_scenery_subdata_init(Proto* proto, int type) +{ + switch (type) { + case SCENERY_TYPE_DOOR: + proto->scenery.data.door.openFlags = 0; + proto->scenery.extendedFlags |= 0x800; + break; + case SCENERY_TYPE_STAIRS: + proto->scenery.data.stairs.field_0 = -1; + proto->scenery.data.stairs.field_4 = -1; + proto->scenery.extendedFlags |= 0x800; + break; + case SCENERY_TYPE_ELEVATOR: + proto->scenery.data.elevator.type = -1; + proto->scenery.data.elevator.level = -1; + proto->scenery.extendedFlags |= 0x800; + break; + case SCENERY_TYPE_LADDER_UP: + proto->scenery.data.ladder.field_0 = -1; + proto->scenery.extendedFlags |= 0x800; + break; + case SCENERY_TYPE_LADDER_DOWN: + proto->scenery.data.ladder.field_0 = -1; + proto->scenery.extendedFlags |= 0x800; + break; + } + + return 0; +} + // 0x49FCFC int proto_wall_init(Proto* proto, int a2) { diff --git a/src/proto.h b/src/proto.h index ba4626b..982af88 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_subdata_init(Proto* proto, int type); int proto_wall_init(Proto* proto, int a2); int proto_tile_init(Proto* proto, int a2); int proto_misc_init(Proto* proto, int a2);