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

Add changerespawncolour() script command

This command simply changes the color that the player respawns with upon
death. The respawn color also persists through custom save files.

Closes #830.
This commit is contained in:
Misa 2021-09-06 16:09:18 -07:00
parent 33c5b8b7c0
commit 8e61a04937
4 changed files with 17 additions and 1 deletions

View file

@ -363,6 +363,8 @@ void Game::init(void)
disableaudiopause = false; disableaudiopause = false;
disabletemporaryaudiopause = true; disabletemporaryaudiopause = true;
inputdelay = false; inputdelay = false;
respawncolour = 0;
} }
void Game::lifesequence(void) void Game::lifesequence(void)
@ -5198,6 +5200,10 @@ void Game::customloadquick(const std::string& savfile)
{ {
map.showtrinkets = help.Int(pText); map.showtrinkets = help.Int(pText);
} }
else if (SDL_strcmp(pKey, "respawncolour") == 0)
{
respawncolour = help.Int(pText);
}
} }
@ -5670,6 +5676,8 @@ bool Game::customsavequick(const std::string& savfile)
xml::update_tag(msgs, "showtrinkets", (int) map.showtrinkets); xml::update_tag(msgs, "showtrinkets", (int) map.showtrinkets);
xml::update_tag(msgs, "respawncolour", respawncolour);
std::string summary = savearea + ", " + timestring(); std::string summary = savearea + ", " + timestring();
xml::update_tag(msgs, "summary", summary.c_str()); xml::update_tag(msgs, "summary", summary.c_str());

View file

@ -481,6 +481,8 @@ public:
bool disableaudiopause; bool disableaudiopause;
bool disabletemporaryaudiopause; bool disabletemporaryaudiopause;
bool inputdelay; bool inputdelay;
int respawncolour;
}; };
#ifndef GAME_DEFINITION #ifndef GAME_DEFINITION

View file

@ -833,7 +833,7 @@ void mapclass::resetplayer(const bool player_died)
obj.entities[i].newyp = obj.entities[i].yp; obj.entities[i].newyp = obj.entities[i].yp;
obj.entities[i].dir = game.savedir; obj.entities[i].dir = game.savedir;
obj.entities[i].colour = 0; obj.entities[i].colour = game.respawncolour;
if (player_died) if (player_died)
{ {
game.lifeseq = 10; game.lifeseq = 10;

View file

@ -1672,6 +1672,10 @@ void scriptclass::run(void)
obj.entities[i].colour = getcolorfromname(words[1]); obj.entities[i].colour = getcolorfromname(words[1]);
} }
} }
else if (words[0] == "changerespawncolour")
{
game.respawncolour = getcolorfromname(words[1]);
}
else if (words[0] == "altstates") else if (words[0] == "altstates")
{ {
obj.altstates = ss_toi(words[1]); obj.altstates = ss_toi(words[1]);
@ -3184,6 +3188,8 @@ void scriptclass::hardreset(void)
game.disabletemporaryaudiopause = true; game.disabletemporaryaudiopause = true;
game.respawncolour = 0;
//dwgraphicsclass //dwgraphicsclass
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
graphics.textbox.clear(); graphics.textbox.clear();