mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
SW: Fixes and cleanups following backporting upstream's input changes.
This commit is contained in:
parent
2c0ad0dd12
commit
979c4846a4
5 changed files with 49 additions and 62 deletions
|
@ -2016,7 +2016,7 @@ drawscreen(PLAYERp pp)
|
|||
if (PedanticMode || pp->sop_control ||
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
@ -2127,7 +2127,7 @@ drawscreen(PLAYERp pp)
|
|||
if (dimensionmode != 6)// && !ScreenSavePic)
|
||||
{
|
||||
// Cameras must be done before the main loop.
|
||||
JS_DrawCameras(pp, tx, ty, tz, tq16ang, tq16horiz);
|
||||
JS_DrawCameras(pp, tx, ty, tz);
|
||||
}
|
||||
|
||||
screen->BeginScene();
|
||||
|
|
|
@ -593,14 +593,14 @@ bool LoadLevel(const char *filename)
|
|||
int16_t ang;
|
||||
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &ang, &Player[0].cursectnum) == -1)
|
||||
{
|
||||
Printf("Level not found: %s", filename);
|
||||
return false;
|
||||
Printf("Level not found: %s", filename);
|
||||
return false;
|
||||
}
|
||||
currentLevel = &mapList[Level];
|
||||
currentLevel = &mapList[Level];
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
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)
|
||||
|
@ -2577,22 +2577,22 @@ void RunLevel(void)
|
|||
handleevents();
|
||||
OSD_DispatchQueued();
|
||||
D_ProcessEvents();
|
||||
faketimerhandler();
|
||||
if (LoadGameOutsideMoveLoop)
|
||||
{
|
||||
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
|
||||
{
|
||||
faketimerhandler();
|
||||
MoveLoop();
|
||||
}
|
||||
|
||||
|
||||
drawscreen(Player + screenpeek);
|
||||
|
||||
if (QuitFlag)
|
||||
|
@ -3070,7 +3070,6 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
static int32_t turnheldtime;
|
||||
int32_t momx, momy;
|
||||
|
||||
extern SWBOOL MenuButtonAutoRun;
|
||||
extern SWBOOL MenuButtonAutoAim;
|
||||
|
||||
if (Prediction && CommEnabled)
|
||||
|
@ -3088,31 +3087,27 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
// MAKE SURE THIS WILL GET SET
|
||||
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);
|
||||
|
||||
if (!CommEnabled)
|
||||
{
|
||||
// Go back to the source to set this - the old code here was catastrophically bad.
|
||||
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
|
||||
if (!CommEnabled)
|
||||
{
|
||||
// Go back to the source to set this - the old code here was catastrophically bad.
|
||||
// this needs to be fixed properly - as it is this can never be compatible with demo playback.
|
||||
|
||||
if (mouseaim)
|
||||
SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||
if (mouseaim)
|
||||
SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON);
|
||||
|
||||
if (cl_autoaim)
|
||||
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
}
|
||||
if (cl_autoaim)
|
||||
SET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
}
|
||||
|
||||
ControlInfo info;
|
||||
CONTROL_GetInput(&info);
|
||||
|
||||
|
||||
//info.dz = (info.dz * move_scale)>>8;
|
||||
//info.dyaw = (info.dyaw * turn_scale)>>8;
|
||||
|
||||
PauseKey(pp);
|
||||
|
||||
if (PauseKeySet)
|
||||
|
@ -3205,12 +3200,12 @@ getinput(SW_PACKET *loc, SWBOOL tied)
|
|||
}
|
||||
else
|
||||
{
|
||||
q16angvel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(32));
|
||||
q16angvel += fix16_from_int(info.dyaw) / analogExtent * (turnamount << 1);
|
||||
q16angvel = fix16_div(fix16_from_int(info.mousex), fix16_from_int(45));
|
||||
q16angvel += fix16_from_int(info.dyaw * (turnamount << 1) / (analogExtent >> 1));
|
||||
}
|
||||
|
||||
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
|
||||
vel = -(info.mousey >> 6);
|
||||
|
||||
|
|
|
@ -524,16 +524,13 @@ short camplayerview = 1; // Don't show yourself!
|
|||
// Hack job alert!
|
||||
// Mirrors and cameras are maintained in the same data structure, but for hardware rendering they cannot be interleaved.
|
||||
// So this function replicates JS_DrawMirrors to only process the camera textures but not change any global state.
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16_t tpq16horiz)
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
int tposx, tposy; // Camera
|
||||
int* longptr;
|
||||
fix16_t tang;
|
||||
|
||||
// int tx, ty, tz, tpang; // Interpolate so mirror doesn't
|
||||
// drift!
|
||||
SWBOOL bIsWallMirror = FALSE;
|
||||
|
||||
camloopcnt += (int32_t)(totalclock - ototalclock);
|
||||
|
@ -717,7 +714,7 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, fix16_t tpq16ang, fix16_
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int j, cnt;
|
||||
int dist;
|
||||
|
@ -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);
|
||||
// ty = pp->oposy + mulscale16(pp->posy - pp->oposy, 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;
|
||||
|
|
|
@ -71,8 +71,8 @@ extern SWBOOL mirrorinview;
|
|||
extern short NormalVisibility;
|
||||
|
||||
void JAnalyzeSprites(tspriteptr_t tspr);
|
||||
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, 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_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_InitMirrors(void);
|
||||
void JS_InitLockouts(void);
|
||||
void JS_ToggleLockouts(void);
|
||||
|
|
|
@ -1642,7 +1642,6 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16angvel)
|
|||
sprite[pp->PlayerUnderSprite].ang = fix16_to_int(*pq16ang);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1829,7 +1828,6 @@ PlayerAutoLook(PLAYERp pp)
|
|||
int x,y,k,j;
|
||||
short tempsect;
|
||||
|
||||
|
||||
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))
|
||||
|
@ -1841,8 +1839,7 @@ PlayerAutoLook(PLAYERp pp)
|
|||
tempsect = pp->cursectnum;
|
||||
COVERupdatesector(x, y, &tempsect);
|
||||
|
||||
if (tempsect >= 0) // If the new point is inside a valid
|
||||
// sector...
|
||||
if (tempsect >= 0) // If the new point is inside a valid sector...
|
||||
{
|
||||
// Get the floorz as if the new (x,y) point was still in
|
||||
// your sector
|
||||
|
@ -1861,7 +1858,7 @@ PlayerAutoLook(PLAYERp pp)
|
|||
pp->q16horizoff += fix16_from_int((((j - k) * 160) >> 16));
|
||||
else
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(mulscale16((j - k), 160))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1875,7 +1872,7 @@ PlayerAutoLook(PLAYERp pp)
|
|||
pp->q16horizoff += fix16_from_int((((100 - fix16_to_int(pp->q16horizoff)) >> 3) + 1));
|
||||
else
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(((fix16_from_int(100) - pp->q16horizoff) >> 3) + fix16_one))));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1889,8 +1886,8 @@ PlayerAutoLook(PLAYERp pp)
|
|||
{
|
||||
pp->q16horizoff = fix16_ssub(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_max(pp->q16horizoff, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pp->q16horizoff < 0)
|
||||
{
|
||||
if (PedanticMode)
|
||||
|
@ -1899,8 +1896,8 @@ PlayerAutoLook(PLAYERp pp)
|
|||
{
|
||||
pp->q16horizoff = fix16_sadd(pp->q16horizoff, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float((-pp->q16horizoff >> 3) + fix16_one))));
|
||||
pp->q16horizoff = fix16_min(pp->q16horizoff, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1920,9 +1917,9 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
return;
|
||||
}
|
||||
|
||||
// Fixme: This should probably be made optional.
|
||||
if (cl_slopetilting)
|
||||
PlayerAutoLook(pp);
|
||||
// Fixme: This should probably be made optional.
|
||||
if (cl_slopetilting)
|
||||
PlayerAutoLook(pp);
|
||||
|
||||
if (q16aimvel)
|
||||
{
|
||||
|
@ -1958,10 +1955,10 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
if (TEST_SYNC_KEY(pp, SK_SNAP_DOWN))
|
||||
{
|
||||
if (PedanticMode)
|
||||
pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2));
|
||||
pp->q16horizbase -= fix16_from_int((HORIZ_SPEED/2));
|
||||
else
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval((HORIZ_SPEED/2))));
|
||||
}
|
||||
}
|
||||
|
||||
// adjust *pq16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_SNAP_UP))
|
||||
|
@ -1973,7 +1970,6 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// this is the unlocked type
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
|
||||
{
|
||||
|
@ -1984,10 +1980,10 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
if (TEST_SYNC_KEY(pp, SK_LOOK_DOWN))
|
||||
{
|
||||
if (PedanticMode)
|
||||
pp->q16horizbase -= fix16_from_int(HORIZ_SPEED);
|
||||
pp->q16horizbase -= fix16_from_int(HORIZ_SPEED);
|
||||
else
|
||||
pp->q16horizbase = fix16_ssub(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
}
|
||||
}
|
||||
|
||||
// adjust *pq16horiz positive
|
||||
if (TEST_SYNC_KEY(pp, SK_LOOK_UP))
|
||||
|
@ -1996,10 +1992,9 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
pp->q16horizbase += fix16_from_int(HORIZ_SPEED);
|
||||
else
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(HORIZ_SPEED)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!TEST(pp->Flags, PF_LOCK_HORIZ))
|
||||
{
|
||||
if (!(TEST_SYNC_KEY(pp, SK_LOOK_UP) || TEST_SYNC_KEY(pp, SK_LOOK_DOWN)))
|
||||
|
@ -2016,7 +2011,7 @@ DoPlayerHorizon(PLAYERp pp, fix16_t *pq16horiz, fix16_t q16aimvel)
|
|||
pp->q16horizbase += fix16_from_int(25 - (fix16_to_int(pp->q16horizbase) >> 2));
|
||||
else
|
||||
pp->q16horizbase = fix16_sadd(pp->q16horizbase, fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(fix16_ssub(fix16_from_int(25), fix16_sdiv(pp->q16horizbase, fix16_from_int(4)))))));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue