aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorlukaslw2014-07-26 19:31:54 +0200
committerlukaslw2014-07-26 19:31:54 +0200
commit9ea766ce2bc5c1ed7c2382021d2e2635a236d7f4 (patch)
tree945aa09b488cb7f4baed54404189763381775f91 /engines
parent0d1b5533db2ec543f34a51b9a4b0fac0231db411 (diff)
downloadscummvm-rg350-9ea766ce2bc5c1ed7c2382021d2e2635a236d7f4.tar.gz
scummvm-rg350-9ea766ce2bc5c1ed7c2382021d2e2635a236d7f4.tar.bz2
scummvm-rg350-9ea766ce2bc5c1ed7c2382021d2e2635a236d7f4.zip
PRINCE: Hero state names - update
Diffstat (limited to 'engines')
-rw-r--r--engines/prince/hero.cpp102
-rw-r--r--engines/prince/hero.h21
-rw-r--r--engines/prince/prince.cpp14
-rw-r--r--engines/prince/script.cpp10
4 files changed, 55 insertions, 92 deletions
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index a0e7533c69..2cc5789781 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -34,7 +34,7 @@
namespace Prince {
Hero::Hero(PrinceEngine *vm, GraphicsMan *graph) : _vm(vm), _graph(graph)
- , _number(0), _visible(false), _state(MOVE), _middleX(0), _middleY(0)
+ , _number(0), _visible(false), _state(kHeroStateStay), _middleX(0), _middleY(0)
, _boreNum(1), _currHeight(0), _moveDelay(0), _shadMinus(0), _moveSetType(0)
, _lastDirection(kHeroDirDown), _destDirection(kHeroDirDown), _talkTime(0), _boredomTime(0), _phase(0)
, _specAnim(nullptr), _drawX(0), _drawY(0), _drawZ(0), _zoomFactor(0), _scaleValue(0)
@@ -99,42 +99,6 @@ Graphics::Surface *Hero::getSurface() {
return NULL;
}
-//TEMP
-void Hero::getState() {
- switch (_state) {
- case STAY:
- debug("STAY");
- break;
- case TURN:
- debug("TURN");
- break;
- case MOVE:
- debug("MOVE");
- break;
- case BORE:
- debug("BORE");
- break;
- case SPEC:
- debug("SPEC");
- break;
- case TALK:
- debug("TALK");
- break;
- case MVAN:
- debug("MVAN");
- break;
- case TRAN:
- debug("TRAN");
- break;
- case RUN:
- debug("RUN");
- break;
- case DMOVE:
- debug("DMOVE");
- break;
- }
-}
-
uint16 Hero::getData(AttrId dataId) {
switch (dataId) {
case kHeroLastDir:
@@ -665,11 +629,11 @@ void Hero::showHero() {
// Scale of hero
selectZoom();
- if (_state != STAY) {
+ if (_state != kHeroStateStay) {
_boredomTime = 0;
}
- if (_state == SPEC) {
+ if (_state == kHeroStateSpec) {
if (_specAnim != nullptr) {
if (_phase < _specAnim->getPhaseCount() - 1) {
_phase++;
@@ -677,17 +641,17 @@ void Hero::showHero() {
_phase = 0;
freeHeroAnim();
if (!_talkTime) {
- _state = STAY;
+ _state = kHeroStateStay;
} else {
- _state = TALK;
+ _state = kHeroStateTalk;
}
}
} else {
- _state = STAY;
+ _state = kHeroStateStay;
}
}
- if (_state == TALK) {
+ if (_state == kHeroStateTalk) {
if (_talkTime) {
switch (_lastDirection) {
case kHeroDirLeft:
@@ -709,11 +673,11 @@ void Hero::showHero() {
_phase = _moveSet[_moveSetType]->getLoopCount();
}
} else {
- _state = STAY;
+ _state = kHeroStateStay;
}
}
- if (_state == BORE) {
+ if (_state == kHeroStateBore) {
switch (_boreNum) {
case 0:
_moveSetType = kMove_BORED1;
@@ -728,21 +692,21 @@ void Hero::showHero() {
} else {
_phase = 0;
_lastDirection = kHeroDirDown;
- _state = STAY;
+ _state = kHeroStateStay;
}
} else {
- _state = STAY;
+ _state = kHeroStateStay;
}
}
- if (_state == STAY) {
+ if (_state == kHeroStateStay) {
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;
+ _state = kHeroStateBore;
if (_lastDirection == kHeroDirUp) {
_lastDirection = kHeroDirLeft;
} else {
@@ -758,64 +722,64 @@ void Hero::showHero() {
heroStanding();
}
- if (_state == TURN) {
+ if (_state == kHeroStateTurn) {
if (_destDirection && (_lastDirection != _destDirection)) {
_phase = 0;
int rotateDir = rotateHero(_lastDirection, _destDirection);
_lastDirection = _destDirection;
if (rotateDir) {
_turnAnim = rotateDir;
- _state = TRAN;
+ _state = kHeroStateTran;
} else {
- _state = STAY;
+ _state = kHeroStateStay;
heroStanding();
}
} else {
- _state = STAY;
+ _state = kHeroStateStay;
heroStanding();
}
}
- if (_state == TRAN) {
+ if (_state == kHeroStateTran) {
if (_moveSet[_turnAnim] != nullptr) {
// only in bear form
_moveSetType = _turnAnim;
if (_phase < _moveSet[_moveSetType]->getPhaseCount() - 2) {
_phase += 2;
} else {
- _state = STAY;
+ _state = kHeroStateStay;
heroStanding();
}
} else {
- _state = STAY;
+ _state = kHeroStateStay;
heroStanding();
}
}
- if (_state == MVAN) {
+ if (_state == kHeroStateMvan) {
if (_moveSet[_turnAnim] != nullptr) {
// only in bear form
_moveSetType = _turnAnim;
if (_phase < _moveSet[_moveSetType]->getPhaseCount() - 2) {
_phase += 2;
} else {
- _state = MOVE;
+ _state = kHeroStateMove;
}
} else {
- _state = MOVE;
+ _state = kHeroStateMove;
}
}
- if (_state == DMOVE) {
+ if (_state == kHeroStateDelayMove) {
_moveDelay--;
if (!_moveDelay) {
- _state = MOVE;
+ _state = kHeroStateMove;
}
}
int x, y, dir;
- if (_state == MOVE) {
+ if (_state == kHeroStateMove) {
//go_for_it:
while (1) {
if (_currCoords != nullptr) {
@@ -833,7 +797,7 @@ void Hero::showHero() {
continue;
} else {
_turnAnim = rotateDir;
- _state = MVAN;
+ _state = kHeroStateMvan;
if (_moveSet[_turnAnim] != nullptr) {
// only in bear form
_moveSetType = _turnAnim;
@@ -842,11 +806,11 @@ void Hero::showHero() {
break;
} else {
_turnAnim = 0;
- _state = MOVE;
+ _state = kHeroStateMove;
continue;
}
} else {
- _state = MOVE;
+ _state = kHeroStateMove;
continue;
}
}
@@ -893,7 +857,7 @@ void Hero::showHero() {
_boredomTime = 0;
_phase = 0;
- _state = TURN;
+ _state = kHeroStateTurn;
if (!_destDirection) {
_destDirection = _lastDirection;
@@ -935,7 +899,7 @@ void Hero::heroMoveGotIt(int x, int y, int dir) {
break;
}
- if (_vm->_flags->getFlagValue(Flags::HEROFAST) || _state == RUN) {
+ if (_vm->_flags->getFlagValue(Flags::HEROFAST) || _state == kHeroStateRun) {
if (_phase < _moveSet[_moveSetType]->getPhaseCount() - 2) {
_phase += 2;
} else {
@@ -955,7 +919,7 @@ void Hero::heroMoveGotIt(int x, int y, int dir) {
}
if (_vm->_flags->getFlagValue(Flags::HEROFAST)) {
_step *= 2.5;
- } else if (_state == RUN) {
+ } else if (_state == kHeroStateRun) {
_step *= 2;
}
}
@@ -1015,7 +979,7 @@ void Hero::freeOldMove() {
_step = 0;
_phase = 0;
_moveDelay = 0;
- _state = Hero::STAY;
+ _state = Hero::kHeroStateStay;
}
void Hero::freeHeroAnim() {
diff --git a/engines/prince/hero.h b/engines/prince/hero.h
index 693cbd81e3..d2ad0d9c95 100644
--- a/engines/prince/hero.h
+++ b/engines/prince/hero.h
@@ -53,16 +53,16 @@ public:
static const int16 kStepUpDown = 4;
enum State {
- STAY = 0,
- TURN = 1,
- MOVE = 2,
- BORE = 3,
- SPEC = 4,
- TALK = 5,
- MVAN = 6,
- TRAN = 7,
- RUN = 8,
- DMOVE = 9
+ kHeroStateStay,
+ kHeroStateTurn,
+ kHeroStateMove,
+ kHeroStateBore,
+ kHeroStateSpec,
+ kHeroStateTalk,
+ kHeroStateMvan,
+ kHeroStateTran,
+ kHeroStateRun,
+ kHeroStateDelayMove
};
enum Direction {
@@ -132,7 +132,6 @@ public:
void plotPoint(int x, int y);
void showHeroShadow(Graphics::Surface *heroFrame);
void setShadowScale(int32 shadowScale);
- void getState();
void freeOldMove();
void freeHeroAnim();
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 14e9e2844b..dee52f7634 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -2222,7 +2222,7 @@ void PrinceEngine::walkTo() {
_mainHero->_dirTab = _directionTable;
_mainHero->_currDirTab = _directionTable;
_directionTable = nullptr;
- _mainHero->_state = _mainHero->MOVE;
+ _mainHero->_state = _mainHero->kHeroStateMove;
moveShandria();
}
}
@@ -2249,14 +2249,14 @@ void PrinceEngine::moveRunHero(int heroId, int x, int y, int dir, bool runHeroFl
hero->_currDirTab = _directionTable;
_directionTable = nullptr;
if (runHeroFlag) {
- hero->_state = _mainHero->RUN;
+ hero->_state = _mainHero->kHeroStateRun;
} else {
- hero->_state = _mainHero->MOVE;
+ hero->_state = _mainHero->kHeroStateMove;
}
}
} else {
hero->freeOldMove();
- hero->_state = Hero::TURN;
+ hero->_state = Hero::kHeroStateTurn;
}
hero->freeHeroAnim();
hero->_visible = 1;
@@ -2886,13 +2886,13 @@ void PrinceEngine::talkHero(int slot) {
if (slot == 0) {
text._color = 220; // TODO - test this
- _mainHero->_state = Hero::TALK;
+ _mainHero->_state = Hero::kHeroStateTalk;
_mainHero->_talkTime = time;
text._x = _mainHero->_middleX;
text._y = _mainHero->_middleY - _mainHero->_scaledFrameYSize;
} else {
text._color = _flags->getFlagValue(Flags::KOLOR); // TODO - test this
- _secondHero->_state = Hero::TALK;
+ _secondHero->_state = Hero::kHeroStateTalk;
_secondHero->_talkTime = time;
text._x = _secondHero->_middleX;
text._y = _secondHero->_middleY - _secondHero->_scaledFrameYSize;
@@ -4405,7 +4405,7 @@ byte *PrinceEngine::makePath(int destX, int destY) {
return nullptr;
} else {
_mainHero->freeOldMove();
- _mainHero->_state = _mainHero->TURN;
+ _mainHero->_state = _mainHero->kHeroStateTurn;
return nullptr;
}
}
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 4f989a18ae..fbd1b649ae 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -956,7 +956,7 @@ void Interpreter::O_WALKHERO() {
hero = _vm->_secondHero;
}
if (hero != nullptr) {
- if (hero->_state != Hero::STAY) {
+ if (hero->_state != Hero::kHeroStateStay) {
_currentInstruction -= 4;
_opcodeNF = 1;
}
@@ -1181,7 +1181,7 @@ void Interpreter::O_SETHEROANIM() {
Resource::loadResource(hero->_specAnim, normalizedPath.c_str(), true);
}
hero->_phase = 0;
- hero->_state = Hero::SPEC;
+ hero->_state = Hero::kHeroStateSpec;
}
}
debugInterpreter("O_SETHEROANIM hero %d, offset %d", hero, offset);
@@ -1196,7 +1196,7 @@ void Interpreter::O_WAITHEROANIM() {
hero = _vm->_secondHero;
}
if (hero != nullptr) {
- if (hero->_state == Hero::SPEC) {
+ if (hero->_state == Hero::kHeroStateSpec) {
_currentInstruction -= 4;
_opcodeNF = 1;
}
@@ -1711,9 +1711,9 @@ void Interpreter::O_FREEFLC() {
void Interpreter::O_TALKHEROSTOP() {
uint16 heroId = readScriptFlagValue();
if (!heroId) {
- _vm->_mainHero->_state = _vm->_mainHero->STAY;
+ _vm->_mainHero->_state = _vm->_mainHero->kHeroStateStay;
} else if (heroId == 1) {
- _vm->_secondHero->_state = _vm->_secondHero->STAY;
+ _vm->_secondHero->_state = _vm->_secondHero->kHeroStateStay;
}
debugInterpreter("O_TALKHEROSTOP %d", heroId);
}