Start of experimental Mission Plus mode.
This commit is contained in:
parent
220525d6f8
commit
6fe72e4b2a
|
@ -1,5 +1,5 @@
|
|||
VERSION = 1.0
|
||||
REVISION = 3
|
||||
VERSION = 1.1
|
||||
REVISION = 0
|
||||
LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po))
|
||||
|
||||
OUT = bin
|
||||
|
|
|
@ -252,7 +252,7 @@ static void lookForPlayer(void)
|
|||
|
||||
r = randF();
|
||||
|
||||
if (world.missionType == MT_OUTPOST)
|
||||
if (world.missionType == MT_OUTPOST || game.plus)
|
||||
{
|
||||
r = randF() * 0.65;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ static void lookForPlayer(void)
|
|||
|
||||
r = randF();
|
||||
|
||||
if (world.missionType == MT_OUTPOST)
|
||||
if (world.missionType == MT_OUTPOST || game.plus)
|
||||
{
|
||||
r = randF() * 0.65;
|
||||
}
|
||||
|
|
|
@ -43,14 +43,6 @@ Unit *createUnit(void)
|
|||
|
||||
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->spriteFrame = 0;
|
||||
|
||||
|
@ -80,6 +72,14 @@ static void init(void)
|
|||
u->startX = (int) u->x;
|
||||
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)
|
||||
|
|
|
@ -37,4 +37,5 @@ extern void playBattleSound(int snd, int ch, int x, int y);
|
|||
extern int rrnd(int low, int high);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
extern World world;
|
||||
|
|
10
src/main.c
10
src/main.c
|
@ -111,10 +111,11 @@ static long capFrameRate(const long then)
|
|||
|
||||
static void handleCommandLine(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int i, plus;
|
||||
char *worldId;
|
||||
|
||||
worldId = NULL;
|
||||
plus = 0;
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
{
|
||||
|
@ -182,11 +183,16 @@ static void handleCommandLine(int argc, char *argv[])
|
|||
initCredits();
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "-plus") == 0)
|
||||
{
|
||||
plus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (worldId != NULL)
|
||||
{
|
||||
initWorldTest(worldId);
|
||||
initWorldTest(worldId, plus);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ extern void init18N(int argc, char *argv[]);
|
|||
extern void initGameSystem(void);
|
||||
extern void initLookups(void);
|
||||
extern void initSDL(void);
|
||||
extern void initWorldTest(char *worldId);
|
||||
extern void initWorldTest(char *worldId, int plus);
|
||||
extern void initEnding(void);
|
||||
extern void initCredits(void);
|
||||
extern void prepareScene(void);
|
||||
|
|
|
@ -370,6 +370,7 @@ typedef struct {
|
|||
char worldId[MAX_NAME_LENGTH];
|
||||
int isComplete;
|
||||
int saveSlot;
|
||||
int plus;
|
||||
Tuple keys[MAX_KEY_TYPES];
|
||||
Tuple missionStatusHead, *missionStatusTail;
|
||||
Trophy trophyHead, *trophyTail;
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "worldTest.h"
|
||||
|
||||
void initWorldTest(char *worldId)
|
||||
void initWorldTest(char *worldId, int plus)
|
||||
{
|
||||
loadGame(0);
|
||||
|
||||
|
@ -29,6 +29,9 @@ void initWorldTest(char *worldId)
|
|||
if (worldId != NULL)
|
||||
{
|
||||
STRNCPY(game.worldId, worldId, MAX_NAME_LENGTH);
|
||||
|
||||
game.plus = 1;
|
||||
|
||||
initWorld();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -25,6 +25,7 @@ static void loadTriggers(cJSON *root);
|
|||
static void loadBob(cJSON *root);
|
||||
static void loadEntities(cJSON *root);
|
||||
static void loadObjectives(cJSON *root);
|
||||
static void initPlusEnemyTypes(void);
|
||||
|
||||
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, "boss", 4) == 0 ? MT_BOSS : world.missionType;
|
||||
|
||||
if (!game.plus)
|
||||
{
|
||||
loadEnemyTypes(cJSON_GetObjectItem(root, "enemyTypes")->valuestring);
|
||||
}
|
||||
else
|
||||
{
|
||||
initPlusEnemyTypes();
|
||||
}
|
||||
|
||||
loadTriggers(cJSON_GetObjectItem(root, "triggers"));
|
||||
|
||||
|
@ -176,6 +184,11 @@ static void loadEntities(cJSON *root)
|
|||
{
|
||||
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->currentValue = cJSON_GetObjectItem(node, "currentValue")->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";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue