mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Merge pull request #127 from InfoTeddy/general-bug-fixes
Don't re-draw horizontal and vertical warp backgrounds if gotoroom()ing to the same room in custom levels
This commit is contained in:
commit
5afba66d2e
3 changed files with 17 additions and 2 deletions
|
@ -121,6 +121,7 @@ public:
|
||||||
int door_up;
|
int door_up;
|
||||||
int door_down;
|
int door_down;
|
||||||
int roomx, roomy, roomchangedir;
|
int roomx, roomy, roomchangedir;
|
||||||
|
int prevroomx, prevroomy;
|
||||||
int temp, j, k;
|
int temp, j, k;
|
||||||
|
|
||||||
int savex, savey, saverx, savery;
|
int savex, savey, saverx, savery;
|
||||||
|
|
|
@ -1059,9 +1059,18 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
|
||||||
loadlevel(game.roomx, game.roomy, dwgfx, game, obj, music);
|
loadlevel(game.roomx, game.roomy, dwgfx, game, obj, music);
|
||||||
|
|
||||||
|
|
||||||
|
//Do we need to reload the background?
|
||||||
|
bool redrawbg = game.roomx != game.prevroomx || game.roomy != game.prevroomy;
|
||||||
|
|
||||||
|
if(redrawbg)
|
||||||
|
{
|
||||||
dwgfx.backgrounddrawn = false; //Used for background caching speedup
|
dwgfx.backgrounddrawn = false; //Used for background caching speedup
|
||||||
|
}
|
||||||
dwgfx.foregrounddrawn = false; //Used for background caching speedup
|
dwgfx.foregrounddrawn = false; //Used for background caching speedup
|
||||||
|
|
||||||
|
game.prevroomx = game.roomx;
|
||||||
|
game.prevroomy = game.roomy;
|
||||||
|
|
||||||
//a very special case: if entering the communication room, room 13,4 before tag 5 is set, set the game state to a background
|
//a very special case: if entering the communication room, room 13,4 before tag 5 is set, set the game state to a background
|
||||||
//textbox thingy. if tag five is not set when changing room, reset the game state. (tag 5 is set when you get back to the ship)
|
//textbox thingy. if tag five is not set when changing room, reset the game state. (tag 5 is set when you get back to the ship)
|
||||||
if(!game.intimetrial && !custommode)
|
if(!game.intimetrial && !custommode)
|
||||||
|
@ -1605,7 +1614,10 @@ void mapclass::loadlevel(int rx, int ry, Graphics& dwgfx, Game& game, entityclas
|
||||||
}
|
}
|
||||||
|
|
||||||
//If screen warping, then override all that:
|
//If screen warping, then override all that:
|
||||||
|
bool redrawbg = game.roomx != game.prevroomx || game.roomy != game.prevroomy;
|
||||||
|
if(redrawbg){
|
||||||
dwgfx.backgrounddrawn = false;
|
dwgfx.backgrounddrawn = false;
|
||||||
|
}
|
||||||
if(ed.level[curlevel].warpdir>0){
|
if(ed.level[curlevel].warpdir>0){
|
||||||
if(ed.level[curlevel].warpdir==1){
|
if(ed.level[curlevel].warpdir==1){
|
||||||
warpx=true;
|
warpx=true;
|
||||||
|
|
|
@ -3427,6 +3427,8 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass&
|
||||||
game.roomchange = false;
|
game.roomchange = false;
|
||||||
game.roomx = 0;
|
game.roomx = 0;
|
||||||
game.roomy = 0;
|
game.roomy = 0;
|
||||||
|
game.prevroomx = 0;
|
||||||
|
game.prevroomy = 0;
|
||||||
game.teleport_to_new_area = false;
|
game.teleport_to_new_area = false;
|
||||||
game.teleport_to_x = 0;
|
game.teleport_to_x = 0;
|
||||||
game.teleport_to_y = 0;
|
game.teleport_to_y = 0;
|
||||||
|
|
Loading…
Reference in a new issue