mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- handle the run key.
This commit is contained in:
parent
b9e0f493b2
commit
fe7f3a2f9e
13 changed files with 38 additions and 62 deletions
|
@ -180,12 +180,9 @@ void ctrlGetInput(void)
|
|||
gInput.syncFlags.lookDown |= buttonMap.ButtonDown(gamefunc_Aim_Down);
|
||||
}
|
||||
|
||||
int const run = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const run2 = false; // What??? buttonMap.ButtonDown(gamefunc_Run);
|
||||
int const run = !!(gInput.actions & SB_RUN);
|
||||
int const keyMove = (1 + run) << 10;
|
||||
|
||||
gInput.syncFlags.run |= run;
|
||||
|
||||
if (gInput.fvel < keyMove && gInput.fvel > -keyMove)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward))
|
||||
|
@ -244,7 +241,7 @@ void ctrlGetInput(void)
|
|||
if (turnRight)
|
||||
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2)));
|
||||
|
||||
if ((run2 || run) && turnHeldTime > 24)
|
||||
if (run && turnHeldTime > 24)
|
||||
input.q16avel <<= 1;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
|
|
|
@ -1332,7 +1332,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
gViewLookAdjust = 0.f;
|
||||
}
|
||||
|
||||
pPlayer->isRunning = pInput->syncFlags.run;
|
||||
pPlayer->isRunning = !!(pInput->actions & SB_RUN);
|
||||
if ((pInput->syncFlags.value & flag_buttonmask_norun) || (pInput->actions & SB_BUTTON_MASK) || pInput->fvel || pInput->svel || pInput->q16avel)
|
||||
pPlayer->restTime = 0;
|
||||
else if (pPlayer->restTime >= 0)
|
||||
|
|
|
@ -360,6 +360,8 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo *info)
|
|||
if (g_gameType & GAMEFLAG_BLOOD) buttonMap.ClearButton(gamefunc_Open);
|
||||
input.actions |= SB_OPEN;
|
||||
}
|
||||
if (G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run)))
|
||||
input.actions |= SB_RUN;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ enum EDukeSyncBits_ : uint32_t
|
|||
{
|
||||
SKB_AIM_UP = 1 << 3,
|
||||
SKB_AIM_DOWN = 1 << 4,
|
||||
SKB_RUN = 1 << 5,
|
||||
SKB_LOOK_LEFT = 1 << 6,
|
||||
SKB_LOOK_RIGHT = 1 << 7,
|
||||
SKB_LOOK_UP = 1 << 13,
|
||||
|
@ -95,7 +94,7 @@ union SYNCFLAGS
|
|||
uint32_t value;
|
||||
struct
|
||||
{
|
||||
unsigned int run : 1;
|
||||
unsigned int _run : 1;
|
||||
unsigned int _jump : 1;
|
||||
unsigned int _crouch : 1;
|
||||
unsigned int _shoot : 1;
|
||||
|
@ -124,7 +123,6 @@ union SYNCFLAGS
|
|||
#define SK_CRAWL_LOCK 14
|
||||
#define SK_FLY 15
|
||||
|
||||
#define SK_RUN 16
|
||||
#define SK_AIM_UP 21
|
||||
#define SK_AIM_DOWN 22
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void PlayerInterruptKeys(bool after)
|
|||
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int const playerRunning = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int const playerRunning = !!(localInput.actions & SB_RUN);
|
||||
int const turnAmount = playerRunning ? 12 : 8;
|
||||
int const keyMove = playerRunning ? 12 : 6;
|
||||
|
||||
|
|
|
@ -112,10 +112,10 @@ void playerJump(int snum, int fz, int cz);
|
|||
void applylook(int snum, double factor, fixed_t adjustment);
|
||||
void checklook(int snum, int sb_snum);
|
||||
void playerCenterView(int snum);
|
||||
void playerLookUp(int snum, EDukeSyncBits sb_snum);
|
||||
void playerLookDown(int snum, EDukeSyncBits sb_snum);
|
||||
void playerAimUp(int snum, EDukeSyncBits sb_snum);
|
||||
void playerAimDown(int snum, EDukeSyncBits sb_snum);
|
||||
void playerLookUp(int snum, ESyncBits sb_snum);
|
||||
void playerLookDown(int snum, ESyncBits sb_snum);
|
||||
void playerAimUp(int snum, ESyncBits sb_snum);
|
||||
void playerAimDown(int snum, ESyncBits sb_snum);
|
||||
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, int horiz);
|
||||
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
|
||||
int hits(int i);
|
||||
|
|
|
@ -1171,15 +1171,15 @@ int ParseState::parse(void)
|
|||
j = 1;
|
||||
else if( (l& pstanding) && s >= 0 && s < 8)
|
||||
j = 1;
|
||||
else if( (l& pwalking) && s >= 8 && !(PlayerInput(g_p, SKB_RUN)) )
|
||||
else if( (l& pwalking) && s >= 8 && !(PlayerInput(g_p, SB_RUN)) )
|
||||
j = 1;
|
||||
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SKB_RUN) )
|
||||
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SB_RUN) )
|
||||
j = 1;
|
||||
else if( (l& phigher) && ps[g_p].posz < (g_sp->z-(48<<8)) )
|
||||
j = 1;
|
||||
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SKB_RUN)) )
|
||||
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SB_RUN)) )
|
||||
j = 1;
|
||||
else if( (l& prunningback) && s <= -8 && (PlayerInput(g_p, SKB_RUN)) )
|
||||
else if( (l& prunningback) && s <= -8 && (PlayerInput(g_p, SB_RUN)) )
|
||||
j = 1;
|
||||
else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
|
||||
j = 1;
|
||||
|
|
|
@ -616,7 +616,6 @@ static void processInputBits(player_struct *p, ControlInfo &info)
|
|||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Aim_Up) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && info.dz > 0)) loc.sbits |= SKB_AIM_UP;
|
||||
if ((buttonMap.ButtonDown(gamefunc_Aim_Down) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && info.dz < 0))) loc.sbits |= SKB_AIM_DOWN;
|
||||
if (G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run))) loc.sbits |= SKB_RUN;
|
||||
if (buttonMap.ButtonDown(gamefunc_Look_Left)) loc.sbits |= SKB_LOOK_LEFT;
|
||||
if (buttonMap.ButtonDown(gamefunc_Look_Right)) loc.sbits |= SKB_LOOK_RIGHT;
|
||||
if (buttonMap.ButtonDown(gamefunc_Look_Up)) loc.sbits |= SKB_LOOK_UP;
|
||||
|
@ -634,7 +633,7 @@ static void processInputBits(player_struct *p, ControlInfo &info)
|
|||
if (onVehicle)
|
||||
{
|
||||
// mask out all actions not compatible with vehicles.
|
||||
loc.actions &= ~(SB_WEAPONMASK_BITS | SB_TURNAROUND | SB_CENTERVIEW | SB_HOLSTER | SB_JUMP | SB_CROUCH);
|
||||
loc.actions &= ~(SB_WEAPONMASK_BITS | SB_TURNAROUND | SB_CENTERVIEW | SB_HOLSTER | SB_JUMP | SB_CROUCH | SB_RUN);
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming))
|
||||
|
@ -688,7 +687,7 @@ static void processMovement(player_struct *p, InputPacket &input, ControlInfo &i
|
|||
bool mouseaim = in_mousemode || buttonMap.ButtonDown(gamefunc_Mouse_Aiming);
|
||||
|
||||
// JBF: Run key behaviour is selectable
|
||||
int running = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int running = !!(loc.actions & SB_RUN);
|
||||
int turnamount = NORMALTURN << running;
|
||||
int keymove = NORMALKEYMOVE << running;
|
||||
|
||||
|
@ -982,7 +981,7 @@ static void processVehicleInput(player_struct *p, ControlInfo& info, InputPacket
|
|||
loc.actions |= SB_JUMP;
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
loc.sbits |= SKB_AIM_UP;
|
||||
if (buttonMap.ButtonDown(gamefunc_Run))
|
||||
if (loc.buttons & SB_RUN)
|
||||
loc.actions |= SB_CROUCH;
|
||||
}
|
||||
|
||||
|
@ -1126,9 +1125,9 @@ void GetInput()
|
|||
}
|
||||
else
|
||||
{
|
||||
processInputBits(p, info);
|
||||
processMovement(p, input, info, scaleAdjust);
|
||||
checkCrouchToggle(p);
|
||||
processInputBits(p, info);
|
||||
FinalizeInput(myconnectindex, input, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1050,7 +1050,7 @@ void playerCenterView(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
void playerLookUp(int snum, EDukeSyncBits sb_snum)
|
||||
void playerLookUp(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
|
@ -1058,11 +1058,11 @@ void playerLookUp(int snum, EDukeSyncBits sb_snum)
|
|||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
p->pitchAdjust += (sb_snum & SKB_RUN) ? 12 : 24;
|
||||
p->pitchAdjust += (actions & SB_RUN) ? 12 : 24;
|
||||
}
|
||||
}
|
||||
|
||||
void playerLookDown(int snum, EDukeSyncBits sb_snum)
|
||||
void playerLookDown(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
|
@ -1070,29 +1070,29 @@ void playerLookDown(int snum, EDukeSyncBits sb_snum)
|
|||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
p->pitchAdjust -= (sb_snum & SKB_RUN) ? 12 : 24;
|
||||
p->pitchAdjust -= (actions & SB_RUN) ? 12 : 24;
|
||||
}
|
||||
}
|
||||
|
||||
void playerAimUp(int snum, EDukeSyncBits sb_snum)
|
||||
void playerAimUp(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMUP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->pitchAdjust += (sb_snum & SKB_RUN) ? 6 : 12;
|
||||
p->pitchAdjust += (actions & SB_RUN) ? 6 : 12;
|
||||
}
|
||||
}
|
||||
|
||||
void playerAimDown(int snum, EDukeSyncBits sb_snum)
|
||||
void playerAimDown(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMDOWN, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
p->pitchAdjust -= (sb_snum & SKB_RUN) ? 6 : 12;
|
||||
p->pitchAdjust -= (actions & SB_RUN) ? 6 : 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3009,19 +3009,19 @@ HORIZONLY:
|
|||
}
|
||||
else if (sb_snum & SKB_LOOK_UP)
|
||||
{
|
||||
playerLookUp(snum, sb_snum);
|
||||
playerLookUp(snum, actions);
|
||||
}
|
||||
else if (sb_snum & SKB_LOOK_DOWN)
|
||||
{
|
||||
playerLookDown(snum, sb_snum);
|
||||
playerLookDown(snum, actions);
|
||||
}
|
||||
else if (sb_snum & SKB_AIM_UP)
|
||||
{
|
||||
playerAimUp(snum, sb_snum);
|
||||
playerAimUp(snum, actions);
|
||||
}
|
||||
else if (sb_snum & SKB_AIM_DOWN)
|
||||
{ // aim_down
|
||||
playerAimDown(snum, sb_snum);
|
||||
playerAimDown(snum, actions);
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
|
|
|
@ -4035,19 +4035,19 @@ HORIZONLY:
|
|||
}
|
||||
else if (sb_snum & SKB_LOOK_UP)
|
||||
{
|
||||
playerLookUp(snum, sb_snum);
|
||||
playerLookUp(snum, actions);
|
||||
}
|
||||
else if (sb_snum & SKB_LOOK_DOWN)
|
||||
{
|
||||
playerLookDown(snum, sb_snum);
|
||||
playerLookDown(snum, actions);
|
||||
}
|
||||
else if ((sb_snum & SKB_AIM_UP) && !p->OnMotorcycle)
|
||||
{
|
||||
playerAimUp(snum, sb_snum);
|
||||
playerAimUp(snum, actions);
|
||||
}
|
||||
else if ((sb_snum & SKB_AIM_DOWN) && !p->OnMotorcycle)
|
||||
{
|
||||
playerAimDown(snum, sb_snum);
|
||||
playerAimDown(snum, actions);
|
||||
}
|
||||
if (p->recoil && p->kickback_pic == 0)
|
||||
{
|
||||
|
|
|
@ -149,7 +149,6 @@ getinput(InputPacket *loc, SWBOOL tied)
|
|||
|
||||
SET_LOC_KEY(loc->bits, SK_SPACE_BAR, buttonMap.ButtonDown(gamefunc_Open));
|
||||
|
||||
int const running = G_CheckAutorun(buttonMap.ButtonDown(gamefunc_Run));
|
||||
int32_t turnamount;
|
||||
int32_t keymove;
|
||||
|
||||
|
@ -165,7 +164,7 @@ getinput(InputPacket *loc, SWBOOL tied)
|
|||
ApplyGlobalInput(*loc, &info);
|
||||
|
||||
|
||||
if (running)
|
||||
if (loc->actions & SB_RUN)
|
||||
{
|
||||
if (pp->sop_control)
|
||||
turnamount = RUNTURN * 3;
|
||||
|
|
|
@ -2073,7 +2073,7 @@ DoPlayerBob(PLAYERp pp)
|
|||
dist = 0;
|
||||
|
||||
// if running make a longer stride
|
||||
if (G_CheckAutorun(TEST_SYNC_KEY(pp, SK_RUN)))
|
||||
if (pp->input.actions & SB_RUN)
|
||||
{
|
||||
//amt = 10;
|
||||
amt = 12;
|
||||
|
@ -2464,31 +2464,12 @@ MoveScrollMode2D(PLAYERp pp)
|
|||
if (M_Active())
|
||||
return;
|
||||
|
||||
#if 0
|
||||
// Recenter view if told
|
||||
if (buttonMap.ButtonDown(gamefunc_Center_View))
|
||||
{
|
||||
Follow_posx = pp->posx;
|
||||
Follow_posy = pp->posy;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
mfsvel -= scrl_input.dyaw / 4;
|
||||
mfsvel -= scrl_input.dx / 4;
|
||||
mfvel = -scrl_input.dz /4;
|
||||
|
||||
#if 0
|
||||
int const running = !!BUTTON(gamefunc_Run) ^ !!TEST(pp->Flags, PF_LOCK_RUN);
|
||||
if (running)
|
||||
{
|
||||
keymove = NORMALKEYMOVE << 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
keymove = NORMALKEYMOVE;
|
||||
}
|
||||
keymove = NORMALKEYMOVE;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Turn_Left))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue