Moved alien definitions from ".dat" files to alien.cpp.
Like "scripts", these definitions in text files make absolutely no sense. They are completely unreadable, and Starfighter's engine is inflexible anyway.
This commit is contained in:
parent
e258921987
commit
16473a715f
|
@ -1,2 +0,0 @@
|
|||
0 7
|
||||
-1
|
|
@ -1,10 +0,0 @@
|
|||
14 15
|
||||
13 17
|
||||
12 18
|
||||
11 16
|
||||
10 19
|
||||
15 10
|
||||
|
||||
20 12
|
||||
21 12
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
14 22
|
||||
-1
|
|
@ -1,8 +0,0 @@
|
|||
14 15
|
||||
13 17
|
||||
12 18
|
||||
11 16
|
||||
10 19
|
||||
19 29
|
||||
20 29
|
||||
-1
|
|
@ -1,5 +0,0 @@
|
|||
10 21
|
||||
11 21
|
||||
12 21
|
||||
19 23
|
||||
-1
|
|
@ -1,7 +0,0 @@
|
|||
0 27
|
||||
1 27
|
||||
2 27
|
||||
3 27
|
||||
4 27
|
||||
14 24
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
14 24
|
||||
-1
|
|
@ -1,8 +0,0 @@
|
|||
10 31
|
||||
11 31
|
||||
12 31
|
||||
13 31
|
||||
14 30
|
||||
20 31
|
||||
21 31
|
||||
-1
|
|
@ -1,7 +0,0 @@
|
|||
0 8
|
||||
1 8
|
||||
2 8
|
||||
3 8
|
||||
4 8
|
||||
5 8
|
||||
-1
|
|
@ -1,7 +0,0 @@
|
|||
10 33
|
||||
11 33
|
||||
12 33
|
||||
13 33
|
||||
14 32
|
||||
20 33
|
||||
-1
|
|
@ -1,4 +0,0 @@
|
|||
12 37
|
||||
13 38
|
||||
14 36
|
||||
-1
|
|
@ -1,7 +0,0 @@
|
|||
9 28
|
||||
10 28
|
||||
11 28
|
||||
12 28
|
||||
13 28
|
||||
14 28
|
||||
-1
|
|
@ -1,6 +0,0 @@
|
|||
10 35
|
||||
11 35
|
||||
12 35
|
||||
13 35
|
||||
14 23
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
15 10
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
15 10
|
||||
-1
|
|
@ -1,6 +0,0 @@
|
|||
0 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
-1
|
|
@ -1,10 +0,0 @@
|
|||
0 9
|
||||
1 9
|
||||
2 9
|
||||
3 9
|
||||
4 9
|
||||
5 9
|
||||
6 9
|
||||
7 9
|
||||
8 9
|
||||
-1
|
|
@ -1,4 +0,0 @@
|
|||
12 6
|
||||
13 5
|
||||
14 4
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
0 8
|
||||
-1
|
|
@ -1,2 +0,0 @@
|
|||
19 13
|
||||
-1
|
|
@ -1,6 +0,0 @@
|
|||
20 8
|
||||
21 8
|
||||
22 8
|
||||
23 8
|
||||
24 8
|
||||
-1
|
250
src/alien.cpp
250
src/alien.cpp
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2003 Parallel Realities
|
||||
Copyright (C) 2011, 2012 Guus Sliepen
|
||||
Copyright (C) 2012, 2015 onpon4 <onpon4@riseup.net>
|
||||
Copyright (C) 2012, 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -684,13 +684,12 @@ void alien_defs_init()
|
|||
|
||||
void aliens_init()
|
||||
{
|
||||
FILE *fp;
|
||||
char string[255];
|
||||
int index;
|
||||
int alienType;
|
||||
int placeAttempt;
|
||||
int barrierSpeed;
|
||||
|
||||
engine.targetIndex = -1;
|
||||
barrierSpeed = 1;
|
||||
|
||||
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
||||
{
|
||||
aliens[i].active = false;
|
||||
|
@ -698,25 +697,166 @@ void aliens_init()
|
|||
aliens[i].flags = 0;
|
||||
}
|
||||
|
||||
engine.targetIndex = -1;
|
||||
|
||||
strcpy(string, "");
|
||||
barrierSpeed = 1;
|
||||
|
||||
sprintf(string, "data/aliens%d.dat", game.area);
|
||||
fp = fopen(string, "rb");
|
||||
|
||||
if (fp != NULL)
|
||||
switch (game.area)
|
||||
{
|
||||
while (fscanf(fp, "%d %d ", &index, &alienType) == 2)
|
||||
case MISN_START:
|
||||
aliens[0] = alien_defs[CD_TRANSPORTSHIP];
|
||||
break;
|
||||
|
||||
case MISN_CERADSE:
|
||||
aliens[0] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[1] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[2] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[3] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[4] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[5] = alien_defs[CD_CARGOSHIP];
|
||||
break;
|
||||
|
||||
case MISN_HINSTAG:
|
||||
aliens[0] = alien_defs[CD_MISSILEBOAT];
|
||||
aliens[1] = alien_defs[CD_MISSILEBOAT];
|
||||
aliens[2] = alien_defs[CD_MISSILEBOAT];
|
||||
aliens[3] = alien_defs[CD_MISSILEBOAT];
|
||||
aliens[4] = alien_defs[CD_MISSILEBOAT];
|
||||
break;
|
||||
|
||||
case MISN_JOLDAR:
|
||||
aliens[0] = alien_defs[CD_MINER];
|
||||
aliens[1] = alien_defs[CD_MINER];
|
||||
aliens[2] = alien_defs[CD_MINER];
|
||||
aliens[3] = alien_defs[CD_MINER];
|
||||
aliens[4] = alien_defs[CD_MINER];
|
||||
aliens[5] = alien_defs[CD_MINER];
|
||||
aliens[6] = alien_defs[CD_MINER];
|
||||
aliens[7] = alien_defs[CD_MINER];
|
||||
aliens[8] = alien_defs[CD_MINER];
|
||||
break;
|
||||
|
||||
case MISN_MOEBO:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_FRIGATE];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_FRIGATE_WING1];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_FRIGATE_WING2];
|
||||
break;
|
||||
|
||||
case MISN_NEROD:
|
||||
aliens[0] = alien_defs[CD_CARGOSHIP];
|
||||
break;
|
||||
|
||||
case MISN_ALLEZ:
|
||||
aliens[ALIEN_GOODTRANSPORT] = alien_defs[CD_GOODTRANSPORT];
|
||||
break;
|
||||
|
||||
case MISN_URUSOR:
|
||||
aliens[20] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[21] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[22] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[23] = alien_defs[CD_CARGOSHIP];
|
||||
aliens[24] = alien_defs[CD_CARGOSHIP];
|
||||
break;
|
||||
|
||||
case MISN_ELAMALE:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_MINEBOSS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_BOSS2_WING1];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_BOSS2_WING2];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_BOSS2_WING3];
|
||||
aliens[ALIEN_BOSS_PART4] = alien_defs[CD_BOSS2_WING4];
|
||||
aliens[ALIEN_KLINE] = alien_defs[CD_KLINE];
|
||||
aliens[20] = alien_defs[CD_SLAVETRANSPORT];
|
||||
aliens[21] = alien_defs[CD_SLAVETRANSPORT];
|
||||
break;
|
||||
|
||||
case MISN_ODEON:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_EVILURSULA];
|
||||
break;
|
||||
|
||||
case MISN_FELLON:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_MINEBOSS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_BOSS2_WING1];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_BOSS2_WING2];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_BOSS2_WING3];
|
||||
aliens[ALIEN_BOSS_PART4] = alien_defs[CD_BOSS2_WING4];
|
||||
aliens[ALIEN_GOODTRANSPORT] = alien_defs[CD_REBELCARRIER];
|
||||
aliens[20] = alien_defs[CD_REBELCARRIER];
|
||||
break;
|
||||
|
||||
case MISN_ALMARTHA:
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_CLOAKFIGHTER];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_CLOAKFIGHTER];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_CLOAKFIGHTER];
|
||||
aliens[ALIEN_GOODTRANSPORT] = alien_defs[CD_KRASS];
|
||||
break;
|
||||
|
||||
case MISN_POSWIC:
|
||||
aliens[0] = alien_defs[CD_ESCORT];
|
||||
aliens[1] = alien_defs[CD_ESCORT];
|
||||
aliens[2] = alien_defs[CD_ESCORT];
|
||||
aliens[3] = alien_defs[CD_ESCORT];
|
||||
aliens[4] = alien_defs[CD_ESCORT];
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_EXEC];
|
||||
break;
|
||||
|
||||
case MISN_ELLESH:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_EXEC];
|
||||
break;
|
||||
|
||||
case MISN_PLUTO:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_PLUTOBOSS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_BARRIER];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_BARRIER];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_BARRIER];
|
||||
aliens[ALIEN_BOSS_PART4] = alien_defs[CD_BARRIER];
|
||||
aliens[20] = alien_defs[CD_BARRIER];
|
||||
aliens[21] = alien_defs[CD_BARRIER];
|
||||
break;
|
||||
|
||||
case MISN_NEPTUNE:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_NEPTUNEBOSS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_MOBILESHIELD];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_MOBILESHIELD];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_MOBILESHIELD];
|
||||
aliens[ALIEN_BOSS_PART4] = alien_defs[CD_MOBILESHIELD];
|
||||
aliens[20] = alien_defs[CD_MOBILESHIELD];
|
||||
break;
|
||||
|
||||
case MISN_URANUS:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_URANUSBOSS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_URANUSBOSSWING1];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_URANUSBOSSWING2];
|
||||
break;
|
||||
|
||||
case MISN_SATURN:
|
||||
aliens[9] = alien_defs[CD_MOBILE_RAY];
|
||||
aliens[10] = alien_defs[CD_MOBILE_RAY];
|
||||
aliens[11] = alien_defs[CD_MOBILE_RAY];
|
||||
aliens[12] = alien_defs[CD_MOBILE_RAY];
|
||||
aliens[13] = alien_defs[CD_MOBILE_RAY];
|
||||
aliens[14] = alien_defs[CD_MOBILE_RAY];
|
||||
break;
|
||||
|
||||
case MISN_JUPITER:
|
||||
aliens[ALIEN_BOSS] = alien_defs[CD_KRASS];
|
||||
aliens[ALIEN_BOSS_PART1] = alien_defs[CD_FIREFLY];
|
||||
aliens[ALIEN_BOSS_PART2] = alien_defs[CD_FIREFLY];
|
||||
aliens[ALIEN_BOSS_PART3] = alien_defs[CD_FIREFLY];
|
||||
aliens[ALIEN_BOSS_PART4] = alien_defs[CD_FIREFLY];
|
||||
break;
|
||||
|
||||
case MISN_EARTH:
|
||||
case MISN_VENUS:
|
||||
aliens[ALIEN_KLINE] = alien_defs[CD_KLINE];
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < ALIEN_MAX ; i++)
|
||||
{
|
||||
if (aliens[i].shield != -1)
|
||||
{
|
||||
placeAttempt = 0;
|
||||
|
||||
aliens[index] = alien_defs[alienType];
|
||||
aliens[index].owner = &aliens[index];
|
||||
aliens[index].target = &aliens[index];
|
||||
aliens[index].face = rand() % 2;
|
||||
aliens[index].active = true;
|
||||
aliens[i].owner = &aliens[i];
|
||||
aliens[i].target = &aliens[i];
|
||||
aliens[i].face = rand() % 2;
|
||||
aliens[i].active = true;
|
||||
|
||||
/*
|
||||
we make 1000 attempts to place this enemy since it is required. If after
|
||||
|
@ -728,7 +868,7 @@ void aliens_init()
|
|||
{
|
||||
placeAttempt++;
|
||||
|
||||
if (alien_place(&aliens[index]))
|
||||
if (alien_place(&aliens[i]))
|
||||
break;
|
||||
|
||||
if (placeAttempt > 1000)
|
||||
|
@ -736,59 +876,58 @@ void aliens_init()
|
|||
}
|
||||
|
||||
if (game.area == MISN_CERADSE)
|
||||
cargo_add(&aliens[index], P_CARGO);
|
||||
cargo_add(&aliens[i], P_CARGO);
|
||||
else if (game.area == MISN_NEROD)
|
||||
cargo_add(&aliens[index], P_PHOEBE);
|
||||
cargo_add(&aliens[i], P_PHOEBE);
|
||||
|
||||
if (index == ALIEN_KLINE)
|
||||
if (i == ALIEN_KLINE)
|
||||
{
|
||||
aliens[ALIEN_KLINE].target = &player;
|
||||
}
|
||||
|
||||
if (aliens[index].classDef == CD_CLOAKFIGHTER)
|
||||
if (aliens[i].classDef == CD_CLOAKFIGHTER)
|
||||
{
|
||||
aliens[index].active = false;
|
||||
aliens[index].maxShield = aliens[index].shield = 400;
|
||||
aliens[index].flags &= ~FL_RUNSAWAY;
|
||||
aliens[index].speed = 3;
|
||||
aliens[i].active = false;
|
||||
aliens[i].maxShield = aliens[i].shield = 400;
|
||||
aliens[i].flags &= ~FL_RUNSAWAY;
|
||||
aliens[i].speed = 3;
|
||||
}
|
||||
|
||||
if ((aliens[index].classDef == CD_MOBILE_RAY) && (index >= 11))
|
||||
if ((aliens[i].classDef == CD_MOBILE_RAY) && (i >= 11))
|
||||
{
|
||||
aliens[index].active = false;
|
||||
aliens[i].active = false;
|
||||
}
|
||||
|
||||
if (aliens[index].classDef == CD_FIREFLY)
|
||||
if (aliens[i].classDef == CD_FIREFLY)
|
||||
{
|
||||
aliens[index].active = false;
|
||||
aliens[i].active = false;
|
||||
}
|
||||
|
||||
if (aliens[index].classDef == CD_BARRIER)
|
||||
if (aliens[i].classDef == CD_BARRIER)
|
||||
{
|
||||
aliens[index].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[index].speed = barrierSpeed;
|
||||
aliens[i].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[i].speed = barrierSpeed;
|
||||
barrierSpeed++;
|
||||
}
|
||||
|
||||
if ((game.area == MISN_POSWIC) &&
|
||||
(aliens[index].classDef == CD_BOSS))
|
||||
(aliens[i].classDef == CD_BOSS))
|
||||
{
|
||||
aliens[index].imageIndex[1] = 29;
|
||||
aliens[index].flags |= FL_IMMORTAL;
|
||||
aliens[i].imageIndex[1] = 29;
|
||||
aliens[i].flags |= FL_IMMORTAL;
|
||||
}
|
||||
|
||||
if (game.area == MISN_ELLESH)
|
||||
aliens[index].flags |= FL_HASMINIMUMSPEED;
|
||||
aliens[i].flags |= FL_HASMINIMUMSPEED;
|
||||
|
||||
if (game.area == MISN_JUPITER)
|
||||
{
|
||||
aliens[index].flags = FL_WEAPCO;
|
||||
if (index == ALIEN_BOSS)
|
||||
aliens[index].chance[1] = 5;
|
||||
aliens[i].flags = FL_WEAPCO;
|
||||
if (i == ALIEN_BOSS)
|
||||
aliens[i].chance[1] = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if (game.area == MISN_MOEBO)
|
||||
{
|
||||
|
@ -813,22 +952,22 @@ void aliens_init()
|
|||
aliens[ALIEN_BOSS].x = -screen->w / 2;
|
||||
aliens[ALIEN_BOSS].y = screen->h / 2;
|
||||
|
||||
aliens[ALIEN_BOSS_PART1].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[ALIEN_BOSS_PART1].owner = &aliens[ALIEN_BOSS_PART2];
|
||||
aliens[ALIEN_BOSS_PART1].target = &player;
|
||||
aliens[ALIEN_BOSS_PART1].dx = 15;
|
||||
aliens[ALIEN_BOSS_PART1].dy = -22;
|
||||
aliens[ALIEN_BOSS_PART1].dx = -35;
|
||||
aliens[ALIEN_BOSS_PART1].dy = -12;
|
||||
|
||||
aliens[ALIEN_BOSS_PART2].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[ALIEN_BOSS_PART2].target = &player;
|
||||
aliens[ALIEN_BOSS_PART2].dx = 15;
|
||||
aliens[ALIEN_BOSS_PART2].dy = 22;
|
||||
aliens[ALIEN_BOSS_PART2].dy = -22;
|
||||
|
||||
aliens[ALIEN_BOSS_PART3].owner = &aliens[ALIEN_BOSS_PART1];
|
||||
aliens[ALIEN_BOSS_PART3].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[ALIEN_BOSS_PART3].target = &player;
|
||||
aliens[ALIEN_BOSS_PART3].dx = -35;
|
||||
aliens[ALIEN_BOSS_PART3].dy = -12;
|
||||
aliens[ALIEN_BOSS_PART3].dx = 15;
|
||||
aliens[ALIEN_BOSS_PART3].dy = 22;
|
||||
|
||||
aliens[ALIEN_BOSS_PART4].owner = &aliens[ALIEN_BOSS_PART2];
|
||||
aliens[ALIEN_BOSS_PART4].owner = &aliens[ALIEN_BOSS_PART3];
|
||||
aliens[ALIEN_BOSS_PART4].target = &player;
|
||||
aliens[ALIEN_BOSS_PART4].dx = -35;
|
||||
aliens[ALIEN_BOSS_PART4].dy = 20;
|
||||
|
@ -854,11 +993,10 @@ void aliens_init()
|
|||
aliens[ALIEN_BOSS].y = screen->h / 2;
|
||||
|
||||
aliens[ALIEN_BOSS_PART1].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[ALIEN_BOSS_PART1].dy = 20;
|
||||
aliens[ALIEN_BOSS_PART1].dy = -16;
|
||||
|
||||
aliens[ALIEN_BOSS_PART2].owner = &aliens[ALIEN_BOSS];
|
||||
aliens[ALIEN_BOSS_PART2].dy = -16;
|
||||
}
|
||||
aliens[ALIEN_BOSS_PART2].dy = 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static const char *klineGreeting[] = {
|
|||
"Do you really think you can defeat us?!"
|
||||
};
|
||||
|
||||
void event_set()
|
||||
void events_init()
|
||||
{
|
||||
for (int i = 0 ; i < 20 ; i++)
|
||||
{
|
||||
|
@ -202,11 +202,11 @@ void event_set()
|
|||
gameEvent[2].time = 60;
|
||||
gameEvent[2].face = FACE_KRASS;
|
||||
strcpy(gameEvent[2].message, "Hey, boy, we've got company! Looks like your friends didn't do a very good job after all!");
|
||||
gameEvent[2].entity = 10;
|
||||
gameEvent[2].entity = ALIEN_BOSS_PART1;
|
||||
gameEvent[2].flag = -FL_ACTIVATE;
|
||||
|
||||
gameEvent[3].time = 90;
|
||||
gameEvent[3].entity = 11;
|
||||
gameEvent[3].entity = ALIEN_BOSS_PART2;
|
||||
gameEvent[3].flag = -FL_ACTIVATE;
|
||||
|
||||
gameEvent[4].time = 93;
|
||||
|
@ -214,7 +214,7 @@ void event_set()
|
|||
strcpy(gameEvent[4].message, "Keep those things off my back or it'll cost you extra!!!");
|
||||
|
||||
gameEvent[5].time = 120;
|
||||
gameEvent[5].entity = 12;
|
||||
gameEvent[5].entity = ALIEN_BOSS_PART3;
|
||||
gameEvent[5].flag = -FL_ACTIVATE;
|
||||
|
||||
gameEvent[6].time = 140;
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct Event_ {
|
|||
|
||||
} Event;
|
||||
|
||||
void event_set();
|
||||
void events_init();
|
||||
void event_check();
|
||||
void event_sync();
|
||||
|
||||
|
|
|
@ -2099,7 +2099,7 @@ int game_mainLoop()
|
|||
|
||||
clearInfoLines();
|
||||
|
||||
event_set();
|
||||
events_init();
|
||||
|
||||
engine.ssx = 0;
|
||||
engine.ssy = 0;
|
||||
|
|
Loading…
Reference in New Issue