Browse Source

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

pull/876/head
Anders Jenbo 7 years ago
parent
commit
0bdd819ca9
  1. 25
      Source/codec.cpp
  2. 16
      Source/control.cpp
  3. 4
      Source/drlg_l2.cpp
  4. 4
      Source/drlg_l4.cpp
  5. 4
      Source/dthread.cpp
  6. 12
      Source/engine.cpp
  7. 3
      Source/gmenu.cpp
  8. 53
      Source/items.cpp
  9. 7
      Source/monster.cpp
  10. 2
      Source/msg.cpp
  11. 2
      Source/pack.cpp
  12. 6
      Source/path.cpp
  13. 30
      Source/quests.cpp
  14. 4
      Source/stores.cpp
  15. 2
      Source/themes.cpp
  16. 6
      Source/towners.cpp
  17. 2
      Source/trigs.cpp

25
Source/codec.cpp

@ -34,20 +34,21 @@ int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword)
memset(buf, 0, sizeof(buf));
sig = (CodecSignature *)pbSrcDst;
if (sig->error > 0) {
size = 0;
SHA1Clear();
} else {
SHA1Result(0, dst);
if (sig->checksum != *(DWORD *)dst) {
memset(dst, 0, sizeof(dst));
size = 0;
SHA1Clear();
} else {
size += sig->last_chunk_size - 64;
SHA1Clear();
}
goto error;
}
SHA1Result(0, dst);
if (sig->checksum != *(DWORD *)dst) {
memset(dst, 0, sizeof(dst));
goto error;
}
size += sig->last_chunk_size - 64;
SHA1Clear();
return size;
error:
SHA1Clear();
return 0;
}
void codec_init_key(int unused, char *pszPassword)

16
Source/control.cpp

@ -504,9 +504,9 @@ void SetSpell()
spselflag = 0;
if (pSpell != -1) {
ClearPanel();
drawpanflag = 255;
plr[myplr]._pRSpell = pSpell;
plr[myplr]._pRSplType = pSplType;
drawpanflag = 255;
}
}
@ -2465,11 +2465,11 @@ void DrawTalkPan()
int i, off, talk_btn, color, nCel, x;
char *msg;
off = 0;
if (!talkflag)
return;
DrawPanelBox(175, sgbPlrTalkTbl + 20, 294, 5, 239, 516);
off = 0;
for (i = 293; i > 283; off++, i--) {
DrawPanelBox((off >> 1) + 175, sgbPlrTalkTbl + off + 25, i, 1, (off >> 1) + 239, off + 521);
}
@ -2488,8 +2488,8 @@ void DrawTalkPan()
if (msg)
*msg = '\0';
CelDecDatOnly(gpBuffer + x, pSPentSpn2Cels, frame, 12);
talk_btn = 0;
frame = (frame & 7) + 1;
talk_btn = 0;
for (i = 0; i < 4; i++) {
if (i == myplr)
continue;
@ -2728,15 +2728,11 @@ void control_up_down(int v)
{
int i;
i = 0;
while (1) {
for (i = 0; i < 8; i++) {
sgbTalkSavePos = (v + sgbTalkSavePos) & 7;
if (sgszTalkSave[sgbTalkSavePos][0])
break;
i++;
if (i >= 8) {
if (sgszTalkSave[sgbTalkSavePos][0]) {
strcpy(sgszTalkMsg, sgszTalkSave[sgbTalkSavePos]);
return;
}
}
strcpy(sgszTalkMsg, sgszTalkSave[sgbTalkSavePos]);
}

4
Source/drlg_l2.cpp

@ -555,13 +555,13 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy)
void CreateL2Dungeon(DWORD rseed, int entry)
{
if (gbMaxPlayers == 1) {
if (currlevel == 7 && !quests[8]._qactive) {
if (currlevel == 7 && !quests[QTYPE_BLIND]._qactive) {
currlevel = 6;
CreateL2Dungeon(glSeedTbl[6], 4);
currlevel = 7;
}
if (currlevel == 8) {
if (!quests[8]._qactive) {
if (!quests[QTYPE_BLIND]._qactive) {
currlevel = 6;
CreateL2Dungeon(glSeedTbl[6], 4);
currlevel = 8;

4
Source/drlg_l4.cpp

@ -1754,8 +1754,8 @@ BOOL DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy
}
if (currlevel == 15) {
quests[15]._qtx = sx + 1;
quests[15]._qty = sy + 1;
quests[QTYPE_VB]._qtx = sx + 1;
quests[QTYPE_VB]._qty = sy + 1;
}
if (setview == TRUE) {
ViewX = 2 * sx + 21;

4
Source/dthread.cpp

@ -21,7 +21,7 @@ void dthread_remove_player(int pnum)
#endif
for (pkt = sgpInfoHead; pkt; pkt = pkt->pNext) {
if (pkt->dwSpaceLeft == pnum)
pkt->dwSpaceLeft = 4;
pkt->dwSpaceLeft = MAX_PLRS;
}
#ifdef __cplusplus
sgMemCrit.Leave();
@ -106,7 +106,7 @@ unsigned int __stdcall dthread_handler(void *)
#endif
if (pkt) {
if (pkt->dwSpaceLeft != 4)
if (pkt->dwSpaceLeft != MAX_PLRS)
multi_send_zero_packet(pkt->dwSpaceLeft, pkt->data[0], &pkt->data[8], *(DWORD *)&pkt->data[4]);
dwMilliseconds = 1000 * *(DWORD *)&pkt->data[4] / gdwDeltaBytesSec;

12
Source/engine.cpp

@ -164,9 +164,9 @@ void CelDecDatOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth)
*/
void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize, nDataCap;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize, nDataCap;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
@ -205,9 +205,9 @@ void CelDrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce
*/
void CelDecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize, nDataCap;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize, nDataCap;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
@ -924,9 +924,9 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
*/
void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize, nDataCap;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize, nDataCap;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
@ -965,9 +965,9 @@ void Cel2DrawHdrOnly(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C
*/
void Cel2DecodeHdrOnly(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize, nDataCap;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize, nDataCap;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
@ -2480,9 +2480,9 @@ void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel)
*/
void Cl2DecodeFrm1(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)
@ -3112,9 +3112,9 @@ void Cl2DecodeLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int
*/
void Cl2DecodeFrm4(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap)
{
int nDataStart, nDataSize;
BYTE *pRLEBytes;
DWORD *pFrameTable;
int nDataStart, nDataSize;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)

3
Source/gmenu.cpp

@ -220,7 +220,8 @@ void gmenu_clear_buffer(int x, int y, int width, int height)
{
BYTE *i;
for (i = gpBuffer + PitchTbl[y] + x; height; height--) {
i = gpBuffer + PitchTbl[y] + x;
while (height--) {
memset(i, 205, width);
i -= BUFFER_WIDTH;
}

53
Source/items.cpp

@ -752,8 +752,9 @@ void CalcPlrItemMin(int pnum)
p = &plr[pnum];
pi = p->InvList;
i = p->_pNumInv;
for (i = p->_pNumInv; i; i--) {
while (i--) {
pi->_iStatFlag = ItemMinStats(p, pi);
pi++;
}
@ -1947,27 +1948,25 @@ void GetItemBonus(int i, int idata, int minlvl, int maxlvl, int onlygood)
void SetupItem(int i)
{
int it, il;
int it;
it = ItemCAnimTbl[item[i]._iCurs];
item[i]._iAnimData = itemanims[it];
item[i]._iAnimLen = ItemAnimLs[it];
item[i]._iAnimWidth = 96;
item[i]._iAnimWidth2 = 16;
item[i]._iAnimData = itemanims[it];
il = ItemAnimLs[it];
item[i]._iAnimLen = il;
item[i]._iIdentified = FALSE;
item[i]._iPostDraw = FALSE;
if (!plr[myplr].pLvlLoad) {
item[i]._iSelFlag = 0;
il = 1;
item[i]._iAnimFrame = 1;
item[i]._iAnimFlag = TRUE;
item[i]._iSelFlag = 0;
} else {
item[i]._iAnimFrame = item[i]._iAnimLen;
item[i]._iAnimFlag = FALSE;
item[i]._iSelFlag = 1;
}
item[i]._iAnimFrame = il;
}
int RndItem(int m)
@ -2186,9 +2185,9 @@ void GetUniqueItem(int i, int uid)
if (item[i]._iMiscId == IMISC_UNIQUE)
item[i]._iSeed = uid;
item[i]._iCreateInfo |= 0x0200;
item[i]._iUid = uid;
item[i]._iMagical = ITEM_QUALITY_UNIQUE;
item[i]._iCreateInfo |= 0x0200;
}
void SpawnUnique(int uid, int x, int y)
@ -2529,8 +2528,8 @@ void RecreateEar(int ii, WORD ic, int iseed, int Id, int dur, int mdur, int ch,
tempstr[16] = '\0';
sprintf(item[ii]._iName, "Ear of %s", tempstr);
item[ii]._iCurs = ((ivalue >> 6) & 3) + 19;
item[ii]._iCreateInfo = ic;
item[ii]._ivalue = ivalue & 0x3F;
item[ii]._iCreateInfo = ic;
item[ii]._iSeed = iseed;
}
@ -2775,8 +2774,8 @@ void ProcessItems()
PlaySfxLoc(ItemDropSnds[ItemCAnimTbl[item[ii]._iCurs]], item[ii]._ix, item[ii]._iy);
if (item[ii]._iAnimFrame >= item[ii]._iAnimLen) {
item[ii]._iAnimFlag = FALSE;
item[ii]._iAnimFrame = item[ii]._iAnimLen;
item[ii]._iAnimFlag = FALSE;
item[ii]._iSelFlag = 1;
}
}
@ -3742,12 +3741,10 @@ void SortSmith()
sorted = FALSE;
while (j > 0 && !sorted) {
sorted = TRUE;
if (j > 0) {
for (k = 0; k < j; k++) {
if (smithitem[k].IDidx > smithitem[k + 1].IDidx) {
BubbleSwapItem(&smithitem[k], &smithitem[k + 1]);
sorted = FALSE;
}
for (k = 0; k < j; k++) {
if (smithitem[k].IDidx > smithitem[k + 1].IDidx) {
BubbleSwapItem(&smithitem[k], &smithitem[k + 1]);
sorted = FALSE;
}
}
j--;
@ -3958,12 +3955,10 @@ void SortWitch()
sorted = FALSE;
while (j > 3 && !sorted) {
sorted = TRUE;
if (j > 3) {
for (k = 3; k < j; k++) {
if (witchitem[k].IDidx > witchitem[k + 1].IDidx) {
BubbleSwapItem(&witchitem[k], &witchitem[k + 1]);
sorted = FALSE;
}
for (k = 3; k < j; k++) {
if (witchitem[k].IDidx > witchitem[k + 1].IDidx) {
BubbleSwapItem(&witchitem[k], &witchitem[k + 1]);
sorted = FALSE;
}
}
j--;
@ -4152,12 +4147,10 @@ void SortHealer()
sorted = FALSE;
while (j > 2 && !sorted) {
sorted = TRUE;
if (j > 2) {
for (k = 2; k < j; k++) {
if (healitem[k].IDidx > healitem[k + 1].IDidx) {
BubbleSwapItem(&healitem[k], &healitem[k + 1]);
sorted = FALSE;
}
for (k = 2; k < j; k++) {
if (healitem[k].IDidx > healitem[k + 1].IDidx) {
BubbleSwapItem(&healitem[k], &healitem[k + 1]);
sorted = FALSE;
}
}
j--;

7
Source/monster.cpp

@ -1537,8 +1537,11 @@ void M_GetKnockback(int i)
monster[i]._myoff = 0;
monster[i]._mx = monster[i]._moldx;
monster[i]._my = monster[i]._moldy;
monster[i]._mfutx = monster[i]._moldx;
monster[i]._mfuty = monster[i]._moldy;
monster[i]._mfutx = monster[i]._mx;
monster[i]._mfuty = monster[i]._my;
// BUGFIX useless assignment
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
M_CheckEFlag(i);
M_ClearSquares(i);
dMonster[monster[i]._mx][monster[i]._my] = i + 1;

2
Source/msg.cpp

@ -53,7 +53,7 @@ TMegaPkt *msg_get_next_packet()
{
TMegaPkt *result;
sgpCurrPkt = (TMegaPkt *)DiabloAllocPtr(32008);
sgpCurrPkt = (TMegaPkt *)DiabloAllocPtr(sizeof(TMegaPkt));
sgpCurrPkt->pNext = NULL;
sgpCurrPkt->dwSpaceLeft = 32000;

2
Source/pack.cpp

@ -118,7 +118,7 @@ void VerifyGoldSeeds(PlayerStruct *pPlayer)
int i, j;
for (i = 0; i < pPlayer->_pNumInv; i++) {
if (pPlayer->InvList[i].IDidx == IDI_GOLD && pPlayer->_pNumInv > 0) {
if (pPlayer->InvList[i].IDidx == IDI_GOLD) {
for (j = 0; j < pPlayer->_pNumInv; j++) {
if (i != j) {
if (pPlayer->InvList[j].IDidx == IDI_GOLD && pPlayer->InvList[i]._iSeed == pPlayer->InvList[j]._iSeed) {

6
Source/path.cpp

@ -288,7 +288,9 @@ void path_next_node(PATHNODE *pPath)
int f;
next = path_2_nodes;
if (path_2_nodes->NextNode) {
if (!path_2_nodes->NextNode) {
path_2_nodes->NextNode = pPath;
} else {
current = path_2_nodes;
next = path_2_nodes->NextNode;
f = pPath->f;
@ -298,8 +300,6 @@ void path_next_node(PATHNODE *pPath)
}
pPath->NextNode = next;
current->NextNode = pPath;
} else {
path_2_nodes->NextNode = pPath;
}
}

30
Source/quests.cpp

@ -625,26 +625,26 @@ void SetReturnLvlPos()
case SL_SKELKING:
ReturnLvlX = quests[QTYPE_KING]._qtx + 1;
ReturnLvlY = quests[QTYPE_KING]._qty;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvl = quests[QTYPE_KING]._qlevel;
ReturnLvlT = DTYPE_CATHEDRAL;
break;
case SL_BONECHAMB:
ReturnLvlX = quests[QTYPE_BONE]._qtx + 1;
ReturnLvlY = quests[QTYPE_BONE]._qty;
ReturnLvlT = DTYPE_CATACOMBS;
ReturnLvl = quests[QTYPE_BONE]._qlevel;
ReturnLvlT = DTYPE_CATACOMBS;
break;
case SL_POISONWATER:
ReturnLvlX = quests[QTYPE_PW]._qtx;
ReturnLvlY = quests[QTYPE_PW]._qty + 1;
ReturnLvlT = DTYPE_CATHEDRAL;
ReturnLvl = quests[QTYPE_PW]._qlevel;
ReturnLvlT = DTYPE_CATHEDRAL;
break;
case SL_VILEBETRAYER:
ReturnLvlX = quests[QTYPE_VB]._qtx + 1;
ReturnLvlY = quests[QTYPE_VB]._qty - 1;
ReturnLvlT = DTYPE_HELL;
ReturnLvl = quests[QTYPE_VB]._qlevel;
ReturnLvlT = DTYPE_HELL;
break;
}
}
@ -751,17 +751,17 @@ void ResyncQuests()
}
}
if (currlevel == quests[QTYPE_BLKM]._qlevel) {
if (quests[QTYPE_BLKM]._qactive == 1) {
if (!quests[QTYPE_BLKM]._qvar1) {
SpawnQuestItem(IDI_FUNGALTM, 0, 0, 5, 1);
quests[QTYPE_BLKM]._qvar1 = QS_TOMESPAWNED;
}
} else if (quests[QTYPE_BLKM]._qactive == 2) {
if (quests[QTYPE_BLKM]._qvar1 >= QS_MUSHGIVEN) {
Qtalklist[TOWN_WITCH]._qblkm = -1;
Qtalklist[TOWN_HEALER]._qblkm = QUEST_MUSH3;
} else if (quests[QTYPE_BLKM]._qvar1 >= QS_BRAINGIVEN) {
Qtalklist[TOWN_HEALER]._qblkm = -1;
if (quests[QTYPE_BLKM]._qactive == 1 && !quests[QTYPE_BLKM]._qvar1) {
SpawnQuestItem(IDI_FUNGALTM, 0, 0, 5, 1);
quests[QTYPE_BLKM]._qvar1 = QS_TOMESPAWNED;
} else {
if (quests[QTYPE_BLKM]._qactive == 2) {
if (quests[QTYPE_BLKM]._qvar1 >= QS_MUSHGIVEN) {
Qtalklist[TOWN_WITCH]._qblkm = -1;
Qtalklist[TOWN_HEALER]._qblkm = QUEST_MUSH3;
} else if (quests[QTYPE_BLKM]._qvar1 >= QS_BRAINGIVEN) {
Qtalklist[TOWN_HEALER]._qblkm = -1;
}
}
}
}

4
Source/stores.cpp

@ -1384,7 +1384,7 @@ void S_StartTalk()
#else
sn = 0;
for (i = 0; i < 16; i++) {
if (quests[i]._qlevel == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog)
if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog)
sn++;
}
@ -1399,7 +1399,7 @@ void S_StartTalk()
sn2 = sn - 2;
for (i = 0; i < 16; i++) {
if (quests[i]._qlevel == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) {
if (quests[i]._qactive == 2 && ((DWORD *)&Qtalklist[talker])[i] != -1 && quests[i]._qlog) {
AddSText(0, sn, 1, questlist[i]._qlstr, COL_WHITE, 1);
sn += la;
}

2
Source/themes.cpp

@ -393,7 +393,6 @@ void InitThemes()
zharlib = -1;
numthemes = 0;
bCrossFlag = FALSE;
armorFlag = TRUE;
bFountainFlag = TRUE;
cauldronFlag = TRUE;
@ -401,6 +400,7 @@ void InitThemes()
pFountainFlag = TRUE;
tFountainFlag = TRUE;
treasureFlag = TRUE;
bCrossFlag = FALSE;
weaponFlag = TRUE;
if (currlevel == 16)

6
Source/towners.cpp

@ -159,10 +159,10 @@ void SetTownerGPtrs(BYTE *pData, BYTE **pAnim)
void NewTownerAnim(int tnum, BYTE *pAnim, int numFrames, int Delay)
{
towner[tnum]._tAnimCnt = 0;
towner[tnum]._tAnimLen = numFrames;
towner[tnum]._tAnimData = pAnim;
towner[tnum]._tAnimLen = numFrames;
towner[tnum]._tAnimFrame = 1;
towner[tnum]._tAnimCnt = 0;
towner[tnum]._tAnimDelay = Delay;
}
@ -531,7 +531,7 @@ void TownDead()
tidx = GetActiveTowner(TOWN_DEADGUY);
TownCtrlMsg(tidx);
if (!qtextflag) {
if ((quests[6]._qactive != 2 || quests[6]._qlog) && quests[6]._qactive != 1) {
if ((quests[QTYPE_BUTCH]._qactive != 2 || quests[QTYPE_BUTCH]._qlog) && quests[QTYPE_BUTCH]._qactive != 1) {
towner[tidx]._tAnimDelay = 1000;
towner[tidx]._tAnimFrame = 1;
strcpy(towner[tidx]._tName, "Slain Townsman");

2
Source/trigs.cpp

@ -830,7 +830,7 @@ BOOL ForceL4Trig()
void Freeupstairs()
{
int i, yy, xx, tx, ty;
int i, tx, ty, yy, xx;
for (i = 0; i < numtrigs; i++) {
tx = trigs[i]._tx;

Loading…
Cancel
Save