mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Merge branch 'finish-jingles-return' into 'master'
Finish Jingles Return See merge request KartKrew/Kart!1214
This commit is contained in:
commit
b5fbb84395
9 changed files with 221 additions and 267 deletions
|
|
@ -6455,18 +6455,9 @@ struct int_const_s const INT_CONST[] = {
|
||||||
{"JT_NONE",JT_NONE},
|
{"JT_NONE",JT_NONE},
|
||||||
{"JT_OTHER",JT_OTHER},
|
{"JT_OTHER",JT_OTHER},
|
||||||
{"JT_MASTER",JT_MASTER},
|
{"JT_MASTER",JT_MASTER},
|
||||||
{"JT_1UP",JT_1UP},
|
|
||||||
{"JT_SHOES",JT_SHOES},
|
{"JT_INVINCIBILITY",JT_INVINCIBILITY},
|
||||||
{"JT_INV",JT_INV},
|
{"JT_GROW",JT_GROW},
|
||||||
{"JT_MINV",JT_MINV},
|
|
||||||
{"JT_DROWN",JT_DROWN},
|
|
||||||
{"JT_SUPER",JT_SUPER},
|
|
||||||
{"JT_GOVER",JT_GOVER},
|
|
||||||
{"JT_NIGHTSTIMEOUT",JT_NIGHTSTIMEOUT},
|
|
||||||
{"JT_SSTIMEOUT",JT_SSTIMEOUT},
|
|
||||||
// {"JT_LCLEAR",JT_LCLEAR},
|
|
||||||
// {"JT_RACENT",JT_RACENT},
|
|
||||||
// {"JT_CONTSC",JT_CONTSC},
|
|
||||||
|
|
||||||
// Overlay exception settings
|
// Overlay exception settings
|
||||||
{"OV_DONTSCREENOFFSET", OV_DONTSCREENOFFSET},
|
{"OV_DONTSCREENOFFSET", OV_DONTSCREENOFFSET},
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,7 @@ extern const tic_t bulbtime;
|
||||||
extern UINT8 numbulbs;
|
extern UINT8 numbulbs;
|
||||||
|
|
||||||
extern tic_t raceexittime;
|
extern tic_t raceexittime;
|
||||||
extern tic_t battleexittime;
|
#define MUSICCOUNTDOWNMAX (raceexittime - (TICRATE/2))
|
||||||
|
|
||||||
extern INT32 hyudorotime;
|
extern INT32 hyudorotime;
|
||||||
extern INT32 stealtime;
|
extern INT32 stealtime;
|
||||||
|
|
@ -694,7 +694,7 @@ extern UINT8 maxXtraLife; // Max extra lives from rings
|
||||||
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
|
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
|
||||||
|
|
||||||
// For racing
|
// For racing
|
||||||
extern tic_t racecountdown, exitcountdown;
|
extern tic_t racecountdown, exitcountdown, musiccountdown;
|
||||||
|
|
||||||
#define DEFAULT_GRAVITY (4*FRACUNIT/5)
|
#define DEFAULT_GRAVITY (4*FRACUNIT/5)
|
||||||
extern fixed_t gravity;
|
extern fixed_t gravity;
|
||||||
|
|
|
||||||
25
src/g_game.c
25
src/g_game.c
|
|
@ -249,8 +249,7 @@ tic_t starttime = 3;
|
||||||
const tic_t bulbtime = TICRATE/2;
|
const tic_t bulbtime = TICRATE/2;
|
||||||
UINT8 numbulbs = 1;
|
UINT8 numbulbs = 1;
|
||||||
|
|
||||||
tic_t raceexittime = 5*TICRATE + (2*TICRATE/3);
|
tic_t raceexittime = 7*TICRATE + (TICRATE/2);
|
||||||
tic_t battleexittime = 8*TICRATE;
|
|
||||||
|
|
||||||
INT32 hyudorotime = 7*TICRATE;
|
INT32 hyudorotime = 7*TICRATE;
|
||||||
INT32 stealtime = TICRATE/2;
|
INT32 stealtime = TICRATE/2;
|
||||||
|
|
@ -277,7 +276,7 @@ mobj_t *hunt1;
|
||||||
mobj_t *hunt2;
|
mobj_t *hunt2;
|
||||||
mobj_t *hunt3;
|
mobj_t *hunt3;
|
||||||
|
|
||||||
tic_t racecountdown, exitcountdown; // for racing
|
tic_t racecountdown, exitcountdown, musiccountdown; // for racing
|
||||||
|
|
||||||
fixed_t gravity;
|
fixed_t gravity;
|
||||||
fixed_t mapobjectscale;
|
fixed_t mapobjectscale;
|
||||||
|
|
@ -2392,6 +2391,19 @@ void G_Ticker(boolean run)
|
||||||
|
|
||||||
if (Playing() == true)
|
if (Playing() == true)
|
||||||
{
|
{
|
||||||
|
if (musiccountdown > 1)
|
||||||
|
{
|
||||||
|
musiccountdown--;
|
||||||
|
if (musiccountdown == 1)
|
||||||
|
{
|
||||||
|
S_ChangeMusicInternal("racent", true);
|
||||||
|
}
|
||||||
|
else if (musiccountdown == (MUSICCOUNTDOWNMAX - (3*TICRATE)/2))
|
||||||
|
{
|
||||||
|
P_EndingMusic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
K_TickMidVote();
|
K_TickMidVote();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4447,11 +4459,6 @@ static void G_DoCompleted(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See Y_StartIntermission timer handling
|
|
||||||
if ((gametyperules & GTR_CIRCUIT) && ((multiplayer && demo.playback) || j == r_splitscreen+1) && (!K_CanChangeRules(false) || cv_inttime.value > 0))
|
|
||||||
// play some generic music if there's no win/cool/lose music going on (for exitlevel commands)
|
|
||||||
S_ChangeMusicInternal("racent", true);
|
|
||||||
|
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
AM_Stop();
|
AM_Stop();
|
||||||
|
|
||||||
|
|
@ -5542,7 +5549,7 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
|
||||||
|
|
||||||
// Clear a bunch of variables
|
// Clear a bunch of variables
|
||||||
redscore = bluescore = lastmap = 0;
|
redscore = bluescore = lastmap = 0;
|
||||||
racecountdown = exitcountdown = mapreset = exitfadestarted = 0;
|
racecountdown = exitcountdown = musiccountdown = mapreset = exitfadestarted = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1771,21 +1771,6 @@ static int lib_pPlayVictorySound(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pPlayLivesJingle(lua_State *L)
|
|
||||||
{
|
|
||||||
player_t *player = NULL;
|
|
||||||
//NOHUD
|
|
||||||
//INLEVEL
|
|
||||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
|
||||||
{
|
|
||||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
|
||||||
if (!player)
|
|
||||||
return LUA_ErrInvalid(L, "player_t");
|
|
||||||
}
|
|
||||||
P_PlayLivesJingle(player);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lib_pCanPickupItem(lua_State *L)
|
static int lib_pCanPickupItem(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
|
@ -4051,7 +4036,6 @@ static luaL_Reg lib[] = {
|
||||||
{"P_PlayRinglossSound",lib_pPlayRinglossSound},
|
{"P_PlayRinglossSound",lib_pPlayRinglossSound},
|
||||||
{"P_PlayDeathSound",lib_pPlayDeathSound},
|
{"P_PlayDeathSound",lib_pPlayDeathSound},
|
||||||
{"P_PlayVictorySound",lib_pPlayVictorySound},
|
{"P_PlayVictorySound",lib_pPlayVictorySound},
|
||||||
{"P_PlayLivesJingle",lib_pPlayLivesJingle},
|
|
||||||
{"P_CanPickupItem",lib_pCanPickupItem},
|
{"P_CanPickupItem",lib_pCanPickupItem},
|
||||||
|
|
||||||
// p_spec
|
// p_spec
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean fromAir, angle_t oldPitch, an
|
||||||
|
|
||||||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||||
void P_RestoreMusic(player_t *player);
|
void P_RestoreMusic(player_t *player);
|
||||||
boolean P_EndingMusic(player_t *player);
|
void P_EndingMusic(void);
|
||||||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||||
INT32 P_GivePlayerRings(player_t *player, INT32 num_rings);
|
INT32 P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||||
INT32 P_GivePlayerSpheres(player_t *player, INT32 num_spheres);
|
INT32 P_GivePlayerSpheres(player_t *player, INT32 num_spheres);
|
||||||
|
|
@ -228,7 +228,6 @@ UINT8 P_FindHighestLap(void);
|
||||||
|
|
||||||
boolean P_PlayerMoving(INT32 pnum);
|
boolean P_PlayerMoving(INT32 pnum);
|
||||||
|
|
||||||
void P_PlayLivesJingle(player_t *player);
|
|
||||||
void P_PlayRinglossSound(mobj_t *source);
|
void P_PlayRinglossSound(mobj_t *source);
|
||||||
void P_PlayDeathSound(mobj_t *source);
|
void P_PlayDeathSound(mobj_t *source);
|
||||||
void P_PlayVictorySound(mobj_t *source);
|
void P_PlayVictorySound(mobj_t *source);
|
||||||
|
|
@ -246,20 +245,9 @@ typedef enum
|
||||||
JT_NONE, // Null state
|
JT_NONE, // Null state
|
||||||
JT_OTHER, // Other state
|
JT_OTHER, // Other state
|
||||||
JT_MASTER, // Main level music
|
JT_MASTER, // Main level music
|
||||||
JT_1UP, // Extra life
|
|
||||||
JT_SHOES, // Speed shoes
|
|
||||||
JT_INV, // Invincibility
|
|
||||||
JT_MINV, // Mario Invincibility
|
|
||||||
JT_DROWN, // Drowning
|
|
||||||
JT_SUPER, // Super Sonic
|
|
||||||
JT_GOVER, // Game Over
|
|
||||||
JT_NIGHTSTIMEOUT, // NiGHTS Time Out (10 seconds)
|
|
||||||
JT_SSTIMEOUT, // NiGHTS Special Stage Time Out (10 seconds)
|
|
||||||
|
|
||||||
// these are not jingles
|
JT_INVINCIBILITY, // Invincibility
|
||||||
// JT_LCLEAR, // Level Clear
|
JT_GROW, // Grow
|
||||||
// JT_RACENT, // Multiplayer Intermission
|
|
||||||
// JT_CONTSC, // Continue
|
|
||||||
|
|
||||||
NUMJINGLES
|
NUMJINGLES
|
||||||
} jingletype_t;
|
} jingletype_t;
|
||||||
|
|
|
||||||
|
|
@ -7165,7 +7165,7 @@ static void P_InitLevelSettings(void)
|
||||||
K_UpdateShrinkCheat(&players[i]);
|
K_UpdateShrinkCheat(&players[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
racecountdown = exitcountdown = exitfadestarted = 0;
|
racecountdown = exitcountdown = musiccountdown = exitfadestarted = 0;
|
||||||
curlap = bestlap = 0; // SRB2Kart
|
curlap = bestlap = 0; // SRB2Kart
|
||||||
|
|
||||||
// Gamespeed and frantic items
|
// Gamespeed and frantic items
|
||||||
|
|
|
||||||
10
src/p_tick.c
10
src/p_tick.c
|
|
@ -813,10 +813,14 @@ void P_Ticker(boolean run)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (K_CheckBossIntro() == true)
|
if (musiccountdown > 0)
|
||||||
|
{
|
||||||
|
// Music is controlled by completion sequence
|
||||||
|
}
|
||||||
|
else if (K_CheckBossIntro() == true)
|
||||||
{
|
{
|
||||||
// Bosses have a punchy start, so no position.
|
// Bosses have a punchy start, so no position.
|
||||||
if (leveltime == 3)
|
if (leveltime == 1)
|
||||||
{
|
{
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
S_ShowMusicCredit();
|
S_ShowMusicCredit();
|
||||||
|
|
@ -849,7 +853,7 @@ void P_Ticker(boolean run)
|
||||||
if (encoremode)
|
if (encoremode)
|
||||||
{
|
{
|
||||||
// Encore humming starts immediately.
|
// Encore humming starts immediately.
|
||||||
if (leveltime == 3)
|
if (leveltime == 1)
|
||||||
S_ChangeMusicInternal("encore", true);
|
S_ChangeMusicInternal("encore", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
396
src/p_user.c
396
src/p_user.c
|
|
@ -36,6 +36,7 @@
|
||||||
#include "r_splats.h"
|
#include "r_splats.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include "y_inter.h" // Y_DetermineIntermissionType
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
// We need to affect the NiGHTS hud
|
// We need to affect the NiGHTS hud
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
|
@ -86,18 +87,9 @@ jingle_t jingleinfo[NUMJINGLES] = {
|
||||||
{"" , false}, // JT_NONE
|
{"" , false}, // JT_NONE
|
||||||
{"" , false}, // JT_OTHER
|
{"" , false}, // JT_OTHER
|
||||||
{"" , false}, // JT_MASTER
|
{"" , false}, // JT_MASTER
|
||||||
{"_1up" , false},
|
|
||||||
{"_shoes" , true},
|
{"kinvnc" , true}, // JT_INVINCIBILITY
|
||||||
{"_inv" , false},
|
{"kgrow" , true}, // JT_GROW
|
||||||
{"_minv" , false},
|
|
||||||
{"_drown" , false},
|
|
||||||
{"_super" , true},
|
|
||||||
{"_gover" , false},
|
|
||||||
{"_ntime" , false}, // JT_NIGHTSTIMEOUT
|
|
||||||
{"_drown" , false} // JT_SSTIMEOUT
|
|
||||||
// {"_clear" , false},
|
|
||||||
// {"_inter" , true},
|
|
||||||
// {"_conti" , true}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -606,24 +598,6 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
|
||||||
player->roundscore = MAXSCORE;
|
player->roundscore = MAXSCORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// P_PlayLivesJingle
|
|
||||||
//
|
|
||||||
void P_PlayLivesJingle(player_t *player)
|
|
||||||
{
|
|
||||||
if (player && !P_IsLocalPlayer(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (use1upSound)
|
|
||||||
S_StartSound(NULL, sfx_oneup);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
P_PlayJingle(player, JT_1UP);
|
|
||||||
strlcpy(S_sfx[sfx_None].caption, "One-up", 7);
|
|
||||||
S_StartCaption(sfx_None, -1, extralifetics+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void P_PlayJingle(player_t *player, jingletype_t jingletype)
|
void P_PlayJingle(player_t *player, jingletype_t jingletype)
|
||||||
{
|
{
|
||||||
const char *musname = jingleinfo[jingletype].musname;
|
const char *musname = jingleinfo[jingletype].musname;
|
||||||
|
|
@ -651,7 +625,7 @@ void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, b
|
||||||
return;
|
return;
|
||||||
|
|
||||||
S_RetainMusic(musname, musflags, looping, 0, status);
|
S_RetainMusic(musname, musflags, looping, 0, status);
|
||||||
S_StopMusic();
|
//S_StopMusic();
|
||||||
S_ChangeMusicInternal(musname, looping);
|
S_ChangeMusicInternal(musname, looping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -668,48 +642,30 @@ boolean P_EvaluateMusicStatus(UINT16 status, const char *musname)
|
||||||
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case JT_1UP: // Extra life
|
case JT_INVINCIBILITY: // Invincibility
|
||||||
result = false; //(players[i].powers[pw_extralife] > 1);
|
if (players[i].invincibilitytimer > 1)
|
||||||
break;
|
|
||||||
|
|
||||||
case JT_SHOES: // Speed shoes
|
|
||||||
/*if (players[i].powers[pw_sneakers] > 1 && !players[i].powers[pw_super])
|
|
||||||
{
|
{
|
||||||
//strlcpy(S_sfx[sfx_None].caption, "Speed shoes", 12);
|
strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14);
|
||||||
//S_StartCaption(sfx_None, -1, players[i].powers[pw_sneakers]);
|
S_StartCaption(sfx_None, -1, players[i].invincibilitytimer);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else*/
|
else
|
||||||
|
{
|
||||||
result = false;
|
result = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JT_INV: // Invincibility
|
case JT_GROW: // Grow
|
||||||
case JT_MINV: // Mario Invincibility
|
if (players[i].growshrinktimer > 1)
|
||||||
/*if (players[i].powers[pw_invulnerability] > 1)
|
|
||||||
{
|
{
|
||||||
//strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14);
|
strlcpy(S_sfx[sfx_None].caption, "Grow", 14);
|
||||||
//S_StartCaption(sfx_None, -1, players[i].powers[pw_invulnerability]);
|
S_StartCaption(sfx_None, -1, players[i].growshrinktimer);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else*/
|
else
|
||||||
|
{
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
}
|
||||||
|
|
||||||
case JT_DROWN: // Drowning
|
|
||||||
result = false; //(players[i].powers[pw_underwater] && players[i].powers[pw_underwater] <= 11*TICRATE + 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case JT_SUPER: // Super Sonic
|
|
||||||
result = false; //(players[i].powers[pw_super]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case JT_GOVER: // Game Over
|
|
||||||
result = (players[i].lives <= 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case JT_NIGHTSTIMEOUT: // NiGHTS Time Out (10 seconds)
|
|
||||||
case JT_SSTIMEOUT:
|
|
||||||
result = false; //(players[i].nightstime && players[i].nightstime <= 10*TICRATE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JT_OTHER: // Other state
|
case JT_OTHER: // Other state
|
||||||
|
|
@ -755,91 +711,105 @@ void P_PlayVictorySound(mobj_t *source)
|
||||||
//
|
//
|
||||||
// Consistently sets ending music!
|
// Consistently sets ending music!
|
||||||
//
|
//
|
||||||
boolean P_EndingMusic(player_t *player)
|
void P_EndingMusic(void)
|
||||||
{
|
{
|
||||||
char buffer[9];
|
const char *jingle = NULL;
|
||||||
boolean looping = true;
|
boolean nointer = false;
|
||||||
boolean racetracks = !!(gametyperules & GTR_CIRCUIT);
|
UINT8 bestPos = UINT8_MAX;
|
||||||
INT32 bestlocalpos, test;
|
player_t *bestPlayer = NULL;
|
||||||
player_t *bestlocalplayer;
|
|
||||||
|
|
||||||
if (!P_IsLocalPlayer(player)) // Only applies to a local player
|
SINT8 i;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (multiplayer && demo.playback) // Don't play this in multiplayer replays
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Event - Level Finish
|
// Event - Level Finish
|
||||||
// Check for if this is valid or not
|
// Check for if this is valid or not
|
||||||
#define getplayerpos(p) \
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
(((players[p].position < 1) || (players[p].pflags & PF_NOCONTEST)) \
|
|
||||||
? MAXPLAYERS+1 \
|
|
||||||
: players[p].position);
|
|
||||||
|
|
||||||
if (r_splitscreen)
|
|
||||||
{
|
{
|
||||||
const UINT8 *localplayertable = G_PartyArray(consoleplayer);
|
UINT8 pos = UINT8_MAX;
|
||||||
|
player_t *checkPlayer = NULL;
|
||||||
|
|
||||||
if (!((players[localplayertable[0]].exiting || (players[localplayertable[0]].pflags & PF_NOCONTEST))
|
checkPlayer = &players[displayplayers[i]];
|
||||||
|| (players[localplayertable[1]].exiting || (players[localplayertable[1]].pflags & PF_NOCONTEST))
|
if (!checkPlayer || checkPlayer->spectator == true)
|
||||||
|| ((r_splitscreen > 1) && (players[localplayertable[2]].exiting || (players[localplayertable[2]].pflags & PF_NOCONTEST)))
|
{
|
||||||
|| ((r_splitscreen > 2) && (players[localplayertable[3]].exiting || (players[localplayertable[3]].pflags & PF_NOCONTEST)))))
|
continue;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
bestlocalplayer = &players[localplayertable[0]];
|
if (checkPlayer->pflags & PF_NOCONTEST)
|
||||||
bestlocalpos = getplayerpos(localplayertable[0]);
|
{
|
||||||
#define setbests(p) \
|
// No Contest, use special value
|
||||||
test = getplayerpos(p); \
|
;
|
||||||
if (test < bestlocalpos) \
|
}
|
||||||
{ \
|
else if (checkPlayer->exiting)
|
||||||
bestlocalplayer = &players[p]; \
|
{
|
||||||
bestlocalpos = test; \
|
// Standard exit, use their position
|
||||||
}
|
pos = checkPlayer->position;
|
||||||
setbests(localplayertable[1]);
|
}
|
||||||
if (r_splitscreen > 1)
|
|
||||||
setbests(localplayertable[2]);
|
|
||||||
if (r_splitscreen > 2)
|
|
||||||
setbests(localplayertable[3]);
|
|
||||||
#undef setbests
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(player->exiting || (player->pflags & PF_NOCONTEST)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bestlocalplayer = player;
|
|
||||||
bestlocalpos = getplayerpos((player-players));
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef getplayerpos
|
|
||||||
|
|
||||||
if (racetracks == true && bestlocalpos == MAXPLAYERS+1)
|
|
||||||
sprintf(buffer, "k*fail"); // F-Zero death results theme
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (K_IsPlayerLosing(bestlocalplayer))
|
|
||||||
sprintf(buffer, "k*lose");
|
|
||||||
else if (bestlocalpos == 1)
|
|
||||||
sprintf(buffer, "k*win");
|
|
||||||
else
|
else
|
||||||
sprintf(buffer, "k*ok");
|
{
|
||||||
|
// Not finished, ignore
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos <= bestPos)
|
||||||
|
{
|
||||||
|
bestPlayer = checkPlayer;
|
||||||
|
bestPos = pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See G_DoCompleted and Y_DetermineIntermissionType
|
||||||
|
nointer = ((modeattacking && (players[consoleplayer].pflags & PF_NOCONTEST))
|
||||||
|
|| (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE));
|
||||||
|
|
||||||
|
if (bestPlayer == NULL)
|
||||||
|
{
|
||||||
|
// No jingle for you
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bestPos == UINT8_MAX)
|
||||||
|
{
|
||||||
|
jingle = "RETIRE";
|
||||||
|
|
||||||
|
if (G_GametypeUsesLives() == true)
|
||||||
|
{
|
||||||
|
// A retry will be happening
|
||||||
|
nointer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (bestPlayer->position == 1)
|
||||||
|
{
|
||||||
|
jingle = "_first";
|
||||||
|
}
|
||||||
|
else if (K_IsPlayerLosing(bestPlayer) == false)
|
||||||
|
{
|
||||||
|
jingle = "_win";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jingle = "_lose";
|
||||||
|
|
||||||
|
if (G_GametypeUsesLives() == true)
|
||||||
|
{
|
||||||
|
// A retry will be happening
|
||||||
|
nointer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nointer == true)
|
||||||
|
{
|
||||||
|
// Do not set "racent" in G_Ticker
|
||||||
|
musiccountdown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jingle == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
S_SpeedMusic(1.0f);
|
S_SpeedMusic(1.0f);
|
||||||
|
|
||||||
if (racetracks == true)
|
S_ChangeMusicInternal(jingle, false);
|
||||||
{
|
|
||||||
buffer[1] = 'r';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer[1] = 'b';
|
|
||||||
looping = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
S_ChangeMusicInternal(buffer, looping);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -849,96 +819,100 @@ boolean P_EndingMusic(player_t *player)
|
||||||
//
|
//
|
||||||
void P_RestoreMusic(player_t *player)
|
void P_RestoreMusic(player_t *player)
|
||||||
{
|
{
|
||||||
UINT32 position;
|
UINT8 overrideLevel = 0;
|
||||||
|
SINT8 i;
|
||||||
|
|
||||||
if (!P_IsLocalPlayer(player)) // Only applies to a local player
|
if (P_IsLocalPlayer(player) == false)
|
||||||
|
{
|
||||||
|
// Only applies to local players
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
S_SpeedMusic(1.0f);
|
S_SpeedMusic(1.0f);
|
||||||
|
|
||||||
// TO-DO: Use jingle system for Kart's stuff
|
|
||||||
|
|
||||||
// Event - HERE COMES A NEW CHALLENGER
|
// Event - HERE COMES A NEW CHALLENGER
|
||||||
if (mapreset)
|
if (mapreset)
|
||||||
{
|
{
|
||||||
S_ChangeMusicInternal("chalng", false); //S_StopMusic();
|
S_ChangeMusicInternal("chalng", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event - Level Ending
|
// Event - Level Ending
|
||||||
if (P_EndingMusic(player))
|
if (musiccountdown > 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Event - Level Start
|
// Event - Level Start
|
||||||
if ((K_CheckBossIntro() == false)
|
if ((K_CheckBossIntro() == false)
|
||||||
&& (leveltime < (starttime + (TICRATE/2)))) // see also where time overs are handled
|
&& (leveltime < (starttime + (TICRATE/2)))) // see also where time overs are handled
|
||||||
return;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
|
return;
|
||||||
|
|
||||||
if (r_splitscreen)
|
|
||||||
{
|
|
||||||
INT32 bestlocaltimer = 1;
|
|
||||||
const UINT8 *localplayertable = G_PartyArray(consoleplayer);
|
|
||||||
|
|
||||||
#define setbests(p) \
|
|
||||||
if (players[p].playerstate == PST_LIVE) \
|
|
||||||
{ \
|
|
||||||
if (players[p].invincibilitytimer > bestlocaltimer) \
|
|
||||||
{ wantedmus = 1; bestlocaltimer = players[p].invincibilitytimer; } \
|
|
||||||
else if (players[p].growshrinktimer > bestlocaltimer) \
|
|
||||||
{ wantedmus = 2; bestlocaltimer = players[p].growshrinktimer; } \
|
|
||||||
}
|
}
|
||||||
setbests(localplayertable[0]);
|
|
||||||
setbests(localplayertable[1]);
|
for (i = 0; i <= r_splitscreen; i++)
|
||||||
if (r_splitscreen > 1)
|
{
|
||||||
setbests(localplayertable[2]);
|
player_t *checkPlayer = &players[displayplayers[i]];
|
||||||
if (r_splitscreen > 2)
|
if (!checkPlayer)
|
||||||
setbests(localplayertable[3]);
|
|
||||||
#undef setbests
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (player->playerstate == PST_LIVE)
|
continue;
|
||||||
{
|
|
||||||
if (player->invincibilitytimer > 1)
|
|
||||||
wantedmus = 1;
|
|
||||||
else if (player->growshrinktimer > 1)
|
|
||||||
wantedmus = 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item - Grow
|
if (checkPlayer->exiting)
|
||||||
if (wantedmus == 2)
|
|
||||||
{
|
{
|
||||||
S_ChangeMusicInternal("kgrow", true);
|
return;
|
||||||
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
|
|
||||||
}
|
}
|
||||||
// Item - Invincibility
|
|
||||||
else if (wantedmus == 1)
|
if (checkPlayer->invincibilitytimer > 1)
|
||||||
{
|
{
|
||||||
S_ChangeMusicInternal("kinvnc", true);
|
overrideLevel = max(overrideLevel, 2);
|
||||||
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
|
|
||||||
}
|
}
|
||||||
else
|
else if (checkPlayer->growshrinktimer > 1)
|
||||||
{
|
{
|
||||||
|
overrideLevel = max(overrideLevel, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overrideLevel != 0)
|
||||||
|
{
|
||||||
|
// Do a jingle override.
|
||||||
|
jingletype_t jt = JT_NONE;
|
||||||
|
|
||||||
|
switch (overrideLevel)
|
||||||
|
{
|
||||||
|
// Lowest priority to highest priority.
|
||||||
|
case 1:
|
||||||
|
jt = JT_GROW;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
jt = JT_INVINCIBILITY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jt != JT_NONE)
|
||||||
|
{
|
||||||
|
//CONS_Printf("JINGLE: %d\n", jt);
|
||||||
|
//if (S_RecallMusic(jt, false) == false)
|
||||||
|
//{
|
||||||
|
P_PlayJingle(player, jt);
|
||||||
|
//}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Event - Final Lap
|
// Event - Final Lap
|
||||||
// Still works for GME, but disabled for consistency
|
// Still works for GME, but disabled for consistency
|
||||||
if ((gametyperules & GTR_CIRCUIT) && player->laps >= numlaps)
|
if ((gametyperules & GTR_CIRCUIT) && player->laps >= numlaps)
|
||||||
S_SpeedMusic(1.2f);
|
S_SpeedMusic(1.2f);
|
||||||
#endif
|
#endif
|
||||||
if (mapmusresume && cv_resume.value)
|
|
||||||
position = mapmusresume;
|
|
||||||
else
|
|
||||||
position = mapmusposition;
|
|
||||||
|
|
||||||
S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0,
|
if (S_RecallMusic(JT_NONE, false) == false) // go down the stack
|
||||||
S_GetRestoreMusicFadeIn());
|
{
|
||||||
S_ClearRestoreMusicFadeInCvar();
|
CONS_Debug(DBG_BASIC, "Cannot find any music in resume stack!\n");
|
||||||
mapmusresume = 0;
|
S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1286,9 +1260,12 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
|
||||||
void P_DoPlayerExit(player_t *player)
|
void P_DoPlayerExit(player_t *player)
|
||||||
{
|
{
|
||||||
const boolean losing = K_IsPlayerLosing(player);
|
const boolean losing = K_IsPlayerLosing(player);
|
||||||
|
const boolean specialout = (specialstageinfo.valid == true && losing == true);
|
||||||
|
|
||||||
if (player->exiting || mapreset)
|
if (player->exiting || mapreset)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
|
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
|
||||||
{
|
{
|
||||||
|
|
@ -1303,13 +1280,19 @@ void P_DoPlayerExit(player_t *player)
|
||||||
K_PlayerLoseLife(player);
|
K_PlayerLoseLife(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (P_IsLocalPlayer(player) && !specialout)
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
musiccountdown = MUSICCOUNTDOWNMAX;
|
||||||
|
}
|
||||||
|
|
||||||
player->exiting = 1;
|
player->exiting = 1;
|
||||||
|
|
||||||
if (!player->spectator)
|
if (!player->spectator)
|
||||||
{
|
{
|
||||||
ClearFakePlayerSkin(player);
|
ClearFakePlayerSkin(player);
|
||||||
|
|
||||||
if ((gametyperules & GTR_CIRCUIT)) // If in Race Mode, allow
|
if ((gametyperules & GTR_CIRCUIT)) // Special Race-like handling
|
||||||
{
|
{
|
||||||
K_UpdateAllPlayerPositions();
|
K_UpdateAllPlayerPositions();
|
||||||
|
|
||||||
|
|
@ -1333,13 +1316,9 @@ void P_DoPlayerExit(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See Y_StartIntermission timer handling
|
|
||||||
if (!K_CanChangeRules(false) || cv_inttime.value > 0)
|
|
||||||
P_EndingMusic(player);
|
|
||||||
|
|
||||||
if (P_CheckRacers() && !exitcountdown)
|
if (P_CheckRacers() && !exitcountdown)
|
||||||
{
|
{
|
||||||
if (specialstageinfo.valid == true && losing == true)
|
if (specialout == true)
|
||||||
{
|
{
|
||||||
exitcountdown = TICRATE;
|
exitcountdown = TICRATE;
|
||||||
}
|
}
|
||||||
|
|
@ -1349,16 +1328,9 @@ void P_DoPlayerExit(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gametyperules & GTR_BUMPERS)) // Battle Mode exiting
|
else if (!exitcountdown) // All other gametypes
|
||||||
{
|
{
|
||||||
if (!exitcountdown)
|
exitcountdown = raceexittime+1;
|
||||||
exitcountdown = battleexittime+1;
|
|
||||||
P_EndingMusic(player);
|
|
||||||
}
|
|
||||||
else // Accidental death safeguard???
|
|
||||||
{
|
|
||||||
if (!exitcountdown)
|
|
||||||
exitcountdown = raceexittime+2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grandprixinfo.gp == true && player->bot == false && losing == false)
|
if (grandprixinfo.gp == true && player->bot == false && losing == false)
|
||||||
|
|
@ -1377,7 +1349,9 @@ void P_DoPlayerExit(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modeattacking)
|
if (modeattacking)
|
||||||
|
{
|
||||||
G_UpdateRecords();
|
G_UpdateRecords();
|
||||||
|
}
|
||||||
|
|
||||||
profile_t *pr = PR_GetPlayerProfile(player);
|
profile_t *pr = PR_GetPlayerProfile(player);
|
||||||
if (pr != NULL && !losing)
|
if (pr != NULL && !losing)
|
||||||
|
|
@ -3844,10 +3818,16 @@ void P_DoTimeOver(player_t *player)
|
||||||
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER);
|
P_DamageMobj(player->mo, NULL, NULL, 1, DMG_TIMEOVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
P_EndingMusic(player);
|
if (P_IsLocalPlayer(player))
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
musiccountdown = MUSICCOUNTDOWNMAX;
|
||||||
|
}
|
||||||
|
|
||||||
if (!exitcountdown)
|
if (!exitcountdown)
|
||||||
exitcountdown = 5*TICRATE;
|
{
|
||||||
|
exitcountdown = raceexittime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SRB2Kart: These are useful functions, but we aren't using them yet.
|
// SRB2Kart: These are useful functions, but we aren't using them yet.
|
||||||
|
|
|
||||||
|
|
@ -805,7 +805,7 @@ void Y_StartIntermission(void)
|
||||||
if (prevmap >= nummapheaders || !mapheaderinfo[prevmap])
|
if (prevmap >= nummapheaders || !mapheaderinfo[prevmap])
|
||||||
I_Error("Y_StartIntermission: Internal map ID %d not found (nummapheaders = %d)", prevmap, nummapheaders);
|
I_Error("Y_StartIntermission: Internal map ID %d not found (nummapheaders = %d)", prevmap, nummapheaders);
|
||||||
|
|
||||||
if (!(gametyperules & GTR_CIRCUIT) && (timer > 1))
|
if (timer > 1 && musiccountdown == 0)
|
||||||
S_ChangeMusicInternal("racent", true); // loop it
|
S_ChangeMusicInternal("racent", true); // loop it
|
||||||
|
|
||||||
S_ShowMusicCredit(); // Always call
|
S_ShowMusicCredit(); // Always call
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue