mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- Blood: Eliminate gView
extern'd pointer.
This commit is contained in:
parent
560bf3e8df
commit
59bee2f9f6
11 changed files with 119 additions and 122 deletions
|
@ -4927,11 +4927,11 @@ void MoveDude(DBloodActor* actor)
|
|||
switch (nLink)
|
||||
{
|
||||
case kMarkerLowStack:
|
||||
if (pPlayer == gView)
|
||||
if (pPlayer->nPlayer == myconnectindex)
|
||||
gotpic.Set(actor->sector()->floorpicnum);
|
||||
break;
|
||||
case kMarkerUpStack:
|
||||
if (pPlayer == gView)
|
||||
if (pPlayer->nPlayer == myconnectindex)
|
||||
gotpic.Set(actor->sector()->ceilingpicnum);
|
||||
break;
|
||||
case kMarkerLowWater:
|
||||
|
|
|
@ -477,13 +477,13 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
auto& nVoxel = voxelIndex[nTile];
|
||||
if (cl_showweapon == 2 && r_voxels && nVoxel != -1)
|
||||
{
|
||||
pNSprite->set_int_ang((gView->actor->int_ang() + 512) & 2047); // always face viewer
|
||||
pNSprite->angle = (pPlayer->actor->spr.angle + DAngle90).Normalized360(); // always face viewer
|
||||
pNSprite->cstat |= CSTAT_SPRITE_ALIGNMENT_SLAB;
|
||||
pNSprite->cstat &= ~CSTAT_SPRITE_YFLIP;
|
||||
pNSprite->picnum = nVoxel;
|
||||
if (pPlayer->curWeapon == kWeapLifeLeech) // position lifeleech behind player
|
||||
{
|
||||
pNSprite->pos.XY() += gView->actor->spr.angle.ToVector() * 8;
|
||||
pNSprite->pos.XY() += pPlayer->actor->spr.angle.ToVector() * 8;
|
||||
}
|
||||
if ((pPlayer->curWeapon == kWeapLifeLeech) || (pPlayer->curWeapon == kWeapVoodooDoll)) // make lifeleech/voodoo doll always face viewer like sprite
|
||||
pNSprite->set_int_ang((pNSprite->int_ang() + 512) & 2047); // offset angle 90 degrees
|
||||
|
@ -524,6 +524,7 @@ static int GetOctant(int x, int y)
|
|||
|
||||
void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t cZ, DAngle cA, double interpfrac)
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
int nViewSprites = tsprites.Size();
|
||||
// shift before interpolating to increase precision.
|
||||
DAngle myclock = DAngle::fromDeg(((PlayClock << 3) + (4 << 3) * interpfrac) * BAngToDegree);
|
||||
|
@ -813,7 +814,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
|
|||
case kMissileFlareRegular:
|
||||
case kMissileFlareAlt:
|
||||
if (pTSprite->statnum == kStatFlare) {
|
||||
if (owneractor->GetTarget() == gView->actor)
|
||||
if (owneractor->GetTarget() == pPlayer->actor)
|
||||
{
|
||||
pTSprite->xrepeat = 0;
|
||||
break;
|
||||
|
@ -852,41 +853,41 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
|
|||
}
|
||||
|
||||
if (pXSector && pXSector->color) copyfloorpal(pTSprite, pSector);
|
||||
if (powerupCheck(gView, kPwUpBeastVision) > 0) pTSprite->shade = -128;
|
||||
if (powerupCheck(pPlayer, kPwUpBeastVision) > 0) pTSprite->shade = -128;
|
||||
|
||||
if (IsPlayerSprite(pTSprite)) {
|
||||
PLAYER* pPlayer = &gPlayer[pTSprite->type - kDudePlayer1];
|
||||
if (powerupCheck(pPlayer, kPwUpShadowCloak) && !powerupCheck(gView, kPwUpBeastVision)) {
|
||||
PLAYER* thisPlayer = &gPlayer[pTSprite->type - kDudePlayer1];
|
||||
if (powerupCheck(thisPlayer, kPwUpShadowCloak) && !powerupCheck(pPlayer, kPwUpBeastVision)) {
|
||||
pTSprite->cstat |= CSTAT_SPRITE_TRANSLUCENT;
|
||||
pTSprite->pal = 5;
|
||||
}
|
||||
else if (powerupCheck(pPlayer, kPwUpDeathMask)) {
|
||||
else if (powerupCheck(thisPlayer, kPwUpDeathMask)) {
|
||||
pTSprite->shade = -128;
|
||||
pTSprite->pal = 5;
|
||||
}
|
||||
else if (powerupCheck(pPlayer, kPwUpDoppleganger)) {
|
||||
pTSprite->pal = 11 + (gView->teamId & 3);
|
||||
else if (powerupCheck(thisPlayer, kPwUpDoppleganger)) {
|
||||
pTSprite->pal = 11 + (pPlayer->teamId & 3);
|
||||
}
|
||||
|
||||
if (powerupCheck(pPlayer, kPwUpReflectShots)) {
|
||||
if (powerupCheck(thisPlayer, kPwUpReflectShots)) {
|
||||
viewAddEffect(tsprites, nTSprite, kViewEffectReflectiveBall);
|
||||
}
|
||||
|
||||
if (cl_showweapon && gGameOptions.nGameType > 0 && gView) {
|
||||
if (cl_showweapon && gGameOptions.nGameType > 0 && pPlayer) {
|
||||
viewAddEffect(tsprites, nTSprite, kViewEffectShowWeapon);
|
||||
}
|
||||
|
||||
if (pPlayer->flashEffect && (gView != pPlayer || gViewPos != VIEWPOS_0)) {
|
||||
if (thisPlayer->flashEffect && (pPlayer != thisPlayer || gViewPos != VIEWPOS_0)) {
|
||||
auto pNTSprite = viewAddEffect(tsprites, nTSprite, kViewEffectShoot);
|
||||
if (pNTSprite) {
|
||||
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
POSTURE* pPosture = &thisPlayer->pPosture[thisPlayer->lifeMode][thisPlayer->posture];
|
||||
pNTSprite->pos.XY() += pTSprite->angle.ToVector() * pPosture->zOffset * 0.25;
|
||||
pNTSprite->set_int_z(pPlayer->actor->int_pos().Z - pPosture->xOffset);
|
||||
pNTSprite->set_int_z(thisPlayer->actor->int_pos().Z - pPosture->xOffset);
|
||||
}
|
||||
}
|
||||
|
||||
if (pPlayer->hasFlag > 0 && gGameOptions.nGameType == 3) {
|
||||
if (pPlayer->hasFlag & 1) {
|
||||
if (thisPlayer->hasFlag > 0 && gGameOptions.nGameType == 3) {
|
||||
if (thisPlayer->hasFlag & 1) {
|
||||
auto pNTSprite = viewAddEffect(tsprites, nTSprite, kViewEffectFlag);
|
||||
if (pNTSprite)
|
||||
{
|
||||
|
@ -894,7 +895,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
|
|||
pNTSprite->cstat |= CSTAT_SPRITE_XFLIP;
|
||||
}
|
||||
}
|
||||
if (pPlayer->hasFlag & 2) {
|
||||
if (thisPlayer->hasFlag & 2) {
|
||||
auto pNTSprite = viewAddEffect(tsprites, nTSprite, kViewEffectFlag);
|
||||
if (pNTSprite)
|
||||
{
|
||||
|
@ -905,7 +906,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
if (pTSprite->ownerActor != gView->actor || gViewPos != VIEWPOS_0) {
|
||||
if (pTSprite->ownerActor != pPlayer->actor || gViewPos != VIEWPOS_0) {
|
||||
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->int_pos().X, pTSprite->int_pos().Y) >= cZ)
|
||||
{
|
||||
viewAddEffect(tsprites, nTSprite, kViewEffectShadow);
|
||||
|
|
|
@ -441,7 +441,7 @@ void GameInterface::Ticker()
|
|||
|
||||
viewCorrectPrediction();
|
||||
ambProcess(pPlayer);
|
||||
viewUpdateDelirium();
|
||||
viewUpdateDelirium(pPlayer);
|
||||
gi->UpdateSounds();
|
||||
if (pPlayer->hand == 1)
|
||||
{
|
||||
|
@ -627,7 +627,6 @@ void GameInterface::app_init()
|
|||
enginecompatibility_mode = ENGINECOMPATIBILITY_19960925;
|
||||
|
||||
gViewIndex = myconnectindex;
|
||||
gView = &gPlayer[myconnectindex];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -639,7 +638,6 @@ void GameInterface::app_init()
|
|||
static void gameInit()
|
||||
{
|
||||
gViewIndex = myconnectindex;
|
||||
gView = &gPlayer[myconnectindex];
|
||||
|
||||
UpdateNetworkMenus();
|
||||
if (gGameOptions.nGameType > 0)
|
||||
|
@ -775,7 +773,7 @@ DEFINE_ACTION_FUNCTION(_Blood, PowerupIcon)
|
|||
DEFINE_ACTION_FUNCTION(_Blood, GetViewPlayer)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_POINTER(gView);
|
||||
ACTION_RETURN_POINTER(&gPlayer[myconnectindex]);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_BloodPlayer, GetHealth)
|
||||
|
|
|
@ -60,7 +60,7 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
|
|||
if (!SyncInput() && gamestate == GS_LEVEL)
|
||||
{
|
||||
// Perform unsynchronised angle/horizon if not dead.
|
||||
if (gView->actor->xspr.health != 0)
|
||||
if (pPlayer->actor->xspr.health != 0)
|
||||
{
|
||||
pPlayer->angle.applyinput(input.avel, &pPlayer->input.actions, scaleAdjust);
|
||||
pPlayer->horizon.applyinput(input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||
|
|
|
@ -104,13 +104,13 @@ static void viewBurnTime(int gScale)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void hudDraw(PLAYER* gView, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac)
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac)
|
||||
{
|
||||
double look_anghalf = gView->angle.look_anghalf(interpfrac);
|
||||
double look_anghalf = pPlayer->angle.look_anghalf(interpfrac);
|
||||
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
double looking_arc = gView->angle.looking_arc(interpfrac);
|
||||
double looking_arc = pPlayer->angle.looking_arc(interpfrac);
|
||||
|
||||
double cX = 160 - look_anghalf;
|
||||
double cY = 220 + looking_arc;
|
||||
|
@ -133,29 +133,29 @@ void hudDraw(PLAYER* gView, sectortype* pSector, double bobx, double boby, doubl
|
|||
}
|
||||
int nShade = pSector? pSector->floorshade : 0;
|
||||
int nPalette = 0;
|
||||
if (gView->actor->sector()->hasX()) {
|
||||
sectortype* pViewSect = gView->actor->sector();
|
||||
if (pPlayer->actor->sector()->hasX()) {
|
||||
sectortype* pViewSect = pPlayer->actor->sector();
|
||||
XSECTOR* pXSector = &pViewSect->xs();
|
||||
if (pXSector->color)
|
||||
nPalette = pViewSect->floorpal;
|
||||
}
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
else if (gView->actor->xspr.health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
|
||||
if (pPlayer->sceneQav < 0) WeaponDraw(pPlayer, nShade, cX, cY, nPalette);
|
||||
else if (pPlayer->actor->xspr.health > 0) playerQavSceneDraw(pPlayer, nShade, cX, cY, nPalette);
|
||||
else {
|
||||
gView->sceneQav = gView->weaponQav = kQAVNone;
|
||||
gView->qavTimer = gView->weaponTimer = gView->curWeapon = 0;
|
||||
pPlayer->sceneQav = pPlayer->weaponQav = kQAVNone;
|
||||
pPlayer->qavTimer = pPlayer->weaponTimer = pPlayer->curWeapon = 0;
|
||||
}
|
||||
#else
|
||||
WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
WeaponDraw(pPlayer, nShade, cX, cY, nPalette);
|
||||
#endif
|
||||
}
|
||||
if (gViewPos == 0 && gView->actor->xspr.burnTime > 60)
|
||||
if (gViewPos == 0 && pPlayer->actor->xspr.burnTime > 60)
|
||||
{
|
||||
viewBurnTime(gView->actor->xspr.burnTime);
|
||||
viewBurnTime(pPlayer->actor->xspr.burnTime);
|
||||
}
|
||||
if (packItemActive(gView, 1))
|
||||
if (packItemActive(pPlayer, 1))
|
||||
{
|
||||
drawElement(0, 0, 2344, 1, 0, 0, -1);
|
||||
drawElement(320, 0, 2344, 1, 1, 0, 1);
|
||||
|
@ -167,15 +167,15 @@ void hudDraw(PLAYER* gView, sectortype* pSector, double bobx, double boby, doubl
|
|||
drawElement(212, 77, 2347, 1, 0, 0, 1, 0, 0.2);
|
||||
}
|
||||
}
|
||||
if (powerupCheck(gView, kPwUpAsbestArmor) > 0)
|
||||
if (powerupCheck(pPlayer, kPwUpAsbestArmor) > 0)
|
||||
{
|
||||
drawElement(0, 237, 2358, 1, 0, 1, -1);
|
||||
drawElement(320, 237, 2358, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
int zn = ((gView->zWeapon - gView->zView - (12 << 8)) >> 7) + 220;
|
||||
PLAYER* pPSprite = &gPlayer[gView->actor->spr.type - kDudePlayer1];
|
||||
if (gView->actor->IsPlayerActor() && pPSprite->hand == 1)
|
||||
int zn = ((pPlayer->zWeapon - pPlayer->zView - (12 << 8)) >> 7) + 220;
|
||||
PLAYER* pPSprite = &gPlayer[pPlayer->actor->spr.type - kDudePlayer1];
|
||||
if (pPlayer->actor->IsPlayerActor() && pPSprite->hand == 1)
|
||||
{
|
||||
gChoke.animateChoke(160, zn, interpfrac);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ void GameInterface::SwitchCoopView()
|
|||
gViewIndex = connectpoint2[gViewIndex];
|
||||
if (gViewIndex == -1)
|
||||
gViewIndex = connecthead;
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
else if (gGameOptions.nGameType == 3)
|
||||
{
|
||||
|
@ -85,7 +84,6 @@ void GameInterface::SwitchCoopView()
|
|||
if (oldViewIndex == gViewIndex || gPlayer[myconnectindex].teamId == gPlayer[gViewIndex].teamId)
|
||||
break;
|
||||
} while (oldViewIndex != gViewIndex);
|
||||
gView = &gPlayer[gViewIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
PLAYER gPlayer[kMaxPlayers];
|
||||
PLAYER* gView;
|
||||
|
||||
bool gBlueFlagDropped = false;
|
||||
bool gRedFlagDropped = false;
|
||||
|
|
|
@ -201,7 +201,6 @@ struct POWERUPINFO
|
|||
void playerResetPosture(PLAYER* pPlayer);
|
||||
|
||||
extern PLAYER gPlayer[kMaxPlayers];
|
||||
extern PLAYER* gView;
|
||||
|
||||
extern bool gBlueFlagDropped;
|
||||
extern bool gRedFlagDropped;
|
||||
|
|
|
@ -72,7 +72,7 @@ static void UpdateFrame(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void UpdateStatusBar()
|
||||
void UpdateStatusBar(PLAYER* pPlayer)
|
||||
{
|
||||
if (automapMode == am_off && hud_size <= Hud_Stbar)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ void UpdateStatusBar()
|
|||
SummaryInfo sum;
|
||||
if (gGameOptions.nGameType == 3)
|
||||
{
|
||||
sum.kills = gView ? gView->fragCount : 0;
|
||||
sum.kills = pPlayer ? pPlayer->fragCount : 0;
|
||||
sum.maxkills = -3;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -111,12 +111,12 @@ GameStats GameInterface::getStats()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void viewDrawAimedPlayerName(void)
|
||||
void viewDrawAimedPlayerName(PLAYER* pPlayer)
|
||||
{
|
||||
if (!cl_idplayers || (gView->aim.dx == 0 && gView->aim.dy == 0))
|
||||
if (!cl_idplayers || (pPlayer->aim.dx == 0 && pPlayer->aim.dy == 0))
|
||||
return;
|
||||
|
||||
int hit = HitScan(gView->actor, gView->zView, gView->aim.dx, gView->aim.dy, gView->aim.dz, CLIPMASK0, 512);
|
||||
int hit = HitScan(pPlayer->actor, pPlayer->zView, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, CLIPMASK0, 512);
|
||||
if (hit == 3)
|
||||
{
|
||||
auto actor = gHitInfo.actor();
|
||||
|
@ -314,27 +314,27 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void UpdateBlend()
|
||||
void UpdateBlend(PLAYER* pPlayer)
|
||||
{
|
||||
int nRed = 0;
|
||||
int nGreen = 0;
|
||||
int nBlue = 0;
|
||||
|
||||
nRed += gView->pickupEffect;
|
||||
nGreen += gView->pickupEffect;
|
||||
nBlue -= gView->pickupEffect;
|
||||
nRed += pPlayer->pickupEffect;
|
||||
nGreen += pPlayer->pickupEffect;
|
||||
nBlue -= pPlayer->pickupEffect;
|
||||
|
||||
nRed += ClipHigh(gView->painEffect, 85) * 2;
|
||||
nGreen -= ClipHigh(gView->painEffect, 85) * 3;
|
||||
nBlue -= ClipHigh(gView->painEffect, 85) * 3;
|
||||
nRed += ClipHigh(pPlayer->painEffect, 85) * 2;
|
||||
nGreen -= ClipHigh(pPlayer->painEffect, 85) * 3;
|
||||
nBlue -= ClipHigh(pPlayer->painEffect, 85) * 3;
|
||||
|
||||
nRed -= gView->blindEffect;
|
||||
nGreen -= gView->blindEffect;
|
||||
nBlue -= gView->blindEffect;
|
||||
nRed -= pPlayer->blindEffect;
|
||||
nGreen -= pPlayer->blindEffect;
|
||||
nBlue -= pPlayer->blindEffect;
|
||||
|
||||
nRed -= gView->chokeEffect >> 6;
|
||||
nGreen -= gView->chokeEffect >> 5;
|
||||
nBlue -= gView->chokeEffect >> 6;
|
||||
nRed -= pPlayer->chokeEffect >> 6;
|
||||
nGreen -= pPlayer->chokeEffect >> 5;
|
||||
nBlue -= pPlayer->chokeEffect >> 6;
|
||||
|
||||
nRed = ClipRange(nRed, -255, 255);
|
||||
nGreen = ClipRange(nGreen, -255, 255);
|
||||
|
@ -358,13 +358,13 @@ int gShowFrameRate = 1;
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void viewUpdateDelirium(void)
|
||||
void viewUpdateDelirium(PLAYER* pPlayer)
|
||||
{
|
||||
gScreenTiltO = gScreenTilt;
|
||||
deliriumTurnO = deliriumTurn;
|
||||
deliriumPitchO = deliriumPitch;
|
||||
int powerCount;
|
||||
if ((powerCount = powerupCheck(gView, kPwUpDeliriumShroom)) != 0)
|
||||
if ((powerCount = powerupCheck(pPlayer, kPwUpDeliriumShroom)) != 0)
|
||||
{
|
||||
int tilt1 = 170, tilt2 = 170, pitch = 20;
|
||||
int timer = PlayClock * 2;
|
||||
|
@ -405,7 +405,7 @@ void viewUpdateDelirium(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void viewUpdateShake(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
||||
void viewUpdateShake(PLAYER* pPlayer, int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, double& pshakeX, double& pshakeY)
|
||||
{
|
||||
auto doEffect = [&](const int& effectType)
|
||||
{
|
||||
|
@ -421,8 +421,8 @@ void viewUpdateShake(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, doub
|
|||
pshakeY += QRandom2(nValue);
|
||||
}
|
||||
};
|
||||
doEffect(gView->flickerEffect);
|
||||
doEffect(gView->quakeEffect);
|
||||
doEffect(pPlayer->flickerEffect);
|
||||
doEffect(pPlayer->quakeEffect);
|
||||
}
|
||||
|
||||
|
||||
|
@ -436,7 +436,7 @@ int32_t g_frameRate;
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void DrawMap(DBloodActor* view, const double smoothratio)
|
||||
static void DrawMap(PLAYER* pPlayer, const double smoothratio)
|
||||
{
|
||||
int tm = 0;
|
||||
if (viewport3d.Left() > 0)
|
||||
|
@ -444,8 +444,8 @@ static void DrawMap(DBloodActor* view, const double smoothratio)
|
|||
setViewport(Hud_Stbar);
|
||||
tm = 1;
|
||||
}
|
||||
auto ang = !SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
DrawOverheadMap(view->interpolatedpos(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio * (1. / MaxSmoothRatio));
|
||||
auto ang = !SyncInput() ? pPlayer->angle.sum() : pPlayer->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
DrawOverheadMap(pPlayer->actor->interpolatedpos(smoothratio * (1. / MaxSmoothRatio)).XY(), ang, smoothratio * (1. / MaxSmoothRatio));
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
@ -456,13 +456,13 @@ static void DrawMap(DBloodActor* view, const double smoothratio)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, DAngle& rotscrnang, const double smoothratio)
|
||||
static void SetupView(PLAYER* pPlayer, int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sectortype*& pSector, double& zDelta, double& shakeX, double& shakeY, DAngle& rotscrnang, const double smoothratio)
|
||||
{
|
||||
int bobWidth, bobHeight;
|
||||
|
||||
pSector = gView->actor->sector();
|
||||
pSector = pPlayer->actor->sector();
|
||||
#if 0
|
||||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->actor->xspr.health > 0)
|
||||
if (numplayers > 1 && pPlayer == gMe && gPrediction && gMe->actor->xspr.health > 0)
|
||||
{
|
||||
nSectnum = predict.sectnum;
|
||||
cX = interpolatedvalue(predictOld.x, predict.x, smoothratio * (1. / MaxSmoothRatio));
|
||||
|
@ -490,31 +490,31 @@ static void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sec
|
|||
else
|
||||
#endif
|
||||
{
|
||||
cX = interpolatedvalue(gView->actor->opos.X, gView->actor->spr.pos.X, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
|
||||
cY = interpolatedvalue(gView->actor->opos.Y, gView->actor->spr.pos.Y, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
|
||||
cZ = interpolatedvalue(gView->ozView, gView->zView, smoothratio * (1. / MaxSmoothRatio));
|
||||
zDelta = interpolatedvalue<double>(gView->ozWeapon, gView->zWeapon - gView->zView - (12 << 8), smoothratio * (1. / MaxSmoothRatio));
|
||||
bobWidth = interpolatedvalue(gView->obobWidth, gView->bobWidth, smoothratio * (1. / MaxSmoothRatio));
|
||||
bobHeight = interpolatedvalue(gView->obobHeight, gView->bobHeight, smoothratio * (1. / MaxSmoothRatio));
|
||||
shakeX = interpolatedvalue<double>(gView->oswayWidth, gView->swayWidth, smoothratio * (1. / MaxSmoothRatio));
|
||||
shakeY = interpolatedvalue<double>(gView->oswayHeight, gView->swayHeight, smoothratio * (1. / MaxSmoothRatio));
|
||||
cX = interpolatedvalue(pPlayer->actor->opos.X, pPlayer->actor->spr.pos.X, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
|
||||
cY = interpolatedvalue(pPlayer->actor->opos.Y, pPlayer->actor->spr.pos.Y, smoothratio * (1. / MaxSmoothRatio)) * worldtoint;
|
||||
cZ = interpolatedvalue(pPlayer->ozView, pPlayer->zView, smoothratio * (1. / MaxSmoothRatio));
|
||||
zDelta = interpolatedvalue<double>(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - (12 << 8), smoothratio * (1. / MaxSmoothRatio));
|
||||
bobWidth = interpolatedvalue(pPlayer->obobWidth, pPlayer->bobWidth, smoothratio * (1. / MaxSmoothRatio));
|
||||
bobHeight = interpolatedvalue(pPlayer->obobHeight, pPlayer->bobHeight, smoothratio * (1. / MaxSmoothRatio));
|
||||
shakeX = interpolatedvalue<double>(pPlayer->oswayWidth, pPlayer->swayWidth, smoothratio * (1. / MaxSmoothRatio));
|
||||
shakeY = interpolatedvalue<double>(pPlayer->oswayHeight, pPlayer->swayHeight, smoothratio * (1. / MaxSmoothRatio));
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
cA = gView->angle.sum();
|
||||
cH = gView->horizon.sum();
|
||||
rotscrnang = gView->angle.rotscrnang;
|
||||
cA = pPlayer->angle.sum();
|
||||
cH = pPlayer->horizon.sum();
|
||||
rotscrnang = pPlayer->angle.rotscrnang;
|
||||
}
|
||||
else
|
||||
{
|
||||
cA = gView->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
cH = gView->horizon.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
rotscrnang = gView->angle.interpolatedrotscrn(smoothratio * (1. / MaxSmoothRatio));
|
||||
cA = pPlayer->angle.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
cH = pPlayer->horizon.interpolatedsum(smoothratio * (1. / MaxSmoothRatio));
|
||||
rotscrnang = pPlayer->angle.interpolatedrotscrn(smoothratio * (1. / MaxSmoothRatio));
|
||||
}
|
||||
}
|
||||
|
||||
viewUpdateShake(cX, cY, cZ, cA, cH, shakeX, shakeY);
|
||||
cH += buildhoriz(MulScale(0x40000000 - Cos(gView->tiltEffect << 2), 30, 30));
|
||||
viewUpdateShake(pPlayer, cX, cY, cZ, cA, cH, shakeX, shakeY);
|
||||
cH += buildhoriz(MulScale(0x40000000 - Cos(pPlayer->tiltEffect << 2), 30, 30));
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
if (cl_viewhbob)
|
||||
|
@ -530,7 +530,7 @@ static void SetupView(int& cX, int& cY, int& cZ, DAngle& cA, fixedhoriz& cH, sec
|
|||
}
|
||||
else
|
||||
{
|
||||
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->actor, &pSector, cA, cH, smoothratio);
|
||||
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, pPlayer->actor, &pSector, cA, cH, smoothratio);
|
||||
}
|
||||
if (pSector != nullptr)
|
||||
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &pSector);
|
||||
|
@ -610,6 +610,8 @@ void renderCrystalBall()
|
|||
|
||||
void viewDrawScreen(bool sceneonly)
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
|
||||
if (testgotpic(2342, true))
|
||||
{
|
||||
FireProcess();
|
||||
|
@ -635,18 +637,18 @@ void viewDrawScreen(bool sceneonly)
|
|||
if (automapMode == am_off)
|
||||
{
|
||||
int basepal = 0;
|
||||
if (powerupCheck(gView, kPwUpDeathMask) > 0) basepal = 4;
|
||||
else if (powerupCheck(gView, kPwUpReflectShots) > 0) basepal = 1;
|
||||
else if (gView->isUnderwater) {
|
||||
if (gView->nWaterPal) basepal = gView->nWaterPal;
|
||||
if (powerupCheck(pPlayer, kPwUpDeathMask) > 0) basepal = 4;
|
||||
else if (powerupCheck(pPlayer, kPwUpReflectShots) > 0) basepal = 1;
|
||||
else if (pPlayer->isUnderwater) {
|
||||
if (pPlayer->nWaterPal) basepal = pPlayer->nWaterPal;
|
||||
else {
|
||||
if (gView->actor->xspr.medium == kMediumWater) basepal = 1;
|
||||
else if (gView->actor->xspr.medium == kMediumGoo) basepal = 3;
|
||||
if (pPlayer->actor->xspr.medium == kMediumWater) basepal = 1;
|
||||
else if (pPlayer->actor->xspr.medium == kMediumGoo) basepal = 3;
|
||||
else basepal = 2;
|
||||
}
|
||||
}
|
||||
UpdateDacs(basepal);
|
||||
UpdateBlend();
|
||||
UpdateBlend(pPlayer);
|
||||
|
||||
int cX, cY, cZ;
|
||||
DAngle cA, rotscrnang;
|
||||
|
@ -654,13 +656,13 @@ void viewDrawScreen(bool sceneonly)
|
|||
sectortype* pSector;
|
||||
double zDelta;
|
||||
double shakeX, shakeY;
|
||||
SetupView(cX, cY, cZ, cA, cH, pSector, zDelta, shakeX, shakeY, rotscrnang, gInterpolate);
|
||||
SetupView(pPlayer, cX, cY, cZ, cA, cH, pSector, zDelta, shakeX, shakeY, rotscrnang, gInterpolate);
|
||||
|
||||
DAngle tilt = interpolatedvalue(gScreenTiltO, gScreenTilt, gInterpolate * (1. / MaxSmoothRatio));
|
||||
bool bDelirium = powerupCheck(gView, kPwUpDeliriumShroom) > 0;
|
||||
bool bDelirium = powerupCheck(pPlayer, kPwUpDeliriumShroom) > 0;
|
||||
static bool bDeliriumOld = false;
|
||||
//int tiltcs, tiltdim;
|
||||
uint8_t otherview = powerupCheck(gView, kPwUpCrystalBall) > 0;
|
||||
uint8_t otherview = powerupCheck(pPlayer, kPwUpCrystalBall) > 0;
|
||||
if (tilt.Degrees() || bDelirium)
|
||||
{
|
||||
rotscrnang = tilt;
|
||||
|
@ -704,7 +706,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
break;
|
||||
}
|
||||
}
|
||||
g_relvisibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - brightness, 0)) - g_visibility;
|
||||
g_relvisibility = (int32_t)(ClipLow(gVisibility - 32 * pPlayer->visibility - brightness, 0)) - g_visibility;
|
||||
cA += interpolatedvalue(deliriumTurnO, deliriumTurn, gInterpolate * (1. / MaxSmoothRatio));
|
||||
|
||||
if (pSector != nullptr)
|
||||
|
@ -735,21 +737,21 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
}
|
||||
|
||||
if (!sceneonly) hudDraw(gView, pSector, shakeX, shakeY, zDelta, basepal, gInterpolate * (1. / MaxSmoothRatio));
|
||||
if (!sceneonly) hudDraw(pPlayer, pSector, shakeX, shakeY, zDelta, basepal, gInterpolate * (1. / MaxSmoothRatio));
|
||||
fixedhoriz deliriumPitchI = interpolatedvalue(q16horiz(deliriumPitchO), q16horiz(deliriumPitch), gInterpolate * (1. / MaxSmoothRatio));
|
||||
auto bakCstat = gView->actor->spr.cstat;
|
||||
gView->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(gView->actor, vec3_t( cX, cY, cZ ), sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
gView->actor->spr.cstat = bakCstat;
|
||||
auto bakCstat = pPlayer->actor->spr.cstat;
|
||||
pPlayer->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(pPlayer->actor, vec3_t( cX, cY, cZ ), sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
pPlayer->actor->spr.cstat = bakCstat;
|
||||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
int nClipDist = gView->actor->int_clipdist();
|
||||
int nClipDist = pPlayer->actor->int_clipdist();
|
||||
int vec, vf4;
|
||||
Collision c1, c2;
|
||||
GetZRange(gView->actor, &vf4, &c1, &vec, &c2, nClipDist, 0);
|
||||
GetZRange(pPlayer->actor, &vf4, &c1, &vec, &c2, nClipDist, 0);
|
||||
if (sceneonly) return;
|
||||
double look_anghalf = gView->angle.look_anghalf(gInterpolate * (1. / MaxSmoothRatio));
|
||||
DrawCrosshair(kCrosshairTile, gView->actor->xspr.health >> 4, -look_anghalf, 0, 2);
|
||||
double look_anghalf = pPlayer->angle.look_anghalf(gInterpolate * (1. / MaxSmoothRatio));
|
||||
DrawCrosshair(kCrosshairTile, pPlayer->actor->xspr.health >> 4, -look_anghalf, 0, 2);
|
||||
#if 0 // This currently does not work. May have to be redone as a hardware effect.
|
||||
if (v4 && gNetPlayers > 1)
|
||||
{
|
||||
|
@ -782,23 +784,23 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
UpdateDacs(0, true); // keep the view palette active only for the actual 3D view and its overlays.
|
||||
|
||||
MarkSectorSeen(gView->actor->sector());
|
||||
MarkSectorSeen(pPlayer->actor->sector());
|
||||
|
||||
if (automapMode != am_off)
|
||||
{
|
||||
DrawMap(gView->actor, gInterpolate);
|
||||
DrawMap(pPlayer, gInterpolate);
|
||||
}
|
||||
UpdateStatusBar();
|
||||
UpdateStatusBar(pPlayer);
|
||||
|
||||
viewDrawAimedPlayerName();
|
||||
viewDrawAimedPlayerName(pPlayer);
|
||||
if (paused)
|
||||
{
|
||||
auto text = GStrings("TXTB_PAUSED");
|
||||
viewDrawText(PickBigFont(text), text, 160, 10, 0, 0, 1, 0);
|
||||
}
|
||||
else if (gView->nPlayer != myconnectindex)
|
||||
else if (pPlayer->nPlayer != myconnectindex)
|
||||
{
|
||||
FStringf gTempStr("] %s [", PlayerName(gView->nPlayer));
|
||||
FStringf gTempStr("] %s [", PlayerName(pPlayer->nPlayer));
|
||||
viewDrawText(OriginalSmallFont, gTempStr, 160, 10, 0, 0, 1, 0);
|
||||
}
|
||||
if (cl_interpolate)
|
||||
|
@ -839,7 +841,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
if (i == gView->nPlayer || gGameOptions.nGameType == 1)
|
||||
if (i == myconnectindex || gGameOptions.nGameType == 1)
|
||||
{
|
||||
auto actor = gPlayer[i].actor;
|
||||
auto vect = OutAutomapVector(mxy - cpos, cangvect, czoom, xydim);
|
||||
|
|
|
@ -92,13 +92,13 @@ extern DAngle gScreenTiltO, gScreenTilt;
|
|||
extern int gShowFrameRate;
|
||||
extern int gLastPal;
|
||||
|
||||
void hudDraw(PLAYER* gView, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac);
|
||||
void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, double zDelta, int basepal, double interpfrac);
|
||||
void viewInitializePrediction(void);
|
||||
void viewUpdatePrediction(InputPacket* pInput);
|
||||
void viewCorrectPrediction(void);
|
||||
void viewBackupView(int nPlayer);
|
||||
void InitStatusBar(void);
|
||||
void UpdateStatusBar();
|
||||
void UpdateStatusBar(PLAYER* pPlayer);
|
||||
void viewInit(void);
|
||||
void viewprocessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t smooth);
|
||||
void viewSetMessage(const char* pMessage, const char* color = nullptr, const MESSAGE_PRIORITY priority = MESSAGE_PRIORITY_NORMAL);
|
||||
|
@ -108,7 +108,7 @@ void viewSetErrorMessage(const char* pMessage);
|
|||
void DoLensEffect(void);
|
||||
void UpdateDacs(int nPalette, bool bNoTint = false);
|
||||
void viewDrawScreen(bool sceneonly = false);
|
||||
void viewUpdateDelirium(void);
|
||||
void viewUpdateDelirium(PLAYER* pPlayer);
|
||||
void viewSetSystemMessage(const char* pMessage, ...);
|
||||
|
||||
inline void viewInterpolateSector(sectortype* pSector)
|
||||
|
|
Loading…
Reference in a new issue