mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- Blood: Revert upstream unsynchronised input implementation.
This commit is contained in:
parent
20f94c5895
commit
c835d9cadc
11 changed files with 22 additions and 225 deletions
|
@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "db.h"
|
||||
#include "blood.h"
|
||||
#include "choke.h"
|
||||
#include "controls.h"
|
||||
#include "dude.h"
|
||||
#include "endgame.h"
|
||||
#include "eventq.h"
|
||||
|
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "gamecontrol.h"
|
||||
#include "common_game.h"
|
||||
#include "blood.h"
|
||||
#include "controls.h"
|
||||
#include "globals.h"
|
||||
#include "levels.h"
|
||||
#include "view.h"
|
||||
|
@ -39,16 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
static InputPacket gInput;
|
||||
bool bSilentAim = false;
|
||||
|
||||
int iTurnCount = 0;
|
||||
|
||||
int32_t mouseyaxismode = -1;
|
||||
|
||||
fixed_t gViewLook, gViewAngle;
|
||||
float gViewAngleAdjust;
|
||||
float gViewLookAdjust;
|
||||
int gViewLookRecenter;
|
||||
|
||||
static void GetInputInternal(ControlInfo* const hidInput)
|
||||
{
|
||||
|
@ -159,27 +148,6 @@ static void GetInputInternal(ControlInfo* const hidInput)
|
|||
gInput.svel = clamp(gInput.svel + input.svel, -2048, 2048);
|
||||
gInput.q16avel += input.q16avel;
|
||||
gInput.q16horz = clamp(gInput.q16horz + input.q16horz, IntToFixed(-127) >> 2, IntToFixed(127) >> 2);
|
||||
|
||||
if (gMe && gMe->pXSprite && gMe->pXSprite->health != 0 && !paused)
|
||||
{
|
||||
int upAngle = 289;
|
||||
int downAngle = -347;
|
||||
double lookStepUp = 4.0*upAngle/60.0;
|
||||
double lookStepDown = -4.0*downAngle/60.0;
|
||||
gViewAngle = (gViewAngle + input.q16avel + FloatToFixed(scaleAdjust * gViewAngleAdjust)) & 0x7ffffff;
|
||||
if (gViewLookRecenter)
|
||||
{
|
||||
if (gViewLook < 0)
|
||||
gViewLook = min(gViewLook + FloatToFixed(scaleAdjust * lookStepDown), 0);
|
||||
if (gViewLook > 0)
|
||||
gViewLook = max(gViewLook - FloatToFixed(scaleAdjust * lookStepUp), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gViewLook = clamp(gViewLook + FloatToFixed(scaleAdjust * gViewLookAdjust), IntToFixed(downAngle), IntToFixed(upAngle));
|
||||
}
|
||||
gViewLook = clamp(gViewLook + (input.q16horz << 3), IntToFixed(downAngle), IntToFixed(upAngle));
|
||||
}
|
||||
}
|
||||
|
||||
void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
||||
Copyright (C) 2019 Nuke.YKT
|
||||
|
||||
This file is part of NBlood.
|
||||
|
||||
NBlood is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "packet.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
extern bool bSilentAim;
|
||||
|
||||
extern fixed_t gViewLook, gViewAngle;
|
||||
extern float gViewAngleAdjust;
|
||||
extern float gViewLookAdjust;
|
||||
extern int gViewLookRecenter;
|
||||
|
||||
void ctrlGetInput();
|
||||
|
||||
END_BLD_NS
|
|
@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "SmackerDecoder.h"
|
||||
#include "common_game.h"
|
||||
#include "blood.h"
|
||||
#include "controls.h"
|
||||
#include "globals.h"
|
||||
#include "sound.h"
|
||||
#include "view.h"
|
||||
|
|
|
@ -645,8 +645,6 @@ void MyLoadSave::Load(void)
|
|||
Read(&gMapRev, sizeof(gMapRev));
|
||||
Read(&gSongId, sizeof(gSkyCount));
|
||||
Read(&gFogMode, sizeof(gFogMode));
|
||||
Read(&gViewAngle, sizeof(gViewAngle));
|
||||
Read(&gViewLook, sizeof(gViewLook));
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
Read(&gModernMap, sizeof(gModernMap));
|
||||
#endif
|
||||
|
@ -733,8 +731,6 @@ void MyLoadSave::Save(void)
|
|||
Write(&gMapRev, sizeof(gMapRev));
|
||||
Write(&gSongId, sizeof(gSkyCount));
|
||||
Write(&gFogMode, sizeof(gFogMode));
|
||||
Write(&gViewAngle, sizeof(gViewAngle));
|
||||
Write(&gViewLook, sizeof(gViewLook));
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
Write(&gModernMap, sizeof(gModernMap));
|
||||
#endif
|
||||
|
|
|
@ -56,9 +56,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
|
|||
|
||||
if (parm->numparms == 5)
|
||||
{
|
||||
// fix me, I'm broken.
|
||||
pPlayer->q16horiz = gView->q16horiz = IntToFixed(atoi(parm->parms[4]));
|
||||
gViewAngle = FloatToFixed(atan2(atoi(parm->parms[4]), 100) * (1024. / pi::pi()));
|
||||
}
|
||||
|
||||
viewBackupView(pPlayer->nPlayer);
|
||||
|
|
|
@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "actor.h"
|
||||
#include "blood.h"
|
||||
#include "callback.h"
|
||||
#include "controls.h"
|
||||
#include "eventq.h"
|
||||
#include "fx.h"
|
||||
#include "gib.h"
|
||||
|
@ -807,8 +806,6 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
if (pPlayer == gMe)
|
||||
{
|
||||
viewInitializePrediction();
|
||||
gViewLook = pPlayer->q16look;
|
||||
gViewAngle = pPlayer->q16ang;
|
||||
}
|
||||
if (IsUnderwaterSector(pSprite->sectnum))
|
||||
{
|
||||
|
@ -1323,13 +1320,6 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
InputPacket *pInput = &pPlayer->input;
|
||||
|
||||
if (pPlayer == gMe && numplayers == 1)
|
||||
{
|
||||
gViewAngleAdjust = 0.f;
|
||||
gViewLookRecenter = false;
|
||||
gViewLookAdjust = 0.f;
|
||||
}
|
||||
|
||||
pPlayer->isRunning = !!(pInput->actions & SB_RUN);
|
||||
if ((pInput->actions & SB_BUTTON_MASK) || pInput->fvel || pInput->svel || pInput->q16avel)
|
||||
pPlayer->restTime = 0;
|
||||
|
@ -1447,11 +1437,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
speed = 128;
|
||||
pPlayer->spin = min(pPlayer->spin+speed, 0);
|
||||
pPlayer->q16ang += IntToFixed(speed);
|
||||
if (pPlayer == gMe && numplayers == 1)
|
||||
gViewAngleAdjust += float(speed);
|
||||
}
|
||||
if (pPlayer == gMe && numplayers == 1)
|
||||
gViewAngleAdjust += float(pSprite->ang - pPlayer->angold);
|
||||
pPlayer->q16ang = (pPlayer->q16ang+IntToFixed(pSprite->ang-pPlayer->angold))&0x7ffffff;
|
||||
pPlayer->angold = pSprite->ang = FixedToInt(pPlayer->q16ang);
|
||||
if (!(pInput->actions & SB_JUMP))
|
||||
|
@ -1559,69 +1545,29 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
}
|
||||
pInput->actions &= ~SB_OPEN;
|
||||
}
|
||||
if (bVanilla)
|
||||
if ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
{
|
||||
if ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
{
|
||||
if (pPlayer->q16look < 0)
|
||||
pPlayer->q16look = min(pPlayer->q16look+IntToFixed(4), 0);
|
||||
if (pPlayer->q16look > 0)
|
||||
pPlayer->q16look = max(pPlayer->q16look-IntToFixed(4), 0);
|
||||
if (!pPlayer->q16look)
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP|SB_AIM_UP))
|
||||
pPlayer->q16look = min(pPlayer->q16look+IntToFixed(4), IntToFixed(60));
|
||||
if (pInput->actions & (SB_LOOK_DOWN|SB_AIM_DOWN))
|
||||
pPlayer->q16look = max(pPlayer->q16look-IntToFixed(4), IntToFixed(-60));
|
||||
}
|
||||
pPlayer->q16look = clamp(pPlayer->q16look+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
||||
if (pPlayer->q16look < 0)
|
||||
pPlayer->q16look = min(pPlayer->q16look+IntToFixed(4), 0);
|
||||
if (pPlayer->q16look > 0)
|
||||
pPlayer->q16horiz = IntToFixed(mulscale30(120, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
||||
else if (pPlayer->q16look < 0)
|
||||
pPlayer->q16horiz = IntToFixed(mulscale30(180, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
||||
else
|
||||
pPlayer->q16horiz = 0;
|
||||
pPlayer->q16look = max(pPlayer->q16look-IntToFixed(4), 0);
|
||||
if (!pPlayer->q16look)
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
int upAngle = 289;
|
||||
int downAngle = -347;
|
||||
double lookStepUp = 4.0*upAngle/60.0;
|
||||
double lookStepDown = -4.0*downAngle/60.0;
|
||||
if ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
{
|
||||
if (pPlayer->q16look < 0)
|
||||
pPlayer->q16look = min(pPlayer->q16look+FloatToFixed(lookStepDown), 0);
|
||||
if (pPlayer->q16look > 0)
|
||||
pPlayer->q16look = max(pPlayer->q16look-FloatToFixed(lookStepUp), 0);
|
||||
if (!pPlayer->q16look)
|
||||
pInput->actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP | SB_AIM_UP))
|
||||
pPlayer->q16look = min(pPlayer->q16look+FloatToFixed(lookStepUp), IntToFixed(upAngle));
|
||||
if (pInput->actions & (SB_LOOK_DOWN | SB_AIM_DOWN))
|
||||
pPlayer->q16look = max(pPlayer->q16look-FloatToFixed(lookStepDown), IntToFixed(downAngle));
|
||||
}
|
||||
if (pPlayer == gMe && numplayers == 1)
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP | SB_AIM_UP))
|
||||
{
|
||||
gViewLookAdjust += float(lookStepUp);
|
||||
}
|
||||
if (pInput->actions & (SB_LOOK_DOWN | SB_AIM_DOWN))
|
||||
{
|
||||
gViewLookAdjust -= float(lookStepDown);
|
||||
}
|
||||
gViewLookRecenter = ((pInput->actions & SB_CENTERVIEW) && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)));
|
||||
}
|
||||
pPlayer->q16look = clamp(pPlayer->q16look+(pInput->q16horz<<3), IntToFixed(downAngle), IntToFixed(upAngle));
|
||||
pPlayer->q16horiz = FloatToFixed(100.f*tanf(FixedToFloat(pPlayer->q16look)*fPI/1024.f));
|
||||
if (pInput->actions & (SB_LOOK_UP|SB_AIM_UP))
|
||||
pPlayer->q16look = min(pPlayer->q16look+IntToFixed(4), IntToFixed(60));
|
||||
if (pInput->actions & (SB_LOOK_DOWN|SB_AIM_DOWN))
|
||||
pPlayer->q16look = max(pPlayer->q16look-IntToFixed(4), IntToFixed(-60));
|
||||
}
|
||||
pPlayer->q16look = clamp(pPlayer->q16look+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
||||
if (pPlayer->q16look > 0)
|
||||
pPlayer->q16horiz = IntToFixed(mulscale30(120, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
||||
else if (pPlayer->q16look < 0)
|
||||
pPlayer->q16horiz = IntToFixed(mulscale30(180, Sin(FixedToInt(pPlayer->q16look)<<3)));
|
||||
else
|
||||
pPlayer->q16horiz = 0;
|
||||
int nSector = pSprite->sectnum;
|
||||
int florhit = gSpriteHit[pSprite->extra].florhit & 0xc000;
|
||||
char va;
|
||||
|
|
|
@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "common_game.h"
|
||||
#include "compat.h"
|
||||
#include "globals.h"
|
||||
#include "controls.h"
|
||||
#include "db.h"
|
||||
#include "dude.h"
|
||||
#include "levels.h"
|
||||
|
|
|
@ -93,11 +93,6 @@ void viewInitializePrediction(void)
|
|||
predict.at40 = gMe->zWeapon;
|
||||
predict.at44 = gMe->zWeaponVel;
|
||||
predictOld = predict;
|
||||
if (numplayers != 1)
|
||||
{
|
||||
gViewAngle = predict.at30;
|
||||
gViewLook = predict.at20;
|
||||
}
|
||||
}
|
||||
|
||||
void viewUpdatePrediction(InputPacket *pInput)
|
||||
|
@ -110,11 +105,6 @@ void viewUpdatePrediction(InputPacket *pInput)
|
|||
gMe->pSprite->cstat = bakCstat;
|
||||
//predictFifo[gPredictTail&255] = predict;
|
||||
//gPredictTail++;
|
||||
if (numplayers != 1)
|
||||
{
|
||||
gViewAngle = predict.at30;
|
||||
gViewLook = predict.at20;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_158B4(PLAYER *pPlayer)
|
||||
|
@ -127,13 +117,6 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
{
|
||||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.at48];
|
||||
|
||||
if (numplayers > 1 && gPrediction)
|
||||
{
|
||||
gViewAngleAdjust = 0.f;
|
||||
gViewLookRecenter = false;
|
||||
gViewLookAdjust = 0.f;
|
||||
}
|
||||
|
||||
predict.at70 = !!(gMe->input.actions & SB_RUN);
|
||||
predict.at71 = !!(gMe->input.actions & SB_JUMP);
|
||||
if (predict.at48 == 1)
|
||||
|
@ -202,8 +185,6 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
|
||||
predict.at4c = min(predict.at4c+speed, 0);
|
||||
predict.at30 += IntToFixed(speed);
|
||||
if (numplayers > 1 && gPrediction)
|
||||
gViewAngleAdjust += float(speed);
|
||||
}
|
||||
|
||||
if (!predict.at71)
|
||||
|
@ -231,8 +212,8 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.at48 = 2;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
if (predict.at6e && !pInput->syncFlags.lookUp && !pInput->syncFlags.lookDown)
|
||||
|
||||
if (predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
{
|
||||
if (predict.at20 < 0)
|
||||
predict.at20 = min(predict.at20+IntToFixed(4), 0);
|
||||
|
@ -243,12 +224,12 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (pInput->syncFlags.lookUp)
|
||||
if (pInput->actions & SB_LOOK_UP)
|
||||
predict.at20 = min(predict.at20+IntToFixed(4), IntToFixed(60));
|
||||
if (pInput->syncFlags.lookDown)
|
||||
if (pInput->actions & SB_LOOK_DOWN)
|
||||
predict.at20 = max(predict.at20-IntToFixed(4), IntToFixed(-60));
|
||||
}
|
||||
predict.at20 = clamp(predict.at20+pInput->q16mlook, IntToFixed(-60), IntToFixed(60));
|
||||
predict.at20 = clamp(predict.at20+pInput->q16horz, IntToFixed(-60), IntToFixed(60));
|
||||
|
||||
if (predict.at20 > 0)
|
||||
predict.at24 = mulscale30(IntToFixed(120), Sin(FixedToInt(predict.at20<<3)));
|
||||
|
@ -256,41 +237,6 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
predict.at24 = mulscale30(IntToFixed(180), Sin(FixedToInt(predict.at20<<3)));
|
||||
else
|
||||
predict.at24 = 0;
|
||||
#endif
|
||||
int upAngle = 289;
|
||||
int downAngle = -347;
|
||||
double lookStepUp = 4.0*upAngle/60.0;
|
||||
double lookStepDown = -4.0*downAngle/60.0;
|
||||
if (predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN)))
|
||||
{
|
||||
if (predict.at20 < 0)
|
||||
predict.at20 = min(predict.at20+FloatToFixed(lookStepDown), 0);
|
||||
if (predict.at20 > 0)
|
||||
predict.at20 = max(predict.at20-FloatToFixed(lookStepUp), 0);
|
||||
if (predict.at20 == 0)
|
||||
predict.at6e = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP | SB_AIM_UP))
|
||||
predict.at20 = min(predict.at20+FloatToFixed(lookStepUp), IntToFixed(upAngle));
|
||||
if (pInput->actions & (SB_LOOK_DOWN | SB_AIM_DOWN))
|
||||
predict.at20 = max(predict.at20-FloatToFixed(lookStepDown), IntToFixed(downAngle));
|
||||
}
|
||||
if (numplayers > 1 && gPrediction)
|
||||
{
|
||||
if (pInput->actions & (SB_LOOK_UP | SB_AIM_UP))
|
||||
{
|
||||
gViewLookAdjust += float(lookStepUp);
|
||||
}
|
||||
if (pInput->actions & (SB_LOOK_DOWN | SB_AIM_DOWN))
|
||||
{
|
||||
gViewLookAdjust -= float(lookStepDown);
|
||||
}
|
||||
gViewLookRecenter = predict.at6e && !(pInput->actions & (SB_LOOK_UP | SB_LOOK_DOWN));
|
||||
}
|
||||
predict.at20 = clamp(predict.at20+(pInput->q16horz<<3), IntToFixed(downAngle), IntToFixed(upAngle));
|
||||
predict.at24 = FloatToFixed(100.f*tanf(FixedToFloat(predict.at20)*fPI/1024.f));
|
||||
|
||||
int nSector = predict.at68;
|
||||
int florhit = predict.at75.florhit & 0xc000;
|
||||
|
@ -706,12 +652,6 @@ void fakeActProcessSprites(void)
|
|||
void viewCorrectPrediction(void)
|
||||
{
|
||||
#if 0
|
||||
if (numplayers == 1)
|
||||
{
|
||||
gViewLook = gMe->q16look;
|
||||
gViewAngle = gMe->q16ang;
|
||||
return;
|
||||
}
|
||||
spritetype *pSprite = gMe->pSprite;
|
||||
VIEW *pView = &predictFifo[(gNetFifoTail-1)&255];
|
||||
if (gMe->q16ang != pView->at30 || pView->at24 != gMe->q16horiz || pView->at50 != pSprite->x || pView->at54 != pSprite->y || pView->at58 != pSprite->z)
|
||||
|
|
|
@ -681,15 +681,6 @@ void viewDrawScreen(bool sceneonly)
|
|||
v48 = finterpolate(pView->at18, v48, gInterpolate);
|
||||
}
|
||||
}
|
||||
if (!cl_syncinput && gView == gMe && (numplayers <= 1 || gPrediction) && gView->pXSprite->health != 0 && !VanillaMode())
|
||||
{
|
||||
int upAngle = 289;
|
||||
int downAngle = -347;
|
||||
fixed_t q16look;
|
||||
cA = gViewAngle;
|
||||
q16look = gViewLook;
|
||||
q16horiz = FloatToFixed(100.f * tanf(FixedToFloat(q16look) * fPI / 1024.f));
|
||||
}
|
||||
viewUpdateShake();
|
||||
q16horiz += IntToFixed(shakeHoriz);
|
||||
cA += IntToFixed(shakeAngle);
|
||||
|
|
|
@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "build.h"
|
||||
#include "palette.h"
|
||||
#include "common_game.h"
|
||||
#include "controls.h"
|
||||
#include "messages.h"
|
||||
#include "player.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue