Some more cleanup.

This commit is contained in:
onpon4 2015-11-03 20:26:56 -05:00
parent cce6d11510
commit 7c67112a8b
3 changed files with 16 additions and 16 deletions

View File

@ -99,7 +99,7 @@ void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
In 16 bit mode this is slow. VERY slow. Don't write directly to a surface In 16 bit mode this is slow. VERY slow. Don't write directly to a surface
that constantly needs updating (eg - the main game screen) that constantly needs updating (eg - the main game screen)
*/ */
static int renderString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest) static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
{ {
int i; int i;
int splitword; int splitword;
@ -172,29 +172,29 @@ static int renderString(const char *in, int x, int y, int fontColor, signed char
return area.y; return area.y;
} }
int drawString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest) int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest)
{ {
renderString(in, x, y - 1, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x, y - 1, FONT_OUTLINE, wrap, dest);
renderString(in, x, y + 1, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x, y + 1, FONT_OUTLINE, wrap, dest);
renderString(in, x, y + 2, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x, y + 2, FONT_OUTLINE, wrap, dest);
renderString(in, x - 1, y, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x - 1, y, FONT_OUTLINE, wrap, dest);
renderString(in, x - 2, y, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x - 2, y, FONT_OUTLINE, wrap, dest);
renderString(in, x + 1, y, FONT_OUTLINE, wrap, dest); gfx_renderStringBase(in, x + 1, y, FONT_OUTLINE, wrap, dest);
return renderString(in, x, y, fontColor, wrap, dest); return gfx_renderStringBase(in, x, y, fontColor, wrap, dest);
} }
int drawString(const char *in, int x, int y, int fontColor, SDL_Surface *dest) int drawString(const char *in, int x, int y, int fontColor, SDL_Surface *dest)
{ {
if (x == -1) if (x == -1)
x = (dest->w - (strlen(in) * 9)) / 2; x = (dest->w - (strlen(in) * 9)) / 2;
return drawString(in, x, y, fontColor, 0, dest); return gfx_renderString(in, x, y, fontColor, 0, dest);
} }
int drawString(const char *in, int x, int y, int fontColor) int drawString(const char *in, int x, int y, int fontColor)
{ {
if (x == -1) if (x == -1)
x = (800 - (strlen(in) * 9)) / 2; x = (screen->w - (strlen(in) * 9)) / 2;
return drawString(in, x, y, fontColor, 0, screen); return gfx_renderString(in, x, y, fontColor, 0, screen);
} }
/* /*
@ -477,7 +477,7 @@ void createMessageBox(SDL_Surface *face, const char *message, signed char transp
x = 10; x = 10;
} }
drawString(message, x, 5, FONT_WHITE, 1, messageBox); gfx_renderString(message, x, 5, FONT_WHITE, 1, messageBox);
} }
void freeGraphics() void freeGraphics()

View File

@ -34,7 +34,7 @@ extern SDL_Surface *messageBox;
void gfx_init(); void gfx_init();
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite); SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest); void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest);
extern int drawString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest); int gfx_renderString(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest);
extern int drawString(const char *in, int x, int y, int fontColor, SDL_Surface *dest); extern int drawString(const char *in, int x, int y, int fontColor, SDL_Surface *dest);
extern int drawString(const char *in, int x, int y, int fontColor); extern int drawString(const char *in, int x, int y, int fontColor);
extern void drawBackGround(); extern void drawBackGround();

View File

@ -431,7 +431,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
} }
else else
{ {
newY = drawString(string, 80, y, col, 1, comms) + 25; newY = gfx_renderString(string, 80, y, col, 1, comms) + 25;
if (newY < y + 60) if (newY < y + 60)
newY += (60 - (newY - y)); newY += (60 - (newY - y));
y = newY; y = newY;
@ -441,7 +441,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
fclose(fp); fclose(fp);
blevelRect(comms, 5, comms->h - 28, 180, 20, 0x25, 0x00, 0x00); blevelRect(comms, 5, comms->h - 28, 180, 20, 0x25, 0x00, 0x00);
drawString("RETURN TO MESSAGES", 15, comms->h - 25, FONT_WHITE, 1, comms); gfx_renderString("RETURN TO MESSAGES", 15, comms->h - 25, FONT_WHITE, 1, comms);
engine.commsSection = 1; engine.commsSection = 1;
} }