Split glitchrunner mode into multiple versions

Previously, turning glitchrunner mode on essentially locked you to
emulating 2.0, and turning it off just meant normal 2.3 behavior. But
what if you wanted 2.2 behavior instead? Well, that's what I had to ask
when a TAS of mine would desync in 2.3 because of the two-frame delay
fix (glitchrunner off), but would also desync because of 2.0 warp lines
(glitchrunner on).

What I've done is made it so there are three states to glitchrunner mode
now: 2.0 (previously just the "on" state), 2.2 (previously a state you
couldn't use), and "off". Furthermore, I made it an enum, so in case
future versions of the game patch out more glitches, we can add them to
the enum (and the only other thing we have to update is a lookup table
in GlitchrunnerMode.c). Also, 2.2 glitches exist in 2.0, so you'll want
to use GlitchrunnerMode_less_than_or_equal() to check glitchrunner
version.
This commit is contained in:
Misa
2021-08-04 17:09:49 -07:00
committed by Ethan Lee
parent b09d0c48e4
commit 243f9b92f8
12 changed files with 208 additions and 34 deletions

View File

@@ -4,6 +4,7 @@
#include "editor.h"
#include "Entity.h"
#include "FileSystemUtils.h"
#include "GlitchrunnerMode.h"
#include "Graphics.h"
#include "GraphicsUtil.h"
#include "KeyPoll.h"
@@ -105,6 +106,37 @@ static void volumesliderrender(void)
graphics.Print(-1, 85, buffer, tr, tg, tb, true);
}
static void inline drawglitchrunnertext(void)
{
int tempr = tr;
int tempg = tg;
int tempb = tb;
/* Screen width 40 chars, 4 per char */
char buffer[160 + 1];
const char* mode_string;
const enum GlitchrunnerMode mode = GlitchrunnerMode_get();
if (mode == GlitchrunnerNone)
{
tempr /= 2;
tempg /= 2;
tempb /= 2;
mode_string = "OFF";
}
else
{
mode_string = GlitchrunnerMode_enum_to_string(mode);
}
SDL_snprintf(buffer, sizeof(buffer), "Glitchrunner mode is %s", mode_string);
graphics.Print(-1, 95, buffer, tempr, tempg, tempb, true);
}
static void menurender(void)
{
int temp = 50;
@@ -571,14 +603,7 @@ static void menurender(void)
graphics.bigprint(-1, 30, "Glitchrunner Mode", tr, tg, tb, true);
graphics.Print(-1, 65, "Re-enable glitches that existed", tr, tg, tb, true);
graphics.Print(-1, 75, "in previous versions of the game.", tr, tg, tb, true);
if (game.glitchrunnermode)
{
graphics.Print(-1, 95, "Glitchrunner mode is ON", tr, tg, tb, true);
}
else
{
graphics.Print(-1, 95, "Glitchrunner mode is OFF", tr / 2, tg / 2, tb / 2, true);
}
drawglitchrunnertext();
break;
case 1:
graphics.bigprint(-1, 30, "Input Delay", tr, tg, tb, true);
@@ -625,6 +650,12 @@ static void menurender(void)
break;
}
break;
case Menu::setglitchrunner:
graphics.bigprint(-1, 30, "Glitchrunner Mode", tr, tg, tb, true);
graphics.Print(-1, 65, "Select a new glitchrunner", tr, tg, tb, true);
graphics.Print(-1, 75, "version below.", tr, tg, tb, true);
drawglitchrunnertext();
break;
case Menu::advancedoptions:
switch (game.currentmenuoption)
{
@@ -2666,7 +2697,7 @@ void maprender(void)
// We need to draw the black screen above the menu in order to disguise it
// being jankily brought down in glitchrunner mode when exiting to the title
// Otherwise, there's no reason to obscure the menu
if (game.glitchrunnermode || graphics.fademode == 3 || graphics.fademode == 5)
if (GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2) || graphics.fademode == 3 || graphics.fademode == 5)
{
graphics.drawfade();
}