This commit is contained in:
Christoph Oelckers 2020-05-19 21:21:55 +02:00
parent 7ec3232a3a
commit df545d34eb
3 changed files with 27 additions and 26 deletions

View file

@ -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

View file

@ -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)

View file

@ -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