mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +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:
@@ -3423,19 +3423,19 @@ int Graphics::crewcolour(const int t)
|
||||
switch (t)
|
||||
{
|
||||
case 0:
|
||||
return CYAN;
|
||||
return EntityColour_CREW_CYAN;
|
||||
case 1:
|
||||
return PURPLE;
|
||||
return EntityColour_CREW_PURPLE;
|
||||
case 2:
|
||||
return YELLOW;
|
||||
return EntityColour_CREW_YELLOW;
|
||||
case 3:
|
||||
return RED;
|
||||
return EntityColour_CREW_RED;
|
||||
case 4:
|
||||
return GREEN;
|
||||
return EntityColour_CREW_GREEN;
|
||||
case 5:
|
||||
return BLUE;
|
||||
return EntityColour_CREW_BLUE;
|
||||
default:
|
||||
return 0;
|
||||
return EntityColour_CREW_CYAN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user