mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Finish implementing sprites in textboxes
This commit adjusts the Y position for flip-mode, and makes the main game use this new system.
This commit is contained in:
parent
76ea4488af
commit
b5c9508dd4
3 changed files with 26 additions and 45 deletions
|
@ -671,10 +671,10 @@ void Game::levelcomplete_textbox(void)
|
||||||
graphics.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::crewmate_textbox(const int r, const int g, const int b)
|
void Game::crewmate_textbox(const int color)
|
||||||
{
|
{
|
||||||
const int extra_cjk_height = (font::height(PR_FONT_INTERFACE) * 4) - 32;
|
const int extra_cjk_height = (font::height(PR_FONT_INTERFACE) * 4) - 32;
|
||||||
graphics.createtextboxflipme("", -1, 64 + 8 + 16 - extra_cjk_height/2, r, g, b);
|
graphics.createtextboxflipme("", -1, 64 + 8 + 16 - extra_cjk_height/2, TEXT_COLOUR("gray"));
|
||||||
|
|
||||||
/* This is a special case for wrapping, we MUST have two lines.
|
/* This is a special case for wrapping, we MUST have two lines.
|
||||||
* So just make sure it can't fit in one line. */
|
* So just make sure it can't fit in one line. */
|
||||||
|
@ -697,6 +697,7 @@ void Game::crewmate_textbox(const int r, const int g, const int b)
|
||||||
float spaces_per_8 = font::len(PR_FONT_INTERFACE, " ")/8.0f;
|
float spaces_per_8 = font::len(PR_FONT_INTERFACE, " ")/8.0f;
|
||||||
graphics.textboxpad(SDL_ceilf(5/spaces_per_8), SDL_ceilf(2/spaces_per_8));
|
graphics.textboxpad(SDL_ceilf(5/spaces_per_8), SDL_ceilf(2/spaces_per_8));
|
||||||
graphics.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
|
graphics.addsprite(14, 12, 0, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::remaining_textbox(void)
|
void Game::remaining_textbox(void)
|
||||||
|
@ -2453,7 +2454,7 @@ void Game::updatestate(void)
|
||||||
incstate();
|
incstate();
|
||||||
setstatedelay(45);
|
setstatedelay(45);
|
||||||
|
|
||||||
crewmate_textbox(175, 174, 174);
|
crewmate_textbox(13);
|
||||||
break;
|
break;
|
||||||
case 3008:
|
case 3008:
|
||||||
incstate();
|
incstate();
|
||||||
|
@ -2495,7 +2496,7 @@ void Game::updatestate(void)
|
||||||
incstate();
|
incstate();
|
||||||
setstatedelay(45);
|
setstatedelay(45);
|
||||||
|
|
||||||
crewmate_textbox(174, 175, 174);
|
crewmate_textbox(14);
|
||||||
break;
|
break;
|
||||||
case 3022:
|
case 3022:
|
||||||
incstate();
|
incstate();
|
||||||
|
@ -2536,7 +2537,7 @@ void Game::updatestate(void)
|
||||||
incstate();
|
incstate();
|
||||||
setstatedelay(45);
|
setstatedelay(45);
|
||||||
|
|
||||||
crewmate_textbox(174, 174, 175);
|
crewmate_textbox(16);
|
||||||
break;
|
break;
|
||||||
case 3042:
|
case 3042:
|
||||||
incstate();
|
incstate();
|
||||||
|
@ -2578,7 +2579,7 @@ void Game::updatestate(void)
|
||||||
incstate();
|
incstate();
|
||||||
setstatedelay(45);
|
setstatedelay(45);
|
||||||
|
|
||||||
crewmate_textbox(175, 175, 174);
|
crewmate_textbox(20);
|
||||||
break;
|
break;
|
||||||
case 3052:
|
case 3052:
|
||||||
incstate();
|
incstate();
|
||||||
|
@ -2644,7 +2645,7 @@ void Game::updatestate(void)
|
||||||
incstate();
|
incstate();
|
||||||
setstatedelay(45);
|
setstatedelay(45);
|
||||||
|
|
||||||
crewmate_textbox(175, 174, 175);
|
crewmate_textbox(15);
|
||||||
break;
|
break;
|
||||||
case 3062:
|
case 3062:
|
||||||
incstate();
|
incstate();
|
||||||
|
|
|
@ -222,7 +222,7 @@ public:
|
||||||
void gethardestroom(void);
|
void gethardestroom(void);
|
||||||
|
|
||||||
void levelcomplete_textbox(void);
|
void levelcomplete_textbox(void);
|
||||||
void crewmate_textbox(const int r, const int g, const int b);
|
void crewmate_textbox(const int color);
|
||||||
void remaining_textbox(void);
|
void remaining_textbox(void);
|
||||||
void actionprompt_textbox(void);
|
void actionprompt_textbox(void);
|
||||||
void savetele_textbox(void);
|
void savetele_textbox(void);
|
||||||
|
|
|
@ -838,20 +838,14 @@ const char* Graphics::textbox_line(
|
||||||
void Graphics::drawgui(void)
|
void Graphics::drawgui(void)
|
||||||
{
|
{
|
||||||
int text_sign;
|
int text_sign;
|
||||||
int crew_yp;
|
|
||||||
int crew_sprite;
|
|
||||||
|
|
||||||
if (flipmode)
|
if (flipmode)
|
||||||
{
|
{
|
||||||
text_sign = -1;
|
text_sign = -1;
|
||||||
crew_yp = 64 + 48 + 4;
|
|
||||||
crew_sprite = 6;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text_sign = 1;
|
text_sign = 1;
|
||||||
crew_yp = 64 + 32 + 4;
|
|
||||||
crew_sprite = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw all the textboxes to the screen
|
//Draw all the textboxes to the screen
|
||||||
|
@ -1023,41 +1017,27 @@ void Graphics::drawgui(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int crew_xp = textboxes[i].xp+20 - 6;
|
|
||||||
if (textboxes[i].r == 175 && textboxes[i].g == 175)
|
|
||||||
{
|
|
||||||
//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);
|
|
||||||
}
|
|
||||||
else if (textboxes[i].r == 175 && textboxes[i].b == 175)
|
|
||||||
{
|
|
||||||
//red guy
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
//green guy
|
|
||||||
draw_sprite(crew_xp, crew_yp, crew_sprite, 120 - help.glow / 4 - textboxes[i].rand, 220 - help.glow / 4, 120 - help.glow / 4);
|
|
||||||
}
|
|
||||||
else if (textboxes[i].g == 175)
|
|
||||||
{
|
|
||||||
//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);
|
|
||||||
}
|
|
||||||
else if (textboxes[i].b == 175)
|
|
||||||
{
|
|
||||||
//blue guy
|
|
||||||
draw_sprite(crew_xp, crew_yp, crew_sprite, 75, 75, 255 - help.glow / 4 - textboxes[i].rand);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = 0; index < (int) textboxes[i].sprites.size(); index++)
|
for (size_t index = 0; index < textboxes[i].sprites.size(); index++)
|
||||||
{
|
{
|
||||||
TextboxSprite* sprite = &textboxes[i].sprites[index];
|
TextboxSprite* sprite = &textboxes[i].sprites[index];
|
||||||
draw_sprite(
|
int y = sprite->y + yp;
|
||||||
sprite->x + textboxes[i].xp,
|
|
||||||
sprite->y + textboxes[i].yp,
|
if (flipmode)
|
||||||
|
{
|
||||||
|
y = yp + textboxes[i].h - sprite->y - sprites_rect.h;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_grid_tile(
|
||||||
|
grphx.im_sprites,
|
||||||
sprite->tile,
|
sprite->tile,
|
||||||
getcol(sprite->col)
|
sprite->x + textboxes[i].xp,
|
||||||
|
y,
|
||||||
|
sprites_rect.w,
|
||||||
|
sprites_rect.h,
|
||||||
|
getcol(sprite->col),
|
||||||
|
1,
|
||||||
|
(flipmode ? -1 : 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue