GUIScript: Make LoadSymbol return an object.
[gemrb.git] / gemrb / core / IniSpawn.h
bloba69f44fae8149a7c335889f981798516cc280e45
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2007 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 /**
22 * @file IniSpawn.h
23 * Declares IniSpawn a class for the special creature re/spawn features
24 * PST has. The information is originally stored in <arearesref>.ini files
25 * @author The GemRB Project
28 #ifndef INISPAWN_H
29 #define INISPAWN_H
31 #include "exports.h"
32 #include "ie_types.h"
34 #include "DataFileMgr.h"
35 #include "Region.h"
37 class Map;
39 /**
40 * @struct CritterEntry
43 //critter flags
44 #define CF_IGNORECANSEE 1
45 #define CF_DEATHVAR 2
46 #define CF_NO_DIFF_1 4
47 #define CF_NO_DIFF_2 8
48 #define CF_NO_DIFF_3 16
49 #define CF_CHECKVIEWPORT 32
50 #define CF_CHECKCROWD 64
51 #define CF_SAFESTPOINT 128
52 #define CF_NO_DIFF_MASK 28
53 #define CF_CHECK_NAME 256
54 //spec ids flags
55 #define AI_EA 0
56 #define AI_FACTION 1
57 #define AI_TEAM 2
58 #define AI_GENERAL 3
59 #define AI_RACE 4
60 #define AI_CLASS 5
61 #define AI_SPECIFICS 6
62 #define AI_GENDER 7
63 #define AI_ALIGNMENT 8
65 //spawn point could be:
66 // s - single
67 // r - random
68 // e - preset
69 // save_select_point saves the spawnpoint
71 struct CritterEntry {
72 int creaturecount;
73 ieResRef *CreFile; //spawn one of these creatures
74 ieByte Spec[9]; //existance check IDS qualifier
75 ieByte SetSpec[9]; //set IDS qualifier
76 ieVariable ScriptName; //existance check scripting name
77 ieVariable SpecVar; //condition variable
78 ieResRef SpecContext; //condition variable context
79 ieResRef OverrideScript; //override override script
80 ieResRef ClassScript; //overrride class script
81 ieResRef RaceScript; //override race script
82 ieResRef GeneralScript; //override general script
83 ieResRef DefaultScript; //override default script
84 ieResRef AreaScript; //override area script
85 ieResRef SpecificScript; //override specific script
86 ieResRef Dialog; //override dialog
87 ieVariable SpawnPointVar; //spawn point saved location
88 Point SpawnPoint; //spawn point
89 int SpecVarOperator; //operation performed on spec var
90 int SpecVarValue; //using this value with the operation
91 int SpecVarInc; //add this to spec var at each spawn
92 int Orientation; //spawn orientation
93 int Flags; //CF_IGNORENOSEE, CF_DEATHVAR, etc
94 int TotalQuantity; //total number
95 int SpawnCount; //create quantity
98 /**
99 * @class SpawnEntry
101 class SpawnEntry {
102 public:
103 ieDword interval;
104 int crittercount;
105 CritterEntry *critters;
106 SpawnEntry() {
107 interval = 0;
108 crittercount = 0;
109 critters = NULL;
111 ~SpawnEntry() {
112 if (critters) {
113 for (int i=0;i<crittercount;i++) {
114 delete[] critters[i].CreFile;
116 delete[] critters;
122 * @class Spawn
123 * Class for the special creature re/spawn features that are unique to PST.
126 struct VariableSpec {
127 ieVariable Name;
128 ieDword Value;
131 class GEM_EXPORT IniSpawn {
132 public:
133 IniSpawn(Map *owner);
134 ~IniSpawn();
136 private:
137 Map *map; //owner
138 ieResRef NamelessSpawnArea;
139 int namelessvarcount;
140 VariableSpec *NamelessVar;
141 int localscount;
142 VariableSpec *Locals;
143 Point NamelessSpawnPoint;
144 int NamelessState;
145 SpawnEntry enterspawn;
146 int last_spawndate;
147 int eventcount;
148 SpawnEntry *eventspawns;
150 void ReadCreature(DataFileMgr *inifile,
151 const char *crittername, CritterEntry &critter);
152 void ReadSpawnEntry(DataFileMgr *inifile,
153 const char *entryname, SpawnEntry &entry);
154 //spawns a single creature
155 void SpawnCreature(CritterEntry &critter);
156 void SpawnGroup(SpawnEntry &event);
157 //gets the spec var operation code from a keyword
158 int GetDiffMode(const char *keyword);
159 public:
160 void InitSpawn(const ieResRef DefaultArea);
161 void RespawnNameless();
162 void InitialSpawn();
163 void CheckSpawn();
166 #endif // ! INISPAWN_H