From b4937ff8d5cdb12f6754ba37fba82f8d9dc30a19 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 2 Apr 2020 15:19:32 -0700 Subject: [PATCH] Remove outdated comments from Graphics.cpp This removes a bunch of commented-out code that was clearly kept from the Flash version, even though the Flash graphics API is much different than SDL's. Also removes a bunch of TODOs that either say nothing, or say something whose meaning has been totally lost to time due to being completely vague, or something that's already been done and someone forgot to remove the TODO. --- desktop_version/src/Graphics.cpp | 87 -------------------------------- 1 file changed, 87 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 1c0c99c9..ec9c22a4 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -25,10 +25,6 @@ void Graphics::init() //We initialise a few things - //updatebackground = true; - - - //ct = new ColorTransform(0, 0, 0, 1, 255, 255, 255, 1); //Set to white linestate = 0; @@ -41,10 +37,6 @@ void Graphics::init() flipmode = false; setflipmode = false; - //flipmatrix.scale(1, -1); - //flipmatrix.translate(0, 240); - //flipfontmatrix.scale(1, -1); flipfontmatrix.translate(0, 8); - //flipfontmatrix2.scale(1, -1); flipfontmatrix2.translate(0, 9); //Background inits for (int i = 0; i < 50; i++) @@ -77,7 +69,6 @@ void Graphics::init() backboxvy.push_back(bvy); backboxint.push_back(bint); } - //backboxrect = new Rectangle(); backoffset = 0; backgrounddrawn = false; @@ -161,7 +152,6 @@ void Graphics::drawspritesetcol(int x, int y, int t, int c) setcol(c); BlitSurfaceColoured(sprites[t],NULL,backBuffer, &rect, ct); - //.copyPixels(sprites[t], sprites_rect, backbuffer, tpoint); } void Graphics::Makebfont() @@ -392,13 +382,10 @@ void Graphics::PrintOffAlpha( int _x, int _y, std::string _s, int r, int g, int if (flipmode) { - //flipbfont[font_idx(cur)].colorTransform(bfont_rect, ct); BlitSurfaceColoured( flipbfont[font_idx(curr)], NULL, backBuffer, &fontRect , ct); } else { - //bfont[font_idx(cur)].colorTransform(bfont_rect, ct); - //backBuffer.copyPixels(bfont[font_idx(cur)], bfont_rect, tpoint); BlitSurfaceColoured( bfont[font_idx(curr)], NULL, backBuffer, &fontRect , ct); } bfontpos+=bfontlen(curr) ; @@ -411,14 +398,11 @@ void Graphics::bprint( int x, int y, std::string t, int r, int g, int b, bool ce void Graphics::bprintalpha( int x, int y, std::string t, int r, int g, int b, int a, bool cen /*= false*/ ) { - - //printmask(x, y, t, cen); if (!notextoutline) { PrintAlpha(x, y - 1, t, 0, 0, 0, a, cen); if (cen) { - //TODO find different PrintOffAlpha(-1, y, t, 0, 0, 0, a, cen); PrintOffAlpha(1, y, t, 0, 0, 0, a, cen); } @@ -457,13 +441,10 @@ void Graphics::RPrint( int _x, int _y, std::string _s, int r, int g, int b, bool if (flipmode) { - //flipbfont[font_idx(cur)].colorTransform(bfont_rect, ct); BlitSurfaceColoured( flipbfont[font_idx(curr)], NULL, backBuffer, &fontRect , ct); } else { - //bfont[font_idx(cur)].colorTransform(bfont_rect, ct); - //backBuffer.copyPixels(bfont[font_idx(cur)], bfont_rect, tpoint); BlitSurfaceColoured( bfont[font_idx(curr)], NULL, backBuffer, &fontRect , ct); } bfontpos+=bfontlen(curr) ; @@ -552,7 +533,6 @@ void Graphics::drawsprite( int x, int y, int t, int r, int g, int b ) { SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h }; setcolreal(getRGB(r,g,b)); - //sprites[t].colorTransform(sprites_rect, ct); BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct); } @@ -783,7 +763,6 @@ void Graphics::drawimage( int t, int xp, int yp, bool cent/*=false*/ ) trect.w = images[t]->w; trect.h = images[t]->h; BlitSurfaceStandard(images[t], NULL, backBuffer, &trect); - //backbuffer.copyPixels(images[t], trect, tpoint); } else { @@ -823,9 +802,7 @@ void Graphics::cutscenebars() cutscenebarspos += 25; cutscenebarspos = std::min(cutscenebarspos, 361); FillRect(backBuffer, 0, 0, cutscenebarspos, 16, 0x000000); - //backbuffer.fillRect(new Rectangle(0, 0, cutscenebarspos, 16), 0x000000); FillRect(backBuffer, 360-cutscenebarspos, 224, cutscenebarspos, 16, 0x000000); - //backbuffer.fillRect(new Rectangle(360-cutscenebarspos, 224, cutscenebarspos, 16), 0x000000); } else { @@ -836,9 +813,7 @@ void Graphics::cutscenebars() cutscenebarspos = std::max(cutscenebarspos, 0); //draw FillRect(backBuffer, 0, 0, cutscenebarspos, 16, 0x000000); - //backbuffer.fillRect(new Rectangle(0, 0, cutscenebarspos, 16), 0x000000); FillRect(backBuffer, 360-cutscenebarspos, 224, cutscenebarspos, 16, 0x000000); - //backbuffer.fillRect(new Rectangle(360-cutscenebarspos, 224, cutscenebarspos, 16), 0x000000); } } } @@ -905,7 +880,6 @@ void Graphics::drawpixeltextbox( int x, int y, int w, int h, int w2, int h2, int //given these parameters, draw a textbox with a pixel width //madrect.x = x; madrect.y = y; madrect.w = w; madrect.h = h; - //backbuffer.fillRect(madrect, RGB(r / 6, g / 6, b / 6)); FillRect(backBuffer,x,y,w,h, r/6, g/6, b/6 ); for (k = 0; k < w2-2; k++) @@ -930,8 +904,6 @@ void Graphics::drawcustompixeltextbox( int x, int y, int w, int h, int w2, int h { //given these parameters, draw a textbox with a pixel width - //madrect.x = x; madrect.y = y; madrect.w = w; madrect.h = h; - //backbuffer.fillRect(madrect, RGB(r / 6, g / 6, b / 6)); FillRect(backBuffer,x,y,w,h, r/6, g/6, b/6 ); for (k = 0; k < w2-2; k++) @@ -966,8 +938,6 @@ void Graphics::drawcustompixeltextbox( int x, int y, int w, int h, int w2, int h void Graphics::drawtextbox( int x, int y, int w, int h, int r, int g, int b ) { //given these parameters, draw a textbox - //madrect.x = x; madrect.y = y; madrect.w = w*8; madrect.h = h*8; - //backbuffer.fillRect(madrect, RGB(r / 6, g / 6, b / 6)); FillRect(backBuffer,x,y,w*8,h*8, r/6, g/6, b/6 ); drawcoloredtile(x, y, 40, r, g, b); @@ -1071,14 +1041,12 @@ void Graphics::drawfade() if ((fademode == 1)||(fademode == 4)) { FillRect(backBuffer, 0, 0, backBuffer->w, backBuffer->h, 0x000000); - //backbuffer.fillRect(backbuffer.rect, 0x000000); } else if(fademode==3) { for (int i = 0; i < 15; i++) { FillRect(backBuffer, fadebars[i], i * 16, fadeamount, 16, 0x000000 ); - //backbuffer.fillRect(new Rectangle(, , , 16), 0x000000); } } else if(fademode==5 ) @@ -1086,7 +1054,6 @@ void Graphics::drawfade() for (int i = 0; i < 15; i++) { FillRect(backBuffer, fadebars[i]-fadeamount, i * 16, 500, 16, 0x000000 ); - //backbuffer.fillRect(new Rectangle(fadebars[i]-fadeamount, i * 16, 500, 16), 0x000000); } } @@ -1461,14 +1428,11 @@ void Graphics::drawentities() { tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; - // setcol(obj.entities[i].colour); - //flipsprites[obj.entities[i].drawframe].colorTransform(sprites_rect, ct); drawRect = sprites_rect; drawRect.x += tpoint.x; drawRect.y += tpoint.y; BlitSurfaceColoured(flipsprites[obj.entities[i].drawframe],NULL, backBuffer, &drawRect, ct); - //backbuffer.copyPixels(flipsprites[obj.entities[i].drawframe], sprites_rect, tpoint); if (map.warpx) { //screenwrapping! @@ -1513,9 +1477,7 @@ void Graphics::drawentities() { tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; - // setcol(obj.entities[i].colour); - //sprites[obj.entities[i].drawframe].colorTransform(sprites_rect, ct); drawRect = sprites_rect; drawRect.x += tpoint.x; @@ -1605,12 +1567,10 @@ void Graphics::drawentities() //A seperate index of colours, for simplicity if(obj.entities[i].colour==1) { - //backbuffer.fillRect(prect, RGB(196 - (fRandom() * 64), 10, 10)); FillRect(backBuffer, prect, (fRandom() * 64), 10, 10); } else if (obj.entities[i].colour == 2) { - //backbuffer.fillRect(prect, RGB(160- help.glow/2 - (fRandom()*20), 200- help.glow/2, 220 - help.glow)); FillRect(backBuffer,prect, int(160- help.glow/2 - (fRandom()*20)), 200- help.glow/2, 220 - help.glow); } } @@ -1640,7 +1600,6 @@ void Graphics::drawentities() } else if (obj.entities[i].size == 8) // Special: Moving platform, 8 tiles { - //TODO check this is correct game breaking moving paltform tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; drawRect = sprites_rect; @@ -1801,7 +1760,6 @@ void Graphics::drawentities() } else if (obj.entities[i].size == 11) //The fucking elephant { - //TODO elephant bug setcol(obj.entities[i].colour); drawimagecol(3, obj.entities[i].xp, obj.entities[i].yp); } @@ -1813,7 +1771,6 @@ void Graphics::drawentities() tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; setcol(obj.entities[i].colour); - // drawRect = sprites_rect; drawRect.x += tpoint.x; @@ -1927,27 +1884,19 @@ void Graphics::drawentities() - //scaleMatrix.scale(6, 6); - //bigbuffer.fillRect(bigbuffer.rect, 0x000000); FillRect(tempBuffer, 0x000000); tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; setcol(obj.entities[i].colour); - //flipsprites[obj.entities[i].drawframe].colorTransform(sprites_rect, ct); - //bigbuffer.copyPixels(flipsprites[obj.entities[i].drawframe], sprites_rect, new Point(0, 0)); SDL_Rect drawRect = {Sint16(obj.entities[i].xp ), Sint16(obj.entities[i].yp), sprites_rect.x, sprites_rect.y }; SDL_Surface* TempSurface = ScaleSurface( flipsprites[obj.entities[i].drawframe], 6* sprites_rect.w,6* sprites_rect.w ); BlitSurfaceColoured(TempSurface, NULL , backBuffer, &drawRect, ct ); SDL_FreeSurface(TempSurface); - //scaleMatrix.translate(-obj.entities[i].xp, -obj.entities[i].yp); } else { - //TODO checkthis tpoint.x = obj.entities[i].xp; tpoint.y = obj.entities[i].yp; setcol(obj.entities[i].colour); - //flipsprites[obj.entities[i].drawframe].colorTransform(sprites_rect, ct); - //bigbuffer.copyPixels(flipsprites[obj.entities[i].drawframe], sprites_rect, new Point(0, 0)); SDL_Rect drawRect = {Sint16(obj.entities[i].xp ), Sint16(obj.entities[i].yp), Sint16(sprites_rect.x * 6), Sint16(sprites_rect.y * 6 ) }; SDL_Surface* TempSurface = ScaleSurface( flipsprites[obj.entities[i].drawframe], 6 * sprites_rect.w,6* sprites_rect.h ); BlitSurfaceColoured(TempSurface, NULL , backBuffer, &drawRect, ct ); @@ -1977,7 +1926,6 @@ void Graphics::drawbackground( int t ) if (starsspeed[i] <= 6) { FillRect(backBuffer,stars[i], getRGB(0x22,0x22,0x22)); - //backbuffer.fillRect(stars[i], 0x222222); } else { @@ -2171,8 +2119,6 @@ void Graphics::drawbackground( int t ) if (backgrounddrawn) { - //TODO Scroll? - //towerbuffer.scroll( -3, 0); ScrollSurface(towerbuffer, -3, 0 ); for (int j = 0; j < 15; j++) { @@ -2201,9 +2147,6 @@ void Graphics::drawbackground( int t ) } backgrounddrawn = true; } - //TODO this is why map breaks - - //backbuffer.copyPixels(towerbuffer, towerbuffer.rect, tl); BlitSurfaceStandard(towerbuffer, NULL, backBuffer, NULL); break; case 4: //Warp zone (vertical) @@ -2212,8 +2155,6 @@ void Graphics::drawbackground( int t ) if (backgrounddrawn) { - //TODO scroll?! - //towerbuffer.scroll(0, -3); ScrollSurface(towerbuffer,0,-3); for (int i = 0; i < 21; i++) { @@ -2358,8 +2299,6 @@ void Graphics::drawbackground( int t ) break; default: FillRect(backBuffer, 0x000000 ); - //TODO - //backbuffer.copyPixels(backgrounds[t], bg_rect, tl); BlitSurfaceStandard(backgrounds[t], NULL, backBuffer, &bg_rect); break; @@ -2368,7 +2307,6 @@ void Graphics::drawbackground( int t ) void Graphics::drawmap() { - ///TODO forground once; if (!foregrounddrawn) { FillRect(foregroundBuffer, 0x00000000); @@ -2635,7 +2573,6 @@ void Graphics::drawtowerbackgroundsolo() void Graphics::drawtowerbackground() { - //TODO int temp; if (map.bypos < 0) map.bypos += 120 * 8; @@ -2654,7 +2591,6 @@ void Graphics::drawtowerbackground() } } - //backbuffer.copyPixels(towerbuffer, towerbuffer.rect, tl, null, null, false); SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL); map.tdrawback = false; @@ -2662,8 +2598,6 @@ void Graphics::drawtowerbackground() else { //just update the bottom - //TODO SCOLL - //towerbuffer.scroll(0, -map.bscroll); ScrollSurface(towerbuffer, 0, -map.bscroll); for (int i = 0; i < 40; i++) { @@ -2671,7 +2605,6 @@ void Graphics::drawtowerbackground() drawtowertile3(i * 8, -(map.bypos % 8), temp, map.colstate); } - //backbuffer.copyPixels(towerbuffer, towerbuffer.rect, tl, null, null, false); SDL_BlitSurface(towerbuffer,NULL, backBuffer,NULL); } } @@ -2875,15 +2808,10 @@ void Graphics::setcol( int t ) ct.colour = 0xFFFFFF; break; } - //ct.color = endian_swap(ct.color); } void Graphics::menuoffrender() { - //TODO - //screenbuffer.lock(); - //screenbuffer.copyPixels(menubuffer, menubuffer.rect, tl, null, null, false); - //screenbuffer->UpdateScreen(menubuffer,NULL); SDL_Rect offsetRect1; setRect (offsetRect1, 0, 0, backBuffer->w ,backBuffer->h); @@ -2913,20 +2841,15 @@ void Graphics::menuoffrender() //put the stored backbuffer in the backbuffer. BlitSurfaceStandard(tempBuffer, NULL, backBuffer, NULL); - //screenbuffer.copyPixels(backbuffer, backbuffer.rect, new Point(0, menuoffset), null, null, false); SDL_Rect offsetRect; setRect (offsetRect, 0, menuoffset, backBuffer->w ,backBuffer->h); BlitSurfaceStandard(menubuffer,NULL,backBuffer,&offsetRect); } - //screenbuffer.unlock(); SDL_Rect rect; setRect(rect, 0, 0, backBuffer->w, backBuffer->h); screenbuffer->UpdateScreen(backBuffer,&rect); - //backbuffer.lock(); - //backbuffer.fillRect(backbuffer.rect, 0x000000); FillRect(backBuffer, 0x000000); - //backbuffer.unlock(); } void Graphics::drawhuetile( int x, int y, int t, int c ) @@ -3023,7 +2946,6 @@ void Graphics::flashlight() void Graphics::screenshake() { point tpoint; - //screenbuffer.lock(); if(flipmode) { // tpoint.x = int((Math.random() * 7) - 4); tpoint.y = int((Math.random() * 7) - 4); @@ -3050,14 +2972,9 @@ void Graphics::screenshake() SDL_Rect shakeRect; setRect(shakeRect,tpoint.x, tpoint.y, backBuffer->w, backBuffer->h); screenbuffer->UpdateScreen( backBuffer, &shakeRect); - // screenbuffer.copyPixels(backbuffer, backbuffer.rect, tpoint, null, null, false); } - //screenbuffer.unlock(); - //backbuffer.lock(); FillRect(backBuffer, 0x000000 ); - //backbuffer.fillRect(backbuffer.rect, 0x000000); - //backbuffer.unlock(); } void Graphics::render() @@ -3198,7 +3115,6 @@ void Graphics::setcolreal(Uint32 t) void Graphics::drawforetile(int x, int y, int t) { - //frontbuffer.copyPixels(tiles[t], tiles_rect, tpoint); SDL_Rect rect; setRect(rect, x,y,tiles_rect.w, tiles_rect.h); BlitSurfaceStandard(tiles[t],NULL, foregroundBuffer, &rect ); @@ -3206,7 +3122,6 @@ void Graphics::drawforetile(int x, int y, int t) void Graphics::drawforetile2(int x, int y, int t) { - //frontbuffer.copyPixels(tiles2[t], tiles_rect, tpoint); SDL_Rect rect; setRect(rect, x,y,tiles_rect.w, tiles_rect.h); BlitSurfaceStandard(tiles2[t],NULL, foregroundBuffer, &rect ); @@ -3217,7 +3132,6 @@ void Graphics::drawforetile3(int x, int y, int t, int off) SDL_Rect rect; setRect(rect, x,y,tiles_rect.w, tiles_rect.h); BlitSurfaceStandard(tiles3[t+(off*30)],NULL, foregroundBuffer, &rect ); - //frontbuffer.copyPixels(tiles3[t+(off*30)], tiles_rect, tpoint); } void Graphics::drawrect(int x, int y, int w, int h, int r, int g, int b) @@ -3228,7 +3142,6 @@ void Graphics::drawrect(int x, int y, int w, int h, int r, int g, int b) madrect.y = y; madrect.w = w; madrect.h = 1; - //backbuffer.fillRect(madrect, RGB(r,g,b)); FillRect(backBuffer, madrect, getRGB(b,g,r)); madrect.w = 1;