mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'spindash' into 'master'
Spindash See merge request KartKrew/Kart!303
This commit is contained in:
commit
0060a30bc4
18 changed files with 702 additions and 372 deletions
|
|
@ -4315,7 +4315,6 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
static boolean CheckForSpeedHacks(UINT8 p)
|
static boolean CheckForSpeedHacks(UINT8 p)
|
||||||
{
|
{
|
||||||
if (netcmds[maketic%TICQUEUE][p].forwardmove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].forwardmove < -MAXPLMOVE
|
if (netcmds[maketic%TICQUEUE][p].forwardmove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].forwardmove < -MAXPLMOVE
|
||||||
|| netcmds[maketic%TICQUEUE][p].sidemove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].sidemove < -MAXPLMOVE
|
|
||||||
|| netcmds[maketic%TICQUEUE][p].driftturn > KART_FULLTURN || netcmds[maketic%TICQUEUE][p].driftturn < -KART_FULLTURN)
|
|| netcmds[maketic%TICQUEUE][p].driftturn > KART_FULLTURN || netcmds[maketic%TICQUEUE][p].driftturn < -KART_FULLTURN)
|
||||||
{
|
{
|
||||||
XBOXSTATIC char buf[2];
|
XBOXSTATIC char buf[2];
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,9 @@ typedef enum
|
||||||
k_jmp, // In Mario Kart, letting go of the jump button stops the drift
|
k_jmp, // In Mario Kart, letting go of the jump button stops the drift
|
||||||
k_offroad, // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed
|
k_offroad, // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed
|
||||||
k_pogospring, // Pogo spring bounce effect
|
k_pogospring, // Pogo spring bounce effect
|
||||||
k_brakestop, // Wait until you've made a complete stop for a few tics before letting brake go in reverse.
|
k_spindash, // Spindash charge timer
|
||||||
|
k_spindashspeed, // Spindash release speed
|
||||||
|
k_spindashboost, // Spindash release boost timer
|
||||||
k_waterskip, // Water skipping counter
|
k_waterskip, // Water skipping counter
|
||||||
k_dashpadcooldown, // Separate the vanilla SA-style dash pads from using pw_flashing
|
k_dashpadcooldown, // Separate the vanilla SA-style dash pads from using pw_flashing
|
||||||
k_numboosts, // Count of how many boosts are being stacked, for after image spawning
|
k_numboosts, // Count of how many boosts are being stacked, for after image spawning
|
||||||
|
|
@ -375,6 +377,9 @@ typedef enum
|
||||||
khud_lapanimation, // Used to show the lap start wing logo animation
|
khud_lapanimation, // Used to show the lap start wing logo animation
|
||||||
khud_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down:
|
khud_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down:
|
||||||
|
|
||||||
|
// Start
|
||||||
|
khud_fault, // Set when faulting during the starting countdown
|
||||||
|
|
||||||
// Camera
|
// Camera
|
||||||
khud_boostcam, // Camera push forward on boost
|
khud_boostcam, // Camera push forward on boost
|
||||||
khud_destboostcam, // Ditto
|
khud_destboostcam, // Ditto
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ typedef enum
|
||||||
BT_BACKWARD = 1<<6, // Aim Item Backward
|
BT_BACKWARD = 1<<6, // Aim Item Backward
|
||||||
BT_LOOKBACK = 1<<7, // Look Backward
|
BT_LOOKBACK = 1<<7, // Look Backward
|
||||||
|
|
||||||
|
BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE),
|
||||||
|
|
||||||
// free: 1<<8 to 1<<12
|
// free: 1<<8 to 1<<12
|
||||||
|
|
||||||
// Lua garbage
|
// Lua garbage
|
||||||
|
|
@ -58,7 +60,6 @@ typedef enum
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
|
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
|
||||||
SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50)
|
|
||||||
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
|
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
|
||||||
INT16 aiming; // vertical aiming, see G_BuildTicCmd
|
INT16 aiming; // vertical aiming, see G_BuildTicCmd
|
||||||
UINT16 buttons;
|
UINT16 buttons;
|
||||||
|
|
|
||||||
|
|
@ -8837,7 +8837,9 @@ static const char *const KARTSTUFF_LIST[] = {
|
||||||
"JMP",
|
"JMP",
|
||||||
"OFFROAD",
|
"OFFROAD",
|
||||||
"POGOSPRING",
|
"POGOSPRING",
|
||||||
"BRAKESTOP",
|
"SPINDASH",
|
||||||
|
"SPINDASHSPEED",
|
||||||
|
"SPINDASHBOOST",
|
||||||
"WATERSKIP",
|
"WATERSKIP",
|
||||||
"DASHPADCOOLDOWN",
|
"DASHPADCOOLDOWN",
|
||||||
"NUMBOOSTS",
|
"NUMBOOSTS",
|
||||||
|
|
|
||||||
|
|
@ -482,8 +482,13 @@ extern UINT16 extralifetics;
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
extern tic_t introtime;
|
extern tic_t introtime;
|
||||||
extern tic_t starttime;
|
extern tic_t starttime;
|
||||||
|
|
||||||
|
extern const tic_t bulbtime;
|
||||||
|
extern UINT8 numbulbs;
|
||||||
|
|
||||||
extern tic_t raceexittime;
|
extern tic_t raceexittime;
|
||||||
extern tic_t battleexittime;
|
extern tic_t battleexittime;
|
||||||
|
|
||||||
extern INT32 hyudorotime;
|
extern INT32 hyudorotime;
|
||||||
extern INT32 stealtime;
|
extern INT32 stealtime;
|
||||||
extern INT32 sneakertime;
|
extern INT32 sneakertime;
|
||||||
|
|
@ -534,6 +539,7 @@ extern tic_t hyubgone;
|
||||||
extern tic_t mapreset;
|
extern tic_t mapreset;
|
||||||
extern boolean thwompsactive;
|
extern boolean thwompsactive;
|
||||||
extern SINT8 spbplace;
|
extern SINT8 spbplace;
|
||||||
|
extern boolean rainbowstartavailable;
|
||||||
|
|
||||||
extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :)
|
extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :)
|
||||||
extern boolean legitimateexit;
|
extern boolean legitimateexit;
|
||||||
|
|
|
||||||
114
src/g_game.c
114
src/g_game.c
|
|
@ -224,10 +224,15 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2);
|
||||||
UINT16 extralifetics = 4*TICRATE;
|
UINT16 extralifetics = 4*TICRATE;
|
||||||
|
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
tic_t introtime = 108+5; // plus 5 for white fade
|
tic_t introtime = 0;
|
||||||
tic_t starttime = 6*TICRATE + (3*TICRATE/4);
|
tic_t starttime = 0;
|
||||||
|
|
||||||
|
const tic_t bulbtime = TICRATE/2;
|
||||||
|
UINT8 numbulbs = 0;
|
||||||
|
|
||||||
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
||||||
tic_t battleexittime = 8*TICRATE;
|
tic_t battleexittime = 8*TICRATE;
|
||||||
|
|
||||||
INT32 hyudorotime = 7*TICRATE;
|
INT32 hyudorotime = 7*TICRATE;
|
||||||
INT32 stealtime = TICRATE/2;
|
INT32 stealtime = TICRATE/2;
|
||||||
INT32 sneakertime = TICRATE + (TICRATE/3);
|
INT32 sneakertime = TICRATE + (TICRATE/3);
|
||||||
|
|
@ -289,6 +294,7 @@ tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled
|
||||||
tic_t mapreset; // Map reset delay when enough players have joined an empty game
|
tic_t mapreset; // Map reset delay when enough players have joined an empty game
|
||||||
boolean thwompsactive; // Thwomps activate on lap 2
|
boolean thwompsactive; // Thwomps activate on lap 2
|
||||||
SINT8 spbplace; // SPB exists, give the person behind better items
|
SINT8 spbplace; // SPB exists, give the person behind better items
|
||||||
|
boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten
|
||||||
|
|
||||||
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
|
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
|
||||||
tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures.
|
tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures.
|
||||||
|
|
@ -1255,13 +1261,12 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p)
|
||||||
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
INT32 localaiming[MAXSPLITSCREENPLAYERS];
|
||||||
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
static fixed_t forwardmove = MAXPLMOVE<<FRACBITS>>16;
|
||||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
|
||||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||||
|
|
||||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
{
|
{
|
||||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
INT32 laim, th, tspeed, forward, axis; //i
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
|
||||||
|
|
@ -1372,7 +1377,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
turnright = turnright || (axis > 0);
|
turnright = turnright || (axis > 0);
|
||||||
turnleft = turnleft || (axis < 0);
|
turnleft = turnleft || (axis < 0);
|
||||||
}
|
}
|
||||||
forward = side = 0;
|
forward = 0;
|
||||||
|
|
||||||
// use two stage accelerative turning
|
// use two stage accelerative turning
|
||||||
// on the keyboard and joystick
|
// on the keyboard and joystick
|
||||||
|
|
@ -1393,13 +1398,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
|
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed]));
|
cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed]));
|
||||||
side += sidemove[1];
|
|
||||||
}
|
}
|
||||||
else if (turnleft && !(turnright))
|
else if (turnleft && !(turnright))
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
|
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed]));
|
cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed]));
|
||||||
side -= sidemove[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (analogjoystickmove && axis != 0)
|
if (analogjoystickmove && axis != 0)
|
||||||
|
|
@ -1407,7 +1410,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG!
|
cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG!
|
||||||
cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10)));
|
cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10)));
|
||||||
side += ((axis * sidemove[0]) >> 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specator mouse turning
|
// Specator mouse turning
|
||||||
|
|
@ -1427,9 +1429,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
cmd->buttons |= BT_BRAKE;
|
cmd->buttons |= BT_BRAKE;
|
||||||
axis = JoyAxis(AXISAIM, ssplayer);
|
axis = JoyAxis(AXISAIM, ssplayer);
|
||||||
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
|
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
|
||||||
forward += forwardmove[1];
|
forward += forwardmove;
|
||||||
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
|
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
|
||||||
forward -= forwardmove[1];
|
forward -= forwardmove;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1438,13 +1440,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
|
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_ACCELERATE;
|
cmd->buttons |= BT_ACCELERATE;
|
||||||
forward = forwardmove[1]; // 50
|
forward = forwardmove; // 50
|
||||||
}
|
}
|
||||||
else if (analogjoystickmove && axis > 0)
|
else if (analogjoystickmove && axis > 0)
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_ACCELERATE;
|
cmd->buttons |= BT_ACCELERATE;
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
forward += ((axis * forwardmove[1]) >> 10)*2;
|
forward += ((axis * forwardmove) >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
axis = JoyAxis(AXISBRAKE, ssplayer);
|
axis = JoyAxis(AXISBRAKE, ssplayer);
|
||||||
|
|
@ -1452,14 +1454,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_BRAKE;
|
cmd->buttons |= BT_BRAKE;
|
||||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||||
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
|
forward -= forwardmove;
|
||||||
}
|
}
|
||||||
else if (analogjoystickmove && axis > 0)
|
else if (analogjoystickmove && axis > 0)
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_BRAKE;
|
cmd->buttons |= BT_BRAKE;
|
||||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||||
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
|
||||||
forward -= ((axis * forwardmove[0]) >> 10);
|
forward -= ((axis * forwardmove) >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// But forward/backward IS used for aiming.
|
// But forward/backward IS used for aiming.
|
||||||
|
|
@ -1554,21 +1556,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
|
|
||||||
mousex = mousey = mlooky = 0;
|
mousex = mousey = mlooky = 0;
|
||||||
|
|
||||||
if (forward > MAXPLMOVE)
|
cmd->forwardmove += (SINT8)forward;
|
||||||
forward = MAXPLMOVE;
|
|
||||||
else if (forward < -MAXPLMOVE)
|
|
||||||
forward = -MAXPLMOVE;
|
|
||||||
|
|
||||||
if (side > MAXPLMOVE)
|
if (cmd->forwardmove > MAXPLMOVE)
|
||||||
side = MAXPLMOVE;
|
cmd->forwardmove = MAXPLMOVE;
|
||||||
else if (side < -MAXPLMOVE)
|
else if (cmd->forwardmove < -MAXPLMOVE)
|
||||||
side = -MAXPLMOVE;
|
cmd->forwardmove = -MAXPLMOVE;
|
||||||
|
|
||||||
if (forward || side)
|
|
||||||
{
|
|
||||||
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
|
||||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
|
||||||
}
|
|
||||||
|
|
||||||
//{ SRB2kart - Drift support
|
//{ SRB2kart - Drift support
|
||||||
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
|
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
|
||||||
|
|
@ -1588,12 +1581,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
|
|
||||||
cmd->angleturn *= realtics;
|
cmd->angleturn *= realtics;
|
||||||
|
|
||||||
// SRB2kart - no additional angle if not moving
|
lang += (cmd->angleturn<<16);
|
||||||
if ((player->mo && player->speed > 0) // Moving
|
|
||||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
|
||||||
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|
|
||||||
|| (player->spectator || objectplacing)) // Not a physical player
|
|
||||||
lang += (cmd->angleturn<<16);
|
|
||||||
|
|
||||||
cmd->angleturn = (INT16)(lang >> 16);
|
cmd->angleturn = (INT16)(lang >> 16);
|
||||||
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
|
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
|
||||||
|
|
@ -1623,7 +1611,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Reset away view if a command is given.
|
//Reset away view if a command is given.
|
||||||
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
if ((cmd->forwardmove || cmd->buttons)
|
||||||
&& !r_splitscreen && displayplayers[0] != consoleplayer && ssplayer == 1)
|
&& !r_splitscreen && displayplayers[0] != consoleplayer && ssplayer == 1)
|
||||||
displayplayers[0] = consoleplayer;
|
displayplayers[0] = consoleplayer;
|
||||||
}
|
}
|
||||||
|
|
@ -2337,10 +2325,6 @@ void G_Ticker(boolean run)
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
INT32 buf;
|
INT32 buf;
|
||||||
ticcmd_t *cmd;
|
ticcmd_t *cmd;
|
||||||
UINT32 ra_timeskip = (modeattacking && !demo.playback && leveltime < starttime - TICRATE*4) ? 0 : (starttime - TICRATE*4 - 1);
|
|
||||||
// starttime - TICRATE*4 is where we want RA to start when we PLAY IT, so we will loop the main thinker on RA start to get it to this point,
|
|
||||||
// the reason this is done is to ensure that ghosts won't look out of synch with other map elements (objects, moving platforms...)
|
|
||||||
// when we REPLAY, don't skip, let the camera spin, do its thing etc~
|
|
||||||
|
|
||||||
// also the -1 is to ensure that the thinker runs in the loop below.
|
// also the -1 is to ensure that the thinker runs in the loop below.
|
||||||
|
|
||||||
|
|
@ -2413,16 +2397,12 @@ void G_Ticker(boolean run)
|
||||||
switch (gamestate)
|
switch (gamestate)
|
||||||
{
|
{
|
||||||
case GS_LEVEL:
|
case GS_LEVEL:
|
||||||
|
if (demo.title)
|
||||||
for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now.
|
F_TitleDemoTicker();
|
||||||
{
|
P_Ticker(run); // tic the game
|
||||||
if (demo.title)
|
ST_Ticker();
|
||||||
F_TitleDemoTicker();
|
AM_Ticker();
|
||||||
P_Ticker(run); // tic the game
|
HU_Ticker();
|
||||||
ST_Ticker();
|
|
||||||
AM_Ticker();
|
|
||||||
HU_Ticker();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
|
|
@ -4783,13 +4763,12 @@ char *G_BuildMapTitle(INT32 mapnum)
|
||||||
|
|
||||||
// For demos
|
// For demos
|
||||||
#define ZT_FWD 0x01
|
#define ZT_FWD 0x01
|
||||||
#define ZT_SIDE 0x02
|
#define ZT_ANGLE 0x02
|
||||||
#define ZT_ANGLE 0x04
|
#define ZT_BUTTONS 0x04
|
||||||
#define ZT_BUTTONS 0x08
|
#define ZT_AIMING 0x08
|
||||||
#define ZT_AIMING 0x10
|
#define ZT_DRIFT 0x10
|
||||||
#define ZT_DRIFT 0x20
|
#define ZT_LATENCY 0x20
|
||||||
#define ZT_LATENCY 0x40
|
#define DEMOMARKER 0x40 // demoend
|
||||||
#define DEMOMARKER 0x80 // demoend
|
|
||||||
|
|
||||||
UINT8 demo_extradata[MAXPLAYERS];
|
UINT8 demo_extradata[MAXPLAYERS];
|
||||||
UINT8 demo_writerng; // 0=no, 1=yes, 2=yes but on a timeout
|
UINT8 demo_writerng; // 0=no, 1=yes, 2=yes but on a timeout
|
||||||
|
|
@ -4852,7 +4831,6 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
dest[i].forwardmove = src[i].forwardmove;
|
dest[i].forwardmove = src[i].forwardmove;
|
||||||
dest[i].sidemove = src[i].sidemove;
|
|
||||||
dest[i].angleturn = SHORT(src[i].angleturn);
|
dest[i].angleturn = SHORT(src[i].angleturn);
|
||||||
dest[i].aiming = (INT16)SHORT(src[i].aiming);
|
dest[i].aiming = (INT16)SHORT(src[i].aiming);
|
||||||
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
|
dest[i].buttons = (UINT16)SHORT(src[i].buttons);
|
||||||
|
|
@ -5161,8 +5139,6 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
||||||
|
|
||||||
if (ziptic & ZT_FWD)
|
if (ziptic & ZT_FWD)
|
||||||
oldcmd[playernum].forwardmove = READSINT8(demo_p);
|
oldcmd[playernum].forwardmove = READSINT8(demo_p);
|
||||||
if (ziptic & ZT_SIDE)
|
|
||||||
oldcmd[playernum].sidemove = READSINT8(demo_p);
|
|
||||||
if (ziptic & ZT_ANGLE)
|
if (ziptic & ZT_ANGLE)
|
||||||
oldcmd[playernum].angleturn = READINT16(demo_p);
|
oldcmd[playernum].angleturn = READINT16(demo_p);
|
||||||
if (ziptic & ZT_BUTTONS)
|
if (ziptic & ZT_BUTTONS)
|
||||||
|
|
@ -5176,14 +5152,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
||||||
|
|
||||||
G_CopyTiccmd(cmd, &oldcmd[playernum], 1);
|
G_CopyTiccmd(cmd, &oldcmd[playernum], 1);
|
||||||
|
|
||||||
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
|
localangle[0] += (cmd->angleturn<<16);
|
||||||
if (((players[displayplayers[0]].mo && players[displayplayers[0]].speed > 0) // Moving
|
|
||||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
|
||||||
|| (players[displayplayers[0]].respawn.state != RESPAWNST_NONE) // Respawning
|
|
||||||
|| (players[displayplayers[0]].spectator || objectplacing)) // Not a physical player
|
|
||||||
&& !(players[displayplayers[0]].kartstuff[k_spinouttimer]
|
|
||||||
&& players[displayplayers[0]].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout
|
|
||||||
localangle[0] += (cmd->angleturn<<16);
|
|
||||||
|
|
||||||
if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER)
|
if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER)
|
||||||
{
|
{
|
||||||
|
|
@ -5209,13 +5178,6 @@ void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
||||||
ziptic |= ZT_FWD;
|
ziptic |= ZT_FWD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd->sidemove != oldcmd[playernum].sidemove)
|
|
||||||
{
|
|
||||||
WRITEUINT8(demo_p,cmd->sidemove);
|
|
||||||
oldcmd[playernum].sidemove = cmd->sidemove;
|
|
||||||
ziptic |= ZT_SIDE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd->angleturn != oldcmd[playernum].angleturn)
|
if (cmd->angleturn != oldcmd[playernum].angleturn)
|
||||||
{
|
{
|
||||||
WRITEINT16(demo_p,cmd->angleturn);
|
WRITEINT16(demo_p,cmd->angleturn);
|
||||||
|
|
@ -5729,8 +5691,6 @@ void G_GhostTicker(void)
|
||||||
|
|
||||||
if (ziptic & ZT_FWD)
|
if (ziptic & ZT_FWD)
|
||||||
g->p++;
|
g->p++;
|
||||||
if (ziptic & ZT_SIDE)
|
|
||||||
g->p++;
|
|
||||||
if (ziptic & ZT_ANGLE)
|
if (ziptic & ZT_ANGLE)
|
||||||
g->p += 2;
|
g->p += 2;
|
||||||
if (ziptic & ZT_BUTTONS)
|
if (ziptic & ZT_BUTTONS)
|
||||||
|
|
|
||||||
24
src/k_bot.c
24
src/k_bot.c
|
|
@ -474,6 +474,7 @@ fixed_t K_BotTopSpeedRubberband(player_t *player)
|
||||||
fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
||||||
{
|
{
|
||||||
fixed_t rubberband = K_BotRubberband(player) - FRACUNIT;
|
fixed_t rubberband = K_BotRubberband(player) - FRACUNIT;
|
||||||
|
fixed_t newfrict;
|
||||||
|
|
||||||
if (rubberband <= 0)
|
if (rubberband <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -481,8 +482,14 @@ fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict)
|
||||||
return frict;
|
return frict;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 128 is a magic number that felt good in-game
|
newfrict = FixedDiv(frict, FRACUNIT + (rubberband / 2));
|
||||||
return FixedDiv(frict, FRACUNIT + (rubberband / 2));
|
|
||||||
|
if (newfrict < 0)
|
||||||
|
newfrict = 0;
|
||||||
|
if (newfrict > FRACUNIT)
|
||||||
|
newfrict = FRACUNIT;
|
||||||
|
|
||||||
|
return newfrict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
|
|
@ -698,13 +705,16 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
||||||
// Start boost handler
|
// Start boost handler
|
||||||
if (leveltime <= starttime)
|
if (leveltime <= starttime)
|
||||||
{
|
{
|
||||||
tic_t boosthold = starttime - TICRATE;
|
tic_t length = (TICRATE/6);
|
||||||
|
tic_t boosthold = starttime - K_GetSpindashChargeTime(player);
|
||||||
|
|
||||||
boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty);
|
cmd->buttons |= BT_EBRAKEMASK;
|
||||||
|
|
||||||
|
boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty) * length;
|
||||||
|
|
||||||
if (leveltime >= boosthold)
|
if (leveltime >= boosthold)
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_ACCELERATE;
|
cmd->buttons |= BT_DRIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -741,7 +751,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
||||||
if (anglediff > 90)
|
if (anglediff > 90)
|
||||||
{
|
{
|
||||||
// Wrong way!
|
// Wrong way!
|
||||||
cmd->forwardmove = -25;
|
cmd->forwardmove = -MAXPLMOVE;
|
||||||
cmd->buttons |= BT_BRAKE;
|
cmd->buttons |= BT_BRAKE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -775,7 +785,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
||||||
cmd->buttons |= BT_ACCELERATE;
|
cmd->buttons |= BT_ACCELERATE;
|
||||||
|
|
||||||
// Full speed ahead!
|
// Full speed ahead!
|
||||||
cmd->forwardmove = 50;
|
cmd->forwardmove = MAXPLMOVE;
|
||||||
|
|
||||||
if (dirdist <= rad)
|
if (dirdist <= rad)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
676
src/k_kart.c
676
src/k_kart.c
|
|
@ -27,6 +27,7 @@
|
||||||
#include "f_finale.h"
|
#include "f_finale.h"
|
||||||
#include "lua_hud.h" // For Lua hud checks
|
#include "lua_hud.h" // For Lua hud checks
|
||||||
#include "lua_hook.h" // For MobjDamage and ShouldDamage
|
#include "lua_hook.h" // For MobjDamage and ShouldDamage
|
||||||
|
#include "m_cheat.h" // objectplacing
|
||||||
|
|
||||||
#include "k_waypoint.h"
|
#include "k_waypoint.h"
|
||||||
#include "k_bot.h"
|
#include "k_bot.h"
|
||||||
|
|
@ -1142,10 +1143,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
||||||
|
|
||||||
{ // Normalize distance to the sum of the two objects' radii, since in a perfect world that would be the distance at the point of collision...
|
{ // Normalize distance to the sum of the two objects' radii, since in a perfect world that would be the distance at the point of collision...
|
||||||
fixed_t dist = P_AproxDistance(distx, disty);
|
fixed_t dist = P_AproxDistance(distx, disty);
|
||||||
fixed_t nx = FixedDiv(distx, dist);
|
fixed_t nx, ny;
|
||||||
fixed_t ny = FixedDiv(disty, dist);
|
|
||||||
|
|
||||||
dist = dist ? dist : 1;
|
dist = dist ? dist : 1;
|
||||||
|
|
||||||
|
nx = FixedDiv(distx, dist);
|
||||||
|
ny = FixedDiv(disty, dist);
|
||||||
|
|
||||||
distx = FixedMul(mobj1->radius+mobj2->radius, nx);
|
distx = FixedMul(mobj1->radius+mobj2->radius, nx);
|
||||||
disty = FixedMul(mobj1->radius+mobj2->radius, ny);
|
disty = FixedMul(mobj1->radius+mobj2->radius, ny);
|
||||||
|
|
||||||
|
|
@ -1221,6 +1225,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
||||||
mobj1->player->rmomx = mobj1->momx - mobj1->player->cmomx;
|
mobj1->player->rmomx = mobj1->momx - mobj1->player->cmomx;
|
||||||
mobj1->player->rmomy = mobj1->momy - mobj1->player->cmomy;
|
mobj1->player->rmomy = mobj1->momy - mobj1->player->cmomy;
|
||||||
mobj1->player->kartstuff[k_justbumped] = bumptime;
|
mobj1->player->kartstuff[k_justbumped] = bumptime;
|
||||||
|
mobj1->player->kartstuff[k_spindash] = 0;
|
||||||
|
|
||||||
if (mobj1->player->kartstuff[k_spinouttimer])
|
if (mobj1->player->kartstuff[k_spinouttimer])
|
||||||
{
|
{
|
||||||
|
|
@ -1246,6 +1251,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
||||||
mobj2->player->rmomx = mobj2->momx - mobj2->player->cmomx;
|
mobj2->player->rmomx = mobj2->momx - mobj2->player->cmomx;
|
||||||
mobj2->player->rmomy = mobj2->momy - mobj2->player->cmomy;
|
mobj2->player->rmomy = mobj2->momy - mobj2->player->cmomy;
|
||||||
mobj2->player->kartstuff[k_justbumped] = bumptime;
|
mobj2->player->kartstuff[k_justbumped] = bumptime;
|
||||||
|
mobj2->player->kartstuff[k_spindash] = 0;
|
||||||
|
|
||||||
if (mobj2->player->kartstuff[k_spinouttimer])
|
if (mobj2->player->kartstuff[k_spinouttimer])
|
||||||
{
|
{
|
||||||
|
|
@ -1438,6 +1444,10 @@ static void K_UpdateDraft(player_t *player)
|
||||||
if (players[i].speed < 20*players[i].mo->scale)
|
if (players[i].speed < 20*players[i].mo->scale)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// No tethering off of the guy who got the starting bonus :P
|
||||||
|
if (players[i].kartstuff[k_startboost] > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
#ifndef EASYDRAFTTEST
|
#ifndef EASYDRAFTTEST
|
||||||
yourangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
yourangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||||
theirangle = R_PointToAngle2(0, 0, players[i].mo->momx, players[i].mo->momy);
|
theirangle = R_PointToAngle2(0, 0, players[i].mo->momx, players[i].mo->momy);
|
||||||
|
|
@ -1625,7 +1635,7 @@ void K_SpawnDashDustRelease(player_t *player)
|
||||||
if (!P_IsObjectOnGround(player->mo))
|
if (!P_IsObjectOnGround(player->mo))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player->speed && !player->kartstuff[k_startboost])
|
if (!player->speed && !player->kartstuff[k_startboost] && !player->kartstuff[k_spindash])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
travelangle = player->mo->angle;
|
travelangle = player->mo->angle;
|
||||||
|
|
@ -2037,6 +2047,21 @@ static fixed_t K_FlameShieldDashVar(INT32 val)
|
||||||
return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2);
|
return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tic_t K_GetSpindashChargeTime(player_t *player)
|
||||||
|
{
|
||||||
|
// more charge time for higher speed
|
||||||
|
// Tails = 2s, Mighty = 3s, Fang = 4s, Metal = 4s
|
||||||
|
return (player->kartspeed + 4) * (TICRATE/3);
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed_t K_GetSpindashChargeSpeed(player_t *player)
|
||||||
|
{
|
||||||
|
// more speed for higher weight & speed
|
||||||
|
// Tails = +6.25%, Fang = +20.31%, Mighty = +20.31%, Metal = +25%
|
||||||
|
// (can be higher than this value when overcharged)
|
||||||
|
return (player->kartspeed + player->kartweight) * (FRACUNIT/64);
|
||||||
|
}
|
||||||
|
|
||||||
// Light weights have stronger boost stacking -- aka, better metabolism than heavies XD
|
// Light weights have stronger boost stacking -- aka, better metabolism than heavies XD
|
||||||
#define METABOLISM
|
#define METABOLISM
|
||||||
|
|
||||||
|
|
@ -2069,8 +2094,8 @@ static void K_GetKartBoostPower(player_t *player)
|
||||||
|
|
||||||
#define ADDBOOST(s,a) { \
|
#define ADDBOOST(s,a) { \
|
||||||
numboosts++; \
|
numboosts++; \
|
||||||
speedboost += FixedDiv(s, FRACUNIT + (metabolism * numboosts-1)); \
|
speedboost += FixedDiv(s, FRACUNIT + (metabolism * (numboosts-1))); \
|
||||||
accelboost += FixedDiv(a, FRACUNIT + (metabolism * numboosts-1)); \
|
accelboost += FixedDiv(a, FRACUNIT + (metabolism * (numboosts-1))); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
@ -2102,9 +2127,20 @@ static void K_GetKartBoostPower(player_t *player)
|
||||||
ADDBOOST(K_FlameShieldDashVar(player->kartstuff[k_flamedash]), 3*FRACUNIT); // + infinite top speed, + 300% acceleration
|
ADDBOOST(K_FlameShieldDashVar(player->kartstuff[k_flamedash]), 3*FRACUNIT); // + infinite top speed, + 300% acceleration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player->kartstuff[k_spindashboost]) // Spindash boost
|
||||||
|
{
|
||||||
|
const fixed_t MAXCHARGESPEED = K_GetSpindashChargeSpeed(player);
|
||||||
|
|
||||||
|
// character & charge dependent
|
||||||
|
ADDBOOST(
|
||||||
|
FixedMul(MAXCHARGESPEED, player->kartstuff[k_spindashspeed]), // + 0 to K_GetSpindashChargeSpeed()% top speed
|
||||||
|
(4*FRACUNIT) + (36*player->kartstuff[k_spindashspeed]) // + 400% to 4000% acceleration
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_startboost]) // Startup Boost
|
if (player->kartstuff[k_startboost]) // Startup Boost
|
||||||
{
|
{
|
||||||
ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration
|
ADDBOOST(FRACUNIT/2, 4*FRACUNIT); // + 50% top speed, + 400% acceleration
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_driftboost]) // Drift Boost
|
if (player->kartstuff[k_driftboost]) // Drift Boost
|
||||||
|
|
@ -2235,13 +2271,32 @@ UINT16 K_GetKartFlashing(player_t *player)
|
||||||
return tics;
|
return tics;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove)
|
SINT8 K_GetForwardMove(player_t *player)
|
||||||
|
{
|
||||||
|
SINT8 forwardmove = player->cmd.forwardmove;
|
||||||
|
|
||||||
|
if ((player->pflags & PF_STASIS) || (player->pflags & PF_SLIDING) || player->kartstuff[k_spinouttimer] || K_PlayerEBrake(player))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->kartstuff[k_sneakertimer] || player->kartstuff[k_spindashboost])
|
||||||
|
{
|
||||||
|
return MAXPLMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return forwardmove;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed_t K_3dKartMovement(player_t *player, boolean onground)
|
||||||
{
|
{
|
||||||
const fixed_t accelmax = 4000;
|
const fixed_t accelmax = 4000;
|
||||||
const fixed_t p_speed = K_GetKartSpeed(player, true);
|
const fixed_t p_speed = K_GetKartSpeed(player, true);
|
||||||
const fixed_t p_accel = K_GetKartAccel(player);
|
const fixed_t p_accel = K_GetKartAccel(player);
|
||||||
fixed_t newspeed, oldspeed, finalspeed;
|
fixed_t newspeed, oldspeed, finalspeed;
|
||||||
|
fixed_t movemul = FRACUNIT;
|
||||||
fixed_t orig = ORIG_FRICTION;
|
fixed_t orig = ORIG_FRICTION;
|
||||||
|
SINT8 forwardmove = K_GetForwardMove(player);
|
||||||
|
|
||||||
if (!onground) return 0; // If the player isn't on the ground, there is no change in speed
|
if (!onground) return 0; // If the player isn't on the ground, there is no change in speed
|
||||||
|
|
||||||
|
|
@ -2270,26 +2325,20 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
|
||||||
}
|
}
|
||||||
|
|
||||||
finalspeed = newspeed - oldspeed;
|
finalspeed = newspeed - oldspeed;
|
||||||
|
movemul = abs(forwardmove * FRACUNIT) / 50;
|
||||||
|
|
||||||
// forwardmove is:
|
// forwardmove is:
|
||||||
// 50 while accelerating,
|
// 50 while accelerating,
|
||||||
// 25 while clutching,
|
|
||||||
// 0 with no gas, and
|
// 0 with no gas, and
|
||||||
// -25 when only braking.
|
// -25 when only braking.
|
||||||
|
if (forwardmove >= 0)
|
||||||
if (player->kartstuff[k_sneakertimer])
|
{
|
||||||
forwardmove = 50;
|
finalspeed = FixedMul(finalspeed, movemul);
|
||||||
|
}
|
||||||
finalspeed *= forwardmove/25;
|
else
|
||||||
finalspeed /= 2;
|
{
|
||||||
|
finalspeed = FixedMul(-mapobjectscale/2, movemul);
|
||||||
if (forwardmove < 0 && finalspeed > mapobjectscale*2)
|
}
|
||||||
return finalspeed/2;
|
|
||||||
else if (forwardmove < 0)
|
|
||||||
return -mapobjectscale/2;
|
|
||||||
|
|
||||||
if (finalspeed < 0)
|
|
||||||
finalspeed = 0;
|
|
||||||
|
|
||||||
return finalspeed;
|
return finalspeed;
|
||||||
}
|
}
|
||||||
|
|
@ -3549,7 +3598,7 @@ void K_DriftDustHandling(mobj_t *spawner)
|
||||||
if (spawner->player->speed < 5*spawner->scale)
|
if (spawner->player->speed < 5*spawner->scale)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (spawner->player->cmd.forwardmove < 0)
|
if (K_GetForwardMove(spawner->player) < 0)
|
||||||
playerangle += ANGLE_180;
|
playerangle += ANGLE_180;
|
||||||
|
|
||||||
anglediff = abs((signed)(playerangle - R_PointToAngle2(0, 0, spawner->player->rmomx, spawner->player->rmomy)));
|
anglediff = abs((signed)(playerangle - R_PointToAngle2(0, 0, spawner->player->rmomx, spawner->player->rmomy)));
|
||||||
|
|
@ -5129,10 +5178,12 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->respawn.state == RESPAWNST_DROP)) // Startup boosts
|
if (player->respawn.state == RESPAWNST_DROP) // Dropdashing
|
||||||
targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0);
|
targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0);
|
||||||
|
else if (K_PlayerEBrake(player) == true) // Spindashing
|
||||||
|
targetsnd = ((cmd->buttons & BT_DRIFT) ? 12 : 0);
|
||||||
else
|
else
|
||||||
targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2;
|
targetsnd = (((6*K_GetForwardMove(player))/25) + ((player->speed / mapobjectscale)/5))/2;
|
||||||
|
|
||||||
if (targetsnd < 0)
|
if (targetsnd < 0)
|
||||||
targetsnd = 0;
|
targetsnd = 0;
|
||||||
|
|
@ -5242,6 +5293,11 @@ void K_KartPlayerHUDUpdate(player_t *player)
|
||||||
if (player->karthud[khud_tauntvoices])
|
if (player->karthud[khud_tauntvoices])
|
||||||
player->karthud[khud_tauntvoices]--;
|
player->karthud[khud_tauntvoices]--;
|
||||||
|
|
||||||
|
if (!(player->pflags & PF_SKIDDOWN))
|
||||||
|
player->karthud[khud_fault] = 0;
|
||||||
|
else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE)
|
||||||
|
player->karthud[khud_fault]++;
|
||||||
|
|
||||||
if (G_RaceGametype())
|
if (G_RaceGametype())
|
||||||
{
|
{
|
||||||
// 0 is the fast spin animation, set at 30 tics of ring boost or higher!
|
// 0 is the fast spin animation, set at 30 tics of ring boost or higher!
|
||||||
|
|
@ -5711,6 +5767,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
if (player->kartstuff[k_startboost])
|
if (player->kartstuff[k_startboost])
|
||||||
player->kartstuff[k_startboost]--;
|
player->kartstuff[k_startboost]--;
|
||||||
|
|
||||||
|
if (player->kartstuff[k_spindashboost])
|
||||||
|
{
|
||||||
|
player->kartstuff[k_spindashboost]--;
|
||||||
|
|
||||||
|
if (player->kartstuff[k_spindashboost] <= 0)
|
||||||
|
{
|
||||||
|
player->kartstuff[k_spindashspeed] = player->kartstuff[k_spindashboost] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_invincibilitytimer])
|
if (player->kartstuff[k_invincibilitytimer])
|
||||||
player->kartstuff[k_invincibilitytimer]--;
|
player->kartstuff[k_invincibilitytimer]--;
|
||||||
|
|
||||||
|
|
@ -5767,7 +5833,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->kartstuff[k_justbumped])
|
if (player->kartstuff[k_justbumped] > 0)
|
||||||
player->kartstuff[k_justbumped]--;
|
player->kartstuff[k_justbumped]--;
|
||||||
|
|
||||||
if (player->kartstuff[k_tiregrease])
|
if (player->kartstuff[k_tiregrease])
|
||||||
|
|
@ -6358,15 +6424,37 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||||
|
|
||||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
||||||
{
|
{
|
||||||
fixed_t p_maxspeed = K_GetKartSpeed(player, false);
|
fixed_t p_maxspeed;
|
||||||
fixed_t p_speed = min(player->speed, (p_maxspeed * 2));
|
fixed_t p_speed;
|
||||||
fixed_t weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT));
|
fixed_t weightadjust;
|
||||||
|
|
||||||
if (player->spectator)
|
if ((player->mo == NULL || P_MobjWasRemoved(player->mo)))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->spectator || objectplacing)
|
||||||
{
|
{
|
||||||
return turnvalue;
|
return turnvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (leveltime < introtime)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SRB2kart - no additional angle if not moving
|
||||||
|
if ((player->speed <= 0) // Not moving
|
||||||
|
&& ((player->cmd.buttons & BT_EBRAKEMASK) != BT_EBRAKEMASK) // not e-braking
|
||||||
|
&& (player->respawn.state == RESPAWNST_NONE)) // Not respawning
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_maxspeed = K_GetKartSpeed(player, false);
|
||||||
|
p_speed = min(player->speed, (p_maxspeed * 2));
|
||||||
|
weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT));
|
||||||
|
|
||||||
if (K_PlayerUsesBotMovement(player))
|
if (K_PlayerUsesBotMovement(player))
|
||||||
{
|
{
|
||||||
turnvalue = 5*turnvalue/4; // Base increase to turning
|
turnvalue = 5*turnvalue/4; // Base increase to turning
|
||||||
|
|
@ -6428,7 +6516,7 @@ Stage 1: red sparks
|
||||||
Stage 2: blue sparks
|
Stage 2: blue sparks
|
||||||
Stage 3: big large rainbow sparks
|
Stage 3: big large rainbow sparks
|
||||||
*/
|
*/
|
||||||
static void K_SpawnDriftBoostExplosion(player_t *player, int stage)
|
void K_SpawnDriftBoostExplosion(player_t *player, int stage)
|
||||||
{
|
{
|
||||||
mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_DRIFTEXPLODE);
|
mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_DRIFTEXPLODE);
|
||||||
|
|
||||||
|
|
@ -6828,6 +6916,91 @@ static INT32 K_FlameShieldMax(player_t *player)
|
||||||
return min(16, 1 + (disttofinish / distv));
|
return min(16, 1 + (disttofinish / distv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean K_PlayerEBrake(player_t *player)
|
||||||
|
{
|
||||||
|
return (player->cmd.buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK
|
||||||
|
&& P_IsObjectOnGround(player->mo) == true
|
||||||
|
&& player->kartstuff[k_drift] == 0
|
||||||
|
&& player->kartstuff[k_spinouttimer] == 0
|
||||||
|
&& player->kartstuff[k_justbumped] == 0
|
||||||
|
&& player->kartstuff[k_spindash] >= 0
|
||||||
|
&& player->kartstuff[k_spindashboost] == 0
|
||||||
|
&& player->powers[pw_nocontrol] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void K_KartSpindash(player_t *player)
|
||||||
|
{
|
||||||
|
const tic_t MAXCHARGETIME = K_GetSpindashChargeTime(player);
|
||||||
|
ticcmd_t *cmd = &player->cmd;
|
||||||
|
|
||||||
|
if (player->kartstuff[k_spindash] > 0 && (cmd->buttons & (BT_DRIFT|BT_BRAKE)) != (BT_DRIFT|BT_BRAKE))
|
||||||
|
{
|
||||||
|
player->kartstuff[k_spindashspeed] = (player->kartstuff[k_spindash] * FRACUNIT) / MAXCHARGETIME;
|
||||||
|
player->kartstuff[k_spindashboost] = TICRATE;
|
||||||
|
|
||||||
|
if (!player->kartstuff[k_tiregrease])
|
||||||
|
{
|
||||||
|
UINT8 i;
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
mobj_t *grease;
|
||||||
|
grease = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_TIREGREASE);
|
||||||
|
P_SetTarget(&grease->target, player->mo);
|
||||||
|
grease->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||||
|
grease->extravalue1 = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player->kartstuff[k_tiregrease] = 2*TICRATE;
|
||||||
|
|
||||||
|
player->kartstuff[k_spindash] = 0;
|
||||||
|
S_StartSound(player->mo, sfx_s23c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (K_PlayerEBrake(player) == false)
|
||||||
|
{
|
||||||
|
player->kartstuff[k_spindash] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->speed < 6*mapobjectscale && player->powers[pw_flashing] == 0)
|
||||||
|
{
|
||||||
|
if (cmd->driftturn != 0 && leveltime % 8 == 0)
|
||||||
|
S_StartSound(player->mo, sfx_ruburn);
|
||||||
|
|
||||||
|
if ((cmd->buttons & (BT_DRIFT|BT_BRAKE)) == (BT_DRIFT|BT_BRAKE))
|
||||||
|
{
|
||||||
|
INT16 chargetime = MAXCHARGETIME - ++player->kartstuff[k_spindash];
|
||||||
|
if (chargetime > 0)
|
||||||
|
{
|
||||||
|
UINT16 soundcharge = 0;
|
||||||
|
UINT8 add = 0;
|
||||||
|
while ((soundcharge += ++add) < chargetime);
|
||||||
|
if (soundcharge == chargetime)
|
||||||
|
{
|
||||||
|
K_SpawnDashDustRelease(player);
|
||||||
|
S_StartSound(player->mo, sfx_s3kab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (chargetime < -TICRATE)
|
||||||
|
K_SpinPlayer(player, NULL, 0, NULL, false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (player->kartstuff[k_spindash] % 4 == 0)
|
||||||
|
{
|
||||||
|
K_SpawnDashDustRelease(player);
|
||||||
|
K_FlameDashLeftoverSmoke(player->mo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (leveltime % 4 == 0)
|
||||||
|
S_StartSound(player->mo, sfx_kc2b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// K_MoveKartPlayer
|
// K_MoveKartPlayer
|
||||||
//
|
//
|
||||||
|
|
@ -6876,7 +7049,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
else if (cmd->buttons & BT_ATTACK)
|
else if (cmd->buttons & BT_ATTACK)
|
||||||
player->pflags |= PF_ATTACKDOWN;
|
player->pflags |= PF_ATTACKDOWN;
|
||||||
|
|
||||||
if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > starttime
|
if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > introtime
|
||||||
&& player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawn.state == RESPAWNST_NONE))
|
&& player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawn.state == RESPAWNST_NONE))
|
||||||
{
|
{
|
||||||
// First, the really specific, finicky items that function without the item being directly in your item slot.
|
// First, the really specific, finicky items that function without the item being directly in your item slot.
|
||||||
|
|
@ -7509,6 +7682,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads
|
||||||
|
|
||||||
if (onground)
|
if (onground)
|
||||||
{
|
{
|
||||||
fixed_t prevfriction = player->mo->friction;
|
fixed_t prevfriction = player->mo->friction;
|
||||||
|
|
@ -7517,16 +7692,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
if (player->kartstuff[k_tiregrease])
|
if (player->kartstuff[k_tiregrease])
|
||||||
player->mo->friction += ((FRACUNIT - prevfriction) / greasetics) * player->kartstuff[k_tiregrease];
|
player->mo->friction += ((FRACUNIT - prevfriction) / greasetics) * player->kartstuff[k_tiregrease];
|
||||||
|
|
||||||
// Friction
|
/*
|
||||||
if (!player->kartstuff[k_offroad])
|
if (K_PlayerEBrake(player) == true)
|
||||||
{
|
player->mo->friction -= 1024;
|
||||||
if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392)
|
else if (player->speed > 0 && cmd->forwardmove < 0)
|
||||||
player->mo->friction += 4608;
|
player->mo->friction -= 512;
|
||||||
}
|
*/
|
||||||
|
|
||||||
// change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel
|
|
||||||
if (player->speed > 0 && cmd->forwardmove < 0)
|
|
||||||
player->mo->friction -= 2048;
|
|
||||||
|
|
||||||
// Karma ice physics
|
// Karma ice physics
|
||||||
if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
|
if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0)
|
||||||
|
|
@ -7544,14 +7715,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
player->mo->friction -= 9824;
|
player->mo->friction -= 9824;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friction was changed, so we must recalculate a bunch of stuff
|
// Cap between intended values
|
||||||
|
if (player->mo->friction > FRACUNIT)
|
||||||
|
player->mo->friction = FRACUNIT;
|
||||||
|
if (player->mo->friction < 0)
|
||||||
|
player->mo->friction = 0;
|
||||||
|
|
||||||
|
// Friction was changed, so we must recalculate movefactor
|
||||||
if (player->mo->friction != prevfriction)
|
if (player->mo->friction != prevfriction)
|
||||||
{
|
{
|
||||||
if (player->mo->friction > FRACUNIT)
|
|
||||||
player->mo->friction = FRACUNIT;
|
|
||||||
if (player->mo->friction < 0)
|
|
||||||
player->mo->friction = 0;
|
|
||||||
|
|
||||||
player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->friction);
|
player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->friction);
|
||||||
|
|
||||||
if (player->mo->movefactor < FRACUNIT)
|
if (player->mo->movefactor < FRACUNIT)
|
||||||
|
|
@ -7571,16 +7743,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads
|
K_KartSpindash(player);
|
||||||
|
|
||||||
// Quick Turning
|
|
||||||
// You can't turn your kart when you're not moving.
|
|
||||||
// So now it's time to burn some rubber!
|
|
||||||
if (player->speed < 2 && leveltime > starttime && cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE && cmd->driftturn != 0)
|
|
||||||
{
|
|
||||||
if (leveltime % 8 == 0)
|
|
||||||
S_StartSound(player->mo, sfx_s224);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Squishing
|
// Squishing
|
||||||
// If a Grow player or a sector crushes you, get flattened instead of being killed.
|
// If a Grow player or a sector crushes you, get flattened instead of being killed.
|
||||||
|
|
@ -7603,76 +7766,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
||||||
S_StopMusic(); // The GO! sound stops the level start ambience
|
S_StopMusic(); // The GO! sound stops the level start ambience
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start charging once you're given the opportunity.
|
|
||||||
if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime)
|
|
||||||
{
|
|
||||||
if (cmd->buttons & BT_ACCELERATE)
|
|
||||||
{
|
|
||||||
if (player->kartstuff[k_boostcharge] == 0)
|
|
||||||
player->kartstuff[k_boostcharge] = cmd->latency;
|
|
||||||
|
|
||||||
player->kartstuff[k_boostcharge]++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
player->kartstuff[k_boostcharge] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increase your size while charging your engine.
|
|
||||||
if (leveltime < starttime+10)
|
|
||||||
{
|
|
||||||
player->mo->scalespeed = mapobjectscale/12;
|
|
||||||
player->mo->destscale = mapobjectscale + (player->kartstuff[k_boostcharge]*131);
|
|
||||||
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
|
|
||||||
player->mo->destscale = (6*player->mo->destscale)/8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the outcome of your charge.
|
|
||||||
if (leveltime > starttime && player->kartstuff[k_boostcharge])
|
|
||||||
{
|
|
||||||
// Not even trying?
|
|
||||||
if (player->kartstuff[k_boostcharge] < 35)
|
|
||||||
{
|
|
||||||
if (player->kartstuff[k_boostcharge] > 17)
|
|
||||||
S_StartSound(player->mo, sfx_cdfm00); // chosen instead of a conventional skid because it's more engine-like
|
|
||||||
}
|
|
||||||
// Get an instant boost!
|
|
||||||
else if (player->kartstuff[k_boostcharge] <= 50)
|
|
||||||
{
|
|
||||||
player->kartstuff[k_startboost] = (50-player->kartstuff[k_boostcharge])+20;
|
|
||||||
|
|
||||||
if (player->kartstuff[k_boostcharge] <= 36)
|
|
||||||
{
|
|
||||||
player->kartstuff[k_startboost] = 0;
|
|
||||||
K_DoSneaker(player, 0);
|
|
||||||
player->kartstuff[k_sneakertimer] = 70; // PERFECT BOOST!!
|
|
||||||
|
|
||||||
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) // Let everyone hear this one
|
|
||||||
S_StartSound(player->mo, sfx_s25f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
K_SpawnDashDustRelease(player); // already handled for perfect boosts by K_DoSneaker
|
|
||||||
if ((!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) && P_IsDisplayPlayer(player))
|
|
||||||
{
|
|
||||||
if (player->kartstuff[k_boostcharge] <= 40)
|
|
||||||
S_StartSound(player->mo, sfx_cdfm01); // You were almost there!
|
|
||||||
else
|
|
||||||
S_StartSound(player->mo, sfx_s23c); // Nope, better luck next time.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// You overcharged your engine? Those things are expensive!!!
|
|
||||||
else if (player->kartstuff[k_boostcharge] > 50)
|
|
||||||
{
|
|
||||||
player->powers[pw_nocontrol] = 40;
|
|
||||||
//S_StartSound(player->mo, sfx_kc34);
|
|
||||||
S_StartSound(player->mo, sfx_s3k83);
|
|
||||||
player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse
|
|
||||||
}
|
|
||||||
|
|
||||||
player->kartstuff[k_boostcharge] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_CheckSpectateStatus(void)
|
void K_CheckSpectateStatus(void)
|
||||||
|
|
@ -7794,7 +7887,14 @@ static patch_t *kp_karmasticker;
|
||||||
static patch_t *kp_splitkarmabomb;
|
static patch_t *kp_splitkarmabomb;
|
||||||
static patch_t *kp_timeoutsticker;
|
static patch_t *kp_timeoutsticker;
|
||||||
|
|
||||||
static patch_t *kp_startcountdown[16];
|
static patch_t *kp_prestartbulb[15];
|
||||||
|
static patch_t *kp_prestartletters[7];
|
||||||
|
|
||||||
|
static patch_t *kp_prestartbulb_split[15];
|
||||||
|
static patch_t *kp_prestartletters_split[7];
|
||||||
|
|
||||||
|
static patch_t *kp_startcountdown[20];
|
||||||
|
static patch_t *kp_racefault[6];
|
||||||
static patch_t *kp_racefinish[6];
|
static patch_t *kp_racefinish[6];
|
||||||
|
|
||||||
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
|
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
|
||||||
|
|
@ -7910,24 +8010,72 @@ void K_LoadKartHUDGraphics(void)
|
||||||
kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX);
|
kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX);
|
||||||
kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX);
|
kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX);
|
||||||
|
|
||||||
|
// Pre-start countdown bulbs
|
||||||
|
sprintf(buffer, "K_BULBxx");
|
||||||
|
for (i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
buffer[6] = '0'+((i+1)/10);
|
||||||
|
buffer[7] = '0'+((i+1)%10);
|
||||||
|
kp_prestartbulb[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buffer, "K_SBLBxx");
|
||||||
|
for (i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
buffer[6] = '0'+((i+1)/10);
|
||||||
|
buffer[7] = '0'+((i+1)%10);
|
||||||
|
kp_prestartbulb_split[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pre-start position letters
|
||||||
|
kp_prestartletters[0] = W_CachePatchName("K_PL_P", PU_HUDGFX);
|
||||||
|
kp_prestartletters[1] = W_CachePatchName("K_PL_O", PU_HUDGFX);
|
||||||
|
kp_prestartletters[2] = W_CachePatchName("K_PL_S", PU_HUDGFX);
|
||||||
|
kp_prestartletters[3] = W_CachePatchName("K_PL_I", PU_HUDGFX);
|
||||||
|
kp_prestartletters[4] = W_CachePatchName("K_PL_T", PU_HUDGFX);
|
||||||
|
kp_prestartletters[5] = W_CachePatchName("K_PL_N", PU_HUDGFX);
|
||||||
|
kp_prestartletters[6] = W_CachePatchName("K_PL_EX", PU_HUDGFX);
|
||||||
|
|
||||||
|
kp_prestartletters_split[0] = W_CachePatchName("K_SPL_P", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[1] = W_CachePatchName("K_SPL_O", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[2] = W_CachePatchName("K_SPL_S", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[3] = W_CachePatchName("K_SPL_I", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[4] = W_CachePatchName("K_SPL_T", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[5] = W_CachePatchName("K_SPL_N", PU_HUDGFX);
|
||||||
|
kp_prestartletters_split[6] = W_CachePatchName("K_SPL_EX", PU_HUDGFX);
|
||||||
|
|
||||||
// Starting countdown
|
// Starting countdown
|
||||||
kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX);
|
kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX);
|
||||||
kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX);
|
kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX);
|
||||||
kp_startcountdown[2] = W_CachePatchName("K_CNT1A", PU_HUDGFX);
|
kp_startcountdown[2] = W_CachePatchName("K_CNT1A", PU_HUDGFX);
|
||||||
kp_startcountdown[3] = W_CachePatchName("K_CNTGOA", PU_HUDGFX);
|
kp_startcountdown[3] = W_CachePatchName("K_CNTGOA", PU_HUDGFX);
|
||||||
kp_startcountdown[4] = W_CachePatchName("K_CNT3B", PU_HUDGFX);
|
kp_startcountdown[4] = W_CachePatchName("K_DUEL1", PU_HUDGFX);
|
||||||
kp_startcountdown[5] = W_CachePatchName("K_CNT2B", PU_HUDGFX);
|
kp_startcountdown[5] = W_CachePatchName("K_CNT3B", PU_HUDGFX);
|
||||||
kp_startcountdown[6] = W_CachePatchName("K_CNT1B", PU_HUDGFX);
|
kp_startcountdown[6] = W_CachePatchName("K_CNT2B", PU_HUDGFX);
|
||||||
kp_startcountdown[7] = W_CachePatchName("K_CNTGOB", PU_HUDGFX);
|
kp_startcountdown[7] = W_CachePatchName("K_CNT1B", PU_HUDGFX);
|
||||||
|
kp_startcountdown[8] = W_CachePatchName("K_CNTGOB", PU_HUDGFX);
|
||||||
|
kp_startcountdown[9] = W_CachePatchName("K_DUEL2", PU_HUDGFX);
|
||||||
// Splitscreen
|
// Splitscreen
|
||||||
kp_startcountdown[8] = W_CachePatchName("K_SMC3A", PU_HUDGFX);
|
kp_startcountdown[10] = W_CachePatchName("K_SMC3A", PU_HUDGFX);
|
||||||
kp_startcountdown[9] = W_CachePatchName("K_SMC2A", PU_HUDGFX);
|
kp_startcountdown[11] = W_CachePatchName("K_SMC2A", PU_HUDGFX);
|
||||||
kp_startcountdown[10] = W_CachePatchName("K_SMC1A", PU_HUDGFX);
|
kp_startcountdown[12] = W_CachePatchName("K_SMC1A", PU_HUDGFX);
|
||||||
kp_startcountdown[11] = W_CachePatchName("K_SMCGOA", PU_HUDGFX);
|
kp_startcountdown[13] = W_CachePatchName("K_SMCGOA", PU_HUDGFX);
|
||||||
kp_startcountdown[12] = W_CachePatchName("K_SMC3B", PU_HUDGFX);
|
kp_startcountdown[14] = W_CachePatchName("K_SDUEL1", PU_HUDGFX);
|
||||||
kp_startcountdown[13] = W_CachePatchName("K_SMC2B", PU_HUDGFX);
|
kp_startcountdown[15] = W_CachePatchName("K_SMC3B", PU_HUDGFX);
|
||||||
kp_startcountdown[14] = W_CachePatchName("K_SMC1B", PU_HUDGFX);
|
kp_startcountdown[16] = W_CachePatchName("K_SMC2B", PU_HUDGFX);
|
||||||
kp_startcountdown[15] = W_CachePatchName("K_SMCGOB", PU_HUDGFX);
|
kp_startcountdown[17] = W_CachePatchName("K_SMC1B", PU_HUDGFX);
|
||||||
|
kp_startcountdown[18] = W_CachePatchName("K_SMCGOB", PU_HUDGFX);
|
||||||
|
kp_startcountdown[19] = W_CachePatchName("K_SDUEL2", PU_HUDGFX);
|
||||||
|
|
||||||
|
// Fault
|
||||||
|
kp_racefault[0] = W_CachePatchName("K_FAULTA", PU_HUDGFX);
|
||||||
|
kp_racefault[1] = W_CachePatchName("K_FAULTB", PU_HUDGFX);
|
||||||
|
// Splitscreen
|
||||||
|
kp_racefault[2] = W_CachePatchName("K_SMFLTA", PU_HUDGFX);
|
||||||
|
kp_racefault[3] = W_CachePatchName("K_SMFLTB", PU_HUDGFX);
|
||||||
|
// 2P splitscreen
|
||||||
|
kp_racefault[4] = W_CachePatchName("K_2PFLTA", PU_HUDGFX);
|
||||||
|
kp_racefault[5] = W_CachePatchName("K_2PFLTB", PU_HUDGFX);
|
||||||
|
|
||||||
// Finish
|
// Finish
|
||||||
kp_racefinish[0] = W_CachePatchName("K_FINA", PU_HUDGFX);
|
kp_racefinish[0] = W_CachePatchName("K_FINA", PU_HUDGFX);
|
||||||
|
|
@ -10487,22 +10635,240 @@ static void K_drawKartMinimap(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void K_drawKartStartBulbs(void)
|
||||||
|
{
|
||||||
|
const UINT8 start_animation[14] = {
|
||||||
|
1, 2, 3, 4, 5, 6, 7, 8,
|
||||||
|
7, 6,
|
||||||
|
9, 10, 11, 12
|
||||||
|
};
|
||||||
|
|
||||||
|
const UINT8 loop_animation[4] = {
|
||||||
|
12, 13, 12, 14
|
||||||
|
};
|
||||||
|
|
||||||
|
const UINT8 chillloop_animation[2] = {
|
||||||
|
11, 12
|
||||||
|
};
|
||||||
|
|
||||||
|
const UINT8 letters_order[10] = {
|
||||||
|
0, 1, 2, 3, 4, 3, 1, 5, 6, 6
|
||||||
|
};
|
||||||
|
|
||||||
|
const UINT8 letters_transparency[40] = {
|
||||||
|
0, 2, 4, 6, 8,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 8, 6, 4, 2
|
||||||
|
};
|
||||||
|
|
||||||
|
fixed_t spacing = 24*FRACUNIT;
|
||||||
|
|
||||||
|
fixed_t startx = (BASEVIDWIDTH/2)*FRACUNIT;
|
||||||
|
fixed_t starty = 48*FRACUNIT;
|
||||||
|
fixed_t x, y;
|
||||||
|
|
||||||
|
UINT8 numperrow = numbulbs/2;
|
||||||
|
UINT8 i;
|
||||||
|
|
||||||
|
UINT32 splitflag = K_calcSplitFlags(0);
|
||||||
|
|
||||||
|
if (r_splitscreen >= 1)
|
||||||
|
{
|
||||||
|
spacing /= 2;
|
||||||
|
starty /= 3;
|
||||||
|
|
||||||
|
if (r_splitscreen > 1)
|
||||||
|
{
|
||||||
|
startx /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startx += (spacing/2);
|
||||||
|
|
||||||
|
if (numbulbs <= 10)
|
||||||
|
{
|
||||||
|
// No second row
|
||||||
|
numperrow = numbulbs;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (numbulbs & 1)
|
||||||
|
{
|
||||||
|
numperrow++;
|
||||||
|
}
|
||||||
|
|
||||||
|
starty -= (spacing/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
startx -= (spacing/2) * numperrow;
|
||||||
|
|
||||||
|
x = startx;
|
||||||
|
y = starty;
|
||||||
|
|
||||||
|
for (i = 0; i < numbulbs; i++)
|
||||||
|
{
|
||||||
|
UINT8 patchnum = 0;
|
||||||
|
INT32 bulbtic = (leveltime - introtime - TICRATE) - (bulbtime * i);
|
||||||
|
|
||||||
|
if (i == numperrow)
|
||||||
|
{
|
||||||
|
y += spacing;
|
||||||
|
x = startx + (spacing/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bulbtic > 0)
|
||||||
|
{
|
||||||
|
if (bulbtic < 14)
|
||||||
|
{
|
||||||
|
patchnum = start_animation[bulbtic];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const INT32 length = (bulbtime * 3);
|
||||||
|
|
||||||
|
bulbtic -= 14;
|
||||||
|
|
||||||
|
if (bulbtic > length)
|
||||||
|
{
|
||||||
|
bulbtic -= length;
|
||||||
|
patchnum = chillloop_animation[bulbtic % 2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patchnum = loop_animation[bulbtic % 4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|splitflag,
|
||||||
|
(r_splitscreen ? kp_prestartbulb_split[patchnum] : kp_prestartbulb[patchnum]), NULL);
|
||||||
|
x += spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = 70*FRACUNIT;
|
||||||
|
y = starty;
|
||||||
|
|
||||||
|
if (r_splitscreen == 1)
|
||||||
|
{
|
||||||
|
x = 106*FRACUNIT;
|
||||||
|
}
|
||||||
|
else if (r_splitscreen > 1)
|
||||||
|
{
|
||||||
|
x = 28*FRACUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
UINT8 patchnum = letters_order[i];
|
||||||
|
INT32 transflag = letters_transparency[(leveltime - i) % 40];
|
||||||
|
patch_t *patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]);
|
||||||
|
|
||||||
|
if (transflag >= 10)
|
||||||
|
;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (transflag != 0)
|
||||||
|
transflag = transflag << FF_TRANSSHIFT;
|
||||||
|
|
||||||
|
V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|splitflag|transflag, patch, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < 9)
|
||||||
|
{
|
||||||
|
x += (SHORT(patch->width)) * FRACUNIT/2;
|
||||||
|
|
||||||
|
patchnum = letters_order[i+1];
|
||||||
|
patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]);
|
||||||
|
x += (SHORT(patch->width)) * FRACUNIT/2;
|
||||||
|
|
||||||
|
if (r_splitscreen)
|
||||||
|
x -= FRACUNIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void K_drawKartStartCountdown(void)
|
static void K_drawKartStartCountdown(void)
|
||||||
{
|
{
|
||||||
INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3
|
INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3
|
||||||
|
|
||||||
if (leveltime >= starttime-(2*TICRATE)) // 2
|
if (stplyr->karthud[khud_fault] != 0)
|
||||||
pnum++;
|
{
|
||||||
if (leveltime >= starttime-TICRATE) // 1
|
INT32 x, xval;
|
||||||
pnum++;
|
|
||||||
if (leveltime >= starttime) // GO!
|
|
||||||
pnum++;
|
|
||||||
if ((leveltime % (2*5)) / 5) // blink
|
|
||||||
pnum += 4;
|
|
||||||
if (r_splitscreen) // splitscreen
|
|
||||||
pnum += 8;
|
|
||||||
|
|
||||||
V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]);
|
if (r_splitscreen > 1) // 3/4p, stationary FIN
|
||||||
|
{
|
||||||
|
pnum += 2;
|
||||||
|
}
|
||||||
|
else if (r_splitscreen == 1) // wide splitscreen
|
||||||
|
{
|
||||||
|
pnum += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((leveltime % (2*5)) / 5) // blink
|
||||||
|
pnum += 1;
|
||||||
|
|
||||||
|
if (r_splitscreen == 0)
|
||||||
|
{
|
||||||
|
x = ((vid.width<<FRACBITS)/vid.dupx);
|
||||||
|
xval = (SHORT(kp_racefault[pnum]->width)<<FRACBITS);
|
||||||
|
x = ((TICRATE - stplyr->karthud[khud_fault])*(xval > x ? xval : x))/TICRATE;
|
||||||
|
|
||||||
|
V_DrawFixedPatch(x + (STCD_X<<FRACBITS) - (xval>>1),
|
||||||
|
(STCD_Y<<FRACBITS) - (SHORT(kp_racefault[pnum]->height)<<(FRACBITS-1)),
|
||||||
|
FRACUNIT,
|
||||||
|
splitflags, kp_racefault[pnum], NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), splitflags, kp_racefault[pnum]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (leveltime >= introtime && leveltime < starttime-(3*TICRATE))
|
||||||
|
{
|
||||||
|
K_drawKartStartBulbs();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if (leveltime >= starttime-(2*TICRATE)) // 2
|
||||||
|
pnum++;
|
||||||
|
if (leveltime >= starttime-TICRATE) // 1
|
||||||
|
pnum++;
|
||||||
|
|
||||||
|
if (leveltime >= starttime) // GO!
|
||||||
|
{
|
||||||
|
UINT8 i;
|
||||||
|
UINT8 numplayers = 0;
|
||||||
|
|
||||||
|
pnum++;
|
||||||
|
|
||||||
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
{
|
||||||
|
if (playeringame[i] && !players[i].spectator)
|
||||||
|
numplayers++;
|
||||||
|
|
||||||
|
if (numplayers > 2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numplayers == 2)
|
||||||
|
{
|
||||||
|
pnum++; // DUEL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((leveltime % (2*5)) / 5) // blink
|
||||||
|
pnum += 5;
|
||||||
|
if (r_splitscreen) // splitscreen
|
||||||
|
pnum += 10;
|
||||||
|
|
||||||
|
V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void K_drawKartFinish(void)
|
static void K_drawKartFinish(void)
|
||||||
|
|
@ -11332,9 +11698,11 @@ void K_drawKartHUD(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the countdowns after everything else.
|
// Draw the countdowns after everything else.
|
||||||
if (leveltime >= starttime-(3*TICRATE)
|
if (leveltime >= introtime
|
||||||
&& leveltime < starttime+TICRATE)
|
&& leveltime < starttime+TICRATE)
|
||||||
|
{
|
||||||
K_drawKartStartCountdown();
|
K_drawKartStartCountdown();
|
||||||
|
}
|
||||||
else if (racecountdown && (!r_splitscreen || !stplyr->exiting))
|
else if (racecountdown && (!r_splitscreen || !stplyr->exiting))
|
||||||
{
|
{
|
||||||
char *countstr = va("%d", racecountdown/TICRATE);
|
char *countstr = va("%d", racecountdown/TICRATE);
|
||||||
|
|
|
||||||
|
|
@ -63,17 +63,22 @@ void K_UpdateDistanceFromFinishLine(player_t *const player);
|
||||||
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
|
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
|
||||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
||||||
INT32 K_GetKartDriftSparkValue(player_t *player);
|
INT32 K_GetKartDriftSparkValue(player_t *player);
|
||||||
|
void K_SpawnDriftBoostExplosion(player_t *player, int stage);
|
||||||
void K_KartUpdatePosition(player_t *player);
|
void K_KartUpdatePosition(player_t *player);
|
||||||
void K_DropItems(player_t *player);
|
void K_DropItems(player_t *player);
|
||||||
void K_StripItems(player_t *player);
|
void K_StripItems(player_t *player);
|
||||||
void K_StripOther(player_t *player);
|
void K_StripOther(player_t *player);
|
||||||
void K_MomentumToFacing(player_t *player);
|
void K_MomentumToFacing(player_t *player);
|
||||||
boolean K_ApplyOffroad(player_t *player);
|
boolean K_ApplyOffroad(player_t *player);
|
||||||
|
tic_t K_GetSpindashChargeTime(player_t *player);
|
||||||
|
fixed_t K_GetSpindashChargeSpeed(player_t *player);
|
||||||
fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed);
|
fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed);
|
||||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower);
|
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower);
|
||||||
fixed_t K_GetKartAccel(player_t *player);
|
fixed_t K_GetKartAccel(player_t *player);
|
||||||
UINT16 K_GetKartFlashing(player_t *player);
|
UINT16 K_GetKartFlashing(player_t *player);
|
||||||
fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove);
|
SINT8 K_GetForwardMove(player_t *player);
|
||||||
|
fixed_t K_3dKartMovement(player_t *player, boolean onground);
|
||||||
|
boolean K_PlayerEBrake(player_t *player);
|
||||||
void K_MoveKartPlayer(player_t *player, boolean onground);
|
void K_MoveKartPlayer(player_t *player, boolean onground);
|
||||||
void K_CheckSpectateStatus(void);
|
void K_CheckSpectateStatus(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,19 @@ void K_DoIngameRespawn(player_t *player)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leveltime <= starttime)
|
if (leveltime < introtime)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (leveltime < starttime) // FAULT
|
||||||
|
{
|
||||||
|
player->powers[pw_nocontrol] = (starttime - leveltime) + 50;
|
||||||
|
player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse
|
||||||
|
S_StartSound(player->mo, sfx_s3k83);
|
||||||
|
player->karthud[khud_fault] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
player->kartstuff[k_ringboost] = 0;
|
player->kartstuff[k_ringboost] = 0;
|
||||||
player->kartstuff[k_driftboost] = 0;
|
player->kartstuff[k_driftboost] = 0;
|
||||||
player->kartstuff[k_drift] = 0;
|
player->kartstuff[k_drift] = 0;
|
||||||
|
|
@ -108,7 +116,7 @@ void K_DoIngameRespawn(player_t *player)
|
||||||
player->kartstuff[k_pogospring] = 0;
|
player->kartstuff[k_pogospring] = 0;
|
||||||
|
|
||||||
// Set up respawn position if invalid
|
// Set up respawn position if invalid
|
||||||
if (player->respawn.wp != NULL)
|
if (player->respawn.wp != NULL && leveltime >= starttime)
|
||||||
{
|
{
|
||||||
const UINT32 dist = RESPAWN_DIST + (player->airtime * 48);
|
const UINT32 dist = RESPAWN_DIST + (player->airtime * 48);
|
||||||
player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
||||||
|
|
@ -279,7 +287,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
||||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||||
|
|
||||||
player->powers[pw_flashing] = 2;
|
player->powers[pw_flashing] = 2;
|
||||||
player->powers[pw_nocontrol] = 2;
|
player->powers[pw_nocontrol] = max(2, player->powers[pw_nocontrol]);
|
||||||
|
|
||||||
if (leveltime % 8 == 0 && !mapreset)
|
if (leveltime % 8 == 0 && !mapreset)
|
||||||
{
|
{
|
||||||
|
|
@ -325,8 +333,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
||||||
dest.x, dest.y
|
dest.x, dest.y
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((player->respawn.distanceleft == 0)
|
if ((player->respawn.distanceleft == 0 && K_GetWaypointIsSpawnpoint(player->respawn.wp) == true)
|
||||||
&& (K_GetWaypointIsSpawnpoint(player->respawn.wp) == true))
|
|| (player->respawn.wp == K_GetFinishLineWaypoint()
|
||||||
|
|| player->respawn.wp->nextwaypoints[nwp] == K_GetFinishLineWaypoint())) // Try not to allow you to pass the finish line while respawning, because it's janky
|
||||||
{
|
{
|
||||||
// Alright buddy, that's the end of the ride.
|
// Alright buddy, that's the end of the ride.
|
||||||
player->respawn.state = RESPAWNST_DROP;
|
player->respawn.state = RESPAWNST_DROP;
|
||||||
|
|
@ -531,7 +540,8 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_DropDashWait(player_t *player)
|
static void K_DropDashWait(player_t *player)
|
||||||
{
|
{
|
||||||
player->respawn.timer--;
|
if (player->powers[pw_nocontrol] == 0)
|
||||||
|
player->respawn.timer--;
|
||||||
|
|
||||||
if (leveltime % 8 == 0)
|
if (leveltime % 8 == 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -767,8 +767,6 @@ static int ticcmd_get(lua_State *L)
|
||||||
|
|
||||||
if (fastcmp(field,"forwardmove"))
|
if (fastcmp(field,"forwardmove"))
|
||||||
lua_pushinteger(L, cmd->forwardmove);
|
lua_pushinteger(L, cmd->forwardmove);
|
||||||
else if (fastcmp(field,"sidemove"))
|
|
||||||
lua_pushinteger(L, cmd->sidemove);
|
|
||||||
else if (fastcmp(field,"angleturn"))
|
else if (fastcmp(field,"angleturn"))
|
||||||
lua_pushinteger(L, cmd->angleturn);
|
lua_pushinteger(L, cmd->angleturn);
|
||||||
else if (fastcmp(field,"aiming"))
|
else if (fastcmp(field,"aiming"))
|
||||||
|
|
@ -797,8 +795,6 @@ static int ticcmd_set(lua_State *L)
|
||||||
|
|
||||||
if (fastcmp(field,"forwardmove"))
|
if (fastcmp(field,"forwardmove"))
|
||||||
cmd->forwardmove = (SINT8)luaL_checkinteger(L, 3);
|
cmd->forwardmove = (SINT8)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"sidemove"))
|
|
||||||
cmd->sidemove = (SINT8)luaL_checkinteger(L, 3);
|
|
||||||
else if (fastcmp(field,"angleturn"))
|
else if (fastcmp(field,"angleturn"))
|
||||||
cmd->angleturn = (INT16)luaL_checkinteger(L, 3);
|
cmd->angleturn = (INT16)luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"aiming"))
|
else if (fastcmp(field,"aiming"))
|
||||||
|
|
|
||||||
|
|
@ -808,10 +808,10 @@ void A_Look(mobj_t *actor)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
|
if (leveltime < starttime) // SRB2kart - no looking before race starts
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (leveltime < starttime) // SRB2kart - no looking before race starts
|
if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// go into chase state
|
// go into chase state
|
||||||
|
|
|
||||||
42
src/p_mobj.c
42
src/p_mobj.c
|
|
@ -1461,10 +1461,10 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||||
mo->momy = FixedMul(mo->momy, ns);
|
mo->momy = FixedMul(mo->momy, ns);
|
||||||
}
|
}
|
||||||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
&& (!(K_GetForwardMove(player) && !(twodlevel || mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_SPINNING))
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)))// && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
@ -1476,16 +1476,8 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oldx == mo->x && oldy == mo->y) // didn't go anywhere
|
mo->momx = FixedMul(mo->momx, mo->friction);
|
||||||
{
|
mo->momy = FixedMul(mo->momy, mo->friction);
|
||||||
mo->momx = FixedMul(mo->momx, ORIG_FRICTION);
|
|
||||||
mo->momy = FixedMul(mo->momy, ORIG_FRICTION);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mo->momx = FixedMul(mo->momx, mo->friction);
|
|
||||||
mo->momy = FixedMul(mo->momy, mo->friction);
|
|
||||||
}
|
|
||||||
|
|
||||||
mo->friction = ORIG_FRICTION;
|
mo->friction = ORIG_FRICTION;
|
||||||
}
|
}
|
||||||
|
|
@ -1961,7 +1953,7 @@ void P_XYMovement(mobj_t *mo)
|
||||||
if (mo->type == MT_FLINGRING || mo->type == MT_BALLHOG || mo->type == MT_BUBBLESHIELDTRAP)
|
if (mo->type == MT_FLINGRING || mo->type == MT_BALLHOG || mo->type == MT_BUBBLESHIELDTRAP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= K_GetKartSpeed(mo->player, false)/2)
|
if (player && (player->kartstuff[k_spinouttimer] && !player->kartstuff[k_wipeoutslow]) && player->speed <= FixedDiv(20*mapobjectscale, player->kartstuff[k_offroad] + FRACUNIT))
|
||||||
return;
|
return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
@ -2807,7 +2799,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
// Check if we're on a polyobject
|
// Check if we're on a polyobject
|
||||||
// that triggers a linedef executor.
|
// that triggers a linedef executor.
|
||||||
msecnode_t *node;
|
msecnode_t *node;
|
||||||
boolean stopmovecut = false;
|
|
||||||
|
|
||||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
{
|
||||||
|
|
@ -2839,8 +2830,8 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
polysec = po->lines[0]->backsector;
|
polysec = po->lines[0]->backsector;
|
||||||
|
|
||||||
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
|
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
|
||||||
if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
|
/*if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
|
||||||
stopmovecut = true;
|
stopmovecut = true;*/
|
||||||
|
|
||||||
if (!(po->flags & POF_LDEXEC))
|
if (!(po->flags & POF_LDEXEC))
|
||||||
{
|
{
|
||||||
|
|
@ -2861,24 +2852,7 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stopmovecut)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Cut momentum in half when you hit the ground and
|
|
||||||
// aren't pressing any controls.
|
|
||||||
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy
|
|
||||||
&& !(mo->player->kartstuff[k_spinouttimer]))
|
|
||||||
{
|
|
||||||
mo->momx = mo->momx/2;
|
|
||||||
mo->momy = mo->momy/2;
|
|
||||||
|
|
||||||
if (mo->player->cmd.buttons & BT_BRAKE && !(mo->player->cmd.forwardmove)) // FURTHER slowdown if you're braking.
|
|
||||||
{
|
|
||||||
mo->momx = mo->momx/2;
|
|
||||||
mo->momy = mo->momy/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->health)
|
if (mo->health)
|
||||||
|
|
|
||||||
|
|
@ -3472,6 +3472,10 @@ static void P_NetArchiveMisc(void)
|
||||||
|
|
||||||
WRITEUINT8(save_p, thwompsactive);
|
WRITEUINT8(save_p, thwompsactive);
|
||||||
WRITESINT8(save_p, spbplace);
|
WRITESINT8(save_p, spbplace);
|
||||||
|
WRITEUINT8(save_p, rainbowstartavailable);
|
||||||
|
|
||||||
|
WRITEUINT32(save_p, introtime);
|
||||||
|
WRITEUINT32(save_p, starttime);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (paused)
|
if (paused)
|
||||||
|
|
@ -3597,6 +3601,10 @@ static inline boolean P_NetUnArchiveMisc(void)
|
||||||
|
|
||||||
thwompsactive = (boolean)READUINT8(save_p);
|
thwompsactive = (boolean)READUINT8(save_p);
|
||||||
spbplace = READSINT8(save_p);
|
spbplace = READSINT8(save_p);
|
||||||
|
rainbowstartavailable = (boolean)READUINT8(save_p);
|
||||||
|
|
||||||
|
introtime = READUINT32(save_p);
|
||||||
|
starttime = READUINT32(save_p);
|
||||||
|
|
||||||
// Is it paused?
|
// Is it paused?
|
||||||
if (READUINT8(save_p) == 0x2f)
|
if (READUINT8(save_p) == 0x2f)
|
||||||
|
|
|
||||||
|
|
@ -2368,6 +2368,7 @@ lumpnum_t lastloadedmaplumpnum; // for comparative savegame
|
||||||
static void P_LevelInitStuff(void)
|
static void P_LevelInitStuff(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
UINT8 p = 0;
|
||||||
|
|
||||||
leveltime = 0;
|
leveltime = 0;
|
||||||
|
|
||||||
|
|
@ -2414,6 +2415,9 @@ static void P_LevelInitStuff(void)
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
if (playeringame[i] && !players[i].spectator)
|
||||||
|
p++;
|
||||||
|
|
||||||
if (grandprixinfo.gp == false)
|
if (grandprixinfo.gp == false)
|
||||||
{
|
{
|
||||||
players[i].lives = 3;
|
players[i].lives = 3;
|
||||||
|
|
@ -2463,6 +2467,29 @@ static void P_LevelInitStuff(void)
|
||||||
players[i].follower = NULL;
|
players[i].follower = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rainbowstartavailable = false;
|
||||||
|
|
||||||
|
if (p >= 2)
|
||||||
|
rainbowstartavailable = true;
|
||||||
|
|
||||||
|
if (p <= 2)
|
||||||
|
{
|
||||||
|
introtime = 0; // No intro in Record Attack / 1v1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
introtime = (108) + 5; // 108 for rotation, + 5 for white fade
|
||||||
|
}
|
||||||
|
|
||||||
|
numbulbs = 5;
|
||||||
|
|
||||||
|
if (p > 2)
|
||||||
|
{
|
||||||
|
numbulbs += (p-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time
|
||||||
|
|
||||||
// SRB2Kart: map load variables
|
// SRB2Kart: map load variables
|
||||||
if (grandprixinfo.gp == true)
|
if (grandprixinfo.gp == true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include "k_kart.h" // K_PlayerEBrake
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
|
|
||||||
|
|
@ -883,6 +884,10 @@ void P_ButteredSlope(mobj_t *mo)
|
||||||
return; // don't slide down slopes if you can't touch them or you're not affected by gravity
|
return; // don't slide down slopes if you can't touch them or you're not affected by gravity
|
||||||
|
|
||||||
if (mo->player) {
|
if (mo->player) {
|
||||||
|
// SRB2Kart - spindash negates slopes
|
||||||
|
if (K_PlayerEBrake(mo->player))
|
||||||
|
return;
|
||||||
|
|
||||||
// Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles)
|
// Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles)
|
||||||
if (abs(mo->standingslope->zdelta) < FRACUNIT/21 && !(mo->player->pflags & PF_SPINNING))
|
if (abs(mo->standingslope->zdelta) < FRACUNIT/21 && !(mo->player->pflags & PF_SPINNING))
|
||||||
return; // Don't slide on non-steep slopes unless spinning
|
return; // Don't slide on non-steep slopes unless spinning
|
||||||
|
|
|
||||||
15
src/p_spec.c
15
src/p_spec.c
|
|
@ -2066,7 +2066,12 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
{
|
{
|
||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
if ((player->starpostnum == numstarposts) || (player->laps == 0))
|
if (leveltime < starttime)
|
||||||
|
{
|
||||||
|
// Will fault the player
|
||||||
|
K_DoIngameRespawn(player);
|
||||||
|
}
|
||||||
|
else if ((player->starpostnum == numstarposts) || (player->laps == 0))
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
UINT8 nump = 0;
|
UINT8 nump = 0;
|
||||||
|
|
@ -2101,6 +2106,14 @@ static void K_HandleLapIncrement(player_t *player)
|
||||||
player->karthud[khud_lapanimation] = 80;
|
player->karthud[khud_lapanimation] = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rainbowstartavailable == true)
|
||||||
|
{
|
||||||
|
S_StartSound(player->mo, sfx_s23c);
|
||||||
|
player->kartstuff[k_startboost] = 125;
|
||||||
|
K_SpawnDriftBoostExplosion(player, 3);
|
||||||
|
rainbowstartavailable = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
|
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
|
||||||
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
|
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
|
||||||
|
|
||||||
|
|
|
||||||
105
src/p_user.c
105
src/p_user.c
|
|
@ -4020,9 +4020,9 @@ static void P_2dMovement(player_t *player)
|
||||||
static void P_3dMovement(player_t *player)
|
static void P_3dMovement(player_t *player)
|
||||||
{
|
{
|
||||||
ticcmd_t *cmd;
|
ticcmd_t *cmd;
|
||||||
angle_t movepushangle, movepushsideangle; // Analog
|
angle_t movepushangle; // Analog
|
||||||
//INT32 topspeed, acceleration, thrustfactor;
|
//INT32 topspeed, acceleration, thrustfactor;
|
||||||
fixed_t movepushforward = 0, movepushside = 0;
|
fixed_t movepushforward = 0;
|
||||||
angle_t dangle; // replaces old quadrants bits
|
angle_t dangle; // replaces old quadrants bits
|
||||||
//boolean dangleflip = false; // SRB2kart - toaster
|
//boolean dangleflip = false; // SRB2kart - toaster
|
||||||
//fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
//fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
||||||
|
|
@ -4039,14 +4039,6 @@ static void P_3dMovement(player_t *player)
|
||||||
|
|
||||||
cmd = &player->cmd;
|
cmd = &player->cmd;
|
||||||
|
|
||||||
if (player->pflags & PF_STASIS || player->kartstuff[k_spinouttimer]) // pw_introcam?
|
|
||||||
{
|
|
||||||
cmd->forwardmove = cmd->sidemove = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring])
|
|
||||||
cmd->sidemove = 0;
|
|
||||||
|
|
||||||
if (player->kartstuff[k_drift] != 0)
|
if (player->kartstuff[k_drift] != 0)
|
||||||
movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift];
|
||||||
else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle
|
else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle
|
||||||
|
|
@ -4054,8 +4046,6 @@ static void P_3dMovement(player_t *player)
|
||||||
else
|
else
|
||||||
movepushangle = player->mo->angle;
|
movepushangle = player->mo->angle;
|
||||||
|
|
||||||
movepushsideangle = movepushangle-ANGLE_90;
|
|
||||||
|
|
||||||
// cmomx/cmomy stands for the conveyor belt speed.
|
// cmomx/cmomy stands for the conveyor belt speed.
|
||||||
if (player->onconveyor == 2) // Wind/Current
|
if (player->onconveyor == 2) // Wind/Current
|
||||||
{
|
{
|
||||||
|
|
@ -4108,10 +4098,6 @@ static void P_3dMovement(player_t *player)
|
||||||
*/
|
*/
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// When sliding, don't allow forward/back
|
|
||||||
if (player->pflags & PF_SLIDING)
|
|
||||||
cmd->forwardmove = 0;
|
|
||||||
|
|
||||||
// Do not let the player control movement if not onground.
|
// Do not let the player control movement if not onground.
|
||||||
// SRB2Kart: pogo spring and speed bumps are supposed to control like you're on the ground
|
// SRB2Kart: pogo spring and speed bumps are supposed to control like you're on the ground
|
||||||
onground = (P_IsObjectOnGround(player->mo) || (player->kartstuff[k_pogospring]));
|
onground = (P_IsObjectOnGround(player->mo) || (player->kartstuff[k_pogospring]));
|
||||||
|
|
@ -4121,23 +4107,11 @@ static void P_3dMovement(player_t *player)
|
||||||
// Forward movement
|
// Forward movement
|
||||||
if (!(P_PlayerInPain(player) && !onground))
|
if (!(P_PlayerInPain(player) && !onground))
|
||||||
{
|
{
|
||||||
movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove);
|
movepushforward = K_3dKartMovement(player, onground);
|
||||||
|
|
||||||
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
|
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
|
||||||
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
|
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
|
||||||
|
|
||||||
if (cmd->buttons & BT_BRAKE && !cmd->forwardmove) // SRB2kart - braking isn't instant
|
|
||||||
movepushforward /= 64;
|
|
||||||
|
|
||||||
if (cmd->forwardmove > 0)
|
|
||||||
player->kartstuff[k_brakestop] = 0;
|
|
||||||
else if (player->kartstuff[k_brakestop] < 6) // Don't start reversing with brakes until you've made a stop first
|
|
||||||
{
|
|
||||||
if (player->speed < 8*FRACUNIT)
|
|
||||||
player->kartstuff[k_brakestop]++;
|
|
||||||
movepushforward = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
|
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
|
||||||
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
|
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
|
||||||
}
|
}
|
||||||
|
|
@ -4146,18 +4120,6 @@ static void P_3dMovement(player_t *player)
|
||||||
K_MomentumToFacing(player);
|
K_MomentumToFacing(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sideways movement
|
|
||||||
if (cmd->sidemove != 0 && !((player->exiting || mapreset) || player->kartstuff[k_spinouttimer]))
|
|
||||||
{
|
|
||||||
if (cmd->sidemove > 0)
|
|
||||||
movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true));
|
|
||||||
else
|
|
||||||
movepushside = (cmd->sidemove * FRACUNIT/128) - FixedDiv(player->speed, K_GetKartSpeed(player, true));
|
|
||||||
|
|
||||||
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
|
|
||||||
totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((totalthrust.x || totalthrust.y)
|
if ((totalthrust.x || totalthrust.y)
|
||||||
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
|
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
|
||||||
// Factor thrust to slope, but only for the part pushing up it!
|
// Factor thrust to slope, but only for the part pushing up it!
|
||||||
|
|
@ -5796,18 +5758,10 @@ static void P_MovePlayer(player_t *player)
|
||||||
boolean add_delta = true;
|
boolean add_delta = true;
|
||||||
|
|
||||||
// Kart: store the current turn range for later use
|
// Kart: store the current turn range for later use
|
||||||
if ((player->mo && player->speed > 0) // Moving
|
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
|
||||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
|
||||||
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|
|
||||||
|| (player->spectator || objectplacing)) // Not a physical player
|
|
||||||
{
|
|
||||||
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
|
|
||||||
player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1;
|
|
||||||
} else {
|
|
||||||
player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (leveltime >= starttime)
|
if (leveltime >= introtime)
|
||||||
{
|
{
|
||||||
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
|
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
|
||||||
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
|
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
|
||||||
|
|
@ -7243,8 +7197,7 @@ fixed_t t_cam4_rotate = -42;
|
||||||
// we then throw that ticcmd garbage in the camera and make it move
|
// we then throw that ticcmd garbage in the camera and make it move
|
||||||
|
|
||||||
// redefine this
|
// redefine this
|
||||||
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
static fixed_t forwardmove = MAXPLMOVE<<FRACBITS>>16;
|
||||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
|
||||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||||
|
|
||||||
static ticcmd_t cameracmd;
|
static ticcmd_t cameracmd;
|
||||||
|
|
@ -7259,7 +7212,7 @@ void P_InitCameraCmd(void)
|
||||||
|
|
||||||
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
{
|
{
|
||||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
INT32 laim, th, tspeed, forward, axis; //i
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming;
|
boolean turnleft, turnright, mouseaiming;
|
||||||
|
|
@ -7308,7 +7261,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
turnright = turnright || (axis > 0);
|
turnright = turnright || (axis > 0);
|
||||||
turnleft = turnleft || (axis < 0);
|
turnleft = turnleft || (axis < 0);
|
||||||
}
|
}
|
||||||
forward = side = 0;
|
forward = 0;
|
||||||
|
|
||||||
// use two stage accelerative turning
|
// use two stage accelerative turning
|
||||||
// on the keyboard and joystick
|
// on the keyboard and joystick
|
||||||
|
|
@ -7326,12 +7279,10 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
if (turnright && !(turnleft))
|
if (turnright && !(turnleft))
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
|
cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed]));
|
||||||
side += sidemove[1];
|
|
||||||
}
|
}
|
||||||
else if (turnleft && !(turnright))
|
else if (turnleft && !(turnright))
|
||||||
{
|
{
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
|
cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed]));
|
||||||
side -= sidemove[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||||
|
|
@ -7344,9 +7295,9 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
cmd->buttons |= BT_BRAKE;
|
cmd->buttons |= BT_BRAKE;
|
||||||
axis = JoyAxis(AXISAIM, 1);
|
axis = JoyAxis(AXISAIM, 1);
|
||||||
if (InputDown(gc_aimforward, 1) || (usejoystick && axis < 0))
|
if (InputDown(gc_aimforward, 1) || (usejoystick && axis < 0))
|
||||||
forward += forwardmove[1];
|
forward += forwardmove;
|
||||||
if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0))
|
if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0))
|
||||||
forward -= forwardmove[1];
|
forward -= forwardmove;
|
||||||
|
|
||||||
// fire with any button/key
|
// fire with any button/key
|
||||||
axis = JoyAxis(AXISFIRE, 1);
|
axis = JoyAxis(AXISFIRE, 1);
|
||||||
|
|
@ -7387,21 +7338,12 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||||
|
|
||||||
mousex = mousey = mlooky = 0;
|
mousex = mousey = mlooky = 0;
|
||||||
|
|
||||||
if (forward > MAXPLMOVE)
|
cmd->forwardmove += (SINT8)forward;
|
||||||
forward = MAXPLMOVE;
|
|
||||||
else if (forward < -MAXPLMOVE)
|
|
||||||
forward = -MAXPLMOVE;
|
|
||||||
|
|
||||||
if (side > MAXPLMOVE)
|
if (cmd->forwardmove > MAXPLMOVE)
|
||||||
side = MAXPLMOVE;
|
cmd->forwardmove = MAXPLMOVE;
|
||||||
else if (side < -MAXPLMOVE)
|
else if (cmd->forwardmove < -MAXPLMOVE)
|
||||||
side = -MAXPLMOVE;
|
cmd->forwardmove = -MAXPLMOVE;
|
||||||
|
|
||||||
if (forward || side)
|
|
||||||
{
|
|
||||||
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
|
|
||||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
|
||||||
}
|
|
||||||
|
|
||||||
lang += (cmd->angleturn<<16);
|
lang += (cmd->angleturn<<16);
|
||||||
|
|
||||||
|
|
@ -7446,11 +7388,10 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||||
cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cam->momx = cam->momy = cam->momz = 0;
|
cam->momx = cam->momy = cam->momz = 0;
|
||||||
|
|
||||||
if (cmd->forwardmove != 0)
|
if (cmd->forwardmove != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
thrustangle = cam->angle >> ANGLETOFINESHIFT;
|
thrustangle = cam->angle >> ANGLETOFINESHIFT;
|
||||||
|
|
||||||
cam->x += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle));
|
cam->x += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle));
|
||||||
|
|
@ -7739,7 +7680,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
|
|
||||||
if (timeover)
|
if (timeover)
|
||||||
angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
|
angle = mo->angle + FixedAngle(camrotate*FRACUNIT);
|
||||||
else if (leveltime < starttime)
|
else if (leveltime < introtime)
|
||||||
angle = focusangle + FixedAngle(camrotate*FRACUNIT);
|
angle = focusangle + FixedAngle(camrotate*FRACUNIT);
|
||||||
else if (camstill || resetcalled || player->playerstate == PST_DEAD)
|
else if (camstill || resetcalled || player->playerstate == PST_DEAD)
|
||||||
angle = thiscam->angle;
|
angle = thiscam->angle;
|
||||||
|
|
@ -7762,7 +7703,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetcalled && (leveltime > starttime && timeover != 2)
|
if (!resetcalled && (leveltime >= introtime && timeover != 2)
|
||||||
&& ((thiscam == &camera[0] && t_cam_rotate != -42)
|
&& ((thiscam == &camera[0] && t_cam_rotate != -42)
|
||||||
|| (thiscam == &camera[1] && t_cam2_rotate != -42)
|
|| (thiscam == &camera[1] && t_cam2_rotate != -42)
|
||||||
|| (thiscam == &camera[2] && t_cam3_rotate != -42)
|
|| (thiscam == &camera[2] && t_cam3_rotate != -42)
|
||||||
|
|
@ -8079,7 +8020,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
}
|
}
|
||||||
else if (player->exiting || timeover == 2)
|
else if (player->exiting || timeover == 2)
|
||||||
thiscam->momx = thiscam->momy = thiscam->momz = 0;
|
thiscam->momx = thiscam->momy = thiscam->momz = 0;
|
||||||
else if (leveltime < starttime)
|
else if (leveltime < introtime)
|
||||||
{
|
{
|
||||||
thiscam->momx = FixedMul(x - thiscam->x, camspeed);
|
thiscam->momx = FixedMul(x - thiscam->x, camspeed);
|
||||||
thiscam->momy = FixedMul(y - thiscam->y, camspeed);
|
thiscam->momy = FixedMul(y - thiscam->y, camspeed);
|
||||||
|
|
@ -8883,7 +8824,7 @@ void P_PlayerThink(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SRB2kart 010217
|
// SRB2kart 010217
|
||||||
if (leveltime < starttime)
|
if (leveltime < introtime)
|
||||||
{
|
{
|
||||||
player->powers[pw_nocontrol] = 2;
|
player->powers[pw_nocontrol] = 2;
|
||||||
}
|
}
|
||||||
|
|
@ -9513,8 +9454,8 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this
|
if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this
|
||||||
&& !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode?
|
&& !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode?
|
||||||
{
|
{
|
||||||
player->mo->tracer->target->health += cmd->sidemove;
|
//player->mo->tracer->target->health += cmd->sidemove;
|
||||||
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
//player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
|
||||||
|
|
||||||
if (player == &players[consoleplayer])
|
if (player == &players[consoleplayer])
|
||||||
localangle[0] = player->mo->angle; // Adjust the local control angle.
|
localangle[0] = player->mo->angle; // Adjust the local control angle.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue