Browse Source

Fix issues related to cross loading save games

pull/978/head
Anders Jenbo 5 years ago
parent
commit
d68c8c1cc8
  1. 23
      Source/gamemenu.cpp
  2. 2
      Source/help.cpp
  3. 2
      Source/init.cpp
  4. 8
      Source/items.cpp
  5. 2
      Source/loadsave.cpp
  6. 77
      Source/player.cpp

23
Source/gamemenu.cpp

@ -19,11 +19,7 @@ TMenuItem sgSingleMenu[] = {
{ GMENU_ENABLED, "Options", &gamemenu_options },
{ GMENU_ENABLED, "New Game", &gamemenu_new_game },
{ GMENU_ENABLED, "Load Game", &gamemenu_load_game },
#ifndef HELLFIRE
{ GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game },
#else
{ GMENU_ENABLED, "Quit Hellfire", &gamemenu_quit_game },
#endif
{ GMENU_ENABLED, "Quit Game", &gamemenu_quit_game },
{ GMENU_ENABLED, NULL, NULL }
// clang-format on
};
@ -34,11 +30,7 @@ TMenuItem sgMultiMenu[] = {
{ GMENU_ENABLED, "Options", &gamemenu_options },
{ GMENU_ENABLED, "New Game", &gamemenu_new_game },
{ GMENU_ENABLED, "Restart In Town", &gamemenu_restart_town },
#ifndef HELLFIRE
{ GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game },
#else
{ GMENU_ENABLED, "Quit Hellfire", &gamemenu_quit_game },
#endif
{ GMENU_ENABLED, "Quit Game", &gamemenu_quit_game },
{ GMENU_ENABLED, NULL, NULL },
// clang-format on
};
@ -48,12 +40,9 @@ TMenuItem sgOptionsMenu[] = {
{ GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume },
{ GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume },
{ GMENU_ENABLED | GMENU_SLIDER, "Gamma", &gamemenu_gamma },
#ifndef HELLFIRE
// { GMENU_ENABLED , NULL, &gamemenu_color_cycling },
{ GMENU_ENABLED | GMENU_SLIDER, "Speed", &gamemenu_speed },
#else
{ GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_loadjog },
#endif
// { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_loadjog },
{ GMENU_ENABLED , "Previous Menu", &gamemenu_previous },
{ GMENU_ENABLED , NULL, NULL },
// clang-format on
@ -277,14 +266,10 @@ void gamemenu_options(BOOL bActivate)
{
gamemenu_get_music();
gamemenu_get_sound();
#ifdef HELLFIRE
gamemenu_jogging();
#endif
//gamemenu_jogging();
gamemenu_get_gamma();
#ifndef HELLFIRE
gamemenu_get_speed();
//gamemenu_get_color_cycling();
#endif
gmenu_set_items(sgOptionsMenu, NULL);
}

2
Source/help.cpp

@ -361,7 +361,7 @@ const char gszSpawnHelpText[] = {
"adjust your music and sound effects settings as well as "
"the gamma level of the screen.|"
"|"
"Quit Diablo: This exits the program. Please note that this "
"Quit Game: This exits the program. Please note that this "
"automatically saves your character.|"
"|"
"$Auto-map:|"

2
Source/init.cpp

@ -145,7 +145,6 @@ void init_archives()
if (patch_rt_mpq == NULL)
patch_rt_mpq = init_test_access("patch_sh.mpq", "DiabloSpawn", 2000, FS_PC);
#ifdef HELLFIRE
hellfire_mpq = init_test_access("hellfire.mpq", "DiabloInstall", 8000, FS_PC);
if (hellfire_mpq != NULL)
gbIsHellfire = true;
@ -156,7 +155,6 @@ void init_archives()
hfvoice_mpq = init_test_access("hfvoice.mpq", "DiabloInstall", 8500, FS_PC);
hfopt1_mpq = init_test_access("hfopt1.mpq", "DiabloInstall", 8600, FS_PC);
hfopt2_mpq = init_test_access("hfopt2.mpq", "DiabloInstall", 8610, FS_PC);
#endif
}
void init_create_window()

8
Source/items.cpp

@ -2008,27 +2008,19 @@ void SaveItemPower(int i, int power, int param1, int param2, int minval, int max
break;
case IPL_FIREDAM:
item[i]._iFlags |= ISPL_FIREDAM;
#ifdef HELLFIRE
item[i]._iFlags &= ~ISPL_LIGHTDAM;
#endif
item[i]._iFMinDam = param1;
item[i]._iFMaxDam = param2;
#ifdef HELLFIRE
item[i]._iLMinDam = 0;
item[i]._iLMaxDam = 0;
#endif
break;
case IPL_LIGHTDAM:
item[i]._iFlags |= ISPL_LIGHTDAM;
#ifdef HELLFIRE
item[i]._iFlags &= ~ISPL_FIREDAM;
#endif
item[i]._iLMinDam = param1;
item[i]._iLMaxDam = param2;
#ifdef HELLFIRE
item[i]._iFMinDam = 0;
item[i]._iFMaxDam = 0;
#endif
break;
case IPL_STR:
item[i]._iPLStr += r;

2
Source/loadsave.cpp

@ -929,6 +929,8 @@ void LoadGame(BOOL firstflag)
ResetPal();
SetCursor_(CURSOR_HAND);
gbProcessPlayers = TRUE;
gbIsHellfireSaveGame = gbIsHellfire;
}
static void BSave(char v)

77
Source/player.cpp

@ -687,9 +687,7 @@ void CreatePlayer(int pnum, char c)
int hp, mana;
int i;
#ifdef HELLFIRE
memset(&plr[pnum], 0, sizeof(PlayerStruct));
#endif
ClearPlrRVars(&plr[pnum]);
SetRndSeed(SDL_GetTicks());
@ -883,9 +881,7 @@ void NextPlrLevel(int pnum)
plr[pnum]._pLevel++;
plr[pnum]._pMaxLvl++;
#ifdef HELLFIRE
CalcPlrInv(pnum, TRUE);
#endif
if (CalcStatDiff(pnum) < 5) {
plr[pnum]._pStatPts = CalcStatDiff(pnum);
@ -927,10 +923,7 @@ void NextPlrLevel(int pnum)
}
if (pnum == myplr) {
#ifdef HELLFIRE
if (plr[pnum]._pMana > 0)
#endif
drawmanaflag = TRUE;
drawmanaflag = TRUE;
}
if (sgbControllerActive)
@ -1344,12 +1337,10 @@ void PM_ChangeOffset(int pnum)
plr[pnum]._pVar6 += plr[pnum]._pxvel;
plr[pnum]._pVar7 += plr[pnum]._pyvel;
#ifdef HELLFIRE
if (currlevel == 0 && jogging_opt) {
if (gbIsHellfire && currlevel == 0 && jogging_opt) {
plr[pnum]._pVar6 += plr[pnum]._pxvel;
plr[pnum]._pVar7 += plr[pnum]._pyvel;
}
#endif
plr[pnum]._pxoff = plr[pnum]._pVar6 >> 8;
plr[pnum]._pyoff = plr[pnum]._pVar7 >> 8;
@ -2309,14 +2300,14 @@ BOOL PM_DoWalk(int pnum)
app_fatal("PM_DoWalk: illegal player %d", pnum);
}
#ifndef HELLFIRE
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
if (!gbIsHellfire) {
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
}
}
#else
if (currlevel == 0 && jogging_opt) {
if (gbIsHellfire && currlevel == 0 && jogging_opt) {
if (plr[pnum]._pAnimFrame % 2 == 0) {
plr[pnum]._pAnimFrame++;
plr[pnum]._pVar8++;
@ -2325,7 +2316,6 @@ BOOL PM_DoWalk(int pnum)
plr[pnum]._pAnimFrame = 0;
}
}
#endif
anim_len = 8;
if (currlevel != 0) {
@ -2377,14 +2367,14 @@ BOOL PM_DoWalk2(int pnum)
app_fatal("PM_DoWalk2: illegal player %d", pnum);
}
#ifndef HELLFIRE
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
if (!gbIsHellfire) {
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
}
}
#else
if (currlevel == 0 && jogging_opt) {
if (gbIsHellfire && currlevel == 0 && jogging_opt) {
if (plr[pnum]._pAnimFrame % 2 == 0) {
plr[pnum]._pAnimFrame++;
plr[pnum]._pVar8++;
@ -2393,7 +2383,6 @@ BOOL PM_DoWalk2(int pnum)
plr[pnum]._pAnimFrame = 0;
}
}
#endif
anim_len = 8;
if (currlevel != 0) {
@ -2441,14 +2430,14 @@ BOOL PM_DoWalk3(int pnum)
app_fatal("PM_DoWalk3: illegal player %d", pnum);
}
#ifndef HELLFIRE
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
if (!gbIsHellfire) {
if (plr[pnum]._pAnimFrame == 3
|| (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
|| (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) {
PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py);
}
}
#else
if (currlevel == 0 && jogging_opt) {
if (gbIsHellfire && currlevel == 0 && jogging_opt) {
if (plr[pnum]._pAnimFrame % 2 == 0) {
plr[pnum]._pAnimFrame++;
plr[pnum]._pVar8++;
@ -2457,7 +2446,6 @@ BOOL PM_DoWalk3(int pnum)
plr[pnum]._pAnimFrame = 0;
}
}
#endif
anim_len = 8;
if (currlevel != 0) {
@ -2680,12 +2668,10 @@ BOOL PlrHitMonst(int pnum, int m)
#else
if (hit < hper) {
#endif
#ifdef HELLFIRE
if (plr[pnum]._pIFlags & ISPL_FIREDAM && plr[pnum]._pIFlags & ISPL_LIGHTDAM) {
int midam = plr[pnum]._pIFMinDam + random_(3, plr[pnum]._pIFMaxDam - plr[pnum]._pIFMinDam);
AddMissile(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pVar1, plr[pnum]._pVar2, plr[pnum]._pdir, MIS_SPECARROW, TARGET_MONSTERS, pnum, midam, 0);
}
#endif
mind = plr[pnum]._pIMinDam;
maxd = plr[pnum]._pIMaxDam;
dam = random_(5, maxd - mind + 1) + mind;
@ -2998,18 +2984,13 @@ BOOL PM_DoAttack(int pnum)
}
}
#ifdef HELLFIRE
if (!(plr[pnum]._pIFlags & ISPL_FIREDAM) || !(plr[pnum]._pIFlags & ISPL_LIGHTDAM))
#endif
if (!(plr[pnum]._pIFlags & ISPL_FIREDAM) || !(plr[pnum]._pIFlags & ISPL_LIGHTDAM)) {
if (plr[pnum]._pIFlags & ISPL_FIREDAM) {
AddMissile(dx, dy, 1, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0);
}
#ifdef HELLFIRE
else
#endif
if (plr[pnum]._pIFlags & ISPL_LIGHTDAM) {
} else if (plr[pnum]._pIFlags & ISPL_LIGHTDAM) {
AddMissile(dx, dy, 2, 0, 0, MIS_WEAPEXP, TARGET_MONSTERS, pnum, 0, 0);
}
}
if (dMonster[dx][dy]) {
m = dMonster[dx][dy];
@ -4093,11 +4074,7 @@ void CheckPlrSpell()
}
if (addflag) {
if (plr[myplr]._pRSpell == SPL_FIREWALL
#ifdef HELLFIRE
|| plr[myplr]._pRSpell == SPL_LIGHTWALL
#endif
) {
if (plr[myplr]._pRSpell == SPL_FIREWALL || plr[myplr]._pRSpell == SPL_LIGHTWALL) {
sd = GetDirection(plr[myplr]._px, plr[myplr]._py, cursmx, cursmy);
sl = GetSpellLevel(myplr, plr[myplr]._pRSpell);
NetSendCmdLocParam3(TRUE, CMD_SPELLXYD, cursmx, cursmy, plr[myplr]._pRSpell, sd, sl);

Loading…
Cancel
Save