Browse Source

Implement Hellfire multiplayer saves

pull/1053/head
Anders Jenbo 5 years ago
parent
commit
4d47d513ce
  1. 1
      Source/items.cpp
  2. 1
      Source/pack.cpp
  3. 10
      Source/pack.h
  4. 4
      Source/pfile.cpp

1
Source/items.cpp

@ -3101,6 +3101,7 @@ void items_427ABA(int x, int y)
dItem[x][y] = ii + 1;
itemavail[0] = itemavail[MAXITEMS - numitems - 1];
itemactive[numitems] = ii;
gbIsHellfireSaveGame = gbIsHellfire;
UnPackItem(&PkSItem, &item[ii]);
item[ii]._ix = x;
item[ii]._iy = y;

1
Source/pack.cpp

@ -114,6 +114,7 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
pPack->pDifficulty = SwapLE32(pPlayer->pDifficulty);
pPack->pDamAcFlags = SwapLE32(pPlayer->pDamAcFlags);
pPack->pDiabloKillLevel = SwapLE32(pPlayer->pDiabloKillLevel);
pPack->bIsHellfire = gbIsHellfire;
if (!gbIsMultiplayer || manashield)
pPack->pManaShield = SwapLE32(pPlayer->pManaShield);

10
Source/pack.h

@ -64,19 +64,19 @@ typedef struct PkPlayerStruct {
Sint8 pBattleNet;
Uint8 pManaShield;
Uint8 pDungMsgs2;
Sint8 bReserved[2];
Sint8 bIsHellfire;
Sint8 bReserved; // For future use
Uint16 wReflections;
Sint16 wReserved2;
Sint16 wReserved2; // For future use
Sint8 pSplLvl2[10]; // Hellfire spells
Sint16 wReserved8;
Sint16 wReserved8; // For future use
Uint32 pDiabloKillLevel;
Sint32 pDifficulty;
Sint32 pDamAcFlags;
Sint32 dwReserved[5];
Sint32 dwReserved[5]; // For future use
} PkPlayerStruct;
#pragma pack(pop)
void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield);
void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok);
void PackItem(PkItemStruct *id, ItemStruct *is);

4
Source/pfile.cpp

@ -279,6 +279,8 @@ BOOL pfile_ui_set_hero_infos(BOOL (*ui_add_hero_info)(_uiheroinfo *))
_uiheroinfo uihero;
strcpy(hero_names[i], pkplr.pName);
bool hasSaveGame = pfile_archive_contains_game(archive, i);
if (!hasSaveGame)
gbIsHellfireSaveGame = pkplr.bIsHellfire;
UnPackPlayer(&pkplr, 0, FALSE);
game_2_ui_player(plr, &uihero, hasSaveGame);
ui_add_hero_info(&uihero);
@ -394,6 +396,8 @@ void pfile_read_player_from_save()
app_fatal("Unable to load character");
gbValidSaveFile = pfile_archive_contains_game(archive, save_num);
if (!gbValidSaveFile)
gbIsHellfireSaveGame = pkplr.bIsHellfire;
UnPackPlayer(&pkplr, myplr, FALSE);
pfile_SFileCloseArchive(archive);
}

Loading…
Cancel
Save