-
Notifications
You must be signed in to change notification settings - Fork 30
/
aipsycho.c
executable file
·87 lines (71 loc) · 2.42 KB
/
aipsycho.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <stdio.h>
#include <math.h>
#include "main.h"
#include "new3d.h"
#include "quat.h"
#include "mload.h"
#include "compobjects.h"
#include "bgobjects.h"
#include "object.h"
#include "node.h"
#include "networking.h"
#include "ships.h"
#include "text.h"
#include "triggers.h"
#include "sphere.h"
#include "pickups.h"
#include "enemies.h"
#include "ai.h"
#include "secondary.h"
#include "primary.h"
// Externals
extern float framelag;
extern AIMDATA AimData;
extern VECTOR Forward;
extern VECTOR SlideUp;
extern PRIMARYWEAPONATTRIB PrimaryWeaponAttribs[];
extern SECONDARYWEAPONATTRIB SecondaryWeaponAttribs[];
extern MLOADHEADER Mloadheader;
/*===================================================================
Procedure : AIR Crash and burn...
Input : ENEMY * Enemy
Output : Nothing
===================================================================*/
void AI_AIR_DEATH_PSYCHO( register ENEMY * Enemy )
{
OBJECT * SObject;
VECTOR NewDir = { 0.0F, 1.0F, 0.0F };
VECTOR TempVector;
VECTOR TempUpVector;
VECTOR TempOffset = { 0.0F, 0.0F, 0.0F };
BYTE Weapon;
SObject = &Enemy->Object;
Enemy->AIFlags |= AI_ANYPLAYERINRANGE;
Enemy->Timer -= framelag;
if( (Enemy->Timer < 0.0F) || (Enemy->AIMoveFlags & AI_CONTROL_COLLISION) )
{
Enemy->Timer = 0.0F;
// Time to Die properly
CreateNewExplosion( &Enemy->Object.Pos, &NewDir, Enemy->Object.Group );
KillUsedEnemy( Enemy );
return;
}
Enemy->Object.Angle.y += (3.0F - ( 3.0F * ( ( 1.0F / ( 1.5F * 60.0F ) ) * Enemy->Timer ) ) ) * framelag;
Enemy->Object.Angle.x += (0.5F - ( 0.5F * ( ( 1.0F / ( 1.5F * 60.0F ) ) * Enemy->Timer ) ) ) * framelag;
Enemy->PrimaryFireTimer -= framelag;
if( Enemy->PrimaryFireTimer < 0.0F )
Enemy->PrimaryFireTimer = 0.0F;
if( !(Enemy->Object.Flags & SHIP_Scattered) )
{
ApplyMatrix( &SObject->Mat, &Forward, &TempVector );
ApplyMatrix( &SObject->Mat, &SlideUp, &TempUpVector );
if( (Enemy->PrimaryFireTimer == 0.0F) && ( EnemyTypes[Enemy->Type].PrimaryWeaponType != NO_PRIMARY ) )
{
Enemy->PrimaryFireTimer = EnemyTypes[Enemy->Type].PrimaryFireRate * 0.5F;
Weapon = BodgePrimaryWeapon( EnemyTypes[Enemy->Type].PrimaryWeaponType, Enemy->PickupHeld );
EnemyFirePrimary( OWNER_ENEMY, Enemy->Index, ++Enemy->BulletID, Weapon,
Enemy->Object.Group, &Enemy->Object.Pos, &TempOffset, &TempVector, &TempUpVector,
EnemyTypes[Enemy->Type].PowerLevel, (EnemyTypes[Enemy->Type].PowerLevel +1) * 33.0F, false, NULL );
}
}
}