mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-02 11:51:25 +00:00
Make a couple of player functions take player indices instead of DukePlayer_t *.
git-svn-id: https://svn.eduke32.com/eduke32@4227 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
efdd31d5a9
commit
9b045deb4b
4 changed files with 30 additions and 27 deletions
|
@ -1440,7 +1440,8 @@ skip_check:
|
||||||
|
|
||||||
case CON_TOSSWEAPON:
|
case CON_TOSSWEAPON:
|
||||||
insptr++;
|
insptr++;
|
||||||
P_DropWeapon(g_player[P_GetP(vm.g_sp)].ps);
|
// NOTE: assumes that current actor is APLAYER
|
||||||
|
P_DropWeapon(P_GetP(vm.g_sp));
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case CON_NULLOP:
|
case CON_NULLOP:
|
||||||
|
|
|
@ -591,6 +591,7 @@ local function have_ammo_at_max(ps, weap)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _tossweapon(pli) -- P_DropWeapon replacement
|
function _tossweapon(pli) -- P_DropWeapon replacement
|
||||||
|
-- NOTE: We're passing player index, C-CON passes APLAYER sprite.
|
||||||
check_player_idx(pli)
|
check_player_idx(pli)
|
||||||
local ps = ffiC.g_player[pli].ps
|
local ps = ffiC.g_player[pli].ps
|
||||||
|
|
||||||
|
|
|
@ -1902,9 +1902,10 @@ void P_SetWeaponGamevars(int32_t snum, const DukePlayer_t *p)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void P_FireWeapon(DukePlayer_t *p)
|
static void P_FireWeapon(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t i, snum = P_Get(p->i); // TODO: PASS_SNUM?
|
int32_t i;
|
||||||
|
DukePlayer_t *const p = g_player[snum].ps;
|
||||||
|
|
||||||
if (VM_OnEvent(EVENT_DOFIRE, p->i, snum, -1, 0) == 0)
|
if (VM_OnEvent(EVENT_DOFIRE, p->i, snum, -1, 0) == 0)
|
||||||
{
|
{
|
||||||
|
@ -1959,9 +1960,10 @@ static void P_FireWeapon(DukePlayer_t *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_DoWeaponSpawn(const DukePlayer_t *p)
|
static void P_DoWeaponSpawn(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t j, snum = P_Get(p->i); // TODO: PASS_SNUM?
|
int32_t j;
|
||||||
|
const DukePlayer_t *const p = g_player[snum].ps;
|
||||||
|
|
||||||
// NOTE: For the 'Spawn' member, 0 means 'none', too (originally so,
|
// NOTE: For the 'Spawn' member, 0 means 'none', too (originally so,
|
||||||
// i.e. legacy). The check for <0 was added to the check because mod
|
// i.e. legacy). The check for <0 was added to the check because mod
|
||||||
|
@ -2953,15 +2955,13 @@ void P_GetInput(int32_t snum)
|
||||||
loc.horz = horiz;
|
loc.horz = horiz;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t P_DoCounters(DukePlayer_t *p)
|
static int32_t P_DoCounters(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t snum = P_Get(p->i);
|
DukePlayer_t *const p = g_player[snum].ps;
|
||||||
|
|
||||||
// j = g_player[snum].sync->avel;
|
// j = g_player[snum].sync->avel;
|
||||||
// p->weapon_ang = -(j/5);
|
// p->weapon_ang = -(j/5);
|
||||||
|
|
||||||
if (snum < 0) return 1;
|
|
||||||
|
|
||||||
if (p->invdisptime > 0)
|
if (p->invdisptime > 0)
|
||||||
p->invdisptime--;
|
p->invdisptime--;
|
||||||
|
|
||||||
|
@ -3160,9 +3160,9 @@ int16_t WeaponPickupSprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATI
|
||||||
TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC
|
TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC
|
||||||
};
|
};
|
||||||
// this is used for player deaths
|
// this is used for player deaths
|
||||||
void P_DropWeapon(DukePlayer_t *p)
|
void P_DropWeapon(int32_t snum)
|
||||||
{
|
{
|
||||||
int32_t snum = P_Get(p->i); // TODO: PASS_SNUM?
|
const DukePlayer_t *const p = g_player[snum].ps;
|
||||||
int32_t cw = PWEAPON(snum, p->curr_weapon, WorksLike);
|
int32_t cw = PWEAPON(snum, p->curr_weapon, WorksLike);
|
||||||
|
|
||||||
if ((unsigned)cw >= MAX_WEAPONS)
|
if ((unsigned)cw >= MAX_WEAPONS)
|
||||||
|
@ -3206,7 +3206,7 @@ static void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
|
||||||
A_PlaySound(PWEAPON(snum, weapon, SelectSound),p->i);
|
A_PlaySound(PWEAPON(snum, weapon, SelectSound),p->i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon)
|
static void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon)
|
||||||
{
|
{
|
||||||
int32_t i = 0, snum = P_Get(p->i); // PASS_SNUM?
|
int32_t i = 0, snum = P_Get(p->i); // PASS_SNUM?
|
||||||
const int8_t curr_weapon = p->curr_weapon;
|
const int8_t curr_weapon = p->curr_weapon;
|
||||||
|
@ -4004,7 +4004,7 @@ static void P_ProcessWeapon(int32_t snum)
|
||||||
A_PlaySound(PWEAPON(snum, p->curr_weapon, Sound2Sound),p->i);
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, Sound2Sound),p->i);
|
||||||
|
|
||||||
if (*kb == PWEAPON(snum, p->curr_weapon, SpawnTime))
|
if (*kb == PWEAPON(snum, p->curr_weapon, SpawnTime))
|
||||||
P_DoWeaponSpawn(p);
|
P_DoWeaponSpawn(snum);
|
||||||
|
|
||||||
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
||||||
{
|
{
|
||||||
|
@ -4074,21 +4074,21 @@ static void P_ProcessWeapon(int32_t snum)
|
||||||
{
|
{
|
||||||
if (((*(kb))%3) == 0)
|
if (((*(kb))%3) == 0)
|
||||||
{
|
{
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
P_DoWeaponSpawn(p);
|
P_DoWeaponSpawn(snum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
||||||
{
|
{
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
P_DoWeaponSpawn(p);
|
P_DoWeaponSpawn(snum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
||||||
{
|
{
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
// P_DoWeaponSpawn(p);
|
// P_DoWeaponSpawn(snum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
||||||
|
@ -4103,21 +4103,21 @@ static void P_ProcessWeapon(int32_t snum)
|
||||||
{
|
{
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
||||||
{
|
{
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
P_DoWeaponSpawn(p);
|
P_DoWeaponSpawn(snum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
||||||
{
|
{
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
// P_DoWeaponSpawn(p);
|
// P_DoWeaponSpawn(snum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
else if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
||||||
P_FireWeapon(p);
|
P_FireWeapon(snum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4472,7 +4472,7 @@ void P_ProcessInput(int32_t snum)
|
||||||
if (p->newowner >= 0)
|
if (p->newowner >= 0)
|
||||||
{
|
{
|
||||||
P_UpdatePosWhenViewingCam(p);
|
P_UpdatePosWhenViewingCam(p);
|
||||||
P_DoCounters(p);
|
P_DoCounters(snum);
|
||||||
|
|
||||||
if (PWEAPON(0, p->curr_weapon, WorksLike) == HANDREMOTE_WEAPON)
|
if (PWEAPON(0, p->curr_weapon, WorksLike) == HANDREMOTE_WEAPON)
|
||||||
P_ProcessWeapon(snum);
|
P_ProcessWeapon(snum);
|
||||||
|
@ -5316,7 +5316,8 @@ HORIZONLY:
|
||||||
p->ang += G_GetAngleDelta(p->ang,getangle(sprite[p->actorsqu].x-p->pos.x,sprite[p->actorsqu].y-p->pos.y))>>2;
|
p->ang += G_GetAngleDelta(p->ang,getangle(sprite[p->actorsqu].x-p->pos.x,sprite[p->actorsqu].y-p->pos.y))>>2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (P_DoCounters(p)) return;
|
if (P_DoCounters(snum))
|
||||||
|
return;
|
||||||
|
|
||||||
P_ProcessWeapon(snum);
|
P_ProcessWeapon(snum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,7 @@ void P_AddWeapon(DukePlayer_t *p,int32_t weapon, int32_t doswitch);
|
||||||
void P_CheckWeapon(DukePlayer_t *p);
|
void P_CheckWeapon(DukePlayer_t *p);
|
||||||
void P_DisplayScuba(int32_t snum);
|
void P_DisplayScuba(int32_t snum);
|
||||||
void P_DisplayWeapon(int32_t snum);
|
void P_DisplayWeapon(int32_t snum);
|
||||||
void P_DropWeapon(DukePlayer_t *p);
|
void P_DropWeapon(int32_t snum);
|
||||||
int32_t P_FindOtherPlayer(int32_t p, int32_t *d);
|
int32_t P_FindOtherPlayer(int32_t p, int32_t *d);
|
||||||
void P_FragPlayer(int32_t snum);
|
void P_FragPlayer(int32_t snum);
|
||||||
void P_UpdatePosWhenViewingCam(DukePlayer_t *p);
|
void P_UpdatePosWhenViewingCam(DukePlayer_t *p);
|
||||||
|
|
Loading…
Reference in a new issue