Added Christabel-specific functions.

This commit is contained in:
Steve 2016-05-05 10:01:07 +01:00
parent 7ebfa8020f
commit 62d35ae7e8
4 changed files with 57 additions and 1 deletions

View File

@ -634,6 +634,20 @@ static int drawComparator(const void *a, const void *b)
return e2->type - e1->type;
}
void killEntity(char *name)
{
Entity *e;
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
{
if (strcmp(e->name, name) == 0)
{
e->health = 0;
e->deathType = DT_INSTANT;
}
}
}
void destroyEntities(void)
{
Entity *e;

View File

@ -75,6 +75,37 @@ void activateLocations(char *locations)
}
}
/*
* Literally only used when Christabel's shuttle is disabled
*/
void createChristabelLocation(void)
{
Location *l;
Entity *e;
for (e = battle.entityHead.next ; e != NULL ; e = e->next)
{
if (strcmp(e->name, "Christabel") == 0)
{
l = malloc(sizeof(Location));
memset(l, 0, sizeof(Location));
battle.locationTail->next = l;
battle.locationTail = l;
STRNCPY(l->name, "CristabelLocation", MAX_NAME_LENGTH);
l->x = e->x;
l->y = e->y;
l->size = 250;
l->active = 0;
l->x -= l->size / 2;
l->y -= l->size / 2;
return;
}
}
}
void loadLocations(cJSON *node)
{
int active;

View File

@ -183,7 +183,7 @@ void runScriptTimeFunctions(void)
static void executeNextLine(ScriptRunner *runner)
{
char *line;
char command[24];
char command[32];
char strParam[3][256];
int intParam[2];
@ -269,6 +269,15 @@ static void executeNextLine(ScriptRunner *runner)
battle.isEpic = 0;
retreatEnemies();
}
else if (strcmp(command, "CREATE_CRISTABEL_LOCATION") == 0)
{
createChristabelLocation();
}
else if (strcmp(command, "KILL_ENTITY") == 0)
{
sscanf(line, "%*s %[^\n]", strParam[0]);
killEntity(strParam[0]);
}
else
{
printf("ERROR: Unrecognised script command '%s'\n", command);

View File

@ -38,6 +38,8 @@ extern void activateNextWaypoint(void);
extern void activateJumpgate(int activate);
extern void activateSpawner(char *name, int active);
extern void completeAllObjectives(void);
extern void createChristabelLocation(void);
extern void killEntity(char *name);
extern Battle battle;
extern Colors colors;