From 517e20cecb5228df7646fe23b00b7fe476c68082 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 1 Oct 2021 18:29:55 -0700 Subject: [PATCH] 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. --- desktop_version/src/Render.cpp | 43 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index ad748770..fa8412f4 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -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: