diff --git a/source/sw/src/demo.cpp b/source/sw/src/demo.cpp index b3994b941..ad04d15a4 100644 --- a/source/sw/src/demo.cpp +++ b/source/sw/src/demo.cpp @@ -194,7 +194,7 @@ DemoWriteHeader(void) dsp.z = pp->posz; fwrite(&dsp, sizeof(dsp), 1, DemoFileOut); fwrite(&pp->Flags, sizeof(pp->Flags), 1, DemoFileOut); - fwrite(&pp->pang, sizeof(pp->pang), 1, DemoFileOut); + fwrite(&pp->q16ang, sizeof(pp->q16ang), 1, DemoFileOut); } fwrite(&Skill, sizeof(Skill), 1, DemoFileOut); @@ -252,7 +252,7 @@ DemoReadHeader(void) //pp->cursectnum = 0; //updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum); DREAD(&pp->Flags, sizeof(pp->Flags), 1, DemoFileIn); - DREAD(&pp->pang, sizeof(pp->pang), 1, DemoFileIn); + DREAD(&pp->q16ang, sizeof(pp->q16ang), 1, DemoFileIn); } DREAD(&Skill, sizeof(Skill), 1, DemoFileIn); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 30c7cc1df..927c53e3d 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -886,7 +886,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror) } tsp->z = tsp->z + pp->siz; - tsp->ang = pp->siang; + tsp->ang = fix16_to_int(pp->siang); //continue; } else @@ -1093,7 +1093,7 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1 *vz = pp->posz; *vsectnum = pp->cursectnum; - *ang = pp->pang + pp->view_outside_dang; + *ang = fix16_to_int(pp->q16ang) + pp->view_outside_dang; nx = sintable[NORM_ANGLE(*ang + 512 + 1024)] << 11; ny = sintable[NORM_ANGLE(*ang + 1024)] << 11; @@ -1141,7 +1141,7 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1 void -BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz) +BackView(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz) { vec3_t n = { *nx, *ny, *nz }; SPRITEp sp; @@ -1260,7 +1260,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz) } void -CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz) +CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz) { vec3_t n = { *nx, *ny, *nz }; SPRITEp sp; @@ -1397,7 +1397,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", (int32_t)pp->pang); + out.AppendFormat("ANG:%d\n", (int32_t)fix16_to_int(pp->q16ang)); return out; } @@ -1576,7 +1576,7 @@ void DrawCrosshair(PLAYERp pp) } -void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, short *tang, int *thoriz) +void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, int *tang, int *thoriz) { int i,nexti; short ang; @@ -1865,7 +1865,7 @@ void PreDrawStackedWater(void) } -void FAF_DrawRooms(int x, int y, int z, short ang, fix16_t q16horiz, short sectnum) +void FAF_DrawRooms(int x, int y, int z, fix16_t q16ang, fix16_t q16horiz, short sectnum) { short i,nexti; @@ -1892,7 +1892,7 @@ void FAF_DrawRooms(int x, int y, int z, short ang, fix16_t q16horiz, short sectn } } - renderDrawRoomsQ16(x,y,z,fix16_from_int(ang),q16horiz,sectnum); + renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum); TRAVERSE_SPRITE_STAT(headspritestat[STAT_CEILING_FLOOR_PIC_OVERRIDE], i, nexti) { @@ -1930,9 +1930,9 @@ void drawscreen(PLAYERp pp) { extern SWBOOL DemoMode,CameraTestMode; - int tx, ty, tz,tinthoriz; - fix16_t tq16horiz; - short tang,tsectnum; + int tx, ty, tz, tinthoriz, tintang; + fix16_t tq16horiz, tq16ang; + short tsectnum; short i,j; int bob_amt = 0; int quake_z, quake_x, quake_y; @@ -2013,7 +2013,7 @@ drawscreen(PLAYERp pp) tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio); ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio); tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio); - tang = camerapp->oang + mulscale16(((camerapp->pang + 1024 - camerapp->oang) & 2047) - 1024, smoothratio); + tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio); tsectnum = camerapp->cursectnum; @@ -2048,21 +2048,21 @@ drawscreen(PLAYERp pp) pp->six = tx; pp->siy = ty; pp->siz = tz - pp->posz; - pp->siang = tang; + pp->siang = tq16ang; if (pp->sop_riding || pp->sop_control) { tx = pp->posx; ty = pp->posy; tz = pp->posz; - tang = pp->pang; + tq16ang = pp->q16ang; tsectnum = pp->cursectnum; updatesectorz(tx, ty, tz, &tsectnum); pp->six = tx; pp->siy = ty; pp->siz = tz - pp->posz; - pp->siang = tang; + pp->siang = tq16ang; } QuakeViewChange(camerapp, &quake_z, &quake_x, &quake_y, &quake_ang); @@ -2071,20 +2071,21 @@ drawscreen(PLAYERp pp) tx = tx + quake_x; ty = ty + quake_y; //tq16horiz = tq16horiz + fix16_from_int(quake_x); - tang = NORM_ANGLE(tang + quake_ang); + tq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(tq16ang) + quake_ang)); if (pp->sop_remote) { if (TEST_BOOL1(pp->remote_sprite)) - tang = pp->remote_sprite->ang; + tq16ang = fix16_from_int(pp->remote_sprite->ang); else - tang = getangle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty); + tq16ang = fix16_from_int(getangle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty)); } //if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE)) if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { - BackView(&tx, &ty, &tz, &tsectnum, &tang, fix16_to_int(tq16horiz)); + tintang = fix16_to_int(tq16ang); + BackView(&tx, &ty, &tz, &tsectnum, &tintang, fix16_to_int(tq16horiz)); } else { @@ -2093,7 +2094,8 @@ drawscreen(PLAYERp pp) if (DemoMode || CameraTestMode) { tinthoriz = fix16_to_int(tq16horiz); - CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &tinthoriz); + tintang = fix16_to_int(tq16ang); + CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tintang, &tinthoriz); } } @@ -2126,18 +2128,18 @@ drawscreen(PLAYERp pp) screen->BeginScene(); OverlapDraw = TRUE; - DrawOverlapRoom(tx, ty, tz, tang, tq16horiz, tsectnum); + DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum); OverlapDraw = FALSE; if (dimensionmode != 6)// && !ScreenSavePic) { // TEST this! Changed to camerapp - //JS_DrawMirrors(camerapp, tx, ty, tz, tang, tq16horiz); - JS_DrawMirrors(pp, tx, ty, tz, tang, tq16horiz); + //JS_DrawMirrors(camerapp, tx, ty, tz, tq16ang, tq16horiz); + JS_DrawMirrors(pp, tx, ty, tz, tq16ang, tq16horiz); } if (dimensionmode != 6 && !FAF_DebugView) - FAF_DrawRooms(tx, ty, tz, tang, tq16horiz, tsectnum); + FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum); analyzesprites(tx, ty, tz, FALSE); post_analyzesprites(); @@ -2213,11 +2215,11 @@ drawscreen(PLAYERp pp) { // only clear the actual window. twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, windowxy2.x - windowxy1.x, windowxy2.y - windowxy1.y, 0xff000000); - renderDrawMapView(tx, ty, zoom, tang); + renderDrawMapView(tx, ty, zoom, fix16_to_int(tq16ang)); } // Draw the line map on top of texture 2d map or just stand alone - drawoverheadmap(tx, ty, zoom, tang); + drawoverheadmap(tx, ty, zoom, fix16_to_int(tq16ang)); } for (j = 0; j < MAXSPRITES; j++) @@ -2347,7 +2349,7 @@ DrawCompass(PLAYERp pp) if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek) return; - ang = pp->pang; + ang = fix16_to_int(pp->q16ang); if (pp->sop_remote) ang = 0; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 2f7afcfaf..ecf281ad1 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -588,7 +588,8 @@ void TerminateGame(void) bool LoadLevel(const char *filename) { - if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &Player[0].pang, &Player[0].cursectnum) == -1) + int16_t q16ang = fix16_to_int(Player[0].q16ang); + if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &q16ang, &Player[0].cursectnum) == -1) { Printf("Level not found: %s", filename); return false; @@ -2718,7 +2719,7 @@ void ManualPlayerInsert(PLAYERp pp) npp->posx = pp->posx; npp->posy = pp->posy; npp->posz = pp->posz; - npp->pang = pp->pang; + npp->q16ang = pp->q16ang; npp->cursectnum = pp->cursectnum; myconnectindex = numplayers; @@ -2748,7 +2749,7 @@ void BotPlayerInsert(PLAYERp pp) npp->posx = pp->posx; npp->posy = pp->posy; npp->posz = pp->posz-Z(100); - npp->pang = pp->pang; + npp->q16ang = pp->q16ang; npp->cursectnum = pp->cursectnum; //myconnectindex = numplayers; @@ -3090,8 +3091,8 @@ void getinput(SW_PACKET *loc) info.dz = (info.dz * move_scale)>>8; info.dyaw = (info.dyaw * turn_scale)>>8; - int32_t svel = 0, vel = 0, angvel = 0; - fix16_t q16horz = 0; + int32_t svel = 0, vel = 0; + fix16_t q16horz, q16avel = 0; if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop) { @@ -3100,8 +3101,8 @@ void getinput(SW_PACKET *loc) } else { - angvel = info.mousex / 32; - angvel += info.dyaw * (turnamount << 1) / analogExtent; + q16avel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(32)); + q16avel += fix16_from_int(info.dyaw) / analogExtent * (turnamount << 1); } if (mouseaim) @@ -3129,17 +3130,17 @@ void getinput(SW_PACKET *loc) { turnheldtime += synctics; if (turnheldtime >= TURBOTURNTIME) - angvel -= turnamount; + q16avel -= fix16_from_int(turnamount); else - angvel -= PREAMBLETURN; + q16avel -= fix16_from_int(PREAMBLETURN); } else if (buttonMap.ButtonDown(gamefunc_Turn_Right)) { turnheldtime += synctics; if (turnheldtime >= TURBOTURNTIME) - angvel += turnamount; + q16avel += fix16_from_int(turnamount); else - angvel += PREAMBLETURN; + q16avel += fix16_from_int(PREAMBLETURN); } else { @@ -3171,18 +3172,18 @@ void getinput(SW_PACKET *loc) vel = clamp(vel, -MAXVEL, MAXVEL); svel = clamp(svel, -MAXSVEL, MAXSVEL); - angvel = clamp(angvel, -MAXANGVEL, MAXANGVEL); + q16avel = fix16_clamp(q16avel, -fix16_from_int(MAXANGVEL), fix16_from_int(MAXANGVEL)); q16horz = fix16_clamp(q16horz, -fix16_from_int(MAXHORIZVEL), fix16_from_int(MAXHORIZVEL)); - momx = mulscale9(vel, sintable[NORM_ANGLE(newpp->pang + 512)]); - momy = mulscale9(vel, sintable[NORM_ANGLE(newpp->pang)]); + momx = mulscale9(vel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang) + 512)]); + momy = mulscale9(vel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang))]); - momx += mulscale9(svel, sintable[NORM_ANGLE(newpp->pang)]); - momy += mulscale9(svel, sintable[NORM_ANGLE(newpp->pang + 1536)]); + momx += mulscale9(svel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang))]); + momy += mulscale9(svel, sintable[NORM_ANGLE(fix16_to_int(newpp->q16ang) + 1536)]); loc->vel = momx; loc->svel = momy; - loc->angvel = angvel; + loc->q16avel = q16avel; loc->q16horz = q16horz; if (!CommEnabled) diff --git a/source/sw/src/game.h b/source/sw/src/game.h index f3ceaae21..3054389fb 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -477,11 +477,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) (labs(GetDeltaAngle((sp)->ang, NORM_ANGLE(getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y)))) < 512) -#define PLAYER_FACING(pp,sp) (labs(GetDeltaAngle((pp)->pang, NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < 320) +#define PLAYER_FACING(pp,sp) (labs(GetDeltaAngle(fix16_to_int((pp)->q16ang), NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < 320) #define FACING(sp1,sp2) (labs(GetDeltaAngle((sp2)->ang, NORM_ANGLE(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y)))) < 512) #define FACING_PLAYER_RANGE(pp,sp,range) (labs(GetDeltaAngle((sp)->ang, NORM_ANGLE(getangle((pp)->posx - (sp)->x, (pp)->posy - (sp)->y)))) < (range)) -#define PLAYER_FACING_RANGE(pp,sp,range) (labs(GetDeltaAngle((pp)->pang, NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < (range)) +#define PLAYER_FACING_RANGE(pp,sp,range) (labs(GetDeltaAngle(fix16_to_int((pp)->q16ang), NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < (range)) #define FACING_RANGE(sp1,sp2,range) (labs(GetDeltaAngle((sp2)->ang, NORM_ANGLE(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y)))) < (range)) // two vectors @@ -995,8 +995,7 @@ typedef struct { int16_t vel; int16_t svel; - int8_t angvel; - fix16_t q16horz; + fix16_t q16horz, q16avel; int32_t bits; } SW_PACKET; @@ -1030,8 +1029,7 @@ struct PLAYERstruct // interpolation int oposx, oposy, oposz; - short oang; - fix16_t oq16horiz; + fix16_t oq16horiz, oq16ang; // holds last valid move position short lv_sectnum; @@ -1055,7 +1053,7 @@ struct PLAYERstruct int camera_dist; // view mode dist int circle_camera_dist; int six,siy,siz; // save player interp position for PlayerSprite - short siang; + fix16_t siang; int xvect, yvect; int oxvect, oyvect; @@ -1077,12 +1075,12 @@ struct PLAYERstruct short circle_camera_ang; short camera_check_time_delay; - short pang,cursectnum,lastcursectnum; + short cursectnum,lastcursectnum; short turn180_target; // 180 degree turn // variables that do not fit into sprite structure int hvel,tilt,tilt_dest; - fix16_t q16horiz, q16horizbase, q16horizoff; + fix16_t q16horiz, q16horizbase, q16horizoff, q16ang; short recoil_amt; short recoil_speed; short recoil_ndx; @@ -2363,7 +2361,7 @@ void ScreenCaptureKeys(void); // draw.c int minigametext(int x,int y,const char *t,short dabits); // jplayer.c void computergetinput(int snum,SW_PACKET *syn); // jplayer.c -void DrawOverlapRoom(int tx,int ty,int tz,short tang,fix16_t tq16horiz,short tsectnum); // rooms.c +void DrawOverlapRoom(int tx,int ty,int tz,fix16_t tq16ang,fix16_t tq16horiz,short tsectnum); // rooms.c void SetupMirrorTiles(void); // rooms.c SWBOOL FAF_Sector(short sectnum); // rooms.c int GetZadjustment(short sectnum,short hitag); // rooms.c diff --git a/source/sw/src/jplayer.cpp b/source/sw/src/jplayer.cpp index 2dfea004d..46e49508d 100644 --- a/source/sw/src/jplayer.cpp +++ b/source/sw/src/jplayer.cpp @@ -437,13 +437,13 @@ void computergetinput(int snum, SW_PACKET *syn) myx = p->posx; myy = p->posy; myz = p->posz; - myang = p->pang; + myang = fix16_to_int(p->q16ang); mycursectnum = p->cursectnum; // Reset input bits syn->vel = 0; syn->svel = 0; - syn->angvel = 0; + syn->q16avel = 0; syn->q16horz = 0; syn->bits = 0; @@ -451,7 +451,7 @@ void computergetinput(int snum, SW_PACKET *syn) y1 = p->posy; z1 = p->posz; - damyang = p->pang; + damyang = fix16_to_int(p->q16ang); damysect = sprite[p->PlayerSprite].sectnum; if ((numplayers >= 2) && (snum == myconnectindex)) { x1 = myx; y1 = myy; z1 = myz+PLAYER_HEIGHT; damyang = myang; damysect = mycursectnum; } @@ -648,9 +648,9 @@ void computergetinput(int snum, SW_PACKET *syn) daang = NORM_ANGLE((daang-64) + STD_RANDOM_RANGE(128)); // Below formula fails in certain cases - //syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL); //was 127 - p->pang = daang; - syn->q16horz = min(max((zang-fix16_to_int(p->q16horiz))>>1,-PLAYER_HORIZ_MAX),PLAYER_HORIZ_MAX); + //syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL)); //was 127 + p->q16ang = fix16_from_int(daang); + syn->q16horz = fix16_from_int(min(max((zang-fix16_to_int(p->q16horiz))>>1,-PLAYER_HORIZ_MAX),PLAYER_HORIZ_MAX)); // Sets type of aiming, auto aim for bots syn->bits |= (1<vel += (x2-x1)*2047/dist; syn->svel += (y2-y1)*2047/dist; - syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL); + syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL)); } else goalsprite[snum] = -1; @@ -869,7 +869,7 @@ void computergetinput(int snum, SW_PACKET *syn) daang = ((getangle(wall[wall[goalwall[snum]].point2].x-wall[goalwall[snum]].x,wall[wall[goalwall[snum]].point2].y-wall[goalwall[snum]].y)+1536)&2047); syn->vel += (x2-x1)*2047/dist; syn->svel += (y2-y1)*2047/dist; - syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL); + syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL)); } @@ -890,7 +890,7 @@ void computergetinput(int snum, SW_PACKET *syn) daang = ((getangle(wall[wall[goalwall[snum]].point2].x-wall[goalwall[snum]].x,wall[wall[goalwall[snum]].point2].y-wall[goalwall[snum]].y)+1536)&2047); syn->vel += (x2-x1)*2047/dist; syn->svel += (y2-y1)*2047/dist; - syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL); + syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL)); } */ } diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 479af6cfa..7c3b41fb4 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -714,7 +714,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz) } } -void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq16horiz) +void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16_t tpq16horiz) { int j, cnt; int dist; @@ -752,7 +752,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq // 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); -// tpang = pp->oang + mulscale16(((pp->pang + 1024 - pp->oang) & 2047) - 1024, smoothratio); +// tpq16ang = pp->oq16ang + mulscale16(((pp->q16ang + fix16_from_int(1024) - pp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); dist = 0x7fffffff; @@ -849,7 +849,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq if (mirror[cnt].campic != -1) tileDelete(mirror[cnt].campic); - renderDrawRoomsQ16(dx, dy, dz, fix16_from_int(tpang), tpq16horiz, sp->sectnum + MAXSECTORS); + renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS); analyzesprites(dx, dy, dz, FALSE); renderDrawMasks(); } @@ -863,7 +863,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq // Must call preparemirror before drawrooms and // completemirror after drawrooms - renderPrepareMirror(tx, ty, tz, fix16_from_int(tpang), tpq16horiz, + renderPrepareMirror(tx, ty, tz, tpq16ang, tpq16horiz, mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang); renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS); @@ -879,7 +879,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq // g_visibility = tvisibility; // g_visibility = NormalVisibility; - // renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tpang), tpq16horiz, pp->cursectnum); + // renderDrawRoomsQ16(tx, ty, tz, tpq16ang, tpq16horiz, pp->cursectnum); // Clean up anything that the camera view might have done SetFragBar(pp); tileDelete(MIRROR); diff --git a/source/sw/src/jsector.h b/source/sw/src/jsector.h index 4e3075d61..71e660bab 100644 --- a/source/sw/src/jsector.h +++ b/source/sw/src/jsector.h @@ -72,7 +72,7 @@ extern short NormalVisibility; void JAnalyzeSprites(tspriteptr_t tspr); void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz); -void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,fix16_t tpq16horiz); +void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,fix16_t tpq16ang,fix16_t tpq16horiz); void JS_InitMirrors(void); void JS_InitLockouts(void); void JS_ToggleLockouts(void); diff --git a/source/sw/src/jweapon.cpp b/source/sw/src/jweapon.cpp index a12a7a08d..195ce5e3a 100644 --- a/source/sw/src/jweapon.cpp +++ b/source/sw/src/jweapon.cpp @@ -1393,7 +1393,7 @@ PlayerInitChemBomb(PLAYERp pp) // Spawn a shot // Inserting and setting up variables w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum, - nx, ny, nz, pp->pang, CHEMBOMB_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), CHEMBOMB_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -1837,7 +1837,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, pp->pang, (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2); + nx, ny, nz, fix16_to_int(pp->q16ang), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2); wp = &sprite[w]; wu = User[w]; @@ -1865,7 +1865,7 @@ PlayerInitCaltrops(PLAYERp pp) SET(wu->Flags, SPR_UNDERWATER); // They go out at different angles -// wp->ang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25)); +// wp->ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25)); wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT); diff --git a/source/sw/src/mclip.cpp b/source/sw/src/mclip.cpp index 056181211..959827838 100644 --- a/source/sw/src/mclip.cpp +++ b/source/sw/src/mclip.cpp @@ -58,7 +58,7 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist) for (i = 0; i < sop->clipbox_num; i++) { - ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]); + ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]); ox[i] = x[i] = pp->posx + (sop->clipbox_vdist[i] * sintable[NORM_ANGLE(ang + 512)] >> 14); oy[i] = y[i] = pp->posy + (sop->clipbox_vdist[i] * sintable[ang] >> 14); @@ -102,7 +102,7 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist) for (i = 0; i < sop->clipbox_num; i++) { - ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]); + ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]); ox[i] = x[i] = pp->posx + (sop->clipbox_vdist[i] * sintable[NORM_ANGLE(ang + 512)] >> 14); oy[i] = y[i] = pp->posy + (sop->clipbox_vdist[i] * sintable[ang] >> 14); @@ -153,7 +153,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(pp->pang + sop->clipbox_ang[i]); + ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]); xs = pp->posx; ys = pp->posy; @@ -219,7 +219,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(pp->pang + sop->clipbox_ang[i]); + ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]); xs = pp->posx; ys = pp->posy; @@ -300,7 +300,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(pp->pang + sop->clipbox_ang[i]); + ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]); xs = pp->posx; ys = pp->posy; diff --git a/source/sw/src/network.cpp b/source/sw/src/network.cpp index e52faab59..b27a49398 100644 --- a/source/sw/src/network.cpp +++ b/source/sw/src/network.cpp @@ -104,8 +104,7 @@ typedef struct { int32_t vel; int32_t svel; - int32_t angvel; - fix16_t q16horz; + fix16_t q16horz, q16avel; int32_t bits; } SW_AVERAGE_PACKET; @@ -296,17 +295,17 @@ int EncodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf) SET(*base_ptr, BIT(1)); } - if (pak->angvel != old_pak->angvel) + if (pak->q16avel != old_pak->q16avel) { - *((char *)buf) = pak->angvel; - buf += sizeof(pak->angvel); + *((char *)buf) = pak->q16avel; + buf += sizeof(pak->q16avel); SET(*base_ptr, BIT(2)); } if (pak->q16horz != old_pak->q16horz) { - *((char *)buf) = fix16_to_int(pak->q16horz); - buf += sizeof(fix16_to_int(pak->q16horz)); + *((char *)buf) = pak->q16horz; + buf += sizeof(pak->q16horz); SET(*base_ptr, BIT(3)); } @@ -348,14 +347,14 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf) if (TEST(*base_ptr, BIT(2))) { - pak->angvel = *(char *)buf; - buf += sizeof(pak->angvel); + pak->q16avel = *(char *)buf; + buf += sizeof(pak->q16avel); } if (TEST(*base_ptr, BIT(3))) { - pak->q16horz = fix16_from_int(*(char *)buf); - buf += sizeof(fix16_to_int(pak->q16horz)); + pak->q16horz = *(char *)buf; + buf += sizeof(pak->q16horz); } //won't work if > 4 bytes @@ -937,7 +936,7 @@ faketimerhandler(void) AveragePacket.vel += loc.vel; AveragePacket.svel += loc.svel; - AveragePacket.angvel += loc.angvel; + AveragePacket.q16avel += loc.q16avel; AveragePacket.q16horz += loc.q16horz; SET(AveragePacket.bits, loc.bits); @@ -955,8 +954,8 @@ faketimerhandler(void) loc.vel = AveragePacket.vel / MovesPerPacket; loc.svel = AveragePacket.svel / MovesPerPacket; - loc.angvel = AveragePacket.angvel / MovesPerPacket; - loc.q16horz = AveragePacket.q16horz / MovesPerPacket; + loc.q16avel = AveragePacket.q16avel / fix16_from_int(MovesPerPacket); + loc.q16horz = AveragePacket.q16horz / fix16_from_int(MovesPerPacket); loc.bits = AveragePacket.bits; memset(&AveragePacket, 0, sizeof(AveragePacket)); diff --git a/source/sw/src/ninja.cpp b/source/sw/src/ninja.cpp index 52a506c2f..c878c705a 100644 --- a/source/sw/src/ninja.cpp +++ b/source/sw/src/ninja.cpp @@ -2406,7 +2406,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, pp->pang, 0); + pp->posy, pp->posz, fix16_to_int(pp->q16ang), 50); pp->SpriteP = sp = &sprite[sp_num]; pp->pnum = pnum; @@ -2483,7 +2483,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, pp->pang, 0); + NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0); sp = &sprite[sp_num]; u = User[sp_num]; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 38368f329..59469e718 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1229,7 +1229,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets) angle2 = NORM_ANGLE(getangle(ep->x - sp->x, ep->y - sp->y)); // Get the angle difference - // delta_ang = labs(pp->pang - angle2); + // delta_ang = labs(fix16_to_int(pp->q16ang) - angle2); delta_ang = labs(GetDeltaAngle(sp->ang, angle2)); @@ -1333,7 +1333,7 @@ DoPlayerTeleportPause(PLAYERp pp) void DoPlayerTeleportToSprite(PLAYERp pp, SPRITEp sp) { - pp->pang = pp->oang = sp->ang; + pp->q16ang = pp->q16ang = fix16_from_int(sp->ang); pp->posx = pp->oposx = pp->oldposx = sp->x; pp->posy = pp->oposy = pp->oldposy = sp->y; @@ -1553,12 +1553,12 @@ DoPlayerTurn(PLAYERp pp) FLAG_KEY_RELEASE(pp, SK_TURN_180); - pp->turn180_target = NORM_ANGLE(pp->pang + 1024); + pp->turn180_target = NORM_ANGLE(fix16_to_int(pp->q16ang) + 1024); // make the first turn in the clockwise direction // the rest will follow - delta_ang = GetDeltaAngle(pp->turn180_target, pp->pang); - pp->pang = NORM_ANGLE(pp->pang + (labs(delta_ang) >> TURN_SHIFT)); + delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(pp->q16ang)); + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + (labs(delta_ang) >> TURN_SHIFT))); SET(pp->Flags, PF_TURN_180); } @@ -1573,47 +1573,47 @@ DoPlayerTurn(PLAYERp pp) { short delta_ang; - delta_ang = GetDeltaAngle(pp->turn180_target, pp->pang); - pp->pang = NORM_ANGLE(pp->pang + (delta_ang >> TURN_SHIFT)); + delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(pp->q16ang)); + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + (delta_ang >> TURN_SHIFT))); - sprite[pp->PlayerSprite].ang = pp->pang; + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); if (!Prediction) { if (pp->PlayerUnderSprite >= 0) - sprite[pp->PlayerUnderSprite].ang = pp->pang; + sprite[pp->PlayerUnderSprite].ang = fix16_to_int(pp->q16ang); } // get new delta to see how close we are - delta_ang = GetDeltaAngle(pp->turn180_target, pp->pang); + delta_ang = GetDeltaAngle(pp->turn180_target, fix16_to_int(pp->q16ang)); if (labs(delta_ang) < (3<pang = pp->turn180_target; + pp->q16ang = fix16_from_int(pp->turn180_target); RESET(pp->Flags, PF_TURN_180); } else return; } - angvel = pp->input.angvel * PLAYER_TURN_SCALE; + angvel = fix16_to_int(pp->input.q16avel) * PLAYER_TURN_SCALE; if (angvel != 0) { // running is not handled here now angvel += DIV4(angvel); - pp->pang += DIV32(angvel * synctics); - pp->pang = NORM_ANGLE(pp->pang); + pp->q16ang += fix16_from_int(DIV32(angvel * synctics)); + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang))); // update players sprite angle // NOTE: It's also updated in UpdatePlayerSprite, but needs to be // here to cover // all cases. - sprite[pp->PlayerSprite].ang = pp->pang; + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); if (!Prediction) { if (pp->PlayerUnderSprite >= 0) - sprite[pp->PlayerUnderSprite].ang = pp->pang; + sprite[pp->PlayerUnderSprite].ang = fix16_to_int(pp->q16ang); } } @@ -1629,7 +1629,7 @@ DoPlayerTurnBoat(PLAYERp pp) if (sop->drive_angspeed) { pp->drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(pp->input.angvel, sop->drive_angspeed); + pp->drive_angvel = mulscale16(fix16_to_int(pp->input.q16avel), sop->drive_angspeed); angslide = sop->drive_angslide; pp->drive_angvel = (pp->drive_angvel + (pp->drive_oangvel*(angslide-1)))/angslide; @@ -1638,15 +1638,15 @@ DoPlayerTurnBoat(PLAYERp pp) } else { - angvel = pp->input.angvel * PLAYER_TURN_SCALE; + angvel = fix16_to_int(pp->input.q16avel) * PLAYER_TURN_SCALE; angvel += angvel - DIV4(angvel); angvel = DIV32(angvel * synctics); } if (angvel != 0) { - pp->pang = NORM_ANGLE(pp->pang + angvel); - sprite[pp->PlayerSprite].ang = pp->pang; + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel)); + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); } } @@ -1661,7 +1661,7 @@ DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) int angslide; pp->drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(pp->input.angvel, sop->drive_angspeed); + pp->drive_angvel = mulscale16(fix16_to_int(pp->input.q16avel), sop->drive_angspeed); angslide = sop->drive_angslide; pp->drive_angvel = (pp->drive_angvel + (pp->drive_oangvel*(angslide-1)))/angslide; @@ -1670,15 +1670,15 @@ DoPlayerTurnTank(PLAYERp pp, int z, int floor_dist) } else { - angvel = DIV8(pp->input.angvel * synctics); + angvel = DIV8(fix16_to_int(pp->input.q16avel) * synctics); } if (angvel != 0) { - if (MultiClipTurn(pp, NORM_ANGLE(pp->pang + angvel), z, floor_dist)) + if (MultiClipTurn(pp, NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel), z, floor_dist)) { - pp->pang = NORM_ANGLE(pp->pang + angvel); - sprite[pp->PlayerSprite].ang = pp->pang; + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel)); + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); } } } @@ -1694,7 +1694,7 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) int angslide; pp->drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(pp->input.angvel, sop->drive_angspeed); + pp->drive_angvel = mulscale16(fix16_to_int(pp->input.q16avel), sop->drive_angspeed); angslide = sop->drive_angslide; pp->drive_angvel = (pp->drive_angvel + (pp->drive_oangvel*(angslide-1)))/angslide; @@ -1703,15 +1703,15 @@ DoPlayerTurnTankRect(PLAYERp pp, int *x, int *y, int *ox, int *oy) } else { - angvel = DIV8(pp->input.angvel * synctics); + angvel = DIV8(fix16_to_int(pp->input.q16avel) * synctics); } if (angvel != 0) { - if (RectClipTurn(pp, NORM_ANGLE(pp->pang + angvel), x, y, ox, oy)) + if (RectClipTurn(pp, NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel), x, y, ox, oy)) { - pp->pang = NORM_ANGLE(pp->pang + angvel); - sprite[pp->PlayerSprite].ang = pp->pang; + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel)); + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); } } } @@ -1732,9 +1732,9 @@ DoPlayerTurnTurret(PLAYERp pp) fifo_ndx = (movefifoplc-2) & (MOVEFIFOSIZ - 1); last_input = pp->inputfifo[fifo_ndx]; - if (pp->input.angvel && !last_input.angvel) + if (pp->input.q16avel && !last_input.q16avel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); - else if (!pp->input.angvel && last_input.angvel) + else if (!pp->input.q16avel && last_input.q16avel) PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); } @@ -1743,7 +1743,7 @@ DoPlayerTurnTurret(PLAYERp pp) int angslide; pp->drive_oangvel = pp->drive_angvel; - pp->drive_angvel = mulscale16(pp->input.angvel, sop->drive_angspeed); + pp->drive_angvel = mulscale16(fix16_to_int(pp->input.q16avel), sop->drive_angspeed); angslide = sop->drive_angslide; pp->drive_angvel = (pp->drive_angvel + (pp->drive_oangvel*(angslide-1)))/angslide; @@ -1752,12 +1752,12 @@ DoPlayerTurnTurret(PLAYERp pp) } else { - angvel = DIV4(pp->input.angvel * synctics); + angvel = DIV4(fix16_to_int(pp->input.q16avel) * synctics); } if (angvel != 0) { - new_ang = NORM_ANGLE(pp->pang + angvel); + new_ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + angvel); if (sop->limit_ang_center >= 0) { @@ -1773,8 +1773,8 @@ DoPlayerTurnTurret(PLAYERp pp) } } - pp->pang = new_ang; - sprite[pp->PlayerSprite].ang = pp->pang; + pp->q16ang = fix16_from_int(new_ang); + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); } } @@ -1808,8 +1808,8 @@ PlayerAutoLook(PLAYERp pp) 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 - x = pp->posx + (sintable[(pp->pang + 512) & 2047] >> 5); - y = pp->posy + (sintable[pp->pang & 2047] >> 5); + x = pp->posx + (sintable[(fix16_to_int(pp->q16ang) + 512) & 2047] >> 5); + y = pp->posy + (sintable[fix16_to_int(pp->q16ang) & 2047] >> 5); tempsect = pp->cursectnum; COVERupdatesector(x, y, &tempsect); @@ -2147,7 +2147,7 @@ UpdatePlayerSprite(PLAYERp pp) if (TEST(pp->Flags, PF_DEAD)) { changespritesect(pp->PlayerSprite, pp->cursectnum); - sprite[pp->PlayerSprite].ang = pp->pang; + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); UpdatePlayerUnderSprite(pp); return; } @@ -2222,7 +2222,7 @@ UpdatePlayerSprite(PLAYERp pp) UpdatePlayerUnderSprite(pp); - sprite[pp->PlayerSprite].ang = pp->pang; + sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang); } void @@ -2481,11 +2481,11 @@ MoveScrollMode2D(PLAYERp pp) if (mfsvel > MAXSVEL) mfsvel = MAXSVEL; - momx = mulscale9(mfvel, sintable[NORM_ANGLE(pp->pang + 512)]); - momy = mulscale9(mfvel, sintable[NORM_ANGLE(pp->pang)]); + momx = mulscale9(mfvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 512)]); + momy = mulscale9(mfvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]); - momx += mulscale9(mfsvel, sintable[NORM_ANGLE(pp->pang)]); - momy += mulscale9(mfsvel, sintable[NORM_ANGLE(pp->pang + 1536)]); + momx += mulscale9(mfsvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]); + momy += mulscale9(mfsvel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 1536)]); //mfvel = momx; //mfsvel = momy; @@ -2845,13 +2845,13 @@ DoPlayerMoveBoat(PLAYERp pp) z = pp->posz + Z(10); save_sectnum = pp->cursectnum; - OperateSectorObject(pp->sop, pp->pang, MAXSO, MAXSO); + OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), 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, pp->pang, pp->posx, pp->posy); + OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed DoPlayerHorizon(pp); @@ -2884,7 +2884,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(pp->pang+512)], sintable[pp->pang]); + dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang)+512)], sintable[fix16_to_int(pp->q16ang)]); if (dot < 0) reverse = TRUE; @@ -3024,7 +3024,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) return; // not moving - don't crush - if ((pp->xvect|pp->yvect) == 0 && pp->input.angvel == 0) + if ((pp->xvect|pp->yvect) == 0 && pp->input.q16avel == 0) return; // main sector @@ -3130,7 +3130,7 @@ DriveCrush(PLAYERp pp, int *x, int *y) continue; damage = -(u->Health + 100); - PlayerDamageSlide(u->PlayerP, damage, pp->pang); + PlayerDamageSlide(u->PlayerP, damage, fix16_to_int(pp->q16ang)); PlayerUpdateHealth(u->PlayerP, damage); //PlayerCheckDeath(u->PlayerP, -1); PlayerCheckDeath(u->PlayerP, pp->PlayerSprite); @@ -3265,7 +3265,7 @@ DoPlayerMoveTank(PLAYERp pp) } save_sectnum = pp->cursectnum; - OperateSectorObject(pp->sop, pp->pang, MAXSO, MAXSO); + OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), MAXSO, MAXSO); pp->cursectnum = pp->sop->op_main_sector; // for speed floor_dist = labs(z - pp->sop->floor_loz); @@ -3295,7 +3295,7 @@ DoPlayerMoveTank(PLAYERp pp) hitscan(&hit_pos, pp->cursectnum, //pp->xvect, pp->yvect, 0, - MOVEx(256, pp->pang), MOVEy(256, pp->pang), 0, + MOVEx(256, fix16_to_int(pp->q16ang)), MOVEy(256, fix16_to_int(pp->q16ang)), 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); @@ -3362,7 +3362,7 @@ DoPlayerMoveTank(PLAYERp pp) } } - OperateSectorObject(pp->sop, pp->pang, pp->posx, pp->posy); + OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->posx, pp->posy); pp->cursectnum = save_sectnum; // for speed DoPlayerHorizon(pp); @@ -3380,7 +3380,7 @@ DoPlayerMoveTurret(PLAYERp pp) else SET(pp->Flags, PF_PLAYER_MOVED); - OperateSectorObject(pp->sop, pp->pang, pp->sop->xmid, pp->sop->ymid); + OperateSectorObject(pp->sop, fix16_to_int(pp->q16ang), pp->sop->xmid, pp->sop->ymid); DoPlayerHorizon(pp); } @@ -3809,7 +3809,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(pp->pang+512)], sintable[pp->pang]); + dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang)+512)], sintable[fix16_to_int(pp->q16ang)]); if (dot < 0) climbvel = -climbvel; @@ -3979,7 +3979,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, pp->pang, + pp->cursectnum, fix16_to_int(pp->q16ang), &sec, &wal, &spr, &dist, 800L, NTAG_SEARCH_LO_HI, NULL); @@ -4004,7 +4004,7 @@ DoPlayerClimb(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->pang = pp->LadderAngle; + pp->q16ang = fix16_from_int(pp->LadderAngle); } } } @@ -4024,8 +4024,8 @@ DoPlayerWadeSuperJump(PLAYERp pp) for (i = 0; i < SIZ(angs); i++) { FAFhitscan(pp->posx, pp->posy, zh, pp->cursectnum, // Start position - sintable[NORM_ANGLE(pp->pang + angs[i] + 512)], // X vector of 3D ang - sintable[NORM_ANGLE(pp->pang + angs[i])], // Y vector of 3D ang + sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + angs[i] + 512)], // X vector of 3D ang + sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + angs[i])], // Y vector of 3D ang 0, // Z vector of 3D ang &hitinfo, CLIPMASK_MISSILE); @@ -4463,11 +4463,11 @@ PlayerOnLadder(PLAYERp pp) if (Prediction) return 0; - neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, pp->pang, + neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, fix16_to_int(pp->q16ang), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1024L+768L, NTAG_SEARCH_LO_HI, NULL); - dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->pang+512)], sintable[pp->pang]); + dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang)+512)], sintable[fix16_to_int(pp->q16ang)]); if (dir < 0) return FALSE; @@ -4477,7 +4477,7 @@ PlayerOnLadder(PLAYERp pp) for (i = 0; i < SIZ(angles); i++) { - neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, NORM_ANGLE(pp->pang + angles[i]), + neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, NORM_ANGLE(fix16_to_int(pp->q16ang) + angles[i]), &sec, &wal, &spr, &dist, 600L, NTAG_SEARCH_LO_HI, NULL); @@ -4485,8 +4485,8 @@ PlayerOnLadder(PLAYERp pp) return FALSE; FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, - sintable[NORM_ANGLE(pp->pang + angles[i] + 512)], - sintable[NORM_ANGLE(pp->pang + angles[i])], + sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + angles[i] + 512)], + sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + angles[i])], 0, &hitinfo, CLIPMASK_MISSILE); @@ -4541,7 +4541,7 @@ PlayerOnLadder(PLAYERp pp) pp->lx = lsp->x + nx * 5; pp->ly = lsp->y + ny * 5; - pp->pang = pp->LadderAngle; + pp->q16ang = fix16_from_int(pp->LadderAngle); return TRUE; } @@ -5799,7 +5799,7 @@ DoPlayerBeginOperate(PLAYERp pp) pp->sop = pp->sop_control = sop; sop->controller = pp->SpriteP; - pp->pang = sop->ang; + pp->q16ang = fix16_from_int(sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5834,7 +5834,7 @@ DoPlayerBeginOperate(PLAYERp pp) break; case SO_TURRET_MGUN: case SO_TURRET: - if (pp->input.angvel) + if (pp->input.q16avel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); else PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); @@ -5884,7 +5884,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) save_sectnum = pp->cursectnum; - pp->pang = sop->ang; + pp->q16ang = fix16_from_int(sop->ang); pp->posx = sop->xmid; pp->posy = sop->ymid; COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -5922,7 +5922,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) break; case SO_TURRET_MGUN: case SO_TURRET: - if (pp->input.angvel) + if (pp->input.q16avel) PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND); else PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND); @@ -6013,9 +6013,9 @@ DoPlayerStopOperate(PLAYERp pp) if (pp->sop_remote) { if (TEST_BOOL1(pp->remote_sprite)) - pp->pang = pp->oang = pp->remote_sprite->ang; + pp->q16ang = pp->oq16ang = fix16_from_int(pp->remote_sprite->ang); else - pp->pang = pp->oang = getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy); + pp->q16ang = pp->oq16ang = fix16_from_int(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); } if (pp->sop_control) @@ -6690,7 +6690,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) //DoPlayerDeathTilt(pp, pp->tilt_dest, 4 * synctics); // allow turning - if ((TEST(pp->Flags, PF_DEAD_HEAD) && pp->input.angvel != 0) || TEST(pp->Flags, PF_HEAD_CONTROL)) + if ((TEST(pp->Flags, PF_DEAD_HEAD) && pp->input.q16avel != 0) || TEST(pp->Flags, PF_HEAD_CONTROL)) { DoPlayerTurn(pp); return; @@ -6707,8 +6707,8 @@ void DoPlayerDeathFollowKiller(PLAYERp pp) { ang2 = getangle(kp->x - pp->posx, kp->y - pp->posy); - delta_ang = GetDeltaAngle(ang2, pp->pang); - pp->pang = NORM_ANGLE(pp->pang + (delta_ang >> 4)); + delta_ang = GetDeltaAngle(ang2, fix16_to_int(pp->q16ang)); + pp->q16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(pp->q16ang) + (delta_ang >> 4))); } } } @@ -6748,7 +6748,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 = pp->pang; + pp->SpriteP->ang = fix16_to_int(pp->q16ang); DoSpawnTeleporterEffect(pp->SpriteP); PlaySound(DIGI_TELEPORT, pp, v3df_none); @@ -7451,7 +7451,7 @@ MoveSkipSavePos(void) pp->oposx = pp->posx; pp->oposy = pp->posy; pp->oposz = pp->posz; - pp->oang = pp->pang; + pp->oq16ang = pp->q16ang; pp->oq16horiz = pp->q16horiz; } @@ -7519,7 +7519,7 @@ void ChopsCheck(PLAYERp pp) if (!M_Active() && !HelpInputMode && !TEST(pp->Flags, PF_DEAD) && !pp->sop_riding && numplayers <= 1) { - if ((pp->input.bits|pp->input.vel|pp->input.svel|pp->input.angvel|pp->input.q16horz) || + if ((pp->input.bits|pp->input.vel|pp->input.svel|pp->input.q16avel|pp->input.q16horz) || TEST(pp->Flags, PF_CLIMBING|PF_FALLING|PF_DIVING)) { // Hit a input key or other reason to stop chops @@ -7919,7 +7919,7 @@ domovethings(void) // auto tracking mode for single player multi-game if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) { - Player[screenpeek].pang = getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy); + Player[screenpeek].q16ang = fix16_from_int(getangle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)); } if (!TEST(pp->Flags, PF_DEAD)) @@ -8001,7 +8001,7 @@ InitAllPlayers(void) pp->posx = pp->oposx = pfirst->posx; pp->posy = pp->oposy = pfirst->posy; pp->posz = pp->oposz = pfirst->posz; - pp->pang = pp->oang = pfirst->pang; + pp->q16ang = pp->oq16ang = pfirst->q16ang; pp->q16horiz = pp->oq16horiz = pfirst->q16horiz; pp->cursectnum = pfirst->cursectnum; // set like this so that player can trigger something on start of the level @@ -8153,7 +8153,7 @@ PlayerSpawnPosition(PLAYERp pp) pp->posx = pp->oposx = sp->x; pp->posy = pp->oposy = sp->y; pp->posz = pp->oposz = sp->z; - pp->pang = pp->oang = sp->ang; + pp->q16ang = pp->oq16ang = fix16_from_int(sp->ang); pp->cursectnum = sp->sectnum; getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); @@ -8212,7 +8212,7 @@ InitMultiPlayerInfo(void) continue; } - start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->pang, 0); + start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0); ASSERT(start0 >= 0); if (User[start0]) { diff --git a/source/sw/src/predict.cpp b/source/sw/src/predict.cpp index be6166257..8314f9a30 100644 --- a/source/sw/src/predict.cpp +++ b/source/sw/src/predict.cpp @@ -46,8 +46,8 @@ PLAYERp ppp = &PredictPlayer; typedef struct { int x,y,z; - fix16_t q16horiz; - short ang,filler; + fix16_t q16horiz, q16ang; + short filler; } PREDICT, *PREDICTp; PREDICT Predict[MOVEFIFOSIZ]; @@ -157,7 +157,7 @@ DoPrediction(PLAYERp ppp) u = User[ppp->PlayerSprite]; User[ppp->PlayerSprite] = &PredictUser; - ppp->oang = ppp->pang; + ppp->oq16ang = ppp->q16ang; ppp->oposx = ppp->posx; ppp->oposy = ppp->posy; ppp->oposz = ppp->posz; @@ -179,7 +179,7 @@ DoPrediction(PLAYERp ppp) sprite[Player[myconnectindex].PlayerSprite] = spr; randomseed = bakrandomseed; - Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].ang = ppp->pang; + 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; @@ -199,7 +199,7 @@ CorrectPrediction(int actualfifoplc) return; // see if player position is predicted position - if (predict->ang == Player[myconnectindex].pang && + if (predict->q16ang == Player[myconnectindex].q16ang && predict->x == Player[myconnectindex].posx && predict->y == Player[myconnectindex].posy && predict->z == Player[myconnectindex].posz && @@ -209,7 +209,7 @@ CorrectPrediction(int actualfifoplc) return; } -// //DSPRINTF(ds,"PREDICT ERROR: %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", predict->ang, Player[myconnectindex].pang, predict->x, Player[myconnectindex].posx, predict->y, Player[myconnectindex].posy, predict->z, Player[myconnectindex].posz, fix16_to_int(predict->q16horiz),fix16_to_int(Player[myconnectindex].q16horiz)); +// //DSPRINTF(ds,"PREDICT ERROR: %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld", fix16_to_int(predict->q16ang), fix16_to_int(Player[myconnectindex].q16ang), predict->x, Player[myconnectindex].posx, predict->y, Player[myconnectindex].posy, predict->z, Player[myconnectindex].posz, fix16_to_int(predict->q16horiz),fix16_to_int(Player[myconnectindex].q16horiz)); // MONO_PRINT(ds); InitPrediction(&Player[myconnectindex]); diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index 5a8f9d141..e5dd3447c 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -33,7 +33,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void FAF_DrawRooms(int posx, int posy, int posz, short ang, fix16_t q16horiz, short cursectnum); +void FAF_DrawRooms(int posx, int posy, int posz, fix16_t q16ang, fix16_t q16horiz, short cursectnum); //////////////////////////////////////////////////////////////////// // @@ -1089,7 +1089,7 @@ ViewSectorInScene(short cursectnum, short level) } void -DrawOverlapRoom(int tx, int ty, int tz, short tang, fix16_t tq16horiz, short tsectnum) +DrawOverlapRoom(int tx, int ty, int tz, fix16_t tq16ang, fix16_t tq16horiz, short tsectnum) { short i; short match; @@ -1104,8 +1104,8 @@ DrawOverlapRoom(int tx, int ty, int tz, short tang, fix16_t tq16horiz, short tse if (tsectnum < 0) return; - renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tang), tq16horiz, tsectnum); - //FAF_DrawRooms(tx, ty, tz, tang, tq16horiz, tsectnum); + renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum); + //FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum); // reset Z's for (i = 0; i < save.zcount; i++) @@ -1130,8 +1130,8 @@ DrawOverlapRoom(int tx, int ty, int tz, short tang, fix16_t tq16horiz, short tse if (tsectnum < 0) return; - renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tang), tq16horiz, tsectnum); - //FAF_DrawRooms(tx, ty, tz, ftang, tq16horiz, tsectnum); + renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum); + //FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum); // reset Z's for (i = 0; i < save.zcount; i++) diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 145b3a20b..207bf74d4 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -2339,7 +2339,7 @@ SWBOOL NearThings(PLAYERp pp) return FALSE; } - neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, pp->pang, + neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, fix16_to_int(pp->q16ang), &neartagsect, &neartagwall, &neartagsprite, &neartaghitdist, 1024L, NTAG_SEARCH_LO_HI, NULL); @@ -2373,7 +2373,7 @@ SWBOOL 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 = pp->pang; + short dang = fix16_to_int(pp->q16ang); FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position sintable[NORM_ANGLE(dang + 512)], // X vector of 3D ang @@ -2437,7 +2437,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, pp->pang, + neartag(pp->posx, pp->posy, z, pp->cursectnum, fix16_to_int(pp->q16ang), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, dist, type, NULL); diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index f19e3a01c..fd3cc80b8 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -586,7 +586,7 @@ void DoUpdateSounds(void) PLAYERp pp = Player + screenpeek; SoundListener listener; - listener.angle = -(float)pp->pang * pi::pi() / 1024; // Build uses a period of 2048. + listener.angle = -(float)fix16_to_float(pp->q16ang) * pi::pi() / 1024; // Build uses a period of 2048. listener.velocity.Zero(); listener.position = GetSoundPos((vec3_t*)&pp->posx); listener.underwater = false; diff --git a/source/sw/src/sync.cpp b/source/sw/src/sync.cpp index 6be3ed19e..b52a6129b 100644 --- a/source/sw/src/sync.cpp +++ b/source/sw/src/sync.cpp @@ -76,7 +76,7 @@ PlayerSync(void) updatecrc(crc, pp->posx & 255); updatecrc(crc, pp->posy & 255); updatecrc(crc, pp->posz & 255); - updatecrc(crc, pp->pang & 255); + updatecrc(crc, fix16_to_int(pp->q16ang) & 255); } return (uint8_t) crc & 255; @@ -544,7 +544,7 @@ getsyncbyte() { pp = Player + i; u = User[pp->SpriteP - sprite]; - ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ pp->pang ^ fix16_to_int(pp->q16horiz) ^ u->Health); + ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ fix16_to_int(pp->q16ang) ^ fix16_to_int(pp->q16horiz) ^ u->Health); } for (j = headspritestat[STAT_ENEMY]; j >= 0; j = nextspritestat[j]) diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 67fbfdd0a..bcc0c9c0e 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -788,7 +788,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh) { - pp->RevolveAng = pp->pang; + pp->RevolveAng = fix16_to_int(pp->q16ang); pp->RevolveX = pp->posx; pp->RevolveY = pp->posy; pp->RevolveDeltaAng = 0; @@ -1619,7 +1619,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) { SET(pp->Flags, PF_PLAYER_RIDING); - pp->RevolveAng = pp->pang; + pp->RevolveAng = fix16_to_int(pp->q16ang); pp->RevolveX = pp->posx; pp->RevolveY = pp->posy; @@ -1644,7 +1644,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->RevolveAng = pp->pang; + pp->RevolveAng = fix16_to_int(pp->q16ang); pp->RevolveX = pp->posx; pp->RevolveY = pp->posy; @@ -1660,7 +1660,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->RevolveAng = NORM_ANGLE(pp->pang - pp->RevolveDeltaAng); + pp->RevolveAng = NORM_ANGLE(fix16_to_int(pp->q16ang) - pp->RevolveDeltaAng); } // increment Players delta angle @@ -1674,7 +1674,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 - pp->pang = NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng); + pp->q16ang = fix16_from_int(NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng)); UpdatePlayerSprite(pp); } diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index a85ba93ae..326c08fc3 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -12889,7 +12889,7 @@ InitSpellRing(PLAYERp pp) ang_diff = 2048 / max_missiles; - ang_start = NORM_ANGLE(pp->pang - DIV2(2048)); + ang_start = NORM_ANGLE(fix16_to_int(pp->q16ang) - DIV2(2048)); if (!SW_SHAREWARE) PlaySound(DIGI_RFWIZ, pp, v3df_none); @@ -13448,7 +13448,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), pp->pang, NAPALM_VELOCITY*2); + pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), NAPALM_VELOCITY*2); sp = &sprite[SpriteNum]; u = User[SpriteNum]; @@ -13608,7 +13608,7 @@ InitSpellMirv(PLAYERp pp) return 0; SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursectnum, - pp->posx, pp->posy, pp->posz + Z(12), pp->pang, MIRV_VELOCITY); + pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), MIRV_VELOCITY); sp = &sprite[SpriteNum]; u = User[SpriteNum]; @@ -13723,7 +13723,7 @@ InitSwordAttack(PLAYERp pp) { bp = &sprite[bubble]; - bp->ang = pp->pang; + bp->ang = fix16_to_int(pp->q16ang); random_amt = (RANDOM_P2(32<<8)>>8) - 16; @@ -13772,7 +13772,7 @@ InitSwordAttack(PLAYERp pp) short daang; int daz; - daang = pp->pang; + daang = fix16_to_int(pp->q16ang); daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position @@ -13900,7 +13900,7 @@ InitFistAttack(PLAYERp pp) { bp = &sprite[bubble]; - bp->ang = pp->pang; + bp->ang = fix16_to_int(pp->q16ang); random_amt = (RANDOM_P2(32<<8)>>8) - 16; @@ -13962,7 +13962,7 @@ InitFistAttack(PLAYERp pp) short daang; int daz; - daang = pp->pang; + daang = fix16_to_int(pp->q16ang); daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position @@ -14621,7 +14621,7 @@ InitStar(PLAYERp pp) // Spawn a shot // Inserting and setting up variables - w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, pp->pang, STAR_VELOCITY); + w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, fix16_to_int(pp->q16ang), STAR_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -14744,7 +14744,7 @@ InitHeartAttack(PLAYERp pp) return; SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum, - pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2); + pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), BLOOD_WORM_VELOCITY*2); sp = &sprite[SpriteNum]; u = User[SpriteNum]; @@ -14820,7 +14820,7 @@ InitHeartAttack(PLAYERp pp) return; SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum, - pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2); + pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), BLOOD_WORM_VELOCITY*2); sp = &sprite[SpriteNum]; u = User[SpriteNum]; @@ -14982,7 +14982,7 @@ InitShotgun(PLAYERp pp) else { daz = (100 - fix16_to_int(pp->q16horiz)) * 2000; - daang = pp->pang; + daang = fix16_to_int(pp->q16ang); } for (i = 0; i < 12; i++) @@ -15144,7 +15144,7 @@ InitLaser(PLAYERp pp) // Inserting and setting up variables w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursectnum, - nx, ny, nz, pp->pang, 300); + nx, ny, nz, fix16_to_int(pp->q16ang), 300); wp = &sprite[w]; wu = User[w]; @@ -15256,7 +15256,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, pp->pang, 1200); + nx, ny, nz, fix16_to_int(pp->q16ang), 1200); wp = &sprite[w]; wu = User[w]; @@ -15455,7 +15455,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, pp->pang, ROCKET_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), ROCKET_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -15576,7 +15576,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, pp->pang, ROCKET_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), ROCKET_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -15690,7 +15690,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, pp->pang, 700); + nx, ny, nz, fix16_to_int(pp->q16ang), 700); wp = &sprite[w]; wu = User[w]; @@ -15753,7 +15753,7 @@ InitNuke(PLAYERp pp) wu->ychange = MOVEy(wp->xvel, wp->ang); wu->zchange = zvel; - PlayerDamageSlide(pp, -40, NORM_ANGLE(pp->pang+1024)); // Recoil slide + PlayerDamageSlide(pp, -40, NORM_ANGLE(fix16_to_int(pp->q16ang)+1024)); // Recoil slide return 0; } @@ -15888,7 +15888,7 @@ InitMicro(PLAYERp pp) { hp = NULL; hu = NULL; - ang = pp->pang; + ang = fix16_to_int(pp->q16ang); } nz = pp->posz + pp->bob_z + Z(14); @@ -17444,7 +17444,7 @@ InitTracerUzi(PLAYERp pp) // Inserting and setting up variables w = SpawnSprite(STAT_MISSILE, 0, s_Tracer, pp->cursectnum, - nx, ny, nz, pp->pang, TRACER_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), TRACER_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -17726,8 +17726,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 + Player[0].pang) & 2047] >> 7); - //ny = (sintable[Player[0].pang] >> 7); + //nx = (sintable[(512 + fix16_to_int(Player[0].q16ang)) & 2047] >> 7); + //ny = (sintable[fix16_to_int(Player[0].q16ang)] >> 7); //sp->x -= nx; //sp->y -= ny; @@ -17833,8 +17833,8 @@ InitUzi(PLAYERp pp) } else { - //daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25)); - daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(24) - 12)); + //daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25)); + daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(24) - 12)); daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000); } @@ -18011,7 +18011,7 @@ InitEMP(PLAYERp pp) InitTracerUzi(pp); //daz = nz = pp->posz + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72); - //daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25)); + //daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25)); daz = nz = pp->posz + pp->bob_z; daang = 64; @@ -18021,7 +18021,7 @@ InitEMP(PLAYERp pp) else { daz = (100 - fix16_to_int(pp->q16horiz)) * 2000; - daang = pp->pang; + daang = fix16_to_int(pp->q16ang); } FAFhitscan(pp->posx, pp->posy, nz, pp->cursectnum, // Start position @@ -19278,7 +19278,7 @@ InitGrenade(PLAYERp pp) // Inserting and setting up variables w = SpawnSprite(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursectnum, - nx, ny, nz, pp->pang, GRENADE_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), GRENADE_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -19447,7 +19447,7 @@ InitMine(PLAYERp pp) // Inserting and setting up variables w = SpawnSprite(STAT_MISSILE, MINE, s_Mine, pp->cursectnum, - nx, ny, nz, pp->pang, MINE_VELOCITY); + nx, ny, nz, fix16_to_int(pp->q16ang), MINE_VELOCITY); wp = &sprite[w]; wu = User[w]; @@ -19478,7 +19478,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(pp->pang+512)], sintable[pp->pang]); + dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang)+512)], sintable[fix16_to_int(pp->q16ang)]); // don't adjust for strafing if (labs(dot) > 10000) @@ -19608,7 +19608,7 @@ InitFireball(PLAYERp pp) nz = pp->posz + pp->bob_z + Z(15); - w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, pp->pang, FIREBALL_VELOCITY); + w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, fix16_to_int(pp->q16ang), FIREBALL_VELOCITY); wp = &sprite[w]; wu = User[w]; diff --git a/source/sw/src/zombie.cpp b/source/sw/src/zombie.cpp index 9f35a5020..709f2a8f0 100644 --- a/source/sw/src/zombie.cpp +++ b/source/sw/src/zombie.cpp @@ -790,7 +790,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, pp->pang, 0); + New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0); np = &sprite[New]; nu = User[New]; np->sectnum = pp->cursectnum;