Browse Source

♻️ Replace 'ViewX' and 'ViewY' globals with single 'ViewPosition'

pull/2799/head
Juliano Leal Goncalves 5 years ago committed by Stephen C. Wills
parent
commit
940a120bf9
  1. 14
      Source/automap.cpp
  2. 6
      Source/cursor.cpp
  3. 25
      Source/drlg_l1.cpp
  4. 12
      Source/drlg_l2.cpp
  5. 12
      Source/drlg_l3.cpp
  6. 26
      Source/drlg_l4.cpp
  7. 3
      Source/gendung.cpp
  8. 6
      Source/gendung.h
  9. 7
      Source/loadsave.cpp
  10. 3
      Source/missiles.cpp
  11. 22
      Source/monster.cpp
  12. 20
      Source/player.cpp
  13. 10
      Source/portal.cpp
  14. 3
      Source/quests.cpp
  15. 58
      Source/scrollrt.cpp
  16. 3
      Source/spells.cpp
  17. 21
      Source/town.cpp

14
Source/automap.cpp

@ -281,8 +281,8 @@ void SearchAutomapItem(const Surface &out, const Displacement &myPlayerOffset)
if (dItem[i][j] == 0)
continue;
int px = i - 2 * AutomapOffset.deltaX - ViewX;
int py = j - 2 * AutomapOffset.deltaY - ViewY;
int px = i - 2 * AutomapOffset.deltaX - ViewPosition.x;
int py = j - 2 * AutomapOffset.deltaY - ViewPosition.y;
Point screen = {
(myPlayerOffset.deltaX * AutoMapScale / 100 / 2) + (px - py) * AmLine16 + gnScreenWidth / 2,
@ -318,8 +318,8 @@ void DrawAutomapPlr(const Surface &out, const Displacement &myPlayerOffset, int
tile.y++;
}
int px = tile.x - 2 * AutomapOffset.deltaX - ViewX;
int py = tile.y - 2 * AutomapOffset.deltaY - ViewY;
int px = tile.x - 2 * AutomapOffset.deltaX - ViewPosition.x;
int py = tile.y - 2 * AutomapOffset.deltaY - ViewPosition.y;
Displacement playerOffset = player.position.offset;
if (player.IsWalking())
@ -616,7 +616,7 @@ void DrawAutomap(const Surface &out)
return;
}
Automap = { (ViewX - 16) / 2, (ViewY - 16) / 2 };
Automap = { (ViewPosition.x - 16) / 2, (ViewPosition.y - 16) / 2 };
while (Automap.x + AutomapOffset.deltaX < 0)
AutomapOffset.deltaX++;
while (Automap.x + AutomapOffset.deltaX >= DMAXX)
@ -654,11 +654,11 @@ void DrawAutomap(const Surface &out)
screen.x -= AmLine64 * (cells / 2) - AmLine32;
screen.y -= AmLine32 * (cells / 2) + AmLine16;
}
if ((ViewX & 1) != 0) {
if ((ViewPosition.x & 1) != 0) {
screen.x -= AmLine16;
screen.y -= AmLine8;
}
if ((ViewY & 1) != 0) {
if ((ViewPosition.y & 1) != 0) {
screen.x += AmLine16;
screen.y -= AmLine8;
}

6
Source/cursor.cpp

@ -190,7 +190,7 @@ void CelDrawCursor(const Surface &out, Point position, int cursId)
void InitLevelCursor()
{
NewCursor(CURSOR_HAND);
cursPosition = { ViewX, ViewY };
cursPosition = ViewPosition;
pcurstemp = -1;
pcursmonst = -1;
pcursobj = -1;
@ -296,8 +296,8 @@ void CheckCursMove()
}
// Convert to tile grid
int mx = ViewX;
int my = ViewY;
int mx = ViewPosition.x;
int my = ViewPosition.y;
int columns = 0;
int rows = 0;

25
Source/drlg_l1.cpp

@ -856,8 +856,7 @@ int PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool s
}
if (setview) {
ViewX = 2 * sx + 19;
ViewY = 2 * sy + 20;
ViewPosition = Point { 19, 20 } + Displacement { sx, sy } * 2;
}
if (sx < cx && sy < cy)
@ -2209,7 +2208,7 @@ void GenerateLevel(lvl_entry entry)
} else {
if (PlaceMiniSet(PWATERIN, 1, 1, 0, 0, false, -1) < 0)
doneflag = false;
ViewY--;
ViewPosition.y--;
}
}
if (Quests[Q_LTBANNER].IsAvailable()) {
@ -2220,10 +2219,9 @@ void GenerateLevel(lvl_entry entry)
if (PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1) < 0)
doneflag = false;
if (entry == ENTRY_PREV) {
ViewX = 2 * setpc_x + 20;
ViewY = 2 * setpc_y + 28;
ViewPosition = Point { 20, 28 } + Displacement { setpc_x, setpc_y } * 2;
} else {
ViewY--;
ViewPosition.y--;
}
}
} else if (entry == ENTRY_MAIN) {
@ -2244,7 +2242,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = false;
if (PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1) < 0)
doneflag = false;
ViewY++;
ViewPosition.y++;
} else {
if (PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
@ -2252,7 +2250,7 @@ void GenerateLevel(lvl_entry entry)
if (PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1) < 0)
doneflag = false;
}
ViewY++;
ViewPosition.y++;
}
} else if (!Players[MyPlayerId].pOriginalCathedral && entry == ENTRY_PREV) {
if (currlevel < 21) {
@ -2260,13 +2258,13 @@ void GenerateLevel(lvl_entry entry)
doneflag = false;
if (PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
ViewY--;
ViewPosition.y--;
} else if (currlevel == 21) {
if (PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, false, -1) < 0)
doneflag = false;
if (PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
ViewY += 3;
ViewPosition.y += 3;
} else {
if (PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
@ -2274,7 +2272,7 @@ void GenerateLevel(lvl_entry entry)
if (PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
}
ViewY += 3;
ViewPosition.y += 3;
}
} else {
if (currlevel < 21) {
@ -2288,7 +2286,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = false;
else if (PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1) < 0)
doneflag = false;
ViewY--;
ViewPosition.y--;
}
} else if (currlevel == 21) {
if (PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, true, -1) < 0)
@ -2439,8 +2437,7 @@ void LoadL1Dungeon(const char *path, int vx, int vy)
FillFloor();
ViewX = vx;
ViewY = vy;
ViewPosition = { vx, vy };
Pass3();
DRLG_Init_Globals();

12
Source/drlg_l2.cpp

@ -1716,8 +1716,7 @@ bool PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool
}
if (setview) {
ViewX = 2 * sx + 21;
ViewY = 2 * sy + 22;
ViewPosition = Point { 21, 22 } + Displacement { sx, sy } * 2;
}
return true;
@ -2925,7 +2924,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, false);
}
}
ViewY -= 2;
ViewPosition.y -= 2;
} else if (entry == ENTRY_PREV) {
doneflag = PlaceMiniSet(USTAIRS, 1, 1, -1, -1, false);
if (doneflag) {
@ -2934,7 +2933,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, false);
}
}
ViewX--;
ViewPosition.x--;
} else {
doneflag = PlaceMiniSet(USTAIRS, 1, 1, -1, -1, false);
if (doneflag) {
@ -2943,7 +2942,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = PlaceMiniSet(WARPSTAIRS, 1, 1, -1, -1, true);
}
}
ViewY -= 2;
ViewPosition.y -= 2;
}
}
@ -3130,8 +3129,7 @@ void LoadL2Dungeon(const char *path, int vx, int vy)
InitDungeonPieces();
ViewX = vx;
ViewY = vy;
ViewPosition = { vx, vy };
SetMapMonsters(dunData.get(), { 0, 0 });
SetMapObjects(dunData.get(), 0, 0);

12
Source/drlg_l3.cpp

@ -1666,8 +1666,7 @@ bool PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool
}
if (setview) {
ViewX = 2 * sx + 17;
ViewY = 2 * sy + 19;
ViewPosition = Point { 17, 19 } + Displacement { sx, sy } * 2;
}
return false;
@ -2290,13 +2289,11 @@ void GenerateLevel(lvl_entry entry)
if (!genok) {
if (currlevel < 17) {
genok = PlaceMiniSet(L3DOWN, 1, 1, -1, -1, true);
ViewX += 2;
ViewY -= 2;
ViewPosition += { 2, -2 };
} else {
if (currlevel != 20) {
genok = PlaceMiniSet(L6DOWN, 1, 1, -1, -1, true);
ViewX += 2;
ViewY -= 2;
ViewPosition += { 2, -2 };
}
}
if (!genok && currlevel == 9) {
@ -2554,8 +2551,7 @@ void LoadL3Dungeon(const char *path, int vx, int vy)
Pass3();
DRLG_Init_Globals();
ViewX = vx;
ViewY = vy;
ViewPosition = { vx, vy };
SetMapMonsters(dunData.get(), { 0, 0 });
SetMapObjects(dunData.get(), 0, 0);

26
Source/drlg_l4.cpp

@ -244,8 +244,7 @@ bool PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool
Quests[Q_BETRAYER].position = { sx + 1, sy + 1 };
}
if (setview) {
ViewX = 2 * sx + 21;
ViewY = 2 * sy + 22;
ViewPosition = Point { 21, 22 } + Displacement { sx, sy } * 2;
}
return true;
@ -1347,20 +1346,19 @@ void GenerateLevel(lvl_entry entry)
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, false);
}
ViewX++;
ViewPosition.x++;
} else if (entry == ENTRY_PREV) {
doneflag = PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false);
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, false);
}
ViewX = 2 * setpc_x + 22;
ViewY = 2 * setpc_y + 22;
ViewPosition = Point { 22, 22 } + Displacement { setpc_x, setpc_y } * 2;
} else {
doneflag = PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false);
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, true);
}
ViewX++;
ViewPosition.x++;
}
} else if (currlevel != 15) {
if (entry == ENTRY_MAIN) {
@ -1371,7 +1369,7 @@ void GenerateLevel(lvl_entry entry)
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, false);
}
ViewX++;
ViewPosition.x++;
} else if (entry == ENTRY_PREV) {
doneflag = PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false);
if (doneflag && currlevel != 16) {
@ -1380,7 +1378,7 @@ void GenerateLevel(lvl_entry entry)
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, false);
}
ViewY++;
ViewPosition.y++;
} else {
doneflag = PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false);
if (doneflag && currlevel != 16) {
@ -1389,7 +1387,7 @@ void GenerateLevel(lvl_entry entry)
if (doneflag && currlevel == 13) {
doneflag = PlaceMiniSet(L4TWARP, 1, 1, -1, -1, true);
}
ViewX++;
ViewPosition.x++;
}
} else {
if (entry == ENTRY_MAIN) {
@ -1401,7 +1399,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, false);
}
}
ViewX++;
ViewPosition.x++;
} else {
doneflag = PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, false);
if (doneflag) {
@ -1411,7 +1409,7 @@ void GenerateLevel(lvl_entry entry)
doneflag = PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, true);
}
}
ViewY++;
ViewPosition.y++;
}
}
} while (!doneflag);
@ -1475,8 +1473,7 @@ void CreateL4Dungeon(uint32_t rseed, lvl_entry entry)
dmaxx = 96;
dmaxy = 96;
ViewX = 40;
ViewY = 40;
ViewPosition = { 40, 40 };
DRLG_InitSetPC();
LoadQuestSetPieces();
@ -1500,8 +1497,7 @@ void LoadL4Dungeon(const char *path, int vx, int vy)
SetRoom(dunData.get(), 0, 0);
ViewX = vx;
ViewY = vy;
ViewPosition = { vx, vy };
Pass3();
DRLG_Init_Globals();

3
Source/gendung.cpp

@ -41,8 +41,7 @@ BYTE currlevel;
bool setlevel;
_setlevels setlvlnum;
dungeon_type setlvltype;
int ViewX;
int ViewY;
Point ViewPosition;
ScrollStruct ScrollInfo;
int MicroTileLen;
char TransVal;

6
Source/gendung.h

@ -182,10 +182,8 @@ extern bool setlevel;
extern _setlevels setlvlnum;
/** Specifies the player viewpoint X-coordinate of the map. */
extern dungeon_type setlvltype;
/** Specifies the player viewpoint X-coordinate of the map. */
extern int ViewX;
/** Specifies the player viewpoint Y-coordinate of the map. */
extern int ViewY;
/** Specifies the player viewpoint X,Y-coordinates of the map. */
extern Point ViewPosition;
extern ScrollStruct ScrollInfo;
extern int MicroTileLen;
extern char TransVal;

7
Source/loadsave.cpp

@ -1716,8 +1716,7 @@ void LoadGame(bool firstflag)
SyncInitPlr(MyPlayerId);
SyncPlrAnim(MyPlayerId);
ViewX = viewX;
ViewY = viewY;
ViewPosition = { viewX, viewY };
ActiveMonsterCount = tmpNummonsters;
ActiveItemCount = tmpNumitems;
ActiveMissileCount = tmpNummissiles;
@ -1898,8 +1897,8 @@ void SaveGameData()
file.WriteBE<uint32_t>(setlvlnum);
file.WriteBE<uint32_t>(currlevel);
file.WriteBE<uint32_t>(leveltype);
file.WriteBE<int32_t>(ViewX);
file.WriteBE<int32_t>(ViewY);
file.WriteBE<int32_t>(ViewPosition.x);
file.WriteBE<int32_t>(ViewPosition.y);
file.WriteLE<uint8_t>(invflag ? 1 : 0);
file.WriteLE<uint8_t>(chrflag ? 1 : 0);
file.WriteBE<int32_t>(ActiveMonsterCount);

3
Source/missiles.cpp

@ -3761,8 +3761,7 @@ void MI_Teleport(Missile &missile)
ChangeVisionXY(player._pvid, player.position.tile);
}
if (id == MyPlayerId) {
ViewX = player.position.tile.x - ScrollInfo.tile.x;
ViewY = player.position.tile.y - ScrollInfo.tile.y;
ViewPosition = Point { 0, 0 } + (player.position.tile - ScrollInfo.tile);
}
}

22
Source/monster.cpp

@ -1084,11 +1084,11 @@ void DiabloDeath(Monster &diablo, bool sendmsg)
}
AddLight(diablo.position.tile, 8);
DoVision(diablo.position.tile, 8, false, true);
int dist = diablo.position.tile.WalkingDistance({ ViewX, ViewY });
int dist = diablo.position.tile.WalkingDistance(ViewPosition);
if (dist > 20)
dist = 20;
diablo._mVar3 = ViewX << 16;
diablo.position.temp.x = ViewY << 16;
diablo._mVar3 = ViewPosition.x << 16;
diablo.position.temp.x = ViewPosition.y << 16;
diablo.position.temp.y = (int)((diablo._mVar3 - (diablo.position.tile.x << 16)) / (double)dist);
diablo.position.offset2.deltaX = (int)((diablo.position.temp.x - (diablo.position.tile.y << 16)) / (double)dist);
}
@ -1806,16 +1806,16 @@ bool MonsterDeath(int i)
monster._mVar1++;
if (monster.MType->mtype == MT_DIABLO) {
if (monster.position.tile.x < ViewX) {
ViewX--;
} else if (monster.position.tile.x > ViewX) {
ViewX++;
if (monster.position.tile.x < ViewPosition.x) {
ViewPosition.x--;
} else if (monster.position.tile.x > ViewPosition.x) {
ViewPosition.x++;
}
if (monster.position.tile.y < ViewY) {
ViewY--;
} else if (monster.position.tile.y > ViewY) {
ViewY++;
if (monster.position.tile.y < ViewPosition.y) {
ViewPosition.y--;
} else if (monster.position.tile.y > ViewPosition.y) {
ViewPosition.y++;
}
if (monster._mVar1 == 140)

20
Source/player.cpp

@ -307,8 +307,7 @@ constexpr std::array<const DirectionSettings, 8> WalkSettings { {
void ScrollViewPort(const Player &player, _scroll_direction dir)
{
ScrollInfo.tile.x = player.position.tile.x - ViewX;
ScrollInfo.tile.y = player.position.tile.y - ViewY;
ScrollInfo.tile = Point { 0, 0 } + (player.position.tile - ViewPosition);
if (zoomflag) {
if (abs(ScrollInfo.tile.x) >= 3 || abs(ScrollInfo.tile.y) >= 3) {
@ -430,8 +429,7 @@ void StartWalkStand(int pnum)
if (pnum == MyPlayerId) {
ScrollInfo.offset = { 0, 0 };
ScrollInfo._sdir = SDIR_NONE;
ViewX = player.position.tile.x;
ViewY = player.position.tile.y;
ViewPosition = player.position.tile;
}
}
@ -745,8 +743,7 @@ bool DoWalk(int pnum, int variant)
//Update the "camera" tile position
if (pnum == MyPlayerId && ScrollInfo._sdir != SDIR_NONE) {
ViewX = player.position.tile.x - ScrollInfo.tile.x;
ViewY = player.position.tile.y - ScrollInfo.tile.y;
ViewPosition = Point { 0, 0 } + (player.position.tile - ScrollInfo.tile);
}
if (player.walkpath[0] != WALK_NONE) {
@ -2747,7 +2744,7 @@ void InitPlayer(Player &player, bool firstTime)
if (&player == &myPlayer) {
if (!firstTime || currlevel != 0) {
player.position.tile = { ViewX, ViewY };
player.position.tile = ViewPosition;
}
} else {
unsigned i;
@ -2808,8 +2805,7 @@ void InitMultiView()
}
auto &myPlayer = Players[MyPlayerId];
ViewX = myPlayer.position.tile.x;
ViewY = myPlayer.position.tile.y;
ViewPosition = myPlayer.position.tile;
}
void PlrClrTrans(Point position)
@ -2855,8 +2851,7 @@ void FixPlayerLocation(int pnum, Direction bDir)
if (pnum == MyPlayerId) {
ScrollInfo.offset = { 0, 0 };
ScrollInfo._sdir = SDIR_NONE;
ViewX = player.position.tile.x;
ViewY = player.position.tile.y;
ViewPosition = player.position.tile;
}
ChangeLightXY(player._plid, player.position.tile);
ChangeVisionXY(player._pvid, player.position.tile);
@ -3655,8 +3650,7 @@ void SyncInitPlrPos(int pnum)
if (pnum == MyPlayerId) {
player.position.future = position;
ViewX = position.x;
ViewY = position.y;
ViewPosition = position;
}
}

10
Source/portal.cpp

@ -162,15 +162,13 @@ void GetPortalLevel()
void GetPortalLvlPos()
{
if (currlevel == 0) {
ViewX = WarpDropX[portalindex] + 1;
ViewY = WarpDropY[portalindex] + 1;
ViewPosition = Point { WarpDropX[portalindex], WarpDropY[portalindex] } + Displacement { 1, 1 };
} else {
ViewX = Portals[portalindex].position.x;
ViewY = Portals[portalindex].position.y;
ViewPosition = Portals[portalindex].position;
if (portalindex != MyPlayerId) {
ViewX++;
ViewY++;
ViewPosition.x++;
ViewPosition.y++;
}
}
}

3
Source/quests.cpp

@ -587,8 +587,7 @@ void GetReturnLvlPos()
{
if (Quests[Q_BETRAYER]._qactive == QUEST_DONE)
Quests[Q_BETRAYER]._qvar2 = 2;
ViewX = ReturnLvlX;
ViewY = ReturnLvlY;
ViewPosition = { ReturnLvlX, ReturnLvlY };
currlevel = ReturnLevel;
leveltype = ReturnLevelType;
}

58
Source/scrollrt.cpp

@ -1624,66 +1624,66 @@ void ScrollView()
scroll = false;
if (MousePosition.x < 20) {
if (dmaxy - 1 <= ViewY || dminx >= ViewX) {
if (dmaxy - 1 > ViewY) {
ViewY++;
if (dmaxy - 1 <= ViewPosition.y || dminx >= ViewPosition.x) {
if (dmaxy - 1 > ViewPosition.y) {
ViewPosition.y++;
scroll = true;
}
if (dminx < ViewX) {
ViewX--;
if (dminx < ViewPosition.x) {
ViewPosition.x--;
scroll = true;
}
} else {
ViewY++;
ViewX--;
ViewPosition.y++;
ViewPosition.x--;
scroll = true;
}
}
if (MousePosition.x > gnScreenWidth - 20) {
if (dmaxx - 1 <= ViewX || dminy >= ViewY) {
if (dmaxx - 1 > ViewX) {
ViewX++;
if (dmaxx - 1 <= ViewPosition.x || dminy >= ViewPosition.y) {
if (dmaxx - 1 > ViewPosition.x) {
ViewPosition.x++;
scroll = true;
}
if (dminy < ViewY) {
ViewY--;
if (dminy < ViewPosition.y) {
ViewPosition.y--;
scroll = true;
}
} else {
ViewY--;
ViewX++;
ViewPosition.y--;
ViewPosition.x++;
scroll = true;
}
}
if (MousePosition.y < 20) {
if (dminy >= ViewY || dminx >= ViewX) {
if (dminy < ViewY) {
ViewY--;
if (dminy >= ViewPosition.y || dminx >= ViewPosition.x) {
if (dminy < ViewPosition.y) {
ViewPosition.y--;
scroll = true;
}
if (dminx < ViewX) {
ViewX--;
if (dminx < ViewPosition.x) {
ViewPosition.x--;
scroll = true;
}
} else {
ViewX--;
ViewY--;
ViewPosition.x--;
ViewPosition.y--;
scroll = true;
}
}
if (MousePosition.y > gnScreenHeight - 20) {
if (dmaxy - 1 <= ViewY || dmaxx - 1 <= ViewX) {
if (dmaxy - 1 > ViewY) {
ViewY++;
if (dmaxy - 1 <= ViewPosition.y || dmaxx - 1 <= ViewPosition.x) {
if (dmaxy - 1 > ViewPosition.y) {
ViewPosition.y++;
scroll = true;
}
if (dmaxx - 1 > ViewX) {
ViewX++;
if (dmaxx - 1 > ViewPosition.x) {
ViewPosition.x++;
scroll = true;
}
} else {
ViewX++;
ViewY++;
ViewPosition.x++;
ViewPosition.y++;
scroll = true;
}
}
@ -1768,7 +1768,7 @@ void DrawAndBlit()
nthread_UpdateProgressToNextGameTick();
DrawView(out, ViewX, ViewY);
DrawView(out, ViewPosition.x, ViewPosition.y);
if (ctrlPan) {
DrawCtrlPan(out);
}

3
Source/spells.cpp

@ -101,8 +101,7 @@ void PlacePlayer(int pnum)
dPlayer[newPosition.x][newPosition.y] = pnum + 1;
if (pnum == MyPlayerId) {
ViewX = newPosition.x;
ViewY = newPosition.y;
ViewPosition = newPosition;
}
}
}

21
Source/town.cpp

@ -276,31 +276,24 @@ void CreateTown(lvl_entry entry)
DRLG_Init_Globals();
if (entry == ENTRY_MAIN) { // New game
ViewX = 75;
ViewY = 68;
ViewPosition = { 75, 68 };
} else if (entry == ENTRY_PREV) { // Cathedral
ViewX = 25;
ViewY = 31;
ViewPosition = { 25, 31 };
} else if (entry == ENTRY_TWARPUP) {
if (TWarpFrom == 5) {
ViewX = 49;
ViewY = 22;
ViewPosition = { 49, 22 };
}
if (TWarpFrom == 9) {
ViewX = 18;
ViewY = 69;
ViewPosition = { 18, 69 };
}
if (TWarpFrom == 13) {
ViewX = 41;
ViewY = 81;
ViewPosition = { 41, 81 };
}
if (TWarpFrom == 21) {
ViewX = 36;
ViewY = 25;
ViewPosition = { 36, 25 };
}
if (TWarpFrom == 17) {
ViewX = 79;
ViewY = 62;
ViewPosition = { 79, 62 };
}
}

Loading…
Cancel
Save