Skip to content

Commit

Permalink
MADS: Phantom: Initial implementation of Player::setWalkTrigger()
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Oct 24, 2015
1 parent 6fc4d50 commit 86722cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
24 changes: 20 additions & 4 deletions engines/mads/player.cpp
Expand Up @@ -82,7 +82,8 @@ Player::Player(MADSEngine *vm)
_forcePrefix = false;
_commandsAllowed = false;
_enableAtTarget = false;

_walkTrigger = 0;

Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0);
Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0);
Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false);
Expand Down Expand Up @@ -188,8 +189,10 @@ void Player::changeFacing() {
(Facing)_directionListIndexes[_facing + 10];
selectSeries();

if ((_facing == _turnToFacing) && !_moving)
if ((_facing == _turnToFacing) && !_moving) {
updateFrame();
activateTrigger();
}

_priorTimer += 1;
}
Expand Down Expand Up @@ -280,6 +283,16 @@ void Player::updateFrame() {
_forceRefresh = true;
}

void Player::activateTrigger() {
// TODO: Finish this!
// TODO: Also sync _walkTrigger, if necessary

if (_walkTrigger) {
_vm->_game->_trigger = _walkTrigger;
_walkTrigger = 0;
}
}

void Player::update() {
Scene &scene = _vm->_game->_scene;

Expand Down Expand Up @@ -443,10 +456,12 @@ void Player::move() {
if (newFacing && _moving)
startMovement();

if (_turnToFacing != _facing)
if (_turnToFacing != _facing) {
changeFacing();
else if (!_moving)
} else if (!_moving) {
updateFrame();
activateTrigger();
}

int velocity = _velocity;
if (_scalingVelocity && (_totalDistance > 0)) {
Expand Down Expand Up @@ -811,6 +826,7 @@ void Player::firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point d
}

void Player::setWalkTrigger(int val) {
_walkTrigger = val;
warning("TODO: Player::setWalkTrigger");
}

Expand Down
3 changes: 3 additions & 0 deletions engines/mads/player.h
Expand Up @@ -95,6 +95,8 @@ class Player {
void startMovement();

void changeFacing();

void activateTrigger();
public:
MADSAction *_action;

Expand Down Expand Up @@ -141,6 +143,7 @@ class Player {
int _currentDepth;
int _currentScale;
Common::String _spritesPrefix;
int _walkTrigger;
public:
Player(MADSEngine *vm);

Expand Down

0 comments on commit 86722cc

Please sign in to comment.