Skip to content

Commit

Permalink
PRINCE: code formating fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Zbróg committed Nov 4, 2013
1 parent 5d8e664 commit 8c85eff
Show file tree
Hide file tree
Showing 17 changed files with 691 additions and 610 deletions.
1 change: 1 addition & 0 deletions engines/prince/archive.h
Expand Up @@ -25,6 +25,7 @@

#include "common/archive.h"

// This is here just as remainder that archive support is missing
namespace Price {

class Archive : public Common::Archive {
Expand Down
165 changes: 91 additions & 74 deletions engines/prince/debugger.cpp
Expand Up @@ -26,113 +26,130 @@
namespace Prince {

Debugger::Debugger(PrinceEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag));
DCmd_Register("viewflc", WRAP_METHOD(Debugger, Cmd_ViewFlc));
DCmd_Register("initroom", WRAP_METHOD(Debugger, Cmd_InitRoom));
DCmd_Register("changecursor", WRAP_METHOD(Debugger, Cmd_ChangeCursor));
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("level", WRAP_METHOD(Debugger, Cmd_DebugLevel));
DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag));
DCmd_Register("viewflc", WRAP_METHOD(Debugger, Cmd_ViewFlc));
DCmd_Register("initroom", WRAP_METHOD(Debugger, Cmd_InitRoom));
DCmd_Register("changecursor", WRAP_METHOD(Debugger, Cmd_ChangeCursor));
}

static int strToInt(const char *s) {
if (!*s)
// No string at all
return 0;
else if (toupper(s[strlen(s) - 1]) != 'H')
// Standard decimal string
return atoi(s);

// Hexadecimal string
uint tmp = 0;
int read = sscanf(s, "%xh", &tmp);
if (read < 1)
error("strToInt failed on string \"%s\"", s);
return (int)tmp;
if (!*s)
// No string at all
return 0;
else if (toupper(s[strlen(s) - 1]) != 'H')
// Standard decimal string
return atoi(s);

// Hexadecimal string
uint tmp = 0;
int read = sscanf(s, "%xh", &tmp);
if (read < 1)
error("strToInt failed on string \"%s\"", s);
return (int)tmp;
}

bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
if (argc == 1) {
DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
} else { // set level
gDebugLevel = atoi(argv[1]);
if (0 <= gDebugLevel && gDebugLevel < 11) {
DebugPrintf("Debug level set to level %d\n", gDebugLevel);
} else if (gDebugLevel < 0) {
DebugPrintf("Debugging is now disabled\n");
} else
DebugPrintf("Not a valid debug level (0 - 10)\n");
}

return true;
}

/*
* This command sets a flag
*/
bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
// Check for a flag to set
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//g_globals->setFlag(flagNum);
return true;
// Check for a flag to set
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//g_globals->setFlag(flagNum);
return true;
}

/*
* This command gets the value of a flag
*/
bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
// Check for an flag to display
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//DebugPrintf("Value: %d\n", g_globals->getFlag(flagNum));
return true;
// Check for an flag to display
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//DebugPrintf("Value: %d\n", g_globals->getFlag(flagNum));
return true;
}

/*
* This command clears a flag
*/
bool Debugger::Cmd_ClearFlag(int argc, const char **argv) {
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//g_globals->clearFlag(flagNum);
return true;
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <flag number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
//g_globals->clearFlag(flagNum);
return true;
}

/*
* This command starts new flc anim
*/
bool Debugger::Cmd_ViewFlc(int argc, const char **argv) {
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <anim number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->loadAnim(flagNum, false);
return true;
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <anim number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->loadAnim(flagNum, false);
return true;
}

bool Debugger::Cmd_InitRoom(int argc, const char **argv) {
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <anim number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->loadLocation(flagNum);
return true;
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <anim number>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->loadLocation(flagNum);
return true;
}

bool Debugger::Cmd_ChangeCursor(int argc, const char **argv) {
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <curId>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->changeCursor(flagNum);
return true;
// Check for a flag to clear
if (argc != 2) {
DebugPrintf("Usage: %s <curId>\n", argv[0]);
return true;
}

int flagNum = strToInt(argv[1]);
_vm->changeCursor(flagNum);
return true;
}

}
1 change: 1 addition & 0 deletions engines/prince/debugger.h
Expand Up @@ -36,6 +36,7 @@ class Debugger : public GUI::Debugger {
virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ

private:
bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_SetFlag(int argc, const char **argv);
bool Cmd_GetFlag(int argc, const char **argv);
bool Cmd_ClearFlag(int argc, const char **argv);
Expand Down

0 comments on commit 8c85eff

Please sign in to comment.