mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-09-25 13:27:12 +03:00
Replace colour IDs with an enum
Entity colors are just integers. Their colour ID gets passed through a big switch, returning different RGB values depending on the colour ID (and can also get affected by randomness or other game state.) But because of this, there's a bunch of random numbers floating around, with no actual description on what they are other than comments which, while most of the time are accurate, only exist in the switch. To fix this, this commit adds a new enum which labels every colour. While we can't use it as a type (as we need to allow colours outside of what are defined, in case people want a "pure white", and scripting can set any colour ID they want), colours have to stay as `int`.
This commit is contained in:
@@ -2737,14 +2737,14 @@ void gameinput(void)
|
||||
int player = obj.getplayer();
|
||||
if (INBOUNDS_VEC(player, obj.entities))
|
||||
{
|
||||
obj.entities[player].colour = 102;
|
||||
obj.entities[player].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
|
||||
int teleporter = obj.getteleporter();
|
||||
if (INBOUNDS_VEC(teleporter, obj.entities))
|
||||
{
|
||||
obj.entities[teleporter].tile = 6;
|
||||
obj.entities[teleporter].colour = 102;
|
||||
obj.entities[teleporter].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
//which teleporter script do we use? it depends on the companion!
|
||||
game.setstate(4000);
|
||||
@@ -2768,16 +2768,16 @@ void gameinput(void)
|
||||
int player = obj.getplayer();
|
||||
if (INBOUNDS_VEC(player, obj.entities))
|
||||
{
|
||||
obj.entities[player].colour = 102;
|
||||
obj.entities[player].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
int companion = obj.getcompanion();
|
||||
if(INBOUNDS_VEC(companion, obj.entities)) obj.entities[companion].colour = 102;
|
||||
if(INBOUNDS_VEC(companion, obj.entities)) obj.entities[companion].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
|
||||
int teleporter = obj.getteleporter();
|
||||
if (INBOUNDS_VEC(teleporter, obj.entities))
|
||||
{
|
||||
obj.entities[teleporter].tile = 6;
|
||||
obj.entities[teleporter].colour = 102;
|
||||
obj.entities[teleporter].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
//which teleporter script do we use? it depends on the companion!
|
||||
game.setstate(3000);
|
||||
@@ -3241,7 +3241,7 @@ static void mapmenuactionpress(const bool version2_2)
|
||||
int i = obj.getplayer();
|
||||
if (INBOUNDS_VEC(i, obj.entities))
|
||||
{
|
||||
obj.entities[i].colour = 102;
|
||||
obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
|
||||
//which teleporter script do we use? it depends on the companion!
|
||||
@@ -3463,14 +3463,14 @@ void teleporterinput(void)
|
||||
int i = obj.getplayer();
|
||||
if (INBOUNDS_VEC(i, obj.entities))
|
||||
{
|
||||
obj.entities[i].colour = 102;
|
||||
obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
|
||||
i = obj.getteleporter();
|
||||
if (INBOUNDS_VEC(i, obj.entities))
|
||||
{
|
||||
obj.entities[i].tile = 6;
|
||||
obj.entities[i].colour = 102;
|
||||
obj.entities[i].colour = EntityColour_TELEPORTER_FLASHING;
|
||||
}
|
||||
//which teleporter script do we use? it depends on the companion!
|
||||
game.setstate(4000);
|
||||
|
||||
Reference in New Issue
Block a user