From b6586b8c4e204b76e6bcdb669c24c2a454c35ffc Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 22 Dec 2024 15:17:03 +0100 Subject: [PATCH] tr2: port FX_Turn180 --- docs/tr2/progress.svg | 16 ++++++++-------- docs/tr2/progress.txt | 2 +- src/tr2/decomp/effects.c | 6 ++++++ src/tr2/decomp/effects.h | 1 + src/tr2/global/funcs.h | 1 - src/tr2/inject_exec.c | 1 + 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/tr2/progress.svg b/docs/tr2/progress.svg index a4c5cfc28..1ddb82e6d 100644 --- a/docs/tr2/progress.svg +++ b/docs/tr2/progress.svg @@ -69,10 +69,10 @@ Tomb2.exe progress according to the physical function order: -93.97% (1169) · 3.62% (45) · 0% (0) · 2.41% (30) +94.05% (1170) · 3.54% (44) · 0% (0) · 2.41% (30) - - + + @@ -335,7 +335,7 @@ void __cdecl HotLiquid_Control(int16_t fx_num); void __cdecl Waterfall_Control(int16_t item_num); void __cdecl FX_FinishLevel(ITEM *item); -void __cdecl FX_Turn180(ITEM *item); +void __cdecl FX_Turn180(ITEM *item); void __cdecl FX_FloorShake(ITEM *item); void __cdecl FX_LaraNormal(ITEM *item); void __cdecl FX_Boiler(ITEM *item); @@ -1324,10 +1324,10 @@ Tomb2.exe progress according to the function sizes: -98.42% · 1.25% · 0% · 0.33% +98.43% · 1.25% · 0% · 0.33% - - + + @@ -2463,7 +2463,7 @@ sub_44E860 void __cdecl SE_GraphicsAdapterSet(HWND hwndDlg, DISPLAY_ADAPTER_NODE *adapter); void __cdecl S_Audio_Sample_OutCloseTrack(int32_t track_id); -void __cdecl FX_Turn180(ITEM *item); +void __cdecl FX_Turn180(ITEM *item); void __cdecl FX_InvisibilityOff(ITEM *item); void __cdecl BridgeFlat_Floor(const ITEM *item, int32_t x, int32_t y, int32_t z, int32_t *out_height); void __cdecl HWR_BeginScene(void); diff --git a/docs/tr2/progress.txt b/docs/tr2/progress.txt index 06c6804d5..a8adebbae 100644 --- a/docs/tr2/progress.txt +++ b/docs/tr2/progress.txt @@ -3243,7 +3243,7 @@ typedef enum { 0x0041CD20 0x00DE + void __cdecl HotLiquid_Control(int16_t fx_num); 0x0041CE00 0x013D + void __cdecl Waterfall_Control(int16_t item_num); 0x0041CF40 0x000B + void __cdecl FX_FinishLevel(ITEM *item); -0x0041CF50 0x0016 - void __cdecl FX_Turn180(ITEM *item); +0x0041CF50 0x0016 + void __cdecl FX_Turn180(ITEM *item); 0x0041CF70 0x0096 - void __cdecl FX_FloorShake(ITEM *item); 0x0041D010 0x0040 - void __cdecl FX_LaraNormal(ITEM *item); 0x0041D050 0x001C - void __cdecl FX_Boiler(ITEM *item); diff --git a/src/tr2/decomp/effects.c b/src/tr2/decomp/effects.c index 862f3cbf5..afe65e352 100644 --- a/src/tr2/decomp/effects.c +++ b/src/tr2/decomp/effects.c @@ -382,3 +382,9 @@ void __cdecl FX_FinishLevel(ITEM *const item) { g_LevelComplete = true; } + +void __cdecl FX_Turn180(ITEM *const item) +{ + item->rot.x = -item->rot.x; + item->rot.y += PHD_180; +} diff --git a/src/tr2/decomp/effects.h b/src/tr2/decomp/effects.h index b87b4a9cf..17dc94cc3 100644 --- a/src/tr2/decomp/effects.h +++ b/src/tr2/decomp/effects.h @@ -47,3 +47,4 @@ void __cdecl DoLotsOfBlood( void __cdecl Richochet(const GAME_VECTOR *pos); void __cdecl FX_FinishLevel(ITEM *item); +void __cdecl FX_Turn180(ITEM *item); diff --git a/src/tr2/global/funcs.h b/src/tr2/global/funcs.h index 5e141e49c..a2a0321d5 100644 --- a/src/tr2/global/funcs.h +++ b/src/tr2/global/funcs.h @@ -6,7 +6,6 @@ // clang-format off #define Output_InsertInventoryBackground ((void __cdecl (*)(const int16_t *obj_ptr))0x00401D50) -#define FX_Turn180 ((void __cdecl (*)(ITEM *item))0x0041CF50) #define FX_FloorShake ((void __cdecl (*)(ITEM *item))0x0041CF70) #define FX_LaraNormal ((void __cdecl (*)(ITEM *item))0x0041D010) #define FX_Boiler ((void __cdecl (*)(ITEM *item))0x0041D050) diff --git a/src/tr2/inject_exec.c b/src/tr2/inject_exec.c index 482dc722c..0ff81facd 100644 --- a/src/tr2/inject_exec.c +++ b/src/tr2/inject_exec.c @@ -259,6 +259,7 @@ static void M_DecompEffects(const bool enable) INJECT(enable, 0x0041C7F0, Richochet); INJECT(enable, 0x0041CA90, Splash); INJECT(enable, 0x0041CF40, FX_FinishLevel); + INJECT(enable, 0x0041CF50, FX_Turn180); INJECT(enable, 0x0041D780, FX_LaraHandsFree); INJECT(enable, 0x0041DB50, Knife); INJECT(enable, 0x00433360, Effect_ExplodingDeath);