mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Move title usages of towerbg to titlebg
With the previous commit in place, we can now simply move some usages of the previous towerbg to use a separate object instead. That way, we don't have to mess with a monolithic state, or some better way to phrase what I just said, and we instead have two separate objects that can coexist side-by-side.
This commit is contained in:
parent
72c048d71e
commit
70f3d457dd
10 changed files with 54 additions and 44 deletions
|
@ -1373,7 +1373,7 @@ void Game::updatestate()
|
|||
gamestate = TITLEMODE;
|
||||
graphics.fademode = 4;
|
||||
graphics.backgrounddrawn = true;
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
createmenu(Menu::timetrialcomplete);
|
||||
state = 0;
|
||||
break;
|
||||
|
@ -2942,7 +2942,7 @@ void Game::updatestate()
|
|||
gamestate = TITLEMODE;
|
||||
graphics.fademode = 4;
|
||||
graphics.backgrounddrawn = true;
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
music.play(6);
|
||||
state = 0;
|
||||
break;
|
||||
|
@ -3278,7 +3278,7 @@ void Game::updatestate()
|
|||
gamestate = TITLEMODE;
|
||||
graphics.fademode = 4;
|
||||
graphics.backgrounddrawn = true;
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
createmenu(Menu::nodeathmodecomplete);
|
||||
state = 0;
|
||||
break;
|
||||
|
@ -7129,7 +7129,7 @@ void Game::quittomenu()
|
|||
FILESYSTEM_unmountassets(); // should be before music.play(6)
|
||||
music.play(6);
|
||||
graphics.backgrounddrawn = false;
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
graphics.flipmode = false;
|
||||
//Don't be stuck on the summary screen,
|
||||
//or "who do you want to play the level with?"
|
||||
|
@ -7223,7 +7223,7 @@ void Game::returntoeditor()
|
|||
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
|
||||
}
|
||||
}
|
||||
graphics.towerbg.scrolldir = 0;
|
||||
graphics.titlebg.scrolldir = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7233,7 +7233,7 @@ void Game::returntopausemenu()
|
|||
returntomenu(kludge_ingametemp);
|
||||
gamestate = MAPMODE;
|
||||
map.kludge_to_bg();
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
graphics.backgrounddrawn = false;
|
||||
mapheld = true;
|
||||
graphics.flipmode = graphics.setflipmode;
|
||||
|
|
|
@ -118,6 +118,7 @@ void Graphics::init()
|
|||
footerbuffer = NULL;
|
||||
ghostbuffer = NULL;
|
||||
towerbg = TowerBG();
|
||||
titlebg = TowerBG();
|
||||
trinketr = 0;
|
||||
trinketg = 0;
|
||||
trinketb = 0;
|
||||
|
|
|
@ -230,6 +230,7 @@ public:
|
|||
SDL_Surface* tempBuffer;
|
||||
|
||||
TowerBG towerbg;
|
||||
TowerBG titlebg;
|
||||
|
||||
SDL_Rect bfont_rect;
|
||||
SDL_Rect tiles_rect;
|
||||
|
|
|
@ -580,6 +580,7 @@ void menuactionpress()
|
|||
game.colourblindmode = !game.colourblindmode;
|
||||
game.savestats();
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
music.playef(11);
|
||||
break;
|
||||
case 1:
|
||||
|
@ -1683,7 +1684,7 @@ void titleinput()
|
|||
music.playef(18);
|
||||
game.screenshake = 10;
|
||||
game.flashlight = 5;
|
||||
graphics.towerbg.colstate = 10;
|
||||
graphics.titlebg.colstate = 10;
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else
|
||||
|
@ -2381,13 +2382,13 @@ void mapmenuactionpress()
|
|||
map.bg_to_kludge();
|
||||
game.kludge_ingametemp = game.currentmenuname;
|
||||
|
||||
graphics.towerbg.scrolldir = 0;
|
||||
graphics.towerbg.colstate = ((int) (graphics.towerbg.colstate / 5)) * 5;
|
||||
graphics.towerbg.bypos = 0;
|
||||
graphics.titlebg.scrolldir = 0;
|
||||
graphics.titlebg.colstate = ((int) (graphics.titlebg.colstate / 5)) * 5;
|
||||
graphics.titlebg.bypos = 0;
|
||||
map.nexttowercolour();
|
||||
|
||||
// Fix delta rendering glitch
|
||||
graphics.updatetowerbackground(graphics.towerbg);
|
||||
graphics.updatetowerbackground(graphics.titlebg);
|
||||
titleupdatetextcol();
|
||||
break;
|
||||
}
|
||||
|
@ -2536,11 +2537,11 @@ void gamecompleteinput()
|
|||
//Do this before we update map.bypos
|
||||
if (!game.colourblindmode)
|
||||
{
|
||||
graphics.updatetowerbackground(graphics.towerbg);
|
||||
graphics.updatetowerbackground(graphics.titlebg);
|
||||
}
|
||||
|
||||
//Do these here because input comes first
|
||||
graphics.towerbg.bypos += graphics.towerbg.bscroll;
|
||||
graphics.titlebg.bypos += graphics.titlebg.bscroll;
|
||||
game.oldcreditposition = game.creditposition;
|
||||
|
||||
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
|
||||
|
@ -2556,7 +2557,7 @@ void gamecompleteinput()
|
|||
}
|
||||
else
|
||||
{
|
||||
graphics.towerbg.bscroll = +7;
|
||||
graphics.titlebg.bscroll = +7;
|
||||
}
|
||||
game.press_action = true;
|
||||
}
|
||||
|
|
|
@ -27,15 +27,15 @@ void titleupdatetextcol()
|
|||
void titlelogic()
|
||||
{
|
||||
//Misc
|
||||
//map.updatetowerglow(graphics.towerbg);
|
||||
//map.updatetowerglow(graphics.titlebg);
|
||||
help.updateglow();
|
||||
|
||||
graphics.towerbg.bypos -= 2;
|
||||
graphics.towerbg.bscroll = -2;
|
||||
graphics.titlebg.bypos -= 2;
|
||||
graphics.titlebg.bscroll = -2;
|
||||
|
||||
if (!game.colourblindmode)
|
||||
{
|
||||
graphics.updatetowerbackground(graphics.towerbg);
|
||||
graphics.updatetowerbackground(graphics.titlebg);
|
||||
}
|
||||
|
||||
if (!game.menustart)
|
||||
|
@ -149,10 +149,10 @@ void maplogic()
|
|||
void gamecompletelogic()
|
||||
{
|
||||
//Misc
|
||||
map.updatetowerglow(graphics.towerbg);
|
||||
map.updatetowerglow(graphics.titlebg);
|
||||
help.updateglow();
|
||||
graphics.crewframe = 0;
|
||||
graphics.towerbg.scrolldir = 1;
|
||||
graphics.titlebg.scrolldir = 1;
|
||||
graphics.updatetitlecolours();
|
||||
|
||||
graphics.col_tr = map.r - (help.glow / 4) - fRandom() * 4;
|
||||
|
@ -169,11 +169,11 @@ void gamecompletelogic()
|
|||
if (game.creditposition <= -Credits::creditmaxposition)
|
||||
{
|
||||
game.creditposition = -Credits::creditmaxposition;
|
||||
graphics.towerbg.bscroll = 0;
|
||||
graphics.titlebg.bscroll = 0;
|
||||
}
|
||||
else if (!game.press_action)
|
||||
{
|
||||
graphics.towerbg.bscroll = +1;
|
||||
graphics.titlebg.bscroll = +1;
|
||||
}
|
||||
|
||||
if (graphics.fademode == 1)
|
||||
|
@ -182,8 +182,8 @@ void gamecompletelogic()
|
|||
graphics.showcutscenebars = false;
|
||||
graphics.cutscenebarspos = 0;
|
||||
graphics.oldcutscenebarspos = 0;
|
||||
graphics.towerbg.scrolldir = 0;
|
||||
graphics.towerbg.bypos = 0;
|
||||
graphics.titlebg.scrolldir = 0;
|
||||
graphics.titlebg.bypos = 0;
|
||||
//Return to game
|
||||
game.gamestate = GAMECOMPLETE2;
|
||||
graphics.fademode = 4;
|
||||
|
@ -193,7 +193,7 @@ void gamecompletelogic()
|
|||
void gamecompletelogic2()
|
||||
{
|
||||
//Misc
|
||||
map.updatetowerglow(graphics.towerbg);
|
||||
map.updatetowerglow(graphics.titlebg);
|
||||
help.updateglow();
|
||||
|
||||
game.creditposdelay--;
|
||||
|
@ -222,7 +222,7 @@ void gamecompletelogic2()
|
|||
game.savetele();
|
||||
music.currentsong=tmp;
|
||||
//Return to game
|
||||
graphics.towerbg.colstate = 10;
|
||||
graphics.titlebg.colstate = 10;
|
||||
game.gamestate = TITLEMODE;
|
||||
graphics.fademode = 4;
|
||||
FILESYSTEM_unmountassets(); // should be before music.playef(18)
|
||||
|
|
|
@ -628,10 +628,10 @@ void mapclass::updatetowerglow(TowerBG& bg_obj)
|
|||
|
||||
void mapclass::nexttowercolour()
|
||||
{
|
||||
graphics.towerbg.colstate+=5;
|
||||
if (graphics.towerbg.colstate >= 30) graphics.towerbg.colstate = 0;
|
||||
int check = graphics.towerbg.colstate % 5; //current state of phase
|
||||
int cmode = (graphics.towerbg.colstate - check) / 5; // current colour transition
|
||||
graphics.titlebg.colstate+=5;
|
||||
if (graphics.titlebg.colstate >= 30) graphics.titlebg.colstate = 0;
|
||||
int check = graphics.titlebg.colstate % 5; //current state of phase
|
||||
int cmode = (graphics.titlebg.colstate - check) / 5; // current colour transition
|
||||
|
||||
switch(cmode)
|
||||
{
|
||||
|
@ -655,15 +655,15 @@ void mapclass::nexttowercolour()
|
|||
break;
|
||||
}
|
||||
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
}
|
||||
|
||||
void mapclass::settowercolour(int t)
|
||||
{
|
||||
graphics.towerbg.colstate=t*5;
|
||||
if (graphics.towerbg.colstate >= 30) graphics.towerbg.colstate = 0;
|
||||
int check = graphics.towerbg.colstate % 5; //current state of phase
|
||||
int cmode = (graphics.towerbg.colstate - check) / 5; // current colour transition
|
||||
graphics.titlebg.colstate=t*5;
|
||||
if (graphics.titlebg.colstate >= 30) graphics.titlebg.colstate = 0;
|
||||
int check = graphics.titlebg.colstate % 5; //current state of phase
|
||||
int cmode = (graphics.titlebg.colstate - check) / 5; // current colour transition
|
||||
|
||||
switch(cmode)
|
||||
{
|
||||
|
@ -687,7 +687,7 @@ void mapclass::settowercolour(int t)
|
|||
break;
|
||||
}
|
||||
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
}
|
||||
|
||||
bool mapclass::spikecollide(int x, int y)
|
||||
|
|
|
@ -1182,7 +1182,7 @@ void titlerender()
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!game.colourblindmode) graphics.drawtowerbackground(graphics.towerbg);
|
||||
if(!game.colourblindmode) graphics.drawtowerbackground(graphics.titlebg);
|
||||
|
||||
tr = graphics.col_tr;
|
||||
tg = graphics.col_tg;
|
||||
|
@ -1211,7 +1211,7 @@ void gamecompleterender()
|
|||
{
|
||||
FillRect(graphics.backBuffer, 0x000000);
|
||||
|
||||
if(!game.colourblindmode) graphics.drawtowerbackground(graphics.towerbg);
|
||||
if(!game.colourblindmode) graphics.drawtowerbackground(graphics.titlebg);
|
||||
|
||||
tr = graphics.col_tr;
|
||||
tg = graphics.col_tg;
|
||||
|
|
|
@ -2642,7 +2642,7 @@ void scriptclass::resetgametomenu()
|
|||
graphics.flipmode = false;
|
||||
obj.entities.clear();
|
||||
graphics.fademode = 4;
|
||||
graphics.towerbg.tdrawback = true;
|
||||
graphics.titlebg.tdrawback = true;
|
||||
game.createmenu(Menu::gameover);
|
||||
}
|
||||
|
||||
|
|
|
@ -3292,7 +3292,7 @@ void editorrender()
|
|||
{
|
||||
if(!game.colourblindmode)
|
||||
{
|
||||
graphics.drawtowerbackground(graphics.towerbg);
|
||||
graphics.drawtowerbackground(graphics.titlebg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3679,8 +3679,8 @@ void editorlogic()
|
|||
game.shouldreturntoeditor = false;
|
||||
}
|
||||
|
||||
graphics.towerbg.bypos -= 2;
|
||||
graphics.towerbg.bscroll = -2;
|
||||
graphics.titlebg.bypos -= 2;
|
||||
graphics.titlebg.bscroll = -2;
|
||||
|
||||
ed.entframedelay--;
|
||||
if(ed.entframedelay<=0)
|
||||
|
@ -3740,14 +3740,14 @@ void editorlogic()
|
|||
}
|
||||
else if (!game.colourblindmode)
|
||||
{
|
||||
graphics.updatetowerbackground(graphics.towerbg);
|
||||
graphics.updatetowerbackground(graphics.titlebg);
|
||||
}
|
||||
|
||||
if (graphics.fademode == 1)
|
||||
{
|
||||
//Return to game
|
||||
map.nexttowercolour();
|
||||
graphics.towerbg.colstate = 10;
|
||||
graphics.titlebg.colstate = 10;
|
||||
game.gamestate = TITLEMODE;
|
||||
script.hardreset();
|
||||
graphics.fademode = 4;
|
||||
|
|
|
@ -211,6 +211,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
map.ypos = (700-29) * 8;
|
||||
graphics.towerbg.bypos = map.ypos / 2;
|
||||
graphics.titlebg.bypos = map.ypos / 2;
|
||||
|
||||
//Moved screensetting init here from main menu V2.1
|
||||
int width = 320;
|
||||
|
@ -262,6 +263,12 @@ int main(int argc, char *argv[])
|
|||
graphics.towerbg.buffer_lerp = CREATE_SURFACE(320 + 16, 240 + 16);
|
||||
SDL_SetSurfaceBlendMode(graphics.towerbg.buffer_lerp, SDL_BLENDMODE_NONE);
|
||||
|
||||
graphics.titlebg.buffer = CREATE_SURFACE(320 + 16, 240 + 16);
|
||||
SDL_SetSurfaceBlendMode(graphics.titlebg.buffer, SDL_BLENDMODE_NONE);
|
||||
|
||||
graphics.titlebg.buffer_lerp = CREATE_SURFACE(320 + 16, 240 + 16);
|
||||
SDL_SetSurfaceBlendMode(graphics.titlebg.buffer_lerp, SDL_BLENDMODE_NONE);
|
||||
|
||||
graphics.tempBuffer = CREATE_SURFACE(320, 240);
|
||||
SDL_SetSurfaceBlendMode(graphics.tempBuffer, SDL_BLENDMODE_NONE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue