Skip to content

Commit

Permalink
PRINCE: Hero bored timer - update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jul 25, 2014
1 parent 98dafb8 commit 2a1b354
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
24 changes: 14 additions & 10 deletions engines/prince/hero.cpp
Expand Up @@ -736,17 +736,21 @@ void Hero::showHero() {
}

if (_state == STAY) {
if (!_vm->_optionsFlag && !_vm->_interpreter->getLastOPCode()) { // TODO - check OPCODE after right click
_boredomTime++;
if (_boredomTime == _maxBoredom) {
_boreNum =_vm->_randomSource.getRandomNumber(1); // rand one of two 'bored' animation
_phase = 0;
_state = BORE;
if (_lastDirection == kHeroDirUp) {
_lastDirection = kHeroDirLeft;
} else {
_lastDirection = kHeroDirDown;
if (!_vm->_optionsFlag) {
if (!_vm->_interpreter->getLastOPCode() || !_vm->_interpreter->getFgOpcodePC()) {
_boredomTime++;
if (_boredomTime == _maxBoredom) {
_boreNum =_vm->_randomSource.getRandomNumber(1); // rand one of two 'bored' animation
_phase = 0;
_state = BORE;
if (_lastDirection == kHeroDirUp) {
_lastDirection = kHeroDirLeft;
} else {
_lastDirection = kHeroDirDown;
}
}
} else {
_boredomTime = 0;
}
} else {
_boredomTime = 0;
Expand Down
2 changes: 2 additions & 0 deletions engines/prince/prince.cpp
Expand Up @@ -2674,6 +2674,8 @@ void PrinceEngine::displayInventory() {
_mainHero->freeOldMove();
_secondHero->freeOldMove();

_interpreter->storeNewPC(0);

prepareInventoryToView();

while (!shouldQuit()) {
Expand Down
4 changes: 4 additions & 0 deletions engines/prince/script.cpp
Expand Up @@ -466,6 +466,10 @@ int Interpreter::getLastOPCode() {
return _lastOpcode;
}

int Interpreter::getFgOpcodePC() {
return _fgOpcodePC;
}

uint32 Interpreter::getCurrentString() {
return _currentString;
}
Expand Down
1 change: 1 addition & 0 deletions engines/prince/script.h
Expand Up @@ -187,6 +187,7 @@ class Interpreter {
void step();
void storeNewPC(int opcodePC);
int getLastOPCode();
int getFgOpcodePC();

uint32 getCurrentString();
void setCurrentString(uint32 value);
Expand Down

0 comments on commit 2a1b354

Please sign in to comment.