Q16.16 for player angle, too

git-svn-id: https://svn.eduke32.com/eduke32@6725 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-03-07 04:21:18 +00:00
parent 4d8bb170a3
commit a76750df55
19 changed files with 290 additions and 258 deletions

View file

@ -1065,12 +1065,12 @@ void plotpixel(int32_t x, int32_t y, char col);
char getpixel(int32_t x, int32_t y);
void setviewtotile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void setviewback(void);
void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, int16_t *tang);
void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang);
void completemirror(void);
int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int16_t daang, int32_t dahoriz, int16_t dacursectnum);
fix16_t daang, fix16_t dahoriz, int16_t dacursectnum);
void drawmasks(void);
void clearview(int32_t dacol);
void clearallviews(int32_t dacol);

View file

@ -352,7 +352,7 @@ void polymer_setaspect(int32_t);
void polymer_glinit(void);
void polymer_resetlights(void);
void polymer_loadboard(void);
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t daang, int32_t dahoriz, int16_t dacursectnum);
void polymer_drawmasks(void);
void polymer_editorpick(void);
void polymer_inb4rotatesprite(int16_t tilenum, char pal, int8_t shade, int32_t method);

View file

@ -1389,6 +1389,7 @@ int32_t globalposx, globalposy, globalposz, globalhoriz;
fix16_t qglobalhoriz;
float fglobalposx, fglobalposy, fglobalposz;
int16_t globalang, globalcursectnum;
fix16_t qglobalang;
int32_t globalpal, cosglobalang, singlobalang;
int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
static int32_t globaluclip, globaldclip;
@ -7895,15 +7896,22 @@ void initspritelists(void)
}
void set_globalang(int16_t ang)
void set_globalang(fix16_t ang)
{
globalang = ang&2047;
globalang = fix16_to_int(ang)&2047;
qglobalang = ang & 0x7FFFFFF;
cosglobalang = sintable[(globalang+512)&2047];
singlobalang = sintable[globalang&2047];
#ifdef USE_OPENGL
fcosglobalang = (float) cosglobalang;
fsinglobalang = (float) singlobalang;
float const f_ang = fix16_to_float(ang);
float const f_ang_radians = f_ang * M_PI * (1.f/1024.f);
fcosglobalang = cosf(f_ang_radians) * 16384.f;
fsinglobalang = sinf(f_ang_radians) * 16384.f;
#endif
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
}
@ -7912,7 +7920,7 @@ void set_globalang(int16_t ang)
// drawrooms
//
int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
int16_t daang, fix16_t dahoriz, int16_t dacursectnum)
fix16_t daang, fix16_t dahoriz, int16_t dacursectnum)
{
int32_t i, j, /*cz, fz,*/ closest;
int16_t *shortptr1, *shortptr2;
@ -7922,8 +7930,15 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
beforedrawrooms = 0;
set_globalpos(daposx, daposy, daposz);
set_globalang(daang);
// support the old range of values
if ((dahoriz & 0xFFFF0000) == 0)
dahoriz = fix16_from_int(dahoriz);
if ((daang & 0xFFFF0000) == 0)
daang = fix16_from_int(daang);
set_globalang(daang);
global100horiz = dahoriz;
// xdimenscale is scale(xdimen,yxaspect,320);
@ -12382,8 +12397,8 @@ void squarerotatetile(int16_t tilenume)
//
// preparemirror
//
void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, int16_t *tang)
void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang)
{
const int32_t x = wall[dawall].x, dx = wall[wall[dawall].point2].x-x;
const int32_t y = wall[dawall].y, dy = wall[wall[dawall].point2].y-y;
@ -12396,7 +12411,7 @@ void preparemirror(int32_t dax, int32_t day, int16_t daang, int16_t dawall,
*tposx = (x<<1) + scale(dx,i,j) - dax;
*tposy = (y<<1) + scale(dy,i,j) - day;
*tang = ((getangle(dx,dy)<<1)-daang)&2047;
*tang = (fix16_from_int(getangle(dx, dy) << 1) - daang) & 0x7FFFFFF;
inpreparemirror = 1;
}

View file

@ -205,7 +205,7 @@ extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen;
extern float fxdimen;
extern intptr_t frameoffset;
extern int32_t globalposx, globalposy, globalposz, globalhoriz;
extern fix16_t qglobalhoriz;
extern fix16_t qglobalhoriz, qglobalang;
extern float fglobalposx, fglobalposy, fglobalposz;
extern int16_t globalang, globalcursectnum;
extern int32_t globalpal, cosglobalang, singlobalang;
@ -257,7 +257,7 @@ extern void get_floorspr_points(uspritetype const * const spr, int32_t px, int32
// int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat);
int32_t wallfront(int32_t l1, int32_t l2);
void set_globalang(int16_t ang);
void set_globalang(fix16_t ang);
#ifdef DEBUGGINGAIDS
int32_t animateoffs(int const tilenum, int fakevar);

View file

@ -718,7 +718,7 @@ int16_t *cursectormasks;
int16_t *cursectormaskcount;
float horizang;
int16_t viewangle;
fix16_t viewangle;
int32_t depth;
_prmirror mirrors[10];
@ -1060,7 +1060,7 @@ void polymer_loadboard(void)
// The parallaxed ART sky angle divisor corresponding to a horizfrac of 32768.
#define DEFAULT_ARTSKY_ANGDIV 4.3027f
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum)
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t daang, fix16_t dahoriz, int16_t dacursectnum)
{
int16_t cursectnum;
int32_t i, cursectflorz, cursectceilz;
@ -1080,8 +1080,8 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
// fogcalc_old needs this
gvisibility = ((float)globalvisibility)*FOGSCALE;
ang = (float)(daang) * (360.f/2048.f);
horizang = (float)(-getangle(128, dahoriz-100)) * (360.f/2048.f);
ang = fix16_to_float(daang) * (360.f/2048.f);
horizang = (float)(-getangle(128, fix16_to_int(dahoriz)-100)) * (360.f/2048.f);
tiltang = (gtang * 90.0f);
pos[0] = (float)daposy;
@ -1214,7 +1214,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
polymer_emptybuckets();
viewangle = daang;
viewangle = fix16_to_int(daang);
enddrawing();
return;
}
@ -1225,7 +1225,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
curmodelviewmatrix = rootmodelviewmatrix;
// build globals used by rotatesprite
viewangle = daang;
viewangle = fix16_to_int(daang);
set_globalang(daang);
// polymost globals used by polymost_dorotatesprite

View file

@ -3496,6 +3496,7 @@ static void polymost_drawalls(int32_t const bunch)
int32_t const sectnum = thesector[bunchfirst[bunch]];
usectortype const * const sec = (usectortype *)&sector[sectnum];
float const fglobalang = fix16_to_float(qglobalang);
//DRAW WALLS SECTION!
for (bssize_t z=bunchfirst[bunch]; z>=0; z=bunchp2[z])
@ -3695,14 +3696,14 @@ static void polymost_drawalls(int32_t const bunch)
float const r = (fy1-fy0)/(x1-x0); //slope of line
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
int y = ((((int32_t)((x0-ghalfx)*o.y))+globalang)>>(11-dapskybits));
int y = ((int32_t)(((x0-ghalfx)*o.y)+fglobalang)>>(11-dapskybits));
float fx = x0;
do
{
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
otex.u = otex.d*(t*((float)(globalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->floorxpanning:0)) - xtex.u*ghalfx;
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->floorxpanning:0)) - xtex.u*ghalfx;
y++;
o.x = fx; fx = ((float)((y<<(11-dapskybits))-globalang))*o.z+ghalfx;
o.x = fx; fx = ((float)((y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
pow2xsplit = 0; polymost_domost(o.x,(o.x-x0)*r+fy0,fx,(fx-x0)*r+fy0); //flor
@ -4027,14 +4028,14 @@ static void polymost_drawalls(int32_t const bunch)
float const r = (cy1-cy0)/(x1-x0); //slope of line
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
int y = ((((int32_t)((x0-ghalfx)*o.y))+globalang)>>(11-dapskybits));
int y = ((int32_t)(((x0-ghalfx)*o.y)+fglobalang)>>(11-dapskybits));
float fx = x0;
do
{
globalpicnum = dapskyoff[y&((1<<dapskybits)-1)]+i;
otex.u = otex.d*(t*((float)(globalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - xtex.u*ghalfx;
otex.u = otex.d*(t*((float)(fglobalang-(y<<(11-dapskybits)))) * (1.f/2048.f) + (float)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - xtex.u*ghalfx;
y++;
o.x = fx; fx = ((float)((y<<(11-dapskybits))-globalang))*o.z+ghalfx;
o.x = fx; fx = (((float) (y<<(11-dapskybits))-fglobalang))*o.z+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
pow2xsplit = 0; polymost_domost(fx,(fx-x0)*r+cy0,o.x,(o.x-x0)*r+cy0); //ceil

View file

@ -86,7 +86,7 @@ void G_ClearCameraView(DukePlayer_t *ps)
{
ps->newowner = -1;
ps->pos = ps->opos;
ps->ang = ps->oang;
ps->q16ang = ps->oq16ang;
updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum);
P_UpdateScreenPal(ps);
@ -1151,7 +1151,7 @@ void A_MoveDummyPlayers(void)
{
CS(spriteNum) = 257;
SZ(spriteNum) = sector[SECT(spriteNum)].ceilingz+(27<<8);
SA(spriteNum) = pPlayer->ang;
SA(spriteNum) = fix16_to_int(pPlayer->q16ang);
if (T1(spriteNum) == 8)
T1(spriteNum) = 0;
else T1(spriteNum)++;
@ -1195,7 +1195,7 @@ ACTOR_STATIC void G_MovePlayers(void)
pSprite->y = pPlayer->opos.y;
pSprite->z = pPlayer->opos.z + PHEIGHT;
actor[spriteNum].bpos.z = pSprite->z;
pSprite->ang = pPlayer->oang;
pSprite->ang = fix16_from_int(pPlayer->oq16ang);
setsprite(spriteNum, (vec3_t *)pSprite);
}
@ -1279,12 +1279,15 @@ ACTOR_STATIC void G_MovePlayers(void)
if (pPlayer->wackedbyactor >= 0 && sprite[pPlayer->wackedbyactor].statnum < MAXSTATUS)
{
pPlayer->ang += G_GetAngleDelta(pPlayer->ang,getangle(sprite[pPlayer->wackedbyactor].x-pPlayer->pos.x,sprite[pPlayer->wackedbyactor].y-pPlayer->pos.y))>>1;
pPlayer->ang &= 2047;
pPlayer->q16ang += fix16_to_int(G_GetAngleDelta(pPlayer->q16ang,
getangle(sprite[pPlayer->wackedbyactor].x - pPlayer->pos.x,
sprite[pPlayer->wackedbyactor].y - pPlayer->pos.y))
>> 1);
pPlayer->q16ang &= 0x7FFFFFF;
}
}
pSprite->ang = pPlayer->ang;
pSprite->ang = fix16_to_int(pPlayer->q16ang);
}
}
else
@ -1316,13 +1319,13 @@ ACTOR_STATIC void G_MovePlayers(void)
if (pSprite->extra < 8)
{
pSprite->xvel = 128;
pSprite->ang = pPlayer->ang;
pSprite->ang = fix16_to_int(pPlayer->q16ang);
pSprite->extra++;
A_SetSprite(spriteNum,CLIPMASK0);
}
else
{
pSprite->ang = 2047-pPlayer->ang;
pSprite->ang = 2047-fix16_to_int(pPlayer->q16ang);
setsprite(spriteNum,(vec3_t *)pSprite);
}
}
@ -1674,7 +1677,7 @@ ACTOR_STATIC void G_MoveStandables(void)
pSprite->owner = -2;
g_player[p].ps->on_crane = spriteNum;
A_PlaySound(DUKE_GRUNT,g_player[p].ps->i);
g_player[p].ps->ang = pSprite->ang+1024;
g_player[p].ps->q16ang = fix16_from_int(pSprite->ang+1024);
}
else
{
@ -1762,8 +1765,8 @@ ACTOR_STATIC void G_MoveStandables(void)
{
DukePlayer_t *const ps = g_player[p].ps;
ps->opos.x = ps->pos.x = pSprite->x-(sintable[(ps->ang+512)&2047]>>6);
ps->opos.y = ps->pos.y = pSprite->y-(sintable[ps->ang&2047]>>6);
ps->opos.x = ps->pos.x = pSprite->x-(sintable[(fix16_to_int(ps->q16ang)+512)&2047]>>6);
ps->opos.y = ps->pos.y = pSprite->y-(sintable[fix16_to_int(ps->q16ang)&2047]>>6);
ps->opos.z = ps->pos.z = pSprite->z+(2<<8);
setsprite(ps->i, (vec3_t *)ps);
@ -2611,7 +2614,7 @@ ACTOR_STATIC void A_DoProjectileBounce(int const spriteNum)
ACTOR_STATIC void P_HandleBeingSpitOn(DukePlayer_t * const ps)
{
ps->qhoriz += F16(32);
ps->q16horiz += F16(32);
ps->return_to_center = 8;
if (ps->loogcnt)
@ -3427,7 +3430,7 @@ ACTOR_STATIC void G_MoveTransports(void)
}
}
pPlayer->ang = sprite[OW(spriteNum)].ang;
pPlayer->q16ang = fix16_from_int(sprite[OW(spriteNum)].ang);
if (sprite[OW(spriteNum)].owner != OW(spriteNum))
{
@ -3841,7 +3844,7 @@ ACTOR_STATIC void G_MoveActors(void)
// I'm 50/50 on this being either a typo or a stupid hack
if (playerDist < 1596)
{
int const angDiff = G_GetAngleDelta(pPlayer->ang,getangle(pSprite->x-pPlayer->pos.x,pSprite->y-pPlayer->pos.y));
int const angDiff = G_GetAngleDelta(fix16_to_int(pPlayer->q16ang),getangle(pSprite->x-pPlayer->pos.x,pSprite->y-pPlayer->pos.y));
if (angDiff > -64 && angDiff < 64 && TEST_SYNC_KEY(g_player[playerNum].inputBits->bits, SK_OPEN)
&& pPlayer->toggle_key_flag == 1)
@ -3853,7 +3856,7 @@ ACTOR_STATIC void G_MoveActors(void)
if (sprite[ballSprite].picnum == QUEBALL || sprite[ballSprite].picnum == STRIPEBALL)
{
int const angDiff2 = G_GetAngleDelta(
pPlayer->ang, getangle(sprite[ballSprite].x - pPlayer->pos.x, sprite[ballSprite].y - pPlayer->pos.y));
fix16_to_int(pPlayer->q16ang), getangle(sprite[ballSprite].x - pPlayer->pos.x, sprite[ballSprite].y - pPlayer->pos.y));
if (angDiff2 > -64 && angDiff2 < 64)
{
@ -3869,7 +3872,7 @@ ACTOR_STATIC void G_MoveActors(void)
if (ballSprite == -1)
{
pSprite->xvel = (pSprite->pal == 12) ? 164 : 140;
pSprite->ang = pPlayer->ang;
pSprite->ang = fix16_to_int(pPlayer->q16ang);
pPlayer->toggle_key_flag = 2;
}
@ -4248,7 +4251,7 @@ ACTOR_STATIC void G_MoveActors(void)
}
else if (playerDist < 1024 && pPlayer->quick_kick == 0)
{
int const angDiff = G_GetAngleDelta(pPlayer->ang, getangle(SX(spriteNum) - pPlayer->pos.x,
int const angDiff = G_GetAngleDelta(fix16_to_int(pPlayer->q16ang), getangle(SX(spriteNum) - pPlayer->pos.x,
SY(spriteNum) - pPlayer->pos.y));
if (angDiff > -128 && angDiff < 128)
@ -4270,7 +4273,7 @@ ACTOR_STATIC void G_MoveActors(void)
setsprite(spriteNum,(vec3_t *)pSprite);
pSprite->ang = pPlayer->ang;
pSprite->ang = fix16_to_int(pPlayer->q16ang);
if ((TEST_SYNC_KEY(g_player[playerNum].inputBits->bits, SK_FIRE) || (pPlayer->quick_kick > 0)) && sprite[pPlayer->i].extra > 0)
if (pPlayer->quick_kick > 0 ||
@ -4303,7 +4306,7 @@ ACTOR_STATIC void G_MoveActors(void)
DELETE_SPRITE_AND_CONTINUE(spriteNum);
}
pSprite->z = pPlayer->pos.z + pPlayer->pyoff - pData[2] + ZOFFSET3 + (fix16_to_int(F16(100) - pPlayer->qhoriz) << 4);
pSprite->z = pPlayer->pos.z + pPlayer->pyoff - pData[2] + ZOFFSET3 + (fix16_to_int(F16(100) - pPlayer->q16horiz) << 4);
if (pData[2] > 512)
pData[2] -= 128;
@ -4340,8 +4343,8 @@ ACTOR_STATIC void G_MoveActors(void)
pSprite->xrepeat = 20 + (sintable[pData[1] & 2047] >> 13);
pSprite->yrepeat = 15 + (sintable[pData[1] & 2047] >> 13);
pSprite->x = pPlayer->pos.x + (sintable[(pPlayer->ang + 512) & 2047] >> 7);
pSprite->y = pPlayer->pos.y + (sintable[pPlayer->ang & 2047] >> 7);
pSprite->x = pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 7);
pSprite->y = pPlayer->pos.y + (sintable[fix16_to_int(pPlayer->q16ang) & 2047] >> 7);
goto next_sprite;
}
@ -5792,8 +5795,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (pPlayer->cursectnum == pSprite->sectnum && pPlayer->on_ground == 1)
{
pPlayer->ang += (l*q);
pPlayer->ang &= 2047;
pPlayer->q16ang += fix16_from_int(l*q);
pPlayer->q16ang &= 0x7FFFFFF;
pPlayer->pos.z += zchange;
@ -6013,8 +6016,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
pPlayer->bobpos.x += m;
pPlayer->bobpos.y += x;
pPlayer->ang += q;
pPlayer->ang &= 2047;
pPlayer->q16ang += fix16_from_int(q);
pPlayer->q16ang &= 0x7FFFFFF;
if (g_netServer || numplayers > 1)
{

View file

@ -334,17 +334,17 @@ static void M32_drawdebug(void)
#endif
static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vsectnum, int32_t ang, fix16_t qhoriz)
static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vsectnum, int16_t ang, int16_t horiz)
{
spritetype *sp = &sprite[pp->i];
int32_t i, hx, hy;
int32_t daang;
int32_t bakcstat = sp->cstat;
hitdata_t hit;
vec3_t n = {
sintable[(ang+1536)&2047]>>4,
sintable[(ang+1024)&2047]>>4,
fix16_mul(qhoriz-F16(100), F16(128))
(horiz-100) * 128
};
updatesectorz(vect->x,vect->y,vect->z,vsectnum);
@ -365,7 +365,7 @@ static int32_t G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vs
if (hit.wall >= 0)
{
daang = getangle(wall[wall[hit.wall].point2].x-wall[hit.wall].x,
int32_t daang = getangle(wall[wall[hit.wall].point2].x-wall[hit.wall].x,
wall[wall[hit.wall].point2].y-wall[hit.wall].y);
i = n.x*sintable[daang] + n.y*sintable[(daang+1536)&2047];
@ -519,16 +519,16 @@ static void G_SE40(int32_t smoothratio)
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), CAMERA(ang), smoothratio);
polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), fix16_to_int(CAMERA(q16ang)), smoothratio);
#endif
drawrooms(sprite[sprite2].x + x, sprite[sprite2].y + y,
z + renderz, CAMERA(ang), CAMERA(qhoriz), sect);
z + renderz, CAMERA(q16ang), CAMERA(q16horiz), sect);
drawing_ror = 1 + level;
if (drawing_ror == 2) // viewing from top
G_OROR_DupeSprites(sp);
G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothratio);
G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothratio);
drawmasks();
if (level)
@ -555,7 +555,7 @@ static void G_SE40(int32_t smoothratio)
}
#endif
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, fix16_t qhoriz, int32_t smoothratio)
void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz, int32_t smoothratio)
{
if ((gotpic[MIRROR>>3]&(1<<(MIRROR&7)))
#ifdef POLYMER
@ -604,7 +604,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, fix16_t qhoriz,
if (wall[g_mirrorWall[i]].overpicnum == MIRROR)
{
int32_t tposx, tposy;
int16_t tang;
fix16_t tang;
preparemirror(x, y, a, g_mirrorWall[i], &tposx, &tposy, &tang);
@ -616,16 +616,16 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, fix16_t qhoriz,
int32_t didmirror;
yax_preparedrawrooms();
didmirror = drawrooms(tposx,tposy,z,tang,qhoriz,g_mirrorSector[i]+MAXSECTORS);
didmirror = drawrooms(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS);
yax_drawrooms(G_DoSpriteAnimations, g_mirrorSector[i], didmirror, smoothratio);
}
#ifdef USE_OPENGL
else
drawrooms(tposx,tposy,z,tang,qhoriz,g_mirrorSector[i]+MAXSECTORS);
drawrooms(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS);
// XXX: Sprites don't get drawn with TROR/Polymost
#endif
display_mirror = 1;
G_DoSpriteAnimations(tposx,tposy,tang,smoothratio);
G_DoSpriteAnimations(tposx,tposy,fix16_to_int(tang),smoothratio);
display_mirror = 0;
drawmasks();
@ -740,8 +740,8 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (pSprite->yvel < 0) pSprite->yvel = -100;
else if (pSprite->yvel > 199) pSprite->yvel = 300;
CAMERA(ang) = actor[ud.camerasprite].tempang +
mulscale16(((pSprite->ang+1024-actor[ud.camerasprite].tempang)&2047)-1024, smoothRatio);
CAMERA(q16ang) = fix16_from_int(actor[ud.camerasprite].tempang
+ mulscale16(((pSprite->ang + 1024 - actor[ud.camerasprite].tempang) & 2047) - 1024, smoothRatio));
int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERA, pPlayer->i, playerNum, 0);
@ -756,12 +756,12 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
#endif
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, CAMERA(ang), smoothRatio);
polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio);
#endif
yax_preparedrawrooms();
drawrooms(pSprite->x,pSprite->y,pSprite->z-ZOFFSET6,CAMERA(ang),pSprite->yvel,pSprite->sectnum);
drawrooms(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, CAMERA(q16ang), pSprite->yvel, pSprite->sectnum);
yax_drawrooms(G_DoSpriteAnimations, pSprite->sectnum, 0, smoothRatio);
G_DoSpriteAnimations(pSprite->x,pSprite->y,CAMERA(ang),smoothRatio);
G_DoSpriteAnimations(pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio);
drawmasks();
}
}
@ -908,10 +908,10 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
pPlayer->opos.z + mulscale16(pPlayer->pos.z - pPlayer->opos.z, smoothRatio) };
CAMERA(pos) = camVect;
CAMERA(ang) = pPlayer->oang + mulscale16(((pPlayer->ang + 1024 - pPlayer->oang) & 2047) - 1024, smoothRatio);
CAMERA(ang) += pPlayer->look_ang;
CAMERA(qhoriz) = pPlayer->oqhoriz + pPlayer->oqhorizoff
+ mulscale16((pPlayer->qhoriz + pPlayer->qhorizoff - pPlayer->oqhoriz - pPlayer->oqhorizoff), smoothRatio);
CAMERA(q16ang) = pPlayer->oq16ang + mulscale16(((pPlayer->q16ang + F16(1024) - pPlayer->oq16ang) & 0x7FFFFFF) - F16(1024), smoothRatio);
CAMERA(q16ang) += fix16_from_int(pPlayer->look_ang);
CAMERA(q16horiz) = pPlayer->oq16horiz + pPlayer->oq16horizoff
+ mulscale16((pPlayer->q16horiz + pPlayer->q16horizoff - pPlayer->oq16horiz - pPlayer->oq16horizoff), smoothRatio);
if (ud.viewbob)
{
@ -927,10 +927,10 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
{
CAMERA(pos.z) -= 3072;
if (G_DoThirdPerson(pPlayer, &CAMERA(pos), &CAMERA(sect), CAMERA(ang), CAMERA(qhoriz)) < 0)
if (G_DoThirdPerson(pPlayer, &CAMERA(pos), &CAMERA(sect), fix16_to_int(CAMERA(q16ang)), fix16_to_int(CAMERA(q16horiz))) < 0)
{
CAMERA(pos.z) += 3072;
G_DoThirdPerson(pPlayer, &CAMERA(pos), &CAMERA(sect), CAMERA(ang), CAMERA(qhoriz));
G_DoThirdPerson(pPlayer, &CAMERA(pos), &CAMERA(sect), fix16_to_int(CAMERA(q16ang)), fix16_to_int(CAMERA(q16horiz)));
}
}
}
@ -940,8 +940,8 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
// looking through viewscreen
CAMERA(pos) = camVect;
CAMERA(ang) = pPlayer->ang + pPlayer->look_ang;
CAMERA(qhoriz) = fix16_from_int(100 + sprite[pPlayer->newowner].shade);
CAMERA(q16ang) = pPlayer->q16ang + fix16_from_int(pPlayer->look_ang);
CAMERA(q16horiz) = fix16_from_int(100 + sprite[pPlayer->newowner].shade);
CAMERA(sect) = sprite[pPlayer->newowner].sectnum;
}
@ -951,7 +951,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (g_earthquakeTime > 0 && pPlayer->on_ground == 1)
{
CAMERA(pos.z) += 256 - (((g_earthquakeTime)&1) << 9);
CAMERA(ang) += (2 - ((g_earthquakeTime)&2)) << 2;
CAMERA(q16ang) += fix16_from_int((2 - ((g_earthquakeTime)&2)) << 2);
}
if (sprite[pPlayer->i].pal == 1)
@ -1005,7 +1005,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
// like showview must cope with that situation or bail out!
int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMS, pPlayer->i, playerNum, 0);
CAMERA(qhoriz) = fix16_clamp(CAMERA(qhoriz), F16(HORIZ_MIN), F16(HORIZ_MAX));
CAMERA(q16horiz) = fix16_clamp(CAMERA(q16horiz), F16(HORIZ_MIN), F16(HORIZ_MAX));
if (noDraw != 1) // event return values other than 0 and 1 are reserved
{
@ -1015,13 +1015,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
"other values are reserved.\n");
*/
G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(ang), CAMERA(qhoriz), smoothRatio);
G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(q16ang), CAMERA(q16horiz), smoothRatio);
#ifdef LEGACY_ROR
G_SE40(smoothRatio);
#endif
#ifdef POLYMER
if (getrendermode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothRatio);
polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothRatio);
#endif
// for G_PrintCoords
dr_viewingrange = viewingrange;
@ -1030,13 +1030,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
gotpic[MIRROR>>3] |= (1<<(MIRROR&7));
#else
yax_preparedrawrooms();
drawrooms(CAMERA(pos.x),CAMERA(pos.y),CAMERA(pos.z),CAMERA(ang),CAMERA(qhoriz),CAMERA(sect));
drawrooms(CAMERA(pos.x),CAMERA(pos.y),CAMERA(pos.z),CAMERA(q16ang),CAMERA(q16horiz),CAMERA(sect));
yax_drawrooms(G_DoSpriteAnimations, CAMERA(sect), 0, smoothRatio);
#ifdef LEGACY_ROR
if ((unsigned)ror_sprite < MAXSPRITES && drawing_ror == 1) // viewing from bottom
G_OROR_DupeSprites(&sprite[ror_sprite]);
#endif
G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),CAMERA(ang),smoothRatio);
G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothRatio);
#ifdef LEGACY_ROR
drawing_ror = 0;
#endif
@ -1249,7 +1249,7 @@ void G_DumpDebugInfo(void)
Gv_DumpValues();
// fclose(fp);
#endif
saveboard("debug.map", &g_player[myconnectindex].ps->pos, g_player[myconnectindex].ps->ang,
saveboard("debug.map", &g_player[myconnectindex].ps->pos, fix16_to_int(g_player[myconnectindex].ps->q16ang),
g_player[myconnectindex].ps->cursectnum);
}
@ -2114,11 +2114,11 @@ int A_Spawn(int spriteNum, int tileNum)
int const playerNum = P_Get(spriteNum);
const DukePlayer_t *const pPlayer = g_player[playerNum].ps;
shellAng = pPlayer->ang - (krand() & 63) + 8; // Fine tune
shellAng = fix16_to_int(pPlayer->q16ang) - (krand() & 63) + 8; // Fine tune
T1(newSprite) = krand() & 1;
pSprite->z = (3 << 8) + pPlayer->pyoff + pPlayer->pos.z - (fix16_to_int((pPlayer->qhorizoff + pPlayer->qhoriz - F16(100))) << 4);
pSprite->z = (3 << 8) + pPlayer->pyoff + pPlayer->pos.z - (fix16_to_int((pPlayer->q16horizoff + pPlayer->q16horiz - F16(100))) << 4);
if (pSprite->picnum == SHOTGUNSHELL)
pSprite->z += (3 << 8);
@ -3892,9 +3892,9 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
if (g_player[playerNum].ps->over_shoulder_on > 0 && g_player[playerNum].ps->newowner < 0)
{
t->ang = g_player[playerNum].ps->ang +
mulscale16((((g_player[playerNum].ps->ang+1024 - g_player[playerNum].ps->oang)&2047)-1024),
smoothratio);
t->ang = fix16_to_int(
g_player[playerNum].ps->q16ang
+ mulscale16((((g_player[playerNum].ps->q16ang + 1024 - g_player[playerNum].ps->oq16ang) & 2047) - 1024), smoothratio));
#ifdef USE_OPENGL
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
@ -4595,7 +4595,7 @@ void G_HandleLocalKeys(void)
{
ud.folx = g_player[screenpeek].ps->opos.x;
ud.foly = g_player[screenpeek].ps->opos.y;
ud.fola = g_player[screenpeek].ps->oang;
ud.fola = fix16_to_int(g_player[screenpeek].ps->oq16ang);
}
P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps);
}
@ -6857,8 +6857,9 @@ int G_DoMoveThings(void)
if (g_player[i].ps->holoduke_on != -1)
sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
hitscan((vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047], sintable[pPlayer->ang & 2047],
fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) << 11, &hitData, 0xffff0030);
hitscan((vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
sintable[fix16_to_int(pPlayer->q16ang) & 2047], fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) << 11, &hitData,
0xffff0030);
for (bssize_t TRAVERSE_CONNECT(i))
if (g_player[i].ps->holoduke_on != -1)

View file

@ -129,8 +129,8 @@ static inline int32_t G_GetLogoFlags(void)
typedef struct {
vec3_t pos;
int32_t dist, clock;
fix16_t qhoriz;
int16_t ang, sect;
fix16_t q16horiz, q16ang;
int16_t sect;
} camera_t;
extern camera_t g_camera;
@ -192,8 +192,8 @@ typedef struct {
int32_t returnvar[MAX_RETURN_VALUES-1];
#if !defined LUNATIC
int16_t cameraang, camerasect;
fix16_t cameraqhoriz;
fix16_t cameraq16ang, cameraq16horiz;
int16_t camerasect;
#endif
int16_t pause_on,from_bonus;
int16_t camerasprite,last_camsprite;

View file

@ -285,7 +285,7 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
{
int const nAngle = 128-(krand()&255);
pPlayer->qhoriz += F16(64);
pPlayer->q16horiz += F16(64);
pPlayer->return_to_center = 9;
pPlayer->rotscrnang = nAngle >> 1;
pPlayer->look_ang = pPlayer->rotscrnang;
@ -3619,9 +3619,9 @@ nullquote:
{
nResult =
(vm.pSprite->picnum == APLAYER && (g_netServer || ud.multimode > 1))
? G_GetAngleDelta(g_player[otherp].ps->ang, getangle(pPlayer->pos.x - g_player[otherp].ps->pos.x,
? G_GetAngleDelta(fix16_to_int(g_player[otherp].ps->q16ang), getangle(pPlayer->pos.x - g_player[otherp].ps->pos.x,
pPlayer->pos.y - g_player[otherp].ps->pos.y))
: G_GetAngleDelta(pPlayer->ang, getangle(vm.pSprite->x - pPlayer->pos.x, vm.pSprite->y - pPlayer->pos.y));
: G_GetAngleDelta(fix16_to_int(pPlayer->q16ang), getangle(vm.pSprite->x - pPlayer->pos.x, vm.pSprite->y - pPlayer->pos.y));
nResult = (nResult > -128 && nResult < 128);
}
@ -4410,7 +4410,7 @@ finish_qsprintf:
case CON_GETPLAYERANGLE:
insptr++;
Gv_SetVarX(*insptr++, pPlayer->ang);
Gv_SetVarX(*insptr++, fix16_to_int(pPlayer->q16ang));
continue;
case CON_GETACTORANGLE:
@ -4420,7 +4420,7 @@ finish_qsprintf:
case CON_SETPLAYERANGLE:
insptr++;
pPlayer->ang = Gv_GetVarX(*insptr++) & 2047;
pPlayer->q16ang = fix16_from_int(Gv_GetVarX(*insptr++) & 2047);
continue;
case CON_SETACTORANGLE:
@ -5727,7 +5727,7 @@ finish_qsprintf:
case CON_IFANGDIFFL:
insptr++;
tw = klabs(G_GetAngleDelta(pPlayer->ang, vm.pSprite->ang));
tw = klabs(G_GetAngleDelta(fix16_to_int(pPlayer->q16ang), vm.pSprite->ang));
VM_CONDITIONAL(tw <= *insptr);
continue;

View file

@ -539,9 +539,9 @@ int32_t __fastcall VM_GetPlayer(int32_t const playerNum, int32_t labelNum, int32
case PLAYER_POSX: labelNum = ps->pos.x; break;
case PLAYER_POSY: labelNum = ps->pos.y; break;
case PLAYER_POSZ: labelNum = ps->pos.z; break;
case PLAYER_HORIZ: labelNum = fix16_to_int(ps->qhoriz); break;
case PLAYER_OHORIZ: labelNum = fix16_to_int(ps->oqhoriz); break;
case PLAYER_OHORIZOFF: labelNum = fix16_to_int(ps->oqhorizoff); break;
case PLAYER_HORIZ: labelNum = fix16_to_int(ps->q16horiz); break;
case PLAYER_OHORIZ: labelNum = fix16_to_int(ps->oq16horiz); break;
case PLAYER_OHORIZOFF: labelNum = fix16_to_int(ps->oq16horizoff); break;
case PLAYER_INVDISPTIME: labelNum = ps->invdisptime; break;
case PLAYER_BOBPOSX: labelNum = ps->bobpos.x; break;
case PLAYER_BOBPOSY: labelNum = ps->bobpos.y; break;
@ -564,9 +564,9 @@ int32_t __fastcall VM_GetPlayer(int32_t const playerNum, int32_t labelNum, int32
case PLAYER_RANDOMFLAMEX: labelNum = ps->randomflamex; break;
case PLAYER_CRACK_TIME: labelNum = ps->crack_time; break;
case PLAYER_AIM_MODE: labelNum = ps->aim_mode; break;
case PLAYER_ANG: labelNum = ps->ang; break;
case PLAYER_OANG: labelNum = ps->oang; break;
case PLAYER_ANGVEL: labelNum = ps->angvel; break;
case PLAYER_ANG: labelNum = fix16_to_int(ps->q16ang); break;
case PLAYER_OANG: labelNum = fix16_to_int(ps->oq16ang); break;
case PLAYER_ANGVEL: labelNum = fix16_to_int(ps->q16angvel); break;
case PLAYER_CURSECTNUM: labelNum = ps->cursectnum; break;
case PLAYER_LOOK_ANG: labelNum = ps->look_ang; break;
case PLAYER_LAST_EXTRA: labelNum = ps->last_extra; break;
@ -578,7 +578,7 @@ int32_t __fastcall VM_GetPlayer(int32_t const playerNum, int32_t labelNum, int32
case PLAYER_CURR_WEAPON: labelNum = ps->curr_weapon; break;
case PLAYER_LAST_WEAPON: labelNum = ps->last_weapon; break;
case PLAYER_TIPINCS: labelNum = ps->tipincs; break;
case PLAYER_HORIZOFF: labelNum = fix16_to_int(ps->qhorizoff); break;
case PLAYER_HORIZOFF: labelNum = fix16_to_int(ps->q16horizoff); break;
case PLAYER_WANTWEAPONFIRE: labelNum = ps->wantweaponfire; break;
case PLAYER_HOLODUKE_AMOUNT: labelNum = ps->inv_amount[GET_HOLODUKE]; break;
case PLAYER_NEWOWNER: labelNum = ps->newowner; break;
@ -723,9 +723,9 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_POSX: ps->pos.x = iSet; break;
case PLAYER_POSY: ps->pos.y = iSet; break;
case PLAYER_POSZ: ps->pos.z = iSet; break;
case PLAYER_HORIZ: ps->qhoriz = fix16_from_int(iSet); break;
case PLAYER_OHORIZ: ps->oqhoriz = fix16_from_int(iSet); break;
case PLAYER_OHORIZOFF: ps->oqhorizoff = fix16_from_int(iSet); break;
case PLAYER_HORIZ: ps->q16horiz = fix16_from_int(iSet); break;
case PLAYER_OHORIZ: ps->oq16horiz = fix16_from_int(iSet); break;
case PLAYER_OHORIZOFF: ps->oq16horizoff = fix16_from_int(iSet); break;
case PLAYER_INVDISPTIME: ps->invdisptime = iSet; break;
case PLAYER_BOBPOSX: ps->bobpos.x = iSet; break;
case PLAYER_BOBPOSY: ps->bobpos.y = iSet; break;
@ -748,9 +748,9 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_RANDOMFLAMEX: ps->randomflamex = iSet; break;
case PLAYER_CRACK_TIME: ps->crack_time = iSet; break;
case PLAYER_AIM_MODE: ps->aim_mode = iSet; break;
case PLAYER_ANG: ps->ang = iSet; break;
case PLAYER_OANG: ps->oang = iSet; break;
case PLAYER_ANGVEL: ps->angvel = iSet; break;
case PLAYER_ANG: ps->q16ang = fix16_from_int(iSet); break;
case PLAYER_OANG: ps->oq16ang = fix16_from_int(iSet); break;
case PLAYER_ANGVEL: ps->q16angvel = fix16_from_int(iSet); break;
case PLAYER_CURSECTNUM: ps->cursectnum = iSet; break;
case PLAYER_LOOK_ANG: ps->look_ang = iSet; break;
case PLAYER_LAST_EXTRA: ps->last_extra = iSet; break;
@ -762,7 +762,7 @@ void __fastcall VM_SetPlayer(int32_t const playerNum, int32_t const labelNum, in
case PLAYER_CURR_WEAPON: ps->curr_weapon = iSet; break;
case PLAYER_LAST_WEAPON: ps->last_weapon = iSet; break;
case PLAYER_TIPINCS: ps->tipincs = iSet; break;
case PLAYER_HORIZOFF: ps->qhorizoff = fix16_from_int(iSet); break;
case PLAYER_HORIZOFF: ps->q16horizoff = fix16_from_int(iSet); break;
case PLAYER_WANTWEAPONFIRE: ps->wantweaponfire = iSet; break;
case PLAYER_HOLODUKE_AMOUNT: ps->inv_amount[GET_HOLODUKE] = iSet; break;
case PLAYER_NEWOWNER: ps->newowner = iSet; break;
@ -906,7 +906,7 @@ int32_t __fastcall VM_GetPlayerInput(int32_t const playerNum, int32_t labelNum)
switch (labelNum)
{
case INPUT_AVEL: labelNum = i->avel; break;
case INPUT_AVEL: labelNum = fix16_to_int(i->qavel); break;
case INPUT_HORZ: labelNum = fix16_to_int(i->qhorz); break;
case INPUT_FVEL: labelNum = i->fvel; break;
case INPUT_SVEL: labelNum = i->svel; break;
@ -930,7 +930,7 @@ void __fastcall VM_SetPlayerInput(int32_t const playerNum, int32_t const labelNu
switch (labelNum)
{
case INPUT_AVEL: i->avel = iSet; break;
case INPUT_AVEL: i->qavel = fix16_from_int(iSet); break;
case INPUT_HORZ: i->qhorz = fix16_from_int(iSet); break;
case INPUT_FVEL: i->fvel = iSet; break;
case INPUT_SVEL: i->svel = iSet; break;

View file

@ -1543,8 +1543,8 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
Gv_NewVar("camerahoriz",(intptr_t)&ud.cameraqhoriz, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR); // XXX FIXME
Gv_NewVar("cameraang",(intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR); // XXX FIXME
Gv_NewVar("camerahoriz",(intptr_t)&ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR); // XXX FIXME
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
@ -1700,8 +1700,8 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("camerax")].global = (intptr_t)&ud.camerapos.x;
aGameVars[Gv_GetVarIndex("cameray")].global = (intptr_t)&ud.camerapos.y;
aGameVars[Gv_GetVarIndex("cameraz")].global = (intptr_t)&ud.camerapos.z;
aGameVars[Gv_GetVarIndex("cameraang")].global = (intptr_t)&ud.cameraang;
aGameVars[Gv_GetVarIndex("camerahoriz")].global = (intptr_t)&ud.cameraqhoriz; // XXX FIXME
aGameVars[Gv_GetVarIndex("cameraang")].global = (intptr_t)&ud.cameraq16ang; // XXX FIXME
aGameVars[Gv_GetVarIndex("camerahoriz")].global = (intptr_t)&ud.cameraq16horiz; // XXX FIXME
aGameVars[Gv_GetVarIndex("camerasect")].global = (intptr_t)&ud.camerasect;
aGameVars[Gv_GetVarIndex("cameradist")].global = (intptr_t)&g_cameraDistance;
aGameVars[Gv_GetVarIndex("cameraclock")].global = (intptr_t)&g_cameraClock;

View file

@ -1441,9 +1441,9 @@ void Net_FillPlayerUpdate(playerupdate_t *update, int32_t player)
update->pos = g_player[player].ps->pos;
update->opos = g_player[player].ps->opos;
update->vel = g_player[player].ps->vel;
update->ang = g_player[player].ps->ang;
update->horiz = g_player[player].ps->qhoriz;
update->horizoff = g_player[player].ps->qhorizoff;
update->ang = g_player[player].ps->q16ang;
update->horiz = g_player[player].ps->q16horiz;
update->horizoff = g_player[player].ps->q16horizoff;
update->ping = g_player[player].ping;
update->deadflag = g_player[player].ps->dead_flag;
update->playerquitflag = g_player[player].playerquitflag;
@ -1458,9 +1458,9 @@ void Net_ExtractPlayerUpdate(playerupdate_t *update, int32_t type)
g_player[playerindex].ps->pos = update->pos;
g_player[playerindex].ps->opos = update->opos;
g_player[playerindex].ps->vel = update->vel;
g_player[playerindex].ps->ang = update->ang;
g_player[playerindex].ps->qhoriz = update->horiz;
g_player[playerindex].ps->qhorizoff = update->horizoff;
g_player[playerindex].ps->q16ang = update->ang;
g_player[playerindex].ps->q16horiz = update->horiz;
g_player[playerindex].ps->q16horizoff = update->horizoff;
}
if (type == PACKET_MASTER_TO_SLAVE)

View file

@ -289,7 +289,7 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
if (pSprite->picnum == APLAYER)
{
const DukePlayer_t *const ps = g_player[P_GetP(pSprite)].ps;
onScreen = (klabs(scale(SZ(spriteNum)-pSprite->z,10,spriteDist)-fix16_to_int(ps->qhoriz+ps->qhorizoff-F16(100))) < 100);
onScreen = (klabs(scale(SZ(spriteNum)-pSprite->z,10,spriteDist)-fix16_to_int(ps->q16horiz+ps->q16horizoff-F16(100))) < 100);
}
int const canSee = (PN(spriteNum) == ORGANTIC || PN(spriteNum) == ROTATEGUN)
@ -480,7 +480,7 @@ static void P_PreFireHitscan(int spriteNum, int playerNum, int projecTile, vec3_
{
hitdata_t hitData;
*zvel = A_GetShootZvel(fix16_to_int(F16(100)-pPlayer->qhoriz-pPlayer->qhorizoff)<<5);
*zvel = A_GetShootZvel(fix16_to_int(F16(100)-pPlayer->q16horiz-pPlayer->q16horizoff)<<5);
hitscan(srcVect, sprite[spriteNum].sectnum, sintable[(*shootAng + 512) & 2047],
sintable[*shootAng & 2047], *zvel << 6, &hitData, CLIPMASK1);
@ -503,7 +503,7 @@ static void P_PreFireHitscan(int spriteNum, int playerNum, int projecTile, vec3_
if (aimSprite == -1) // no target
{
notarget:
*zvel = fix16_to_int(F16(100)-pPlayer->qhoriz-pPlayer->qhorizoff)<<5;
*zvel = fix16_to_int(F16(100)-pPlayer->q16horiz-pPlayer->q16horizoff)<<5;
}
Proj_MaybeAddSpread(doSpread, zvel, shootAng, zRange, angRange);
@ -917,7 +917,7 @@ static int A_ShootCustom(int const spriteNum, int const projecTile, int shootAng
otherSprite = GetAutoAimAng(spriteNum, playerNum, projecTile, 8<<8, 0+2, startPos, pProj->vel, &zvel, &shootAng);
if (otherSprite < 0)
zvel = fix16_to_int(F16(100)-pPlayer->qhoriz-pPlayer->qhorizoff)*(pProj->vel/8);
zvel = fix16_to_int(F16(100)-pPlayer->q16horiz-pPlayer->q16horizoff)*(pProj->vel/8);
if (pProj->sound >= 0)
A_PlaySound(pProj->sound, spriteNum);
@ -976,7 +976,7 @@ static int A_ShootCustom(int const spriteNum, int const projecTile, int shootAng
case PROJECTILE_KNEE:
if (playerNum >= 0)
{
zvel = fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) << 5;
zvel = fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) << 5;
startPos->z += (6 << 8);
shootAng += 15;
}
@ -1095,7 +1095,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
{
if (playerNum >= 0)
{
Zvel = fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) << 5;
Zvel = fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) << 5;
startPos.z += (6 << 8);
shootAng += 15;
}
@ -1239,7 +1239,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
if (playerNum >= 0)
{
if (GetAutoAimAng(spriteNum, playerNum, projecTile, -ZOFFSET4, 0, &startPos, vel, &Zvel, &shootAng) < 0)
Zvel = fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) * 98;
Zvel = fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 98;
}
else
{
@ -1306,7 +1306,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
j = GetAutoAimAng(spriteNum, playerNum, projecTile, 8 << 8, 0 + 2, &startPos, vel, &Zvel, &shootAng);
if (j < 0)
Zvel = fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) * 81;
Zvel = fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 81;
if (projecTile == RPG)
A_PlaySound(RPG_SHOOT, spriteNum);
@ -1413,7 +1413,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
case HANDHOLDINGLASER__STATIC:
{
int const zOffset = (playerNum >= 0) ? g_player[playerNum].ps->pyoff : 0;
Zvel = (playerNum >= 0) ? fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) * 32 : 0;
Zvel = (playerNum >= 0) ? fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32 : 0;
startPos.z -= zOffset;
Proj_DoHitscan(spriteNum, 0, &startPos, Zvel, shootAng, &hitData);
@ -1513,7 +1513,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec
if (playerNum >= 0)
{
if (GetAutoAimAng(spriteNum, playerNum, projecTile, ZOFFSET6, 0, &startPos, 768, &Zvel, &shootAng) < 0)
Zvel = fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) * 98;
Zvel = fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 98;
}
else if (pSprite->statnum != STAT_EFFECTOR)
{
@ -1561,7 +1561,7 @@ int A_ShootWithZvel(int const spriteNum, int const projecTile, int const forceZv
{
startPos = *(vec3_t *)pPlayer;
startPos.z += pPlayer->pyoff + ZOFFSET6;
shootAng = pPlayer->ang;
shootAng = fix16_to_int(pPlayer->q16ang);
pPlayer->crack_time = 777;
}
else
@ -1632,7 +1632,7 @@ static void P_DisplaySpit(void)
{
int const rotAng = klabs(sintable[((loogCounter + i) << 5) & 2047]) >> 5;
int const rotZoom = 4096 + ((loogCounter + i) << 9);
int const rotX = (-g_player[screenpeek].inputBits->avel >> 1) + (sintable[((loogCounter + i) << 6) & 2047] >> 10);
int const rotX = (-fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 1) + (sintable[((loogCounter + i) << 6) & 2047] >> 10);
rotatesprite_fs((pPlayer->loogiex[i] + rotX) << 16, (200 + pPlayer->loogiey[i] - rotY) << 16, rotZoom - (i << 8),
256 - rotAng, LOOGIE, 0, 0, 2);
@ -1683,7 +1683,7 @@ static int P_DisplayFist(int const fistShade)
wx[(g_snum==0)] = (wx[0]+wx[1])/2+1;
#endif
rotatesprite((-fistInc + 222 + (g_player[screenpeek].inputBits->avel >> 5)) << 16, (fistY + fistYOffset) << 16,
rotatesprite((-fistInc + 222 + (fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 5)) << 16, (fistY + fistYOffset) << 16,
fistZoom, 0, FIST, fistShade, fistPal, 2, wx[0], windowxy1.y, wx[1], windowxy2.y);
return 1;
@ -1830,8 +1830,8 @@ static int P_DisplayKnee(int kneeShade)
if (kneePal == 0)
kneePal = ps->palookup;
G_DrawTileScaled(105+(g_player[screenpeek].inputBits->avel>>5)-(ps->look_ang>>1)+(knee_y[ps->knee_incs]>>2),
kneeY+280-(fix16_to_int(ps->qhoriz-ps->qhorizoff)>>4),KNEE,kneeShade,4+DRAWEAP_CENTER,kneePal);
G_DrawTileScaled(105+(fix16_to_int(g_player[screenpeek].inputBits->qavel)>>5)-(ps->look_ang>>1)+(knee_y[ps->knee_incs]>>2),
kneeY+280-(fix16_to_int(ps->q16horiz-ps->q16horizoff)>>4),KNEE,kneeShade,4+DRAWEAP_CENTER,kneePal);
return 1;
}
@ -1860,8 +1860,8 @@ static int P_DisplayKnuckles(int knuckleShade)
int const knuckleY = (klabs(pPlayer->look_ang) / 9) - (pPlayer->hard_landing << 3);
int const knucklePal = P_GetHudPal(pPlayer);
G_DrawTileScaled(160 + (g_player[screenpeek].inputBits->avel >> 5) - (pPlayer->look_ang >> 1),
knuckleY + 180 - (fix16_to_int(pPlayer->qhoriz - pPlayer->qhorizoff) >> 4),
G_DrawTileScaled(160 + (fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 5) - (pPlayer->look_ang >> 1),
knuckleY + 180 - (fix16_to_int(pPlayer->q16horiz - pPlayer->q16horizoff) >> 4),
CRACKKNUCKLES + knuckleFrames[pPlayer->knuckle_incs >> 1], knuckleShade, 4 + DRAWEAP_CENTER,
knucklePal);
@ -2015,8 +2015,8 @@ static int P_DisplayTip(int tipShade)
guniqhudid = 201;
G_DrawTileScaled(170 + (g_player[screenpeek].inputBits->avel >> 5) - (pPlayer->look_ang >> 1),
tipYOffset + tipY + 240 - (fix16_to_int(pPlayer->qhoriz - pPlayer->qhorizoff) >> 4),
G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 5) - (pPlayer->look_ang >> 1),
tipYOffset + tipY + 240 - (fix16_to_int(pPlayer->q16horiz - pPlayer->q16horizoff) >> 4),
TIP + ((26 - pPlayer->tipincs) >> 4), tipShade, DRAWEAP_CENTER, tipPal);
guniqhudid = 0;
@ -2048,14 +2048,14 @@ static int P_DisplayAccess(int accessShade)
if ((pSprite->access_incs - 3) > 0 && (pSprite->access_incs - 3) >> 3)
{
G_DrawTileScaled(170 + (g_player[screenpeek].inputBits->avel >> 5) - (pSprite->look_ang >> 1) + accessX,
accessY + 266 - (fix16_to_int(pSprite->qhoriz - pSprite->qhorizoff) >> 4),
G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 5) - (pSprite->look_ang >> 1) + accessX,
accessY + 266 - (fix16_to_int(pSprite->q16horiz - pSprite->q16horizoff) >> 4),
HANDHOLDINGLASER + (pSprite->access_incs >> 3), accessShade, DRAWEAP_CENTER, accessPal);
}
else
{
G_DrawTileScaled(170 + (g_player[screenpeek].inputBits->avel >> 5) - (pSprite->look_ang >> 1) + accessX,
accessY + 266 - (fix16_to_int(pSprite->qhoriz - pSprite->qhorizoff) >> 4), HANDHOLDINGACCESS, accessShade,
G_DrawTileScaled(170 + (fix16_to_int(g_player[screenpeek].inputBits->qavel) >> 5) - (pSprite->look_ang >> 1) + accessX,
accessY + 266 - (fix16_to_int(pSprite->q16horiz - pSprite->q16horizoff) >> 4), HANDHOLDINGACCESS, accessShade,
4 + DRAWEAP_CENTER, accessPal);
}
@ -2820,13 +2820,14 @@ void P_GetInput(int playerNum)
static int32_t lastControlInput = 0; // MED
DukePlayer_t * pPlayer = g_player[playerNum].ps;
static input_t staticInput;
static int32_t dyaw;
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
{
if (!(pPlayer->gm&MODE_MENU))
CONTROL_GetInput(&info[0]);
Bmemset(&info[1], 0, sizeof(input_t));
dyaw = 0;
Bmemset(&localInput, 0, sizeof(input_t));
localInput.bits = (((int32_t)g_gameQuit) << SK_GAMEQUIT);
@ -2886,26 +2887,23 @@ void P_GetInput(int playerNum)
// JBF: Run key behaviour is selectable
int const playerRunning = (ud.runkey_mode) ? (BUTTON(gamefunc_Run) | ud.auto_run) : (ud.auto_run ^ BUTTON(gamefunc_Run));
staticInput.svel = staticInput.fvel = staticInput.avel = staticInput.qhorz = 0;
staticInput.svel = staticInput.fvel = staticInput.qavel = staticInput.qhorz = 0;
if (BUTTON(gamefunc_Strafe))
{
staticInput.svel = -(info[0].dyaw + info[1].dyaw) / 8;
staticInput.svel = -(info[0].dyaw + info[1].dyaw) / 8;
info[1].dyaw = (info[1].dyaw + info[0].dyaw) % 8;
staticInput.svel = -(info[0].dyaw + dyaw) >> 3;
staticInput.svel = -(info[0].dyaw + dyaw) >> 3;
dyaw = (info[0].dyaw + dyaw) % 8;
}
else
{
staticInput.avel = (info[0].dyaw + info[1].dyaw) / 32;
info[1].dyaw = (info[1].dyaw + info[0].dyaw) % 32;
}
staticInput.qavel = fix16_div(fix16_from_int(info[0].dyaw), F16(32));
staticInput.qhorz = fix16_div(fix16_from_int(info[0].dpitch), F16(512));
staticInput.qhorz = fix16_div(fix16_from_int(info[0].dpitch), F16(256));
if (ud.mouseflip) staticInput.qhorz = -staticInput.qhorz;
staticInput.svel -= info[0].dx;
info[1].dz = info[0].dz % (1 << 6);
staticInput.fvel = -info[0].dz >> 6;
// OSD_Printf("running: %d\n", running);
@ -2925,12 +2923,12 @@ void P_GetInput(int playerNum)
if (BUTTON(gamefunc_Turn_Left))
{
turnHeldTime += elapsedTics;
staticInput.avel -= (turnHeldTime>=TURBOTURNTIME) ? (turnAmount<<1) : (PREAMBLETURN<<1);
staticInput.qavel -= fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
}
else if (BUTTON(gamefunc_Turn_Right))
{
turnHeldTime += elapsedTics;
staticInput.avel += (turnHeldTime>=TURBOTURNTIME) ? (turnAmount<<1) : (PREAMBLETURN<<1);
staticInput.qavel += fix16_from_int((turnHeldTime >= TURBOTURNTIME) ? (turnAmount << 1) : (PREAMBLETURN << 1));
}
else
turnHeldTime=0;
@ -2950,7 +2948,7 @@ void P_GetInput(int playerNum)
staticInput.fvel = clamp(staticInput.fvel, -MAXVEL, MAXVEL);
staticInput.svel = clamp(staticInput.svel, -MAXSVEL, MAXSVEL);
staticInput.avel = clamp(staticInput.avel, -MAXANGVEL, MAXANGVEL);
staticInput.qavel = fix16_clamp(staticInput.qavel, F16(-MAXANGVEL), F16(MAXANGVEL));
staticInput.qhorz = fix16_clamp(staticInput.qhorz, F16(-MAXHORIZ), F16(MAXHORIZ));
int weaponSelection;
@ -3003,7 +3001,7 @@ void P_GetInput(int playerNum)
localInput.bits |= BUTTON(gamefunc_Center_View) << SK_CENTER_VIEW;
localInput.bits |= BUTTON(gamefunc_Holster_Weapon) << SK_HOLSTER;
localInput.bits |= (BUTTON(gamefunc_Inventory_Left) ||
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel > 0 || staticInput.avel < 0))) << SK_INV_LEFT;
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel > 0 || staticInput.qavel < 0))) << SK_INV_LEFT;
localInput.bits |= KB_KeyPressed(sc_Pause) << SK_PAUSE;
localInput.bits |= BUTTON(gamefunc_Quick_Kick) << SK_QUICK_KICK;
localInput.bits |= g_myAimMode << SK_AIMMODE;
@ -3011,7 +3009,7 @@ void P_GetInput(int playerNum)
localInput.bits |= BUTTON(gamefunc_Jetpack) << SK_JETPACK;
localInput.bits |= (g_gameQuit << SK_GAMEQUIT);
localInput.bits |= (BUTTON(gamefunc_Inventory_Right) ||
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel < 0 || staticInput.avel > 0))) << SK_INV_RIGHT;
(BUTTON(gamefunc_Dpad_Select) && (staticInput.svel < 0 || staticInput.qavel > 0))) << SK_INV_RIGHT;
localInput.bits |= BUTTON(gamefunc_TurnAround) << SK_TURNAROUND;
localInput.bits |= BUTTON(gamefunc_Open) << SK_OPEN;
localInput.bits |= BUTTON(gamefunc_Inventory) << SK_INVENTORY;
@ -3021,7 +3019,7 @@ void P_GetInput(int playerNum)
{
staticInput.fvel = 0;
staticInput.svel = 0;
staticInput.avel = 0;
staticInput.qavel = 0;
}
if (BUTTON(gamefunc_Dpad_Aiming))
@ -3047,23 +3045,25 @@ void P_GetInput(int playerNum)
if (ud.scrollmode && ud.overhead_on)
{
ud.folfvel = staticInput.fvel;
ud.folavel = staticInput.avel;
ud.folavel = fix16_to_int(staticInput.qavel);
localInput.fvel = 0;
localInput.svel = 0;
localInput.avel = 0;
localInput.qavel = 0;
localInput.qhorz = 0;
return;
}
localInput.fvel = mulscale9(staticInput.fvel, sintable[(pPlayer->ang + 2560) & 2047]) +
mulscale9(staticInput.svel, sintable[(pPlayer->ang + 2048) & 2047]) +
int16_t const q16ang = fix16_to_int(pPlayer->q16ang);
localInput.fvel = mulscale9(staticInput.fvel, sintable[(q16ang + 2560) & 2047]) +
mulscale9(staticInput.svel, sintable[(q16ang + 2048) & 2047]) +
pPlayer->fric.x;
localInput.svel = mulscale9(staticInput.fvel, sintable[(pPlayer->ang + 2048) & 2047]) +
mulscale9(staticInput.svel, sintable[(pPlayer->ang + 1536) & 2047]) +
localInput.svel = mulscale9(staticInput.fvel, sintable[(q16ang + 2048) & 2047]) +
mulscale9(staticInput.svel, sintable[(q16ang + 1536) & 2047]) +
pPlayer->fric.y;
localInput.avel = staticInput.avel;
localInput.qavel = staticInput.qavel;
localInput.qhorz = staticInput.qhorz;
}
@ -3457,8 +3457,8 @@ void P_CheckWeaponI(int playerNum)
static void DoWallTouchDamage(const DukePlayer_t *pPlayer, int32_t wallNum)
{
vec3_t const davect = { pPlayer->pos.x + (sintable[(pPlayer->ang + 512) & 2047] >> 9),
pPlayer->pos.y + (sintable[pPlayer->ang & 2047] >> 9), pPlayer->pos.z };
vec3_t const davect = { pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 9),
pPlayer->pos.y + (sintable[fix16_to_int(pPlayer->q16ang) & 2047] >> 9), pPlayer->pos.z };
A_DamageWall(pPlayer->i, wallNum, &davect, -1);
}
@ -3505,8 +3505,8 @@ static void P_CheckTouchDamage(DukePlayer_t *pPlayer, int touchObject)
pPlayer->hurt_delay = 16;
P_PalFrom(pPlayer, 32, 32,0,0);
pPlayer->vel.x = -(sintable[(pPlayer->ang+512)&2047]<<8);
pPlayer->vel.y = -(sintable[(pPlayer->ang)&2047]<<8);
pPlayer->vel.x = -(sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<8);
pPlayer->vel.y = -(sintable[(fix16_to_int(pPlayer->q16ang))&2047]<<8);
A_PlaySound(DUKE_LONGTERM_PAIN,pPlayer->i);
DoWallTouchDamage(pPlayer, touchWall);
@ -3917,8 +3917,8 @@ static void P_ProcessWeapon(int playerNum)
{
hitdata_t hitData;
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047],
sintable[pPlayer->ang & 2047], fix16_to_int(F16(100) - pPlayer->qhoriz - pPlayer->qhorizoff) * 32, &hitData,
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
sintable[fix16_to_int(pPlayer->q16ang) & 2047], fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32, &hitData,
CLIPMASK1);
if ((hitData.sect < 0 || hitData.sprite >= 0) ||
@ -4016,19 +4016,19 @@ static void P_ProcessWeapon(int playerNum)
if (pPlayer->on_ground && TEST_SYNC_KEY(playerBits, SK_CROUCH))
{
pipeBombFwdVel = 15;
pipeBombZvel = (fix16_to_int(pPlayer->qhoriz + pPlayer->qhorizoff - F16(100)) * 20);
pipeBombZvel = (fix16_to_int(pPlayer->q16horiz + pPlayer->q16horizoff - F16(100)) * 20);
}
else
{
pipeBombFwdVel = 140;
pipeBombZvel = -512 - (fix16_to_int(pPlayer->qhoriz + pPlayer->qhorizoff - F16(100)) * 20);
pipeBombZvel = -512 - (fix16_to_int(pPlayer->q16horiz + pPlayer->q16horizoff - F16(100)) * 20);
}
int pipeSpriteNum = A_InsertSprite(pPlayer->cursectnum,
pPlayer->pos.x+(sintable[(pPlayer->ang+512)&2047]>>6),
pPlayer->pos.y+(sintable[pPlayer->ang&2047]>>6),
pPlayer->pos.x+(sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]>>6),
pPlayer->pos.y+(sintable[fix16_to_int(pPlayer->q16ang)&2047]>>6),
pPlayer->pos.z,PWEAPON(playerNum, pPlayer->curr_weapon, Shoots),-16,9,9,
pPlayer->ang,(pipeBombFwdVel+(pPlayer->hbomb_hold_delay<<5)),pipeBombZvel,pPlayer->i,1);
fix16_to_int(pPlayer->q16ang),(pipeBombFwdVel+(pPlayer->hbomb_hold_delay<<5)),pipeBombZvel,pPlayer->i,1);
pipeBombType = PIPEBOMB_CONTROL(playerNum);
@ -4363,7 +4363,7 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer)
{
int const newOwner = pPlayer->newowner;
pPlayer->pos = *(vec3_t *)&sprite[newOwner];
pPlayer->ang = SA(newOwner);
pPlayer->q16ang = fix16_from_int(SA(newOwner));
pPlayer->vel.x = 0;
pPlayer->vel.y = 0;
sprite[pPlayer->i].xvel = 0;
@ -4421,9 +4421,10 @@ static void P_DoWater(int const playerNum, int const playerBits, int const floor
if (pPlayer->scuba_on && (krand()&255) < 8)
{
int const spriteNum = A_Spawn(pPlayer->i, WATERBUBBLE);
int const q16ang = fix16_to_int(pPlayer->q16ang);
sprite[spriteNum].x += sintable[(pPlayer->ang + 512 + 64 - (g_globalRandom & 128)) & 2047] >> 6;
sprite[spriteNum].y += sintable[(pPlayer->ang + 64 - (g_globalRandom & 128)) & 2047] >> 6;
sprite[spriteNum].x += sintable[(q16ang + 512 + 64 - (g_globalRandom & 128)) & 2047] >> 6;
sprite[spriteNum].y += sintable[(q16ang + 64 - (g_globalRandom & 128)) & 2047] >> 6;
sprite[spriteNum].xrepeat = 3;
sprite[spriteNum].yrepeat = 2;
sprite[spriteNum].z = pPlayer->pos.z + ZOFFSET3;
@ -4511,11 +4512,11 @@ static void P_Dead(int const playerNum, int const sectorLotag, int const floorZ,
}
Bmemcpy(&pPlayer->opos, &pPlayer->pos, sizeof(vec3_t));
pPlayer->oang = pPlayer->ang;
pPlayer->oq16ang = pPlayer->q16ang;
pPlayer->opyoff = pPlayer->pyoff;
pPlayer->qhoriz = F16(100);
pPlayer->qhorizoff = 0;
pPlayer->q16horiz = F16(100);
pPlayer->q16horizoff = 0;
updatesector(pPlayer->pos.x, pPlayer->pos.y, &pPlayer->cursectnum);
@ -4606,15 +4607,15 @@ void P_ProcessInput(int playerNum)
actor[pPlayer->i].floorz = floorZ;
actor[pPlayer->i].ceilingz = ceilZ;
pPlayer->oqhoriz = pPlayer->qhoriz;
pPlayer->oqhorizoff = pPlayer->qhorizoff;
pPlayer->oq16horiz = pPlayer->q16horiz;
pPlayer->oq16horizoff = pPlayer->q16horizoff;
// calculates automatic view angle for playing without a mouse
if (pPlayer->aim_mode == 0 && pPlayer->on_ground && sectorLotag != ST_2_UNDERWATER
&& (sector[pPlayer->cursectnum].floorstat & 2))
{
vec2_t const adjustedPlayer = { pPlayer->pos.x + (sintable[(pPlayer->ang + 512) & 2047] >> 5),
pPlayer->pos.y + (sintable[pPlayer->ang & 2047] >> 5) };
vec2_t const adjustedPlayer = { pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 5),
pPlayer->pos.y + (sintable[fix16_to_int(pPlayer->q16ang) & 2047] >> 5) };
int16_t curSectNum = pPlayer->cursectnum;
updatesector(adjustedPlayer.x, adjustedPlayer.y, &curSectNum);
@ -4624,14 +4625,14 @@ void P_ProcessInput(int playerNum)
int const slopeZ = getflorzofslope(pPlayer->cursectnum, adjustedPlayer.x, adjustedPlayer.y);
if ((pPlayer->cursectnum == curSectNum) ||
(klabs(getflorzofslope(curSectNum, adjustedPlayer.x, adjustedPlayer.y) - slopeZ) <= ZOFFSET6))
pPlayer->qhorizoff += fix16_from_int(mulscale16(trueFloorZ - slopeZ, 160));
pPlayer->q16horizoff += fix16_from_int(mulscale16(trueFloorZ - slopeZ, 160));
}
}
if (pPlayer->qhorizoff > 0)
pPlayer->qhorizoff -= ((pPlayer->qhorizoff >> 3) + fix16_one);
else if (pPlayer->qhorizoff < 0)
pPlayer->qhorizoff += (((-pPlayer->qhorizoff) >> 3) + fix16_one);
if (pPlayer->q16horizoff > 0)
pPlayer->q16horizoff -= ((pPlayer->q16horizoff >> 3) + fix16_one);
else if (pPlayer->q16horizoff < 0)
pPlayer->q16horizoff += (((-pPlayer->q16horizoff) >> 3) + fix16_one);
if (highZhit >= 0 && (highZhit&49152) == 49152)
{
@ -4814,12 +4815,12 @@ void P_ProcessInput(int playerNum)
pPlayer->bobpos.y = pPlayer->pos.y;
pPlayer->opos.z = pPlayer->pos.z;
pPlayer->opyoff = pPlayer->pyoff;
pPlayer->oang = pPlayer->ang;
pPlayer->oq16ang = pPlayer->q16ang;
if (pPlayer->one_eighty_count < 0)
{
pPlayer->one_eighty_count += 128;
pPlayer->ang += 128;
pPlayer->q16ang += F16(128);
}
// Shrinking code
@ -5072,14 +5073,14 @@ void P_ProcessInput(int playerNum)
pPlayer->vel.x = 0;
pPlayer->vel.y = 0;
}
else if (g_player[playerNum].inputBits->avel) //p->ang += syncangvel * constant
else if (g_player[playerNum].inputBits->qavel) //p->ang += syncangvel * constant
{
int const inputAng = g_player[playerNum].inputBits->avel;
fix16_t const inputAng = g_player[playerNum].inputBits->qavel;
pPlayer->angvel = (sectorLotag == ST_2_UNDERWATER) ? (inputAng - (inputAng >> 3)) * ksgn(velocityModifier)
: inputAng * ksgn(velocityModifier);
pPlayer->ang += pPlayer->angvel;
pPlayer->ang &= 2047;
pPlayer->q16angvel = (sectorLotag == ST_2_UNDERWATER) ? fix16_mul(inputAng - (inputAng >> 3), fix16_from_int(ksgn(velocityModifier)))
: fix16_mul(inputAng, fix16_from_int(ksgn(velocityModifier)));
pPlayer->q16ang += pPlayer->q16angvel;
pPlayer->q16ang &= 0x7FFFFFF;
pPlayer->crack_time = 777;
}
@ -5122,10 +5123,10 @@ void P_ProcessInput(int playerNum)
if (g_player[playerNum].inputBits->extbits & (1 << 2)) VM_OnEvent(EVENT_STRAFELEFT, pPlayer->i, playerNum);
if (g_player[playerNum].inputBits->extbits & (1 << 3)) VM_OnEvent(EVENT_STRAFERIGHT, pPlayer->i, playerNum);
if (g_player[playerNum].inputBits->extbits & (1 << 4) || g_player[playerNum].inputBits->avel < 0)
if (g_player[playerNum].inputBits->extbits & (1 << 4) || g_player[playerNum].inputBits->qavel < 0)
VM_OnEvent(EVENT_TURNLEFT, pPlayer->i, playerNum);
if (g_player[playerNum].inputBits->extbits & (1 << 5) || g_player[playerNum].inputBits->avel > 0)
if (g_player[playerNum].inputBits->extbits & (1 << 5) || g_player[playerNum].inputBits->qavel > 0)
VM_OnEvent(EVENT_TURNRIGHT, pPlayer->i, playerNum);
if (pPlayer->vel.x || pPlayer->vel.y || g_player[playerNum].inputBits->fvel || g_player[playerNum].inputBits->svel)
@ -5318,7 +5319,7 @@ HORIZONLY:;
if (VM_OnEvent(EVENT_LOOKUP,pPlayer->i,playerNum) == 0)
{
pPlayer->return_to_center = 9;
pPlayer->qhoriz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
pPlayer->q16horiz += fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
centerHoriz++;
}
}
@ -5328,7 +5329,7 @@ HORIZONLY:;
if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0)
{
pPlayer->return_to_center = 9;
pPlayer->qhoriz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
pPlayer->q16horiz -= fix16_from_int(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
centerHoriz++;
}
}
@ -5337,7 +5338,7 @@ HORIZONLY:;
{
if (VM_OnEvent(EVENT_AIMUP,pPlayer->i,playerNum) == 0)
{
pPlayer->qhoriz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
pPlayer->q16horiz += fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
centerHoriz++;
}
}
@ -5346,7 +5347,7 @@ HORIZONLY:;
{
if (VM_OnEvent(EVENT_AIMDOWN,pPlayer->i,playerNum) == 0)
{
pPlayer->qhoriz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
pPlayer->q16horiz -= fix16_from_int(6<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
centerHoriz++;
}
}
@ -5354,23 +5355,23 @@ HORIZONLY:;
if (pPlayer->return_to_center > 0 && !TEST_SYNC_KEY(playerBits, SK_LOOK_UP) && !TEST_SYNC_KEY(playerBits, SK_LOOK_DOWN))
{
pPlayer->return_to_center--;
pPlayer->qhoriz += F16(33)-fix16_div(pPlayer->qhoriz, F16(3));
pPlayer->q16horiz += F16(33)-fix16_div(pPlayer->q16horiz, F16(3));
centerHoriz++;
}
if (pPlayer->hard_landing > 0)
{
pPlayer->hard_landing--;
pPlayer->qhoriz -= fix16_from_int(pPlayer->hard_landing<<4);
pPlayer->q16horiz -= fix16_from_int(pPlayer->hard_landing<<4);
}
if (centerHoriz)
{
if (pPlayer->qhoriz > F16(95) && pPlayer->qhoriz < F16(105)) pPlayer->qhoriz = F16(100);
if (pPlayer->qhorizoff > F16(-5) && pPlayer->qhorizoff < F16(5)) pPlayer->qhorizoff = 0;
if (pPlayer->q16horiz > F16(95) && pPlayer->q16horiz < F16(105)) pPlayer->q16horiz = F16(100);
if (pPlayer->q16horizoff > F16(-5) && pPlayer->q16horizoff < F16(5)) pPlayer->q16horizoff = 0;
}
pPlayer->qhoriz = fix16_clamp(pPlayer->qhoriz + g_player[playerNum].inputBits->qhorz, F16(HORIZ_MIN), F16(HORIZ_MAX));
pPlayer->q16horiz = fix16_clamp(pPlayer->q16horiz + g_player[playerNum].inputBits->qhorz, F16(HORIZ_MIN), F16(HORIZ_MAX));
//Shooting code/changes
@ -5392,7 +5393,7 @@ HORIZONLY:;
if (pPlayer->knee_incs > 0)
{
pPlayer->qhoriz -= F16(48);
pPlayer->q16horiz -= F16(48);
pPlayer->return_to_center = 9;
if (++pPlayer->knee_incs > 15)
@ -5444,8 +5445,10 @@ HORIZONLY:;
pPlayer->actorsqu = -1;
}
else if (pPlayer->actorsqu >= 0)
pPlayer->ang += G_GetAngleDelta(pPlayer->ang, getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x,
sprite[pPlayer->actorsqu].y - pPlayer->pos.y)) >> 2;
pPlayer->q16ang += fix16_from_int(
G_GetAngleDelta(fix16_to_int(pPlayer->q16ang),
getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x, sprite[pPlayer->actorsqu].y - pPlayer->pos.y))
>> 2);
}
if (P_DoCounters(playerNum))

View file

@ -119,8 +119,8 @@ typedef struct {
typedef struct {
uint32_t bits;
int16_t fvel, svel, avel;
fix16_t qhorz;
int16_t fvel, svel;
fix16_t qavel, qhorz;
int8_t extbits;
} input_t;
@ -135,6 +135,10 @@ typedef struct {
typedef struct {
vec3_t pos, opos, vel, npos;
vec2_t bobpos, fric;
fix16_t q16horiz, q16horizoff, oq16horiz, oq16horizoff;
fix16_t q16ang, oq16ang, q16angvel;
int32_t truefz, truecz, player_par;
int32_t randomflamex, exitx, exity;
int32_t runspeed, max_player_health, max_shield_amount;
@ -153,11 +157,10 @@ typedef struct {
int16_t loogiex[64], loogiey[64], sbs, sound_pitch;
int16_t ang, oang, angvel, cursectnum, look_ang, last_extra, subweapon;
int16_t cursectnum, look_ang, last_extra, subweapon;
int16_t max_ammo_amount[MAX_WEAPONS], ammo_amount[MAX_WEAPONS], inv_amount[GET_MAX];
int16_t wackedbyactor, pyoff, opyoff;
fix16_t qhoriz, qhorizoff, oqhoriz, oqhorizoff;
int16_t newowner, jumping_counter, airleft;
int16_t fta, ftq, access_wallnum, access_spritenum;
int16_t got_access, weapon_ang, visibility;
@ -205,7 +208,7 @@ typedef struct {
// anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i.
struct { int32_t idx; } wa;
#endif
int8_t padding_[3];
int8_t padding_[1];
} DukePlayer_t;
// KEEPINSYNC lunatic/_defs_game.lua

View file

@ -668,7 +668,7 @@ void P_RandomSpawnPoint(int playerNum)
pPlayer->pos = g_playerSpawnPoints[i].pos;
pPlayer->opos = pPlayer->pos;
pPlayer->bobpos = *(vec2_t *)&pPlayer->pos;
pPlayer->ang = g_playerSpawnPoints[i].ang;
pPlayer->q16ang = fix16_from_int(g_playerSpawnPoints[i].ang);
pPlayer->cursectnum = g_playerSpawnPoints[i].sect;
sprite[pPlayer->i].cstat = 1 + 256;
@ -712,10 +712,10 @@ void P_ResetPlayer(int playerNum)
pPlayer->last_extra = pSprite->extra = pPlayer->max_player_health;
pPlayer->wantweaponfire = -1;
pPlayer->qhoriz = F16(100);
pPlayer->q16horiz = F16(100);
pPlayer->on_crane = -1;
pPlayer->frag_ps = playerNum;
pPlayer->qhorizoff = 0;
pPlayer->q16horizoff = 0;
pPlayer->opyoff = 0;
pPlayer->wackedbyactor = -1;
pPlayer->inv_amount[GET_SHIELD] = g_startArmorAmount;
@ -775,7 +775,7 @@ void P_ResetStatus(int playerNum)
pPlayer->pyoff = 0;
pPlayer->opyoff = 0;
pPlayer->loogcnt = 0;
pPlayer->angvel = 0;
pPlayer->q16angvel = 0;
pPlayer->weapon_sway = 0;
pPlayer->extra_extra8 = 0;
pPlayer->show_empty_weapon = 0;
@ -790,9 +790,9 @@ void P_ResetStatus(int playerNum)
pPlayer->footprintpal = 0;
pPlayer->footprintshade = 0;
pPlayer->jumping_toggle = 0;
pPlayer->oqhoriz = F16(140);
pPlayer->qhoriz = F16(140);
pPlayer->qhorizoff = 0;
pPlayer->oq16horiz = F16(140);
pPlayer->q16horiz = F16(140);
pPlayer->q16horizoff = 0;
pPlayer->bobcounter = 0;
pPlayer->on_ground = 0;
pPlayer->player_par = 0;
@ -1486,7 +1486,7 @@ static void resetpspritevars(char gameMode)
if (g_player[0].ps->cursectnum >= 0) // < 0 may happen if we start a map in void space (e.g. testing it)
{
A_InsertSprite(g_player[0].ps->cursectnum,g_player[0].ps->pos.x,g_player[0].ps->pos.y,g_player[0].ps->pos.z,
APLAYER,0,0,0,g_player[0].ps->ang,0,0,0,10);
APLAYER,0,0,0,fix16_to_int(g_player[0].ps->q16ang),0,0,0,10);
}
if (ud.recstat != 2)
@ -1621,7 +1621,7 @@ static void resetpspritevars(char gameMode)
actor[i].bpos.x = g_player[j].ps->bobpos.x = g_player[j].ps->opos.x = g_player[j].ps->pos.x = s->x;
actor[i].bpos.y = g_player[j].ps->bobpos.y = g_player[j].ps->opos.y = g_player[j].ps->pos.y = s->y;
actor[i].bpos.z = g_player[j].ps->opos.z = g_player[j].ps->pos.z = s->z;
g_player[j].ps->oang = g_player[j].ps->ang = s->ang;
g_player[j].ps->oq16ang = g_player[j].ps->q16ang = fix16_from_int(s->ang);
updatesector(s->x,s->y,&g_player[j].ps->cursectnum);
}
@ -1891,10 +1891,11 @@ int G_EnterLevel(int gameMode)
wm_setapptitle(tempbuf);
DukePlayer_t *const pPlayer = g_player[0].ps;
int16_t lbang;
if (!VOLUMEONE && Menu_HaveUserMap())
{
if (loadboard(boardfilename, 0, &pPlayer->pos, &pPlayer->ang, &pPlayer->cursectnum) < 0)
if (loadboard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", boardfilename);
return 1;
@ -1903,7 +1904,7 @@ int G_EnterLevel(int gameMode)
G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename, ud.m_level_number);
}
else if (loadboard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &pPlayer->ang, &pPlayer->cursectnum) < 0)
else if (loadboard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
{
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", g_mapInfo[mii].filename);
return 1;
@ -1913,6 +1914,8 @@ int G_EnterLevel(int gameMode)
G_LoadMapHack(levelName, g_mapInfo[mii].filename);
}
pPlayer->q16ang = fix16_from_int(lbang);
g_precacheCount = 0;
Bmemset(gotpic, 0, sizeof(gotpic));
Bmemset(precachehightile, 0, sizeof(precachehightile));

View file

@ -306,8 +306,8 @@ static inline void G_MoveClouds(void)
g_cloudClock = totalclock+6;
g_cloudX += sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9;
g_cloudY += sintable[g_player[screenpeek].ps->ang&2047]>>9;
g_cloudX += sintable[(fix16_to_int(g_player[screenpeek].ps->q16ang)+512)&2047]>>9;
g_cloudY += sintable[fix16_to_int(g_player[screenpeek].ps->q16ang)&2047]>>9;
for (i=g_cloudCnt-1; i>=0; i--)
{
@ -639,10 +639,11 @@ static void G_PrintCoords(int32_t snum)
}
Bsprintf(tempbuf, "XYZ= (%d, %d, %d)", ps->pos.x, ps->pos.y, ps->pos.z);
printext256(x, y, COLOR_WHITE, -1, tempbuf, 0);
char horiz[16], horizoff[16];
fix16_to_str(ps->qhoriz, horiz, 2);
fix16_to_str(ps->qhorizoff, horizoff, 2);
Bsprintf(tempbuf, "A/H/HO= %d, %s, %s", ps->ang, horiz, horizoff);
char ang[16], horiz[16], horizoff[16];
fix16_to_str(ps->q16ang, ang, 2);
fix16_to_str(ps->q16horiz, horiz, 2);
fix16_to_str(ps->q16horizoff, horizoff, 2);
Bsprintf(tempbuf, "A/H/HO= %s, %s, %s", ang, horiz, horizoff);
printext256(x, y+9, COLOR_WHITE, -1, tempbuf, 0);
Bsprintf(tempbuf, "VEL= (%d, %d, %d) + (%d, %d, 0)",
ps->vel.x>>14, ps->vel.y>>14, ps->vel.z, ps->fric.x>>5, ps->fric.y>>5);
@ -1036,13 +1037,13 @@ void G_DisplayRest(int32_t smoothratio)
{
cposx = pp->opos.x + mulscale16(pp->pos.x-pp->opos.x, smoothratio);
cposy = pp->opos.y + mulscale16(pp->pos.y-pp->opos.y, smoothratio);
cang = pp->oang + mulscale16(((pp->ang+1024-pp->oang)&2047)-1024, smoothratio);
cang = fix16_to_int(pp->oq16ang) + mulscale16((fix16_to_int(pp->q16ang+F16(1024)-pp->oq16ang)&2047)-1024, smoothratio);
}
else
{
cposx = pp->opos.x;
cposy = pp->opos.y;
cang = pp->oang;
cang = fix16_to_int(pp->oq16ang);
}
}
else

View file

@ -1583,7 +1583,7 @@ void A_DamageWall(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum)
{
int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, SECTOREFFECTOR, 0, 0, 0,
g_player[0].ps->ang, 0, 0, spriteNum, 3);
fix16_to_int(g_player[0].ps->q16ang), 0, 0, spriteNum, 3);
SLT(i) = 128;
T2(i) = 5;
T3(i) = wallNum;
@ -2753,7 +2753,7 @@ CHECKINV1:
if (pPlayer->cursectnum > -1)
{
int const i = A_InsertSprite(pPlayer->cursectnum, pPlayer->pos.x, pPlayer->pos.y,
pPlayer->pos.z+(30<<8), APLAYER, -64, 0, 0, pPlayer->ang, 0, 0, -1, 10);
pPlayer->pos.z+(30<<8), APLAYER, -64, 0, 0, fix16_to_int(pPlayer->q16ang), 0, 0, -1, 10);
pPlayer->holoduke_on = i;
T4(i) = T5(i) = 0;
sprite[i].yvel = playerNum;
@ -2869,8 +2869,8 @@ static int P_FindWall(DukePlayer_t *pPlayer, int *hitWall)
{
hitdata_t hitData;
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047],
sintable[pPlayer->ang & 2047], 0, &hitData, CLIPMASK0);
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
sintable[fix16_to_int(pPlayer->q16ang) & 2047], 0, &hitData, CLIPMASK0);
*hitWall = hitData.wall;
@ -2987,22 +2987,24 @@ void P_CheckSectors(int playerNum)
if (wall[foundWall].lotag)
return;
int const intang = fix16_to_int(pPlayer->oq16ang);
if (pPlayer->newowner >= 0)
neartag(pPlayer->opos.x, pPlayer->opos.y, pPlayer->opos.z, sprite[pPlayer->i].sectnum, pPlayer->oang, &nearSector,
neartag(pPlayer->opos.x, pPlayer->opos.y, pPlayer->opos.z, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
else
{
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z, sprite[pPlayer->i].sectnum, pPlayer->oang, &nearSector,
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET3, sprite[pPlayer->i].sectnum, pPlayer->oang, &nearSector,
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET3, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, pPlayer->oang, &nearSector,
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
{
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, pPlayer->oang, &nearSector,
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 3, our_neartag_blacklist);
if (nearSprite >= 0)
{

View file

@ -657,7 +657,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
}
int32_t sndist, sndang;
int32_t explosionp = S_CalcDistAndAng(i, num, CAMERA(sect), CAMERA(ang), &CAMERA(pos), pos, &sndist, &sndang);
int32_t explosionp = S_CalcDistAndAng(i, num, CAMERA(sect), fix16_to_int(CAMERA(q16ang)), &CAMERA(pos), pos, &sndist, &sndang);
int32_t pitch = S_GetPitch(num);
const DukePlayer_t *peekps = g_player[screenpeek].ps;
@ -897,7 +897,7 @@ void S_Update(void)
{
c = &CAMERA(pos);
cs = CAMERA(sect);
ca = CAMERA(ang);
ca = fix16_to_int(CAMERA(q16ang));
}
else
{