Browse Source

Startup issues with shareware version

pull/982/head
Anders Jenbo 5 years ago
parent
commit
9b1568cc08
  1. 12
      Source/init.cpp
  2. 1
      Source/init.h
  3. 8
      Source/mainmenu.cpp
  4. 3
      SourceX/DiabloUI/dialogs.cpp
  5. 2
      SourceX/DiabloUI/selhero.cpp
  6. 2
      SourceX/sound.cpp
  7. 5
      SourceX/storm/storm.cpp

12
Source/init.cpp

@ -21,6 +21,8 @@ int gbActive;
HANDLE hellfire_mpq;
/** The current input handler function */
WNDPROC CurrentProc;
/** A handle to the spawn.mpq archive. */
HANDLE spawn_mpq;
/** A handle to the diabdat.mpq archive. */
HANDLE diabdat_mpq;
/** A handle to the patch_rt.mpq archive. */
@ -70,6 +72,10 @@ void init_cleanup()
{
pfile_flush_W();
if (spawn_mpq) {
SFileCloseArchive(spawn_mpq);
spawn_mpq = NULL;
}
if (diabdat_mpq) {
SFileCloseArchive(diabdat_mpq);
diabdat_mpq = NULL;
@ -133,11 +139,11 @@ void init_archives()
diabdat_mpq = init_test_access("diabdat.mpq", "DiabloCD", 1000, FS_CD);
if (diabdat_mpq == NULL) {
diabdat_mpq = init_test_access("spawn.mpq", "DiabloSpawn", 1000, FS_PC);
if (diabdat_mpq != NULL)
spawn_mpq = init_test_access("spawn.mpq", "DiabloSpawn", 1000, FS_PC);
if (spawn_mpq != NULL)
gbIsSpawn = true;
}
if (diabdat_mpq == NULL || !SFileOpenFile("ui_art\\title.pcx", &fh))
if (!SFileOpenFile("ui_art\\title.pcx", &fh))
InsertCDDlg();
SFileCloseFile(fh);

1
Source/init.h

@ -16,6 +16,7 @@ extern _SNETVERSIONDATA fileinfo;
extern int gbActive;
extern HANDLE hellfire_mpq;
extern WNDPROC CurrentProc;
extern HANDLE spawn_mpq;
extern HANDLE diabdat_mpq;
extern bool gbIsSpawn;
extern bool gbIsHellfire;

8
Source/mainmenu.cpp

@ -20,12 +20,16 @@ void mainmenu_refresh_music()
{
music_start(menu_music_track_id);
if (gbIsSpawn && !gbIsHellfire) {
return;
}
do {
menu_music_track_id++;
if (menu_music_track_id == NUM_MUSIC || (!gbIsHellfire && menu_music_track_id > TMUSIC_L4))
menu_music_track_id = TMUSIC_L2;
if (gbIsSpawn && menu_music_track_id > TMUSIC_L1)
menu_music_track_id = TMUSIC_L5;
if (menu_music_track_id == NUM_MUSIC || (!gbIsHellfire && menu_music_track_id > TMUSIC_L4))
menu_music_track_id = TMUSIC_TOWN;
} while (menu_music_track_id == TMUSIC_TOWN || menu_music_track_id == TMUSIC_L1);
}

3
SourceX/DiabloUI/dialogs.cpp

@ -11,9 +11,6 @@
namespace dvl {
extern HANDLE diabdat_mpq;
extern SDL_Surface *pal_surface;
namespace {
Art dialogArt;

2
SourceX/DiabloUI/selhero.cpp

@ -348,7 +348,7 @@ void selhero_ClassSelector_Focus(int value)
void selhero_ClassSelector_Select(int value)
{
int hClass = vecSelHeroDlgItems[value]->m_value;
if (gbSpawned && (hClass == PC_ROGUE || hClass == PC_SORCERER)) {
if (gbSpawned && (hClass == PC_ROGUE || hClass == PC_SORCERER || hClass == PC_BARD)) {
ArtBackground.Unload();
UiSelOkDialog(NULL, "The Rogue and Sorcerer are only available in the full retail version of Diablo. Visit https://www.gog.com/game/diablo to purchase.", false);
LoadBackgroundArt("ui_art\\selhero.pcx");

2
SourceX/sound.cpp

@ -204,7 +204,7 @@ void music_start(int nTrack)
assert((DWORD)nTrack < NUM_MUSIC);
music_stop();
if (gbMusicOn) {
if (gbIsSpawn)
if (spawn_mpq)
trackPath = sgszSpawnMusicTracks[nTrack];
else
trackPath = sgszMusicTracks[nTrack];

5
SourceX/storm/storm.cpp

@ -182,7 +182,10 @@ BOOL SFileOpenFile(const char *filename, HANDLE *phFile)
if (!result && patch_rt_mpq) {
result = SFileOpenFileEx((HANDLE)patch_rt_mpq, filename, 0, phFile);
}
if (!result) {
if (!result && spawn_mpq) {
result = SFileOpenFileEx((HANDLE)spawn_mpq, filename, 0, phFile);
}
if (!result && diabdat_mpq) {
result = SFileOpenFileEx((HANDLE)diabdat_mpq, filename, 0, phFile);
}

Loading…
Cancel
Save