diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 8a73ff911..28d6d4fb1 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -792,4 +792,30 @@ void playerAimDown(int snum, int sb_snum) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int haskey(int sect, int snum) +{ + auto p = &ps[snum]; + if (!g_sectorExtra[sect]) + return 1; + if (g_sectorExtra[sect] > 6) + return 1; + int wk = g_sectorExtra[sect]; + if (wk > 3) + wk -= 3; + + if (p->keys[wk] == 1) + { + g_sectorExtra[sect] = 0; + return 1; + } + + return 0; +} + END_DUKE_NS diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index 6db73c904..156ba055c 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -426,8 +426,7 @@ int P_GetKneePal(const DukePlayer_t *pPlayer); int P_GetKneePal(const DukePlayer_t *pPlayer, int hudPal); int P_GetOverheadPal(const DukePlayer_t *pPlayer); void madenoise(int playerNum); -int P_HasKey(int sectNum, int playerNum); -#define haskey P_HasKey +int haskey(int sect, int snum); // Get the player index given an TILE_APLAYER sprite pointer. static inline int P_GetP(const void *pSprite) diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 291c488bc..69463cc20 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -2778,28 +2778,4 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer) } - - -int P_HasKey(int sectNum, int playerNum) -{ - if (g_sectorExtra[sectNum] == 0) - return 1; - if (g_sectorExtra[sectNum] > 6) - return 1; - - int key = g_sectorExtra[sectNum]; - if (key > 3) - key -= 3; - - if (g_player[playerNum].ps->keys[key] == 1) - { - g_sectorExtra[sectNum] = 0; - return 1; - } - return 0; -} - -int16_t max_ammo_amount[MAX_WEAPONS]; - - END_DUKE_NS