1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00
VVVVVV/desktop_version/src/Map.h
Misa ad6adcb3c0 Refactor how "hidden names" work
By "hidden names", I'm referring to "Dimension VVVVVV" and "The Ship"
popping up on the quit/pause/teleporter screens, even though those rooms
don't have any roomnames.

Apparently my commit to fix roomname re-draw bleed on the
quit/pause/teleporter screens exposed yet another hardreset()-caused
bug. The issue here is that since hardreset() sets game.roomx and
game.roomy to 0, map.area() will no longer work properly, and since the
hidden roomname check is based on map.area(), it will no longer display
"Dimension VVVVVV" or "The Ship" once you press ACTION to quit. It used
to do this due to the re-draw bleed, but now it doesn't.

I saw that roomnames didn't get reset in hardreset(), so the solution
here is to re-factor hidden names to be an actual variable, instead of
being implicit. map.hiddenname is a variable that's set in
mapclass::loadlevel(), and if isn't empty, it will be drawn on the
quit/pause/teleporter screens. That way it will still display "Dimension
VVVVVV" and "The Ship" when you press ACTION to quit to the menu.

EDIT: Since PR #230 got merged, this commit is no longer strictly
necessary, but it's still good to refactor hidden names like this.
2020-06-19 09:05:48 -04:00

176 lines
3.4 KiB
C++

#ifndef MAPGAME_H
#define MAPGAME_H
#include "Tower.h"
#include "WarpClass.h"
#include "Finalclass.h"
#include "Labclass.h"
#include "Spacestation2.h"
#include "Otherlevel.h"
#include "Entity.h"
#include "Graphics.h"
#include <vector>
#include "Music.h"
#include "editor.h"
class mapclass
{
public:
mapclass();
int RGB(int red,int green,int blue);
int intpol(int a, int b, float c);
void setteleporter(int x, int y);
void settrinket(int x, int y);
void resetmap();
void resetnames();
void transformname(int t);
std::string getglitchname(int x, int y);
void initmapdata();
int finalat(int x, int y);
int maptiletoenemycol(int t);
void changefinalcol(int t);
void setcol(const int r1, const int g1, const int b1 , const int r2, const int g2, const int b2, const int c);
void updatetowerglow();
void nexttowercolour();
void settowercolour(int t);
bool spikecollide(int x, int y);
bool collide(int x, int y);
void settile(int xp, int yp, int t);
int area(int _rx, int _ry);
void exploretower();
void hideship();
void showship();
void resetplayer();
void warpto(int rx, int ry , int t, int tx, int ty);
void gotoroom(int rx, int ry);
std::string currentarea(int t);
void loadlevel(int rx, int ry);
std::vector <int> roomdeaths;
std::vector <int> roomdeathsfinal;
std::vector <int> areamap;
std::vector <int> contents;
std::vector <int> explored;
std::vector <int> vmult;
std::vector <std::string> tmap;
int temp;
int temp2;
int background;
int rcol;
int tileset;
bool warpx;
bool warpy;
std::string roomname;
std::string hiddenname;
//Special tower stuff
bool towermode;
float ypos;
float oldypos;
int bypos;
int cameramode;
int cameraseek, cameraseekframe;
int resumedelay;
bool minitowermode;
int scrolldir;
//This is the old colour cycle
int r, g,b;
int check, cmode;
int towercol;
int colstate, colstatedelay;
int colsuperstate;
int spikeleveltop, spikelevelbottom;
int oldspikeleveltop, oldspikelevelbottom;
bool tdrawback;
int bscroll;
//final level navigation
int finalx;
int finaly;
bool finalmode;
bool finalstretch;
//Variables for playing custom levels
bool custommode;
bool custommodeforreal;
int customx, customy;
int customwidth, customheight;
int custommmxoff, custommmyoff, custommmxsize, custommmysize;
int customzoom;
bool customshowmm;
std::vector<std::string> specialnames;
int glitchmode;
int glitchdelay;
std::string glitchname;
//final level colour cycling stuff
bool final_colormode;
int final_mapcol;
int final_aniframe;
int final_aniframedelay;
int final_colorframe, final_colorframedelay;
//Teleporters and Trinkets on the map
std::vector<point> teleporters;
std::vector<point> shinytrinkets;
bool showteleporters, showtargets, showtrinkets;
//Roomtext
bool roomtexton;
std::vector<Roomtext> roomtext;
//Levels
otherlevelclass otherlevel;
spacestation2class spacestation2;
labclass lablevel;
finalclass finallevel;
warpclass warplevel;
towerclass tower;
int extrarow;
//Accessibility options
bool invincibility;
//Map cursor
int cursorstate, cursordelay;
};
extern mapclass map;
#endif /* MAPGAME_H */