aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/prince/prince.cpp66
-rw-r--r--engines/prince/prince.h2
-rw-r--r--engines/prince/script.cpp2
3 files changed, 32 insertions, 38 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 257e84ab4e..33750d50c7 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -71,12 +71,12 @@ void PrinceEngine::debugEngine(const char *s, ...) {
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
- debug("Prince::Engine frame %08ld %s", _frameNr, buf);
+ debug("Prince::Engine %s", buf);
}
PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) :
Engine(syst), _gameDescription(gameDesc), _graph(nullptr), _script(nullptr), _interpreter(nullptr), _flags(nullptr),
- _locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), _frameNr(0),
+ _locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr),
_cursor1(nullptr), _cursor2(nullptr), _cursor3(nullptr), _font(nullptr),
_suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince"),
_invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _maxInvW(72), _maxInvH(76),
@@ -4379,6 +4379,29 @@ void PrinceEngine::freeCoords3() {
}
}
+void PrinceEngine::openInventoryCheck() {
+ if (!_optionsFlag) {
+ if (_mouseFlag == 1 || _mouseFlag == 2) {
+ if (_mainHero->_visible) {
+ if (!_flags->getFlagValue(Flags::INVALLOWED)) {
+ // 29 - Basement, 50 - Map
+ if (_locationNr != 29 && _locationNr != 50) {
+ Common::Point mousePos = _system->getEventManager()->getMousePos();
+ if (mousePos.y < 4 && !_showInventoryFlag) {
+ _invCounter++;
+ } else {
+ _invCounter = 0;
+ }
+ if (_invCounter >= _invMaxCount) {
+ inventoryFlagChange(true);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
void PrinceEngine::mainLoop() {
changeCursor(0);
@@ -4393,64 +4416,35 @@ void PrinceEngine::mainLoop() {
case Common::EVENT_KEYDOWN:
keyHandler(event);
break;
- case Common::EVENT_KEYUP:
- break;
- case Common::EVENT_MOUSEMOVE:
- break;
case Common::EVENT_LBUTTONDOWN:
leftMouseButton();
break;
case Common::EVENT_RBUTTONDOWN:
rightMouseButton();
break;
- case Common::EVENT_LBUTTONUP:
- break;
- case Common::EVENT_RBUTTONUP:
- break;
- case Common::EVENT_QUIT:
- break;
default:
break;
}
}
- if (shouldQuit())
+ if (shouldQuit()) {
return;
+ }
_interpreter->step();
drawScreen();
+
_graph->update(_graph->_frontScreen);
+ openInventoryCheck();
+
// Calculate the frame delay based off a desired frame time
int delay = 1000 / 15 - int32(_system->getMillis() - currentTime);
// Ensure non-negative
delay = delay < 0 ? 0 : delay;
_system->delayMillis(delay);
- _frameNr++;
-
- // inventory turning on:
- if (!_optionsFlag) {
- if (_mouseFlag == 1 || _mouseFlag == 2) {
- if (_mainHero->_visible) {
- if (!_flags->getFlagValue(Flags::INVALLOWED)) {
- // 29 - Basement, 50 - Map
- if (_locationNr != 29 && _locationNr != 50) {
- Common::Point mousePos = _system->getEventManager()->getMousePos();
- if (mousePos.y < 4 && !_showInventoryFlag) {
- _invCounter++;
- } else {
- _invCounter = 0;
- }
- if (_invCounter >= _invMaxCount) {
- inventoryFlagChange(true);
- }
- }
- }
- }
- }
- }
}
}
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index a1379d6b59..13405a6347 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -306,7 +306,6 @@ public:
static const uint8 kMaxTexts = 32;
Text _textSlots[kMaxTexts];
- uint64 _frameNr;
Hero *_mainHero;
Hero *_secondHero;
@@ -439,6 +438,7 @@ public:
void enableOptions(bool checkType);
void checkOptions();
void checkInvOptions();
+ void openInventoryCheck();
void leftMouseButton();
void rightMouseButton();
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 4f122d8bec..9b49b749a4 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -426,7 +426,7 @@ void Interpreter::debugInterpreter(const char *s, ...) {
if (!strcmp(_mode, "fg")) {
debug(10, "PrinceEngine::Script %s %s", str.c_str(), buf);
}
- //debug("Prince::Script frame %08ld mode %s %s %s", _vm->_frameNr, _mode, str.c_str(), buf);
+ //debug("Prince::Script mode %s %s %s", _mode, str.c_str(), buf);
}
void Interpreter::step() {