mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Render debug info in tactical
Functionality for rendering pathfinding and cover values in tactical was behind defunct #ifdefs. It's now compiled always, but only enabled if cheat level is BEDUG_CHEAT_LEVEL. Unified rendering the debug info into one function, instead of several nearly identical ones. Ctrl + Shift + Z cycles through the different debug modes. Now it should be fairly easy to add more info modes like these two in the future.
This commit is contained in:
+153
-160
@@ -23,6 +23,7 @@
|
||||
#include "LogicalBodyTypes/BodyTypeDB.h"
|
||||
|
||||
#include "Utilities.h"
|
||||
#include <Cheats.h>
|
||||
|
||||
UINT32 guiShieldGraphic = 0;
|
||||
BOOLEAN fShieldGraphicInit = FALSE;
|
||||
@@ -552,22 +553,25 @@ void ResetRenderParameters( );
|
||||
|
||||
void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
//extern UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ];
|
||||
//extern UINT8 gubGridNoMarkers[ WORLD_MAX ];
|
||||
extern UINT8 * gubFOVDebugInfoInfo;
|
||||
extern UINT8 * gubGridNoMarkers;
|
||||
extern UINT8 gubGridNoValue;
|
||||
extern BOOLEAN gfDisplayCoverValues;
|
||||
extern BOOLEAN gfDisplayGridNoVisibleValues = 0;
|
||||
//extern INT16 gsCoverValue[ WORLD_MAX ];
|
||||
extern INT16 * gsCoverValue;
|
||||
extern INT16 gsBestCover;
|
||||
void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
#endif
|
||||
//extern UINT8 * gubFOVDebugInfoInfo;
|
||||
//extern UINT8 * gubGridNoMarkers;
|
||||
//extern UINT8 gubGridNoValue;
|
||||
//extern BOOLEAN gfDisplayGridNoVisibleValues = 0;
|
||||
//void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
//void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||
extern INT16 gsBestCover;
|
||||
INT32* gRenderDebugInfoValues = nullptr;
|
||||
void RenderDebugInfo(INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS);
|
||||
void ResetDebugInfoValues()
|
||||
{
|
||||
if (gRenderDebugInfoValues)
|
||||
{
|
||||
for (size_t i = 0; i < WORLD_MAX; i++)
|
||||
{
|
||||
gRenderDebugInfoValues[i] = 0x7FFFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteFromWorld( UINT16 usTileIndex, UINT32 uiRenderTiles, UINT16 usIndex );
|
||||
|
||||
@@ -3363,23 +3367,10 @@ UINT32 cnt = 0;
|
||||
RenderRoomInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if( gRenderFlags&RENDER_FLAG_FOVDEBUG )
|
||||
if (DEBUG_CHEAT_LEVEL() && gTacticalStatus.Team[OUR_TEAM].bTeamActive)
|
||||
{
|
||||
RenderFOVDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
RenderDebugInfo(gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS);
|
||||
}
|
||||
else if (gfDisplayCoverValues)
|
||||
{
|
||||
RenderCoverDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
else if (gfDisplayGridNoVisibleValues)
|
||||
{
|
||||
RenderGridNoVisibleDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//#endif
|
||||
|
||||
//RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y );
|
||||
//AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y );
|
||||
@@ -8105,7 +8096,6 @@ void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPoi
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS )
|
||||
{
|
||||
INT8 bXOddFlag = 0;
|
||||
@@ -8215,114 +8205,7 @@ void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStar
|
||||
|
||||
}
|
||||
|
||||
void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS )
|
||||
{
|
||||
INT8 bXOddFlag = 0;
|
||||
INT16 sAnchorPosX_M, sAnchorPosY_M;
|
||||
INT16 sAnchorPosX_S, sAnchorPosY_S;
|
||||
INT16 sTempPosX_M, sTempPosY_M;
|
||||
INT16 sTempPosX_S, sTempPosY_S;
|
||||
BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE;
|
||||
UINT16 usTileIndex;
|
||||
INT16 sX, sY;
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
|
||||
|
||||
// Begin Render Loop
|
||||
sAnchorPosX_M = sStartPointX_M;
|
||||
sAnchorPosY_M = sStartPointY_M;
|
||||
sAnchorPosX_S = sStartPointX_S;
|
||||
sAnchorPosY_S = sStartPointY_S;
|
||||
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
fEndRenderRow = FALSE;
|
||||
sTempPosX_M = sAnchorPosX_M;
|
||||
sTempPosY_M = sAnchorPosY_M;
|
||||
sTempPosX_S = sAnchorPosX_S;
|
||||
sTempPosY_S = sAnchorPosY_S;
|
||||
|
||||
if(bXOddFlag > 0)
|
||||
sTempPosX_S += 20;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M );
|
||||
|
||||
if ( usTileIndex < GRIDSIZE )
|
||||
{
|
||||
sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5;
|
||||
sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5;
|
||||
|
||||
// Adjust for interface level
|
||||
sY -= gpWorldLevelData[ usTileIndex ].sHeight;
|
||||
sY += gsRenderHeight;
|
||||
|
||||
if (gsCoverValue[ usTileIndex] != 0x7F7F)
|
||||
{
|
||||
SetFont( SMALLCOMPFONT );
|
||||
SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE );
|
||||
if (usTileIndex == gsBestCover)
|
||||
{
|
||||
SetFontForeground( FONT_MCOLOR_RED );
|
||||
}
|
||||
else if (gsCoverValue[ usTileIndex ] < 0)
|
||||
{
|
||||
SetFontForeground( FONT_MCOLOR_WHITE );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFontForeground( FONT_GRAY3 );
|
||||
}
|
||||
mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", gsCoverValue[ usTileIndex ] );
|
||||
SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sTempPosX_S += 40;
|
||||
sTempPosX_M ++;
|
||||
sTempPosY_M --;
|
||||
|
||||
if ( sTempPosX_S >= sEndXS )
|
||||
{
|
||||
fEndRenderRow = TRUE;
|
||||
}
|
||||
|
||||
} while( !fEndRenderRow );
|
||||
|
||||
if ( bXOddFlag > 0 )
|
||||
{
|
||||
sAnchorPosY_M ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
sAnchorPosX_M ++;
|
||||
}
|
||||
|
||||
|
||||
bXOddFlag = !bXOddFlag;
|
||||
sAnchorPosY_S += 10;
|
||||
|
||||
if ( sAnchorPosY_S >= sEndYS )
|
||||
{
|
||||
fEndRenderCol = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
while( !fEndRenderCol );
|
||||
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// This one just renders tile gridnos. Not much use nowadays
|
||||
void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS )
|
||||
{
|
||||
INT8 bXOddFlag = 0;
|
||||
@@ -8423,11 +8306,139 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void RenderDebugInfo(INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS)
|
||||
{
|
||||
INT8 bXOddFlag = 0;
|
||||
INT16 sTempPosX_M, sTempPosY_M;
|
||||
INT16 sTempPosX_S, sTempPosY_S;
|
||||
BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE;
|
||||
|
||||
// Begin Render Loop
|
||||
INT16 sAnchorPosX_M = sStartPointX_M;
|
||||
INT16 sAnchorPosY_M = sStartPointY_M;
|
||||
INT16 sAnchorPosX_S = sStartPointX_S;
|
||||
INT16 sAnchorPosY_S = sStartPointY_S;
|
||||
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8* pDestBuf = LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);
|
||||
|
||||
const auto mode = gRenderDebugInfoMode;
|
||||
|
||||
do
|
||||
{
|
||||
fEndRenderRow = FALSE;
|
||||
sTempPosX_M = sAnchorPosX_M;
|
||||
sTempPosY_M = sAnchorPosY_M;
|
||||
sTempPosX_S = sAnchorPosX_S;
|
||||
sTempPosY_S = sAnchorPosY_S;
|
||||
|
||||
if (bXOddFlag > 0)
|
||||
sTempPosX_S += 20;
|
||||
|
||||
do
|
||||
{
|
||||
UINT16 usTileIndex = FASTMAPROWCOLTOPOS(sTempPosY_M, sTempPosX_M);
|
||||
if (usTileIndex < GRIDSIZE)
|
||||
{
|
||||
INT16 sX = sTempPosX_S + (WORLD_TILE_X / 2) - 5;
|
||||
INT16 sY = sTempPosY_S + (WORLD_TILE_Y / 2) - 5;
|
||||
|
||||
// Adjust for interface level
|
||||
sY -= gpWorldLevelData[usTileIndex].sHeight;
|
||||
sY += gsRenderHeight;
|
||||
|
||||
|
||||
if (gRenderDebugInfoValues[usTileIndex] != 0x7FFFFFFF)
|
||||
{
|
||||
SetFont(SMALLCOMPFONT);
|
||||
SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE);
|
||||
|
||||
|
||||
////////////////////////////
|
||||
// Debug mode specific setup
|
||||
switch (mode)
|
||||
{
|
||||
case DEBUG_PATHFINDING:
|
||||
if (gRenderDebugInfoValues[usTileIndex] < 0)
|
||||
{
|
||||
SetFontForeground(FONT_LTRED);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFontForeground(FONT_LTGREEN);
|
||||
}
|
||||
break;
|
||||
case DEBUG_THREATVALUE:
|
||||
//TODO implement
|
||||
goto exit_loop;
|
||||
break;
|
||||
case DEBUG_COVERVALUE:
|
||||
if (usTileIndex == gsBestCover)
|
||||
{
|
||||
SetFontForeground(FONT_YELLOW);
|
||||
}
|
||||
else if (gRenderDebugInfoValues[usTileIndex] < 0)
|
||||
{
|
||||
SetFontForeground(FONT_LTRED);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFontForeground(FONT_LTGREEN);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto exit_loop;
|
||||
break;
|
||||
}
|
||||
////////////////////////////
|
||||
|
||||
|
||||
mprintf_buffer(pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY, L"%d", gRenderDebugInfoValues[usTileIndex]);
|
||||
SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sTempPosX_S += 40;
|
||||
sTempPosX_M++;
|
||||
sTempPosY_M--;
|
||||
|
||||
if (sTempPosX_S >= sEndXS)
|
||||
{
|
||||
fEndRenderRow = TRUE;
|
||||
}
|
||||
|
||||
} while (!fEndRenderRow);
|
||||
|
||||
if (bXOddFlag > 0)
|
||||
{
|
||||
sAnchorPosY_M++;
|
||||
}
|
||||
else
|
||||
{
|
||||
sAnchorPosX_M++;
|
||||
}
|
||||
|
||||
|
||||
bXOddFlag = !bXOddFlag;
|
||||
sAnchorPosY_S += 10;
|
||||
|
||||
if (sAnchorPosY_S >= sEndYS)
|
||||
{
|
||||
fEndRenderCol = TRUE;
|
||||
}
|
||||
} while (!fEndRenderCol);
|
||||
|
||||
exit_loop:
|
||||
UnLockVideoSurface(FRAME_BUFFER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ExamineZBufferRect( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom)
|
||||
{
|
||||
CalcRenderParameters( sLeft, sTop, sRight, sBottom );
|
||||
@@ -9088,21 +9099,3 @@ void SetRenderCenter( INT16 sNewX, INT16 sNewY )
|
||||
gfScrollInertia = FALSE;
|
||||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void RenderFOVDebug( )
|
||||
{
|
||||
RenderFOVDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
|
||||
void RenderCoverDebug( )
|
||||
{
|
||||
RenderCoverDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
|
||||
void RenderGridNoVisibleDebug( )
|
||||
{
|
||||
RenderGridNoVisibleDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -216,6 +216,16 @@ void SetRenderCenter( INT16 sNewX, INT16 sNewY );
|
||||
#ifdef _DEBUG
|
||||
void RenderFOVDebug( );
|
||||
#endif
|
||||
enum RenderDebugInfoModes
|
||||
{
|
||||
DEBUG_PATHFINDING,
|
||||
DEBUG_THREATVALUE,
|
||||
DEBUG_COVERVALUE,
|
||||
DEBUG_OFF
|
||||
};
|
||||
void ResetDebugInfoValues();
|
||||
extern INT32* gRenderDebugInfoValues;
|
||||
|
||||
|
||||
BOOLEAN Zero8BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex );
|
||||
BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZStripIndex );
|
||||
@@ -227,4 +237,4 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip(UINT16 *pBuffer, UINT32 uiD
|
||||
BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE);
|
||||
BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "Button Defines.h"
|
||||
#include "Animation Data.h"
|
||||
#endif
|
||||
#include <Cheats.h>
|
||||
|
||||
|
||||
#define SET_MOVEMENTCOST( a, b, c, d ) ( ( gubWorldMovementCosts[ a ][ b ][ c ] < d ) ? ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) : 0 );
|
||||
@@ -84,7 +85,6 @@ extern UINT8 *gubFOVDebugInfoInfo;
|
||||
extern INT16 gsFullTileDirections[MAX_FULLTILE_DIRECTIONS];
|
||||
extern INT32 dirDelta[8];
|
||||
extern INT16 DirIncrementer[8];
|
||||
extern INT16 *gsCoverValue;
|
||||
extern INT32 gsTempActionGridNo;
|
||||
extern INT32 gsOverItemsGridNo;
|
||||
extern INT32 gsOutOfRangeGridNo;
|
||||
@@ -320,8 +320,6 @@ void DeinitializeWorld()
|
||||
TrashWorld();
|
||||
if(gubGridNoMarkers)
|
||||
MemFree(gubGridNoMarkers);
|
||||
if(gsCoverValue)
|
||||
MemFree(gsCoverValue);
|
||||
if(gubBuildingInfo)
|
||||
MemFree(gubBuildingInfo);
|
||||
if(gusWorldRoomInfo)
|
||||
@@ -4313,10 +4311,12 @@ void SetWorldSize(INT32 nWorldRows, INT32 nWorldCols)
|
||||
gubGridNoMarkers = (UINT8*)MemAlloc(WORLD_MAX);
|
||||
memset(gubGridNoMarkers, 0, sizeof(UINT8)*WORLD_MAX);
|
||||
|
||||
if(gsCoverValue)
|
||||
MemFree(gsCoverValue);
|
||||
gsCoverValue = (INT16*)MemAlloc(sizeof(INT16)*WORLD_MAX);
|
||||
memset(gsCoverValue, 0x7F, sizeof(INT16)*WORLD_MAX);
|
||||
if (DEBUG_CHEAT_LEVEL())
|
||||
{
|
||||
MemFree(gRenderDebugInfoValues);
|
||||
gRenderDebugInfoValues = (INT32*)MemAlloc(sizeof(INT32) * WORLD_MAX);
|
||||
ResetDebugInfoValues();
|
||||
}
|
||||
|
||||
// Init building structures and variables
|
||||
if(gubBuildingInfo)
|
||||
|
||||
Reference in New Issue
Block a user