diff --git a/src/game/lara/lara_cheat.c b/src/game/lara/lara_cheat.c index f205d142..c91c6336 100644 --- a/src/game/lara/lara_cheat.c +++ b/src/game/lara/lara_cheat.c @@ -26,6 +26,7 @@ static void Lara_Cheat_GiveAllGunsImpl(void); static void Lara_Cheat_GiveAllMedpacksImpl(void); static void Lara_Cheat_GiveAllKeysImpl(void); static void Lara_Cheat_ReinitialiseGunMeshes(void); +static void Lara_Cheat_ResetGunStatus(void); static void Lara_Cheat_ReinitialiseGunMeshes(void) { @@ -79,6 +80,30 @@ static void Lara_Cheat_GiveAllKeysImpl(void) Inv_AddItem(O_PICKUP_ITEM_2); } +static void Lara_Cheat_ResetGunStatus(void) +{ + const bool has_flare = g_Lara.mesh_ptrs[LM_HAND_L] + == g_Meshes[g_Objects[O_LARA_FLARE].mesh_idx + LM_HAND_L]; + if (has_flare) { + g_Lara.gun_type = LGT_FLARE; + return; + } + + g_Lara.gun_status = LGS_ARMLESS; + g_Lara.gun_type = LGT_UNARMED; + g_Lara.request_gun_type = LGT_UNARMED; + g_Lara.weapon_item = NO_ITEM; + g_Lara.gun_status = LGS_ARMLESS; + g_Lara.left_arm.frame_num = 0; + g_Lara.left_arm.lock = 0; + g_Lara.right_arm.frame_num = 0; + g_Lara.right_arm.lock = 0; + g_Lara.left_arm.anim_num = g_LaraItem->anim_num; + g_Lara.right_arm.anim_num = g_LaraItem->anim_num; + g_Lara.left_arm.frame_base = g_Anims[g_LaraItem->anim_num].frame_ptr; + g_Lara.right_arm.frame_base = g_Anims[g_LaraItem->anim_num].frame_ptr; +} + void __cdecl Lara_Cheat_EndLevel(void) { g_LevelComplete = true; @@ -91,6 +116,10 @@ bool __cdecl Lara_Cheat_EnterFlyMode(void) return false; } + if (g_Lara.extra_anim) { + Lara_Cheat_ResetGunStatus(); + } + Lara_GetOffVehicle(); if (g_Lara.water_status != LWS_UNDERWATER || g_LaraItem->hit_points <= 0) { @@ -158,10 +187,9 @@ bool __cdecl Lara_Cheat_ExitFlyMode(void) g_Lara.gun_status = LGS_UNDRAW; } else { g_Lara.gun_status = LGS_ARMLESS; + Lara_Cheat_ReinitialiseGunMeshes(); } - Lara_Cheat_ReinitialiseGunMeshes(); - Console_Log(GS(OSD_FLY_MODE_OFF)); return true; } @@ -377,6 +405,7 @@ bool Lara_Cheat_Teleport(int32_t x, int32_t y, int32_t z) } g_Lara.extra_anim = 0; + Lara_Cheat_ResetGunStatus(); Lara_Cheat_ReinitialiseGunMeshes(); }