More name updates...

This commit is contained in:
onpon4 2015-03-05 10:47:30 -05:00
parent 3f4c3b894a
commit 7ed2d1a991
6 changed files with 36 additions and 33 deletions

View File

@ -25,7 +25,7 @@ Aliens are assigned various AI types and this routine makes use of them.
Levels of aggression, defence and evasion are all here. Levels of aggression, defence and evasion are all here.
*/ */
void ai_set(object *theEnemy) void alien_setAI(object *theEnemy)
{ {
// Make friendly craft generally concentrate on smaller fighters // Make friendly craft generally concentrate on smaller fighters
if ((theEnemy->flags & FL_FRIEND) && (theEnemy->target == &enemy[WC_BOSS])) if ((theEnemy->flags & FL_FRIEND) && (theEnemy->target == &enemy[WC_BOSS]))
@ -106,7 +106,7 @@ void ai_set(object *theEnemy)
} }
} }
void ai_setKlineAttackMethod(object *theEnemy) void alien_setKlineAttackMethod(object *theEnemy)
{ {
theEnemy->maxShield -= 500; theEnemy->maxShield -= 500;
if (theEnemy->maxShield == 0) if (theEnemy->maxShield == 0)
@ -143,7 +143,7 @@ void ai_setKlineAttackMethod(object *theEnemy)
/* /*
This AI is exclusively for Kline. This AI is exclusively for Kline.
*/ */
void ai_setKline(object *theEnemy) void alien_setKlineAI(object *theEnemy)
{ {
// Weapon type change // Weapon type change
if ((rand() % 3) == 0) if ((rand() % 3) == 0)
@ -186,7 +186,7 @@ void ai_setKline(object *theEnemy)
theEnemy->flags |= FL_CIRCLES; theEnemy->flags |= FL_CIRCLES;
break; break;
default: default:
ai_set(theEnemy); alien_setAI(theEnemy);
break; break;
} }
} }

View File

@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef AI_H #ifndef AI_H
#define AI_H #define AI_H
void ai_set(object *theEnemy); void alien_setAI(object *theEnemy);
void ai_setKlineAttackMethod(object *theEnemy); void alien_setKlineAttackMethod(object *theEnemy);
void ai_setKline(object *theEnemy); void alien_setKlineAI(object *theEnemy);
#endif #endif

View File

@ -498,13 +498,16 @@ static void aliens_getPreDefined()
} }
} }
void setTarget(int index) void player_setTarget(int index)
{ {
engine.targetIndex = index; engine.targetIndex = index;
engine.targetShield = 85; engine.targetShield = 85;
engine.targetShield /= enemy[index].shield; engine.targetShield /= enemy[index].shield;
} }
// XXX: This function initializes the *spawning* of enemies, within an
// area. It is only used in one place (before the mission loop), so it
// probably should be moved over to there.
void initAliens() void initAliens()
{ {
for (int i = 0 ; i < MAX_ALIENS ; i++) for (int i = 0 ; i < MAX_ALIENS ; i++)
@ -572,7 +575,7 @@ void initAliens()
enemy[WC_KLINE].active = true; enemy[WC_KLINE].active = true;
enemy[WC_KLINE].x = player.x + 1000; enemy[WC_KLINE].x = player.x + 1000;
enemy[WC_KLINE].y = player.y; enemy[WC_KLINE].y = player.y;
setTarget(WC_KLINE); player_setTarget(WC_KLINE);
} }
if ((currentGame.system == 2) && (currentGame.experimentalShield > 0)) if ((currentGame.system == 2) && (currentGame.experimentalShield > 0))
@ -586,7 +589,7 @@ void initAliens()
enemy[10].active = true; enemy[10].active = true;
enemy[10].x = player.x - 1000; enemy[10].x = player.x - 1000;
enemy[10].y = player.y; enemy[10].y = player.y;
setTarget(10); player_setTarget(10);
enemy[10].shield = currentGame.experimentalShield; enemy[10].shield = currentGame.experimentalShield;
} }
} }
@ -623,23 +626,23 @@ void initAliens()
case 20: case 20:
case 21: case 21:
case 23: case 23:
setTarget(WC_BOSS); player_setTarget(WC_BOSS);
break; break;
case 7: case 7:
setTarget(FR_PHOEBE); player_setTarget(FR_PHOEBE);
break; break;
case 8: case 8:
setTarget(19); player_setTarget(19);
break; break;
case 9: case 9:
setTarget(FR_SID); player_setTarget(FR_SID);
break; break;
case 10: case 10:
setTarget(0); player_setTarget(0);
break; break;
case 25: case 25:
case 26: case 26:
setTarget(WC_KLINE); player_setTarget(WC_KLINE);
break; break;
default: default:
break; break;
@ -650,7 +653,7 @@ void initAliens()
"Looks" for an enemy by picking a randomly active enemy and using them "Looks" for an enemy by picking a randomly active enemy and using them
as a target. If the target is too far away, it will be ignored. as a target. If the target is too far away, it will be ignored.
*/ */
static void searchForTarget(object *theEnemy) static void alien_searchForTarget(object *theEnemy)
{ {
int i; int i;
@ -709,7 +712,7 @@ static void searchForTarget(object *theEnemy)
theEnemy->target = targetEnemy; theEnemy->target = targetEnemy;
} }
static int traceTarget(object *theEnemy) static int alien_checkTarget(object *theEnemy)
{ {
// Do various checks to see if the alien can fire at // Do various checks to see if the alien can fire at
// the target. Start with the most obvious checks. // the target. Start with the most obvious checks.
@ -752,7 +755,7 @@ static int traceTarget(object *theEnemy)
Currently only used for the allies. Whilst flying around, the allies will fire on Currently only used for the allies. Whilst flying around, the allies will fire on
any enemy craft that enter their line of sight. any enemy craft that enter their line of sight.
*/ */
static int traceView(object *theEnemy) static int alien_enemiesInFront(object *theEnemy)
{ {
object *anEnemy = enemy; object *anEnemy = enemy;
@ -926,7 +929,7 @@ static void moveAndSeparate(object *theEnemy)
Call this whenever a mission requires all the remaining aliens to Call this whenever a mission requires all the remaining aliens to
automatically die automatically die
*/ */
void killAllAliens() void mission_killAllEnemies()
{ {
for (int i = 0 ; i < MAX_ALIENS ; i++) for (int i = 0 ; i < MAX_ALIENS ; i++)
{ {
@ -1001,7 +1004,7 @@ void doAliens()
{ {
if (engine.missionCompleteTimer == 0) if (engine.missionCompleteTimer == 0)
{ {
searchForTarget(theEnemy); alien_searchForTarget(theEnemy);
} }
else else
{ {
@ -1016,9 +1019,9 @@ void doAliens()
if ((!(theEnemy->flags & FL_DISABLED)) && (theEnemy->thinktime == 0) && (theEnemy->target != theEnemy) && (theEnemy->owner == theEnemy)) if ((!(theEnemy->flags & FL_DISABLED)) && (theEnemy->thinktime == 0) && (theEnemy->target != theEnemy) && (theEnemy->owner == theEnemy))
{ {
if (theEnemy->classDef == CD_KLINE) if (theEnemy->classDef == CD_KLINE)
ai_setKline(theEnemy); alien_setKlineAI(theEnemy);
else else
ai_set(theEnemy); alien_setAI(theEnemy);
theEnemy->thinktime = (rand() % 25) * 10; theEnemy->thinktime = (rand() % 25) * 10;
@ -1114,11 +1117,11 @@ void doAliens()
(!(theEnemy->flags & FL_NOFIRE))) (!(theEnemy->flags & FL_NOFIRE)))
{ {
if ((theEnemy->target->shield > 0)) if ((theEnemy->target->shield > 0))
canFire = traceTarget(theEnemy); canFire = alien_checkTarget(theEnemy);
if (((theEnemy->thinktime % 2) == 0) && if (((theEnemy->thinktime % 2) == 0) &&
(theEnemy->flags & FL_FRIEND)) (theEnemy->flags & FL_FRIEND))
canFire = traceView(theEnemy); canFire = alien_enemiesInFront(theEnemy);
} }
else else
{ {

View File

@ -24,9 +24,9 @@ extern object defEnemy[MAX_DEFALIENS];
extern object enemy[MAX_ALIENS]; extern object enemy[MAX_ALIENS];
bool alien_add(); bool alien_add();
void setTarget(int index); void player_setTarget(int index);
void initAliens(); void initAliens();
void killAllAliens(); void mission_killAllEnemies();
void doAliens(); void doAliens();
void setAlienShapes(); void setAlienShapes();
void defineAliens(); void defineAliens();

View File

@ -621,7 +621,7 @@ void doBullets()
} }
else else
{ {
ai_setKlineAttackMethod(theEnemy); alien_setKlineAttackMethod(theEnemy);
} }
} }
} }

View File

@ -294,7 +294,7 @@ void checkTimer()
if ((currentGame.area == 24) && (currentMission.completed1[0] < OB_INCOMPLETE)) if ((currentGame.area == 24) && (currentMission.completed1[0] < OB_INCOMPLETE))
{ {
currentMission.completed1[0] = OB_COMPLETED; currentMission.completed1[0] = OB_COMPLETED;
killAllAliens(); mission_killAllEnemies();
engine.addAliens = -1; engine.addAliens = -1;
setInfoLine("*** All Primary Objectives Completed ***", FONT_GREEN); setInfoLine("*** All Primary Objectives Completed ***", FONT_GREEN);
} }
@ -492,13 +492,13 @@ static char revealHiddenObjectives()
// Activate Kline!! :) // Activate Kline!! :)
if (currentGame.area == 11) if (currentGame.area == 11)
{ {
killAllAliens(); mission_killAllEnemies();
syncScriptEvents(); syncScriptEvents();
enemy[WC_KLINE].active = true; enemy[WC_KLINE].active = true;
enemy[WC_KLINE].x = player.x + 1000; enemy[WC_KLINE].x = player.x + 1000;
enemy[WC_KLINE].y = player.y; enemy[WC_KLINE].y = player.y;
enemy[WC_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE; enemy[WC_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE;
setTarget(WC_KLINE); player_setTarget(WC_KLINE);
loadMusic("music/last_cyber_dance.ogg"); loadMusic("music/last_cyber_dance.ogg");
if ((engine.useAudio) && (engine.useMusic)) if ((engine.useAudio) && (engine.useMusic))
Mix_PlayMusic(engine.music, -1); Mix_PlayMusic(engine.music, -1);
@ -559,7 +559,7 @@ bool allMissionsCompleted()
{ {
if (currentMission.remainingObjectives2 == 0) if (currentMission.remainingObjectives2 == 0)
{ {
killAllAliens(); mission_killAllEnemies();
engine.addAliens = -1; engine.addAliens = -1;
} }
} }
@ -584,7 +584,7 @@ bool allMissionsCompleted()
// do some area specific things // do some area specific things
if ((currentGame.area == 10) && (currentMission.remainingObjectives1 == 0)) if ((currentGame.area == 10) && (currentMission.remainingObjectives1 == 0))
{ {
killAllAliens(); mission_killAllEnemies();
engine.addAliens = -1; engine.addAliens = -1;
} }
} }