Updated mission config settings.

This commit is contained in:
Steve 2018-05-12 11:50:49 +01:00
parent 181fc83632
commit 05e7fc7cad
7 changed files with 123 additions and 23 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Blob Wars : Attrition\n" "Project-Id-Version: Blob Wars : Attrition\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: ???\n"
"Last-Translator: ???\n" "Last-Translator: ???\n"
"Language-Team: ???\n" "Language-Team: ???\n"
@ -265,12 +265,18 @@ msgstr ""
msgid "Cells: %d / %d" msgid "Cells: %d / %d"
msgstr "" msgstr ""
msgid "Mission configuration"
msgstr ""
msgid "! Corrupt data" msgid "! Corrupt data"
msgstr "" msgstr ""
msgid "- empty -" msgid "- empty -"
msgstr "" 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." 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 "" msgstr ""
@ -433,9 +439,6 @@ msgstr ""
msgid "Find Teeka" msgid "Find Teeka"
msgstr "" msgstr ""
msgid "Defeat enemies"
msgstr ""
msgid "Destroy Toxic Barrels" msgid "Destroy Toxic Barrels"
msgstr "" msgstr ""

View File

@ -431,11 +431,12 @@ enum
ST_HUB_CELLS, ST_HUB_CELLS,
ST_CORRUPT_SAVE, ST_CORRUPT_SAVE,
ST_EMPTY_SAVE, ST_EMPTY_SAVE,
ST_MISSION_CONFIG,
ST_MAX ST_MAX
}; };
#define PLUS_NONE 0 #define PLUS_NONE 0
#define PLUS_BASIC (2 << 0) #define PLUS_ALL_OBJS (2 << 0)
#define PLUS_STRONGER (2 << 1) #define PLUS_STRONGER (2 << 1)
#define PLUS_RANDOM (2 << 2) #define PLUS_RANDOM (2 << 2)
#define PLUS_KILL_ALL (2 << 3) #define PLUS_KILL_ALL (2 << 3)

View File

@ -343,7 +343,8 @@ void loadGame(int slot)
} }
else 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); free(text);

View File

@ -143,7 +143,7 @@ static void draw(void)
SDL_SetTextureAlphaMod(atlasTexture->texture, 255); SDL_SetTextureAlphaMod(atlasTexture->texture, 255);
drawText(10, SCREEN_HEIGHT - 30, 16, TA_LEFT, colors.white, "Copyright 2014, 2018 Parallel Realities"); 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(); drawWidgets();

View File

@ -28,6 +28,7 @@ static HubMission *getMissionAt(int x, int y);
static void drawMissions(void); static void drawMissions(void);
static void drawInfoBar(void); static void drawInfoBar(void);
static void drawMissionInfo(void); static void drawMissionInfo(void);
static void drawPlusSettings(void);
static void logic(void); static void logic(void);
static void draw(void); static void draw(void);
static void startMission(void); static void startMission(void);
@ -44,6 +45,7 @@ static void drawHudWidgets(void);
static void awardMissionTrophies(void); static void awardMissionTrophies(void);
static void returnFromOptions(void); static void returnFromOptions(void);
void destroyHub(void); void destroyHub(void);
static void startMissionPlus(void);
static HubMission hubMissionHead; static HubMission hubMissionHead;
static HubMission *hubMissionTail; static HubMission *hubMissionTail;
@ -59,6 +61,7 @@ static PointF cursor;
static float blipSize; static float blipSize;
static float blipValue; static float blipValue;
static int showing; static int showing;
static int doPlusSettings;
static PointF cloudPos; static PointF cloudPos;
void initHub(void) void initHub(void)
@ -105,6 +108,9 @@ void initHub(void)
getWidget("ok", "stats")->action = returnFromTrophyStats; getWidget("ok", "stats")->action = returnFromTrophyStats;
getWidget("ok", "trophies")->action = returnFromTrophyStats; getWidget("ok", "trophies")->action = returnFromTrophyStats;
getWidget("startMission", "missionPlus")->action = startMissionPlus;
getWidget("cancel", "missionPlus")->action = cancel;
loadMissions(); loadMissions();
if (dev.cheatLevels) if (dev.cheatLevels)
@ -122,13 +128,15 @@ void initHub(void)
blipValue = 0; blipValue = 0;
doPlusSettings = 0;
showing = SHOW_NONE; showing = SHOW_NONE;
cursor.x = SCREEN_WIDTH / 2; cursor.x = SCREEN_WIDTH / 2;
cursor.y = SCREEN_HEIGHT / 2; cursor.y = SCREEN_HEIGHT / 2;
SDL_WarpMouseInWindow(app.window, cursor.x * app.scaleX, cursor.y * app.scaleY); 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) 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])) 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; app.mouse.button[SDL_BUTTON_LEFT] = 0;
clearControl(CONTROL_FIRE); clearControl(CONTROL_FIRE);
} }
@ -371,7 +388,15 @@ static void draw(void)
case SHOW_NONE: case SHOW_NONE:
if (selectedMission != NULL) if (selectedMission != NULL)
{ {
drawMissionInfo(); if (!doPlusSettings)
{
drawMissionInfo();
}
else
{
drawPlusSettings();
}
drawWidgets(); drawWidgets();
} }
blitRect(atlasTexture->texture, cursor.x, cursor.y, getCurrentFrame(cursorSpr), 1); 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) static void unlockMission(char *id)
{ {
Tuple *t; Tuple *t;
@ -594,6 +637,65 @@ HubMission *getMissionAt(int x, int y)
static void startMission(void) 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); STRNCPY(game.worldId, selectedMission->id, MAX_NAME_LENGTH);
saveGame(0); saveGame(0);
@ -605,14 +707,6 @@ static void startMission(void)
initWorld(); initWorld();
} }
static void cancel(void)
{
hideAllWidgets();
showing = SHOW_NONE;
selectedMission = NULL;
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
}
static void options(void) static void options(void)
{ {
initOptions(returnFromOptions); initOptions(returnFromOptions);

View File

@ -30,8 +30,8 @@ static HashTable table;
void setLanguage(char *applicationName, char *languageCode) void setLanguage(char *applicationName, char *languageCode)
{ {
char language[MAX_LINE_LENGTH]; char language[MAX_DESCRIPTION_LENGTH], c[MAX_LINE_LENGTH];
char **key, **value, *c; char **key, **value;
#ifndef _WIN32 #ifndef _WIN32
char *lang; char *lang;
#endif #endif
@ -54,7 +54,7 @@ void setLanguage(char *applicationName, char *languageCode)
if (c[0] != '\0') 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); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, c, MAX_LINE_LENGTH);
@ -68,14 +68,14 @@ void setLanguage(char *applicationName, char *languageCode)
#else #else
if ((lang = getenv("LC_ALL")) || (lang = getenv("LC_CTYPE")) || (lang = getenv("LANG"))) 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 #endif
} }
else else
{ {
STRNCPY(language, languageCode, MAX_LINE_LENGTH); STRNCPY(language, languageCode, MAX_DESCRIPTION_LENGTH);
} }
strtok(language, "."); strtok(language, ".");

View File

@ -93,6 +93,7 @@ void initStrings(void)
app.strings[ST_HUB_KEYS] = _("Keys: %d / %d"); app.strings[ST_HUB_KEYS] = _("Keys: %d / %d");
app.strings[ST_HUB_HEARTS] = _("Hearts: %d / %d"); app.strings[ST_HUB_HEARTS] = _("Hearts: %d / %d");
app.strings[ST_HUB_CELLS] = _("Cells: %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_CORRUPT_SAVE] = _("! Corrupt data");
app.strings[ST_EMPTY_SAVE] = _("- empty -"); app.strings[ST_EMPTY_SAVE] = _("- empty -");