Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
input: fix numeric keys interacting with the demos
Browse files Browse the repository at this point in the history
Resolves #172.
  • Loading branch information
rr- committed Sep 11, 2024
1 parent 01d9781 commit f7ebd28
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- added an option to fix M16 accuracy while running (#45)
- added a .NET-based configuration tool (#197)
- changed the default flare key from `/` to `.` to avoid conflicts with the console (#163)
- fixed numeric keys interfering with the demos (#172)
- fixed explosions sometimes being drawn too dark (#187)
- fixed killing the T-Rex with a grenade launcher crashing the game (#168)
- fixed secret rewards not displaying shotgun ammo (#159)
Expand Down
63 changes: 33 additions & 30 deletions src/specific/s_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "decomp/decomp.h"
#include "game/console.h"
#include "game/gameflow/gameflow_new.h"
#include "game/input.h"
#include "game/inventory/backpack.h"
#include "game/lara/lara_control.h"
Expand Down Expand Up @@ -196,39 +197,41 @@ bool __cdecl S_Input_Update(void)
return g_IsGameToExit;
}

if (KEY_DOWN(DIK_1) && Inv_RequestItem(O_PISTOL_OPTION)) {
g_Lara.request_gun_type = LGT_PISTOLS;
} else if (KEY_DOWN(DIK_2) && Inv_RequestItem(O_SHOTGUN_OPTION)) {
g_Lara.request_gun_type = LGT_SHOTGUN;
} else if (KEY_DOWN(DIK_3) && Inv_RequestItem(O_MAGNUM_OPTION)) {
g_Lara.request_gun_type = LGT_MAGNUMS;
} else if (KEY_DOWN(DIK_4) && Inv_RequestItem(O_UZI_OPTION)) {
g_Lara.request_gun_type = LGT_UZIS;
} else if (KEY_DOWN(DIK_5) && Inv_RequestItem(O_HARPOON_OPTION)) {
g_Lara.request_gun_type = LGT_HARPOON;
} else if (KEY_DOWN(DIK_6) && Inv_RequestItem(O_M16_OPTION)) {
g_Lara.request_gun_type = LGT_M16;
} else if (KEY_DOWN(DIK_7) && Inv_RequestItem(O_GRENADE_OPTION)) {
g_Lara.request_gun_type = LGT_GRENADE;
} else if (KEY_DOWN(DIK_0) && Inv_RequestItem(O_FLARES_OPTION)) {
g_Lara.request_gun_type = LGT_FLARE;
}

if (KEY_DOWN(DIK_8) && Inv_RequestItem(O_SMALL_MEDIPACK_OPTION)) {
if (m_MediPackCooldown == 0) {
Lara_UseItem(O_SMALL_MEDIPACK_OPTION);
if (g_GameInfo.current_level.type != GFL_DEMO) {
if (KEY_DOWN(DIK_1) && Inv_RequestItem(O_PISTOL_OPTION)) {
g_Lara.request_gun_type = LGT_PISTOLS;
} else if (KEY_DOWN(DIK_2) && Inv_RequestItem(O_SHOTGUN_OPTION)) {
g_Lara.request_gun_type = LGT_SHOTGUN;
} else if (KEY_DOWN(DIK_3) && Inv_RequestItem(O_MAGNUM_OPTION)) {
g_Lara.request_gun_type = LGT_MAGNUMS;
} else if (KEY_DOWN(DIK_4) && Inv_RequestItem(O_UZI_OPTION)) {
g_Lara.request_gun_type = LGT_UZIS;
} else if (KEY_DOWN(DIK_5) && Inv_RequestItem(O_HARPOON_OPTION)) {
g_Lara.request_gun_type = LGT_HARPOON;
} else if (KEY_DOWN(DIK_6) && Inv_RequestItem(O_M16_OPTION)) {
g_Lara.request_gun_type = LGT_M16;
} else if (KEY_DOWN(DIK_7) && Inv_RequestItem(O_GRENADE_OPTION)) {
g_Lara.request_gun_type = LGT_GRENADE;
} else if (KEY_DOWN(DIK_0) && Inv_RequestItem(O_FLARES_OPTION)) {
g_Lara.request_gun_type = LGT_FLARE;
}
m_MediPackCooldown = 15;
}
if (KEY_DOWN(DIK_9) && Inv_RequestItem(O_LARGE_MEDIPACK_OPTION)) {
if (m_MediPackCooldown == 0) {
Lara_UseItem(O_LARGE_MEDIPACK_OPTION);

if (KEY_DOWN(DIK_8) && Inv_RequestItem(O_SMALL_MEDIPACK_OPTION)) {
if (m_MediPackCooldown == 0) {
Lara_UseItem(O_SMALL_MEDIPACK_OPTION);
}
m_MediPackCooldown = 15;
}
if (KEY_DOWN(DIK_9) && Inv_RequestItem(O_LARGE_MEDIPACK_OPTION)) {
if (m_MediPackCooldown == 0) {
Lara_UseItem(O_LARGE_MEDIPACK_OPTION);
}
m_MediPackCooldown = 15;
}
m_MediPackCooldown = 15;
}

if (m_MediPackCooldown > 0) {
m_MediPackCooldown--;
if (m_MediPackCooldown > 0) {
m_MediPackCooldown--;
}
}

if (KEY_DOWN(DIK_S)) {
Expand Down

0 comments on commit f7ebd28

Please sign in to comment.