mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 04:02:37 +00:00
Remove restrictions on numlaps, merge with gptest
- numlaps 0 now sets the race to 0 laps.
- Players will finish upon crossing the finishing line
immediately after POSITION.
- gptest merged with numlaps.
- numlaps works in GP.
- Warping to sprint maps with numlaps already set now lets
numlaps exceed the map default. It was previous capped
at map default ONLY when loading into the level (so you
could still exceed it by setting numlaps during
POSITION). Now it's consistent.
- numlaps can now be set at any time during the race.
This commit is contained in:
parent
4588a20a95
commit
e437656633
7 changed files with 55 additions and 40 deletions
|
|
@ -62,6 +62,7 @@
|
|||
#include "deh_tables.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "k_specialstage.h"
|
||||
#include "k_race.h"
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
#include "m_avrecorder.h"
|
||||
|
|
@ -443,7 +444,6 @@ consvar_t cv_kartdebugnodes = CVAR_INIT ("debugnodes", "Off", CV_CHEAT, CV_OnOff
|
|||
consvar_t cv_kartdebugcolorize = CVAR_INIT ("debugcolorize", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_kartdebugdirector = CVAR_INIT ("debugdirector", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_spbtest = CVAR_INIT ("spbtest", "Off", CV_CHEAT|CV_NETVAR, CV_OnOff, NULL);
|
||||
consvar_t cv_gptest = CVAR_INIT ("gptest", "Off", CV_CHEAT|CV_NETVAR, CV_OnOff, NULL);
|
||||
consvar_t cv_debugrank = CVAR_INIT ("debugrank", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_battletest = CVAR_INIT ("battletest", "Off", CV_CHEAT|CV_NETVAR, CV_OnOff, NULL);
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ consvar_t cv_pointlimit = CVAR_INIT ("pointlimit", "Default", CV_NETVAR|CV_CALL|
|
|||
static CV_PossibleValue_t timelimit_cons_t[] = {{1, "MIN"}, {30*60, "MAX"}, {0, "None"}, {-1, "Default"}, {0, NULL}};
|
||||
consvar_t cv_timelimit = CVAR_INIT ("timelimit", "Default", CV_NETVAR|CV_CALL|CV_NOINIT, timelimit_cons_t, TimeLimit_OnChange);
|
||||
|
||||
static CV_PossibleValue_t numlaps_cons_t[] = {{1, "MIN"}, {MAX_LAPS, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||
static CV_PossibleValue_t numlaps_cons_t[] = {{0, "MIN"}, {MAX_LAPS, "MAX"}, {-1, "Map default"}, {0, NULL}};
|
||||
consvar_t cv_numlaps = CVAR_INIT ("numlaps", "Map default", CV_SAVE|CV_NETVAR|CV_CALL|CV_CHEAT, numlaps_cons_t, NumLaps_OnChange);
|
||||
|
||||
consvar_t cv_forceskin = CVAR_INIT ("forcecharacter", "None", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange);
|
||||
|
|
@ -6544,15 +6544,18 @@ static void Command_ShowTime_f(void)
|
|||
// SRB2Kart: On change messages
|
||||
static void NumLaps_OnChange(void)
|
||||
{
|
||||
if (K_CanChangeRules(false) == false)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
numlaps = K_RaceLapCount(gamemap - 1);
|
||||
|
||||
if (gamestate == GS_LEVEL && leveltime < starttime)
|
||||
{
|
||||
CONS_Printf(M_GetText("Number of laps have been set to %d.\n"), cv_numlaps.value);
|
||||
numlaps = (UINT8)cv_numlaps.value;
|
||||
if (cv_numlaps.value == -1)
|
||||
{
|
||||
CONS_Printf(M_GetText("Number of laps have been set to %d (map default).\n"), numlaps);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf(M_GetText("Number of laps have been set to %d.\n"), numlaps);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ extern consvar_t cv_votetime;
|
|||
|
||||
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugdistribution, cv_kartdebughuddrop;
|
||||
extern consvar_t cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector;
|
||||
extern consvar_t cv_spbtest, cv_gptest, cv_reducevfx;
|
||||
extern consvar_t cv_spbtest, cv_reducevfx;
|
||||
extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict;
|
||||
extern consvar_t cv_debugrank;
|
||||
extern consvar_t cv_battletest;
|
||||
|
|
|
|||
|
|
@ -349,7 +349,6 @@ void K_RegisterKartStuff(void)
|
|||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_debugrank);
|
||||
CV_RegisterVar(&cv_spbtest);
|
||||
CV_RegisterVar(&cv_gptest);
|
||||
CV_RegisterVar(&cv_capsuletest);
|
||||
CV_RegisterVar(&cv_battletest);
|
||||
CV_RegisterVar(&cv_debugencorevote);
|
||||
|
|
|
|||
23
src/k_race.c
23
src/k_race.c
|
|
@ -421,3 +421,26 @@ void K_RunFinishLineBeam(void)
|
|||
K_DrawFinishLineBeamForLine(offsetb, aimingb, finishBeamLine, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
UINT8 K_RaceLapCount(void);
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
|
||||
UINT8 K_RaceLapCount(INT16 mapNum)
|
||||
{
|
||||
if (!(gametyperules & GTR_CIRCUIT))
|
||||
{
|
||||
// Not in Race mode
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cv_numlaps.value == -1)
|
||||
{
|
||||
// Use map default
|
||||
return mapheaderinfo[mapNum]->numlaps;
|
||||
}
|
||||
|
||||
return cv_numlaps.value;
|
||||
}
|
||||
|
|
|
|||
16
src/k_race.h
16
src/k_race.h
|
|
@ -70,6 +70,22 @@ boolean K_GenerateFinishBeamLine(void);
|
|||
|
||||
void K_RunFinishLineBeam(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
UINT8 K_RaceLapCount(INT16 mapNum);
|
||||
|
||||
Returns the effective final lap count of the race.
|
||||
|
||||
Input Arguments:-
|
||||
mapNum - The level to count laps for, 0-indexed.
|
||||
|
||||
Return:-
|
||||
The lap count to finish.
|
||||
--------------------------------------------------*/
|
||||
|
||||
UINT8 K_RaceLapCount(INT16 mapNum);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "r_things.h"
|
||||
#include "fastcmp.h"
|
||||
#include "byteptr.h"
|
||||
#include "k_race.h"
|
||||
|
||||
// I was ALMOST tempted to start tearing apart all
|
||||
// of the map loading code and turning it into C++
|
||||
|
|
@ -304,12 +305,7 @@ void K_InitGrandPrixRank(gpRank_t *rankData)
|
|||
const INT32 cupLevelNum = grandprixinfo.cup->cachedlevels[i];
|
||||
if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum] != NULL)
|
||||
{
|
||||
if (!cv_gptest.value)
|
||||
{
|
||||
laps += mapheaderinfo[cupLevelNum]->numlaps;
|
||||
continue;
|
||||
}
|
||||
laps++;
|
||||
laps += K_RaceLapCount(cupLevelNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7443,29 +7443,7 @@ static void P_InitGametype(void)
|
|||
if (modeattacking && !demo.playback)
|
||||
P_LoadRecordGhosts();
|
||||
|
||||
if (gametyperules & GTR_CIRCUIT)
|
||||
{
|
||||
if (K_CanChangeRules(true) && cv_numlaps.value
|
||||
&& (!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|
||||
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_numlaps.value)))
|
||||
{
|
||||
numlaps = cv_numlaps.value;
|
||||
}
|
||||
else if ((grandprixinfo.gp == true)
|
||||
&& (grandprixinfo.eventmode == GPEVENT_NONE)
|
||||
&& cv_gptest.value)
|
||||
{
|
||||
numlaps = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
numlaps = mapheaderinfo[gamemap - 1]->numlaps;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
numlaps = 0;
|
||||
}
|
||||
numlaps = K_RaceLapCount(gamemap - 1);
|
||||
|
||||
wantedcalcdelay = wantedfrequency*2;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue