mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 01:01:43 +00:00
Move some sidemove/forwardmove checks to playsim code rather than have them happen in ticcmd generation.
pGetPlayerControlDirection has to die since it was the only other usage of sidemove, and wasn't even relevant anymore anyways.
This commit is contained in:
parent
1951548245
commit
99e50250cf
5 changed files with 26 additions and 61 deletions
31
src/g_game.c
31
src/g_game.c
|
@ -1347,11 +1347,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
{
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed] * realtics));
|
||||
cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed] * realtics));
|
||||
side += sidemove[1];
|
||||
}
|
||||
else if (turnleft && !(turnright))
|
||||
{
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed] * realtics));
|
||||
cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed] * realtics));
|
||||
side -= sidemove[1];
|
||||
}
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
|
@ -1359,6 +1361,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10) * realtics)); // ANALOG!
|
||||
cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10) * realtics));
|
||||
side += ((axis * sidemove[0]) >> 10);
|
||||
}
|
||||
|
||||
// Specator mouse turning
|
||||
|
@ -1368,20 +1371,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8) * realtics));
|
||||
}
|
||||
|
||||
// Speed bump strafing
|
||||
if (!demoplayback && ((player->pflags & PF_FORCESTRAFE) || (player->kartstuff[k_pogospring])))
|
||||
{
|
||||
if (turnright)
|
||||
side += sidemove[1];
|
||||
if (turnleft)
|
||||
side -= sidemove[1];
|
||||
if (analogjoystickmove && axis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
side += ((axis * sidemove[0]) >> 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||
{
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
|
@ -1514,7 +1503,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
mousex = mousey = mlooky = 0;
|
||||
|
||||
if (forward > MAXPLMOVE)
|
||||
// moved to P_3DMovement
|
||||
/*if (forward > MAXPLMOVE)
|
||||
forward = MAXPLMOVE;
|
||||
else if (forward < -MAXPLMOVE)
|
||||
forward = -MAXPLMOVE;
|
||||
|
@ -1522,16 +1512,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
if (side > MAXPLMOVE)
|
||||
side = MAXPLMOVE;
|
||||
else if (side < -MAXPLMOVE)
|
||||
side = -MAXPLMOVE;
|
||||
|
||||
// No additional acceleration when moving forward/backward and strafing simultaneously.
|
||||
// do this AFTER we cap to MAXPLMOVE so people can't find ways to cheese around this.
|
||||
// SRB2Kart: We don't need this; we WANT bounce strafing to plain stack on top of normal movement.
|
||||
/*if (!bouncestrafe && forward && side)
|
||||
{
|
||||
forward = FixedMul(forward, 3*FRACUNIT/4);
|
||||
side = FixedMul(side, 3*FRACUNIT/4);
|
||||
}*/
|
||||
side = -MAXPLMOVE;*/
|
||||
|
||||
if (forward || side)
|
||||
{
|
||||
|
|
|
@ -678,16 +678,6 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pGetPlayerControlDirection(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
//HUDSAFE
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
lua_pushinteger(L, P_GetPlayerControlDirection(player));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pAddPlayerScore(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2540,7 +2530,6 @@ static luaL_Reg lib[] = {
|
|||
// p_user
|
||||
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
|
||||
{"P_GetPlayerSpinHeight",lib_pGetPlayerSpinHeight},
|
||||
{"P_GetPlayerControlDirection",lib_pGetPlayerControlDirection},
|
||||
{"P_AddPlayerScore",lib_pAddPlayerScore},
|
||||
{"P_PlayerInPain",lib_pPlayerInPain},
|
||||
{"P_DoPlayerPain",lib_pDoPlayerPain},
|
||||
|
|
|
@ -1130,12 +1130,12 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
P_TeleportMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
|
||||
player->mo->momx = player->mo->momy = 0;
|
||||
}
|
||||
if (cmd->sidemove != 0)
|
||||
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
|
||||
{
|
||||
P_Thrust(player->mo, player->mo->angle-ANGLE_90, (cmd->sidemove*FRACUNIT/MAXPLMOVE)*cv_speed.value);
|
||||
P_TeleportMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, player->mo->z);
|
||||
player->mo->momx = player->mo->momy = 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (player->mo->z > player->mo->ceilingz - player->mo->height)
|
||||
player->mo->z = player->mo->ceilingz - player->mo->height;
|
||||
|
|
|
@ -131,7 +131,6 @@ extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
|
|||
|
||||
fixed_t P_GetPlayerHeight(player_t *player);
|
||||
fixed_t P_GetPlayerSpinHeight(player_t *player);
|
||||
INT32 P_GetPlayerControlDirection(player_t *player);
|
||||
void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
|
||||
|
|
40
src/p_user.c
40
src/p_user.c
|
@ -4509,7 +4509,7 @@ boolean P_AnalogMove(player_t *player)
|
|||
// 1 = pressing in the direction of movement
|
||||
// 2 = pressing in the opposite direction of movement
|
||||
//
|
||||
INT32 P_GetPlayerControlDirection(player_t *player)
|
||||
/*INT32 P_GetPlayerControlDirection(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
angle_t controllerdirection, controlplayerdirection;
|
||||
|
@ -4584,7 +4584,7 @@ INT32 P_GetPlayerControlDirection(player_t *player)
|
|||
}
|
||||
|
||||
// Control scheme for 2d levels.
|
||||
/*static void P_2dMovement(player_t *player)
|
||||
static void P_2dMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
INT32 topspeed, acceleration, thrustfactor;
|
||||
|
@ -4794,24 +4794,20 @@ static void P_3dMovement(player_t *player)
|
|||
cmd->forwardmove = cmd->sidemove = 0;
|
||||
if (player->kartstuff[k_sneakertimer])
|
||||
cmd->forwardmove = 50;
|
||||
if (player->pflags & PF_GLIDING)
|
||||
{
|
||||
if (!player->skidtime)
|
||||
player->pflags &= ~PF_GLIDING;
|
||||
else if (player->exiting || mapreset)
|
||||
{
|
||||
player->pflags &= ~PF_GLIDING;
|
||||
P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
|
||||
player->skidtime = 0;
|
||||
}
|
||||
}
|
||||
if (player->pflags & PF_SPINNING && !(player->exiting || mapreset))
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd->forwardmove > MAXPLMOVE)
|
||||
cmd->forwardmove = MAXPLMOVE;
|
||||
else if (cmd->forwardmove < -MAXPLMOVE)
|
||||
cmd->forwardmove = -MAXPLMOVE;
|
||||
|
||||
if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring])
|
||||
cmd->sidemove = 0;
|
||||
else if (cmd->sidemove > MAXPLMOVE)
|
||||
cmd->sidemove = MAXPLMOVE;
|
||||
else if (cmd->sidemove < -MAXPLMOVE)
|
||||
cmd->sidemove = -MAXPLMOVE;
|
||||
|
||||
if (analogmove)
|
||||
{
|
||||
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
@ -4819,9 +4815,7 @@ static void P_3dMovement(player_t *player)
|
|||
else
|
||||
{
|
||||
if (player->kartstuff[k_drift] != 0)
|
||||
{
|
||||
movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
||||
}
|
||||
else
|
||||
movepushangle = player->mo->angle;
|
||||
}
|
||||
|
@ -5039,10 +5033,10 @@ static void P_SpectatorMovement(player_t *player)
|
|||
// Quake-style flying spectators :D
|
||||
player->mo->momz += FixedMul(cmd->forwardmove*(mapheaderinfo[gamemap-1]->mobj_scale), AIMINGTOSLOPE(player->aiming));
|
||||
}
|
||||
if (cmd->sidemove != 0)
|
||||
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
|
||||
{
|
||||
P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*(mapheaderinfo[gamemap-1]->mobj_scale));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -7032,6 +7026,7 @@ static void P_MovePlayer(player_t *player)
|
|||
//ANALOG CONTROL//
|
||||
//////////////////
|
||||
|
||||
#if 0
|
||||
// This really looks like it should be moved to P_3dMovement. -Red
|
||||
if (P_AnalogMove(player)
|
||||
&& (cmd->forwardmove != 0 || cmd->sidemove != 0) && !player->climbing && !twodlevel && !(player->mo->flags2 & MF2_TWOD))
|
||||
|
@ -7088,6 +7083,7 @@ static void P_MovePlayer(player_t *player)
|
|||
else if (player == &players[fourthdisplayplayer])
|
||||
localangle4 = player->mo->angle;
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////
|
||||
//BOMB SHIELD ACTIVATION,//
|
||||
|
|
Loading…
Reference in a new issue