2020-01-01 21:29:24 +01:00
|
|
|
#ifndef GAME_H
|
|
|
|
#define GAME_H
|
|
|
|
|
2020-07-19 06:21:27 +02:00
|
|
|
#include <SDL.h>
|
2020-07-19 21:43:29 +02:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-09-14 01:31:02 +02:00
|
|
|
// Forward decl without including all of <tinyxml2.h>
|
Move all settings to settings.vvv
The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.
The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.
The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).
Closes #373 fully.
2020-11-04 08:11:21 +01:00
|
|
|
namespace tinyxml2
|
|
|
|
{
|
|
|
|
class XMLDocument;
|
|
|
|
class XMLElement;
|
|
|
|
}
|
2020-09-14 01:31:02 +02:00
|
|
|
|
2020-04-15 06:11:10 +02:00
|
|
|
struct MenuOption
|
|
|
|
{
|
2020-07-04 06:30:31 +02:00
|
|
|
char text[161]; // 40 chars (160 bytes) covers the entire screen, + 1 more for null terminator
|
|
|
|
// WARNING: should match Game::menutextbytes below
|
2020-04-15 06:11:10 +02:00
|
|
|
bool active;
|
|
|
|
};
|
|
|
|
|
2020-04-16 06:53:36 +02:00
|
|
|
//Menu IDs
|
|
|
|
namespace Menu
|
|
|
|
{
|
|
|
|
enum MenuName
|
|
|
|
{
|
|
|
|
mainmenu,
|
|
|
|
playerworlds,
|
|
|
|
levellist,
|
|
|
|
quickloadlevel,
|
|
|
|
youwannaquit,
|
|
|
|
errornostart,
|
|
|
|
graphicoptions,
|
|
|
|
ed_settings,
|
|
|
|
ed_desc,
|
|
|
|
ed_music,
|
|
|
|
ed_quit,
|
|
|
|
options,
|
2020-06-30 22:06:19 +02:00
|
|
|
advancedoptions,
|
2020-04-16 06:53:36 +02:00
|
|
|
accessibility,
|
|
|
|
controller,
|
|
|
|
cleardatamenu,
|
|
|
|
setinvincibility,
|
2020-04-17 01:02:01 +02:00
|
|
|
setslowdown,
|
2020-04-16 06:53:36 +02:00
|
|
|
unlockmenu,
|
|
|
|
credits,
|
|
|
|
credits2,
|
|
|
|
credits25,
|
|
|
|
credits3,
|
|
|
|
credits4,
|
|
|
|
credits5,
|
|
|
|
credits6,
|
|
|
|
play,
|
|
|
|
unlocktimetrial,
|
|
|
|
unlocktimetrials,
|
|
|
|
unlocknodeathmode,
|
|
|
|
unlockintermission,
|
|
|
|
unlockflipmode,
|
|
|
|
newgamewarning,
|
|
|
|
playmodes,
|
|
|
|
intermissionmenu,
|
|
|
|
playint1,
|
|
|
|
playint2,
|
|
|
|
continuemenu,
|
|
|
|
startnodeathmode,
|
|
|
|
gameover,
|
|
|
|
gameover2,
|
|
|
|
unlockmenutrials,
|
|
|
|
timetrials,
|
|
|
|
nodeathmodecomplete,
|
|
|
|
nodeathmodecomplete2,
|
|
|
|
timetrialcomplete,
|
|
|
|
timetrialcomplete2,
|
|
|
|
timetrialcomplete3,
|
|
|
|
gamecompletecontinue,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-17 01:22:40 +02:00
|
|
|
struct MenuStackFrame
|
|
|
|
{
|
|
|
|
int option;
|
|
|
|
enum Menu::MenuName name;
|
|
|
|
};
|
|
|
|
|
Refactor how custom level stats are stored, read, and written
There were a few problems with the old way of doing things:
(1) Level stats were an ad-hoc object. Basically, it's an object whose
attributes are stored in separate arrays, instead of being an actual
object with its attributes stored in one array.
(2) Level filenames with pipes in them could cause trouble. This is
because the filename attribute array was stored in the XML by being
separated by pipes.
(3) There was an arbitrary limit of only having 200 level stats, for
whatever reason.
To remedy this issue, I've made a new struct named CustomLevelStat that
is a proper object. The separate attribute arrays have been replaced
with a proper vector, which also doesn't have a size limit.
For compatibility with versions 2.2 and below, I've kept being able to
read the old format. This only happens if the new format doesn't exist.
However, I also WRITE the old format as well, in case you want to go
back to version 2.2 or below for whatever reason. It's slightly
wasteful to have both, but that way there's no risk of breaking
compatibility.
2020-06-30 03:39:22 +02:00
|
|
|
struct CustomLevelStat
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
int score; //0 - not played, 1 - finished, 2 - all trinkets, 3 - finished, all trinkets
|
|
|
|
};
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
class Game
|
|
|
|
{
|
|
|
|
public:
|
Allow using help/graphics/music/game/key/map/obj everywhere
This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and
`obj` essentially static global objects that can be used everywhere.
This is useful in case we ever need to add a new function in the future,
so we don't have to bother with passing a new argument in which means we
have to pass a new argument in to the function that calls that function
which means having to pass a new argument into the function that calls
THAT function, etc. which is a real headache when working on fan mods of
the source code.
Note that this changes NONE of the existing function signatures, it
merely just makes those variables accessible everywhere in the same way
`script` and `ed` are.
Also note that some classes had to be initialized after the filesystem
was initialized, but C++ would keep initializing them before the
filesystem got initialized, because I *had* to put them at the top of
`main.cpp`, or else they wouldn't be global variables.
The only way to work around this was to use entityclass's initialization
style (which I'm pretty sure entityclass of all things doesn't need to
be initialized this way), where you actually initialize the class in an
`init()` function, and so then you do `graphics.init()` after the
filesystem initialization, AFTER doing `Graphics graphics` up at the
top.
I've had to do this for `graphics` (but only because its child
GraphicsResources `grphx` needs to be initialized this way), `music`,
and `game`. I don't think this will affect anything. Other than that,
`help`, `key`, and `map` are still using the C++-intended method of
having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
|
|
|
void init(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
int crewrescued();
|
|
|
|
|
|
|
|
std::string unrescued();
|
|
|
|
|
|
|
|
void resetgameclock();
|
|
|
|
|
2020-11-04 03:45:33 +01:00
|
|
|
bool customsavequick(std::string savfile);
|
|
|
|
bool savequick();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
void gameclock();
|
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
std::string giventimestring(int hrs, int min, int sec);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
std::string timestring();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
std::string partimestring();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
std::string resulttimestring();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
std::string timetstring(int t);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-17 04:16:40 +02:00
|
|
|
void returnmenu();
|
2020-04-26 02:36:36 +02:00
|
|
|
void returntomenu(enum Menu::MenuName t);
|
2020-04-17 04:04:36 +02:00
|
|
|
void createmenu(enum Menu::MenuName t, bool samemenu = false);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void lifesequence();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void gethardestroom();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void updatestate();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void unlocknum(int t);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-07-08 20:30:57 +02:00
|
|
|
void loadstats(int *width, int *height, bool *vsync);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
Move all settings to settings.vvv
The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.
The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.
The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).
Closes #373 fully.
2020-11-04 08:11:21 +01:00
|
|
|
void savestats(const bool stats_only = false);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void deletestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
Move all settings to settings.vvv
The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.
The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.
The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).
Closes #373 fully.
2020-11-04 08:11:21 +01:00
|
|
|
void deserializesettings(tinyxml2::XMLElement* dataNode, int* width, int* height, bool* vsync);
|
|
|
|
|
|
|
|
void serializesettings(tinyxml2::XMLElement* dataNode);
|
|
|
|
|
|
|
|
void loadsettings(int* width, int* height, bool* vsync);
|
|
|
|
|
|
|
|
void savesettings();
|
|
|
|
|
|
|
|
void deletesettings();
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
void deletequick();
|
|
|
|
|
2020-11-04 02:58:38 +01:00
|
|
|
bool savetele();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void loadtele();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
void deletetele();
|
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void customstart();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void start();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void startspecial(int t);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void starttrial(int t);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
void swnpenalty();
|
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void deathsequence();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void customloadquick(std::string savfile);
|
|
|
|
void loadquick();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void loadsummary();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-09-14 01:31:02 +02:00
|
|
|
void readmaingamesave(tinyxml2::XMLDocument& doc);
|
|
|
|
std::string writemaingamesave(tinyxml2::XMLDocument& doc);
|
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
void initteleportermode();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-02 22:01:55 +02:00
|
|
|
std::string saveFilePath;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
int door_left;
|
|
|
|
int door_right;
|
|
|
|
int door_up;
|
|
|
|
int door_down;
|
|
|
|
int roomx, roomy, roomchangedir;
|
2020-01-27 23:46:11 +01:00
|
|
|
int prevroomx, prevroomy;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int savex, savey, saverx, savery;
|
|
|
|
int savegc, savedir;
|
|
|
|
|
|
|
|
//Added for port
|
|
|
|
int edsavex, edsavey, edsaverx, edsavery;
|
|
|
|
int edsavegc, edsavedir;
|
|
|
|
|
|
|
|
//State logic stuff
|
|
|
|
int state, statedelay;
|
|
|
|
|
2020-04-02 22:01:55 +02:00
|
|
|
bool glitchrunkludge;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-02 22:01:55 +02:00
|
|
|
int usingmmmmmm;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int gamestate;
|
|
|
|
bool hascontrol, jumpheld;
|
|
|
|
int jumppressed;
|
|
|
|
int gravitycontrol;
|
|
|
|
|
|
|
|
bool muted;
|
|
|
|
int mutebutton;
|
2020-04-19 21:40:59 +02:00
|
|
|
bool musicmuted;
|
|
|
|
int musicmutebutton;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int tapleft, tapright;
|
|
|
|
|
|
|
|
//Menu interaction stuff
|
|
|
|
bool mapheld;
|
|
|
|
int menupage;
|
|
|
|
int lastsaved;
|
|
|
|
int deathcounts;
|
|
|
|
|
|
|
|
int frames, seconds, minutes, hours;
|
|
|
|
bool gamesaved;
|
2020-11-04 03:45:33 +01:00
|
|
|
bool gamesavefailed;
|
2020-01-01 21:29:24 +01:00
|
|
|
std::string savetime;
|
|
|
|
std::string savearea;
|
|
|
|
int savetrinkets;
|
|
|
|
bool startscript;
|
|
|
|
std::string newscript;
|
|
|
|
|
|
|
|
int mainmenu;
|
|
|
|
bool menustart;
|
|
|
|
|
|
|
|
//Teleporting
|
|
|
|
bool teleport_to_new_area;
|
|
|
|
int teleport_to_x, teleport_to_y;
|
|
|
|
std::string teleportscript;
|
|
|
|
bool useteleporter;
|
|
|
|
int teleport_to_teleporter;
|
|
|
|
|
|
|
|
//Main Menu Variables
|
Refactor menu creation code
Firstly, menu options are no longer ad-hoc objects, and are added by
using Game::option() (this is the biggest change). This removes the
vector Game::menuoptionsactive, and Game::menuoptions is now a vector of
MenuOption instead of std::string.
Secondly, the manual tracker variable of the amount of menu options,
Game::nummenuoptions, has been removed, in favor of using vectors
properly and using Game::menuoptions::size().
As a result, a lot of copy-pasted code has been removed from
Game::createmenu(), mostly due to having to have different versions of
menus depending on whether or not we have certain defines, or having an
mmmmmm.vvv file inside the VVVVVV directory. In the old days, you
couldn't just add or remove a menu option conveniently, you had to
shuffle around the position of every other menu option too, which
resulted in lots of copy-pasted code. But now this copy-pasted code has
been de-duplicated, at least in Game::createmenu().
2020-04-15 06:50:17 +02:00
|
|
|
std::vector<MenuOption> menuoptions;
|
|
|
|
int currentmenuoption ;
|
2020-04-17 05:09:22 +02:00
|
|
|
enum Menu::MenuName currentmenuname;
|
2020-06-23 02:23:56 +02:00
|
|
|
enum Menu::MenuName kludge_ingametemp;
|
2020-02-12 05:45:58 +01:00
|
|
|
int current_credits_list_index;
|
2020-01-01 21:29:24 +01:00
|
|
|
int menuxoff, menuyoff;
|
Make menus automatically centered and narrowed
All menus had a hardcoded X position (offset to an arbitrary starting
point of 110) and a hardcoded horizontal spacing for the "staircasing"
(mostly 30 pixels, but for some specific menus hardcoded to 15, 20 or
something else). Not all menus were centered, and seem to have been
manually made narrower (with lower horizontal spacing) whenever text
ran offscreen during development.
This system may already be hard to work with in an English-only menu
system, since you may need to adjust horizontal spacing or positioning
when adding an option. The main reason I made this change is that it's
even less optimal when menu options have to be translated, since
maximum string lengths are hard to determine, and it's easy to have
menu options running offscreen, especially when not all menus are
checked for all languages and when options could be added in the middle
of a menu after translations of that menu are already checked.
Now, menus are automatically centered based on their options, and they
are automatically made narrower if they won't fit with the default
horizontal spacing of 30 pixels (with some padding). The game.menuxoff
variable for the menu X position is now also offset to 0 instead of 110
The _default_ horizontal spacing can be changed on a per-menu basis,
and most menus (not all) which already had a narrower spacing set,
retain that as a maximum spacing, simply because they looked odd with
30 pixels of spacing (especially the main menu). They will be made even
narrower automatically if needed. In the most extreme case, the spacing
can go down to 0 and options will be displayed right below each other.
This isn't in the usual style of the game, but at least we did the best
we could to prevent options running offscreen.
The only exception to automatic menu centering and narrowing is the
list of player levels, because it's a special case and existing
behavior would be better than automatic centering there.
2020-06-29 02:09:52 +02:00
|
|
|
int menuspacing;
|
2020-07-04 06:30:31 +02:00
|
|
|
static const int menutextbytes = 161; // this is just sizeof(MenuOption::text), but doing that is non-standard
|
2020-04-17 03:52:40 +02:00
|
|
|
std::vector<MenuStackFrame> menustack;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-07-04 06:30:31 +02:00
|
|
|
void inline option(const char* text, bool active = true)
|
2020-04-15 06:12:24 +02:00
|
|
|
{
|
|
|
|
MenuOption menuoption;
|
2020-07-04 06:30:31 +02:00
|
|
|
SDL_strlcpy(menuoption.text, text, sizeof(menuoption.text));
|
2020-04-15 06:12:24 +02:00
|
|
|
menuoption.active = active;
|
|
|
|
menuoptions.push_back(menuoption);
|
|
|
|
}
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
int menucountdown;
|
2020-04-16 06:53:36 +02:00
|
|
|
enum Menu::MenuName menudest;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int creditposx, creditposy, creditposdelay;
|
2020-05-02 03:23:52 +02:00
|
|
|
int oldcreditposx;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
//Sine Wave Ninja Minigame
|
|
|
|
bool swnmode;
|
|
|
|
int swngame, swnstate, swnstate2, swnstate3, swnstate4, swndelay, swndeaths;
|
|
|
|
int swntimer, swncolstate, swncoldelay;
|
|
|
|
int swnrecord, swnbestrank, swnrank, swnmessage;
|
|
|
|
|
|
|
|
//SuperCrewMate Stuff
|
|
|
|
bool supercrewmate, scmhurt, scmmoveme;
|
|
|
|
int scmprogress;
|
|
|
|
|
|
|
|
//Accessibility Options
|
|
|
|
bool colourblindmode;
|
|
|
|
bool noflashingmode;
|
|
|
|
int slowdown;
|
|
|
|
Uint32 gameframerate;
|
|
|
|
|
|
|
|
bool nodeathmode;
|
|
|
|
int gameoverdelay;
|
|
|
|
bool nocutscenes;
|
|
|
|
|
|
|
|
//Time Trials
|
|
|
|
bool intimetrial, timetrialparlost;
|
|
|
|
int timetrialcountdown, timetrialshinytarget, timetriallevel;
|
2020-06-30 00:53:19 +02:00
|
|
|
int timetrialpar, timetrialresulttime, timetrialresultframes, timetrialrank;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int creditposition;
|
2020-04-30 19:56:27 +02:00
|
|
|
int oldcreditposition;
|
2020-01-01 21:29:24 +01:00
|
|
|
bool insecretlab;
|
|
|
|
|
|
|
|
bool inintermission;
|
|
|
|
|
2020-07-03 03:10:52 +02:00
|
|
|
static const int numcrew = 6;
|
|
|
|
bool crewstats[numcrew];
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
bool alarmon;
|
|
|
|
int alarmdelay;
|
|
|
|
bool blackout;
|
|
|
|
|
2020-07-03 03:10:52 +02:00
|
|
|
bool tele_crewstats[numcrew];
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-07-03 03:10:52 +02:00
|
|
|
bool quick_crewstats[numcrew];
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-07-03 01:45:22 +02:00
|
|
|
static const int numunlock = 25;
|
|
|
|
bool unlock[numunlock];
|
|
|
|
bool unlocknotify[numunlock];
|
2020-04-26 21:43:30 +02:00
|
|
|
bool anything_unlocked();
|
2020-01-01 21:29:24 +01:00
|
|
|
int stat_trinkets;
|
|
|
|
bool fullscreen;
|
|
|
|
int bestgamedeaths;
|
|
|
|
|
|
|
|
|
2020-07-03 02:09:30 +02:00
|
|
|
static const int numtrials = 6;
|
|
|
|
int besttimes[numtrials];
|
|
|
|
int bestframes[numtrials];
|
|
|
|
int besttrinkets[numtrials];
|
|
|
|
int bestlives[numtrials];
|
|
|
|
int bestrank[numtrials];
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
std::string tele_gametime;
|
|
|
|
int tele_trinkets;
|
|
|
|
std::string tele_currentarea;
|
|
|
|
std::string quick_gametime;
|
|
|
|
int quick_trinkets;
|
|
|
|
std::string quick_currentarea;
|
|
|
|
|
|
|
|
int mx, my;
|
|
|
|
int screenshake, flashlight;
|
|
|
|
bool advancetext, pausescript;
|
|
|
|
|
|
|
|
int deathseq, lifeseq;
|
|
|
|
|
2020-04-10 00:58:24 +02:00
|
|
|
int trinkets();
|
|
|
|
int crewmates();
|
2020-04-09 07:27:13 +02:00
|
|
|
int savepoint, teleportxpos;
|
|
|
|
bool teleport;
|
2020-01-01 21:29:24 +01:00
|
|
|
int edteleportent;
|
|
|
|
bool completestop;
|
|
|
|
|
|
|
|
float inertia;
|
|
|
|
|
|
|
|
int companion;
|
|
|
|
bool roomchange;
|
|
|
|
SDL_Rect teleblock;
|
|
|
|
bool activetele;
|
|
|
|
int readytotele;
|
2020-04-30 02:04:25 +02:00
|
|
|
int oldreadytotele;
|
2020-01-01 21:29:24 +01:00
|
|
|
int activity_r, activity_g, activity_b;
|
|
|
|
std::string activity_lastprompt;
|
|
|
|
|
|
|
|
std::string telesummary, quicksummary, customquicksummary;
|
2020-04-26 22:41:35 +02:00
|
|
|
bool save_exists();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
bool backgroundtext;
|
|
|
|
|
|
|
|
int activeactivity, act_fade;
|
2020-04-29 06:58:19 +02:00
|
|
|
int prev_act_fade;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
bool press_left, press_right, press_action, press_map;
|
|
|
|
|
|
|
|
//Some stats:
|
|
|
|
int totalflips;
|
|
|
|
std::string hardestroom;
|
|
|
|
int hardestroomdeaths, currentroomdeaths;
|
|
|
|
|
|
|
|
bool savemystats;
|
|
|
|
|
|
|
|
|
|
|
|
bool fullScreenEffect_badSignal;
|
2020-04-02 22:01:55 +02:00
|
|
|
bool useLinearFilter;
|
|
|
|
int stretchMode;
|
|
|
|
int controllerSensitivity;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
bool quickrestartkludge;
|
|
|
|
|
|
|
|
//Custom stuff
|
|
|
|
std::string customscript[50];
|
|
|
|
int customcol;
|
|
|
|
int levelpage;
|
|
|
|
int playcustomlevel;
|
|
|
|
std::string customleveltitle;
|
|
|
|
std::string customlevelfilename;
|
|
|
|
|
|
|
|
void clearcustomlevelstats();
|
|
|
|
void loadcustomlevelstats();
|
|
|
|
void savecustomlevelstats();
|
|
|
|
void updatecustomlevelstats(std::string clevel, int cscore);
|
|
|
|
|
Refactor how custom level stats are stored, read, and written
There were a few problems with the old way of doing things:
(1) Level stats were an ad-hoc object. Basically, it's an object whose
attributes are stored in separate arrays, instead of being an actual
object with its attributes stored in one array.
(2) Level filenames with pipes in them could cause trouble. This is
because the filename attribute array was stored in the XML by being
separated by pipes.
(3) There was an arbitrary limit of only having 200 level stats, for
whatever reason.
To remedy this issue, I've made a new struct named CustomLevelStat that
is a proper object. The separate attribute arrays have been replaced
with a proper vector, which also doesn't have a size limit.
For compatibility with versions 2.2 and below, I've kept being able to
read the old format. This only happens if the new format doesn't exist.
However, I also WRITE the old format as well, in case you want to go
back to version 2.2 or below for whatever reason. It's slightly
wasteful to have both, but that way there's no risk of breaking
compatibility.
2020-06-30 03:39:22 +02:00
|
|
|
std::vector<CustomLevelStat> customlevelstats;
|
2020-01-01 21:29:24 +01:00
|
|
|
bool customlevelstatsloaded;
|
|
|
|
|
|
|
|
|
2020-04-02 22:01:55 +02:00
|
|
|
std::vector<SDL_GameControllerButton> controllerButton_map;
|
|
|
|
std::vector<SDL_GameControllerButton> controllerButton_flip;
|
|
|
|
std::vector<SDL_GameControllerButton> controllerButton_esc;
|
2020-08-09 00:41:59 +02:00
|
|
|
std::vector<SDL_GameControllerButton> controllerButton_restart;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-01-13 02:45:44 +01:00
|
|
|
bool skipfakeload;
|
Add a player trail to the editor (ghosts)
A few months ago, I added ghosts to the VVVVVV: Community Edition editor. I was told recently I should think
about upstreaming it, and with Terry saying go ahead I finally ported them into VVVVVV. There's one slight
difference however--you can choose whether you have them or not in the editor's settings menu. They're off by
default, and this is saved to the save file.
Anyway, when you're playtesting, the game saves the players position, color, room coordinates and sprite every 3
frames. The max is 100, where if it tries to add more, the oldest one gets removed.
When you exit playtesting, the saved positions appear one at a time, and you can use the Z key to speed it up.
[Here's a video of them in action.](https://o.lol-sa.me/4H21zCv.mp4)
2020-06-13 00:04:35 +02:00
|
|
|
bool ghostsenabled;
|
2020-04-09 21:03:24 +02:00
|
|
|
|
|
|
|
bool cliplaytest;
|
|
|
|
int playx;
|
|
|
|
int playy;
|
|
|
|
int playrx;
|
|
|
|
int playry;
|
|
|
|
int playgc;
|
2020-07-11 20:55:26 +02:00
|
|
|
int playmusic;
|
2020-06-22 00:56:31 +02:00
|
|
|
std::string playassets;
|
2020-05-07 23:38:19 +02:00
|
|
|
|
|
|
|
void quittomenu();
|
2020-05-08 00:17:04 +02:00
|
|
|
void returntolab();
|
2020-05-08 00:23:55 +02:00
|
|
|
bool fadetomenu;
|
|
|
|
int fadetomenudelay;
|
2020-05-08 00:30:26 +02:00
|
|
|
bool fadetolab;
|
|
|
|
int fadetolabdelay;
|
2020-05-09 21:35:17 +02:00
|
|
|
|
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
|
|
|
void returntoeditor();
|
2020-05-09 21:52:58 +02:00
|
|
|
bool shouldreturntoeditor;
|
2020-05-09 21:35:17 +02:00
|
|
|
#endif
|
Add a player trail to the editor (ghosts)
A few months ago, I added ghosts to the VVVVVV: Community Edition editor. I was told recently I should think
about upstreaming it, and with Terry saying go ahead I finally ported them into VVVVVV. There's one slight
difference however--you can choose whether you have them or not in the editor's settings menu. They're off by
default, and this is saved to the save file.
Anyway, when you're playtesting, the game saves the players position, color, room coordinates and sprite every 3
frames. The max is 100, where if it tries to add more, the oldest one gets removed.
When you exit playtesting, the saved positions appear one at a time, and you can use the Z key to speed it up.
[Here's a video of them in action.](https://o.lol-sa.me/4H21zCv.mp4)
2020-06-13 00:04:35 +02:00
|
|
|
|
2020-06-13 00:23:16 +02:00
|
|
|
int gametimer;
|
2020-06-14 05:07:52 +02:00
|
|
|
|
|
|
|
bool inline inspecial()
|
|
|
|
{
|
|
|
|
return inintermission || insecretlab || intimetrial || nodeathmode;
|
|
|
|
}
|
2020-05-04 21:52:57 +02:00
|
|
|
|
|
|
|
bool over30mode;
|
2020-06-25 23:31:37 +02:00
|
|
|
bool glitchrunnermode; // Have fun speedrunners! <3 Misa
|
2020-06-23 01:51:16 +02:00
|
|
|
|
|
|
|
bool ingame_titlemode;
|
2020-06-23 02:26:45 +02:00
|
|
|
|
|
|
|
void returntopausemenu();
|
2020-08-01 21:51:11 +02:00
|
|
|
void unlockAchievement(const char *name);
|
2020-06-30 04:49:14 +02:00
|
|
|
|
|
|
|
bool disablepause;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
2020-09-28 04:15:06 +02:00
|
|
|
#ifndef GAME_DEFINITION
|
Allow using help/graphics/music/game/key/map/obj everywhere
This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and
`obj` essentially static global objects that can be used everywhere.
This is useful in case we ever need to add a new function in the future,
so we don't have to bother with passing a new argument in which means we
have to pass a new argument in to the function that calls that function
which means having to pass a new argument into the function that calls
THAT function, etc. which is a real headache when working on fan mods of
the source code.
Note that this changes NONE of the existing function signatures, it
merely just makes those variables accessible everywhere in the same way
`script` and `ed` are.
Also note that some classes had to be initialized after the filesystem
was initialized, but C++ would keep initializing them before the
filesystem got initialized, because I *had* to put them at the top of
`main.cpp`, or else they wouldn't be global variables.
The only way to work around this was to use entityclass's initialization
style (which I'm pretty sure entityclass of all things doesn't need to
be initialized this way), where you actually initialize the class in an
`init()` function, and so then you do `graphics.init()` after the
filesystem initialization, AFTER doing `Graphics graphics` up at the
top.
I've had to do this for `graphics` (but only because its child
GraphicsResources `grphx` needs to be initialized this way), `music`,
and `game`. I don't think this will affect anything. Other than that,
`help`, `key`, and `map` are still using the C++-intended method of
having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
|
|
|
extern Game game;
|
2020-09-28 04:15:06 +02:00
|
|
|
#endif
|
Allow using help/graphics/music/game/key/map/obj everywhere
This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and
`obj` essentially static global objects that can be used everywhere.
This is useful in case we ever need to add a new function in the future,
so we don't have to bother with passing a new argument in which means we
have to pass a new argument in to the function that calls that function
which means having to pass a new argument into the function that calls
THAT function, etc. which is a real headache when working on fan mods of
the source code.
Note that this changes NONE of the existing function signatures, it
merely just makes those variables accessible everywhere in the same way
`script` and `ed` are.
Also note that some classes had to be initialized after the filesystem
was initialized, but C++ would keep initializing them before the
filesystem got initialized, because I *had* to put them at the top of
`main.cpp`, or else they wouldn't be global variables.
The only way to work around this was to use entityclass's initialization
style (which I'm pretty sure entityclass of all things doesn't need to
be initialized this way), where you actually initialize the class in an
`init()` function, and so then you do `graphics.init()` after the
filesystem initialization, AFTER doing `Graphics graphics` up at the
top.
I've had to do this for `graphics` (but only because its child
GraphicsResources `grphx` needs to be initialized this way), `music`,
and `game`. I don't think this will affect anything. Other than that,
`help`, `key`, and `map` are still using the C++-intended method of
having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
#endif /* GAME_H */
|