- Re-standardise horizon around 0 and not 100.

* Blood had this right. It makes sense that the horizon be based around as it's easier to work with.
* Removed all associated game math to deduct default horizon of 100 when doing weapon zvel etc, meaning actual horizon can just be used.
* Re-did return to center function to work on the already converted pitch. Return speed should be 1:1 with previous code.
This commit is contained in:
Mitchell Richters 2020-10-07 13:28:38 +11:00
parent 99e6c718d7
commit 09a05f354c
30 changed files with 144 additions and 163 deletions

View file

@ -100,8 +100,8 @@ struct GameInterface : ::GameInterface
void LevelCompleted(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int a) override;
void SetTileProps(int til, int surf, int vox, int shade) override; void SetTileProps(int til, int surf, int vox, int shade) override;
fixed_t playerHorizMin() override { return IntToFixed(-80); } fixed_t playerHorizMin() override { return IntToFixed(-180); }
fixed_t playerHorizMax() override { return IntToFixed(220); } fixed_t playerHorizMax() override { return IntToFixed(120); }
int playerKeyMove() override { return 1024; } int playerKeyMove() override { return 1024; }
GameStats getStats() override; GameStats getStats() override;

View file

@ -1488,15 +1488,15 @@ void trPlayerCtrlSetLookAngle(XSPRITE* pXSource, PLAYER* pPlayer)
if (abs(look) > 0) if (abs(look) > 0)
{ {
if (pPlayer->q16horiz != IntToFixed(100)) if (pPlayer->q16horiz != 0)
{ {
// move q16horiz back to 100 // move q16horiz back to 0
pPlayer->q16horiz += IntToFixed(25) - (pPlayer->q16horiz >> 2); pPlayer->q16horiz += xs_CRoundToInt(-pPlayer->q16horiz * (1. / 3.));
} }
} }
else else
{ {
pPlayer->q16horiz = IntToFixed(100); pPlayer->q16horiz = 0;
} }
} }

View file

@ -721,7 +721,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4; pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
pPlayer->pSprite->cstat &= (unsigned short)~32768; pPlayer->pSprite->cstat &= (unsigned short)~32768;
pPlayer->bloodlust = 0; pPlayer->bloodlust = 0;
pPlayer->q16horiz = IntToFixed(100); pPlayer->q16horiz = 0;
pPlayer->q16slopehoriz = 0; pPlayer->q16slopehoriz = 0;
pPlayer->slope = 0; pPlayer->slope = 0;
pPlayer->fraggerId = -1; pPlayer->fraggerId = -1;
@ -1587,7 +1587,7 @@ void ProcessInput(PLAYER *pPlayer)
if (klabs(pPlayer->q16slopehoriz) < 4) if (klabs(pPlayer->q16slopehoriz) < 4)
pPlayer->q16slopehoriz = 0; pPlayer->q16slopehoriz = 0;
} }
pPlayer->slope = -(pPlayer->q16horiz - IntToFixed(100)) >> 9; pPlayer->slope = -pPlayer->q16horiz >> 9;
if (pInput->actions & SB_INVPREV) if (pInput->actions & SB_INVPREV)
{ {
pInput->actions&= ~SB_INVPREV; pInput->actions&= ~SB_INVPREV;

View file

@ -263,7 +263,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
if (klabs(predict.at28) < 4) if (klabs(predict.at28) < 4)
predict.at28 = 0; predict.at28 = 0;
} }
predict.at2c = -(predict.at24 - IntToFixed(100)) >> 9; predict.at2c = -predict.at24 >> 9;
} }
void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput) void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)

View file

@ -291,7 +291,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
{ {
int vX = mulscale30(-Cos(nAng), 1280); int vX = mulscale30(-Cos(nAng), 1280);
int vY = mulscale30(-Sin(nAng), 1280); int vY = mulscale30(-Sin(nAng), 1280);
int vZ = FixedToInt(mulscale(zm - IntToFixed(100), 1280, 3))-(16<<8); int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat; int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256; pSprite->cstat &= ~256;
dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors); dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -337,7 +337,7 @@ void CalcPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum,
{ {
int vX = mulscale30(-Cos(nAng), 1280); int vX = mulscale30(-Cos(nAng), 1280);
int vY = mulscale30(-Sin(nAng), 1280); int vY = mulscale30(-Sin(nAng), 1280);
int vZ = FixedToInt(mulscale(zm - IntToFixed(100), 1280, 3))-(16<<8); int vZ = FixedToInt(mulscale(zm, 1280, 3))-(16<<8);
int bakCstat = pSprite->cstat; int bakCstat = pSprite->cstat;
pSprite->cstat &= ~256; pSprite->cstat &= ~256;
dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors); dassert(*vsectnum >= 0 && *vsectnum < kMaxSectors);
@ -716,7 +716,7 @@ void viewDrawScreen(bool sceneonly)
{ {
q16horiz += q16slopehoriz; q16horiz += q16slopehoriz;
} }
cZ += xs_CRoundToInt((q16horiz - IntToFixed(100)) / 6553.6); cZ += xs_CRoundToInt(q16horiz / 6553.6);
cameradist = -1; cameradist = -1;
cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate); cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate);
} }

View file

@ -170,7 +170,7 @@ int32_t ydimen;
int32_t rxi[8], ryi[8]; int32_t rxi[8], ryi[8];
int32_t globalposx, globalposy, globalposz, globalhoriz; int32_t globalposx, globalposy, globalposz;
fixed_t qglobalhoriz; fixed_t qglobalhoriz;
float fglobalposx, fglobalposy, fglobalposz; float fglobalposx, fglobalposy, fglobalposz;
int16_t globalang, globalcursectnum; int16_t globalang, globalcursectnum;
@ -1092,8 +1092,7 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
// xdimenscale is scale(xdimen,yxaspect,320); // xdimenscale is scale(xdimen,yxaspect,320);
// normalization by viewingrange so that center-of-aim doesn't depend on it // normalization by viewingrange so that center-of-aim doesn't depend on it
qglobalhoriz = mulscale16(dahoriz-IntToFixed(100), divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1); qglobalhoriz = mulscale16(dahoriz, divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1);
globalhoriz = FixedToInt(qglobalhoriz);
globalcursectnum = dacursectnum; globalcursectnum = dacursectnum;

View file

@ -87,7 +87,7 @@ extern int16_t maskwall[MAXWALLSB], maskwallcnt;
extern tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1]; extern tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1];
extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen; extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen;
extern float fxdimen; extern float fxdimen;
extern int32_t globalposx, globalposy, globalposz, globalhoriz; extern int32_t globalposx, globalposy, globalposz;
extern fixed_t qglobalhoriz, qglobalang; extern fixed_t qglobalhoriz, qglobalang;
extern float fglobalposx, fglobalposy, fglobalposz; extern float fglobalposx, fglobalposy, fglobalposz;
extern int16_t globalang, globalcursectnum; extern int16_t globalang, globalcursectnum;

View file

@ -2872,8 +2872,7 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang
set_globalpos(dax, day, daz); set_globalpos(dax, day, daz);
set_globalang(daang); set_globalang(daang);
globalhoriz = mulscale16(FixedToInt(dahoriz)-100,divscale16(xdimenscale,viewingrange))+(ydimen>>1); qglobalhoriz = mulscale16(dahoriz, divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1);
qglobalhoriz = mulscale16(dahoriz-IntToFixed(100), divscale16(xdimenscale, viewingrange))+IntToFixed(ydimen>>1);
gyxscale = ((float)xdimenscale)*(1.0f/131072.f); gyxscale = ((float)xdimenscale)*(1.0f/131072.f);
gxyaspect = ((double)xyaspect*fviewingrange)*(5.0/(65536.0*262144.0)); gxyaspect = ((double)xyaspect*fviewingrange)*(5.0/(65536.0*262144.0));
gviewxrange = fviewingrange * fxdimen * (1.f/(32768.f*1024.f)); gviewxrange = fviewingrange * fxdimen * (1.f/(32768.f*1024.f));

View file

@ -1571,12 +1571,12 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
void sethorizon(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust) void sethorizon(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust)
{ {
// Calculate adjustment as true pitch (Fixed point math really sucks...) // Calculate adjustment as true pitch (Fixed point math really sucks...)
double horizAngle = atan2(*q16horiz - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()); double horizAngle = atan2(*q16horiz, IntToFixed(128)) * (512. / pi::pi());
if (q16horz) if (q16horz)
{ {
*actions &= ~SB_CENTERVIEW; *actions &= ~SB_CENTERVIEW;
horizAngle = clamp(horizAngle + FixedToFloat(q16horz), -180, 180); horizAngle += FixedToFloat(q16horz);
} }
// this is the locked type // this is the locked type
@ -1605,27 +1605,27 @@ void sethorizon(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, do
horizAngle += scaleAdjust * amount; horizAngle += scaleAdjust * amount;
} }
// convert back to Build's horizon // clamp horizAngle after processing
*q16horiz = IntToFixed(100) + xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))); horizAngle = clamp(horizAngle, -180, 180);
// return to center if conditions met. // return to center if conditions met.
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN))) if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
{ {
if (*q16horiz < FloatToFixed(99.75) || *q16horiz > FloatToFixed(100.25)) if (abs(horizAngle) > 0.275)
{ {
// move *q16horiz back to 100 // move horizAngle back to 0
*q16horiz += xs_CRoundToInt(scaleAdjust * (((1000. / GameTicRate) * FRACUNIT) - (*q16horiz * (10. / GameTicRate)))); horizAngle += -scaleAdjust * horizAngle * (9. / GameTicRate);
} }
else else
{ {
// not looking anymore because *q16horiz is back at 100 // not looking anymore because horizAngle is back at 0
*q16horiz = IntToFixed(100); horizAngle = 0;
*actions &= ~SB_CENTERVIEW; *actions &= ~SB_CENTERVIEW;
} }
} }
// clamp before returning // clamp before returning
*q16horiz = clamp(*q16horiz, gi->playerHorizMin(), gi->playerHorizMax()); *q16horiz = clamp(xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))), gi->playerHorizMin(), gi->playerHorizMax());
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -108,8 +108,8 @@ struct GameInterface
virtual void LevelCompleted(MapRecord* map, int skill) {} virtual void LevelCompleted(MapRecord* map, int skill) {}
virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; } virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; }
virtual void SetTileProps(int tile, int surf, int vox, int shade) {} virtual void SetTileProps(int tile, int surf, int vox, int shade) {}
virtual fixed_t playerHorizMin() { return IntToFixed(-99); } virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
virtual fixed_t playerHorizMax() { return IntToFixed(299); } virtual fixed_t playerHorizMax() { return IntToFixed(200); }
virtual int playerKeyMove() { return 0; } virtual int playerKeyMove() { return 0; }
virtual FString statFPS() virtual FString statFPS()

View file

@ -261,8 +261,8 @@ struct GameInterface : ::GameInterface
void LevelCompleted(MapRecord *map, int skill) override; void LevelCompleted(MapRecord *map, int skill) override;
void NextLevel(MapRecord *map, int skill) override; void NextLevel(MapRecord *map, int skill) override;
bool DrawAutomapPlayer(int x, int y, int z, int a) override; bool DrawAutomapPlayer(int x, int y, int z, int a) override;
fixed_t playerHorizMin() override { return IntToFixed(-50); } fixed_t playerHorizMin() override { return IntToFixed(-150); }
fixed_t playerHorizMax() override { return IntToFixed(250); } fixed_t playerHorizMax() override { return IntToFixed(150); }
int playerKeyMove() override { return 6; } int playerKeyMove() override { return 6; }
::GameStats getStats() override; ::GameStats getStats() override;

View file

@ -739,7 +739,7 @@ loc_flag:
// loc_27266: // loc_27266:
case kWeaponSword: case kWeaponSword:
{ {
nHeight += (IntToFixed(100) - PlayerList[nLocalPlayer].q16horiz) >> 10; nHeight += -PlayerList[nLocalPlayer].q16horiz >> 10;
theZ += nHeight; theZ += nHeight;
@ -844,7 +844,7 @@ loc_flag:
} }
case kWeaponPistol: case kWeaponPistol:
{ {
int var_50 = (PlayerList[nLocalPlayer].q16horiz - IntToFixed(100)) >> 14; int var_50 = PlayerList[nLocalPlayer].q16horiz >> 14;
nHeight -= var_50; nHeight -= var_50;
if (sPlayerInput[nPlayer].nTarget >= 0 && cl_autoaim) if (sPlayerInput[nPlayer].nTarget >= 0 && cl_autoaim)
@ -859,7 +859,7 @@ loc_flag:
case kWeaponGrenade: case kWeaponGrenade:
{ {
ThrowGrenade(nPlayer, ebp, ebx, nHeight - 2560, FixedToInt(PlayerList[nLocalPlayer].q16horiz) - 100); ThrowGrenade(nPlayer, ebp, ebx, nHeight - 2560, FixedToInt(PlayerList[nLocalPlayer].q16horiz));
break; break;
} }
case kWeaponStaff: case kWeaponStaff:

View file

@ -438,7 +438,7 @@ void RestartPlayer(short nPlayer)
nYDamage[nPlayer] = 0; nYDamage[nPlayer] = 0;
nXDamage[nPlayer] = 0; nXDamage[nPlayer] = 0;
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = IntToFixed(100); PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = 0;
nBreathTimer[nPlayer] = 90; nBreathTimer[nPlayer] = 90;
nTauntTimer[nPlayer] = RandomSize(3) + 3; nTauntTimer[nPlayer] = RandomSize(3) + 3;
@ -535,7 +535,7 @@ void StartDeathSeq(int nPlayer, int nVal)
StopFiringWeapon(nPlayer); StopFiringWeapon(nPlayer);
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = IntToFixed(100); PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = 0;
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080; oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
nPlayerInvisible[nPlayer] = 0; nPlayerInvisible[nPlayer] = 0;
dVertPan[nPlayer] = 15; dVertPan[nPlayer] = 15;
@ -1050,7 +1050,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle; PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
sprite[nPlayerSprite].ang = ang; sprite[nPlayerSprite].ang = ang;
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 0);
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz; PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz;
lPlayerXVel = 0; lPlayerXVel = 0;
@ -1069,11 +1069,11 @@ void FuncPlayer(int a, int nDamage, int nRun)
if (currentLevel->levelNumber == 11) if (currentLevel->levelNumber == 11)
{ {
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 146); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 46);
} }
else else
{ {
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 111); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 11);
} }
} }
} }
@ -1101,7 +1101,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
zVelB = -zVelB; zVelB = -zVelB;
} }
if (zVelB > 512 && PlayerList[nPlayer].q16angle != IntToFixed(100) && (sPlayerInput[nPlayer].actions & (SB_AIMMODE))) { if (zVelB > 512 && PlayerList[nPlayer].q16horiz != 0 && (sPlayerInput[nPlayer].actions & (SB_AIMMODE))) {
sPlayerInput[nPlayer].actions |= SB_CENTERVIEW; sPlayerInput[nPlayer].actions |= SB_CENTERVIEW;
} }
} }
@ -2789,9 +2789,9 @@ loc_1BD2E:
} }
else else
{ {
if (PlayerList[nPlayer].q16horiz < IntToFixed(100)) if (PlayerList[nPlayer].q16horiz < 0)
{ {
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 0);
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8); eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
} }
else else
@ -2802,7 +2802,7 @@ loc_1BD2E:
{ {
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, gi->playerHorizMax()); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, gi->playerHorizMax());
} }
else if (PlayerList[nPlayer].q16horiz <= IntToFixed(100)) else if (PlayerList[nPlayer].q16horiz <= 0)
{ {
if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater)) if (!(SectFlag[sprite[nPlayerSprite].sectnum] & kSectUnderwater))
{ {

View file

@ -313,7 +313,7 @@ void DrawView(double smoothRatio, bool sceneonly)
{ {
if (nSnakeCam >= 0 && !sceneonly) if (nSnakeCam >= 0 && !sceneonly)
{ {
pan = IntToFixed(100); pan = 0;
viewz = playerZ; viewz = playerZ;
} }
else else
@ -344,7 +344,7 @@ void DrawView(double smoothRatio, bool sceneonly)
-2000 * Sin(inita), -2000 * Sin(inita),
4, 0, 0, CLIPMASK1); 4, 0, 0, CLIPMASK1);
pan = IntToFixed(100); pan = 0;
viewz = playerZ; viewz = playerZ;
} }

View file

@ -2504,7 +2504,7 @@ static void greenslime(int i)
s->z = ps[p].posz + ps[p].pyoff - t[2] + (8 << 8); s->z = ps[p].posz + ps[p].pyoff - t[2] + (8 << 8);
s->z += (IntToFixed(100) - ps[p].getq16horiz()) >> 12; s->z += -ps[p].getq16horiz() >> 12;
if (t[2] > 512) if (t[2] > 512)
t[2] -= 128; t[2] -= 128;

View file

@ -376,8 +376,6 @@ enum miscConstants
FOURSLEIGHT = (1 << 8), FOURSLEIGHT = (1 << 8),
MOVEFIFOSIZ =256, MOVEFIFOSIZ =256,
HORIZ_MIN =-99,
HORIZ_MAX =299,
AUTO_AIM_ANGLE =48, AUTO_AIM_ANGLE =48,
PHEIGHT_DUKE =(38<<8), PHEIGHT_DUKE =(38<<8),
PHEIGHT_RR =(40<<8), PHEIGHT_RR =(40<<8),

View file

@ -330,12 +330,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_HORIZ: case PLAYER_HORIZ:
if (bSet) playerSetHoriz(&ps[iPlayer].q16horiz, &ps[iPlayer].horizTarget, lValue); if (bSet) playerSetHoriz(&ps[iPlayer].q16horiz, &ps[iPlayer].horizTarget - 100, lValue);
else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16horiz), sActor, sPlayer); else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16horiz + 100), sActor, sPlayer);
break; break;
case PLAYER_OHORIZ: case PLAYER_OHORIZ:
if (!bSet) SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16horiz), sActor, sPlayer); if (!bSet) SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16horiz + 100), sActor, sPlayer);
break; break;
case PLAYER_OHORIZOFF: case PLAYER_OHORIZOFF:
@ -2246,7 +2246,7 @@ int ParseState::parse(void)
ps[g_p].last_extra = g_sp->extra = max_player_health; ps[g_p].last_extra = g_sp->extra = max_player_health;
ps[g_p].wantweaponfire = -1; ps[g_p].wantweaponfire = -1;
ps[g_p].sethoriz(100); ps[g_p].sethoriz(0);
ps[g_p].on_crane = -1; ps[g_p].on_crane = -1;
ps[g_p].frag_ps = g_p; ps[g_p].frag_ps = g_p;
ps[g_p].sethorizoff(0); ps[g_p].sethorizoff(0);

View file

@ -375,7 +375,7 @@ int aim(spritetype* s, int aang)
if (sdist > 512 && sdist < smax) if (sdist > 512 && sdist < smax)
{ {
if (s->picnum == TILE_APLAYER) if (s->picnum == TILE_APLAYER)
a = (abs(scale(sp->z - s->z, 10, sdist) - (ps[s->yvel].gethorizsum() - 100)) < 100); a = (abs(scale(sp->z - s->z, 10, sdist) - ps[s->yvel].gethorizsum()) < 100);
else a = 1; else a = 1;
cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + actorinfo[sp->picnum].aimoffset, sp->sectnum, s->x, s->y, s->z - (32 << 8), s->sectnum); cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + actorinfo[sp->picnum].aimoffset, sp->sectnum, s->x, s->y, s->z - (32 << 8), s->sectnum);
@ -649,7 +649,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
backupplayer(p); backupplayer(p);
p->sethoriz(100); p->sethoriz(0);
p->q16horizoff = 0; p->q16horizoff = 0;
updatesector(p->posx, p->posy, &p->cursectnum); updatesector(p->posx, p->posy, &p->cursectnum);
@ -1094,7 +1094,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
nx = (sintable[(ang + 1536) & 2047] >> 4); nx = (sintable[(ang + 1536) & 2047] >> 4);
ny = (sintable[(ang + 1024) & 2047] >> 4); ny = (sintable[(ang + 1024) & 2047] >> 4);
nz = (q16horiz - IntToFixed(100)) >> 9; nz = q16horiz >> 9;
sp = &sprite[pp->i]; sp = &sprite[pp->i];

View file

@ -166,7 +166,7 @@ void shoot_d(int i, int atwith)
} }
else else
{ {
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (98. / FRACUNIT));
sx += sintable[(sa + 860) & 0x7FF] / 448; sx += sintable[(sa + 860) & 0x7FF] / 448;
sy += sintable[(sa + 348) & 0x7FF] / 448; sy += sintable[(sa + 348) & 0x7FF] / 448;
sz += (3 << 8); sz += (3 << 8);
@ -224,7 +224,7 @@ void shoot_d(int i, int atwith)
} }
else else
{ {
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (81. / FRACUNIT));
if (sprite[ps[p].i].xvel != 0) if (sprite[ps[p].i].xvel != 0)
vel = (int)((((512 - (1024 vel = (int)((((512 - (1024
- abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024))) - abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024)))
@ -292,7 +292,7 @@ void shoot_d(int i, int atwith)
{ {
if (p >= 0) if (p >= 0)
{ {
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
sz += (6 << 8); sz += (6 << 8);
sa += 15; sa += 15;
} }
@ -464,14 +464,14 @@ void shoot_d(int i, int atwith)
if (j == -1) if (j == -1)
{ {
// no target // no target
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
} }
zvel += (zRange / 2) - (krand() & (zRange - 1)); zvel += (zRange / 2) - (krand() & (zRange - 1));
} }
else if (j == -1) else if (j == -1)
{ {
sa += 16 - (krand() & 31); sa += 16 - (krand() & 31);
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
zvel += 128 - (krand() & 255); zvel += 128 - (krand() & 255);
} }
@ -681,7 +681,7 @@ void shoot_d(int i, int atwith)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy); sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
} }
else else
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (98. / FRACUNIT));
} }
else else
{ {
@ -769,7 +769,7 @@ void shoot_d(int i, int atwith)
if (sprite[j].picnum != RECON) if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy); sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
} }
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); else zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (81. / FRACUNIT));
if (atwith == RPG) if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, i); S_PlayActorSound(RPG_SHOOT, i);
@ -914,7 +914,7 @@ void shoot_d(int i, int atwith)
case HANDHOLDINGLASER: case HANDHOLDINGLASER:
if (p >= 0) if (p >= 0)
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
else zvel = 0; else zvel = 0;
hitscan(sx, sy, sz - ps[p].pyoff, sect, hitscan(sx, sy, sz - ps[p].pyoff, sect,
@ -1015,7 +1015,7 @@ void shoot_d(int i, int atwith)
else else
{ {
sa += 16 - (krand() & 31); sa += 16 - (krand() & 31);
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
zvel += 128 - (krand() & 255); zvel += 128 - (krand() & 255);
} }
@ -1090,7 +1090,7 @@ void shoot_d(int i, int atwith)
zvel = ((sprite[j].z - sz - dal - (4 << 8)) * 768) / (ldist(&sprite[ps[p].i], &sprite[j])); zvel = ((sprite[j].z - sz - dal - (4 << 8)) * 768) / (ldist(&sprite[ps[p].i], &sprite[j]));
sa = getangle(sprite[j].x - sx, sprite[j].y - sy); sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
} }
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); else zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (98. / FRACUNIT));
} }
else if (s->statnum != 3) else if (s->statnum != 3)
{ {
@ -1940,7 +1940,7 @@ int operateTripbomb(int snum)
hitscan(p->posx, p->posy, p->posz, hitscan(p->posx, p->posy, p->posz,
p->cursectnum, sintable[(p->getang() + 512) & 2047], p->cursectnum, sintable[(p->getang() + 512) & 2047],
sintable[p->getang() & 2047], (IntToFixed(100) - p->getq16horizsum()) >> 11, sintable[p->getang() & 2047], -p->getq16horizsum() >> 11,
&sect, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1); &sect, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1);
if (sect < 0 || hitsp >= 0) if (sect < 0 || hitsp >= 0)
@ -2122,12 +2122,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH)) if (p->on_ground && (actions & SB_CROUCH))
{ {
k = 15; k = 15;
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
else else
{ {
k = 140; k = 140;
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = -512 - xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,

View file

@ -154,7 +154,7 @@ void shoot_r(int i, int atwith)
{ {
if (p >= 0) if (p >= 0)
{ {
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
sz += (6 << 8); sz += (6 << 8);
sa += 15; sa += 15;
} }
@ -333,7 +333,7 @@ void shoot_r(int i, int atwith)
if (j == -1) if (j == -1)
{ {
sa += 16 - (krand() & 31); sa += 16 - (krand() & 31);
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; zvel = -ps[p].getq16horizsum() >> 11;
zvel += 128 - (krand() & 255); zvel += 128 - (krand() & 255);
} }
} }
@ -343,7 +343,7 @@ void shoot_r(int i, int atwith)
sa += 64 - (krand() & 127); sa += 64 - (krand() & 127);
else else
sa += 16 - (krand() & 31); sa += 16 - (krand() & 31);
if (j == -1) zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11; if (j == -1) zvel = -ps[p].getq16horizsum() >> 11;
zvel += 128 - (krand() & 255); zvel += 128 - (krand() & 255);
} }
sz -= (2 << 8); sz -= (2 << 8);
@ -602,7 +602,7 @@ void shoot_r(int i, int atwith)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy); sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
} }
else else
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (98. / FRACUNIT));
} }
else else
{ {
@ -693,7 +693,7 @@ void shoot_r(int i, int atwith)
{ {
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7; sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
sy += sintable[(s->ang + 160) & 2047] >> 7; sy += sintable[(s->ang + 160) & 2047] >> 7;
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / FRACUNIT)); zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (98. / FRACUNIT));
} }
} }
else else
@ -804,7 +804,7 @@ void shoot_r(int i, int atwith)
if (sprite[j].picnum != RECON) if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy); sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
} }
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / FRACUNIT)); else zvel = xs_CRoundToInt(-ps[p].getq16horizsum() * (81. / FRACUNIT));
if (atwith == RPG) if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, i); S_PlayActorSound(RPG_SHOOT, i);
else if (isRRRA()) else if (isRRRA())
@ -1476,7 +1476,7 @@ void checkweapons_r(struct player_struct* p)
sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON];
p->OnMotorcycle = 0; p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon.Clear(MOTORCYCLE_WEAPON);
p->sethoriz(100); p->sethoriz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;
@ -1492,7 +1492,7 @@ void checkweapons_r(struct player_struct* p)
sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
p->OnBoat = 0; p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon.Clear(BOAT_WEAPON);
p->sethoriz(100); p->sethoriz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;
@ -2843,12 +2843,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{ {
k = 15; k = 15;
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
else else
{ {
k = 140; k = 140;
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = -512 - xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
@ -3253,12 +3253,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle) if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{ {
k = 15; k = 15;
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
else else
{ {
k = 32; k = 32;
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = -512 - xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
@ -4181,7 +4181,7 @@ void OnMotorcycle(struct player_struct *p, int motosprite)
p->gotweapon.Set(MOTORCYCLE_WEAPON); p->gotweapon.Set(MOTORCYCLE_WEAPON);
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->sethoriz(100); p->sethoriz(0);
} }
if (!S_CheckActorSoundPlaying(p->i,186)) if (!S_CheckActorSoundPlaying(p->i,186))
S_PlayActorSound(186, p->i); S_PlayActorSound(186, p->i);
@ -4212,7 +4212,7 @@ void OffMotorcycle(struct player_struct *p)
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon.Clear(MOTORCYCLE_WEAPON);
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->sethoriz(100); p->sethoriz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;
@ -4258,7 +4258,7 @@ void OnBoat(struct player_struct *p, int boatsprite)
p->gotweapon.Set(BOAT_WEAPON); p->gotweapon.Set(BOAT_WEAPON);
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->sethoriz(100); p->sethoriz(0);
} }
} }
@ -4277,7 +4277,7 @@ void OffBoat(struct player_struct *p)
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon.Clear(BOAT_WEAPON);
p->curr_weapon = p->last_full_weapon; p->curr_weapon = p->last_full_weapon;
checkavailweapon(p); checkavailweapon(p);
p->sethoriz(100); p->sethoriz(0);
p->moto_do_bump = 0; p->moto_do_bump = 0;
p->MotoSpeed = 0; p->MotoSpeed = 0;
p->TiltStatus = 0; p->TiltStatus = 0;

View file

@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH)) if (p->on_ground && (actions & SB_CROUCH))
{ {
k = 15; k = 15;
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
else else
{ {
k = 140; k = 140;
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / FRACUNIT)); i = -512 - xs_CRoundToInt(p->getq16horizsum() * (20. / FRACUNIT));
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,

View file

@ -112,7 +112,7 @@ void resetplayerstats(int snum)
p->footprintpal = 0; p->footprintpal = 0;
p->footprintshade = 0; p->footprintshade = 0;
p->jumping_toggle = 0; p->jumping_toggle = 0;
p->sethoriz(140); //!! p->sethoriz(40); //!!
p->oq16horiz = p->q16horiz; p->oq16horiz = p->q16horiz;
p->sethorizoff(0); p->sethorizoff(0);
p->oq16horizoff = p->q16horizoff; p->oq16horizoff = p->q16horizoff;

View file

@ -593,7 +593,7 @@ void displayrooms(int snum, double smoothratio)
if (p->newowner >= 0) if (p->newowner >= 0)
{ {
cang = buildang(getcamspriteang(p->newowner, smoothratio)); cang = buildang(getcamspriteang(p->newowner, smoothratio));
choriz = q16horiz(p->q16horiz + p->q16horizoff); choriz = buildhoriz(sprite[p->newowner].shade);
cposx = sprite[p->newowner].pos.x; cposx = sprite[p->newowner].pos.x;
cposy = sprite[p->newowner].pos.y; cposy = sprite[p->newowner].pos.y;
cposz = sprite[p->newowner].pos.z; cposz = sprite[p->newowner].pos.z;
@ -630,9 +630,6 @@ void displayrooms(int snum, double smoothratio)
if (sprite[p->i].pal == 1) cposz -= (18 << 8); if (sprite[p->i].pal == 1) cposz -= (18 << 8);
if (p->newowner >= 0)
choriz = buildhoriz(100 + sprite[p->newowner].shade);
else if (p->spritebridge == 0) else if (p->spritebridge == 0)
{ {
if (cposz < (p->truecz + (4 << 8))) cposz = cz + (4 << 8); if (cposz < (p->truecz + (4 << 8))) cposz = cz + (4 << 8);
@ -646,7 +643,7 @@ void displayrooms(int snum, double smoothratio)
if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8); if (cposz > fz - (4 << 8)) cposz = fz - (4 << 8);
} }
choriz = clamp(choriz, buildhoriz(HORIZ_MIN), buildhoriz(HORIZ_MAX)); choriz = clamp(choriz, q16horiz(gi->playerHorizMin()), q16horiz(gi->playerHorizMax()));
if (isRR() && sector[sect].lotag == 848) if (isRR() && sector[sect].lotag == 848)
{ {

View file

@ -438,7 +438,7 @@ void initshell(int j, int i, bool isshell)
a = ps[snum].getang() - (krand() & 63) + 8; //Fine tune a = ps[snum].getang() - (krand() & 63) + 8; //Fine tune
t[0] = krand() & 1; t[0] = krand() & 1;
sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - ((ps[snum].q16horizoff + ps[snum].q16horiz - IntToFixed(100)) >> 12) + (!isshell ? (3 << 8) : 0); sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - (ps[snum].getq16horizsum() >> 12) + (!isshell ? (3 << 8) : 0);
sp->zvel = -(krand() & 255); sp->zvel = -(krand() & 255);
} }
else else

View file

@ -945,7 +945,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16h
// Calculate the vector (nx,ny,nz) to shoot backwards // Calculate the vector (nx,ny,nz) to shoot backwards
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3); vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
vy = (sintable[NORM_ANGLE(ang + 1024)] >> 3); vy = (sintable[NORM_ANGLE(ang + 1024)] >> 3);
vz = (q16horiz - IntToFixed(100)) >> 8; vz = q16horiz >> 8;
// Player sprite of current view // Player sprite of current view
sp = &sprite[pp->PlayerSprite]; sp = &sprite[pp->PlayerSprite];
@ -1074,7 +1074,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16h
vx += DIV2(vx); vx += DIV2(vx);
vy += DIV2(vy); vy += DIV2(vy);
vz = (q16horiz - IntToFixed(100)) >> 8; vz = q16horiz >> 8;
// Player sprite of current view // Player sprite of current view
sp = &sprite[pp->PlayerSprite]; sp = &sprite[pp->PlayerSprite];
@ -1300,7 +1300,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
{ {
case 1: case 1:
pp->last_camera_sp = sp; pp->last_camera_sp = sp;
CircleCamera(tx, ty, tz, tsectnum, tq16ang, IntToFixed(100)); CircleCamera(tx, ty, tz, tsectnum, tq16ang, 0);
found_camera = true; found_camera = true;
break; break;
@ -1326,9 +1326,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
zvect = 0; zvect = 0;
// new horiz to player // new horiz to player
*tq16horiz = IntToFixed(100) - (zvect << 8); *tq16horiz = clamp(-(zvect << 8), gi->playerHorizMin(), gi->playerHorizMax());
*tq16horiz = max(*tq16horiz, IntToFixed(PLAYER_HORIZ_MIN));
*tq16horiz = min(*tq16horiz, IntToFixed(PLAYER_HORIZ_MAX));
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz); //DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz);
MONO_PRINT(ds); MONO_PRINT(ds);
@ -1739,9 +1737,7 @@ drawscreen(PLAYERp pp, double smoothratio)
} }
// recoil only when not in camera // recoil only when not in camera
tq16horiz = tq16horiz + pp->recoil_horizoff; tq16horiz = clamp(tq16horiz + pp->recoil_horizoff, gi->playerHorizMin(), gi->playerHorizMax());
tq16horiz = max(tq16horiz, IntToFixed(PLAYER_HORIZ_MIN));
tq16horiz = min(tq16horiz, IntToFixed(PLAYER_HORIZ_MAX));
} }
if (automapMode != am_full)// && !ScreenSavePic) if (automapMode != am_full)// && !ScreenSavePic)

View file

@ -684,14 +684,10 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
// 100! // 100!
if (SP_TAG7(sp) != 0) if (SP_TAG7(sp) != 0)
{ {
camhoriz = SP_TAG7(sp); camhoriz = clamp(SP_TAG7(sp), gi->playerHorizMin(), gi->playerHorizMax());
if (camhoriz > PLAYER_HORIZ_MAX)
camhoriz = PLAYER_HORIZ_MAX;
else if (camhoriz < PLAYER_HORIZ_MIN)
camhoriz = PLAYER_HORIZ_MIN;
} }
else else
camhoriz = 100; // Default camhoriz = 0; // Default
// If player is dead still then update at MoveSkip4 // If player is dead still then update at MoveSkip4
// rate. // rate.

View file

@ -1418,7 +1418,7 @@ PlayerInitChemBomb(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
// //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff), // //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff),
// FixedToInt(pp->q16horizoff + pp->q16horiz)); // FixedToInt(pp->q16horizoff + pp->q16horiz));
@ -1489,7 +1489,7 @@ InitSpriteChemBomb(int16_t SpriteNum)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_BLOCK); SET(wp->cstat, CSTAT_SPRITE_BLOCK);
wp->zvel = ((-100 - RANDOM_RANGE(100)) * HORIZ_MULT); wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT;
wp->clipdist = 80L >> 2; wp->clipdist = 80L >> 2;
@ -1551,7 +1551,7 @@ InitChemBomb(short SpriteNum)
if (SpriteInUnderwaterArea(wp)) if (SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
wp->zvel = ((-100 - RANDOM_RANGE(100)) * HORIZ_MULT); wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT;
wp->clipdist = 0; wp->clipdist = 0;
if (u->ID == MUSHROOM_CLOUD || u->ID == 3121 || u->ID == SUMO_RUN_R0) // 3121 == GRENADE_EXP if (u->ID == MUSHROOM_CLOUD || u->ID == 3121 || u->ID == SUMO_RUN_R0) // 3121 == GRENADE_EXP
@ -1862,7 +1862,7 @@ PlayerInitCaltrops(PLAYERp pp)
// They go out at different angles // They go out at different angles
// wp->ang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); // wp->ang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
oclipdist = pp->SpriteP->clipdist; oclipdist = pp->SpriteP->clipdist;
pp->SpriteP->clipdist = 0; pp->SpriteP->clipdist = 0;
@ -1928,7 +1928,7 @@ InitCaltrops(int16_t SpriteNum)
wu->floor_dist = Z(3); wu->floor_dist = Z(3);
wu->Counter = 0; wu->Counter = 0;
wp->zvel = ((-100 - RANDOM_RANGE(100)) * HORIZ_MULT); wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT;
// wp->clipdist = 80L>>2; // wp->clipdist = 80L>>2;
@ -1990,7 +1990,7 @@ InitPhosphorus(int16_t SpriteNum)
wu->floor_dist = Z(3); wu->floor_dist = Z(3);
wu->Counter = 0; wu->Counter = 0;
wp->zvel = ((-100 - RANDOM_RANGE(100)) * HORIZ_MULT); wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT;
wu->xchange = MOVEx(wp->xvel, wp->ang); wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang);
@ -2496,7 +2496,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
if (u->PlayerP) if (u->PlayerP)
{ {
wp->z += xs_CRoundToInt((IntToFixed(100) - u->PlayerP->q16horiz) * ((HORIZ_MULT / 3.) / FRACUNIT)); wp->z += xs_CRoundToInt(-u->PlayerP->q16horiz * ((HORIZ_MULT / 3.) / FRACUNIT));
} }
switch (wu->ID) switch (wu->ID)

View file

@ -1744,10 +1744,10 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust)
sethorizon(&pp->q16horizbase, q16horz, &pp->input.actions, scaleAdjust); sethorizon(&pp->q16horizbase, q16horz, &pp->input.actions, scaleAdjust);
// bound adjust q16horizoff // bound adjust q16horizoff
if (pp->q16horizbase + pp->q16horizoff < IntToFixed(PLAYER_HORIZ_MIN)) if (pp->q16horizbase + pp->q16horizoff < gi->playerHorizMin())
pp->q16horizoff = IntToFixed(PLAYER_HORIZ_MIN) - pp->q16horizbase; pp->q16horizoff = gi->playerHorizMin() - pp->q16horizbase;
else if (pp->q16horizbase + pp->q16horizoff > IntToFixed(PLAYER_HORIZ_MAX)) else if (pp->q16horizbase + pp->q16horizoff > gi->playerHorizMax())
pp->q16horizoff = IntToFixed(PLAYER_HORIZ_MAX) - pp->q16horizbase; pp->q16horizoff = gi->playerHorizMax() - pp->q16horizbase;
// add base and offsets // add base and offsets
pp->q16horiz = pp->q16horizbase + pp->q16horizoff; pp->q16horiz = pp->q16horizbase + pp->q16horizoff;
@ -6308,7 +6308,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
sp->yrepeat = PLAYER_NINJA_YREPEAT; sp->yrepeat = PLAYER_NINJA_YREPEAT;
//pp->tilt = 0; //pp->tilt = 0;
pp->q16horiz = pp->q16horizbase = IntToFixed(100); pp->q16horiz = pp->q16horizbase = 0;
DoPlayerResetMovement(pp); DoPlayerResetMovement(pp);
u->ID = NINJA_RUN_R0; u->ID = NINJA_RUN_R0;
PlayerDeathReset(pp); PlayerDeathReset(pp);
@ -7360,7 +7360,7 @@ InitAllPlayers(void)
//getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz); //getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz);
//pfirst->posz = fz - PLAYER_HEIGHT; //pfirst->posz = fz - PLAYER_HEIGHT;
pfirst->q16horiz = pfirst->q16horizbase = IntToFixed(100); pfirst->q16horiz = pfirst->q16horizbase = 0;
// Initialize all [MAX_SW_PLAYERS] arrays here! // Initialize all [MAX_SW_PLAYERS] arrays here!
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++) for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)

View file

@ -28,10 +28,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#define PLAYER_H #define PLAYER_H
#define PLAYER_HORIZ_MAX 299 // !JIM! was 199 and 5
#define PLAYER_HORIZ_MIN -99 // Had to make plax sky pan up/down like in Duke
// But this is MUCH better!
#define MIN_SWIM_DEPTH 15 #define MIN_SWIM_DEPTH 15
// Player view height // Player view height

View file

@ -12826,7 +12826,7 @@ DoRing(int16_t Weapon)
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14; sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14; sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
if (User[sp->owner]->PlayerP) if (User[sp->owner]->PlayerP)
sp->z += (u->Dist * ((IntToFixed(100) - pp->q16horiz) >> 9)) >> 9; sp->z += (u->Dist * (-pp->q16horiz >> 9)) >> 9;
//sp->ang = NORM_ANGLE(sp->ang + 512); //sp->ang = NORM_ANGLE(sp->ang + 512);
//updatesector(sp->x, sp->y); //updatesector(sp->x, sp->y);
@ -12913,7 +12913,7 @@ InitSpellRing(PLAYERp pp)
// put it out there // put it out there
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14; sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14; sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
sp->z = pp->posz + Z(20) + ((u->Dist * ((IntToFixed(100) - pp->q16horiz) >> 9)) >> 9); sp->z = pp->posz + Z(20) + ((u->Dist * (-pp->q16horiz >> 9)) >> 9);
sp->ang = NORM_ANGLE(sp->ang + 512); sp->ang = NORM_ANGLE(sp->ang + 512);
@ -13452,7 +13452,7 @@ InitSpellNapalm(PLAYERp pp)
sp->xrepeat = 32; sp->xrepeat = 32;
sp->yrepeat = 32; sp->yrepeat = 32;
sp->clipdist = 0; sp->clipdist = 0;
sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; sp->zvel = -pp->q16horiz >> 9;
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
SET(u->Flags2, SPR2_BLUR_TAPER_FAST); SET(u->Flags2, SPR2_BLUR_TAPER_FAST);
@ -13607,7 +13607,7 @@ InitSpellMirv(PLAYERp pp)
sp->xrepeat = 72; sp->xrepeat = 72;
sp->yrepeat = 72; sp->yrepeat = 72;
sp->clipdist = 32L >> 2; sp->clipdist = 32L >> 2;
sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; sp->zvel = -pp->q16horiz >> 9;
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
@ -13758,7 +13758,7 @@ InitSwordAttack(PLAYERp pp)
int daz; int daz;
daang = FixedToInt(pp->q16ang); daang = FixedToInt(pp->q16ang);
daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); daz = xs_CRoundToInt(-pp->q16horiz * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
@ -13948,7 +13948,7 @@ InitFistAttack(PLAYERp pp)
int daz; int daz;
daang = FixedToInt(pp->q16ang); daang = FixedToInt(pp->q16ang);
daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); daz = xs_CRoundToInt(-pp->q16horiz * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
@ -14621,7 +14621,7 @@ InitStar(PLAYERp pp)
wp->clipdist = 32L >> 2; wp->clipdist = 32L >> 2;
// wp->zvel was overflowing with this calculation - had to move to a local // wp->zvel was overflowing with this calculation - had to move to a local
// long var // long var
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT));
wu->ceiling_dist = Z(1); wu->ceiling_dist = Z(1);
wu->floor_dist = Z(1); wu->floor_dist = Z(1);
@ -14678,7 +14678,7 @@ InitStar(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np)) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np))
SET(nu->Flags, SPR_UNDERWATER); SET(nu->Flags, SPR_UNDERWATER);
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((double)(HORIZ_MULT+STAR_HORIZ_ADJ) / FRACUNIT));
np->zvel = zvel >> 1; np->zvel = zvel >> 1;
if (MissileSetPos(nw, DoStar, 1000)) if (MissileSetPos(nw, DoStar, 1000))
@ -14742,7 +14742,7 @@ InitHeartAttack(PLAYERp pp)
sp->xrepeat = 52; sp->xrepeat = 52;
sp->yrepeat = 52; sp->yrepeat = 52;
sp->clipdist = 0; sp->clipdist = 0;
sp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; sp->zvel = -pp->q16horiz >> 9;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
SET(u->Flags2, SPR2_DONT_TARGET_OWNER); SET(u->Flags2, SPR2_DONT_TARGET_OWNER);
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
@ -14966,7 +14966,7 @@ InitShotgun(PLAYERp pp)
} }
else else
{ {
daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)); daz = xs_CRoundToInt(-pp->q16horiz * (2000. / FRACUNIT));
daang = FixedToInt(pp->q16ang); daang = FixedToInt(pp->q16ang);
} }
@ -15142,7 +15142,7 @@ InitLaser(PLAYERp pp)
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// the slower the missile travels the less of a zvel it needs // the slower the missile travels the less of a zvel it needs
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 11; wp->zvel = -pp->q16horiz >> 11;
wu->WeaponNum = u->WeaponNum; wu->WeaponNum = u->WeaponNum;
wu->Radius = 200; wu->Radius = 200;
@ -15249,7 +15249,7 @@ InitRail(PLAYERp pp)
wp->yrepeat = 52; wp->yrepeat = 52;
wp->xrepeat = 52; wp->xrepeat = 52;
wp->shade = -15; wp->shade = -15;
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 17.) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((HORIZ_MULT + 17.) / FRACUNIT));
wu->RotNum = 5; wu->RotNum = 5;
NewStateGroup(w, &sg_Rail[0]); NewStateGroup(w, &sg_Rail[0]);
@ -15450,7 +15450,7 @@ InitRocket(PLAYERp pp)
wp->yrepeat = 90; wp->yrepeat = 90;
wp->xrepeat = 90; wp->xrepeat = 90;
wp->shade = -15; wp->shade = -15;
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 35.) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((HORIZ_MULT + 35.) / FRACUNIT));
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
@ -15581,7 +15581,7 @@ InitBunnyRocket(PLAYERp pp)
wp->yrepeat = 64; wp->yrepeat = 64;
wp->xrepeat = 64; wp->xrepeat = 64;
wp->shade = -15; wp->shade = -15;
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT + 35.) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((HORIZ_MULT + 35.) / FRACUNIT));
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
@ -15695,7 +15695,7 @@ InitNuke(PLAYERp pp)
wp->yrepeat = 128; wp->yrepeat = 128;
wp->xrepeat = 128; wp->xrepeat = 128;
wp->shade = -15; wp->shade = -15;
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((HORIZ_MULT - 36.) / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * ((HORIZ_MULT - 36.) / FRACUNIT));
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// Set to red palette // Set to red palette
@ -15902,7 +15902,7 @@ InitMicro(PLAYERp pp)
wp->yrepeat = 24; wp->yrepeat = 24;
wp->xrepeat = 24; wp->xrepeat = 24;
wp->shade = -15; wp->shade = -15;
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// randomize zvelocity // randomize zvelocity
@ -17432,8 +17432,8 @@ InitTracerUzi(PLAYERp pp)
nx = pp->posx; nx = pp->posx;
ny = pp->posy; ny = pp->posy;
//nz = pp->posz + pp->bob_z + Z(8); //nz = pp->posz + pp->bob_z + Z(8);
//nz = pp->posz + pp->bob_z + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); //nz = pp->posz + pp->bob_z + Z(8) + xs_CRoundToInt(-pp->q16horiz * (72. / FRACUNIT));
nz = pp->posz + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); nz = pp->posz + Z(8) + xs_CRoundToInt(-pp->q16horiz * (72. / FRACUNIT));
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -17451,7 +17451,7 @@ InitTracerUzi(PLAYERp pp)
wp->xrepeat = 10; wp->xrepeat = 10;
wp->shade = -40; wp->shade = -40;
wp->zvel = 0; wp->zvel = 0;
//wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; //wp->zvel = -pp->q16horiz >> 9;
wp->clipdist = 32 >> 2; wp->clipdist = 32 >> 2;
wu->WeaponNum = u->WeaponNum; wu->WeaponNum = u->WeaponNum;
@ -17478,7 +17478,7 @@ InitTracerUzi(PLAYERp pp)
return 0; return 0;
} }
wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); wp->zvel = xs_CRoundToInt(-pp->q16horiz * ((wp->xvel / 8.) / FRACUNIT));
pp->SpriteP->clipdist = oclipdist; pp->SpriteP->clipdist = oclipdist;
@ -17510,7 +17510,7 @@ InitTracerTurret(short SpriteNum, short Operator, int horiz)
nx = sp->x; nx = sp->x;
ny = sp->y; ny = sp->y;
nz = sp->z + ((100 - horiz) * 72); nz = sp->z + (-horiz * 72);
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -17537,7 +17537,7 @@ InitTracerTurret(short SpriteNum, short Operator, int horiz)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE); SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
wp->zvel = ((100 - horiz) * (wp->xvel/8)); wp->zvel = (-horiz * (wp->xvel/8));
WeaponAutoAim(sp, w, 32, false); WeaponAutoAim(sp, w, 32, false);
@ -17830,7 +17830,7 @@ InitUzi(PLAYERp pp)
{ {
//daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); //daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(24) - 12)); daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(24) - 12));
daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000); daz = xs_CRoundToInt(-pp->q16horiz * (2000. / FRACUNIT)) + (RANDOM_RANGE(24000) - 12000);
} }
@ -18005,7 +18005,7 @@ InitEMP(PLAYERp pp)
InitTracerUzi(pp); InitTracerUzi(pp);
//daz = nz = pp->posz + Z(8) + xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (72. / FRACUNIT)); //daz = nz = pp->posz + Z(8) + xs_CRoundToInt(-pp->q16horiz * (72. / FRACUNIT));
//daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25)); //daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
daz = nz = pp->posz + pp->bob_z; daz = nz = pp->posz + pp->bob_z;
@ -18015,7 +18015,7 @@ InitEMP(PLAYERp pp)
} }
else else
{ {
daz = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (2000. / FRACUNIT)); daz = xs_CRoundToInt(-pp->q16horiz * (2000. / FRACUNIT));
daang = FixedToInt(pp->q16ang); daang = FixedToInt(pp->q16ang);
} }
@ -18189,7 +18189,7 @@ InitTankShell(short SpriteNum, PLAYERp pp)
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE); SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); wp->zvel = xs_CRoundToInt(-pp->q16horiz * ((wp->xvel / 8.) / FRACUNIT));
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
@ -18268,7 +18268,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
wp->yrepeat = 24; wp->yrepeat = 24;
wp->xrepeat = 24; wp->xrepeat = 24;
wp->shade = -15; wp->shade = -15;
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
wp->clipdist = 64L>>2; wp->clipdist = 64L>>2;
// randomize zvelocity // randomize zvelocity
@ -18349,7 +18349,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp)
SET(wu->Flags2, SPR2_SO_MISSILE); SET(wu->Flags2, SPR2_SO_MISSILE);
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); wp->zvel = xs_CRoundToInt(-pp->q16horiz * ((wp->xvel / 8.) / FRACUNIT));
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
@ -18396,7 +18396,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp)
SET(wu->Flags2, SPR2_SO_MISSILE); SET(wu->Flags2, SPR2_SO_MISSILE);
SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_YCENTER);
wp->zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((wp->xvel / 8.) / FRACUNIT)); wp->zvel = xs_CRoundToInt(-pp->q16horiz * ((wp->xvel / 8.) / FRACUNIT));
WeaponAutoAim(sp, w, 64, false); WeaponAutoAim(sp, w, 64, false);
// a bit of randomness // a bit of randomness
@ -18445,7 +18445,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp)
wp->yrepeat = 52; wp->yrepeat = 52;
wp->xrepeat = 52; wp->xrepeat = 52;
wp->shade = -15; wp->shade = -15;
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
wu->RotNum = 5; wu->RotNum = 5;
NewStateGroup(w, &sg_Rail[0]); NewStateGroup(w, &sg_Rail[0]);
@ -18505,7 +18505,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp)
wp->shade = -15; wp->shade = -15;
// the slower the missile travels the less of a zvel it needs // the slower the missile travels the less of a zvel it needs
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 11; wp->zvel = -pp->q16horiz >> 11;
wu->Radius = 200; wu->Radius = 200;
wu->ceiling_dist = Z(1); wu->ceiling_dist = Z(1);
@ -18566,7 +18566,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
if (q16horiz < horizmin) if (q16horiz < horizmin)
q16horiz = horizmin; q16horiz = horizmin;
daz = xs_CRoundToInt((IntToFixed(100) - q16horiz) * (2000. / FRACUNIT)) + (RANDOM_RANGE(Z(80)) - Z(40)); daz = xs_CRoundToInt(-q16horiz * (2000. / FRACUNIT)) + (RANDOM_RANGE(Z(80)) - Z(40));
daang = sp->ang; daang = sp->ang;
} }
@ -19304,7 +19304,7 @@ InitGrenade(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff), FixedToInt(pp->q16horizoff + pp->q16horiz)); ////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",FixedToInt(pp->q16horiz), FixedToInt(pp->q16horizoff), FixedToInt(pp->q16horizoff + pp->q16horiz));
//MONO_PRINT(ds); //MONO_PRINT(ds);
@ -19451,7 +19451,7 @@ InitMine(PLAYERp pp)
wp->xrepeat = 32; wp->xrepeat = 32;
wp->shade = -15; wp->shade = -15;
wp->clipdist = 128L>>2; wp->clipdist = 128L>>2;
wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; wp->zvel = -pp->q16horiz >> 9;
wu->WeaponNum = u->WeaponNum; wu->WeaponNum = u->WeaponNum;
wu->Radius = 200; wu->Radius = 200;
wu->ceiling_dist = Z(5); wu->ceiling_dist = Z(5);
@ -19464,7 +19464,7 @@ InitMine(PLAYERp pp)
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp)) if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
SET(wu->Flags, SPR_UNDERWATER); SET(wu->Flags, SPR_UNDERWATER);
//wp->zvel = (IntToFixed(100) - pp->q16horiz) >> 9; //wp->zvel = -pp->q16horiz >> 9;
MissileSetPos(w, DoMine, 800); MissileSetPos(w, DoMine, 800);
@ -19617,8 +19617,8 @@ InitFireball(PLAYERp pp)
wu->ceiling_dist = Z(6); wu->ceiling_dist = Z(6);
wu->floor_dist = Z(6); wu->floor_dist = Z(6);
//zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * ((100. + ADJUST) / FRACUNIT)); //zvel = xs_CRoundToInt(-pp->q16horiz * ((100. + ADJUST) / FRACUNIT));
zvel = xs_CRoundToInt((IntToFixed(100) - pp->q16horiz) * (240. / FRACUNIT)); zvel = xs_CRoundToInt(-pp->q16horiz * (240. / FRACUNIT));
//wu->RotNum = 5; //wu->RotNum = 5;
//NewStateGroup(w, &sg_Fireball); //NewStateGroup(w, &sg_Fireball);