mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- got rid of PLAYER::pXSprite.
Now the player references its actor through ONE pointer only.
This commit is contained in:
parent
b848a9c980
commit
8d8e0550df
12 changed files with 71 additions and 75 deletions
|
@ -297,8 +297,8 @@ void StartLevel(MapRecord* level, bool newgame)
|
|||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[i];
|
||||
pPlayer->pXSprite->health &= 0xf000;
|
||||
pPlayer->pXSprite->health |= gHealthTemp[i];
|
||||
pPlayer->actor->xspr.health &= 0xf000;
|
||||
pPlayer->actor->xspr.health |= gHealthTemp[i];
|
||||
pPlayer->weaponQav = gPlayerTemp[i].weaponQav;
|
||||
pPlayer->curWeapon = gPlayerTemp[i].curWeapon;
|
||||
pPlayer->weaponState = gPlayerTemp[i].weaponState;
|
||||
|
|
|
@ -54,7 +54,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
if (!SyncInput() && gamestate == GS_LEVEL)
|
||||
{
|
||||
// Perform unsynchronised angle/horizon if not dead.
|
||||
if (gView->pXSprite->health != 0)
|
||||
if (gView->actor->xspr.health != 0)
|
||||
{
|
||||
pPlayer->angle.applyinput(input.avel, &pPlayer->input.actions, scaleAdjust);
|
||||
pPlayer->horizon.applyinput(input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||
|
|
|
@ -143,7 +143,7 @@ void GameInterface::MenuClosed()
|
|||
|
||||
bool GameInterface::CanSave()
|
||||
{
|
||||
return (gamestate == GS_LEVEL && gPlayer[myconnectindex].pXSprite->health != 0);
|
||||
return (gamestate == GS_LEVEL && gPlayer[myconnectindex].actor->xspr.health != 0);
|
||||
}
|
||||
|
||||
FSavegameInfo GameInterface::GetSaveSig()
|
||||
|
|
|
@ -91,7 +91,7 @@ void hudDraw(PLAYER *gView, sectortype* pSector, double bobx, double boby, doubl
|
|||
{
|
||||
double look_anghalf = gView->angle.look_anghalf(smoothratio);
|
||||
|
||||
DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2);
|
||||
DrawCrosshair(kCrosshairTile, gView->actor->xspr.health >> 4, -look_anghalf, 0, 2);
|
||||
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ void hudDraw(PLAYER *gView, sectortype* pSector, double bobx, double boby, doubl
|
|||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
|
||||
else if (gView->actor->xspr.health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
|
||||
else {
|
||||
gView->sceneQav = gView->weaponQav = kQAVNone;
|
||||
gView->qavTimer = gView->weaponTimer = gView->curWeapon = 0;
|
||||
|
@ -136,9 +136,9 @@ void hudDraw(PLAYER *gView, sectortype* pSector, double bobx, double boby, doubl
|
|||
WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
#endif
|
||||
}
|
||||
if (gViewPos == 0 && gView->pXSprite->burnTime > 60)
|
||||
if (gViewPos == 0 && gView->actor->xspr.burnTime > 60)
|
||||
{
|
||||
viewBurnTime(gView->pXSprite->burnTime);
|
||||
viewBurnTime(gView->actor->xspr.burnTime);
|
||||
}
|
||||
if (packItemActive(gView, 1))
|
||||
{
|
||||
|
|
|
@ -278,7 +278,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
if (gGameOptions.nGameType != 0 || numplayers > 1) // sp only for now.
|
||||
return nullptr;
|
||||
|
||||
if (gamestate != GS_LEVEL || gMe->pXSprite->health == 0) // must be alive and in a level to cheat.
|
||||
if (gamestate != GS_LEVEL || gMe->actor->xspr.health == 0) // must be alive and in a level to cheat.
|
||||
return nullptr;
|
||||
|
||||
bPlayerCheated = true;
|
||||
|
@ -308,7 +308,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
|
||||
case kCheatMcGee:
|
||||
{
|
||||
if (!gMe->pXSprite->burnTime)
|
||||
if (!gMe->actor->xspr.burnTime)
|
||||
evPostActor(gMe->actor, 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(gMe->actor, gMe->actor, 2400);
|
||||
return GStrings("TXTB_FIRED");
|
||||
|
@ -321,7 +321,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
{
|
||||
actHealDude(gMe->actor, 200, 200);
|
||||
gMe->armor[1] = VanillaMode() ? 200 : 3200;
|
||||
if (!gMe->pXSprite->burnTime)
|
||||
if (!gMe->actor->xspr.burnTime)
|
||||
evPostActor(gMe->actor, 0, kCallbackFXFlameLick);
|
||||
actBurnSprite(gMe->actor, gMe->actor, 2400);
|
||||
return GStrings("TXTB_RETARD");
|
||||
|
@ -397,7 +397,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
SetKeys(false);
|
||||
SetWooMode(true);
|
||||
powerupActivate(gMe, kPwUpDeliriumShroom);
|
||||
gMe->pXSprite->health = 16;
|
||||
gMe->actor->xspr.health = 16;
|
||||
gMe->hasWeapon[1] = 1;
|
||||
gMe->curWeapon = kWeapNone;
|
||||
gMe->nextWeapon = kWeapPitchFork;
|
||||
|
@ -488,7 +488,7 @@ static void cmd_Give(int player, uint8_t **stream, bool skip)
|
|||
int type = ReadByte(stream);
|
||||
if (skip) return;
|
||||
|
||||
if (numplayers != 1 || gamestate != GS_LEVEL || gMe->pXSprite->health == 0)
|
||||
if (numplayers != 1 || gamestate != GS_LEVEL || gMe->actor->xspr.health == 0)
|
||||
{
|
||||
Printf("give: Cannot give while dead or not in a single-player game.\n");
|
||||
return;
|
||||
|
|
|
@ -1183,10 +1183,10 @@ void nnExtProcessSuperSprites()
|
|||
for (int a = connecthead; a >= 0; a = connectpoint2[a])
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[a];
|
||||
if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->pXSprite->health <= 0)
|
||||
if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->actor->xspr.health <= 0)
|
||||
continue;
|
||||
|
||||
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor, x, y, z, pSect, okDist))
|
||||
if (pPlayer->actor->xspr.health > 0 && CheckProximity(gPlayer->actor, x, y, z, pSect, okDist))
|
||||
{
|
||||
trTriggerSprite(pProx, kCmdSpriteProximity);
|
||||
break;
|
||||
|
@ -1226,7 +1226,7 @@ void nnExtProcessSuperSprites()
|
|||
for (int a = connecthead; a >= 0; a = connectpoint2[a])
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[a];
|
||||
if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->pXSprite->health <= 0)
|
||||
if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->actor->xspr.health <= 0)
|
||||
continue;
|
||||
|
||||
auto plActor = pPlayer->actor;
|
||||
|
@ -2017,7 +2017,7 @@ void trPlayerCtrlStopScene(PLAYER* pPlayer)
|
|||
pPlayer->sceneQav = -1;
|
||||
|
||||
// restore weapon
|
||||
if (pPlayer->pXSprite->health > 0)
|
||||
if (pPlayer->actor->xspr.health > 0)
|
||||
{
|
||||
int oldWeapon = (pXInitiator && pXInitiator->dropMsg != 0) ? pXInitiator->dropMsg : 1;
|
||||
pPlayer->newWeapon = pPlayer->curWeapon = oldWeapon;
|
||||
|
@ -2036,34 +2036,35 @@ void trPlayerCtrlStopScene(PLAYER* pPlayer)
|
|||
void trPlayerCtrlLink(DBloodActor* sourceactor, PLAYER* pPlayer, bool checkCondition)
|
||||
{
|
||||
// save player's sprite index to let the tracking condition know it after savegame loading...
|
||||
sourceactor->prevmarker = pPlayer->actor;
|
||||
auto actor = pPlayer->actor;
|
||||
sourceactor->prevmarker = actor;
|
||||
|
||||
pPlayer->pXSprite->txID = sourceactor->xspr.txID;
|
||||
pPlayer->pXSprite->command = kCmdToggle;
|
||||
pPlayer->pXSprite->triggerOn = sourceactor->xspr.triggerOn;
|
||||
pPlayer->pXSprite->triggerOff = sourceactor->xspr.triggerOff;
|
||||
pPlayer->pXSprite->busyTime = sourceactor->xspr.busyTime;
|
||||
pPlayer->pXSprite->waitTime = sourceactor->xspr.waitTime;
|
||||
pPlayer->pXSprite->restState = sourceactor->xspr.restState;
|
||||
actor->xspr.txID = sourceactor->xspr.txID;
|
||||
actor->xspr.command = kCmdToggle;
|
||||
actor->xspr.triggerOn = sourceactor->xspr.triggerOn;
|
||||
actor->xspr.triggerOff = sourceactor->xspr.triggerOff;
|
||||
actor->xspr.busyTime = sourceactor->xspr.busyTime;
|
||||
actor->xspr.waitTime = sourceactor->xspr.waitTime;
|
||||
actor->xspr.restState = sourceactor->xspr.restState;
|
||||
|
||||
pPlayer->pXSprite->Push = sourceactor->xspr.Push;
|
||||
pPlayer->pXSprite->Impact = sourceactor->xspr.Impact;
|
||||
pPlayer->pXSprite->Vector = sourceactor->xspr.Vector;
|
||||
pPlayer->pXSprite->Touch = sourceactor->xspr.Touch;
|
||||
pPlayer->pXSprite->Sight = sourceactor->xspr.Sight;
|
||||
pPlayer->pXSprite->Proximity = sourceactor->xspr.Proximity;
|
||||
actor->xspr.Push = sourceactor->xspr.Push;
|
||||
actor->xspr.Impact = sourceactor->xspr.Impact;
|
||||
actor->xspr.Vector = sourceactor->xspr.Vector;
|
||||
actor->xspr.Touch = sourceactor->xspr.Touch;
|
||||
actor->xspr.Sight = sourceactor->xspr.Sight;
|
||||
actor->xspr.Proximity = sourceactor->xspr.Proximity;
|
||||
|
||||
pPlayer->pXSprite->Decoupled = sourceactor->xspr.Decoupled;
|
||||
pPlayer->pXSprite->Interrutable = sourceactor->xspr.Interrutable;
|
||||
pPlayer->pXSprite->DudeLockout = sourceactor->xspr.DudeLockout;
|
||||
actor->xspr.Decoupled = sourceactor->xspr.Decoupled;
|
||||
actor->xspr.Interrutable = sourceactor->xspr.Interrutable;
|
||||
actor->xspr.DudeLockout = sourceactor->xspr.DudeLockout;
|
||||
|
||||
pPlayer->pXSprite->data1 = sourceactor->xspr.data1;
|
||||
pPlayer->pXSprite->data2 = sourceactor->xspr.data2;
|
||||
pPlayer->pXSprite->data3 = sourceactor->xspr.data3;
|
||||
pPlayer->pXSprite->data4 = sourceactor->xspr.data4;
|
||||
actor->xspr.data1 = sourceactor->xspr.data1;
|
||||
actor->xspr.data2 = sourceactor->xspr.data2;
|
||||
actor->xspr.data3 = sourceactor->xspr.data3;
|
||||
actor->xspr.data4 = sourceactor->xspr.data4;
|
||||
|
||||
pPlayer->pXSprite->key = sourceactor->xspr.key;
|
||||
pPlayer->pXSprite->dropMsg = sourceactor->xspr.dropMsg;
|
||||
actor->xspr.key = sourceactor->xspr.key;
|
||||
actor->xspr.dropMsg = sourceactor->xspr.dropMsg;
|
||||
|
||||
// let's check if there is tracking condition expecting objects with this TX id
|
||||
if (checkCondition && sourceactor->xspr.txID >= kChannelUser)
|
||||
|
@ -2079,7 +2080,7 @@ void trPlayerCtrlLink(DBloodActor* sourceactor, PLAYER* pPlayer, bool checkCondi
|
|||
{
|
||||
if (!pCond->obj[k].obj.isActor() || pCond->obj[k].obj.actor() != sourceactor) continue;
|
||||
pCond->obj[k].obj = EventObject(pPlayer->actor);
|
||||
pCond->obj[k].cmd = (uint8_t)pPlayer->pXSprite->command;
|
||||
pCond->obj[k].cmd = (uint8_t)pPlayer->actor->xspr.command;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2899,7 +2900,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
|
|||
|
||||
pPlayer->nWaterPal = waterPal;
|
||||
pPlayer->posture = kPostureSwim;
|
||||
pPlayer->pXSprite->burnTime = 0;
|
||||
pPlayer->actor->xspr.burnTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3013,7 +3014,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
|
||||
pPlayer->nWaterPal = waterPal;
|
||||
pPlayer->posture = kPostureSwim;
|
||||
pPlayer->pXSprite->burnTime = 0;
|
||||
pPlayer->actor->xspr.burnTime = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -5723,7 +5724,7 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT& event)
|
|||
|
||||
/// !!! COMMANDS OF THE CURRENT SPRITE, NOT OF THE EVENT !!! ///
|
||||
if ((cmd -= kCmdNumberic) < 0) return true;
|
||||
else if (pPlayer->pXSprite->health <= 0)
|
||||
else if (pPlayer->actor->xspr.health <= 0)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -7081,14 +7082,14 @@ void playerQavSceneReset(PLAYER* pPlayer)
|
|||
|
||||
bool playerSizeShrink(PLAYER* pPlayer, int divider)
|
||||
{
|
||||
pPlayer->pXSprite->scale = 256 / divider;
|
||||
pPlayer->actor->xspr.scale = 256 / divider;
|
||||
playerSetRace(pPlayer, kModeHumanShrink);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool playerSizeGrow(PLAYER* pPlayer, int multiplier)
|
||||
{
|
||||
pPlayer->pXSprite->scale = 256 * multiplier;
|
||||
pPlayer->actor->xspr.scale = 256 * multiplier;
|
||||
playerSetRace(pPlayer, kModeHumanGrown);
|
||||
return true;
|
||||
}
|
||||
|
@ -7096,7 +7097,7 @@ bool playerSizeGrow(PLAYER* pPlayer, int multiplier)
|
|||
bool playerSizeReset(PLAYER* pPlayer)
|
||||
{
|
||||
playerSetRace(pPlayer, kModeHuman);
|
||||
pPlayer->pXSprite->scale = 0;
|
||||
pPlayer->actor->xspr.scale = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -681,7 +681,6 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1);
|
||||
assert(actor->hasX());
|
||||
XSPRITE *pXSprite = &actor->x();
|
||||
pPlayer->pXSprite = pXSprite;
|
||||
pPlayer->actor = actor;
|
||||
DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
||||
pPlayer->pDudeInfo = pDudeInfo;
|
||||
|
@ -701,7 +700,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
actor->spr.flags = 15;
|
||||
pXSprite->burnTime = 0;
|
||||
actor->SetBurnSource(nullptr);
|
||||
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
|
||||
pPlayer->actor->xspr.health = pDudeInfo->startHealth<<4;
|
||||
pPlayer->actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||
pPlayer->bloodlust = 0;
|
||||
pPlayer->horizon.horiz = pPlayer->horizon.horizoff = q16horiz(0);
|
||||
|
@ -792,7 +791,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
if (IsUnderwaterSector(actor->spr.sector()))
|
||||
{
|
||||
pPlayer->posture = 1;
|
||||
pPlayer->pXSprite->medium = kMediumWater;
|
||||
pPlayer->actor->xspr.medium = kMediumWater;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1348,9 +1347,8 @@ void UpdatePlayerSpriteAngle(PLAYER *pPlayer)
|
|||
void doslopetilting(PLAYER* pPlayer, double const scaleAdjust = 1)
|
||||
{
|
||||
auto plActor = pPlayer->actor;
|
||||
auto* const pXSprite = pPlayer->pXSprite;
|
||||
int const florhit = pPlayer->actor->hit.florhit.type;
|
||||
bool const va = pXSprite->height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0;
|
||||
bool const va = plActor->xspr.height < 16 && (florhit == kHitSector || florhit == 0) ? 1 : 0;
|
||||
pPlayer->horizon.calcviewpitch(plActor->spr.pos.vec2, buildang(plActor->spr.ang), va, plActor->spr.sector()->floorstat & CSTAT_SECTOR_SLOPE, plActor->spr.sector(), scaleAdjust);
|
||||
}
|
||||
|
||||
|
@ -2180,10 +2178,9 @@ void PlayerSurvive(int, DBloodActor* actor)
|
|||
|
||||
void PlayerKneelsOver(int, DBloodActor* actor)
|
||||
{
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
{
|
||||
if (gPlayer[p].pXSprite == pXSprite)
|
||||
if (gPlayer[p].actor == actor)
|
||||
{
|
||||
PLAYER *pPlayer = &gPlayer[p];
|
||||
playerDamageSprite(pPlayer->fragger, pPlayer, kDamageSpirit, 500<<4);
|
||||
|
@ -2375,7 +2372,6 @@ void SerializePlayers(FSerializer& arc)
|
|||
{
|
||||
for (int i = 0; i < gNetPlayers; i++)
|
||||
{
|
||||
gPlayer[i].pXSprite = &gPlayer[i].actor->x();
|
||||
gPlayer[i].pDudeInfo = &dudeInfo[gPlayer[i].actor->spr.type - kDudeBase];
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
|
|
|
@ -81,7 +81,6 @@ extern POSTURE gPostureDefaults[kModeMax][kPostureMax];
|
|||
struct PLAYER
|
||||
{
|
||||
TObjPtr<DBloodActor*> actor;
|
||||
XSPRITE* pXSprite;
|
||||
DUDEINFO* pDudeInfo;
|
||||
InputPacket input;
|
||||
PlayerHorizon horizon;
|
||||
|
|
|
@ -65,7 +65,7 @@ void viewInitializePrediction(void)
|
|||
predict.xvel = gMe->actor->xvel;
|
||||
predict.yvel = gMe->actor->yvel;
|
||||
predict.zvel = gMe->actor->zvel;
|
||||
predict.floordist = gMe->pXSprite->height;
|
||||
predict.floordist = gMe->actor->xspr.height;
|
||||
predict.at48 = gMe->posture;
|
||||
predict.spin = gMe->angle.spin;
|
||||
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
|
||||
|
|
|
@ -189,7 +189,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event)
|
|||
if (nPlayer >= 0 && nPlayer < kMaxPlayers && playeringame[nPlayer])
|
||||
{
|
||||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||
if (pPlayer->pXSprite->health > 0)
|
||||
if (pPlayer->actor->xspr.health > 0)
|
||||
{
|
||||
evKillActor(actor);
|
||||
pPlayer->ammoCount[8] = ClipHigh(pPlayer->ammoCount[8]+pXSprite->data3, gAmmoInfo[8].max);
|
||||
|
@ -560,7 +560,7 @@ void OperateSprite(DBloodActor* actor, EVENT event)
|
|||
case kSoundPlayer:
|
||||
if (gGameOptions.nGameType == 0)
|
||||
{
|
||||
if (gMe->pXSprite->health <= 0)
|
||||
if (gMe->actor->xspr.health <= 0)
|
||||
break;
|
||||
gMe->restTime = 0;
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, sectorty
|
|||
|
||||
pSector = gView->actor->spr.sector();
|
||||
#if 0
|
||||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->pXSprite->health > 0)
|
||||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->actor->xspr.health > 0)
|
||||
{
|
||||
nSectnum = predict. sectnum;
|
||||
cX = interpolatedvalue(predictOld.x, predict.x, gInterpolate);
|
||||
|
@ -573,8 +573,8 @@ void viewDrawScreen(bool sceneonly)
|
|||
else if (gView->isUnderwater) {
|
||||
if (gView->nWaterPal) basepal = gView->nWaterPal;
|
||||
else {
|
||||
if (gView->pXSprite->medium == kMediumWater) basepal = 1;
|
||||
else if (gView->pXSprite->medium == kMediumGoo) basepal = 3;
|
||||
if (gView->actor->xspr.medium == kMediumWater) basepal = 1;
|
||||
else if (gView->actor->xspr.medium == kMediumGoo) basepal = 3;
|
||||
else basepal = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ static bool BannedUnderwater(int nWeapon)
|
|||
return nWeapon == kWeapSpraycan || nWeapon == kWeapDynamite;
|
||||
}
|
||||
|
||||
static bool CheckWeaponAmmo(const PLAYER *pPlayer, int weapon, int ammotype, int count)
|
||||
static bool CheckWeaponAmmo(PLAYER *pPlayer, int weapon, int ammotype, int count)
|
||||
{
|
||||
if (gInfiniteAmmo)
|
||||
return 1;
|
||||
|
@ -181,12 +181,12 @@ static bool CheckWeaponAmmo(const PLAYER *pPlayer, int weapon, int ammotype, int
|
|||
return 1;
|
||||
if (weapon == kWeapRemote && pPlayer->weaponAmmo == 11 && pPlayer->weaponState == 11)
|
||||
return 1;
|
||||
if (weapon == kWeapLifeLeech && pPlayer->pXSprite->health > 0)
|
||||
if (weapon == kWeapLifeLeech && pPlayer->actor->xspr.health > 0)
|
||||
return 1;
|
||||
return pPlayer->ammoCount[ammotype] >= count;
|
||||
}
|
||||
|
||||
static bool CheckAmmo(const PLAYER *pPlayer, int ammotype, int count)
|
||||
static bool CheckAmmo(PLAYER *pPlayer, int ammotype, int count)
|
||||
{
|
||||
if (gInfiniteAmmo)
|
||||
return 1;
|
||||
|
@ -194,7 +194,7 @@ static bool CheckAmmo(const PLAYER *pPlayer, int ammotype, int count)
|
|||
return 1;
|
||||
if (pPlayer->curWeapon == kWeapRemote && pPlayer->weaponAmmo == 11 && pPlayer->weaponState == 11)
|
||||
return 1;
|
||||
if (pPlayer->curWeapon == kWeapLifeLeech && pPlayer->pXSprite->health >= unsigned(count<<4))
|
||||
if (pPlayer->curWeapon == kWeapLifeLeech && pPlayer->actor->xspr.health >= unsigned(count<<4))
|
||||
return 1;
|
||||
return pPlayer->ammoCount[ammotype] >= count;
|
||||
}
|
||||
|
@ -1731,7 +1731,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
|
|||
if (gGameOptions.nGameType <= 1)
|
||||
{
|
||||
int nAmmo = pPlayer->ammoCount[8];
|
||||
if (nAmmo < 25 && pPlayer->missile->xspr.health > unsigned((25-nAmmo)<<4))
|
||||
if (nAmmo < 25 && pPlayer->actor->xspr.health > unsigned((25-nAmmo)<<4))
|
||||
{
|
||||
actDamageSprite(actor, actor, kDamageSpirit, ((25-nAmmo)<<4));
|
||||
nAmmo = 25;
|
||||
|
@ -1784,7 +1784,7 @@ int WeaponUpgrade(PLAYER *pPlayer, int newWeapon)
|
|||
int OrderNext[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1 };
|
||||
int OrderPrev[] = { 12, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 };
|
||||
|
||||
static int WeaponFindNext(const PLAYER *pPlayer, int *a2, int bDir)
|
||||
static int WeaponFindNext(PLAYER *pPlayer, int *a2, int bDir)
|
||||
{
|
||||
int weapon = pPlayer->curWeapon;
|
||||
do
|
||||
|
@ -1817,7 +1817,7 @@ static int WeaponFindNext(const PLAYER *pPlayer, int *a2, int bDir)
|
|||
return weapon;
|
||||
}
|
||||
|
||||
static int WeaponFindLoaded(const PLAYER *pPlayer, int *a2)
|
||||
static int WeaponFindLoaded(PLAYER *pPlayer, int *a2)
|
||||
{
|
||||
int v4 = 1;
|
||||
int v14 = 0;
|
||||
|
@ -2030,14 +2030,14 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
pPlayer->flashEffect = ClipLow(pPlayer->flashEffect - 1, 0);
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (gPlayerCtrl[pPlayer->nPlayer].qavScene.initiator != nullptr && pPlayer->pXSprite->health > 0) {
|
||||
if (gPlayerCtrl[pPlayer->nPlayer].qavScene.initiator != nullptr && pPlayer->actor->xspr.health > 0) {
|
||||
playerQavSceneProcess(pPlayer, &gPlayerCtrl[pPlayer->nPlayer].qavScene);
|
||||
UpdateAimVector(pPlayer);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pPlayer->pXSprite->health == 0)
|
||||
if (pPlayer->actor->xspr.health == 0)
|
||||
{
|
||||
pPlayer->qavLoop = 0;
|
||||
sfxKill3DSound(pPlayer->actor, 1, -1);
|
||||
|
@ -2069,7 +2069,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
bool bShoot2 = pPlayer->input.actions & SB_ALTFIRE;
|
||||
const int prevNewWeaponVal = pPlayer->input.getNewWeapon(); // used to fix scroll issue for banned weapons
|
||||
if ((bShoot || bShoot2 || prevNewWeaponVal) && pPlayer->weaponQav == qavGetCorrectID(kQAVVDIDLE2)) pPlayer->weaponTimer = 0;
|
||||
if (pPlayer->qavLoop && pPlayer->pXSprite->health > 0)
|
||||
if (pPlayer->qavLoop && pPlayer->actor->xspr.health > 0)
|
||||
{
|
||||
if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1))
|
||||
{
|
||||
|
@ -2110,7 +2110,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
}
|
||||
if (pPlayer->weaponTimer > 0)
|
||||
return;
|
||||
if (pPlayer->pXSprite->health == 0 || pPlayer->curWeapon == kWeapNone)
|
||||
if (pPlayer->actor->xspr.health == 0 || pPlayer->curWeapon == kWeapNone)
|
||||
pPlayer->weaponQav = kQAVNone;
|
||||
switch (pPlayer->curWeapon)
|
||||
{
|
||||
|
@ -2295,7 +2295,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (pPlayer->pXSprite->health == 0 || pPlayer->hasWeapon[pPlayer->newWeapon] == 0)
|
||||
if (pPlayer->actor->xspr.health == 0 || pPlayer->hasWeapon[pPlayer->newWeapon] == 0)
|
||||
{
|
||||
pPlayer->newWeapon = kWeapNone;
|
||||
return;
|
||||
|
@ -2631,7 +2631,7 @@ void WeaponProcess(PLAYER *pPlayer) {
|
|||
}
|
||||
return;
|
||||
case kWeapLifeLeech:
|
||||
if (gGameOptions.nGameType <= 1 && !checkAmmo2(pPlayer, 8, 1) && pPlayer->pXSprite->health < (25 << 4))
|
||||
if (gGameOptions.nGameType <= 1 && !checkAmmo2(pPlayer, 8, 1) && pPlayer->actor->xspr.health < (25 << 4))
|
||||
{
|
||||
sfxPlay3DSound(pPlayer->actor, 494, 2, 0);
|
||||
StartQAV(pPlayer, kQAVSTAFIRE4, nClientFireLifeLeech);
|
||||
|
|
Loading…
Reference in a new issue