diff --git a/docs/progress.svg b/docs/progress.svg index d238b5f09..ed17f1d8b 100644 --- a/docs/progress.svg +++ b/docs/progress.svg @@ -455,7 +455,7 @@ DrawLightning InitialiseLightning LightningControl -LightningCollision +LightningCollision InitialiseThorsHandle ThorsHandleControl ThorsHandleCollision @@ -1199,7 +1199,7 @@ flatA InitialiseObjects draw_pistol_meshes -LightningCollision +LightningCollision sub_4079E9 GetSavedGamesList Inv_RingGetView @@ -1463,10 +1463,10 @@ sub_440EF0 sub_437BC0 S_CDVolume -Functions decompiled (count): 48.02% -Functions decompiled (bytesize): 45.88% -Functions not decompiled, but with known names (count): 37.89% -Functions not decompiled, but with known names (bytesize): 38.29% +Functions decompiled (count): 48.15% +Functions decompiled (bytesize): 45.92% +Functions not decompiled, but with known names (count): 37.76% +Functions not decompiled, but with known names (bytesize): 38.25% Functions not decompiled, with unknown names (count): 14.09% Functions not decompiled, with unknown names (bytesize): 15.83% diff --git a/docs/progress.txt b/docs/progress.txt index a2510189b..a7d33baad 100644 --- a/docs/progress.txt +++ b/docs/progress.txt @@ -636,7 +636,7 @@ LaraWaterCurrent 0x00429440 0x000001DB + DrawLightning 0x00429620 0x000004D1 + InitialiseLightning 0x00429B00 0x0000007E + LightningControl 0x00429B80 0x000002AF + -LightningCollision 0x00429E30 0x00000061 * +LightningCollision 0x00429E30 0x00000061 + InitialiseThorsHandle 0x00429EA0 0x00000086 * ThorsHandleControl 0x00429F30 0x000002B0 * ThorsHandleCollision 0x0042A1F0 0x0000004B * diff --git a/src/game/lightning.c b/src/game/lightning.c index 0168626a6..2824fe14e 100644 --- a/src/game/lightning.c +++ b/src/game/lightning.c @@ -263,9 +263,24 @@ void LightningControl(int16_t item_num) SoundEffect(98, &item->pos, 0); } +void LightningCollision(int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll) +{ + LIGHTNING* l = Items[item_num].data; + if (!l->zapped) { + return; + } + + Lara.hit_direction = 1 + (GetRandomControl() * 4) / 0x7FFF; + Lara.hit_frame++; + if (Lara.hit_frame > 34) { + Lara.hit_frame = 34; + } +} + void T1MInjectGameLightning() { INJECT(0x00429620, DrawLightning); INJECT(0x00429B00, InitialiseLightning); INJECT(0x00429B80, LightningControl); + INJECT(0x00429E30, LightningCollision); } diff --git a/src/game/lightning.h b/src/game/lightning.h index 1e13fdc61..57576fb50 100644 --- a/src/game/lightning.h +++ b/src/game/lightning.h @@ -5,7 +5,6 @@ #include // clang-format off -#define LightningCollision ((void (*)(int16_t item_num, ITEM_INFO* litem, COLL_INFO* coll))0x00429E30) #define InitialiseThorsHandle ((void (*)(int16_t item_num))0x00429EA0) #define ThorsHandleControl ((void (*)(int16_t item_num))0x00429F30) #define ThorsHandleCollision ((void (*)(int16_t item_num, ITEM_INFO* litem, COLL_INFO* coll))0x0042A1F0) @@ -15,6 +14,8 @@ void DrawLightning(ITEM_INFO* item); void InitialiseLightning(int16_t item_num); void LightningControl(int16_t item_num); +void LightningCollision( + int16_t item_num, ITEM_INFO* lara_item, COLL_INFO* coll); void T1MInjectGameLightning();