diff --git a/docs/progress.svg b/docs/progress.svg index ef727cd..879afa1 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -47.62% (580) · 49.92% (608) · 0% (0) · 2.46% (30) +47.70% (581) · 49.84% (607) · 0% (0) · 2.46% (30) - - + + @@ -260,7 +260,7 @@ int32_t __cdecl LOS_ClipTarget(const GAME_VECTOR *start, GAME_VECTOR *target, const FLOOR_INFO *floor); int32_t __cdecl LOS_CheckSmashable(const GAME_VECTOR *start, GAME_VECTOR *target); void __cdecl Room_FlipMap(void); -void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); +void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); void __cdecl Room_AddFlipItems(ROOM_INFO *r); void __cdecl Control_TriggerMusicTrack(int16_t value, int16_t flags, int16_t type); void __cdecl Control_TriggerMusicNormalTrack(int16_t value, int16_t flags, int16_t type); @@ -1298,10 +1298,10 @@ Tomb2.exe progress according to the function sizes: -45.13% · 54.54% · 0% · 0.33% +45.18% · 54.50% · 0% · 0.33% - - + + @@ -1859,7 +1859,7 @@ void __cdecl AdjustTextureUVs(bool reset_uv_add); void __cdecl Output_DrawScreenSprite2D(int32_t sx, int32_t sy, int32_t sz, int32_t scale_h, int32_t scale_v, int16_t sprite_idx, int16_t shade, uint16_t flags); void __cdecl Lara_Control_Cutscene(int16_t item_num); -void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); +void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); void __cdecl floor_shake_effect(ITEM_INFO *item); void __cdecl Lara_State_DeathSlide(ITEM_INFO *item, COLL_INFO *coll); void __cdecl Lara_Col_Compress( ITEM_INFO *item, COLL_INFO *coll ); diff --git a/docs/progress.txt b/docs/progress.txt index 71eef65..6c081b1 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -2847,7 +2847,7 @@ typedef enum { 0x00416260 0x00DA + int32_t __cdecl LOS_ClipTarget(const GAME_VECTOR *start, GAME_VECTOR *target, const FLOOR_INFO *floor); 0x00416340 0x02FE + int32_t __cdecl LOS_CheckSmashable(const GAME_VECTOR *start, GAME_VECTOR *target); 0x00416640 0x00B3 + void __cdecl Room_FlipMap(void); -0x00416700 0x0096 - void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); +0x00416700 0x0096 + void __cdecl Room_RemoveFlipItems(ROOM_INFO *r); 0x004167A0 0x005C - void __cdecl Room_AddFlipItems(ROOM_INFO *r); 0x00416800 0x0024 - void __cdecl Control_TriggerMusicTrack(int16_t value, int16_t flags, int16_t type); 0x00416830 0x00DA - void __cdecl Control_TriggerMusicNormalTrack(int16_t value, int16_t flags, int16_t type); diff --git a/src/game/room.c b/src/game/room.c index 9e443d1..ad074ec 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -848,3 +848,32 @@ void __cdecl Room_FlipMap(void) g_FlipStatus = !g_FlipStatus; } + +void __cdecl Room_RemoveFlipItems(const ROOM_INFO *const r) +{ + int16_t item_num = r->item_num; + + while (item_num != NO_ITEM) { + ITEM_INFO *const item = &g_Items[item_num]; + + switch (item->object_num) { + case O_MOVABLE_BLOCK_1: + case O_MOVABLE_BLOCK_2: + case O_MOVABLE_BLOCK_3: + case O_MOVABLE_BLOCK_4: + Room_AlterFloorHeight(item, WALL_L); + break; + + default: + break; + } + + if (item->flags & IF_ONE_SHOT && g_Objects[item->object_num].intelligent + && item->hit_points <= 0) { + Item_RemoveDrawn(item_num); + item->flags |= IF_KILLED; + } + + item_num = item->next_item; + } +} diff --git a/src/game/room.h b/src/game/room.h index 9ae048e..3e043b0 100644 --- a/src/game/room.h +++ b/src/game/room.h @@ -23,3 +23,4 @@ int16_t __cdecl Room_GetDoor(const FLOOR_INFO *floor); void __cdecl Room_TestTriggers(const int16_t *fd, bool heavy); void __cdecl Room_AlterFloorHeight(const ITEM_INFO *item, int32_t height); void __cdecl Room_FlipMap(void); +void __cdecl Room_RemoveFlipItems(const ROOM_INFO *r); diff --git a/src/global/funcs.h b/src/global/funcs.h index dac8585..20b1559 100644 --- a/src/global/funcs.h +++ b/src/global/funcs.h @@ -8,7 +8,6 @@ #define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50) #define Game_Control ((int32_t __cdecl (*)(int32_t nframes, int32_t demo_mode))0x00414390) #define Camera_RefreshFromTrigger ((void __cdecl (*)(int16_t type, const int16_t *data))0x00415100) -#define Room_RemoveFlipItems ((void __cdecl (*)(ROOM_INFO *r))0x00416700) #define Room_AddFlipItems ((void __cdecl (*)(ROOM_INFO *r))0x004167A0) #define Control_TriggerMusicTrack ((void __cdecl (*)(int16_t value, int16_t flags, int16_t type))0x00416800) #define Control_TriggerMusicNormalTrack ((void __cdecl (*)(int16_t value, int16_t flags, int16_t type))0x00416830) diff --git a/src/inject_exec.c b/src/inject_exec.c index 66de627..9f6c49e 100644 --- a/src/inject_exec.c +++ b/src/inject_exec.c @@ -248,6 +248,7 @@ static void Inject_Room(const bool enable) INJECT(enable, 0x004151F0, Room_TestTriggers); INJECT(enable, 0x004340B0, Room_AlterFloorHeight); INJECT(enable, 0x00416640, Room_FlipMap); + INJECT(enable, 0x00416700, Room_RemoveFlipItems); } static void Inject_Matrix(const bool enable)