mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Extern gameScreen, remove screenbuffer
I know earlier I removed the gameScreen extern in favor of using screenbuffer, but that was only to be consistent. After further consideration, I have found that it's actually really stupid. There's no reason to be accessing it through screenbuffer, and it's probably an artifact of 2.0-2.2 passing stack-allocated otherwise-global classes everywhere through function arguments. Also, it leads to stupid bugs where screenbuffer could potentially be NULL, which has already resulted in various annoying crashes in the past. Although those could be fixed by simply initializing screenbuffer at the very top of main(), but, why not just scrap the whole thing anyway? So that's what I'm doing. As a nice side effect, I've removed the transitive include of Screen.h from Graphics.h. This could've been done already since it only includes it for the pointer anyway, but it's still good to do it now.
This commit is contained in:
@@ -109,7 +109,6 @@ void Graphics::init(void)
|
||||
m = 0;
|
||||
linedelay = 0;
|
||||
menubuffer = NULL;
|
||||
screenbuffer = NULL;
|
||||
tempBuffer = NULL;
|
||||
warpbuffer = NULL;
|
||||
warpbuffer_lerp = NULL;
|
||||
@@ -3014,7 +3013,7 @@ void Graphics::menuoffrender(void)
|
||||
BlitSurfaceStandard(tempBuffer, NULL, backBuffer, NULL);
|
||||
BlitSurfaceStandard(menubuffer, NULL, backBuffer, &offsetRect);
|
||||
|
||||
screenbuffer->UpdateScreen(backBuffer, NULL);
|
||||
gameScreen.UpdateScreen(backBuffer, NULL);
|
||||
ClearSurface(backBuffer);
|
||||
}
|
||||
|
||||
@@ -3135,7 +3134,7 @@ void Graphics::flashlight(void)
|
||||
void Graphics::screenshake(void)
|
||||
{
|
||||
SDL_Rect shakeRect = {screenshake_x, screenshake_y, backBuffer->w, backBuffer->h};
|
||||
screenbuffer->UpdateScreen(backBuffer, &shakeRect);
|
||||
gameScreen.UpdateScreen(backBuffer, &shakeRect);
|
||||
|
||||
ClearSurface(backBuffer);
|
||||
}
|
||||
@@ -3148,12 +3147,7 @@ void Graphics::updatescreenshake(void)
|
||||
|
||||
void Graphics::render(void)
|
||||
{
|
||||
if (screenbuffer == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
screenbuffer->UpdateScreen(backBuffer, NULL);
|
||||
gameScreen.UpdateScreen(backBuffer, NULL);
|
||||
}
|
||||
|
||||
void Graphics::renderwithscreeneffects(void)
|
||||
@@ -3180,7 +3174,7 @@ void Graphics::renderfixedpre(void)
|
||||
updatescreenshake();
|
||||
}
|
||||
|
||||
if (screenbuffer != NULL && screenbuffer->badSignalEffect)
|
||||
if (gameScreen.badSignalEffect)
|
||||
{
|
||||
UpdateFilter();
|
||||
}
|
||||
@@ -3414,10 +3408,7 @@ bool Graphics::reloadresources(void)
|
||||
images.push_back(grphx.im_image11);
|
||||
images.push_back(grphx.im_image12);
|
||||
|
||||
if (screenbuffer != NULL)
|
||||
{
|
||||
screenbuffer->LoadIcon();
|
||||
}
|
||||
gameScreen.LoadIcon();
|
||||
|
||||
music.destroy();
|
||||
music.init();
|
||||
|
||||
Reference in New Issue
Block a user