1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Fix editor ghost colors updating too fast

Like actual entities, editor ghost colors were updating every render
frame instead of logic frame. So just like actual entities, I added a
realcol attribute to them that editorrender() uses instead, and added
code to update said realcol attribute in editorlogic(). That way the
colors don't go by too quickly (especially the death color).
This commit is contained in:
Misa 2020-06-12 17:34:19 -07:00 committed by Ethan Lee
parent d1b1ed830b
commit f151cff34d
3 changed files with 16 additions and 1 deletions

View file

@ -1689,6 +1689,7 @@ void gamelogic()
ghost.x = obj.entities[i].xp; ghost.x = obj.entities[i].xp;
ghost.y = obj.entities[i].yp; ghost.y = obj.entities[i].yp;
ghost.col = obj.entities[i].colour; ghost.col = obj.entities[i].colour;
ghost.realcol = obj.entities[i].realcol;
ghost.frame = obj.entities[i].drawframe; ghost.frame = obj.entities[i].drawframe;
} }
ed.ghosts.push_back(ghost); ed.ghosts.push_back(ghost);

View file

@ -2889,7 +2889,7 @@ void editorrender()
point tpoint; point tpoint;
tpoint.x = ed.ghosts[i].x; tpoint.x = ed.ghosts[i].x;
tpoint.y = ed.ghosts[i].y; tpoint.y = ed.ghosts[i].y;
graphics.setcol(ed.ghosts[i].col); graphics.setcolreal(ed.ghosts[i].realcol);
Uint32 alpha = graphics.ct.colour & graphics.backBuffer->format->Amask; Uint32 alpha = graphics.ct.colour & graphics.backBuffer->format->Amask;
Uint32 therest = graphics.ct.colour & 0x00FFFFFF; Uint32 therest = graphics.ct.colour & 0x00FFFFFF;
alpha = (3 * (alpha >> 24) / 4) << 24; alpha = (3 * (alpha >> 24) / 4) << 24;
@ -3621,6 +3621,19 @@ void editorlogic()
if (game.ghostsenabled) if (game.ghostsenabled)
{ {
for (size_t i = 0; i < ed.ghosts.size(); i++)
{
GhostInfo& ghost = ed.ghosts[i];
if ((int) i > ed.currentghosts || ghost.rx != ed.levx || ghost.ry != ed.levy)
{
continue;
}
graphics.setcol(ghost.col);
ghost.realcol = graphics.ct.colour;
}
if (ed.currentghosts + 1 < (int)ed.ghosts.size()) { if (ed.currentghosts + 1 < (int)ed.ghosts.size()) {
ed.currentghosts++; ed.currentghosts++;
if (ed.zmod) ed.currentghosts++; if (ed.zmod) ed.currentghosts++;

View file

@ -82,6 +82,7 @@ struct GhostInfo {
int x; // .xp int x; // .xp
int y; // .yp int y; // .yp
int col; // .colour int col; // .colour
Uint32 realcol;
int frame; // .drawframe int frame; // .drawframe
}; };