Move mapclass r/g/b variables off onto TowerBG

This fixes a bug where if you entered a tower before watching the
credits sequence, the credits sequence would have mismatched text and
background colors.

This bug happened because entering a tower modified the r/g/b attributes
of mapclass, and updated graphics.towerbg, without updating
graphics.titlebg too. Then gamecompleterender() uses the r/g/b
attributes of mapclass.

The solution is to put the r/g/b attributes on TowerBG instead. That
way, entering a tower will only modify the r/g/b attributes used to
render towers, and won't affect the r/g/b attributes used to render the
credits sequence.

Additionally, I also de-duplicated the case-switch that updated the
r/g/b attributes based off of the current colstate, because it got
copy-pasted twice, leading to three instances of one piece of code.
This commit is contained in:
Misa
2021-01-07 17:37:38 -08:00
committed by Ethan Lee
parent 6b18e3875d
commit 3dd1dcc131
5 changed files with 50 additions and 91 deletions

View File

@@ -46,7 +46,9 @@ public:
void changefinalcol(int t);
void setcol(const int r1, const int g1, const int b1 , const int r2, const int g2, const int b2, const int c);
void setcol(TowerBG& bg_obj, const int r1, const int g1, const int b1 , const int r2, const int g2, const int b2, const int c);
void updatebgobj(TowerBG& bg_obj);
void updatetowerglow(TowerBG& bg_obj);
@@ -109,8 +111,6 @@ public:
int resumedelay;
bool minitowermode;
//This is the old colour cycle
int r, g,b;
int colstatedelay;
int colsuperstate;
int spikeleveltop, spikelevelbottom;