diff --git a/src/game/ending.c b/src/game/ending.c index 68231e5..ae542dc 100644 --- a/src/game/ending.c +++ b/src/game/ending.c @@ -88,16 +88,16 @@ static void draw(void) float h; int th; - h = (SCREEN_WIDTH / 800.0) * background[endingImageIndex]->rect.h; + h = (app.config.winWidth / 800.0) * background[endingImageIndex]->rect.h; - blitRectScaled(atlasTexture->texture, 0, SCREEN_HEIGHT - h, SCREEN_WIDTH, h, &background[endingImageIndex]->rect, 0); + blitRectScaled(atlasTexture->texture, 0, app.config.winHeight - h, app.config.winWidth, h, &background[endingImageIndex]->rect, 0); if (endingTimer > 0 && endingTextIndex < NUM_ENDING_LINES) { - app.textWidth = (SCREEN_WIDTH / 2); + app.textWidth = (app.config.winWidth / 2); th = getWrappedTextHeight(endingText[endingTextIndex], 24) + 15; - drawRect(0, SCREEN_HEIGHT - th - 10, SCREEN_WIDTH, th + 10, 0, 0, 0, 128); - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - th, 24, TA_CENTER, colors.white, endingText[endingTextIndex]); + drawRect(0, app.config.winHeight - th - 10, app.config.winWidth, th + 10, 0, 0, 0, 128); + drawText(app.config.winWidth / 2, app.config.winHeight - th, 24, TA_CENTER, colors.white, endingText[endingTextIndex]); app.textWidth = 0; } } diff --git a/src/hub/hub.c b/src/hub/hub.c index 015edae..b5b7361 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -136,7 +136,7 @@ void initHub(void) cursor.y = app.config.winHeight / 2; SDL_WarpMouseInWindow(app.window, cursor.x, cursor.y); - game.isComplete = 1; + game.isComplete = 0; for (t = game.missionStatusHead.next ; t != NULL ; t = t->next) { @@ -506,7 +506,7 @@ static void drawMissionInfo(void) drawText(UI_WIDTH / 2, y + 25, 32, TA_CENTER, colors.white, selectedMission->name); - app.textWidth = (w - 150); + app.textWidth = (w - 25); drawText(x + 15, y + 100, 22, TA_LEFT, colors.white, selectedMission->description); app.textWidth = 0; diff --git a/src/system/savepng.h b/src/system/savepng.h index 2aa9342..796fe7d 100644 --- a/src/system/savepng.h +++ b/src/system/savepng.h @@ -17,6 +17,7 @@ extern "C" { /* This helps CPP projects that include this header */ * Returns 0 success or -1 on failure, the error message is then retrievable * via SDL_GetError(). */ +#define SDL_SavePNG(surface, file) \ SDL_SavePNG_RW(surface, SDL_RWFromFile(file, "wb"), 1) /* @@ -29,19 +30,15 @@ extern "C" { /* This helps CPP projects that include this header */ * Returns 0 success or -1 on failure, the error message is then retrievable * via SDL_GetError(). */ +extern int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *rw, int freedst); /* * Return new SDL_Surface with a format suitable for PNG output. */ +extern SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src); #ifdef __cplusplus } /* extern "C" */ #endif #endif - -#define SDL_SavePNG(surface, file) \ - -extern SDL_Surface *SDL_PNGFormatAlpha(SDL_Surface *src); -extern int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *rw, int freedst); -#define SDL_SavePNG(surface, file) \ diff --git a/src/system/text.c b/src/system/text.c index 4cc7bad..1757e7e 100644 --- a/src/system/text.c +++ b/src/system/text.c @@ -22,15 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void initFont(char *name, char *filename); static void drawWord(char *word, int *x, int *y, int startX); -static void drawTextLines(int x, int y, int size, int align, SDL_Color color); -static void drawTextLine(int x, int y, int size, int align, SDL_Color color, const char *line); +static void drawTextLines(int x, int y, int size, int align); +static void drawTextLine(int x, int y, int size, int align, const char *line); void calcTextDimensions(const char *text, int size, int *w, int *h); void useFont(char *name); static void initChars(Font *f); static char *nextCharacter(const char *str, int *i); static Glyph *findGlyph(char *c); -static SDL_Color white = {255, 255, 255, 255}; static char drawTextBuffer[1024]; static Font fontHead; static Font *fontTail; @@ -56,6 +55,7 @@ static void initFont(char *name, char *filename) SDL_Rect dest; Glyph *g; int i; + SDL_Color white = {255, 255, 255, 255}; f = malloc(sizeof(Font)); memset(f, 0, sizeof(Font)); @@ -156,9 +156,6 @@ void drawText(int x, int y, int size, int align, SDL_Color color, const char *fo if (activeFont) { - SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b); - SDL_SetTextureAlphaMod(activeFont->texture, color.a); - memset(&drawTextBuffer, '\0', sizeof(drawTextBuffer)); va_start(args, format); @@ -167,16 +164,34 @@ void drawText(int x, int y, int size, int align, SDL_Color color, const char *fo if (app.textWidth == 0) { - drawTextLine(x, y, size, align, color, drawTextBuffer); + SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0); + SDL_SetTextureAlphaMod(activeFont->texture, 255); + + drawTextLine(x + 2, y + 2, size, align, drawTextBuffer); + drawTextLine(x + 1, y + 1, size, align, drawTextBuffer); + + SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b); + SDL_SetTextureAlphaMod(activeFont->texture, color.a); + + drawTextLine(x, y, size, align, drawTextBuffer); } else { - drawTextLines(x, y, size, align, color); + SDL_SetTextureColorMod(activeFont->texture, 0, 0, 0); + SDL_SetTextureAlphaMod(activeFont->texture, 255); + + drawTextLines(x + 2, y + 2, size, align); + drawTextLines(x + 1, y + 1, size, align); + + SDL_SetTextureColorMod(activeFont->texture, color.r, color.g, color.b); + SDL_SetTextureAlphaMod(activeFont->texture, color.a); + + drawTextLines(x, y, size, align); } } } -static void drawTextLines(int x, int y, int size, int align, SDL_Color color) +static void drawTextLines(int x, int y, int size, int align) { char line[MAX_LINE_LENGTH], token[MAX_WORD_LENGTH]; int i, n, w, h, currentWidth, len; @@ -198,7 +213,7 @@ static void drawTextLines(int x, int y, int size, int align, SDL_Color color) if (currentWidth + w > app.textWidth) { - drawTextLine(x, y, size, align, color, line); + drawTextLine(x, y, size, align, line); currentWidth = 0; @@ -217,10 +232,10 @@ static void drawTextLines(int x, int y, int size, int align, SDL_Color color) } } - drawTextLine(x, y, size, align, color, line); + drawTextLine(x, y, size, align, line); } -static void drawTextLine(int x, int y, int size, int align, SDL_Color color, const char *line) +static void drawTextLine(int x, int y, int size, int align, const char *line) { int i, startX, n, w, h; char word[MAX_WORD_LENGTH];