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

Merge towerrender() into gamerender()

This removes a lot of duplicate code, which towerrender() mostly
consisted of, even though the only difference is that it draws a
separate map and screen edge spikes are drawn.
This commit is contained in:
Misa 2020-04-26 15:16:35 -07:00 committed by Ethan Lee
parent 660f752bae
commit 53bad3bcaf
3 changed files with 32 additions and 174 deletions

View file

@ -1358,21 +1358,37 @@ void gamerender()
if(!game.blackout) if(!game.blackout)
{ {
if(!game.colourblindmode) if (map.towermode)
{ {
graphics.drawbackground(map.background); if (!game.colourblindmode)
{
graphics.drawtowerbackground();
graphics.drawtowermap();
}
else
{
FillRect(graphics.backBuffer,0x00000);
graphics.drawtowermap_nobackground();
}
} }
else else
{ {
FillRect(graphics.backBuffer,0x00000); if(!game.colourblindmode)
} {
if (map.final_colormode) graphics.drawbackground(map.background);
{ }
graphics.drawfinalmap(); else
} {
else FillRect(graphics.backBuffer,0x00000);
{ }
graphics.drawmap(); if (map.final_colormode)
{
graphics.drawfinalmap();
}
else
{
graphics.drawmap();
}
} }
@ -1405,6 +1421,10 @@ void gamerender()
} }
graphics.drawentities(); graphics.drawentities();
if (map.towermode)
{
graphics.drawtowerspikes();
}
} }
if(map.extrarow==0 || (map.custommode && map.roomname!="")) if(map.extrarow==0 || (map.custommode && map.roomname!=""))
@ -2549,166 +2569,6 @@ void maprender()
} }
} }
void towerrender()
{
FillRect(graphics.backBuffer, 0x000000);
if (!game.colourblindmode)
{
graphics.drawtowerbackground();
graphics.drawtowermap();
}
else
{
graphics.drawtowermap_nobackground();
}
if(!game.completestop)
{
for (size_t i = 0; i < obj.entities.size(); i++)
{
//Is this entity on the ground? (needed for jumping)
if (obj.entitycollidefloor(i))
{
obj.entities[i].onground = 2;
}
else
{
obj.entities[i].onground--;
}
if (obj.entitycollideroof(i))
{
obj.entities[i].onroof = 2;
}
else
{
obj.entities[i].onroof--;
}
//Animate the entities
obj.animateentities(i);
}
}
graphics.drawentities();
graphics.drawtowerspikes();
graphics.cutscenebars();
BlitSurfaceStandard(graphics.backBuffer, NULL, graphics.tempBuffer, NULL);
graphics.drawgui();
if (graphics.flipmode)
{
if (game.advancetext) graphics.bprint(5, 228, "- Press ACTION to advance text -", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
}
else
{
if (game.advancetext) graphics.bprint(5, 5, "- Press ACTION to advance text -", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
}
graphics.footerrect.y = 230;
if (graphics.translucentroomname)
{
SDL_BlitSurface(graphics.footerbuffer, NULL, graphics.backBuffer, &graphics.footerrect);
}
else
{
FillRect(graphics.backBuffer, graphics.footerrect, 0);
}
graphics.bprint(5, 231, map.roomname, 196, 196, 255 - help.glow, true);
if (game.intimetrial && graphics.fademode==0)
{
//Draw countdown!
if (game.timetrialcountdown > 0)
{
if (game.timetrialcountdown < 30)
{
game.resetgameclock();
if (int(game.timetrialcountdown / 4) % 2 == 0) graphics.bigprint( -1, 100, "Go!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 4);
}
else if (game.timetrialcountdown < 60)
{
graphics.bigprint( -1, 100, "1", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 4);
}
else if (game.timetrialcountdown < 90)
{
graphics.bigprint( -1, 100, "2", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 4);
}
else if (game.timetrialcountdown < 120)
{
graphics.bigprint( -1, 100, "3", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 4);
}
}
else
{
//Draw OSD stuff
graphics.bprint(6, 18, "TIME :", 255,255,255);
graphics.bprint(6, 30, "DEATH:", 255, 255, 255);
graphics.bprint(6, 42, "SHINY:", 255,255,255);
if(game.timetrialparlost)
{
graphics.bprint(56, 18, game.timestring(), 196, 80, 80);
}
else
{
graphics.bprint(56, 18, game.timestring(), 196, 196, 196);
}
if(game.deathcounts>0)
{
graphics.bprint(56, 30,help.String(game.deathcounts), 196, 80, 80);
}
else
{
graphics.bprint(56, 30,help.String(game.deathcounts), 196, 196, 196);
}
if(game.trinkets()<game.timetrialshinytarget)
{
graphics.bprint(56, 42,help.String(game.trinkets()) + " of " +help.String(game.timetrialshinytarget), 196, 80, 80);
}
else
{
graphics.bprint(56, 42,help.String(game.trinkets()) + " of " +help.String(game.timetrialshinytarget), 196, 196, 196);
}
if(game.timetrialparlost)
{
graphics.bprint(195, 214, "PAR TIME:", 80, 80, 80);
graphics.bprint(275, 214, game.partimestring(), 80, 80, 80);
}
else
{
graphics.bprint(195, 214, "PAR TIME:", 255, 255, 255);
graphics.bprint(275, 214, game.partimestring(), 196, 196, 196);
}
}
}
graphics.drawfade();
if (game.flashlight > 0 && !game.noflashingmode)
{
game.flashlight--;
graphics.flashlight();
}
if (game.screenshake > 0 && !game.noflashingmode)
{
game.screenshake--;
graphics.screenshake();
}
else
{
graphics.render();
}
}
void teleporterrender() void teleporterrender()
{ {
int tempx; int tempx;

View file

@ -10,8 +10,6 @@
void titlerender(); void titlerender();
void towerrender();
void gamerender(); void gamerender();
void maprender(); void maprender();

View file

@ -425,7 +425,7 @@ int main(int argc, char *argv[])
if (map.towermode) if (map.towermode)
{ {
gameinput(); gameinput();
towerrender(); gamerender();
gamelogic(); gamelogic();
} }