-
Notifications
You must be signed in to change notification settings - Fork 30
/
aiidle.c
executable file
·116 lines (97 loc) · 2.4 KB
/
aiidle.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#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"
#ifdef OPT_ON
#pragma optimize( "gty", on )
#endif
// Externals
extern float framelag;
/*===================================================================
Procedure : AIR Idle
Input : ENEMY * Enemy
Output : Nothing
===================================================================*/
void AI_AIR_IDLE( register ENEMY * Enemy )
{
if ( Enemy->Timer )
{
Enemy->Timer -= framelag;
if ( Enemy->Timer < 0.0F )
Enemy->Timer = 0.0F;
return;
}
// Switch to AIMODE_SCAN
Enemy->Object.AI_Mode = AIMODE_SCAN;
Enemy->Timer = RESET_SCAN_TIME + (float) Random_Range( (u_int16_t) RESET_SCAN_TIME );
}
/*===================================================================
Procedure : TURRET Idle
Input : ENEMY * Enemy
Output : Nothing
===================================================================*/
void AI_TURRET_IDLE( register ENEMY * Enemy )
{
if( Enemy->Object.Animating )
{
return;
}
if( Enemy->Object.CurAnimSeq != TURRETSEQ_Closed )
SetCurAnimSeq( TURRETSEQ_Closed, &Enemy->Object );
AI_UPDATEGUNS( Enemy );
if ( Enemy->Timer )
{
Enemy->Timer -= framelag;
if ( Enemy->Timer < 0.0F )
Enemy->Timer = 0.0F;
return;
}
// Switch to AIMODE_SCAN
AI_THINK( Enemy , true , true );
if( Enemy->AIFlags & AI_ANYPLAYERINRANGE )
{
Enemy->Object.AI_Mode = AIMODE_SCAN;
Enemy->Timer = RESET_SCAN_TIME;
}else{
Enemy->Timer = RESET_IDLE_TIME * 2.0F;
}
}
/*===================================================================
Procedure : CRAWL Idle
Input : ENEMY * Enemy
Output : Nothing
===================================================================*/
void AI_CRAWL_IDLE( register ENEMY * Enemy )
{
if( Enemy->Object.Animating )
{
return;
}
if ( Enemy->Timer )
{
Enemy->Timer -= framelag;
if ( Enemy->Timer < 0.0F )
Enemy->Timer = 0.0F;
return;
}
// Switch to AIMODE_SCAN
Enemy->Object.AI_Mode = AIMODE_SCAN;
Enemy->Timer = RESET_SCAN_TIME + (float) Random_Range( (u_int16_t) RESET_SCAN_TIME );
}
#ifdef OPT_ON
#pragma optimize( "", off )
#endif