Unlock all missions when game is complete, for free play. Remove all cells and hearts.
This commit is contained in:
parent
8d54233df5
commit
930ca048a9
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "cell.h"
|
#include "cell.h"
|
||||||
|
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
static void init(void);
|
||||||
|
|
||||||
Entity *initCell(void)
|
Entity *initCell(void)
|
||||||
{
|
{
|
||||||
|
@ -39,11 +40,20 @@ Entity *initCell(void)
|
||||||
i->spriteFrame = 0;
|
i->spriteFrame = 0;
|
||||||
i->spriteTime = -1;
|
i->spriteTime = -1;
|
||||||
|
|
||||||
|
i->init = init;
|
||||||
i->touch = touch;
|
i->touch = touch;
|
||||||
|
|
||||||
return (Entity*)i;
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init(void)
|
||||||
|
{
|
||||||
|
if (game.isComplete)
|
||||||
|
{
|
||||||
|
self->alive = ALIVE_DEAD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void touch(Entity *other)
|
static void touch(Entity *other)
|
||||||
{
|
{
|
||||||
if (other != NULL && other->type == ET_BOB && self->alive == ALIVE_ALIVE)
|
if (other != NULL && other->type == ET_BOB && self->alive == ALIVE_ALIVE)
|
||||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static void action(void);
|
static void action(void);
|
||||||
static void touch(Entity *other);
|
static void touch(Entity *other);
|
||||||
|
static void init(void);
|
||||||
|
|
||||||
Entity *initHeart(Entity *e)
|
Entity *initHeart(Entity *e)
|
||||||
{
|
{
|
||||||
|
@ -41,11 +42,20 @@ Entity *initHeart(Entity *e)
|
||||||
i->spriteTime = -1;
|
i->spriteTime = -1;
|
||||||
|
|
||||||
i->action = action;
|
i->action = action;
|
||||||
|
i->init = init;
|
||||||
i->touch = touch;
|
i->touch = touch;
|
||||||
|
|
||||||
return (Entity*)i;
|
return (Entity*)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init(void)
|
||||||
|
{
|
||||||
|
if (game.isComplete)
|
||||||
|
{
|
||||||
|
self->alive = ALIVE_DEAD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void action(void)
|
static void action(void)
|
||||||
{
|
{
|
||||||
if (self->isOnGround)
|
if (self->isOnGround)
|
||||||
|
|
|
@ -127,6 +127,8 @@ void initHub(void)
|
||||||
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;
|
||||||
|
|
||||||
for (t = game.missionStatusHead.next ; t != NULL ; t = t->next)
|
for (t = game.missionStatusHead.next ; t != NULL ; t = t->next)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +140,13 @@ void initHub(void)
|
||||||
if (t->value.i == MS_COMPLETE)
|
if (t->value.i == MS_COMPLETE)
|
||||||
{
|
{
|
||||||
game.stats[STAT_MISSIONS_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)
|
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);
|
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 (strcmp(t->key, id) == 0)
|
||||||
{
|
{
|
||||||
if (t->value.i == MS_LOCKED)
|
if (t->value.i == MS_LOCKED || game.isComplete)
|
||||||
{
|
{
|
||||||
t->value.i = MS_INCOMPLETE;
|
t->value.i = MS_INCOMPLETE;
|
||||||
|
|
||||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Unlocked mission %s", id);
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Unlocked mission %s", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ void initObjectives(void)
|
||||||
int totalTargets;
|
int totalTargets;
|
||||||
Objective *o;
|
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);
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "world.isReturnVisit = %d", world.isReturnVisit);
|
||||||
|
|
||||||
|
|
|
@ -24,5 +24,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void setGameplayMessage(int type, char *format, ...);
|
extern void setGameplayMessage(int type, char *format, ...);
|
||||||
|
|
||||||
|
extern Game game;
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void loadWorld(char *id)
|
||||||
|
|
||||||
sprintf(filename, "%s/%s.json", app.saveDir, id);
|
sprintf(filename, "%s/%s.json", app.saveDir, id);
|
||||||
|
|
||||||
if (fileExists(filename))
|
if (!game.isComplete && fileExists(filename))
|
||||||
{
|
{
|
||||||
text = readFile(filename);
|
text = readFile(filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,6 @@ extern char *readFile(const char *filename);
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Dev dev;
|
extern Dev dev;
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
|
extern Game game;
|
||||||
extern World world;
|
extern World world;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue