mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
SW: Use Q16.16 for horiz.
This commit is contained in:
parent
e878c5bab8
commit
f07a0ae01e
13 changed files with 171 additions and 167 deletions
|
@ -1865,7 +1865,7 @@ void PreDrawStackedWater(void)
|
|||
}
|
||||
|
||||
|
||||
void FAF_DrawRooms(int x, int y, int z, short ang, int horiz, short sectnum)
|
||||
void FAF_DrawRooms(int x, int y, int z, short ang, fix16_t q16horiz, short sectnum)
|
||||
{
|
||||
short i,nexti;
|
||||
|
||||
|
@ -1892,7 +1892,7 @@ void FAF_DrawRooms(int x, int y, int z, short ang, int horiz, short sectnum)
|
|||
}
|
||||
}
|
||||
|
||||
drawrooms(x,y,z,ang,horiz,sectnum);
|
||||
renderDrawRoomsQ16(x,y,z,fix16_from_int(ang),q16horiz,sectnum);
|
||||
|
||||
TRAVERSE_SPRITE_STAT(headspritestat[STAT_CEILING_FLOOR_PIC_OVERRIDE], i, nexti)
|
||||
{
|
||||
|
@ -1930,7 +1930,8 @@ void
|
|||
drawscreen(PLAYERp pp)
|
||||
{
|
||||
extern SWBOOL DemoMode,CameraTestMode;
|
||||
int tx, ty, tz,thoriz;
|
||||
int tx, ty, tz,tinthoriz;
|
||||
fix16_t tq16horiz;
|
||||
short tang,tsectnum;
|
||||
short i,j;
|
||||
int bob_amt = 0;
|
||||
|
@ -2013,7 +2014,7 @@ drawscreen(PLAYERp pp)
|
|||
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);
|
||||
thoriz = camerapp->ohoriz + mulscale16(camerapp->horiz - camerapp->ohoriz, smoothratio);
|
||||
tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio);
|
||||
tsectnum = camerapp->cursectnum;
|
||||
|
||||
//ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
||||
|
@ -2069,7 +2070,7 @@ drawscreen(PLAYERp pp)
|
|||
tz = tz + quake_z;
|
||||
tx = tx + quake_x;
|
||||
ty = ty + quake_y;
|
||||
//thoriz = thoriz + quake_x;
|
||||
//tq16horiz = tq16horiz + fix16_from_int(quake_x);
|
||||
tang = NORM_ANGLE(tang + quake_ang);
|
||||
|
||||
if (pp->sop_remote)
|
||||
|
@ -2083,14 +2084,17 @@ drawscreen(PLAYERp pp)
|
|||
//if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||
{
|
||||
BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz);
|
||||
BackView(&tx, &ty, &tz, &tsectnum, &tang, fix16_to_int(tq16horiz));
|
||||
}
|
||||
else
|
||||
{
|
||||
bob_amt = camerapp->bob_amt;
|
||||
|
||||
if (DemoMode || CameraTestMode)
|
||||
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &thoriz);
|
||||
{
|
||||
tinthoriz = fix16_to_int(tq16horiz);
|
||||
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &tinthoriz);
|
||||
}
|
||||
}
|
||||
|
||||
if (!TEST(pp->Flags, PF_VIEW_FROM_CAMERA|PF_VIEW_FROM_OUTSIDE))
|
||||
|
@ -2099,10 +2103,10 @@ drawscreen(PLAYERp pp)
|
|||
tz += camerapp->bob_z;
|
||||
|
||||
// recoil only when not in camera
|
||||
//thoriz = thoriz + camerapp->recoil_horizoff;
|
||||
thoriz = thoriz + pp->recoil_horizoff;
|
||||
thoriz = max(thoriz, PLAYER_HORIZ_MIN);
|
||||
thoriz = min(thoriz, PLAYER_HORIZ_MAX);
|
||||
//tq16horiz = tq16horiz + fix16_from_int(camerapp->recoil_horizoff);
|
||||
tq16horiz = tq16horiz + fix16_from_int(pp->recoil_horizoff);
|
||||
tq16horiz = fix16_max(tq16horiz, fix16_from_int(PLAYER_HORIZ_MIN));
|
||||
tq16horiz = fix16_min(tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX));
|
||||
}
|
||||
|
||||
if (r_usenewaspect)
|
||||
|
@ -2122,18 +2126,18 @@ drawscreen(PLAYERp pp)
|
|||
|
||||
screen->BeginScene();
|
||||
OverlapDraw = TRUE;
|
||||
DrawOverlapRoom(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
DrawOverlapRoom(tx, ty, tz, tang, tq16horiz, tsectnum);
|
||||
OverlapDraw = FALSE;
|
||||
|
||||
if (dimensionmode != 6)// && !ScreenSavePic)
|
||||
{
|
||||
// TEST this! Changed to camerapp
|
||||
//JS_DrawMirrors(camerapp, tx, ty, tz, tang, thoriz);
|
||||
JS_DrawMirrors(pp, tx, ty, tz, tang, thoriz);
|
||||
//JS_DrawMirrors(camerapp, tx, ty, tz, tang, tq16horiz);
|
||||
JS_DrawMirrors(pp, tx, ty, tz, tang, tq16horiz);
|
||||
}
|
||||
|
||||
if (dimensionmode != 6 && !FAF_DebugView)
|
||||
FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
FAF_DrawRooms(tx, ty, tz, tang, tq16horiz, tsectnum);
|
||||
|
||||
analyzesprites(tx, ty, tz, FALSE);
|
||||
post_analyzesprites();
|
||||
|
|
|
@ -2966,7 +2966,7 @@ void getinput(SW_PACKET *loc)
|
|||
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
||||
#define MAXANGVEL 100
|
||||
#define MAXAIMVEL 128
|
||||
#define MAXHORIZVEL 128
|
||||
#define SET_LOC_KEY(loc, sync_num, key_test) SET(loc, ((!!(key_test)) << (sync_num)))
|
||||
|
||||
static int32_t turnheldtime;
|
||||
|
@ -3000,9 +3000,9 @@ void getinput(SW_PACKET *loc)
|
|||
|
||||
if (cl_autoaim)
|
||||
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
else
|
||||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
}
|
||||
}
|
||||
|
||||
ControlInfo info;
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3090,7 +3090,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, aimvel = 0;
|
||||
int32_t svel = 0, vel = 0, angvel = 0;
|
||||
fix16_t q16horz = 0;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||
{
|
||||
|
@ -3104,14 +3105,14 @@ void getinput(SW_PACKET *loc)
|
|||
}
|
||||
|
||||
if (mouseaim)
|
||||
aimvel = -info.mousey / 64;
|
||||
q16horz = -fix16_div(fix16_from_int(info.mousey), fix16_from_int(64));
|
||||
else
|
||||
vel = -(info.mousey >> 6);
|
||||
|
||||
if (in_mouseflip)
|
||||
aimvel = -aimvel;
|
||||
q16horz = -q16horz;
|
||||
|
||||
aimvel -= info.dpitch * turnamount / analogExtent;
|
||||
q16horz -= fix16_from_int(info.dpitch) * turnamount / analogExtent;
|
||||
svel -= info.dx * keymove / analogExtent;
|
||||
vel -= info.dz * keymove / analogExtent;
|
||||
|
||||
|
@ -3171,7 +3172,7 @@ void getinput(SW_PACKET *loc)
|
|||
svel = clamp(svel, -MAXSVEL, MAXSVEL);
|
||||
|
||||
angvel = clamp(angvel, -MAXANGVEL, MAXANGVEL);
|
||||
aimvel = clamp(aimvel, -MAXAIMVEL, MAXAIMVEL);
|
||||
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)]);
|
||||
|
@ -3182,7 +3183,7 @@ void getinput(SW_PACKET *loc)
|
|||
loc->vel = momx;
|
||||
loc->svel = momy;
|
||||
loc->angvel = angvel;
|
||||
loc->aimvel = aimvel;
|
||||
loc->q16horz = q16horz;
|
||||
|
||||
if (!CommEnabled)
|
||||
{
|
||||
|
|
|
@ -996,7 +996,7 @@ typedef struct
|
|||
int16_t vel;
|
||||
int16_t svel;
|
||||
int8_t angvel;
|
||||
int8_t aimvel;
|
||||
fix16_t q16horz;
|
||||
int32_t bits;
|
||||
} SW_PACKET;
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ struct PLAYERstruct
|
|||
int
|
||||
oposx, oposy, oposz;
|
||||
short oang;
|
||||
short ohoriz;
|
||||
fix16_t oq16horiz;
|
||||
|
||||
// holds last valid move position
|
||||
short lv_sectnum;
|
||||
|
@ -1081,7 +1081,8 @@ struct PLAYERstruct
|
|||
short turn180_target; // 180 degree turn
|
||||
|
||||
// variables that do not fit into sprite structure
|
||||
int horizbase,horiz,horizoff,hvel,tilt,tilt_dest;
|
||||
int hvel,tilt,tilt_dest;
|
||||
fix16_t q16horiz, q16horizbase, q16horizoff;
|
||||
short recoil_amt;
|
||||
short recoil_speed;
|
||||
short recoil_ndx;
|
||||
|
@ -2362,7 +2363,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,int thoriz,short tsectnum); // rooms.c
|
||||
void DrawOverlapRoom(int tx,int ty,int tz,short tang,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
|
||||
|
|
|
@ -444,7 +444,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
syn->vel = 0;
|
||||
syn->svel = 0;
|
||||
syn->angvel = 0;
|
||||
syn->aimvel = 0;
|
||||
syn->q16horz = 0;
|
||||
syn->bits = 0;
|
||||
|
||||
x1 = p->posx;
|
||||
|
@ -596,7 +596,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
{
|
||||
vec3_t hit_pos = { x1, y1, z1-PLAYER_HEIGHT };
|
||||
hitscan(&hit_pos,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||
(100-p->horiz-p->horizoff)*32,&hitinfo,CLIPMASK1);
|
||||
(100-fix16_to_int(p->q16horiz)-fix16_to_int(p->q16horizoff))*32,&hitinfo,CLIPMASK1);
|
||||
if ((hitinfo.pos.x-x1)*(hitinfo.pos.x-x1)+(hitinfo.pos.y-y1)*(hitinfo.pos.y-y1) < 2560*2560) syn->bits &= ~(1<<SK_SHOOT);
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
// Below formula fails in certain cases
|
||||
//syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL); //was 127
|
||||
p->pang = daang;
|
||||
syn->aimvel = min(max((zang-p->horiz)>>1,-PLAYER_HORIZ_MAX),PLAYER_HORIZ_MAX);
|
||||
syn->q16horz = 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<<SK_AUTO_AIM);
|
||||
return;
|
||||
|
|
|
@ -460,14 +460,14 @@ void JS_InitMirrors(void)
|
|||
// Draw a 3d screen to a specific tile
|
||||
/////////////////////////////////////////////////////
|
||||
void drawroomstotile(int daposx, int daposy, int daposz,
|
||||
short daang, int dahoriz, short dacursectnum, short tilenume)
|
||||
short daang, fix16_t daq16horiz, short dacursectnum, short tilenume)
|
||||
{
|
||||
TileFiles.MakeCanvas(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
||||
|
||||
renderSetTarget(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
||||
screen->BeginScene();
|
||||
|
||||
drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum);
|
||||
drawrooms(daposx, daposy, daposz, daang, daq16horiz, dacursectnum);
|
||||
analyzesprites(daposx, daposy, daposz, FALSE);
|
||||
renderDrawMasks();
|
||||
screen->FinishScene();
|
||||
|
@ -524,16 +524,13 @@ short camplayerview = 1; // Don't show yourself!
|
|||
// Hack job alert!
|
||||
// Mirrors and cameras are maintained in the same data structure, but for hardware rendering they cannot be interleaved.
|
||||
// So this function replicates JS_DrawMirrors to only process the camera textures but not change any global state.
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
int tposx, tposy; // Camera
|
||||
int* longptr;
|
||||
fix16_t tang;
|
||||
|
||||
// int tx, ty, tz, tpang; // Interpolate so mirror doesn't
|
||||
// drift!
|
||||
SWBOOL bIsWallMirror = FALSE;
|
||||
|
||||
camloopcnt += (int32_t)(totalclock - ototalclock);
|
||||
|
@ -717,7 +714,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz
|
|||
}
|
||||
}
|
||||
|
||||
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
|
||||
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, fix16_t tpq16horiz)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
|
@ -852,7 +849,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz
|
|||
|
||||
if (mirror[cnt].campic != -1)
|
||||
tileDelete(mirror[cnt].campic);
|
||||
drawrooms(dx, dy, dz, tpang, tphoriz, sp->sectnum + MAXSECTORS);
|
||||
renderDrawRoomsQ16(dx, dy, dz, fix16_from_int(tpang), tpq16horiz, sp->sectnum + MAXSECTORS);
|
||||
analyzesprites(dx, dy, dz, FALSE);
|
||||
renderDrawMasks();
|
||||
}
|
||||
|
@ -866,10 +863,10 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz
|
|||
// Must call preparemirror before drawrooms and
|
||||
// completemirror after drawrooms
|
||||
|
||||
renderPrepareMirror(tx, ty, tz, fix16_from_int(tpang), fix16_from_int(tphoriz),
|
||||
renderPrepareMirror(tx, ty, tz, fix16_from_int(tpang), tpq16horiz,
|
||||
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
|
||||
|
||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), fix16_from_int(tphoriz), mirror[cnt].mirrorsector + MAXSECTORS);
|
||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
|
||||
|
||||
analyzesprites(tposx, tposy, tz, TRUE);
|
||||
renderDrawMasks();
|
||||
|
@ -882,7 +879,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz
|
|||
// g_visibility = tvisibility;
|
||||
// g_visibility = NormalVisibility;
|
||||
|
||||
// drawrooms(tx, ty, tz, tpang, tphoriz, pp->cursectnum);
|
||||
// renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tpang), tpq16horiz, pp->cursectnum);
|
||||
// Clean up anything that the camera view might have done
|
||||
SetFragBar(pp);
|
||||
tileDelete(MIRROR);
|
||||
|
|
|
@ -71,8 +71,8 @@ extern SWBOOL mirrorinview;
|
|||
extern short NormalVisibility;
|
||||
|
||||
void JAnalyzeSprites(tspriteptr_t tspr);
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz);
|
||||
void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz);
|
||||
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_InitMirrors(void);
|
||||
void JS_InitLockouts(void);
|
||||
void JS_ToggleLockouts(void);
|
||||
|
|
|
@ -1423,10 +1423,10 @@ PlayerInitChemBomb(PLAYERp pp)
|
|||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||
SET(wu->Flags, SPR_UNDERWATER);
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
|
||||
// //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",pp->horiz, pp->horizoff,
|
||||
// pp->horizoff + pp->horiz);
|
||||
// //DSPRINTF(ds,"q16horiz %d, ho %d, ho+ho %d",fix16_to_int(pp->q16horiz), fix16_to_int(pp->q16horizoff),
|
||||
// fix16_to_int(pp->q16horizoff + pp->q16horiz));
|
||||
// MONO_PRINT(ds);
|
||||
|
||||
oclipdist = pp->SpriteP->clipdist;
|
||||
|
@ -1867,7 +1867,7 @@ PlayerInitCaltrops(PLAYERp pp)
|
|||
// They go out at different angles
|
||||
// wp->ang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
|
||||
oclipdist = pp->SpriteP->clipdist;
|
||||
pp->SpriteP->clipdist = 0;
|
||||
|
@ -2501,7 +2501,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
|
|||
|
||||
if (u->PlayerP)
|
||||
{
|
||||
wp->z += ((100 - u->PlayerP->horiz) * (HORIZ_MULT/3));
|
||||
wp->z += ((100 - fix16_to_int(u->PlayerP->q16horiz)) * (HORIZ_MULT/3));
|
||||
}
|
||||
|
||||
switch (wu->ID)
|
||||
|
|
|
@ -105,7 +105,7 @@ typedef struct
|
|||
int32_t vel;
|
||||
int32_t svel;
|
||||
int32_t angvel;
|
||||
int32_t aimvel;
|
||||
fix16_t q16horz;
|
||||
int32_t bits;
|
||||
} SW_AVERAGE_PACKET;
|
||||
|
||||
|
@ -303,10 +303,10 @@ int EncodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
|||
SET(*base_ptr, BIT(2));
|
||||
}
|
||||
|
||||
if (pak->aimvel != old_pak->aimvel)
|
||||
if (pak->q16horz != old_pak->q16horz)
|
||||
{
|
||||
*((char *)buf) = pak->aimvel;
|
||||
buf += sizeof(pak->aimvel);
|
||||
*((char *)buf) = fix16_to_int(pak->q16horz);
|
||||
buf += sizeof(fix16_to_int(pak->q16horz));
|
||||
SET(*base_ptr, BIT(3));
|
||||
}
|
||||
|
||||
|
@ -354,8 +354,8 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
|||
|
||||
if (TEST(*base_ptr, BIT(3)))
|
||||
{
|
||||
pak->aimvel = *(char *)buf;
|
||||
buf += sizeof(pak->aimvel);
|
||||
pak->q16horz = fix16_from_int(*(char *)buf);
|
||||
buf += sizeof(fix16_to_int(pak->q16horz));
|
||||
}
|
||||
|
||||
//won't work if > 4 bytes
|
||||
|
@ -938,7 +938,7 @@ faketimerhandler(void)
|
|||
AveragePacket.vel += loc.vel;
|
||||
AveragePacket.svel += loc.svel;
|
||||
AveragePacket.angvel += loc.angvel;
|
||||
AveragePacket.aimvel += loc.aimvel;
|
||||
AveragePacket.q16horz += loc.q16horz;
|
||||
SET(AveragePacket.bits, loc.bits);
|
||||
|
||||
pp = Player + myconnectindex;
|
||||
|
@ -956,7 +956,7 @@ faketimerhandler(void)
|
|||
loc.vel = AveragePacket.vel / MovesPerPacket;
|
||||
loc.svel = AveragePacket.svel / MovesPerPacket;
|
||||
loc.angvel = AveragePacket.angvel / MovesPerPacket;
|
||||
loc.aimvel = AveragePacket.aimvel / MovesPerPacket;
|
||||
loc.q16horz = AveragePacket.q16horz / MovesPerPacket;
|
||||
loc.bits = AveragePacket.bits;
|
||||
|
||||
memset(&AveragePacket, 0, sizeof(AveragePacket));
|
||||
|
|
|
@ -1829,7 +1829,7 @@ PlayerAutoLook(PLAYERp pp)
|
|||
if ((pp->cursectnum == tempsect) ||
|
||||
(klabs(getflorzofslope(tempsect, x, y) - k) <= (4 << 8)))
|
||||
{
|
||||
pp->horizoff += (((j - k) * 160) >> 16);
|
||||
pp->q16horizoff += fix16_from_int((((j - k) * 160) >> 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1838,17 +1838,17 @@ PlayerAutoLook(PLAYERp pp)
|
|||
if (TEST(pp->Flags, PF_CLIMBING))
|
||||
{
|
||||
// tilt when climbing but you can't even really tell it
|
||||
if (pp->horizoff < 100)
|
||||
pp->horizoff += (((100 - pp->horizoff) >> 3) + 1);
|
||||
if (pp->q16horizoff < fix16_from_int(100))
|
||||
pp->q16horizoff += fix16_from_int((((100 - fix16_to_int(pp->q16horizoff)) >> 3) + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make horizoff grow towards 0 since horizoff is not modified when
|
||||
// Make q16horizoff grow towards 0 since q16horizoff is not modified when
|
||||
// you're not on a slope
|
||||
if (pp->horizoff > 0)
|
||||
pp->horizoff -= ((pp->horizoff >> 3) + 1);
|
||||
if (pp->horizoff < 0)
|
||||
pp->horizoff += (((-pp->horizoff) >> 3) + 1);
|
||||
if (pp->q16horizoff > 0)
|
||||
pp->q16horizoff -= fix16_from_int(((fix16_to_int(pp->q16horizoff) >> 3) + 1));
|
||||
if (pp->q16horizoff < 0)
|
||||
pp->q16horizoff += fix16_from_int((((fix16_to_int(-pp->q16horizoff)) >> 3) + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1859,23 +1859,23 @@ DoPlayerHorizon(PLAYERp pp)
|
|||
int i;
|
||||
#define HORIZ_SPEED (16)
|
||||
|
||||
// //DSPRINTF(ds,"pp->horizoff, %d", pp->horizoff);
|
||||
// //DSPRINTF(ds,"fix16_to_int(pp->q16horizoff), %d", fix16_to_int(pp->q16horizoff));
|
||||
// MONO_PRINT(ds);
|
||||
|
||||
// Fixme: This should probably be made optional.
|
||||
if (cl_slopetilting)
|
||||
PlayerAutoLook(pp);
|
||||
|
||||
if (pp->input.aimvel)
|
||||
if (pp->input.q16horz)
|
||||
{
|
||||
pp->horizbase += pp->input.aimvel;
|
||||
pp->q16horizbase += pp->input.q16horz;
|
||||
SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING);
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(pp, SK_CENTER_VIEW))
|
||||
{
|
||||
pp->horiz = pp->horizbase = 100;
|
||||
pp->horizoff = 0;
|
||||
pp->q16horiz = pp->q16horizbase = fix16_from_int(100);
|
||||
pp->q16horizoff = 0;
|
||||
}
|
||||
|
||||
// this is the locked type
|
||||
|
@ -1884,13 +1884,13 @@ DoPlayerHorizon(PLAYERp pp)
|
|||
// set looking because player is manually looking
|
||||
SET(pp->Flags, PF_LOCK_HORIZ | PF_LOOKING);
|
||||
|
||||
// adjust pp->horizon negative
|
||||
// adjust pp->q16horiz negative
|
||||
if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN))
|
||||
pp->horizbase -= (HORIZ_SPEED/2);
|
||||
pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2));
|
||||
|
||||
// adjust pp->horizon positive
|
||||
// adjust pp->q16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_SNAP_UP))
|
||||
pp->horizbase += (HORIZ_SPEED/2);
|
||||
pp->q16horizbase += fix16_from_int((HORIZ_SPEED/2));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1900,13 +1900,13 @@ DoPlayerHorizon(PLAYERp pp)
|
|||
RESET(pp->Flags, PF_LOCK_HORIZ);
|
||||
SET(pp->Flags, PF_LOOKING);
|
||||
|
||||
// adjust pp->horizon negative
|
||||
// adjust pp->q16horiz negative
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
|
||||
pp->horizbase -= HORIZ_SPEED;
|
||||
pp->q16horizbase -= fix16_from_int(HORIZ_SPEED);
|
||||
|
||||
// adjust pp->horizon positive
|
||||
// adjust pp->q16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_UP))
|
||||
pp->horizbase += HORIZ_SPEED;
|
||||
pp->q16horizbase += fix16_from_int(HORIZ_SPEED);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1914,20 +1914,20 @@ DoPlayerHorizon(PLAYERp pp)
|
|||
{
|
||||
if (!(TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN)))
|
||||
{
|
||||
// not pressing the pp->horiz keys
|
||||
if (pp->horizbase != 100)
|
||||
// not pressing the pp->q16horiz keys
|
||||
if (pp->q16horizbase != fix16_from_int(100))
|
||||
{
|
||||
|
||||
// move pp->horiz back to 100
|
||||
// move pp->q16horiz back to 100
|
||||
for (i = 1; i; i--)
|
||||
{
|
||||
// this formula does not work for pp->horiz = 101-103
|
||||
pp->horizbase += 25 - (pp->horizbase >> 2);
|
||||
// this formula does not work for pp->q16horiz = 101-103
|
||||
pp->q16horizbase += fix16_from_int(25 - (fix16_to_int(pp->q16horizbase) >> 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// not looking anymore because pp->horiz is back at 100
|
||||
// not looking anymore because pp->q16horiz is back at 100
|
||||
RESET(pp->Flags, PF_LOOKING);
|
||||
}
|
||||
}
|
||||
|
@ -1935,27 +1935,27 @@ DoPlayerHorizon(PLAYERp pp)
|
|||
|
||||
#if 1
|
||||
// bound the base
|
||||
pp->horizbase = max(pp->horizbase, PLAYER_HORIZ_MIN);
|
||||
pp->horizbase = min(pp->horizbase, PLAYER_HORIZ_MAX);
|
||||
pp->q16horizbase = fix16_max(pp->q16horizbase, fix16_from_int(PLAYER_HORIZ_MIN));
|
||||
pp->q16horizbase = fix16_min(pp->q16horizbase, fix16_from_int(PLAYER_HORIZ_MAX));
|
||||
|
||||
// bound adjust horizoff
|
||||
if (pp->horizbase + pp->horizoff < PLAYER_HORIZ_MIN)
|
||||
pp->horizoff = PLAYER_HORIZ_MIN - pp->horizbase;
|
||||
else if (pp->horizbase + pp->horizoff > PLAYER_HORIZ_MAX)
|
||||
pp->horizoff = PLAYER_HORIZ_MAX - pp->horizbase;
|
||||
// bound adjust q16horizoff
|
||||
if (pp->q16horizbase + pp->q16horizoff < fix16_from_int(PLAYER_HORIZ_MIN))
|
||||
pp->q16horizoff = fix16_from_int(PLAYER_HORIZ_MIN) - pp->q16horizbase;
|
||||
else if (pp->q16horizbase + pp->q16horizoff > fix16_from_int(PLAYER_HORIZ_MAX))
|
||||
pp->q16horizoff = fix16_from_int(PLAYER_HORIZ_MAX) - pp->q16horizbase;
|
||||
|
||||
////DSPRINTF(ds,"base %d, off %d, base + off %d",pp->horizbase, pp->horizoff, pp->horizbase + pp->horizoff);
|
||||
////DSPRINTF(ds,"base %d, off %d, base + off %d",fix16_to_int(pp->q16horizbase), fix16_to_int(pp->q16horizoff), fix16_to_int(pp->q16horizbase + pp->q16horizoff));
|
||||
//MONO_PRINT(ds);
|
||||
|
||||
// add base and offsets
|
||||
pp->horiz = pp->horizbase + pp->horizoff;
|
||||
pp->q16horiz = pp->q16horizbase + pp->q16horizoff;
|
||||
#else
|
||||
if (pp->horizbase + pp->horizoff < PLAYER_HORIZ_MIN)
|
||||
pp->horizbase += HORIZ_SPEED;
|
||||
else if (pp->horizbase + pp->horizoff > PLAYER_HORIZ_MAX)
|
||||
pp->horizbase -= HORIZ_SPEED;
|
||||
if (pp->q16horizbase + pp->q16horizoff < fix16_from_int(PLAYER_HORIZ_MIN))
|
||||
pp->q16horizbase += fix16_from_int(HORIZ_SPEED);
|
||||
else if (pp->q16horizbase + pp->q16horizoff > fix16_from_int(PLAYER_HORIZ_MAX))
|
||||
pp->q16horizbase -= HORIZ_SPEED;
|
||||
|
||||
pp->horiz = pp->horizbase + pp->horizoff;
|
||||
pp->q16horiz = pp->q16horizbase + pp->q16horizoff;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -1987,7 +1987,7 @@ DoPlayerBob(PLAYERp pp)
|
|||
// wrap bcnt
|
||||
pp->bcnt &= 2047;
|
||||
|
||||
// move pp->horiz up and down from 100 using sintable
|
||||
// move pp->q16horiz up and down from 100 using sintable
|
||||
//pp->bob_z = Z((8 * sintable[pp->bcnt]) >> 14);
|
||||
pp->bob_z = mulscale14(Z(amt),sintable[pp->bcnt]);
|
||||
}
|
||||
|
@ -2003,7 +2003,7 @@ DoPlayerBob(PLAYERp pp)
|
|||
// wrap bcnt
|
||||
pp->bcnt &= 2047;
|
||||
|
||||
// move pp->horiz up and down from 100 using sintable
|
||||
// move pp->q16horiz up and down from 100 using sintable
|
||||
//pp->bob_z = Z((4 * sintable[pp->bcnt]) >> 14);
|
||||
pp->bob_z = mulscale14(Z(amt),sintable[pp->bcnt]);
|
||||
}
|
||||
|
@ -2037,7 +2037,7 @@ DoPlayerRecoil(PLAYERp pp)
|
|||
return;
|
||||
}
|
||||
|
||||
// move pp->horiz up and down
|
||||
// move pp->q16horiz up and down
|
||||
pp->recoil_horizoff = ((pp->recoil_amt * sintable[pp->recoil_ndx]) >> 14);
|
||||
}
|
||||
|
||||
|
@ -6599,21 +6599,21 @@ DoPlayerBeginDie(PLAYERp pp)
|
|||
int
|
||||
DoPlayerDeathHoriz(PLAYERp pp, short target, short speed)
|
||||
{
|
||||
if (pp->horiz > target)
|
||||
if (pp->q16horiz > fix16_from_int(target))
|
||||
{
|
||||
pp->horiz -= speed;
|
||||
if (pp->horiz <= target)
|
||||
pp->horiz = target;
|
||||
pp->q16horiz -= fix16_from_int(speed);
|
||||
if (pp->q16horiz <= fix16_from_int(target))
|
||||
pp->q16horiz = fix16_from_int(target);
|
||||
}
|
||||
|
||||
if (pp->horiz < target)
|
||||
if (pp->q16horiz < fix16_from_int(target))
|
||||
{
|
||||
pp->horiz += speed;
|
||||
if (pp->horiz >= target)
|
||||
pp->horiz = target;
|
||||
pp->q16horiz += fix16_from_int(speed);
|
||||
if (pp->q16horiz >= fix16_from_int(target))
|
||||
pp->q16horiz = fix16_from_int(target);
|
||||
}
|
||||
|
||||
return pp->horiz == target;
|
||||
return pp->q16horiz == fix16_from_int(target);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -6769,7 +6769,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
|
|||
sp->yrepeat = PLAYER_NINJA_YREPEAT;
|
||||
|
||||
//pp->tilt = 0;
|
||||
pp->horiz = pp->horizbase = 100;
|
||||
pp->q16horiz = pp->q16horizbase = fix16_from_int(100);
|
||||
DoPlayerResetMovement(pp);
|
||||
u->ID = NINJA_RUN_R0;
|
||||
PlayerDeathReset(pp);
|
||||
|
@ -7452,7 +7452,7 @@ MoveSkipSavePos(void)
|
|||
pp->oposy = pp->posy;
|
||||
pp->oposz = pp->posz;
|
||||
pp->oang = pp->pang;
|
||||
pp->ohoriz = pp->horiz;
|
||||
pp->oq16horiz = pp->q16horiz;
|
||||
}
|
||||
|
||||
// save off stats for skip4
|
||||
|
@ -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.aimvel) ||
|
||||
if ((pp->input.bits|pp->input.vel|pp->input.svel|pp->input.angvel|pp->input.q16horz) ||
|
||||
TEST(pp->Flags, PF_CLIMBING|PF_FALLING|PF_DIVING))
|
||||
{
|
||||
// Hit a input key or other reason to stop chops
|
||||
|
@ -7993,7 +7993,7 @@ InitAllPlayers(void)
|
|||
|
||||
//getzsofslope(pfirst->cursectnum, pfirst->posx, pfirst->posy, &cz, &fz);
|
||||
//pfirst->posz = fz - PLAYER_HEIGHT;
|
||||
pfirst->horiz = pfirst->horizbase = 100;
|
||||
pfirst->q16horiz = pfirst->q16horizbase = fix16_from_int(100);
|
||||
|
||||
// Initialize all [MAX_SW_PLAYERS] arrays here!
|
||||
for (pp = Player; pp < &Player[MAX_SW_PLAYERS]; pp++)
|
||||
|
@ -8002,14 +8002,14 @@ InitAllPlayers(void)
|
|||
pp->posy = pp->oposy = pfirst->posy;
|
||||
pp->posz = pp->oposz = pfirst->posz;
|
||||
pp->pang = pp->oang = pfirst->pang;
|
||||
pp->horiz = pp->ohoriz = pfirst->horiz;
|
||||
pp->q16horiz = pp->oq16horiz = pfirst->q16horiz;
|
||||
pp->cursectnum = pfirst->cursectnum;
|
||||
// set like this so that player can trigger something on start of the level
|
||||
pp->lastcursectnum = pfirst->cursectnum+1;
|
||||
|
||||
//pp->MaxHealth = 100;
|
||||
|
||||
pp->horizbase = pfirst->horizbase;
|
||||
pp->q16horizbase = pfirst->q16horizbase;
|
||||
pp->oldposx = 0;
|
||||
pp->oldposy = 0;
|
||||
pp->climb_ndx = 10;
|
||||
|
@ -8041,7 +8041,7 @@ InitAllPlayers(void)
|
|||
pp->FadeAmt = 0;
|
||||
pp->FadeTics = 0;
|
||||
pp->StartColor = 0;
|
||||
pp->horizoff = 0;
|
||||
pp->q16horizoff = 0;
|
||||
memcpy(&pp->temp_pal[0],&palette_data[0][0],768);
|
||||
|
||||
INITLIST(&pp->PanelSpriteList);
|
||||
|
|
|
@ -45,7 +45,8 @@ PLAYERp ppp = &PredictPlayer;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int x,y,z,horiz;
|
||||
int x,y,z;
|
||||
fix16_t q16horiz;
|
||||
short ang,filler;
|
||||
} PREDICT, *PREDICTp;
|
||||
|
||||
|
@ -160,7 +161,7 @@ DoPrediction(PLAYERp ppp)
|
|||
ppp->oposx = ppp->posx;
|
||||
ppp->oposy = ppp->posy;
|
||||
ppp->oposz = ppp->posz;
|
||||
ppp->ohoriz = ppp->horiz;
|
||||
ppp->oq16horiz = ppp->q16horiz;
|
||||
|
||||
#if PREDICT_DEBUG
|
||||
PredictDebug(ppp);
|
||||
|
@ -182,7 +183,7 @@ DoPrediction(PLAYERp ppp)
|
|||
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)].horiz = ppp->horiz;
|
||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].q16horiz = ppp->q16horiz;
|
||||
predictmovefifoplc++;
|
||||
}
|
||||
|
||||
|
@ -202,13 +203,13 @@ CorrectPrediction(int actualfifoplc)
|
|||
predict->x == Player[myconnectindex].posx &&
|
||||
predict->y == Player[myconnectindex].posy &&
|
||||
predict->z == Player[myconnectindex].posz &&
|
||||
predict->horiz == Player[myconnectindex].horiz
|
||||
predict->q16horiz == Player[myconnectindex].q16horiz
|
||||
)
|
||||
{
|
||||
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, predict->horiz,Player[myconnectindex].horiz);
|
||||
// //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));
|
||||
// MONO_PRINT(ds);
|
||||
|
||||
InitPrediction(&Player[myconnectindex]);
|
||||
|
|
|
@ -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, int horiz, short cursectnum);
|
||||
void FAF_DrawRooms(int posx, int posy, int posz, short ang, fix16_t q16horiz, short cursectnum);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -1089,7 +1089,7 @@ ViewSectorInScene(short cursectnum, short level)
|
|||
}
|
||||
|
||||
void
|
||||
DrawOverlapRoom(int tx, int ty, int tz, short tang, int thoriz, short tsectnum)
|
||||
DrawOverlapRoom(int tx, int ty, int tz, short tang, fix16_t tq16horiz, short tsectnum)
|
||||
{
|
||||
short i;
|
||||
short match;
|
||||
|
@ -1104,8 +1104,8 @@ DrawOverlapRoom(int tx, int ty, int tz, short tang, int thoriz, short tsectnum)
|
|||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tang), tq16horiz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, tang, 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, int thoriz, short tsectnum)
|
|||
if (tsectnum < 0)
|
||||
return;
|
||||
|
||||
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||
renderDrawRoomsQ16(tx, ty, tz, fix16_from_int(tang), tq16horiz, tsectnum);
|
||||
//FAF_DrawRooms(tx, ty, tz, ftang, tq16horiz, tsectnum);
|
||||
|
||||
// reset Z's
|
||||
for (i = 0; i < save.zcount; i++)
|
||||
|
|
|
@ -93,7 +93,7 @@ PlayerSync2(void)
|
|||
{
|
||||
pp = Player + i;
|
||||
|
||||
updatecrc(crc, pp->horiz & 255);
|
||||
updatecrc(crc, fix16_to_int(pp->q16horiz) & 255);
|
||||
updatecrc(crc, User[pp->PlayerSprite]->Health & 255);
|
||||
updatecrc(crc, pp->bcnt & 255);
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ getsyncbyte()
|
|||
{
|
||||
pp = Player + i;
|
||||
u = User[pp->SpriteP - sprite];
|
||||
ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ pp->pang ^ pp->horiz ^ u->Health);
|
||||
ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ pp->pang ^ fix16_to_int(pp->q16horiz) ^ u->Health);
|
||||
}
|
||||
|
||||
for (j = headspritestat[STAT_ENEMY]; j >= 0; j = nextspritestat[j])
|
||||
|
|
|
@ -12841,7 +12841,7 @@ DoRing(int16_t Weapon)
|
|||
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
||||
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
||||
if (User[sp->owner]->PlayerP)
|
||||
sp->z += (u->Dist * ((100 - pp->horiz) * HORIZ_MULT)) >> 9;
|
||||
sp->z += (u->Dist * ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT)) >> 9;
|
||||
|
||||
//sp->ang = NORM_ANGLE(sp->ang + 512);
|
||||
//updatesector(sp->x, sp->y);
|
||||
|
@ -12928,7 +12928,7 @@ InitSpellRing(PLAYERp pp)
|
|||
// put it out there
|
||||
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
||||
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
||||
sp->z = pp->posz + Z(20) + ((u->Dist * ((100 - pp->horiz) * HORIZ_MULT)) >> 9);
|
||||
sp->z = pp->posz + Z(20) + ((u->Dist * ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT)) >> 9);
|
||||
|
||||
sp->ang = NORM_ANGLE(sp->ang + 512);
|
||||
|
||||
|
@ -13467,7 +13467,7 @@ InitSpellNapalm(PLAYERp pp)
|
|||
sp->xrepeat = 32;
|
||||
sp->yrepeat = 32;
|
||||
sp->clipdist = 0;
|
||||
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
SET(u->Flags2, SPR2_BLUR_TAPER_FAST);
|
||||
|
@ -13622,7 +13622,7 @@ InitSpellMirv(PLAYERp pp)
|
|||
sp->xrepeat = 72;
|
||||
sp->yrepeat = 72;
|
||||
sp->clipdist = 32L >> 2;
|
||||
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
|
@ -13773,7 +13773,7 @@ InitSwordAttack(PLAYERp pp)
|
|||
int daz;
|
||||
|
||||
daang = pp->pang;
|
||||
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
|
||||
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
||||
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
||||
|
@ -13963,7 +13963,7 @@ InitFistAttack(PLAYERp pp)
|
|||
int daz;
|
||||
|
||||
daang = pp->pang;
|
||||
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
|
||||
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
||||
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
||||
|
@ -14636,7 +14636,7 @@ InitStar(PLAYERp pp)
|
|||
wp->clipdist = 32L >> 2;
|
||||
// wp->zvel was overflowing with this calculation - had to move to a local
|
||||
// long var
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||
|
||||
wu->ceiling_dist = Z(1);
|
||||
wu->floor_dist = Z(1);
|
||||
|
@ -14693,7 +14693,7 @@ InitStar(PLAYERp pp)
|
|||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np))
|
||||
SET(nu->Flags, SPR_UNDERWATER);
|
||||
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||
np->zvel = zvel >> 1;
|
||||
|
||||
if (MissileSetPos(nw, DoStar, 1000))
|
||||
|
@ -14757,7 +14757,7 @@ InitHeartAttack(PLAYERp pp)
|
|||
sp->xrepeat = 52;
|
||||
sp->yrepeat = 52;
|
||||
sp->clipdist = 0;
|
||||
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
SET(u->Flags2, SPR2_DONT_TARGET_OWNER);
|
||||
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
|
||||
|
@ -14981,7 +14981,7 @@ InitShotgun(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
daz = (100 - pp->horiz) * 2000;
|
||||
daz = (100 - fix16_to_int(pp->q16horiz)) * 2000;
|
||||
daang = pp->pang;
|
||||
}
|
||||
|
||||
|
@ -15157,7 +15157,7 @@ InitLaser(PLAYERp pp)
|
|||
wp->clipdist = 64L>>2;
|
||||
|
||||
// the slower the missile travels the less of a zvel it needs
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wp->zvel /= 4;
|
||||
|
||||
wu->WeaponNum = u->WeaponNum;
|
||||
|
@ -15265,7 +15265,7 @@ InitRail(PLAYERp pp)
|
|||
wp->yrepeat = 52;
|
||||
wp->xrepeat = 52;
|
||||
wp->shade = -15;
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT+17));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+17));
|
||||
|
||||
wu->RotNum = 5;
|
||||
NewStateGroup(w, &sg_Rail[0]);
|
||||
|
@ -15465,7 +15465,7 @@ InitRocket(PLAYERp pp)
|
|||
wp->yrepeat = 90;
|
||||
wp->xrepeat = 90;
|
||||
wp->shade = -15;
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT+35));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+35));
|
||||
|
||||
wp->clipdist = 64L>>2;
|
||||
|
||||
|
@ -15586,7 +15586,7 @@ InitBunnyRocket(PLAYERp pp)
|
|||
wp->yrepeat = 64;
|
||||
wp->xrepeat = 64;
|
||||
wp->shade = -15;
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT+35));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+35));
|
||||
|
||||
wp->clipdist = 64L>>2;
|
||||
|
||||
|
@ -15700,7 +15700,7 @@ InitNuke(PLAYERp pp)
|
|||
wp->yrepeat = 128;
|
||||
wp->xrepeat = 128;
|
||||
wp->shade = -15;
|
||||
zvel = ((100 - pp->horiz) * (HORIZ_MULT-36));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT-36));
|
||||
wp->clipdist = 64L>>2;
|
||||
|
||||
// Set to red palette
|
||||
|
@ -15907,7 +15907,7 @@ InitMicro(PLAYERp pp)
|
|||
wp->yrepeat = 24;
|
||||
wp->xrepeat = 24;
|
||||
wp->shade = -15;
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wp->clipdist = 64L>>2;
|
||||
|
||||
// randomize zvelocity
|
||||
|
@ -17437,8 +17437,8 @@ InitTracerUzi(PLAYERp pp)
|
|||
nx = pp->posx;
|
||||
ny = pp->posy;
|
||||
//nz = pp->posz + pp->bob_z + Z(8);
|
||||
//nz = pp->posz + pp->bob_z + Z(8) + ((100 - pp->horiz) * 72);
|
||||
nz = pp->posz + Z(8) + ((100 - pp->horiz) * 72);
|
||||
//nz = pp->posz + pp->bob_z + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
||||
nz = pp->posz + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
||||
|
||||
// Spawn a shot
|
||||
// Inserting and setting up variables
|
||||
|
@ -17456,7 +17456,7 @@ InitTracerUzi(PLAYERp pp)
|
|||
wp->xrepeat = 10;
|
||||
wp->shade = -40;
|
||||
wp->zvel = 0;
|
||||
//wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
//wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wp->clipdist = 32 >> 2;
|
||||
|
||||
wu->WeaponNum = u->WeaponNum;
|
||||
|
@ -17483,7 +17483,7 @@ InitTracerUzi(PLAYERp pp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
||||
|
||||
pp->SpriteP->clipdist = oclipdist;
|
||||
|
||||
|
@ -17835,7 +17835,7 @@ InitUzi(PLAYERp pp)
|
|||
{
|
||||
//daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||
daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(24) - 12));
|
||||
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18010,7 +18010,7 @@ InitEMP(PLAYERp pp)
|
|||
|
||||
InitTracerUzi(pp);
|
||||
|
||||
//daz = nz = pp->posz + Z(8) + ((100 - pp->horiz) * 72);
|
||||
//daz = nz = pp->posz + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
||||
//daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||
|
||||
daz = nz = pp->posz + pp->bob_z;
|
||||
|
@ -18020,7 +18020,7 @@ InitEMP(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
daz = (100 - pp->horiz) * 2000;
|
||||
daz = (100 - fix16_to_int(pp->q16horiz)) * 2000;
|
||||
daang = pp->pang;
|
||||
}
|
||||
|
||||
|
@ -18194,7 +18194,7 @@ InitTankShell(short SpriteNum, PLAYERp pp)
|
|||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
||||
|
||||
WeaponAutoAim(sp, w, 64, FALSE);
|
||||
// a bit of randomness
|
||||
|
@ -18273,7 +18273,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
|
|||
wp->yrepeat = 24;
|
||||
wp->xrepeat = 24;
|
||||
wp->shade = -15;
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wp->clipdist = 64L>>2;
|
||||
|
||||
// randomize zvelocity
|
||||
|
@ -18354,7 +18354,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp)
|
|||
SET(wu->Flags2, SPR2_SO_MISSILE);
|
||||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
||||
|
||||
WeaponAutoAim(sp, w, 64, FALSE);
|
||||
// a bit of randomness
|
||||
|
@ -18401,7 +18401,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp)
|
|||
SET(wu->Flags2, SPR2_SO_MISSILE);
|
||||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
||||
|
||||
WeaponAutoAim(sp, w, 64, FALSE);
|
||||
// a bit of randomness
|
||||
|
@ -18450,7 +18450,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp)
|
|||
wp->yrepeat = 52;
|
||||
wp->xrepeat = 52;
|
||||
wp->shade = -15;
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
|
||||
wu->RotNum = 5;
|
||||
NewStateGroup(w, &sg_Rail[0]);
|
||||
|
@ -18510,7 +18510,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp)
|
|||
wp->shade = -15;
|
||||
|
||||
// the slower the missile travels the less of a zvel it needs
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wp->zvel /= 4;
|
||||
|
||||
wu->Radius = 200;
|
||||
|
@ -18557,7 +18557,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
|
|||
nsect = sp->sectnum;
|
||||
|
||||
if (RANDOM_P2(1024) < 200)
|
||||
InitTracerTurret(sp - sprite, pp->PlayerSprite, pp->horiz);
|
||||
InitTracerTurret(sp - sprite, pp->PlayerSprite, fix16_to_int(pp->q16horiz));
|
||||
|
||||
daang = 64;
|
||||
if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1)
|
||||
|
@ -18568,7 +18568,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
|
|||
else
|
||||
{
|
||||
int horiz;
|
||||
horiz = pp->horiz;
|
||||
horiz = fix16_to_int(pp->q16horiz);
|
||||
if (horiz < 75)
|
||||
horiz = 75;
|
||||
|
||||
|
@ -19310,9 +19310,9 @@ InitGrenade(PLAYERp pp)
|
|||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||
SET(wu->Flags, SPR_UNDERWATER);
|
||||
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
|
||||
////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",pp->horiz, pp->horizoff, pp->horizoff + pp->horiz);
|
||||
////DSPRINTF(ds,"q16horiz %d, ho %d, ho+ho %d",fix16_to_int(pp->q16horiz), fix16_to_int(pp->q16horizoff), fix16_to_int(pp->q16horizoff + pp->q16horiz));
|
||||
//MONO_PRINT(ds);
|
||||
|
||||
oclipdist = pp->SpriteP->clipdist;
|
||||
|
@ -19457,7 +19457,7 @@ InitMine(PLAYERp pp)
|
|||
wp->xrepeat = 32;
|
||||
wp->shade = -15;
|
||||
wp->clipdist = 128L>>2;
|
||||
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
wu->WeaponNum = u->WeaponNum;
|
||||
wu->Radius = 200;
|
||||
wu->ceiling_dist = Z(5);
|
||||
|
@ -19470,7 +19470,7 @@ InitMine(PLAYERp pp)
|
|||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||
SET(wu->Flags, SPR_UNDERWATER);
|
||||
|
||||
//wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||
//wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
||||
|
||||
MissileSetPos(w, DoMine, 800);
|
||||
|
||||
|
@ -19623,8 +19623,8 @@ InitFireball(PLAYERp pp)
|
|||
|
||||
wu->ceiling_dist = Z(6);
|
||||
wu->floor_dist = Z(6);
|
||||
//zvel = ((100 - pp->horiz) * (100+ADJUST));
|
||||
zvel = ((100 - pp->horiz) * (240L));
|
||||
//zvel = ((100 - fix16_to_int(pp->q16horiz)) * (100+ADJUST));
|
||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (240L));
|
||||
|
||||
//wu->RotNum = 5;
|
||||
//NewStateGroup(w, &sg_Fireball);
|
||||
|
|
Loading…
Reference in a new issue