diff --git a/locale/blobwarsAttrition.pot b/locale/blobwarsAttrition.pot index a3c3c66..5c2af4d 100644 --- a/locale/blobwarsAttrition.pot +++ b/locale/blobwarsAttrition.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Blob Wars : Attrition\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-29 07:46:49+0100\n" +"POT-Creation-Date: 2018-05-12 11:50:05+0100\n" "PO-Revision-Date: ???\n" "Last-Translator: ???\n" "Language-Team: ???\n" @@ -265,12 +265,18 @@ msgstr "" msgid "Cells: %d / %d" msgstr "" +msgid "Mission configuration" +msgstr "" + msgid "! Corrupt data" msgstr "" msgid "- empty -" msgstr "" +msgid "Defeat enemies" +msgstr "" + msgid "This is an information point. Bob can stand by them for a few moments to see what they have to say. There are many scattered throughout this tutorial map, to help you learn how to play. They will also appear from time to time during the actual game. Stand by them for a short time, to get more information. If you get lost, tap the radar icon in the top left, to view a map of the local area." msgstr "" @@ -433,9 +439,6 @@ msgstr "" msgid "Find Teeka" msgstr "" -msgid "Defeat enemies" -msgstr "" - msgid "Destroy Toxic Barrels" msgstr "" diff --git a/src/defs.h b/src/defs.h index 3161543..80207c3 100644 --- a/src/defs.h +++ b/src/defs.h @@ -431,11 +431,12 @@ enum ST_HUB_CELLS, ST_CORRUPT_SAVE, ST_EMPTY_SAVE, + ST_MISSION_CONFIG, ST_MAX }; #define PLUS_NONE 0 -#define PLUS_BASIC (2 << 0) +#define PLUS_ALL_OBJS (2 << 0) #define PLUS_STRONGER (2 << 1) #define PLUS_RANDOM (2 << 2) #define PLUS_KILL_ALL (2 << 3) diff --git a/src/game/game.c b/src/game/game.c index bb1cac5..a0eecf0 100644 --- a/src/game/game.c +++ b/src/game/game.c @@ -343,7 +343,8 @@ void loadGame(int slot) } else { - printf("Corrupt save file\n"); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Corrupt save file: %s", filename); + exit(1); } free(text); diff --git a/src/game/title.c b/src/game/title.c index 61d957b..13043f6 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -143,7 +143,7 @@ static void draw(void) SDL_SetTextureAlphaMod(atlasTexture->texture, 255); drawText(10, SCREEN_HEIGHT - 30, 16, TA_LEFT, colors.white, "Copyright 2014, 2018 Parallel Realities"); - drawText(SCREEN_WIDTH - 10, SCREEN_HEIGHT - 30, 16, TA_RIGHT, colors.white, "Version %.2f.%d", VERSION, REVISION); + drawText(SCREEN_WIDTH - 10, SCREEN_HEIGHT - 30, 16, TA_RIGHT, colors.white, "Version %.1f.%d", VERSION, REVISION); drawWidgets(); diff --git a/src/hub/hub.c b/src/hub/hub.c index 4c9c25e..149ca13 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -28,6 +28,7 @@ static HubMission *getMissionAt(int x, int y); static void drawMissions(void); static void drawInfoBar(void); static void drawMissionInfo(void); +static void drawPlusSettings(void); static void logic(void); static void draw(void); static void startMission(void); @@ -44,6 +45,7 @@ static void drawHudWidgets(void); static void awardMissionTrophies(void); static void returnFromOptions(void); void destroyHub(void); +static void startMissionPlus(void); static HubMission hubMissionHead; static HubMission *hubMissionTail; @@ -59,6 +61,7 @@ static PointF cursor; static float blipSize; static float blipValue; static int showing; +static int doPlusSettings; static PointF cloudPos; void initHub(void) @@ -105,6 +108,9 @@ void initHub(void) getWidget("ok", "stats")->action = returnFromTrophyStats; getWidget("ok", "trophies")->action = returnFromTrophyStats; + getWidget("startMission", "missionPlus")->action = startMissionPlus; + getWidget("cancel", "missionPlus")->action = cancel; + loadMissions(); if (dev.cheatLevels) @@ -122,13 +128,15 @@ void initHub(void) blipValue = 0; + doPlusSettings = 0; + showing = SHOW_NONE; cursor.x = SCREEN_WIDTH / 2; cursor.y = SCREEN_HEIGHT / 2; SDL_WarpMouseInWindow(app.window, cursor.x * app.scaleX, cursor.y * app.scaleY); - game.isComplete = 0; + game.isComplete = 1; for (t = game.missionStatusHead.next ; t != NULL ; t = t->next) { @@ -345,7 +353,16 @@ static void doMissionInfo(void) if ((w != NULL) && (isControl(CONTROL_FIRE) || app.mouse.button[SDL_BUTTON_LEFT])) { - w->action(); + if (w->type == WT_BUTTON) + { + w->action(); + } + else if (w->type == WT_SPINNER) + { + /* assuming there are only two options */ + w->value[0] = !w->value[0]; + } + app.mouse.button[SDL_BUTTON_LEFT] = 0; clearControl(CONTROL_FIRE); } @@ -371,7 +388,15 @@ static void draw(void) case SHOW_NONE: if (selectedMission != NULL) { - drawMissionInfo(); + if (!doPlusSettings) + { + drawMissionInfo(); + } + else + { + drawPlusSettings(); + } + drawWidgets(); } blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1); @@ -494,6 +519,24 @@ static void drawMissionInfo(void) } } +static void drawPlusSettings(void) +{ + int w, h, x, y; + + w = 800; + h = 550; + x = (SCREEN_WIDTH - w) / 2; + y = (SCREEN_HEIGHT - h) / 2; + + drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 128); + + drawRect(x, y, w, h, 0, 0, 0, 192); + drawOutlineRect(x, y, w, h, 255, 255, 255, 255); + + drawText(SCREEN_WIDTH / 2, y + 25, 32, TA_CENTER, colors.white, selectedMission->name); + drawText(SCREEN_WIDTH / 2, y + 75, 24, TA_CENTER, colors.white, app.strings[ST_MISSION_CONFIG]); +} + static void unlockMission(char *id) { Tuple *t; @@ -594,6 +637,65 @@ HubMission *getMissionAt(int x, int y) static void startMission(void) { + if (!game.isComplete) + { + STRNCPY(game.worldId, selectedMission->id, MAX_NAME_LENGTH); + + saveGame(0); + + stopMusic(); + + destroyHub(); + + initWorld(); + } + else + { + hideAllWidgets(); + + showWidgetGroup("missionPlus"); + + doPlusSettings = 1; + } +} + +static void cancel(void) +{ + hideAllWidgets(); + showing = SHOW_NONE; + selectedMission = NULL; + app.keyboard[SDL_SCANCODE_ESCAPE] = 0; +} + +static void startMissionPlus(void) +{ + game.plus = 0; + + if (getWidget("allObjectives", "missionPlus")->value[0]) + { + game.plus |= PLUS_ALL_OBJS; + } + + if (getWidget("randomEnemies", "missionPlus")->value[0]) + { + game.plus |= PLUS_RANDOM; + } + + if (getWidget("tougherEnemies", "missionPlus")->value[0]) + { + game.plus |= PLUS_STRONGER; + } + + if (getWidget("defeatAllEnemies", "missionPlus")->value[0]) + { + game.plus |= PLUS_KILL_ALL; + } + + if (getWidget("mirrorWorld", "missionPlus")->value[0]) + { + game.plus |= PLUS_MIRROR; + } + STRNCPY(game.worldId, selectedMission->id, MAX_NAME_LENGTH); saveGame(0); @@ -605,14 +707,6 @@ static void startMission(void) initWorld(); } -static void cancel(void) -{ - hideAllWidgets(); - showing = SHOW_NONE; - selectedMission = NULL; - app.keyboard[SDL_SCANCODE_ESCAPE] = 0; -} - static void options(void) { initOptions(returnFromOptions); diff --git a/src/system/i18n.c b/src/system/i18n.c index e5af69b..861c815 100644 --- a/src/system/i18n.c +++ b/src/system/i18n.c @@ -30,8 +30,8 @@ static HashTable table; void setLanguage(char *applicationName, char *languageCode) { - char language[MAX_LINE_LENGTH]; - char **key, **value, *c; + char language[MAX_DESCRIPTION_LENGTH], c[MAX_LINE_LENGTH]; + char **key, **value; #ifndef _WIN32 char *lang; #endif @@ -54,7 +54,7 @@ void setLanguage(char *applicationName, char *languageCode) if (c[0] != '\0') { - STRNCPY(language, c, MAX_LINE_LENGTH); + STRNCPY(language, c, MAX_DESCRIPTION_LENGTH); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH); @@ -68,14 +68,14 @@ void setLanguage(char *applicationName, char *languageCode) #else if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG"))) { - STRNCPY(language, lang, MAX_LINE_LENGTH); + STRNCPY(language, lang, MAX_DESCRIPTION_LENGTH); } #endif } else { - STRNCPY(language, languageCode, MAX_LINE_LENGTH); + STRNCPY(language, languageCode, MAX_DESCRIPTION_LENGTH); } strtok(language, "."); diff --git a/src/system/strings.c b/src/system/strings.c index a6bfa78..7cafe13 100644 --- a/src/system/strings.c +++ b/src/system/strings.c @@ -93,6 +93,7 @@ void initStrings(void) app.strings[ST_HUB_KEYS] = _("Keys: %d / %d"); app.strings[ST_HUB_HEARTS] = _("Hearts: %d / %d"); app.strings[ST_HUB_CELLS] = _("Cells: %d / %d"); + app.strings[ST_MISSION_CONFIG] = _("Mission configuration"); app.strings[ST_CORRUPT_SAVE] = _("! Corrupt data"); app.strings[ST_EMPTY_SAVE] = _("- empty -");