Browse Source

Merge branch 'master' of github.com:diasurgical/devilution

pull/36/head
Anders Jenbo 7 years ago
parent
commit
3d0cd681df
  1. 2
      .travis.yml
  2. 2
      MakefileVC
  3. 1042
      Source/missiles.cpp
  4. 4
      Source/msg.cpp
  5. 2
      Source/pack.cpp
  6. 4
      Source/player.cpp
  7. 124
      Source/quests.cpp
  8. 16
      Source/scrollrt.cpp
  9. 4
      Source/scrollrt.h
  10. 21
      Source/sound.cpp
  11. 35
      Source/stores.cpp
  12. 2
      Source/stores.h
  13. 6
      Source/town.cpp
  14. 2
      Source/wave.cpp
  15. 2
      Source/wave.h
  16. 8
      structs.h

2
.travis.yml

@ -2,7 +2,7 @@ language: cpp
os:
- osx
addons:
homebrew:
packages:

2
MakefileVC

@ -36,7 +36,7 @@ else
VC6_LINK = wine $(VC6_BIN_DIR)/link.exe
endif
CFLAGS=/nologo /c /TC /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi
CFLAGS=/nologo /c /TC /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi /FA
LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no
ifeq ($(MAKE_BUILD),pdb)

1042
Source/missiles.cpp

File diff suppressed because it is too large Load Diff

4
Source/msg.cpp

@ -2480,7 +2480,7 @@ int __fastcall On_NOVA(TCmdLoc *pCmd, int pnum)
int __fastcall On_SETSHIELD(TCmd *pCmd, int pnum)
{
if (gbBufferMsgs != 1)
plr[pnum].pManaShield = 1;
plr[pnum].pManaShield = TRUE;
return sizeof(*pCmd);
}
@ -2488,7 +2488,7 @@ int __fastcall On_SETSHIELD(TCmd *pCmd, int pnum)
int __fastcall On_REMSHIELD(TCmd *pCmd, int pnum)
{
if (gbBufferMsgs != 1)
plr[pnum].pManaShield = 0;
plr[pnum].pManaShield = FALSE;
return sizeof(*pCmd);
}

2
Source/pack.cpp

@ -65,7 +65,7 @@ void __fastcall PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield)
if (gbMaxPlayers == 1 || manashield)
pPack->pManaShield = pPlayer->pManaShield;
else
pPack->pManaShield = 0;
pPack->pManaShield = FALSE;
}
// 679660: using guessed type char gbMaxPlayers;

4
Source/player.cpp

@ -665,7 +665,7 @@ void __fastcall CreatePlayer(int pnum, char c)
plr[pnum].pTownWarps = 0;
plr[pnum].pLvlLoad = 0;
plr[pnum].pBattleNet = 0;
plr[pnum].pManaShield = 0;
plr[pnum].pManaShield = FALSE;
InitDungMsgs(pnum);
CreatePlrItems(pnum);
@ -841,7 +841,7 @@ void __fastcall InitPlayer(int pnum, BOOL FirstTime)
} else {
plr[pnum]._pwtype = WT_MELEE;
}
plr[pnum].pManaShield = 0;
plr[pnum].pManaShield = FALSE;
}
if (plr[pnum].plrlevel == currlevel || leveldebug) {

124
Source/quests.cpp

@ -53,96 +53,66 @@ int QuestGroup4[2] = { QTYPE_VEIL, QTYPE_WARLRD };
void __cdecl InitQuests()
{
char v0; // dl
unsigned char *v1; // esi
unsigned char *v2; // eax
unsigned char *v3; // ecx
int *v4; // eax
int v5; // ebp
unsigned int v6; // edi
//int v7; // eax
unsigned char v8; // al
unsigned char v9; // al
char v10; // al
int v13; // eax
int v15; // eax
int v17; // eax
int v19; // eax
char v20; // [esp+8h] [ebp-4h]
v0 = gbMaxPlayers;
v1 = &quests[0]._qactive;
int initiatedQuests;
int i;
unsigned int z;
if (gbMaxPlayers == 1) {
v2 = &quests[0]._qactive;
do {
*v2 = 0;
v2 += 24;
} while ((signed int)v2 < (signed int)&quests[MAXQUESTS]._qactive);
for (i = 0; i < MAXQUESTS; i++) {
quests[i]._qactive = 0;
}
} else {
v3 = &quests[0]._qactive;
v4 = &questlist[0]._qflags;
do {
if (!(*(_BYTE *)v4 & 1))
*v3 = 0;
v4 += 5;
v3 += 24;
} while ((signed int)v4 < (signed int)&questlist[MAXQUESTS]._qflags);
for (i = 0; i < MAXQUESTS; i++) {
if (!(questlist[i]._qflags & 1)) {
quests[i]._qactive = 0;
}
}
}
v5 = 0;
initiatedQuests = 0;
questlog = 0;
ALLQUESTS = 1;
WaterDone = 0;
v20 = 0;
v6 = 0;
do {
if ((unsigned char)v0 <= 1u || questlist[v6]._qflags & 1) {
*(v1 - 1) = questlist[v6]._qdtype;
if ((unsigned char)v0 <= 1u) {
v8 = questlist[v6]._qdlvl;
*v1 = 1;
*(v1 - 2) = v8;
v1[13] = 0;
*(_DWORD *)(v1 + 18) = 0;
} else {
*(v1 - 2) = questlist[v6]._qdmultlvl;
//_LOBYTE(v7) = delta_quest_inited(v5);
if (!delta_quest_inited(v5)) {
*v1 = 1;
v1[13] = 0;
*(_DWORD *)(v1 + 18) = 0;
for (z = 0; z < MAXQUESTS; z++) {
if (gbMaxPlayers <= 1 || questlist[z]._qflags & 1) {
quests[z]._qtype = questlist[z]._qdtype;
if (gbMaxPlayers > 1) {
quests[z]._qlevel = questlist[z]._qdmultlvl;
if (!delta_quest_inited(initiatedQuests)) {
quests[z]._qactive = 1;
quests[z]._qvar1 = 0;
quests[z]._qlog = 0;
}
v0 = gbMaxPlayers;
++v5;
++initiatedQuests;
} else {
quests[z]._qactive = 1;
quests[z]._qlevel = questlist[z]._qdlvl;
quests[z]._qvar1 = 0;
quests[z]._qlog = 0;
}
v9 = questlist[v6]._qslvl;
*(_DWORD *)(v1 + 2) = 0;
v1[10] = v9;
v1[11] = v20;
v1[1] = questlist[v6]._qlvlt;
v10 = questlist[v6]._qdmsg;
*(_DWORD *)(v1 + 6) = 0;
v1[14] = 0;
v1[12] = v10;
quests[z]._qtx = 0;
quests[z]._qslvl = questlist[z]._qslvl;
quests[z]._qidx = z;
quests[z]._qlvltype = questlist[z]._qlvlt;
quests[z]._qty = 0;
quests[z]._qvar2 = 0;
quests[z]._qmsg = questlist[z]._qdmsg;
}
++v20;
++v6;
v1 += 24;
} while (v6 < MAXQUESTS);
if (v0 == 1) {
}
if (gbMaxPlayers == 1) {
SetRndSeed(glSeedTbl[15]);
if (random(0, 2))
quests[QTYPE_PW]._qactive = 0;
else
quests[QTYPE_KING]._qactive = 0;
v13 = random(0, 3);
quests[QuestGroup1[v13]]._qactive = 0;
v15 = random(0, 3);
quests[QuestGroup2[v15]]._qactive = 0;
v17 = random(0, 3);
quests[QuestGroup3[v17]]._qactive = 0;
v19 = random(0, 2);
v0 = gbMaxPlayers;
quests[QuestGroup4[v19]]._qactive = 0;
quests[QuestGroup1[random(0, sizeof(QuestGroup1) / sizeof(int))]]._qactive = 0;
quests[QuestGroup2[random(0, sizeof(QuestGroup2) / sizeof(int))]]._qactive = 0;
quests[QuestGroup3[random(0, sizeof(QuestGroup3) / sizeof(int))]]._qactive = 0;
quests[QuestGroup4[random(0, sizeof(QuestGroup4) / sizeof(int))]]._qactive = 0;
}
#ifdef _DEBUG
if (questdebug != -1)
@ -153,7 +123,7 @@ void __cdecl InitQuests()
if (!quests[QTYPE_INFRA]._qactive)
quests[QTYPE_INFRA]._qvar2 = 2;
quests[QTYPE_BOL]._qvar1 = 1;
if (v0 != 1)
if (gbMaxPlayers != 1)
quests[QTYPE_VB]._qvar1 = 2;
}
// 679660: using guessed type char gbMaxPlayers;

16
Source/scrollrt.cpp

@ -67,7 +67,7 @@ void __cdecl ClearCursor() // CODE_FIX: this was supposed to be in cursor.cpp
sgdwCursWdtOld = 0;
}
void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, int del_flag)
void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, BOOL del_flag)
{
int v7; // ebx
char v8; // al
@ -151,7 +151,7 @@ void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, int de
}
}
void __fastcall DrawClippedMissile(int x, int y, int sx, int sy, int a5, int a6, int a7)
void __fastcall DrawClippedMissile(int x, int y, int sx, int sy, int a5, int a6, BOOL a7)
{
int v7; // ebx
char v8; // al
@ -880,7 +880,7 @@ void __fastcall scrollrt_draw_clipped_dungeon(char *a1, int sx, int sy, int a4,
if (visiondebug && v50 & DFLAG_LIT)
Cel2DecodeHdrOnly(dst_buf, (char *)pSquareCel, 1, 64, 0, 8);
if (MissilePreFlag && v50 & DFLAG_MISSILE)
DrawClippedMissile(a1a, sy, a4, a5, 0, 8, 1);
DrawClippedMissile(a1a, sy, a4, a5, 0, 8, TRUE);
if (light_table_index < lightmax) {
if (v7) {
v11 = &dead[(v7 & 0x1F) - 1];
@ -1010,7 +1010,7 @@ void __fastcall scrollrt_draw_clipped_dungeon(char *a1, int sx, int sy, int a4,
}
}
if (v50 & 1)
DrawClippedMissile(a1a, sy, a4, a5, 0, 8, 0);
DrawClippedMissile(a1a, sy, a4, a5, 0, 8, FALSE);
if (v47 && light_table_index < lightmax)
DrawClippedObject(a1a, sy, a4, a5, 0, 0, 8);
if (v49) {
@ -1476,7 +1476,7 @@ void __fastcall scrollrt_draw_clipped_dungeon_2(char *buffer, int x, int y, int
Cel2DecodeHdrOnly(dst_buf, (char *)pSquareCel, 1, 64, a5, 8);
if (MissilePreFlag && v53 & DFLAG_MISSILE) {
v13 = sx;
DrawClippedMissile(a1, y, sx, sy, a5, 8, 1);
DrawClippedMissile(a1, y, sx, sy, a5, 8, TRUE);
} else {
v13 = sx;
}
@ -1611,7 +1611,7 @@ void __fastcall scrollrt_draw_clipped_dungeon_2(char *buffer, int x, int y, int
}
}
if (v53 & DFLAG_MISSILE)
DrawClippedMissile(a1, y, v13, sy, a5, 8, 0);
DrawClippedMissile(a1, y, v13, sy, a5, 8, FALSE);
if (v50 && light_table_index < lightmax)
DrawClippedObject(a1, y, v13, sy, 0, a5, 8);
if (v52) {
@ -2019,7 +2019,7 @@ void __fastcall scrollrt_draw_dungeon(char *buffer, int x, int y, int a4, int a5
if (visiondebug && v52 & DFLAG_LIT)
CelDecodeHdrOnly(dst_buf, (char *)pSquareCel, 1, 64, 0, a5);
if (MissilePreFlag && v52 & DFLAG_MISSILE)
DrawMissile(xa, y, sx, sy, 0, a5, 1);
DrawMissile(xa, y, sx, sy, 0, a5, TRUE);
if (light_table_index < lightmax) {
if (v9) {
v13 = &dead[(v9 & 0x1F) - 1];
@ -2149,7 +2149,7 @@ void __fastcall scrollrt_draw_dungeon(char *buffer, int x, int y, int a4, int a5
}
}
if (v52 & DFLAG_MISSILE)
DrawMissile(xa, y, sx, sy, 0, a5, 0);
DrawMissile(xa, y, sx, sy, 0, a5, FALSE);
if (v49 && light_table_index < lightmax)
DrawObject(xa, y, sx, sy, 0, 0, a5);
if (v51) {

4
Source/scrollrt.h

@ -14,8 +14,8 @@ extern int(__fastcall *DrawPlrProc)(int player_num, int x, int y, int screen_x,
extern int draw_monster_num; // weak
void __cdecl ClearCursor();
void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, int del_flag);
void __fastcall DrawClippedMissile(int x, int y, int sx, int sy, int a5, int a6, int a7);
void __fastcall DrawMissile(int x, int y, int sx, int sy, int a5, int a6, BOOL del_flag);
void __fastcall DrawClippedMissile(int x, int y, int sx, int sy, int a5, int a6, BOOL a7);
void __fastcall DrawDeadPlayer(int x, int y, int sx, int sy, int a5, int a6, BOOLEAN clipped);
void __fastcall DrawPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10);
void __fastcall DrawClippedPlayer(int pnum, int x, int y, int px, int py, unsigned char *animdata, int animframe, int animwidth, int a9, int a10);

21
Source/sound.cpp

@ -189,8 +189,8 @@ BOOL __fastcall sound_file_reload(TSnd *sound_file, LPDIRECTSOUNDBUFFER DSB)
rv = FALSE;
WOpenFile(sound_file->sound_path, &file, 0);
WSetFilePointer(file, sound_file->chunk.dwOffset, 0, 0);
WOpenFile(sound_file->sound_path, &file, FALSE);
WSetFilePointer(file, sound_file->chunk.dwOffset, NULL, 0);
#ifdef __cplusplus
if (DSB->Lock(0, sound_file->chunk.dwSize, &buf1, &size1, &buf2, &size2, 0) == DS_OK) {
@ -213,7 +213,8 @@ BOOL __fastcall sound_file_reload(TSnd *sound_file, LPDIRECTSOUNDBUFFER DSB)
TSnd *__fastcall sound_file_load(char *path)
{
void *file, *wave_file;
HANDLE file;
BYTE *wave_file;
TSnd *pSnd;
LPVOID buf1, buf2;
DWORD size1, size2;
@ -222,8 +223,8 @@ TSnd *__fastcall sound_file_load(char *path)
if (!sglpDS)
return NULL;
WOpenFile(path, &file, 0);
pSnd = (TSnd *)DiabloAllocPtr(40);
WOpenFile(path, &file, FALSE);
pSnd = (TSnd *)DiabloAllocPtr(sizeof(TSnd));
memset(pSnd, 0, sizeof(TSnd));
pSnd->sound_path = path;
pSnd->start_tc = GetTickCount() - 81;
@ -242,7 +243,7 @@ TSnd *__fastcall sound_file_load(char *path)
if (error_code != DS_OK)
DSErrMsg(error_code, 318, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
memcpy(buf1, (char *)wave_file + pSnd->chunk.dwOffset, size1);
memcpy(buf1, wave_file + pSnd->chunk.dwOffset, size1);
#ifdef __cplusplus
error_code = pSnd->DSB->Unlock(buf1, size1, buf2, size2);
@ -252,7 +253,7 @@ TSnd *__fastcall sound_file_load(char *path)
if (error_code != DS_OK)
DSErrMsg(error_code, 325, "C:\\Src\\Diablo\\Source\\SOUND.CPP");
mem_free_dbg(wave_file);
mem_free_dbg((void *)wave_file);
WCloseFile(file);
return pSnd;
@ -313,7 +314,7 @@ void __fastcall snd_init(HWND hWnd)
#else
if (sglpDS && sglpDS->lpVtbl->SetCooperativeLevel(sglpDS, hWnd, DSSCL_EXCLUSIVE) == DS_OK)
#endif
sound_create_primary_buffer(0);
sound_create_primary_buffer(NULL);
SVidInitialize(sglpDS);
SFileDdaInitialize(sglpDS);
@ -441,7 +442,7 @@ void __cdecl music_stop()
if (sgpMusicTrack) {
SFileDdaEnd(sgpMusicTrack);
SFileCloseFile(sgpMusicTrack);
sgpMusicTrack = 0;
sgpMusicTrack = NULL;
sgnMusicTrack = 6;
}
}
@ -462,7 +463,7 @@ void __fastcall music_start(int nTrack)
#endif
sound_create_primary_buffer(sgpMusicTrack);
if (!success) {
sgpMusicTrack = 0;
sgpMusicTrack = NULL;
} else {
SFileDdaBeginEx(sgpMusicTrack, 0x40000, 0x40000, 0, sglMusicVolume, 0, 0);
sgnMusicTrack = nTrack;

35
Source/stores.cpp

@ -387,7 +387,7 @@ void __fastcall OffsetSTextY(int y, int yo)
stext[y]._syoff = yo;
}
void __fastcall AddSText(int x, int y, int j, char *str, int clr, int sel)
void __fastcall AddSText(int x, int y, int j, char *str, char clr, int sel)
{
stext[y]._sx = x;
stext[y]._syoff = 0;
@ -1532,29 +1532,24 @@ void __cdecl S_StartHealer()
void __fastcall S_ScrollHBuy(int idx)
{
int v1; // esi
int v2; // edi
int *v3; // esi
int iclr; // [esp+8h] [ebp-4h]
int i;
char iclr;
v1 = idx;
v2 = 5;
ClearSText(5, 21);
stextup = 5;
v3 = &healitem[v1]._iStatFlag;
do {
if (*(v3 - 87) != -1) {
_LOBYTE(iclr) = COL_WHITE;
if (!*v3)
_LOBYTE(iclr) = COL_RED;
AddSText(20, v2, 0, (char *)v3 - 295, iclr, 1);
AddSTextVal(v2, *(v3 - 39));
PrintStoreItem((ItemStruct *)(v3 - 89), v2 + 1, iclr);
stextdown = v2;
v3 += 92;
for (i = 5; i < 20; i += 4) {
if (healitem[idx]._itype != -1) {
iclr = COL_WHITE;
if (!healitem[idx]._iStatFlag)
iclr = COL_RED;
AddSText(20, i, 0, healitem[idx]._iName, iclr, 1);
AddSTextVal(i, healitem[idx]._iIvalue);
PrintStoreItem(&healitem[idx], i + 1, iclr);
stextdown = i;
idx++;
}
v2 += 4;
} while (v2 < 20);
}
if (!stext[stextsel]._ssel && stextsel != 22)
stextsel = stextdown;
}

2
Source/stores.h

@ -48,7 +48,7 @@ void __fastcall ClearSText(int s, int e);
void __fastcall AddSLine(int y);
void __fastcall AddSTextVal(int y, int val);
void __fastcall OffsetSTextY(int y, int yo);
void __fastcall AddSText(int x, int y, int j, char *str, int clr, int sel);
void __fastcall AddSText(int x, int y, int j, char *str, char clr, int sel);
void __cdecl StoreAutoPlace();
void __cdecl S_StartSmith();
void __fastcall S_ScrollSBuy(int idx);

6
Source/town.cpp

@ -213,7 +213,7 @@ void __fastcall town_draw_clipped_town(BYTE *buffer, int x, int y, int sx, int s
v7 = v29;
}
if (dFlags[0][v7] & DFLAG_MISSILE)
DrawClippedMissile(xa, y, sx, sy, 0, 8, 0);
DrawClippedMissile(xa, y, sx, sy, 0, 8, FALSE);
}
// 4B8CC0: using guessed type char pcursitem;
// 4B8CC2: using guessed type char pcursplr;
@ -473,7 +473,7 @@ void __fastcall town_draw_clipped_town_2(int x, int y, int a3, int a4, int a5, i
v9 = v31;
}
if (dFlags[0][v9] & DFLAG_MISSILE)
DrawClippedMissile(xa, a3, sx, sy, a5, 8, 0);
DrawClippedMissile(xa, a3, sx, sy, a5, 8, FALSE);
}
// 4B8CC0: using guessed type char pcursitem;
// 4B8CC2: using guessed type char pcursplr;
@ -693,7 +693,7 @@ void __fastcall town_draw_town_all(BYTE *buffer, int x, int y, int a4, int dir,
town_draw_e_flag(buffer - 64, x - 1, y + 1, a4, dir, sx - 64, sy);
}
if (dFlags[x][y] & DFLAG_MISSILE)
DrawMissile(x, y, sx, sy, 0, dir, 0);
DrawMissile(x, y, sx, sy, 0, dir, FALSE);
}
// 4B8CC0: using guessed type char pcursitem;
// 4B8CC2: using guessed type char pcursplr;

2
Source/wave.cpp

@ -202,7 +202,7 @@ BOOL __fastcall ReadWaveSection(MEMFILE *pMemFile, DWORD id, CKINFO *chunk)
return chunk->dwOffset != (DWORD)-1;
}
void *__fastcall LoadWaveFile(HANDLE hsFile, WAVEFORMATEX *pwfx, CKINFO *chunk)
BYTE *__fastcall LoadWaveFile(HANDLE hsFile, WAVEFORMATEX *pwfx, CKINFO *chunk)
{
MEMFILE wave_file;

2
Source/wave.h

@ -16,6 +16,6 @@ BOOL __fastcall ReadMemFile(MEMFILE *pMemFile, void *lpBuf, size_t length);
void __fastcall FillMemFile(MEMFILE *pMemFile);
int __fastcall SeekMemFile(MEMFILE *pMemFile, LONG lDist, DWORD dwMethod);
BOOL __fastcall ReadWaveSection(MEMFILE *pMemFile, DWORD id, CKINFO *chunk);
void *__fastcall LoadWaveFile(HANDLE hsFile, WAVEFORMATEX *pwfx, CKINFO *chunk);
BYTE *__fastcall LoadWaveFile(HANDLE hsFile, WAVEFORMATEX *pwfx, CKINFO *chunk);
#endif /* __WAVE_H__ */

8
structs.h

@ -322,7 +322,7 @@ typedef struct PlayerStruct {
unsigned char pDungMsgs;
unsigned char pLvlLoad;
unsigned char pBattleNet;
unsigned char pManaShield;
BOOLEAN pManaShield;
char bReserved[3];
short wReserved[8];
DWORD pDiabloKillLevel;
@ -414,13 +414,13 @@ typedef struct MissileStruct {
int _miAnimFrame;
BOOL _miDrawFlag;
int _miLightFlag;
int _miPreFlag;
BOOL _miPreFlag;
int _miUniqTrans;
int _mirange;
int _misource;
int _micaster;
int _midam;
int _miHitFlag;
BOOL _miHitFlag;
int _midist;
int _mlid;
int _mirnd;
@ -1409,7 +1409,7 @@ typedef struct PkPlayerStruct {
char pDungMsgs;
char pLvlLoad;
char pBattleNet;
char pManaShield;
BOOLEAN pManaShield;
char bReserved[3];
short wReserved[8];
int pDiabloKillLevel;

Loading…
Cancel
Save