aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1/logic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword1/logic.cpp')
-rw-r--r--engines/sword1/logic.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 5b42c9340e..d8933bc2f7 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -89,14 +89,14 @@ void Logic::initialize() {
delete _textMan;
_textMan = new Text(_objMan, _resMan,
- (SwordEngine::_systemVars.language == BS1_CZECH) ? true : false);
+ (SwordEngine::_systemVars.language == BS1_CZECH) ? true : false);
_screen->useTextManager(_textMan);
_textRunning = _speechRunning = false;
_speechFinished = true;
}
void Logic::newScreen(uint32 screen) {
- Object *compact = (Object*)_objMan->fetchObject(PLAYER);
+ Object *compact = (Object *)_objMan->fetchObject(PLAYER);
// work around script bug #911508
if (((screen == 25) || (_scriptVars[SCREEN] == 25)) && (_scriptVars[SAND_FLAG] == 4)) {
@@ -115,15 +115,15 @@ void Logic::newScreen(uint32 screen) {
if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved
fnAddHuman(NULL, 0, 0, 0, 0, 0, 0, 0);
if (_scriptVars[GEORGE_WALKING]) { // except that if George was walking when we saveed the game
- fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0,0);
- fnIdle(compact,PLAYER,0,0,0,0,0,0);
+ fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0, 0);
+ fnIdle(compact, PLAYER, 0, 0, 0, 0, 0, 0);
_scriptVars[GEORGE_WALKING] = 0;
}
SwordEngine::_systemVars.justRestoredGame = 0;
_music->startMusic(_scriptVars[CURRENT_MUSIC], 1);
} else { // if we haven't just restored a game, set George to stand, etc
compact->o_screen = _scriptVars[NEW_SCREEN]; //move the mega/player at this point between screens
- fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0,0);
+ fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0, 0);
fnChangeFloor(compact, PLAYER, _scriptVars[CHANGE_PLACE], 0, 0, 0, 0, 0);
}
}
@@ -227,7 +227,7 @@ void Logic::processLogic(Object *compact, uint32 id) {
case LOGIC_restart:
compact->o_tree.o_script_pc[compact->o_tree.o_script_level] = compact->o_tree.o_script_id[compact->o_tree.o_script_level];
compact->o_logic = LOGIC_script;
- logicRet=1;
+ logicRet = 1;
break;
case LOGIC_bookmark:
memcpy(&(compact->o_tree.o_script_level), &(compact->o_bookmark.o_script_level), sizeof(ScriptTree));
@@ -293,41 +293,41 @@ int Logic::logicArAnimate(Object *compact, uint32 id) {
compact->o_status |= STAT_SHRINK;
route = compact->o_route;
- walkPc =compact->o_walk_pc;
- compact->o_frame =route[walkPc].frame;
- compact->o_dir =route[walkPc].dir;
- compact->o_xcoord =route[walkPc].x;
- compact->o_ycoord =route[walkPc].y;
- compact->o_anim_x =compact->o_xcoord;
- compact->o_anim_y =compact->o_ycoord;
+ walkPc = compact->o_walk_pc;
+ compact->o_frame = route[walkPc].frame;
+ compact->o_dir = route[walkPc].dir;
+ compact->o_xcoord = route[walkPc].x;
+ compact->o_ycoord = route[walkPc].y;
+ compact->o_anim_x = compact->o_xcoord;
+ compact->o_anim_y = compact->o_ycoord;
if (((_scriptVars[GEORGE_WALKING] == 2) && (walkPc > 5) && (id == PLAYER) &&
- (route[walkPc - 1].step == 5) && (route[walkPc].step == 0)) ||
- ((_scriptVars[GEORGE_WALKING] == 3) && (id == PLAYER))) {
-
- compact->o_frame = 96 + compact->o_dir; //reset
- if ((compact->o_dir != 2) && (compact->o_dir != 6)) { // on verticals and diagonals stand where george is
- compact->o_xcoord = route[walkPc - 1].x;
- compact->o_ycoord = route[walkPc - 1].y;
- compact->o_anim_x = compact->o_xcoord;
- compact->o_anim_y = compact->o_ycoord;
- }
- compact->o_logic = LOGIC_script;
- compact->o_down_flag = 0; //0 means error
- _scriptVars[GEORGE_WALKING] = 0;
- route[compact->o_walk_pc+1].frame = 512; //end of sequence
- if (_scriptVars[MEGA_ON_GRID] == 2)
- _scriptVars[MEGA_ON_GRID] = 0;
+ (route[walkPc - 1].step == 5) && (route[walkPc].step == 0)) ||
+ ((_scriptVars[GEORGE_WALKING] == 3) && (id == PLAYER))) {
+
+ compact->o_frame = 96 + compact->o_dir; //reset
+ if ((compact->o_dir != 2) && (compact->o_dir != 6)) { // on verticals and diagonals stand where george is
+ compact->o_xcoord = route[walkPc - 1].x;
+ compact->o_ycoord = route[walkPc - 1].y;
+ compact->o_anim_x = compact->o_xcoord;
+ compact->o_anim_y = compact->o_ycoord;
+ }
+ compact->o_logic = LOGIC_script;
+ compact->o_down_flag = 0; //0 means error
+ _scriptVars[GEORGE_WALKING] = 0;
+ route[compact->o_walk_pc + 1].frame = 512; //end of sequence
+ if (_scriptVars[MEGA_ON_GRID] == 2)
+ _scriptVars[MEGA_ON_GRID] = 0;
}
compact->o_walk_pc++;
- if (route[compact->o_walk_pc].frame == 512) { //end of sequence
+ if (route[compact->o_walk_pc].frame == 512) { //end of sequence
compact->o_logic = LOGIC_script;
if (((_scriptVars[GEORGE_WALKING] == 2) || (_scriptVars[GEORGE_WALKING] == 1)) &&
- (id == PLAYER)) {
- _scriptVars[GEORGE_WALKING] = 0;
- if (_scriptVars[MEGA_ON_GRID] == 2)
- _scriptVars[MEGA_ON_GRID] = 0;
+ (id == PLAYER)) {
+ _scriptVars[GEORGE_WALKING] = 0;
+ if (_scriptVars[MEGA_ON_GRID] == 2)
+ _scriptVars[MEGA_ON_GRID] = 0;
}
}
return 0;
@@ -360,16 +360,16 @@ int Logic::speechDriver(Object *compact) {
_speechFinished = true;
}
if (compact->o_anim_resource) {
- uint8 *animData = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *animData = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
int32 numFrames = _resMan->readUint32(animData);
animData += 4;
compact->o_anim_pc++; // go to next frame of anim
if (_speechFinished || (compact->o_anim_pc >= numFrames) ||
- (_speechRunning && (_sound->amISpeaking() == 0)))
- compact->o_anim_pc = 0; //set to frame 0, closed mouth
+ (_speechRunning && (_sound->amISpeaking() == 0)))
+ compact->o_anim_pc = 0; //set to frame 0, closed mouth
- AnimUnit *animPtr = (AnimUnit*)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
+ AnimUnit *animPtr = (AnimUnit *)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
if (!(compact->o_status & STAT_SHRINK)) {
compact->o_anim_x = _resMan->getUint32(animPtr->animX);
compact->o_anim_y = _resMan->getUint32(animPtr->animY);
@@ -385,10 +385,10 @@ int Logic::fullAnimDriver(Object *compact) {
compact->o_logic = LOGIC_script;
return 1;
}
- uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *data = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
uint32 numFrames = _resMan->readUint32(data);
data += 4;
- AnimUnit *animPtr = (AnimUnit*)(data + compact->o_anim_pc * sizeof(AnimUnit));
+ AnimUnit *animPtr = (AnimUnit *)(data + compact->o_anim_pc * sizeof(AnimUnit));
compact->o_anim_x = compact->o_xcoord = _resMan->getUint32(animPtr->animX);
compact->o_anim_y = compact->o_ycoord = _resMan->getUint32(animPtr->animY);
@@ -407,9 +407,9 @@ int Logic::animDriver(Object *compact) {
compact->o_logic = LOGIC_script;
return 1;
}
- uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *data = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
uint32 numFrames = _resMan->readUint32(data);
- AnimUnit *animPtr = (AnimUnit*)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
+ AnimUnit *animPtr = (AnimUnit *)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
if (!(compact->o_status & STAT_SHRINK)) {
compact->o_anim_x = _resMan->getUint32(animPtr->animX);
@@ -426,9 +426,9 @@ int Logic::animDriver(Object *compact) {
}
void Logic::updateScreenParams() {
- Object *compact = (Object*)_objMan->fetchObject(PLAYER);
+ Object *compact = (Object *)_objMan->fetchObject(PLAYER);
_screen->setScrolling((int16)(compact->o_xcoord - _scriptVars[FEET_X]),
- (int16)(compact->o_ycoord - _scriptVars[FEET_Y]));
+ (int16)(compact->o_ycoord - _scriptVars[FEET_Y]));
}
int Logic::scriptManager(Object *compact, uint32 id) {
@@ -465,7 +465,7 @@ void Logic::runMouseScript(Object *cpt, int32 scriptId) {
}
int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int scriptBase, int scriptNum) {
- int32 *scriptCode = (int32*)(((uint8*)scriptModule) + sizeof(Header));
+ int32 *scriptCode = (int32 *)(((uint8 *)scriptModule) + sizeof(Header));
int32 stack[MAX_STACK_SIZE];
int32 stackIdx = 0;
int32 offset;
@@ -609,7 +609,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
debug(9, "IT_SCRIPTEND");
return 0;
case IT_POPVAR: // pop a variable
- debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx-1]);
+ debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx - 1]);
varNum = scriptCode[pc++];
if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) {
if (varNum >= 397) // BS1 Demo has different number of script variables
@@ -622,15 +622,15 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_POPLONGOFFSET:
offset = scriptCode[pc++];
debug(9, "IT_POPLONGOFFSET: Cpt[%d] = %d", offset, stack[stackIdx - 1]);
- *((int32 *)((uint8*)compact + offset)) = stack[--stackIdx];
+ *((int32 *)((uint8 *)compact + offset)) = stack[--stackIdx];
break;
case IT_PUSHLONGOFFSET:
offset = scriptCode[pc++];
- debug(9, "IT_PUSHLONGOFFSET: PUSH Cpt[%d] (==%d)", offset, *((int32 *)((uint8*)compact + offset)));
- stack[stackIdx++] = *((int32 *)((uint8*)compact + offset));
+ debug(9, "IT_PUSHLONGOFFSET: PUSH Cpt[%d] (==%d)", offset, *((int32 *)((uint8 *)compact + offset)));
+ stack[stackIdx++] = *((int32 *)((uint8 *)compact + offset));
break;
case IT_SKIPONFALSE:
- debug(9, "IT_SKIPONFALSE: %d (%s)", scriptCode[pc], (stack[stackIdx-1] ? "IS TRUE (NOT SKIPPED)" : "IS FALSE (SKIPPED)"));
+ debug(9, "IT_SKIPONFALSE: %d (%s)", scriptCode[pc], (stack[stackIdx - 1] ? "IS TRUE (NOT SKIPPED)" : "IS FALSE (SKIPPED)"));
if (stack[--stackIdx])
pc++;
else
@@ -645,12 +645,12 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
{
int switchValue = stack[--stackIdx];
int switchCount = scriptCode[pc++];
- int doneSwitch=0;
+ int doneSwitch = 0;
- for (int cnt = 0; (cnt < switchCount) && (doneSwitch==0); cnt++) {
+ for (int cnt = 0; (cnt < switchCount) && (doneSwitch == 0); cnt++) {
if (switchValue == scriptCode[pc]) {
- pc += scriptCode[pc+1];
- doneSwitch=1;
+ pc += scriptCode[pc + 1];
+ doneSwitch = 1;
} else
pc += 2;
}
@@ -659,7 +659,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
}
break;
case IT_SKIPONTRUE: // skip if expression true
- debug(9, "IT_SKIPONTRUE: %d (%s)", scriptCode[pc], (stack[stackIdx-1] ? "IS TRUE (SKIPPED)" : "IS FALSE (NOT SKIPPED)"));
+ debug(9, "IT_SKIPONTRUE: %d (%s)", scriptCode[pc], (stack[stackIdx - 1] ? "IS TRUE (SKIPPED)" : "IS FALSE (NOT SKIPPED)"));
stackIdx--;
if (stack[stackIdx])
pc += scriptCode[pc];
@@ -667,7 +667,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
pc++;
break;
case IT_PRINTF:
- debug(0, "IT_PRINTF(%d)",stack[stackIdx]);
+ debug(0, "IT_PRINTF(%d)", stack[stackIdx]);
break;
case IT_RESTARTSCRIPT:
debug(9, "IT_RESTARTSCRIPT");
@@ -676,16 +676,16 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_POPWORDOFFSET:
offset = scriptCode[pc++];
debug(9, "IT_POPWORDOFFSET: Cpt[%d] = %d", offset, stack[stackIdx - 1] & 0xFFFF);
- *((int32 *)((uint8*)compact + offset)) = stack[--stackIdx] & 0xffff;
+ *((int32 *)((uint8 *)compact + offset)) = stack[--stackIdx] & 0xffff;
break;
case IT_PUSHWORDOFFSET:
offset = scriptCode[pc++];
- debug(9, "IT_PUSHWORDOFFSET: PUSH Cpt[%d] == %d", offset, (*((int32 *)((uint8*)compact + offset))) & 0xffff);
- stack[stackIdx++] = (*((int32 *)((uint8*)compact + offset))) & 0xffff;
+ debug(9, "IT_PUSHWORDOFFSET: PUSH Cpt[%d] == %d", offset, (*((int32 *)((uint8 *)compact + offset))) & 0xffff);
+ stack[stackIdx++] = (*((int32 *)((uint8 *)compact + offset))) & 0xffff;
break;
default:
- error("Invalid operator %d",scriptCode[pc-1]);
- return 0; // for compilers that don't support NORETURN
+ error("Invalid operator %d", scriptCode[pc - 1]);
+ return 0; // for compilers that don't support NORETURN
}
}
}
@@ -831,7 +831,7 @@ int Logic::fnAnim(Object *cpt, int32 id, int32 cdt, int32 spr, int32 e, int32 f,
AnimSet *animTab;
if (cdt && (!spr)) {
- animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
+ animTab = (AnimSet *)((uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header));
animTab += cpt->o_dir;
cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
@@ -865,13 +865,13 @@ int Logic::fnSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo
AnimUnit *animPtr;
- uint8 *data = (uint8*)_resMan->openFetchRes(cdt);
+ uint8 *data = (uint8 *)_resMan->openFetchRes(cdt);
data += sizeof(Header);
if (frameNo == LAST_FRAME)
frameNo = _resMan->readUint32(data) - 1;
data += 4;
- animPtr = (AnimUnit*)(data + frameNo * sizeof(AnimUnit));
+ animPtr = (AnimUnit *)(data + frameNo * sizeof(AnimUnit));
cpt->o_anim_x = _resMan->getUint32(animPtr->animX);
cpt->o_anim_y = _resMan->getUint32(animPtr->animY);
@@ -895,13 +895,13 @@ int Logic::fnFullAnim(Object *cpt, int32 id, int32 anim, int32 graphic, int32 e,
}
int Logic::fnFullSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
- uint8 *data = (uint8*)_resMan->openFetchRes(cdt) + sizeof(Header);
+ uint8 *data = (uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header);
if (frameNo == LAST_FRAME)
frameNo = _resMan->readUint32(data) - 1;
data += 4;
- AnimUnit *animPtr = (AnimUnit*)(data + sizeof(AnimUnit) * frameNo);
+ AnimUnit *animPtr = (AnimUnit *)(data + sizeof(AnimUnit) * frameNo);
cpt->o_anim_x = cpt->o_xcoord = _resMan->getUint32(animPtr->animX);
cpt->o_anim_y = cpt->o_ycoord = _resMan->getUint32(animPtr->animY);
cpt->o_frame = _resMan->getUint32(animPtr->animFrame);
@@ -1115,7 +1115,7 @@ int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, i
// first setup the talk animation
if (cdt && (!spr)) { // if 'cdt' is non-zero but 'spr' is zero - 'cdt' is an anim table tag
- AnimSet *animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
+ AnimSet *animTab = (AnimSet *)((uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header));
animTab += cpt->o_dir;
cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
@@ -1152,10 +1152,10 @@ int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, i
char *text = _objMan->lockText(textNo);
cpt->o_speech_time = strlen(text) + 5;
- uint32 textCptId = _textMan->lowTextManager((uint8*)text, cpt->o_speech_width, (uint8)cpt->o_speech_pen);
+ uint32 textCptId = _textMan->lowTextManager((uint8 *)text, cpt->o_speech_width, (uint8)cpt->o_speech_pen);
_objMan->unlockText(textNo);
- Object * textCpt = _objMan->fetchObject(textCptId);
+ Object *textCpt = _objMan->fetchObject(textCptId);
textCpt->o_screen = cpt->o_screen;
textCpt->o_target = textCptId;
@@ -1247,7 +1247,7 @@ int Logic::fnChangeSpeechText(Object *cpt, int32 id, int32 tar, int32 width, int
//The game is halted for debugging. Maybe we'll remove this later.
int Logic::fnTalkError(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
error("fnTalkError for id %d, instruction %d", id, cpt->o_down_flag);
- return SCRIPT_STOP; // for compilers that don't support NORETURN
+ return SCRIPT_STOP; // for compilers that don't support NORETURN
}
int Logic::fnStartTalk(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
@@ -1414,12 +1414,12 @@ int Logic::fnWalk(Object *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stan
int32 target = _scriptVars[CLICK_ID];
// exceptions: compacts that use hand pointers but are not actually exits
if ((target != LEFT_SCROLL_POINTER) && (target != RIGHT_SCROLL_POINTER) &&
- (target != FLOOR_63) && (target != ROOF_63) && (target != GUARD_ROOF_63) &&
- (target != LEFT_TREE_POINTER_71) && (target != RIGHT_TREE_POINTER_71)) {
+ (target != FLOOR_63) && (target != ROOF_63) && (target != GUARD_ROOF_63) &&
+ (target != LEFT_TREE_POINTER_71) && (target != RIGHT_TREE_POINTER_71)) {
target = _objMan->fetchObject(_scriptVars[CLICK_ID])->o_mouse_on;
if ((target >= SCR_exit0) && (target <= SCR_exit9)) {
- fnStandAt(cpt,id,x,y,dir,stance,0,0);
+ fnStandAt(cpt, id, x, y, dir, stance, 0, 0);
return SCRIPT_STOP;
}
}
@@ -1439,13 +1439,13 @@ int Logic::fnTurn(Object *cpt, int32 id, int32 dir, int32 stance, int32 c, int32
dir = 9;
int route = _router->routeFinder(id, cpt, cpt->o_xcoord, cpt->o_ycoord, dir);
- if (route)
- cpt->o_down_flag = 1; //1 means ok
+ if (route)
+ cpt->o_down_flag = 1; //1 means ok
else
- cpt->o_down_flag = 0; //0 means error
+ cpt->o_down_flag = 0; //0 means error
cpt->o_logic = LOGIC_AR_animate;
- cpt->o_walk_pc = 0; //reset
+ cpt->o_walk_pc = 0; //reset
return SCRIPT_STOP;
}
@@ -1602,7 +1602,7 @@ int Logic::fnStopMusic(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d
int Logic::fnInnerSpace(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
error("fnInnerSpace() not working");
- return SCRIPT_STOP; // for compilers that don't support NORETURN
+ return SCRIPT_STOP; // for compilers that don't support NORETURN
}
int Logic::fnSetScreen(Object *cpt, int32 id, int32 target, int32 screen, int32 c, int32 d, int32 z, int32 x) {
@@ -1690,7 +1690,7 @@ int Logic::fnBlack(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, in
}
uint16 Logic::inRange(uint16 a, uint16 b, uint16 c) {
- return (a > b)? a : (((b > c) ? c : b));
+ return (a > b) ? a : (((b > c) ? c : b));
}
void Logic::startPosCallFn(uint8 fnId, uint32 param1, uint32 param2, uint32 param3) {
@@ -1789,7 +1789,7 @@ void Logic::startPositions(uint32 pos) {
if (pos == 0)
pos = 1;
Object *compact = _objMan->fetchObject(PLAYER);
- fnEnterSection(compact, PLAYER, pos, 0, 0, 0, 0, 0); // (automatically opens the compact resource for that section)
+ fnEnterSection(compact, PLAYER, pos, 0, 0, 0, 0, 0); // (automatically opens the compact resource for that section)
SwordEngine::_systemVars.controlPanelMode = CP_NORMAL;
SwordEngine::_systemVars.wantFade = true;
}