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

Make sure sprite colors in the editor don't update more than 30 FPS

This adds Graphics::crewcolourreal(), which is like the
entityclass::crewcolour() that the editor already uses, except for the
real color instead of the color ID. Also, editorclass now has an
attribute `entcolreal` so enemy colors don't update more than 30 frames
a second.
This commit is contained in:
Misa 2020-05-02 13:53:19 -07:00 committed by Ethan Lee
parent 98e033e5d0
commit 49fbe18d34
4 changed files with 37 additions and 8 deletions

View file

@ -3080,3 +3080,23 @@ void Graphics::reloadresources() {
music.init();
}
Uint32 Graphics::crewcolourreal(int t)
{
switch (t)
{
case 0:
return col_crewcyan;
case 1:
return col_crewpurple;
case 2:
return col_crewyellow;
case 3:
return col_crewred;
case 4:
return col_crewgreen;
case 5:
return col_crewblue;
}
return col_crewcyan;
}

View file

@ -322,6 +322,8 @@ public:
void updatetitlecolours();
bool kludgeswnlinewidth;
Uint32 crewcolourreal(int t);
};
extern Graphics graphics;

View file

@ -2564,8 +2564,6 @@ void editorrender()
}
//Draw entities
game.customcol=ed.getlevelcol(ed.levx+(ed.levy*ed.maxwidth))+1;
ed.entcol=ed.getenemycol(game.customcol);
obj.customplatformtile=game.customcol*12;
ed.temp=edentat(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30));
@ -2585,7 +2583,7 @@ void editorrender()
switch(edentity[i].t)
{
case 1: //Entities
graphics.drawspritesetcol((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),ed.getenemyframe(ed.level[ed.levx+(ed.levy*ed.maxwidth)].enemytype),ed.entcol);
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),ed.getenemyframe(ed.level[ed.levx+(ed.levy*ed.maxwidth)].enemytype),ed.entcolreal);
if(edentity[i].p1==0) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "V", 255, 255, 255 - help.glow, false);
if(edentity[i].p1==1) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "^", 255, 255, 255 - help.glow, false);
if(edentity[i].p1==2) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "<", 255, 255, 255 - help.glow, false);
@ -2728,17 +2726,17 @@ void editorrender()
}
break;
case 15: //Crewmates
graphics.drawspritesetcol((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),144,obj.crewcolour(edentity[i].p1));
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),144,graphics.crewcolourreal(edentity[i].p1));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,164,164));
break;
case 16: //Start
if(edentity[i].p1==0) //Left
{
graphics.drawspritesetcol((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),0,obj.crewcolour(0));
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),0,graphics.col_crewcyan);
}
else if(edentity[i].p1==1)
{
graphics.drawspritesetcol((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),3,obj.crewcolour(0));
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),3,graphics.col_crewcyan);
}
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,255,255));
if(ed.entframe<2)
@ -3365,10 +3363,10 @@ void editorrender()
FillRect(graphics.backBuffer, tx+6,ty+2,4,12,graphics.getRGB(255,255,255));
//15:
tx+=tg;
graphics.drawsprite(tx,ty,186,75, 75, 255- help.glow/4 - (fRandom()*20));
graphics.drawsprite(tx,ty,186,graphics.col_crewblue);
//16:
tx+=tg;
graphics.drawsprite(tx,ty,184,160- help.glow/2 - (fRandom()*20), 200- help.glow/2, 220 - help.glow);
graphics.drawsprite(tx,ty,184,graphics.col_crewcyan);
if(ed.drawmode==10)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"R",255,255,255,false);
if(ed.drawmode==11)graphics.Print(22+((ed.drawmode-10)*tg)-4, 225-4,"T",255,255,255,false);
@ -3593,6 +3591,13 @@ void editorlogic()
{
//Misc
help.updateglow();
graphics.updatetitlecolours();
game.customcol=ed.getlevelcol(ed.levx+(ed.levy*ed.maxwidth))+1;
ed.entcol=ed.getenemycol(game.customcol);
graphics.setcol(ed.entcol);
ed.entcolreal = graphics.ct.colour;
map.bypos -= 2;
map.bscroll = -2;

View file

@ -6,6 +6,7 @@
#include <vector>
#include <string>
#include "Script.h"
#include "Graphics.h"
class edentities{
public:
@ -150,6 +151,7 @@ class editorclass{
int getlevelcol(int t);
int getenemycol(int t);
int entcol;
Uint32 entcolreal;
//Colouring stuff
int getwarpbackground(int rx, int ry);