Skip to content

Commit

Permalink
Fixed tactical world scaling. part-2
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrd2 committed Jul 8, 2019
1 parent ad56a0a commit d3922fa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/game/Tactical/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "Handle_UI.h"
#include "MouseSystem.h"
#include "UILayout.h"


#define MAX_UICOMPOSITES 4
Expand Down Expand Up @@ -44,7 +45,7 @@
#define ARROWS_SHOW_UP_ABOVE_CLIMB3 0x00800000
#define ARROWS_SHOW_DOWN_CLIMB 0x02000000

#define ROOF_LEVEL_HEIGHT 50
#define ROOF_LEVEL_HEIGHT (g_ui.m_tacticalScreenScale * 50)

#define SCROLL_LEFT_PADDING -30
#define SCROLL_RIGHT_PADDING 10
Expand Down
34 changes: 17 additions & 17 deletions src/game/TileEngine/RenderWorld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static SGPRect gOldClipRect;
INT16 gsRenderCenterX;
INT16 gsRenderCenterY;
INT16 gsRenderWorldOffsetX = 0;
INT16 gsRenderWorldOffsetY = 10;
INT16 gsRenderWorldOffsetY = CELL_Y_SIZE;


struct RenderFXType
Expand Down Expand Up @@ -400,7 +400,7 @@ static void RenderTiles(RenderTilesFlags const uiFlags, INT32 const iStartPointX
{
iTileMapPos[uiMapPosIndex] = FASTMAPROWCOLTOPOS(iTempPosY_M, iTempPosX_M);

iTempPosX_S += 40;
iTempPosX_S += WORLD_TILE_X; // maxrd2: was 40
iTempPosX_M++;
iTempPosY_M--;

Expand All @@ -421,7 +421,7 @@ static void RenderTiles(RenderTilesFlags const uiFlags, INT32 const iStartPointX
INT32 iTempPosY_S = iAnchorPosY_S;
UINT32 uiMapPosIndex = 0;

if (bXOddFlag) iTempPosX_S += 20;
if (bXOddFlag) iTempPosX_S += WORLD_TILE_X / 2; // maxrd2: was 20

do
{
Expand Down Expand Up @@ -480,7 +480,7 @@ static void RenderTiles(RenderTilesFlags const uiFlags, INT32 const iStartPointX
//Looking up height every time here is alot better than doing it above!
INT16 const sTileHeight = me.sHeight;

INT16 sModifiedTileHeight = (sTileHeight / 80 - 1) * 80;
INT16 sModifiedTileHeight = (sTileHeight / WORLD_CLIFF_HEIGHT - 1) * WORLD_CLIFF_HEIGHT; // maxrd2: was 80 instead of WORLD_CLIFF_HEIGHTs
if (sModifiedTileHeight < 0) sModifiedTileHeight = 0;

BOOLEAN fRenderTile = TRUE;
Expand Down Expand Up @@ -1583,13 +1583,13 @@ static void RenderTiles(RenderTilesFlags const uiFlags, INT32 const iStartPointX
* taskbar. */
if (iTempPosY_S < 360)
{
ColorFillVideoSurfaceArea(FRAME_BUFFER, iTempPosX_S, iTempPosY_S, iTempPosX_S + 40, MIN(iTempPosY_S + 20, 360), RGB(0, 0, 0));
ColorFillVideoSurfaceArea(FRAME_BUFFER, iTempPosX_S, iTempPosY_S, iTempPosX_S + WORLD_TILE_X, MIN(iTempPosY_S + WORLD_TILE_Y, 360), RGB(0, 0, 0)); // maxrd2: was 40 and 20
}
}
}

next_tile:
iTempPosX_S += 40;
iTempPosX_S += WORLD_TILE_X; // maxrd2: was 40
iTempPosX_M++;
iTempPosY_M--;
} while (iTempPosX_S < iEndXS);
Expand All @@ -1605,7 +1605,7 @@ static void RenderTiles(RenderTilesFlags const uiFlags, INT32 const iStartPointX
}

bXOddFlag = !bXOddFlag;
iAnchorPosY_S += 10;
iAnchorPosY_S += WORLD_TILE_Y / 2; // maxrd2: was 10
}
while (iAnchorPosY_S < iEndYS);

Expand Down Expand Up @@ -2013,7 +2013,7 @@ static BOOLEAN HandleScrollDirections(UINT32 ScrollFlags, INT16 sScrollXStep, IN

static UINT ScrollSpeed(void)
{
UINT speed = 20 << (_KeyDown(SHIFT) ? 2 : gubCurScrollSpeedID);
UINT speed = (2 * CELL_X_SIZE) << (_KeyDown(SHIFT) ? 2 : gubCurScrollSpeedID); // maxrd2: was 20
if (!gfDoVideoScroll) speed *= 2;
return speed;
}
Expand Down Expand Up @@ -2282,7 +2282,7 @@ static BOOLEAN ApplyScrolling(INT16 sTempRenderCenterX, INT16 sTempRenderCenterY

// Adjust for offset position on screen
sScreenCenterX -= 0;
sScreenCenterY -= 10;
sScreenCenterY -= CELL_Y_SIZE;

const INT16 sX_S = g_ui.m_tacticalMapCenterX;
const INT16 sY_S = g_ui.m_tacticalMapCenterY;
Expand Down Expand Up @@ -2453,15 +2453,15 @@ static void RenderRoomInfo(INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sSt
INT16 sTempPosX_S = sAnchorPosX_S;
INT16 sTempPosY_S = sAnchorPosY_S;

if (bXOddFlag) sTempPosX_S += 20;
if (bXOddFlag) sTempPosX_S += WORLD_TILE_X / 2; // maxrd2: was 20

do
{
const UINT16 usTileIndex = FASTMAPROWCOLTOPOS(sTempPosY_M, sTempPosX_M);
if (usTileIndex < GRIDSIZE)
{
const INT16 sX = sTempPosX_S + WORLD_TILE_X / 2 - 5;
INT16 sY = sTempPosY_S + WORLD_TILE_Y / 2 - 5;
const INT16 sX = sTempPosX_S + WORLD_TILE_X / 2 - WORLD_TILE_X / 8; // maxrd2: was 5
INT16 sY = sTempPosY_S + WORLD_TILE_Y / 2 - WORLD_TILE_Y / 4; // maxrd2: was 5

// THIS ROOM STUFF IS ONLY DONE IN THE EDITOR...
// ADJUST BY SHEIGHT
Expand Down Expand Up @@ -2638,7 +2638,7 @@ static void RenderCoverDebugInfo(INT16 sStartPointX_M, INT16 sStartPointY_M, INT
}
}

sTempPosX_S += 40;
sTempPosX_S += WORLD_TILE_X; // maxrd2: was 40
sTempPosX_M++;
sTempPosY_M--;
}
Expand Down Expand Up @@ -2724,7 +2724,7 @@ static void RenderGridNoVisibleDebugInfo(INT16 sStartPointX_M, INT16 sStartPoint
}

bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 10;
sAnchorPosY_S += WORLD_TILE_Y / 2; // maxrd2: was 10
}
while (sAnchorPosY_S < sEndYS);
}
Expand Down Expand Up @@ -2764,7 +2764,7 @@ static void ExamineZBufferForHiddenTiles(INT16 sStartPointX_M, INT16 sStartPoint
INT16 sTempPosX_S = sAnchorPosX_S;
const INT16 sTempPosY_S = sAnchorPosY_S;

if (bXOddFlag) sTempPosX_S += 20;
if (bXOddFlag) sTempPosX_S += WORLD_TILE_X / 2; // maxrd2: was 20

do
{
Expand Down Expand Up @@ -2816,7 +2816,7 @@ static void ExamineZBufferForHiddenTiles(INT16 sStartPointX_M, INT16 sStartPoint
}

ENDOFLOOP:
sTempPosX_S += 40;
sTempPosX_S += WORLD_TILE_X; // maxrd2: was 40
sTempPosX_M++;
sTempPosY_M--;
} while (sTempPosX_S < sEndXS);
Expand All @@ -2831,7 +2831,7 @@ static void ExamineZBufferForHiddenTiles(INT16 sStartPointX_M, INT16 sStartPoint
}

bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 10;
sAnchorPosY_S += WORLD_TILE_Y / 2; // maxrd2: was 10
}
while (sAnchorPosY_S < sEndYS);
}
Expand Down
5 changes: 4 additions & 1 deletion src/game/TileEngine/RenderWorld.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef RENDERWORLD_H
#define RENDERWORLD_H

#include "UILayout.h"


extern BOOLEAN gfDoVideoScroll;
extern UINT8 gubCurScrollSpeedID;

Expand Down Expand Up @@ -35,7 +38,7 @@ ENUM_BITSET(RenderFlags)
#define TOPMOST_Z_LEVEL 32767

/* number of pixels to show the exit sector cursor at the edge of the map */
#define NO_PX_SHOW_EXIT_CURS 15
#define NO_PX_SHOW_EXIT_CURS (g_ui.m_tacticalScreenScale * 15)

enum RenderLayerFlags
{
Expand Down

0 comments on commit d3922fa

Please sign in to comment.