mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add speed to gametype
Set a specific gamespeed per gametype. KARTSPEED_AUTO for it to be decided by game settings. Wanted this for a while, but also it makes game speed display logic for DRP very straightforward.
This commit is contained in:
parent
55d71d7674
commit
af6340741e
6 changed files with 55 additions and 10 deletions
|
|
@ -784,6 +784,7 @@ void readgametype(MYFILE *f, char *gtname)
|
||||||
INT32 newgtpointlimit = 0;
|
INT32 newgtpointlimit = 0;
|
||||||
INT32 newgttimelimit = 0;
|
INT32 newgttimelimit = 0;
|
||||||
UINT8 newgtinttype = 0;
|
UINT8 newgtinttype = 0;
|
||||||
|
SINT8 newgtspeed = KARTSPEED_AUTO; // KARTSPEED_EASY
|
||||||
char gtconst[MAXLINELEN];
|
char gtconst[MAXLINELEN];
|
||||||
char gppic[9];
|
char gppic[9];
|
||||||
char gppicmini[9];
|
char gppicmini[9];
|
||||||
|
|
@ -850,6 +851,29 @@ void readgametype(MYFILE *f, char *gtname)
|
||||||
// Case sensitive
|
// Case sensitive
|
||||||
newgtinttype = (int)get_number(word2lwr);
|
newgtinttype = (int)get_number(word2lwr);
|
||||||
}
|
}
|
||||||
|
else if (fastcmp(word, "GAMESPEED"))
|
||||||
|
{
|
||||||
|
if (fasticmp(word2, "EASY"))
|
||||||
|
{
|
||||||
|
newgtspeed = KARTSPEED_EASY;
|
||||||
|
}
|
||||||
|
else if (fasticmp(word2, "NORMAL"))
|
||||||
|
{
|
||||||
|
newgtspeed = KARTSPEED_NORMAL;
|
||||||
|
}
|
||||||
|
else if (fasticmp(word2, "HARD"))
|
||||||
|
{
|
||||||
|
newgtspeed = KARTSPEED_HARD;
|
||||||
|
}
|
||||||
|
else if (fasticmp(word2, "ANY"))
|
||||||
|
{
|
||||||
|
newgtspeed = KARTSPEED_AUTO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deh_warning("readgametype %s: unknown gamespeed name %s\n", gtname, word2);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Type of level
|
// Type of level
|
||||||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||||
{
|
{
|
||||||
|
|
@ -942,6 +966,7 @@ void readgametype(MYFILE *f, char *gtname)
|
||||||
newgametype->intermission = newgtinttype;
|
newgametype->intermission = newgtinttype;
|
||||||
newgametype->pointlimit = newgtpointlimit;
|
newgametype->pointlimit = newgtpointlimit;
|
||||||
newgametype->timelimit = newgttimelimit;
|
newgametype->timelimit = newgttimelimit;
|
||||||
|
newgametype->speed = newgtspeed;
|
||||||
|
|
||||||
gametypes[numgametypes++] = newgametype;
|
gametypes[numgametypes++] = newgametype;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -624,6 +624,7 @@ struct gametype_t
|
||||||
UINT32 rules;
|
UINT32 rules;
|
||||||
UINT32 tol;
|
UINT32 tol;
|
||||||
UINT8 intermission;
|
UINT8 intermission;
|
||||||
|
SINT8 speed;
|
||||||
INT32 pointlimit;
|
INT32 pointlimit;
|
||||||
INT32 timelimit;
|
INT32 timelimit;
|
||||||
char gppic[9];
|
char gppic[9];
|
||||||
|
|
|
||||||
|
|
@ -3181,6 +3181,7 @@ static gametype_t defaultgametypes[] =
|
||||||
GTR_CIRCUIT|GTR_BOTS|GTR_ENCORE,
|
GTR_CIRCUIT|GTR_BOTS|GTR_ENCORE,
|
||||||
TOL_RACE,
|
TOL_RACE,
|
||||||
int_time,
|
int_time,
|
||||||
|
KARTSPEED_AUTO,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"",
|
"",
|
||||||
|
|
@ -3194,6 +3195,7 @@ static gametype_t defaultgametypes[] =
|
||||||
GTR_SPHERES|GTR_BUMPERS|GTR_PAPERITEMS|GTR_POWERSTONES|GTR_KARMA|GTR_ITEMARROWS|GTR_PRISONS|GTR_BATTLESTARTS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_CLOSERPLAYERS,
|
GTR_SPHERES|GTR_BUMPERS|GTR_PAPERITEMS|GTR_POWERSTONES|GTR_KARMA|GTR_ITEMARROWS|GTR_PRISONS|GTR_BATTLESTARTS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_CLOSERPLAYERS,
|
||||||
TOL_BATTLE,
|
TOL_BATTLE,
|
||||||
int_scoreortimeattack,
|
int_scoreortimeattack,
|
||||||
|
KARTSPEED_EASY,
|
||||||
0,
|
0,
|
||||||
3,
|
3,
|
||||||
"TT_RNDB",
|
"TT_RNDB",
|
||||||
|
|
@ -3207,6 +3209,7 @@ static gametype_t defaultgametypes[] =
|
||||||
GTR_CATCHER|GTR_SPECIALSTART|GTR_ROLLINGSTART|GTR_CIRCUIT|GTR_NOPOSITION,
|
GTR_CATCHER|GTR_SPECIALSTART|GTR_ROLLINGSTART|GTR_CIRCUIT|GTR_NOPOSITION,
|
||||||
TOL_SPECIAL,
|
TOL_SPECIAL,
|
||||||
int_time,
|
int_time,
|
||||||
|
KARTSPEED_AUTO,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"TT_RNDSS",
|
"TT_RNDSS",
|
||||||
|
|
@ -3220,6 +3223,7 @@ static gametype_t defaultgametypes[] =
|
||||||
GTR_BOSS|GTR_SPHERES|GTR_BUMPERS|GTR_POINTLIMIT|GTR_CLOSERPLAYERS|GTR_NOCUPSELECT|GTR_ENCORE,
|
GTR_BOSS|GTR_SPHERES|GTR_BUMPERS|GTR_POINTLIMIT|GTR_CLOSERPLAYERS|GTR_NOCUPSELECT|GTR_ENCORE,
|
||||||
TOL_VERSUS,
|
TOL_VERSUS,
|
||||||
int_scoreortimeattack,
|
int_scoreortimeattack,
|
||||||
|
KARTSPEED_EASY,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"",
|
"",
|
||||||
|
|
@ -3233,6 +3237,7 @@ static gametype_t defaultgametypes[] =
|
||||||
GTR_CHECKPOINTS|GTR_NOMP|GTR_NOCUPSELECT|GTR_NOPOSITION,
|
GTR_CHECKPOINTS|GTR_NOMP|GTR_NOCUPSELECT|GTR_NOPOSITION,
|
||||||
TOL_TUTORIAL,
|
TOL_TUTORIAL,
|
||||||
int_none,
|
int_none,
|
||||||
|
KARTSPEED_EASY,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"",
|
"",
|
||||||
|
|
|
||||||
|
|
@ -2516,7 +2516,7 @@ static void HU_DrawRankings(void)
|
||||||
V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
|
V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
|
||||||
V_DrawCenteredString(256, 16, hilicol, va("%d", g_pointlimit));
|
V_DrawCenteredString(256, 16, hilicol, va("%d", g_pointlimit));
|
||||||
}
|
}
|
||||||
else if (gametyperules & GTR_CIRCUIT)
|
else if (gametypes[gametype]->speed == KARTSPEED_AUTO)
|
||||||
{
|
{
|
||||||
V_DrawCenteredString(256, 8, 0, "GAME SPEED");
|
V_DrawCenteredString(256, 8, 0, "GAME SPEED");
|
||||||
V_DrawCenteredString(256, 16, hilicol, (cv_4thgear.value) ? va("4th Gear") : kartspeed_cons_t[1+gamespeed].strvalue);
|
V_DrawCenteredString(256, 16, hilicol, (cv_4thgear.value) ? va("4th Gear") : kartspeed_cons_t[1+gamespeed].strvalue);
|
||||||
|
|
|
||||||
|
|
@ -2567,6 +2567,7 @@ static int lib_gAddGametype(lua_State *L)
|
||||||
INT32 newgtpointlimit = 0;
|
INT32 newgtpointlimit = 0;
|
||||||
INT32 newgttimelimit = 0;
|
INT32 newgttimelimit = 0;
|
||||||
UINT8 newgtinttype = 0;
|
UINT8 newgtinttype = 0;
|
||||||
|
SINT8 newgtspeed = KARTSPEED_AUTO;
|
||||||
INT16 j;
|
INT16 j;
|
||||||
|
|
||||||
luaL_checktype(L, 1, LUA_TTABLE);
|
luaL_checktype(L, 1, LUA_TTABLE);
|
||||||
|
|
@ -2632,6 +2633,14 @@ static int lib_gAddGametype(lua_State *L)
|
||||||
if (!lua_isstring(L, 3))
|
if (!lua_isstring(L, 3))
|
||||||
TYPEERROR("gppicmini", LUA_TSTRING)
|
TYPEERROR("gppicmini", LUA_TSTRING)
|
||||||
gppicmini = lua_tostring(L, 3);
|
gppicmini = lua_tostring(L, 3);
|
||||||
|
} else if (i == 10 || (k && fasticmp(k, "speed"))) {
|
||||||
|
if (!lua_isnumber(L, 3))
|
||||||
|
TYPEERROR("speed", LUA_TNUMBER)
|
||||||
|
newgtspeed = (UINT32)lua_tointeger(L, 3);
|
||||||
|
if (newgtspeed < KARTSPEED_AUTO || newgtspeed > KARTSPEED_HARD)
|
||||||
|
{
|
||||||
|
newgtspeed = KARTSPEED_AUTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -2672,6 +2681,7 @@ static int lib_gAddGametype(lua_State *L)
|
||||||
newgametype->intermission = newgtinttype;
|
newgametype->intermission = newgtinttype;
|
||||||
newgametype->pointlimit = newgtpointlimit;
|
newgametype->pointlimit = newgtpointlimit;
|
||||||
newgametype->timelimit = newgttimelimit;
|
newgametype->timelimit = newgttimelimit;
|
||||||
|
newgametype->speed = newgtspeed;
|
||||||
|
|
||||||
if (gppic != NULL)
|
if (gppic != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7673,7 +7673,8 @@ static void P_InitLevelSettings(void)
|
||||||
g_exit.retry = false;
|
g_exit.retry = false;
|
||||||
|
|
||||||
// Gamespeed and frantic items
|
// Gamespeed and frantic items
|
||||||
gamespeed = KARTSPEED_EASY;
|
const boolean multi_speed = (gametypes[gametype]->speed == KARTSPEED_AUTO);
|
||||||
|
gamespeed = multi_speed ? KARTSPEED_EASY : gametypes[gametype]->speed;
|
||||||
franticitems = false;
|
franticitems = false;
|
||||||
|
|
||||||
if (K_PodiumSequence() == true)
|
if (K_PodiumSequence() == true)
|
||||||
|
|
@ -7688,7 +7689,7 @@ static void P_InitLevelSettings(void)
|
||||||
}
|
}
|
||||||
else if (grandprixinfo.gp == true)
|
else if (grandprixinfo.gp == true)
|
||||||
{
|
{
|
||||||
if (gametyperules & GTR_CIRCUIT)
|
if (multi_speed)
|
||||||
{
|
{
|
||||||
gamespeed = grandprixinfo.gamespeed;
|
gamespeed = grandprixinfo.gamespeed;
|
||||||
}
|
}
|
||||||
|
|
@ -7697,19 +7698,22 @@ static void P_InitLevelSettings(void)
|
||||||
modeattacking != ATTACKING_NONE
|
modeattacking != ATTACKING_NONE
|
||||||
|| tutorialchallenge == TUTORIALSKIP_INPROGRESS
|
|| tutorialchallenge == TUTORIALSKIP_INPROGRESS
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
if (multi_speed)
|
||||||
{
|
{
|
||||||
if ((gametyperules & GTR_CATCHER) && encoremode == false)
|
if ((gametyperules & GTR_CATCHER) && encoremode == false)
|
||||||
{
|
{
|
||||||
gamespeed = KARTSPEED_NORMAL;
|
gamespeed = KARTSPEED_NORMAL;
|
||||||
}
|
}
|
||||||
else if (gametyperules & GTR_CIRCUIT)
|
else
|
||||||
{
|
{
|
||||||
gamespeed = KARTSPEED_HARD;
|
gamespeed = KARTSPEED_HARD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gametyperules & GTR_CIRCUIT)
|
if (multi_speed)
|
||||||
{
|
{
|
||||||
if (cv_kartspeed.value == KARTSPEED_AUTO)
|
if (cv_kartspeed.value == KARTSPEED_AUTO)
|
||||||
gamespeed = ((speedscramble == -1) ? KARTSPEED_NORMAL : (UINT8)speedscramble);
|
gamespeed = ((speedscramble == -1) ? KARTSPEED_NORMAL : (UINT8)speedscramble);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue