mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-13 07:58:04 +00:00
- Blood: Cut q16ang
/q16look_ang
/q16rotscrnang
over to PlayerAngle struct.
This commit is contained in:
parent
40cb64cdcf
commit
bd68f67460
10 changed files with 84 additions and 75 deletions
|
@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "v_text.h"
|
#include "v_text.h"
|
||||||
|
#include "binaryangle.h"
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
|
@ -586,6 +587,16 @@ inline fixed_t interpolateangfix16(fixed_t a, fixed_t b, int c)
|
||||||
return a+mulscale16(((b-a+0x4000000)&0x7ffffff)-0x4000000, c);
|
return a+mulscale16(((b-a+0x4000000)&0x7ffffff)-0x4000000, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline binangle interpolateangbin(uint32_t a, uint32_t b, double c)
|
||||||
|
{
|
||||||
|
return bamang(xs_CRoundToUInt(a + fmulscale16(b - a, c)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline lookangle interpolateanglook(int32_t a, int32_t b, double c)
|
||||||
|
{
|
||||||
|
return bamlook(xs_CRoundToUInt(a + fmulscale16(b - a, c)));
|
||||||
|
}
|
||||||
|
|
||||||
inline char Chance(int a1)
|
inline char Chance(int a1)
|
||||||
{
|
{
|
||||||
return wrand() < (a1>>1);
|
return wrand() < (a1>>1);
|
||||||
|
|
|
@ -55,11 +55,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||||
// Perform unsynchronised angle/horizon if not dead.
|
// Perform unsynchronised angle/horizon if not dead.
|
||||||
if (gView->pXSprite->health != 0)
|
if (gView->pXSprite->health != 0)
|
||||||
{
|
{
|
||||||
applylook2(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
|
applylook(&pPlayer->angle, input.q16avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
|
||||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
|
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerProcessHelpers(&pPlayer->q16ang, &pPlayer->angAdjust, &pPlayer->angTarget, scaleAdjust);
|
pPlayer->angle.processhelpers(scaleAdjust);
|
||||||
pPlayer->horizon.processhelpers(scaleAdjust);
|
pPlayer->horizon.processhelpers(scaleAdjust);
|
||||||
UpdatePlayerSpriteAngle(pPlayer);
|
UpdatePlayerSpriteAngle(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ static void viewBurnTime(int gScale)
|
||||||
|
|
||||||
void hudDraw(PLAYER *gView, VIEW *pView, int nSectnum, double bobx, double boby, double zDelta, int basepal, double smoothratio)
|
void hudDraw(PLAYER *gView, VIEW *pView, int nSectnum, double bobx, double boby, double zDelta, int basepal, double smoothratio)
|
||||||
{
|
{
|
||||||
double look_anghalf = getHalfLookAng(pView->q16look_ang, gView->q16look_ang, cl_syncinput, smoothratio);
|
double look_anghalf = getHalfLookAng(pView->look_ang.asq16(), gView->angle.look_ang.asq16(), cl_syncinput, smoothratio);
|
||||||
|
|
||||||
DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2);
|
DrawCrosshair(kCrosshairTile, gView->pXSprite->health >> 4, -look_anghalf, 0, 2);
|
||||||
|
|
||||||
|
|
|
@ -2113,7 +2113,7 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite) {
|
||||||
|
|
||||||
if (pXSource->data2 == 1) {
|
if (pXSource->data2 == 1) {
|
||||||
|
|
||||||
if (pPlayer) pPlayer->q16ang = IntToFixed(pSource->ang);
|
if (pPlayer) pPlayer->angle.ang = buildang(pSource->ang);
|
||||||
else if (isDude) xsprite[pSprite->extra].goalAng = pSprite->ang = pSource->ang;
|
else if (isDude) xsprite[pSprite->extra].goalAng = pSprite->ang = pSource->ang;
|
||||||
else pSprite->ang = pSource->ang;
|
else pSprite->ang = pSource->ang;
|
||||||
}
|
}
|
||||||
|
@ -3965,8 +3965,8 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
||||||
case 9: // 73 (set player's sprite angle, TO-DO: if tx > 0, take a look on TX ID sprite)
|
case 9: // 73 (set player's sprite angle, TO-DO: if tx > 0, take a look on TX ID sprite)
|
||||||
//data4 is reserved
|
//data4 is reserved
|
||||||
if (pXSprite->data4 != 0) break;
|
if (pXSprite->data4 != 0) break;
|
||||||
else if (pSprite->flags & kModernTypeFlag1) pPlayer->q16ang = IntToFixed(pSprite->ang);
|
else if (pSprite->flags & kModernTypeFlag1) pPlayer->angle.ang = buildang(pSprite->ang);
|
||||||
else if (valueIsBetween(pXSprite->data2, -kAng360, kAng360)) pPlayer->q16ang = IntToFixed(pXSprite->data2);
|
else if (valueIsBetween(pXSprite->data2, -kAng360, kAng360)) pPlayer->angle.ang = buildang(pXSprite->data2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
|
||||||
|
|
||||||
if (parm->numparms >= 4)
|
if (parm->numparms >= 4)
|
||||||
{
|
{
|
||||||
pPlayer->q16ang = gView->q16ang = IntToFixed(atoi(parm->parms[3]));
|
pPlayer->angle.oang = gView->angle.ang = buildang(atoi(parm->parms[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parm->numparms == 5)
|
if (parm->numparms == 5)
|
||||||
|
|
|
@ -712,7 +712,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
pSprite->z -= bottom - pSprite->z;
|
pSprite->z -= bottom - pSprite->z;
|
||||||
pSprite->pal = 11+(pPlayer->teamId&3);
|
pSprite->pal = 11+(pPlayer->teamId&3);
|
||||||
pPlayer->angold = pSprite->ang = pStartZone->ang;
|
pPlayer->angold = pSprite->ang = pStartZone->ang;
|
||||||
pPlayer->q16ang = IntToFixed(pSprite->ang);
|
pPlayer->angle.ang = buildang(pSprite->ang);
|
||||||
pSprite->type = kDudePlayer1+nPlayer;
|
pSprite->type = kDudePlayer1+nPlayer;
|
||||||
pSprite->clipdist = pDudeInfo->clipdist;
|
pSprite->clipdist = pDudeInfo->clipdist;
|
||||||
pSprite->flags = 15;
|
pSprite->flags = 15;
|
||||||
|
@ -733,7 +733,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
pPlayer->restTime = 0;
|
pPlayer->restTime = 0;
|
||||||
pPlayer->kickPower = 0;
|
pPlayer->kickPower = 0;
|
||||||
pPlayer->laughCount = 0;
|
pPlayer->laughCount = 0;
|
||||||
pPlayer->spin = 0;
|
pPlayer->angle.spin = buildlook(0);
|
||||||
pPlayer->posture = 0;
|
pPlayer->posture = 0;
|
||||||
pPlayer->voodooTarget = -1;
|
pPlayer->voodooTarget = -1;
|
||||||
pPlayer->voodooTargets = 0;
|
pPlayer->voodooTargets = 0;
|
||||||
|
@ -1312,8 +1312,8 @@ void UpdatePlayerSpriteAngle(PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = pPlayer->pSprite;
|
spritetype *pSprite = pPlayer->pSprite;
|
||||||
|
|
||||||
pPlayer->q16ang = (pPlayer->q16ang + IntToFixed(pSprite->ang - pPlayer->angold)) & 0x7FFFFFF;
|
pPlayer->angle.ang += buildang(pSprite->ang - pPlayer->angold);
|
||||||
pPlayer->angold = pSprite->ang = FixedToInt(pPlayer->q16ang);
|
pPlayer->angold = pSprite->ang = pPlayer->angle.ang.asbuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1325,7 +1325,7 @@ void UpdatePlayerSpriteAngle(PLAYER *pPlayer)
|
||||||
static void resetinputhelpers(PLAYER* pPlayer)
|
static void resetinputhelpers(PLAYER* pPlayer)
|
||||||
{
|
{
|
||||||
pPlayer->horizon.resetadjustment();
|
pPlayer->horizon.resetadjustment();
|
||||||
pPlayer->angAdjust = 0;
|
pPlayer->angle.resetadjustment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessInput(PLAYER *pPlayer)
|
void ProcessInput(PLAYER *pPlayer)
|
||||||
|
@ -1359,7 +1359,7 @@ void ProcessInput(PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
|
fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
|
||||||
pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng);
|
pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng);
|
||||||
playerAddAngle2(&pPlayer->q16ang, &pPlayer->angAdjust, FixedToFloat(getincangleq16(pPlayer->q16ang, fraggerAng)));
|
pPlayer->angle.addadjustment(FixedToFloat(getincangleq16(pPlayer->angle.ang.asq16(), fraggerAng)));
|
||||||
}
|
}
|
||||||
pPlayer->deathTime += 4;
|
pPlayer->deathTime += 4;
|
||||||
if (!bSeqStat)
|
if (!bSeqStat)
|
||||||
|
@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
|
||||||
|
|
||||||
if (cl_syncinput)
|
if (cl_syncinput)
|
||||||
{
|
{
|
||||||
applylook2(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, pInput->q16avel, &pInput->actions, 1, pPlayer->posture != 0);
|
applylook(&pPlayer->angle, pInput->q16avel, &pInput->actions, 1, pPlayer->posture != 0);
|
||||||
UpdatePlayerSpriteAngle(pPlayer);
|
UpdatePlayerSpriteAngle(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,7 @@ struct PLAYER
|
||||||
DUDEINFO* pDudeInfo;
|
DUDEINFO* pDudeInfo;
|
||||||
InputPacket input;
|
InputPacket input;
|
||||||
PlayerHorizon horizon;
|
PlayerHorizon horizon;
|
||||||
|
PlayerAngle angle;
|
||||||
uint8_t newWeapon;
|
uint8_t newWeapon;
|
||||||
int used1; // something related to game checksum
|
int used1; // something related to game checksum
|
||||||
int weaponQav;
|
int weaponQav;
|
||||||
|
@ -153,7 +154,6 @@ struct PLAYER
|
||||||
int restTime;
|
int restTime;
|
||||||
int kickPower;
|
int kickPower;
|
||||||
int laughCount;
|
int laughCount;
|
||||||
fixed_t spin; // turning around
|
|
||||||
bool godMode;
|
bool godMode;
|
||||||
bool fallScream;
|
bool fallScream;
|
||||||
bool cantJump;
|
bool cantJump;
|
||||||
|
@ -178,17 +178,10 @@ struct PLAYER
|
||||||
int pickupEffect;
|
int pickupEffect;
|
||||||
bool flashEffect; // if true, reduce pPlayer->visibility counter
|
bool flashEffect; // if true, reduce pPlayer->visibility counter
|
||||||
int quakeEffect;
|
int quakeEffect;
|
||||||
fixed_t q16ang;
|
|
||||||
int angold;
|
int angold;
|
||||||
int player_par;
|
int player_par;
|
||||||
int nWaterPal;
|
int nWaterPal;
|
||||||
POSTURE pPosture[kModeMax][kPostureMax];
|
POSTURE pPosture[kModeMax][kPostureMax];
|
||||||
fixed_t q16look_ang;
|
|
||||||
fixed_t q16rotscrnang;
|
|
||||||
|
|
||||||
// Input helper variables.
|
|
||||||
double angAdjust;
|
|
||||||
fixed_t angTarget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PROFILE
|
struct PROFILE
|
||||||
|
|
|
@ -57,7 +57,7 @@ static VIEW predictFifo[256];
|
||||||
|
|
||||||
void viewInitializePrediction(void)
|
void viewInitializePrediction(void)
|
||||||
{
|
{
|
||||||
predict.at30 = gMe->q16ang;
|
predict.at30 = gMe->angle.ang;
|
||||||
predict.at24 = gMe->horizon.horiz;
|
predict.at24 = gMe->horizon.horiz;
|
||||||
predict.at28 = gMe->horizon.horizoff;
|
predict.at28 = gMe->horizon.horizoff;
|
||||||
predict.at2c = gMe->slope;
|
predict.at2c = gMe->slope;
|
||||||
|
@ -75,7 +75,7 @@ void viewInitializePrediction(void)
|
||||||
predict.at64 = zvel[gMe->pSprite->index];
|
predict.at64 = zvel[gMe->pSprite->index];
|
||||||
predict.at6a = gMe->pXSprite->height;
|
predict.at6a = gMe->pXSprite->height;
|
||||||
predict.at48 = gMe->posture;
|
predict.at48 = gMe->posture;
|
||||||
predict.at4c = gMe->spin;
|
predict.at4c = gMe->angle.spin;
|
||||||
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
|
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
|
||||||
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
|
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
|
||||||
predict.TotalKills = gMe->bobPhase;
|
predict.TotalKills = gMe->bobPhase;
|
||||||
|
@ -120,8 +120,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
predict.at71 = !!(gMe->input.actions & SB_JUMP);
|
predict.at71 = !!(gMe->input.actions & SB_JUMP);
|
||||||
if (predict.at48 == 1)
|
if (predict.at48 == 1)
|
||||||
{
|
{
|
||||||
int x = Cos(FixedToInt(predict.at30));
|
int x = Cos(predict.at30.asbuild());
|
||||||
int y = Sin(FixedToInt(predict.at30));
|
int y = Sin(predict.at30.asbuild());
|
||||||
if (pInput->fvel)
|
if (pInput->fvel)
|
||||||
{
|
{
|
||||||
int forward = pInput->fvel;
|
int forward = pInput->fvel;
|
||||||
|
@ -145,8 +145,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
int speed = 0x10000;
|
int speed = 0x10000;
|
||||||
if (predict.at6a > 0)
|
if (predict.at6a > 0)
|
||||||
speed -= divscale16(predict.at6a, 0x100);
|
speed -= divscale16(predict.at6a, 0x100);
|
||||||
int x = Cos(FixedToInt(predict.at30));
|
int x = Cos(predict.at30.asbuild());
|
||||||
int y = Sin(FixedToInt(predict.at30));
|
int y = Sin(predict.at30.asbuild());
|
||||||
if (pInput->fvel)
|
if (pInput->fvel)
|
||||||
{
|
{
|
||||||
int forward = pInput->fvel;
|
int forward = pInput->fvel;
|
||||||
|
@ -170,11 +170,11 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pInput->q16avel)
|
if (pInput->q16avel)
|
||||||
predict.at30 = (predict.at30+pInput->q16avel)&0x7ffffff;
|
predict.at30 = degang(FixedToFloat(pInput->q16avel));
|
||||||
if (pInput->actions & SB_TURNAROUND)
|
if (pInput->actions & SB_TURNAROUND)
|
||||||
if (!predict.at4c)
|
if (!predict.at4c.asbuild())
|
||||||
predict.at4c = -1024;
|
predict.at4c = buildlook(-1024);
|
||||||
if (predict.at4c < 0)
|
if (predict.at4c.asbuild() < 0)
|
||||||
{
|
{
|
||||||
int speed;
|
int speed;
|
||||||
if (predict.at48 == 1)
|
if (predict.at48 == 1)
|
||||||
|
@ -182,8 +182,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
else
|
else
|
||||||
speed = 128;
|
speed = 128;
|
||||||
|
|
||||||
predict.at4c = min(predict.at4c+speed, 0);
|
predict.at4c = buildlook(min(predict.at4c.asbuild()+speed, 0));
|
||||||
predict.at30 += IntToFixed(speed);
|
predict.at30 += buildang(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!predict.at71)
|
if (!predict.at71)
|
||||||
|
@ -249,8 +249,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||||
if (va && (sector[nSector].floorstat&2) != 0)
|
if (va && (sector[nSector].floorstat&2) != 0)
|
||||||
{
|
{
|
||||||
int z1 = getflorzofslope(nSector, predict.at50, predict.at54);
|
int z1 = getflorzofslope(nSector, predict.at50, predict.at54);
|
||||||
int x2 = predict.at50+mulscale30(64, Cos(FixedToInt(predict.at30)));
|
int x2 = predict.at50+mulscale30(64, Cos(predict.at30.asbuild()));
|
||||||
int y2 = predict.at54+mulscale30(64, Sin(FixedToInt(predict.at30)));
|
int y2 = predict.at54+mulscale30(64, Sin(predict.at30.asbuild()));
|
||||||
short nSector2 = nSector;
|
short nSector2 = nSector;
|
||||||
updatesector(x2, y2, &nSector2);
|
updatesector(x2, y2, &nSector2);
|
||||||
if (nSector2 == nSector)
|
if (nSector2 == nSector)
|
||||||
|
@ -656,7 +656,7 @@ void viewCorrectPrediction(void)
|
||||||
#if 0
|
#if 0
|
||||||
spritetype *pSprite = gMe->pSprite;
|
spritetype *pSprite = gMe->pSprite;
|
||||||
VIEW *pView = &predictFifo[(gNetFifoTail-1)&255];
|
VIEW *pView = &predictFifo[(gNetFifoTail-1)&255];
|
||||||
if (gMe->q16ang != pView->at30 || pView->at24 != gMe->horizon.horiz || pView->at50 != pSprite->x || pView->at54 != pSprite->y || pView->at58 != pSprite->z)
|
if (gMe->angle.ang != pView->at30 || pView->at24 != gMe->horizon.horiz || pView->at50 != pSprite->x || pView->at54 != pSprite->y || pView->at58 != pSprite->z)
|
||||||
{
|
{
|
||||||
viewInitializePrediction();
|
viewInitializePrediction();
|
||||||
predictOld = gPrevView[myconnectindex];
|
predictOld = gPrevView[myconnectindex];
|
||||||
|
|
|
@ -104,7 +104,7 @@ void viewBackupView(int nPlayer)
|
||||||
{
|
{
|
||||||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||||
VIEW *pView = &gPrevView[nPlayer];
|
VIEW *pView = &gPrevView[nPlayer];
|
||||||
pView->at30 = pPlayer->q16ang;
|
pView->at30 = pPlayer->angle.ang;
|
||||||
pView->at50 = pPlayer->pSprite->x;
|
pView->at50 = pPlayer->pSprite->x;
|
||||||
pView->at54 = pPlayer->pSprite->y;
|
pView->at54 = pPlayer->pSprite->y;
|
||||||
pView->at38 = pPlayer->zView;
|
pView->at38 = pPlayer->zView;
|
||||||
|
@ -116,8 +116,8 @@ void viewBackupView(int nPlayer)
|
||||||
pView->atc = pPlayer->bobWidth;
|
pView->atc = pPlayer->bobWidth;
|
||||||
pView->at18 = pPlayer->swayHeight;
|
pView->at18 = pPlayer->swayHeight;
|
||||||
pView->at1c = pPlayer->swayWidth;
|
pView->at1c = pPlayer->swayWidth;
|
||||||
pView->q16look_ang = pPlayer->q16look_ang;
|
pView->look_ang = pPlayer->angle.look_ang;
|
||||||
pView->q16rotscrnang = pPlayer->q16rotscrnang;
|
pView->rotscrnang = pPlayer->angle.rotscrnang;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewCorrectViewOffsets(int nPlayer, vec3_t const *oldpos)
|
void viewCorrectViewOffsets(int nPlayer, vec3_t const *oldpos)
|
||||||
|
@ -633,8 +633,9 @@ void viewDrawScreen(bool sceneonly)
|
||||||
renderSetAspect(v1, yxaspect);
|
renderSetAspect(v1, yxaspect);
|
||||||
|
|
||||||
int cX, cY, cZ, v74, v8c;
|
int cX, cY, cZ, v74, v8c;
|
||||||
fixed_t cA, q16rotscrnang;
|
lookangle rotscrnang;
|
||||||
fixedhoriz q16horizon, q16horizoff;
|
binangle cA;
|
||||||
|
fixedhoriz cH, cOff;
|
||||||
double zDelta, v4c, v48;
|
double zDelta, v4c, v48;
|
||||||
int nSectnum = gView->pSprite->sectnum;
|
int nSectnum = gView->pSprite->sectnum;
|
||||||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->pXSprite->health > 0)
|
if (numplayers > 1 && gView == gMe && gPrediction && gMe->pXSprite->health > 0)
|
||||||
|
@ -644,7 +645,7 @@ void viewDrawScreen(bool sceneonly)
|
||||||
cY = interpolate(predictOld.at54, predict.at54, gInterpolate);
|
cY = interpolate(predictOld.at54, predict.at54, gInterpolate);
|
||||||
cZ = interpolate(predictOld.at38, predict.at38, gInterpolate);
|
cZ = interpolate(predictOld.at38, predict.at38, gInterpolate);
|
||||||
zDelta = finterpolate(predictOld.at34, predict.at34, gInterpolate);
|
zDelta = finterpolate(predictOld.at34, predict.at34, gInterpolate);
|
||||||
q16horizoff = q16horiz(interpolate(predictOld.at28.asq16(), predict.at28.asq16(), gInterpolate));
|
cOff = q16horiz(interpolate(predictOld.at28.asq16(), predict.at28.asq16(), gInterpolate));
|
||||||
v74 = interpolate(predictOld.atc, predict.atc, gInterpolate);
|
v74 = interpolate(predictOld.atc, predict.atc, gInterpolate);
|
||||||
v8c = interpolate(predictOld.at8, predict.at8, gInterpolate);
|
v8c = interpolate(predictOld.at8, predict.at8, gInterpolate);
|
||||||
v4c = finterpolate(predictOld.at1c, predict.at1c, gInterpolate);
|
v4c = finterpolate(predictOld.at1c, predict.at1c, gInterpolate);
|
||||||
|
@ -652,15 +653,17 @@ void viewDrawScreen(bool sceneonly)
|
||||||
|
|
||||||
if (!cl_syncinput)
|
if (!cl_syncinput)
|
||||||
{
|
{
|
||||||
cA = predict.at30 + predict.q16look_ang;
|
cA = bamang(predict.at30.asbam() + predict.look_ang.asbam());
|
||||||
q16horizon = predict.at24;
|
cH = predict.at24;
|
||||||
q16rotscrnang = predict.q16rotscrnang;
|
rotscrnang = predict.rotscrnang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cA = interpolateangfix16(predictOld.at30 + predictOld.q16look_ang, predict.at30 + predict.q16look_ang, gInterpolate);
|
uint32_t oang = predictOld.at30.asbam() + predictOld.look_ang.asbam();
|
||||||
q16horizon = q16horiz(interpolate(predictOld.at24.asq16(), predict.at24.asq16(), gInterpolate));
|
uint32_t ang = predict.at30.asbam() + predict.look_ang.asbam();
|
||||||
q16rotscrnang = interpolateangfix16(predictOld.q16rotscrnang, predict.q16rotscrnang, gInterpolate);
|
cA = interpolateangbin(oang, ang, gInterpolate);
|
||||||
|
cH = q16horiz(interpolate(predictOld.at24.asq16(), predict.at24.asq16(), gInterpolate));
|
||||||
|
rotscrnang = interpolateanglook(predictOld.rotscrnang.asbam(), predict.rotscrnang.asbam(), gInterpolate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -670,7 +673,7 @@ void viewDrawScreen(bool sceneonly)
|
||||||
cY = interpolate(pView->at54, gView->pSprite->y, gInterpolate);
|
cY = interpolate(pView->at54, gView->pSprite->y, gInterpolate);
|
||||||
cZ = interpolate(pView->at38, gView->zView, gInterpolate);
|
cZ = interpolate(pView->at38, gView->zView, gInterpolate);
|
||||||
zDelta = finterpolate(pView->at34, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
zDelta = finterpolate(pView->at34, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||||
q16horizoff = q16horiz(interpolate(pView->at28.asq16(), gView->horizon.horizoff.asq16(), gInterpolate));
|
cOff = q16horiz(interpolate(pView->at28.asq16(), gView->horizon.horizoff.asq16(), gInterpolate));
|
||||||
v74 = interpolate(pView->atc, gView->bobWidth, gInterpolate);
|
v74 = interpolate(pView->atc, gView->bobWidth, gInterpolate);
|
||||||
v8c = interpolate(pView->at8, gView->bobHeight, gInterpolate);
|
v8c = interpolate(pView->at8, gView->bobHeight, gInterpolate);
|
||||||
v4c = finterpolate(pView->at1c, gView->swayWidth, gInterpolate);
|
v4c = finterpolate(pView->at1c, gView->swayWidth, gInterpolate);
|
||||||
|
@ -678,35 +681,37 @@ void viewDrawScreen(bool sceneonly)
|
||||||
|
|
||||||
if (!cl_syncinput)
|
if (!cl_syncinput)
|
||||||
{
|
{
|
||||||
cA = gView->q16ang + gView->q16look_ang;
|
cA = bamang(gView->angle.ang.asbam() + gView->angle.look_ang.asbam());
|
||||||
q16horizon = gView->horizon.horiz;
|
cH = gView->horizon.horiz;
|
||||||
q16rotscrnang = gView->q16rotscrnang;
|
rotscrnang = gView->angle.rotscrnang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cA = interpolateangfix16(pView->at30 + pView->q16look_ang, gView->q16ang + gView->q16look_ang, gInterpolate);
|
uint32_t oang = pView->at30.asbam() + pView->look_ang.asbam();
|
||||||
q16horizon = q16horiz(interpolate(pView->at24.asq16(), gView->horizon.horiz.asq16(), gInterpolate));
|
uint32_t ang = gView->angle.ang.asbam() + gView->angle.look_ang.asbam();
|
||||||
q16rotscrnang = interpolateangfix16(pView->q16rotscrnang, gView->q16rotscrnang, gInterpolate);
|
cA = interpolateangbin(oang, ang, gInterpolate);
|
||||||
|
cH = q16horiz(interpolate(pView->at24.asq16(), gView->horizon.horiz.asq16(), gInterpolate));
|
||||||
|
rotscrnang = interpolateanglook(pView->rotscrnang.asbam(), gView->angle.rotscrnang.asbam(), gInterpolate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewUpdateShake();
|
viewUpdateShake();
|
||||||
q16horizon += buildhoriz(shakeHoriz);
|
cH += buildhoriz(shakeHoriz);
|
||||||
cA += IntToFixed(shakeAngle);
|
cA += buildang(shakeAngle);
|
||||||
cX += shakeX;
|
cX += shakeX;
|
||||||
cY += shakeY;
|
cY += shakeY;
|
||||||
cZ += shakeZ;
|
cZ += shakeZ;
|
||||||
v4c += shakeBobX;
|
v4c += shakeBobX;
|
||||||
v48 += shakeBobY;
|
v48 += shakeBobY;
|
||||||
q16horizon += buildhoriz(mulscale30(0x40000000 - Cos(gView->tiltEffect << 2), 30));
|
cH += buildhoriz(mulscale30(0x40000000 - Cos(gView->tiltEffect << 2), 30));
|
||||||
if (gViewPos == 0)
|
if (gViewPos == 0)
|
||||||
{
|
{
|
||||||
if (cl_viewbob)
|
if (cl_viewbob)
|
||||||
{
|
{
|
||||||
if (cl_viewhbob)
|
if (cl_viewhbob)
|
||||||
{
|
{
|
||||||
cX -= mulscale30(v74, Sin(FixedToInt(cA))) >> 4;
|
cX -= mulscale30(v74, Sin(cA.asbuild())) >> 4;
|
||||||
cY += mulscale30(v74, Cos(FixedToInt(cA))) >> 4;
|
cY += mulscale30(v74, Cos(cA.asbuild())) >> 4;
|
||||||
}
|
}
|
||||||
if (cl_viewvbob)
|
if (cl_viewvbob)
|
||||||
{
|
{
|
||||||
|
@ -715,15 +720,15 @@ void viewDrawScreen(bool sceneonly)
|
||||||
}
|
}
|
||||||
if (cl_slopetilting)
|
if (cl_slopetilting)
|
||||||
{
|
{
|
||||||
q16horizon += q16horizoff;
|
cH += cOff;
|
||||||
}
|
}
|
||||||
cZ += xs_CRoundToInt(q16horizon.asq16() / 6553.6);
|
cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
|
||||||
cameradist = -1;
|
cameradist = -1;
|
||||||
cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate);
|
cameraclock = gFrameClock +mulscale16(4, (int)gInterpolate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CalcPosition(gView->pSprite, (int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum, FixedToInt(cA), q16horizon.asq16(), (int)gInterpolate);
|
CalcPosition(gView->pSprite, (int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum, cA.asbuild(), cH.asq16(), (int)gInterpolate);
|
||||||
}
|
}
|
||||||
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum);
|
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum);
|
||||||
int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate);
|
int v78 = interpolateang(gScreenTiltO, gScreenTilt, gInterpolate);
|
||||||
|
@ -734,7 +739,7 @@ void viewDrawScreen(bool sceneonly)
|
||||||
//int tiltcs, tiltdim;
|
//int tiltcs, tiltdim;
|
||||||
uint8_t v4 = powerupCheck(gView, kPwUpCrystalBall) > 0;
|
uint8_t v4 = powerupCheck(gView, kPwUpCrystalBall) > 0;
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
renderSetRollAngle(FixedToFloat(q16rotscrnang));
|
renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT));
|
||||||
#endif
|
#endif
|
||||||
if (v78 || bDelirium)
|
if (v78 || bDelirium)
|
||||||
{
|
{
|
||||||
|
@ -869,7 +874,7 @@ void viewDrawScreen(bool sceneonly)
|
||||||
nSprite = nextspritestat[nSprite];
|
nSprite = nextspritestat[nSprite];
|
||||||
}
|
}
|
||||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
|
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
|
||||||
cA = (cA + interpolateangfix16(IntToFixed(deliriumTurnO), IntToFixed(deliriumTurn), gInterpolate)) & 0x7ffffff;
|
cA += q16ang(interpolateangfix16(IntToFixed(deliriumTurnO), IntToFixed(deliriumTurn), gInterpolate));
|
||||||
int vfc, vf8;
|
int vfc, vf8;
|
||||||
getzsofslope(nSectnum, cX, cY, &vfc, &vf8);
|
getzsofslope(nSectnum, cX, cY, &vfc, &vf8);
|
||||||
if (cZ >= vf8)
|
if (cZ >= vf8)
|
||||||
|
@ -880,13 +885,13 @@ void viewDrawScreen(bool sceneonly)
|
||||||
{
|
{
|
||||||
cZ = vfc + (gLowerLink[nSectnum] >= 0 ? 0 : (8 << 8));
|
cZ = vfc + (gLowerLink[nSectnum] >= 0 ? 0 : (8 << 8));
|
||||||
}
|
}
|
||||||
q16horizon = q16horiz(ClipRange(q16horizon.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
cH = q16horiz(ClipRange(cH.asq16(), gi->playerHorizMin(), gi->playerHorizMax()));
|
||||||
RORHACK:
|
RORHACK:
|
||||||
int ror_status[16];
|
int ror_status[16];
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||||
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||||
DrawMirrors(cX, cY, cZ, cA, q16horizon.asq16() + deliriumPitchI, gInterpolate, gViewIndex);
|
DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, gInterpolate, gViewIndex);
|
||||||
int bakCstat = gView->pSprite->cstat;
|
int bakCstat = gView->pSprite->cstat;
|
||||||
if (gViewPos == 0)
|
if (gViewPos == 0)
|
||||||
{
|
{
|
||||||
|
@ -897,8 +902,8 @@ void viewDrawScreen(bool sceneonly)
|
||||||
gView->pSprite->cstat |= 514;
|
gView->pSprite->cstat |= 514;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDrawRoomsQ16(cX, cY, cZ, cA, q16horizon.asq16() + deliriumPitchI, nSectnum);
|
renderDrawRoomsQ16(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, nSectnum);
|
||||||
viewProcessSprites(cX, cY, cZ, FixedToInt(cA), gInterpolate);
|
viewProcessSprites(cX, cY, cZ, cA.asbuild(), gInterpolate);
|
||||||
bool do_ror_hack = false;
|
bool do_ror_hack = false;
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
||||||
|
@ -955,7 +960,7 @@ void viewDrawScreen(bool sceneonly)
|
||||||
int v8 = byte_1CE5C2 > 0 && (sector[tmpSect].ceilingstat & 1);
|
int v8 = byte_1CE5C2 > 0 && (sector[tmpSect].ceilingstat & 1);
|
||||||
if (gWeather.at12d8 > 0 || v8)
|
if (gWeather.at12d8 > 0 || v8)
|
||||||
{
|
{
|
||||||
gWeather.Draw(cX, cY, cZ, cA, q16horizon.asq16() + deliriumPitch, gWeather.at12d8);
|
gWeather.Draw(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitch, gWeather.at12d8);
|
||||||
if (v8)
|
if (v8)
|
||||||
{
|
{
|
||||||
gWeather.at12d8 = ClipRange(delta * 8 + gWeather.at12d8, 0, 4095);
|
gWeather.at12d8 = ClipRange(delta * 8 + gWeather.at12d8, 0, 4095);
|
||||||
|
|
|
@ -42,14 +42,14 @@ struct VIEW {
|
||||||
fixedhoriz at24; // horiz
|
fixedhoriz at24; // horiz
|
||||||
fixedhoriz at28; // horizoff
|
fixedhoriz at28; // horizoff
|
||||||
int at2c;
|
int at2c;
|
||||||
fixed_t at30; // angle
|
binangle at30; // angle
|
||||||
int at34; // weapon z
|
int at34; // weapon z
|
||||||
int at38; // view z
|
int at38; // view z
|
||||||
int at3c;
|
int at3c;
|
||||||
int at40;
|
int at40;
|
||||||
int at44;
|
int at44;
|
||||||
int at48; // posture
|
int at48; // posture
|
||||||
int at4c; // spin
|
lookangle at4c; // spin
|
||||||
int at50; // x
|
int at50; // x
|
||||||
int at54; // y
|
int at54; // y
|
||||||
int at58; // z
|
int at58; // z
|
||||||
|
@ -65,8 +65,8 @@ struct VIEW {
|
||||||
char at72; // underwater
|
char at72; // underwater
|
||||||
short at73; // sprite flags
|
short at73; // sprite flags
|
||||||
SPRITEHIT at75;
|
SPRITEHIT at75;
|
||||||
fixed_t q16look_ang;
|
lookangle look_ang;
|
||||||
fixed_t q16rotscrnang;
|
lookangle rotscrnang;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern VIEW gPrevView[kMaxPlayers];
|
extern VIEW gPrevView[kMaxPlayers];
|
||||||
|
|
Loading…
Reference in a new issue