Unlock all missions when game is complete, for free play. Remove all cells and hearts.

This commit is contained in:
Steve 2018-03-16 08:29:13 +00:00
parent 8d54233df5
commit 930ca048a9
7 changed files with 40 additions and 5 deletions

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cell.h"
static void touch(Entity *other);
static void init(void);
Entity *initCell(void)
{
@ -39,11 +40,20 @@ Entity *initCell(void)
i->spriteFrame = 0;
i->spriteTime = -1;
i->init = init;
i->touch = touch;
return (Entity*)i;
}
static void init(void)
{
if (game.isComplete)
{
self->alive = ALIVE_DEAD;
}
}
static void touch(Entity *other)
{
if (other != NULL && other->type == ET_BOB && self->alive == ALIVE_ALIVE)

View File

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void action(void);
static void touch(Entity *other);
static void init(void);
Entity *initHeart(Entity *e)
{
@ -41,11 +42,20 @@ Entity *initHeart(Entity *e)
i->spriteTime = -1;
i->action = action;
i->init = init;
i->touch = touch;
return (Entity*)i;
}
static void init(void)
{
if (game.isComplete)
{
self->alive = ALIVE_DEAD;
}
}
static void action(void)
{
if (self->isOnGround)

View File

@ -128,6 +128,8 @@ void initHub(void)
cursor.y = SCREEN_HEIGHT / 2;
SDL_WarpMouseInWindow(app.window, cursor.x * app.scaleX, cursor.y * app.scaleY);
game.isComplete = 0;
for (t = game.missionStatusHead.next ; t != NULL ; t = t->next)
{
if (t->value.i != MS_INCOMPLETE)
@ -138,6 +140,13 @@ void initHub(void)
if (t->value.i == MS_COMPLETE)
{
game.stats[STAT_MISSIONS_COMPLETE]++;
if (strcmp(t->key, "teeka") == 0)
{
game.isComplete = 1;
unlockTeeka = 0;
}
}
}
@ -166,7 +175,11 @@ void initHub(void)
for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next)
{
if (mission->status == MS_MISSING_HEART_CELL)
if (game.isComplete)
{
STRNCPY(mission->description, _("As the game is now complete, free play for this mission has been unlocked."), MAX_DESCRIPTION_LENGTH);
}
else if (mission->status == MS_MISSING_HEART_CELL)
{
STRNCPY(mission->description, _("All objectives for this misson have been completed. However, there is a Cell or a Heart left to find. See if you can locate it."), MAX_DESCRIPTION_LENGTH);
}
@ -483,9 +496,10 @@ static void unlockMission(char *id)
{
if (strcmp(t->key, id) == 0)
{
if (t->value.i == MS_LOCKED)
if (t->value.i == MS_LOCKED || game.isComplete)
{
t->value.i = MS_INCOMPLETE;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Unlocked mission %s", id);
}

View File

@ -27,7 +27,7 @@ void initObjectives(void)
int totalTargets;
Objective *o;
world.isReturnVisit = world.currentStatus == MS_PARTIAL || world.currentStatus == MS_MISSING_HEART_CELL;
world.isReturnVisit = world.currentStatus == MS_PARTIAL || world.currentStatus == MS_MISSING_HEART_CELL || game.isComplete;
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "world.isReturnVisit = %d", world.isReturnVisit);

View File

@ -24,5 +24,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern void setGameplayMessage(int type, char *format, ...);
extern Game game;
extern World world;

View File

@ -40,7 +40,7 @@ void loadWorld(char *id)
sprintf(filename, "%s/%s.json", app.saveDir, id);
if (fileExists(filename))
if (!game.isComplete && fileExists(filename))
{
text = readFile(filename);
}

View File

@ -28,5 +28,6 @@ extern char *readFile(const char *filename);
extern App app;
extern Dev dev;
extern Entity *self;
extern Game game;
extern World world;