Merge branch 'gears' into 'master'

Replace Easy, Normal, Hard speed with Gear 1, 2, 3; also debugchallenges and console changes

See merge request KartKrew/Kart!1962
This commit is contained in:
Oni 2024-02-28 03:12:54 +00:00
commit 693c177572
8 changed files with 134 additions and 28 deletions

View file

@ -83,15 +83,15 @@ CV_PossibleValue_t CV_TrueFalse[] = {{0, "False"}, {1, "True"}, {0, NULL}};
// SRB2kart
CV_PossibleValue_t kartspeed_cons_t[] = {
{KARTSPEED_AUTO, "Auto"},
{KARTSPEED_EASY, "Easy"},
{KARTSPEED_NORMAL, "Normal"},
{KARTSPEED_HARD, "Hard"},
{KARTSPEED_EASY, "Gear 1"},
{KARTSPEED_NORMAL, "Gear 2"},
{KARTSPEED_HARD, "Gear 3"},
{0, NULL}
};
CV_PossibleValue_t dummykartspeed_cons_t[] = {
{KARTSPEED_EASY, "Easy"},
{KARTSPEED_NORMAL, "Normal"},
{KARTSPEED_HARD, "Hard"},
{KARTSPEED_EASY, "Gear 1"},
{KARTSPEED_NORMAL, "Gear 2"},
{KARTSPEED_HARD, "Gear 3"},
{0, NULL}
};
CV_PossibleValue_t gpdifficulty_cons_t[] = {
@ -2033,7 +2033,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
if (var == &cv_kartspeed && !M_SecretUnlocked(SECRET_HARDSPEED, false))
{
if (!stricmp(value, "Hard") || atoi(value) >= KARTSPEED_HARD)
if (!stricmp(value, "Gear 3") || atoi(value) >= KARTSPEED_HARD)
{
CONS_Printf(M_GetText("You haven't unlocked this yet!\n"));
return;

View file

@ -895,6 +895,31 @@ static void CON_InputDelChar(void)
// ----
//
static void AdjustTextSize(INT32 n)
{
INT32 range = max(vid.dupx, vid.dupy);
if (range < 3) // make bigger jumps if the resolution is small
n *= 4 - range;
// 1-3 ascending is larger
// but 0 is special and is the largest
INT32 cur = (cv_constextsize.value & V_SCALEPATCHMASK) >> V_SCALEPATCHSHIFT;
if (!cur) // reverse direction at 0
{
if (n < 0)
cur = 4 + n;
else
return;
}
else
cur += n;
if (cur < 1) // min: V_NOSCALEPATCH
cur = 1;
if (cur > 4) // max: 4 & 3 = 0
cur = 4;
CV_SetValue(&cv_constextsize, (cur << V_SCALEPATCHSHIFT) & V_SCALEPATCHMASK);
}
// Handles console key input
//
boolean CON_Responder(event_t *ev)
@ -1138,6 +1163,18 @@ boolean CON_Responder(event_t *ev)
return true;
}
// Zoom
if (key == '=')
{
AdjustTextSize(1);
return true;
}
else if (key == '-')
{
AdjustTextSize(-1);
return true;
}
// ...why shouldn't it eat the key? if it doesn't, it just means you
// can control Sonic from the console, which is silly
return true;//return false;

View file

@ -859,7 +859,13 @@ consvar_t cv_kartdebugnodes = ServerCheat("debugnodes", "Off").on_off().descript
consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYERS).description("Let P1's Profile control a different splitscreen player");
#ifdef DEVELOP
consvar_t cv_debugchallenges = PlayerCheat("debugchallenges", "Off").on_off().description("Chao keys are infinite, unlock any tile, relock tiles, animations play quickly");
consvar_t cv_debugchallenges = PlayerCheat("debugchallenges", "Off").description("Chao keys are infinite, unlock any tile, relock tiles, animations play quickly").values({
{1, "MIN"},
{UINT16_MAX-1, "MAX"},
{0, "Off"},
{-1, "On"},
{-2, "Tag"},
});
#endif
consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines, respawn lines, death pits and instakill planes with high contrast colors");
@ -913,13 +919,14 @@ consvar_t cv_dummyaddonsearch = MenuDummy("dummyaddonsearch", "").onchange_noini
consvar_t cv_dummyextraspassword = MenuDummy("dummyextraspassword", "");
extern CV_PossibleValue_t gpdifficulty_cons_t[];
consvar_t cv_dummygpdifficulty = MenuDummy("dummygpdifficulty", "Normal").values(gpdifficulty_cons_t);
void Dummygpdifficulty_OnChange(void);
consvar_t cv_dummygpdifficulty = MenuDummy("dummygpdifficulty", "Normal").values(gpdifficulty_cons_t).onchange(Dummygpdifficulty_OnChange);
consvar_t cv_dummygpencore = MenuDummy("dummygpencore", "Off").on_off();
consvar_t cv_dummyip = MenuDummy("dummyip", "");
extern CV_PossibleValue_t dummykartspeed_cons_t[];
consvar_t cv_dummykartspeed = MenuDummy("dummykartspeed", "Normal").values(dummykartspeed_cons_t);
consvar_t cv_dummykartspeed = MenuDummy("dummykartspeed", "Gear 2").values(dummykartspeed_cons_t);
consvar_t cv_dummymatchbots = MenuDummy("dummymatchbots", "Off").values({
{0, "Off"},

View file

@ -2777,7 +2777,7 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
x2 = KARTGP_MASTER;
else
{
deh_warning("gamespeed requirement \"%s\" invalid for condition ID %d", params[3], id+1);
deh_warning("difficulty requirement \"%s\" invalid for condition ID %d", params[3], id+1);
return;
}
}
@ -2801,7 +2801,7 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
re = KARTGP_MASTER;
else
{
deh_warning("gamespeed requirement \"%s\" invalid for condition ID %d", params[1], id+1);
deh_warning("difficulty requirement \"%s\" invalid for condition ID %d", params[1], id+1);
return;
}
}
@ -2975,24 +2975,33 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
}
else if (fastcmp(params[0], "ISDIFFICULTY"))
{
//PARAMCHECK(1);
PARAMCHECK(1);
ty = UCRP_ISDIFFICULTY;
re = KARTSPEED_NORMAL;
if (params[1])
{
if (fastcmp(params[1], "NORMAL"))
;
re = KARTSPEED_NORMAL;
else if (fastcmp(params[1], "HARD"))
re = KARTSPEED_HARD;
else if (fastcmp(params[1], "MASTER"))
re = KARTGP_MASTER;
else
{
deh_warning("gamespeed requirement \"%s\" invalid for condition ID %d", params[1], id+1);
deh_warning("difficulty requirement \"%s\" invalid for condition ID %d", params[1], id+1);
return;
}
}
}
else if (fastcmp(params[0], "ISGEAR"))
{
PARAMCHECK(1);
ty = UCRP_ISGEAR;
re = atoi(params[1]) - 1;
if (re < KARTSPEED_NORMAL || re > KARTSPEED_HARD)
{
deh_warning("gear requirement \"%s\" invalid for condition ID %d", params[1], id+1);
return;
}
}
else if (fastcmp(params[0], "PODIUMCUP"))
{
PARAMCHECK(1);

View file

@ -6185,9 +6185,13 @@ void M_DrawAddons(void)
static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili)
{
#ifdef DEVELOP
extern consvar_t cv_debugchallenges;
#endif
unlockable_t *ref = NULL;
patch_t *pat = missingpat;
UINT8 *colormap = NULL, *bgmap = NULL;
INT32 tileflags = 0;
fixed_t siz, accordion;
UINT16 id, num;
boolean unlockedyet;
@ -6205,6 +6209,16 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
// Okay, this is what we want to draw.
ref = &unlockables[num];
#ifdef DEVELOP
if (cv_debugchallenges.value > 0 &&
cv_debugchallenges.value != ref->conditionset)
{
// Searching for a conditionset, fade out any tiles
// that don't match.
tileflags = V_80TRANS;
}
#endif
unlockedyet = !((gamedata->unlocked[num] == false)
|| (challengesmenu.pending && num == challengesmenu.currentunlock && challengesmenu.unlockanim <= UNLOCKTIME));
@ -6275,7 +6289,7 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
(x*FRACUNIT) + (SHORT(pat->width)*(FRACUNIT-accordion)/2), y*FRACUNIT,
accordion,
FRACUNIT,
0, pat,
tileflags, pat,
bgmap
);
@ -6285,9 +6299,12 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
|| challengesmenu.extradata[id].flip > (3*TILEFLIP_MAX)/4);
#ifdef DEVELOP
extern consvar_t cv_debugchallenges;
if (cv_debugchallenges.value)
{
// Show the content of every tile without needing to
// flip them.
categoryside = false;
}
#endif
if (categoryside)
@ -6471,7 +6488,7 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
((x + 5)*FRACUNIT) + (32*(FRACUNIT-accordion)/2), (y + 5)*FRACUNIT,
FixedDiv(32*accordion, siz),
FixedDiv(32 << FRACBITS, siz),
0, pat,
tileflags, pat,
colormap
);
}
@ -6481,17 +6498,13 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
((x + 2)*FRACUNIT) + (16*(FRACUNIT-accordion)/2), (y + 2)*FRACUNIT,
FixedDiv(16*accordion, siz),
FixedDiv(16 << FRACBITS, siz),
0, pat,
tileflags, pat,
colormap
);
}
drawborder:
if (!hili)
{
return;
}
if (hili)
{
boolean maj = (ref != NULL && ref->majorunlock);
char buffer[9];
@ -6509,6 +6522,17 @@ drawborder:
colormap
);
}
#ifdef DEVELOP
if (cv_debugchallenges.value == -2 ||
cv_debugchallenges.value > 0)
{
// Display the conditionset for this tile.
V_DrawThinString(x, y,
ref->conditionset == cv_debugchallenges.value ? V_AQUAMAP : V_GRAYMAP,
va("%u", ref->conditionset));
}
#endif
}
#define challengetransparentstrength 8

View file

@ -1612,10 +1612,12 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
return (cn->requirement != -1 && player->followerskin == cn->requirement);
case UCRP_ISDIFFICULTY:
if (grandprixinfo.gp == false)
return (gamespeed >= cn->requirement);
return false;
if (cn->requirement == KARTGP_MASTER)
return (grandprixinfo.masterbots == true);
return (grandprixinfo.gamespeed >= cn->requirement);
case UCRP_ISGEAR:
return (gamespeed >= cn->requirement);
case UCRP_PODIUMCUP:
if (grandprixinfo.gp == false || K_PodiumSequence() == false)
@ -2527,6 +2529,8 @@ static const char *M_GetConditionString(condition_t *cn)
return speedtext;
}
case UCRP_ISGEAR:
return va("in Gear %d", cn->requirement + 1);
case UCRP_PODIUMCUP:
{

View file

@ -92,7 +92,8 @@ typedef enum
UCRP_ISCHARACTER, // character == [skin]
UCRP_ISENGINECLASS, // engine class [class]
UCRP_HASFOLLOWER, // follower == [followerskin]
UCRP_ISDIFFICULTY, // difficulty >= [difficulty]
UCRP_ISDIFFICULTY, // GP difficulty >= [difficulty]
UCRP_ISGEAR, // gear speed >= [speed]
UCRP_PODIUMCUP, // cup == [cup] [optional: >= grade OR place]
UCRP_PODIUMEMERALD, // Get to podium sequence with that cup's emerald

View file

@ -151,3 +151,27 @@ void M_SetupDifficultySelect(INT32 choice)
M_SetupNextMenu(&PLAY_RaceDifficultyDef, false);
}
void Dummygpdifficulty_OnChange(void);
void Dummygpdifficulty_OnChange(void)
{
const char *tooltip = NULL;
switch (cv_dummygpdifficulty.value)
{
case KARTSPEED_EASY:
tooltip = "Warm up to the track with some\x83 Gear 1\x80 practice. For\x83 beginners.";
break;
case KARTSPEED_NORMAL:
tooltip = "Push to the top in\x82 Gear 2\x80. A balanced challenge for\x82 everyone!";
break;
case KARTSPEED_HARD:
tooltip = "Challenge tough competition at\x87 Gear 3\x80. For\x87 thrill-seekers!";
break;
case KARTGP_MASTER:
tooltip = "Let's go crazy! Take on brutal CPUs at\x87 Gear 3\x80: for\x85 lunatics only!";
break;
}
PLAY_RaceDifficulty[drace_gpdifficulty].tooltip = tooltip;
}