mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- Blood: cleanup of render code.
Renaming of disassembly variables and moving of disabled Crystal Ball renderer to a separate function.
This commit is contained in:
parent
f30a568858
commit
4109a256ac
4 changed files with 321 additions and 307 deletions
|
@ -38,18 +38,18 @@ void GameInterface::WarpToCoords(int x, int y, int z, int ang, int horz)
|
|||
PLAYER *pPlayer = &gPlayer[myconnectindex];
|
||||
VIEW* pView = &gPrevView[myconnectindex];
|
||||
|
||||
pPlayer->pSprite->x = pView->at50 = gView->pSprite->x = x;
|
||||
pPlayer->pSprite->y = pView->at54 = gView->pSprite->y = y;
|
||||
pPlayer->zView = pView->at38 = gView->zView = z;
|
||||
pPlayer->pSprite->x = pView->x = gView->pSprite->x = x;
|
||||
pPlayer->pSprite->y = pView->y = gView->pSprite->y = y;
|
||||
pPlayer->zView = pView->viewz = gView->zView = z;
|
||||
|
||||
if (ang != INT_MIN)
|
||||
{
|
||||
pPlayer->angle.oang = pPlayer->angle.ang = pView->at30 = gView->angle.ang = buildang(ang);
|
||||
pPlayer->angle.oang = pPlayer->angle.ang = pView->angle = gView->angle.ang = buildang(ang);
|
||||
}
|
||||
|
||||
if (horz != INT_MIN)
|
||||
{
|
||||
pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = pView->at24 = gView->horizon.horiz = buildhoriz(horz);
|
||||
pPlayer->horizon.ohoriz = pPlayer->horizon.horiz = pView->horiz = gView->horizon.horiz = buildhoriz(horz);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,37 +51,37 @@ static VIEW predictFifo[256];
|
|||
|
||||
void viewInitializePrediction(void)
|
||||
{
|
||||
predict.at30 = gMe->angle.ang;
|
||||
predict.at24 = gMe->horizon.horiz;
|
||||
predict.at28 = gMe->horizon.horizoff;
|
||||
predict.angle = gMe->angle.ang;
|
||||
predict.horiz = gMe->horizon.horiz;
|
||||
predict.horizoff = gMe->horizon.horizoff;
|
||||
predict.at2c = gMe->slope;
|
||||
predict.at6f = gMe->cantJump;
|
||||
predict.at70 = gMe->isRunning;
|
||||
predict.at72 = gMe->isUnderwater;
|
||||
predict.at71 = !!(gMe->input.actions & SB_JUMP);
|
||||
predict.at50 = gMe->pSprite->x;
|
||||
predict.at54 = gMe->pSprite->y;
|
||||
predict.at58 = gMe->pSprite->z;
|
||||
predict.at68 = gMe->pSprite->sectnum;
|
||||
predict.x = gMe->pSprite->x;
|
||||
predict.y = gMe->pSprite->y;
|
||||
predict.z = gMe->pSprite->z;
|
||||
predict.sectnum = gMe->pSprite->sectnum;
|
||||
predict.at73 = gMe->pSprite->flags;
|
||||
predict.at5c = xvel[gMe->pSprite->index];
|
||||
predict.at60 = yvel[gMe->pSprite->index];
|
||||
predict.at64 = zvel[gMe->pSprite->index];
|
||||
predict.at6a = gMe->pXSprite->height;
|
||||
predict.xvel = xvel[gMe->pSprite->index];
|
||||
predict.yvel = yvel[gMe->pSprite->index];
|
||||
predict.zvel = zvel[gMe->pSprite->index];
|
||||
predict.floordist = gMe->pXSprite->height;
|
||||
predict.at48 = gMe->posture;
|
||||
predict.at4c = gMe->angle.spin;
|
||||
predict.spin = gMe->angle.spin;
|
||||
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
|
||||
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
|
||||
predict.bobPhase = gMe->bobPhase;
|
||||
predict.Kills = gMe->bobAmp;
|
||||
predict.at8 = gMe->bobHeight;
|
||||
predict.atc = gMe->bobWidth;
|
||||
predict.bobHeight = gMe->bobHeight;
|
||||
predict.bobWidth = gMe->bobWidth;
|
||||
predict.at10 = gMe->swayPhase;
|
||||
predict.at14 = gMe->swayAmp;
|
||||
predict.at18 = gMe->swayHeight;
|
||||
predict.at1c = gMe->swayWidth;
|
||||
predict.at34 = gMe->zWeapon-gMe->zView-(12<<8);
|
||||
predict.at38 = gMe->zView;
|
||||
predict.shakeBobY = gMe->swayHeight;
|
||||
predict.shakeBobX = gMe->swayWidth;
|
||||
predict.weaponZ = gMe->zWeapon-gMe->zView-(12<<8);
|
||||
predict.viewz = gMe->zView;
|
||||
predict.at3c = gMe->zViewVel;
|
||||
predict.at40 = gMe->zWeapon;
|
||||
predict.at44 = gMe->zWeaponVel;
|
||||
|
@ -102,8 +102,8 @@ void viewUpdatePrediction(InputPacket *pInput)
|
|||
|
||||
static void sub_158B4(PLAYER *pPlayer)
|
||||
{
|
||||
predict.at38 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
||||
predict.at40 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
||||
predict.viewz = predict.z - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
||||
predict.at40 = predict.z - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
||||
}
|
||||
|
||||
static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
||||
|
@ -114,8 +114,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.at71 = !!(gMe->input.actions & SB_JUMP);
|
||||
if (predict.at48 == 1)
|
||||
{
|
||||
int x = Cos(predict.at30.asbuild());
|
||||
int y = Sin(predict.at30.asbuild());
|
||||
int x = Cos(predict.angle.asbuild());
|
||||
int y = Sin(predict.angle.asbuild());
|
||||
if (pInput->fvel)
|
||||
{
|
||||
int forward = pInput->fvel;
|
||||
|
@ -123,24 +123,24 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
forward = MulScale(pPosture->frontAccel, forward, 8);
|
||||
else
|
||||
forward = MulScale(pPosture->backAccel, forward, 8);
|
||||
predict.at5c += MulScale(forward, x, 30);
|
||||
predict.at60 += MulScale(forward, y, 30);
|
||||
predict.xvel += MulScale(forward, x, 30);
|
||||
predict.yvel += MulScale(forward, y, 30);
|
||||
}
|
||||
if (pInput->svel)
|
||||
{
|
||||
int strafe = pInput->svel;
|
||||
strafe = MulScale(pPosture->sideAccel, strafe, 8);
|
||||
predict.at5c += MulScale(strafe, y, 30);
|
||||
predict.at60 -= MulScale(strafe, x, 30);
|
||||
predict.xvel += MulScale(strafe, y, 30);
|
||||
predict.yvel -= MulScale(strafe, x, 30);
|
||||
}
|
||||
}
|
||||
else if (predict.at6a < 0x100)
|
||||
else if (predict.floordist < 0x100)
|
||||
{
|
||||
int speed = 0x10000;
|
||||
if (predict.at6a > 0)
|
||||
speed -= DivScale(predict.at6a, 0x100, 16);
|
||||
int x = Cos(predict.at30.asbuild());
|
||||
int y = Sin(predict.at30.asbuild());
|
||||
if (predict.floordist > 0)
|
||||
speed -= DivScale(predict.floordist, 0x100, 16);
|
||||
int x = Cos(predict.angle.asbuild());
|
||||
int y = Sin(predict.angle.asbuild());
|
||||
if (pInput->fvel)
|
||||
{
|
||||
int forward = pInput->fvel;
|
||||
|
@ -148,27 +148,27 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
forward = MulScale(pPosture->frontAccel, forward, 8);
|
||||
else
|
||||
forward = MulScale(pPosture->backAccel, forward, 8);
|
||||
if (predict.at6a)
|
||||
if (predict.floordist)
|
||||
forward = MulScale(forward, speed, 16);
|
||||
predict.at5c += MulScale(forward, x, 30);
|
||||
predict.at60 += MulScale(forward, y, 30);
|
||||
predict.xvel += MulScale(forward, x, 30);
|
||||
predict.yvel += MulScale(forward, y, 30);
|
||||
}
|
||||
if (pInput->svel)
|
||||
{
|
||||
int strafe = pInput->svel;
|
||||
strafe = MulScale(pPosture->sideAccel, strafe, 8);
|
||||
if (predict.at6a)
|
||||
if (predict.floordist)
|
||||
strafe = MulScale(strafe, speed, 16);
|
||||
predict.at5c += MulScale(strafe, y, 30);
|
||||
predict.at60 -= MulScale(strafe, x, 30);
|
||||
predict.xvel += MulScale(strafe, y, 30);
|
||||
predict.yvel -= MulScale(strafe, x, 30);
|
||||
}
|
||||
}
|
||||
if (pInput->avel)
|
||||
predict.at30 = degang(pInput->avel);
|
||||
predict.angle = degang(pInput->avel);
|
||||
if (pInput->actions & SB_TURNAROUND)
|
||||
if (!predict.at4c.asbuild())
|
||||
predict.at4c = buildlook(-1024);
|
||||
if (predict.at4c.asbuild() < 0)
|
||||
if (!predict.spin.asbuild())
|
||||
predict.spin = buildlook(-1024);
|
||||
if (predict.spin.asbuild() < 0)
|
||||
{
|
||||
int speed;
|
||||
if (predict.at48 == 1)
|
||||
|
@ -176,8 +176,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
else
|
||||
speed = 128;
|
||||
|
||||
predict.at4c = buildlook(min(predict.at4c.asbuild()+speed, 0));
|
||||
predict.at30 += buildang(speed);
|
||||
predict.spin = buildlook(min(predict.spin.asbuild()+speed, 0));
|
||||
predict.angle += buildang(speed);
|
||||
}
|
||||
|
||||
if (!predict.at71)
|
||||
|
@ -187,18 +187,18 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
{
|
||||
case 1:
|
||||
if (predict.at71)
|
||||
predict.at64 -= pPosture->normalJumpZ;//0x5b05;
|
||||
predict.zvel -= pPosture->normalJumpZ;//0x5b05;
|
||||
if (pInput->actions & SB_CROUCH)
|
||||
predict.at64 += pPosture->normalJumpZ;//0x5b05;
|
||||
predict.zvel += pPosture->normalJumpZ;//0x5b05;
|
||||
break;
|
||||
case 2:
|
||||
if (!(pInput->actions & SB_CROUCH))
|
||||
predict.at48 = 0;
|
||||
break;
|
||||
default:
|
||||
if (!predict.at6f && predict.at71 && predict.at6a == 0) {
|
||||
if (packItemActive(pPlayer, 4)) predict.at64 = pPosture->pwupJumpZ;//-0x175555;
|
||||
else predict.at64 = pPosture->normalJumpZ;//-0xbaaaa;
|
||||
if (!predict.at6f && predict.at71 && predict.floordist == 0) {
|
||||
if (packItemActive(pPlayer, 4)) predict.zvel = pPosture->pwupJumpZ;//-0x175555;
|
||||
else predict.zvel = pPosture->normalJumpZ;//-0xbaaaa;
|
||||
predict.at6f = 1;
|
||||
}
|
||||
if (pInput->actions & SB_CROUCH)
|
||||
|
@ -233,33 +233,33 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.at24 = 0;
|
||||
#endif
|
||||
|
||||
int nSector = predict.at68;
|
||||
int nSector = predict.sectnum;
|
||||
int florhit = predict.at75.florhit & 0xc000;
|
||||
char va;
|
||||
if (predict.at6a < 16 && (florhit == 0x4000 || florhit == 0))
|
||||
if (predict.floordist < 16 && (florhit == 0x4000 || florhit == 0))
|
||||
va = 1;
|
||||
else
|
||||
va = 0;
|
||||
if (va && (sector[nSector].floorstat&2) != 0)
|
||||
{
|
||||
int z1 = getflorzofslope(nSector, predict.at50, predict.at54);
|
||||
int x2 = predict.at50+MulScale(64, Cos(predict.at30.asbuild()), 30);
|
||||
int y2 = predict.at54+MulScale(64, Sin(predict.at30.asbuild()), 30);
|
||||
int z1 = getflorzofslope(nSector, predict.x, predict.y);
|
||||
int x2 = predict.x+MulScale(64, Cos(predict.angle.asbuild()), 30);
|
||||
int y2 = predict.y+MulScale(64, Sin(predict.angle.asbuild()), 30);
|
||||
short nSector2 = nSector;
|
||||
updatesector(x2, y2, &nSector2);
|
||||
if (nSector2 == nSector)
|
||||
{
|
||||
int z2 = getflorzofslope(nSector2, x2, y2);
|
||||
predict.at28 = q16horiz(interpolate(predict.at28.asq16(), IntToFixed(z1 - z2) >> 3, 0x4000));
|
||||
predict.horizoff = q16horiz(interpolate(predict.horizoff.asq16(), IntToFixed(z1 - z2) >> 3, 0x4000));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
predict.at28 = q16horiz(interpolate(predict.at28.asq16(), 0, 0x4000));
|
||||
if (abs(predict.at28.asq16()) < 4)
|
||||
predict.at28 = q16horiz(0);
|
||||
predict.horizoff = q16horiz(interpolate(predict.horizoff.asq16(), 0, 0x4000));
|
||||
if (abs(predict.horizoff.asq16()) < 4)
|
||||
predict.horizoff = q16horiz(0);
|
||||
}
|
||||
predict.at2c = -predict.at24.asq16() >> 9;
|
||||
predict.at2c = -predict.horiz.asq16() >> 9;
|
||||
}
|
||||
|
||||
void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
||||
|
@ -271,41 +271,41 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
int top, bottom;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
|
||||
top += predict.at58-pSprite->z;
|
||||
bottom += predict.at58-pSprite->z;
|
||||
top += predict.z-pSprite->z;
|
||||
bottom += predict.z-pSprite->z;
|
||||
|
||||
int dzb = (bottom-predict.at58)/4;
|
||||
int dzt = (predict.at58-top)/4;
|
||||
int dzb = (bottom-predict.z)/4;
|
||||
int dzt = (predict.z-top)/4;
|
||||
|
||||
int dw = pSprite->clipdist<<2;
|
||||
short nSector = predict.at68;
|
||||
short nSector = predict.sectnum;
|
||||
if (!gNoClip)
|
||||
{
|
||||
pushmove_old((int32_t*)&predict.at50, (int32_t*)&predict.at54, (int32_t*)&predict.at58, &predict.at68, dw, dzt, dzb, CLIPMASK0);
|
||||
if (predict.at68 == -1)
|
||||
predict.at68 = nSector;
|
||||
pushmove_old((int32_t*)&predict.x, (int32_t*)&predict.y, (int32_t*)&predict.z, &predict.sectnum, dw, dzt, dzb, CLIPMASK0);
|
||||
if (predict.sectnum == -1)
|
||||
predict.sectnum = nSector;
|
||||
}
|
||||
fakeProcessInput(pPlayer, pInput);
|
||||
|
||||
int nSpeed = approxDist(predict.at5c, predict.at60);
|
||||
int nSpeed = approxDist(predict.xvel, predict.yvel);
|
||||
|
||||
predict.at3c = interpolate(predict.at3c, predict.at64, 0x7000);
|
||||
int dz = predict.at58-pPosture->eyeAboveZ-predict.at38;
|
||||
predict.at3c = interpolate(predict.at3c, predict.zvel, 0x7000);
|
||||
int dz = predict.z-pPosture->eyeAboveZ-predict.viewz;
|
||||
if (dz > 0)
|
||||
predict.at3c += MulScale(dz<<8, 0xa000, 16);
|
||||
else
|
||||
predict.at3c += MulScale(dz<<8, 0x1800, 16);
|
||||
predict.at38 += predict.at3c>>8;
|
||||
predict.viewz += predict.at3c>>8;
|
||||
|
||||
predict.at44 = interpolate(predict.at44, predict.at64, 0x5000);
|
||||
dz = predict.at58-pPosture->weaponAboveZ-predict.at40;
|
||||
predict.at44 = interpolate(predict.at44, predict.zvel, 0x5000);
|
||||
dz = predict.z-pPosture->weaponAboveZ-predict.at40;
|
||||
if (dz > 0)
|
||||
predict.at44 += MulScale(dz<<8, 0x8000, 16);
|
||||
else
|
||||
predict.at44 += MulScale(dz<<8, 0xc00, 16);
|
||||
predict.at40 += predict.at44>>8;
|
||||
|
||||
predict.at34 = predict.at40 - predict.at38 - (12<<8);
|
||||
predict.weaponZ = predict.at40 - predict.viewz - (12<<8);
|
||||
|
||||
predict.bobPhase = ClipLow(predict.bobPhase-4, 0);
|
||||
|
||||
|
@ -314,10 +314,10 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
{
|
||||
predict.Kills = (predict.Kills+17)&2047;
|
||||
predict.at14 = (predict.at14+17)&2047;
|
||||
predict.at8 = MulScale(10*pPosture->bobV,Sin(predict.Kills*2), 30);
|
||||
predict.atc = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
|
||||
predict.at18 = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
|
||||
predict.at1c = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
|
||||
predict.bobHeight = MulScale(10*pPosture->bobV,Sin(predict.Kills*2), 30);
|
||||
predict.bobWidth = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
|
||||
predict.shakeBobY = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
|
||||
predict.shakeBobX = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -336,10 +336,10 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.bobPhase = ClipHigh(predict.bobPhase + nSpeed, 30);
|
||||
}
|
||||
}
|
||||
predict.at8 = MulScale(predict.bobPhase*pPosture->bobV,Sin(predict.Kills*2), 30);
|
||||
predict.atc = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
|
||||
predict.at18 = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
|
||||
predict.at1c = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
|
||||
predict.bobHeight = MulScale(predict.bobPhase*pPosture->bobV,Sin(predict.Kills*2), 30);
|
||||
predict.bobWidth = MulScale(predict.bobPhase*pPosture->bobH,Sin(predict.Kills-256), 30);
|
||||
predict.shakeBobY = MulScale(predict.bobPhase*pPosture->swayV,Sin(predict.at14*2), 30);
|
||||
predict.shakeBobX = MulScale(predict.bobPhase*pPosture->swayH,Sin(predict.at14-0x155), 30);
|
||||
}
|
||||
if (!pXSprite->health)
|
||||
return;
|
||||
|
@ -347,11 +347,11 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
|
|||
if (predict.at48 == 1)
|
||||
{
|
||||
predict.at72 = 1;
|
||||
int nSector = predict.at68;
|
||||
int nSector = predict.sectnum;
|
||||
int nLink = gLowerLink[nSector];
|
||||
if (nLink > 0 && (sprite[nLink].type == kMarkerLowGoo || sprite[nLink].type == kMarkerLowWater))
|
||||
{
|
||||
if (getceilzofslope(nSector, predict.at50, predict.at54) > predict.at38)
|
||||
if (getceilzofslope(nSector, predict.x, predict.y) > predict.viewz)
|
||||
predict.at72 = 0;
|
||||
}
|
||||
}
|
||||
|
@ -365,34 +365,34 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
pPlayer = &gPlayer[pSprite->type-kDudePlayer1];
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
top += predict.at58 - pSprite->z;
|
||||
bottom += predict.at58 - pSprite->z;
|
||||
int bz = (bottom-predict.at58)/4;
|
||||
int tz = (predict.at58-top)/4;
|
||||
top += predict.z - pSprite->z;
|
||||
bottom += predict.z - pSprite->z;
|
||||
int bz = (bottom-predict.z)/4;
|
||||
int tz = (predict.z-top)/4;
|
||||
int wd = pSprite->clipdist*4;
|
||||
int nSector = predict.at68;
|
||||
int nSector = predict.sectnum;
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
if (predict.at5c || predict.at60)
|
||||
if (predict.xvel || predict.yvel)
|
||||
{
|
||||
if (pPlayer && gNoClip)
|
||||
{
|
||||
predict.at50 += predict.at5c>>12;
|
||||
predict.at54 += predict.at60>>12;
|
||||
if (!FindSector(predict.at50, predict.at54, &nSector))
|
||||
nSector = predict.at68;
|
||||
predict.x += predict.xvel>>12;
|
||||
predict.y += predict.yvel>>12;
|
||||
if (!FindSector(predict.x, predict.y, &nSector))
|
||||
nSector = predict.sectnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
predict.at75.hit = ClipMove(&predict.at50, &predict.at54, &predict.at58, &nSector, predict.at5c >> 12, predict.at60 >> 12, wd, tz, bz, CLIPMASK0);
|
||||
predict.at75.hit = ClipMove(&predict.x, &predict.y, &predict.z, &nSector, predict.xvel >> 12, predict.yvel >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
nSector = predict.at68;
|
||||
nSector = predict.sectnum;
|
||||
|
||||
if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate)
|
||||
{
|
||||
short nSector2 = nSector;
|
||||
pushmove_old((int32_t*)&predict.at50, (int32_t*)&predict.at54, (int32_t*)&predict.at58, &nSector2, wd, tz, bz, CLIPMASK0);
|
||||
pushmove_old((int32_t*)&predict.x, (int32_t*)&predict.y, (int32_t*)&predict.z, &nSector2, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector2 != -1)
|
||||
nSector = nSector2;
|
||||
}
|
||||
|
@ -415,15 +415,15 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
// ???
|
||||
}
|
||||
}
|
||||
actWallBounceVector(&predict.at5c, &predict.at60, nHitWall, 0);
|
||||
actWallBounceVector(&predict.xvel, &predict.yvel, nHitWall, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (predict.at68 != nSector)
|
||||
if (predict.sectnum != nSector)
|
||||
{
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
predict.at68 = nSector;
|
||||
predict.sectnum = nSector;
|
||||
}
|
||||
char bUnderwater = 0;
|
||||
char bDepth = 0;
|
||||
|
@ -445,16 +445,16 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
if (pPlayer)
|
||||
wd += 16;
|
||||
|
||||
if (predict.at64)
|
||||
predict.at58 += predict.at64 >> 8;
|
||||
if (predict.zvel)
|
||||
predict.z += predict.zvel >> 8;
|
||||
|
||||
static_assert(sizeof(tspritetype) == sizeof(spritetype));
|
||||
tspritetype pSpriteBak; memcpy(&pSpriteBak, pSprite, sizeof(pSpriteBak)); // how dare you??? (Use a tspritetype here so that if the sprite storage gets refactored, this line gets flagged.)
|
||||
spritetype *pTempSprite = pSprite;
|
||||
pTempSprite->x = predict.at50;
|
||||
pTempSprite->y = predict.at54;
|
||||
pTempSprite->z = predict.at58;
|
||||
pTempSprite->sectnum = predict.at68;
|
||||
pTempSprite->x = predict.x;
|
||||
pTempSprite->y = predict.y;
|
||||
pTempSprite->z = predict.z;
|
||||
pTempSprite->sectnum = predict.sectnum;
|
||||
int ceilZ, ceilHit, floorZ, floorHit;
|
||||
GetZRange(pTempSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, wd, CLIPMASK0);
|
||||
GetSpriteExtents(pTempSprite, &top, &bottom);
|
||||
|
@ -465,7 +465,7 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
{
|
||||
if (bUnderwater)
|
||||
{
|
||||
int cz = getceilzofslope(nSector, predict.at50, predict.at54);
|
||||
int cz = getceilzofslope(nSector, predict.x, predict.y);
|
||||
if (cz > top)
|
||||
vc += ((bottom-cz)*-80099) / (bottom-top);
|
||||
else
|
||||
|
@ -473,7 +473,7 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
}
|
||||
else
|
||||
{
|
||||
int fz = getflorzofslope(nSector, predict.at50, predict.at54);
|
||||
int fz = getflorzofslope(nSector, predict.x, predict.y);
|
||||
if (fz < bottom)
|
||||
vc += ((bottom-fz)*-80099) / (bottom-top);
|
||||
}
|
||||
|
@ -487,8 +487,8 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
}
|
||||
if (vc)
|
||||
{
|
||||
predict.at58 += ((vc*4)/2)>>8;
|
||||
predict.at64 += vc;
|
||||
predict.z += ((vc*4)/2)>>8;
|
||||
predict.zvel += vc;
|
||||
}
|
||||
}
|
||||
GetSpriteExtents(pTempSprite, &top, &bottom);
|
||||
|
@ -497,7 +497,7 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
int floorZ2 = floorZ;
|
||||
int floorHit2 = floorHit;
|
||||
GetZRange(pTempSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, pSprite->clipdist<<2, CLIPMASK0, PARALLAXCLIP_CEILING|PARALLAXCLIP_FLOOR);
|
||||
if (bottom <= floorZ && predict.at58-floorZ2 < bz)
|
||||
if (bottom <= floorZ && predict.z-floorZ2 < bz)
|
||||
{
|
||||
floorZ = floorZ2;
|
||||
floorHit = floorHit2;
|
||||
|
@ -506,21 +506,21 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
if (floorZ <= bottom)
|
||||
{
|
||||
predict.at75.florhit = floorHit;
|
||||
predict.at58 += floorZ-bottom;
|
||||
int var44 = predict.at64-velFloor[predict.at68];
|
||||
predict.z += floorZ-bottom;
|
||||
int var44 = predict.zvel-velFloor[predict.sectnum];
|
||||
if (var44 > 0)
|
||||
{
|
||||
actFloorBounceVector(&predict.at5c, &predict.at60, &var44, predict.at68, 0);
|
||||
predict.at64 = var44;
|
||||
if (abs(predict.at64) < 0x10000)
|
||||
actFloorBounceVector(&predict.xvel, &predict.yvel, &var44, predict.sectnum, 0);
|
||||
predict.zvel = var44;
|
||||
if (abs(predict.zvel) < 0x10000)
|
||||
{
|
||||
predict.at64 = velFloor[predict.at68];
|
||||
predict.zvel = velFloor[predict.sectnum];
|
||||
predict.at73 &= ~4;
|
||||
}
|
||||
else
|
||||
predict.at73 |= 4;
|
||||
}
|
||||
else if (predict.at64 == 0)
|
||||
else if (predict.zvel == 0)
|
||||
predict.at73 &= ~4;
|
||||
}
|
||||
else
|
||||
|
@ -532,40 +532,40 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
if (top <= ceilZ)
|
||||
{
|
||||
predict.at75.ceilhit = ceilHit;
|
||||
predict.at58 += ClipLow(ceilZ-top, 0);
|
||||
if (predict.at64 <= 0 && (predict.at73&4))
|
||||
predict.at64 = MulScale(-predict.at64, 0x2000, 16);
|
||||
predict.z += ClipLow(ceilZ-top, 0);
|
||||
if (predict.zvel <= 0 && (predict.at73&4))
|
||||
predict.zvel = MulScale(-predict.zvel, 0x2000, 16);
|
||||
}
|
||||
else
|
||||
predict.at75.ceilhit = 0;
|
||||
|
||||
GetSpriteExtents(pTempSprite, &top, &bottom);
|
||||
memcpy(pSprite, &pSpriteBak, sizeof(pSpriteBak));
|
||||
predict.at6a = ClipLow(floorZ-bottom, 0)>>8;
|
||||
if (predict.at5c || predict.at60)
|
||||
predict.floordist = ClipLow(floorZ-bottom, 0)>>8;
|
||||
if (predict.xvel || predict.yvel)
|
||||
{
|
||||
if ((floorHit & 0xc000) == 0xc000)
|
||||
{
|
||||
int nHitSprite = floorHit & 0x3fff;
|
||||
if ((sprite[nHitSprite].cstat & 0x30) == 0)
|
||||
{
|
||||
predict.at5c += MulScale(4, predict.at50 - sprite[nHitSprite].x, 2);
|
||||
predict.at60 += MulScale(4, predict.at54 - sprite[nHitSprite].y, 2);
|
||||
predict.xvel += MulScale(4, predict.x - sprite[nHitSprite].x, 2);
|
||||
predict.yvel += MulScale(4, predict.y - sprite[nHitSprite].y, 2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0 && xsector[nXSector].Underwater)
|
||||
return;
|
||||
if (predict.at6a >= 0x100)
|
||||
if (predict.floordist >= 0x100)
|
||||
return;
|
||||
int nDrag = gDudeDrag;
|
||||
if (predict.at6a > 0)
|
||||
nDrag -= scale(gDudeDrag, predict.at6a, 0x100);
|
||||
predict.at5c -= mulscale16r(predict.at5c, nDrag);
|
||||
predict.at60 -= mulscale16r(predict.at60, nDrag);
|
||||
if (approxDist(predict.at5c, predict.at60) < 0x1000)
|
||||
predict.at5c = predict.at60 = 0;
|
||||
if (predict.floordist > 0)
|
||||
nDrag -= scale(gDudeDrag, predict.floordist, 0x100);
|
||||
predict.xvel -= mulscale16r(predict.xvel, nDrag);
|
||||
predict.yvel -= mulscale16r(predict.yvel, nDrag);
|
||||
if (approxDist(predict.xvel, predict.yvel) < 0x1000)
|
||||
predict.xvel = predict.yvel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ static void fakeActAirDrag(spritetype *, int num)
|
|||
{
|
||||
int xvec = 0;
|
||||
int yvec = 0;
|
||||
int nSector = predict.at68;
|
||||
int nSector = predict.sectnum;
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
sectortype *pSector = §or[nSector];
|
||||
int nXSector = pSector->extra;
|
||||
|
@ -590,9 +590,9 @@ static void fakeActAirDrag(spritetype *, int num)
|
|||
yvec = MulScale(vel, Sin(pXSector->windAng), 30);
|
||||
}
|
||||
}
|
||||
predict.at5c += MulScale(xvec-predict.at5c, num, 16);
|
||||
predict.at60 += MulScale(yvec-predict.at60, num, 16);
|
||||
predict.at64 -= MulScale(predict.at64, num, 16);
|
||||
predict.xvel += MulScale(xvec-predict.xvel, num, 16);
|
||||
predict.yvel += MulScale(yvec-predict.yvel, num, 16);
|
||||
predict.zvel -= MulScale(predict.zvel, num, 16);
|
||||
}
|
||||
|
||||
void fakeActProcessSprites(void)
|
||||
|
@ -602,7 +602,7 @@ void fakeActProcessSprites(void)
|
|||
{
|
||||
int nXSprite = pSprite->extra;
|
||||
assert(nXSprite > 0 && nXSprite < kMaxXSprites);
|
||||
int nSector = predict.at68;
|
||||
int nSector = predict.sectnum;
|
||||
int nXSector = sector[nSector].extra;
|
||||
XSECTOR *pXSector = NULL;
|
||||
if (nXSector > 0)
|
||||
|
@ -615,9 +615,9 @@ void fakeActProcessSprites(void)
|
|||
{
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
top += predict.at58 - pSprite->z;
|
||||
bottom += predict.at58 - pSprite->z;
|
||||
if (getflorzofslope(nSector, predict.at50, predict.at54) < bottom)
|
||||
top += predict.z - pSprite->z;
|
||||
bottom += predict.z - pSprite->z;
|
||||
if (getflorzofslope(nSector, predict.x, predict.y) < bottom)
|
||||
{
|
||||
int angle = pXSector->panAngle;
|
||||
int speed = 0;
|
||||
|
@ -629,8 +629,8 @@ void fakeActProcessSprites(void)
|
|||
}
|
||||
if (sector[nSector].floorstat&64)
|
||||
angle = (GetWallAngle(sector[nSector].wallptr)+512)&2047;
|
||||
predict.at5c += MulScale(speed,Cos(angle), 30);
|
||||
predict.at60 += MulScale(speed,Sin(angle), 30);
|
||||
predict.xvel += MulScale(speed,Cos(angle), 30);
|
||||
predict.yvel += MulScale(speed,Sin(angle), 30);
|
||||
}
|
||||
}
|
||||
if (pXSector && pXSector->Underwater)
|
||||
|
@ -638,7 +638,7 @@ void fakeActProcessSprites(void)
|
|||
else
|
||||
fakeActAirDrag(pSprite, 128);
|
||||
|
||||
if ((predict.at73 & 4) != 0 || predict.at5c != 0 || predict.at60 != 0 || predict.at64 != 0 || velFloor[predict.at68] != 0 || velCeil[predict.at68] != 0)
|
||||
if ((predict.at73 & 4) != 0 || predict.xvel != 0 || predict.yvel != 0 || predict.zvel != 0 || velFloor[predict.sectnum] != 0 || velCeil[predict.sectnum] != 0)
|
||||
{
|
||||
fakeMoveDude(pSprite);
|
||||
}
|
||||
|
|
|
@ -85,18 +85,18 @@ void viewBackupView(int nPlayer)
|
|||
{
|
||||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||
VIEW *pView = &gPrevView[nPlayer];
|
||||
pView->at30 = pPlayer->angle.ang;
|
||||
pView->at50 = pPlayer->pSprite->x;
|
||||
pView->at54 = pPlayer->pSprite->y;
|
||||
pView->at38 = pPlayer->zView;
|
||||
pView->at34 = pPlayer->zWeapon-pPlayer->zView-0xc00;
|
||||
pView->at24 = pPlayer->horizon.horiz;
|
||||
pView->at28 = pPlayer->horizon.horizoff;
|
||||
pView->angle = pPlayer->angle.ang;
|
||||
pView->x = pPlayer->pSprite->x;
|
||||
pView->y = pPlayer->pSprite->y;
|
||||
pView->viewz = pPlayer->zView;
|
||||
pView->weaponZ = pPlayer->zWeapon-pPlayer->zView-0xc00;
|
||||
pView->horiz = pPlayer->horizon.horiz;
|
||||
pView->horizoff = pPlayer->horizon.horizoff;
|
||||
pView->at2c = pPlayer->slope;
|
||||
pView->at8 = pPlayer->bobHeight;
|
||||
pView->atc = pPlayer->bobWidth;
|
||||
pView->at18 = pPlayer->swayHeight;
|
||||
pView->at1c = pPlayer->swayWidth;
|
||||
pView->bobHeight = pPlayer->bobHeight;
|
||||
pView->bobWidth = pPlayer->bobWidth;
|
||||
pView->shakeBobY = pPlayer->swayHeight;
|
||||
pView->shakeBobX = pPlayer->swayWidth;
|
||||
pView->look_ang = pPlayer->angle.look_ang;
|
||||
pView->rotscrnang = pPlayer->angle.rotscrnang;
|
||||
pPlayer->angle.backup();
|
||||
|
@ -107,9 +107,9 @@ void viewCorrectViewOffsets(int nPlayer, vec3_t const *oldpos)
|
|||
{
|
||||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||
VIEW *pView = &gPrevView[nPlayer];
|
||||
pView->at50 += pPlayer->pSprite->x-oldpos->x;
|
||||
pView->at54 += pPlayer->pSprite->y-oldpos->y;
|
||||
pView->at38 += pPlayer->pSprite->z-oldpos->z;
|
||||
pView->x += pPlayer->pSprite->x-oldpos->x;
|
||||
pView->y += pPlayer->pSprite->y-oldpos->y;
|
||||
pView->viewz += pPlayer->pSprite->z-oldpos->z;
|
||||
}
|
||||
|
||||
void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int nPalette, int position, char shadow, unsigned int nStat, uint8_t alpha)
|
||||
|
@ -442,15 +442,122 @@ static void DrawMap(spritetype* pSprite)
|
|||
tm = 1;
|
||||
}
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
int x = interpolate(pView->at50, pSprite->x, gInterpolate);
|
||||
int y = interpolate(pView->at54, pSprite->y, gInterpolate);
|
||||
int x = interpolate(pView->x, pSprite->x, gInterpolate);
|
||||
int y = interpolate(pView->y, pSprite->y, gInterpolate);
|
||||
int ang = (!SyncInput() ? gView->angle.sum() : gView->angle.interpolatedsum(gInterpolate)).asbuild();
|
||||
DrawOverheadMap(x, y, ang, gInterpolate);
|
||||
if (tm)
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
||||
void renderCrystalBall()
|
||||
{
|
||||
#if 0
|
||||
// needs to be redone for pure hardware rendering when MP is working again.
|
||||
int tmp = (PlayClock / 240) % (gNetPlayers - 1);
|
||||
int i = connecthead;
|
||||
while (1)
|
||||
{
|
||||
if (i == gViewIndex)
|
||||
i = connectpoint2[i];
|
||||
if (tmp == 0)
|
||||
break;
|
||||
i = connectpoint2[i];
|
||||
tmp--;
|
||||
}
|
||||
PLAYER* pOther = &gPlayer[i];
|
||||
//othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);;
|
||||
if (!tileData(4079))
|
||||
{
|
||||
TileFiles.tileCreate(4079, 128, 128);
|
||||
}
|
||||
//renderSetTarget(4079, 128, 128);
|
||||
renderSetAspect(65536, 78643);
|
||||
int vd8 = pOther->pSprite->x;
|
||||
int vd4 = pOther->pSprite->y;
|
||||
int vd0 = pOther->zView;
|
||||
int vcc = pOther->pSprite->sectnum;
|
||||
int v50 = pOther->pSprite->ang;
|
||||
int v54 = 0;
|
||||
if (pOther->flickerEffect)
|
||||
{
|
||||
int nValue = ClipHigh(pOther->flickerEffect * 8, 2000);
|
||||
v54 += QRandom2(nValue >> 8);
|
||||
v50 += QRandom2(nValue >> 8);
|
||||
vd8 += QRandom2(nValue >> 4);
|
||||
vd4 += QRandom2(nValue >> 4);
|
||||
vd0 += QRandom2(nValue);
|
||||
}
|
||||
if (pOther->quakeEffect)
|
||||
{
|
||||
int nValue = ClipHigh(pOther->quakeEffect * 8, 2000);
|
||||
v54 += QRandom2(nValue >> 8);
|
||||
v50 += QRandom2(nValue >> 8);
|
||||
vd8 += QRandom2(nValue >> 4);
|
||||
vd4 += QRandom2(nValue >> 4);
|
||||
vd0 += QRandom2(nValue);
|
||||
}
|
||||
CalcOtherPosition(pOther->pSprite, &vd8, &vd4, &vd0, &vcc, v50, 0, (int)gInterpolate);
|
||||
CheckLink(&vd8, &vd4, &vd0, &vcc);
|
||||
uint8_t v14 = 0;
|
||||
if (IsUnderwaterSector(vcc))
|
||||
{
|
||||
v14 = 10;
|
||||
}
|
||||
memcpy(bakMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, otherMirrorGotpic, 2);
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0));
|
||||
int vc4, vc8;
|
||||
getzsofslope(vcc, vd8, vd4, &vc8, &vc4);
|
||||
if (vd0 >= vc4)
|
||||
{
|
||||
vd0 = vc4 - (gUpperLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
if (vd0 <= vc8)
|
||||
{
|
||||
vd0 = vc8 + (gLowerLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
v54 = ClipRange(v54, -200, 200);
|
||||
RORHACKOTHER:
|
||||
int ror_status[16];
|
||||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
DrawMirrors(vd8, vd4, vd0, IntToFixed(v50), IntToFixed(v54), gInterpolate, -1);
|
||||
drawrooms(vd8, vd4, vd0, v50, v54, vcc);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
||||
do_ror_hack = true;
|
||||
if (do_ror_hack)
|
||||
{
|
||||
spritesortcnt = 0;
|
||||
goto RORHACKOTHER;
|
||||
}
|
||||
memcpy(otherMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, bakMirrorGotpic, 2);
|
||||
viewProcessSprites(vd8, vd4, vd0, v50, gInterpolate);
|
||||
renderDrawMasks();
|
||||
renderRestoreTarget();
|
||||
#endif
|
||||
}
|
||||
|
||||
void render3DViewPolymost()
|
||||
{
|
||||
int yxAspect = yxaspect;
|
||||
int viewingRange = viewingrange;
|
||||
videoSetCorrectedAspect();
|
||||
|
||||
int v1 = xs_CRoundToInt(double(viewingrange) * tan(r_fov * (pi::pi() / 360.)));
|
||||
|
||||
renderSetAspect(v1, yxaspect);
|
||||
|
||||
}
|
||||
|
||||
// The hackery in this code necessitates separating the main render functions because the modern renderer does not need
|
||||
// the messed up way to render portals.
|
||||
void render3DViewModern()
|
||||
{
|
||||
}
|
||||
|
||||
void viewDrawScreen(bool sceneonly)
|
||||
{
|
||||
|
@ -493,46 +600,38 @@ void viewDrawScreen(bool sceneonly)
|
|||
UpdateDacs(basepal);
|
||||
UpdateBlend();
|
||||
|
||||
int yxAspect = yxaspect;
|
||||
int viewingRange = viewingrange;
|
||||
videoSetCorrectedAspect();
|
||||
|
||||
int v1 = xs_CRoundToInt(double(viewingrange) * tan(r_fov * (pi::pi() / 360.)));
|
||||
|
||||
renderSetAspect(v1, yxaspect);
|
||||
|
||||
int cX, cY, cZ, v74, v8c;
|
||||
int cX, cY, cZ, bobWidth, bobHeight;
|
||||
lookangle rotscrnang;
|
||||
binangle cA;
|
||||
fixedhoriz cH;
|
||||
double zDelta, v4c, v48;
|
||||
double zDelta, shakeX, shakeY;
|
||||
int nSectnum = gView->pSprite->sectnum;
|
||||
if (numplayers > 1 && gView == gMe && gPrediction && gMe->pXSprite->health > 0)
|
||||
{
|
||||
nSectnum = predict.at68;
|
||||
cX = interpolate(predictOld.at50, predict.at50, gInterpolate);
|
||||
cY = interpolate(predictOld.at54, predict.at54, gInterpolate);
|
||||
cZ = interpolate(predictOld.at38, predict.at38, gInterpolate);
|
||||
zDelta = finterpolate(predictOld.at34, predict.at34, gInterpolate);
|
||||
v74 = interpolate(predictOld.atc, predict.atc, gInterpolate);
|
||||
v8c = interpolate(predictOld.at8, predict.at8, gInterpolate);
|
||||
v4c = finterpolate(predictOld.at1c, predict.at1c, gInterpolate);
|
||||
v48 = finterpolate(predictOld.at18, predict.at18, gInterpolate);
|
||||
nSectnum = predict.sectnum;
|
||||
cX = interpolate(predictOld.x, predict.x, gInterpolate);
|
||||
cY = interpolate(predictOld.y, predict.y, gInterpolate);
|
||||
cZ = interpolate(predictOld.viewz, predict.viewz, gInterpolate);
|
||||
zDelta = finterpolate(predictOld.weaponZ, predict.weaponZ, gInterpolate);
|
||||
bobWidth = interpolate(predictOld.bobWidth, predict.bobWidth, gInterpolate);
|
||||
bobHeight = interpolate(predictOld.bobHeight, predict.bobHeight, gInterpolate);
|
||||
shakeX = finterpolate(predictOld.shakeBobX, predict.shakeBobX, gInterpolate);
|
||||
shakeY = finterpolate(predictOld.shakeBobY, predict.shakeBobY, gInterpolate);
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
cA = bamang(predict.at30.asbam() + predict.look_ang.asbam());
|
||||
cH = predict.at24 + predict.at28;
|
||||
cA = bamang(predict.angle.asbam() + predict.look_ang.asbam());
|
||||
cH = predict.horiz + predict.horizoff;
|
||||
rotscrnang = predict.rotscrnang;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t oang = predictOld.at30.asbam() + predictOld.look_ang.asbam();
|
||||
uint32_t ang = predict.at30.asbam() + predict.look_ang.asbam();
|
||||
uint32_t oang = predictOld.angle.asbam() + predictOld.look_ang.asbam();
|
||||
uint32_t ang = predict.angle.asbam() + predict.look_ang.asbam();
|
||||
cA = interpolateangbin(oang, ang, gInterpolate);
|
||||
|
||||
fixed_t ohoriz = (predictOld.at24 + predictOld.at28).asq16();
|
||||
fixed_t horiz = (predict.at24 + predict.at28).asq16();
|
||||
fixed_t ohoriz = (predictOld.horiz + predictOld.horizoff).asq16();
|
||||
fixed_t horiz = (predict.horiz + predict.horizoff).asq16();
|
||||
cH = q16horiz(interpolate(ohoriz, horiz, gInterpolate));
|
||||
|
||||
rotscrnang = interpolateanglook(predictOld.rotscrnang.asbam(), predict.rotscrnang.asbam(), gInterpolate);
|
||||
|
@ -541,14 +640,14 @@ void viewDrawScreen(bool sceneonly)
|
|||
else
|
||||
{
|
||||
VIEW* pView = &gPrevView[gViewIndex];
|
||||
cX = interpolate(pView->at50, gView->pSprite->x, gInterpolate);
|
||||
cY = interpolate(pView->at54, gView->pSprite->y, gInterpolate);
|
||||
cZ = interpolate(pView->at38, gView->zView, gInterpolate);
|
||||
zDelta = finterpolate(pView->at34, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||
v74 = interpolate(pView->atc, gView->bobWidth, gInterpolate);
|
||||
v8c = interpolate(pView->at8, gView->bobHeight, gInterpolate);
|
||||
v4c = finterpolate(pView->at1c, gView->swayWidth, gInterpolate);
|
||||
v48 = finterpolate(pView->at18, gView->swayHeight, gInterpolate);
|
||||
cX = interpolate(pView->x, gView->pSprite->x, gInterpolate);
|
||||
cY = interpolate(pView->y, gView->pSprite->y, gInterpolate);
|
||||
cZ = interpolate(pView->viewz, gView->zView, gInterpolate);
|
||||
zDelta = finterpolate(pView->weaponZ, gView->zWeapon - gView->zView - (12 << 8), gInterpolate);
|
||||
bobWidth = interpolate(pView->bobWidth, gView->bobWidth, gInterpolate);
|
||||
bobHeight = interpolate(pView->bobHeight, gView->bobHeight, gInterpolate);
|
||||
shakeX = finterpolate(pView->shakeBobX, gView->swayWidth, gInterpolate);
|
||||
shakeY = finterpolate(pView->shakeBobY, gView->swayHeight, gInterpolate);
|
||||
|
||||
if (!SyncInput())
|
||||
{
|
||||
|
@ -570,19 +669,19 @@ void viewDrawScreen(bool sceneonly)
|
|||
cX += shakeX;
|
||||
cY += shakeY;
|
||||
cZ += shakeZ;
|
||||
v4c += shakeBobX;
|
||||
v48 += shakeBobY;
|
||||
shakeX += shakeBobX;
|
||||
shakeY += shakeBobY;
|
||||
cH += buildhoriz(MulScale(0x40000000 - Cos(gView->tiltEffect << 2), 30, 30));
|
||||
if (gViewPos == 0)
|
||||
{
|
||||
if (cl_viewhbob)
|
||||
{
|
||||
cX -= MulScale(v74, Sin(cA.asbuild()), 30) >> 4;
|
||||
cY += MulScale(v74, Cos(cA.asbuild()), 30) >> 4;
|
||||
cX -= MulScale(bobWidth, Sin(cA.asbuild()), 30) >> 4;
|
||||
cY += MulScale(bobWidth, Cos(cA.asbuild()), 30) >> 4;
|
||||
}
|
||||
if (cl_viewvbob)
|
||||
{
|
||||
cZ += v8c;
|
||||
cZ += bobHeight;
|
||||
}
|
||||
cZ += xs_CRoundToInt(cH.asq16() / 6553.6);
|
||||
cameradist = -1;
|
||||
|
@ -609,92 +708,8 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
else if (v4 && gNetPlayers > 1)
|
||||
{
|
||||
#if 0 // needs to be redone for pure hardware rendering.
|
||||
int tmp = (PlayClock / 240) % (gNetPlayers - 1);
|
||||
int i = connecthead;
|
||||
while (1)
|
||||
{
|
||||
if (i == gViewIndex)
|
||||
i = connectpoint2[i];
|
||||
if (tmp == 0)
|
||||
break;
|
||||
i = connectpoint2[i];
|
||||
tmp--;
|
||||
}
|
||||
PLAYER* pOther = &gPlayer[i];
|
||||
//othercameraclock = PlayClock + MulScale(4, (int)gInterpolate, 16);;
|
||||
if (!tileData(4079))
|
||||
{
|
||||
TileFiles.tileCreate(4079, 128, 128);
|
||||
}
|
||||
r enderSetTarget(4079, 128, 128);
|
||||
renderSetAspect(65536, 78643);
|
||||
int vd8 = pOther->pSprite->x;
|
||||
int vd4 = pOther->pSprite->y;
|
||||
int vd0 = pOther->zView;
|
||||
int vcc = pOther->pSprite->sectnum;
|
||||
int v50 = pOther->pSprite->ang;
|
||||
int v54 = 0;
|
||||
if (pOther->flickerEffect)
|
||||
{
|
||||
int nValue = ClipHigh(pOther->flickerEffect * 8, 2000);
|
||||
v54 += QRandom2(nValue >> 8);
|
||||
v50 += QRandom2(nValue >> 8);
|
||||
vd8 += QRandom2(nValue >> 4);
|
||||
vd4 += QRandom2(nValue >> 4);
|
||||
vd0 += QRandom2(nValue);
|
||||
}
|
||||
if (pOther->quakeEffect)
|
||||
{
|
||||
int nValue = ClipHigh(pOther->quakeEffect * 8, 2000);
|
||||
v54 += QRandom2(nValue >> 8);
|
||||
v50 += QRandom2(nValue >> 8);
|
||||
vd8 += QRandom2(nValue >> 4);
|
||||
vd4 += QRandom2(nValue >> 4);
|
||||
vd0 += QRandom2(nValue);
|
||||
}
|
||||
CalcOtherPosition(pOther->pSprite, &vd8, &vd4, &vd0, &vcc, v50, 0, (int)gInterpolate);
|
||||
CheckLink(&vd8, &vd4, &vd0, &vcc);
|
||||
if (IsUnderwaterSector(vcc))
|
||||
{
|
||||
v14 = 10;
|
||||
}
|
||||
memcpy(bakMirrorGotpic, gotpic + 510, 2);
|
||||
memcpy(gotpic + 510, otherMirrorGotpic, 2);
|
||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * pOther->visibility, 0));
|
||||
int vc4, vc8;
|
||||
getzsofslope(vcc, vd8, vd4, &vc8, &vc4);
|
||||
if (vd0 >= vc4)
|
||||
{
|
||||
vd0 = vc4 - (gUpperLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
if (vd0 <= vc8)
|
||||
{
|
||||
vd0 = vc8 + (gLowerLink[vcc] >= 0 ? 0 : (8 << 8));
|
||||
}
|
||||
v54 = ClipRange(v54, -200, 200);
|
||||
RORHACKOTHER:
|
||||
int ror_status[16];
|
||||
for (int i = 0; i < 16; i++)
|
||||
ror_status[i] = TestBitString(gotpic, 4080 + i);
|
||||
yax_preparedrawrooms();
|
||||
DrawMirrors(vd8, vd4, vd0, IntToFixed(v50), IntToFixed(v54), gInterpolate, -1);
|
||||
drawrooms(vd8, vd4, vd0, v50, v54, vcc);
|
||||
yax_drawrooms(viewProcessSprites, vcc, 0, gInterpolate);
|
||||
bool do_ror_hack = false;
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (ror_status[i] != TestBitString(gotpic, 4080 + i))
|
||||
do_ror_hack = true;
|
||||
if (do_ror_hack)
|
||||
{
|
||||
spritesortcnt = 0;
|
||||
goto RORHACKOTHER;
|
||||
}
|
||||
memcpy(otherMirrorGotpic, gotpic+510, 2);
|
||||
memcpy(gotpic+510, bakMirrorGotpic, 2);
|
||||
viewProcessSprites(vd8, vd4, vd0, v50, gInterpolate);
|
||||
renderDrawMasks();
|
||||
renderRestoreTarget();
|
||||
#if 0
|
||||
renderCrystalBall();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -809,7 +824,6 @@ void viewDrawScreen(bool sceneonly)
|
|||
|
||||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
renderSetAspect(viewingRange, yxAspect);
|
||||
int nClipDist = gView->pSprite->clipdist << 2;
|
||||
int ve8, vec, vf0, vf4;
|
||||
GetZRange(gView->pSprite, &vf4, &vf0, &vec, &ve8, nClipDist, 0);
|
||||
|
@ -834,7 +848,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
hudDraw(gView, nSectnum, v4c, v48, zDelta, basepal, gInterpolate);
|
||||
hudDraw(gView, nSectnum, shakeX, shakeY, zDelta, basepal, gInterpolate);
|
||||
}
|
||||
UpdateDacs(0, true); // keep the view palette active only for the actual 3D view and its overlays.
|
||||
if (automapMode != am_off)
|
||||
|
|
|
@ -34,31 +34,31 @@ BEGIN_BLD_NS
|
|||
struct VIEW {
|
||||
int bobPhase;
|
||||
int Kills;
|
||||
int at8; // bob height
|
||||
int atc; // bob width
|
||||
int bobHeight; // bob height
|
||||
int bobWidth; // bob width
|
||||
int at10;
|
||||
int at14;
|
||||
int at18; // bob sway y
|
||||
int at1c; // bob sway x
|
||||
fixedhoriz at24; // horiz
|
||||
fixedhoriz at28; // horizoff
|
||||
int shakeBobY; // bob sway y
|
||||
int shakeBobX; // bob sway x
|
||||
fixedhoriz horiz; // horiz
|
||||
fixedhoriz horizoff; // horizoff
|
||||
int at2c;
|
||||
binangle at30; // angle
|
||||
int at34; // weapon z
|
||||
int at38; // view z
|
||||
binangle angle; // angle
|
||||
int weaponZ; // weapon z
|
||||
int viewz; // view z
|
||||
int at3c;
|
||||
int at40;
|
||||
int at44;
|
||||
int at48; // posture
|
||||
lookangle at4c; // spin
|
||||
int at50; // x
|
||||
int at54; // y
|
||||
int at58; // z
|
||||
int at5c; //xvel
|
||||
int at60; //yvel
|
||||
int at64; //zvel
|
||||
short at68; // sectnum
|
||||
unsigned int at6a; // floordist
|
||||
lookangle spin; // spin
|
||||
int x; // x
|
||||
int y; // y
|
||||
int z; // z
|
||||
int xvel; //xvel
|
||||
int yvel; //yvel
|
||||
int zvel; //zvel
|
||||
short sectnum; // sectnum
|
||||
unsigned int floordist; // floordist
|
||||
char at6e; // look center
|
||||
char at6f;
|
||||
char at70; // run
|
||||
|
|
Loading…
Reference in a new issue