mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-16 12:40:38 +00:00
Revert "SW: Improve main game loop."
This reverts commite878c5bab8
. Revert "SW: Use Q16.16 for horiz." This reverts commitf07a0ae01e
. Revert "SW: Use Q16.16 for angle." This reverts commit1ecc74c2ec
. Revert "SW: Minor repairs for Q16.16 implementation." This reverts commitd78d046bad
. Revert "SW: Process input at frame rate." This reverts commitc162014dab
. Revert "SW: Amendments to accommodate changes in master." This reverts commiteaa51138ad
. Revert "SW: Fix incorrectly declared function input type." This reverts commit1cdd5b08d8
. Revert "SW: Amend scaleAdjustmentToInterval() with correct value for SW." This reverts commitd4dd737cd5
. Revert "SW: Refinements to new input code." This reverts commit5ebc65a1fb
. Revert "SW: Adjust look and snap up/down keys and slightly tune PLAYER_TURN_AMOUNT." This reverts commit2852536dbf
. Revert "SW: Get PLAYER_TURN_SCALE to be just right." This reverts commit4630c8a0b7
. Revert "SW: Make map follow mode work better." This reverts commit8e94c48eff
. Revert "SW: Remove line accidentally left from 'MoveScrollMode2D()'." This reverts commit5db8047b41
. Revert "Fix multiplayer desync after the change to q16 angle and horiz." This reverts commit3bc46078b8
. Revert "SW: Revert commented out horiz->q16horiz renames in DSPRINTF strings" This reverts commit537313f620
. Revert "sw/src/draw.cpp:drawscreen: We can set the pp->si* fields just once," This reverts commitd2e9595980
. Revert "sw/src/game.cpp:LoadLevel: Rename q16ang -> ang" This reverts commita178961a3e
. Revert "SW: Minor tweaks." This reverts commit377ba68344
. Revert "SW: Further refine turning and optimise horizon adjustment." This reverts commit039022d9ac
. Revert "SW: Don't process input at frame rate if ScrollMode2D is true." This reverts commit1aa1e62c4d
. Revert "SW: Use a bit more Q16.16 in places." This reverts commit40ca656f38
. Revert "SW: Use the old interpolation path in drawscreen if player is dead" This reverts commit2d73466425
. Revert "SW: Smooth out 180 degree turn landing and replace some fix16_min/max with fix16_clamp." This reverts commit0996e87f79
. Revert "Change Next/Previous Weapon button handling for Shadow Warrior." This reverts commitf6b8ca6a22
. Revert "SW: Make "Center_View" key return smoothly." This reverts commit23c401fbc2
. Revert "SW: Use the old interpolation path in drawscreen if player is dead" This reverts commit43ec16eb55
. Revert "Interpolation fixes for SW:" This reverts commitac8a7ecfbd
. Revert "SW: Reset the number of interpolations on level load" This reverts commit04bf8499e7
. Revert "Another change modifying saved game format in SW:" This reverts commite80888523e
. Revert "SW: Interpolate sector objects in non-demo, single player games." This reverts commit996ab77cf4
. Revert "- fixed merge errors in SW." This reverts commitb8cfa94568
. Revert "- fix interpolation stutters when opening console for SW." This reverts commit99fdbfb6cb
. Revert "- reset buttonMap button states after returning from pause for SW (stops keys acting stuck down if down prior to pausing)." This reverts commit693b6955da
. Revert "SW: fix stupid input scaling bug" This reverts commit1c79e6e17c
. Revert "SW: Make vehicle input better." This reverts commit670a53c402
. Revert "SW: Change fix16_from_float() to fix16_from_int() that was changed in4630c8a0b7
but should have been reverted in 377ba68344e34495638c6fa7685ff78c9a0ed6f8." This reverts commit423c9da071
. Revert "SW: Remove ScrollMode2D extern boolean and move into PLAYERp struct." This reverts commit31eb55c1fa
.
This commit is contained in:
parent
31eb55c1fa
commit
83936bf5eb
23 changed files with 892 additions and 943 deletions
|
@ -194,7 +194,7 @@ DemoWriteHeader(void)
|
||||||
dsp.z = pp->posz;
|
dsp.z = pp->posz;
|
||||||
fwrite(&dsp, sizeof(dsp), 1, DemoFileOut);
|
fwrite(&dsp, sizeof(dsp), 1, DemoFileOut);
|
||||||
fwrite(&pp->Flags, sizeof(pp->Flags), 1, DemoFileOut);
|
fwrite(&pp->Flags, sizeof(pp->Flags), 1, DemoFileOut);
|
||||||
fwrite(&pp->q16ang, sizeof(pp->q16ang), 1, DemoFileOut);
|
fwrite(&pp->pang, sizeof(pp->pang), 1, DemoFileOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(&Skill, sizeof(Skill), 1, DemoFileOut);
|
fwrite(&Skill, sizeof(Skill), 1, DemoFileOut);
|
||||||
|
@ -252,7 +252,7 @@ DemoReadHeader(void)
|
||||||
//pp->cursectnum = 0;
|
//pp->cursectnum = 0;
|
||||||
//updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum);
|
//updatesectorz(pp->posx, pp->posy, pp->posz, &pp->cursectnum);
|
||||||
DREAD(&pp->Flags, sizeof(pp->Flags), 1, DemoFileIn);
|
DREAD(&pp->Flags, sizeof(pp->Flags), 1, DemoFileIn);
|
||||||
DREAD(&pp->q16ang, sizeof(pp->q16ang), 1, DemoFileIn);
|
DREAD(&pp->pang, sizeof(pp->pang), 1, DemoFileIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
DREAD(&Skill, sizeof(Skill), 1, DemoFileIn);
|
DREAD(&Skill, sizeof(Skill), 1, DemoFileIn);
|
||||||
|
|
|
@ -75,6 +75,7 @@ extern short HelpPagePic[];
|
||||||
extern ParentalStruct aVoxelArray[MAXTILES];
|
extern ParentalStruct aVoxelArray[MAXTILES];
|
||||||
extern SWBOOL RedrawScreen;
|
extern SWBOOL RedrawScreen;
|
||||||
SWBOOL RedrawCompass=FALSE;
|
SWBOOL RedrawCompass=FALSE;
|
||||||
|
extern int Follow_posx,Follow_posy;
|
||||||
|
|
||||||
int ConnectCopySprite(uspritetype const * tsp);
|
int ConnectCopySprite(uspritetype const * tsp);
|
||||||
void PreDrawStackedWater(void);
|
void PreDrawStackedWater(void);
|
||||||
|
@ -885,7 +886,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
|
||||||
}
|
}
|
||||||
|
|
||||||
tsp->z = tsp->z + pp->siz;
|
tsp->z = tsp->z + pp->siz;
|
||||||
tsp->ang = fix16_to_int(pp->q16ang);
|
tsp->ang = pp->siang;
|
||||||
//continue;
|
//continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1054,9 +1055,11 @@ ResizeView(PLAYERp pp)
|
||||||
|
|
||||||
if (inputState.GetKeyStatus(KEYSC_ESC))
|
if (inputState.GetKeyStatus(KEYSC_ESC))
|
||||||
{
|
{
|
||||||
|
extern SWBOOL ScrollMode2D;
|
||||||
|
|
||||||
inputState.ClearKeyStatus(sc_Escape);
|
inputState.ClearKeyStatus(sc_Escape);
|
||||||
dimensionmode = 3;
|
dimensionmode = 3;
|
||||||
pp->ScrollMode2D = FALSE;
|
ScrollMode2D = FALSE;
|
||||||
SetRedrawScreen(pp);
|
SetRedrawScreen(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1090,7 +1093,7 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1
|
||||||
*vz = pp->posz;
|
*vz = pp->posz;
|
||||||
*vsectnum = pp->cursectnum;
|
*vsectnum = pp->cursectnum;
|
||||||
|
|
||||||
*ang = fix16_to_int(pp->q16ang) + pp->view_outside_dang;
|
*ang = pp->pang + pp->view_outside_dang;
|
||||||
|
|
||||||
nx = sintable[NORM_ANGLE(*ang + 512 + 1024)] << 11;
|
nx = sintable[NORM_ANGLE(*ang + 512 + 1024)] << 11;
|
||||||
ny = sintable[NORM_ANGLE(*ang + 1024)] << 11;
|
ny = sintable[NORM_ANGLE(*ang + 1024)] << 11;
|
||||||
|
@ -1138,7 +1141,7 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
BackView(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
||||||
{
|
{
|
||||||
vec3_t n = { *nx, *ny, *nz };
|
vec3_t n = { *nx, *ny, *nz };
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
|
@ -1150,7 +1153,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
||||||
|
|
||||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||||
|
|
||||||
ang = fix16_to_int(*nq16ang) + pp->view_outside_dang;
|
ang = *nang + pp->view_outside_dang;
|
||||||
|
|
||||||
// Calculate the vector (nx,ny,nz) to shoot backwards
|
// Calculate the vector (nx,ny,nz) to shoot backwards
|
||||||
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
|
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
|
||||||
|
@ -1212,7 +1215,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
||||||
flag_backup = hsp->cstat;
|
flag_backup = hsp->cstat;
|
||||||
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||||
BackView(nx, ny, nz, vsect, nq16ang, horiz);
|
BackView(nx, ny, nz, vsect, nang, horiz);
|
||||||
hsp->cstat = flag_backup;
|
hsp->cstat = flag_backup;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1253,11 +1256,11 @@ BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
||||||
// Make sure vsect is correct
|
// Make sure vsect is correct
|
||||||
updatesectorz(*nx, *ny, *nz, vsect);
|
updatesectorz(*nx, *ny, *nz, vsect);
|
||||||
|
|
||||||
*nq16ang = fix16_from_int(ang);
|
*nang = ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
|
CircleCamera(int *nx, int *ny, int *nz, short *vsect, short *nang, short horiz)
|
||||||
{
|
{
|
||||||
vec3_t n = { *nx, *ny, *nz };
|
vec3_t n = { *nx, *ny, *nz };
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
|
@ -1267,7 +1270,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
|
||||||
PLAYERp pp = &Player[screenpeek];
|
PLAYERp pp = &Player[screenpeek];
|
||||||
short ang;
|
short ang;
|
||||||
|
|
||||||
ang = fix16_to_int(*nq16ang) + pp->circle_camera_ang;
|
ang = *nang + pp->circle_camera_ang;
|
||||||
|
|
||||||
// Calculate the vector (nx,ny,nz) to shoot backwards
|
// Calculate the vector (nx,ny,nz) to shoot backwards
|
||||||
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 4);
|
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 4);
|
||||||
|
@ -1333,7 +1336,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
|
||||||
flag_backup = hsp->cstat;
|
flag_backup = hsp->cstat;
|
||||||
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
|
|
||||||
CircleCamera(nx, ny, nz, vsect, nq16ang, horiz);
|
CircleCamera(nx, ny, nz, vsect, nang, horiz);
|
||||||
hsp->cstat = flag_backup;
|
hsp->cstat = flag_backup;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1365,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
|
||||||
// Make sure vsect is correct
|
// Make sure vsect is correct
|
||||||
updatesectorz(*nx, *ny, *nz, vsect);
|
updatesectorz(*nx, *ny, *nz, vsect);
|
||||||
|
|
||||||
*nq16ang = fix16_from_int(ang);
|
*nang = ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString GameInterface::statFPS()
|
FString GameInterface::statFPS()
|
||||||
|
@ -1394,7 +1397,7 @@ FString GameInterface::GetCoordString()
|
||||||
out.AppendFormat("POSX:%d ", pp->posx);
|
out.AppendFormat("POSX:%d ", pp->posx);
|
||||||
out.AppendFormat("POSY:%d ", pp->posy);
|
out.AppendFormat("POSY:%d ", pp->posy);
|
||||||
out.AppendFormat("POSZ:%d ", pp->posz);
|
out.AppendFormat("POSZ:%d ", pp->posz);
|
||||||
out.AppendFormat("ANG:%d\n", (int32_t)fix16_to_int(pp->q16ang));
|
out.AppendFormat("ANG:%d\n", (int32_t)pp->pang);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -1573,7 +1576,7 @@ void DrawCrosshair(PLAYERp pp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fix16_t *tq16ang, fix16_t *tq16horiz)
|
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, short *tang, int *thoriz)
|
||||||
{
|
{
|
||||||
int i,nexti;
|
int i,nexti;
|
||||||
short ang;
|
short ang;
|
||||||
|
@ -1614,7 +1617,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fix16_t
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
pp->last_camera_sp = sp;
|
pp->last_camera_sp = sp;
|
||||||
CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100);
|
CircleCamera(tx, ty, tz, tsectnum, tang, 100);
|
||||||
found_camera = TRUE;
|
found_camera = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1640,12 +1643,14 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fix16_t
|
||||||
zvect = 0;
|
zvect = 0;
|
||||||
|
|
||||||
// new horiz to player
|
// new horiz to player
|
||||||
*tq16horiz = fix16_clamp(fix16_from_int(100 - (zvect/256)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
*thoriz = 100 - (zvect/256);
|
||||||
|
*thoriz = max(*thoriz, PLAYER_HORIZ_MIN);
|
||||||
|
*thoriz = min(*thoriz, PLAYER_HORIZ_MAX);
|
||||||
|
|
||||||
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz);
|
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,thoriz %d",xvect,yvect,zvect,*thoriz);
|
||||||
MONO_PRINT(ds);
|
MONO_PRINT(ds);
|
||||||
|
|
||||||
*tq16ang = fix16_from_int(ang);
|
*tang = ang;
|
||||||
*tx = sp->x;
|
*tx = sp->x;
|
||||||
*ty = sp->y;
|
*ty = sp->y;
|
||||||
*tz = sp->z;
|
*tz = sp->z;
|
||||||
|
@ -1860,7 +1865,7 @@ void PreDrawStackedWater(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FAF_DrawRooms(int x, int y, int z, fix16_t q16ang, fix16_t q16horiz, short sectnum)
|
void FAF_DrawRooms(int x, int y, int z, short ang, int horiz, short sectnum)
|
||||||
{
|
{
|
||||||
short i,nexti;
|
short i,nexti;
|
||||||
|
|
||||||
|
@ -1887,7 +1892,7 @@ void FAF_DrawRooms(int x, int y, int z, fix16_t q16ang, fix16_t q16horiz, short
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderDrawRoomsQ16(x,y,z,q16ang,q16horiz,sectnum);
|
drawrooms(x,y,z,ang,horiz,sectnum);
|
||||||
|
|
||||||
TRAVERSE_SPRITE_STAT(headspritestat[STAT_CEILING_FLOOR_PIC_OVERRIDE], i, nexti)
|
TRAVERSE_SPRITE_STAT(headspritestat[STAT_CEILING_FLOOR_PIC_OVERRIDE], i, nexti)
|
||||||
{
|
{
|
||||||
|
@ -1919,14 +1924,14 @@ short ScreenSavePic = FALSE;
|
||||||
|
|
||||||
SWBOOL PicInView(short, SWBOOL);
|
SWBOOL PicInView(short, SWBOOL);
|
||||||
void DoPlayerDiveMeter(PLAYERp pp);
|
void DoPlayerDiveMeter(PLAYERp pp);
|
||||||
|
void MoveScrollMode2D(PLAYERp pp);
|
||||||
|
|
||||||
void
|
void
|
||||||
drawscreen(PLAYERp pp)
|
drawscreen(PLAYERp pp)
|
||||||
{
|
{
|
||||||
extern SWBOOL DemoMode,CameraTestMode;
|
extern SWBOOL DemoMode,CameraTestMode;
|
||||||
int tx, ty, tz;
|
int tx, ty, tz,thoriz;
|
||||||
fix16_t tq16horiz, tq16ang;
|
short tang,tsectnum;
|
||||||
short tsectnum;
|
|
||||||
short i,j;
|
short i,j;
|
||||||
int bob_amt = 0;
|
int bob_amt = 0;
|
||||||
int quake_z, quake_x, quake_y;
|
int quake_z, quake_x, quake_y;
|
||||||
|
@ -2007,17 +2012,8 @@ drawscreen(PLAYERp pp)
|
||||||
tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio);
|
tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio);
|
||||||
ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio);
|
ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio);
|
||||||
tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio);
|
tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio);
|
||||||
if (pp == Player+myconnectindex && (pp->on_vehicle || pp->sop_control || TEST(pp->Flags, PF_DEAD)))
|
tang = camerapp->oang + mulscale16(((camerapp->pang + 1024 - camerapp->oang) & 2047) - 1024, smoothratio);
|
||||||
{
|
thoriz = camerapp->ohoriz + mulscale16(camerapp->horiz - camerapp->ohoriz, 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);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tq16ang = camerapp->q16ang;
|
|
||||||
tq16horiz = camerapp->q16horiz;
|
|
||||||
}
|
|
||||||
|
|
||||||
tsectnum = camerapp->cursectnum;
|
tsectnum = camerapp->cursectnum;
|
||||||
|
|
||||||
//ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
//ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
||||||
|
@ -2048,52 +2044,53 @@ drawscreen(PLAYERp pp)
|
||||||
// with "last valid" code this should never happen
|
// with "last valid" code this should never happen
|
||||||
// ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
// ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS);
|
||||||
|
|
||||||
|
pp->six = tx;
|
||||||
|
pp->siy = ty;
|
||||||
|
pp->siz = tz - pp->posz;
|
||||||
|
pp->siang = tang;
|
||||||
|
|
||||||
if (pp->sop_riding || pp->sop_control)
|
if (pp->sop_riding || pp->sop_control)
|
||||||
{
|
|
||||||
if (pp->sop_control && !InterpolateSectObj)
|
|
||||||
{
|
{
|
||||||
tx = pp->posx;
|
tx = pp->posx;
|
||||||
ty = pp->posy;
|
ty = pp->posy;
|
||||||
tz = pp->posz;
|
tz = pp->posz;
|
||||||
tq16ang = pp->q16ang;
|
tang = pp->pang;
|
||||||
}
|
|
||||||
tsectnum = pp->cursectnum;
|
tsectnum = pp->cursectnum;
|
||||||
updatesectorz(tx, ty, tz, &tsectnum);
|
updatesectorz(tx, ty, tz, &tsectnum);
|
||||||
}
|
|
||||||
|
|
||||||
pp->six = tx;
|
pp->six = tx;
|
||||||
pp->siy = ty;
|
pp->siy = ty;
|
||||||
pp->siz = tz - pp->posz;
|
pp->siz = tz - pp->posz;
|
||||||
|
pp->siang = tang;
|
||||||
|
}
|
||||||
|
|
||||||
QuakeViewChange(camerapp, &quake_z, &quake_x, &quake_y, &quake_ang);
|
QuakeViewChange(camerapp, &quake_z, &quake_x, &quake_y, &quake_ang);
|
||||||
VisViewChange(camerapp, &g_visibility);
|
VisViewChange(camerapp, &g_visibility);
|
||||||
tz = tz + quake_z;
|
tz = tz + quake_z;
|
||||||
tx = tx + quake_x;
|
tx = tx + quake_x;
|
||||||
ty = ty + quake_y;
|
ty = ty + quake_y;
|
||||||
//tq16horiz = tq16horiz + fix16_from_int(quake_x);
|
//thoriz = thoriz + quake_x;
|
||||||
tq16ang = fix16_sadd(tq16ang, fix16_from_int(quake_ang)) & 0x7FFFFFF;
|
tang = NORM_ANGLE(tang + quake_ang);
|
||||||
|
|
||||||
if (pp->sop_remote)
|
if (pp->sop_remote)
|
||||||
{
|
{
|
||||||
if (TEST_BOOL1(pp->remote_sprite))
|
if (TEST_BOOL1(pp->remote_sprite))
|
||||||
tq16ang = fix16_from_int(pp->remote_sprite->ang);
|
tang = pp->remote_sprite->ang;
|
||||||
else
|
else
|
||||||
tq16ang = fix16_from_int(getangle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty));
|
tang = getangle(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE))
|
//if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||||
{
|
{
|
||||||
BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, fix16_to_int(tq16horiz));
|
BackView(&tx, &ty, &tz, &tsectnum, &tang, thoriz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bob_amt = camerapp->bob_amt;
|
bob_amt = camerapp->bob_amt;
|
||||||
|
|
||||||
if (DemoMode || CameraTestMode)
|
if (DemoMode || CameraTestMode)
|
||||||
{
|
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &thoriz);
|
||||||
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tq16ang, &tq16horiz);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TEST(pp->Flags, PF_VIEW_FROM_CAMERA|PF_VIEW_FROM_OUTSIDE))
|
if (!TEST(pp->Flags, PF_VIEW_FROM_CAMERA|PF_VIEW_FROM_OUTSIDE))
|
||||||
|
@ -2102,8 +2099,10 @@ drawscreen(PLAYERp pp)
|
||||||
tz += camerapp->bob_z;
|
tz += camerapp->bob_z;
|
||||||
|
|
||||||
// recoil only when not in camera
|
// recoil only when not in camera
|
||||||
//tq16horiz = fix16_clamp(fix16_sadd(tq16horiz, fix16_from_int(camerapp->recoil_horizoff)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
//thoriz = thoriz + camerapp->recoil_horizoff;
|
||||||
tq16horiz = fix16_clamp(fix16_sadd(tq16horiz, fix16_from_int(pp->recoil_horizoff)), fix16_from_int(PLAYER_HORIZ_MIN), fix16_from_int(PLAYER_HORIZ_MAX));
|
thoriz = thoriz + pp->recoil_horizoff;
|
||||||
|
thoriz = max(thoriz, PLAYER_HORIZ_MIN);
|
||||||
|
thoriz = min(thoriz, PLAYER_HORIZ_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_usenewaspect)
|
if (r_usenewaspect)
|
||||||
|
@ -2118,25 +2117,25 @@ drawscreen(PLAYERp pp)
|
||||||
if (dimensionmode != 6)// && !ScreenSavePic)
|
if (dimensionmode != 6)// && !ScreenSavePic)
|
||||||
{
|
{
|
||||||
// Cameras must be done before the main loop.
|
// Cameras must be done before the main loop.
|
||||||
JS_DrawCameras(pp, tx, ty, tz);
|
JS_DrawCameras(pp, tx, ty, tz, tang, thoriz);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->BeginScene();
|
screen->BeginScene();
|
||||||
OverlapDraw = TRUE;
|
OverlapDraw = TRUE;
|
||||||
DrawOverlapRoom(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
DrawOverlapRoom(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
OverlapDraw = FALSE;
|
OverlapDraw = FALSE;
|
||||||
|
|
||||||
if (dimensionmode != 6)// && !ScreenSavePic)
|
if (dimensionmode != 6)// && !ScreenSavePic)
|
||||||
{
|
{
|
||||||
// TEST this! Changed to camerapp
|
// TEST this! Changed to camerapp
|
||||||
//JS_DrawMirrors(camerapp, tx, ty, tz, tq16ang, tq16horiz);
|
//JS_DrawMirrors(camerapp, tx, ty, tz, tang, thoriz);
|
||||||
JS_DrawMirrors(pp, tx, ty, tz, tq16ang, tq16horiz);
|
JS_DrawMirrors(pp, tx, ty, tz, tang, thoriz);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This call is redundant if the tiled overhead map is shown, but the
|
// TODO: This call is redundant if the tiled overhead map is shown, but the
|
||||||
// HUD elements should be properly outputted with hardware rendering first.
|
// HUD elements should be properly outputted with hardware rendering first.
|
||||||
if (!FAF_DebugView)
|
if (!FAF_DebugView)
|
||||||
FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
|
|
||||||
analyzesprites(tx, ty, tz, FALSE);
|
analyzesprites(tx, ty, tz, FALSE);
|
||||||
post_analyzesprites();
|
post_analyzesprites();
|
||||||
|
@ -2187,10 +2186,12 @@ drawscreen(PLAYERp pp)
|
||||||
|
|
||||||
if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex)
|
if ((dimensionmode == 5 || dimensionmode == 6) && pp == Player+myconnectindex)
|
||||||
{
|
{
|
||||||
if (pp->ScrollMode2D)
|
extern SWBOOL ScrollMode2D;
|
||||||
|
|
||||||
|
if (ScrollMode2D)
|
||||||
{
|
{
|
||||||
tx = pp->mfposx;
|
tx = Follow_posx;
|
||||||
ty = pp->mfposy;
|
ty = Follow_posy;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < MAXSPRITES; j++)
|
for (j = 0; j < MAXSPRITES; j++)
|
||||||
|
@ -2210,11 +2211,11 @@ drawscreen(PLAYERp pp)
|
||||||
{
|
{
|
||||||
// only clear the actual window.
|
// only clear the actual window.
|
||||||
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);
|
twod->AddColorOnlyQuad(windowxy1.x, windowxy1.y, (windowxy2.x + 1) - windowxy1.x, (windowxy2.y + 1) - windowxy1.y, 0xff000000);
|
||||||
renderDrawMapView(tx, ty, zoom, fix16_to_int(tq16ang));
|
renderDrawMapView(tx, ty, zoom, tang);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the line map on top of texture 2d map or just stand alone
|
// Draw the line map on top of texture 2d map or just stand alone
|
||||||
drawoverheadmap(tx, ty, zoom, fix16_to_int(tq16ang), pp->ScrollMode2D);
|
drawoverheadmap(tx, ty, zoom, tang);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < MAXSPRITES; j++)
|
for (j = 0; j < MAXSPRITES; j++)
|
||||||
|
@ -2259,6 +2260,8 @@ drawscreen(PLAYERp pp)
|
||||||
if (!M_Active())
|
if (!M_Active())
|
||||||
SecretInfo(pp);
|
SecretInfo(pp);
|
||||||
|
|
||||||
|
videoNextPage();
|
||||||
|
|
||||||
#if SYNC_TEST
|
#if SYNC_TEST
|
||||||
SyncStatMessage();
|
SyncStatMessage();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2270,9 +2273,6 @@ drawscreen(PLAYERp pp)
|
||||||
short_restoreinterpolations(); // Stick at end of drawscreen
|
short_restoreinterpolations(); // Stick at end of drawscreen
|
||||||
|
|
||||||
PostDraw();
|
PostDraw();
|
||||||
|
|
||||||
videoNextPage();
|
|
||||||
|
|
||||||
DrawScreen = FALSE;
|
DrawScreen = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,7 +2345,7 @@ DrawCompass(PLAYERp pp)
|
||||||
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
|
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ang = fix16_to_int(pp->q16ang);
|
ang = pp->pang;
|
||||||
|
|
||||||
if (pp->sop_remote)
|
if (pp->sop_remote)
|
||||||
ang = 0;
|
ang = 0;
|
||||||
|
|
|
@ -52,7 +52,6 @@ Things required to make savegames work:
|
||||||
#include "names2.h"
|
#include "names2.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "interp.h"
|
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
#include "sector.h"
|
#include "sector.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
@ -147,6 +146,7 @@ char DemoText[3][64];
|
||||||
int DemoTextYstart = 0;
|
int DemoTextYstart = 0;
|
||||||
|
|
||||||
SWBOOL DoubleInitAWE32 = FALSE;
|
SWBOOL DoubleInitAWE32 = FALSE;
|
||||||
|
int Follow_posx=0,Follow_posy=0;
|
||||||
|
|
||||||
SWBOOL NoMeters = FALSE;
|
SWBOOL NoMeters = FALSE;
|
||||||
short IntroAnimCount = 0;
|
short IntroAnimCount = 0;
|
||||||
|
@ -186,8 +186,8 @@ SWBOOL NoDemoStartup = FALSE;
|
||||||
SWBOOL FirstTimeIntoGame;
|
SWBOOL FirstTimeIntoGame;
|
||||||
|
|
||||||
SWBOOL BorderAdjust = FALSE;
|
SWBOOL BorderAdjust = FALSE;
|
||||||
SWBOOL InterpolateSectObj;
|
|
||||||
SWBOOL LocationInfo = 0;
|
SWBOOL LocationInfo = 0;
|
||||||
|
void drawoverheadmap(int cposx, int cposy, int czoom, short cang);
|
||||||
int DispFrameRate = FALSE;
|
int DispFrameRate = FALSE;
|
||||||
int DispMono = TRUE;
|
int DispMono = TRUE;
|
||||||
int Fog = FALSE;
|
int Fog = FALSE;
|
||||||
|
@ -228,6 +228,7 @@ SWBOOL PauseMode = FALSE;
|
||||||
SWBOOL PauseKeySet = FALSE;
|
SWBOOL PauseKeySet = FALSE;
|
||||||
SWBOOL SlowMode = FALSE;
|
SWBOOL SlowMode = FALSE;
|
||||||
SWBOOL FrameAdvanceTics = 3;
|
SWBOOL FrameAdvanceTics = 3;
|
||||||
|
SWBOOL ScrollMode2D = FALSE;
|
||||||
|
|
||||||
SWBOOL DebugSO = FALSE;
|
SWBOOL DebugSO = FALSE;
|
||||||
SWBOOL DebugPanel = FALSE;
|
SWBOOL DebugPanel = FALSE;
|
||||||
|
@ -275,8 +276,6 @@ uint8_t DebugPrintColor = 255;
|
||||||
|
|
||||||
int krandcount;
|
int krandcount;
|
||||||
|
|
||||||
SW_PACKET localInput;
|
|
||||||
|
|
||||||
/// L O C A L P R O T O T Y P E S /////////////////////////////////////////////////////////
|
/// L O C A L P R O T O T Y P E S /////////////////////////////////////////////////////////
|
||||||
void BOT_DeleteAllBots(void);
|
void BOT_DeleteAllBots(void);
|
||||||
void BotPlayerInsert(PLAYERp pp);
|
void BotPlayerInsert(PLAYERp pp);
|
||||||
|
@ -286,7 +285,6 @@ void MenuLevel(void);
|
||||||
void StatScreen(PLAYERp mpp);
|
void StatScreen(PLAYERp mpp);
|
||||||
void InitRunLevel(void);
|
void InitRunLevel(void);
|
||||||
void RunLevel(void);
|
void RunLevel(void);
|
||||||
void getinput(int playerNum);
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static FILE *debug_fout = NULL;
|
static FILE *debug_fout = NULL;
|
||||||
|
@ -588,8 +586,7 @@ void TerminateGame(void)
|
||||||
|
|
||||||
bool LoadLevel(const char *filename)
|
bool LoadLevel(const char *filename)
|
||||||
{
|
{
|
||||||
int16_t ang;
|
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &Player[0].pang, &Player[0].cursectnum) == -1)
|
||||||
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &ang, &Player[0].cursectnum) == -1)
|
|
||||||
{
|
{
|
||||||
Printf("Level not found: %s", filename);
|
Printf("Level not found: %s", filename);
|
||||||
return false;
|
return false;
|
||||||
|
@ -597,7 +594,6 @@ bool LoadLevel(const char *filename)
|
||||||
currentLevel = &mapList[Level];
|
currentLevel = &mapList[Level];
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(currentLevel->labelName);
|
STAT_NewLevel(currentLevel->labelName);
|
||||||
Player[0].q16ang = fix16_from_int(ang);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,7 +939,6 @@ void InitLevelGlobals(void)
|
||||||
AnimCnt = 0;
|
AnimCnt = 0;
|
||||||
left_foot = FALSE;
|
left_foot = FALSE;
|
||||||
screenpeek = myconnectindex;
|
screenpeek = myconnectindex;
|
||||||
numinterpolations = short_numinterpolations = 0;
|
|
||||||
|
|
||||||
gNet.TimeLimitClock = gNet.TimeLimit;
|
gNet.TimeLimitClock = gNet.TimeLimit;
|
||||||
|
|
||||||
|
@ -951,7 +946,6 @@ void InitLevelGlobals(void)
|
||||||
sumowasseen = FALSE;
|
sumowasseen = FALSE;
|
||||||
zillawasseen = FALSE;
|
zillawasseen = FALSE;
|
||||||
memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
|
memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
|
||||||
InterpolateSectObj = !CommEnabled;// && !PedanticMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitLevelGlobals2(void)
|
void InitLevelGlobals2(void)
|
||||||
|
@ -2392,6 +2386,48 @@ void dsprintf_null(char *str, const char *format, ...)
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MoveLoop(void)
|
||||||
|
{
|
||||||
|
int pnum;
|
||||||
|
|
||||||
|
getpackets();
|
||||||
|
|
||||||
|
if (PredictionOn && CommEnabled)
|
||||||
|
{
|
||||||
|
while (predictmovefifoplc < Player[myconnectindex].movefifoend)
|
||||||
|
{
|
||||||
|
DoPrediction(ppp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//While you have new input packets to process...
|
||||||
|
if (!CommEnabled)
|
||||||
|
bufferjitter = 0;
|
||||||
|
|
||||||
|
while (Player[myconnectindex].movefifoend - movefifoplc > bufferjitter)
|
||||||
|
{
|
||||||
|
//Make sure you have at least 1 packet from everyone else
|
||||||
|
for (pnum=connecthead; pnum>=0; pnum=connectpoint2[pnum])
|
||||||
|
{
|
||||||
|
if (movefifoplc == Player[pnum].movefifoend)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Pnum is >= 0 only if last loop was broken, meaning a player wasn't caught up
|
||||||
|
if (pnum >= 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
domovethings();
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
//if (DemoSyncRecord)
|
||||||
|
// demosync_record();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitPlayerGameSettings(void)
|
void InitPlayerGameSettings(void)
|
||||||
{
|
{
|
||||||
|
@ -2505,6 +2541,8 @@ void InitRunLevel(void)
|
||||||
StartAmbientSound();
|
StartAmbientSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void faketimerhandler();
|
||||||
|
|
||||||
void RunLevel(void)
|
void RunLevel(void)
|
||||||
{
|
{
|
||||||
InitRunLevel();
|
InitRunLevel();
|
||||||
|
@ -2519,44 +2557,21 @@ void RunLevel(void)
|
||||||
handleevents();
|
handleevents();
|
||||||
OSD_DispatchQueued();
|
OSD_DispatchQueued();
|
||||||
D_ProcessEvents();
|
D_ProcessEvents();
|
||||||
|
faketimerhandler();
|
||||||
if (LoadGameOutsideMoveLoop)
|
if (LoadGameOutsideMoveLoop)
|
||||||
{
|
{
|
||||||
return; // Stop the game loop if a savegame was loaded from the menu.
|
return; // Stop the game loop if a savegame was loaded from the menu.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M_Active() || GUICapture || GamePaused)
|
if (M_Active())
|
||||||
{
|
{
|
||||||
ototalclock = (int)totalclock - (120 / synctics);
|
ototalclock = (int)totalclock;
|
||||||
buttonMap.ResetButtonStates();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PLAYERp const pp = Player + myconnectindex;
|
MoveLoop();
|
||||||
|
|
||||||
while ((totalclock - ototalclock) >= synctics)
|
|
||||||
{
|
|
||||||
ototalclock += synctics;
|
|
||||||
|
|
||||||
getinput(myconnectindex);
|
|
||||||
|
|
||||||
auto const q16ang = fix16_to_int(pp->q16ang);
|
|
||||||
auto & input = pp->inputfifo[Player[myconnectindex].movefifoend & (MOVEFIFOSIZ - 1)];
|
|
||||||
|
|
||||||
input = localInput;
|
|
||||||
input.vel = mulscale9(localInput.vel, sintable[NORM_ANGLE(q16ang + 512)]) +
|
|
||||||
mulscale9(localInput.svel, sintable[NORM_ANGLE(q16ang)]);
|
|
||||||
input.svel = mulscale9(localInput.vel, sintable[NORM_ANGLE(q16ang)]) +
|
|
||||||
mulscale9(localInput.svel, sintable[NORM_ANGLE(q16ang + 1536)]);
|
|
||||||
|
|
||||||
pp->movefifoend++;
|
|
||||||
localInput = {};
|
|
||||||
|
|
||||||
domovethings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pp->ScrollMode2D && !pp->on_vehicle)
|
|
||||||
getinput(myconnectindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawscreen(Player + screenpeek);
|
drawscreen(Player + screenpeek);
|
||||||
|
|
||||||
|
@ -2774,7 +2789,7 @@ void ManualPlayerInsert(PLAYERp pp)
|
||||||
npp->posx = pp->posx;
|
npp->posx = pp->posx;
|
||||||
npp->posy = pp->posy;
|
npp->posy = pp->posy;
|
||||||
npp->posz = pp->posz;
|
npp->posz = pp->posz;
|
||||||
npp->q16ang = pp->q16ang;
|
npp->pang = pp->pang;
|
||||||
npp->cursectnum = pp->cursectnum;
|
npp->cursectnum = pp->cursectnum;
|
||||||
|
|
||||||
myconnectindex = numplayers;
|
myconnectindex = numplayers;
|
||||||
|
@ -2804,7 +2819,7 @@ void BotPlayerInsert(PLAYERp pp)
|
||||||
npp->posx = pp->posx;
|
npp->posx = pp->posx;
|
||||||
npp->posy = pp->posy;
|
npp->posy = pp->posy;
|
||||||
npp->posz = pp->posz-Z(100);
|
npp->posz = pp->posz-Z(100);
|
||||||
npp->q16ang = pp->q16ang;
|
npp->pang = pp->pang;
|
||||||
npp->cursectnum = pp->cursectnum;
|
npp->cursectnum = pp->cursectnum;
|
||||||
|
|
||||||
//myconnectindex = numplayers;
|
//myconnectindex = numplayers;
|
||||||
|
@ -3007,15 +3022,11 @@ void PauseKey(PLAYERp pp)
|
||||||
|
|
||||||
short MirrorDelay;
|
short MirrorDelay;
|
||||||
|
|
||||||
double elapsedInputTicks;
|
void getinput(SW_PACKET *loc)
|
||||||
double scaleAdjustmentToInterval(double x) { return x * (120 / synctics) / (1000.0 / elapsedInputTicks); }
|
|
||||||
|
|
||||||
void DoPlayerHorizon(PLAYERp pp, fix16_t *q16horz);
|
|
||||||
|
|
||||||
void getinput(int const playerNum)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PLAYERp pp = Player + playerNum;
|
PLAYERp pp = Player + myconnectindex;
|
||||||
|
PLAYERp newpp = Player + myconnectindex;
|
||||||
int inv_hotkey = 0;
|
int inv_hotkey = 0;
|
||||||
|
|
||||||
#define TURBOTURNTIME (120/8)
|
#define TURBOTURNTIME (120/8)
|
||||||
|
@ -3025,27 +3036,26 @@ void getinput(int const playerNum)
|
||||||
#define NORMALKEYMOVE 35
|
#define NORMALKEYMOVE 35
|
||||||
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
||||||
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
||||||
#define MAXANGVEL 1024
|
#define MAXANGVEL 100
|
||||||
#define MAXHORIZVEL 256
|
#define MAXAIMVEL 128
|
||||||
#define TURN_SHIFT 4
|
#define SET_LOC_KEY(loc, sync_num, key_test) SET(loc, ((!!(key_test)) << (sync_num)))
|
||||||
#define SET_LOC_KEY(bits, sync_num, key_test) SET(bits, ((!!(key_test)) << (sync_num)))
|
|
||||||
|
|
||||||
static int32_t turnheldtime;
|
static int32_t turnheldtime;
|
||||||
|
int32_t momx, momy;
|
||||||
|
|
||||||
// reset objects.
|
extern SWBOOL MenuButtonAutoRun;
|
||||||
SW_PACKET input {};
|
|
||||||
localInput = {};
|
|
||||||
localInput.bits = 0;
|
|
||||||
|
|
||||||
extern SWBOOL MenuButtonAutoAim;
|
extern SWBOOL MenuButtonAutoAim;
|
||||||
|
|
||||||
if (Prediction && CommEnabled)
|
if (Prediction && CommEnabled)
|
||||||
{
|
{
|
||||||
pp = ppp;
|
newpp = ppp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset all syncbits
|
||||||
|
loc->bits = 0;
|
||||||
|
|
||||||
// MAKE SURE THIS WILL GET SET
|
// MAKE SURE THIS WILL GET SET
|
||||||
SET_LOC_KEY(localInput.bits, SK_QUIT_GAME, MultiPlayQuitFlag);
|
SET_LOC_KEY(loc->bits, SK_QUIT_GAME, MultiPlayQuitFlag);
|
||||||
|
|
||||||
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
||||||
|
|
||||||
|
@ -3055,23 +3065,78 @@ void getinput(int const playerNum)
|
||||||
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
|
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
|
||||||
|
|
||||||
if (mouseaim)
|
if (mouseaim)
|
||||||
SET(Player[playerNum].Flags, PF_MOUSE_AIMING_ON);
|
SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||||
else
|
else
|
||||||
RESET(Player[playerNum].Flags, PF_MOUSE_AIMING_ON);
|
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||||
|
|
||||||
if (cl_autoaim)
|
if (cl_autoaim)
|
||||||
SET(Player[playerNum].Flags, PF_AUTO_AIM);
|
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
else
|
else
|
||||||
RESET(Player[playerNum].Flags, PF_AUTO_AIM);
|
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlInfo info;
|
ControlInfo info;
|
||||||
CONTROL_GetInput(&info);
|
CONTROL_GetInput(&info);
|
||||||
|
|
||||||
|
|
||||||
|
//info.dz = (info.dz * move_scale)>>8;
|
||||||
|
//info.dyaw = (info.dyaw * turn_scale)>>8;
|
||||||
|
|
||||||
|
PauseKey(pp);
|
||||||
|
|
||||||
|
if (PauseKeySet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// MAP KEY
|
||||||
|
if (buttonMap.ButtonDown(gamefunc_Map))
|
||||||
|
{
|
||||||
|
buttonMap.ClearButton(gamefunc_Map);
|
||||||
|
|
||||||
|
// Init follow coords
|
||||||
|
Follow_posx = pp->posx;
|
||||||
|
Follow_posy = pp->posy;
|
||||||
|
|
||||||
|
if (dimensionmode == 3)
|
||||||
|
dimensionmode = 5;
|
||||||
|
else if (dimensionmode == 5)
|
||||||
|
dimensionmode = 6;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MirrorDelay = 1;
|
||||||
|
dimensionmode = 3;
|
||||||
|
SetFragBar(pp);
|
||||||
|
ScrollMode2D = FALSE;
|
||||||
|
SetRedrawScreen(pp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle follow map mode on/off
|
||||||
|
if (dimensionmode == 5 || dimensionmode == 6)
|
||||||
|
{
|
||||||
|
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
||||||
|
{
|
||||||
|
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
|
||||||
|
ScrollMode2D = !ScrollMode2D;
|
||||||
|
Follow_posx = pp->posx;
|
||||||
|
Follow_posy = pp->posy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If in 2D follow mode, scroll around using glob vars
|
||||||
|
// Tried calling this in domovethings, but key response it too poor, skips key presses
|
||||||
|
// Note: ScrollMode2D = Follow mode, so this get called only during follow mode
|
||||||
|
if (ScrollMode2D && pp == Player + myconnectindex && !Prediction)
|
||||||
|
MoveScrollMode2D(Player + myconnectindex);
|
||||||
|
|
||||||
|
// !JIM! Added M_Active() so that you don't move at all while using menus
|
||||||
|
if (M_Active() || ScrollMode2D || InputMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | buttonMap.ButtonDown(gamefunc_Open)));
|
||||||
|
|
||||||
int const running = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
int const running = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||||
int32_t turnamount;
|
int32_t turnamount;
|
||||||
int32_t keymove;
|
int32_t keymove;
|
||||||
constexpr int analogTurnAmount = (NORMALTURN << 1);
|
|
||||||
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
constexpr int const analogExtent = 32767; // KEEPINSYNC sdlayer.cpp
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
|
@ -3093,178 +3158,58 @@ void getinput(int const playerNum)
|
||||||
keymove = NORMALKEYMOVE;
|
keymove = NORMALKEYMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PauseKey(pp);
|
|
||||||
|
|
||||||
if (PauseKeySet)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// MAP KEY
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Map))
|
|
||||||
{
|
|
||||||
buttonMap.ClearButton(gamefunc_Map);
|
|
||||||
|
|
||||||
// Init follow coords
|
|
||||||
pp->mfposx = pp->posx;
|
|
||||||
pp->mfposy = pp->posy;
|
|
||||||
|
|
||||||
if (dimensionmode == 3)
|
|
||||||
dimensionmode = 5;
|
|
||||||
else if (dimensionmode == 5)
|
|
||||||
dimensionmode = 6;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MirrorDelay = 1;
|
|
||||||
dimensionmode = 3;
|
|
||||||
SetFragBar(pp);
|
|
||||||
pp->ScrollMode2D = FALSE;
|
|
||||||
SetRedrawScreen(pp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toggle follow map mode on/off
|
|
||||||
if (dimensionmode == 5 || dimensionmode == 6)
|
|
||||||
{
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
|
||||||
{
|
|
||||||
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
|
|
||||||
pp->ScrollMode2D = !pp->ScrollMode2D;
|
|
||||||
pp->mfposx = pp->posx;
|
|
||||||
pp->mfposy = pp->posy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If in 2D follow mode, scroll around.
|
|
||||||
if (pp->ScrollMode2D && !Prediction)
|
|
||||||
{
|
|
||||||
keymove = keymove / 2;
|
|
||||||
|
|
||||||
if (M_Active())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Recenter view if told
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Center_View))
|
|
||||||
{
|
|
||||||
pp->mfposx = pp->posx;
|
|
||||||
pp->mfposy = pp->posy;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toggle follow map mode on/off
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Map_Follow_Mode))
|
|
||||||
{
|
|
||||||
buttonMap.ClearButton(gamefunc_Map_Follow_Mode);
|
|
||||||
pp->ScrollMode2D = !pp->ScrollMode2D;
|
|
||||||
// Reset coords
|
|
||||||
pp->mfposx = pp->posx;
|
|
||||||
pp->mfposy = pp->posy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
|
||||||
input.svel -= info.dyaw>>2;
|
|
||||||
|
|
||||||
input.svel -= info.dx>>2;
|
|
||||||
input.vel = -info.dz>>2;
|
|
||||||
|
|
||||||
if (!ConPanel)
|
|
||||||
{
|
|
||||||
if (!HelpInputMode)
|
|
||||||
{
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
|
||||||
input.svel += keymove;
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
|
||||||
input.svel += -keymove;
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
|
||||||
input.vel += keymove;
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
|
||||||
input.vel += -keymove;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!InputMode)
|
|
||||||
{
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left))
|
|
||||||
input.svel += keymove;
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Right))
|
|
||||||
input.svel += -keymove;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
input.vel = clamp(input.vel, -MAXVEL, MAXVEL);
|
|
||||||
input.svel = clamp(input.svel, -MAXSVEL, MAXSVEL);
|
|
||||||
|
|
||||||
pp->mfposx += mulscale9(input.vel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 512)]) +
|
|
||||||
mulscale9(input.svel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]);
|
|
||||||
pp->mfposy += mulscale9(input.vel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang))]) +
|
|
||||||
mulscale9(input.svel, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang) + 1536)]);
|
|
||||||
|
|
||||||
pp->mfposx = max(pp->mfposx, x_min_bound);
|
|
||||||
pp->mfposy = max(pp->mfposy, y_min_bound);
|
|
||||||
pp->mfposx = min(pp->mfposx, x_max_bound);
|
|
||||||
pp->mfposy = min(pp->mfposy, y_max_bound);
|
|
||||||
}
|
|
||||||
|
|
||||||
// !JIM! Added M_Active() so that you don't move at all while using menus
|
|
||||||
if (M_Active() || pp->ScrollMode2D || InputMode)
|
|
||||||
return;
|
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_SPACE_BAR, ((!!inputState.GetKeyStatus(KEYSC_SPACE)) | buttonMap.ButtonDown(gamefunc_Open)));
|
|
||||||
|
|
||||||
info.dz = (info.dz * move_scale)>>8;
|
info.dz = (info.dz * move_scale)>>8;
|
||||||
info.dyaw = (info.dyaw * turn_scale)>>8;
|
info.dyaw = (info.dyaw * turn_scale)>>8;
|
||||||
|
|
||||||
|
int32_t svel = 0, vel = 0, angvel = 0, aimvel = 0;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||||
{
|
{
|
||||||
input.svel = -info.mousex;
|
svel = -info.mousex;
|
||||||
input.svel -= info.dyaw * keymove / analogExtent;
|
svel -= info.dyaw * keymove / analogExtent;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), fix16_from_int(32)));
|
angvel = info.mousex / 32;
|
||||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_int(info.dyaw * analogTurnAmount / (analogExtent >> 1)));
|
angvel += info.dyaw * (turnamount << 1) / analogExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseaim)
|
if (mouseaim)
|
||||||
input.q16horz = fix16_sadd(input.q16horz, fix16_sdiv(fix16_from_int(info.mousey), fix16_from_int(64)));
|
aimvel = -info.mousey / 64;
|
||||||
else
|
else
|
||||||
input.vel = -(info.mousey >> 6);
|
vel = -(info.mousey >> 6);
|
||||||
|
|
||||||
if (!in_mouseflip)
|
if (in_mouseflip)
|
||||||
input.q16horz = -input.q16horz;
|
aimvel = -aimvel;
|
||||||
|
|
||||||
input.q16horz = fix16_ssub(input.q16horz, fix16_from_int(info.dpitch * analogTurnAmount / analogExtent));
|
aimvel -= info.dpitch * turnamount / analogExtent;
|
||||||
input.svel -= info.dx * keymove / analogExtent;
|
svel -= info.dx * keymove / analogExtent;
|
||||||
input.vel -= info.dz * keymove / analogExtent;
|
vel -= info.dz * keymove / analogExtent;
|
||||||
|
|
||||||
static double lastInputTicks;
|
|
||||||
|
|
||||||
auto const currentHiTicks = timerGetHiTicks();
|
|
||||||
elapsedInputTicks = currentHiTicks - lastInputTicks;
|
|
||||||
|
|
||||||
lastInputTicks = currentHiTicks;
|
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
if (buttonMap.ButtonDown(gamefunc_Strafe) && !pp->sop)
|
||||||
{
|
{
|
||||||
if (!localInput.svel)
|
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||||
{
|
svel -= -keymove;
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left) && !localInput.svel)
|
if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||||
input.svel = keymove;
|
svel -= keymove;
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Right) && !localInput.svel)
|
|
||||||
input.svel = -keymove;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||||
{
|
{
|
||||||
turnheldtime += synctics;
|
turnheldtime += synctics;
|
||||||
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
if (turnheldtime >= TURBOTURNTIME)
|
||||||
|
angvel -= turnamount;
|
||||||
|
else
|
||||||
|
angvel -= PREAMBLETURN;
|
||||||
}
|
}
|
||||||
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
else if (buttonMap.ButtonDown(gamefunc_Turn_Right))
|
||||||
{
|
{
|
||||||
turnheldtime += synctics;
|
turnheldtime += synctics;
|
||||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval((turnheldtime >= TURBOTURNTIME) ? turnamount : PREAMBLETURN)));
|
if (turnheldtime >= TURBOTURNTIME)
|
||||||
|
angvel += turnamount;
|
||||||
|
else
|
||||||
|
angvel += PREAMBLETURN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3272,119 +3217,43 @@ void getinput(int const playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localInput.svel < keymove && localInput.svel > -keymove)
|
|
||||||
{
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop)
|
if (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !pp->sop)
|
||||||
input.svel += keymove;
|
svel += keymove;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop)
|
if (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !pp->sop)
|
||||||
input.svel += -keymove;
|
svel += -keymove;
|
||||||
}
|
|
||||||
|
|
||||||
if (localInput.vel < keymove && localInput.vel > -keymove)
|
|
||||||
{
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||||
input.vel += keymove;
|
{
|
||||||
|
vel += keymove;
|
||||||
|
//DSPRINTF(ds,"vel key %d",vel);
|
||||||
|
//DebugWriteString(ds);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//DSPRINTF(ds,"vel %d",vel);
|
||||||
|
//DebugWriteString(ds);
|
||||||
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||||
input.vel += -keymove;
|
vel += -keymove;
|
||||||
}
|
|
||||||
|
|
||||||
localInput.vel = clamp(localInput.vel + input.vel, -MAXVEL, MAXVEL);
|
vel = clamp(vel, -MAXVEL, MAXVEL);
|
||||||
localInput.svel = clamp(localInput.svel + input.svel, -MAXSVEL, MAXSVEL);
|
svel = clamp(svel, -MAXSVEL, MAXSVEL);
|
||||||
|
|
||||||
localInput.q16avel = fix16_clamp(fix16_sadd(localInput.q16avel, input.q16avel), fix16_from_int(-MAXANGVEL), fix16_from_int(MAXANGVEL));
|
angvel = clamp(angvel, -MAXANGVEL, MAXANGVEL);
|
||||||
localInput.q16horz = fix16_clamp(fix16_sadd(localInput.q16horz, input.q16horz), fix16_from_int(-MAXHORIZVEL), fix16_from_int(MAXHORIZVEL));
|
aimvel = clamp(aimvel, -MAXAIMVEL, MAXAIMVEL);
|
||||||
|
|
||||||
// actually snap
|
momx = mulscale9(vel, sintable[NORM_ANGLE(newpp->pang + 512)]);
|
||||||
SET_LOC_KEY(localInput.bits, SK_SNAP_UP, buttonMap.ButtonDown(gamefunc_Aim_Up));
|
momy = mulscale9(vel, sintable[NORM_ANGLE(newpp->pang)]);
|
||||||
SET_LOC_KEY(localInput.bits, SK_SNAP_DOWN, buttonMap.ButtonDown(gamefunc_Aim_Down));
|
|
||||||
|
|
||||||
// actually just look
|
momx += mulscale9(svel, sintable[NORM_ANGLE(newpp->pang)]);
|
||||||
SET_LOC_KEY(localInput.bits, SK_LOOK_UP, buttonMap.ButtonDown(gamefunc_Look_Up));
|
momy += mulscale9(svel, sintable[NORM_ANGLE(newpp->pang + 1536)]);
|
||||||
SET_LOC_KEY(localInput.bits, SK_LOOK_DOWN, buttonMap.ButtonDown(gamefunc_Look_Down));
|
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_CENTER_VIEW, buttonMap.ButtonDown(gamefunc_Center_View));
|
loc->vel = momx;
|
||||||
SET_LOC_KEY(localInput.bits, SK_TURN_180, buttonMap.ButtonDown(gamefunc_TurnAround));
|
loc->svel = momy;
|
||||||
|
loc->angvel = angvel;
|
||||||
pp->on_vehicle = P_CheckOperatingVehicle(pp);
|
loc->aimvel = aimvel;
|
||||||
|
|
||||||
if (!TEST(pp->Flags, PF_DEAD) && !pp->on_vehicle)
|
|
||||||
{
|
|
||||||
if (!TEST(pp->Flags, PF_CLIMBING))
|
|
||||||
{
|
|
||||||
if (!TEST(pp->Flags, PF_TURN_180))
|
|
||||||
{
|
|
||||||
if (TEST_SYNC_KEY(pp, SK_TURN_180))
|
|
||||||
{
|
|
||||||
if (FLAG_KEY_PRESSED(pp, SK_TURN_180))
|
|
||||||
{
|
|
||||||
fix16_t delta_q16ang;
|
|
||||||
|
|
||||||
FLAG_KEY_RELEASE(pp, SK_TURN_180);
|
|
||||||
|
|
||||||
pp->turn180_target = fix16_sadd(pp->q16ang, fix16_from_int(1024)) & 0x7FFFFFF;
|
|
||||||
|
|
||||||
// make the first turn in the clockwise direction
|
|
||||||
// the rest will follow
|
|
||||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
|
||||||
|
|
||||||
pp->q16ang = fix16_sadd(pp->q16ang, fix16_max(fix16_one, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT))))))) & 0x7FFFFFF;
|
|
||||||
|
|
||||||
SET(pp->Flags, PF_TURN_180);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FLAG_KEY_RESET(pp, SK_TURN_180);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TEST(pp->Flags, PF_TURN_180))
|
|
||||||
{
|
|
||||||
fix16_t delta_q16ang;
|
|
||||||
|
|
||||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
|
||||||
pp->q16ang = fix16_sadd(pp->q16ang, fix16_from_dbl(scaleAdjustmentToInterval(fix16_to_dbl(fix16_sdiv(fix16_abs(delta_q16ang), fix16_from_int(TURN_SHIFT)))))) & 0x7FFFFFF;
|
|
||||||
|
|
||||||
sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang);
|
|
||||||
if (!Prediction)
|
|
||||||
{
|
|
||||||
if (pp->PlayerUnderSprite >= 0)
|
|
||||||
sprite[pp->PlayerUnderSprite].ang = fix16_to_int(pp->q16ang);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get new delta to see how close we are
|
|
||||||
delta_q16ang = GetDeltaAngleQ16(pp->turn180_target, pp->q16ang);
|
|
||||||
|
|
||||||
if (fix16_abs(delta_q16ang) < (fix16_one << 1))
|
|
||||||
{
|
|
||||||
pp->q16ang = pp->turn180_target;
|
|
||||||
RESET(pp->Flags, PF_TURN_180);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input.q16avel != 0)
|
|
||||||
{
|
|
||||||
pp->q16ang = fix16_sadd(pp->q16ang, input.q16avel) & 0x7FFFFFF;
|
|
||||||
|
|
||||||
// update players sprite angle
|
|
||||||
// NOTE: It's also updated in UpdatePlayerSprite, but needs to be
|
|
||||||
// here to cover
|
|
||||||
// all cases.
|
|
||||||
sprite[pp->PlayerSprite].ang = fix16_to_int(pp->q16ang);
|
|
||||||
if (!Prediction)
|
|
||||||
{
|
|
||||||
if (pp->PlayerUnderSprite >= 0)
|
|
||||||
sprite[pp->PlayerUnderSprite].ang = fix16_to_int(pp->q16ang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DoPlayerHorizon(pp, &localInput.q16horz);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CommEnabled)
|
if (!CommEnabled)
|
||||||
{
|
{
|
||||||
|
@ -3394,29 +3263,39 @@ void getinput(int const playerNum)
|
||||||
{
|
{
|
||||||
MenuButtonAutoAim = FALSE;
|
MenuButtonAutoAim = FALSE;
|
||||||
if ((!!TEST(pp->Flags, PF_AUTO_AIM)) != !!cl_autoaim)
|
if ((!!TEST(pp->Flags, PF_AUTO_AIM)) != !!cl_autoaim)
|
||||||
SET_LOC_KEY(localInput.bits, SK_AUTO_AIM, TRUE);
|
SET_LOC_KEY(loc->bits, SK_AUTO_AIM, TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (inputState.GetKeyStatus(sc_Pause))
|
else if (inputState.GetKeyStatus(sc_Pause))
|
||||||
{
|
{
|
||||||
SET_LOC_KEY(localInput.bits, SK_PAUSE, inputState.GetKeyStatus(sc_Pause));
|
SET_LOC_KEY(loc->bits, SK_PAUSE, inputState.GetKeyStatus(sc_Pause));
|
||||||
inputState.ClearKeyStatus(sc_Pause);
|
inputState.ClearKeyStatus(sc_Pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_RUN, buttonMap.ButtonDown(gamefunc_Run));
|
SET_LOC_KEY(loc->bits, SK_CENTER_VIEW, buttonMap.ButtonDown(gamefunc_Center_View));
|
||||||
SET_LOC_KEY(localInput.bits, SK_SHOOT, buttonMap.ButtonDown(gamefunc_Fire));
|
|
||||||
|
SET_LOC_KEY(loc->bits, SK_RUN, buttonMap.ButtonDown(gamefunc_Run));
|
||||||
|
SET_LOC_KEY(loc->bits, SK_SHOOT, buttonMap.ButtonDown(gamefunc_Fire));
|
||||||
|
|
||||||
|
// actually snap
|
||||||
|
SET_LOC_KEY(loc->bits, SK_SNAP_UP, buttonMap.ButtonDown(gamefunc_Aim_Up));
|
||||||
|
SET_LOC_KEY(loc->bits, SK_SNAP_DOWN, buttonMap.ButtonDown(gamefunc_Aim_Down));
|
||||||
|
|
||||||
|
// actually just look
|
||||||
|
SET_LOC_KEY(loc->bits, SK_LOOK_UP, buttonMap.ButtonDown(gamefunc_Look_Up));
|
||||||
|
SET_LOC_KEY(loc->bits, SK_LOOK_DOWN, buttonMap.ButtonDown(gamefunc_Look_Down));
|
||||||
|
|
||||||
for (i = 0; i < MAX_WEAPONS_KEYS; i++)
|
for (i = 0; i < MAX_WEAPONS_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (buttonMap.ButtonDown(gamefunc_Weapon_1 + i))
|
if (buttonMap.ButtonDown(gamefunc_Weapon_1 + i))
|
||||||
{
|
{
|
||||||
SET(localInput.bits, i + 1);
|
SET(loc->bits, i + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonPressed(gamefunc_Next_Weapon))
|
if (buttonMap.ButtonDown(gamefunc_Next_Weapon))
|
||||||
{
|
{
|
||||||
USERp u = User[pp->PlayerSprite];
|
USERp u = User[pp->PlayerSprite];
|
||||||
short next_weapon = u->WeaponNum + 1;
|
short next_weapon = u->WeaponNum + 1;
|
||||||
|
@ -3452,11 +3331,11 @@ void getinput(int const playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SET(localInput.bits, next_weapon + 1);
|
SET(loc->bits, next_weapon + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (buttonMap.ButtonPressed(gamefunc_Previous_Weapon))
|
if (buttonMap.ButtonDown(gamefunc_Previous_Weapon))
|
||||||
{
|
{
|
||||||
USERp u = User[pp->PlayerSprite];
|
USERp u = User[pp->PlayerSprite];
|
||||||
short prev_weapon = u->WeaponNum - 1;
|
short prev_weapon = u->WeaponNum - 1;
|
||||||
|
@ -3490,7 +3369,7 @@ void getinput(int const playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SET(localInput.bits, prev_weapon + 1);
|
SET(loc->bits, prev_weapon + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Alt_Weapon))
|
if (buttonMap.ButtonDown(gamefunc_Alt_Weapon))
|
||||||
|
@ -3498,7 +3377,7 @@ void getinput(int const playerNum)
|
||||||
buttonMap.ClearButton(gamefunc_Alt_Weapon);
|
buttonMap.ClearButton(gamefunc_Alt_Weapon);
|
||||||
USERp u = User[pp->PlayerSprite];
|
USERp u = User[pp->PlayerSprite];
|
||||||
short const which_weapon = u->WeaponNum + 1;
|
short const which_weapon = u->WeaponNum + 1;
|
||||||
SET(localInput.bits, which_weapon);
|
SET(loc->bits, which_weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3516,21 +3395,23 @@ void getinput(int const playerNum)
|
||||||
if (buttonMap.ButtonDown(gamefunc_Caltrops))
|
if (buttonMap.ButtonDown(gamefunc_Caltrops))
|
||||||
inv_hotkey = INVENTORY_CALTROPS+1;
|
inv_hotkey = INVENTORY_CALTROPS+1;
|
||||||
|
|
||||||
SET(localInput.bits, inv_hotkey<<SK_INV_HOTKEY_BIT0);
|
SET(loc->bits, inv_hotkey<<SK_INV_HOTKEY_BIT0);
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_INV_USE, buttonMap.ButtonDown(gamefunc_Inventory));
|
SET_LOC_KEY(loc->bits, SK_INV_USE, buttonMap.ButtonDown(gamefunc_Inventory));
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_OPERATE, buttonMap.ButtonDown(gamefunc_Open));
|
SET_LOC_KEY(loc->bits, SK_OPERATE, buttonMap.ButtonDown(gamefunc_Open));
|
||||||
SET_LOC_KEY(localInput.bits, SK_JUMP, buttonMap.ButtonDown(gamefunc_Jump));
|
SET_LOC_KEY(loc->bits, SK_JUMP, buttonMap.ButtonDown(gamefunc_Jump));
|
||||||
SET_LOC_KEY(localInput.bits, SK_CRAWL, buttonMap.ButtonDown(gamefunc_Crouch));
|
SET_LOC_KEY(loc->bits, SK_CRAWL, buttonMap.ButtonDown(gamefunc_Crouch));
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_INV_LEFT, buttonMap.ButtonDown(gamefunc_Inventory_Left));
|
SET_LOC_KEY(loc->bits, SK_TURN_180, buttonMap.ButtonDown(gamefunc_TurnAround));
|
||||||
SET_LOC_KEY(localInput.bits, SK_INV_RIGHT, buttonMap.ButtonDown(gamefunc_Inventory_Right));
|
|
||||||
|
|
||||||
SET_LOC_KEY(localInput.bits, SK_HIDE_WEAPON, buttonMap.ButtonDown(gamefunc_Holster_Weapon));
|
SET_LOC_KEY(loc->bits, SK_INV_LEFT, buttonMap.ButtonDown(gamefunc_Inventory_Left));
|
||||||
|
SET_LOC_KEY(loc->bits, SK_INV_RIGHT, buttonMap.ButtonDown(gamefunc_Inventory_Right));
|
||||||
|
|
||||||
|
SET_LOC_KEY(loc->bits, SK_HIDE_WEAPON, buttonMap.ButtonDown(gamefunc_Holster_Weapon));
|
||||||
|
|
||||||
// need BUTTON
|
// need BUTTON
|
||||||
SET_LOC_KEY(localInput.bits, SK_CRAWL_LOCK, inputState.GetKeyStatus(KEYSC_NUM));
|
SET_LOC_KEY(loc->bits, SK_CRAWL_LOCK, inputState.GetKeyStatus(KEYSC_NUM));
|
||||||
|
|
||||||
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
|
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
|
||||||
{
|
{
|
||||||
|
@ -3543,7 +3424,7 @@ void getinput(int const playerNum)
|
||||||
if (screenpeek < 0)
|
if (screenpeek < 0)
|
||||||
screenpeek = connecthead;
|
screenpeek = connecthead;
|
||||||
|
|
||||||
if (dimensionmode != 2 && screenpeek == playerNum)
|
if (dimensionmode != 2 && screenpeek == myconnectindex)
|
||||||
{
|
{
|
||||||
// JBF: figure out what's going on here
|
// JBF: figure out what's going on here
|
||||||
DoPlayerDivePalette(pp); // Check Dive again
|
DoPlayerDivePalette(pp); // Check Dive again
|
||||||
|
@ -3583,7 +3464,7 @@ void getinput(int const playerNum)
|
||||||
|
|
||||||
#define MAP_BLOCK_SPRITE (DK_BLUE + 6)
|
#define MAP_BLOCK_SPRITE (DK_BLUE + 6)
|
||||||
|
|
||||||
void drawoverheadmap(int cposx, int cposy, int czoom, short cang, SWBOOL ScrollMode2D)
|
void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
|
||||||
{
|
{
|
||||||
int i, j, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
|
int i, j, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
|
||||||
int dax, day, cosang, sinang, xspan, yspan, sprx, spry;
|
int dax, day, cosang, sinang, xspan, yspan, sprx, spry;
|
||||||
|
|
|
@ -540,11 +540,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 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 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(fix16_to_int((pp)->q16ang), NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < 320)
|
#define PLAYER_FACING(pp,sp) (labs(GetDeltaAngle((pp)->pang, 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(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 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(fix16_to_int((pp)->q16ang), NORM_ANGLE(getangle((sp)->x - (pp)->posx, (sp)->y - (pp)->posy)))) < (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 FACING_RANGE(sp1,sp2,range) (labs(GetDeltaAngle((sp2)->ang, NORM_ANGLE(getangle((sp1)->x - (sp2)->x, (sp1)->y - (sp2)->y)))) < (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
|
// two vectors
|
||||||
|
@ -874,8 +874,6 @@ extern int PlayerYellVocs[MAX_YELLSOUNDS];
|
||||||
|
|
||||||
void BossHealthMeter(void);
|
void BossHealthMeter(void);
|
||||||
|
|
||||||
extern SWBOOL InterpolateSectObj;
|
|
||||||
|
|
||||||
// Global variables used for modifying variouse things from the Console
|
// Global variables used for modifying variouse things from the Console
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1060,7 +1058,8 @@ typedef struct
|
||||||
{
|
{
|
||||||
int16_t vel;
|
int16_t vel;
|
||||||
int16_t svel;
|
int16_t svel;
|
||||||
fix16_t q16horz, q16avel;
|
int8_t angvel;
|
||||||
|
int8_t aimvel;
|
||||||
int32_t bits;
|
int32_t bits;
|
||||||
} SW_PACKET;
|
} SW_PACKET;
|
||||||
|
|
||||||
|
@ -1094,10 +1093,8 @@ struct PLAYERstruct
|
||||||
// interpolation
|
// interpolation
|
||||||
int
|
int
|
||||||
oposx, oposy, oposz;
|
oposx, oposy, oposz;
|
||||||
fix16_t oq16horiz, oq16ang;
|
short oang;
|
||||||
|
short ohoriz;
|
||||||
// Map follow mode pos values.
|
|
||||||
int32_t mfposx, mfposy;
|
|
||||||
|
|
||||||
// holds last valid move position
|
// holds last valid move position
|
||||||
short lv_sectnum;
|
short lv_sectnum;
|
||||||
|
@ -1121,6 +1118,7 @@ struct PLAYERstruct
|
||||||
int camera_dist; // view mode dist
|
int camera_dist; // view mode dist
|
||||||
int circle_camera_dist;
|
int circle_camera_dist;
|
||||||
int six,siy,siz; // save player interp position for PlayerSprite
|
int six,siy,siz; // save player interp position for PlayerSprite
|
||||||
|
short siang;
|
||||||
|
|
||||||
int xvect, yvect;
|
int xvect, yvect;
|
||||||
int oxvect, oyvect;
|
int oxvect, oyvect;
|
||||||
|
@ -1131,6 +1129,8 @@ struct PLAYERstruct
|
||||||
int drive_angvel;
|
int drive_angvel;
|
||||||
int drive_oangvel;
|
int drive_oangvel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// scroll 2D mode stuff
|
// scroll 2D mode stuff
|
||||||
int scr_x, scr_y, oscr_x, oscr_y;
|
int scr_x, scr_y, oscr_x, oscr_y;
|
||||||
int scr_xvect, scr_yvect;
|
int scr_xvect, scr_yvect;
|
||||||
|
@ -1140,12 +1140,11 @@ struct PLAYERstruct
|
||||||
short circle_camera_ang;
|
short circle_camera_ang;
|
||||||
short camera_check_time_delay;
|
short camera_check_time_delay;
|
||||||
|
|
||||||
short cursectnum,lastcursectnum;
|
short pang,cursectnum,lastcursectnum;
|
||||||
fix16_t turn180_target; // 180 degree turn
|
short turn180_target; // 180 degree turn
|
||||||
|
|
||||||
// variables that do not fit into sprite structure
|
// variables that do not fit into sprite structure
|
||||||
int hvel,tilt,tilt_dest;
|
int horizbase,horiz,horizoff,hvel,tilt,tilt_dest;
|
||||||
fix16_t q16horiz, q16horizbase, q16horizoff, q16ang;
|
|
||||||
short recoil_amt;
|
short recoil_amt;
|
||||||
short recoil_speed;
|
short recoil_speed;
|
||||||
short recoil_ndx;
|
short recoil_ndx;
|
||||||
|
@ -1153,7 +1152,7 @@ struct PLAYERstruct
|
||||||
|
|
||||||
int oldposx,oldposy,oldposz;
|
int oldposx,oldposy,oldposz;
|
||||||
int RevolveX, RevolveY;
|
int RevolveX, RevolveY;
|
||||||
fix16_t RevolveDeltaAng, RevolveAng;
|
short RevolveDeltaAng, RevolveAng;
|
||||||
|
|
||||||
// under vars are for wading and swimming
|
// under vars are for wading and swimming
|
||||||
short PlayerSprite, PlayerUnderSprite;
|
short PlayerSprite, PlayerUnderSprite;
|
||||||
|
@ -1282,8 +1281,6 @@ struct PLAYERstruct
|
||||||
short Reverb; // Player's current reverb setting
|
short Reverb; // Player's current reverb setting
|
||||||
short Heads; // Number of Accursed Heads orbiting player
|
short Heads; // Number of Accursed Heads orbiting player
|
||||||
int PlayerVersion;
|
int PlayerVersion;
|
||||||
|
|
||||||
SWBOOL on_vehicle, ScrollMode2D;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
|
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
|
||||||
|
@ -1909,6 +1906,7 @@ typedef struct
|
||||||
|
|
||||||
extern SPIN Spin[17];
|
extern SPIN Spin[17];
|
||||||
extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE];
|
extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE];
|
||||||
|
extern int x_min_bound, y_min_bound, x_max_bound, y_max_bound;
|
||||||
|
|
||||||
#define MAXANIM 256
|
#define MAXANIM 256
|
||||||
typedef void ANIM_CALLBACK (ANIMp, void *);
|
typedef void ANIM_CALLBACK (ANIMp, void *);
|
||||||
|
@ -2127,7 +2125,6 @@ void SetBorder(PLAYERp pp, int);
|
||||||
void SetFragBar(PLAYERp pp);
|
void SetFragBar(PLAYERp pp);
|
||||||
int Distance(int x1, int y1, int x2, int y2);
|
int Distance(int x1, int y1, int x2, int y2);
|
||||||
short GetDeltaAngle(short, short);
|
short GetDeltaAngle(short, short);
|
||||||
fix16_t GetDeltaAngleQ16(fix16_t, fix16_t);
|
|
||||||
|
|
||||||
int SetActorRotation(short SpriteNum,int,int);
|
int SetActorRotation(short SpriteNum,int,int);
|
||||||
int NewStateGroup(short SpriteNum, STATEp SpriteGroup[]);
|
int NewStateGroup(short SpriteNum, STATEp SpriteGroup[]);
|
||||||
|
@ -2295,6 +2292,7 @@ extern int lockspeed,totalsynctics;
|
||||||
#define synctics 3
|
#define synctics 3
|
||||||
#define ACTORMOVETICS (synctics<<1)
|
#define ACTORMOVETICS (synctics<<1)
|
||||||
#define TICSPERMOVEMENT synctics
|
#define TICSPERMOVEMENT synctics
|
||||||
|
#define FAKETIMERHANDLER() if (totalclock >= ototalclock + synctics) faketimerhandler()
|
||||||
|
|
||||||
// subtract value from clipdist on getzrange calls
|
// subtract value from clipdist on getzrange calls
|
||||||
#define GETZRANGE_CLIP_ADJ 8
|
#define GETZRANGE_CLIP_ADJ 8
|
||||||
|
@ -2402,7 +2400,7 @@ int DoSkullBeginDeath(int16_t SpriteNum); // skull.c
|
||||||
void AnimateCacheCursor(void); // game.c
|
void AnimateCacheCursor(void); // game.c
|
||||||
void TerminateGame(void); // game.c
|
void TerminateGame(void); // game.c
|
||||||
void TerminateLevel(void); // game.c
|
void TerminateLevel(void); // game.c
|
||||||
void drawoverheadmap(int cposx,int cposy,int czoom,short cang, SWBOOL ScrollMode2D); // game.c
|
void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c
|
||||||
void DrawMenuLevelScreen(void); // game.c
|
void DrawMenuLevelScreen(void); // game.c
|
||||||
void DebugWriteString(char *string); // game.c
|
void DebugWriteString(char *string); // game.c
|
||||||
void ManualPlayerInsert(PLAYERp pp); // game.c
|
void ManualPlayerInsert(PLAYERp pp); // game.c
|
||||||
|
@ -2425,7 +2423,7 @@ void ScreenCaptureKeys(void); // draw.c
|
||||||
int minigametext(int x,int y,const char *t,short dabits); // jplayer.c
|
int minigametext(int x,int y,const char *t,short dabits); // jplayer.c
|
||||||
void computergetinput(int snum,SW_PACKET *syn); // jplayer.c
|
void computergetinput(int snum,SW_PACKET *syn); // jplayer.c
|
||||||
|
|
||||||
void DrawOverlapRoom(int tx,int ty,int tz,fix16_t tq16ang,fix16_t tq16horiz,short tsectnum); // rooms.c
|
void DrawOverlapRoom(int tx,int ty,int tz,short tang,int thoriz,short tsectnum); // rooms.c
|
||||||
void SetupMirrorTiles(void); // rooms.c
|
void SetupMirrorTiles(void); // rooms.c
|
||||||
SWBOOL FAF_Sector(short sectnum); // rooms.c
|
SWBOOL FAF_Sector(short sectnum); // rooms.c
|
||||||
int GetZadjustment(short sectnum,short hitag); // rooms.c
|
int GetZadjustment(short sectnum,short hitag); // rooms.c
|
||||||
|
|
|
@ -33,6 +33,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
|
#define MAXINTERPOLATIONS 1024
|
||||||
int numinterpolations = 0, startofdynamicinterpolations = 0;
|
int numinterpolations = 0, startofdynamicinterpolations = 0;
|
||||||
int oldipos[MAXINTERPOLATIONS];
|
int oldipos[MAXINTERPOLATIONS];
|
||||||
int bakipos[MAXINTERPOLATIONS];
|
int bakipos[MAXINTERPOLATIONS];
|
||||||
|
@ -110,12 +111,4 @@ void restoreinterpolations(void) // Stick at end of drawscreen
|
||||||
for (i = numinterpolations - 1; i >= 0; i--)
|
for (i = numinterpolations - 1; i >= 0; i--)
|
||||||
*curipos[i] = bakipos[i];
|
*curipos[i] = bakipos[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void togglespriteinterpolation(spritetype *sp, int set)
|
|
||||||
{
|
|
||||||
auto func = set ? setinterpolation : stopinterpolation;
|
|
||||||
func(&sp->x);
|
|
||||||
func(&sp->y);
|
|
||||||
func(&sp->z);
|
|
||||||
}
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
|
@ -23,13 +23,6 @@ Original Source: 1997 - Frank Maddin and Jim Norwood
|
||||||
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
*/
|
*/
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef INTERP_H
|
|
||||||
|
|
||||||
#define INTERP_H
|
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
#define SHORT_MAXINTERPOLATIONS 256
|
#define SHORT_MAXINTERPOLATIONS 256
|
||||||
|
@ -38,7 +31,7 @@ extern short short_oldipos[SHORT_MAXINTERPOLATIONS];
|
||||||
extern short short_bakipos[SHORT_MAXINTERPOLATIONS];
|
extern short short_bakipos[SHORT_MAXINTERPOLATIONS];
|
||||||
extern short *short_curipos[SHORT_MAXINTERPOLATIONS];
|
extern short *short_curipos[SHORT_MAXINTERPOLATIONS];
|
||||||
|
|
||||||
#define MAXINTERPOLATIONS MAXSPRITES
|
#define MAXINTERPOLATIONS 1024
|
||||||
extern int numinterpolations, startofdynamicinterpolations;
|
extern int numinterpolations, startofdynamicinterpolations;
|
||||||
extern int oldipos[MAXINTERPOLATIONS];
|
extern int oldipos[MAXINTERPOLATIONS];
|
||||||
extern int bakipos[MAXINTERPOLATIONS];
|
extern int bakipos[MAXINTERPOLATIONS];
|
||||||
|
@ -49,12 +42,4 @@ void stopinterpolation(int *posptr);
|
||||||
void updateinterpolations(void);
|
void updateinterpolations(void);
|
||||||
void dointerpolations(int smoothratio);
|
void dointerpolations(int smoothratio);
|
||||||
void restoreinterpolations(void);
|
void restoreinterpolations(void);
|
||||||
|
|
||||||
void togglespriteinterpolation(spritetype *sp, int set);
|
|
||||||
|
|
||||||
static void FORCE_INLINE setspriteinterpolation(spritetype *sp) { togglespriteinterpolation(sp, 1); }
|
|
||||||
static void FORCE_INLINE stopspriteinterpolation(spritetype *sp) { togglespriteinterpolation(sp, 0); }
|
|
||||||
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -437,21 +437,21 @@ void computergetinput(int snum, SW_PACKET *syn)
|
||||||
myx = p->posx;
|
myx = p->posx;
|
||||||
myy = p->posy;
|
myy = p->posy;
|
||||||
myz = p->posz;
|
myz = p->posz;
|
||||||
myang = fix16_to_int(p->q16ang);
|
myang = p->pang;
|
||||||
mycursectnum = p->cursectnum;
|
mycursectnum = p->cursectnum;
|
||||||
|
|
||||||
// Reset input bits
|
// Reset input bits
|
||||||
syn->vel = 0;
|
syn->vel = 0;
|
||||||
syn->svel = 0;
|
syn->svel = 0;
|
||||||
syn->q16avel = 0;
|
syn->angvel = 0;
|
||||||
syn->q16horz = 0;
|
syn->aimvel = 0;
|
||||||
syn->bits = 0;
|
syn->bits = 0;
|
||||||
|
|
||||||
x1 = p->posx;
|
x1 = p->posx;
|
||||||
y1 = p->posy;
|
y1 = p->posy;
|
||||||
z1 = p->posz;
|
z1 = p->posz;
|
||||||
|
|
||||||
damyang = fix16_to_int(p->q16ang);
|
damyang = p->pang;
|
||||||
damysect = sprite[p->PlayerSprite].sectnum;
|
damysect = sprite[p->PlayerSprite].sectnum;
|
||||||
if ((numplayers >= 2) && (snum == myconnectindex))
|
if ((numplayers >= 2) && (snum == myconnectindex))
|
||||||
{ x1 = myx; y1 = myy; z1 = myz+PLAYER_HEIGHT; damyang = myang; damysect = mycursectnum; }
|
{ x1 = myx; y1 = myy; z1 = myz+PLAYER_HEIGHT; damyang = myang; damysect = mycursectnum; }
|
||||||
|
@ -596,7 +596,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
||||||
{
|
{
|
||||||
vec3_t hit_pos = { x1, y1, z1-PLAYER_HEIGHT };
|
vec3_t hit_pos = { x1, y1, z1-PLAYER_HEIGHT };
|
||||||
hitscan(&hit_pos,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
hitscan(&hit_pos,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||||
(100-fix16_to_int(p->q16horiz)-fix16_to_int(p->q16horizoff))*32,&hitinfo,CLIPMASK1);
|
(100-p->horiz-p->horizoff)*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);
|
if ((hitinfo.pos.x-x1)*(hitinfo.pos.x-x1)+(hitinfo.pos.y-y1)*(hitinfo.pos.y-y1) < 2560*2560) syn->bits &= ~(1<<SK_SHOOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,9 +648,9 @@ void computergetinput(int snum, SW_PACKET *syn)
|
||||||
daang = NORM_ANGLE((daang-64) + STD_RANDOM_RANGE(128));
|
daang = NORM_ANGLE((daang-64) + STD_RANDOM_RANGE(128));
|
||||||
|
|
||||||
// Below formula fails in certain cases
|
// Below formula fails in certain cases
|
||||||
//syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL)); //was 127
|
//syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL); //was 127
|
||||||
p->q16ang = fix16_from_int(daang);
|
p->pang = daang;
|
||||||
syn->q16horz = fix16_clamp(fix16_sdiv(fix16_ssub(fix16_from_int(zang), p->q16horiz), fix16_from_int(2)), -fix16_from_int(PLAYER_HORIZ_MAX), fix16_from_int(PLAYER_HORIZ_MAX));
|
syn->aimvel = min(max((zang-p->horiz)>>1,-PLAYER_HORIZ_MAX),PLAYER_HORIZ_MAX);
|
||||||
// Sets type of aiming, auto aim for bots
|
// Sets type of aiming, auto aim for bots
|
||||||
syn->bits |= (1<<SK_AUTO_AIM);
|
syn->bits |= (1<<SK_AUTO_AIM);
|
||||||
return;
|
return;
|
||||||
|
@ -806,7 +806,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
||||||
daang = getangle(x2-x1,y2-y1);
|
daang = getangle(x2-x1,y2-y1);
|
||||||
syn->vel += (x2-x1)*2047/dist;
|
syn->vel += (x2-x1)*2047/dist;
|
||||||
syn->svel += (y2-y1)*2047/dist;
|
syn->svel += (y2-y1)*2047/dist;
|
||||||
syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goalsprite[snum] = -1;
|
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);
|
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->vel += (x2-x1)*2047/dist;
|
||||||
syn->svel += (y2-y1)*2047/dist;
|
syn->svel += (y2-y1)*2047/dist;
|
||||||
syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
syn->angvel = 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);
|
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->vel += (x2-x1)*2047/dist;
|
||||||
syn->svel += (y2-y1)*2047/dist;
|
syn->svel += (y2-y1)*2047/dist;
|
||||||
syn->q16avel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
syn->angvel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,14 +460,14 @@ void JS_InitMirrors(void)
|
||||||
// Draw a 3d screen to a specific tile
|
// Draw a 3d screen to a specific tile
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
void drawroomstotile(int daposx, int daposy, int daposz,
|
void drawroomstotile(int daposx, int daposy, int daposz,
|
||||||
fix16_t daq16ang, fix16_t daq16horiz, short dacursectnum, short tilenume)
|
short daang, int dahoriz, short dacursectnum, short tilenume)
|
||||||
{
|
{
|
||||||
TileFiles.MakeCanvas(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
TileFiles.MakeCanvas(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
||||||
|
|
||||||
renderSetTarget(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
renderSetTarget(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y);
|
||||||
screen->BeginScene();
|
screen->BeginScene();
|
||||||
|
|
||||||
renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum);
|
drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum);
|
||||||
analyzesprites(daposx, daposy, daposz, FALSE);
|
analyzesprites(daposx, daposy, daposz, FALSE);
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
screen->FinishScene();
|
screen->FinishScene();
|
||||||
|
@ -524,13 +524,16 @@ short camplayerview = 1; // Don't show yourself!
|
||||||
// Hack job alert!
|
// Hack job alert!
|
||||||
// Mirrors and cameras are maintained in the same data structure, but for hardware rendering they cannot be interleaved.
|
// 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.
|
// 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)
|
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
|
||||||
{
|
{
|
||||||
int j, cnt;
|
int j, cnt;
|
||||||
int dist;
|
int dist;
|
||||||
int tposx, tposy; // Camera
|
int tposx, tposy; // Camera
|
||||||
int* longptr;
|
int* longptr;
|
||||||
|
fix16_t tang;
|
||||||
|
|
||||||
|
// int tx, ty, tz, tpang; // Interpolate so mirror doesn't
|
||||||
|
// drift!
|
||||||
SWBOOL bIsWallMirror = FALSE;
|
SWBOOL bIsWallMirror = FALSE;
|
||||||
|
|
||||||
camloopcnt += (int32_t)(totalclock - ototalclock);
|
camloopcnt += (int32_t)(totalclock - ototalclock);
|
||||||
|
@ -700,11 +703,11 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
||||||
|
|
||||||
if (TEST_BOOL11(sp) && numplayers > 1)
|
if (TEST_BOOL11(sp) && numplayers > 1)
|
||||||
{
|
{
|
||||||
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->q16ang, cp->q16horiz, cp->cursectnum, mirror[cnt].campic);
|
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->pang, cp->horiz, cp->cursectnum, mirror[cnt].campic);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawroomstotile(sp->x, sp->y, sp->z, fix16_from_int(SP_TAG5(sp)), fix16_from_int(camhoriz), sp->sectnum, mirror[cnt].campic);
|
drawroomstotile(sp->x, sp->y, sp->z, SP_TAG5(sp), camhoriz, sp->sectnum, mirror[cnt].campic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,7 +717,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16_t tpq16horiz)
|
void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
|
||||||
{
|
{
|
||||||
int j, cnt;
|
int j, cnt;
|
||||||
int dist;
|
int dist;
|
||||||
|
@ -752,7 +755,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16
|
||||||
// tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
|
// tx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
|
||||||
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
|
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
|
||||||
// tz = pp->oposz + mulscale16(pp->posz - pp->oposz, smoothratio);
|
// tz = pp->oposz + mulscale16(pp->posz - pp->oposz, smoothratio);
|
||||||
// tpq16ang = pp->q16ang
|
// tpang = pp->oang + mulscale16(((pp->pang + 1024 - pp->oang) & 2047) - 1024, smoothratio);
|
||||||
|
|
||||||
|
|
||||||
dist = 0x7fffffff;
|
dist = 0x7fffffff;
|
||||||
|
@ -849,7 +852,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16
|
||||||
|
|
||||||
if (mirror[cnt].campic != -1)
|
if (mirror[cnt].campic != -1)
|
||||||
tileDelete(mirror[cnt].campic);
|
tileDelete(mirror[cnt].campic);
|
||||||
renderDrawRoomsQ16(dx, dy, dz, tpq16ang, tpq16horiz, sp->sectnum + MAXSECTORS);
|
drawrooms(dx, dy, dz, tpang, tphoriz, sp->sectnum + MAXSECTORS);
|
||||||
analyzesprites(dx, dy, dz, FALSE);
|
analyzesprites(dx, dy, dz, FALSE);
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
}
|
}
|
||||||
|
@ -863,10 +866,10 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16
|
||||||
// Must call preparemirror before drawrooms and
|
// Must call preparemirror before drawrooms and
|
||||||
// completemirror after drawrooms
|
// completemirror after drawrooms
|
||||||
|
|
||||||
renderPrepareMirror(tx, ty, tz, tpq16ang, tpq16horiz,
|
renderPrepareMirror(tx, ty, tz, fix16_from_int(tpang), fix16_from_int(tphoriz),
|
||||||
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
|
mirror[cnt].mirrorwall, /*mirror[cnt].mirrorsector,*/ &tposx, &tposy, &tang);
|
||||||
|
|
||||||
renderDrawRoomsQ16(tposx, tposy, tz, (tang), tpq16horiz, mirror[cnt].mirrorsector + MAXSECTORS);
|
renderDrawRoomsQ16(tposx, tposy, tz, (tang), fix16_from_int(tphoriz), mirror[cnt].mirrorsector + MAXSECTORS);
|
||||||
|
|
||||||
analyzesprites(tposx, tposy, tz, TRUE);
|
analyzesprites(tposx, tposy, tz, TRUE);
|
||||||
renderDrawMasks();
|
renderDrawMasks();
|
||||||
|
@ -879,7 +882,7 @@ void JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16
|
||||||
// g_visibility = tvisibility;
|
// g_visibility = tvisibility;
|
||||||
// g_visibility = NormalVisibility;
|
// g_visibility = NormalVisibility;
|
||||||
|
|
||||||
// renderDrawRoomsQ16(tx, ty, tz, tpq16ang, tpq16horiz, pp->cursectnum);
|
// drawrooms(tx, ty, tz, tpang, tphoriz, pp->cursectnum);
|
||||||
// Clean up anything that the camera view might have done
|
// Clean up anything that the camera view might have done
|
||||||
SetFragBar(pp);
|
SetFragBar(pp);
|
||||||
tileDelete(MIRROR);
|
tileDelete(MIRROR);
|
||||||
|
|
|
@ -71,8 +71,8 @@ extern SWBOOL mirrorinview;
|
||||||
extern short NormalVisibility;
|
extern short NormalVisibility;
|
||||||
|
|
||||||
void JAnalyzeSprites(tspriteptr_t tspr);
|
void JAnalyzeSprites(tspriteptr_t tspr);
|
||||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz);
|
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,fix16_t tpq16ang,fix16_t tpq16horiz);
|
void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz);
|
||||||
void JS_InitMirrors(void);
|
void JS_InitMirrors(void);
|
||||||
void JS_InitLockouts(void);
|
void JS_InitLockouts(void);
|
||||||
void JS_ToggleLockouts(void);
|
void JS_ToggleLockouts(void);
|
||||||
|
|
|
@ -1393,7 +1393,7 @@ PlayerInitChemBomb(PLAYERp pp)
|
||||||
// Spawn a shot
|
// Spawn a shot
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, CHEMBOMB, s_ChemBomb, pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), CHEMBOMB_VELOCITY);
|
nx, ny, nz, pp->pang, CHEMBOMB_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -1423,10 +1423,10 @@ PlayerInitChemBomb(PLAYERp pp)
|
||||||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||||
SET(wu->Flags, SPR_UNDERWATER);
|
SET(wu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
|
|
||||||
// //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",fix16_to_int(pp->q16horiz), fix16_to_int(pp->q16horizoff),
|
// //DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",pp->horiz, pp->horizoff,
|
||||||
// fix16_to_int(pp->q16horizoff + pp->q16horiz));
|
// pp->horizoff + pp->horiz);
|
||||||
// MONO_PRINT(ds);
|
// MONO_PRINT(ds);
|
||||||
|
|
||||||
oclipdist = pp->SpriteP->clipdist;
|
oclipdist = pp->SpriteP->clipdist;
|
||||||
|
@ -1837,7 +1837,7 @@ PlayerInitCaltrops(PLAYERp pp)
|
||||||
// Spawn a shot
|
// Spawn a shot
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum,
|
w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2);
|
nx, ny, nz, pp->pang, (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -1865,9 +1865,9 @@ PlayerInitCaltrops(PLAYERp pp)
|
||||||
SET(wu->Flags, SPR_UNDERWATER);
|
SET(wu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
// They go out at different angles
|
// They go out at different angles
|
||||||
// wp->ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25));
|
// wp->ang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
|
|
||||||
oclipdist = pp->SpriteP->clipdist;
|
oclipdist = pp->SpriteP->clipdist;
|
||||||
pp->SpriteP->clipdist = 0;
|
pp->SpriteP->clipdist = 0;
|
||||||
|
@ -2501,7 +2501,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
|
||||||
|
|
||||||
if (u->PlayerP)
|
if (u->PlayerP)
|
||||||
{
|
{
|
||||||
wp->z += ((100 - fix16_to_int(u->PlayerP->q16horiz)) * (HORIZ_MULT/3));
|
wp->z += ((100 - u->PlayerP->horiz) * (HORIZ_MULT/3));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (wu->ID)
|
switch (wu->ID)
|
||||||
|
|
|
@ -58,7 +58,7 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist)
|
||||||
|
|
||||||
for (i = 0; i < sop->clipbox_num; i++)
|
for (i = 0; i < sop->clipbox_num; i++)
|
||||||
{
|
{
|
||||||
ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]);
|
ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]);
|
||||||
ox[i] = x[i] = pp->posx + (sop->clipbox_vdist[i] * sintable[NORM_ANGLE(ang + 512)] >> 14);
|
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);
|
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++)
|
for (i = 0; i < sop->clipbox_num; i++)
|
||||||
{
|
{
|
||||||
ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]);
|
ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]);
|
||||||
ox[i] = x[i] = pp->posx + (sop->clipbox_vdist[i] * sintable[NORM_ANGLE(ang + 512)] >> 14);
|
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);
|
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
|
// move the box to position instead of using offset- this prevents small rounding errors
|
||||||
// allowing you to move through wall
|
// allowing you to move through wall
|
||||||
ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]);
|
ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]);
|
||||||
|
|
||||||
xs = pp->posx;
|
xs = pp->posx;
|
||||||
ys = pp->posy;
|
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
|
// move the box to position instead of using offset- this prevents small rounding errors
|
||||||
// allowing you to move through wall
|
// allowing you to move through wall
|
||||||
ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]);
|
ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]);
|
||||||
|
|
||||||
xs = pp->posx;
|
xs = pp->posx;
|
||||||
ys = pp->posy;
|
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
|
// move the box to position instead of using offset- this prevents small rounding errors
|
||||||
// allowing you to move through wall
|
// allowing you to move through wall
|
||||||
ang = NORM_ANGLE(fix16_to_int(pp->q16ang) + sop->clipbox_ang[i]);
|
ang = NORM_ANGLE(pp->pang + sop->clipbox_ang[i]);
|
||||||
|
|
||||||
xs = pp->posx;
|
xs = pp->posx;
|
||||||
ys = pp->posy;
|
ys = pp->posy;
|
||||||
|
|
|
@ -44,8 +44,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
// getinput() calls will require redoing with regard to local input changes.
|
void getinput(SW_PACKET*);
|
||||||
// void getinput(int playerNum);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SYNC BUG NOTES:
|
SYNC BUG NOTES:
|
||||||
|
@ -105,7 +104,8 @@ typedef struct
|
||||||
{
|
{
|
||||||
int32_t vel;
|
int32_t vel;
|
||||||
int32_t svel;
|
int32_t svel;
|
||||||
fix16_t q16horz, q16avel;
|
int32_t angvel;
|
||||||
|
int32_t aimvel;
|
||||||
int32_t bits;
|
int32_t bits;
|
||||||
} SW_AVERAGE_PACKET;
|
} SW_AVERAGE_PACKET;
|
||||||
|
|
||||||
|
@ -282,7 +282,6 @@ int EncodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
||||||
*buf = 0;
|
*buf = 0;
|
||||||
buf++;
|
buf++;
|
||||||
|
|
||||||
// TODO: Properly copy the values in a cross-platform manner
|
|
||||||
if (pak->vel != old_pak->vel)
|
if (pak->vel != old_pak->vel)
|
||||||
{
|
{
|
||||||
*((short *)buf) = pak->vel;
|
*((short *)buf) = pak->vel;
|
||||||
|
@ -297,17 +296,17 @@ int EncodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
||||||
SET(*base_ptr, BIT(1));
|
SET(*base_ptr, BIT(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pak->q16avel != old_pak->q16avel)
|
if (pak->angvel != old_pak->angvel)
|
||||||
{
|
{
|
||||||
*((fix16_t *)buf) = pak->q16avel;
|
*((char *)buf) = pak->angvel;
|
||||||
buf += sizeof(pak->q16avel);
|
buf += sizeof(pak->angvel);
|
||||||
SET(*base_ptr, BIT(2));
|
SET(*base_ptr, BIT(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pak->q16horz != old_pak->q16horz)
|
if (pak->aimvel != old_pak->aimvel)
|
||||||
{
|
{
|
||||||
*((fix16_t *)buf) = pak->q16horz;
|
*((char *)buf) = pak->aimvel;
|
||||||
buf += sizeof(pak->q16horz);
|
buf += sizeof(pak->aimvel);
|
||||||
SET(*base_ptr, BIT(3));
|
SET(*base_ptr, BIT(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +334,6 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
||||||
|
|
||||||
*pak = *old_pak;
|
*pak = *old_pak;
|
||||||
|
|
||||||
// TODO: Properly copy the values in a cross-platform manner
|
|
||||||
if (TEST(*base_ptr, BIT(0)))
|
if (TEST(*base_ptr, BIT(0)))
|
||||||
{
|
{
|
||||||
pak->vel = *(short *)buf;
|
pak->vel = *(short *)buf;
|
||||||
|
@ -350,14 +348,14 @@ int DecodeBits(SW_PACKET *pak, SW_PACKET *old_pak, uint8_t* buf)
|
||||||
|
|
||||||
if (TEST(*base_ptr, BIT(2)))
|
if (TEST(*base_ptr, BIT(2)))
|
||||||
{
|
{
|
||||||
pak->q16avel = *(fix16_t *)buf;
|
pak->angvel = *(char *)buf;
|
||||||
buf += sizeof(pak->q16avel);
|
buf += sizeof(pak->angvel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST(*base_ptr, BIT(3)))
|
if (TEST(*base_ptr, BIT(3)))
|
||||||
{
|
{
|
||||||
pak->q16horz = *(fix16_t *)buf;
|
pak->aimvel = *(char *)buf;
|
||||||
buf += sizeof(pak->q16horz);
|
buf += sizeof(pak->aimvel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//won't work if > 4 bytes
|
//won't work if > 4 bytes
|
||||||
|
@ -935,13 +933,12 @@ faketimerhandler(void)
|
||||||
if (Player[myconnectindex].movefifoend - movefifoplc >= 100)
|
if (Player[myconnectindex].movefifoend - movefifoplc >= 100)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// getinput() calls will require redoing with regard to local input changes.
|
getinput(&loc);
|
||||||
// getinput(&loc);
|
|
||||||
|
|
||||||
AveragePacket.vel += loc.vel;
|
AveragePacket.vel += loc.vel;
|
||||||
AveragePacket.svel += loc.svel;
|
AveragePacket.svel += loc.svel;
|
||||||
AveragePacket.q16avel += loc.q16avel;
|
AveragePacket.angvel += loc.angvel;
|
||||||
AveragePacket.q16horz += loc.q16horz;
|
AveragePacket.aimvel += loc.aimvel;
|
||||||
SET(AveragePacket.bits, loc.bits);
|
SET(AveragePacket.bits, loc.bits);
|
||||||
|
|
||||||
pp = Player + myconnectindex;
|
pp = Player + myconnectindex;
|
||||||
|
@ -958,8 +955,8 @@ faketimerhandler(void)
|
||||||
|
|
||||||
loc.vel = AveragePacket.vel / MovesPerPacket;
|
loc.vel = AveragePacket.vel / MovesPerPacket;
|
||||||
loc.svel = AveragePacket.svel / MovesPerPacket;
|
loc.svel = AveragePacket.svel / MovesPerPacket;
|
||||||
loc.q16avel = AveragePacket.q16avel / fix16_from_int(MovesPerPacket);
|
loc.angvel = AveragePacket.angvel / MovesPerPacket;
|
||||||
loc.q16horz = AveragePacket.q16horz / fix16_from_int(MovesPerPacket);
|
loc.aimvel = AveragePacket.aimvel / MovesPerPacket;
|
||||||
loc.bits = AveragePacket.bits;
|
loc.bits = AveragePacket.bits;
|
||||||
|
|
||||||
memset(&AveragePacket, 0, sizeof(AveragePacket));
|
memset(&AveragePacket, 0, sizeof(AveragePacket));
|
||||||
|
|
|
@ -2405,7 +2405,7 @@ InitPlayerSprite(PLAYERp pp)
|
||||||
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
||||||
pp->Reverb = 0;
|
pp->Reverb = 0;
|
||||||
sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
|
sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
|
||||||
pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0);
|
pp->posy, pp->posz, pp->pang, 0);
|
||||||
|
|
||||||
pp->SpriteP = sp = &sprite[sp_num];
|
pp->SpriteP = sp = &sprite[sp_num];
|
||||||
pp->pnum = pnum;
|
pp->pnum = pnum;
|
||||||
|
@ -2481,7 +2481,7 @@ SpawnPlayerUnderSprite(PLAYERp pp)
|
||||||
int pnum = pp - Player, sp_num;
|
int pnum = pp - Player, sp_num;
|
||||||
|
|
||||||
sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum,
|
sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum,
|
||||||
NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0);
|
NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->pang, 0);
|
||||||
|
|
||||||
sp = &sprite[sp_num];
|
sp = &sprite[sp_num];
|
||||||
u = User[sp_num];
|
u = User[sp_num];
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -130,6 +130,7 @@ void DoPlayer(void);
|
||||||
void domovethings(void);
|
void domovethings(void);
|
||||||
void InitAllPlayers(void);
|
void InitAllPlayers(void);
|
||||||
void InitMultiPlayerInfo(void);
|
void InitMultiPlayerInfo(void);
|
||||||
|
void MoveScrollMode2D(PLAYERp pp);
|
||||||
void DoPlayerDivePalette(PLAYERp pp);
|
void DoPlayerDivePalette(PLAYERp pp);
|
||||||
void DoPlayerNightVisionPalette(PLAYERp pp);
|
void DoPlayerNightVisionPalette(PLAYERp pp);
|
||||||
void DoPlayerStopDiveNoWarp(PLAYERp pp);
|
void DoPlayerStopDiveNoWarp(PLAYERp pp);
|
||||||
|
@ -143,8 +144,6 @@ void PlaySOsound(short sectnum,short sound_num);
|
||||||
void DoSpawnTeleporterEffectPlace(SPRITEp sp);
|
void DoSpawnTeleporterEffectPlace(SPRITEp sp);
|
||||||
void FindMainSector(SECTOR_OBJECTp sop);
|
void FindMainSector(SECTOR_OBJECTp sop);
|
||||||
|
|
||||||
SWBOOL P_CheckOperatingVehicle(PLAYERp pp);
|
|
||||||
|
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,9 +45,8 @@ PLAYERp ppp = &PredictPlayer;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int x,y,z;
|
int x,y,z,horiz;
|
||||||
fix16_t q16horiz, q16ang;
|
short ang,filler;
|
||||||
short filler;
|
|
||||||
} PREDICT, *PREDICTp;
|
} PREDICT, *PREDICTp;
|
||||||
|
|
||||||
PREDICT Predict[MOVEFIFOSIZ];
|
PREDICT Predict[MOVEFIFOSIZ];
|
||||||
|
@ -157,11 +156,11 @@ DoPrediction(PLAYERp ppp)
|
||||||
u = User[ppp->PlayerSprite];
|
u = User[ppp->PlayerSprite];
|
||||||
User[ppp->PlayerSprite] = &PredictUser;
|
User[ppp->PlayerSprite] = &PredictUser;
|
||||||
|
|
||||||
ppp->oq16ang = ppp->q16ang;
|
ppp->oang = ppp->pang;
|
||||||
ppp->oposx = ppp->posx;
|
ppp->oposx = ppp->posx;
|
||||||
ppp->oposy = ppp->posy;
|
ppp->oposy = ppp->posy;
|
||||||
ppp->oposz = ppp->posz;
|
ppp->oposz = ppp->posz;
|
||||||
ppp->oq16horiz = ppp->q16horiz;
|
ppp->ohoriz = ppp->horiz;
|
||||||
|
|
||||||
#if PREDICT_DEBUG
|
#if PREDICT_DEBUG
|
||||||
PredictDebug(ppp);
|
PredictDebug(ppp);
|
||||||
|
@ -179,11 +178,11 @@ DoPrediction(PLAYERp ppp)
|
||||||
sprite[Player[myconnectindex].PlayerSprite] = spr;
|
sprite[Player[myconnectindex].PlayerSprite] = spr;
|
||||||
randomseed = bakrandomseed;
|
randomseed = bakrandomseed;
|
||||||
|
|
||||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].q16ang = ppp->q16ang;
|
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].ang = ppp->pang;
|
||||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].x = ppp->posx;
|
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].x = ppp->posx;
|
||||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].y = ppp->posy;
|
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].y = ppp->posy;
|
||||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].z = ppp->posz;
|
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].z = ppp->posz;
|
||||||
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].q16horiz = ppp->q16horiz;
|
Predict[predictmovefifoplc & (MOVEFIFOSIZ-1)].horiz = ppp->horiz;
|
||||||
predictmovefifoplc++;
|
predictmovefifoplc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,17 +198,17 @@ CorrectPrediction(int actualfifoplc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// see if player position is predicted position
|
// see if player position is predicted position
|
||||||
if (predict->q16ang == Player[myconnectindex].q16ang &&
|
if (predict->ang == Player[myconnectindex].pang &&
|
||||||
predict->x == Player[myconnectindex].posx &&
|
predict->x == Player[myconnectindex].posx &&
|
||||||
predict->y == Player[myconnectindex].posy &&
|
predict->y == Player[myconnectindex].posy &&
|
||||||
predict->z == Player[myconnectindex].posz &&
|
predict->z == Player[myconnectindex].posz &&
|
||||||
predict->q16horiz == Player[myconnectindex].q16horiz
|
predict->horiz == Player[myconnectindex].horiz
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //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));
|
// //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);
|
||||||
// MONO_PRINT(ds);
|
// MONO_PRINT(ds);
|
||||||
|
|
||||||
InitPrediction(&Player[myconnectindex]);
|
InitPrediction(&Player[myconnectindex]);
|
||||||
|
|
|
@ -33,7 +33,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
|
|
||||||
BEGIN_SW_NS
|
BEGIN_SW_NS
|
||||||
|
|
||||||
void FAF_DrawRooms(int posx, int posy, int posz, fix16_t q16ang, fix16_t q16horiz, short cursectnum);
|
void FAF_DrawRooms(int posx, int posy, int posz, short ang, int horiz, short cursectnum);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -1089,7 +1089,7 @@ ViewSectorInScene(short cursectnum, short level)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DrawOverlapRoom(int tx, int ty, int tz, fix16_t tq16ang, fix16_t tq16horiz, short tsectnum)
|
DrawOverlapRoom(int tx, int ty, int tz, short tang, int thoriz, short tsectnum)
|
||||||
{
|
{
|
||||||
short i;
|
short i;
|
||||||
short match;
|
short match;
|
||||||
|
@ -1104,8 +1104,8 @@ DrawOverlapRoom(int tx, int ty, int tz, fix16_t tq16ang, fix16_t tq16horiz, shor
|
||||||
if (tsectnum < 0)
|
if (tsectnum < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
//FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
//FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
|
|
||||||
// reset Z's
|
// reset Z's
|
||||||
for (i = 0; i < save.zcount; i++)
|
for (i = 0; i < save.zcount; i++)
|
||||||
|
@ -1130,8 +1130,8 @@ DrawOverlapRoom(int tx, int ty, int tz, fix16_t tq16ang, fix16_t tq16horiz, shor
|
||||||
if (tsectnum < 0)
|
if (tsectnum < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
renderDrawRoomsQ16(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
drawrooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
//FAF_DrawRooms(tx, ty, tz, tq16ang, tq16horiz, tsectnum);
|
//FAF_DrawRooms(tx, ty, tz, tang, thoriz, tsectnum);
|
||||||
|
|
||||||
// reset Z's
|
// reset Z's
|
||||||
for (i = 0; i < save.zcount; i++)
|
for (i = 0; i < save.zcount; i++)
|
||||||
|
|
|
@ -2339,7 +2339,7 @@ SWBOOL NearThings(PLAYERp pp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, fix16_to_int(pp->q16ang),
|
neartag(pp->posx, pp->posy, pp->posz, pp->cursectnum, pp->pang,
|
||||||
&neartagsect, &neartagwall, &neartagsprite,
|
&neartagsect, &neartagwall, &neartagsprite,
|
||||||
&neartaghitdist, 1024L, NTAG_SEARCH_LO_HI, NULL);
|
&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
|
// This only gets called if nothing else worked, check for nearness to a wall
|
||||||
{
|
{
|
||||||
hitdata_t hitinfo = { { 0, 0, 0 }, 0, 0, 0 };
|
hitdata_t hitinfo = { { 0, 0, 0 }, 0, 0, 0 };
|
||||||
short dang = fix16_to_int(pp->q16ang);
|
short dang = pp->pang;
|
||||||
|
|
||||||
FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position
|
FAFhitscan(pp->posx, pp->posy, pp->posz - Z(30), pp->cursectnum, // Start position
|
||||||
sintable[NORM_ANGLE(dang + 512)], // X vector of 3D ang
|
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;
|
int neartaghitdist;
|
||||||
|
|
||||||
|
|
||||||
neartag(pp->posx, pp->posy, z, pp->cursectnum, fix16_to_int(pp->q16ang),
|
neartag(pp->posx, pp->posy, z, pp->cursectnum, pp->pang,
|
||||||
&neartagsector, &neartagwall, &neartagsprite,
|
&neartagsector, &neartagwall, &neartagsprite,
|
||||||
&neartaghitdist, dist, type, NULL);
|
&neartaghitdist, dist, type, NULL);
|
||||||
|
|
||||||
|
|
|
@ -586,7 +586,7 @@ void DoUpdateSounds(void)
|
||||||
PLAYERp pp = Player + screenpeek;
|
PLAYERp pp = Player + screenpeek;
|
||||||
SoundListener listener;
|
SoundListener listener;
|
||||||
|
|
||||||
listener.angle = -(float)fix16_to_float(pp->q16ang) * pi::pi() / 1024; // Build uses a period of 2048.
|
listener.angle = -(float)pp->pang * pi::pi() / 1024; // Build uses a period of 2048.
|
||||||
listener.velocity.Zero();
|
listener.velocity.Zero();
|
||||||
listener.position = GetSoundPos((vec3_t*)&pp->posx);
|
listener.position = GetSoundPos((vec3_t*)&pp->posx);
|
||||||
listener.underwater = false;
|
listener.underwater = false;
|
||||||
|
|
|
@ -76,7 +76,7 @@ PlayerSync(void)
|
||||||
updatecrc(crc, pp->posx & 255);
|
updatecrc(crc, pp->posx & 255);
|
||||||
updatecrc(crc, pp->posy & 255);
|
updatecrc(crc, pp->posy & 255);
|
||||||
updatecrc(crc, pp->posz & 255);
|
updatecrc(crc, pp->posz & 255);
|
||||||
updatecrc(crc, fix16_to_int(pp->q16ang) & 255);
|
updatecrc(crc, pp->pang & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint8_t) crc & 255;
|
return (uint8_t) crc & 255;
|
||||||
|
@ -93,7 +93,7 @@ PlayerSync2(void)
|
||||||
{
|
{
|
||||||
pp = Player + i;
|
pp = Player + i;
|
||||||
|
|
||||||
updatecrc(crc, fix16_to_int(pp->q16horiz) & 255);
|
updatecrc(crc, pp->horiz & 255);
|
||||||
updatecrc(crc, User[pp->PlayerSprite]->Health & 255);
|
updatecrc(crc, User[pp->PlayerSprite]->Health & 255);
|
||||||
updatecrc(crc, pp->bcnt & 255);
|
updatecrc(crc, pp->bcnt & 255);
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ getsyncbyte()
|
||||||
{
|
{
|
||||||
pp = Player + i;
|
pp = Player + i;
|
||||||
u = User[pp->SpriteP - sprite];
|
u = User[pp->SpriteP - sprite];
|
||||||
ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ fix16_to_int(pp->q16ang) ^ fix16_to_int(pp->q16horiz) ^ u->Health);
|
ch ^= (pp->posx ^ pp->posy ^ pp->posz ^ pp->pang ^ pp->horiz ^ u->Health);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = headspritestat[STAT_ENEMY]; j >= 0; j = nextspritestat[j])
|
for (j = headspritestat[STAT_ENEMY]; j >= 0; j = nextspritestat[j])
|
||||||
|
|
|
@ -34,7 +34,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
#include "ai.h"
|
#include "ai.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "interp.h"
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
@ -789,7 +788,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh)
|
if (pp->posx > xlow && pp->posx < xhigh && pp->posy > ylow && pp->posy < yhigh)
|
||||||
{
|
{
|
||||||
pp->RevolveAng = pp->q16ang;
|
pp->RevolveAng = pp->pang;
|
||||||
pp->RevolveX = pp->posx;
|
pp->RevolveX = pp->posx;
|
||||||
pp->RevolveY = pp->posy;
|
pp->RevolveY = pp->posy;
|
||||||
pp->RevolveDeltaAng = 0;
|
pp->RevolveDeltaAng = 0;
|
||||||
|
@ -849,7 +848,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure every sector object has an outer loop tagged - important
|
// Make sure every sector object has an outer loop tagged - important
|
||||||
// Further setup interpolation
|
|
||||||
//
|
//
|
||||||
|
|
||||||
FoundOutsideLoop = FALSE;
|
FoundOutsideLoop = FALSE;
|
||||||
|
@ -862,21 +860,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
||||||
// move all walls in sectors
|
// move all walls in sectors
|
||||||
for (k = startwall; k <= endwall; k++)
|
for (k = startwall; k <= endwall; k++)
|
||||||
{
|
{
|
||||||
uint16_t const nextwall = wall[k].nextwall;
|
|
||||||
|
|
||||||
// setup interpolation
|
|
||||||
if (InterpolateSectObj)
|
|
||||||
{
|
|
||||||
setinterpolation(&wall[k].x);
|
|
||||||
setinterpolation(&wall[k].y);
|
|
||||||
|
|
||||||
if (nextwall < MAXWALLS)
|
|
||||||
{
|
|
||||||
setinterpolation(&wall[wall[nextwall].point2].x);
|
|
||||||
setinterpolation(&wall[wall[nextwall].point2].y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for morph point - tornado style
|
// for morph point - tornado style
|
||||||
if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
|
if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
|
||||||
sop->morph_wall_point = k;
|
sop->morph_wall_point = k;
|
||||||
|
@ -886,16 +869,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
// each wall has this set - for collision detection
|
// each wall has this set - for collision detection
|
||||||
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
|
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
|
||||||
|
uint16_t const nextwall = wall[k].nextwall;
|
||||||
if (nextwall < MAXWALLS)
|
if (nextwall < MAXWALLS)
|
||||||
SET(wall[nextwall].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
|
SET(wall[nextwall].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpolate floor and ceiling
|
|
||||||
if (InterpolateSectObj && (k != startwall))
|
|
||||||
{
|
|
||||||
setinterpolation(&(*sectp)->ceilingz);
|
|
||||||
setinterpolation(&(*sectp)->floorz);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FoundOutsideLoop)
|
if (!FoundOutsideLoop)
|
||||||
|
@ -995,8 +972,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
||||||
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
||||||
|
|
||||||
sop->sp_num[sn] = sp_num;
|
sop->sp_num[sn] = sp_num;
|
||||||
if (InterpolateSectObj)
|
|
||||||
setspriteinterpolation(sp);
|
|
||||||
|
|
||||||
|
|
||||||
if (!TEST(sop->flags, SOBJ_SPRITE_OBJ))
|
if (!TEST(sop->flags, SOBJ_SPRITE_OBJ))
|
||||||
|
@ -1644,7 +1619,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
{
|
{
|
||||||
SET(pp->Flags, PF_PLAYER_RIDING);
|
SET(pp->Flags, PF_PLAYER_RIDING);
|
||||||
|
|
||||||
pp->RevolveAng = pp->q16ang;
|
pp->RevolveAng = pp->pang;
|
||||||
pp->RevolveX = pp->posx;
|
pp->RevolveX = pp->posx;
|
||||||
pp->RevolveY = pp->posy;
|
pp->RevolveY = pp->posy;
|
||||||
|
|
||||||
|
@ -1655,11 +1630,6 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
pp->posx += BOUND_4PIX(nx);
|
pp->posx += BOUND_4PIX(nx);
|
||||||
pp->posy += BOUND_4PIX(ny);
|
pp->posy += BOUND_4PIX(ny);
|
||||||
|
|
||||||
if (!InterpolateSectObj)
|
|
||||||
{
|
|
||||||
pp->oposx = pp->posx;
|
|
||||||
pp->oposy = pp->posy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TEST(sop->flags, SOBJ_DONT_ROTATE))
|
if (TEST(sop->flags, SOBJ_DONT_ROTATE))
|
||||||
{
|
{
|
||||||
|
@ -1674,7 +1644,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
// save the current information so when Player stops
|
// save the current information so when Player stops
|
||||||
// moving then you
|
// moving then you
|
||||||
// know where he was last
|
// know where he was last
|
||||||
pp->RevolveAng = pp->q16ang;
|
pp->RevolveAng = pp->pang;
|
||||||
pp->RevolveX = pp->posx;
|
pp->RevolveX = pp->posx;
|
||||||
pp->RevolveY = pp->posy;
|
pp->RevolveY = pp->posy;
|
||||||
|
|
||||||
|
@ -1690,13 +1660,13 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
pp->RevolveY += BOUND_4PIX(ny);
|
pp->RevolveY += BOUND_4PIX(ny);
|
||||||
|
|
||||||
// Last known angle is now adjusted by the delta angle
|
// Last known angle is now adjusted by the delta angle
|
||||||
pp->RevolveAng = fix16_ssub(pp->q16ang, pp->RevolveDeltaAng) & 0x7FFFFFF;
|
pp->RevolveAng = NORM_ANGLE(pp->pang - pp->RevolveDeltaAng);
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment Players delta angle
|
// increment Players delta angle
|
||||||
pp->RevolveDeltaAng = fix16_sadd(pp->RevolveDeltaAng, fix16_from_int(GlobSpeedSO)) & 0x7FFFFFF;
|
pp->RevolveDeltaAng = NORM_ANGLE(pp->RevolveDeltaAng + GlobSpeedSO);
|
||||||
|
|
||||||
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&pp->RevolveX, fix16_to_int(pp->RevolveDeltaAng), (vec2_t *)&pp->posx);
|
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&pp->RevolveX, pp->RevolveDeltaAng, (vec2_t *)&pp->posx);
|
||||||
|
|
||||||
// THIS WAS CAUSING PROLEMS!!!!
|
// THIS WAS CAUSING PROLEMS!!!!
|
||||||
// Sectors are still being manipulated so you can end up in a void (-1) sector
|
// Sectors are still being manipulated so you can end up in a void (-1) sector
|
||||||
|
@ -1704,9 +1674,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
||||||
|
|
||||||
// New angle is formed by taking last known angle and
|
// New angle is formed by taking last known angle and
|
||||||
// adjusting by the delta angle
|
// adjusting by the delta angle
|
||||||
pp->q16ang = fix16_sadd(pp->RevolveAng, pp->RevolveDeltaAng) & 0x7FFFFFF;
|
pp->pang = NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng);
|
||||||
if (!InterpolateSectObj)
|
|
||||||
pp->oq16ang = pp->q16ang;
|
|
||||||
|
|
||||||
UpdatePlayerSprite(pp);
|
UpdatePlayerSprite(pp);
|
||||||
}
|
}
|
||||||
|
@ -1959,8 +1927,6 @@ PlayerPart:
|
||||||
pp->SpriteP->z = pp->loz;
|
pp->SpriteP->z = pp->loz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!InterpolateSectObj)
|
|
||||||
pp->oposz = pp->posz;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2075,8 +2041,6 @@ void KillSectorObjectSprites(SECTOR_OBJECTp sop)
|
||||||
if (sp->picnum == ST1 && sp->hitag == SPAWN_SPOT)
|
if (sp->picnum == ST1 && sp->hitag == SPAWN_SPOT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (InterpolateSectObj)
|
|
||||||
stopspriteinterpolation(sp);
|
|
||||||
KillSprite(sop->sp_num[i]);
|
KillSprite(sop->sp_num[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
||||||
#include "names2.h"
|
#include "names2.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "interp.h"
|
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
#include "common_game.h"
|
#include "common_game.h"
|
||||||
#include "break.h"
|
#include "break.h"
|
||||||
|
@ -11393,8 +11392,6 @@ AddSpriteToSectorObject(short SpriteNum, SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
||||||
sop->sp_num[sn] = SpriteNum;
|
sop->sp_num[sn] = SpriteNum;
|
||||||
if (InterpolateSectObj)
|
|
||||||
setspriteinterpolation(sp);
|
|
||||||
|
|
||||||
SET(u->Flags, SPR_ON_SO_SECTOR|SPR_SO_ATTACHED);
|
SET(u->Flags, SPR_ON_SO_SECTOR|SPR_SO_ATTACHED);
|
||||||
|
|
||||||
|
@ -11461,8 +11458,6 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop)
|
||||||
|
|
||||||
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
ASSERT(sn < SIZ(sop->sp_num) - 1);
|
||||||
sop->sp_num[sn] = explosion;
|
sop->sp_num[sn] = explosion;
|
||||||
if (InterpolateSectObj)
|
|
||||||
setspriteinterpolation(exp);
|
|
||||||
|
|
||||||
// Place sprite exactly where shoot point is
|
// Place sprite exactly where shoot point is
|
||||||
//exp->x = eu->ox = sop->xmid - u->sx;
|
//exp->x = eu->ox = sop->xmid - u->sx;
|
||||||
|
@ -12846,7 +12841,7 @@ DoRing(int16_t Weapon)
|
||||||
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
||||||
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
||||||
if (User[sp->owner]->PlayerP)
|
if (User[sp->owner]->PlayerP)
|
||||||
sp->z += (u->Dist * ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT)) >> 9;
|
sp->z += (u->Dist * ((100 - pp->horiz) * HORIZ_MULT)) >> 9;
|
||||||
|
|
||||||
//sp->ang = NORM_ANGLE(sp->ang + 512);
|
//sp->ang = NORM_ANGLE(sp->ang + 512);
|
||||||
//updatesector(sp->x, sp->y);
|
//updatesector(sp->x, sp->y);
|
||||||
|
@ -12894,7 +12889,7 @@ InitSpellRing(PLAYERp pp)
|
||||||
|
|
||||||
ang_diff = 2048 / max_missiles;
|
ang_diff = 2048 / max_missiles;
|
||||||
|
|
||||||
ang_start = NORM_ANGLE(fix16_to_int(pp->q16ang) - DIV2(2048));
|
ang_start = NORM_ANGLE(pp->pang - DIV2(2048));
|
||||||
|
|
||||||
if (!SW_SHAREWARE)
|
if (!SW_SHAREWARE)
|
||||||
PlaySound(DIGI_RFWIZ, pp, v3df_none);
|
PlaySound(DIGI_RFWIZ, pp, v3df_none);
|
||||||
|
@ -12933,7 +12928,7 @@ InitSpellRing(PLAYERp pp)
|
||||||
// put it out there
|
// put it out there
|
||||||
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(sp->ang + 512)]) >> 14;
|
||||||
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
sp->y += ((int) u->Dist * (int) sintable[sp->ang]) >> 14;
|
||||||
sp->z = pp->posz + Z(20) + ((u->Dist * ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT)) >> 9);
|
sp->z = pp->posz + Z(20) + ((u->Dist * ((100 - pp->horiz) * HORIZ_MULT)) >> 9);
|
||||||
|
|
||||||
sp->ang = NORM_ANGLE(sp->ang + 512);
|
sp->ang = NORM_ANGLE(sp->ang + 512);
|
||||||
|
|
||||||
|
@ -13453,7 +13448,7 @@ InitSpellNapalm(PLAYERp pp)
|
||||||
for (i = 0; i < SIZ(mp); i++)
|
for (i = 0; i < SIZ(mp); i++)
|
||||||
{
|
{
|
||||||
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
|
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
|
||||||
pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), NAPALM_VELOCITY*2);
|
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, NAPALM_VELOCITY*2);
|
||||||
|
|
||||||
sp = &sprite[SpriteNum];
|
sp = &sprite[SpriteNum];
|
||||||
u = User[SpriteNum];
|
u = User[SpriteNum];
|
||||||
|
@ -13472,7 +13467,7 @@ InitSpellNapalm(PLAYERp pp)
|
||||||
sp->xrepeat = 32;
|
sp->xrepeat = 32;
|
||||||
sp->yrepeat = 32;
|
sp->yrepeat = 32;
|
||||||
sp->clipdist = 0;
|
sp->clipdist = 0;
|
||||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SET(u->Flags2, SPR2_BLUR_TAPER_FAST);
|
SET(u->Flags2, SPR2_BLUR_TAPER_FAST);
|
||||||
|
@ -13613,7 +13608,7 @@ InitSpellMirv(PLAYERp pp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursectnum,
|
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Mirv, pp->cursectnum,
|
||||||
pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), MIRV_VELOCITY);
|
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, MIRV_VELOCITY);
|
||||||
|
|
||||||
sp = &sprite[SpriteNum];
|
sp = &sprite[SpriteNum];
|
||||||
u = User[SpriteNum];
|
u = User[SpriteNum];
|
||||||
|
@ -13627,7 +13622,7 @@ InitSpellMirv(PLAYERp pp)
|
||||||
sp->xrepeat = 72;
|
sp->xrepeat = 72;
|
||||||
sp->yrepeat = 72;
|
sp->yrepeat = 72;
|
||||||
sp->clipdist = 32L >> 2;
|
sp->clipdist = 32L >> 2;
|
||||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
SET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER);
|
||||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
|
|
||||||
|
@ -13728,7 +13723,7 @@ InitSwordAttack(PLAYERp pp)
|
||||||
{
|
{
|
||||||
bp = &sprite[bubble];
|
bp = &sprite[bubble];
|
||||||
|
|
||||||
bp->ang = fix16_to_int(pp->q16ang);
|
bp->ang = pp->pang;
|
||||||
|
|
||||||
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
|
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
|
||||||
|
|
||||||
|
@ -13777,8 +13772,8 @@ InitSwordAttack(PLAYERp pp)
|
||||||
short daang;
|
short daang;
|
||||||
int daz;
|
int daz;
|
||||||
|
|
||||||
daang = fix16_to_int(pp->q16ang);
|
daang = pp->pang;
|
||||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||||
|
|
||||||
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
||||||
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
||||||
|
@ -13905,7 +13900,7 @@ InitFistAttack(PLAYERp pp)
|
||||||
{
|
{
|
||||||
bp = &sprite[bubble];
|
bp = &sprite[bubble];
|
||||||
|
|
||||||
bp->ang = fix16_to_int(pp->q16ang);
|
bp->ang = pp->pang;
|
||||||
|
|
||||||
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
|
random_amt = (RANDOM_P2(32<<8)>>8) - 16;
|
||||||
|
|
||||||
|
@ -13967,8 +13962,8 @@ InitFistAttack(PLAYERp pp)
|
||||||
short daang;
|
short daang;
|
||||||
int daz;
|
int daz;
|
||||||
|
|
||||||
daang = fix16_to_int(pp->q16ang);
|
daang = pp->pang;
|
||||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||||
|
|
||||||
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
FAFhitscan(pp->posx, pp->posy, pp->posz, pp->cursectnum, // Start position
|
||||||
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
sintable[NORM_ANGLE(daang + 512)], // X vector of 3D ang
|
||||||
|
@ -14626,7 +14621,7 @@ InitStar(PLAYERp pp)
|
||||||
// Spawn a shot
|
// Spawn a shot
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, fix16_to_int(pp->q16ang), STAR_VELOCITY);
|
w = SpawnSprite(STAT_MISSILE, STAR1, s_Star, pp->cursectnum, nx, ny, nz, pp->pang, STAR_VELOCITY);
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
|
||||||
|
@ -14641,7 +14636,7 @@ InitStar(PLAYERp pp)
|
||||||
wp->clipdist = 32L >> 2;
|
wp->clipdist = 32L >> 2;
|
||||||
// wp->zvel was overflowing with this calculation - had to move to a local
|
// wp->zvel was overflowing with this calculation - had to move to a local
|
||||||
// long var
|
// long var
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||||
|
|
||||||
wu->ceiling_dist = Z(1);
|
wu->ceiling_dist = Z(1);
|
||||||
wu->floor_dist = Z(1);
|
wu->floor_dist = Z(1);
|
||||||
|
@ -14698,7 +14693,7 @@ InitStar(PLAYERp pp)
|
||||||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np))
|
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(np))
|
||||||
SET(nu->Flags, SPR_UNDERWATER);
|
SET(nu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT+STAR_HORIZ_ADJ));
|
||||||
np->zvel = zvel >> 1;
|
np->zvel = zvel >> 1;
|
||||||
|
|
||||||
if (MissileSetPos(nw, DoStar, 1000))
|
if (MissileSetPos(nw, DoStar, 1000))
|
||||||
|
@ -14749,7 +14744,7 @@ InitHeartAttack(PLAYERp pp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
||||||
pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), BLOOD_WORM_VELOCITY*2);
|
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2);
|
||||||
|
|
||||||
sp = &sprite[SpriteNum];
|
sp = &sprite[SpriteNum];
|
||||||
u = User[SpriteNum];
|
u = User[SpriteNum];
|
||||||
|
@ -14762,7 +14757,7 @@ InitHeartAttack(PLAYERp pp)
|
||||||
sp->xrepeat = 52;
|
sp->xrepeat = 52;
|
||||||
sp->yrepeat = 52;
|
sp->yrepeat = 52;
|
||||||
sp->clipdist = 0;
|
sp->clipdist = 0;
|
||||||
sp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
sp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SET(u->Flags2, SPR2_DONT_TARGET_OWNER);
|
SET(u->Flags2, SPR2_DONT_TARGET_OWNER);
|
||||||
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
|
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
|
||||||
|
@ -14825,7 +14820,7 @@ InitHeartAttack(PLAYERp pp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
SpriteNum = SpawnSprite(STAT_MISSILE_SKIP4, BLOOD_WORM, s_BloodWorm, pp->cursectnum,
|
||||||
pp->posx, pp->posy, pp->posz + Z(12), fix16_to_int(pp->q16ang), BLOOD_WORM_VELOCITY*2);
|
pp->posx, pp->posy, pp->posz + Z(12), pp->pang, BLOOD_WORM_VELOCITY*2);
|
||||||
|
|
||||||
sp = &sprite[SpriteNum];
|
sp = &sprite[SpriteNum];
|
||||||
u = User[SpriteNum];
|
u = User[SpriteNum];
|
||||||
|
@ -14986,8 +14981,8 @@ InitShotgun(PLAYERp pp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
daz = (100 - fix16_to_int(pp->q16horiz)) * 2000;
|
daz = (100 - pp->horiz) * 2000;
|
||||||
daang = fix16_to_int(pp->q16ang);
|
daang = pp->pang;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
|
@ -15149,7 +15144,7 @@ InitLaser(PLAYERp pp)
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), 300);
|
nx, ny, nz, pp->pang, 300);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -15162,7 +15157,7 @@ InitLaser(PLAYERp pp)
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
// the slower the missile travels the less of a zvel it needs
|
// the slower the missile travels the less of a zvel it needs
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wp->zvel /= 4;
|
wp->zvel /= 4;
|
||||||
|
|
||||||
wu->WeaponNum = u->WeaponNum;
|
wu->WeaponNum = u->WeaponNum;
|
||||||
|
@ -15261,7 +15256,7 @@ InitRail(PLAYERp pp)
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), 1200);
|
nx, ny, nz, pp->pang, 1200);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -15270,7 +15265,7 @@ InitRail(PLAYERp pp)
|
||||||
wp->yrepeat = 52;
|
wp->yrepeat = 52;
|
||||||
wp->xrepeat = 52;
|
wp->xrepeat = 52;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+17));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT+17));
|
||||||
|
|
||||||
wu->RotNum = 5;
|
wu->RotNum = 5;
|
||||||
NewStateGroup(w, &sg_Rail[0]);
|
NewStateGroup(w, &sg_Rail[0]);
|
||||||
|
@ -15460,7 +15455,7 @@ InitRocket(PLAYERp pp)
|
||||||
//nz = pp->posz + pp->bob_z + Z(12);
|
//nz = pp->posz + pp->bob_z + Z(12);
|
||||||
nz = pp->posz + pp->bob_z + Z(8);
|
nz = pp->posz + pp->bob_z + Z(8);
|
||||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), ROCKET_VELOCITY);
|
nx, ny, nz, pp->pang, ROCKET_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -15470,7 +15465,7 @@ InitRocket(PLAYERp pp)
|
||||||
wp->yrepeat = 90;
|
wp->yrepeat = 90;
|
||||||
wp->xrepeat = 90;
|
wp->xrepeat = 90;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+35));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT+35));
|
||||||
|
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
|
@ -15581,7 +15576,7 @@ InitBunnyRocket(PLAYERp pp)
|
||||||
//nz = pp->posz + pp->bob_z + Z(12);
|
//nz = pp->posz + pp->bob_z + Z(12);
|
||||||
nz = pp->posz + pp->bob_z + Z(8);
|
nz = pp->posz + pp->bob_z + Z(8);
|
||||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R4, &s_BunnyRocket[0][0], pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), ROCKET_VELOCITY);
|
nx, ny, nz, pp->pang, ROCKET_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -15591,7 +15586,7 @@ InitBunnyRocket(PLAYERp pp)
|
||||||
wp->yrepeat = 64;
|
wp->yrepeat = 64;
|
||||||
wp->xrepeat = 64;
|
wp->xrepeat = 64;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT+35));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT+35));
|
||||||
|
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
|
@ -15695,7 +15690,7 @@ InitNuke(PLAYERp pp)
|
||||||
//nz = pp->posz + pp->bob_z + Z(12);
|
//nz = pp->posz + pp->bob_z + Z(12);
|
||||||
nz = pp->posz + pp->bob_z + Z(8);
|
nz = pp->posz + pp->bob_z + Z(8);
|
||||||
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), 700);
|
nx, ny, nz, pp->pang, 700);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -15705,7 +15700,7 @@ InitNuke(PLAYERp pp)
|
||||||
wp->yrepeat = 128;
|
wp->yrepeat = 128;
|
||||||
wp->xrepeat = 128;
|
wp->xrepeat = 128;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (HORIZ_MULT-36));
|
zvel = ((100 - pp->horiz) * (HORIZ_MULT-36));
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
// Set to red palette
|
// Set to red palette
|
||||||
|
@ -15758,7 +15753,7 @@ InitNuke(PLAYERp pp)
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
||||||
wu->zchange = zvel;
|
wu->zchange = zvel;
|
||||||
|
|
||||||
PlayerDamageSlide(pp, -40, NORM_ANGLE(fix16_to_int(pp->q16ang)+1024)); // Recoil slide
|
PlayerDamageSlide(pp, -40, NORM_ANGLE(pp->pang+1024)); // Recoil slide
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -15893,7 +15888,7 @@ InitMicro(PLAYERp pp)
|
||||||
{
|
{
|
||||||
hp = NULL;
|
hp = NULL;
|
||||||
hu = NULL;
|
hu = NULL;
|
||||||
ang = fix16_to_int(pp->q16ang);
|
ang = pp->pang;
|
||||||
}
|
}
|
||||||
|
|
||||||
nz = pp->posz + pp->bob_z + Z(14);
|
nz = pp->posz + pp->bob_z + Z(14);
|
||||||
|
@ -15912,7 +15907,7 @@ InitMicro(PLAYERp pp)
|
||||||
wp->yrepeat = 24;
|
wp->yrepeat = 24;
|
||||||
wp->xrepeat = 24;
|
wp->xrepeat = 24;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
// randomize zvelocity
|
// randomize zvelocity
|
||||||
|
@ -17442,14 +17437,14 @@ InitTracerUzi(PLAYERp pp)
|
||||||
nx = pp->posx;
|
nx = pp->posx;
|
||||||
ny = pp->posy;
|
ny = pp->posy;
|
||||||
//nz = pp->posz + pp->bob_z + Z(8);
|
//nz = pp->posz + pp->bob_z + Z(8);
|
||||||
//nz = pp->posz + pp->bob_z + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
//nz = pp->posz + pp->bob_z + Z(8) + ((100 - pp->horiz) * 72);
|
||||||
nz = pp->posz + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
nz = pp->posz + Z(8) + ((100 - pp->horiz) * 72);
|
||||||
|
|
||||||
// Spawn a shot
|
// Spawn a shot
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, 0, s_Tracer, pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, 0, s_Tracer, pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), TRACER_VELOCITY);
|
nx, ny, nz, pp->pang, TRACER_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -17461,7 +17456,7 @@ InitTracerUzi(PLAYERp pp)
|
||||||
wp->xrepeat = 10;
|
wp->xrepeat = 10;
|
||||||
wp->shade = -40;
|
wp->shade = -40;
|
||||||
wp->zvel = 0;
|
wp->zvel = 0;
|
||||||
//wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
//wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wp->clipdist = 32 >> 2;
|
wp->clipdist = 32 >> 2;
|
||||||
|
|
||||||
wu->WeaponNum = u->WeaponNum;
|
wu->WeaponNum = u->WeaponNum;
|
||||||
|
@ -17488,7 +17483,7 @@ InitTracerUzi(PLAYERp pp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||||
|
|
||||||
pp->SpriteP->clipdist = oclipdist;
|
pp->SpriteP->clipdist = oclipdist;
|
||||||
|
|
||||||
|
@ -17731,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);
|
sp->ang = NORM_ANGLE(wall_ang + 1024);
|
||||||
|
|
||||||
// int nx,ny;
|
// int nx,ny;
|
||||||
//nx = (sintable[(512 + fix16_to_int(Player[0].q16ang)) & 2047] >> 7);
|
//nx = (sintable[(512 + Player[0].pang) & 2047] >> 7);
|
||||||
//ny = (sintable[fix16_to_int(Player[0].q16ang)] >> 7);
|
//ny = (sintable[Player[0].pang] >> 7);
|
||||||
//sp->x -= nx;
|
//sp->x -= nx;
|
||||||
//sp->y -= ny;
|
//sp->y -= ny;
|
||||||
|
|
||||||
|
@ -17838,9 +17833,9 @@ InitUzi(PLAYERp pp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25));
|
//daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||||
daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(24) - 12));
|
daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(24) - 12));
|
||||||
daz = ((100 - fix16_to_int(pp->q16horiz)) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
daz = ((100 - pp->horiz) * 2000) + (RANDOM_RANGE(24000) - 12000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18015,8 +18010,8 @@ InitEMP(PLAYERp pp)
|
||||||
|
|
||||||
InitTracerUzi(pp);
|
InitTracerUzi(pp);
|
||||||
|
|
||||||
//daz = nz = pp->posz + Z(8) + ((100 - fix16_to_int(pp->q16horiz)) * 72);
|
//daz = nz = pp->posz + Z(8) + ((100 - pp->horiz) * 72);
|
||||||
//daang = NORM_ANGLE(fix16_to_int(pp->q16ang) + (RANDOM_RANGE(50) - 25));
|
//daang = NORM_ANGLE(pp->pang + (RANDOM_RANGE(50) - 25));
|
||||||
|
|
||||||
daz = nz = pp->posz + pp->bob_z;
|
daz = nz = pp->posz + pp->bob_z;
|
||||||
daang = 64;
|
daang = 64;
|
||||||
|
@ -18025,8 +18020,8 @@ InitEMP(PLAYERp pp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
daz = (100 - fix16_to_int(pp->q16horiz)) * 2000;
|
daz = (100 - pp->horiz) * 2000;
|
||||||
daang = fix16_to_int(pp->q16ang);
|
daang = pp->pang;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAFhitscan(pp->posx, pp->posy, nz, pp->cursectnum, // Start position
|
FAFhitscan(pp->posx, pp->posy, nz, pp->cursectnum, // Start position
|
||||||
|
@ -18199,7 +18194,7 @@ InitTankShell(short SpriteNum, PLAYERp pp)
|
||||||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||||
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
|
SET(wp->cstat, CSTAT_SPRITE_INVISIBLE);
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||||
|
|
||||||
WeaponAutoAim(sp, w, 64, FALSE);
|
WeaponAutoAim(sp, w, 64, FALSE);
|
||||||
// a bit of randomness
|
// a bit of randomness
|
||||||
|
@ -18278,7 +18273,7 @@ InitTurretMicro(short SpriteNum, PLAYERp pp)
|
||||||
wp->yrepeat = 24;
|
wp->yrepeat = 24;
|
||||||
wp->xrepeat = 24;
|
wp->xrepeat = 24;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wp->clipdist = 64L>>2;
|
wp->clipdist = 64L>>2;
|
||||||
|
|
||||||
// randomize zvelocity
|
// randomize zvelocity
|
||||||
|
@ -18359,7 +18354,7 @@ InitTurretRocket(short SpriteNum, PLAYERp pp)
|
||||||
SET(wu->Flags2, SPR2_SO_MISSILE);
|
SET(wu->Flags2, SPR2_SO_MISSILE);
|
||||||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||||
|
|
||||||
WeaponAutoAim(sp, w, 64, FALSE);
|
WeaponAutoAim(sp, w, 64, FALSE);
|
||||||
// a bit of randomness
|
// a bit of randomness
|
||||||
|
@ -18406,7 +18401,7 @@ InitTurretFireball(short SpriteNum, PLAYERp pp)
|
||||||
SET(wu->Flags2, SPR2_SO_MISSILE);
|
SET(wu->Flags2, SPR2_SO_MISSILE);
|
||||||
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
SET(wp->cstat, CSTAT_SPRITE_YCENTER);
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * (wp->xvel/8));
|
wp->zvel = ((100 - pp->horiz) * (wp->xvel/8));
|
||||||
|
|
||||||
WeaponAutoAim(sp, w, 64, FALSE);
|
WeaponAutoAim(sp, w, 64, FALSE);
|
||||||
// a bit of randomness
|
// a bit of randomness
|
||||||
|
@ -18455,7 +18450,7 @@ InitTurretRail(short SpriteNum, PLAYERp pp)
|
||||||
wp->yrepeat = 52;
|
wp->yrepeat = 52;
|
||||||
wp->xrepeat = 52;
|
wp->xrepeat = 52;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
|
|
||||||
wu->RotNum = 5;
|
wu->RotNum = 5;
|
||||||
NewStateGroup(w, &sg_Rail[0]);
|
NewStateGroup(w, &sg_Rail[0]);
|
||||||
|
@ -18515,7 +18510,7 @@ InitTurretLaser(short SpriteNum, PLAYERp pp)
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
|
|
||||||
// the slower the missile travels the less of a zvel it needs
|
// the slower the missile travels the less of a zvel it needs
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wp->zvel /= 4;
|
wp->zvel /= 4;
|
||||||
|
|
||||||
wu->Radius = 200;
|
wu->Radius = 200;
|
||||||
|
@ -18562,7 +18557,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
|
||||||
nsect = sp->sectnum;
|
nsect = sp->sectnum;
|
||||||
|
|
||||||
if (RANDOM_P2(1024) < 200)
|
if (RANDOM_P2(1024) < 200)
|
||||||
InitTracerTurret(sp - sprite, pp->PlayerSprite, fix16_to_int(pp->q16horiz));
|
InitTracerTurret(sp - sprite, pp->PlayerSprite, pp->horiz);
|
||||||
|
|
||||||
daang = 64;
|
daang = 64;
|
||||||
if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1)
|
if (WeaponAutoAimHitscan(sp, &daz, &daang, FALSE) != -1)
|
||||||
|
@ -18573,7 +18568,7 @@ InitSobjMachineGun(short SpriteNum, PLAYERp pp)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int horiz;
|
int horiz;
|
||||||
horiz = fix16_to_int(pp->q16horiz);
|
horiz = pp->horiz;
|
||||||
if (horiz < 75)
|
if (horiz < 75)
|
||||||
horiz = 75;
|
horiz = 75;
|
||||||
|
|
||||||
|
@ -19283,7 +19278,7 @@ InitGrenade(PLAYERp pp)
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, GRENADE, &s_Grenade[0][0], pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), GRENADE_VELOCITY);
|
nx, ny, nz, pp->pang, GRENADE_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -19315,9 +19310,9 @@ InitGrenade(PLAYERp pp)
|
||||||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||||
SET(wu->Flags, SPR_UNDERWATER);
|
SET(wu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
|
|
||||||
////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",fix16_to_int(pp->q16horiz), fix16_to_int(pp->q16horizoff), fix16_to_int(pp->q16horizoff + pp->q16horiz));
|
////DSPRINTF(ds,"horiz %d, ho %d, ho+ho %d",pp->horiz, pp->horizoff, pp->horizoff + pp->horiz);
|
||||||
//MONO_PRINT(ds);
|
//MONO_PRINT(ds);
|
||||||
|
|
||||||
oclipdist = pp->SpriteP->clipdist;
|
oclipdist = pp->SpriteP->clipdist;
|
||||||
|
@ -19452,7 +19447,7 @@ InitMine(PLAYERp pp)
|
||||||
// Inserting and setting up variables
|
// Inserting and setting up variables
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, MINE, s_Mine, pp->cursectnum,
|
w = SpawnSprite(STAT_MISSILE, MINE, s_Mine, pp->cursectnum,
|
||||||
nx, ny, nz, fix16_to_int(pp->q16ang), MINE_VELOCITY);
|
nx, ny, nz, pp->pang, MINE_VELOCITY);
|
||||||
|
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
@ -19462,7 +19457,7 @@ InitMine(PLAYERp pp)
|
||||||
wp->xrepeat = 32;
|
wp->xrepeat = 32;
|
||||||
wp->shade = -15;
|
wp->shade = -15;
|
||||||
wp->clipdist = 128L>>2;
|
wp->clipdist = 128L>>2;
|
||||||
wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
wu->WeaponNum = u->WeaponNum;
|
wu->WeaponNum = u->WeaponNum;
|
||||||
wu->Radius = 200;
|
wu->Radius = 200;
|
||||||
wu->ceiling_dist = Z(5);
|
wu->ceiling_dist = Z(5);
|
||||||
|
@ -19475,7 +19470,7 @@ InitMine(PLAYERp pp)
|
||||||
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(wp))
|
||||||
SET(wu->Flags, SPR_UNDERWATER);
|
SET(wu->Flags, SPR_UNDERWATER);
|
||||||
|
|
||||||
//wp->zvel = ((100 - fix16_to_int(pp->q16horiz)) * HORIZ_MULT);
|
//wp->zvel = ((100 - pp->horiz) * HORIZ_MULT);
|
||||||
|
|
||||||
MissileSetPos(w, DoMine, 800);
|
MissileSetPos(w, DoMine, 800);
|
||||||
|
|
||||||
|
@ -19483,7 +19478,7 @@ InitMine(PLAYERp pp)
|
||||||
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
wu->xchange = MOVEx(wp->xvel, wp->ang);
|
||||||
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
wu->ychange = MOVEy(wp->xvel, wp->ang);
|
||||||
|
|
||||||
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(fix16_to_int(pp->q16ang)+512)], sintable[fix16_to_int(pp->q16ang)]);
|
dot = DOT_PRODUCT_2D(pp->xvect, pp->yvect, sintable[NORM_ANGLE(pp->pang+512)], sintable[pp->pang]);
|
||||||
|
|
||||||
// don't adjust for strafing
|
// don't adjust for strafing
|
||||||
if (labs(dot) > 10000)
|
if (labs(dot) > 10000)
|
||||||
|
@ -19613,7 +19608,7 @@ InitFireball(PLAYERp pp)
|
||||||
|
|
||||||
nz = pp->posz + pp->bob_z + Z(15);
|
nz = pp->posz + pp->bob_z + Z(15);
|
||||||
|
|
||||||
w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, fix16_to_int(pp->q16ang), FIREBALL_VELOCITY);
|
w = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Fireball, pp->cursectnum, nx, ny, nz, pp->pang, FIREBALL_VELOCITY);
|
||||||
wp = &sprite[w];
|
wp = &sprite[w];
|
||||||
wu = User[w];
|
wu = User[w];
|
||||||
|
|
||||||
|
@ -19628,8 +19623,8 @@ InitFireball(PLAYERp pp)
|
||||||
|
|
||||||
wu->ceiling_dist = Z(6);
|
wu->ceiling_dist = Z(6);
|
||||||
wu->floor_dist = Z(6);
|
wu->floor_dist = Z(6);
|
||||||
//zvel = ((100 - fix16_to_int(pp->q16horiz)) * (100+ADJUST));
|
//zvel = ((100 - pp->horiz) * (100+ADJUST));
|
||||||
zvel = ((100 - fix16_to_int(pp->q16horiz)) * (240L));
|
zvel = ((100 - pp->horiz) * (240L));
|
||||||
|
|
||||||
//wu->RotNum = 5;
|
//wu->RotNum = 5;
|
||||||
//NewStateGroup(w, &sg_Fireball);
|
//NewStateGroup(w, &sg_Fireball);
|
||||||
|
|
|
@ -790,7 +790,7 @@ SpawnZombie(PLAYERp pp, short Weapon)
|
||||||
|
|
||||||
//Zombies++;
|
//Zombies++;
|
||||||
|
|
||||||
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0);
|
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->pang, 0);
|
||||||
np = &sprite[New];
|
np = &sprite[New];
|
||||||
nu = User[New];
|
nu = User[New];
|
||||||
np->sectnum = pp->cursectnum;
|
np->sectnum = pp->cursectnum;
|
||||||
|
|
Loading…
Reference in a new issue