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:
parent
d1b1ed830b
commit
f151cff34d
3 changed files with 16 additions and 1 deletions
|
@ -1689,6 +1689,7 @@ void gamelogic()
|
|||
ghost.x = obj.entities[i].xp;
|
||||
ghost.y = obj.entities[i].yp;
|
||||
ghost.col = obj.entities[i].colour;
|
||||
ghost.realcol = obj.entities[i].realcol;
|
||||
ghost.frame = obj.entities[i].drawframe;
|
||||
}
|
||||
ed.ghosts.push_back(ghost);
|
||||
|
|
|
@ -2889,7 +2889,7 @@ void editorrender()
|
|||
point tpoint;
|
||||
tpoint.x = ed.ghosts[i].x;
|
||||
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 therest = graphics.ct.colour & 0x00FFFFFF;
|
||||
alpha = (3 * (alpha >> 24) / 4) << 24;
|
||||
|
@ -3621,6 +3621,19 @@ void editorlogic()
|
|||
|
||||
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()) {
|
||||
ed.currentghosts++;
|
||||
if (ed.zmod) ed.currentghosts++;
|
||||
|
|
|
@ -82,6 +82,7 @@ struct GhostInfo {
|
|||
int x; // .xp
|
||||
int y; // .yp
|
||||
int col; // .colour
|
||||
Uint32 realcol;
|
||||
int frame; // .drawframe
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue