Add new debug command to display droid paths for selected droids on the map.

The default key combo is LCTRL + m. You need to delete your keymap file again.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4161 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-03-20 13:40:34 +00:00
parent d334213174
commit 9a57ec77f6
5 changed files with 52 additions and 3 deletions

View File

@ -149,6 +149,7 @@ static BOOL bDrawBlips=TRUE;
static BOOL bDrawProximitys=TRUE;
BOOL godMode;
BOOL showGateways = FALSE;
BOOL showPath = FALSE;
static char skyboxPageName[PATH_MAX] = "page-25";
@ -263,6 +264,39 @@ SDWORD getCentreZ( void )
return(gridCentreZ);
}
static void showDroidPaths(void)
{
DROID *psDroid;
if (((gameTime2 / 250) % 2) != 0)
{
return;
}
for (psDroid = apsDroidLists[selectedPlayer]; psDroid; psDroid=psDroid->psNext)
{
if (psDroid->selected)
{
int i;
int len = psDroid->sMove.numPoints;
for (i = 0; i < len; i++)
{
Vector3i pos;
ASSERT(tileOnMap(psDroid->sMove.asPath[i].x, psDroid->sMove.asPath[i].y), "Path off map!");
pos.x = world_coord(psDroid->sMove.asPath[i].x) + TILE_UNITS / 2;
pos.z = world_coord(psDroid->sMove.asPath[i].y) + TILE_UNITS / 2;
pos.y = map_Height(pos.x, pos.z) + 16;
ASSERT(worldOnMap(pos.x, pos.y), "Effect off map!");
effectGiveAuxVar(80);
addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_LASER, FALSE, NULL, 0);
}
}
}
}
/* Render the 3D world */
void draw3DScene( void )
{
@ -429,6 +463,11 @@ void draw3DScene( void )
{
drawRangeAtPos(rangeCenterX,rangeCenterY,rangeRadius);
}
if (showPath)
{
showDroidPaths();
}
}
@ -4319,7 +4358,7 @@ static void showSensorRange2(BASE_OBJECT *psObj)
yDif = yDif/4096;
pos.x = psObj->pos.x - xDif;
pos.z = psObj->pos.y - yDif;
pos.y = map_Height(pos.x,pos.z)+ 16; // 64 up to get to base of spire
pos.y = map_Height(pos.x,pos.z) + 16;
effectGiveAuxVar(80); // half normal plasma size...
if(bBuilding)
{
@ -4347,7 +4386,7 @@ static void drawRangeAtPos(SDWORD centerX, SDWORD centerY, SDWORD radius)
yDif = yDif/4096;
pos.x = centerX - xDif;
pos.z = centerY - yDif;
pos.y = map_Height(pos.x,pos.z)+ 16; // 64 up to get to base of spire
pos.y = map_Height(pos.x,pos.z) + 16;
effectGiveAuxVar(80); // half normal plasma size...
addEffect(&pos,EFFECT_EXPLOSION,EXPLOSION_TYPE_SMALL,FALSE,NULL,0);

View File

@ -114,6 +114,7 @@ extern SDWORD mouseTileX, mouseTileY;
extern BOOL bRender3DOnly;
extern BOOL showGateways;
extern BOOL showPath;
extern Vector2i visibleTiles;
/*returns the graphic ID for a droid rank*/

View File

@ -144,6 +144,12 @@ void kf_ToggleShowGateways(void)
showGateways = !showGateways;
}
void kf_ToggleShowPath(void)
{
addConsoleMessage("Path display toggled.", DEFAULT_JUSTIFY);
showPath = !showPath;
}
// --------------------------------------------------------------------------
void kf_ToggleRadarJump( void )
{

View File

@ -206,6 +206,7 @@ extern void kf_SelectCommander_9( void );
void kf_ToggleReopenBuildMenu( void );
extern void kf_ToggleShowGateways(void);
extern void kf_ToggleShowPath(void);
// dirty but necessary
extern char sTextToSend[MAX_CONSOLE_STRING_LENGTH];

View File

@ -249,6 +249,7 @@ _keymapsave keyMapSaveTable[] =
kf_ToggleWatchWindow,
kf_ToggleDrivingMode,
kf_ToggleShowGateways,
kf_ToggleShowPath,
NULL // last function!
};
@ -431,7 +432,8 @@ void keyInitMappings( BOOL bForceDefaults )
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,(KEY_CODE)KEY_MAXSCAN,KEYMAP_PRESSED,kf_ToggleReopenBuildMenu,_("Toggle reopening the build menu"));
// NOTE THIS!!!!!!!
// available: ctrl+m, ctrl+k, ctrl+l
// available: ctrl+k, ctrl+l
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_M,KEYMAP_PRESSED,kf_ToggleShowPath, "Toggle display of droid path");
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_E,KEYMAP_PRESSED,kf_ToggleShowGateways, "Toggle display of gateways");
keyAddMapping(KEYMAP___HIDE,KEY_LSHIFT,KEY_BACKSPACE,KEYMAP_PRESSED,kf_ToggleDebugMappings, "TOGGLE Debug Mappings");
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_M,KEYMAP_PRESSED,kf_ShowMappings, "Show all keyboard mappings - use pause!");