mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 20:40:39 +00:00
- Exhumed: Clean up player accesses in gun.cpp
and associated utilities.
This commit is contained in:
parent
27a41121ec
commit
f3ef64b2ac
11 changed files with 98 additions and 105 deletions
|
@ -50,7 +50,7 @@ void FuncAnubis(int, int a, int b, int c);
|
|||
|
||||
void BuildBubbleMachine(DExhumedActor* nSprite);
|
||||
void DoBubbleMachines();
|
||||
void DoBubbles(int nPlayer);
|
||||
void DoBubbles(DExhumedPlayer* const pPlayer);
|
||||
void FuncBubble(int, int, int, int);
|
||||
|
||||
// bullet
|
||||
|
@ -128,16 +128,16 @@ struct Weapon
|
|||
|
||||
extern Weapon WeaponInfo[];
|
||||
|
||||
void RestoreMinAmmo(int nPlayer);
|
||||
void FillWeapons(int nPlayer);
|
||||
void ResetPlayerWeapons(int nPlayer);
|
||||
void RestoreMinAmmo(DExhumedPlayer* const pPlayer);
|
||||
void FillWeapons(DExhumedPlayer* const pPlayer);
|
||||
void ResetPlayerWeapons(DExhumedPlayer* const pPlayer);
|
||||
void InitWeapons();
|
||||
void SetNewWeapon(DExhumedPlayer* const pPlayer, int nWeapon);
|
||||
void SetNewWeaponImmediate(DExhumedPlayer* const pPlayer, int nWeapon);
|
||||
void SetNewWeaponIfBetter(DExhumedPlayer* const pPlayer, int nWeapon);
|
||||
void SelectNewWeapon(DExhumedPlayer* const pPlayer);
|
||||
void CheckClip(int nPlayer);
|
||||
void MoveWeapons(int nPlayer);
|
||||
void CheckClip(DExhumedPlayer* const pPlayer);
|
||||
void MoveWeapons(DExhumedPlayer* const pPlayer);
|
||||
void DrawWeapons(DExhumedPlayer* const pPlayer, double interpfrac);
|
||||
|
||||
// items
|
||||
|
@ -182,7 +182,7 @@ void UndoFlashes();
|
|||
void DoLights();
|
||||
void AddFlow(sectortype* pSect, int nSpeed, int b, DAngle ang = -minAngle);
|
||||
void AddFlow(walltype* pWall, int nSpeed, int b);
|
||||
void BuildFlash(int nPlayer, int nVal);
|
||||
void BuildFlash(DExhumedPlayer* const pPlayer, int nVal);
|
||||
void AddGlow(sectortype* pSector, int nVal);
|
||||
void AddFlicker(sectortype* pSector, int nVal);
|
||||
|
||||
|
@ -214,7 +214,7 @@ void Gravity(DExhumedActor* actor);
|
|||
DExhumedActor* UpdateEnemy(DExhumedActor** ppEnemy);
|
||||
Collision MoveCreature(DExhumedActor* nSprite);
|
||||
Collision MoveCreatureWithCaution(DExhumedActor* actor);
|
||||
DVector3 WheresMyMouth(int nPlayer, sectortype** sectnum);
|
||||
DVector3 WheresMyMouth(DExhumedPlayer* const pPlayer, sectortype** sectnum);
|
||||
double GetActorHeight(DExhumedActor* nSprite);
|
||||
DExhumedActor* insertActor(sectortype* s, int st);
|
||||
DExhumedActor* GrabBody();
|
||||
|
@ -725,7 +725,7 @@ extern FreeListArray<Snake, kMaxSnakes> SnakeList;
|
|||
|
||||
void InitSnakes();
|
||||
int GrabSnake();
|
||||
void BuildSnake(int nPlayer, double zVal);
|
||||
void BuildSnake(DExhumedPlayer* const pPlayer, double zVal);
|
||||
void FuncSnake(int, int, int, int);
|
||||
|
||||
// spider
|
||||
|
|
|
@ -177,11 +177,11 @@ void BuildBubbleMachine(DExhumedActor* pActor)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DoBubbles(int nPlayer)
|
||||
void DoBubbles(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
sectortype* pSector;
|
||||
const auto pos = WheresMyMouth(nPlayer, &pSector);
|
||||
const auto pActor = BuildBubble(pos, pSector, nPlayer);
|
||||
pActor->spr.hitag = nPlayer;
|
||||
const auto pos = WheresMyMouth(pPlayer, &pSector);
|
||||
const auto pActor = BuildBubble(pos, pSector, pPlayer->pnum);
|
||||
pActor->spr.hitag = pPlayer->pnum;
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
|
@ -256,7 +256,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
|
|||
|
||||
if (buttons & kButtonCheatGuns) // LOBOCOP cheat
|
||||
{
|
||||
FillWeapons(player);
|
||||
FillWeapons(pPlayer);
|
||||
if (player == myconnectindex) Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_WEAPONS"));
|
||||
}
|
||||
if (buttons & kButtonCheatKeys) // LOBOPICK cheat
|
||||
|
|
|
@ -78,9 +78,10 @@ void GameInterface::Render()
|
|||
|
||||
if (nFreeze != 2) // Hide when Ramses is talking.
|
||||
{
|
||||
const auto pPlayer = getPlayer(nLocalPlayer);
|
||||
DrawStatusBar();
|
||||
auto offsets = getPlayer(nLocalPlayer)->Angles.getCrosshairOffsets(interpfrac);
|
||||
DrawCrosshair(getPlayer(nLocalPlayer)->nHealth >> 3, offsets.first.X, offsets.first.Y, 1, offsets.second);
|
||||
auto offsets = pPlayer->Angles.getCrosshairOffsets(interpfrac);
|
||||
DrawCrosshair(pPlayer->nHealth >> 3, offsets.first.X, offsets.first.Y, 1, offsets.second);
|
||||
|
||||
if (paused && !M_Active())
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ void SerializeGun(FSerializer& arc)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void RestoreMinAmmo(int nPlayer)
|
||||
void RestoreMinAmmo(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
for (int i = 0; i < kMaxWeapons; i++)
|
||||
{
|
||||
|
@ -78,15 +78,15 @@ void RestoreMinAmmo(int nPlayer)
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((1 << i) & getPlayer(nPlayer)->nPlayerWeapons)
|
||||
if ((1 << i) & pPlayer->nPlayerWeapons)
|
||||
{
|
||||
if (nMinAmmo[i] > getPlayer(nPlayer)->nAmmo[i]) {
|
||||
getPlayer(nPlayer)->nAmmo[i] = nMinAmmo[i];
|
||||
if (nMinAmmo[i] > pPlayer->nAmmo[i]) {
|
||||
pPlayer->nAmmo[i] = nMinAmmo[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckClip(nPlayer);
|
||||
CheckClip(pPlayer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -95,18 +95,18 @@ void RestoreMinAmmo(int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void FillWeapons(int nPlayer)
|
||||
void FillWeapons(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
getPlayer(nPlayer)->nPlayerWeapons = 0xFFFF; // turn on all bits
|
||||
pPlayer->nPlayerWeapons = 0xFFFF; // turn on all bits
|
||||
|
||||
for (int i = 0; i < kMaxWeapons; i++)
|
||||
{
|
||||
if (WeaponInfo[i].d) {
|
||||
getPlayer(nPlayer)->nAmmo[i] = 300;
|
||||
pPlayer->nAmmo[i] = 300;
|
||||
}
|
||||
}
|
||||
|
||||
CheckClip(nPlayer);
|
||||
CheckClip(pPlayer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -115,19 +115,19 @@ void FillWeapons(int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ResetPlayerWeapons(int nPlayer)
|
||||
void ResetPlayerWeapons(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
for (int i = 0; i < kMaxWeapons; i++)
|
||||
{
|
||||
getPlayer(nPlayer)->nAmmo[i] = 0;
|
||||
pPlayer->nAmmo[i] = 0;
|
||||
}
|
||||
|
||||
getPlayer(nPlayer)->nCurrentWeapon = 0;
|
||||
getPlayer(nPlayer)->nState = 0;
|
||||
getPlayer(nPlayer)->nWeapFrame = 0;
|
||||
pPlayer->nCurrentWeapon = 0;
|
||||
pPlayer->nState = 0;
|
||||
pPlayer->nWeapFrame = 0;
|
||||
|
||||
getPlayer(nPlayer)->pPlayerGrenade = nullptr;
|
||||
getPlayer(nPlayer)->nPlayerWeapons = 0x1; // turn on bit 1 only
|
||||
pPlayer->pPlayerGrenade = nullptr;
|
||||
pPlayer->nPlayerWeapons = 0x1; // turn on bit 1 only
|
||||
}
|
||||
|
||||
void InitWeapons()
|
||||
|
@ -245,7 +245,7 @@ void SelectNewWeapon(DExhumedPlayer* const pPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void SetWeaponStatus(int nPlayer)
|
||||
static void SetWeaponStatus(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -255,16 +255,16 @@ void SetWeaponStatus(int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
uint8_t WeaponCanFire(int nPlayer)
|
||||
static uint8_t WeaponCanFire(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
int nWeapon = getPlayer(nPlayer)->nCurrentWeapon;
|
||||
auto pSector =getPlayer(nPlayer)->pPlayerViewSect;
|
||||
int nWeapon = pPlayer->nCurrentWeapon;
|
||||
auto pSector = pPlayer->pPlayerViewSect;
|
||||
|
||||
if (!(pSector->Flag & kSectUnderwater) || WeaponInfo[nWeapon].bFireUnderwater)
|
||||
{
|
||||
int nAmmoType = WeaponInfo[nWeapon].nAmmoType;
|
||||
|
||||
if (WeaponInfo[nWeapon].d <= getPlayer(nPlayer)->nAmmo[nAmmoType]) {
|
||||
if (WeaponInfo[nWeapon].d <= pPlayer->nAmmo[nAmmoType]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -285,9 +285,9 @@ void ResetSwordSeqs()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector)
|
||||
static Collision CheckCloseRange(DExhumedPlayer* const pPlayer, DVector3& pos, sectortype* *ppSector)
|
||||
{
|
||||
auto pActor = getPlayer(nPlayer)->GetActor();
|
||||
auto pActor = pPlayer->GetActor();
|
||||
|
||||
HitInfo hit{};
|
||||
hitscan(pos, *ppSector, DVector3(pActor->spr.Angles.Yaw.ToVector() * 1024, 0 ), hit, CLIPMASK1);
|
||||
|
@ -320,10 +320,8 @@ Collision CheckCloseRange(int nPlayer, DVector3& pos, sectortype* *ppSector)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void CheckClip(int nPlayer)
|
||||
void CheckClip(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
const auto pPlayer = getPlayer(nPlayer);
|
||||
|
||||
if (pPlayer->nPlayerClip <= 0)
|
||||
pPlayer->nPlayerClip = min(pPlayer->nAmmo[kWeaponM60], (int16_t)100);
|
||||
|
||||
|
@ -337,10 +335,9 @@ void CheckClip(int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void MoveWeapons(int nPlayer)
|
||||
void MoveWeapons(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
const auto pPlayer = getPlayer(nPlayer);
|
||||
|
||||
const auto pRa = &Ra[pPlayer->pnum];
|
||||
static int dword_96E22 = 0;
|
||||
|
||||
int nSectFlag = pPlayer->pPlayerViewSect->Flag;
|
||||
|
@ -403,14 +400,14 @@ void MoveWeapons(int nPlayer)
|
|||
case 0:
|
||||
{
|
||||
pPlayer->nState = 1;
|
||||
SetWeaponStatus(nPlayer);
|
||||
SetWeaponStatus(pPlayer);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (pPlayer->bIsFiring)
|
||||
{
|
||||
if (!WeaponCanFire(nPlayer))
|
||||
if (!WeaponCanFire(pPlayer))
|
||||
{
|
||||
if (!dword_96E22) {
|
||||
D3PlayFX(StaticSound[4], pPlayer->GetActor());
|
||||
|
@ -420,12 +417,12 @@ void MoveWeapons(int nPlayer)
|
|||
{
|
||||
if (nWeapon == kWeaponRing)
|
||||
{
|
||||
if (Ra[nPlayer].pTarget == nullptr)
|
||||
if (pRa->pTarget == nullptr)
|
||||
break;
|
||||
|
||||
Ra[nPlayer].nAction = 0;
|
||||
Ra[nPlayer].nFrame = 0;
|
||||
Ra[nPlayer].nState = 1;
|
||||
pRa->nAction = 0;
|
||||
pRa->nFrame = 0;
|
||||
pRa->nState = 1;
|
||||
}
|
||||
|
||||
pPlayer->nState = 2;
|
||||
|
@ -440,7 +437,7 @@ void MoveWeapons(int nPlayer)
|
|||
}
|
||||
else if (nWeapon == kWeaponMummified)
|
||||
{
|
||||
ShootStaff(nPlayer);
|
||||
ShootStaff(pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +483,7 @@ void MoveWeapons(int nPlayer)
|
|||
else
|
||||
{
|
||||
// loc_26D88:
|
||||
if (pPlayer->bIsFiring && WeaponCanFire(nPlayer))
|
||||
if (pPlayer->bIsFiring && WeaponCanFire(pPlayer))
|
||||
{
|
||||
if (nWeapon != kWeaponM60 && nWeapon != kWeaponPistol) {
|
||||
pPlayer->nState = 3;
|
||||
|
@ -545,12 +542,12 @@ void MoveWeapons(int nPlayer)
|
|||
SelectNewWeapon(pPlayer);
|
||||
}
|
||||
|
||||
Ra[nPlayer].nState = 0;
|
||||
pRa->nState = 0;
|
||||
break;
|
||||
}
|
||||
else if (nWeapon == kWeaponM60)
|
||||
{
|
||||
CheckClip(nPlayer);
|
||||
CheckClip(pPlayer);
|
||||
pPlayer->nState = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -572,7 +569,7 @@ void MoveWeapons(int nPlayer)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (pPlayer->bIsFiring && WeaponCanFire(nPlayer)) {
|
||||
if (pPlayer->bIsFiring && WeaponCanFire(pPlayer)) {
|
||||
pPlayer->nState = 2;
|
||||
break;
|
||||
}
|
||||
|
@ -610,7 +607,7 @@ void MoveWeapons(int nPlayer)
|
|||
pPlayer->nState = 0;
|
||||
pPlayer->nNextWeapon = -1;
|
||||
|
||||
SetWeaponStatus(nPlayer);
|
||||
SetWeaponStatus(pPlayer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +641,7 @@ loc_flag:
|
|||
|
||||
if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (seqFrame->flags & 4))
|
||||
{
|
||||
BuildFlash(nPlayer, 512);
|
||||
BuildFlash(pPlayer, 512);
|
||||
AddFlash(
|
||||
pPlayerActor->sector(),
|
||||
pPlayerActor->spr.pos,
|
||||
|
@ -661,7 +658,7 @@ loc_flag:
|
|||
var_38 = 0;
|
||||
}
|
||||
|
||||
if (nPlayer == nLocalPlayer) {
|
||||
if (pPlayer->pnum == nLocalPlayer) {
|
||||
pPlayer->nPrevWeapBob = pPlayer->nWeapBob = 512;
|
||||
}
|
||||
|
||||
|
@ -718,7 +715,7 @@ loc_flag:
|
|||
newState = 9;
|
||||
}
|
||||
|
||||
auto cRange = CheckCloseRange(nPlayer, thePos, &pSectorB);
|
||||
auto cRange = CheckCloseRange(pPlayer, thePos, &pSectorB);
|
||||
|
||||
if (cRange.type != kHitNone)
|
||||
{
|
||||
|
@ -780,7 +777,7 @@ loc_flag:
|
|||
{
|
||||
if (nSectFlag & kSectUnderwater)
|
||||
{
|
||||
DoBubbles(nPlayer);
|
||||
DoBubbles(pPlayer);
|
||||
pPlayer->nState = 1;
|
||||
pPlayer->nWeapFrame = 0;
|
||||
StopActorSound(pPlayerActor);
|
||||
|
@ -814,7 +811,7 @@ loc_flag:
|
|||
nHeight += h;
|
||||
|
||||
DExhumedActor* target = nullptr;
|
||||
if (pPlayer->pTarget != nullptr && Autoaim(nPlayer))
|
||||
if (pPlayer->pTarget != nullptr && Autoaim(pPlayer->pnum))
|
||||
{
|
||||
DExhumedActor* t = pPlayer->pTarget;
|
||||
// only autoaim if target is in front of the player.
|
||||
|
@ -839,7 +836,7 @@ loc_flag:
|
|||
}
|
||||
case kWeaponStaff:
|
||||
{
|
||||
BuildSnake(nPlayer, nHeight);
|
||||
BuildSnake(pPlayer, nHeight);
|
||||
pPlayer->nQuake = 2.;
|
||||
|
||||
pPlayer->nThrust -= pPlayerActor->spr.Angles.Yaw.ToVector() * 2;
|
||||
|
|
|
@ -219,7 +219,7 @@ void InitNewGame()
|
|||
I_Error("Can't create local player\n");
|
||||
}
|
||||
|
||||
InitPlayerInventory(nPlayer);
|
||||
InitPlayerInventory(getPlayer(nPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -814,9 +814,9 @@ void SetTorch(int nPlayer, int bTorchOnOff)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void BuildFlash(int nPlayer, int nVal)
|
||||
void BuildFlash(DExhumedPlayer* const pPlayer, int nVal)
|
||||
{
|
||||
if (nPlayer == nLocalPlayer)
|
||||
if (pPlayer->pnum == nLocalPlayer)
|
||||
{
|
||||
flash = nVal;
|
||||
flash = -nVal; // ???
|
||||
|
|
|
@ -1013,9 +1013,9 @@ Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshol
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DVector3 WheresMyMouth(int nPlayer, sectortype **sectnum)
|
||||
DVector3 WheresMyMouth(DExhumedPlayer* const pPlayer, sectortype **sectnum)
|
||||
{
|
||||
auto pActor = getPlayer(nPlayer)->GetActor();
|
||||
auto pActor = pPlayer->GetActor();
|
||||
double height = GetActorHeight(pActor) * 0.5;
|
||||
|
||||
*sectnum = pActor->sector();
|
||||
|
|
|
@ -132,12 +132,11 @@ void InitPlayerKeys(int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void InitPlayerInventory(int nPlayer)
|
||||
void InitPlayerInventory(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
const auto pPlayer = getPlayer(nPlayer);
|
||||
pPlayer->Clear();
|
||||
|
||||
ResetPlayerWeapons(nPlayer);
|
||||
ResetPlayerWeapons(pPlayer);
|
||||
|
||||
pPlayer->nItem = -1;
|
||||
pPlayer->nPlayerSwear = 4;
|
||||
|
@ -150,15 +149,15 @@ void InitPlayerInventory(int nPlayer)
|
|||
pPlayer->nCurrentWeapon = 0;
|
||||
pPlayer->nPlayerScore = 0;
|
||||
|
||||
if (nPlayer == nLocalPlayer)
|
||||
if (pPlayer->pnum == nLocalPlayer)
|
||||
automapMode = am_off;
|
||||
|
||||
|
||||
auto tex = aTexIds[kTexPlayermarker1 + nPlayer];
|
||||
auto tex = aTexIds[kTexPlayermarker1 + pPlayer->pnum];
|
||||
auto texp = TexMan.GetGameTexture(tex);
|
||||
auto pixels = GetRawPixels(tex);
|
||||
|
||||
getPlayer(nPlayer)->nPlayerColor = pixels[texp->GetTexelWidth() * texp->GetTexelHeight() / 2];
|
||||
pPlayer->nPlayerColor = pixels[texp->GetTexelWidth() * texp->GetTexelHeight() / 2];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -318,11 +317,11 @@ void RestartPlayer(int nPlayer)
|
|||
|
||||
if (!(currentLevel->gameflags & LEVEL_EX_MULTI))
|
||||
{
|
||||
RestoreMinAmmo(nPlayer);
|
||||
RestoreMinAmmo(pPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetPlayerWeapons(nPlayer);
|
||||
ResetPlayerWeapons(pPlayer);
|
||||
pPlayer->nMagic = 0;
|
||||
}
|
||||
|
||||
|
@ -466,11 +465,9 @@ void SetPlayerMummified(DExhumedPlayer* const pPlayer, int bIsMummified)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ShootStaff(int nPlayer)
|
||||
void ShootStaff(DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
const auto pPlayer = getPlayer(nPlayer);
|
||||
const auto pPlayerActor = pPlayer->GetActor();
|
||||
|
||||
pPlayerActor->nAction = 15;
|
||||
pPlayerActor->nFrame = 0;
|
||||
pPlayerActor->nSeqFile = "joe";
|
||||
|
@ -759,7 +756,7 @@ static void doPickupWeapon(DExhumedPlayer* pPlayer, DExhumedActor* pPickupActor,
|
|||
}
|
||||
|
||||
if (nWeapon == 2)
|
||||
CheckClip(pPlayer->pnum);
|
||||
CheckClip(pPlayer);
|
||||
|
||||
if (nItem > 50)
|
||||
{
|
||||
|
@ -847,7 +844,7 @@ void doPlayerItemPickups(DExhumedPlayer* const pPlayer)
|
|||
case 8: // M - 60 Ammo Belt
|
||||
if (AddAmmo(pPlayer, ammoArray[nItem - 6], pPickupActor->spr.hitag))
|
||||
{
|
||||
if (nItem == 8) CheckClip(pPlayer->pnum);
|
||||
if (nItem == 8) CheckClip(pPlayer);
|
||||
doPickupDestroy(pPickupActor, nItem);
|
||||
doPickupNotification(pPlayer, nItem, StaticSound[kSoundAmmoPickup]);
|
||||
}
|
||||
|
@ -1464,7 +1461,7 @@ static void doPlayerUnderwater(DExhumedPlayer* const pPlayer, const bool oUnderw
|
|||
}
|
||||
}
|
||||
|
||||
DoBubbles(pPlayer->pnum);
|
||||
DoBubbles(pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1982,7 +1979,7 @@ static void doPlayerActionSequence(DExhumedPlayer* const pPlayer)
|
|||
if (!RandomSize(5))
|
||||
{
|
||||
sectortype* mouthSect;
|
||||
const auto pos = WheresMyMouth(pPlayer->pnum, &mouthSect);
|
||||
const auto pos = WheresMyMouth(pPlayer, &mouthSect);
|
||||
BuildAnim(nullptr, "blood", 0, DVector3(pos.XY(), pPlayerActor->spr.pos.Z + 15), mouthSect, 1.171875, 128);
|
||||
}
|
||||
break;
|
||||
|
@ -2082,7 +2079,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
|
||||
doPlayerActionSequence(pPlayer);
|
||||
updatePlayerDoppleActor(pPlayer);
|
||||
MoveWeapons(nPlayer);
|
||||
MoveWeapons(pPlayer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -23,13 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
void SetSavePoint(int nPlayer, const DVector3& pos, sectortype* pSector, DAngle nAngle);
|
||||
void InitPlayer();
|
||||
void InitPlayerKeys(int nPlayer);
|
||||
int GrabPlayer();
|
||||
void InitPlayerInventory(int nPlayer);
|
||||
void RestartPlayer(int nPlayer);
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxPlayers = 8,
|
||||
|
@ -138,10 +131,16 @@ extern TObjPtr<DExhumedActor*> nNetStartSprite[kMaxPlayers];
|
|||
extern int nNetStartSprites;
|
||||
extern int nCurStartSprite;
|
||||
|
||||
void SetSavePoint(int nPlayer, const DVector3& pos, sectortype* pSector, DAngle nAngle);
|
||||
void InitPlayer();
|
||||
void InitPlayerKeys(int nPlayer);
|
||||
int GrabPlayer();
|
||||
void InitPlayerInventory(DExhumedPlayer* const pPlayer);
|
||||
void RestartPlayer(int nPlayer);
|
||||
int GetPlayerFromActor(DExhumedActor* actor);
|
||||
void SetPlayerMummified(DExhumedPlayer* const pPlayer, int bIsMummified);
|
||||
int AddAmmo(DExhumedPlayer* const pPlayer, int nWeapon, int nAmmoAmount);
|
||||
void ShootStaff(int nPlayer);
|
||||
void ShootStaff(DExhumedPlayer* const pPlayer);
|
||||
void updatePlayerTarget(DExhumedPlayer* const pPlayer);
|
||||
|
||||
inline void doPlayerVertPanning(DExhumedPlayer* const pPlayer, const double nDestVertPan)
|
||||
|
|
|
@ -128,17 +128,17 @@ void DestroySnake(int nSnake)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer)
|
||||
static void ExplodeSnakeSprite(DExhumedActor* pActor, DExhumedPlayer* const pPlayer)
|
||||
{
|
||||
int nDamage = BulletInfo[kWeaponStaff].nDamage;
|
||||
|
||||
if (getPlayer(nPlayer)->nDouble > 0) {
|
||||
if (pPlayer->nDouble > 0) {
|
||||
nDamage *= 2;
|
||||
}
|
||||
|
||||
// take a copy of this, to revert after call to runlist_RadialDamageEnemy()
|
||||
DExhumedActor* nOwner = pActor->pTarget;
|
||||
pActor->pTarget = getPlayer(nPlayer)->GetActor();
|
||||
pActor->pTarget = pPlayer->GetActor();
|
||||
|
||||
runlist_RadialDamageEnemy(pActor, nDamage, BulletInfo[kWeaponStaff].nRadius);
|
||||
|
||||
|
@ -157,14 +157,13 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void BuildSnake(int nPlayer, double zVal)
|
||||
void BuildSnake(DExhumedPlayer* const pPlayer, double zVal)
|
||||
{
|
||||
zVal -= 5;
|
||||
|
||||
auto pPlayerActor = getPlayer(nPlayer)->GetActor();
|
||||
auto pViewSect = getPlayer(nPlayer)->pPlayerViewSect;
|
||||
auto pPlayerActor = pPlayer->GetActor();
|
||||
auto pViewSect = pPlayer->pPlayerViewSect;
|
||||
auto nPic = getSequence("snakbody", 0)->getFirstFrameTexture();
|
||||
|
||||
auto pos = pPlayerActor->spr.pos.plusZ(zVal - 10);
|
||||
|
||||
HitInfo hit{};
|
||||
|
@ -178,7 +177,7 @@ void BuildSnake(int nPlayer, double zVal)
|
|||
auto pActor = insertActor(hit.hitSector, 202);
|
||||
pActor->spr.pos = hit.hitpos;
|
||||
|
||||
ExplodeSnakeSprite(pActor, nPlayer);
|
||||
ExplodeSnakeSprite(pActor, pPlayer);
|
||||
DeleteActor(pActor);
|
||||
return;
|
||||
}
|
||||
|
@ -189,9 +188,9 @@ void BuildSnake(int nPlayer, double zVal)
|
|||
if (hitactor && hitactor->spr.statnum >= 90 && hitactor->spr.statnum <= 199) {
|
||||
pTarget = hitactor;
|
||||
}
|
||||
else if (getPlayer(nPlayer)->pTarget != nullptr)
|
||||
else if (pPlayer->pTarget != nullptr)
|
||||
{
|
||||
pTarget = getPlayer(nPlayer)->pTarget;
|
||||
pTarget = pPlayer->pTarget;
|
||||
}
|
||||
|
||||
int nSnake = GrabSnake();
|
||||
|
@ -254,8 +253,8 @@ void BuildSnake(int nPlayer, double zVal)
|
|||
SnakeList[nSnake].pEnemy = pTarget;
|
||||
SnakeList[nSnake].nCountdown = 0;
|
||||
SnakeList[nSnake].nAngle = 0;
|
||||
SnakeList[nSnake].nSnakePlayer = nPlayer;
|
||||
nPlayerSnake[nPlayer] = nSnake;
|
||||
SnakeList[nSnake].nSnakePlayer = pPlayer->pnum;
|
||||
nPlayerSnake[pPlayer->pnum] = nSnake;
|
||||
|
||||
if (bSnakeCam)
|
||||
{
|
||||
|
@ -373,7 +372,7 @@ void AISnake::Tick(RunListEvent* ev)
|
|||
if (nMov.type || nMov.exbits)
|
||||
{
|
||||
int nPlayer = SnakeList[nSnake].nSnakePlayer;
|
||||
ExplodeSnakeSprite(SnakeList[nSnake].pSprites[0], nPlayer);
|
||||
ExplodeSnakeSprite(SnakeList[nSnake].pSprites[0], getPlayer(nPlayer));
|
||||
|
||||
nPlayerSnake[nPlayer] = -1;
|
||||
SnakeList[nSnake].nSnakePlayer = -1;
|
||||
|
|
Loading…
Reference in a new issue