mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 18:04:09 +03:00
Merge remote-tracking branch 'upstream/master' into auto-center-menu
Fix one conflict.
This commit is contained in:
@@ -200,20 +200,58 @@ void Graphics::updatetitlecolours()
|
||||
col_trinket = ct.colour;
|
||||
}
|
||||
|
||||
#define PROCESS_TILESHEET_CHECK_ERROR(tilesheet, tile_square) \
|
||||
if (grphx.im_##tilesheet->w % tile_square != 0 \
|
||||
|| grphx.im_##tilesheet->h % tile_square != 0) \
|
||||
{ \
|
||||
const char* error = "Error: %s.png dimensions not exact multiples of %i!"; \
|
||||
char message[128]; \
|
||||
SDL_snprintf(message, sizeof(message), error, #tilesheet, tile_square); \
|
||||
\
|
||||
const char* error_title = "Error with %s.png"; \
|
||||
char message_title[128]; \
|
||||
SDL_snprintf(message_title, sizeof(message_title), error_title, #tilesheet); \
|
||||
\
|
||||
puts(message); \
|
||||
\
|
||||
SDL_ShowSimpleMessageBox( \
|
||||
SDL_MESSAGEBOX_ERROR, \
|
||||
message_title, \
|
||||
message, \
|
||||
NULL \
|
||||
); \
|
||||
\
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
#define PROCESS_TILESHEET_RENAME(tilesheet, vector, tile_square, extra_code) \
|
||||
PROCESS_TILESHEET_CHECK_ERROR(tilesheet, tile_square) \
|
||||
\
|
||||
for (int j = 0; j < grphx.im_##tilesheet->h / tile_square; j++) \
|
||||
{ \
|
||||
for (int i = 0; i < grphx.im_##tilesheet->w / tile_square; i++) \
|
||||
{ \
|
||||
SDL_Surface* temp = GetSubSurface( \
|
||||
grphx.im_##tilesheet, \
|
||||
i * tile_square, j * tile_square, \
|
||||
tile_square, tile_square \
|
||||
); \
|
||||
vector.push_back(temp); \
|
||||
\
|
||||
extra_code \
|
||||
} \
|
||||
}
|
||||
|
||||
#define PROCESS_TILESHEET(tilesheet, tile_square, extra_code) \
|
||||
PROCESS_TILESHEET_RENAME(tilesheet, tilesheet, tile_square, extra_code)
|
||||
|
||||
void Graphics::Makebfont()
|
||||
{
|
||||
for (int j = 0; j < (grphx.im_bfont->h / 8); j++)
|
||||
PROCESS_TILESHEET(bfont, 8,
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_bfont,i*8,j*8,8,8);
|
||||
bfont.push_back(temp);
|
||||
|
||||
SDL_Surface* TempFlipped = FlipSurfaceVerticle(temp);
|
||||
flipbfont.push_back(TempFlipped);
|
||||
}
|
||||
}
|
||||
SDL_Surface* TempFlipped = FlipSurfaceVerticle(temp);
|
||||
flipbfont.push_back(TempFlipped);
|
||||
})
|
||||
|
||||
unsigned char* charmap = NULL;
|
||||
size_t length;
|
||||
@@ -241,65 +279,27 @@ int Graphics::bfontlen(uint32_t ch) {
|
||||
|
||||
void Graphics::MakeTileArray()
|
||||
{
|
||||
for(int j = 0; j <30; j++)
|
||||
{
|
||||
for(int i = 0; i <40; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_tiles,i*8,j*8,8,8);
|
||||
tiles.push_back(temp);
|
||||
}
|
||||
}
|
||||
for(int j = 0; j <30; j++)
|
||||
{
|
||||
for(int i = 0; i <40; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_tiles2,i*8,j*8,8,8);
|
||||
tiles2.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j <30; j++)
|
||||
{
|
||||
for(int i = 0; i <30; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_tiles3,i*8,j*8,8,8);
|
||||
tiles3.push_back(temp);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j <60; j++)
|
||||
{
|
||||
for(int i = 0; i <12; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_entcolours,i*8,j*8,8,8);
|
||||
entcolours.push_back(temp);
|
||||
}
|
||||
}
|
||||
PROCESS_TILESHEET(tiles, 8, )
|
||||
PROCESS_TILESHEET(tiles2, 8, )
|
||||
PROCESS_TILESHEET(tiles3, 8, )
|
||||
PROCESS_TILESHEET(entcolours, 8, )
|
||||
}
|
||||
|
||||
void Graphics::maketelearray()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_teleporter,i*96,0,96,96);
|
||||
tele.push_back(temp);
|
||||
}
|
||||
PROCESS_TILESHEET_RENAME(teleporter, tele, 96, )
|
||||
}
|
||||
|
||||
void Graphics::MakeSpriteArray()
|
||||
{
|
||||
for(int j = 0; j <16; j++)
|
||||
{
|
||||
for(int i = 0; i <12; i++)
|
||||
{
|
||||
SDL_Surface* temp = GetSubSurface(grphx.im_sprites,i*32,j*32,32,32);
|
||||
sprites.push_back(temp);
|
||||
temp = GetSubSurface(grphx.im_flipsprites,i*32,j*32,32,32);
|
||||
flipsprites.push_back(temp);
|
||||
}
|
||||
}
|
||||
PROCESS_TILESHEET(sprites, 32, )
|
||||
PROCESS_TILESHEET(flipsprites, 32, )
|
||||
}
|
||||
|
||||
#undef PROCESS_TILESHEET
|
||||
#undef PROCESS_TILESHEET_RENAME
|
||||
#undef PROCESS_TILESHEET_CHECK_ERROR
|
||||
|
||||
|
||||
void Graphics::map_tab(int opt, const std::string& text, bool selected /*= false*/)
|
||||
{
|
||||
@@ -1141,16 +1141,34 @@ void Graphics::textboxremove()
|
||||
|
||||
void Graphics::textboxtimer( int t )
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxtimer() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].timer=t;
|
||||
}
|
||||
|
||||
void Graphics::addline( std::string t )
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("addline() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].addline(t);
|
||||
}
|
||||
|
||||
void Graphics::textboxadjust()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxadjust() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].adjust();
|
||||
}
|
||||
|
||||
@@ -2787,33 +2805,69 @@ void Graphics::setwarprect( int a, int b, int c, int d )
|
||||
|
||||
void Graphics::textboxcenter()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxcenter() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centerx();
|
||||
textbox[m].centery();
|
||||
}
|
||||
|
||||
void Graphics::textboxcenterx()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxcenterx() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centerx();
|
||||
}
|
||||
|
||||
int Graphics::textboxwidth()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxwidth() out-of-bounds!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return textbox[m].w;
|
||||
}
|
||||
|
||||
void Graphics::textboxmove(int xo, int yo)
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxmove() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].xp += xo;
|
||||
textbox[m].yp += yo;
|
||||
}
|
||||
|
||||
void Graphics::textboxmoveto(int xo)
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxmoveto() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].xp = xo;
|
||||
}
|
||||
|
||||
void Graphics::textboxcentery()
|
||||
{
|
||||
if (!INBOUNDS(m, textbox))
|
||||
{
|
||||
puts("textboxcentery() out-of-bounds!");
|
||||
return;
|
||||
}
|
||||
|
||||
textbox[m].centery();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user