1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Some formatting fixes

This commit is contained in:
AllyTally 2023-05-22 16:06:50 -03:00 committed by Misa Elizabeth Kai
parent d93d773a8a
commit d1b9f4f410

View file

@ -342,27 +342,27 @@ void Graphics::printcrewnamestatus( int x, int y, int t, bool rescued )
switch(t) switch(t)
{ {
case 0: case 0:
r=12; g=140, b=140; r = 12; g = 140, b = 140;
gender = 3; gender = 3;
break; break;
case 1: case 1:
r=140; g=12; b=140; r = 140; g = 12; b = 140;
gender = 2; gender = 2;
break; break;
case 2: case 2:
r=140; g=140; b=12; r = 140; g = 140; b = 12;
gender = 1; gender = 1;
break; break;
case 3: case 3:
r=140; g=12; b=12; r = 140; g = 12; b = 12;
gender = 1; gender = 1;
break; break;
case 4: case 4:
r=12; g=140; b=12; r = 12; g = 140; b = 12;
gender = 1; gender = 1;
break; break;
case 5: case 5:
r=12; g=12; b=140; r = 12; g = 12; b = 140;
gender = 2; gender = 2;
break; break;
default: default:
@ -380,7 +380,7 @@ void Graphics::printcrewnamestatus( int x, int y, int t, bool rescued )
} }
else else
{ {
r=64; g=64; b=64; r = 64; g = 64; b = 64;
status_text = loc::gettext_case("Missing...", gender); status_text = loc::gettext_case("Missing...", gender);
} }
@ -404,11 +404,11 @@ void Graphics::print_level_creator(
* - if anyone is sad about this decision, the happy face will cheer them up anyway :D */ * - if anyone is sad about this decision, the happy face will cheer them up anyway :D */
int width_for_face = 17; int width_for_face = 17;
int total_width = width_for_face + font::len(print_flags, creator.c_str()); int total_width = width_for_face + font::len(print_flags, creator.c_str());
int face_x = (SCREEN_WIDTH_PIXELS-total_width)/2; int face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2;
set_texture_color_mod(grphx.im_sprites, r, g, b); set_texture_color_mod(grphx.im_sprites, r, g, b);
draw_texture_part(grphx.im_sprites, face_x, y-1, 7, 2, 10, 10, 1, 1); draw_texture_part(grphx.im_sprites, face_x, y - 1, 7, 2, 10, 10, 1, 1);
set_texture_color_mod(grphx.im_sprites, 255, 255, 255); set_texture_color_mod(grphx.im_sprites, 255, 255, 255);
font::print(print_flags, face_x+width_for_face, y, creator, r, g, b); font::print(print_flags, face_x + width_for_face, y, creator, r, g, b);
} }
int Graphics::set_render_target(SDL_Texture* texture) int Graphics::set_render_target(SDL_Texture* texture)
@ -812,7 +812,7 @@ bool Graphics::shouldrecoloroneway(const int tilenum, const bool mounted)
} }
#endif #endif
void Graphics::drawtile( int x, int y, int t ) void Graphics::drawtile(int x, int y, int t)
{ {
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
if (shouldrecoloroneway(t, tiles1_mounted)) if (shouldrecoloroneway(t, tiles1_mounted))
@ -827,7 +827,7 @@ void Graphics::drawtile( int x, int y, int t )
} }
void Graphics::drawtile2( int x, int y, int t ) void Graphics::drawtile2(int x, int y, int t)
{ {
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
if (shouldrecoloroneway(t, tiles2_mounted)) if (shouldrecoloroneway(t, tiles2_mounted))
@ -841,7 +841,7 @@ void Graphics::drawtile2( int x, int y, int t )
} }
} }
void Graphics::drawtile3( int x, int y, int t, int off, int height_subtract /*= 0*/ ) void Graphics::drawtile3(int x, int y, int t, int off, int height_subtract /*= 0*/)
{ {
t += off * 30; t += off * 30;
@ -911,7 +911,7 @@ void Graphics::drawgui(void)
} }
//Draw all the textboxes to the screen //Draw all the textboxes to the screen
for (size_t i = 0; i<textboxes.size(); i++) for (size_t i = 0; i < textboxes.size(); i++)
{ {
int text_yoff; int text_yoff;
int yp; int yp;
@ -1026,10 +1026,10 @@ void Graphics::drawgui(void)
} }
if (flipmode) if (flipmode)
{ {
y = 240 - y - 8*sc; y = 240 - y - 8 * sc;
} }
SDL_Color color = TEXT_COLOUR("cyan"); SDL_Color color = TEXT_COLOUR("cyan");
font::print((sc==2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, color.r, color.g, color.b); font::print((sc == 2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, color.r, color.g, color.b);
} }
else else
{ {
@ -1063,9 +1063,9 @@ void Graphics::drawgui(void)
} }
if (flipmode) if (flipmode)
{ {
y = 240 - y - 8*sc; y = 240 - y - 8 * sc;
} }
font::print((sc==2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, 196, 196, 243); font::print((sc == 2 ? PR_2X : PR_1X) | PR_CEN, -1, y, translation, 196, 196, 243);
} }
else else
{ {
@ -1083,12 +1083,12 @@ void Graphics::drawgui(void)
if (textboxes[i].r == 175 && textboxes[i].g == 175) if (textboxes[i].r == 175 && textboxes[i].g == 175)
{ {
//purple guy //purple guy
draw_sprite(crew_xp, crew_yp, crew_sprite, 220- help.glow/4 - textboxes[i].rand, 120- help.glow/4, 210 - help.glow/4); draw_sprite(crew_xp, crew_yp, crew_sprite, 220 - help.glow / 4 - textboxes[i].rand, 120 - help.glow / 4, 210 - help.glow / 4);
} }
else if (textboxes[i].r == 175 && textboxes[i].b == 175) else if (textboxes[i].r == 175 && textboxes[i].b == 175)
{ {
//red guy //red guy
draw_sprite(crew_xp, crew_yp, crew_sprite, 255 - help.glow/8, 70 - help.glow/4, 70 - help.glow / 4); draw_sprite(crew_xp, crew_yp, crew_sprite, 255 - help.glow / 8, 70 - help.glow / 4, 70 - help.glow / 4);
} }
else if (textboxes[i].r == 175) else if (textboxes[i].r == 175)
{ {
@ -1098,12 +1098,12 @@ void Graphics::drawgui(void)
else if (textboxes[i].g == 175) else if (textboxes[i].g == 175)
{ {
//yellow guy //yellow guy
draw_sprite(crew_xp, crew_yp, crew_sprite, 220- help.glow/4 - textboxes[i].rand, 210 - help.glow/4, 120- help.glow/4); draw_sprite(crew_xp, crew_yp, crew_sprite, 220 - help.glow / 4 - textboxes[i].rand, 210 - help.glow / 4, 120 - help.glow / 4);
} }
else if (textboxes[i].b == 175) else if (textboxes[i].b == 175)
{ {
//blue guy //blue guy
draw_sprite(crew_xp, crew_yp, crew_sprite, 75, 75, 255- help.glow/4 - textboxes[i].rand); draw_sprite(crew_xp, crew_yp, crew_sprite, 75, 75, 255 - help.glow / 4 - textboxes[i].rand);
} }
} }
} }
@ -1309,13 +1309,13 @@ void Graphics::cutscenebars(void)
if (showcutscenebars) if (showcutscenebars)
{ {
fill_rect(0, 0, usethispos, 16, 0, 0, 0); fill_rect(0, 0, usethispos, 16, 0, 0, 0);
fill_rect(360-usethispos, 224, usethispos, 16, 0, 0, 0); fill_rect(360 - usethispos, 224, usethispos, 16, 0, 0, 0);
} }
else if (cutscenebarspos > 0) //disappearing else if (cutscenebarspos > 0) //disappearing
{ {
//draw //draw
fill_rect(0, 0, usethispos, 16, 0, 0, 0); fill_rect(0, 0, usethispos, 16, 0, 0, 0);
fill_rect(360-usethispos, 224, usethispos, 16, 0, 0, 0); fill_rect(360 - usethispos, 224, usethispos, 16, 0, 0, 0);
} }
} }
@ -1341,7 +1341,7 @@ void Graphics::setbars(const int position)
oldcutscenebarspos = position; oldcutscenebarspos = position;
} }
void Graphics::drawcrewman( int x, int y, int t, bool act, bool noshift /*=false*/ ) void Graphics::drawcrewman(int x, int y, int t, bool act, bool noshift /*=false*/)
{ {
if (!act) if (!act)
{ {
@ -1409,13 +1409,13 @@ void Graphics::drawpixeltextbox(
) { ) {
int k; int k;
fill_rect(x, y, w, h, r/6, g/6, b/6); fill_rect(x, y, w, h, r / 6, g / 6, b / 6);
/* Horizontal tiles */ /* Horizontal tiles */
for (k = 0; k < w/8 - 2; ++k) for (k = 0; k < w / 8 - 2; ++k)
{ {
drawcoloredtile(x + 8 + k*8, y, 41, r, g, b); drawcoloredtile(x + 8 + k * 8, y, 41, r, g, b);
drawcoloredtile(x + 8 + k*8, y + h - 8, 46, r, g, b); drawcoloredtile(x + 8 + k * 8, y + h - 8, 46, r, g, b);
} }
if (w % 8 != 0) if (w % 8 != 0)
@ -1426,10 +1426,10 @@ void Graphics::drawpixeltextbox(
} }
/* Vertical tiles */ /* Vertical tiles */
for (k = 0; k < h/8 - 2; ++k) for (k = 0; k < h / 8 - 2; ++k)
{ {
drawcoloredtile(x, y + 8 + k*8, 43, r, g, b); drawcoloredtile(x, y + 8 + k * 8, 43, r, g, b);
drawcoloredtile(x + w - 8, y + 8 + k*8, 44, r, g, b); drawcoloredtile(x + w - 8, y + 8 + k * 8, 44, r, g, b);
} }
if (h % 8 != 0) if (h % 8 != 0)
@ -1473,7 +1473,7 @@ void Graphics::textboxremove(void)
} }
} }
void Graphics::textboxtimer( int t ) void Graphics::textboxtimer(int t)
{ {
if (!INBOUNDS_VEC(m, textboxes)) if (!INBOUNDS_VEC(m, textboxes))
{ {
@ -1481,7 +1481,7 @@ void Graphics::textboxtimer( int t )
return; return;
} }
textboxes[m].timer=t; textboxes[m].timer = t;
} }
void Graphics::addline( const std::string& t ) void Graphics::addline( const std::string& t )
@ -1526,7 +1526,7 @@ void Graphics::createtextboxreal(
) { ) {
m = textboxes.size(); m = textboxes.size();
if(m<20) if (m < 20)
{ {
textboxclass text; textboxclass text;
text.lines.push_back(t); text.lines.push_back(t);
@ -1590,7 +1590,7 @@ void Graphics::drawfade(void)
case FADE_FADING_IN: case FADE_FADING_IN:
for (size_t i = 0; i < SDL_arraysize(fadebars); i++) for (size_t i = 0; i < SDL_arraysize(fadebars); i++)
{ {
fill_rect(fadebars[i]-usethisamount, i * 16, 500, 16, 0, 0, 0); fill_rect(fadebars[i] - usethisamount, i * 16, 500, 16, 0, 0, 0);
} }
break; break;
case FADE_NONE: case FADE_NONE:
@ -1607,7 +1607,7 @@ void Graphics::processfade(void)
case FADE_START_FADEOUT: case FADE_START_FADEOUT:
for (size_t i = 0; i < SDL_arraysize(fadebars); i++) for (size_t i = 0; i < SDL_arraysize(fadebars); i++)
{ {
fadebars[i] = -int(fRandom() * 12) * 8; fadebars[i] = -(int)(fRandom() * 12) * 8;
} }
setfade(0); setfade(0);
fademode = FADE_FADING_OUT; fademode = FADE_FADING_OUT;
@ -1622,7 +1622,7 @@ void Graphics::processfade(void)
case FADE_START_FADEIN: case FADE_START_FADEIN:
for (size_t i = 0; i < SDL_arraysize(fadebars); i++) for (size_t i = 0; i < SDL_arraysize(fadebars); i++)
{ {
fadebars[i] = 320 + int(fRandom() * 12) * 8; fadebars[i] = 320 + (int)(fRandom() * 12) * 8;
} }
setfade(416); setfade(416);
fademode = FADE_FADING_IN; fademode = FADE_FADING_IN;
@ -1656,7 +1656,7 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu)
if (language_screen) if (language_screen)
{ {
size_t n_options = game.menuoptions.size(); size_t n_options = game.menuoptions.size();
twocol_voptions = n_options - (n_options/2); twocol_voptions = n_options - (n_options / 2);
} }
for (size_t i = 0; i < game.menuoptions.size(); i++) for (size_t i = 0; i < game.menuoptions.size(); i++)
@ -1683,13 +1683,13 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu)
if (language_screen) if (language_screen)
{ {
int name_len = font::len(opt.print_flags, opt.text); int name_len = font::len(opt.print_flags, opt.text);
x = (i < twocol_voptions ? 80 : 240) - name_len/2; x = (i < twocol_voptions ? 80 : 240) - name_len / 2;
y = 36 + (i % twocol_voptions)*12; y = 36 + (i % twocol_voptions) * 12;
} }
else else
{ {
x = i*game.menuspacing + game.menuxoff; x = i * game.menuspacing + game.menuxoff;
y = 140 + i*12 + game.menuyoff; y = 140 + i * 12 + game.menuyoff;
} }
#ifndef NO_CUSTOM_LEVELS #ifndef NO_CUSTOM_LEVELS
@ -1742,7 +1742,7 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu)
vformat_buf(buffer, sizeof(buffer), loc::get_langmeta()->menu_select.c_str(), "label:str", opt_text.c_str()); vformat_buf(buffer, sizeof(buffer), loc::get_langmeta()->menu_select.c_str(), "label:str", opt_text.c_str());
// Account for brackets // Account for brackets
x -= (font::len(opt.print_flags, buffer)-font::len(opt.print_flags, opt_text.c_str()))/2; x -= (font::len(opt.print_flags, buffer) - font::len(opt.print_flags, opt_text.c_str())) / 2;
} }
else else
{ {
@ -1875,7 +1875,7 @@ void Graphics::drawtrophytext(void)
if (obj.trophytext < 15) if (obj.trophytext < 15)
{ {
const int usethismult = lerp(obj.oldtrophytext, obj.trophytext); const int usethismult = lerp(obj.oldtrophytext, obj.trophytext);
brightness = (usethismult/15.0)*255; brightness = (usethismult / 15.0) * 255;
} }
else else
{ {
@ -1962,12 +1962,12 @@ void Graphics::drawtrophytext(void)
if (top_text != NULL) if (top_text != NULL)
{ {
font::string_wordwrap(0, top_text, 304, &lines); font::string_wordwrap(0, top_text, 304, &lines);
font::print_wrap(PR_CEN | PR_BRIGHTNESS(brightness) | PR_BOR, -1, 11-(lines-1)*5, top_text, 196, 196, 255 - help.glow); font::print_wrap(PR_CEN | PR_BRIGHTNESS(brightness) | PR_BOR, -1, 11 - (lines - 1) * 5, top_text, 196, 196, 255 - help.glow);
} }
if (bottom_text != NULL) if (bottom_text != NULL)
{ {
font::string_wordwrap(0, bottom_text, 304, &lines); font::string_wordwrap(0, bottom_text, 304, &lines);
font::print_wrap(PR_CEN | PR_BRIGHTNESS(brightness) | PR_BOR, -1, 221-(lines-1)*5, bottom_text, 196, 196, 255 - help.glow); font::print_wrap(PR_CEN | PR_BRIGHTNESS(brightness) | PR_BOR, -1, 221 - (lines - 1) * 5, bottom_text, 196, 196, 255 - help.glow);
} }
} }
@ -2055,7 +2055,7 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct);
//screenwrapping! // screenwrapping!
SDL_Point wrappedPoint; SDL_Point wrappedPoint;
bool wrapX = false; bool wrapX = false;
bool wrapY = false; bool wrapY = false;
@ -2156,7 +2156,7 @@ void Graphics::drawentity(const int i, const int yoff)
drawcoloredtile(xp, yp - yoff, obj.entities[i].tile, color.r, color.g, color.b); drawcoloredtile(xp, yp - yoff, obj.entities[i].tile, color.r, color.g, color.b);
break; break;
} }
case 5: //Horizontal Line case 5: // Horizontal Line
{ {
int oldw = obj.entities[i].w; int oldw = obj.entities[i].w;
if ((game.swngame == SWN_START_GRAVITRON_STEP_2 || kludgeswnlinewidth) if ((game.swngame == SWN_START_GRAVITRON_STEP_2 || kludgeswnlinewidth)
@ -2167,13 +2167,13 @@ void Graphics::drawentity(const int i, const int yoff)
drawgravityline(i, xp, yp - yoff, lerp(oldw, obj.entities[i].w) - 1, 0); drawgravityline(i, xp, yp - yoff, lerp(oldw, obj.entities[i].w) - 1, 0);
break; break;
} }
case 6: //Vertical Line case 6: // Vertical Line
drawgravityline(i, xp, yp - yoff, 0, obj.entities[i].h - 1); drawgravityline(i, xp, yp - yoff, 0, obj.entities[i].h - 1);
break; break;
case 7: //Teleporter case 7: // Teleporter
drawtele(xp, yp - yoff, obj.entities[i].drawframe, obj.entities[i].realcol); drawtele(xp, yp - yoff, obj.entities[i].drawframe, obj.entities[i].realcol);
break; break;
//case 8: // Special: Moving platform, 8 tiles // case 8: // Special: Moving platform, 8 tiles
// Note: This code is in the 4-tile code // Note: This code is in the 4-tile code
break; break;
case 9: // Really Big Sprite! (2x2) case 9: // Really Big Sprite! (2x2)
@ -2189,9 +2189,9 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct);
tpoint.x = xp+32; tpoint.x = xp + 32;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
@ -2199,17 +2199,17 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct);
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp+32 - yoff; tpoint.y = yp + 32 - yoff;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
draw_grid_tile(sprites, obj.entities[i].drawframe + 12, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe + 12, drawRect.x, drawRect.y, 32, 32, ct);
tpoint.x = xp+32; tpoint.x = xp + 32;
tpoint.y = yp+32 - yoff; tpoint.y = yp + 32 - yoff;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
@ -2223,16 +2223,16 @@ void Graphics::drawentity(const int i, const int yoff)
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct);
tpoint.x = xp+32; tpoint.x = xp + 32;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
@ -2240,7 +2240,7 @@ void Graphics::drawentity(const int i, const int yoff)
draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe + 1, drawRect.x, drawRect.y, 32, 32, ct);
break; break;
} }
case 11: //The fucking elephant case 11: // The fucking elephant
drawimagecol(IMAGE_ELEPHANT, xp, yp - yoff, obj.entities[i].realcol); drawimagecol(IMAGE_ELEPHANT, xp, yp - yoff, obj.entities[i].realcol);
break; break;
case 12: // Regular sprites that don't wrap case 12: // Regular sprites that don't wrap
@ -2248,27 +2248,27 @@ void Graphics::drawentity(const int i, const int yoff)
tpoint.x = xp; tpoint.x = xp;
tpoint.y = yp - yoff; tpoint.y = yp - yoff;
const SDL_Color ct = obj.entities[i].realcol; const SDL_Color ct = obj.entities[i].realcol;
//
drawRect = sprites_rect; drawRect = sprites_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
drawRect.y += tpoint.y; drawRect.y += tpoint.y;
draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct); draw_grid_tile(sprites, obj.entities[i].drawframe, drawRect.x, drawRect.y, 32, 32, ct);
//if we're outside the screen, we need to draw indicators // if we're outside the screen, we need to draw indicators
if (obj.entities[i].xp < -20 && obj.entities[i].vx > 0) if (obj.entities[i].xp < -20 && obj.entities[i].vx > 0)
{ {
if (obj.entities[i].xp < -100) if (obj.entities[i].xp < -100)
{ {
tpoint.x = -5 + (int(( -xp) / 10)); tpoint.x = -5 + (int) (-xp / 10);
} }
else else
{ {
tpoint.x = 5; tpoint.x = 5;
} }
tpoint.y = tpoint.y+4; tpoint.y = tpoint.y + 4;
drawRect = tiles_rect; drawRect = tiles_rect;
@ -2282,7 +2282,7 @@ void Graphics::drawentity(const int i, const int yoff)
{ {
if (obj.entities[i].xp > 420) if (obj.entities[i].xp > 420)
{ {
tpoint.x = 320 - (int(( xp-320) / 10)); tpoint.x = 320 - (int) ((xp - 320) / 10);
} }
else else
{ {
@ -2290,7 +2290,6 @@ void Graphics::drawentity(const int i, const int yoff)
} }
tpoint.y = tpoint.y+4; tpoint.y = tpoint.y+4;
//
drawRect = tiles_rect; drawRect = tiles_rect;
drawRect.x += tpoint.x; drawRect.x += tpoint.x;
@ -2302,7 +2301,7 @@ void Graphics::drawentity(const int i, const int yoff)
} }
case 13: case 13:
{ {
//Special for epilogue: huge hero! // Special for epilogue: huge hero!
draw_grid_tile(grphx.im_sprites, obj.entities[i].drawframe, xp, yp - yoff, sprites_rect.w, sprites_rect.h, obj.entities[i].realcol, 6, 6); draw_grid_tile(grphx.im_sprites, obj.entities[i].drawframe, xp, yp - yoff, sprites_rect.w, sprites_rect.h, obj.entities[i].realcol, 6, 6);
break; break;
} }
@ -2314,7 +2313,7 @@ void Graphics::drawbackground( int t )
switch(t) switch(t)
{ {
case 1: case 1:
//Starfield // Starfield
fill_rect(0, 0, 0); fill_rect(0, 0, 0);
for (int i = 0; i < numstars; i++) for (int i = 0; i < numstars; i++)
{ {
@ -2337,68 +2336,68 @@ void Graphics::drawbackground( int t )
SDL_zero(bcol); SDL_zero(bcol);
SDL_zero(bcol2); SDL_zero(bcol2);
//Lab // Lab
switch(rcol) switch (rcol)
{ {
//Akward ordering to match tileset // Akward ordering to match tileset
case 0: case 0:
bcol2 = getRGB(0, 16*backboxmult, 16*backboxmult); bcol2 = getRGB(0, 16 * backboxmult, 16 * backboxmult);
break; //Cyan break; // Cyan
case 1: case 1:
bcol2 = getRGB(16*backboxmult, 0, 0); bcol2 = getRGB(16 * backboxmult, 0, 0);
break; //Red break; // Red
case 2: case 2:
bcol2 = getRGB(16*backboxmult, 0, 16*backboxmult); bcol2 = getRGB(16 * backboxmult, 0, 16 * backboxmult);
break; //Purple break; // Purple
case 3: case 3:
bcol2 = getRGB(0, 0, 16*backboxmult); bcol2 = getRGB(0, 0, 16 * backboxmult);
break; //Blue break; // Blue
case 4: case 4:
bcol2 = getRGB(16*backboxmult, 16*backboxmult, 0); bcol2 = getRGB(16 * backboxmult, 16 * backboxmult, 0);
break; //Yellow break; // Yellow
case 5: case 5:
bcol2 = getRGB(0, 16 * backboxmult, 0); bcol2 = getRGB(0, 16 * backboxmult, 0);
break; //Green break; // Green
case 6: case 6:
//crazy case // crazy case
switch(spcol) switch (spcol)
{ {
case 0: case 0:
bcol2 = getRGB(0, 16*backboxmult, 16*backboxmult); bcol2 = getRGB(0, 16 * backboxmult, 16 * backboxmult);
break; //Cyan break; // Cyan
case 1: case 1:
bcol2 = getRGB(0, (spcoldel+1)*backboxmult, 16*backboxmult); bcol2 = getRGB(0, (spcoldel + 1) * backboxmult, 16 * backboxmult);
break; //Cyan break; // Cyan
case 2: case 2:
bcol2 = getRGB(0, 0, 16*backboxmult); bcol2 = getRGB(0, 0, 16 * backboxmult);
break; //Blue break; // Blue
case 3: case 3:
bcol2 = getRGB((16-spcoldel)*backboxmult, 0, 16*backboxmult); bcol2 = getRGB((16 - spcoldel) * backboxmult, 0, 16 * backboxmult);
break; //Blue break; // Blue
case 4: case 4:
bcol2 = getRGB(16*backboxmult, 0, 16*backboxmult); bcol2 = getRGB(16 * backboxmult, 0, 16 * backboxmult);
break; //Purple break; // Purple
case 5: case 5:
bcol2 = getRGB(16*backboxmult, 0, (spcoldel+1)*backboxmult); bcol2 = getRGB(16 * backboxmult, 0, (spcoldel + 1) * backboxmult);
break; //Purple break; // Purple
case 6: case 6:
bcol2 = getRGB(16*backboxmult, 0, 0); bcol2 = getRGB(16 * backboxmult, 0, 0);
break; //Red break; // Red
case 7: case 7:
bcol2 = getRGB(16*backboxmult, (16-spcoldel)*backboxmult, 0); bcol2 = getRGB(16 * backboxmult, (16 - spcoldel) * backboxmult, 0);
break; //Red break; // Red
case 8: case 8:
bcol2 = getRGB(16*backboxmult, 16*backboxmult, 0); bcol2 = getRGB(16 * backboxmult, 16 * backboxmult, 0);
break; //Yellow break; // Yellow
case 9: case 9:
bcol2 = getRGB((spcoldel+1)*backboxmult, 16*backboxmult, 0); bcol2 = getRGB((spcoldel + 1) * backboxmult, 16 * backboxmult, 0);
break; //Yellow break; // Yellow
case 10: case 10:
bcol2 = getRGB(0, 16 * backboxmult, 0); bcol2 = getRGB(0, 16 * backboxmult, 0);
break; //Green break; // Green
case 11: case 11:
bcol2 = getRGB(0, 16 * backboxmult, (16-spcoldel)*backboxmult); bcol2 = getRGB(0, 16 * backboxmult, (16 - spcoldel) * backboxmult);
break; //Green break; // Green
} }
break; break;
} }
@ -2406,67 +2405,67 @@ void Graphics::drawbackground( int t )
for (int i = 0; i < numbackboxes; i++) for (int i = 0; i < numbackboxes; i++)
{ {
switch(rcol) switch (rcol)
{ {
//Akward ordering to match tileset // Akward ordering to match tileset
case 0: case 0:
bcol = getRGB(16, 128*backboxmult, 128*backboxmult); bcol = getRGB(16, 128 * backboxmult, 128 * backboxmult);
break; //Cyan break; // Cyan
case 1: case 1:
bcol = getRGB(128*backboxmult, 16, 16); bcol = getRGB(128 * backboxmult, 16, 16);
break; //Red break; // Red
case 2: case 2:
bcol = getRGB(128*backboxmult, 16, 128*backboxmult); bcol = getRGB(128 * backboxmult, 16, 128 * backboxmult);
break; //Purple break; // Purple
case 3: case 3:
bcol = getRGB(16, 16, 128*backboxmult); bcol = getRGB(16, 16, 128 * backboxmult);
break; //Blue break; // Blue
case 4: case 4:
bcol = getRGB(128*backboxmult, 128*backboxmult, 16); bcol = getRGB(128 * backboxmult, 128 * backboxmult, 16);
break; //Yellow break; // Yellow
case 5: case 5:
bcol = getRGB(16, 128 * backboxmult, 16); bcol = getRGB(16, 128 * backboxmult, 16);
break; //Green break; // Green
case 6: case 6:
//crazy case // crazy case
switch(spcol) switch (spcol)
{ {
case 0: case 0:
bcol = getRGB(16, 128*backboxmult, 128*backboxmult); bcol = getRGB(16, 128 * backboxmult, 128 * backboxmult);
break; //Cyan break; // Cyan
case 1: case 1:
bcol = getRGB(16, ((spcoldel+1)*8)*backboxmult, 128*backboxmult); bcol = getRGB(16, ((spcoldel + 1) * 8) * backboxmult, 128 * backboxmult);
break; //Cyan break; // Cyan
case 2: case 2:
bcol = getRGB(16, 16, 128*backboxmult); bcol = getRGB(16, 16, 128 * backboxmult);
break; //Blue break; // Blue
case 3: case 3:
bcol = getRGB((128-(spcoldel*8))*backboxmult, 16, 128*backboxmult); bcol = getRGB((128 - (spcoldel * 8)) * backboxmult, 16, 128 * backboxmult);
break; //Blue break; // Blue
case 4: case 4:
bcol = getRGB(128*backboxmult, 16, 128*backboxmult); bcol = getRGB(128 * backboxmult, 16, 128 * backboxmult);
break; //Purple break; // Purple
case 5: case 5:
bcol = getRGB(128*backboxmult, 16, ((spcoldel+1)*8)*backboxmult); bcol = getRGB(128 * backboxmult, 16, ((spcoldel + 1) * 8) * backboxmult);
break; //Purple break; // Purple
case 6: case 6:
bcol = getRGB(128*backboxmult, 16, 16); bcol = getRGB(128 * backboxmult, 16, 16);
break; //Red break; // Red
case 7: case 7:
bcol = getRGB(128*backboxmult, (128-(spcoldel*8))*backboxmult, 16); bcol = getRGB(128 * backboxmult, (128 - (spcoldel * 8)) * backboxmult, 16);
break; //Red break; // Red
case 8: case 8:
bcol = getRGB(128*backboxmult, 128*backboxmult, 16); bcol = getRGB(128 * backboxmult, 128 * backboxmult, 16);
break; //Yellow break; // Yellow
case 9: case 9:
bcol = getRGB(((spcoldel+1)*8)*backboxmult, 128*backboxmult, 16); bcol = getRGB(((spcoldel + 1) * 8) * backboxmult, 128 * backboxmult, 16);
break; //Yellow break; // Yellow
case 10: case 10:
bcol = getRGB(16, 128 * backboxmult, 16); bcol = getRGB(16, 128 * backboxmult, 16);
break; //Green break; // Green
case 11: case 11:
bcol = getRGB(16, 128 * backboxmult, (128-(spcoldel*8))*backboxmult); bcol = getRGB(16, 128 * backboxmult, (128 - (spcoldel * 8)) * backboxmult);
break; //Green break; // Green
} }
break; break;
} }
@ -2476,8 +2475,8 @@ void Graphics::drawbackground( int t )
backboxrect.y = lerp(backboxes[i].y - backboxvy[i], backboxes[i].y); backboxrect.y = lerp(backboxes[i].y - backboxvy[i], backboxes[i].y);
fill_rect(&backboxrect, bcol); fill_rect(&backboxrect, bcol);
backboxrect.x += 1; backboxrect.x++;
backboxrect.y += 1; backboxrect.y++;
backboxrect.w -= 2; backboxrect.w -= 2;
backboxrect.h -= 2; backboxrect.h -= 2;
fill_rect(&backboxrect, bcol2); fill_rect(&backboxrect, bcol2);
@ -2506,47 +2505,47 @@ void Graphics::drawbackground( int t )
} }
case 5: case 5:
{ {
//Warp zone, central // Warp zone, central
SDL_Color warpbcol; SDL_Color warpbcol;
SDL_Color warpfcol; SDL_Color warpfcol;
switch(rcol) switch(rcol)
{ {
//Akward ordering to match tileset // Akward ordering to match tileset
case 0: case 0:
warpbcol = getRGB(0x0A, 0x10, 0x0E); warpbcol = getRGB(0x0A, 0x10, 0x0E);
warpfcol = getRGB(0x10, 0x22, 0x21); warpfcol = getRGB(0x10, 0x22, 0x21);
break; //Cyan break; // Cyan
case 1: case 1:
warpbcol = getRGB(0x11, 0x09, 0x0B); warpbcol = getRGB(0x11, 0x09, 0x0B);
warpfcol = getRGB(0x22, 0x10, 0x11); warpfcol = getRGB(0x22, 0x10, 0x11);
break; //Red break; // Red
case 2: case 2:
warpbcol = getRGB(0x0F, 0x0A, 0x10); warpbcol = getRGB(0x0F, 0x0A, 0x10);
warpfcol = getRGB(0x22,0x10,0x22); warpfcol = getRGB(0x22,0x10,0x22);
break; //Purple break; // Purple
case 3: case 3:
warpbcol = getRGB(0x0A, 0x0B, 0x10); warpbcol = getRGB(0x0A, 0x0B, 0x10);
warpfcol = getRGB(0x10, 0x10, 0x22); warpfcol = getRGB(0x10, 0x10, 0x22);
break; //Blue break; // Blue
case 4: case 4:
warpbcol = getRGB(0x10, 0x0D, 0x0A); warpbcol = getRGB(0x10, 0x0D, 0x0A);
warpfcol = getRGB(0x22, 0x1E, 0x10); warpfcol = getRGB(0x22, 0x1E, 0x10);
break; //Yellow break; // Yellow
case 5: case 5:
warpbcol = getRGB(0x0D, 0x10, 0x0A); warpbcol = getRGB(0x0D, 0x10, 0x0A);
warpfcol = getRGB(0x14, 0x22, 0x10); warpfcol = getRGB(0x14, 0x22, 0x10);
break; //Green break; // Green
case 6: case 6:
warpbcol = getRGB(0x0A, 0x0A, 0x0A); warpbcol = getRGB(0x0A, 0x0A, 0x0A);
warpfcol = getRGB(0x12, 0x12, 0x12); warpfcol = getRGB(0x12, 0x12, 0x12);
break; //Gray break; // Gray
default: default:
warpbcol = getRGB(0xFF, 0xFF, 0xFF); warpbcol = getRGB(0xFF, 0xFF, 0xFF);
warpfcol = getRGB(0xFF, 0xFF, 0xFF); warpfcol = getRGB(0xFF, 0xFF, 0xFF);
} }
for (int i = 10 ; i >= 0; i--) for (int i = 10; i >= 0; i--)
{ {
const int temp = (i * 16) + backoffset; const int temp = (i * 16) + backoffset;
const SDL_Rect warprect = {160 - temp, 120 - temp, temp * 2, temp * 2}; const SDL_Rect warprect = {160 - temp, 120 - temp, temp * 2, temp * 2};
@ -2562,7 +2561,7 @@ void Graphics::drawbackground( int t )
break; break;
} }
case 6: case 6:
//Final Starfield // Final Starfield
fill_rect(0, 0, 0); fill_rect(0, 0, 0);
for (int i = 0; i < numstars; i++) for (int i = 0; i < numstars; i++)
{ {
@ -2579,7 +2578,7 @@ void Graphics::drawbackground( int t )
} }
break; break;
case 7: case 7:
//Static, unscrolling section of the tower // Static, unscrolling section of the tower
for (int j = 0; j < 30; j++) for (int j = 0; j < 30; j++)
{ {
for (int i = 0; i < 40; i++) for (int i = 0; i < 40; i++)
@ -2589,7 +2588,7 @@ void Graphics::drawbackground( int t )
} }
break; break;
case 8: case 8:
//Static, unscrolling section of the tower // Static, unscrolling section of the tower
for (int j = 0; j < 30; j++) for (int j = 0; j < 30; j++)
{ {
for (int i = 0; i < 40; i++) for (int i = 0; i < 40; i++)
@ -2599,7 +2598,7 @@ void Graphics::drawbackground( int t )
} }
break; break;
case 9: case 9:
//Static, unscrolling section of the tower // Static, unscrolling section of the tower
for (int j = 0; j < 30; j++) for (int j = 0; j < 30; j++)
{ {
for (int i = 0; i < 40; i++) for (int i = 0; i < 40; i++)
@ -2610,7 +2609,6 @@ void Graphics::drawbackground( int t )
break; break;
default: default:
fill_rect(0, 0, 0); fill_rect(0, 0, 0);
break; break;
} }
} }
@ -2620,7 +2618,7 @@ void Graphics::updatebackground(int t)
switch (t) switch (t)
{ {
case 1: case 1:
//Starfield // Starfield
for (int i = 0; i < numstars; i++) for (int i = 0; i < numstars; i++)
{ {
stars[i].x -= starsspeed[i]; stars[i].x -= starsspeed[i];
@ -2633,10 +2631,10 @@ void Graphics::updatebackground(int t)
} }
break; break;
case 2: case 2:
//Lab // Lab
if (rcol == 6) if (rcol == 6)
{ {
//crazy caze // crazy caze
spcoldel--; spcoldel--;
if (spcoldel <= 0) if (spcoldel <= 0)
{ {
@ -2671,7 +2669,7 @@ void Graphics::updatebackground(int t)
} }
} }
break; break;
case 3: //Warp zone (horizontal) case 3: // Warp zone (horizontal)
{ {
const int temp = 680 + (rcol * 3); const int temp = 680 + (rcol * 3);
backoffset += 3; backoffset += 3;
@ -2687,7 +2685,7 @@ void Graphics::updatebackground(int t)
{ {
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
drawtile2(317 - backoffset + (i * 16), (j * 16), temp + 40); //20*16 = 320 drawtile2(317 - backoffset + (i * 16), (j * 16), temp + 40); // 20*16 = 320
drawtile2(317 - backoffset + (i * 16) + 8, (j * 16), temp + 41); drawtile2(317 - backoffset + (i * 16) + 8, (j * 16), temp + 41);
drawtile2(317 - backoffset + (i * 16), (j * 16) + 8, temp + 80); drawtile2(317 - backoffset + (i * 16), (j * 16) + 8, temp + 80);
drawtile2(317 - backoffset + (i * 16) + 8, (j * 16) + 8, temp + 81); drawtile2(317 - backoffset + (i * 16) + 8, (j * 16) + 8, temp + 81);
@ -2696,7 +2694,7 @@ void Graphics::updatebackground(int t)
} }
else else
{ {
//draw the whole thing for the first time! // draw the whole thing for the first time!
backoffset = 0; backoffset = 0;
clear(); clear();
for (int j = 0; j < 15; j++) for (int j = 0; j < 15; j++)
@ -2714,7 +2712,7 @@ void Graphics::updatebackground(int t)
set_render_target(target); set_render_target(target);
break; break;
} }
case 4: //Warp zone (vertical) case 4: // Warp zone (vertical)
{ {
const int temp = 760 + (rcol * 3); const int temp = 760 + (rcol * 3);
backoffset += 3; backoffset += 3;
@ -2730,7 +2728,7 @@ void Graphics::updatebackground(int t)
{ {
for (int i = 0; i < 21; i++) for (int i = 0; i < 21; i++)
{ {
drawtile2((i * 16), 237 - backoffset + (j * 16), temp + 40); //14*17=240 - 3 drawtile2((i * 16), 237 - backoffset + (j * 16), temp + 40); // 14*17=240 - 3
drawtile2((i * 16) + 8, 237 - backoffset + (j * 16), temp + 41); drawtile2((i * 16) + 8, 237 - backoffset + (j * 16), temp + 41);
drawtile2((i * 16), 237 - backoffset + (j * 16) + 8, temp + 80); drawtile2((i * 16), 237 - backoffset + (j * 16) + 8, temp + 80);
drawtile2((i * 16) + 8, 237 - backoffset + (j * 16) + 8, temp + 81); drawtile2((i * 16) + 8, 237 - backoffset + (j * 16) + 8, temp + 81);
@ -2739,7 +2737,7 @@ void Graphics::updatebackground(int t)
} }
else else
{ {
//draw the whole thing for the first time! // draw the whole thing for the first time!
backoffset = 0; backoffset = 0;
clear(); clear();
for (int j = 0; j < 16; j++) for (int j = 0; j < 16; j++)
@ -2758,9 +2756,9 @@ void Graphics::updatebackground(int t)
break; break;
} }
case 5: case 5:
//Warp zone, central // Warp zone, central
backoffset += 1; backoffset++;
if (backoffset >= 16) if (backoffset >= 16)
{ {
backoffset -= 16; backoffset -= 16;
@ -2768,7 +2766,7 @@ void Graphics::updatebackground(int t)
} }
break; break;
case 6: case 6:
//Final Starfield // Final Starfield
for (int i = 0; i < numstars; i++) for (int i = 0; i < numstars; i++)
{ {
stars[i].y -= starsspeed[i]; stars[i].y -= starsspeed[i];