This repository has been archived by the owner on May 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
homm2map.sbf
485 lines (440 loc) · 11 KB
/
homm2map.sbf
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
type Map struct {
Magic uint32
Complexity uint8
_ uint8
Width uint8
Height uint8
PlayerPresence array[6] of uint8
PlayerHumanPlayable array[6] of uint8
PlayerComputerPlayable array[6] of uint8
PlayerCount uint8
HumanOnlyPlayers uint8
NonComputerOnlyPlayers uint8
SpecialVictoryConditionsType VictoryCondition
ComputerCanWinViaSVC uint8
AllowNormalVictory uint8
SpecialVictoryConditionsData1 uint16
SpecialLossConditionsType LossCondition
SpecialLossConditionsData1 uint16
StartWithHero uint8
PlayerRace array[6] of Race
SpecialVictoryConditionsData2 uint16
SpecialLossConditionsData2 uint16
_ array[8] of uint8 // text
_ uint16
Name array[60] of uint8 // text
Description array[300] of uint8 // text
RumorCount uint8
EventCount uint8
_ array[8] of uint8
Tiles array[@Width * @Height] of Tile
TileAddonCount uint32
TileAddons array[@TileAddonCount] of TileAddon
CoodCastles array[72] of CoodCastle
CoodResourceKingdoms array[144] of CoodResource
ObeliskCount uint8
RumorObjectIds array[@RumorCount] of uint16
EventObjectIds array[@EventCount] of uint16
ObjectCount uint16
Objects array[@ObjectCount] of Object
_ uint32
}
type Tile struct {
TileIndex uint16 // tile (ocean, grass, snow, swamp, lava, desert, dirt, wasteland, beach)
ObjectName1 uint8 // level 1.0
IndexName1 uint8 // index level 1.0 or 0xFF
Quantity1 uint8 // count
Quantity2 uint8 // count
ObjectName2 uint8 // level 2.0
IndexName2 uint8 // index level 2.0 or 0xFF
Shape uint8 // shape reflect % 4, 0 none, 1 vertical, 2 horizontal, 3 any
GeneralObject uint8 // zero or object
IndexAddon uint16 // zero or index addons_t
UniqNumber1 uint32 // level 1.0
UniqNumber2 uint32 // level 2.0
}
type TileAddon struct {
IndexAddon uint16 // zero or next addons_t
ObjectNameN1 uint8 // level 1.N
IndexNameN1 uint8 // level 1.N or 0xFF
QuantityN uint8 //
ObjectNameN2 uint8 // level 2.N
IndexNameN2 uint8 // level 1.N or 0xFF
UniqNumberN1 uint32 // level 1.N
UniqNumberN2 uint32 // level 2.N
}
type CoodCastle struct {
X uint8
Y uint8
Type CoodCastleType
}
type CoodResource struct {
X uint8
Y uint8
Type CoodResourceType
}
type Object struct {
Size uint16
Data array[@Size] of uint8
}
type Castle struct {
Color Color
UseCustomBuildings uint8
Buildings Buildings
Dwellings Dwellings
MagicTower uint8
UseCustomTroops uint8
MonsterType array[5] of uint8
MonsterCount array[5] of uint16
HasCapitan uint8
UseCustomName uint8
CastleName array[13] of uint8
Type CoodCastleType // Without 0x80
IsCastle uint8
ForbidCastle uint8
_ array[29] of uint8
}
type Hero struct {
_ uint8
CustomTroops uint8
MonsterType array[5] of uint8 // 0xFF = None
MonsterCount array[5] of uint16
CustomPortrate uint8
Portrate uint8
Artifacts array[3] of uint8 // 0xFF = None
_ uint8
Experience uint32
CustomSkills uint8
SkillTypes array[8] of uint8
SkillLevels array[8] of uint8
_ uint8
CustomName uint8
Name array[13] of uint8
Patrol uint8
CountSquare uint8 // for patrol
_ array[15] of uint8
}
type Info struct { // Sign or buttle
Id uint8
_ array[8] of uint8
Text cstring
}
type Reward struct {
Wood int32
Mercury int32
Ore int32
Sulfur int32
Crystal int32
Gems int32
Gold int32
Artifact uint16 // 0xffff - none
}
type EventCoord struct {
Id uint8 // 0x01
Reward Reward
Computer uint8 // allow events for computer
Cancel uint8 // cancel event after first visit
_ array[10] of uint8
Players array[6] of uint8
Text cstring
}
type EventDay struct {
Id uint8 // 0x00
Reward Reward
Computer uint16 // allow events for computer
First uint16 // day of first occurent
Subsequent uint16 // subsequent occurrences
_ array[6] of uint8
Players array[6] of uint8
Text cstring // message + '/0'
}
type Rumor struct {
Id uint8
_ array[7] of uint8
Text cstring
}
type Riddle struct {
Id uint8 // 0x00
Reward Reward
Count uint8 // count answers (1, 8)
Answers array[8] of array[13] of uint8
Text cstring
}
type Color enum(uint8) {
Blue = 0
Green = 1
Red = 2
Yellow = 3
Orange = 4
Purple = 5
Unknown = 0xFF
}
type Buildings set(uint16) {
ThiefGuild = 1 << 1
Tavern = 1 << 2
Shipyard = 1 << 3
Well = 1 << 4
Statue = 1 << 6
LeftTurret = 1 << 7
RightTurret = 1 << 8
Marketplace = 1 << 9
Farm = 1 << 10 // Garbage He, Crystal Gar, Waterfall, Orchard, Skull Pile
Moat = 1 << 11
Fortification = 1 << 12 // Coliseum, Rainbow, Dungeon, Library, Storm
}
type Dwellings set(uint16) {
Level1 = 1 << 3
Level2 = 1 << 4
Level3 = 1 << 5
Level4 = 1 << 6
Level5 = 1 << 7
Level6 = 1 << 8
UpgradedLevel2 = 1 << 9
UpgradedLevel3 = 1 << 10
UpgradedLevel4 = 1 << 11
UpgradedLevel5 = 1 << 12
UpgradedLevel6 = 1 << 13
}
type ObjectType enum(uint8) {
Zero = 0x00
N_Alchemylab = 0x01
N_Skeleton = 0x04
N_DaemonCave = 0x05
N_FaerieRing = 0x07
N_Gazebo = 0x0A
N_Graveyard = 0x0C
N_ArcherHouse = 0x0D
N_DwarfCott = 0x0F
N_PeasantHut = 0x10
N_DragonCity = 0x14
N_Lighthouse = 0x15
N_Waterwheel = 0x16
N_Mines = 0x17
N_Obelisk = 0x19
N_Oasis = 0x1A
Coast = 0x1C
N_Sawmill = 0x1D
N_Oracle = 0x1E
N_Shipwreck = 0x20
N_DesertTent = 0x22
N_Castle = 0x23
N_StoneLights = 0x24
N_WagonCamp = 0x25
N_Windmill = 0x28
N_RandomTown = 0x30
N_RandomCastle = 0x31
Shrub2 = 0x38
NothingSpecial = 0x39
N_WatchTower = 0x3A
N_TreeHouse = 0x3B
N_TreeCity = 0x3C
N_Ruins = 0x3D
N_Fort = 0x3E
N_Tradingpost = 0x3F
N_Abandonedmine = 0x40
N_Treeknowledge = 0x44
N_DoctorHut = 0x45
N_Temple = 0x46
N_Hillfort = 0x47
N_HalflingHole = 0x48
N_MercenaryCamp = 0x49
N_Pyramid = 0x4C
N_CityDead = 0x4D
N_Excavation = 0x4E
N_Sphinx = 0x4F
TarPit = 0x51
N_ArtesianSpring = 0x52
N_Trollbridge = 0x53
N_WateringHole = 0x54
N_WitchHut = 0x55
N_Xanadu = 0x56
N_Cave = 0x57
N_MagellanMaps = 0x59
N_DerelictShip = 0x5B
N_MagicWell = 0x5E
N_ObservationTower = 0x60
N_FreemanFoundry = 0x61
Trees = 0x63
Mounts = 0x64
Volcano = 0x65
Flowers = 0x66
Stones = 0x67
WaterLake = 0x68
Mandrake = 0x69
DeadTree = 0x6A
Stump = 0x6B
Crater = 0x6C
Cactus = 0x6D
Mound = 0x6E
Dune = 0x6F
LavaPool = 0x70
Shrub = 0x71
N_Arena = 0x72
N_BarrowMounds = 0x73
N_Mermaid = 0x74
N_Sirens = 0x75
N_HutMagi = 0x76
N_EyeMagi = 0x77
N_TravellerTent = 0x78
N_Jail = 0x7B
N_FireAltar = 0x7C
N_AirAltar = 0x7D
N_EarthAltar = 0x7E
N_WaterAltar = 0x7F
WaterChest = 0x80
AlchemyLab = 0x81
Sign = 0x82
Buoy = 0x83
Skeleton = 0x84
DaemonCave = 0x85
TreasureChest = 0x86
FaerieRing = 0x87
Campfire = 0x88
Fountain = 0x89
Gazebo = 0x8A
AncientLamp = 0x8B
Graveyard = 0x8C
ArcherHouse = 0x8D
GoblinHut = 0x8E
DwarfCott = 0x8F
Peasanthut = 0x90
Event = 0x93
DragonCity = 0x94
Lighthouse = 0x95
Waterwheel = 0x96
Mines = 0x97
Monster = 0x98
Obelisk = 0x99
Oasis = 0x9A
Resource = 0x9B
Sawmill = 0x9D
Oracle = 0x9E
Shrine1 = 0x9F
Shipwreck = 0xA0
DesertTent = 0xA2
Castle = 0xA3
Stonelights = 0xA4
WagonCamp = 0xA5
WhirlPool = 0xA7
Windmill = 0xA8
Artifact = 0xA9
Boat = 0xAB
RandomUltimateArtifact = 0xAC
RandomArtifact = 0xAD
RandomResource = 0xAE
RandomMonster = 0xAF
RandomTown = 0xB0
RandomCastle = 0xB1
RandomMonster1 = 0xB3
RandomMonster2 = 0xB4
RandomMonster3 = 0xB5
RandomMonster4 = 0xB6
Heroes = 0xB7
WatchTower = 0xBA
TreeHouse = 0xBB
TreeCity = 0xBC
Ruins = 0xBD
Fort = 0xBE
Tradingpost = 0xBF
Abandonedmine = 0xC0
Thatchedhut = 0xC1
Standingstones = 0xC2
Idol = 0xC3
TreeOfKnowledge = 0xC4
Doctorhut = 0xC5
Temple = 0xC6
HillFort = 0xC7
HalflingHole = 0xC8
MercenaryCamp = 0xC9
Shrine2 = 0xCA
Shrine3 = 0xCB
Pyramid = 0xCC
CityDead = 0xCD
Excavation = 0xCE
Sphinx = 0xCF
Wagon = 0xD0
ArtesianSpring = 0xD2
TrollBridge = 0xD3
WateringHole = 0xD4
WitchShut = 0xD5
Xanadu = 0xD6
Cave = 0xD7
Leanto = 0xD8
MagellanMaps = 0xD9
Flotsam = 0xDA
DerelictShip = 0xDB
ShipwreckSurviror = 0xDC
Bottle = 0xDD
MagicWell = 0xDE
MagicGarden = 0xDF
ObservationTower = 0xE0
FreemanFoundry = 0xE1
Reefs = 0xE9
N_AlchemyTower = 0xEA
N_Stables = 0xEB
Mermaid = 0xEC
Sirens = 0xED
HutMagi = 0xEE
EyeMagi = 0xEF
AlchemyTower = 0xF0
Stables = 0xF1
Arena = 0xF2
BarrowMounds = 0xF3
RandomArtifact1 = 0xF4
RandomArtifact2 = 0xF5
RandomArtifact3 = 0xF6
Barrier = 0xF7
TravellerTent = 0xF8
Jail = 0xFB
FireAltar = 0xFC
AirAltar = 0xFD
EarthAltar = 0xFE
WaterAltar = 0xFF
}
type CoodCastleType set(uint8) {
Knight = 0
Barbarian = 1
Sorceress = 2
Warlock = 3
Wizard = 4
Necromancer = 5
Random = 6
Castle = 0x80
}
type CoodResourceType enum(uint8) {
WoodMine = 0
MercuryMin = 1
OreMine = 2
SulfurMine = 3
CrystalMine = 4
GemsMine = 5
GoldMine = 6
LightHouse = 0x64
DragonCity = 0x65
AbandonedMine = 0x67
}
type VictoryCondition enum(uint8) {
All = 0 // ?
Town = 1
Hero = 2
Artifact = 3
Side = 4
Gold = 5
}
type LossCondition enum(uint8) {
All = 0 // ?
Town = 1
Hero = 2
Time = 3
}
type Race enum(uint8) {
Knight = 0
Barbarian = 1
Sorceress = 2
Warlock = 3
Wizard = 4
Necromancer = 5
Multiple = 6
Random = 7
None = 255
}