From 32e519415a714e1c011048175c91c6146cc8e2b7 Mon Sep 17 00:00:00 2001 From: qndel Date: Sat, 21 Sep 2019 11:37:55 +0200 Subject: [PATCH 1/9] GetDirection cleanup --- Source/engine.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 35ae01520..b5fd3d4d4 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2301,12 +2301,13 @@ int GetDirection(int x1, int y1, int x2, int y2) if (2 * my < mx) return DIR_SE; } else { - ny = -mx; if (my >= 0) { + ny = -mx; md = DIR_W; if (2 * ny < my) md = DIR_SW; } else { + ny = -mx; my = -my; md = DIR_N; if (2 * ny < my) From d71e447a043b2a7fc9606b9c4c66a92ba552ad4d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 24 Sep 2019 06:02:07 +0200 Subject: [PATCH 2/9] Improve build time Most Mac images at Travis are severely outdated each build spends about 5 minutes just to update the brew package list before it is able to install any packages. Switching to a known more recent image solves this situation for now. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 871a5065d..962081ac8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ language: cpp os: - linux - osx + +osx_image: xcode10.3 notifications: email: @@ -15,7 +17,6 @@ addons: homebrew: packages: - mingw-w64 - update: true env: - MAKE_BUILD=make From da78f547122e66b59ae1eea3c59a6ce1bec08e12 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 24 Sep 2019 19:06:54 +0200 Subject: [PATCH 3/9] Apply plr_class --- Source/towners.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/towners.cpp b/Source/towners.cpp index 7a6e4fc2d..968541e18 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -689,11 +689,11 @@ void TalkToTowner(int p, int t) towner[t]._tVar1 = p; quests[QTYPE_BUTCH]._qvar1 = 1; #ifndef SPAWN - if (plr[p]._pClass == 0 && !effect_is_playing(PS_WARR8)) { + if (plr[p]._pClass == PC_WARRIOR && !effect_is_playing(PS_WARR8)) { PlaySFX(PS_WARR8); - } else if (plr[p]._pClass == 1 && !effect_is_playing(PS_ROGUE8)) { + } else if (plr[p]._pClass == PC_ROGUE && !effect_is_playing(PS_ROGUE8)) { PlaySFX(PS_ROGUE8); - } else if (plr[p]._pClass == 2 && !effect_is_playing(PS_MAGE8)) { + } else if (plr[p]._pClass == PC_SORCERER && !effect_is_playing(PS_MAGE8)) { PlaySFX(PS_MAGE8); } #endif From ddec3ce5bb745cedc062c9a85889a88c6b598f64 Mon Sep 17 00:00:00 2001 From: qndel Date: Wed, 25 Sep 2019 19:40:10 +0200 Subject: [PATCH 4/9] PrintStoreItem cleanup --- Source/stores.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index 6c6a56f76..d9043f93d 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -449,6 +449,8 @@ void S_ScrollSBuy(int idx) void PrintStoreItem(ItemStruct *x, int l, char iclr) { char sstr[128]; + char str, dex; + BYTE mag; sstr[0] = '\0'; if (x->_iIdentified) { @@ -488,7 +490,10 @@ void PrintStoreItem(ItemStruct *x, int l, char iclr) } if (!x->_itype) sstr[0] = '\0'; - if (!(x->_iMinStr + x->_iMinMag + x->_iMinDex)) { + str = x->_iMinStr; + dex = x->_iMinDex; + mag = x->_iMinMag; + if (!(str + mag + dex)) { strcat(sstr, "No required attributes"); } else { strcpy(tempstr, "Required:"); @@ -500,10 +505,10 @@ void PrintStoreItem(ItemStruct *x, int l, char iclr) sprintf(tempstr, "%s %i Dex", tempstr, x->_iMinDex); strcat(sstr, tempstr); } - AddSText(40, l, 0, sstr, iclr, 0); + AddSText(40, l++, 0, sstr, iclr, 0); if (x->_iMagical == ITEM_QUALITY_UNIQUE) { if (x->_iIdentified) - AddSText(40, l + 1, 0, "Unique Item", iclr, 0); + AddSText(40, l, 0, "Unique Item", iclr, 0); } } From d3389f3f7cc1b44cbc97db9e5071da16bd415d27 Mon Sep 17 00:00:00 2001 From: qndel Date: Wed, 25 Sep 2019 18:54:54 +0200 Subject: [PATCH 5/9] DrawSLine cleanup --- Source/stores.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index d9043f93d..2bf8d1a99 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -195,16 +195,17 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val) void DrawSLine(int y) { - int xy, yy, width, line; + int xy, yy, width, line, sy; + sy = SStringY[y]; if (stextsize == 1) { xy = SCREENXY(26, 25); - yy = PitchTbl[SStringY[y] + 198] + 26 + 64; + yy = PitchTbl[sy + 198] + 26 + 64; width = 586 / 4; line = BUFFER_WIDTH - 586; } else { xy = SCREENXY(346, 25); - yy = PitchTbl[SStringY[y] + 198] + 346 + 64; + yy = PitchTbl[sy + 198] + 346 + 64; width = 266 / 4; line = BUFFER_WIDTH - 266; } From 5253e285846586b0158ba7ed1d906de481aea9ec Mon Sep 17 00:00:00 2001 From: qndel Date: Wed, 25 Sep 2019 14:05:28 +0200 Subject: [PATCH 6/9] InitAutomap cleanup --- Source/automap.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index 432b8cc5f..de22aaf52 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -71,24 +71,21 @@ void InitAutomap() switch (leveltype) { case DTYPE_CATHEDRAL: pAFile = LoadFileInMem("Levels\\L1Data\\L1.AMP", &dwTiles); - dwTiles >>= 1; break; case DTYPE_CATACOMBS: pAFile = LoadFileInMem("Levels\\L2Data\\L2.AMP", &dwTiles); - dwTiles >>= 1; break; case DTYPE_CAVES: pAFile = LoadFileInMem("Levels\\L3Data\\L3.AMP", &dwTiles); - dwTiles >>= 1; break; case DTYPE_HELL: pAFile = LoadFileInMem("Levels\\L4Data\\L4.AMP", &dwTiles); - dwTiles >>= 1; break; default: return; } + dwTiles >>= 1; pTmp = pAFile; for (i = 1; i <= dwTiles; i++) { From d0421621c4a7095d640ae4c8cc6f136af5f5ca37 Mon Sep 17 00:00:00 2001 From: qndel Date: Wed, 25 Sep 2019 17:56:34 +0200 Subject: [PATCH 7/9] InitMonsterGFX cleanup --- Source/monster.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/Source/monster.cpp b/Source/monster.cpp index 807f9aa52..5e9c56da4 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -328,34 +328,22 @@ void InitMonsterGFX(int monst) MissileFileFlag |= 2; LoadMissileGFX(MFILE_THINLGHT); } - if (mtype == MT_SUCCUBUS) { - if (MissileFileFlag & 4) - return; - + if (mtype == MT_SUCCUBUS && !(MissileFileFlag & 4)) { MissileFileFlag |= 4; LoadMissileGFX(MFILE_FLARE); LoadMissileGFX(MFILE_FLAREEXP); } - if (mtype == MT_SNOWWICH) { - if (MissileFileFlag & 0x20) - return; - + if (mtype == MT_SNOWWICH && !(MissileFileFlag & 0x20)) { MissileFileFlag |= 0x20; LoadMissileGFX(MFILE_SCUBMISB); LoadMissileGFX(MFILE_SCBSEXPB); } - if (mtype == MT_HLSPWN) { - if (MissileFileFlag & 0x40) - return; - + if (mtype == MT_HLSPWN && !(MissileFileFlag & 0x40)) { MissileFileFlag |= 0x40; LoadMissileGFX(MFILE_SCUBMISD); LoadMissileGFX(MFILE_SCBSEXPD); } - if (mtype == MT_SOLBRNR) { - if (MissileFileFlag & 0x80) - return; - + if (mtype == MT_SOLBRNR && !(MissileFileFlag & 0x80)) { MissileFileFlag |= 0x80; LoadMissileGFX(MFILE_SCUBMISC); LoadMissileGFX(MFILE_SCBSEXPC); From 0704393bc3396f3d190da8f2c7ff879100058b4b Mon Sep 17 00:00:00 2001 From: qndel Date: Wed, 25 Sep 2019 19:18:38 +0200 Subject: [PATCH 8/9] StoreAutoPlace cleanup --- Source/stores.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index 2bf8d1a99..dc41200c6 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -327,9 +327,9 @@ void StoreAutoPlace() int i, w, h, idx; SetICursor(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM); - done = FALSE; w = icursW28; h = icursH28; + done = FALSE; if (w == 1 && h == 1) { idx = plr[myplr].HoldItem.IDidx; if (plr[myplr].HoldItem._iStatFlag && AllItemsList[idx].iUsable) { From 449b9fd2dc08c24fad11732886e980e8e42450d8 Mon Sep 17 00:00:00 2001 From: qndel Date: Fri, 27 Sep 2019 02:42:10 +0200 Subject: [PATCH 9/9] CastSpell cleanup --- Source/spells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/spells.cpp b/Source/spells.cpp index 8bd5d983e..c9bde2a22 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -138,7 +138,7 @@ void CastSpell(int id, int spl, int sx, int sy, int dx, int dy, int caster, int if (spelldata[spl].sMissiles[0] == MIS_CBOLT) { UseMana(id, SPL_CBOLT); - for (i = 0; i < (spllvl >> 1) + 3; i++) { + for (i = (spllvl >> 1) + 3; i > 0; i--) { AddMissile(sx, sy, dx, dy, dir, MIS_CBOLT, caster, id, 0, spllvl); } }