From 7c67112a8bba17572f5e39552782d8224a510c49 Mon Sep 17 00:00:00 2001 From: onpon4 Date: Tue, 3 Nov 2015 20:26:56 -0500 Subject: [PATCH] Some more cleanup. --- src/gfx.cpp | 26 +++++++++++++------------- src/gfx.h | 2 +- src/intermission.cpp | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gfx.cpp b/src/gfx.cpp index 2606ae2..b81ff47 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -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 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 splitword; @@ -172,29 +172,29 @@ static int renderString(const char *in, int x, int y, int fontColor, signed char 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); - renderString(in, x, y + 1, FONT_OUTLINE, wrap, dest); - renderString(in, x, y + 2, FONT_OUTLINE, wrap, dest); - renderString(in, x - 1, y, FONT_OUTLINE, wrap, dest); - renderString(in, x - 2, y, FONT_OUTLINE, wrap, dest); - renderString(in, x + 1, y, FONT_OUTLINE, wrap, dest); - return renderString(in, x, y, fontColor, wrap, dest); + gfx_renderStringBase(in, x, y - 1, FONT_OUTLINE, wrap, dest); + gfx_renderStringBase(in, x, y + 1, FONT_OUTLINE, wrap, dest); + gfx_renderStringBase(in, x, y + 2, FONT_OUTLINE, wrap, dest); + gfx_renderStringBase(in, x - 1, y, FONT_OUTLINE, wrap, dest); + gfx_renderStringBase(in, x - 2, y, FONT_OUTLINE, wrap, dest); + gfx_renderStringBase(in, x + 1, y, FONT_OUTLINE, 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) { if (x == -1) 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) { if (x == -1) - x = (800 - (strlen(in) * 9)) / 2; - return drawString(in, x, y, fontColor, 0, screen); + x = (screen->w - (strlen(in) * 9)) / 2; + 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; } - drawString(message, x, 5, FONT_WHITE, 1, messageBox); + gfx_renderString(message, x, 5, FONT_WHITE, 1, messageBox); } void freeGraphics() diff --git a/src/gfx.h b/src/gfx.h index 2507095..fae13dc 100644 --- a/src/gfx.h +++ b/src/gfx.h @@ -34,7 +34,7 @@ extern SDL_Surface *messageBox; void gfx_init(); SDL_Surface *gfx_setTransparent(SDL_Surface *sprite); 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); extern void drawBackGround(); diff --git a/src/intermission.cpp b/src/intermission.cpp index 2cc503b..da2ae5c 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -431,7 +431,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss } else { - newY = drawString(string, 80, y, col, 1, comms) + 25; + newY = gfx_renderString(string, 80, y, col, 1, comms) + 25; if (newY < y + 60) newY += (60 - (newY - y)); y = newY; @@ -441,7 +441,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss fclose(fp); 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; }