aboutsummaryrefslogtreecommitdiff
path: root/sword2/debug.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-02-22 07:37:50 +0000
committerTorbjörn Andersson2005-02-22 07:37:50 +0000
commit9bb141481822a6f1deef4c152e6bbb87d4136a10 (patch)
tree763a23067c5a40043cc1911fc4f643b2d95e9c36 /sword2/debug.cpp
parenta45a0de6581ae7859ff20da58c01bacac8bc612c (diff)
downloadscummvm-rg350-9bb141481822a6f1deef4c152e6bbb87d4136a10.tar.gz
scummvm-rg350-9bb141481822a6f1deef4c152e6bbb87d4136a10.tar.bz2
scummvm-rg350-9bb141481822a6f1deef4c152e6bbb87d4136a10.zip
Moved some debugging stuff into the debugger class.
svn-id: r16859
Diffstat (limited to 'sword2/debug.cpp')
-rw-r--r--sword2/debug.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/sword2/debug.cpp b/sword2/debug.cpp
index 4d4d4eb8ff..11090c3960 100644
--- a/sword2/debug.cpp
+++ b/sword2/debug.cpp
@@ -31,7 +31,7 @@
namespace Sword2 {
-void Debugger::clearDebugTextBlocks(void) {
+void Debugger::clearDebugTextBlocks() {
uint8 blockNo = 0;
while (blockNo < MAX_DEBUG_TEXTS && _debugTextBlocks[blockNo] > 0) {
@@ -56,7 +56,7 @@ void Debugger::makeDebugTextBlock(char *text, int16 x, int16 y) {
_debugTextBlocks[blockNo] = _vm->_fontRenderer->buildNewBloc((byte *) text, x, y, 640 - x, 0, RDSPR_DISPLAYALIGN, CONSOLE_FONT_ID, NO_JUSTIFICATION);
}
-void Debugger::buildDebugText(void) {
+void Debugger::buildDebugText() {
char buf[128];
int32 showVarNo; // for variable watching
@@ -307,12 +307,21 @@ void Debugger::buildDebugText(void) {
// memory indicator - this should come last, to show all the
// sprite blocks above!
- _vm->_memory->memStatusStr(buf);
+ uint32 totAlloc = _vm->_memory->getTotAlloc();
+ int16 numBlocks = _vm->_memory->getNumBlocks();
+
+ if (totAlloc < 1024)
+ sprintf(buf, "%u bytes in %d memory blocks", totAlloc, numBlocks);
+ else if (totAlloc < 1024 * 1024)
+ sprintf(buf, "%uK in %d memory blocks", totAlloc / 1024, numBlocks);
+ else
+ sprintf(buf, "%.02fM in %d memory blocks", totAlloc / 1048576., numBlocks);
+
makeDebugTextBlock(buf, 0, 0);
}
}
-void Debugger::drawDebugGraphics(void) {
+void Debugger::drawDebugGraphics() {
ScreenInfo *screenInfo = _vm->_screen->getScreenInfo();
// walk-grid
@@ -364,18 +373,4 @@ void Debugger::drawRect(int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen) {
_vm->_screen->drawLine(x2, y1, x2, y2, pen); // right edge
}
-void Debugger::printCurrentInfo(void) {
- // prints general stuff about the screen, etc.
- ScreenInfo *screenInfo = _vm->_screen->getScreenInfo();
-
- if (screenInfo->background_layer_id) {
- DebugPrintf("background layer id %d\n", screenInfo->background_layer_id);
- DebugPrintf("%d wide, %d high\n", screenInfo->screen_wide, screenInfo->screen_deep);
- DebugPrintf("%d normal layers\n", screenInfo->number_of_layers);
-
- _vm->_logic->examineRunList();
- } else
- DebugPrintf("No screen\n");
-}
-
} // End of namespace Sword2