1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef BLADERUNNER_DEBUGGER_H
24 #define BLADERUNNER_DEBUGGER_H
25 
26 #include "bladerunner/vector.h"
27 
28 #include "gui/debugger.h"
29 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace BladeRunner {
35 
36 class BladeRunnerEngine;
37 class View;
38 
39 enum DebuggerDrawnObjectType {
40 	debuggerObjTypeUndefined     = 99,
41 	debuggerObjTypeActor 	     =  0,
42 	debuggerObjType3dObject      =  1,
43 	debuggerObjTypeItem          =  2,
44 	debuggerObjTypeRegionNormal  =  3,
45 	debuggerObjTypeRegionExit    =  4,
46 	debuggerObjTypeWaypointNorm  =  5,
47 	debuggerObjTypeWaypoingFlee  =  6,
48 	debuggerObjTypeWaypointCover =  7,
49 	debuggerObjTypeWalkbox       =  8,
50 	debuggerObjTypeEffect        =  9,
51 	debuggerObjTypeLight         = 10,
52 	debuggerObjTypeFog           = 11
53 };
54 
55 class Debugger : public GUI::Debugger{
56 	BladeRunnerEngine *_vm;
57 
58 	static const uint kMaxSpecificObjectsDrawnCount = 100;
59 
60 	struct DebuggerDrawnObject {
61 		int                     sceneId;
62 		int                     setId;
63 		int                     objId;
64 		DebuggerDrawnObjectType type;
65 	};
66 
67 public:
68 	bool _isDebuggerOverlay;
69 
70 	bool _viewActorsToggle;
71 	bool _view3dObjectsToggle;
72 	bool _viewItemsToggle;
73 	bool _viewFogs;
74 	bool _viewLights;
75 	bool _viewScreenEffects;
76 	bool _viewObstacles;
77 	bool _viewRegionsNormalToggle;
78 	bool _viewRegionsExitsToggle;
79 	bool _viewUI;
80 	bool _viewWaypointsNormalToggle;
81 	bool _viewWaypointsFleeToggle;
82 	bool _viewWaypointsCoverToggle;
83 	bool _viewWalkboxes;
84 	bool _viewZBuffer;
85 	bool _playFullVk;
86 	bool _showStatsVk;
87 	bool _showMazeScore;
88 	bool _showMouseClickInfo;
89 
90 	Debugger(BladeRunnerEngine *vm);
91 	~Debugger() override;
92 
93 	bool cmdAnimation(int argc, const char **argv);
94 	bool cmdHealth(int argc, const char **argv);
95 //	bool cmdChapter(int argc, const char **argv);
96 	bool cmdDraw(int argc, const char **argv);
97 	bool cmdFlag(int argc, const char **argv);
98 	bool cmdGoal(int argc, const char **argv);
99 	bool cmdLoop(int argc, const char **argv);
100 	bool cmdPosition(int argc, const char **argv);
101 	bool cmdMusic(int argc, const char** argv);
102 	bool cmdSay(int argc, const char **argv);
103 	bool cmdScene(int argc, const char **argv);
104 	bool cmdVariable(int argc, const char **argv);
105 	bool cmdClue(int argc, const char **argv);
106 	bool cmdTimer(int argc, const char **argv);
107 	bool cmdFriend(int argc, const char **argv);
108 	bool cmdLoad(int argc, const char **argv);
109 	bool cmdSave(int argc, const char **argv);
110 	bool cmdOverlay(int argc, const char **argv);
111 	bool cmdSubtitle(int argc, const char **argv);
112 	bool cmdMazeScore(int argc, const char **argv);
113 	bool cmdObject(int argc, const char **argv);
114 	bool cmdItem(int argc, const char **argv);
115 	bool cmdRegion(int argc, const char **argv);
116 	bool cmdClick(int argc, const char **argv);
117 	bool cmdDifficulty(int argc, const char **argv);
118 #if BLADERUNNER_ORIGINAL_BUGS
119 #else
120 	bool cmdEffect(int argc, const char **argv);
121 #endif // BLADERUNNER_ORIGINAL_BUGS
122 	bool cmdList(int argc, const char **argv);
123 	bool cmdVk(int argc, const char **argv);
124 
125 	Common::String getDifficultyDescription(int difficultyValue);
126 	void drawDebuggerOverlay();
127 
128 	void drawBBox(Vector3 start, Vector3 end, View *view, Graphics::Surface *surface, int color);
129 	void drawSceneObjects();
130 	void drawLights();
131 	void drawFogs();
132 	void drawRegions();
133 	void drawWaypoints();
134 	void drawWalkboxes();
135 	void drawScreenEffects();
136 
137 	bool dbgAttemptToLoadChapterSetScene(int chapterId, int setId, int sceneId);
138 
139 private:
140 	Common::Array<DebuggerDrawnObject> _specificDrawnObjectsList;
141 	bool _specificActorsDrawn;
142 	bool _specific3dObjectsDrawn;
143 	bool _specificItemsDrawn;
144 	bool _specificEffectsDrawn;
145 	bool _specificLightsDrawn;
146 	bool _specificFogsDrawn;
147 	bool _specificRegionNormalDrawn;
148 	bool _specificRegionExitsDrawn;
149 	bool _specificWaypointNormalDrawn;
150 	bool _specificWaypointFleeDrawn;
151 	bool _specificWaypointCoverDrawn;
152 	bool _specificWalkboxesDrawn;
153 
154 	void toggleObjectInDbgDrawList(DebuggerDrawnObject &drObj);
155 	int findInDbgDrawList(DebuggerDrawnObjectType objType, int objId, int setId, int sceneId);
156 	void updateTogglesForDbgDrawListInCurrentSetAndScene();
157 };
158 
159 } // End of namespace BladeRunner
160 
161 #endif
162