Skip to content
This repository was archived by the owner on Jul 23, 2020. It is now read-only.

[WIP] Implements FootClass path debugging feature. #167

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/game/common/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void *g_TurretShapes = nullptr;
void *g_SamShapes = nullptr;
void *g_MGunShapes = nullptr;

#ifdef CHRONOSHIFT_DEBUG
BOOL g_Debug_MotionCapture = false;
BOOL g_Debug_Rotate = false;
BOOL g_Debug_Quiet = false;
Expand All @@ -96,6 +97,7 @@ BOOL g_Debug_Passable = false;
BOOL g_Debug_Unshroud = false;
BOOL g_Debug_Threat = false;
BOOL g_Debug_Find_Path = false;
BOOL g_Debug_Draw_Paths = false;
BOOL g_Debug_Check_Map = false;
BOOL g_Debug_Playtest = false;
BOOL g_Debug_Heap_Dump = false;
Expand All @@ -105,9 +107,6 @@ BOOL g_Debug_Modem_Dump = false;
BOOL g_Debug_Print_Events = false;

BOOL g_MonoEnabled = false; // Actually a part of MonoClass.
#endif

int g_mapBinaryVersion; // For handling C&C and Sole Survivor map formats.

BOOL g_Debug_Paused = false;
BOOL g_Debug_Step = false;
Expand All @@ -118,13 +117,22 @@ BOOL g_Debug_GuardRange = false;
BOOL g_Debug_WeaponRange = false;
BOOL g_Debug_AttackFriendlies = false;
BOOL g_Debug_NavList = false;
BOOL g_Debug_HeadTo = false;
BOOL g_Debug_NavCom = false;
BOOL g_Debug_TarCom = false;
BOOL g_Debug_Damage = false;
BOOL g_Debug_AIControl = false;
BOOL g_Debug_InstantBuild = false;
BOOL g_Debug_BuildCheat = false;
BOOL g_Debug_CursorCoords = false;

DebugFindPathType g_Debug_Find_Path_Mode = DEBUG_PATH_NONE;
#endif

int g_mapBinaryVersion; // For handling C&C and Sole Survivor map formats.

BOOL g_Cheat_OreCivilians = false;
BOOL g_Cheat_TeslaChoppers = false;

BOOL g_ConfirmExit = false;
#endif
36 changes: 27 additions & 9 deletions src/game/common/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ extern void *&g_TurretShapes;
extern void *&g_SamShapes;
extern void *&g_MGunShapes;

#ifdef CHONOSHIFT_DEBUG
extern BOOL &g_Debug_MotionCapture;
extern BOOL &g_Debug_Rotate;
extern BOOL &g_Debug_Quiet;
Expand All @@ -185,6 +186,7 @@ extern BOOL &g_Debug_Smart_Print;
extern BOOL &g_Debug_Trap_Check_Heap;
extern BOOL &g_Debug_Modem_Dump;
extern BOOL &g_Debug_Print_Events;
#endif

extern BOOL &g_MonoEnabled;
#else
Expand Down Expand Up @@ -250,6 +252,7 @@ extern void *g_TurretShapes;
extern void *g_SamShapes;
extern void *g_MGunShapes;

#ifdef CHRONOSHIFT_DEBUG
extern BOOL g_Debug_MotionCapture;
extern BOOL g_Debug_Rotate;
extern BOOL g_Debug_Quiet;
Expand All @@ -264,6 +267,7 @@ extern BOOL g_Debug_Passable;
extern BOOL g_Debug_Unshroud;
extern BOOL g_Debug_Threat;
extern BOOL g_Debug_Find_Path;
extern BOOL g_Debug_Draw_Paths;
extern BOOL g_Debug_Check_Map;
extern BOOL g_Debug_Playtest;
extern BOOL g_Debug_Heap_Dump;
Expand All @@ -272,26 +276,40 @@ extern BOOL g_Debug_Trap_Check_Heap;
extern BOOL g_Debug_Modem_Dump;
extern BOOL g_Debug_Print_Events;

extern BOOL g_MonoEnabled;
#endif

extern int g_mapBinaryVersion;

extern BOOL g_Debug_Paused;
extern BOOL g_Debug_Step;
extern int g_Debug_StepCount;

extern BOOL g_Debug_SightRange;
extern BOOL g_Debug_GuardRange;
extern BOOL g_Debug_WeaponRange;
extern BOOL g_Debug_AttackFriendlies;
extern BOOL g_Debug_NavList;
extern BOOL g_Debug_HeadTo;
extern BOOL g_Debug_NavCom;
extern BOOL g_Debug_TarCom;
extern BOOL g_Debug_Damage;
extern BOOL g_Debug_AIControl;
extern BOOL g_Debug_InstantBuild;
extern BOOL g_Debug_BuildCheat;
extern BOOL g_Debug_CursorCoords;

enum DebugFindPathType {
DEBUG_PATH_NONE,
DEBUG_PATH_AI,
DEBUG_PATH_PLAYER,
DEBUG_PATH_BOTH,
DEBUG_PATH_COUNT
};
DEFINE_ENUMERATION_OPERATORS(DebugFindPathType);

extern DebugFindPathType g_Debug_Find_Path_Mode;

extern BOOL g_Debug_Paused;
extern BOOL g_Debug_Step;
extern int g_Debug_StepCount;

extern BOOL g_MonoEnabled;
#endif

extern int g_mapBinaryVersion;

extern BOOL g_Cheat_OreCivilians;
extern BOOL g_Cheat_TeslaChoppers;

Expand Down
2 changes: 2 additions & 0 deletions src/game/common/remap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ RemapControlType MetalScheme;
RemapControlType GreyScheme;
RemapControlType SidebarScheme;
#endif

RemapControlType WhiteScheme;
2 changes: 2 additions & 0 deletions src/game/common/remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ extern RemapControlType GreyScheme;
extern RemapControlType SidebarScheme;
#endif

extern RemapControlType WhiteScheme;

#endif // REMAP_H
2 changes: 1 addition & 1 deletion src/game/debug/gamelogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void Debug_Log(const char *format, ...)
#endif
}

vsprintf(&DebugBuffer[strlen(DebugBuffer)], Prep_Buffer(format, DebugBuffer), va);
vsprintf(DebugBuffer, Prep_Buffer(format, DebugBuffer), va);

if (strlen(DebugBuffer) >= DEBUG_BUFFER_SIZE) {
#ifdef PLATFORM_WINDOWS
Expand Down
19 changes: 19 additions & 0 deletions src/game/engine/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,25 @@ void DisplayClass::Center_Map(coord_t coord)
}
}

/**
* @brief
*
* SS: 0x0044807C
*/
void DisplayClass::Redraw_View(BOOL force)
{
cell_t tl_cell_x = Max((cell_t)0, (cell_t)Coord_Cell_X(DisplayPos));
cell_t tl_cell_y = Max((cell_t)0, (cell_t)Coord_Cell_Y(DisplayPos));
cell_t br_cell_x = Min((cell_t)(Lepton_To_Cell_Coord(DisplayWidth) + tl_cell_x), (cell_t)(MAP_MAX_WIDTH - 1));
cell_t br_cell_y = Min((cell_t)(Lepton_To_Cell_Coord(DisplayHeight) + tl_cell_y), (cell_t)(MAP_MAX_HEIGHT - 1));
for (cell_t x = tl_cell_x; x <= br_cell_x ; ++x) {
for (cell_t y = tl_cell_y; y <= br_cell_y; ++y) {
cell_t cellnum = Cell_From_XY(x, y);
Map[cellnum].Redraw_Objects();
}
}
}

/**
* @brief Registers the cell in the band box cursor list, calculates from mouse pos if cell is -1.
*
Expand Down
1 change: 1 addition & 0 deletions src/game/engine/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class DisplayClass : public MapClass
void Sell_Mode_Control(int mode);
void Repair_Mode_Control(int mode);
void Center_Map(coord_t coord = 0);
void Redraw_View(BOOL force = false);
cell_t Set_Cursor_Pos(cell_t cell);
BOOL Passes_Proximity_Check(ObjectTypeClass *object, HousesType house, int16_t *list, cell_t cell) const;
void Redraw_Icons();
Expand Down
Loading