World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Decoration.cpp
См. документацию.
2 
3 #include <cstdlib>
4 
5 #include "../../Party.h"
6 #include "Engine/Engine.h"
7 
8 std::array<LevelDecoration, 3000> pLevelDecorations;
11 
12 //----- (004583B0) --------------------------------------------------------
13 LevelDecoration::LevelDecoration() { memset(this, 0, sizeof(*this)); }
14 
15 //----- (00450929) --------------------------------------------------------
17  // LevelDecoration *v1; // esi@1
18  // signed int v2; // eax@1
19  // int v3; // eax@5
20  // int v4; // eax@6
21  // int v5; // eax@7
22  // int v6; // eax@8
23  // int v7; // eax@9
24  // int result; // eax@14
25  // int v9; // eax@18
26  // int v10; // eax@19
27  // int v11; // eax@20
28  // int v12; // eax@21
29  // int v13; // eax@22
30 
31  switch (uDecorationDescID) {
32  case 0:
33  case 1:
34  case 2:
35  case 3:
36  return 0;
37 
38  case 4:
39  return 16; // dec01 "Trash Pile"
40  case 5:
41  return 32; // dec02 "Campfire"
42  case 6:
43  return 12 + rand() % 4; // dec03 "Cauldron"
44  case 7:
45  case 8:
46  case 9:
47  case 10:
48  return 0;
49 
50  case 11:
51  return 34; // dec08 "Fruit plate"
52  case 12:
53  return 0;
54 
55  case 13:
56  return 17; // dec10 "Trash Pile"
57  case 14:
58  return 18; // dec11 "Filth"
59  case 15:
60  case 16:
61  case 17:
62  case 18:
63  case 19:
64  case 20:
65  case 21:
66  case 22:
67  case 23:
68  return 0;
69 
70  case 24:
71  return 36; // dec21 "Keg"
72  case 25:
73  case 26:
74  case 27:
75  case 28:
76  case 29:
77  case 30:
78  case 31:
79  case 32:
80  case 33:
81  return 0;
82 
83  case 34:
84  return 4 + rand() % 6; // dec32 "Barrel"
85  case 35:
86  case 36:
87  case 37:
88  case 38:
89  case 39:
90  case 40:
91  case 41:
92  case 42:
93  case 43:
94  case 44:
95  case 45:
96  case 46:
97  case 47:
98  case 48:
99  case 49:
100  case 50:
101  case 51:
102  case 52:
103  case 53:
104  case 54:
105  case 55:
106  case 56:
107  case 57:
108  case 58:
109  case 59:
110  case 60:
111  case 61:
112  case 62:
113  case 63:
114  case 64:
115  case 65:
116  case 66:
117  case 67:
118  case 68:
119  case 69:
120  case 70:
121  case 71:
122  case 72:
123  case 73:
124  case 74:
125  case 75:
126  case 76:
127  case 77:
128  case 78:
129  case 79:
130  case 80:
131  case 81:
132  case 82:
133  case 83:
134  case 84:
135  case 85:
136  case 86:
137  case 87:
138  case 88:
139  case 89:
140  case 90:
141  case 91:
142  case 92:
143  case 93:
144  case 94:
145  case 95:
146  case 96:
147  case 97:
148  case 98:
149  case 99:
150  case 100:
151  case 101:
152  case 102:
153  case 103:
154  case 104:
155  case 105:
156  case 106:
157  case 107:
158  case 108:
159  case 109:
160  case 110:
161  case 111:
162  case 112:
163  case 113:
164  case 114:
165  case 115:
166  case 116:
167  case 117:
168  case 118:
169  case 119:
170  case 120:
171  case 121:
172  case 122:
173  case 123:
174  case 124:
175  case 125:
176  case 126:
177  case 127:
178  case 128:
179  case 129:
180  case 130:
181  case 131:
182  case 132:
183  case 133:
184  case 134:
185  case 135:
186  case 136:
187  case 137:
188  case 138:
189  case 139:
190  case 140:
191  case 141:
192  case 142:
193  case 143:
194  case 144:
195  case 145:
196  case 146:
197  case 147:
198  case 148:
199  case 149:
200  case 150:
201  case 151:
202  case 152:
203  case 153:
204  case 154:
205  case 155:
206  case 156:
207  case 157:
208  case 158:
209  case 159:
210  case 160:
211  case 161:
212  case 162:
213  case 163:
214  case 164:
215  case 165:
216  case 166:
217  case 167:
218  case 168:
219  case 169:
220  case 170:
221  case 171:
222  case 172:
223  case 173:
224  case 174:
225  case 175:
226  case 176:
227  case 177:
228  case 178:
229  case 179:
230  case 180:
231  case 181:
232  case 182:
233  case 183:
234 
235  case 184:
236  return 33; // dec24 "Campfire"
237  case 185:
238  case 186:
239  return 0;
240 
241  case 187: // dec88 "Mushroom"
242  case 190: // dec91 "Mushroom"
243  return 37;
244 
245  case 188:
246  case 189:
247  case 191:
248  case 192:
249  case 193:
250  case 194:
251  case 195:
252  case 196:
253  case 197:
254  case 198:
255  case 199:
256  case 200:
257  case 201:
258  case 202:
259  case 203:
260  case 204:
261  case 205:
262  return 0;
263 
264  case 206:
265  return 162 + rand() % 7; // dec60
266  case 207:
267  return 169 + rand() % 7; // dec61
268  case 208:
269  return 176 + rand() % 7; // dec62
270  case 209:
271  return 183 + rand() % 7; // dec63
272  case 210:
273  return 150; // dec64 "Magic pedestal"
274  case 211:
275  return 151; // dec65 "Magic pedestal"
276  case 212:
277  return 152; // dec66 "Magic pedestal"
278  case 213:
279  return 153; // dec67 "Magic pedestal"
280  case 214:
281  return 154; // dec68 "Magic pedestal"
282  case 215:
283  return 155; // dec69 "Magic pedestal"
284  case 216:
285  return 156; // dec70 "Magic pedestal"
286  case 217:
287  return 157; // dec71 "Magic pedestal"
288  case 218:
289  return 158; // dec72 "Magic pedestal"
290  case 219:
291  return 159; // dec73 "Magic pedestal"
292  case 220:
293  return 160; // dec74 "Magic pedestal"
294  case 221:
295  return 161; // dec75 "Magic pedestal"
296 
297  case 222:
298  case 223:
299  case 224:
300  case 225:
301  case 226:
302  case 227:
303  return 0;
304 
305  default:
306  Error("Invalid DecorationDescID: %u", uDecorationDescID);
307  }
308 }
309 
310 //----- (0047A825) --------------------------------------------------------
312  // bool v1; // ebx@1
313  // LevelDecoration *v2; // edi@1
314 
315  static const std::array<const PARTY_QUEST_BITS, 14> aObeliskQuests = {{
330  }};
331 
332  if (pParty->uCurrentHour == 0 &&
334  std::all_of(aObeliskQuests.begin(), aObeliskQuests.end(),
337  return true;
338  }
339 
341  return false;
342 }
343 
344 //----- (0044C2F4) --------------------------------------------------------
346  switch (uDecorationDescID) {
347  case 4: // trash pile
348  case 5: // campfire
349  case 6: // cauldron
350  case 11: // fruit plate
351  case 13: // trash pile
352  case 14: // dirt
353  case 24: // keg
354  case 184: // fire
355  case 187: // fire
356  case 190: // fire
357  return true;
358  }
359 
360  if (uDecorationDescID >= 206 &&
361  uDecorationDescID <= 209) // lighthouse fire
362  return true;
363  if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedestal
364  return true;
365 
366  return false;
367 }
PARTY_QUEST_OBELISK_CELESTE
@ PARTY_QUEST_OBELISK_CELESTE
Definition: Party.h:34
pLevelDecorations
std::array< LevelDecoration, 3000 > pLevelDecorations
Definition: Decoration.cpp:8
PARTY_QUEST_OBELISK_EVENMORN_ISLAND
@ PARTY_QUEST_OBELISK_EVENMORN_ISLAND
Definition: Party.h:36
PARTY_QUEST_OBELISK_BRACADA_DESERT
@ PARTY_QUEST_OBELISK_BRACADA_DESERT
Definition: Party.h:33
LevelDecoration::IsInteractive
bool IsInteractive()
Definition: Decoration.cpp:345
PARTY_QUEST_OBELISK_ERATHIA
@ PARTY_QUEST_OBELISK_ERATHIA
Definition: Party.h:30
Party::uCurrentHour
unsigned int uCurrentHour
Definition: Party.h:275
PARTY_QUEST_OBELISK_TULAREAN_FOREST
@ PARTY_QUEST_OBELISK_TULAREAN_FOREST
Definition: Party.h:31
PARTY_QUEST_OBELISK_TREASURE_FOUND
@ PARTY_QUEST_OBELISK_TREASURE_FOUND
Definition: Party.h:44
Engine.h
LevelDecoration::LevelDecoration
LevelDecoration()
Definition: Decoration.cpp:13
PARTY_QUEST_OBELISK_HARMONDALE
@ PARTY_QUEST_OBELISK_HARMONDALE
Definition: Party.h:29
activeLevelDecoration
LevelDecoration * activeLevelDecoration
Definition: Decoration.cpp:10
pParty
Party * pParty
Definition: Party.cpp:30
LEVEL_DECORATION_INVISIBLE
@ LEVEL_DECORATION_INVISIBLE
Definition: Decoration.h:14
PARTY_QUEST_OBELISK_THE_PIT
@ PARTY_QUEST_OBELISK_THE_PIT
Definition: Party.h:35
PARTY_QUEST_OBELISK_MOUNT_NIGHON
@ PARTY_QUEST_OBELISK_MOUNT_NIGHON
Definition: Party.h:37
LevelDecoration::uFlags
uint16_t uFlags
Definition: Decoration.h:27
uNumLevelDecorations
size_t uNumLevelDecorations
Definition: Decoration.cpp:9
PARTY_QUEST_OBELISK_AVLEE
@ PARTY_QUEST_OBELISK_AVLEE
Definition: Party.h:41
LevelDecoration
Definition: Decoration.h:20
PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS
@ PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS
Definition: Party.h:39
TestPartyQuestBit
bool TestPartyQuestBit(PARTY_QUEST_BITS bit)
Definition: Party.cpp:917
PARTY_QUEST_OBELISK_BARROW_DOWNS
@ PARTY_QUEST_OBELISK_BARROW_DOWNS
Definition: Party.h:38
LevelDecoration::uDecorationDescID
uint16_t uDecorationDescID
Definition: Decoration.h:26
PARTY_QUEST_OBELISK_STONE_CITY
@ PARTY_QUEST_OBELISK_STONE_CITY
Definition: Party.h:42
Decoration.h
LevelDecoration::IsObeliskChestActive
bool IsObeliskChestActive()
Definition: Decoration.cpp:311
PARTY_QUEST_OBELISK_TATALIA
@ PARTY_QUEST_OBELISK_TATALIA
Definition: Party.h:40
PARTY_QUEST_OBELISK_DEYJA
@ PARTY_QUEST_OBELISK_DEYJA
Definition: Party.h:32
LevelDecoration::GetGlobalEvent
int GetGlobalEvent()
Definition: Decoration.cpp:16