ScummVM API documentation
ai_main.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef SCUMM_HE_MOONBASE_AI_MAIN_H
23#define SCUMM_HE_MOONBASE_AI_MAIN_H
24
25#include "common/array.h"
26#include "scumm/he/moonbase/ai_tree.h"
27
28namespace Scumm {
29
30class ScummEngine_v100he;
31class AIEntity;
32class patternList;
33
34enum {
35 TERRAIN_TYPE_GOOD = 0,
36 TERRAIN_TYPE_SLOPE = 1,
37 TERRAIN_TYPE_WATER = 2,
38 MAX_MEMORY = 3
39};
40
41enum {
42 ITEM_BOMB = 0,
43 ITEM_CLUSTER = 1,
44 ITEM_REPAIR = 2,
45 ITEM_ANTIAIR = 3,
46 ITEM_BRIDGE = 4,
47 ITEM_TOWER = 5,
48 ITEM_GUIDED = 6,
49 ITEM_EMP = 7,
50 ITEM_SPIKE = 8,
51 ITEM_RECLAIMER = 9,
52 ITEM_BALLOON = 10,
53 ITEM_MINE = 11,
54 ITEM_CRAWLER = 12,
55 ITEM_VIRUS = 13,
56 ITEM_ENERGY = 14,
57 ITEM_SHIELD = 15,
58 ITEM_OFFENSE = 16,
59 ITEM_HUB = 17,
60 ITEM_TIME_EXPIRED = 18,
61 SKIP_TURN = -999
62};
63
64enum BuildingTypes {
65 BUILDING_ENERGY_COLLECTOR = 3,
66 BUILDING_MAIN_BASE = 4,
67 BUILDING_BRIDGE = 5,
68 BUILDING_TOWER = 6,
69 BUILDING_EXPLOSIVE_MINE = 7,
70 BUILDING_SHIELD = 8,
71 BUILDING_ANTI_AIR = 9,
72 BUILDING_OFFENSIVE_LAUNCHER = 10,
73 BUILDING_BALLOON = 11,
74 BUILDING_CRAWLER = 12
75};
76
77enum {
78 ENERGY_POOL_X = 45,
79 ENERGY_POOL_Y = 46,
80 ENERGY_POOL_UNITS_ON = 47,
81
82 MIN_DIST = 108
83};
84
85class AI {
86public:
87 AI(ScummEngine_v100he *vm);
88
89 void resetAI();
90 void cleanUpAI();
91 void setAIType(const int paramCount, const int32 *params);
92 int masterControlProgram(const int paramCount, const int32 *params);
93
94private:
95 int chooseBehavior();
96 int chooseTarget(int behavior);
97
98 Tree *initApproachTarget(int targetX, int targetY, Node **retNode);
99 int *approachTarget(Tree *myTree, int &x, int &y, Node **currentNode);
100 Tree *initAcquireTarget(int targetX, int targetY, Node **retNode);
101 int *acquireTarget(int targetX, int targetY);
102 int *acquireTarget(int targetX, int targetY, Tree *myTree, int &errorCode);
103 int *offendTarget(int &targetX, int &targetY, int index);
104 int *defendTarget(int &targetX, int &targetY, int index);
105 int *energizeTarget(int &targetX, int &targetY, int index);
106
107public:
108 int getClosestUnit(int x, int y, int radius, int player, int alignment, int unitType, int checkUnitEnabled);
109 int getClosestUnit(int x, int y, int radius, int player, int alignment, int unitType, int checkUnitEnabled, int minDist);
110
111 int getDistance(int originX, int originY, int endX, int endY);
112 int calcAngle(int originX, int originY, int endX, int endY);
113 int calcAngle(int originX, int originY, int endX, int endY, int noWrapFlag);
114 int getTerrain(int x, int y);
115
116 int getHubX(int hub);
117 int getHubY(int hub);
118 int getMaxX();
119 int getMaxY();
120
121 int getCurrentPlayer();
122 int getMaxPower();
123 int getMinPower();
124 int getTerrainSquareSize();
125 int getBuildingOwner(int building);
126 int getBuildingState(int building);
127 int getBuildingType(int building);
128 int getBuildingArmor(int building);
129 int getBuildingMaxArmor(int building);
130 int getBuildingWorth(int building);
131 int getBuildingTeam(int building);
132
133 int getPlayerEnergy();
134 int getPlayerMaxTime();
135 int getTimerValue(int timerNum);
136 int getPlayerTeam(int player);
137
138 int getAnimSpeed();
139
140 int simulateBuildingLaunch(int x, int y, int power, int angle, int numSteps, int isEnergy);
141
142 int getPowerAngleFromPoint(int originX, int originY, int endX, int endY, int threshold, int olFlag);
143 int getPowerAngleFromPoint(int originX, int originY, int endX, int endY, int threshold);
144 int checkIfWaterState(int x, int y);
145 int getUnitsWithinRadius(int x, int y, int radius);
146
147 float degToRad(float degrees);
148
149 int getEnergyHogType();
150
151private:
152 int getEnergyPoolsArray();
153 int getCoordinateVisibility(int x, int y, int playerNum);
154 int getUnitVisibility(int unit, int playerNum);
155 int getEnergyPoolVisibility(int pool, int playerNum);
156 int getNumberOfPools();
157 int getNumberOfPlayers();
158 int getWindXSpeed();
159 int getWindYSpeed();
160 int getTotalWindSpeed();
161 int getWindXSpeedMax();
162 int getWindYSpeedMax();
163 int getBigXSize();
164 int getBigYSize();
165 int getEnergyPoolWidth(int pool);
166 int getLastAttacked(int &x, int &y);
167 int getFOW();
168 int getBuildingStackPtr();
169 int getTurnCounter();
170
171 int getGroundAltitude(int x, int y);
172 int checkForCordOverlap(int xStart, int yStart, int affectRadius, int simulateFlag);
173 int checkForAngleOverlap(int unit, int angle);
174 int estimateNextRoundEnergy(int player);
175 int checkForUnitOverlap(int x, int y, int radius, int ignoredUnit);
176 int checkForEnergySquare(int x, int y);
177 int aiChat();
178
179 int simulateWeaponLaunch(int x, int y, int power, int angle, int numSteps);
180 int fakeSimulateWeaponLaunch(int x, int y, int power, int angle);
181
182 int checkIfWaterSquare(int x, int y);
183
184 int getLandingPoint(int x, int y, int power, int angle);
185 int getEnemyUnitsVisible(int playerNum);
186
187 void limitLocation(int &a, int &b, int c, int d);
188 int energyPoolSize(int pool);
189 int getMaxCollectors(int pool);
190
191public:
192 Common::Array<int> _lastXCoord[5];
193 Common::Array<int> _lastYCoord[5];
194
195 ScummEngine_v100he *_vm;
196
197 AIEntity *_aiType[5];
198
199 int _aiState;
200 int _behavior;
201 int _energyHogType;
202
203 patternList *_moveList[5];
204
205 const int32 *_mcpParams;
206};
207
208} // End of namespace Scumm
209
210#endif
Definition: ai_types.h:61
Definition: ai_main.h:85
Definition: ai_node.h:64
Definition: ai_tree.h:42
Definition: ai_pattern.h:109
Definition: actor.h:30