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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * 22 * Based on the original sources 23 * Faery Tale II -- The Halls of the Dead 24 * (c) 1993-1996 The Wyrmkeep Entertainment Co. 25 */ 26 27 #ifndef SAGA2_IDTYPES_H 28 #define SAGA2_IDTYPES_H 29 30 namespace Saga2 { 31 32 #define FTA 33 34 typedef uint32 ChunkID; 35 #define MakeID(a,b,c,d) ((d<<24L)|(c<<16L)|(b<<8L)|a) 36 37 /* ===================================================================== * 38 ObjectID 39 * ===================================================================== */ 40 41 typedef uint16 ObjectID; // a reference to a script 42 43 // Some fixed objects 44 45 const ObjectID Nothing = 0, // a reference to no object 46 ObjectLimbo = 1, // where dead objects go 47 ActorLimbo = 2, // where dead actors go 48 ImportantLimbo = 3, // where dead important objects go 49 ActorBaseID = 0x8000, // high bit set for actors 50 WorldBaseID = 0xF000; // 4K posible worlds 51 52 /* ===================================================================== * 53 TileID 54 * ===================================================================== */ 55 56 typedef uint16 TileID; 57 58 const int16 nullID = -1; 59 60 /* ===================================================================== * 61 PlayerActorID 62 * ===================================================================== */ 63 64 typedef int16 PlayerActorID; 65 66 /* ===================================================================== * 67 MetaTileID struct 68 * ===================================================================== */ 69 70 struct StaticMetaTileID { 71 int16 map, index; 72 }; 73 74 struct MetaTileID { 75 int16 map; // map number 76 int16 index; // index into metatile array 77 78 // Default constructor MetaTileIDMetaTileID79 MetaTileID(void) : map(0), index(0) {} 80 81 // Copy constructor MetaTileIDMetaTileID82 MetaTileID(const MetaTileID &id) : map(id.map), index(id.index) {} 83 84 // Constructor MetaTileIDMetaTileID85 MetaTileID(int16 m, int16 i) : map(m), index(i) {} 86 MetaTileIDMetaTileID87 MetaTileID(StaticMetaTileID mt) { 88 map = mt.map; 89 index = mt.index; 90 } 91 92 MetaTileID operator = (const MetaTileID &id) { 93 map = id.map; 94 index = id.index; 95 return *this; 96 } 97 98 bool operator == (const MetaTileID &id) const { 99 return map == id.map && index == id.index; 100 } 101 102 bool operator != (const MetaTileID &id) const { 103 return map != id.map || index != id.index; 104 } 105 }; 106 107 // ID of NULL meta tile 108 extern const StaticMetaTileID NoMetaTile; 109 110 /* ===================================================================== * 111 ActiveItemID struct 112 * ===================================================================== */ 113 114 const int activeItemIndexMask = 0x1FFF; 115 const int activeItemMapMask = 0xE000; 116 const int activeItemMapShift = 13; 117 118 const int16 activeItemIndexNullID = 0x1FFF; 119 120 struct StaticActiveItemID { 121 int16 val; 122 }; 123 124 #include "common/pack-start.h" 125 struct ActiveItemID { 126 int16 val; // ID value -- 127 // first 3 bits world number 128 // next 13 bits index 129 130 // Default constructor ActiveItemIDActiveItemID131 ActiveItemID(void) : val(0) {} 132 133 // Copy constructor ActiveItemIDActiveItemID134 ActiveItemID(const ActiveItemID &id) : val(id.val) { 135 } 136 137 // Constructor ActiveItemIDActiveItemID138 ActiveItemID(int16 idVal) : val(idVal) {} 139 140 // Constructor ActiveItemIDActiveItemID141 ActiveItemID(int16 m, int16 i) : 142 val((m << activeItemMapShift) | (i & activeItemIndexMask)) { 143 } 144 ActiveItemIDActiveItemID145 ActiveItemID(StaticActiveItemID a) { 146 val = a.val; 147 } 148 149 ActiveItemID operator = (const ActiveItemID &id) { 150 val = id.val; 151 return *this; 152 } 153 154 ActiveItemID operator = (int16 idVal) { 155 val = idVal; 156 return *this; 157 } 158 159 bool operator == (const ActiveItemID &id) const { 160 return val == id.val; 161 } 162 163 bool operator != (const ActiveItemID &id) const { 164 return val != id.val; 165 } 166 int16ActiveItemID167 operator int16(void) { 168 return val; 169 } 170 setMapNumActiveItemID171 void setMapNum(int16 m) { 172 val &= ~activeItemMapMask; 173 val |= (m << activeItemMapShift); 174 } 175 getMapNumActiveItemID176 int16 getMapNum(void) { 177 return (uint16)val >> activeItemMapShift; 178 } 179 setIndexNumActiveItemID180 void setIndexNum(int16 i) { 181 val &= ~activeItemIndexMask; 182 val |= i & activeItemIndexMask; 183 } 184 getIndexNumActiveItemID185 int16 getIndexNum(void) { 186 return val & activeItemIndexMask; 187 } 188 } PACKED_STRUCT; 189 #include "common/pack-end.h" 190 191 // ID of NULL active item 192 extern const StaticActiveItemID NoActiveItem; 193 194 /* ===================================================================== * 195 Task's and TaskStacks 196 * ===================================================================== */ 197 198 // Task evaluation return types 199 enum TaskResult { 200 taskFailed = -1, // Task has ended in failure 201 taskNotDone = 0, // Task has not ended yet 202 taskSucceeded = 1 // Task has ended in success 203 }; 204 205 typedef int16 TaskID; 206 const TaskID NoTask = -1; 207 208 typedef int16 TaskStackID; 209 const TaskStackID NoTaskStack = -1; 210 211 /* ===================================================================== * 212 TimerID 213 * ===================================================================== */ 214 215 typedef int16 TimerID; 216 217 /* ===================================================================== * 218 SensorID 219 * ===================================================================== */ 220 221 typedef int16 SensorID; 222 223 /* ===================================================================== * 224 BandID 225 * ===================================================================== */ 226 227 typedef int16 BandID; 228 const BandID NoBand = -1; 229 230 typedef uint8 gPen; // a pen index number 231 232 typedef uint16 weaponID; 233 234 typedef uint32 hResID; 235 236 typedef uint8 ColorTable[256]; 237 238 #ifndef offsetof 239 #define offsetof(type,field) (uint32)&(((type *)0)->field) 240 #endif 241 242 #define maxuint8 0xff 243 #define maxint16 0x7fff 244 #define minint16 0x8000 245 #define maxuint16 0xffff 246 #define maxint32 0x7fffffff 247 248 enum { 249 kActorListID = MKTAG('A', 'C', 'T', 'O') 250 }; 251 252 // number of containers 253 const int kNumViews = 3; 254 255 enum { 256 kNullWeapon = 0, 257 kMaxWeapons = 256 258 }; 259 260 enum { 261 kActorCount = 575 262 }; 263 264 // 265 // Damage effects - these are the types of damage in the world 266 // Damage being defined as a change in effective vitality 267 // Note that healing is negative damage. 268 // 269 enum effectDamageTypes { 270 // Generic 271 kDamageOther = 0, // Healing, cause wounds 272 // Combat damage 273 kDamageImpact = 1, // hammers, maces 274 kDamageSlash = 2, // swords 275 kDamageProjectile = 3, // arrows, poin-ted sticks 276 // Magic damage 277 kDamageFire = 4, // Yellow 278 kDamageAcid = 5, // Violet 279 kDamageHeat = 6, // Red 280 kDamageCold = 7, // Blue 281 kDamageLightning = 8, // Orange 282 kDamagePoison = 9, // Green 283 // Other magic damage 284 kDamageMental = 10, // dain bramage 285 kDamageToUndead = 11, // undead take this damage 286 kDamageDirMagic = 12, // the plusses on swords etc. 287 // Physiological Damage 288 kDamageStarve = 13, // You must eat! 289 // other 290 kDamageEnergy = 14 // Generally hard to resist - god damage 291 }; 292 293 // Tile metrics 294 295 enum { 296 kTileWidth = 64, 297 kTileHeight = 32, 298 kTileMaxHeight = 160, 299 kTileDX = (kTileWidth / 2), 300 kTileDY = (kTileHeight / 2), 301 kTileDXShift = 5, 302 kTileDYShift = 4, 303 kTileDXMask = (kTileDX - 1), 304 kTileDYMask = (kTileDY - 1), 305 kMaxTileHeight = 160 306 }; 307 308 // Size of a tile in ( U, V ) coords 309 310 enum { 311 kTileUVSize = 16, 312 kTileUVShift = 4, 313 kTileZSize = 8, 314 kTileZShift = 3, 315 kTileUVMask = (kTileUVSize - 1) 316 }; 317 318 // Size of a map sector (4 metatiles x 4 metatiles) 319 320 enum { 321 kSectorSize = kTileUVSize * 8 * 4, 322 kSectorShift = kTileUVShift + 3 + 2, 323 kSectorMask = (kSectorSize - 1) 324 }; 325 326 // Plaftorm metrics 327 enum { 328 kPlatformWidth = 8, 329 kPlatMask = kPlatformWidth - 1, 330 kPlatShift = 3, 331 kPlatUVSize = kTileUVSize * kPlatformWidth 332 }; 333 334 // Metatile metrics 335 enum { 336 kMetaTileWidth = kTileWidth * kPlatformWidth, 337 kMetaTileHeight = kTileHeight * kPlatformWidth, 338 kMetaDX = kMetaTileWidth / 2, 339 kMetaDY = kMetaTileHeight / 2 340 }; 341 342 enum { 343 kSubTileSize = 4, 344 kSubTileMask = kSubTileSize - 1, 345 kSubTileShift = 2, 346 kTileSubSize = 4, 347 kTileSubMask = kTileSubSize - 1, 348 kTileSubShift = 2 349 }; 350 351 // Constants to convert an X,Y into subtile coordinates 352 enum { 353 kSubTileDX = (kTileDX / 4), 354 kSubTileDY = (kTileDY / 4), 355 kSubTileDXShift = (kTileDXShift - 2), 356 kSubTileDYShift = (kTileDYShift - 2) 357 }; 358 359 enum { 360 kSubTileMaskUShift = 4, 361 kSubTileMaskVShift = 1 362 }; 363 364 // Maximum height that a character can climb w/o steps or ladders 365 enum { 366 kMaxStepHeight = 16, // highest climbable step 367 kMaxPickHeight = 64, // highest pickable step 368 kMaxSmoothStep = 8, // highest smoothly climbable 369 kMaxJumpStep = 64 // highest jump character likes 370 }; 371 372 373 // Save/Load dialog metrics 374 375 enum { 376 kNumSaveLoadPanels = 3, 377 kNumSaveLoadBtns = 4, 378 kNumSaveLoadTexts = 1, 379 380 kSLDBoxXSize = 374, 381 kSLDBoxXSzNS = 366, 382 kSLDBoxYSize = 223, 383 kSLDBoxX = (640 - kSLDBoxXSize) / 2, 384 kSLDBoxY = (480 - kSLDBoxYSize) / 3, 385 386 kSLTPHeight = 38, 387 kSLMDHeight = 122, 388 kSLBTHeight = 63, 389 kSLTPWidth = 374, 390 kSLMDWidth = 374, 391 kSLBTWidth = 374 392 }; 393 394 // Options dialog metrics 395 enum { 396 kNumOptionsPanels = 3, 397 kNumOptionsBtns = 9, 398 kNumOptionsTexts = 8, 399 400 kOptBoxXSize = 487, 401 kOptBoxXSzNS = 479, 402 kOptBoxYSize = 230, 403 kOptBoxX = (640 - kOptBoxXSize) / 2, 404 kOptBoxY = (480 - kOptBoxYSize) / 3, 405 406 kOptTPHeight = 39, 407 kOptMDHeight = 90, 408 kOptBTHeight = 101, 409 kOptTPWidth = 487, 410 kOptMDWidth = 487, 411 kOptBTWidth = 487 412 }; 413 414 // buttons 415 enum { 416 kButtonSpace = 3, 417 kButtonYOffset = kOptTPHeight + 7, 418 kPushButtonWidth = 121, 419 kPushButtonHeight = 30, 420 421 kSliderWidth = 168, 422 kImageHeight = 17, 423 424 kTextPixelLen = 175, 425 kSmallTextOffset = 80 426 }; 427 428 // Message Dialog Metrics 429 enum { 430 kNumMessagePanels = 1, 431 kNumMessageBtns = 3, 432 kNumMessageTexts = 2, 433 kMesBtnOffset = 14, 434 435 kMesBoxXSize = 374, 436 kMesBoxXSzNS = 368, 437 kMesBoxYSize = 146, 438 kMesBoxX = (640 - kMesBoxXSize) / 2, 439 kMesBoxY = (480 - kMesBoxYSize) / 3 440 }; 441 442 //Sets Up Tile Map Area 443 enum { 444 kTileRectX = 16 + 4, 445 kTileRectY = 16 + 4, 446 kTileRectWidth = 448 - 8, 447 kTileRectHeight = 428 - 8 448 }; 449 450 // Horribly kludged hard-coded sprite index numbers for bubble sprites 451 enum { 452 kMaxActiveSpells = 8, 453 kBaseBubbleSpriteIndex = 111, 454 kBubbleSpriteCount = 8 455 }; 456 457 enum { 458 kPlayerActors = 3, 459 kMinAutoAggressionVitality = 5, 460 BASE_REC_RATE = 1 461 }; 462 463 enum { 464 kObjectVolumeArraySize = 128 465 }; 466 467 enum { 468 kDefaultReach = 24 469 }; 470 471 // Actor Constants 472 enum { 473 kMaxFactions = 64 474 }; 475 476 } // end of namespace Saga2 477 478 #endif 479