1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 02:28:30 +02:00

Account for heights in the FLIP macro

Flipping objects in Flip Mode needs to account for the heights of those
objects (that's why flipme text boxes in Flip Mode in 2.2 were
positioned wrongly).

Also, turn it into a macro instead of an inline function.

This changes the positions of all existing de-duplicated map menu text
in Flip Mode, but it'll be more correct.
This commit is contained in:
Misa 2021-10-01 18:29:55 -07:00
parent 3a911a9a9b
commit 517e20cecb

View File

@ -22,17 +22,6 @@ static int tr;
static int tg;
static int tb;
// Macro-like inline function used in maprender()
// Used to keep some text positions the same in Flip Mode
static int inline FLIP(int ypos)
{
if (graphics.flipmode)
{
return 220 - ypos;
}
return ypos;
}
static inline void drawslowdowntext(void)
{
switch (game.slowdown)
@ -2009,6 +1998,10 @@ void gamerender(void)
graphics.renderwithscreeneffects();
}
/* Used to keep some graphics positions on the map screen
* the same in Flip Mode. */
#define FLIP(y, h) (graphics.flipmode ? 220 - (y) - (h) : (y))
void maprender(void)
{
ClearSurface(graphics.backBuffer);
@ -2389,19 +2382,19 @@ void maprender(void)
else if(map.custommode){
LevelMetaData& meta = cl.ListOfMetaData[game.playcustomlevel];
graphics.bigprint( -1, FLIP(45), meta.title, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(70), "by " + meta.creator, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(80), meta.website, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(100), meta.Desc1, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(110), meta.Desc2, 196, 196, 255 - help.glow, true);
graphics.Print( -1, FLIP(120), meta.Desc3, 196, 196, 255 - help.glow, true);
graphics.bigprint(-1, FLIP(45, 8), meta.title, 196, 196, 255 - help.glow, true);
graphics.Print(-1, FLIP(70, 8), "by " + meta.creator, 196, 196, 255 - help.glow, true);
graphics.Print(-1, FLIP(80, 8), meta.website, 196, 196, 255 - help.glow, true);
graphics.Print(-1, FLIP(100, 8), meta.Desc1, 196, 196, 255 - help.glow, true);
graphics.Print(-1, FLIP(110, 8), meta.Desc2, 196, 196, 255 - help.glow, true);
graphics.Print(-1, FLIP(120, 8), meta.Desc3, 196, 196, 255 - help.glow, true);
int remaining = cl.numcrewmates() - game.crewmates();
if(remaining==1){
graphics.Print(1,FLIP(165), help.number_words(remaining)+ " crewmate remains", 196, 196, 255 - help.glow, true);
graphics.Print(1, FLIP(165, 8), help.number_words(remaining) + " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(remaining>0){
graphics.Print(1,FLIP(165), help.number_words(remaining)+ " crewmates remain", 196, 196, 255 - help.glow, true);
graphics.Print(1, FLIP(165, 8), help.number_words(remaining) + " crewmates remain", 196, 196, 255 - help.glow, true);
}
}
#endif
@ -2482,14 +2475,14 @@ void maprender(void)
}
/* Stats. */
graphics.Print(0, FLIP(52), "[Trinkets found]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(64), help.number_words(game.trinkets()) + " out of " + help.number_words(total), 96, 96, 96, true);
graphics.Print(0, FLIP(52, 8), "[Trinkets found]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(64, 8), help.number_words(game.trinkets()) + " out of " + help.number_words(total), 96, 96, 96, true);
graphics.Print(0, FLIP(102), "[Number of Deaths]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(114), help.String(game.deathcounts), 96, 96, 96, true);
graphics.Print(0, FLIP(102, 8), "[Number of Deaths]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(114, 8), help.String(game.deathcounts), 96, 96, 96, true);
graphics.Print(0, FLIP(152), "[Time Taken]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(164), game.timestring(), 96, 96, 96, true);
graphics.Print(0, FLIP(152, 8), "[Time Taken]", 196, 196, 255 - help.glow, true);
graphics.Print(0, FLIP(164, 8), game.timestring(), 96, 96, 96, true);
break;
}
case 3: