mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Add player colour as a level property
This PR adds a new XML property for the player's colour. It is 0 by default, but you can change it to any colour ID. For example, making the player use the trinket color is `<PlayerColour>3</PlayerColour>`. This is mostly a quality-of-life addition, as the player's colour is always 0 unless changed by scripts. A lot of levels which use different player colours use an intro script which both changes the player's colour and sets their respawn colour, which works great for finished, completed levels, but makes playtesting a little more annoying as they will spawn in as the wrong colour. Adding a level property for the default player colour fixes this annoyance. Additionally, this changes the behavior of `restoreplayercolour`. This command used to set the player's colour to 0 (ignoring the respawn colour, so when Viridian would die, they would revert to the respawn colour). Now, it sets both Viridian's colour AND the respawn colour to what was present in the level file. This way, you can temporarily change the player colour using the script commands, and then use `restoreplayercolour` to revert back to what the player colour normally is. The start point colour has also changed, to show the player colour instead of always colour 0. Like most changes like this, a way to change this in-editor does not yet exist, but is planned for the future.
This commit is contained in:
@@ -1850,8 +1850,9 @@ void scriptclass::run(void)
|
||||
i = obj.getplayer();
|
||||
if (INBOUNDS_VEC(i, obj.entities))
|
||||
{
|
||||
obj.entities[i].colour = 0;
|
||||
obj.entities[i].colour = cl.player_colour;
|
||||
}
|
||||
game.savecolour = cl.player_colour;
|
||||
}
|
||||
else if (words[0] == "changeplayercolour")
|
||||
{
|
||||
@@ -2652,7 +2653,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
|
||||
}
|
||||
}
|
||||
|
||||
/* Containers which need to be reset before gameplay starts
|
||||
/* State which needs to be reset before gameplay starts
|
||||
* ex. before custom levels get loaded */
|
||||
|
||||
switch (mode)
|
||||
@@ -2662,6 +2663,8 @@ void scriptclass::startgamemode(const enum StartMode mode)
|
||||
default:
|
||||
textbox_colours.clear();
|
||||
add_default_colours();
|
||||
cl.onewaycol_override = false;
|
||||
cl.player_colour = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3207,7 +3210,7 @@ void scriptclass::hardreset(void)
|
||||
game.savey = 0;
|
||||
game.savegc = 0;
|
||||
}
|
||||
game.savecolour = 0;
|
||||
game.savecolour = cl.player_colour;
|
||||
|
||||
game.intimetrial = false;
|
||||
game.timetrialcountdown = 0;
|
||||
|
||||
Reference in New Issue
Block a user