1 //Copyright Paul Reiche, Fred Ford. 1992-2002
2 
3 /*
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 
19 #ifndef UQM_INTEL_H_
20 #define UQM_INTEL_H_
21 
22 #include "battlecontrols.h"
23 #include "controls.h"
24 #include "element.h"
25 #include "races.h"
26 
27 #if defined(__cplusplus)
28 extern "C" {
29 #endif
30 
31 #define MANEUVERABILITY(pi) ((pi)->ManeuverabilityIndex)
32 #define WEAPON_RANGE(pi) ((pi)->WeaponRange)
33 
34 #define WORLD_TO_TURN(d) ((d)>>6)
35 
36 #define CLOSE_RANGE_WEAPON DISPLAY_TO_WORLD (50)
37 #define LONG_RANGE_WEAPON DISPLAY_TO_WORLD (1000)
38 #define FAST_SHIP 150
39 #define MEDIUM_SHIP 45
40 #define SLOW_SHIP 25
41 
42 enum
43 {
44 	ENEMY_SHIP_INDEX = 0,
45 	CREW_OBJECT_INDEX,
46 	ENEMY_WEAPON_INDEX,
47 	GRAVITY_MASS_INDEX,
48 	FIRST_EMPTY_INDEX
49 };
50 
51 extern BATTLE_INPUT_STATE computer_intelligence (
52 		ComputerInputContext *context, STARSHIP *StarShipPtr);
53 extern BATTLE_INPUT_STATE tactical_intelligence (
54 		ComputerInputContext *context, STARSHIP *StarShipPtr);
55 extern void ship_intelligence (ELEMENT *ShipPtr,
56 		EVALUATE_DESC *ObjectsOfConcern, COUNT ConcernCounter);
57 extern BOOLEAN ship_weapons (ELEMENT *ShipPtr, ELEMENT *OtherPtr,
58 		COUNT margin_of_error);
59 
60 extern void Pursue (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr);
61 extern void Entice (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr);
62 extern void Avoid (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr);
63 extern BOOLEAN TurnShip (ELEMENT *ShipPtr, COUNT angle);
64 extern BOOLEAN ThrustShip (ELEMENT *ShipPtr, COUNT angle);
65 
66 
67 #define HUMAN_CONTROL (BYTE)(1 << 0)
68 #define CYBORG_CONTROL (BYTE)(1 << 1)
69 		// The computer fights the battles.
70 #define PSYTRON_CONTROL (BYTE)(1 << 2)
71 		// The computer selects the ships to fight with.
72 #define NETWORK_CONTROL (BYTE)(1 << 3)
73 #define COMPUTER_CONTROL (CYBORG_CONTROL | PSYTRON_CONTROL)
74 #define CONTROL_MASK (HUMAN_CONTROL | COMPUTER_CONTROL | NETWORK_CONTROL)
75 
76 #define STANDARD_RATING (BYTE)(1 << 4)
77 #define GOOD_RATING (BYTE)(1 << 5)
78 #define AWESOME_RATING (BYTE)(1 << 6)
79 
80 
81 #if defined(__cplusplus)
82 }
83 #endif
84 
85 #endif /* UQM_INTEL_H_ */
86