mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-03-03 15:31:11 +00:00
- fixed P_GetInput to work with the changed backend.
This commit is contained in:
parent
8a1206edbc
commit
53f36e5c40
3 changed files with 23 additions and 13 deletions
|
@ -323,6 +323,7 @@ typedef struct
|
|||
char playerreadyflag, playerquitflag, connected;
|
||||
char user_name[32];
|
||||
char syncval[SYNCFIFOSIZ][MAXSYNCBYTES];
|
||||
double lastInputTicks;
|
||||
|
||||
} playerdata_t;
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -199,7 +199,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
pPlayer->visibility = ud.const_visibility;
|
||||
|
||||
int const playerVis = pPlayer->visibility;
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis * (numplayers > 1 ? 1.f : r_ambientlightrecip));
|
||||
g_visibility = (playerVis <= 0) ? 0 : (int32_t)(playerVis);
|
||||
|
||||
CAMERA(sect) = pPlayer->cursectnum;
|
||||
|
||||
|
|
|
@ -108,12 +108,27 @@ static int P_CheckLockedMovement(int const playerNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static double elapsedInputTicks;
|
||||
|
||||
static double scaleAdjustmentToInterval(double x)
|
||||
{
|
||||
return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks);
|
||||
}
|
||||
|
||||
void P_GetInput(int const playerNum)
|
||||
{
|
||||
auto &thisPlayer = g_player[playerNum];
|
||||
auto const pPlayer = thisPlayer.ps;
|
||||
ControlInfo info;
|
||||
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
|
@ -153,23 +168,19 @@ void P_GetInput(int const playerNum)
|
|||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
{
|
||||
static int strafeyaw;
|
||||
|
||||
input.svel = -(info.mousex + strafeyaw) >> 3;
|
||||
strafeyaw = (info.mousex + strafeyaw) % 8;
|
||||
|
||||
input.svel -= info.dyaw * keyMove / analogExtent;
|
||||
input.svel -= info.mousex * 4.f;
|
||||
input.svel -= scaleAdjustmentToInterval(info.dyaw * keyMove);
|
||||
}
|
||||
else
|
||||
{
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_sdiv(fix16_from_int(info.mousex), F16(32)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_int(info.dyaw / analogExtent * (analogTurnAmount << 1)));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_float(info.mousex));
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(info.dyaw)));
|
||||
}
|
||||
|
||||
if (mouseaim)
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_sdiv(fix16_from_int(info.mousey), F16(64)));
|
||||
input.q16horz = fix16_sadd(input.q16horz, fix16_from_float(info.mousey));
|
||||
else
|
||||
input.fvel = -(info.mousey >> 3);
|
||||
input.fvel -= info.mousey * 8.f;
|
||||
|
||||
if (!in_mouseflip) input.q16horz = -input.q16horz;
|
||||
|
||||
|
@ -178,8 +189,6 @@ void P_GetInput(int const playerNum)
|
|||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
static double lastInputTicks;
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - lastInputTicks;
|
||||
|
||||
lastInputTicks = currentHiTicks;
|
||||
|
||||
|
|
Loading…
Reference in a new issue