1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 22:18:30 +02:00
VVVVVV/desktop_version/src/Script.h
Misa db9ee0d8e3 Switch flipme script command to use flipme textbox attribute
This is why the text box attribute was named flipme, after all.

You may have noticed that the flipme command inverts textflipme instead
of simply setting it to true. Well, that's because it should be the same
as the previous behavior, which was essentially to invert it instead of
setting it to true - i.e. calling flipme twice would keep the original
text box position in Flip Mode, which means it would be upside-down
(this is a lot of flipping to keep track of...) - because flipme added
to texty in-place instead of simply assigning to it. (It did the
calculation incorrectly in 2.2 and previous, but I digress.)

Similarly, textflipme is not reset in hardreset(), because none of the
other script text box variables are reset either.
2021-03-21 02:53:25 -04:00

77 lines
1.2 KiB
C++

#ifndef SCRIPT_H
#define SCRIPT_H
#include <string>
#include <vector>
#include <SDL.h>
#define filllines(lines) commands.insert(commands.end(), lines, lines + SDL_arraysize(lines))
struct Script
{
std::string name;
std::vector<std::string> contents;
};
class scriptclass
{
public:
scriptclass(void);
void load(const std::string& name);
void loadother(const char* t);
void loadcustom(const std::string& t);
void inline add(const std::string& t)
{
commands.push_back(t);
}
void clearcustom(void);
void tokenize(const std::string& t);
void run(void);
void resetgametomenu(void);
void startgamemode(int t);
void teleport(void);
void hardreset(void);
//Script contents
std::vector<std::string> commands;
std::string words[40];
std::vector<std::string> txt;
std::string scriptname;
int position;
int looppoint, loopcount;
int scriptdelay;
bool running, dontrunnextframe;
//Textbox stuff
int textx;
int texty;
int r,g,b;
bool textflipme;
//Misc
int i, j, k;
//Custom level stuff
std::vector<Script> customscripts;
};
#ifndef SCRIPT_DEFINITION
extern scriptclass script;
#endif
#endif /* SCRIPT_H */