SW: Fixes and cleanups following backporting upstream's input changes.

This commit is contained in:
Mitchell Richters 2020-05-20 20:44:04 +10:00 committed by Christoph Oelckers
parent 2c0ad0dd12
commit 979c4846a4
5 changed files with 49 additions and 62 deletions

View file

@ -2016,7 +2016,7 @@ drawscreen(PLAYERp pp)
if (PedanticMode || pp->sop_control || if (PedanticMode || pp->sop_control ||
pp == Player+myconnectindex && TEST(pp->Flags, PF_DEAD)) pp == Player+myconnectindex && TEST(pp->Flags, PF_DEAD))
{ {
tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); tq16ang = camerapp->oq16ang + mulscale16(NORM_Q16ANGLE(camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) - fix16_from_int(1024), smoothratio);
tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio); tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio);
} }
else else
@ -2127,7 +2127,7 @@ 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, tq16ang, tq16horiz); JS_DrawCameras(pp, tx, ty, tz);
} }
screen->BeginScene(); screen->BeginScene();

View file

@ -599,8 +599,8 @@ 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);
return true;
Player[0].q16ang = fix16_from_int(ang); Player[0].q16ang = fix16_from_int(ang);
return true;
} }
void LoadDemoRun(void) void LoadDemoRun(void)
@ -2577,22 +2577,22 @@ 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()) if (M_Active() || GUICapture || GamePaused)
{ {
ototalclock = (int)totalclock; ototalclock = (int)totalclock - (120 / synctics);
buttonMap.ResetButtonStates();
} }
else else
{ {
faketimerhandler();
MoveLoop(); MoveLoop();
} }
drawscreen(Player + screenpeek); drawscreen(Player + screenpeek);
if (QuitFlag) if (QuitFlag)
@ -3070,7 +3070,6 @@ getinput(SW_PACKET *loc, SWBOOL tied)
static int32_t turnheldtime; static int32_t turnheldtime;
int32_t momx, momy; int32_t momx, momy;
extern SWBOOL MenuButtonAutoRun;
extern SWBOOL MenuButtonAutoAim; extern SWBOOL MenuButtonAutoAim;
if (Prediction && CommEnabled) if (Prediction && CommEnabled)
@ -3109,10 +3108,6 @@ getinput(SW_PACKET *loc, SWBOOL tied)
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); PauseKey(pp);
if (PauseKeySet) if (PauseKeySet)
@ -3205,12 +3200,12 @@ getinput(SW_PACKET *loc, SWBOOL tied)
} }
else else
{ {
q16angvel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(32)); q16angvel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(45));
q16angvel += fix16_from_int(info.dyaw) / analogExtent * (turnamount << 1); q16angvel += fix16_from_int(info.dyaw * (turnamount << 1) / (analogExtent >> 1));
} }
if (mouseaim) if (mouseaim)
q16aimvel = -fix16_div(fix16_from_int(info.mousey), fix16_from_int(64)); q16aimvel = -fix16_div(fix16_from_int(info.mousey), fix16_from_int(77));
else else
vel = -(info.mousey >> 6); vel = -(info.mousey >> 6);

View file

@ -524,16 +524,13 @@ 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, fix16_t tpq16ang, fix16_t tpq16horiz) void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
{ {
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);
@ -755,7 +752,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->oq16ang + mulscale16(((pp->q16ang + fix16_from_int(1024) - pp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); // tpq16ang = pp->q16ang;
dist = 0x7fffffff; dist = 0x7fffffff;

View file

@ -71,7 +71,7 @@ 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, fix16_t tpq16ang, fix16_t tpq16horiz); 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,fix16_t tpq16ang,fix16_t tpq16horiz);
void JS_InitMirrors(void); void JS_InitMirrors(void);
void JS_InitLockouts(void); void JS_InitLockouts(void);

View file

@ -1642,7 +1642,6 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
sprite[pp->PlayerUnderSprite].ang = fix16_to_int(*pq16ang); sprite[pp->PlayerUnderSprite].ang = fix16_to_int(*pq16ang);
} }
} }
} }
} }
@ -1829,7 +1828,6 @@ PlayerAutoLook(PLAYERp pp)
int x,y,k,j; int x,y,k,j;
short tempsect; short tempsect;
if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING))
{ {
if ((PedanticMode || !TEST(pp->Flags, PF_MOUSE_AIMING_ON)) if ((PedanticMode || !TEST(pp->Flags, PF_MOUSE_AIMING_ON))
@ -1841,8 +1839,7 @@ PlayerAutoLook(PLAYERp pp)
tempsect = pp->cursectnum; tempsect = pp->cursectnum;
COVERupdatesector(x, y, &tempsect); COVERupdatesector(x, y, &tempsect);
if (tempsect >= 0) // If the new point is inside a valid if (tempsect >= 0) // If the new point is inside a valid sector...
// sector...
{ {
// Get the floorz as if the new (x,y) point was still in // Get the floorz as if the new (x,y) point was still in
// your sector // your sector
@ -1973,7 +1970,6 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
} }
} }
// this is the unlocked type // this is the unlocked type
if (TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN)) if (TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
{ {
@ -1999,7 +1995,6 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
} }
} }
if (!TEST(pp->Flags, PF_LOCK_HORIZ)) if (!TEST(pp->Flags, PF_LOCK_HORIZ))
{ {
if (!(TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN))) if (!(TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN)))