diff --git a/Source/gendung.cpp b/Source/gendung.cpp index d3fc99a7b..8624546b6 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -5,29 +5,61 @@ */ #include "all.h" +/** Contains the tile IDs of the map. */ BYTE dungeon[DMAXX][DMAXY]; +/** Contains a backup of the tile IDs of the map. */ BYTE pdungeon[DMAXX][DMAXY]; char dflags[DMAXX][DMAXY]; +/** Specifies the active set level X-coordinate of the map. */ int setpc_x; +/** Specifies the active set level Y-coordinate of the map. */ int setpc_y; +/** Specifies the width of the active set level of the map. */ int setpc_w; +/** Specifies the height of the active set level of the map. */ int setpc_h; +/** Contains the contents of the single player quest DUN file. */ BYTE *pSetPiece; +/** Specifies whether a single player quest DUN has been loaded. */ BOOL setloadflag; BYTE *pSpecialCels; +/** Specifies the tile definitions of the active dungeon type; (e.g. levels/l1data/l1.til). */ BYTE *pMegaTiles; BYTE *pLevelPieces; BYTE *pDungeonCels; BYTE *pSpeedCels; +/** + * Returns the frame number of the speed CEL, an in memory decoding + * of level CEL frames, based on original frame number and light index. + * Note, given light index 0, the original frame number is returned. + */ int SpeedFrameTbl[128][16]; /** * List of transparancy masks to use for dPieces */ char block_lvid[MAXTILES + 1]; +/** Specifies the CEL frame occurrence for each frame of the level CEL (e.g. "levels/l1data/l1.cel"). */ int level_frame_count[MAXTILES]; int tile_defs[MAXTILES]; +/** + * Secifies the CEL frame decoder type for each frame of the + * level CEL (e.g. "levels/l1data/l1.cel"), Indexed by frame numbers starting at 1. + * The decoder type may be one of the following. + * 0x0000 - cel.decodeType0 + * 0x1000 - cel.decodeType1 + * 0x2000 - cel.decodeType2 + * 0x3000 - cel.decodeType3 + * 0x4000 - cel.decodeType4 + * 0x5000 - cel.decodeType5 + * 0x6000 - cel.decodeType6 + */ WORD level_frame_types[MAXTILES]; +/** + * Specifies the size of each frame of the level cel (e.g. + * "levels/l1data/l1.cel"). Indexed by frame numbers starting at 1. + */ int level_frame_sizes[MAXTILES]; +/** Specifies the number of frames in the level cel (e.g. "levels/l1data/l1.cel"). */ int nlevel_frames; /** * List of light blocking dPieces @@ -46,41 +78,77 @@ BOOLEAN nTransTable[MAXTILES + 1]; */ BOOLEAN nMissileTable[MAXTILES + 1]; BOOLEAN nTrapTable[MAXTILES + 1]; +/** Specifies the minimum X-coordinate of the map. */ int dminx; +/** Specifies the minimum Y-coordinate of the map. */ int dminy; +/** Specifies the maximum X-coordinate of the map. */ int dmaxx; +/** Specifies the maximum Y-coordinate of the map. */ int dmaxy; int gnDifficulty; +/** Specifies the active dungeon type of the current game. */ BYTE leveltype; +/** Specifies the active dungeon level of the current game. */ BYTE currlevel; BOOLEAN setlevel; +/** Specifies the active quest level of the current game. */ BYTE setlvlnum; char setlvltype; +/** Specifies the player viewpoint X-coordinate of the map. */ int ViewX; +/** Specifies the player viewpoint Y-coordinate of the map. */ int ViewY; int ViewBX; int ViewBY; int ViewDX; int ViewDY; ScrollStruct ScrollInfo; +/** Specifies the level viewpoint X-coordinate of the map. */ int LvlViewX; +/** Specifies the level viewpoint Y-coordinate of the map. */ int LvlViewY; int MicroTileLen; char TransVal; +/** Specifies the active transparency indices. */ BOOLEAN TransList[256]; +/** Contains the piece IDs of each tile on the map. */ int dPiece[MAXDUNX][MAXDUNY]; +/** Specifies the dungeon piece information for a given coordinate and block number. */ MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; +/** Specifies the dungeon piece information for a given coordinate and block number, optimized for diagonal access. */ MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; +/** Specifies the transparency at each coordinate of the map. */ char dTransVal[MAXDUNX][MAXDUNY]; char dLight[MAXDUNX][MAXDUNY]; char dPreLight[MAXDUNX][MAXDUNY]; char dFlags[MAXDUNX][MAXDUNY]; +/** Contains the player numbers (players array indices) of the map. */ char dPlayer[MAXDUNX][MAXDUNY]; +/** + * Contains the NPC numbers of the map. The NPC number represents a + * towner number (towners array index) in Tristram and a monster number + * (monsters array index) in the dungeon. + */ int dMonster[MAXDUNX][MAXDUNY]; +/** + * Contains the dead numbers (deads array indices) and dead direction of + * the map, encoded as specified by the pseudo-code below. + * dDead[x][y] & 0x1F - index of dead + * dDead[x][y] >> 0x5 - direction + */ char dDead[MAXDUNX][MAXDUNY]; +/** Contains the object numbers (objects array indices) of the map. */ char dObject[MAXDUNX][MAXDUNY]; +/** Contains the item numbers (items array indices) of the map. */ char dItem[MAXDUNX][MAXDUNY]; +/** Contains the missile numbers (missiles array indices) of the map. */ char dMissile[MAXDUNX][MAXDUNY]; +/** + * Contains the arch frame numbers of the map from the special tileset + * (e.g. "levels/l1data/l1s.cel"). Note, the special tileset of Tristram (i.e. + * "levels/towndata/towns.cel") contains trees rather than arches. + */ char dSpecial[MAXDUNX][MAXDUNY]; int themeCount; THEME_LOC themeLoc[MAXTHEMES]; diff --git a/Source/init.cpp b/Source/init.cpp index 473c1b7df..61213e60c 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -9,14 +9,22 @@ _SNETVERSIONDATA fileinfo; int gbActive; +/** Specifies the path to diablo.exe. */ char diablo_exe_path[MAX_PATH]; +/** A handle to an unused MPQ archive. */ HANDLE hellfire_mpq; +/** Specifies the path to patch_rt.mpq. */ char patch_rt_mpq_path[MAX_PATH]; WNDPROC CurrentProc; +/** A handle to the diabdat.mpq archive. */ HANDLE diabdat_mpq; +/** Specifies the path to diabdat.mpq. */ char diabdat_mpq_path[MAX_PATH]; +/** A handle to the patch_rt.mpq archive. */ HANDLE patch_rt_mpq; +/** Specifies whether the MS Office Shortcut Bar was killed. */ BOOL killed_mom_parent; +/** Stores the previous state of the screensaver. */ BOOLEAN screensaver_enabled_prev; /* data */ diff --git a/Source/items.cpp b/Source/items.cpp index 9296d9dd8..a2431bb05 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -10,6 +10,7 @@ BOOL uitemflag; int itemavail[MAXITEMS]; ItemStruct curruitem; ItemGetRecordStruct itemrecord[MAXITEMS]; +/** Contains the items on ground in the current game. */ ItemStruct item[MAXITEMS + 1]; BOOL itemhold[3][3]; BYTE *itemanims[ITEMTYPES]; @@ -19,6 +20,7 @@ int gnNumGetRecords; /* data */ +/** Maps from item_cursor_graphic to in-memory item type. */ BYTE ItemCAnimTbl[] = { 20, 16, 16, 16, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 21, 21, 25, 12, 28, @@ -38,6 +40,7 @@ BYTE ItemCAnimTbl[] = { 14, 17, 17, 17, 0, 34, 1, 0, 3, 17, 8, 8, 6, 1, 3, 3, 11, 3, 4 }; +/** Map of item type .cel file names. */ char *ItemDropNames[] = { "Armor2", "Axe", @@ -75,6 +78,7 @@ char *ItemDropNames[] = { "Fanvil", "FLazStaf", }; +/** Maps of item drop animation length. */ BYTE ItemAnimLs[] = { 15, 13, @@ -112,6 +116,7 @@ BYTE ItemAnimLs[] = { 13, 8, }; +/** Maps of drop sounds effect of dropping the item on ground. */ int ItemDropSnds[] = { IS_FHARM, IS_FAXE, @@ -149,6 +154,7 @@ int ItemDropSnds[] = { IS_FANVL, IS_FSTAF, }; +/** Maps of drop sounds effect of placing the item in the inventory. */ int ItemInvSnds[] = { IS_IHARM, IS_IAXE, @@ -186,7 +192,9 @@ int ItemInvSnds[] = { IS_IANVL, IS_ISTAF, }; +/** Specifies the current Y-coordinate used for validation of items on ground. */ int idoppely = 16; +/** Maps from Griswold premium item number to a quality level delta as added to the base quality level. */ int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 }; void InitItemGFX() diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index eeb3a612f..48b22d0f8 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -5,6 +5,7 @@ */ #include "all.h" +/** Contains the data related to each monster ID. */ MonsterData monsterdata[] = { // clang-format off // width, mImage, GraphicType, has_special, sndfile, snd_special, has_trans, TransFile, Frames[6], Rate[6], mName, mMinDLvl, mMaxDLvl, mLevel, mMinHP, mMaxHP, mAi, mFlags, mInt, mHit, mAFNum, mMinDamage, mMaxDamage, mHit2, mAFNum2, mMinDamage2, mMaxDamage2, mArmorClass, mMonstClass, mMagicRes , mMagicRes2 , mTreasure, mSelFlag, mExp @@ -377,7 +378,7 @@ BYTE MonstAvailTbl[] = { MAT_NEVER, // The Dark Lord MAT_NEVER, // The Arch-Litch Malignus }; - +/** Contains the data related to each unique monster ID. */ UniqMonstStruct UniqMonst[] = { // clang-format off // mtype, mName, mTrnName, mlevel, mmaxhp, mAi, mint, mMinDamage, mMaxDamage, mMagicRes, mUnqAttr, mUnqVar1, mUnqVar2, mtalkmsg diff --git a/Source/monster.cpp b/Source/monster.cpp index 1fa4dc1e1..0116b1856 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -10,6 +10,7 @@ int MissileFileFlag; // BUGFIX: replace monstkills[MAXMONSTERS] with monstkills[NUM_MTYPES]. +/** Tracks the total number of monsters killed per monster_id. */ int monstkills[MAXMONSTERS]; int monstactive[MAXMONSTERS]; int nummonsters; @@ -22,11 +23,14 @@ int monstimgtot; int uniquetrans; int nummtypes; +/** Maps from walking path step to facing direction. */ const char plr2monst[9] = { 0, 5, 3, 7, 1, 4, 6, 0, 2 }; +/** Maps from monster intelligence factor to missile type. */ const BYTE counsmiss[4] = { MIS_FIREBOLT, MIS_CBOLT, MIS_LIGHTCTRL, MIS_FIREBALL }; /* data */ +/** Maps from monster walk animation frame num to monster velocity. */ int MWVel[24][3] = { { 256, 512, 1024 }, { 128, 256, 512 }, @@ -53,11 +57,17 @@ int MWVel[24][3] = { { 11, 22, 44 }, { 10, 21, 42 } }; +/** Maps from monster action to monster animation letter. */ char animletter[7] = "nwahds"; +/** Maps from direction to a left turn from the direction. */ int left[8] = { 7, 0, 1, 2, 3, 4, 5, 6 }; +/** Maps from direction to a right turn from the direction. */ int right[8] = { 1, 2, 3, 4, 5, 6, 7, 0 }; +/** Maps from direction to the opposite direction. */ int opposite[8] = { 4, 5, 6, 7, 0, 1, 2, 3 }; +/** Maps from direction to delta X-offset. */ int offset_x[8] = { 1, 0, -1, -1, -1, 0, 1, 1 }; +/** Maps from direction to delta Y-offset. */ int offset_y[8] = { 1, 1, 1, 0, -1, -1, -1, 0 }; /** unused */ @@ -66,6 +76,7 @@ int rnd10[4] = { 10, 15, 20, 30 }; int rnd20[4] = { 20, 30, 40, 50 }; int rnd60[4] = { 60, 70, 80, 90 }; +/** Maps from monster AI ID to monster AI function. */ void (*AiProc[])(int i) = { &MAI_Zombie, &MAI_Fat, diff --git a/Source/objects.cpp b/Source/objects.cpp index 89ffe152d..45df9fbc0 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -10,6 +10,7 @@ int trapdir; BYTE *pObjCels[40]; char ObjFileList[40]; int objectactive[MAXOBJECTS]; +/** Specifies the number of active objects. */ int nobjects; int leverid; int objectavail[MAXOBJECTS]; @@ -17,8 +18,11 @@ ObjectStruct object[MAXOBJECTS]; BOOL InitObjFlag; int numobjfiles; +/** Specifies the X-coordinate delta between barrels. */ int bxadd[8] = { -1, 0, 1, -1, 1, -1, 0, 1 }; +/** Specifies the Y-coordinate delta between barrels. */ int byadd[8] = { -1, -1, -1, 0, 0, 1, 1, 1 }; +/** Maps from shrine_id to shrine name. */ char *shrinestrs[NUM_SHRINETYPE] = { "Mysterious", "Hidden", @@ -47,22 +51,30 @@ char *shrinestrs[NUM_SHRINETYPE] = { "Glimmering", "Tainted" }; +/** Specifies the minimum dungeon level on which each shrine will appear. */ char shrinemin[NUM_SHRINETYPE] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +/** Specifies the maximum dungeon level on which each shrine will appear. */ char shrinemax[NUM_SHRINETYPE] = { 16, 16, 16, 16, 16, 16, 16, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; -/** 0 - sp+mp, 1 - sp only, 2 - mp only */ +/** + * Specifies the game type for which each shrine may appear. + * 0 - sp & mp + * 1 - sp only + * 2 - mp only + */ BYTE shrineavail[NUM_SHRINETYPE] = { 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2 }; +/** Maps from book_id to book name. */ char *StoryBookName[9] = { "The Great Conflict", "The Wages of Sin are War", @@ -74,6 +86,7 @@ char *StoryBookName[9] = { "Tale of the Three", "The Black King" }; +/** Specifies the speech IDs of each dungeon type narrator book, for each player class. */ int StoryText[3][3] = { { TEXT_BOOK11, TEXT_BOOK12, TEXT_BOOK13 }, { TEXT_BOOK21, TEXT_BOOK22, TEXT_BOOK23 }, diff --git a/Source/palette.cpp b/Source/palette.cpp index a3232e79f..8f1637a00 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -6,15 +6,21 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" +/** In-memory palette to which gamma corrections are applied. */ PALETTEENTRY logical_palette[256]; +/** The active palette of the system. */ PALETTEENTRY system_palette[256]; +/** The original palette as loaded from file. */ PALETTEENTRY orig_palette[256]; int gdwPalEntries; /* data */ +/** Specifies the gamma correction level. */ int gamma_correction = 100; +/** Specifies whether colour cycling is enabled. */ BOOL color_cycling_enabled = TRUE; +/** Specifies whether the palette has max brightness. */ BOOLEAN sgbFadedIn = TRUE; static void palette_update() diff --git a/Source/player.cpp b/Source/player.cpp index 5059e6b52..a607d3e18 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -22,8 +22,11 @@ int plr_sframe_size; int deathdelay; int plr_dframe_size; +/** Maps from armor animation to letter used in graphic files. */ const char ArmourChar[4] = { 'L', 'M', 'H', 0 }; +/** Maps from weapon animation to letter used in graphic files. */ const char WepChar[10] = { 'N', 'U', 'S', 'D', 'B', 'A', 'M', 'H', 'T', 0 }; +/** Maps from player class to letter used in graphic files. */ const char CharChar[] = { 'W', 'R', @@ -33,15 +36,21 @@ const char CharChar[] = { /* data */ +/** Specifies the X-coordinate delta from the player start location in Tristram. */ int plrxoff[9] = { 0, 2, 0, 2, 1, 0, 1, 2, 1 }; +/** Specifies the Y-coordinate delta from the player start location in Tristram. */ int plryoff[9] = { 0, 2, 2, 0, 1, 1, 0, 1, 2 }; +/** Specifies the X-coordinate delta from a player, used for instanced when casting resurrect. */ int plrxoff2[9] = { 0, 1, 0, 1, 2, 0, 1, 2, 2 }; +/** Specifies the Y-coordinate delta from a player, used for instanced when casting resurrect. */ int plryoff2[9] = { 0, 0, 1, 1, 0, 2, 2, 1, 2 }; +/** Specifies the frame of each animation for which an action is triggered, for each player class. */ char PlrGFXAnimLens[][11] = { { 10, 16, 8, 2, 20, 20, 6, 20, 8, 9, 14 }, { 8, 18, 8, 4, 20, 16, 7, 20, 8, 10, 12 }, { 8, 16, 8, 6, 20, 12, 8, 20, 8, 12, 8 }, }; +/** Maps from player class to player velocity. */ int PWVel[3][3] = { { 2048, 1024, 512 }, { 2048, 1024, 512 }, @@ -51,21 +60,28 @@ int PWVel[3][3] = { int AnimLenFromClass[3] = { 8, 8, 8 }; +/** Maps from player_class to starting stat in strength. */ int StrengthTbl[3] = { 30, 20, 15 }; +/** Maps from player_class to starting stat in magic. */ int MagicTbl[3] = { 10, 15, 35 }; +/** Maps from player_class to starting stat in dexterity. */ int DexterityTbl[3] = { 20, 30, 15 }; +/** Maps from player_class to starting stat in vitality. */ int VitalityTbl[3] = { 25, 20, 20 }; +/** Specifies the chance to block bonus of each player class.*/ int ToBlkTbl[3] = { 30, 20, 10 }; char *ClassStrTblOld[] = { "Warrior", "Rogue", "Sorceror", }; +/** Maps from player_class to maximum stats. */ int MaxStats[3][4] = { { 250, 50, 60, 100 }, { 55, 70, 250, 80 }, { 45, 250, 85, 80 } }; +/** Specifies the experience point limit of each level. */ int ExpLvlsTbl[MAXCHARLEVEL] = { 0, 2000, @@ -124,7 +140,8 @@ char *ClassStrTbl[] = { "Rogue", "Sorceror", }; -BYTE fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 }; /* PM_ChangeLightOff local type */ +/** Unused local of PM_ChangeLightOff, originally for computing light radius. */ +BYTE fix[9] = { 0, 0, 3, 3, 3, 6, 6, 6, 8 }; void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) { diff --git a/Source/quests.cpp b/Source/quests.cpp index 774cf4ac0..4042e6e9b 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -8,6 +8,7 @@ int qtopline; BOOL questlog; BYTE *pQLogCel; +/** Contains the quests of the current game. */ QuestStruct quests[MAXQUESTS]; int qline; int qlist[MAXQUESTS]; @@ -20,6 +21,7 @@ int ReturnLvlT; int ALLQUESTS; int ReturnLvl; +/** Contains the data related to each quest_id. */ QuestData questlist[MAXQUESTS] = { // clang-format off // _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, _qflags, _qdmsg, _qlstr @@ -41,7 +43,15 @@ QuestData questlist[MAXQUESTS] = { { 15, 15, DTYPE_CATHEDRAL, Q_BETRAYER, 100, 5, 1, TEXT_VILE1, "Archbishop Lazarus" }, // clang-format on }; +/** + * Specifies a delta in X-coordinates from the quest entrance for + * which the hover text of the cursor will be visible. + */ char questxoff[7] = { 0, -1, 0, -1, -2, -1, -2 }; +/** + * Specifies a delta in Y-coordinates from the quest entrance for + * which the hover text of the cursor will be visible. + */ char questyoff[7] = { 0, 0, -1, -1, -1, -2, -2 }; char *questtrigstr[5] = { "King Leoric's Tomb", @@ -50,9 +60,29 @@ char *questtrigstr[5] = { "A Dark Passage", "Unholy Altar" }; +/** + * A quest group containing the three quests the Butcher, + * Ogden's Sign and Gharbad the Weak, which ensures that exactly + * two of these three quests appear in any single player game. + */ int QuestGroup1[3] = { Q_BUTCHER, Q_LTBANNER, Q_GARBUD }; +/** + * A quest group containing the three quests Halls of the Blind, + * the Magic Rock and Valor, which ensures that exactly two of + * these three quests appear in any single player game. + */ int QuestGroup2[3] = { Q_BLIND, Q_ROCK, Q_BLOOD }; +/** + * A quest group containing the three quests Black Mushroom, + * Zhar the Mad and Anvil of Fury, which ensures that exactly + * two of these three quests appear in any single player game. + */ int QuestGroup3[3] = { Q_MUSHROOM, Q_ZHAR, Q_ANVIL }; +/** + * A quest group containing the two quests Lachdanan and Warlord + * of Blood, which ensures that exactly one of these two quests + * appears in any single player game. + */ int QuestGroup4[2] = { Q_VEIL, Q_WARLORD }; void InitQuests() diff --git a/Source/render.cpp b/Source/render.cpp index 98a05d58b..b87c0416c 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -13,6 +13,7 @@ BYTE *gpCelFrame = NULL; DWORD *gpDrawMask = NULL; // char world_4B326D[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +/** Specifies the draw masks used to render transparency of the right side of tiles. */ DWORD RightMask[32] = { 0xEAAAAAAA, 0xF5555555, 0xFEAAAAAA, 0xFF555555, @@ -31,7 +32,7 @@ DWORD RightMask[32] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; - +/** Specifies the draw masks used to render transparency of the left side of tiles. */ DWORD LeftMask[32] = { 0xAAAAAAAB, 0x5555555F, 0xAAAAAABF, 0x555555FF, @@ -50,7 +51,7 @@ DWORD LeftMask[32] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; - +/** Specifies the draw masks used to render transparency of wall tiles. */ DWORD WallMask[32] = { 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, diff --git a/Source/sound.cpp b/Source/sound.cpp index 7a50e0b50..8d5fb290d 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -6,21 +6,28 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" +/** Contains the audio channels used for playback of sounds. */ LPDIRECTSOUNDBUFFER DSBs[8]; LPDIRECTSOUND sglpDS; BOOLEAN gbSndInited; int sglMusicVolume; int sglSoundVolume; +/** Provides a handle to the dynamic library dsound.dll. */ HMODULE hDsound_dll; +/** Specifies whether background music is enabled. */ HANDLE sghMusic; LPDIRECTSOUNDBUFFER sglpDSB; /* data */ BOOLEAN gbMusicOn = TRUE; +/** Specifies whether sound effects are enabled. */ BOOLEAN gbSoundOn = TRUE; +/** Specifies that no duplicate audio channel should be used. */ BOOLEAN gbDupSounds = TRUE; +/** Specifies the active background music track id. */ int sgnMusicTrack = NUM_MUSIC; +/** Maps from track ID to track name. */ char *sgszMusicTracks[NUM_MUSIC] = { #ifdef SPAWN "Music\\sTowne.wav", diff --git a/Source/themes.cpp b/Source/themes.cpp index 45e40cc2c..9ae82f515 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -22,8 +22,9 @@ BOOL pFountainFlag; BOOL bFountainFlag; BOOL bCrossFlag; +/** Specifies the set of special theme IDs from which one will be selected at random. */ int ThemeGood[4] = { THEME_GOATSHRINE, THEME_SHRINE, THEME_SKELROOM, THEME_LIBRARY }; - +/** Specifies a 5x5 area to fit theme objects. */ int trm5x[] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, @@ -31,7 +32,7 @@ int trm5x[] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2 }; - +/** Specifies a 5x5 area to fit theme objects. */ int trm5y[] = { -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, @@ -39,13 +40,13 @@ int trm5y[] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; - +/** Specifies a 3x3 area to fit theme objects. */ int trm3x[] = { -1, 0, 1, -1, 0, 1, -1, 0, 1 }; - +/** Specifies a 3x3 area to fit theme objects. */ int trm3y[] = { -1, -1, -1, 0, 0, 0, diff --git a/Source/towners.cpp b/Source/towners.cpp index 177788ec7..cdca244cd 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -16,6 +16,13 @@ BYTE *pCowCels; TownerStruct towner[NUM_TOWNERS]; #ifndef SPAWN +/** + * Maps from active cow sound effect index and player class to sound + * effect ID for interacting with cows in Tristram. + * + * ref: enum _sfx_id + * ref: enum plr_class + */ const int snSFX[3][NUM_CLASSES] = { { PS_WARR52, PS_ROGUE52, PS_MAGE52 }, { PS_WARR49, PS_ROGUE49, PS_MAGE49 }, @@ -24,7 +31,7 @@ const int snSFX[3][NUM_CLASSES] = { #endif /* data */ - +/** Specifies the animation frame sequence of a given NPC. */ char AnimOrder[6][148] = { { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, @@ -91,11 +98,23 @@ char AnimOrder[6][148] = { 1, 2, 1, 19, 18, 19, 1, 2, 1, 2, 3, -1 } }; +/** Specifies the start X-coordinates of the cows in Tristram. */ int TownCowX[] = { 58, 56, 59 }; +/** Specifies the start Y-coordinates of the cows in Tristram. */ int TownCowY[] = { 16, 14, 20 }; +/** Specifies the start directions of the cows in Tristram. */ int TownCowDir[] = { DIR_SW, DIR_NW, DIR_N }; +/** Maps from direction to X-coordinate delta, which is used when + * placing cows in Tristram. A single cow may require space of up + * to three tiles when being placed on the map. + */ int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 }; +/** Maps from direction to Y-coordinate delta, which is used when + * placing cows in Tristram. A single cow may require space of up + * to three tiles when being placed on the map. + */ int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; +/** Contains the data related to quest gossip for each towner ID. */ QuestTalkData Qtalklist[] = { // clang-format off // _qinfra, _qblkm, _qgarb, _qzhar, _qveil, _qmod, _qbutch, _qbol, _qblind, _qblood, _qanvil, _qwarlrd, _qking, _qpw, _qbone, _qvb @@ -112,6 +131,7 @@ QuestTalkData Qtalklist[] = { { TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1, TEXT_KING1 } // clang-format on }; +/** Specifies the active sound effect ID for interacting with cows. */ int CowPlaying = -1; int GetActiveTowner(int t) diff --git a/Source/trigs.cpp b/Source/trigs.cpp index c5b84cf14..df96e6ecb 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -11,19 +11,33 @@ int numtrigs; TriggerStruct trigs[MAXTRIGGERS]; int TWarpFrom; +/** Specifies the dungeon piece IDs which constitute stairways leading down to the cathedral from town. */ int TownDownList[] = { 716, 715, 719, 720, 721, 723, 724, 725, 726, 727, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down to the catacombs from town. */ int TownWarp1List[] = { 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1181, 1183, 1185, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the cathedral. */ int L1UpList[] = { 127, 129, 130, 131, 132, 133, 135, 137, 138, 139, 140, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the cathedral. */ int L1DownList[] = { 106, 107, 108, 109, 110, 112, 114, 115, 118, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the catacombs. */ int L2UpList[] = { 266, 267, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the catacombs. */ int L2DownList[] = { 269, 270, 271, 272, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from the catacombs. */ int L2TWarpUpList[] = { 558, 559, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from the caves. */ int L3UpList[] = { 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from the caves. */ int L3DownList[] = { 162, 163, 164, 165, 166, 167, 168, 169, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from the caves. */ int L3TWarpUpList[] = { 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up from hell. */ int L4UpList[] = { 82, 83, 90, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down from hell. */ int L4DownList[] = { 120, 130, 131, 132, 133, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading up to town from hell. */ int L4TWarpUpList[] = { 421, 422, 429, -1 }; +/** Specifies the dungeon piece IDs which constitute stairways leading down to Diablo from hell. */ int L4PentaList[] = { 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, -1 }; #ifndef SPAWN