diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 295c65b1e..8fec286a4 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -49,6 +49,7 @@ int setseed; int debugmonsttypes; int PauseMode; bool forceSpawn; +bool forceDiablo; BOOLEAN UseTheoQuest; BOOLEAN UseCowFarmer; BOOLEAN UseNestArt; @@ -118,6 +119,8 @@ static void print_help_and_exit() printf(" %-20s %-30s\n", "-x", "Run in windowed mode"); printf(" %-20s %-30s\n", "--spawn", "Force spawn mode even if diabdat.mpq is found"); #ifdef HELLFIRE + printf("\nHellfire options:\n"); + printf(" %-20s %-30s\n", "--diablo", "Force diablo mode even if hellfire.mpq is found"); printf(" %-20s %-30s\n", "--theoquest", "Enable the Theo quest"); printf(" %-20s %-30s\n", "--cowquest", "Enable the Cow quest"); printf(" %-20s %-30s\n", "--nestart", "Use alternate nest palette"); @@ -168,6 +171,8 @@ static void diablo_parse_flags(int argc, char **argv) } else if (strcasecmp("--spawn", argv[i]) == 0) { forceSpawn = TRUE; #ifdef HELLFIRE + } else if (strcasecmp("--diablo", argv[i]) == 0) { + forceDiablo = TRUE; } else if (strcasecmp("--theoquest", argv[i]) == 0) { UseTheoQuest = TRUE; } else if (strcasecmp("--cowquest", argv[i]) == 0) { @@ -384,9 +389,7 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer) do { fExitProgram = FALSE; -#ifndef HELLFIRE gbLoadGame = FALSE; -#endif if (!NetInit(bSinglePlayer, &fExitProgram)) { gbRunGameResult = !fExitProgram; @@ -400,25 +403,15 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer) InitQuests(); InitPortals(); InitDungMsgs(myplr); -#ifndef HELLFIRE } if (!gbValidSaveFile || !gbLoadGame) { -#else - if (!gbValidSaveFile && gbLoadGame) - inv_diablo_to_hellfire(myplr); -#endif uMsg = WM_DIABNEWGAME; } else { uMsg = WM_DIABLOADGAME; } run_game_loop(uMsg); NetClose(); -#ifndef HELLFIRE pfile_create_player_description(0, 0); -#else - if (gbMaxPlayers == 1) - break; -#endif } while (gbRunGameResult); SNetDestroy(); @@ -451,6 +444,8 @@ static void diablo_init() if (forceSpawn) gbIsSpawn = true; + if (forceDiablo) + gbIsHellfire = false; UiInitialize(); UiSetSpawned(gbIsSpawn); @@ -475,17 +470,13 @@ static void diablo_splash() play_movie("gendata\\logo.smk", TRUE); -#ifndef HELLFIRE - if (!gbIsSpawn) -#endif - if (getIniBool(APP_NAME, "Intro", true)) { -#ifndef HELLFIRE - play_movie("gendata\\diablo1.smk", TRUE); -#else + if (gbIsHellfire && getIniBool("Hellfire", "Intro", true)) { play_movie("gendata\\Hellfire.smk", TRUE); -#endif - setIniValue(APP_NAME, "Intro", "0"); - } + setIniValue("Hellfire", "Intro", "0"); + } else if (!gbIsSpawn && getIniBool("Diablo", "Intro", true)) { + play_movie("gendata\\diablo1.smk", TRUE); + setIniValue("Diablo", "Intro", "0"); + } UiTitleDialog(); } diff --git a/Source/init.cpp b/Source/init.cpp index f3ce0887f..07d0082eb 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -27,6 +27,8 @@ HANDLE diabdat_mpq; HANDLE patch_rt_mpq; /** Indicate if we only have access to demo data */ bool gbIsSpawn; +/** Indicate if we have loaded the Hellfire expansion data */ +bool gbIsHellfire; HANDLE hfmonk_mpq; HANDLE hfbard_mpq; HANDLE hfbarb_mpq; @@ -145,6 +147,8 @@ void init_archives() #ifdef HELLFIRE hellfire_mpq = init_test_access("hellfire.mpq", "DiabloInstall", 8000, FS_PC); + if (hellfire_mpq != NULL) + gbIsHellfire = true; hfmonk_mpq = init_test_access("hfmonk.mpq", "DiabloInstall", 8100, FS_PC); hfbard_mpq = init_test_access("hfbard.mpq", "DiabloInstall", 8110, FS_PC); hfbarb_mpq = init_test_access("hfbarb.mpq", "DiabloInstall", 8120, FS_PC); diff --git a/Source/init.h b/Source/init.h index c6a3c4acf..5d9d9d82a 100644 --- a/Source/init.h +++ b/Source/init.h @@ -18,6 +18,7 @@ extern HANDLE hellfire_mpq; extern WNDPROC CurrentProc; extern HANDLE diabdat_mpq; extern bool gbIsSpawn; +extern bool gbIsHellfire; extern HANDLE patch_rt_mpq; extern HANDLE hfmonk_mpq; extern HANDLE hfbard_mpq; diff --git a/Source/inv.cpp b/Source/inv.cpp index 082522e24..03389aca1 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1698,47 +1698,6 @@ void RemoveInvItem(int pnum, int iv) CalcPlrScrolls(pnum); } -/** - * @brief This destroyes all items except gold - */ -BOOL inv_diablo_to_hellfire(int pnum) -{ - ItemStruct tmp; - ItemStruct *item; - int i, old_item_cnt, new_item_index; - - if (plr[pnum]._pgfxnum != 0) { - plr[pnum]._pgfxnum = 0; - plr[pnum]._pGFXLoad = 0; - SetPlrAnims(pnum); - } - for (i = 0, item = plr[pnum].InvBody; i < NUM_INVLOC; i++, item++) { - item->_itype = ITYPE_NONE; - } - old_item_cnt = plr[pnum]._pNumInv; - memset(plr[pnum].InvGrid, 0, sizeof(plr[pnum].InvGrid)); - plr[pnum]._pNumInv = 0; - for (i = 0; i < old_item_cnt; i++) { - item = &plr[pnum].InvList[i]; - if (item->_itype == ITYPE_GOLD) { - new_item_index = plr[pnum]._pNumInv; - // BUGFIX: new_item_index may be greater or equal to NUM_INV_GRID_ELEM - tmp = *item; - item->_itype = ITYPE_NONE; - plr[pnum].InvList[new_item_index] = tmp; - plr[pnum]._pNumInv++; - plr[pnum].InvGrid[i] = plr[pnum]._pNumInv; - } else { - item->_itype = ITYPE_NONE; - } - }; - for (i = 0, item = plr[pnum].SpdList; i < MAXBELTITEMS; i++, item++) { - item->_itype = ITYPE_NONE; - } - CalcPlrItemVals(pnum, FALSE); - return FALSE; -} - void RemoveSpdBarItem(int pnum, int iv) { plr[pnum].SpdList[iv]._itype = ITYPE_NONE; diff --git a/Source/inv.h b/Source/inv.h index 240aeba96..346d02758 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -27,7 +27,6 @@ int SwapItem(ItemStruct *a, ItemStruct *b); void CheckInvSwap(int pnum, BYTE bLoc, int idx, WORD wCI, int seed, BOOL bId); void inv_update_rem_item(int pnum, BYTE iv); void RemoveInvItem(int pnum, int iv); -BOOL inv_diablo_to_hellfire(int pnum); void RemoveSpdBarItem(int pnum, int iv); void CheckInvItem(); void CheckInvScrn(); diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 513739799..30bd87554 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -23,11 +23,9 @@ namespace { std::string GetSavePath(DWORD save_num) { std::string path = GetPrefPath(); -#ifdef HELLFIRE - const char *ext = ".hsv"; -#else const char *ext = ".sv"; -#endif + if (gbIsHellfire) + ext = ".hsv"; if (gbIsSpawn) { if (gbMaxPlayers <= 1) { @@ -39,12 +37,7 @@ std::string GetSavePath(DWORD save_num) if (gbMaxPlayers <= 1) { path.append("single_"); } else { -#ifdef HELLFIRE - path.append("hrinfo_"); - ext = ".drv"; -#else path.append("multi_"); -#endif } } diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index be736c3c0..b4d6b366a 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -152,29 +152,31 @@ BOOL SFileOpenFile(const char *filename, HANDLE *phFile) result = SFileOpenFileEx((HANDLE)0, path.c_str(), 0xFFFFFFFF, phFile); } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfopt2_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfopt1_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfvoice_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfmusic_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfbarb_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfbard_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hfmonk_mpq, filename, 0, phFile); - } - if (!result) { - result = SFileOpenFileEx((HANDLE)hellfire_mpq, filename, 0, phFile); + if (gbIsHellfire) { + if (!result) { + result = SFileOpenFileEx((HANDLE)hfopt2_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfopt1_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfvoice_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfmusic_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfbarb_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfbard_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hfmonk_mpq, filename, 0, phFile); + } + if (!result) { + result = SFileOpenFileEx((HANDLE)hellfire_mpq, filename, 0, phFile); + } } if (!result && patch_rt_mpq) { result = SFileOpenFileEx((HANDLE)patch_rt_mpq, filename, 0, phFile);