- SW: Cut q16ang/q16look_ang/q16rotscrnang over to PlayerAngle struct.

This commit is contained in:
Mitchell Richters 2020-10-08 14:23:29 +11:00
parent 3bc6777cf4
commit d758a0ae28
18 changed files with 165 additions and 175 deletions

View file

@ -785,7 +785,7 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
tsp->x -= mulscale16(pp->posx - pp->oposx, 65536-smoothratio);
tsp->y -= mulscale16(pp->posy - pp->oposy, 65536-smoothratio);
tsp->z -= mulscale16(pp->posz - pp->oposz, 65536-smoothratio);
tsp->ang -= FixedToInt(mulscale16(pp->q16ang - pp->oq16ang, 65536-smoothratio));
tsp->ang -= mulscale16(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), 65536-smoothratio);
}
}
@ -928,7 +928,7 @@ post_analyzesprites(void)
bool
BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16horiz)
BackView(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16horiz)
{
vec3_t n = { *nx, *ny, *nz };
SPRITEp sp;
@ -940,7 +940,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16h
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
ang = FixedToInt(*nq16ang) + pp->view_outside_dang;
ang = nang->asbuild() + pp->view_outside_dang;
// Calculate the vector (nx,ny,nz) to shoot backwards
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
@ -1008,7 +1008,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16h
flag_backup = hsp->cstat;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
BackView(nx, ny, nz, vsect, nq16ang, q16horiz);
BackView(nx, ny, nz, vsect, nang, q16horiz);
hsp->cstat = flag_backup;
return false;
}
@ -1049,12 +1049,12 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fixed_t *nq16ang, fixed_t q16h
// Make sure vsect is correct
updatesectorz(*nx, *ny, *nz, vsect);
*nq16ang += IntToFixed(pp->view_outside_dang);
*nang += buildang(pp->view_outside_dang);
return true;
}
void
CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16horiz)
CircleCamera(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16horiz)
{
vec3_t n = { *nx, *ny, *nz };
SPRITEp sp;
@ -1062,13 +1062,13 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16h
int i, vx, vy, vz, hx, hy;
short bakcstat, daang;
PLAYERp pp = &Player[screenpeek];
short ang;
binangle ang;
ang = FixedToInt(*nq16ang) + pp->circle_camera_ang;
ang = *nang + buildang(pp->circle_camera_ang);
// Calculate the vector (nx,ny,nz) to shoot backwards
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 4);
vy = (sintable[NORM_ANGLE(ang + 1024)] >> 4);
vx = (sintable[NORM_ANGLE(ang.asbuild() + 1536)] >> 4);
vy = (sintable[NORM_ANGLE(ang.asbuild() + 1024)] >> 4);
// lengthen the vector some
vx += DIV2(vx);
@ -1130,7 +1130,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16h
flag_backup = hsp->cstat;
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
CircleCamera(nx, ny, nz, vsect, nq16ang, q16horiz);
CircleCamera(nx, ny, nz, vsect, nang, q16horiz);
hsp->cstat = flag_backup;
return;
}
@ -1159,7 +1159,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, fixed_t q16h
// Make sure vsect is correct
updatesectorz(*nx, *ny, *nz, vsect);
*nq16ang = IntToFixed(ang);
*nang = ang;
}
FString GameInterface::GetCoordString()
@ -1169,7 +1169,7 @@ FString GameInterface::GetCoordString()
out.AppendFormat("POSX:%d ", pp->posx);
out.AppendFormat("POSY:%d ", pp->posy);
out.AppendFormat("POSZ:%d ", pp->posz);
out.AppendFormat("ANG:%d\n", FixedToInt(pp->q16ang));
out.AppendFormat("ANG:%d\n", pp->angle.ang.asbuild());
return out;
}
@ -1255,14 +1255,14 @@ void DrawCrosshair(PLAYERp pp)
if (!(CameraTestMode))
{
USERp u = User[pp->PlayerSprite];
::DrawCrosshair(2326, u->Health, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
::DrawCrosshair(2326, u->Health, -getHalfLookAng(pp->angle.olook_ang.asq16(), pp->angle.look_ang.asq16(), cl_syncinput, smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
}
}
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t *tq16ang, fixedhoriz *thoriz)
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, binangle *tang, fixedhoriz *thoriz)
{
int i,nexti;
short ang;
binangle ang;
SPRITEp sp;
bool found_camera = false;
bool player_in_camera = false;
@ -1275,8 +1275,8 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
{
sp = &sprite[i];
ang = getangle(*tx - sp->x, *ty - sp->y);
ang_test = getincangle(ang, sp->ang) < sp->lotag;
ang = q16ang(gethiq16angle(*tx - sp->x, *ty - sp->y));
ang_test = getincangle(ang.asbuild(), sp->ang) < sp->lotag;
FAFcansee_test =
(FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, *tx, *ty, *tz, pp->cursectnum) ||
@ -1300,7 +1300,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
{
case 1:
pp->last_camera_sp = sp;
CircleCamera(tx, ty, tz, tsectnum, tq16ang, 0);
CircleCamera(tx, ty, tz, tsectnum, tang, 0);
found_camera = true;
break;
@ -1310,8 +1310,8 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
pp->last_camera_sp = sp;
xvect = sintable[NORM_ANGLE(ang + 512)] >> 3;
yvect = sintable[NORM_ANGLE(ang)] >> 3;
xvect = sintable[NORM_ANGLE(ang.asbuild() + 512)] >> 3;
yvect = sintable[NORM_ANGLE(ang.asbuild())] >> 3;
zdiff = sp->z - *tz;
if (labs(sp->x - *tx) > 1000)
@ -1331,7 +1331,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fixed_t
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,thoriz %d",xvect,yvect,zvect,*thoriz.asbuild());
MONO_PRINT(ds);
*tq16ang = IntToFixed(ang);
*tang = ang;
*tx = sp->x;
*ty = sp->y;
*tz = sp->z;
@ -1602,7 +1602,8 @@ drawscreen(PLAYERp pp, double smoothratio)
{
extern bool CameraTestMode;
int tx, ty, tz;
fixed_t tq16ang, tq16rotscrnang;
lookangle trotscrnang;
binangle tang;
fixedhoriz thoriz;
short tsectnum;
short i,j;
@ -1646,23 +1647,19 @@ drawscreen(PLAYERp pp, double smoothratio)
// This isn't needed for the turret as it was fixable, but moving sector objects are problematic.
if (cl_syncinput || pp != Player+myconnectindex)
{
fixed_t dang = IntToFixed(1024);
fixed_t oang = camerapp->oq16ang + camerapp->oq16look_ang;
fixed_t ang = camerapp->q16ang + camerapp->q16look_ang;
tq16ang = oang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(ang + dang - oang) - dang, smoothratio));
tang = camerapp->angle.interpolatedsum(smoothratio);
thoriz = camerapp->horizon.interpolatedsum(smoothratio);
tq16rotscrnang = camerapp->oq16rotscrnang + xs_CRoundToInt(fmulscale16(NORM_Q16ANGLE(camerapp->q16rotscrnang + dang - camerapp->oq16rotscrnang) - dang, smoothratio));
trotscrnang = camerapp->angle.interpolatedrotscrn(smoothratio);
}
else
{
tq16ang = pp->q16ang + pp->q16look_ang;
tang = pp->angle.sum();
thoriz = pp->horizon.sum();
tq16rotscrnang = pp->q16rotscrnang;
trotscrnang = pp->angle.rotscrnang;
}
tsectnum = camerapp->cursectnum;
renderSetRollAngle(FixedToFloat(tq16rotscrnang));
renderSetRollAngle(trotscrnang.asbam() / (double)BAMUNIT);
COVERupdatesector(tx, ty, &tsectnum);
@ -1683,7 +1680,7 @@ drawscreen(PLAYERp pp, double smoothratio)
tx = pp->posx;
ty = pp->posy;
tz = pp->posz;
tq16ang = pp->q16ang;
tang = pp->angle.ang;
}
tsectnum = pp->cursectnum;
updatesectorz(tx, ty, tz, &tsectnum);
@ -1692,7 +1689,7 @@ drawscreen(PLAYERp pp, double smoothratio)
pp->six = tx;
pp->siy = ty;
pp->siz = tz - pp->posz;
pp->siang = FixedToInt(tq16ang);
pp->siang = tang.asbuild();
QuakeViewChange(camerapp, &quake_z, &quake_x, &quake_y, &quake_ang);
VisViewChange(camerapp, &g_visibility);
@ -1700,24 +1697,24 @@ drawscreen(PLAYERp pp, double smoothratio)
tx = tx + quake_x;
ty = ty + quake_y;
//thoriz += buildhoriz(quake_x);
tq16ang = NORM_Q16ANGLE(tq16ang + IntToFixed(quake_ang));
tang += buildang(quake_ang);
if (pp->sop_remote)
{
if (TEST_BOOL1(pp->remote_sprite))
tq16ang = IntToFixed(pp->remote_sprite->ang);
tang = buildang(pp->remote_sprite->ang);
else
tq16ang = gethiq16angle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty);
tang = q16ang(gethiq16angle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty));
}
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
{
tz -= 8448;
if (!BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, thoriz.asq16()))
if (!BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz.asq16()))
{
tz += 8448;
BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, thoriz.asq16());
BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz.asq16());
}
}
else
@ -1726,7 +1723,7 @@ drawscreen(PLAYERp pp, double smoothratio)
if (CameraTestMode)
{
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tq16ang, &thoriz);
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &thoriz);
}
}
@ -1752,20 +1749,20 @@ drawscreen(PLAYERp pp, double smoothratio)
videoSetCorrectedAspect();
renderSetAspect(xs_CRoundToInt(double(viewingrange)* tan(r_fov* (PI / 360.))), yxaspect);
OverlapDraw = true;
DrawOverlapRoom(tx, ty, tz, tq16ang, thoriz.asq16(), tsectnum);
DrawOverlapRoom(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
OverlapDraw = false;
if (automapMode != am_full)// && !ScreenSavePic)
{
// TEST this! Changed to camerapp
//JS_DrawMirrors(camerapp, tx, ty, tz, tq16ang, thoriz.asq16());
JS_DrawMirrors(pp, tx, ty, tz, tq16ang, thoriz.asq16());
//JS_DrawMirrors(camerapp, tx, ty, tz, tang.asq16(), thoriz.asq16());
JS_DrawMirrors(pp, tx, ty, tz, tang.asq16(), thoriz.asq16());
}
// TODO: This call is redundant if the tiled overhead map is shown, but the
// HUD elements should be properly outputted with hardware rendering first.
if (!FAF_DebugView)
FAF_DrawRooms(tx, ty, tz, tq16ang, thoriz.asq16(), tsectnum);
FAF_DrawRooms(tx, ty, tz, tang.asq16(), thoriz.asq16(), tsectnum);
analyzesprites(tx, ty, tz, false);
post_analyzesprites();
@ -1813,7 +1810,7 @@ drawscreen(PLAYERp pp, double smoothratio)
}
}
}
DrawOverheadMap(tx, ty, FixedToInt(tq16ang));
DrawOverheadMap(tx, ty, tang.asbuild());
}
for (j = 0; j < MAXSPRITES; j++)

View file

@ -336,7 +336,7 @@ void InitLevel(MapRecord *maprec)
currentLevel = maprec;
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
STAT_NewLevel(currentLevel->fileName);
Player[0].q16ang = IntToFixed(ang);
Player[0].angle.ang = buildang(ang);
SetupPreCache();

View file

@ -356,11 +356,11 @@ int StdRandomRange(int range);
#define KENFACING_PLAYER(pp,sp) (sintable[NORM_ANGLE(sp->ang+512)]*(pp->posy-sp->y) >= sintable[NORM_ANGLE(sp-ang)]*(pp->posx-sp->x))
#define FACING_PLAYER(pp,sp) (abs(getincangle(getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y), (sp)->ang)) < 512)
#define PLAYER_FACING(pp,sp) (abs(getincangle(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy), FixedToInt((pp)->q16ang))) < 320)
#define PLAYER_FACING(pp,sp) (abs(getincangle(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy), (pp)->angle.ang.asbuild())) < 320)
#define FACING(sp1,sp2) (abs(getincangle(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y), (sp2)->ang)) < 512)
#define FACING_PLAYER_RANGE(pp,sp,range) (abs(getincangle(getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y), (sp)->ang)) < (range))
#define PLAYER_FACING_RANGE(pp,sp,range) (abs(getincangle(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy), FixedToInt((pp)->q16ang))) < (range))
#define PLAYER_FACING_RANGE(pp,sp,range) (abs(getincangle(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy), (pp)->angle.ang.asbuild())) < (range))
#define FACING_RANGE(sp1,sp2,range) (abs(getincangle(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y), (sp2)->ang)) < (range))
// two vectors
@ -829,10 +829,7 @@ struct PLAYERstruct
// variable that fit in the sprite or user structure
int32_t posx, posy, posz;
// interpolation
int
oposx, oposy, oposz;
fixed_t oq16ang;
fixed_t oq16look_ang, oq16rotscrnang;
int oposx, oposy, oposz;
// holds last valid move position
short lv_sectnum;
@ -883,8 +880,7 @@ struct PLAYERstruct
// variables that do not fit into sprite structure
int hvel,tilt,tilt_dest;
PlayerHorizon horizon;
fixed_t q16ang;
fixed_t q16look_ang, q16rotscrnang;
PlayerAngle angle;
short recoil_amt;
short recoil_speed;
short recoil_ndx;
@ -893,7 +889,7 @@ struct PLAYERstruct
int oldposx,oldposy,oldposz;
int RevolveX, RevolveY;
short RevolveDeltaAng;
fixed_t RevolveQ16Ang;
binangle RevolveAng;
// under vars are for wading and swimming
short PlayerSprite, PlayerUnderSprite;
@ -1009,10 +1005,6 @@ struct PLAYERstruct
int cookieTime;
char WpnReloadState;
// Input helper variables.
double horizAdjust, angAdjust;
fixed_t horizTarget, angTarget;
};
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View file

@ -230,13 +230,13 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput)
DoPlayerTurnTurret(pp, input.q16avel);
}
playerProcessHelpers(&pp->q16ang, &pp->angAdjust, &pp->angTarget, scaleAdjust);
pp->angle.processhelpers(scaleAdjust);
pp->horizon.processhelpers(scaleAdjust);
}
if (packet)
{
auto const ang = FixedToInt(pp->q16ang);
auto const ang = pp->angle.ang.asbuild();
*packet = loc;

View file

@ -705,7 +705,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
if (TEST_BOOL11(sp) && numplayers > 1)
{
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->q16ang, cp->horizon.horiz.asq16(), cp->cursectnum, mirror[cnt].campic);
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->angle.ang.asq16(), cp->horizon.horiz.asq16(), cp->cursectnum, mirror[cnt].campic);
}
else
{
@ -757,7 +757,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fixed_t tpq16ang, fixed
// tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
// tz = pp->oposz + mulscale16(pp->posz - pp->oposz, smoothratio);
// tpq16ang = pp->q16ang;
// tpq16ang = pp->angle.ang.asq16();
dist = 0x7fffffff;

View file

@ -1388,7 +1388,7 @@ PlayerInitChemBomb(PLAYERp pp)
// Spawn a shot
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), CHEMBOMB_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), CHEMBOMB_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -1832,7 +1832,7 @@ PlayerInitCaltrops(PLAYERp pp)
// Spawn a shot
// Inserting and setting up variables
w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2);
nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2);
wp = &sprite[w];
wu = User[w];
@ -1860,7 +1860,7 @@ PlayerInitCaltrops(PLAYERp pp)
SET(wu->Flags, SPR_UNDERWATER);
// They go out at different angles
// wp->ang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
// wp->ang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25));
wp->zvel = -pp->horizon.horiz.asq16() >> 9;

View file

@ -60,7 +60,7 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist)
{
// move the box to position instead of using offset- this prevents small rounding errors
// allowing you to move through wall
ang = NORM_ANGLE(FixedToInt(pp->q16ang) + sop->clipbox_ang[i]);
ang = NORM_ANGLE(pp->angle.ang.asbuild() + sop->clipbox_ang[i]);
xs = pp->posx;
ys = pp->posy;

View file

@ -2398,7 +2398,7 @@ InitPlayerSprite(PLAYERp pp)
COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0;
sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
pp->posy, pp->posz, FixedToInt(pp->q16ang), 0);
pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
pp->SpriteP = sp = &sprite[sp_num];
pp->pnum = pnum;
@ -2473,7 +2473,7 @@ SpawnPlayerUnderSprite(PLAYERp pp)
int pnum = pp - Player, sp_num;
sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum,
NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, FixedToInt(pp->q16ang), 0);
NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
sp = &sprite[sp_num];
u = User[sp_num];

View file

@ -59,7 +59,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
if (parm->numparms >= 4)
{
Player->oq16ang = Player->q16ang = IntToFixed(atoi(parm->parms[3]));
Player->angle.oang = Player->angle.ang = buildang(atoi(parm->parms[3]));
}
if (parm->numparms == 5)

View file

@ -6921,7 +6921,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
short ang;
int flags;
double look_anghalf = getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio);
double look_anghalf = getHalfLookAng(pp->angle.look_ang.asq16(), pp->angle.look_ang.asq16(), cl_syncinput, smoothratio);
double looking_arc = fabs(look_anghalf) / 4.5;
TRAVERSE(&pp->PanelSpriteList, psp, next)

View file

@ -1072,8 +1072,8 @@ STATEp sg_PlayerNinjaFly[] =
static void resetinputhelpers(PLAYERp pp)
{
pp->horizAdjust = 0;
pp->angAdjust = 0;
pp->angle.resetadjustment();
pp->horizon.resetadjustment();
}
void
@ -1210,7 +1210,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets)
angle2 = NORM_ANGLE(getangle(ep->x - sp->x, ep->y - sp->y));
// Get the angle difference
// delta_ang = labs(FixedToInt(pp->q16ang) - angle2);
// delta_ang = labs(pp->angle.ang.asbuild() - angle2);
delta_ang = labs(getincangle(angle2, sp->ang));
@ -1313,7 +1313,7 @@ DoPlayerTeleportPause(PLAYERp pp)
void
DoPlayerTeleportToSprite(PLAYERp pp, SPRITEp sp)
{
pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->angle.ang = pp->angle.oang = buildang(sp->ang);
pp->posx = pp->oposx = pp->oldposx = sp->x;
pp->posy = pp->oposy = pp->oldposy = sp->y;
@ -1519,18 +1519,18 @@ DoPlayerCrawlHeight(PLAYERp pp)
void
UpdatePlayerSpriteAngle(PLAYERp pp)
{
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
if (!Prediction && pp->PlayerUnderSprite >= 0)
{
sprite[pp->PlayerUnderSprite].ang = FixedToInt(pp->q16ang);
sprite[pp->PlayerUnderSprite].ang = pp->angle.ang.asbuild();
}
}
void
DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
{
applylook2(&pp->q16ang, &pp->q16look_ang, &pp->q16rotscrnang, &pp->turn180_target, q16avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
applylook(&pp->angle, q16avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
UpdatePlayerSpriteAngle(pp);
}
@ -1554,8 +1554,8 @@ DoPlayerTurnBoat(PLAYERp pp, fixed_t q16avel)
if (q16avel != 0)
{
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
pp->angle.ang += degang(q16avel);
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
}
}
#endif
@ -1579,10 +1579,11 @@ DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist)
if (q16avel != 0)
{
if (MultiClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang + q16avel)), z, floor_dist))
auto sum = pp->angle.ang + degang(q16avel);
if (MultiClipTurn(pp, NORM_ANGLE(sum.asbuild()), z, floor_dist))
{
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
pp->angle.ang = sum;
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
}
}
}
@ -1607,10 +1608,11 @@ DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
if (q16avel != 0)
{
if (RectClipTurn(pp, NORM_ANGLE(FixedToInt(pp->q16ang + q16avel)), x, y, ox, oy))
auto sum = pp->angle.ang + degang(q16avel);
if (RectClipTurn(pp, NORM_ANGLE(sum.asbuild()), x, y, ox, oy))
{
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
pp->angle.ang = sum;
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
}
}
}
@ -1618,7 +1620,8 @@ DoPlayerTurnVehicleRect(PLAYERp pp, int *x, int *y, int *ox, int *oy)
void
DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel)
{
fixed_t new_ang, diff;
fixed_t diff;
binangle new_ang;
SECTOR_OBJECTp sop = pp->sop;
if (sop->drive_angspeed)
@ -1635,26 +1638,26 @@ DoPlayerTurnTurret(PLAYERp pp, fixed_t q16avel)
if (q16avel != 0)
{
new_ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
new_ang = pp->angle.ang + degang(q16avel);
if (sop->limit_ang_center >= 0)
{
diff = getincangleq16(IntToFixed(sop->limit_ang_center), new_ang);
diff = getincangleq16(IntToFixed(sop->limit_ang_center), new_ang.asq16());
if (labs(diff) >= IntToFixed(sop->limit_ang_delta))
{
if (diff < 0)
new_ang = IntToFixed(sop->limit_ang_center - sop->limit_ang_delta);
new_ang = buildang(sop->limit_ang_center - sop->limit_ang_delta);
else
new_ang = IntToFixed(sop->limit_ang_center + sop->limit_ang_delta);
new_ang = buildang(sop->limit_ang_center + sop->limit_ang_delta);
}
}
pp->q16ang = new_ang;
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
pp->angle.ang = new_ang;
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
}
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->sop->xmid, pp->sop->ymid);
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->sop->xmid, pp->sop->ymid);
}
void SlipSlope(PLAYERp pp)
@ -1686,7 +1689,7 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust)
if (!TEST(pp->Flags, PF_MOUSE_AIMING_ON) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped
{
// Get a point, 512 units ahead of player's position
auto const ang = FixedToInt(pp->q16ang);
auto const ang = pp->angle.ang.asbuild();
x = pp->posx + (sintable[(ang + 512) & 2047] >> 5);
y = pp->posy + (sintable[ang & 2047] >> 5);
tempsect = pp->cursectnum;
@ -1927,7 +1930,7 @@ UpdatePlayerSprite(PLAYERp pp)
if (TEST(pp->Flags, PF_DEAD))
{
changespritesect(pp->PlayerSprite, pp->cursectnum);
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
UpdatePlayerUnderSprite(pp);
return;
}
@ -2002,7 +2005,7 @@ UpdatePlayerSprite(PLAYERp pp)
UpdatePlayerUnderSprite(pp);
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
sprite[pp->PlayerSprite].ang = pp->angle.ang.asbuild();
}
void
@ -2279,7 +2282,7 @@ DoPlayerMove(PLAYERp pp)
if (interpolate_ride)
{
pp->oposz = pp->posz;
pp->oq16ang = pp->q16ang;
pp->angle.backup();
}
// check for warp - probably can remove from CeilingHit
@ -2499,13 +2502,13 @@ DoPlayerMoveBoat(PLAYERp pp)
z = pp->posz + Z(10);
save_sectnum = pp->cursectnum;
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO);
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), MAXSO, MAXSO);
pp->cursectnum = pp->sop->op_main_sector; // for speed
floor_dist = labs(z - pp->sop->floor_loz);
clipmove_old(&pp->posx, &pp->posy, &z, &pp->cursectnum, pp->xvect, pp->yvect, (int)pp->sop->clipdist, Z(4), floor_dist, CLIPMASK_PLAYER);
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy);
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->posx, pp->posy);
pp->cursectnum = save_sectnum; // for speed
if (!cl_syncinput)
@ -2533,7 +2536,7 @@ void DoTankTreads(PLAYERp pp)
return;
vel = FindDistance2D(pp->xvect>>8, pp->yvect>>8);
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]);
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->angle.ang.asbuild()+512)], sintable[pp->angle.ang.asbuild()]);
if (dot < 0)
reverse = true;
@ -2760,7 +2763,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
continue;
damage = -(u->Health + 100);
PlayerDamageSlide(u->PlayerP, damage, FixedToInt(pp->q16ang));
PlayerDamageSlide(u->PlayerP, damage, pp->angle.ang.asbuild());
PlayerUpdateHealth(u->PlayerP, damage);
//PlayerCheckDeath(u->PlayerP, -1);
PlayerCheckDeath(u->PlayerP, pp->PlayerSprite);
@ -2895,7 +2898,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
save_sectnum = pp->cursectnum;
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO);
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), MAXSO, MAXSO);
pp->cursectnum = pp->sop->op_main_sector; // for speed
floor_dist = labs(z - pp->sop->floor_loz);
@ -2925,7 +2928,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
hitscan(&hit_pos, pp->cursectnum,
//pp->xvect, pp->yvect, 0,
MOVEx(256, FixedToInt(pp->q16ang)), MOVEy(256, FixedToInt(pp->q16ang)), 0,
MOVEx(256, pp->angle.ang.asbuild()), MOVEy(256, pp->angle.ang.asbuild()), 0,
&hitinfo, CLIPMASK_PLAYER);
////DSPRINTF(ds,"hitinfo.sect %d, hitinfo.wall %d, hitinfo.pos.x %d, hitinfo.pos.y %d, hitinfo.pos.z %d",hitinfo.sect, hitinfo.wall, hitinfo.pos.x, hitinfo.pos.y, hitinfo.pos.z);
@ -2999,7 +3002,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
}
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy);
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), pp->posx, pp->posy);
pp->cursectnum = save_sectnum; // for speed
if (!cl_syncinput)
@ -3469,7 +3472,7 @@ DoPlayerClimb(PLAYERp pp)
pp->xvect = pp->yvect = 0;
climbvel = FindDistance2D(pp->xvect, pp->yvect)>>9;
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]);
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->angle.ang.asbuild()+512)], sintable[pp->angle.ang.asbuild()]);
if (dot < 0)
climbvel = -climbvel;
@ -3646,7 +3649,7 @@ DoPlayerClimb(PLAYERp pp)
// constantly look for new ladder sector because of warping at any time
neartag(pp->posx, pp->posy, pp->posz,
pp->cursectnum, FixedToInt(pp->q16ang),
pp->cursectnum, pp->angle.ang.asbuild(),
&sec, &wal, &spr,
&dist, 800L, NTAG_SEARCH_LO_HI, NULL);
@ -3671,7 +3674,7 @@ DoPlayerClimb(PLAYERp pp)
pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5;
playerSetAngle2(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
pp->angle.settarget(pp->LadderAngle);
}
}
}
@ -3691,8 +3694,8 @@ DoPlayerWadeSuperJump(PLAYERp pp)
for (i = 0; i < SIZ(angs); i++)
{
FAFhitscan(pp->posx, pp->posy, zh, pp->cursectnum, // Start position
sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + angs[i] + 512)], // X vector of 3D ang
sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + angs[i])], // Y vector of 3D ang
sintable[NORM_ANGLE(pp->angle.ang.asbuild() + angs[i] + 512)], // X vector of 3D ang
sintable[NORM_ANGLE(pp->angle.ang.asbuild() + angs[i])], // Y vector of 3D ang
0, // Z vector of 3D ang
&hitinfo, CLIPMASK_MISSILE);
@ -4048,11 +4051,11 @@ PlayerOnLadder(PLAYERp pp)
if (Prediction)
return false;
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, FixedToInt(pp->q16ang),
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, pp->angle.ang.asbuild(),
&neartagsector, &neartagwall, &neartagsprite,
&neartaghitdist, 1024L+768L, NTAG_SEARCH_LO_HI, NULL);
dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]);
dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->angle.ang.asbuild()+512)], sintable[pp->angle.ang.asbuild()]);
if (dir < 0)
return false;
@ -4062,7 +4065,7 @@ PlayerOnLadder(PLAYERp pp)
for (i = 0; i < SIZ(angles); i++)
{
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, NORM_ANGLE(FixedToInt(pp->q16ang) + angles[i]),
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, NORM_ANGLE(pp->angle.ang.asbuild() + angles[i]),
&sec, &wal, &spr,
&dist, 600L, NTAG_SEARCH_LO_HI, NULL);
@ -4070,8 +4073,8 @@ PlayerOnLadder(PLAYERp pp)
return false;
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum,
sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + angles[i] + 512)],
sintable[NORM_ANGLE(FixedToInt(pp->q16ang) + angles[i])],
sintable[NORM_ANGLE(pp->angle.ang.asbuild() + angles[i] + 512)],
sintable[NORM_ANGLE(pp->angle.ang.asbuild() + angles[i])],
0,
&hitinfo, CLIPMASK_MISSILE);
@ -4126,7 +4129,7 @@ PlayerOnLadder(PLAYERp pp)
pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5;
playerSetAngle2(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
pp->angle.settarget(pp->LadderAngle);
return true;
}
@ -5365,7 +5368,7 @@ DoPlayerBeginOperate(PLAYERp pp)
pp->sop = pp->sop_control = sop;
sop->controller = pp->SpriteP;
playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
pp->angle.settarget(sop->ang);
pp->posx = sop->xmid;
pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -5452,7 +5455,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
save_sectnum = pp->cursectnum;
playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
pp->angle.settarget(sop->ang);
pp->posx = sop->xmid;
pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -5583,13 +5586,13 @@ DoPlayerStopOperate(PLAYERp pp)
if (pp->sop_remote)
{
if (TEST_BOOL1(pp->remote_sprite))
pp->q16ang = pp->oq16ang = IntToFixed(pp->remote_sprite->ang);
pp->angle.ang = pp->angle.oang = buildang(pp->remote_sprite->ang);
else
pp->q16ang = pp->oq16ang = gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy);
pp->angle.ang = pp->angle.oang = q16ang(gethiq16angle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy));
}
if (!cl_syncinput)
pp->angTarget = 0;
pp->angle.target = buildang(0);
if (pp->sop_control)
{
@ -6242,7 +6245,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
{
playerAddAngle2(&pp->q16ang, &pp->angAdjust, getincangleq16(pp->q16ang, gethiq16angle(kp->x - pp->posx, kp->y - pp->posy)) / (double)(FRACUNIT << 4));
pp->angle.addadjustment(getincangleq16(pp->angle.ang.asq16(), gethiq16angle(kp->x - pp->posx, kp->y - pp->posy)) / (double)(FRACUNIT << 4));
}
}
}
@ -6278,7 +6281,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
pp->SpriteP->x = pp->posx;
pp->SpriteP->y = pp->posy;
pp->SpriteP->z = pp->posz+PLAYER_HEIGHT;
pp->SpriteP->ang = FixedToInt(pp->q16ang);
pp->SpriteP->ang = pp->angle.ang.asbuild();
DoSpawnTeleporterEffect(pp->SpriteP);
PlaySound(DIGI_TELEPORT, pp, v3df_none);
@ -6970,10 +6973,8 @@ MoveSkipSavePos(void)
pp->oposx = pp->posx;
pp->oposy = pp->posy;
pp->oposz = pp->posz;
pp->oq16ang = pp->q16ang;
pp->obob_z = pp->bob_z;
pp->oq16look_ang = pp->q16look_ang;
pp->oq16rotscrnang = pp->q16rotscrnang;
pp->angle.backup();
pp->horizon.backup();
}
@ -7282,7 +7283,7 @@ domovethings(void)
// auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{
playerSetAngle2(&Player[screenpeek].q16ang, &Player[screenpeek].angTarget, FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)));
Player[screenpeek].angle.settarget(FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)));
}
if (!TEST(pp->Flags, PF_DEAD))
@ -7359,7 +7360,7 @@ InitAllPlayers(void)
pp->posx = pp->oposx = pfirst->posx;
pp->posy = pp->oposy = pfirst->posy;
pp->posz = pp->oposz = pfirst->posz;
pp->q16ang = pp->oq16ang = pfirst->q16ang;
pp->angle.ang = pp->angle.oang = pfirst->angle.ang;
pp->horizon.horiz = pp->horizon.ohoriz = pfirst->horizon.horiz;
pp->cursectnum = pfirst->cursectnum;
// set like this so that player can trigger something on start of the level
@ -7506,7 +7507,7 @@ PlayerSpawnPosition(PLAYERp pp)
pp->posx = pp->oposx = sp->x;
pp->posy = pp->oposy = sp->y;
pp->posz = pp->oposz = sp->z;
pp->q16ang = pp->oq16ang = IntToFixed(sp->ang);
pp->angle.ang = pp->angle.oang = buildang(sp->ang);
pp->cursectnum = sp->sectnum;
getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz);
@ -7565,7 +7566,7 @@ InitMultiPlayerInfo(void)
continue;
}
start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, FixedToInt(pp->q16ang), 0);
start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
ASSERT(start0 >= 0);
if (User[start0])
{

View file

@ -45,7 +45,7 @@ PLAYERp ppp = &PredictPlayer;
typedef struct
{
int x,y,z;
fixed_t q16ang;
binangle ang;
fixedhoriz horiz;
short filler;
} PREDICT, *PREDICTp;
@ -96,10 +96,10 @@ DoPrediction(PLAYERp ppp)
u = User[ppp->PlayerSprite];
User[ppp->PlayerSprite] = &PredictUser;
ppp->oq16ang = ppp->q16ang;
ppp->oposx = ppp->posx;
ppp->oposy = ppp->posy;
ppp->oposz = ppp->posz;
ppp->angle.backup();
ppp->horizon.backup();
// go through the player MOVEMENT code only
@ -114,10 +114,10 @@ DoPrediction(PLAYERp ppp)
sprite[Player[myconnectindex].PlayerSprite] = spr;
randomseed = bakrandomseed;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].q16ang = ppp->q16ang;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].x = ppp->posx;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].y = ppp->posy;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].z = ppp->posz;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].ang = ppp->angle.ang;
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].horiz = ppp->horizon.horiz;
predictmovefifoplc++;
#endif
@ -136,7 +136,7 @@ CorrectPrediction(int actualfifoplc)
return;
// see if player position is predicted position
if (predict->q16ang == Player[myconnectindex].q16ang &&
if (predict->ang == Player[myconnectindex].angle.ang &&
predict->x == Player[myconnectindex].posx &&
predict->y == Player[myconnectindex].posy &&
predict->z == Player[myconnectindex].posz &&
@ -146,7 +146,7 @@ CorrectPrediction(int actualfifoplc)
return;
}
// //DSPRINTF(ds,"PREDICT ERROR: %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", FixedToInt(predict->q16ang), FixedToInt(Player[myconnectindex].q16ang), predict->x, Player[myconnectindex].posx, predict->y, Player[myconnectindex].posy, predict->z, Player[myconnectindex].posz, predict->horiz.asbuild(), Player[myconnectindex].horizon.horiz.asbuild()));
// //DSPRINTF(ds,"PREDICT ERROR: %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", predict->angle.ang.asbuild(), Player[myconnectindex].angle.ang.asbuild(), predict->x, Player[myconnectindex].posx, predict->y, Player[myconnectindex].posy, predict->z, Player[myconnectindex].posz, predict->horiz.asbuild(), Player[myconnectindex].horizon.horiz.asbuild()));
// MONO_PRINT(ds);
InitPrediction(&Player[myconnectindex]);

View file

@ -636,7 +636,7 @@ private:
25, 19, 15, 9, 1, 1, 9, 15, 19, 25
};
ang = FixedToInt(pp->q16ang);
ang = pp->angle.ang.asbuild();
if (pp->sop_remote)
ang = 0;

View file

@ -2317,7 +2317,7 @@ bool NearThings(PLAYERp pp)
return false;
}
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, FixedToInt(pp->q16ang),
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, pp->angle.ang.asbuild(),
&neartagsect, &neartagwall, &neartagsprite,
&neartaghitdist, 1024L, NTAG_SEARCH_LO_HI, NULL);
@ -2351,7 +2351,7 @@ bool NearThings(PLAYERp pp)
// This only gets called if nothing else worked, check for nearness to a wall
{
hitdata_t hitinfo = { { 0, 0, 0 }, 0, 0, 0 };
short dang = FixedToInt(pp->q16ang);
short dang = pp->angle.ang.asbuild();
FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position
sintable[NORM_ANGLE(dang + 512)], // X vector of 3D ang
@ -2415,7 +2415,7 @@ NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int coun
int neartaghitdist;
neartag(pp->posx, pp->posy, z, pp->cursectnum, FixedToInt(pp->q16ang),
neartag(pp->posx, pp->posy, z, pp->cursectnum, pp->angle.ang.asbuild(),
&neartagsector, &neartagwall, &neartagsprite,
&neartaghitdist, dist, type, NULL);

View file

@ -590,7 +590,7 @@ void GameInterface::UpdateSounds(void)
PLAYERp pp = Player + screenpeek;
SoundListener listener;
listener.angle = -FixedToFloat(pp->q16ang) * pi::pi() / 1024; // Build uses a period of 2048.
listener.angle = -(pp->angle.ang.asbam() / (double)BAMUNIT) * pi::pi() / 1024; // Build uses a period of 2048.
listener.velocity.Zero();
listener.position = GetSoundPos((vec3_t*)&pp->posx);
listener.underwater = false;

View file

@ -788,7 +788,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh)
{
pp->RevolveQ16Ang = pp->q16ang;
pp->RevolveAng = pp->angle.ang;
pp->RevolveX = pp->posx;
pp->RevolveY = pp->posy;
pp->RevolveDeltaAng = 0;
@ -1624,7 +1624,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
{
SET(pp->Flags, PF_PLAYER_RIDING);
pp->RevolveQ16Ang = pp->q16ang;
pp->RevolveAng = pp->angle.ang;
pp->RevolveX = pp->posx;
pp->RevolveY = pp->posy;
@ -1648,7 +1648,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
// save the current information so when Player stops
// moving then you
// know where he was last
pp->RevolveQ16Ang = pp->q16ang;
pp->RevolveAng = pp->angle.ang;
pp->RevolveX = pp->posx;
pp->RevolveY = pp->posy;
@ -1664,7 +1664,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
pp->RevolveY += BOUND_4PIX(ny);
// Last known angle is now adjusted by the delta angle
pp->RevolveQ16Ang = NORM_Q16ANGLE(pp->q16ang - IntToFixed(pp->RevolveDeltaAng));
pp->RevolveAng = pp->angle.ang - buildang(pp->RevolveDeltaAng);
}
// increment Players delta angle
@ -1678,7 +1678,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
// New angle is formed by taking last known angle and
// adjusting by the delta angle
playerAddAngle2(&pp->q16ang, &pp->angAdjust, FixedToFloat(getincangleq16(pp->q16ang, pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng))));
pp->angle.addadjustment((pp->angle.ang - (pp->RevolveAng + buildang(pp->RevolveDeltaAng))).asbam() / (double)BAMUNIT);
UpdatePlayerSprite(pp);
}

View file

@ -12874,7 +12874,7 @@ InitSpellRing(PLAYERp pp)
ang_diff = 2048 / max_missiles;
ang_start = NORM_ANGLE(FixedToInt(pp->q16ang) - DIV2(2048));
ang_start = NORM_ANGLE(pp->angle.ang.asbuild() - DIV2(2048));
if (!SW_SHAREWARE)
PlaySound(DIGI_RFWIZ, pp, v3df_none);
@ -13433,7 +13433,7 @@ InitSpellNapalm(PLAYERp pp)
for (i = 0; i < SIZ(mp); i++)
{
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
pp->posx, pp->posy, pp->posz + Z(12), FixedToInt(pp->q16ang), NAPALM_VELOCITY*2);
pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), NAPALM_VELOCITY*2);
sp = &sprite[SpriteNum];
u = User[SpriteNum];
@ -13593,7 +13593,7 @@ InitSpellMirv(PLAYERp pp)
return 0;
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursectnum,
pp->posx, pp->posy, pp->posz + Z(12), FixedToInt(pp->q16ang), MIRV_VELOCITY);
pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), MIRV_VELOCITY);
sp = &sprite[SpriteNum];
u = User[SpriteNum];
@ -13708,7 +13708,7 @@ InitSwordAttack(PLAYERp pp)
{
bp = &sprite[bubble];
bp->ang = FixedToInt(pp->q16ang);
bp->ang = pp->angle.ang.asbuild();
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
@ -13757,7 +13757,7 @@ InitSwordAttack(PLAYERp pp)
short daang;
int daz;
daang = FixedToInt(pp->q16ang);
daang = pp->angle.ang.asbuild();
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
@ -13885,7 +13885,7 @@ InitFistAttack(PLAYERp pp)
{
bp = &sprite[bubble];
bp->ang = FixedToInt(pp->q16ang);
bp->ang = pp->angle.ang.asbuild();
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
@ -13947,7 +13947,7 @@ InitFistAttack(PLAYERp pp)
short daang;
int daz;
daang = FixedToInt(pp->q16ang);
daang = pp->angle.ang.asbuild();
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
@ -14606,7 +14606,7 @@ InitStar(PLAYERp pp)
// Spawn a shot
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, FixedToInt(pp->q16ang), STAR_VELOCITY);
w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), STAR_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -14729,7 +14729,7 @@ InitHeartAttack(PLAYERp pp)
return;
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
pp->posx, pp->posy, pp->posz + Z(12), FixedToInt(pp->q16ang), BLOOD_WORM_VELOCITY*2);
pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), BLOOD_WORM_VELOCITY*2);
sp = &sprite[SpriteNum];
u = User[SpriteNum];
@ -14805,7 +14805,7 @@ InitHeartAttack(PLAYERp pp)
return;
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
pp->posx, pp->posy, pp->posz + Z(12), FixedToInt(pp->q16ang), BLOOD_WORM_VELOCITY*2);
pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), BLOOD_WORM_VELOCITY*2);
sp = &sprite[SpriteNum];
u = User[SpriteNum];
@ -14967,7 +14967,7 @@ InitShotgun(PLAYERp pp)
else
{
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000);
daang = FixedToInt(pp->q16ang);
daang = pp->angle.ang.asbuild();
}
for (i = 0; i < 12; i++)
@ -15129,7 +15129,7 @@ InitLaser(PLAYERp pp)
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), 300);
nx, ny, nz, pp->angle.ang.asbuild(), 300);
wp = &sprite[w];
wu = User[w];
@ -15240,7 +15240,7 @@ InitRail(PLAYERp pp)
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), 1200);
nx, ny, nz, pp->angle.ang.asbuild(), 1200);
wp = &sprite[w];
wu = User[w];
@ -15440,7 +15440,7 @@ InitRocket(PLAYERp pp)
//nz = pp->posz + pp->bob_z + Z(12);
nz = pp->posz + pp->bob_z + Z(8);
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), ROCKET_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -15571,7 +15571,7 @@ InitBunnyRocket(PLAYERp pp)
//nz = pp->posz + pp->bob_z + Z(12);
nz = pp->posz + pp->bob_z + Z(8);
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), ROCKET_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), ROCKET_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -15685,7 +15685,7 @@ InitNuke(PLAYERp pp)
//nz = pp->posz + pp->bob_z + Z(12);
nz = pp->posz + pp->bob_z + Z(8);
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), 700);
nx, ny, nz, pp->angle.ang.asbuild(), 700);
wp = &sprite[w];
wu = User[w];
@ -15748,7 +15748,7 @@ InitNuke(PLAYERp pp)
wu->ychange = MOVEy(wp->xvel, wp->ang);
wu->zchange = zvel;
PlayerDamageSlide(pp, -40, NORM_ANGLE(FixedToInt(pp->q16ang)+1024)); // Recoil slide
PlayerDamageSlide(pp, -40, NORM_ANGLE(pp->angle.ang.asbuild()+1024)); // Recoil slide
return 0;
}
@ -15883,7 +15883,7 @@ InitMicro(PLAYERp pp)
{
hp = NULL;
hu = NULL;
ang = FixedToInt(pp->q16ang);
ang = pp->angle.ang.asbuild();
}
nz = pp->posz + pp->bob_z + Z(14);
@ -17439,7 +17439,7 @@ InitTracerUzi(PLAYERp pp)
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, 0, s_Tracer, pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), TRACER_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), TRACER_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -17721,8 +17721,8 @@ int SpawnWallHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_
sp->ang = NORM_ANGLE(wall_ang + 1024);
// int nx,ny;
//nx = (sintable[(512 + FixedToInt(Player[0].q16ang)) & 2047] >> 7);
//ny = (sintable[FixedToInt(Player[0].q16ang)] >> 7);
//nx = (sintable[(512 + Player[0].angle.ang.asbuild()) & 2047] >> 7);
//ny = (sintable[Player[0].angle.ang.asbuild()] >> 7);
//sp->x -= nx;
//sp->y -= ny;
@ -17828,8 +17828,8 @@ InitUzi(PLAYERp pp)
}
else
{
//daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(24) - 12));
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25));
daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(24) - 12));
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000) + (RANDOM_RANGE(24000) - 12000);
}
@ -18006,7 +18006,7 @@ InitEMP(PLAYERp pp)
InitTracerUzi(pp);
//daz = nz = pp->posz + Z(8) + -mulscale16(pp->horizon.horiz.asq16(), 72);
//daang = NORM_ANGLE(FixedToInt(pp->q16ang) + (RANDOM_RANGE(50) - 25));
//daang = NORM_ANGLE(pp->angle.ang.asbuild() + (RANDOM_RANGE(50) - 25));
daz = nz = pp->posz + pp->bob_z;
daang = 64;
@ -18016,7 +18016,7 @@ InitEMP(PLAYERp pp)
else
{
daz = -mulscale16(pp->horizon.horiz.asq16(), 2000);
daang = FixedToInt(pp->q16ang);
daang = pp->angle.ang.asbuild();
}
FAFhitscan(pp->posx, pp->posy, nz, pp->cursectnum, // Start position
@ -19271,7 +19271,7 @@ InitGrenade(PLAYERp pp)
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), GRENADE_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), GRENADE_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -19440,7 +19440,7 @@ InitMine(PLAYERp pp)
// Inserting and setting up variables
w = SpawnSprite(STAT_MISSILE, MINE, s_Mine, pp->cursectnum,
nx, ny, nz, FixedToInt(pp->q16ang), MINE_VELOCITY);
nx, ny, nz, pp->angle.ang.asbuild(), MINE_VELOCITY);
wp = &sprite[w];
wu = User[w];
@ -19471,7 +19471,7 @@ InitMine(PLAYERp pp)
wu->xchange = MOVEx(wp->xvel, wp->ang);
wu->ychange = MOVEy(wp->xvel, wp->ang);
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(FixedToInt(pp->q16ang)+512)], sintable[FixedToInt(pp->q16ang)]);
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->angle.ang.asbuild()+512)], sintable[pp->angle.ang.asbuild()]);
// don't adjust for strafing
if (labs(dot) > 10000)
@ -19601,7 +19601,7 @@ InitFireball(PLAYERp pp)
nz = pp->posz + pp->bob_z + Z(15);
w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, FixedToInt(pp->q16ang), FIREBALL_VELOCITY);
w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), FIREBALL_VELOCITY);
wp = &sprite[w];
wu = User[w];

View file

@ -788,7 +788,7 @@ SpawnZombie(PLAYERp pp, short Weapon)
//Zombies++;
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, FixedToInt(pp->q16ang), 0);
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
np = &sprite[New];
nu = User[New];
np->sectnum = pp->cursectnum;