1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-08 18:09:45 +01:00

Make scriptclass::load(other) rely less on std::string

Instead of comparing against an std::string (which is heavily
templated), just use good ol' SDL_strcmp().
This commit is contained in:
Misa 2020-07-04 15:59:21 -07:00 committed by Ethan Lee
parent 9398e9f1f0
commit d480c1011c
3 changed files with 210 additions and 209 deletions

View file

@ -22,9 +22,9 @@ public:
scriptclass();
void load(std::string t);
void loadother(std::string t);
void load(std::string name);
void loadother(const char* t);
void loadcustom(std::string t);
void inline add(std::string t)
{
@ -45,8 +45,6 @@ public:
void hardreset();
void loadcustom(std::string t);
//Script contents
std::vector<std::string> commands;
std::string words[40];

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,10 @@
#include "Script.h"
#include <SDL.h>
void scriptclass::loadother(std::string t)
void scriptclass::loadother(const char* t)
{
//loads script name t into the array
if (t == "terminal_station_1")
if (SDL_strcmp(t, "terminal_station_1") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -34,7 +35,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "alreadyvisited")
else if (SDL_strcmp(t, "alreadyvisited") == 0)
{
static const char* lines[] = {
"squeak(player)",
@ -49,7 +50,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_1")
else if (SDL_strcmp(t, "terminal_outside_1") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -100,7 +101,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_2")
else if (SDL_strcmp(t, "terminal_outside_2") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -149,7 +150,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_3")
else if (SDL_strcmp(t, "terminal_outside_3") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -198,7 +199,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_4")
else if (SDL_strcmp(t, "terminal_outside_4") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -236,7 +237,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_5")
else if (SDL_strcmp(t, "terminal_outside_5") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -285,7 +286,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_outside_6")
else if (SDL_strcmp(t, "terminal_outside_6") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -334,7 +335,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_finallevel")
else if (SDL_strcmp(t, "terminal_finallevel") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -409,7 +410,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "finalterminal_finish")
else if (SDL_strcmp(t, "finalterminal_finish") == 0)
{
@ -440,7 +441,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_station_2")
else if (SDL_strcmp(t, "terminal_station_2") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -468,7 +469,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_station_3")
else if (SDL_strcmp(t, "terminal_station_3") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -495,7 +496,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_station_4")
else if (SDL_strcmp(t, "terminal_station_4") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -522,7 +523,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_warp_1")
else if (SDL_strcmp(t, "terminal_warp_1") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -549,7 +550,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_warp_2")
else if (SDL_strcmp(t, "terminal_warp_2") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -577,7 +578,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_lab_1")
else if (SDL_strcmp(t, "terminal_lab_1") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -615,7 +616,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_lab_2")
else if (SDL_strcmp(t, "terminal_lab_2") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -634,7 +635,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_secretlab")
else if (SDL_strcmp(t, "terminal_secretlab") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -665,7 +666,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_shipcomputer")
else if (SDL_strcmp(t, "terminal_shipcomputer") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -695,7 +696,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_letsgo")
else if (SDL_strcmp(t, "terminal_letsgo") == 0)
{
static const char* lines[] = {
"squeak(player)",
@ -725,7 +726,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_radio")
else if (SDL_strcmp(t, "terminal_radio") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -747,7 +748,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukebox")
else if (SDL_strcmp(t, "terminal_jukebox") == 0)
{
static const char* lines[] = {
"cutscene()",
@ -781,7 +782,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock1")
else if (SDL_strcmp(t, "terminal_jukeunlock1") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -799,7 +800,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock2")
else if (SDL_strcmp(t, "terminal_jukeunlock2") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -817,7 +818,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock3")
else if (SDL_strcmp(t, "terminal_jukeunlock3") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -835,7 +836,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock4")
else if (SDL_strcmp(t, "terminal_jukeunlock4") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -853,7 +854,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock41")
else if (SDL_strcmp(t, "terminal_jukeunlock41") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -871,7 +872,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock5")
else if (SDL_strcmp(t, "terminal_jukeunlock5") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -889,7 +890,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock6")
else if (SDL_strcmp(t, "terminal_jukeunlock6") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -907,7 +908,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_jukeunlock7")
else if (SDL_strcmp(t, "terminal_jukeunlock7") == 0)
{
static const char* lines[] = {
"squeak(terminal)",
@ -925,7 +926,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke1")
else if (SDL_strcmp(t, "terminal_juke1") == 0)
{
static const char* lines[] = {
"play(4)",
@ -934,7 +935,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke2")
else if (SDL_strcmp(t, "terminal_juke2") == 0)
{
static const char* lines[] = {
"play(1)",
@ -943,7 +944,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke3")
else if (SDL_strcmp(t, "terminal_juke3") == 0)
{
static const char* lines[] = {
"play(2)",
@ -952,7 +953,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke4")
else if (SDL_strcmp(t, "terminal_juke4") == 0)
{
static const char* lines[] = {
"play(6)",
@ -961,7 +962,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke5")
else if (SDL_strcmp(t, "terminal_juke5") == 0)
{
static const char* lines[] = {
"play(3)",
@ -970,7 +971,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke6")
else if (SDL_strcmp(t, "terminal_juke6") == 0)
{
static const char* lines[] = {
"play(8)",
@ -979,7 +980,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke7")
else if (SDL_strcmp(t, "terminal_juke7") == 0)
{
static const char* lines[] = {
"play(11)",
@ -988,7 +989,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke8")
else if (SDL_strcmp(t, "terminal_juke8") == 0)
{
static const char* lines[] = {
"play(10)",
@ -997,7 +998,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke9")
else if (SDL_strcmp(t, "terminal_juke9") == 0)
{
static const char* lines[] = {
"play(12)",
@ -1006,7 +1007,7 @@ void scriptclass::loadother(std::string t)
};
filllines(lines);
}
else if (t == "terminal_juke10")
else if (SDL_strcmp(t, "terminal_juke10") == 0)
{
static const char* lines[] = {
"play(9)",