diff --git a/src/battle/entities.c b/src/battle/entities.c index fe1c37c..4fbc235 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -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; diff --git a/src/battle/locations.c b/src/battle/locations.c index c01d0c9..ad8ce9c 100644 --- a/src/battle/locations.c +++ b/src/battle/locations.c @@ -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; diff --git a/src/battle/script.c b/src/battle/script.c index 4d4e60b..15c1d73 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -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); diff --git a/src/battle/script.h b/src/battle/script.h index 8b07f1d..ca63782 100644 --- a/src/battle/script.h +++ b/src/battle/script.h @@ -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;