Allow script to activate spawners.
This commit is contained in:
parent
0332e2fe20
commit
30fa446006
|
@ -164,6 +164,11 @@ static void executeNextLine(ScriptRunner *runner)
|
|||
{
|
||||
activateNextWaypoint(0);
|
||||
}
|
||||
else if (strcmp(command, "ACTIVATE_SPAWNERS") == 0)
|
||||
{
|
||||
sscanf(line, "%*s %[^;] %d", strParam[0], &intParam[0]);
|
||||
activateSpawner(strParam[0], intParam[0]);
|
||||
}
|
||||
else if (strcmp(command, "MSG_BOX") == 0)
|
||||
{
|
||||
sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]);
|
||||
|
|
|
@ -36,6 +36,7 @@ extern int showingMessageBoxes(void);
|
|||
extern char *getTranslatedString(char *string);
|
||||
extern void activateNextWaypoint(int id);
|
||||
extern void activateJumpgate(int activate);
|
||||
extern void activateSpawner(char *name, int active);
|
||||
|
||||
extern Battle battle;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -33,13 +33,15 @@ void doSpawners(void)
|
|||
{
|
||||
num = s->step;
|
||||
|
||||
if (s->limit)
|
||||
if (s->total != -1)
|
||||
{
|
||||
num = MIN(s->step, s->total);
|
||||
|
||||
s->total -= num;
|
||||
}
|
||||
|
||||
battle.numInitialEnemies += num;
|
||||
|
||||
for (i = 0 ; i < num ; i++)
|
||||
{
|
||||
type = s->types[rand() % s->numTypes];
|
||||
|
@ -67,3 +69,24 @@ void doSpawners(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void activateSpawner(char *names, int active)
|
||||
{
|
||||
Spawner *s;
|
||||
char *name;
|
||||
|
||||
name = strtok(names, ";");
|
||||
|
||||
while (name)
|
||||
{
|
||||
for (s = battle.spawnerHead.next ; s != NULL ; s = s->next)
|
||||
{
|
||||
if (strcmp(s->name, name) == 0)
|
||||
{
|
||||
s->active = active;
|
||||
}
|
||||
}
|
||||
|
||||
name = strtok(NULL, ";");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue