mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-20 09:52:18 +00:00
Merge branch 'sal-misc-stuff' into 'master'
Sal misc stuff (state overwriting, gamepad tweaks) See merge request STJr/SRB2Internal!116
This commit is contained in:
commit
49a1266ccc
13 changed files with 167 additions and 126 deletions
|
@ -721,6 +721,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_moveaxis2);
|
||||
CV_RegisterVar(&cv_lookaxis);
|
||||
CV_RegisterVar(&cv_lookaxis2);
|
||||
CV_RegisterVar(&cv_jumpaxis);
|
||||
CV_RegisterVar(&cv_jumpaxis2);
|
||||
CV_RegisterVar(&cv_spinaxis);
|
||||
CV_RegisterVar(&cv_spinaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis);
|
||||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_firenaxis);
|
||||
|
|
68
src/g_game.c
68
src/g_game.c
|
@ -346,6 +346,8 @@ typedef enum
|
|||
AXISLOOK,
|
||||
AXISSTRAFE,
|
||||
AXISDEAD, //Axises that don't want deadzones
|
||||
AXISJUMP,
|
||||
AXISSPIN,
|
||||
AXISFIRE,
|
||||
AXISFIRENORMAL,
|
||||
} axis_input_e;
|
||||
|
@ -356,6 +358,8 @@ consvar_t cv_sideaxis = {"joyaxis_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL
|
|||
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis = {"joyaxis_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_jumpaxis = {"joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_spinaxis = {"joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
@ -363,6 +367,8 @@ consvar_t cv_sideaxis2 = {"joyaxis2_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NU
|
|||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_jumpaxis2 = {"joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_spinaxis2 = {"joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if MAXPLAYERS > 32
|
||||
#error "please update player_name table using the new value for MAXPLAYERS"
|
||||
|
@ -725,6 +731,12 @@ static INT32 JoyAxis(axis_input_e axissel)
|
|||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis.value;
|
||||
break;
|
||||
case AXISJUMP:
|
||||
axisval = cv_jumpaxis.value;
|
||||
break;
|
||||
case AXISSPIN:
|
||||
axisval = cv_spinaxis.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis.value;
|
||||
break;
|
||||
|
@ -790,6 +802,12 @@ static INT32 Joy2Axis(axis_input_e axissel)
|
|||
case AXISSTRAFE:
|
||||
axisval = cv_sideaxis2.value;
|
||||
break;
|
||||
case AXISJUMP:
|
||||
axisval = cv_jumpaxis2.value;
|
||||
break;
|
||||
case AXISSPIN:
|
||||
axisval = cv_spinaxis2.value;
|
||||
break;
|
||||
case AXISFIRE:
|
||||
axisval = cv_fireaxis2.value;
|
||||
break;
|
||||
|
@ -858,7 +876,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
INT32 tspeed, forward, side, axis, i;
|
||||
const INT32 speed = 1;
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||
player_t *player = &players[consoleplayer];
|
||||
camera_t *thiscam = &camera;
|
||||
|
||||
|
@ -879,6 +897,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
turnright = PLAYER1INPUTDOWN(gc_turnright);
|
||||
turnleft = PLAYER1INPUTDOWN(gc_turnleft);
|
||||
|
||||
straferkey = PLAYER1INPUTDOWN(gc_straferight);
|
||||
strafelkey = PLAYER1INPUTDOWN(gc_strafeleft);
|
||||
movefkey = PLAYER1INPUTDOWN(gc_forward);
|
||||
movebkey = PLAYER1INPUTDOWN(gc_backward);
|
||||
|
||||
mouseaiming = (PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value;
|
||||
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
|
||||
|
@ -967,9 +991,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// forward with key or button
|
||||
axis = JoyAxis(AXISMOVE);
|
||||
if (PLAYER1INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0))
|
||||
if (movefkey || (gamepadjoystickmove && axis < 0))
|
||||
forward = forwardmove[speed];
|
||||
if (PLAYER1INPUTDOWN(gc_backward) || (gamepadjoystickmove && axis > 0))
|
||||
if (movebkey || (gamepadjoystickmove && axis > 0))
|
||||
forward -= forwardmove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
|
@ -977,9 +1001,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// some people strafe left & right with mouse buttons
|
||||
// those people are weird
|
||||
if (PLAYER1INPUTDOWN(gc_straferight))
|
||||
if (straferkey)
|
||||
side += sidemove[speed];
|
||||
if (PLAYER1INPUTDOWN(gc_strafeleft))
|
||||
if (strafelkey)
|
||||
side -= sidemove[speed];
|
||||
|
||||
if (PLAYER1INPUTDOWN(gc_weaponnext))
|
||||
|
@ -1021,7 +1045,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
cmd->buttons |= BT_CUSTOM3;
|
||||
|
||||
// use with any button/key
|
||||
if (PLAYER1INPUTDOWN(gc_use))
|
||||
axis = JoyAxis(AXISSPIN);
|
||||
if (PLAYER1INPUTDOWN(gc_use) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_USE;
|
||||
|
||||
if (PLAYER1INPUTDOWN(gc_camreset))
|
||||
|
@ -1034,7 +1059,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
resetdown = false;
|
||||
|
||||
// jump button
|
||||
if (PLAYER1INPUTDOWN(gc_jump))
|
||||
axis = JoyAxis(AXISJUMP);
|
||||
if (PLAYER1INPUTDOWN(gc_jump) || (cv_usejoystick.value && axis > 0))
|
||||
cmd->buttons |= BT_JUMP;
|
||||
|
||||
// player aiming shit, ahhhh...
|
||||
|
@ -1114,7 +1140,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// 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.
|
||||
if (!forcestrafe && forward && side)
|
||||
// 9-18-2017: ALSO, only do this when using keys to move. Gamepad analog sticks get severely gimped by this
|
||||
if (!forcestrafe && (((movefkey || movebkey) && side) || ((strafelkey || straferkey) && forward)))
|
||||
{
|
||||
forward = FixedMul(forward, 3*FRACUNIT/4);
|
||||
side = FixedMul(side, 3*FRACUNIT/4);
|
||||
|
@ -1156,7 +1183,7 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
INT32 tspeed, forward, side, axis, i;
|
||||
const INT32 speed = 1;
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||
boolean turnleft, turnright, strafelkey, straferkey, movefkey, movebkey, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||
player_t *player = &players[secondarydisplayplayer];
|
||||
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
||||
|
||||
|
@ -1177,6 +1204,12 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
turnright = PLAYER2INPUTDOWN(gc_turnright);
|
||||
turnleft = PLAYER2INPUTDOWN(gc_turnleft);
|
||||
|
||||
straferkey = PLAYER2INPUTDOWN(gc_straferight);
|
||||
strafelkey = PLAYER2INPUTDOWN(gc_strafeleft);
|
||||
movefkey = PLAYER2INPUTDOWN(gc_forward);
|
||||
movebkey = PLAYER2INPUTDOWN(gc_backward);
|
||||
|
||||
mouseaiming = (PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value;
|
||||
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
|
||||
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
|
||||
|
@ -1265,9 +1298,9 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// forward with key or button
|
||||
axis = Joy2Axis(AXISMOVE);
|
||||
if (PLAYER2INPUTDOWN(gc_forward) || (gamepadjoystickmove && axis < 0))
|
||||
if (movefkey || (gamepadjoystickmove && axis < 0))
|
||||
forward = forwardmove[speed];
|
||||
if (PLAYER2INPUTDOWN(gc_backward) || (gamepadjoystickmove && axis > 0))
|
||||
if (movebkey || (gamepadjoystickmove && axis > 0))
|
||||
forward -= forwardmove[speed];
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
|
@ -1275,9 +1308,9 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// some people strafe left & right with mouse buttons
|
||||
// those people are (still) weird
|
||||
if (PLAYER2INPUTDOWN(gc_straferight))
|
||||
if (straferkey)
|
||||
side += sidemove[speed];
|
||||
if (PLAYER2INPUTDOWN(gc_strafeleft))
|
||||
if (strafelkey)
|
||||
side -= sidemove[speed];
|
||||
|
||||
if (PLAYER2INPUTDOWN(gc_weaponnext))
|
||||
|
@ -1316,7 +1349,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
cmd->buttons |= BT_CUSTOM3;
|
||||
|
||||
// use with any button/key
|
||||
if (PLAYER2INPUTDOWN(gc_use))
|
||||
axis = Joy2Axis(AXISSPIN);
|
||||
if (PLAYER2INPUTDOWN(gc_use) || (cv_usejoystick2.value && axis > 0))
|
||||
cmd->buttons |= BT_USE;
|
||||
|
||||
if (PLAYER2INPUTDOWN(gc_camreset))
|
||||
|
@ -1329,7 +1363,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
resetdown = false;
|
||||
|
||||
// jump button
|
||||
if (PLAYER2INPUTDOWN(gc_jump))
|
||||
axis = Joy2Axis(AXISJUMP);
|
||||
if (PLAYER2INPUTDOWN(gc_jump) || (cv_usejoystick2.value && axis > 0))
|
||||
cmd->buttons |= BT_JUMP;
|
||||
|
||||
// player aiming shit, ahhhh...
|
||||
|
@ -1409,7 +1444,8 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
|
||||
// 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.
|
||||
if (!forcestrafe && forward && side)
|
||||
// 9-18-2017: ALSO, only do this when using keys to move. Gamepad analog sticks get severely gimped by this
|
||||
if (!forcestrafe && (((movefkey || movebkey) && side) || ((strafelkey || straferkey) && forward)))
|
||||
{
|
||||
forward = FixedMul(forward, 3*FRACUNIT/4);
|
||||
side = FixedMul(side, 3*FRACUNIT/4);
|
||||
|
|
|
@ -61,8 +61,8 @@ extern consvar_t cv_useranalog, cv_useranalog2;
|
|||
extern consvar_t cv_analog, cv_analog2;
|
||||
extern consvar_t cv_directionchar, cv_directionchar2;
|
||||
extern consvar_t cv_autobrake, cv_autobrake2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
|
||||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
|
|
|
@ -1135,7 +1135,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
|
||||
// make sure viewz follows player if in 1st person mode
|
||||
player->deltaviewheight = 0;
|
||||
player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale);
|
||||
player->viewheight = FixedMul(41*player->height/48, player->mo->scale);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
||||
else
|
||||
|
|
20
src/m_menu.c
20
src/m_menu.c
|
@ -1029,7 +1029,7 @@ static menuitem_t OP_P1ControlsMenu[] =
|
|||
{
|
||||
{IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup1PControlsMenu, 10},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 20},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Joystick Options...", &OP_Joystick1Def , 30},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def , 30},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 60},
|
||||
|
@ -1044,7 +1044,7 @@ static menuitem_t OP_P2ControlsMenu[] =
|
|||
{
|
||||
{IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup2PControlsMenu, 10},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Second Mouse Options...", &OP_Mouse2OptionsDef, 20},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Second Joystick Options...", &OP_Joystick2Def , 30},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Second Gamepad Options...", &OP_Joystick2Def , 30},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 60},
|
||||
|
@ -1108,24 +1108,28 @@ static menuitem_t OP_ChangeControlsMenu[] =
|
|||
|
||||
static menuitem_t OP_Joystick1Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis ,100},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, NULL, "Select Joystick...", M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 ,100},
|
||||
};
|
||||
|
||||
static menuitem_t OP_JoystickSetMenu[] =
|
||||
|
|
|
@ -7960,16 +7960,20 @@ void A_OrbitNights(mobj_t* actor)
|
|||
//
|
||||
// Description: Spawns a "ghost" mobj of this actor, ala spindash trails and the minus's digging "trails"
|
||||
//
|
||||
// var1 = unused
|
||||
// var1 = duration in tics
|
||||
// var2 = unused
|
||||
//
|
||||
void A_GhostMe(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
mobj_t *ghost;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_GhostMe", actor))
|
||||
return;
|
||||
#endif
|
||||
P_SpawnGhostMobj(actor);
|
||||
ghost = P_SpawnGhostMobj(actor);
|
||||
if (ghost && locvar1 > 0)
|
||||
ghost->fuse = locvar1;
|
||||
}
|
||||
|
||||
// Function: A_SetObjectState
|
||||
|
|
|
@ -1575,7 +1575,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
return; // Only go in the mouth
|
||||
|
||||
// Eaten by player!
|
||||
if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
if ((!player->bot) && (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1))
|
||||
P_RestoreMusic(player);
|
||||
|
||||
if (player->powers[pw_underwater] < underwatertics + 1)
|
||||
|
@ -1583,12 +1583,18 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
if (!player->climbing)
|
||||
{
|
||||
if (player->bot && toucher->state-states != S_PLAY_GASP)
|
||||
S_StartSound(toucher, special->info->deathsound); // Force it to play a sound for bots
|
||||
P_SetPlayerMobjState(toucher, S_PLAY_GASP);
|
||||
P_ResetPlayer(player);
|
||||
}
|
||||
|
||||
toucher->momx = toucher->momy = toucher->momz = 0;
|
||||
break;
|
||||
|
||||
if (player->bot)
|
||||
return;
|
||||
else
|
||||
break;
|
||||
|
||||
case MT_WATERDROP:
|
||||
if (special->state == &states[special->info->spawnstate])
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#define FLOATSPEED (FRACUNIT*4)
|
||||
|
||||
#define VIEWHEIGHTS "41"
|
||||
|
||||
// Maximum player score.
|
||||
#define MAXSCORE 99999990 // 999999990
|
||||
|
||||
|
@ -217,7 +215,7 @@ void P_RestoreMultiMusic(player_t *player);
|
|||
extern mapthing_t *itemrespawnque[ITEMQUESIZE];
|
||||
extern tic_t itemrespawntime[ITEMQUESIZE];
|
||||
extern size_t iquehead, iquetail;
|
||||
extern consvar_t cv_gravity, cv_viewheight;
|
||||
extern consvar_t cv_gravity, cv_movebob;
|
||||
|
||||
void P_RespawnSpecials(void);
|
||||
|
||||
|
|
10
src/p_mobj.c
10
src/p_mobj.c
|
@ -36,9 +36,9 @@
|
|||
#endif
|
||||
#include "f_finale.h"
|
||||
|
||||
// protos.
|
||||
static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_viewheight = {"viewheight", VIEWHEIGHTS, 0, viewheight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_movebob = {"movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef WALLSPLATS
|
||||
consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
@ -2898,7 +2898,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
mo->player->viewheight -= mo->floorz - mo->z;
|
||||
|
||||
mo->player->deltaviewheight =
|
||||
(FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;
|
||||
(FixedMul(41*mo->player->height/48, mo->scale) - mo->player->viewheight)>>3;
|
||||
}
|
||||
|
||||
// adjust height
|
||||
|
@ -9101,7 +9101,7 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
|||
else if (playernum == secondarydisplayplayer)
|
||||
localangle2 = mobj->angle;
|
||||
|
||||
p->viewheight = cv_viewheight.value<<FRACBITS;
|
||||
p->viewheight = 41*p->height/48;
|
||||
|
||||
if (p->mo->eflags & MFE_VERTICALFLIP)
|
||||
p->viewz = p->mo->z + p->mo->height - p->viewheight;
|
||||
|
|
|
@ -424,8 +424,6 @@ static void P_NetUnArchivePlayers(void)
|
|||
if (flags & FOLLOW)
|
||||
players[i].followmobj = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
|
||||
players[i].viewheight = cv_viewheight.value<<FRACBITS;
|
||||
|
||||
players[i].camerascale = READFIXED(save_p);
|
||||
players[i].shieldscale = READFIXED(save_p);
|
||||
|
||||
|
@ -448,6 +446,8 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].jumpfactor = READFIXED(save_p);
|
||||
players[i].height = READFIXED(save_p);
|
||||
players[i].spinheight = READFIXED(save_p);
|
||||
|
||||
players[i].viewheight = 41*players[i].height/48; // scale cannot be factored in at this point
|
||||
}
|
||||
}
|
||||
|
||||
|
|
145
src/p_user.c
145
src/p_user.c
|
@ -188,11 +188,12 @@ void P_CalcHeight(player_t *player)
|
|||
// Note: a LUT allows for effects
|
||||
// like a ramp with low health.
|
||||
|
||||
player->bob = (FixedMul(player->rmomx,player->rmomx)
|
||||
+ FixedMul(player->rmomy,player->rmomy))>>2;
|
||||
player->bob = FixedMul(cv_movebob.value,
|
||||
(FixedMul(player->rmomx,player->rmomx)
|
||||
+ FixedMul(player->rmomy,player->rmomy))>>2);
|
||||
|
||||
if (player->bob > FixedMul(MAXBOB, mo->scale))
|
||||
player->bob = FixedMul(MAXBOB, mo->scale);
|
||||
if (player->bob > FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale)))
|
||||
player->bob = FixedMul(cv_movebob.value, FixedMul(MAXBOB, mo->scale));
|
||||
|
||||
if (!P_IsObjectOnGround(mo))
|
||||
{
|
||||
|
@ -215,7 +216,7 @@ void P_CalcHeight(player_t *player)
|
|||
bob = FixedMul(player->bob/2, FINESINE(angle));
|
||||
|
||||
// move viewheight
|
||||
pviewheight = FixedMul(cv_viewheight.value << FRACBITS, mo->scale); // default eye view height
|
||||
pviewheight = FixedMul(41*player->height/48, mo->scale); // default eye view height
|
||||
|
||||
if (player->playerstate == PST_LIVE)
|
||||
{
|
||||
|
@ -1809,48 +1810,50 @@ boolean P_PlayerHitFloor(player_t *player)
|
|||
S_StartSound(player->mo, sfx_spin);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
|
||||
if (player->pflags & PF_GLIDING) // ground gliding
|
||||
{
|
||||
player->skidtime = TICRATE;
|
||||
player->mo->tics = -1;
|
||||
}
|
||||
else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING);
|
||||
player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
|
||||
S_StartSound(player->mo, sfx_s3k8b);
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
}
|
||||
else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING)
|
||||
|| player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED)
|
||||
{
|
||||
if (player->cmomx || player->cmomy)
|
||||
if (player->pflags & PF_GLIDING) // ground gliding
|
||||
{
|
||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
else if ((player->rmomx || player->rmomy)
|
||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
player->skidtime = TICRATE;
|
||||
player->mo->tics = -1;
|
||||
}
|
||||
else
|
||||
else if (player->charability2 == CA2_MELEE && (player->panim == PA_ABILITY2 && player->mo->state-states != S_PLAY_MELEE_LANDING))
|
||||
{
|
||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
else if ((player->mo->momx || player->mo->momy)
|
||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_MELEE_LANDING);
|
||||
player->mo->tics = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS;
|
||||
S_StartSound(player->mo, sfx_s3k8b);
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
}
|
||||
else if (player->pflags & PF_JUMPED || !(player->pflags & PF_SPINNING)
|
||||
|| player->powers[pw_tailsfly] || player->mo->state-states == S_PLAY_FLY_TIRED)
|
||||
{
|
||||
if (player->cmomx || player->cmomy)
|
||||
{
|
||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
else if ((player->rmomx || player->rmomy)
|
||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->rmomx && !player->rmomy && player->panim != PA_IDLE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->charflags & SF_DASHMODE && player->dashmode >= 3*TICRATE && player->panim != PA_DASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale)
|
||||
&& (player->panim != PA_RUN || player->mo->state-states == S_PLAY_FLOAT_RUN))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_RUN);
|
||||
else if ((player->mo->momx || player->mo->momy)
|
||||
&& (player->panim != PA_WALK || player->mo->state-states == S_PLAY_FLOAT))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
|
||||
else if (!player->mo->momx && !player->mo->momy && player->panim != PA_IDLE)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_STND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4189,14 +4192,10 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (onground && player->pflags & PF_STARTDASH)
|
||||
{
|
||||
if (player->mo->state-states != S_PLAY_SPINDASH)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPINDASH);
|
||||
// Spawn spin dash dust
|
||||
if (!(player->charflags & SF_NOSPINDASHDUST) && !(player->mo->eflags & MFE_GOOWATER))
|
||||
P_DoSpinDashDust(player);
|
||||
}
|
||||
else if (onground && player->pflags & PF_SPINNING && !(player->panim == PA_ROLL))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -4255,6 +4254,8 @@ void P_DoBubbleBounce(player_t *player)
|
|||
P_DoJump(player, false);
|
||||
if (player->charflags & SF_NOJUMPSPIN)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
else
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||
player->pflags |= PF_THOKKED;
|
||||
player->pflags &= ~PF_STARTJUMP;
|
||||
player->secondjump = UINT8_MAX;
|
||||
|
@ -8616,9 +8617,9 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
|||
x = player->mo->x - P_ReturnThrustX(player->mo, thiscam->angle, player->mo->radius);
|
||||
y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
z = player->mo->z + player->mo->height - (cv_viewheight.value<<FRACBITS) - 16*FRACUNIT;
|
||||
z = player->mo->z + player->mo->height - (41*player->height/48) - 16*FRACUNIT;
|
||||
else
|
||||
z = player->mo->z + (cv_viewheight.value<<FRACBITS);
|
||||
z = player->mo->z + (41*player->height/48);
|
||||
|
||||
// set bits for the camera
|
||||
thiscam->x = x;
|
||||
|
@ -8644,7 +8645,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
|||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
angle_t angle = 0, focusangle = 0, focusaiming = 0;
|
||||
fixed_t x, y, z, dist, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||
fixed_t x, y, z, dist, height, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||
INT32 camrotate;
|
||||
boolean camstill, cameranoclip;
|
||||
mobj_t *mo;
|
||||
|
@ -8817,6 +8818,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
}
|
||||
|
||||
height = camheight;
|
||||
|
||||
// sets ideal cam pos
|
||||
if (twodlevel || (mo->flags2 & MF2_TWOD))
|
||||
dist = 480<<FRACBITS;
|
||||
|
@ -8826,9 +8829,19 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
{
|
||||
dist = camdist;
|
||||
|
||||
// x1.5 dist for splitscreen
|
||||
if (splitscreen)
|
||||
{
|
||||
dist = FixedMul(dist, 3*FRACUNIT/2);
|
||||
height = FixedMul(height, 3*FRACUNIT/2);
|
||||
}
|
||||
|
||||
// x1.2 dist for analog
|
||||
if (P_AnalogMove(player))
|
||||
{
|
||||
dist = FixedMul(dist, 6*FRACUNIT/5);
|
||||
height = FixedMul(height, 6*FRACUNIT/5);
|
||||
}
|
||||
|
||||
if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->powers[pw_carry] == CR_ROPEHANG || player->powers[pw_carry] == CR_GENERIC || player->powers[pw_carry] == CR_MACESPIN))
|
||||
dist <<= 1;
|
||||
|
@ -8874,12 +8887,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
#endif // bad 2D camera code
|
||||
|
||||
pviewheight = FixedMul(cv_viewheight.value<<FRACBITS, mo->scale);
|
||||
pviewheight = FixedMul(41*player->height/48, mo->scale);
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
z = mo->z + mo->height - pviewheight - camheight;
|
||||
z = mo->z + mo->height - pviewheight - height;
|
||||
else
|
||||
z = mo->z + pviewheight + camheight;
|
||||
z = mo->z + pviewheight + height;
|
||||
|
||||
// move camera down to move under lower ceilings
|
||||
newsubsec = R_IsPointInSubsector(((mo->x>>FRACBITS) + (thiscam->x>>FRACBITS))<<(FRACBITS-1), ((mo->y>>FRACBITS) + (thiscam->y>>FRACBITS))<<(FRACBITS-1));
|
||||
|
@ -9077,7 +9090,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
|
||||
if (mo->type == MT_EGGTRAP)
|
||||
z = mo->z + 128*FRACUNIT + pviewheight + camheight;
|
||||
z = mo->z + 128*FRACUNIT + pviewheight + height;
|
||||
|
||||
if (thiscam->z < thiscam->floorz && !cameranoclip)
|
||||
thiscam->z = thiscam->floorz;
|
||||
|
@ -9481,23 +9494,6 @@ void P_PlayerThink(player_t *player)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
if (!player->mo->health)
|
||||
;
|
||||
else if (player->pflags & PF_GLIDING)
|
||||
{
|
||||
if (player->panim != PA_ABILITY)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
|
||||
}
|
||||
else if ((player->pflags & PF_JUMPED && !(player->pflags & PF_NOJUMPDAMAGE)
|
||||
&& (player->mo->state-states != S_PLAY_FLOAT && player->mo->state-states != S_PLAY_FLOAT_RUN))
|
||||
&& ((((player->charflags & (SF_NOJUMPSPIN|SF_NOJUMPDAMAGE)) == (SF_NOJUMPSPIN|SF_NOJUMPDAMAGE)) && player->panim != PA_ROLL)
|
||||
|| (!(player->charflags & SF_NOJUMPSPIN) && player->panim != PA_JUMP)))
|
||||
{
|
||||
if (!(player->charflags & SF_NOJUMPSPIN))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
|
||||
else if (!(player->pflags & PF_NOJUMPDAMAGE))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||
}
|
||||
|
||||
if (player->flashcount)
|
||||
player->flashcount--;
|
||||
|
@ -10306,12 +10302,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
if (P_IsLocalPlayer(player) && (player->pflags & PF_WPNDOWN) && player->currentweapon != oldweapon)
|
||||
S_StartSound(NULL, sfx_wepchg);
|
||||
|
||||
if (player->pflags & PF_GLIDING)
|
||||
{
|
||||
if (player->panim != PA_ABILITY)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
|
||||
}
|
||||
else if (player->pflags & PF_SLIDING)
|
||||
if (player->pflags & PF_SLIDING)
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
|
||||
|
||||
/* if (player->powers[pw_carry] == CR_NONE && player->mo->tracer && !player->homing)
|
||||
|
@ -10466,7 +10457,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
{
|
||||
// defaults to make sure 1st person cam doesn't do anything weird on startup
|
||||
player->deltaviewheight = 0;
|
||||
player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale);
|
||||
player->viewheight = FixedMul(41*player->height/48, player->mo->scale);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
player->viewz = player->mo->z + player->mo->height - player->viewheight;
|
||||
else
|
||||
|
|
|
@ -1311,10 +1311,8 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_translucenthud);
|
||||
|
||||
CV_RegisterVar(&cv_maxportals);
|
||||
|
||||
// Default viewheight is changeable,
|
||||
// initialized to standard viewheight
|
||||
CV_RegisterVar(&cv_viewheight);
|
||||
|
||||
CV_RegisterVar(&cv_movebob);
|
||||
|
||||
#ifdef HWRENDER
|
||||
// GL-specific Commands
|
||||
|
|
|
@ -1026,7 +1026,7 @@ static int joy_open(const char *fname)
|
|||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
|
||||
CONS_Printf(M_GetText("Couldn't initialize gamepad: %s\n"), SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
@ -1036,7 +1036,7 @@ static int joy_open(const char *fname)
|
|||
|
||||
if (num_joy < joyindex)
|
||||
{
|
||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||
CONS_Printf("Cannot use gamepad #%d/(%s), it doesn't exist\n",joyindex,fname);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
I_ShutdownJoystick();
|
||||
|
@ -1310,7 +1310,7 @@ static int joy_open2(const char *fname)
|
|||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
|
||||
CONS_Printf(M_GetText("Couldn't initialize gamepad: %s\n"), SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
@ -1318,7 +1318,7 @@ static int joy_open2(const char *fname)
|
|||
|
||||
if (num_joy < joyindex)
|
||||
{
|
||||
CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
|
||||
CONS_Printf("Cannot use gamepad #%d/(%s), it doesn't exist\n",joyindex,fname);
|
||||
for (i = 0; i < num_joy; i++)
|
||||
CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
|
||||
I_ShutdownJoystick2();
|
||||
|
|
Loading…
Reference in a new issue