Browse Source

Add music code+quest (#1575)

pull/876/head
galaxyhaxz 7 years ago committed by Anders Jenbo
parent
commit
3a37b4fc0b
  1. 26
      Source/diablo.cpp
  2. 53
      Source/items.cpp
  3. 3
      Source/items.h
  4. 8
      Source/mainmenu.cpp
  5. 12
      Source/objects.cpp
  6. 3
      Source/objects.h
  7. 10
      Source/sound.cpp
  8. 14
      enums.h

26
Source/diablo.cpp

@ -1728,7 +1728,10 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
glMid2Seed[currlevel] = GetRndSeed();
InitObjects();
InitItems();
CreateThemeRooms();
#ifdef HELLFIRE
if ( currlevel < 17 )
#endif
CreateThemeRooms();
glMid3Seed[currlevel] = GetRndSeed();
InitMissiles();
InitDead();
@ -1839,7 +1842,28 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
ProcessVisionList();
}
#ifdef HELLFIRE
if ( currlevel >= 21 )
{
if ( currlevel == 21 )
{
items_427ABA(RowOfCornerStone, ColOfCornerStone);
}
if ( quests[QTYPE_NAKRUL]._qactive == 3 && currlevel == 24 ) // fix quest struct
{
objects_454BA8();
}
}
#endif
#ifdef HELLFIRE
if ( currlevel >= 17 )
music_start(currlevel > 20 ? TMUSIC_L5 : TMUSIC_L6);
else
music_start(leveltype);
#else
music_start(leveltype);
#endif
while (!IncProgress())
;

53
Source/items.cpp

@ -1,4 +1,7 @@
#include "diablo.h"
#ifdef HELLFIRE
#include "../3rdParty/Storm/Source/storm.h"
#endif
int itemactive[MAXITEMS];
BOOL uitemflag;
@ -206,6 +209,9 @@ int ItemInvSnds[ITEMTYPES] = {
IS_IANVL,
IS_ISTAF
};
#ifdef HELLFIRE
char *off_4A5AC4 = "SItem";
#endif
int idoppely = 16;
int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 };
@ -2443,6 +2449,53 @@ void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch,
item[ii]._iSeed = iseed;
}
#ifdef HELLFIRE
void items_427ABA(int x, int y)
{
int i, ii;
DWORD dwSize;
PkItemStruct PkSItem;
if ( dword_691CB0 || x == 0 || y == 0 )
{
return;
}
CornerItemMaybe.IDidx = 0;
dword_691CB0 = 1;
if ( dItem[x][y] )
{
ii = dItem[x][y] - 1;
for ( i = 0; i < numitems; i++ )
{
if ( itemactive[i] == ii )
{
DeleteItem(ii, i);
break;
}
}
dItem[x][y] = 0;
}
dwSize = 0;
if ( SRegLoadData("Hellfire", off_4A5AC4, 0, (BYTE *)&PkSItem, sizeof(PkSItem), &dwSize) )
{
if ( dwSize == sizeof(PkSItem) )
{
ii = itemavail[0];
dItem[x][y] = ii + 1;
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
UnPackItem(&PkSItem, &item[ii]);
item[ii]._ix = x;
item[ii]._iy = y;
RespawnItem(ii, FALSE);
CornerItemMaybe = item[ii];
numitems++;
}
}
}
#endif
void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag)
{
BOOL failed;

3
Source/items.h

@ -73,6 +73,9 @@ void CreateRndUseful(int pnum, int x, int y, BOOL sendmsg);
void CreateTypeItem(int x, int y, BOOL onlygood, int itype, int imisc, BOOL sendmsg, BOOL delta);
void RecreateItem(int ii, int idx, WORD icreateinfo, int iseed, int ivalue);
void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff);
#ifdef HELLFIRE
void items_427ABA(int x, int y);
#endif
void SpawnQuestItem(int itemid, int x, int y, int randarea, int selflag);
void SpawnRock();
void RespawnItem(int i, BOOL FlipFlag);

8
Source/mainmenu.cpp

@ -6,7 +6,7 @@ char gszHero[16];
/* data */
int menu_music_track_id = 5;
int menu_music_track_id = TMUSIC_INTRO;
void mainmenu_refresh_music()
{
@ -14,9 +14,9 @@ void mainmenu_refresh_music()
#ifndef SPAWN
do {
menu_music_track_id++;
if (menu_music_track_id == 6)
menu_music_track_id = 0;
} while (!menu_music_track_id || menu_music_track_id == 1);
if (menu_music_track_id == NUM_MUSIC)
menu_music_track_id = TMUSIC_TOWN;
} while (menu_music_track_id == TMUSIC_TOWN || menu_music_track_id == TMUSIC_L1);
#endif
}

12
Source/objects.cpp

@ -4530,3 +4530,15 @@ void GetObjectStr(int i)
}
}
}
#ifdef HELLFIRE
void objects_454BA8()
{
dPiece[UberRow][UberCol] = 298;
dPiece[UberRow][UberCol - 1] = 301;
dPiece[UberRow][UberCol - 2] = 300;
dPiece[UberRow][UberCol + 1] = 299;
SetDungeonMicros();
}
#endif

3
Source/objects.h

@ -155,6 +155,9 @@ void SyncL2Doors(int i);
void SyncL3Doors(int i);
void SyncObjectAnim(int o);
void GetObjectStr(int i);
#ifdef HELLFIRE
void objects_454BA8();
#endif
/* rdata */

10
Source/sound.cpp

@ -15,7 +15,7 @@ LPDIRECTSOUNDBUFFER sglpDSB;
BOOLEAN gbMusicOn = TRUE;
BOOLEAN gbSoundOn = TRUE;
BOOLEAN gbDupSounds = TRUE;
int sgnMusicTrack = 6;
int sgnMusicTrack = NUM_MUSIC;
char *sgszMusicTracks[NUM_MUSIC] = {
#ifdef SPAWN
"Music\\sTowne.wav",
@ -27,6 +27,10 @@ char *sgszMusicTracks[NUM_MUSIC] = {
"Music\\DLvlB.wav",
"Music\\DLvlC.wav",
"Music\\DLvlD.wav",
#ifdef HELLFIRE
"Music\\DLvlE.wav",
"Music\\DLvlF.wav",
#endif
"Music\\Dintro.wav"
#endif
};
@ -447,7 +451,7 @@ void music_stop()
SFileDdaEnd(sgpMusicTrack);
SFileCloseFile(sgpMusicTrack);
sgpMusicTrack = NULL;
sgnMusicTrack = 6;
sgnMusicTrack = NUM_MUSIC;
}
}
@ -479,7 +483,7 @@ void sound_disable_music(BOOL disable)
{
if (disable) {
music_stop();
} else if (sgnMusicTrack != 6) {
} else if (sgnMusicTrack != NUM_MUSIC) {
music_start(sgnMusicTrack);
}
}

14
enums.h

@ -2475,6 +2475,10 @@ typedef enum _music_id {
TMUSIC_L2,
TMUSIC_L3,
TMUSIC_L4,
#endif
#ifdef HELLFIRE
TMUSIC_L5,
TMUSIC_L6,
#endif
TMUSIC_INTRO,
NUM_MUSIC,
@ -2750,6 +2754,16 @@ typedef enum quest_id {
QTYPE_PW = 0xD,
QTYPE_BONE = 0xE,
QTYPE_VB = 0xF,
#ifdef HELLFIRE
QTYPE_GRAVE = 0x10,
QTYPE_FARMER = 0x11,
QTYPE_GIRL = 0x12,
QTYPE_TRADER = 0x13,
QTYPE_DEFILER = 0x14,
QTYPE_NAKRUL = 0x15,
QTYPE_CORNSTN = 0x16,
QTYPE_JERSEY = 0x17,
#endif
QTYPE_INVALID = 0xFFFFFFFF,
} quest_id;

Loading…
Cancel
Save