mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +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:
+51
-2
@@ -87,7 +87,7 @@
|
|||||||
#include "SaveLoadScreen.h"
|
#include "SaveLoadScreen.h"
|
||||||
#include "Map Screen Interface.h" // added by Flugente for SquadNames
|
#include "Map Screen Interface.h" // added by Flugente for SquadNames
|
||||||
#include "Keys.h" // added by silversurfer for door handling from the side
|
#include "Keys.h" // added by silversurfer for door handling from the side
|
||||||
|
#include "Cheats.h"
|
||||||
#include "AIInternals.h"
|
#include "AIInternals.h"
|
||||||
extern BOOLEAN gubWorldTileInLight[MAX_ALLOWED_WORLD_MAX];
|
extern BOOLEAN gubWorldTileInLight[MAX_ALLOWED_WORLD_MAX];
|
||||||
extern BOOLEAN gubIsCorpseThere[MAX_ALLOWED_WORLD_MAX];
|
extern BOOLEAN gubIsCorpseThere[MAX_ALLOWED_WORLD_MAX];
|
||||||
@@ -386,7 +386,7 @@ BOOLEAN gfDisplayTimerCursor = FALSE;
|
|||||||
UINT32 guiTimerCursorID = 0;
|
UINT32 guiTimerCursorID = 0;
|
||||||
UINT32 guiTimerLastUpdate = 0;
|
UINT32 guiTimerLastUpdate = 0;
|
||||||
UINT32 guiTimerCursorDelay = 0;
|
UINT32 guiTimerCursorDelay = 0;
|
||||||
|
UINT8 gRenderDebugInfoMode = DEBUG_OFF;
|
||||||
|
|
||||||
CHAR16 gzLocation[ 20 ];
|
CHAR16 gzLocation[ 20 ];
|
||||||
BOOLEAN gfLocation = FALSE;
|
BOOLEAN gfLocation = FALSE;
|
||||||
@@ -518,6 +518,54 @@ void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp
|
|||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void HandleRenderDebugInfoModes()
|
||||||
|
{
|
||||||
|
if (DEBUG_CHEAT_LEVEL())
|
||||||
|
{
|
||||||
|
switch (gRenderDebugInfoMode)
|
||||||
|
{
|
||||||
|
case DEBUG_PATHFINDING:
|
||||||
|
// Nothing to do here, pathfinding info is filled in the pathing functions.
|
||||||
|
break;
|
||||||
|
case DEBUG_THREATVALUE:
|
||||||
|
break;
|
||||||
|
case DEBUG_COVERVALUE:
|
||||||
|
// Calculate cover values for pSoldier under cursor, or for currently selected merc, if nobody is under the cursor.
|
||||||
|
if (gTacticalStatus.Team[OUR_TEAM].bTeamActive)
|
||||||
|
{
|
||||||
|
static SOLDIERTYPE* previousSoldier = nullptr;
|
||||||
|
static INT32 previousLocation = NOWHERE;
|
||||||
|
static UINT8 previousStance = 0;
|
||||||
|
|
||||||
|
UINT16 usSoldierIndex = NOBODY;
|
||||||
|
UINT32 uiMercFlags;
|
||||||
|
FindSoldierFromMouse(&usSoldierIndex, &uiMercFlags);
|
||||||
|
if (usSoldierIndex == NOBODY)
|
||||||
|
{
|
||||||
|
usSoldierIndex = gusSelectedSoldier;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usSoldierIndex != NOBODY)
|
||||||
|
{
|
||||||
|
// Get Soldier
|
||||||
|
INT32 iPercentBetter;
|
||||||
|
SOLDIERTYPE* pSoldier;
|
||||||
|
GetSoldier(&pSoldier, usSoldierIndex);
|
||||||
|
if (previousSoldier != pSoldier || previousLocation != pSoldier->sGridNo || previousStance != gAnimControl[pSoldier->usAnimState].ubEndHeight)
|
||||||
|
{
|
||||||
|
FindBestNearbyCover(pSoldier, pSoldier->aiData.bAIMorale, &iPercentBetter);
|
||||||
|
previousSoldier = pSoldier;
|
||||||
|
previousLocation = pSoldier->sGridNo;
|
||||||
|
previousStance = gAnimControl[pSoldier->usAnimState].ubEndHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // off
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PreventFromTheFreezingBug(SOLDIERTYPE* pSoldier)
|
void PreventFromTheFreezingBug(SOLDIERTYPE* pSoldier)
|
||||||
{
|
{
|
||||||
@@ -691,6 +739,7 @@ UINT32 HandleTacticalUI( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HandleRenderDebugInfoModes();
|
||||||
// Check if current event has changed and clear event if so, to prepare it for execution
|
// Check if current event has changed and clear event if so, to prepare it for execution
|
||||||
// Clearing it does things like set first time flag, param variables, etc
|
// Clearing it does things like set first time flag, param variables, etc
|
||||||
if ( uiNewEvent != guiOldEvent )
|
if ( uiNewEvent != guiOldEvent )
|
||||||
|
|||||||
@@ -296,6 +296,8 @@ extern BOOLEAN gfUIForceReExamineCursorData;
|
|||||||
extern INT16 guiCreateGuyIndex;
|
extern INT16 guiCreateGuyIndex;
|
||||||
extern INT16 guiCreateBadGuyIndex;
|
extern INT16 guiCreateBadGuyIndex;
|
||||||
|
|
||||||
|
extern UINT8 gRenderDebugInfoMode;
|
||||||
|
|
||||||
// WANNE: Calculate the APs to turn around
|
// WANNE: Calculate the APs to turn around
|
||||||
INT16 APsToTurnAround(SOLDIERTYPE *pSoldier, INT32 sAdjustedGridNo);
|
INT16 APsToTurnAround(SOLDIERTYPE *pSoldier, INT32 sAdjustedGridNo);
|
||||||
|
|
||||||
@@ -382,4 +384,4 @@ void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY );
|
|||||||
//Legion by Jazz
|
//Legion by Jazz
|
||||||
void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp );
|
void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+34
-101
@@ -25,7 +25,7 @@
|
|||||||
#include "english.h"
|
#include "english.h"
|
||||||
#include "worlddef.h"
|
#include "worlddef.h"
|
||||||
#include "worldman.h"
|
#include "worldman.h"
|
||||||
// #include "renderworld.h"
|
#include "renderworld.h"
|
||||||
#include "pathai.h"
|
#include "pathai.h"
|
||||||
#include "Points.h"
|
#include "Points.h"
|
||||||
#include "ai.h"
|
#include "ai.h"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
#include "Rotting Corpses.h"
|
#include "Rotting Corpses.h"
|
||||||
#include "Meanwhile.h"
|
#include "Meanwhile.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
|
#include <Cheats.h>
|
||||||
#include "LOS.h" //ddd
|
#include "LOS.h" //ddd
|
||||||
|
|
||||||
//forward declarations of common classes to eliminate includes
|
//forward declarations of common classes to eliminate includes
|
||||||
@@ -66,19 +66,8 @@ extern BOOLEAN InGasSpot(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel);
|
|||||||
// skiplist has extra level of pointers every 4 elements, so a level 5is optimized for
|
// skiplist has extra level of pointers every 4 elements, so a level 5is optimized for
|
||||||
// 4 to the power of 5 elements, or 2 to the power of 10, 1024
|
// 4 to the power of 5 elements, or 2 to the power of 10, 1024
|
||||||
|
|
||||||
//#define PATHAI_VISIBLE_DEBUG
|
|
||||||
|
|
||||||
//#define PATHAI_SKIPLIST_DEBUG
|
//#define PATHAI_SKIPLIST_DEBUG
|
||||||
|
|
||||||
#ifdef PATHAI_VISIBLE_DEBUG
|
|
||||||
#include "video.h"
|
|
||||||
|
|
||||||
//extern INT16 gsCoverValue[WORLD_MAX];
|
|
||||||
extern INT16 * gsCoverValue;
|
|
||||||
BOOLEAN gfDisplayCoverValues = TRUE;
|
|
||||||
BOOLEAN gfDrawPathPoints = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOLEAN gfPlotPathToExitGrid = FALSE;
|
BOOLEAN gfPlotPathToExitGrid = FALSE;
|
||||||
BOOLEAN gfRecalculatingExistingPathCost = FALSE;
|
BOOLEAN gfRecalculatingExistingPathCost = FALSE;
|
||||||
UINT8 gubGlobalPathFlags = 0;
|
UINT8 gubGlobalPathFlags = 0;
|
||||||
@@ -623,15 +612,12 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
memset( gsCoverValue, 0x7F, sizeof( INT16 ) * WORLD_MAX );
|
ResetDebugInfoValues();
|
||||||
|
gRenderDebugInfoValues[ StartNode ] = 0;
|
||||||
|
PATHAI_VISIBLE_DEBUG_Counter = 1;
|
||||||
}
|
}
|
||||||
gsCoverValue[ StartNode ] = 0;
|
|
||||||
PATHAI_VISIBLE_DEBUG_Counter = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//init other private data, mostly flags
|
//init other private data, mostly flags
|
||||||
endDir = lastDir = direction = startDir = 0;
|
endDir = lastDir = direction = startDir = 0;
|
||||||
@@ -796,12 +782,10 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
SetRenderFlags( RENDER_FLAG_FULL );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Count the number of steps, but keep it less than the max path length.
|
// Count the number of steps, but keep it less than the max path length.
|
||||||
// Adjust the parent until it begins at the tail end of the max path length (or the dest if reachable)
|
// Adjust the parent until it begins at the tail end of the max path length (or the dest if reachable)
|
||||||
@@ -884,12 +868,10 @@ int AStarPathfinder::GetPath(SOLDIERTYPE *s ,
|
|||||||
sizePath = giPathDataSize;
|
sizePath = giPathDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
SetRenderFlags( RENDER_FLAG_FULL );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COUNT_PATHS
|
#ifdef COUNT_PATHS
|
||||||
guiSuccessfulPathChecks++;
|
guiSuccessfulPathChecks++;
|
||||||
@@ -1001,15 +983,13 @@ void AStarPathfinder::ExecuteAStarLogic()
|
|||||||
SetAStarStatus(ParentNode, AStar_Closed);
|
SetAStarStatus(ParentNode, AStar_Closed);
|
||||||
//ClosedList.push_back(ParentNode);
|
//ClosedList.push_back(ParentNode);
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
if (gsCoverValue[ ParentNode ] > 0)
|
if (gRenderDebugInfoValues[ParentNode] > 0)
|
||||||
{
|
{
|
||||||
gsCoverValue[ ParentNode ] *= -1;
|
gRenderDebugInfoValues[ParentNode] *= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Shouldn't G and AP be the same thing?
|
// Shouldn't G and AP be the same thing?
|
||||||
INT16 baseGCost = GetAStarG(ParentNode);
|
INT16 baseGCost = GetAStarG(ParentNode);
|
||||||
@@ -1092,7 +1072,7 @@ void AStarPathfinder::ExecuteAStarLogic()
|
|||||||
gpWorldLevelData[ CurrentNode ].ubExtFlags[0] |= MAPELEMENT_EXT_CLIMBPOINT;
|
gpWorldLevelData[ CurrentNode ].ubExtFlags[0] |= MAPELEMENT_EXT_CLIMBPOINT;
|
||||||
gpWorldLevelData[ ParentNode ].ubExtFlags[1] |= MAPELEMENT_EXT_CLIMBPOINT;
|
gpWorldLevelData[ ParentNode ].ubExtFlags[1] |= MAPELEMENT_EXT_CLIMBPOINT;
|
||||||
#ifdef ROOF_DEBUG
|
#ifdef ROOF_DEBUG
|
||||||
gsCoverValue[CurrentNode] = 1;
|
gRenderDebugInfoValues[CurrentNode] = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1190,26 +1170,13 @@ void AStarPathfinder::ExecuteAStarLogic()
|
|||||||
int AStarH = CalcH();
|
int AStarH = CalcH();
|
||||||
int AStarF = (AStarG + extraGCoverCost) + AStarH;
|
int AStarF = (AStarG + extraGCoverCost) + AStarH;
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
if (gsCoverValue[CurrentNode] == 0x7F7F)
|
if (gRenderDebugInfoValues[CurrentNode] == 0x7FFFFFFF)
|
||||||
{
|
{
|
||||||
//gsCoverValue[CurrentNode] = PATHAI_VISIBLE_DEBUG_Counter++;
|
gRenderDebugInfoValues[CurrentNode] = (INT16) AStarF;
|
||||||
gsCoverValue[CurrentNode] = (INT16) AStarF;
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (gsCoverValue[CurrentNodeIndex] >= 0)
|
|
||||||
{
|
|
||||||
gsCoverValue[CurrentNodeIndex]++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gsCoverValue[CurrentNodeIndex]--;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//insert this node onto the heap
|
//insert this node onto the heap
|
||||||
if (GetAStarStatus(CurrentNode) == AStar_Init)
|
if (GetAStarStatus(CurrentNode) == AStar_Init)
|
||||||
@@ -2260,9 +2227,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT32 sDestination, INT8 bLevel, INT16 usMov
|
|||||||
CHAR8 zTempString[1000], zTS[50];
|
CHAR8 zTempString[1000], zTS[50];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PATHAI_VISIBLE_DEBUG
|
|
||||||
UINT16 usCounter = 0;
|
UINT16 usCounter = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
fVehicle = FALSE;
|
fVehicle = FALSE;
|
||||||
iOriginationX = iOriginationY = 0;
|
iOriginationX = iOriginationY = 0;
|
||||||
@@ -2512,12 +2477,10 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
|||||||
memset( pathQ, 0, iMaxPathQ * sizeof( path_t ) );
|
memset( pathQ, 0, iMaxPathQ * sizeof( path_t ) );
|
||||||
memset( trailTree, 0, iMaxTrailTree * sizeof( trail_t ) );
|
memset( trailTree, 0, iMaxTrailTree * sizeof( trail_t ) );
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
memset( gsCoverValue, 0x7F, sizeof( INT16 ) * WORLD_MAX );
|
ResetDebugInfoValues();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bSkipListLevel = 1;
|
bSkipListLevel = 1;
|
||||||
iSkipListSize = 0;
|
iSkipListSize = 0;
|
||||||
@@ -2629,15 +2592,13 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
|||||||
// remember the cost used to get here...
|
// remember the cost used to get here...
|
||||||
prevCost = gubWorldMovementCosts[ trailTree[ sCurPathNdx ].sGridNo ][ trailTree[ sCurPathNdx ].stepDir ][ bLevel ];
|
prevCost = gubWorldMovementCosts[ trailTree[ sCurPathNdx ].sGridNo ][ trailTree[ sCurPathNdx ].stepDir ][ bLevel ];
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
{
|
||||||
if (gsCoverValue[ curLoc ] > 0)
|
if (gRenderDebugInfoValues[ curLoc ] > 0)
|
||||||
{
|
{
|
||||||
gsCoverValue[ curLoc ] *= -1;
|
gRenderDebugInfoValues[ curLoc ] *= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (fTurnSlow)
|
if (fTurnSlow)
|
||||||
@@ -3563,27 +3524,13 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
|||||||
// costs less than the best so far to the same location?
|
// costs less than the best so far to the same location?
|
||||||
if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc])
|
if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc])
|
||||||
{
|
{
|
||||||
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
{
|
||||||
|
if (gRenderDebugInfoValues[newLoc] == 0x7FFFFFFF)
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
|
||||||
{
|
|
||||||
if (gsCoverValue[newLoc] == 0x7F7F)
|
|
||||||
{
|
{
|
||||||
gsCoverValue[newLoc] = usCounter++;
|
gRenderDebugInfoValues[newLoc] = usCounter++;
|
||||||
}
|
}
|
||||||
/*
|
}
|
||||||
else if (gsCoverValue[newLoc] >= 0)
|
|
||||||
{
|
|
||||||
gsCoverValue[newLoc]++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gsCoverValue[newLoc]--;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//NEWQUENODE;
|
//NEWQUENODE;
|
||||||
{
|
{
|
||||||
@@ -3826,20 +3773,13 @@ ENDOFLOOP:
|
|||||||
while (pathQNotEmpty && pathNotYetFound);
|
while (pathQNotEmpty && pathNotYetFound);
|
||||||
|
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
{
|
||||||
|
if ( guiCurrentScreen == GAME_SCREEN )
|
||||||
{
|
{
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
InvalidateRegion(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y);
|
||||||
if ( guiCurrentScreen == GAME_SCREEN )
|
|
||||||
{
|
|
||||||
RenderWorld();
|
|
||||||
RenderCoverDebug( );
|
|
||||||
InvalidateScreen( );
|
|
||||||
EndFrameBufferRender();
|
|
||||||
RefreshScreen( NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
|
||||||
// work finished. Did we find a path?
|
// work finished. Did we find a path?
|
||||||
@@ -3894,17 +3834,10 @@ ENDOFLOOP:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_PATHFINDING && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues && gfDrawPathPoints)
|
{
|
||||||
{
|
InvalidateRegion(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y);
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
}
|
||||||
RenderWorld();
|
|
||||||
RenderCoverDebug( );
|
|
||||||
InvalidateScreen( );
|
|
||||||
EndFrameBufferRender();
|
|
||||||
RefreshScreen( NULL );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// return path length : serves as a "successful" flag and a path length counter
|
// return path length : serves as a "successful" flag and a path length counter
|
||||||
|
|||||||
@@ -1700,6 +1700,24 @@ void ItemCreationCallBack( UINT8 ubResult )
|
|||||||
memset(gszMsgBoxInputString,0,sizeof(gszMsgBoxInputString));
|
memset(gszMsgBoxInputString,0,sizeof(gszMsgBoxInputString));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CycleThroughTileDebugInfo()
|
||||||
|
{
|
||||||
|
const STR16 modeStrings[] =
|
||||||
|
{
|
||||||
|
L"Pathfinding",
|
||||||
|
L"Threat values",
|
||||||
|
L"Cover values",
|
||||||
|
L"Off",
|
||||||
|
};
|
||||||
|
|
||||||
|
gRenderDebugInfoMode += 1;
|
||||||
|
if (gRenderDebugInfoMode > DEBUG_OFF)
|
||||||
|
{
|
||||||
|
gRenderDebugInfoMode = 0;
|
||||||
|
}
|
||||||
|
ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, modeStrings[gRenderDebugInfoMode]);
|
||||||
|
}
|
||||||
|
|
||||||
extern BOOLEAN gfDisableRegionActive;
|
extern BOOLEAN gfDisableRegionActive;
|
||||||
extern BOOLEAN gfUserTurnRegionActive;
|
extern BOOLEAN gfUserTurnRegionActive;
|
||||||
|
|
||||||
@@ -4763,6 +4781,13 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
|
if (fCtrl)
|
||||||
|
{
|
||||||
|
if (DEBUG_CHEAT_LEVEL())
|
||||||
|
{
|
||||||
|
CycleThroughTileDebugInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,7 @@
|
|||||||
#include "Render Fun.h"
|
#include "Render Fun.h"
|
||||||
#include "Boxing.h"
|
#include "Boxing.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#ifdef _DEBUG
|
#include "renderworld.h"
|
||||||
#include "renderworld.h"
|
|
||||||
#include "video.h"
|
|
||||||
#endif
|
|
||||||
#include "worldman.h"
|
#include "worldman.h"
|
||||||
#include "strategicmap.h"
|
#include "strategicmap.h"
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
@@ -27,6 +24,7 @@
|
|||||||
#include "GameSettings.h"
|
#include "GameSettings.h"
|
||||||
#include "Soldier Profile.h"
|
#include "Soldier Profile.h"
|
||||||
#include "rotting corpses.h" // sevenfm
|
#include "rotting corpses.h" // sevenfm
|
||||||
|
#include <Cheats.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -34,17 +32,7 @@
|
|||||||
// were changed to GetAPsCrouch() and GetAPsProne()
|
// were changed to GetAPsCrouch() and GetAPsProne()
|
||||||
// - also all "APBPConstants[AP_PICKUP_ITEM]" were replaced by GetBasicAPsToPickupItem()
|
// - also all "APBPConstants[AP_PICKUP_ITEM]" were replaced by GetBasicAPsToPickupItem()
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
INT16 gsBestCover;
|
||||||
INT16 * gsCoverValue = NULL;
|
|
||||||
#ifdef _DEBUG
|
|
||||||
|
|
||||||
INT16 gsBestCover;
|
|
||||||
#ifndef PATHAI_VISIBLE_DEBUG
|
|
||||||
// NB Change this to true to get visible cover debug -- CJC
|
|
||||||
BOOLEAN gfDisplayCoverValues = FALSE;
|
|
||||||
#endif
|
|
||||||
extern void RenderCoverDebug( void );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
INT16 gubAIPathCosts[19][19];
|
INT16 gubAIPathCosts[19][19];
|
||||||
|
|
||||||
@@ -693,6 +681,11 @@ static void CalculateCoverValue(SOLDIERTYPE* pSoldier, const INT32 sGridNo, cons
|
|||||||
|
|
||||||
INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentBetter, INT32 targetGridNo)
|
INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentBetter, INT32 targetGridNo)
|
||||||
{
|
{
|
||||||
|
if (gRenderDebugInfoMode == DEBUG_COVERVALUE && DEBUG_CHEAT_LEVEL())
|
||||||
|
{
|
||||||
|
ResetDebugInfoValues();
|
||||||
|
}
|
||||||
|
|
||||||
DebugMsg(TOPIC_JA2AI,DBG_LEVEL_3,String("FindBestNearbyCover"));
|
DebugMsg(TOPIC_JA2AI,DBG_LEVEL_3,String("FindBestNearbyCover"));
|
||||||
|
|
||||||
// all 32-bit integers for max. speed
|
// all 32-bit integers for max. speed
|
||||||
@@ -761,12 +754,6 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
|||||||
|
|
||||||
iBestCoverValue = -1;
|
iBestCoverValue = -1;
|
||||||
|
|
||||||
#if defined( _DEBUG ) && defined( COVER_DEBUG )
|
|
||||||
if (gfDisplayCoverValues)
|
|
||||||
{
|
|
||||||
memset( gsCoverValue, 0x7F, sizeof( INT16 ) * WORLD_MAX );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//NameMessage(pSoldier,"looking for some cover...");
|
//NameMessage(pSoldier,"looking for some cover...");
|
||||||
|
|
||||||
@@ -850,6 +837,11 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
|||||||
// cover we are searching for must be better than what we have now!
|
// cover we are searching for must be better than what we have now!
|
||||||
CalculateCoverValue(pSoldier, targetGridNo, 0, iMyThreatValue, uiThreatCnt, ubDiff, fNight, ubBackgroundLightPercent, morale, iCurrentCoverValue, iCurrentScale);
|
CalculateCoverValue(pSoldier, targetGridNo, 0, iMyThreatValue, uiThreatCnt, ubDiff, fNight, ubBackgroundLightPercent, morale, iCurrentCoverValue, iCurrentScale);
|
||||||
|
|
||||||
|
if (gRenderDebugInfoMode == DEBUG_COVERVALUE && DEBUG_CHEAT_LEVEL())
|
||||||
|
{
|
||||||
|
gRenderDebugInfoValues[targetGridNo] = (INT32)(iCurrentCoverValue / 100);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUGCOVER
|
#ifdef DEBUGCOVER
|
||||||
// AINumMessage("Search Range = ",iSearchRange);
|
// AINumMessage("Search Range = ",iSearchRange);
|
||||||
#endif
|
#endif
|
||||||
@@ -1057,12 +1049,10 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( _DEBUG ) && defined( COVER_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_COVERVALUE && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues)
|
|
||||||
{
|
{
|
||||||
gsCoverValue[sGridNo] = (INT16) (iCoverValue / 100);
|
gRenderDebugInfoValues[sGridNo] = (INT32) (iCoverValue / 100);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// if this is better than the best place found so far
|
// if this is better than the best place found so far
|
||||||
|
|
||||||
@@ -1099,34 +1089,15 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
|||||||
gubNPCAPBudget = 0;
|
gubNPCAPBudget = 0;
|
||||||
gubNPCDistLimit = 0;
|
gubNPCDistLimit = 0;
|
||||||
|
|
||||||
#if defined( _DEBUG ) && !defined( PATHAI_VISIBLE_DEBUG )
|
if (gRenderDebugInfoMode == DEBUG_COVERVALUE && DEBUG_CHEAT_LEVEL())
|
||||||
if (gfDisplayCoverValues)
|
|
||||||
{
|
{
|
||||||
// do a locate?
|
|
||||||
LocateSoldier( pSoldier->ubID, SETLOCATORFAST );
|
|
||||||
gsBestCover = sBestCover;
|
gsBestCover = sBestCover;
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
InvalidateRegion(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y);
|
||||||
RenderWorld();
|
|
||||||
RenderCoverDebug( );
|
|
||||||
InvalidateScreen( );
|
|
||||||
EndFrameBufferRender();
|
|
||||||
RefreshScreen( NULL );
|
|
||||||
/*
|
|
||||||
iLoop = GetJA2Clock();
|
|
||||||
do
|
|
||||||
{
|
|
||||||
|
|
||||||
} while( ( GetJA2Clock( ) - iLoop ) < 2000 );
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// if a better cover location was found
|
// if a better cover location was found
|
||||||
if (!TileIsOutOfBounds(sBestCover))
|
if (!TileIsOutOfBounds(sBestCover))
|
||||||
{
|
{
|
||||||
#if defined( _DEBUG ) && !defined( PATHAI_VISIBLE_DEBUG )
|
|
||||||
gsBestCover = sBestCover;
|
|
||||||
#endif
|
|
||||||
// cover values already take the AP cost of getting there into account in
|
// cover values already take the AP cost of getting there into account in
|
||||||
// a BIG way, so no need to worry about that here, even small improvements
|
// a BIG way, so no need to worry about that here, even small improvements
|
||||||
// are actually very significant once we get our APs back (if we live!)
|
// are actually very significant once we get our APs back (if we live!)
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
extern INT16 gubAIPathCosts[19][19];
|
extern INT16 gubAIPathCosts[19][19];
|
||||||
#define AI_PATHCOST_RADIUS 9
|
#define AI_PATHCOST_RADIUS 9
|
||||||
|
|
||||||
extern BOOLEAN gfDisplayCoverValues;
|
|
||||||
//extern INT16 gsCoverValue[WORLD_MAX];
|
|
||||||
extern INT16 * gsCoverValue;
|
|
||||||
|
|
||||||
// AI actions
|
// AI actions
|
||||||
|
|
||||||
enum CreatureCalls
|
enum CreatureCalls
|
||||||
|
|||||||
+153
-160
@@ -23,6 +23,7 @@
|
|||||||
#include "LogicalBodyTypes/BodyTypeDB.h"
|
#include "LogicalBodyTypes/BodyTypeDB.h"
|
||||||
|
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
#include <Cheats.h>
|
||||||
|
|
||||||
UINT32 guiShieldGraphic = 0;
|
UINT32 guiShieldGraphic = 0;
|
||||||
BOOLEAN fShieldGraphicInit = FALSE;
|
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 );
|
void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||||
|
|
||||||
|
//extern UINT8 * gubFOVDebugInfoInfo;
|
||||||
#ifdef _DEBUG
|
//extern UINT8 * gubGridNoMarkers;
|
||||||
//extern UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ];
|
//extern UINT8 gubGridNoValue;
|
||||||
//extern UINT8 gubGridNoMarkers[ WORLD_MAX ];
|
//extern BOOLEAN gfDisplayGridNoVisibleValues = 0;
|
||||||
extern UINT8 * gubFOVDebugInfoInfo;
|
//void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||||
extern UINT8 * gubGridNoMarkers;
|
//void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
||||||
extern UINT8 gubGridNoValue;
|
extern INT16 gsBestCover;
|
||||||
extern BOOLEAN gfDisplayCoverValues;
|
INT32* gRenderDebugInfoValues = nullptr;
|
||||||
extern BOOLEAN gfDisplayGridNoVisibleValues = 0;
|
void RenderDebugInfo(INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS);
|
||||||
//extern INT16 gsCoverValue[ WORLD_MAX ];
|
void ResetDebugInfoValues()
|
||||||
extern INT16 * gsCoverValue;
|
{
|
||||||
extern INT16 gsBestCover;
|
if (gRenderDebugInfoValues)
|
||||||
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 );
|
for (size_t i = 0; i < WORLD_MAX; i++)
|
||||||
void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
|
{
|
||||||
#endif
|
gRenderDebugInfoValues[i] = 0x7FFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DeleteFromWorld( UINT16 usTileIndex, UINT32 uiRenderTiles, UINT16 usIndex );
|
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 );
|
RenderRoomInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
if (DEBUG_CHEAT_LEVEL() && gTacticalStatus.Team[OUR_TEAM].bTeamActive)
|
||||||
if( gRenderFlags&RENDER_FLAG_FOVDEBUG )
|
|
||||||
{
|
{
|
||||||
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 );
|
//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 );
|
//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
|
#ifdef _DEBUG
|
||||||
|
|
||||||
void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS )
|
void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS )
|
||||||
{
|
{
|
||||||
INT8 bXOddFlag = 0;
|
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 )
|
// This one just renders tile gridnos. Not much use nowadays
|
||||||
{
|
|
||||||
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 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RenderGridNoVisibleDebugInfo( 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 )
|
||||||
{
|
{
|
||||||
INT8 bXOddFlag = 0;
|
INT8 bXOddFlag = 0;
|
||||||
@@ -8423,11 +8306,139 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I
|
|||||||
UnLockVideoSurface( FRAME_BUFFER );
|
UnLockVideoSurface( FRAME_BUFFER );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#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)
|
void ExamineZBufferRect( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom)
|
||||||
{
|
{
|
||||||
CalcRenderParameters( sLeft, sTop, sRight, sBottom );
|
CalcRenderParameters( sLeft, sTop, sRight, sBottom );
|
||||||
@@ -9088,21 +9099,3 @@ void SetRenderCenter( INT16 sNewX, INT16 sNewY )
|
|||||||
gfScrollInertia = FALSE;
|
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
|
#ifdef _DEBUG
|
||||||
void RenderFOVDebug( );
|
void RenderFOVDebug( );
|
||||||
#endif
|
#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 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 );
|
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 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);
|
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 "Button Defines.h"
|
||||||
#include "Animation Data.h"
|
#include "Animation Data.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <Cheats.h>
|
||||||
|
|
||||||
|
|
||||||
#define SET_MOVEMENTCOST( a, b, c, d ) ( ( gubWorldMovementCosts[ a ][ b ][ c ] < d ) ? ( gubWorldMovementCosts[ a ][ b ][ c ] = d ) : 0 );
|
#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 INT16 gsFullTileDirections[MAX_FULLTILE_DIRECTIONS];
|
||||||
extern INT32 dirDelta[8];
|
extern INT32 dirDelta[8];
|
||||||
extern INT16 DirIncrementer[8];
|
extern INT16 DirIncrementer[8];
|
||||||
extern INT16 *gsCoverValue;
|
|
||||||
extern INT32 gsTempActionGridNo;
|
extern INT32 gsTempActionGridNo;
|
||||||
extern INT32 gsOverItemsGridNo;
|
extern INT32 gsOverItemsGridNo;
|
||||||
extern INT32 gsOutOfRangeGridNo;
|
extern INT32 gsOutOfRangeGridNo;
|
||||||
@@ -320,8 +320,6 @@ void DeinitializeWorld()
|
|||||||
TrashWorld();
|
TrashWorld();
|
||||||
if(gubGridNoMarkers)
|
if(gubGridNoMarkers)
|
||||||
MemFree(gubGridNoMarkers);
|
MemFree(gubGridNoMarkers);
|
||||||
if(gsCoverValue)
|
|
||||||
MemFree(gsCoverValue);
|
|
||||||
if(gubBuildingInfo)
|
if(gubBuildingInfo)
|
||||||
MemFree(gubBuildingInfo);
|
MemFree(gubBuildingInfo);
|
||||||
if(gusWorldRoomInfo)
|
if(gusWorldRoomInfo)
|
||||||
@@ -4313,10 +4311,12 @@ void SetWorldSize(INT32 nWorldRows, INT32 nWorldCols)
|
|||||||
gubGridNoMarkers = (UINT8*)MemAlloc(WORLD_MAX);
|
gubGridNoMarkers = (UINT8*)MemAlloc(WORLD_MAX);
|
||||||
memset(gubGridNoMarkers, 0, sizeof(UINT8)*WORLD_MAX);
|
memset(gubGridNoMarkers, 0, sizeof(UINT8)*WORLD_MAX);
|
||||||
|
|
||||||
if(gsCoverValue)
|
if (DEBUG_CHEAT_LEVEL())
|
||||||
MemFree(gsCoverValue);
|
{
|
||||||
gsCoverValue = (INT16*)MemAlloc(sizeof(INT16)*WORLD_MAX);
|
MemFree(gRenderDebugInfoValues);
|
||||||
memset(gsCoverValue, 0x7F, sizeof(INT16)*WORLD_MAX);
|
gRenderDebugInfoValues = (INT32*)MemAlloc(sizeof(INT32) * WORLD_MAX);
|
||||||
|
ResetDebugInfoValues();
|
||||||
|
}
|
||||||
|
|
||||||
// Init building structures and variables
|
// Init building structures and variables
|
||||||
if(gubBuildingInfo)
|
if(gubBuildingInfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user