Start of experimental Mission Plus mode.

This commit is contained in:
Steve 2018-05-01 08:38:46 +01:00
parent 220525d6f8
commit 6fe72e4b2a
10 changed files with 61 additions and 17 deletions

View File

@ -1,5 +1,5 @@
VERSION = 1.0 VERSION = 1.1
REVISION = 3 REVISION = 0
LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po)) LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po))
OUT = bin OUT = bin

View File

@ -252,7 +252,7 @@ static void lookForPlayer(void)
r = randF(); r = randF();
if (world.missionType == MT_OUTPOST) if (world.missionType == MT_OUTPOST || game.plus)
{ {
r = randF() * 0.65; r = randF() * 0.65;
} }

View File

@ -223,7 +223,7 @@ static void lookForPlayer(void)
r = randF(); r = randF();
if (world.missionType == MT_OUTPOST) if (world.missionType == MT_OUTPOST || game.plus)
{ {
r = randF() * 0.65; r = randF() * 0.65;
} }

View File

@ -43,14 +43,6 @@ Unit *createUnit(void)
u->oxygen = MAX_OXYGEN; u->oxygen = MAX_OXYGEN;
u->canCarryItem = rand() % 100 < 85;
if (world.missionType == MT_OUTPOST)
{
u->canCarryItem = 1;
u->health = u->healthMax = rrnd(1, 4);
}
u->spriteTime = 0; u->spriteTime = 0;
u->spriteFrame = 0; u->spriteFrame = 0;
@ -80,6 +72,14 @@ static void init(void)
u->startX = (int) u->x; u->startX = (int) u->x;
u->startY = (int) u->y; u->startY = (int) u->y;
} }
u->canCarryItem = rand() % 100 < 85;
if (world.missionType == MT_OUTPOST || game.plus)
{
u->canCarryItem = 1;
u->health = u->healthMax = rrnd(1, 4);
}
} }
static void tick(void) static void tick(void)

View File

@ -37,4 +37,5 @@ extern void playBattleSound(int snd, int ch, int x, int y);
extern int rrnd(int low, int high); extern int rrnd(int low, int high);
extern Entity *self; extern Entity *self;
extern Game game;
extern World world; extern World world;

View File

@ -111,10 +111,11 @@ static long capFrameRate(const long then)
static void handleCommandLine(int argc, char *argv[]) static void handleCommandLine(int argc, char *argv[])
{ {
int i; int i, plus;
char *worldId; char *worldId;
worldId = NULL; worldId = NULL;
plus = 0;
for (i = 1 ; i < argc ; i++) for (i = 1 ; i < argc ; i++)
{ {
@ -182,11 +183,16 @@ static void handleCommandLine(int argc, char *argv[])
initCredits(); initCredits();
return; return;
} }
if (strcmp(argv[i], "-plus") == 0)
{
plus = 1;
}
} }
if (worldId != NULL) if (worldId != NULL)
{ {
initWorldTest(worldId); initWorldTest(worldId, plus);
} }
else else
{ {

View File

@ -31,7 +31,7 @@ extern void init18N(int argc, char *argv[]);
extern void initGameSystem(void); extern void initGameSystem(void);
extern void initLookups(void); extern void initLookups(void);
extern void initSDL(void); extern void initSDL(void);
extern void initWorldTest(char *worldId); extern void initWorldTest(char *worldId, int plus);
extern void initEnding(void); extern void initEnding(void);
extern void initCredits(void); extern void initCredits(void);
extern void prepareScene(void); extern void prepareScene(void);

View File

@ -370,6 +370,7 @@ typedef struct {
char worldId[MAX_NAME_LENGTH]; char worldId[MAX_NAME_LENGTH];
int isComplete; int isComplete;
int saveSlot; int saveSlot;
int plus;
Tuple keys[MAX_KEY_TYPES]; Tuple keys[MAX_KEY_TYPES];
Tuple missionStatusHead, *missionStatusTail; Tuple missionStatusHead, *missionStatusTail;
Trophy trophyHead, *trophyTail; Trophy trophyHead, *trophyTail;

View File

@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "worldTest.h" #include "worldTest.h"
void initWorldTest(char *worldId) void initWorldTest(char *worldId, int plus)
{ {
loadGame(0); loadGame(0);
@ -29,6 +29,9 @@ void initWorldTest(char *worldId)
if (worldId != NULL) if (worldId != NULL)
{ {
STRNCPY(game.worldId, worldId, MAX_NAME_LENGTH); STRNCPY(game.worldId, worldId, MAX_NAME_LENGTH);
game.plus = 1;
initWorld(); initWorld();
} }
else else

View File

@ -25,6 +25,7 @@ static void loadTriggers(cJSON *root);
static void loadBob(cJSON *root); static void loadBob(cJSON *root);
static void loadEntities(cJSON *root); static void loadEntities(cJSON *root);
static void loadObjectives(cJSON *root); static void loadObjectives(cJSON *root);
static void initPlusEnemyTypes(void);
void loadWorld(char *id) void loadWorld(char *id)
{ {
@ -66,7 +67,14 @@ void loadWorld(char *id)
world.missionType = strncmp(world.id, "outpost", 7) == 0 ? MT_OUTPOST : world.missionType; world.missionType = strncmp(world.id, "outpost", 7) == 0 ? MT_OUTPOST : world.missionType;
world.missionType = strncmp(world.id, "boss", 4) == 0 ? MT_BOSS : world.missionType; world.missionType = strncmp(world.id, "boss", 4) == 0 ? MT_BOSS : world.missionType;
if (!game.plus)
{
loadEnemyTypes(cJSON_GetObjectItem(root, "enemyTypes")->valuestring); loadEnemyTypes(cJSON_GetObjectItem(root, "enemyTypes")->valuestring);
}
else
{
initPlusEnemyTypes();
}
loadTriggers(cJSON_GetObjectItem(root, "triggers")); loadTriggers(cJSON_GetObjectItem(root, "triggers"));
@ -176,6 +184,11 @@ static void loadEntities(cJSON *root)
{ {
self->alive = ALIVE_DEAD; self->alive = ALIVE_DEAD;
} }
if (self->type == ET_DOOR && game.plus)
{
self->alive = ALIVE_DEAD;
}
} }
} }
@ -198,5 +211,25 @@ static void loadObjectives(cJSON *root)
o->targetValue = cJSON_GetObjectItem(node, "targetValue")->valueint; o->targetValue = cJSON_GetObjectItem(node, "targetValue")->valueint;
o->currentValue = cJSON_GetObjectItem(node, "currentValue")->valueint; o->currentValue = cJSON_GetObjectItem(node, "currentValue")->valueint;
o->required = cJSON_GetObjectItem(node, "required")->valueint; o->required = cJSON_GetObjectItem(node, "required")->valueint;
if (game.plus)
{
o->required = 1;
} }
} }
}
static void initPlusEnemyTypes(void)
{
world.numEnemyTypes = 7;
world.enemyTypes = malloc(world.numEnemyTypes * sizeof(char*));
world.enemyTypes[0] = "Pistol";
world.enemyTypes[1] = "Grenade";
world.enemyTypes[2] = "MachineGun";
world.enemyTypes[3] = "Shotgun";
world.enemyTypes[4] = "Laser";
world.enemyTypes[5] = "SpreadGun";
world.enemyTypes[6] = "Plasma";
}