1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Merge drawtowerbackgroundsolo() into drawtowerbackground()

It's less code being copied and pasted, especially since for my
over-30-FPS patch I would have to make a separate function for each if
both of them were still there, but if they're unified into one then I
will only have to make one more function.

And since map.scrolldir is now used outside of GAMEMODE, we'll need to
reset it in hardreset() and when exiting playtesting.
This commit is contained in:
Misa 2020-04-29 14:28:11 -07:00 committed by Ethan Lee
parent e9dd38ee35
commit 28db7038fc
6 changed files with 12 additions and 46 deletions

View File

@ -2201,43 +2201,6 @@ void Graphics::drawtowerspikes()
}
}
void Graphics::drawtowerbackgroundsolo()
{
if (map.bypos < 0)
{
map.bypos += 120 * 8;
}
int temp = 0;
if (map.tdrawback)
{
//Draw the whole thing; needed for every colour cycle!
for (int j = 0; j < 31; j++)
{
for (int i = 0; i < 40; i++)
{
temp = map.tower.backat(i, j, map.bypos);
drawtowertile3(i * 8, (j * 8) - (map.bypos % 8), temp, map.colstate);
}
}
SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL);
map.tdrawback = false;
}
else
{
//just update the bottom
ScrollSurface(towerbuffer,0, -map.bscroll);
for (int i = 0; i < 40; i++)
{
temp = map.tower.backat(i, 0, map.bypos);
drawtowertile3(i * 8, -(map.bypos % 8), temp, map.colstate);
}
SDL_BlitSurface(towerbuffer, NULL, backBuffer,NULL);
}
}
void Graphics::drawtowerbackground()
{
int temp;
@ -2248,7 +2211,7 @@ void Graphics::drawtowerbackground()
{
int off = map.scrolldir == 0 ? 0 : map.bscroll;
//Draw the whole thing; needed for every colour cycle!
for (j = 0; j < 30; j++)
for (int j = 0; j < 31; j++)
{
for (int i = 0; i < 40; i++)
{
@ -2265,14 +2228,17 @@ void Graphics::drawtowerbackground()
{
//just update the bottom
ScrollSurface(towerbuffer, 0, -map.bscroll);
for (int i = 0; i < 40; i++)
if (map.scrolldir == 0)
{
if (map.scrolldir == 0)
for (int i = 0; i < 40; i++)
{
temp = map.tower.backat(i, 0, map.bypos);
drawtowertile3(i * 8, -(map.bypos % 8), temp, map.colstate);
}
else
}
else
{
for (int i = 0; i < 40; i++)
{
temp = map.tower.backat(i, 29, map.bypos);
drawtowertile3(i * 8, 29*8 - (map.bypos % 8) - map.bscroll, temp, map.colstate);

View File

@ -185,8 +185,6 @@ public:
bool onscreen(int t);
void drawtowerbackgroundsolo();
void menuoffrender();

View File

@ -1556,6 +1556,7 @@ void gameinput()
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
}
}
map.scrolldir = 0;
}
}
}

View File

@ -1069,7 +1069,7 @@ void titlerender()
}
else
{
if(!game.colourblindmode) graphics.drawtowerbackgroundsolo();
if(!game.colourblindmode) graphics.drawtowerbackground();
tr = map.r - (help.glow / 4) - int(fRandom() * 4);
tg = map.g - (help.glow / 4) - int(fRandom() * 4);
@ -1131,7 +1131,7 @@ void gamecompleterender()
{
FillRect(graphics.backBuffer, 0x000000);
if(!game.colourblindmode) graphics.drawtowerbackgroundsolo();
if(!game.colourblindmode) graphics.drawtowerbackground();
tr = map.r - (help.glow / 4) - fRandom() * 4;
tg = map.g - (help.glow / 4) - fRandom() * 4;

View File

@ -3532,6 +3532,7 @@ void scriptclass::hardreset()
map.towermode=false;
map.cameraseekframe = 0;
map.resumedelay = 0;
map.scrolldir = 0;
map.customshowmm=true;
for (j = 0; j < 20; j++)

View File

@ -3010,7 +3010,7 @@ void editorrender()
{
if(!game.colourblindmode)
{
graphics.drawtowerbackgroundsolo();
graphics.drawtowerbackground();
}
else
{