From 24f677236afc23600737214ab391c5d8c54d0183 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 15 May 2018 08:32:16 +0100 Subject: [PATCH] Removed all objectives tweak, replaced with No Doors. Tweaks to item and pushblock mirroring. Other minor mission tweak fixes. --- src/defs.h | 2 +- src/entities/items/item.c | 5 +++++ src/entities/structures/door.c | 2 +- src/entities/structures/pushBlock.h | 1 + src/hub/hub.c | 5 +++-- src/world/entities.c | 16 ++++++++++++++++ src/world/objectives.c | 4 ++-- 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/defs.h b/src/defs.h index 12cca9c..df50fa6 100644 --- a/src/defs.h +++ b/src/defs.h @@ -440,7 +440,7 @@ enum }; #define PLUS_NONE 0 -#define PLUS_ALL_OBJS (2 << 0) +#define PLUS_NO_DOORS (2 << 0) #define PLUS_STRONGER (2 << 1) #define PLUS_RANDOM (2 << 2) #define PLUS_KILL_ALL (2 << 3) diff --git a/src/entities/items/item.c b/src/entities/items/item.c index 96d444c..ea873cf 100644 --- a/src/entities/items/item.c +++ b/src/entities/items/item.c @@ -247,6 +247,11 @@ static void load(cJSON *root) { i->collected = cJSON_GetObjectItem(root, "collected")->valueint; } + + if (game.plus & PLUS_MIRROR) + { + i->startX = MAP_PIXEL_WIDTH - i->startX; + } } static void save(cJSON *root) diff --git a/src/entities/structures/door.c b/src/entities/structures/door.c index 97fb451..5cda02a 100644 --- a/src/entities/structures/door.c +++ b/src/entities/structures/door.c @@ -77,7 +77,7 @@ static void init(void) s->closedY = s->y; } - if (game.plus & PLUS_ALL_OBJS) + if (game.plus & PLUS_NO_DOORS) { s->alive = ALIVE_DEAD; } diff --git a/src/entities/structures/pushBlock.h b/src/entities/structures/pushBlock.h index f841176..0e29edb 100644 --- a/src/entities/structures/pushBlock.h +++ b/src/entities/structures/pushBlock.h @@ -28,3 +28,4 @@ extern void playBattleSound(int snd, int ch, int x, int y); extern int rrnd(int low, int high); extern Entity *self; +extern Game game; diff --git a/src/hub/hub.c b/src/hub/hub.c index 149ca13..441ae68 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -664,6 +664,7 @@ static void cancel(void) hideAllWidgets(); showing = SHOW_NONE; selectedMission = NULL; + doPlusSettings = 0; app.keyboard[SDL_SCANCODE_ESCAPE] = 0; } @@ -671,9 +672,9 @@ static void startMissionPlus(void) { game.plus = 0; - if (getWidget("allObjectives", "missionPlus")->value[0]) + if (getWidget("noDoors", "missionPlus")->value[0]) { - game.plus |= PLUS_ALL_OBJS; + game.plus |= PLUS_NO_DOORS; } if (getWidget("randomEnemies", "missionPlus")->value[0]) diff --git a/src/world/entities.c b/src/world/entities.c index b513104..f2eb4b3 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -1146,6 +1146,7 @@ static int drawComparator(const void *a, const void *b) static void mirror(void) { Structure *s; + Item *i; if (self->flags & EF_MIRROR) { @@ -1174,6 +1175,21 @@ static void mirror(void) s->tx -= self->w; break; + case ET_PUSHBLOCK: + s = (Structure*)self; + if (s->x != s->startX) + { + s->startX = s->x; + s->startX -= self->w; + } + break; + + case ET_ITEM: + case ET_KEY: + i = (Item*)self; + i->startX -= self->w; + break; + default: break; } diff --git a/src/world/objectives.c b/src/world/objectives.c index 0346da5..ed9e036 100644 --- a/src/world/objectives.c +++ b/src/world/objectives.c @@ -52,10 +52,10 @@ void initObjectives(void) } } - if (world.isReturnVisit || game.plus & PLUS_ALL_OBJS) + if (world.isReturnVisit) { o->targetValue = o->totalValue; - o->required = game.plus & PLUS_ALL_OBJS; + o->required = game.isComplete; } if ((strcmp(o->targetName, "ENEMY") == 0 && o->targetValue == o->totalValue) || game.plus & PLUS_KILL_ALL)