[Scummvm-git-logs] scummvm master -> de625e4f539f1b73112c615ca024e58997e77e42
alxpnv
a04198622 at gmail.com
Thu Jun 10 10:31:48 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7df4708049 ASYLUM: rename Actor::updateStatus1*() methods
de625e4f53 ASYLUM: rename more Actor methods
Commit: 7df47080496f86be27967f15bcbbf7bfc3e554ec
https://github.com/scummvm/scummvm/commit/7df47080496f86be27967f15bcbbf7bfc3e554ec
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-06-10T13:34:27+03:00
Commit Message:
ASYLUM: rename Actor::updateStatus1*() methods
Changed paths:
engines/asylum/resources/actor.cpp
engines/asylum/resources/actor.h
engines/asylum/resources/special.cpp
diff --git a/engines/asylum/resources/actor.cpp b/engines/asylum/resources/actor.cpp
index dbe79fe0b1..7411270008 100644
--- a/engines/asylum/resources/actor.cpp
+++ b/engines/asylum/resources/actor.cpp
@@ -345,9 +345,9 @@ void Actor::update() {
case kActorStatusGettingHurt:
if (getWorld()->chapter == kChapter2) {
- updateStatus16_Chapter2();
+ MaxGetsSome();
} else if (getWorld()->chapter == kChapter11 && _index == getSharedData()->getPlayerIndex()) {
- updateStatus16_Chapter11();
+ SarahGetsSome();
}
break;
@@ -435,41 +435,41 @@ void Actor::update() {
if (_frameIndex <= _frameCount - 1)
++_frameIndex;
else
- resetActors();
+ SarahDies();
}
if (_index >= 10)
- updateStatus17_Chapter2();
+ TentacleDies();
}
break;
case kActorStatusAttacking:
if (getWorld()->chapter == kChapter2) {
if (_index > 12)
- updateStatus15_Chapter2();
+ CrowDives();
if (_index == getSharedData()->getPlayerIndex())
- updateStatus15_Chapter2_Player();
+ MaxAttacks();
if (_index == 11)
- updateStatus15_Chapter2_Actor11();
+ ScareCrowAttacks();
} else if (getWorld()->chapter == kChapter11) {
if (_index >= 10 && _index < 16)
- updateStatus15_Chapter11();
+ TentacleWhips();
if (_index == getSharedData()->getPlayerIndex())
- updateStatus15_Chapter11_Player();
+ SarahAttacks();
}
break;
case kActorStatus18:
if (getWorld()->chapter == kChapter2) {
if (_index > 12)
- updateStatus18_Chapter2();
+ CrowSwoops();
if (_index == 11)
- updateStatus18_Chapter2_Actor11();
+ ScareCrowRetreats();
}
break;
@@ -490,12 +490,12 @@ void Actor::update() {
case kActorStatusWalking2:
if (getWorld()->chapter == kChapter2) {
if (_index > 12) {
- updateStatus12_Chapter2();
+ CrowClosesIn();
return;
}
if (_index == 11) {
- updateStatus12_Chapter2_Actor11();
+ ScareCrowClosesIn();
return;
}
} else if (getWorld()->chapter == kChapter11) {
@@ -513,7 +513,7 @@ void Actor::update() {
case 13:
case 14:
case 15:
- updateStatus12_Chapter11();
+ TentacleRises();
return;
case 2:
@@ -623,7 +623,7 @@ void Actor::update() {
case kActorStatusInteracting:
case kActorStatusHittingPumpkin:
- updateStatus3_19();
+ updateStatusInteracting();
break;
case kActorStatusPickupItem:
@@ -639,15 +639,15 @@ void Actor::update() {
break;
case kActorStatusEnabled2:
- updateStatus14();
+ updateStatusEnabled2();
break;
case kActorStatusMorphingInto:
- updateStatus21();
+ updateStatusMorphing();
break;
case kActorStatusFidget:
- updateStatus9();
+ updateStatusBored();
break;
case kActorStatusShowingInventory:
@@ -1964,7 +1964,7 @@ void Actor::update_409230() {
//////////////////////////////////////////////////////////////////////////
// Static update methods
//////////////////////////////////////////////////////////////////////////
-void Actor::enableActorsChapter2(AsylumEngine *engine) {
+void Actor::crowsReturn(AsylumEngine *engine) {
engine->clearGameFlag(kGameFlag438);
engine->clearGameFlag(kGameFlag439);
engine->clearGameFlag(kGameFlag440);
@@ -2073,7 +2073,7 @@ void Actor::updatePlayerChapter9(AsylumEngine *engine, int nextPlayer) {
// Update methods
//////////////////////////////////////////////////////////////////////////
-void Actor::updateStatus3_19() {
+void Actor::updateStatusInteracting() {
if (getWorld()->chapter != kChapter2 || _frameIndex != 6 || _status == kActorStatusInteracting) { /* Original check: _status <= kActorStatus11 */
if (_frameIndex < _frameCount - 1) {
++_frameIndex;
@@ -2085,13 +2085,13 @@ void Actor::updateStatus3_19() {
}
} else {
if (_index == getSharedData()->getPlayerIndex())
- updateStatus19_Player();
+ checkPumpkinDeath();
++_frameIndex;
}
}
-void Actor::updateStatus19_Player() {
+void Actor::checkPumpkinDeath() {
updatePumpkin(kGameFlag263, kGameFlag270, kObjectPumpkin2Dies, kObjectPumpkin2Loop);
updatePumpkin(kGameFlag264, kGameFlag271, kObjectPumpkin3Dies, kObjectPumpkin3Loop);
updatePumpkin(kGameFlag265, kGameFlag272, kObjectPumpkin4Dies, kObjectPumpkin4Loop);
@@ -2265,7 +2265,7 @@ void Actor::updateStatusEnabledProcessStatus(int16 testX, int16 testY, uint32 co
}
}
-void Actor::updateStatus9() {
+void Actor::updateStatusBored() {
if (_index == getSharedData()->getPlayerIndex()
&& getWorld()->chapter != kChapter9
&& getWorld()->actorType == 0
@@ -2282,7 +2282,7 @@ void Actor::updateStatus9() {
}
}
-void Actor::updateStatus12_Chapter2() {
+void Actor::CrowClosesIn() {
// Compute distance
uint32 frameIndex = _frameIndex;
if (_frameIndex >= _frameCount)
@@ -2326,7 +2326,7 @@ void Actor::updateStatus12_Chapter2() {
}
}
-void Actor::updateStatus12_Chapter2_Actor11() {
+void Actor::ScareCrowClosesIn() {
bool processEnd = true;
Actor *player = getScene()->getActor();
Common::Point sum = _point1 + _point2;
@@ -2402,7 +2402,7 @@ void Actor::updateStatus12_Chapter2_Actor11() {
}
}
-void Actor::updateStatus12_Chapter11() {
+void Actor::TentacleRises() {
if (!_frameIndex)
getSound()->playSound(getWorld()->soundResourceIds[6]);
@@ -2422,12 +2422,12 @@ void Actor::updateStatus12_Chapter11() {
getSharedData()->vector2.x = _point1.x + _point2.x;
getSharedData()->vector2.y = _point1.y + _point2.y;
- updateCoordinates(getSharedData()->vector1, getSharedData()->vector2);
+ TentacleBlocksSarah(getSharedData()->vector1, getSharedData()->vector2);
}
-void Actor::updateStatus14() {
+void Actor::updateStatusEnabled2() {
if (_frameCount == 0)
- error("[Actor::updateStatus14] Invalid frame count (cannot be 0)");
+ error("[Actor::updateStatusEnabled2] Invalid frame count (cannot be 0)");
_frameIndex = (_frameIndex + 1) % _frameCount;
_lastScreenUpdate = _vm->screenUpdateCount;
@@ -2440,24 +2440,24 @@ void Actor::updateStatus14() {
if (_index == 11)
updateStatus(kActorStatusWalking2);
else if (_index > 12)
- updateStatus14_Chapter2_Helper();
+ CrowStatusQuo();
break;
case kChapter11:
if (_index >= 10 && _index < 16)
- updateStatus14_Chapter11();
+ TentacleWigglesForSarah();
break;
}
}
-void Actor::updateStatus14_Chapter2_Helper() {
+void Actor::CrowStatusQuo() {
if (getSharedData()->crowsData[_index + 61])
- updateStatus14_Chapter2();
+ CrowHoveringBeforeKill();
else
updateStatus(kActorStatusWalking2);
}
-void Actor::updateStatus14_Chapter2() {
+void Actor::CrowHoveringBeforeKill() {
// Original calls getDistanceForFrame but does not seem to do anything with the results
Actor *player = getScene()->getActor();
@@ -2542,7 +2542,7 @@ void Actor::updateStatus14_Chapter2() {
}
}
-void Actor::updateStatus14_Chapter11() {
+void Actor::TentacleWigglesForSarah() {
Actor *actor0 = getScene()->getActor(0);
getSharedData()->vector1.x = actor0->getPoint1()->x + actor0->getPoint2()->x;
@@ -2555,7 +2555,7 @@ void Actor::updateStatus14_Chapter11() {
getWorld()->tickValueArray[_index] = rnd(4000) + _vm->getTick();
faceTarget(kActorMax, kDirectionFromActor);
- updateCoordinates(getSharedData()->vector1, getSharedData()->vector2);
+ TentacleBlocksSarah(getSharedData()->vector1, getSharedData()->vector2);
if (getWorld()->tickValueArray[_index] < (int)_vm->getTick()) {
if (euclidianDistance(getSharedData()->vector1, getSharedData()->vector2) >= 75) {
@@ -2569,7 +2569,7 @@ void Actor::updateStatus14_Chapter11() {
}
}
-void Actor::updateStatus15_Chapter2() {
+void Actor::CrowDives() {
Actor *player = getScene()->getActor();
Common::Point sum = _point1 + _point2;
@@ -2610,7 +2610,7 @@ void Actor::updateStatus15_Chapter2() {
if (player->getStatus() != kActorStatusGettingHurt && player->getStatus() != kActorStatusRestarting && player->getFrameIndex() < 6) {
_point1 = sumPlayer - _point2;
- updateStatus15_Chapter2_Helper();
+ MaxGetsHit();
getSpeech()->playPlayer(51);
_vm->setGameFlag(kGameFlag219);
@@ -2652,7 +2652,7 @@ void Actor::updateStatus15_Chapter2() {
}
}
-void Actor::updateStatus15_Chapter2_Helper() {
+void Actor::MaxGetsHit() {
Actor *actor39 = getScene()->getActor(39);
actor39->setFrameIndex(0);
@@ -2695,7 +2695,7 @@ void Actor::updateStatus15_Chapter2_Helper() {
switch (getSharedData()->getChapter2Counter(6)) {
default:
- enableActorsChapter2(_vm);
+ crowsReturn(_vm);
getCursor()->hide();
break;
@@ -2712,9 +2712,9 @@ void Actor::updateStatus15_Chapter2_Helper() {
}
}
-void Actor::updateStatus15_Chapter2_Player() {
+void Actor::MaxAttacks() {
if (_index != getSharedData()->getPlayerIndex())
- error("[Actor::updateStatus15_Chapter2_Player] Function is only available for the current player");
+ error("[Actor::MaxAttacks] Function is only available for the current player");
// Update frame index and process
_frameIndex++;
@@ -2751,49 +2751,49 @@ void Actor::updateStatus15_Chapter2_Player() {
break;
case 15:
- if (getScene()->getActor(16)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(16)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag321);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 16:
- if (getScene()->getActor(15)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(15)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag321);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 17:
- if (getScene()->getActor(21)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(21)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag322);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 18:
- if (getScene()->getActor(19)->updateStatus15_isNoVisibleOrStatus17() && getScene()->getActor(20)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(19)->checkCrowDeath() && getScene()->getActor(20)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag323);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 19:
- if (getScene()->getActor(18)->updateStatus15_isNoVisibleOrStatus17() && getScene()->getActor(20)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(18)->checkCrowDeath() && getScene()->getActor(20)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag323);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 20:
- if (getScene()->getActor(19)->updateStatus15_isNoVisibleOrStatus17() && getScene()->getActor(18)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(19)->checkCrowDeath() && getScene()->getActor(18)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag323);
_vm->clearGameFlag(kGameFlag235);
}
break;
case 21:
- if (getScene()->getActor(17)->updateStatus15_isNoVisibleOrStatus17()) {
+ if (getScene()->getActor(17)->checkCrowDeath()) {
_vm->setGameFlag(kGameFlag322);
_vm->clearGameFlag(kGameFlag235);
}
@@ -2806,7 +2806,7 @@ void Actor::updateStatus15_Chapter2_Player() {
}
if (actorIndex == 11)
- updateStatus15_Chapter2_Player_Helper();
+ checkScareCrowDeath();
}
if (_frameIndex >= _frameCount) {
@@ -2815,7 +2815,7 @@ void Actor::updateStatus15_Chapter2_Player() {
}
}
-void Actor::updateStatus15_Chapter2_Player_Helper() {
+void Actor::checkScareCrowDeath() {
// we are the current player
Actor *actor11 = getScene()->getActor(11);
Actor *actor40 = getScene()->getActor(40);
@@ -2842,18 +2842,18 @@ void Actor::updateStatus15_Chapter2_Player_Helper() {
}
}
-bool Actor::updateStatus15_isNoVisibleOrStatus17() {
+bool Actor::checkCrowDeath() {
return (!isVisible() || _status == kActorStatusRestarting);
}
-void Actor::updateStatus15_Chapter2_Actor11() {
+void Actor::ScareCrowAttacks() {
Actor *player = getScene()->getActor();
Common::Point sum = _point1 + _point2;
Common::Point sumPlayer = *player->getPoint1() + *player->getPoint2();
Common::Rect rect;
- rectFromDirection(&rect, _direction, sum);
+ getCrowStrikeZone(&rect, _direction, sum);
switch (_frameIndex) {
default:
@@ -2884,7 +2884,7 @@ void Actor::updateStatus15_Chapter2_Actor11() {
if (getScene()->getActor(11)->getFrameIndex() < 8
&& getScene()->findActionArea(kActionAreaType2, actionPoint) != -1
- && !updateStatus15_Chapter2_Actor11_Helper(10, 11))
+ && !actorsIntersect(10, 11))
_point1 = actionPoint - _point2;
if (_frameIndex != 8 || _status == kActorStatusGettingHurt) { /* FIXME the status test seems useless */
@@ -2911,7 +2911,7 @@ void Actor::updateStatus15_Chapter2_Actor11() {
player->update_409230();
player->updateStatus(kActorStatusGettingHurt);
- updateStatus15_Chapter2_Helper();
+ MaxGetsHit();
getSpeech()->playPlayer(52);
@@ -2926,7 +2926,7 @@ void Actor::updateStatus15_Chapter2_Actor11() {
}
}
-bool Actor::updateStatus15_Chapter2_Actor11_Helper(ActorIndex actorIndex1, ActorIndex actorIndex2) {
+bool Actor::actorsIntersect(ActorIndex actorIndex1, ActorIndex actorIndex2) {
Actor *actor1 = getScene()->getActor(actorIndex1);
Actor *actor2 = getScene()->getActor(actorIndex2);
@@ -2947,7 +2947,7 @@ bool Actor::updateStatus15_Chapter2_Actor11_Helper(ActorIndex actorIndex1, Actor
return getScene()->rectIntersect(pt1.x, pt1.y, pt2.x, pt2.y, pt3.x, pt3.y, pt4.x, pt4.y);
}
-void Actor::updateStatus15_Chapter11() {
+void Actor::TentacleWhips() {
Actor *actor0 = getScene()->getActor(0);
// Update vectors
@@ -2957,7 +2957,7 @@ void Actor::updateStatus15_Chapter11() {
getSharedData()->vector2.x = getPoint1()->x + getPoint2()->x;
getSharedData()->vector2.y = getPoint1()->y + getPoint2()->y;
- updateCoordinates(getSharedData()->vector1, getSharedData()->vector2);
+ TentacleBlocksSarah(getSharedData()->vector1, getSharedData()->vector2);
++_frameIndex;
if (_frameIndex >= _frameCount)
@@ -2978,7 +2978,7 @@ void Actor::updateStatus15_Chapter11() {
}
}
-void Actor::updateStatus15_Chapter11_Player() {
+void Actor::SarahAttacks() {
_frameIndex++;
if (_frameIndex == 17) {
@@ -3035,7 +3035,7 @@ void Actor::updateStatus15_Chapter11_Player() {
}
}
-void Actor::updateStatus16_Chapter2() {
+void Actor::MaxGetsSome() {
Actor *player = getScene()->getActor();
player->setFrameIndex(player->getFrameIndex() + 1);
@@ -3071,14 +3071,14 @@ void Actor::updateStatus16_Chapter2() {
getSound()->stop(getWorld()->soundResourceIds[7]);
if (_vm->isGameFlagSet(kGameFlag235)) {
- Actor::enableActorsChapter2(_vm);
+ Actor::crowsReturn(_vm);
_vm->clearGameFlag(kGameFlag235);
}
}
}
}
-void Actor::updateStatus16_Chapter11() {
+void Actor::SarahGetsSome() {
// We are sure to be the current player
getCursor()->show();
getSharedData()->setFlag(kFlag1, false);
@@ -3098,7 +3098,7 @@ void Actor::updateStatus16_Chapter11() {
}
}
-void Actor::updateStatus17_Chapter2() {
+void Actor::TentacleDies() {
++_frameIndex;
if (_frameIndex >= _frameCount) {
@@ -3113,7 +3113,7 @@ void Actor::updateStatus17_Chapter2() {
}
}
-void Actor::updateStatus18_Chapter2() {
+void Actor::CrowSwoops() {
Actor *player = getScene()->getActor();
_point1.x = player->getPoint1()->x - (int16)getSharedData()->crowsData[2 * _index + 30];
@@ -3132,7 +3132,7 @@ void Actor::updateStatus18_Chapter2() {
}
}
-void Actor::updateStatus18_Chapter2_Actor11() {
+void Actor::ScareCrowRetreats() {
int32 frameIndex = (int32)_frameIndex;
uint32 distance = (uint32)abs((double)getDistanceForFrame(_direction, (_frameIndex < _frameCount) ? _frameIndex : 2 * _frameCount - (_frameIndex + 1)));
@@ -3168,7 +3168,7 @@ void Actor::updateStatus18_Chapter2_Actor11() {
_frameIndex = (uint32)frameIndex;
}
-void Actor::updateStatus21() {
+void Actor::updateStatusMorphing() {
if (_resourceId == getWorld()->graphicResourceIds[3] || _resourceId == getWorld()->graphicResourceIds[4] || _resourceId == getWorld()->graphicResourceIds[5]) {
if (_frameIndex < _frameCount - 1) {
++_frameIndex;
@@ -3229,7 +3229,7 @@ void Actor::updateFinish() {
}
}
-void Actor::updateCoordinates(const Common::Point &vec1, Common::Point vec2) {
+void Actor::TentacleBlocksSarah(const Common::Point &vec1, Common::Point vec2) {
if (getScene()->getActor(1)->isVisible())
return;
@@ -3246,7 +3246,7 @@ void Actor::updateCoordinates(const Common::Point &vec1, Common::Point vec2) {
updateCoordinatesForDirection(dir, (int16)(diffY - 1), &_point1);
}
-void Actor::resetActors() {
+void Actor::SarahDies() {
getCursor()->hide();
getScene()->getActor(0)->hide();
getScene()->getActor(1)->setFrameIndex(0);
@@ -3900,7 +3900,7 @@ int32 Actor::angleFromVectors(const Common::Point &vec1, const Common::Point &ve
return result;
}
-void Actor::rectFromDirection(Common::Rect *rect, ActorDirection direction, const Common::Point &point) {
+void Actor::getCrowStrikeZone(Common::Rect *rect, ActorDirection direction, const Common::Point &point) {
if (!rect)
error("[Actor::rect] Invalid rect (NULL)!");
diff --git a/engines/asylum/resources/actor.h b/engines/asylum/resources/actor.h
index 3108120733..fd49de7151 100644
--- a/engines/asylum/resources/actor.h
+++ b/engines/asylum/resources/actor.h
@@ -306,7 +306,7 @@ public:
//////////////////////////////////////////////////////////////////////////
// Static update methods
//////////////////////////////////////////////////////////////////////////
- static void enableActorsChapter2(AsylumEngine *engine);
+ static void crowsReturn(AsylumEngine *engine);
/**
* Updates the player appearance in chapter 9.
@@ -422,43 +422,43 @@ private:
//////////////////////////////////////////////////////////////////////////
// Update methods
//////////////////////////////////////////////////////////////////////////
- void updateStatus3_19();
- void updateStatus19_Player();
+ void updateStatusInteracting();
+ void checkPumpkinDeath();
void updatePumpkin(GameFlag flagToCheck, GameFlag flagToSet, ObjectId objectToUpdate, ObjectId objectToDisable);
void updateStatusEnabled();
void updateStatusEnabledProcessStatus(int16 testX, int16 testY, uint32 counter, int16 setX, int16 setY);
- void updateStatus9();
+ void updateStatusBored();
- void updateStatus12_Chapter2();
- void updateStatus12_Chapter2_Actor11();
- void updateStatus12_Chapter11();
+ void CrowClosesIn();
+ void ScareCrowClosesIn();
+ void TentacleRises();
- void updateStatus14();
- void updateStatus14_Chapter2();
- void updateStatus14_Chapter2_Helper();
- void updateStatus14_Chapter11();
+ void updateStatusEnabled2();
+ void CrowHoveringBeforeKill();
+ void CrowStatusQuo();
+ void TentacleWigglesForSarah();
- void updateStatus15_Chapter2();
- void updateStatus15_Chapter2_Helper();
- void updateStatus15_Chapter2_Player();
- void updateStatus15_Chapter2_Player_Helper();
- bool updateStatus15_isNoVisibleOrStatus17();
- void updateStatus15_Chapter2_Actor11();
- bool updateStatus15_Chapter2_Actor11_Helper(ActorIndex actorIndex1, ActorIndex actorIndex2);
- void updateStatus15_Chapter11();
- void updateStatus15_Chapter11_Player();
+ void CrowDives();
+ void MaxGetsHit();
+ void MaxAttacks();
+ void checkScareCrowDeath();
+ bool checkCrowDeath();
+ void ScareCrowAttacks();
+ bool actorsIntersect(ActorIndex actorIndex1, ActorIndex actorIndex2);
+ void TentacleWhips();
+ void SarahAttacks();
- void updateStatus16_Chapter2();
- void updateStatus16_Chapter11();
+ void MaxGetsSome();
+ void SarahGetsSome();
- void updateStatus17_Chapter2();
+ void TentacleDies();
- void updateStatus18_Chapter2();
- void updateStatus18_Chapter2_Actor11();
+ void CrowSwoops();
+ void ScareCrowRetreats();
- void updateStatus21();
+ void updateStatusMorphing();
void updateFinish();
@@ -490,18 +490,8 @@ private:
*/
void setVolume();
- /**
- * Updates the coordinates.
- *
- * @param vec1 The first vector.
- * @param vec2 The second vector.
- */
- void updateCoordinates(const Common::Point &vec1, Common::Point vec2);
-
- /**
- * Hide Actor 0 and reset Actor 1 frame index
- */
- void resetActors();
+ void TentacleBlocksSarah(const Common::Point &vec1, Common::Point vec2);
+ void SarahDies();
/**
* Updates the actor "number" data if the item is "1".
@@ -585,7 +575,7 @@ private:
* @param direction The direction.
* @param point The point.
*/
- static void rectFromDirection(Common::Rect *rect, ActorDirection direction, const Common::Point &point);
+ static void getCrowStrikeZone(Common::Rect *rect, ActorDirection direction, const Common::Point &point);
/**
* Compares the angle between two vectors
diff --git a/engines/asylum/resources/special.cpp b/engines/asylum/resources/special.cpp
index 4d6cf0af80..1728b16ee7 100644
--- a/engines/asylum/resources/special.cpp
+++ b/engines/asylum/resources/special.cpp
@@ -177,7 +177,7 @@ void Special::chapter2(Object *object, ActorIndex actorIndex) {
case kObjectOpeningGate:
if (_vm->isGameFlagSet(kGameFlag1137)) {
_vm->clearGameFlag(kGameFlag1137);
- Actor::enableActorsChapter2(_vm);
+ Actor::crowsReturn(_vm);
}
if (_vm->isGameFlagSet(kGameFlag1131) && !getSound()->isPlaying(getSpeech()->getSoundResourceId())) {
Commit: de625e4f539f1b73112c615ca024e58997e77e42
https://github.com/scummvm/scummvm/commit/de625e4f539f1b73112c615ca024e58997e77e42
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-06-10T13:34:27+03:00
Commit Message:
ASYLUM: rename more Actor methods
Also removed Actor::compare()
Changed paths:
engines/asylum/asylum.cpp
engines/asylum/console.cpp
engines/asylum/resources/actor.cpp
engines/asylum/resources/actor.h
engines/asylum/resources/encounters.cpp
engines/asylum/resources/script.cpp
engines/asylum/resources/script.h
engines/asylum/resources/special.cpp
engines/asylum/shared.h
engines/asylum/views/menu.cpp
engines/asylum/views/scene.cpp
diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index 5d774d2c99..31a2dd0d3a 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -433,7 +433,7 @@ void AsylumEngine::processDelayedEvents() {
_script->resetQueue();
_script->reset();
if (_scene)
- _scene->getActor(0)->updateStatus(kActorStatusDisabled);
+ _scene->getActor(0)->changeStatus(kActorStatusDisabled);
// Fade screen to black
_screen->paletteFade(0, 75, 8);
diff --git a/engines/asylum/console.cpp b/engines/asylum/console.cpp
index 61acfc726a..c389d5d846 100644
--- a/engines/asylum/console.cpp
+++ b/engines/asylum/console.cpp
@@ -586,7 +586,7 @@ bool Console::cmdSetStatus(int argc, const char **argv) {
return true;
}
- actor->updateStatus((ActorStatus)status);
+ actor->changeStatus((ActorStatus)status);
return false;
}
diff --git a/engines/asylum/resources/actor.cpp b/engines/asylum/resources/actor.cpp
index 7411270008..8312f07e54 100644
--- a/engines/asylum/resources/actor.cpp
+++ b/engines/asylum/resources/actor.cpp
@@ -378,13 +378,13 @@ void Actor::update() {
getSpeech()->playPlayer(453);
getScene()->getActor(11)->hide();
- player->updateStatus(kActorStatusInteracting);
+ player->changeStatus(kActorStatusInteracting);
player->setResourceId(player->getResourcesId(35));
player->setDirection(kDirectionS);
player->setFrameCount(GraphicResource::getFrameCount(_vm, player->getResourceId()));
getCursor()->hide();
- getScene()->getActor(0)->updateFromDirection(kDirectionS);
+ getScene()->getActor(0)->changeDirection(kDirectionS);
// Queue script
getScript()->queueScript(getWorld()->getActionAreaById(2696)->scriptIndex, getSharedData()->getPlayerIndex());
@@ -421,7 +421,7 @@ void Actor::update() {
++_frameIndex;
} else {
_vm->clearGameFlag(kGameFlag239);
- getScene()->getActor(10)->updateStatus(kActorStatusEnabled2);
+ getScene()->getActor(10)->changeStatus(kActorStatusEnabled2);
hide();
_vm->setGameFlag(kGameFlag238);
@@ -479,8 +479,8 @@ void Actor::update() {
if (_vm->screenUpdateCount - _lastScreenUpdate > 300) {
if (_vm->getRandom(100) < 50) {
if (!getSpeech()->getSoundResourceId() || !getSound()->isPlaying(getSpeech()->getSoundResourceId())) {
- if (isDefaultDirection(10))
- updateStatus(kActorStatusFidget);
+ if (canChangeStatus(10))
+ changeStatus(kActorStatusFidget);
}
}
_lastScreenUpdate = _vm->screenUpdateCount;
@@ -531,7 +531,7 @@ void Actor::update() {
case kActorStatusWalking: {
uint32 index = (_frameIndex >= _frameCount) ? 2 * _frameCount - (_frameIndex + 1) : _frameIndex;
- uint32 dist = (uint32)abs((double)getDistanceForFrame(_direction, index));
+ uint32 dist = (uint32)abs((double)getWalkIncrement(_direction, index));
Common::Point point = _point1 + _point2;
if (canMove(&point, _direction, dist, false)) {
@@ -553,10 +553,10 @@ void Actor::update() {
if (_index != getSharedData()->getPlayerIndex() && getWorld()->chapter != kChapter9)
getSpecial()->run(NULL, _index);
- updateDirection();
+ updateReflectionData();
if (_field_944 != 5)
- updateFinish();
+ actionAreaCheck();
}
break;
@@ -565,7 +565,7 @@ void Actor::update() {
case kActorStatusWalkingTo2: {
uint32 index = (_frameIndex >= _frameCount) ? 2 * _frameCount - (_frameIndex + 1) : _frameIndex;
- int32 dist = (int32)abs((double)getDistanceForFrame(_direction, index));
+ int32 dist = (int32)abs((double)getWalkIncrement(_direction, index));
Common::Point point = _point1 + _point2;
Common::Point current = _data.points[_data.current];
@@ -577,7 +577,7 @@ void Actor::update() {
if (canMove(&point, _direction, (uint32)dist, false)) {
move(_direction, (uint32)dist);
} else {
- update_409230();
+ stopWalking();
}
} else {
int32 area = getScene()->findActionArea(kActionAreaType1, current);
@@ -585,23 +585,23 @@ void Actor::update() {
area = 1;
if (area == -1 && _data.current >= (int32)(_data.count - 1)) {
- update_409230();
+ stopWalking();
} else {
_frameIndex = (_frameIndex + 1) % _frameCount;
- if (canMoveCheckActors(¤t, _direction)) {
+ if (testActorCollision(¤t, _direction)) {
_point1.x = current.x - _point2.x;
_point1.y = current.y - _point2.y;
if (_data.current < (int32)(_data.count - 1)) {
_data.current++;
- updateFromDirection(_data.directions[_data.current]);
+ changeDirection(_data.directions[_data.current]);
} else {
- update_409230();
+ stopWalking();
}
} else {
- update_409230();
+ stopWalking();
}
}
}
@@ -613,10 +613,10 @@ void Actor::update() {
if (_index != getSharedData()->getPlayerIndex() && getWorld()->chapter != kChapter9)
getSpecial()->run(NULL, _index);
- updateDirection();
+ updateReflectionData();
if (_field_944 != 5)
- updateFinish();
+ actionAreaCheck();
}
break;
@@ -673,14 +673,14 @@ void Actor::update() {
if (_index != getSharedData()->getPlayerIndex() && getWorld()->chapter != kChapter9)
getSpecial()->run(NULL, _index);
- updateDirection();
+ updateReflectionData();
if (_field_944 != 5)
- updateFinish();
+ actionAreaCheck();
}
-void Actor::updateStatus(ActorStatus actorStatus) {
- debugC(kDebugLevelActor, "[updateStatus] %d point1(%d:%d) point2(%d:%d)", actorStatus, _point1.x, _point1.y, _point2.x, _point2.y);
+void Actor::changeStatus(ActorStatus actorStatus) {
+ debugC(kDebugLevelActor, "[changeStatus] %d point1(%d:%d) point2(%d:%d)", actorStatus, _point1.x, _point1.y, _point2.x, _point2.y);
switch (actorStatus) {
default:
@@ -755,7 +755,7 @@ void Actor::updateStatus(ActorStatus actorStatus) {
if (getSharedData()->getFlag(kFlagIsEncounterRunning))
return;
- if (_vm->getRandomBit() == 1 && isDefaultDirection(15))
+ if (_vm->getRandomBit() == 1 && canChangeStatus(15))
updateGraphicData(15);
else
updateGraphicData(10);
@@ -800,7 +800,7 @@ void Actor::updateStatus(ActorStatus actorStatus) {
// Direction & position
//////////////////////////////////////////////////////////////////////////
-void Actor::updateDirection() {
+void Actor::updateReflectionData() {
if (!_processNewDirection)
return;
@@ -994,7 +994,7 @@ void Actor::updateDirection() {
index++;
if (index >= 55)
- error("[Actor::updateDirection] Invalid resource id index");
+ error("[Actor::updateReflectionData] Invalid resource id index");
}
// Compute resource id and adjust frame count
@@ -1010,7 +1010,7 @@ void Actor::updateDirection() {
nextActor->setResourceId(resourceId);
}
-void Actor::updateFromDirection(ActorDirection actorDirection) {
+void Actor::changeDirection(ActorDirection actorDirection) {
_direction = actorDirection;
if (_field_944 == 5)
@@ -1095,7 +1095,7 @@ void Actor::faceTarget(uint32 target, DirectionFrom from) {
}
Common::Point mid(_point1.x + _point2.x, _point1.y + _point2.y);
- updateFromDirection(directionFromAngle(mid, point));
+ changeDirection(getAngle(mid, point));
}
void Actor::setPosition(int16 newX, int16 newY, ActorDirection newDirection, uint32 frame) {
@@ -1103,7 +1103,7 @@ void Actor::setPosition(int16 newX, int16 newY, ActorDirection newDirection, uin
_point1.y = newY - _point2.y;
if (_direction != kDirection8)
- updateFromDirection(newDirection);
+ changeDirection(newDirection);
if (frame > 0)
_frameIndex = frame;
@@ -1160,7 +1160,7 @@ void Actor::clearFields() {
_field_9A0 = 0;
}
-bool Actor::isResourcePresent() const {
+bool Actor::checkBoredStatus() const {
if (_status != kActorStatusFidget)
return false;
@@ -1173,7 +1173,7 @@ bool Actor::isResourcePresent() const {
return (index >= 15);
}
-bool Actor::process(const Common::Point &point) {
+bool Actor::canReach(const Common::Point &point) {
// Compute point and delta
Common::Point sum(_point1.x + _point2.x, _point1.y + _point2.y);
Common::Point delta = point - sum;
@@ -1222,7 +1222,7 @@ bool Actor::process(const Common::Point &point) {
_data.current = 0;
_data.count = 1;
- updateFromDirection(actorDir);
+ changeDirection(actorDir);
return true;
}
@@ -1238,7 +1238,7 @@ bool Actor::process(const Common::Point &point) {
_data.current = 0;
_data.count = 1;
- updateFromDirection(actorDir);
+ changeDirection(actorDir);
return true;
}
@@ -1264,7 +1264,7 @@ bool Actor::process(const Common::Point &point) {
switch (a3) {
default:
- error("[Actor::process] Invalid value for a3");
+ error("[Actor::canReach] Invalid value for a3");
break;
case 0:
@@ -1295,7 +1295,7 @@ bool Actor::process(const Common::Point &point) {
switch (a3) {
default:
- error("[Actor::process] Invalid value for a3");
+ error("[Actor::canReach] Invalid value for a3");
break;
case 0:
@@ -1335,7 +1335,7 @@ bool Actor::process(const Common::Point &point) {
_data.current = 0;
_data.count = 2;
- updateFromDirection(direction1);
+ changeDirection(direction1);
_data.directions[1] = direction2;
@@ -1349,7 +1349,7 @@ bool Actor::process(const Common::Point &point) {
_data.current = 0;
_data.count = 2;
- updateFromDirection(direction2);
+ changeDirection(direction2);
_data.directions[1] = direction1;
@@ -1387,32 +1387,32 @@ bool Actor::process(const Common::Point &point) {
if (abs(sum.x - point.x) > abs(sum.y - point.y)) {
if (sum.x <= point.x) {
- if (!processActionLeft(sum, point, &actions))
+ if (!findLeftPath(sum, point, &actions))
return false;
} else {
- if (!processActionAll(sum, point, &actions))
+ if (!findRightPath(sum, point, &actions))
return false;
}
- updateFromDirection(_data.directions[0]);
+ changeDirection(_data.directions[0]);
return true;
}
if (sum.y > point.y) {
- if (!processActionTop(sum, point, &actions))
+ if (!findUpPath(sum, point, &actions))
return false;
- updateFromDirection(_data.directions[0]);
+ changeDirection(_data.directions[0]);
return true;
}
// last case: sum.y < point.y
- if (!processActionDown(sum, point, &actions))
+ if (!findDownPath(sum, point, &actions))
return false;
- updateFromDirection(_data.directions[0]);
+ changeDirection(_data.directions[0]);
return true;
}
@@ -1448,23 +1448,23 @@ bool Actor::process(const Common::Point &point) {
_data.count = 1;
// Update actor from direction
- updateFromDirection(actorDir);
+ changeDirection(actorDir);
return true;
}
-void Actor::processStatus(int16 actorX, int16 actorY, bool doSpeech) {
- if (process(Common::Point(actorX, actorY))) {
+void Actor::forceTo(int16 actorX, int16 actorY, bool doSpeech) {
+ if (canReach(Common::Point(actorX, actorY))) {
if (_status <= kActorStatus11)
- updateStatus(kActorStatusWalkingTo);
+ changeStatus(kActorStatusWalkingTo);
else
- updateStatus(kActorStatusWalkingTo2);
+ changeStatus(kActorStatusWalkingTo2);
} else if (doSpeech) {
getSpeech()->playIndexed(1);
}
}
-void Actor::processNext(ActorIndex nextActor, int32 actionAreaId, ActorDirection nextDirection, const Common::Point &nextPosition, bool invertPriority, const Common::Point &nextPositionOffset) {
+void Actor::setupReflectionData(ActorIndex nextActor, int32 actionAreaId, ActorDirection nextDirection, const Common::Point &nextPosition, bool invertPriority, const Common::Point &nextPositionOffset) {
_nextActorIndex = nextActor;
_nextActionIndex = (actionAreaId != -1) ? getWorld()->getActionAreaIndexById(actionAreaId) : -1;
_nextDirection = nextDirection;
@@ -1562,10 +1562,10 @@ void Actor::processNext(ActorIndex nextActor, int32 actionAreaId, ActorDirection
_processNewDirection = true;
- updateDirection();
+ updateReflectionData();
}
-bool Actor::canInteract(Common::Point *point, int32* param) {
+bool Actor::aNicePlaceToTalk(Common::Point *point, int32* param) {
Actor *player = getScene()->getActor();
int16 offset = 65;
@@ -1670,7 +1670,7 @@ bool Actor::canInteract(Common::Point *point, int32* param) {
return false;
processActor:
- if (!player->process(pt))
+ if (!player->canReach(pt))
return false;
*point = pt;
@@ -1702,7 +1702,7 @@ bool Actor::canMove(Common::Point *point, ActorDirection direction, uint32 dista
if (y > rct.bottom)
return false;
- if (!canMoveCheckActors(point, direction))
+ if (!testActorCollision(point, direction))
return false;
}
@@ -1742,7 +1742,7 @@ void Actor::move(ActorDirection actorDir, uint32 dist) {
case kActorStatusWalkingTo:
case kActorStatusWalking2:
case kActorStatusWalkingTo2:
- updateCoordinatesForDirection(actorDir, (int16)dist, &_point1);
+ incPosition(actorDir, (int16)dist, &_point1);
_frameIndex = (_frameIndex + 1) % _frameCount;
@@ -1780,7 +1780,7 @@ void Actor::move(ActorDirection actorDir, uint32 dist) {
case kActorStatus18:
if (getWorld()->chapter == kChapter2) {
- updateCoordinatesForDirection(actorDir, (int16)dist, &_point1);
+ incPosition(actorDir, (int16)dist, &_point1);
if (_walkingSound1 == kResourceNone)
break;
@@ -1815,8 +1815,8 @@ void Actor::move(ActorDirection actorDir, uint32 dist) {
}
}
-bool Actor::canMoveCheckActors(Common::Point *point, ActorDirection dir) {
- int32 dist = getAbsoluteDistanceForFrame(dir, (_frameIndex >= _frameCount) ? 2 * _frameCount - (_frameIndex + 1) : _frameIndex);
+bool Actor::testActorCollision(Common::Point *point, ActorDirection dir) {
+ int32 dist = getStride(dir, (_frameIndex >= _frameCount) ? 2 * _frameCount - (_frameIndex + 1) : _frameIndex);
int32 x = point->x + deltaPointsArray[dir][0] * dist - (_field_948 + 10);
int32 y = point->y + deltaPointsArray[dir][1] * dist - (_field_94C + 10);
@@ -1956,8 +1956,8 @@ void Actor::drawInventory() {
getWorld()->field_120 = 0;
}
-void Actor::update_409230() {
- updateStatus(_status <= 11 ? kActorStatusEnabled : kActorStatusEnabled2);
+void Actor::stopWalking() {
+ changeStatus(_status <= 11 ? kActorStatusEnabled : kActorStatusEnabled2);
_data.current = 0;
}
@@ -1975,34 +1975,34 @@ void Actor::crowsReturn(AsylumEngine *engine) {
engine->data()->resetChapter2Data();
engine->scene()->getActor(13)->enable();
- engine->scene()->getActor(13)->processStatus(2300, 71, false);
+ engine->scene()->getActor(13)->forceTo(2300, 71, false);
engine->scene()->getActor(14)->enable();
- engine->scene()->getActor(14)->processStatus(2600, 1300, false);
+ engine->scene()->getActor(14)->forceTo(2600, 1300, false);
engine->scene()->getActor(15)->enable();
- engine->scene()->getActor(15)->processStatus(2742, 615, false);
+ engine->scene()->getActor(15)->forceTo(2742, 615, false);
engine->scene()->getActor(16)->enable();
- engine->scene()->getActor(16)->processStatus(2700, 1200, false);
+ engine->scene()->getActor(16)->forceTo(2700, 1200, false);
engine->scene()->getActor(17)->enable();
- engine->scene()->getActor(17)->processStatus(2751, 347, false);
+ engine->scene()->getActor(17)->forceTo(2751, 347, false);
engine->scene()->getActor(18)->enable();
- engine->scene()->getActor(18)->processStatus(2420, 284, false);
+ engine->scene()->getActor(18)->forceTo(2420, 284, false);
engine->scene()->getActor(19)->enable();
- engine->scene()->getActor(19)->processStatus(2800, 370, false);
+ engine->scene()->getActor(19)->forceTo(2800, 370, false);
engine->scene()->getActor(20)->enable();
- engine->scene()->getActor(20)->processStatus(1973, 1, false);
+ engine->scene()->getActor(20)->forceTo(1973, 1, false);
engine->scene()->getActor(21)->enable();
- engine->scene()->getActor(21)->processStatus(2541, 40, false);
+ engine->scene()->getActor(21)->forceTo(2541, 40, false);
}
-void Actor::updatePlayerChapter9(AsylumEngine *engine, int nextPlayer) {
+void Actor::morphInto(AsylumEngine *engine, int nextPlayer) {
WorldStats *world = engine->scene()->worldstats();
if (world->chapter != kChapter9)
return;
@@ -2066,7 +2066,7 @@ void Actor::updatePlayerChapter9(AsylumEngine *engine, int nextPlayer) {
break;
}
- player->updateStatus(kActorStatusMorphingInto);
+ player->changeStatus(kActorStatusMorphingInto);
}
//////////////////////////////////////////////////////////////////////////
@@ -2079,9 +2079,9 @@ void Actor::updateStatusInteracting() {
++_frameIndex;
} else {
if (_status == kActorStatusInteracting)
- updateStatus(kActorStatusPickupItem);
+ changeStatus(kActorStatusPickupItem);
else
- updateStatus(kActorStatus20);
+ changeStatus(kActorStatus20);
}
} else {
if (_index == getSharedData()->getPlayerIndex())
@@ -2125,8 +2125,8 @@ void Actor::updateStatusEnabled() {
if (strcmp((char *)&_name, "Crow") && strcmp((char *)_name, "Armed Max")) {
if (_vm->getRandom(100) < 50
&& (!getSpeech()->getSoundResourceId() || !getSound()->isPlaying(getSpeech()->getSoundResourceId()))
- && isDefaultDirection(10))
- updateStatus(kActorStatusFidget);
+ && canChangeStatus(10))
+ changeStatus(kActorStatusFidget);
_lastScreenUpdate = _vm->screenUpdateCount;
}
@@ -2163,22 +2163,22 @@ void Actor::updateStatusEnabled() {
case 0:
setPosition(10, 1350, kDirectionN, 0);
- processStatus(1460, -100, false);
+ forceTo(1460, -100, false);
break;
case 1:
setPosition(300, 0, kDirectionN, 0);
- processStatus(1700, 1400, false);
+ forceTo(1700, 1400, false);
break;
case 2:
setPosition(1560, -100, kDirectionN, 0);
- processStatus(-300, 1470, false);
+ forceTo(-300, 1470, false);
break;
case 3:
setPosition(1150, 1400, kDirectionN, 0);
- processStatus(-250, 0, false);
+ forceTo(-250, 0, false);
break;
}
}
@@ -2190,7 +2190,7 @@ void Actor::updateStatusEnabled() {
if (getWorld()->chapter != kChapter2 || _index != 8) {
if (_field_944 == 4) {
Common::Rect frameRect = GraphicResource::getFrameRect(_vm, getWorld()->backgroundImage, 0);
- processStatus((int16)rnd(frameRect.width() + 200) - 100, (int16)rnd(frameRect.height() + 200) - 100, false);
+ forceTo((int16)rnd(frameRect.width() + 200) - 100, (int16)rnd(frameRect.height() + 200) - 100, false);
} else {
// Actor: Crow
if (rnd(1000) < 5 || !strcmp(_name, "Crow")) {
@@ -2209,9 +2209,9 @@ void Actor::updateStatusEnabled() {
if (!getSharedData()->getFlag(kFlagActorUpdateEnabledCheck)) {
if (!isInActionArea(pt, area)) {
Common::Point polyPoint = poly.points[rnd(poly.count())];
- processStatus(polyPoint.x, polyPoint.y, false);
+ forceTo(polyPoint.x, polyPoint.y, false);
} else {
- processStatus(pt.x, pt.y, false);
+ forceTo(pt.x, pt.y, false);
}
}
}
@@ -2256,12 +2256,12 @@ void Actor::updateStatusEnabledProcessStatus(int16 testX, int16 testY, uint32 co
if (xsum != testX || ysum != testY) {
if (rnd(1000) < 5)
- processStatus(testX, testY, false);
+ forceTo(testX, testY, false);
} else {
getSharedData()->setActorUpdateStatusEnabledCounter(counter);
if (rnd(1000) < 5)
- processStatus(setX, setY, false);
+ forceTo(setX, setY, false);
}
}
@@ -2270,7 +2270,7 @@ void Actor::updateStatusBored() {
&& getWorld()->chapter != kChapter9
&& getWorld()->actorType == 0
&& _frameIndex == 0
- && isResourcePresent()) {
+ && checkBoredStatus()) {
if (!getSpeech()->getSoundResourceId() || !getSound()->isPlaying(getSpeech()->getSoundResourceId()))
getSpeech()->playPlayer(13);
}
@@ -2288,7 +2288,7 @@ void Actor::CrowClosesIn() {
if (_frameIndex >= _frameCount)
frameIndex = 2 * _frameCount - (_frameIndex + 1);
- uint32 distance = (uint32)abs((double)getDistanceForFrame(_direction, frameIndex));
+ uint32 distance = (uint32)abs((double)getWalkIncrement(_direction, frameIndex));
// Face actor
faceTarget((uint32)getSharedData()->getPlayerIndex(), kDirectionFromActor);
@@ -2322,7 +2322,7 @@ void Actor::CrowClosesIn() {
getSharedData()->crowsData[2 * _index + 30] = player->getPoint1()->x - _point1.x;
getSharedData()->crowsData[2 * _index + 31] = player->getPoint1()->y - _point1.y;
- updateStatus(kActorStatus18);
+ changeStatus(kActorStatus18);
}
}
@@ -2337,11 +2337,11 @@ void Actor::ScareCrowClosesIn() {
if (_frameIndex >= _frameCount)
frameIndex = 2 * _frameCount - (_frameIndex + 1);
- uint32 distance = (uint32)abs((double)getDistanceForFrame(_direction, frameIndex));
+ uint32 distance = (uint32)abs((double)getWalkIncrement(_direction, frameIndex));
// Update status
if (player->getStatus() == kActorStatusRestarting || !getScene()->getActor(10)->isVisible()) {
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
getSharedData()->crowsData[_index - 11] = 160;
}
@@ -2358,7 +2358,7 @@ void Actor::ScareCrowClosesIn() {
|| getScene()->findActionArea(kActionAreaType1, point2) == -1) {
processEnd = false;
- if (compareAngles(sum, sumPlayer) == false) {
+ if (determineLeftOrRight(sum, sumPlayer) == false) {
if (canMove(&sum, DIR(_direction + 1), distance, false)) {
move(DIR(_direction + 1), distance);
} else if (canMove(&sum, DIR(_direction + 2), distance, false)) {
@@ -2396,7 +2396,7 @@ void Actor::ScareCrowClosesIn() {
if (sqrt((double)((sum.y - sumPlayer.y) * (sum.y - sumPlayer.y) + (sum.x - sumPlayer.x) * (sum.x - sumPlayer.x))) < 80.0) {
_frameIndex = 0;
faceTarget((uint32)getSharedData()->getPlayerIndex(), kDirectionFromActor);
- updateStatus(kActorStatusAttacking);
+ changeStatus(kActorStatusAttacking);
}
}
}
@@ -2410,7 +2410,7 @@ void Actor::TentacleRises() {
if (_frameIndex >= _frameCount) {
_frameIndex = 0;
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
getWorld()->tickValueArray[_index] = rnd(4000) + _vm->getTick();
}
@@ -2438,7 +2438,7 @@ void Actor::updateStatusEnabled2() {
case kChapter2:
if (_index == 11)
- updateStatus(kActorStatusWalking2);
+ changeStatus(kActorStatusWalking2);
else if (_index > 12)
CrowStatusQuo();
break;
@@ -2454,17 +2454,17 @@ void Actor::CrowStatusQuo() {
if (getSharedData()->crowsData[_index + 61])
CrowHoveringBeforeKill();
else
- updateStatus(kActorStatusWalking2);
+ changeStatus(kActorStatusWalking2);
}
void Actor::CrowHoveringBeforeKill() {
- // Original calls getDistanceForFrame but does not seem to do anything with the results
+ // Original calls getWalkIncrement but does not seem to do anything with the results
Actor *player = getScene()->getActor();
ActorStatus playerStatus = player->getStatus();
if (playerStatus == kActorStatusRestarting || !getScene()->getActor(10)->isVisible()) {
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
getSharedData()->crowsData[_index - 11] = 160;
}
@@ -2478,7 +2478,7 @@ void Actor::CrowHoveringBeforeKill() {
if (getSharedData()->crowsData[_index + 29] <= 1 || playerStatus == kActorStatusGettingHurt || playerStatus == kActorStatusRestarting) {
getSharedData()->crowsData[_index + 29]++;
} else {
- updateStatus(kActorStatusAttacking);
+ changeStatus(kActorStatusAttacking);
_point1.y -= 54;
getSharedData()->crowsData[_index + 29] = 0;
getSharedData()->crowsData[_index - 2] += 54;
@@ -2499,7 +2499,7 @@ void Actor::CrowHoveringBeforeKill() {
if (getSharedData()->crowsData[_index + 17] > 108) {
getSharedData()->crowsData[_index + 29] = 0;
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
switch (_index) {
default:
@@ -2507,35 +2507,35 @@ void Actor::CrowHoveringBeforeKill() {
break;
case 13:
- processStatus(2300, 671, false);
+ forceTo(2300, 671, false);
break;
case 14:
- processStatus(2600, 1300, false);
+ forceTo(2600, 1300, false);
break;
case 15:
- processStatus(2742, 615, false);
+ forceTo(2742, 615, false);
break;
case 16:
- processStatus(2700, 1400, false);
+ forceTo(2700, 1400, false);
break;
case 17:
- processStatus(2751, 347, false);
+ forceTo(2751, 347, false);
break;
case 18:
- processStatus(2420, 284, false);
+ forceTo(2420, 284, false);
break;
case 19:
- processStatus(2800, 370, false);
+ forceTo(2800, 370, false);
break;
case 20:
- processStatus(1973, 1, false);
+ forceTo(1973, 1, false);
break;
}
}
@@ -2562,7 +2562,7 @@ void Actor::TentacleWigglesForSarah() {
getWorld()->tickValueArray[_index] = rnd(1000) + 2000 + _vm->getTick();
} else {
if (actor0->getStatus() == kActorStatusWalking2 || actor0->getStatus() == kActorStatusEnabled2 || actor0->getStatus() == kActorStatusAttacking)
- updateStatus(kActorStatusAttacking);
+ changeStatus(kActorStatusAttacking);
getWorld()->tickValueArray[_index] = -666;
}
@@ -2576,7 +2576,7 @@ void Actor::CrowDives() {
Common::Point sumPlayer = *player->getPoint1() + *player->getPoint2();
if (getScene()->getActor(10)->getStatus() == kActorStatusRestarting || !getScene()->getActor(10)->isVisible()) {
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
getSharedData()->crowsData[_index - 11] = 160;
}
@@ -2584,7 +2584,7 @@ void Actor::CrowDives() {
getSound()->playSound(getWorld()->soundResourceIds[1], false, Config.sfxVolume - 10);
if (player->getStatus() == kActorStatusRestarting && _frameIndex < 6)
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
uint32 dist = euclidianDistance(sumPlayer, sum);
int16 offset = (dist <= 10) ? 7 : 12;
@@ -2614,8 +2614,8 @@ void Actor::CrowDives() {
getSpeech()->playPlayer(51);
_vm->setGameFlag(kGameFlag219);
- player->updateFromDirection(DIR(_direction + 4));
- player->updateStatus(kActorStatusGettingHurt);
+ player->changeDirection(DIR(_direction + 4));
+ player->changeStatus(kActorStatusGettingHurt);
getSharedData()->crowsData[_index + 61] = 0;
}
@@ -2644,9 +2644,9 @@ void Actor::CrowDives() {
_frameIndex = 0;
if (getSharedData()->getChapter2Counter(6) <= 2)
- processStatus(sum.x, sum.y, false);
+ forceTo(sum.x, sum.y, false);
else
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
getSharedData()->crowsData[_index + 61] = 0;
}
@@ -2800,7 +2800,7 @@ void Actor::MaxAttacks() {
break;
}
- otherActor->updateStatus(kActorStatusRestarting);
+ otherActor->changeStatus(kActorStatusRestarting);
getSound()->playSound(getWorld()->soundResourceIds[2], false, Config.sfxVolume - 10);
}
}
@@ -2811,7 +2811,7 @@ void Actor::MaxAttacks() {
if (_frameIndex >= _frameCount) {
_frameIndex = 0;
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
}
}
@@ -2836,7 +2836,7 @@ void Actor::checkScareCrowDeath() {
} else if (getSharedData()->getChapter2Counter(5) <= 6) {
getSound()->playSound(getWorld()->soundResourceIds[9], false, Config.sfxVolume - 10);
} else {
- getScene()->getActor(11)->updateStatus(kActorStatusRestarting);
+ getScene()->getActor(11)->changeStatus(kActorStatusRestarting);
getSound()->playSound(getWorld()->soundResourceIds[10], false, Config.sfxVolume - 10);
}
}
@@ -2879,8 +2879,8 @@ void Actor::ScareCrowAttacks() {
_frameIndex += getSharedData()->getChapter2FrameIndexOffset();
Common::Point actionPoint = sum;
- actionPoint.x += compareX(Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.bottom), sumPlayer);
- actionPoint.y += compareY(Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.bottom), sumPlayer);
+ actionPoint.x += pointInRectXAdjust(rect, sumPlayer);
+ actionPoint.y += pointInRectYAdjust(rect, sumPlayer);
if (getScene()->getActor(11)->getFrameIndex() < 8
&& getScene()->findActionArea(kActionAreaType2, actionPoint) != -1
@@ -2892,14 +2892,14 @@ void Actor::ScareCrowAttacks() {
_frameIndex = 0;
if (!getSharedData()->getFlag(kFlagActorUpdateStatus15Check)) {
- updateStatus(kActorStatusWalking2);
+ changeStatus(kActorStatusWalking2);
} else {
getSharedData()->setFlag(kFlagActorUpdateStatus15Check, false);
- getScene()->getActor(11)->updateStatus(kActorStatus18);
+ getScene()->getActor(11)->changeStatus(kActorStatus18);
}
}
} else {
- if (compare(Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.bottom), sumPlayer)) {
+ if (rect.contains(sumPlayer)) {
_vm->clearGameFlag(kGameFlag263);
_vm->clearGameFlag(kGameFlag264);
@@ -2909,8 +2909,8 @@ void Actor::ScareCrowAttacks() {
_vm->clearGameFlag(kGameFlag268);
_vm->clearGameFlag(kGameFlag269);
- player->update_409230();
- player->updateStatus(kActorStatusGettingHurt);
+ player->stopWalking();
+ player->changeStatus(kActorStatusGettingHurt);
MaxGetsHit();
getSpeech()->playPlayer(52);
@@ -2961,12 +2961,12 @@ void Actor::TentacleWhips() {
++_frameIndex;
if (_frameIndex >= _frameCount)
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
if (_frameIndex == 14) {
if (Actor::euclidianDistance(getSharedData()->vector1, getSharedData()->vector2) < 75) {
- actor0->updateStatus(kActorStatusGettingHurt);
+ actor0->changeStatus(kActorStatusGettingHurt);
++getWorld()->field_E848C;
getSound()->stop(getWorld()->soundResourceIds[3]);
@@ -3022,7 +3022,7 @@ void Actor::SarahAttacks() {
break;
}
- actor2->updateStatus(kActorStatusRestarting);
+ actor2->changeStatus(kActorStatusRestarting);
}
}
}
@@ -3031,7 +3031,7 @@ void Actor::SarahAttacks() {
getCursor()->show();
getSharedData()->setFlag(kFlag1, false);
_frameIndex = 0;
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
}
}
@@ -3043,7 +3043,7 @@ void Actor::MaxGetsSome() {
if (player->getFrameIndex() > (player->getFrameCount() - 1)) {
if (getSharedData()->getChapter2Counter(6) <= 2) {
player->setFrameIndex(0);
- player->updateStatus(kActorStatusEnabled2);
+ player->changeStatus(kActorStatusEnabled2);
} else {
_vm->clearGameFlag(kGameFlag438);
_vm->clearGameFlag(kGameFlag439);
@@ -3056,7 +3056,7 @@ void Actor::MaxGetsSome() {
_vm->setGameFlag(kGameFlag219);
player->setFrameIndex(0);
- player->updateStatus(kActorStatusRestarting);
+ player->changeStatus(kActorStatusRestarting);
_vm->clearGameFlag(kGameFlag369);
_vm->clearGameFlag(kGameFlag370);
@@ -3090,10 +3090,10 @@ void Actor::SarahGetsSome() {
if (getWorld()->field_E848C >= 3) {
_frameIndex = 0;
- getScene()->getActor(0)->updateStatus(kActorStatusRestarting);
+ getScene()->getActor(0)->changeStatus(kActorStatusRestarting);
getScene()->getActor(1)->setTickCount(_vm->getTick() + 2000);
} else {
- getScene()->getActor(0)->updateStatus(kActorStatusEnabled2);
+ getScene()->getActor(0)->changeStatus(kActorStatusEnabled2);
}
}
}
@@ -3103,7 +3103,7 @@ void Actor::TentacleDies() {
if (_frameIndex >= _frameCount) {
_frameIndex = 0;
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
hide();
if (_vm->getRandomBit() == 1) {
@@ -3123,7 +3123,7 @@ void Actor::CrowSwoops() {
if (_frameIndex > _frameCount - 1) {
getSharedData()->crowsData[_index + 61] = 1;
- updateStatus(kActorStatusEnabled2);
+ changeStatus(kActorStatusEnabled2);
_point1.y += 54;
getSound()->playSound(getWorld()->soundResourceIds[1], false, Config.sfxVolume - 10);
@@ -3134,12 +3134,12 @@ void Actor::CrowSwoops() {
void Actor::ScareCrowRetreats() {
int32 frameIndex = (int32)_frameIndex;
- uint32 distance = (uint32)abs((double)getDistanceForFrame(_direction, (_frameIndex < _frameCount) ? _frameIndex : 2 * _frameCount - (_frameIndex + 1)));
+ uint32 distance = (uint32)abs((double)getWalkIncrement(_direction, (_frameIndex < _frameCount) ? _frameIndex : 2 * _frameCount - (_frameIndex + 1)));
getSharedData()->setChapter2Counter(7, getSharedData()->getChapter2Counter(7) + 1);
if (getSharedData()->getChapter2Counter(7) > 14) {
getSharedData()->setChapter2Counter(7, 0);
- updateStatus(kActorStatusWalking2);
+ changeStatus(kActorStatusWalking2);
}
faceTarget((uint32)getSharedData()->getPlayerIndex(), kDirectionFromActor);
@@ -3195,11 +3195,11 @@ void Actor::updateStatusMorphing() {
}
getScene()->changePlayer(getWorld()->nextPlayer);
- updateStatus(kActorStatusEnabled);
+ changeStatus(kActorStatusEnabled);
getWorld()->nextPlayer = kActorInvalid;
}
-void Actor::updateFinish() {
+void Actor::actionAreaCheck() {
if (_field_944 == 4 || !isVisible())
return;
@@ -3243,7 +3243,7 @@ void Actor::TentacleBlocksSarah(const Common::Point &vec1, Common::Point vec2) {
ActorDirection dir = (vec1.y > vec2.y) ? kDirectionS : kDirectionN;
if (canMove(&vec2, dir, diffY + 3, false))
- updateCoordinatesForDirection(dir, (int16)(diffY - 1), &_point1);
+ incPosition(dir, (int16)(diffY - 1), &_point1);
}
void Actor::SarahDies() {
@@ -3269,7 +3269,7 @@ void Actor::updateNumbers(uint item, const Common::Point &point) {
//////////////////////////////////////////////////////////////////////////
// Path finding functions
//////////////////////////////////////////////////////////////////////////
-bool Actor::processActionLeft(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
+bool Actor::findLeftPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
// Reset pathfinding data
_data.count = 0;
_data.current = 0;
@@ -3279,13 +3279,13 @@ bool Actor::processActionLeft(Common::Point source, const Common::Point &destina
for (uint32 i = 0; i < 60; i++) {
- // Note: this is handled differently from other processAction functions
+ // Note: this is handled differently from other tryDirection functions
// as we break instead of checking the other actors
- if (!processAction(source, actions, &src, kDirectionE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionN, destination, &flag)
- && !processAction(source, actions, &src, kDirectionS, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionN, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionS, destination, &flag))
break;
// Update source point after all processing
@@ -3298,7 +3298,7 @@ bool Actor::processActionLeft(Common::Point source, const Common::Point &destina
return false;
}
-bool Actor::processActionAll(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
+bool Actor::findRightPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
// Reset pathfinding data
_data.count = 0;
_data.current = 0;
@@ -3307,22 +3307,22 @@ bool Actor::processActionAll(Common::Point source, const Common::Point &destinat
Common::Point src = source;
for (uint32 i = 0; i < 60; i++) {
- if (!processAction(source, actions, &src, kDirectionW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSW, destination, &flag)) {
+ if (!tryDirection(source, actions, &src, kDirectionW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSW, destination, &flag)) {
if (src.y <= destination.y) {
- if (!processAction(source, actions, &src, kDirectionS, destination, &flag)
- && !processAction(source, actions, &src, kDirectionN, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNE, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionS, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionN, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNE, destination, &flag))
continue;
} else {
- if (!processAction(source, actions, &src, kDirectionN, destination, &flag)
- && !processAction(source, actions, &src, kDirectionS, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSE, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionN, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionS, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSE, destination, &flag))
continue;
}
}
@@ -3337,7 +3337,7 @@ bool Actor::processActionAll(Common::Point source, const Common::Point &destinat
return false;
}
-bool Actor::processActionTop(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
+bool Actor::findUpPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
// Reset pathfinding data
_data.count = 0;
_data.current = 0;
@@ -3346,18 +3346,18 @@ bool Actor::processActionTop(Common::Point source, const Common::Point &destinat
Common::Point src = source;
for (uint32 i = 0; i < 60; i++) {
- if (!processAction(source, actions, &src, kDirectionN, destination, &flag)) {
+ if (!tryDirection(source, actions, &src, kDirectionN, destination, &flag)) {
if (src.x >= destination.x) {
- if (!processAction(source, actions, &src, kDirectionNW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionE, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionNW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionE, destination, &flag))
continue;
} else {
- if (!processAction(source, actions, &src, kDirectionNE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionNW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionW, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionNE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionNW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionW, destination, &flag))
continue;
}
}
@@ -3372,7 +3372,7 @@ bool Actor::processActionTop(Common::Point source, const Common::Point &destinat
return false;
}
-bool Actor::processActionDown(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
+bool Actor::findDownPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions) {
// Reset pathfinding data
_data.count = 0;
_data.current = 0;
@@ -3381,11 +3381,11 @@ bool Actor::processActionDown(Common::Point source, const Common::Point &destina
Common::Point src = source;
for (uint32 i = 0; i < 60; i++) {
- if (!processAction(source, actions, &src, kDirectionS, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionSW, destination, &flag)
- && !processAction(source, actions, &src, kDirectionE, destination, &flag)
- && !processAction(source, actions, &src, kDirectionW, destination, &flag))
+ if (!tryDirection(source, actions, &src, kDirectionS, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionSW, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionE, destination, &flag)
+ && !tryDirection(source, actions, &src, kDirectionW, destination, &flag))
continue;
// Update source point after all processing
@@ -3398,7 +3398,7 @@ bool Actor::processActionDown(Common::Point source, const Common::Point &destina
return false;
}
-bool Actor::processAction(const Common::Point &source, Common::Array<int> *actions, Common::Point *point, ActorDirection direction, const Common::Point &destination, bool *flag) {
+bool Actor::tryDirection(const Common::Point &source, Common::Array<int> *actions, Common::Point *point, ActorDirection direction, const Common::Point &destination, bool *flag) {
Common::Point sign;
Common::Point src = source;
uint32 frameNumber = _frameNumber;
@@ -3445,18 +3445,18 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
}
for (int i = 0; i < 10; i++) {
- if (!checkAllActions(src, actions))
+ if (!testPolyInLink(src, actions))
break;
- int32 dist = getAbsoluteDistanceForFrame(direction, frameNumber);
+ int32 dist = getStride(direction, frameNumber);
src.x += (int16)(sign.x * dist);
src.y += (int16)(sign.y * dist);
- if (abs(src.x - destination.x) >= getAbsoluteDistanceForFrame(kDirectionW, frameNumber)) {
- if (abs(src.y - destination.y) < getAbsoluteDistanceForFrame(kDirectionN, frameNumber)) {
+ if (abs(src.x - destination.x) >= getStride(kDirectionW, frameNumber)) {
+ if (abs(src.y - destination.y) < getStride(kDirectionN, frameNumber)) {
if (src.x >= destination.x) {
- if (checkPath(actions, src, kDirectionW, src.x - destination.x)) {
+ if (canGetToDest(actions, src, kDirectionW, src.x - destination.x)) {
*flag = true;
*point = src;
@@ -3471,7 +3471,7 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
return true;
}
} else {
- if (checkPath(actions, src, kDirectionE, destination.x - src.x)) {
+ if (canGetToDest(actions, src, kDirectionE, destination.x - src.x)) {
*flag = true;
*point = src;
@@ -3489,7 +3489,7 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
}
} else {
if (src.y >= destination.y) {
- if (checkPath(actions, src, kDirectionN, src.y - destination.y)) {
+ if (canGetToDest(actions, src, kDirectionN, src.y - destination.y)) {
*flag = true;
*point = src;
@@ -3504,7 +3504,7 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
return true;
}
} else {
- if (checkPath(actions, src, kDirectionS, destination.y - src.y)) {
+ if (canGetToDest(actions, src, kDirectionS, destination.y - src.y)) {
*flag = true;
*point = src;
@@ -3529,7 +3529,7 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
}
// Check if we need to process
- int32 distance = getAbsoluteDistanceForFrame(direction, frameNumber);
+ int32 distance = getStride(direction, frameNumber);
if (source.x == (src.x - sign.x * distance) && source.y == (src.y - sign.y * distance))
return false;
@@ -3540,9 +3540,9 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
_frameNumber = frameNumber;
if (_frameNumber == 0)
- distance = getAbsoluteDistanceForFrame(direction, _frameCount - 1);
+ distance = getStride(direction, _frameCount - 1);
else
- distance = getAbsoluteDistanceForFrame(direction, _frameNumber - 1);
+ distance = getStride(direction, _frameNumber - 1);
src.x -= (int16)(sign.x * distance);
src.y -= (int16)(sign.y * distance);
@@ -3555,7 +3555,7 @@ bool Actor::processAction(const Common::Point &source, Common::Array<int> *actio
return true;
}
-bool Actor::checkPath(Common::Array<int> *actions, const Common::Point &point, ActorDirection direction, int16 loopcount) {
+bool Actor::canGetToDest(Common::Array<int> *actions, const Common::Point &point, ActorDirection direction, int16 loopcount) {
if (loopcount <= 1)
return true;
@@ -3565,7 +3565,7 @@ bool Actor::checkPath(Common::Array<int> *actions, const Common::Point &point, A
Common::Rect rect = getWorld()->sceneRects[getWorld()->sceneRectIdx];
for (int16 i = 1; i < loopcount; i++) {
- if (!checkAllActions(basePoint, actions))
+ if (!testPolyInLink(basePoint, actions))
return false;
if (!rect.contains(basePoint))
@@ -3577,7 +3577,7 @@ bool Actor::checkPath(Common::Array<int> *actions, const Common::Point &point, A
return true;
}
-bool Actor::checkAllActions(const Common::Point &pt, Common::Array<int> *actions) {
+bool Actor::testPolyInLink(const Common::Point &pt, Common::Array<int> *actions) {
if (actions->size() == 0)
return false;
@@ -3658,7 +3658,7 @@ void Actor::setVolume() {
// Helper methods
//////////////////////////////////////////////////////////////////////////
-ActorDirection Actor::directionFromAngle(const Common::Point &vec1, const Common::Point &vec2) {
+ActorDirection Actor::getAngle(const Common::Point &vec1, const Common::Point &vec2) {
int32 diffX = (vec2.x << 16) - (vec1.x << 16);
int32 diffY = (vec1.y << 16) - (vec2.y << 16);
int32 adjust = 0;
@@ -3756,7 +3756,7 @@ void Actor::updateGraphicData(uint32 offset) {
_frameIndex = 0;
}
-bool Actor::isDefaultDirection(int index) const {
+bool Actor::canChangeStatus(int index) const {
return _graphicResourceIds[index] != _graphicResourceIds[5];
}
@@ -3782,13 +3782,13 @@ DrawFlags Actor::getGraphicsFlags() {
return kDrawFlagMirrorLeftRight;
}
-int32 Actor::getAbsoluteDistanceForFrame(ActorDirection dir, uint32 frameIndex) const {
+int32 Actor::getStride(ActorDirection dir, uint32 frameIndex) const {
if (frameIndex >= ARRAYSIZE(_distancesNS))
- warning("[Actor::getAbsoluteDistanceForFrame] Invalid frame index (was: %d, max: %d)", _frameIndex, ARRAYSIZE(_distancesNS) - 1);
+ debugC(kDebugLevelMain, "[Actor::getStride] Invalid frame index (was: %d, max: %d)", _frameIndex, ARRAYSIZE(_distancesNS) - 1);
switch (dir) {
default:
- error("[Actor::getDistanceForFrame] Invalid direction");
+ error("[Actor::getStride] Invalid direction");
case kDirectionN:
case kDirectionS:
@@ -3807,13 +3807,13 @@ int32 Actor::getAbsoluteDistanceForFrame(ActorDirection dir, uint32 frameIndex)
}
}
-int32 Actor::getDistanceForFrame(ActorDirection dir, uint32 frameIndex) const {
+int32 Actor::getWalkIncrement(ActorDirection dir, uint32 frameIndex) const {
if (frameIndex >= ARRAYSIZE(_distancesNS))
- error("[Actor::getDistanceForFrame] Invalid frame index (was: %d, max: %d)", _frameIndex, ARRAYSIZE(_distancesNS) - 1);
+ error("[Actor::getWalkIncrement] Invalid frame index (was: %d, max: %d)", _frameIndex, ARRAYSIZE(_distancesNS) - 1);
switch (dir) {
default:
- error("[Actor::getDistanceForFrame] Invalid direction");
+ error("[Actor::getWalkIncrement] Invalid direction");
case kDirectionN:
return -_distancesNS[frameIndex];
@@ -3841,9 +3841,9 @@ int32 Actor::getDistanceForFrame(ActorDirection dir, uint32 frameIndex) const {
}
}
-void Actor::updateCoordinatesForDirection(ActorDirection direction, int16 delta, Common::Point *point) {
+void Actor::incPosition(ActorDirection direction, int16 delta, Common::Point *point) {
if (!point)
- error("[Actor::updateCoordinatesForDirection] Invalid point (NULL)!");
+ error("[Actor::incPosition] Invalid point (NULL)!");
switch (direction) {
default:
@@ -3887,11 +3887,11 @@ void Actor::updateCoordinatesForDirection(ActorDirection direction, int16 delta,
}
}
-uint32 Actor::euclidianDistance(const Common::Point &vec1, const Common::Point &vec2) {
- return (uint32)sqrt(pow((double)(vec2.y - vec1.y), 2) + pow((double)(vec2.x - vec1.x), 2));
+uint32 Actor::euclidianDistance(const Common::Point &point1, const Common::Point &point2) {
+ return (uint32)sqrt(pow((double)(point2.y - point1.y), 2) + pow((double)(point2.x - point1.x), 2));
}
-int32 Actor::angleFromVectors(const Common::Point &vec1, const Common::Point &vec2) {
+int32 Actor::getAngleOfVector(const Common::Point &vec1, const Common::Point &vec2) {
int32 result = (int32)(((long)(180 - acos((double)(vec2.y - vec1.y) / euclidianDistance(vec1, vec2)) * 180 / -M_PI)) % 360);
if (vec1.x < vec2.x)
@@ -3957,10 +3957,10 @@ void Actor::getCrowStrikeZone(Common::Rect *rect, ActorDirection direction, cons
rect->setHeight(40);
}
-bool Actor::compareAngles(const Common::Point &vec1, const Common::Point &vec2) {
+bool Actor::determineLeftOrRight(const Common::Point &vec1, const Common::Point &vec2) {
Common::Point vec3(2289, 171);
- int32 diff = angleFromVectors(vec1, vec3) - angleFromVectors(vec1, vec2);
+ int32 diff = getAngleOfVector(vec1, vec3) - getAngleOfVector(vec1, vec2);
if (diff < 0)
diff += 359;
@@ -3968,28 +3968,21 @@ bool Actor::compareAngles(const Common::Point &vec1, const Common::Point &vec2)
return (diff > 180);
}
-bool Actor::compare(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec) {
- if (vec.y >= vec1.y && vec.y <= vec2.y && vec.x >= vec1.x && vec.x <= vec2.x)
- return true;
-
- return false;
-}
-
-int16 Actor::compareX(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec) {
- if (vec.x > vec2.x)
+int16 Actor::pointInRectXAdjust(const Common::Rect &rect, const Common::Point &point) {
+ if (point.x > rect.right)
return 3;
- if (vec.x < vec1.x)
+ if (point.x < rect.left)
return -3;
else
return 0;
}
-int16 Actor::compareY(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec) {
- if (vec.y > vec2.y)
+int16 Actor::pointInRectYAdjust(const Common::Rect &rect, const Common::Point &point) {
+ if (point.y > rect.bottom)
return 3;
- if (vec.y < vec1.y)
+ if (point.y < rect.top)
return -3;
else
return 0;
diff --git a/engines/asylum/resources/actor.h b/engines/asylum/resources/actor.h
index fd49de7151..8c30792643 100644
--- a/engines/asylum/resources/actor.h
+++ b/engines/asylum/resources/actor.h
@@ -203,30 +203,30 @@ public:
/**
* Enables the actor
*/
- void enable() { updateStatus(kActorStatusEnabled); }
+ void enable() { changeStatus(kActorStatusEnabled); }
/**
- * Updates the actor status.
+ * Changes the actor status.
*
* @param status The status.
*/
- void updateStatus(ActorStatus status);
+ void changeStatus(ActorStatus status);
/////////////////////////////////////////////////////////////////////////
// Direction & position
/////////////////////////////////////////////////////////////////////////
/**
- * Updates the actor direction, using the values set by script
+ * Updates the actor's mirror image.
*/
- void updateDirection();
+ void updateReflectionData();
/**
* Updates resource Id using the actor direction.
*
* @param direction The direction.
*/
- void updateFromDirection(ActorDirection direction);
+ void changeDirection(ActorDirection direction);
/**
* Face a target from a certain direction
@@ -247,13 +247,13 @@ public:
void setPosition(int16 newX, int16 newY, ActorDirection newDirection, uint32 frame);
/**
- * Query if the passed direction is default direction.
+ * Query if a graphic resource is present.
*
* @param index Zero-based index of the graphic resource.
*
- * @return true if default direction, false if not.
+ * @return true if the graphic resource is present.
*/
- bool isDefaultDirection(int index) const;
+ bool canChangeStatus(int index) const;
/**
* Adjust coordinates.
@@ -285,23 +285,22 @@ public:
*/
void clearFields();
- // Unknown methods
- bool process(const Common::Point &point);
- void processStatus(int16 actorX, int16 actorY, bool doSpeech);
- void processNext(ActorIndex nextActor, int32 actionAreaId, ActorDirection nextDirection, const Common::Point &nextPosition, bool invertPriority, const Common::Point &nextPositionOffset);
- bool canInteract(Common::Point *point, int32* param);
+ bool canReach(const Common::Point &point);
+ void forceTo(int16 actorX, int16 actorY, bool doSpeech);
+ void setupReflectionData(ActorIndex nextActor, int32 actionAreaId, ActorDirection nextDirection, const Common::Point &nextPosition, bool invertPriority, const Common::Point &nextPositionOffset);
+ bool aNicePlaceToTalk(Common::Point *point, int32* param);
bool canMove(Common::Point *point, ActorDirection direction, uint32 count, bool hasDelta);
void move(ActorDirection dir, uint32 distance);
- bool canMoveCheckActors(Common::Point *point, ActorDirection direction);
+ bool testActorCollision(Common::Point *point, ActorDirection direction);
void drawInventory();
- void update_409230();
+ void stopWalking();
/**
* Query if the object resource is present in the resource table between indices 10 & 20
*
* @return true if resource present between 15 & 20, false if not.
*/
- bool isResourcePresent() const;
+ bool checkBoredStatus() const;
//////////////////////////////////////////////////////////////////////////
// Static update methods
@@ -314,27 +313,27 @@ public:
* @param [in,out] engine If non-null, the engine.
* @param nextPlayer The next player index
*/
- static void updatePlayerChapter9(AsylumEngine *engine, int nextPlayer);
+ static void morphInto(AsylumEngine *engine, int nextPlayer);
/**
- * Gets a direction using the angle between the two points.
+ * Gets a direction using the angle between the two vectors.
*
* @param vec1 The first vector.
* @param vec2 The second vector.
*
* @return The direction
*/
- static ActorDirection directionFromAngle(const Common::Point &vec1, const Common::Point &vec2);
+ static ActorDirection getAngle(const Common::Point &vec1, const Common::Point &vec2);
/**
- * Get the euclidean distance between the two vectors
+ * Gets the euclidean distance between two points.
*
- * @param vec1 The first vector.
- * @param vec2 The second vector.
+ * @param point1 The first point.
+ * @param point2 The second point.
*
* @return the distance.
*/
- static uint32 euclidianDistance(const Common::Point &vec1, const Common::Point &vec2);
+ static uint32 euclidianDistance(const Common::Point &point1, const Common::Point &point2);
// Serializable
void saveLoadWithSerializer(Common::Serializer &s);
@@ -460,19 +459,19 @@ private:
void updateStatusMorphing();
- void updateFinish();
+ void actionAreaCheck();
//////////////////////////////////////////////////////////////////////////
// Path finding functions
//////////////////////////////////////////////////////////////////////////
uint32 _frameNumber;
- bool processActionLeft(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
- bool processActionAll(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
- bool processActionTop(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
- bool processActionDown(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
- bool processAction(const Common::Point &source, Common::Array<int> *actions, Common::Point *point, ActorDirection direction, const Common::Point &destination, bool *flag);
- bool checkPath(Common::Array<int> *actions, const Common::Point &point, ActorDirection direction, int16 loopcount);
- bool checkAllActions(const Common::Point &pt, Common::Array<int> *actions);
+ bool findLeftPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
+ bool findRightPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
+ bool findUpPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
+ bool findDownPath(Common::Point source, const Common::Point &destination, Common::Array<int> *actions);
+ bool tryDirection(const Common::Point &source, Common::Array<int> *actions, Common::Point *point, ActorDirection direction, const Common::Point &destination, bool *flag);
+ bool canGetToDest(Common::Array<int> *actions, const Common::Point &point, ActorDirection direction, int16 loopcount);
+ bool testPolyInLink(const Common::Point &pt, Common::Array<int> *actions);
//////////////////////////////////////////////////////////////////////////
// Misc
@@ -530,24 +529,24 @@ private:
DrawFlags getGraphicsFlags();
/**
- * Gets the absolute distance for a frame.
+ * Gets the absolute value of the walk increment for a frame.
*
* @param direction The direction.
* @param frameIndex Zero-based index of the frame.
*
- * @return The distance for the frame.
+ * @return The absolute value of the walk increment.
*/
- int32 getAbsoluteDistanceForFrame(ActorDirection direction, uint32 frameIndex) const;
+ int32 getStride(ActorDirection direction, uint32 frameIndex) const;
- /**
- * Gets the distance for a frame.
+ /**
+ * Gets the walk increment for a frame.
*
* @param direction The direction.
* @param frameIndex Zero-based index of the frame.
*
- * @return The distance for the frame.
+ * @return The walk increment.
*/
- int32 getDistanceForFrame(ActorDirection direction, uint32 frameIndex) const;
+ int32 getWalkIncrement(ActorDirection direction, uint32 frameIndex) const;
/**
* Updates the coordinates depending on the direction.
@@ -556,7 +555,7 @@ private:
* @param delta The delta.
* @param [in,out] point If non-null, the point.
*/
- static void updateCoordinatesForDirection(ActorDirection direction, int16 delta, Common::Point *point);
+ static void incPosition(ActorDirection direction, int16 delta, Common::Point *point);
/**
* Get the angle between the two vectors
@@ -566,59 +565,46 @@ private:
*
* @return the angle
*/
- static int32 angleFromVectors(const Common::Point &vec1, const Common::Point &vec2);
+ static int32 getAngleOfVector(const Common::Point &vec1, const Common::Point &vec2);
/**
- * Create a new rect using the point, depending on the actor direction
+ * Computes the Scare Crow's strike zone.
*
- * @param rect The rectangle.
+ * @param rect The strike zone.
* @param direction The direction.
* @param point The point.
*/
static void getCrowStrikeZone(Common::Rect *rect, ActorDirection direction, const Common::Point &point);
/**
- * Compares the angle between two vectors
- *
- * @param vec1 The first vector.
- * @param vec2 The second vector.
- *
- * @return true if ...
- */
- static bool compareAngles(const Common::Point &vec1, const Common::Point &vec2);
-
- /**
- * Compares vector vec to two other vectors.
+ * Determines the direction of the shortest rotation between two vectors.
*
* @param vec1 The first vector.
* @param vec2 The second vector.
- * @param vec The vector to check
*
- * @return true if vec is between vec1 and vec2.
+ * @return true if CCW, false if CW.
*/
- static bool compare(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec);
+ static bool determineLeftOrRight(const Common::Point &vec1, const Common::Point &vec2);
/**
- * Compare vectors
+ * Gets the adjustment for the X-coordinate of the supplied point.
*
- * @param vec1 The first vector.
- * @param vec2 The second vector.
- * @param vec The vector.
+ * @param rect The rectangle.
+ * @param point The test point.
*
- * @return value depending on whether vec.x is superior or inferior to each vector x coordinate
+ * @return value depending on the horizontal position of the point relative to the rectangle.
*/
- static int16 compareX(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec);
+ static int16 pointInRectXAdjust(const Common::Rect &rect, const Common::Point &point);
/**
- * Compare vectors
+ * Gets the adjustment for the Y-coordinate of the supplied point.
*
- * @param vec1 The first vector.
- * @param vec2 The second vector.
- * @param vec The vector.
+ * @param rect The rectangle.
+ * @param point The test point.
*
- * @return value depending on whether vec.y is superior or inferior to each vector y coordinate
+ * @return value depending on the vertical position of the point relative to the rectangle.
*/
- static int16 compareY(const Common::Point &vec1, const Common::Point &vec2, const Common::Point &vec);
+ static int16 pointInRectYAdjust(const Common::Rect &rect, const Common::Point &point);
}; // end of class MainActor
diff --git a/engines/asylum/resources/encounters.cpp b/engines/asylum/resources/encounters.cpp
index 627d2fe9c9..bd84a893a1 100644
--- a/engines/asylum/resources/encounters.cpp
+++ b/engines/asylum/resources/encounters.cpp
@@ -276,7 +276,7 @@ void Encounter::run(int32 encounterIndex, ObjectId objectId1, ObjectId objectId2
_wasPlayerDisabled = true;
} else {
_wasPlayerDisabled = false;
- player->updateStatus(kActorStatusDisabled);
+ player->changeStatus(kActorStatusDisabled);
}
_shouldEnablePlayer = false;
@@ -307,7 +307,7 @@ void Encounter::exitEncounter() {
_shouldEnablePlayer = true;
if (getSharedData()->getFlag(kFlagEncounterDisablePlayerOnExit))
- getScene()->getActor()->updateStatus(kActorStatusDisabled);
+ getScene()->getActor()->changeStatus(kActorStatusDisabled);
getSharedData()->setFlag(kFlagEncounterDisablePlayerOnExit, false);
@@ -1242,8 +1242,8 @@ void Encounter::setupEntities(bool type4) {
if (_actorIndex) {
Actor *actor = getScene()->getActor(_actorIndex);
- if (actor->isDefaultDirection(20))
- actor->updateStatus(type4 ? kActorStatusDisabled : kActorStatus8);
+ if (actor->canChangeStatus(20))
+ actor->changeStatus(type4 ? kActorStatusDisabled : kActorStatus8);
return;
}
diff --git a/engines/asylum/resources/script.cpp b/engines/asylum/resources/script.cpp
index 12a09fab41..34f90c7f3f 100644
--- a/engines/asylum/resources/script.cpp
+++ b/engines/asylum/resources/script.cpp
@@ -205,7 +205,7 @@ ScriptManager::ScriptManager(AsylumEngine *engine) : _vm(engine) {
ADD_OPCODE(ClearActorFields);
ADD_OPCODE(SetObjectLastFrameIndex);
ADD_OPCODE(SetActionAreaFlags);
- ADD_OPCODE(UpdatePlayerChapter9);
+ ADD_OPCODE(MorphActor);
ADD_OPCODE(ShowMenu);
ADD_OPCODE(UpdateGlobalFlags);
@@ -600,7 +600,7 @@ IMPLEMENT_OPCODE(HideActor)
Actor *actor = getScene()->getActor(cmd->param1);
actor->hide();
- actor->updateDirection();
+ actor->updateReflectionData();
END_OPCODE
//////////////////////////////////////////////////////////////////////////
@@ -609,7 +609,7 @@ IMPLEMENT_OPCODE(ShowActor)
Actor *actor = getScene()->getActor(cmd->param1);
actor->show();
- actor->updateDirection();
+ actor->updateReflectionData();
actor->setLastScreenUpdate(_vm->getTick());
END_OPCODE
@@ -632,7 +632,7 @@ END_OPCODE
IMPLEMENT_OPCODE(DisableActor)
Actor *actor = getScene()->getActor(cmd->param1);
- actor->updateStatus(kActorStatusDisabled);
+ actor->changeStatus(kActorStatusDisabled);
END_OPCODE
//////////////////////////////////////////////////////////////////////////
@@ -694,7 +694,7 @@ IMPLEMENT_OPCODE(JumpActorSpeech)
Actor *actor = getScene()->getActor(cmd->param1);
// Actor goes to position (param2, param3)
- if (actor->process(Common::Point((int16)cmd->param2, (int16)cmd->param3)))
+ if (actor->canReach(Common::Point((int16)cmd->param2, (int16)cmd->param3)))
return;
_currentQueueEntry->currentLine = cmd->param4;
@@ -712,11 +712,11 @@ IMPLEMENT_OPCODE(JumpAndSetDirection)
if (cmd->param5 != 2) {
if (cmd->param2 == -1 || cmd->param3 == -1) {
- actor->updateFromDirection((ActorDirection)cmd->param4);
+ actor->changeDirection((ActorDirection)cmd->param4);
} else if ((actor->getPoint1()->x + actor->getPoint2()->x) == cmd->param2 && (actor->getPoint1()->y + actor->getPoint2()->y) == cmd->param3) {
- actor->updateFromDirection((ActorDirection)cmd->param4);
+ actor->changeDirection((ActorDirection)cmd->param4);
} else {
- actor->processStatus((int16)cmd->param2, (int16)cmd->param3, (bool)cmd->param6);
+ actor->forceTo((int16)cmd->param2, (int16)cmd->param3, (bool)cmd->param6);
if (cmd->param5 == 1) {
cmd->param5 = 2;
@@ -728,7 +728,7 @@ IMPLEMENT_OPCODE(JumpAndSetDirection)
_processNextEntry = false;
if ((actor->getPoint1()->x + actor->getPoint2()->x) == cmd->param2 && (actor->getPoint1()->y + actor->getPoint2()->y) == cmd->param3)
- actor->updateFromDirection((ActorDirection)cmd->param4);
+ actor->changeDirection((ActorDirection)cmd->param4);
}
} else {
if (cmd->param5 == 2)
@@ -935,7 +935,7 @@ END_OPCODE
// Opcode 0x2B
IMPLEMENT_OPCODE(ChangeScene)
uint32 tick = _vm->getTick();
- getScene()->getActor(0)->updateStatus(kActorStatusDisabled);
+ getScene()->getActor(0)->changeStatus(kActorStatusDisabled);
resetQueue();
// Fade screen to black
@@ -985,7 +985,7 @@ IMPLEMENT_OPCODE(UpdateActor)
break;
case kActorStatus20:
- actor->updateStatus(kActorStatusEnabled2);
+ actor->changeStatus(kActorStatusEnabled2);
}
cmd->param3 = 0;
@@ -1013,7 +1013,7 @@ IMPLEMENT_OPCODE(UpdateActor)
actor->setFrameCount(GraphicResource::getFrameCount(_vm, id));
actor->setFrameIndex(0);
actor->setDirection(direction);
- actor->updateStatus(actor->getStatus() <= kActorStatus11 ? kActorStatusInteracting : kActorStatusHittingPumpkin);
+ actor->changeStatus(actor->getStatus() <= kActorStatus11 ? kActorStatusInteracting : kActorStatusHittingPumpkin);
cmd->param3 = 2;
_processNextEntry = true;
@@ -1497,7 +1497,7 @@ IMPLEMENT_OPCODE(PlaySoundUpdateObject)
getSpeech()->play(MAKE_RESOURCE(kResourcePackSpeech, 515 + cmd->param1), MAKE_RESOURCE(kResourcePackText, 1290 + cmd->param1));
if (cmd->param2) {
- getScene()->getActor(cmd->param5)->updateStatus(kActorStatus8);
+ getScene()->getActor(cmd->param5)->changeStatus(kActorStatus8);
cmd->param6 = 1;
_processNextEntry = true;
} else {
@@ -1735,7 +1735,7 @@ IMPLEMENT_OPCODE(Interact)
if ((player->getPoint1()->x + player->getPoint2()->x == cmd->param6)
&& (player->getPoint1()->y + player->getPoint2()->y == cmd->param7)) {
player->faceTarget((uint32)cmd->param1, kDirectionFromActor);
- actor->updateFromDirection((ActorDirection)((player->getDirection() + 4) & 7));
+ actor->changeDirection((ActorDirection)((player->getDirection() + 4) & 7));
} else {
_currentQueueEntry->currentLine = cmd->param3;
}
@@ -1745,8 +1745,8 @@ IMPLEMENT_OPCODE(Interact)
if (actor->getStatus() == kActorStatusWalkingTo || actor->getStatus() == kActorStatusWalkingTo2)
return;
- if (actor->canInteract(&point, &cmd->param4)) {
- player->processStatus(point.x, point.y, (bool)cmd->param4);
+ if (actor->aNicePlaceToTalk(&point, &cmd->param4)) {
+ player->forceTo(point.x, point.y, (bool)cmd->param4);
cmd->param6 = point.x;
cmd->param7 = point.y;
@@ -1837,7 +1837,7 @@ END_OPCODE
IMPLEMENT_OPCODE(ProcessActor)
Actor *actor = getScene()->getActor(cmd->param1);
- actor->processNext(cmd->param2, cmd->param3, (ActorDirection)cmd->param4, Common::Point((int16)cmd->param5, (int16)cmd->param6), (bool)cmd->param7, Common::Point((int16)cmd->param8, (int16)cmd->param9));
+ actor->setupReflectionData(cmd->param2, cmd->param3, (ActorDirection)cmd->param4, Common::Point((int16)cmd->param5, (int16)cmd->param6), (bool)cmd->param7, Common::Point((int16)cmd->param8, (int16)cmd->param9));
END_OPCODE
//////////////////////////////////////////////////////////////////////////
@@ -1875,7 +1875,7 @@ END_OPCODE
//////////////////////////////////////////////////////////////////////////
// Opcode 0x61
-IMPLEMENT_OPCODE(UpdatePlayerChapter9)
+IMPLEMENT_OPCODE(MorphActor)
if (cmd->param2) {
if (getWorld()->nextPlayer == kActorInvalid) {
_processNextEntry = false;
@@ -1884,7 +1884,7 @@ IMPLEMENT_OPCODE(UpdatePlayerChapter9)
_processNextEntry = true;
}
} else {
- Actor::updatePlayerChapter9(_vm, cmd->param1);
+ Actor::morphInto(_vm, cmd->param1);
cmd->param2 = 1;
_processNextEntry = true;
}
diff --git a/engines/asylum/resources/script.h b/engines/asylum/resources/script.h
index 4112d65fe7..36fb607628 100644
--- a/engines/asylum/resources/script.h
+++ b/engines/asylum/resources/script.h
@@ -445,7 +445,7 @@ private:
DECLARE_OPCODE(ClearActorFields);
DECLARE_OPCODE(SetObjectLastFrameIndex);
DECLARE_OPCODE(SetActionAreaFlags);
- DECLARE_OPCODE(UpdatePlayerChapter9);
+ DECLARE_OPCODE(MorphActor);
DECLARE_OPCODE(ShowMenu);
DECLARE_OPCODE(UpdateGlobalFlags);
diff --git a/engines/asylum/resources/special.cpp b/engines/asylum/resources/special.cpp
index 1728b16ee7..13feaf8a3a 100644
--- a/engines/asylum/resources/special.cpp
+++ b/engines/asylum/resources/special.cpp
@@ -235,7 +235,7 @@ void Special::chapter2(Object *object, ActorIndex actorIndex) {
}
for (int i = 13; i < 22; i++)
- getScene()->getActor(i)->updateStatus(kActorStatusAttacking);
+ getScene()->getActor(i)->changeStatus(kActorStatusAttacking);
}
// Play chapter sound
@@ -257,13 +257,13 @@ void Special::chapter2(Object *object, ActorIndex actorIndex) {
if (counter >= 5) {
counter = 0;
- actor->updateFromDirection((ActorDirection)((actor->getDirection() + 1) & 7));
+ actor->changeDirection((ActorDirection)((actor->getDirection() + 1) & 7));
}
getSharedData()->setChapter2Counter(getCounter(actorIndex), counter);
} else if (actor->getStatus() == kActorStatusEnabled) {
- actor->updateStatus(kActorStatusWalking);
+ actor->changeStatus(kActorStatusWalking);
}
break;
@@ -482,7 +482,7 @@ void Special::chapter7(Object *object, ActorIndex actorIndex) {
player->enable();
} else {
getSound()->playSound(MAKE_RESOURCE(kResourcePackSound, 5));
- player->updateStatus(kActorStatusShowingInventory);
+ player->changeStatus(kActorStatusShowingInventory);
}
_vm->setGameFlag(kGameFlag1023);
@@ -755,7 +755,7 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
if (_vm->isGameFlagSet(kGameFlag561) && _vm->isGameFlagNotSet(kGameFlag562)) {
ActorStatus playerStatus = player->getStatus();
if (playerStatus != kActorStatusGettingHurt && playerStatus != kActorStatusRestarting && playerStatus != kActorStatusAttacking && playerStatus != kActorStatusWalkingTo2)
- actor0->updateStatus(kActorStatusAttacking);
+ actor0->changeStatus(kActorStatusAttacking);
_vm->clearGameFlag(kGameFlag561);
}
@@ -764,7 +764,7 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
actor1->show();
actor1->getPoint1()->x = actor0->getPoint2()->x + actor0->getPoint1()->x - actor1->getPoint2()->x;
actor1->getPoint1()->y = actor0->getPoint2()->y + actor0->getPoint1()->y - actor1->getPoint2()->y;
- actor1->updateStatus(kActorStatusWalking2);
+ actor1->changeStatus(kActorStatusWalking2);
}
tentacle(10, kGameFlag557, kGameFlag558, kGameFlag563, &actorRects[0]);
@@ -866,7 +866,7 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
if (getScene()->polygons()->get(getWorld()->actions[getWorld()->getActionAreaIndexById(1591)]->polygonIndex).contains(sum)) {
ActorStatus playerStatus = getScene()->getActor(getSharedData()->getPlayerIndex())->getStatus();
if (playerStatus == kActorStatusWalking2 || playerStatus == kActorStatusAttacking || playerStatus == kActorStatusEnabled2) {
- actor0->updateStatus(kActorStatusGettingHurt);
+ actor0->changeStatus(kActorStatusGettingHurt);
getSpeech()->playPlayer(131);
++getWorld()->field_E848C;
getSound()->stop(getWorld()->soundResourceIds[3]);
@@ -894,7 +894,7 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
if (getScene()->polygons()->get(getWorld()->actions[getWorld()->getActionAreaIndexById(1590)]->polygonIndex).contains(sum)) {
ActorStatus playerStatus = getScene()->getActor(getSharedData()->getPlayerIndex())->getStatus();
if (playerStatus == kActorStatusWalking2 || playerStatus == kActorStatusAttacking || playerStatus == kActorStatusEnabled2) {
- actor0->updateStatus(kActorStatusGettingHurt);
+ actor0->changeStatus(kActorStatusGettingHurt);
++getWorld()->field_E848C;
getSound()->stop(getWorld()->soundResourceIds[3]);
getSound()->stop(getWorld()->soundResourceIds[4]);
@@ -922,7 +922,7 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
if (getScene()->polygons()->get(getWorld()->actions[getWorld()->getActionAreaIndexById(1589)]->polygonIndex).contains(sum)) {
ActorStatus playerStatus = getScene()->getActor(getSharedData()->getPlayerIndex())->getStatus();
if (playerStatus == kActorStatusWalking2 || playerStatus == kActorStatusAttacking || playerStatus == kActorStatusEnabled2) {
- actor0->updateStatus(kActorStatusGettingHurt);
+ actor0->changeStatus(kActorStatusGettingHurt);
++getWorld()->field_E848C;
getSound()->stop(getWorld()->soundResourceIds[3]);
getSound()->stop(getWorld()->soundResourceIds[4]);
@@ -975,8 +975,8 @@ void Special::chapter11(Object *object, ActorIndex actorIndex) {
if (_vm->isGameFlagNotSet(kGameFlag560)) {
_vm->setGameFlag(kGameFlag560);
actor1->hide();
- actor1->updateStatus(kActorStatusEnabled);
- actor0->updateStatus(kActorStatusEnabled);
+ actor1->changeStatus(kActorStatusEnabled);
+ actor0->changeStatus(kActorStatusEnabled);
getWorld()->field_E848C = 0;
getScript()->queueScript(getWorld()->actions[getWorld()->getActionAreaIndexById(1574)]->scriptIndex, kActorSarah);
}
@@ -1405,14 +1405,14 @@ void Special::playSoundChapter3(Object *object, ActorIndex actorIndex) {
case 1:
if (actor->getStatus() == kActorStatusFidget
- && actor->isResourcePresent()
+ && actor->checkBoredStatus()
&& actor->getFrameIndex() == 0)
playSoundPanning(MAKE_RESOURCE(kResourcePackSharedSound, 1861), 22, actorIndex);
break;
case 2:
if (actor->getStatus() == kActorStatusFidget
- && actor->isResourcePresent()
+ && actor->checkBoredStatus()
&& actor->getFrameIndex() == 1)
playSoundPanning(MAKE_RESOURCE(kResourcePackSharedSound, 1892), 16, actorIndex);
break;
@@ -2020,7 +2020,7 @@ void Special::rock(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFl
getWorld()->field_E8594[actorIndex] = actor->getPoint1()->y;
actor->getPoint1()->y -= 160;
- actor->updateStatus(kActorStatusEnabled2);
+ actor->changeStatus(kActorStatusEnabled2);
getSound()->playSound(getWorld()->soundResourceIds[0], false, Config.sfxVolume - 10);
_vm->setGameFlag(flag3);
getScene()->getActor(actorIndex)->show();
@@ -2028,7 +2028,7 @@ void Special::rock(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFl
if (_vm->isGameFlagNotSet(flag4)) {
_vm->setGameFlag(flag4);
actor->setFrameIndex(0);
- actor->updateStatus(kActorStatusWalking2);
+ actor->changeStatus(kActorStatusWalking2);
if (actorIndex == 8 || actorIndex == 9)
actor->setField944(1);
actor->getPoint1()->y = 0;
@@ -2043,7 +2043,7 @@ void Special::rock(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFl
} else {
actor->setField944(3);
getSound()->playSound(getWorld()->soundResourceIds[1], false, Config.sfxVolume - 10);
- actor->updateStatus(kActorStatusAttacking);
+ actor->changeStatus(kActorStatusAttacking);
actor->setFrameIndex(4);
Common::Point sum = *actor->getPoint1() + *actor->getPoint2();
@@ -2053,7 +2053,7 @@ void Special::rock(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, GameFl
getSharedData()->vector2 = sum;
if (Actor::euclidianDistance(sum, playerSum) < 30) {
- getScene()->getActor(0)->updateStatus(kActorStatusGettingHurt);
+ getScene()->getActor(0)->changeStatus(kActorStatusGettingHurt);
++getWorld()->field_E848C;
getSound()->stop(getWorld()->soundResourceIds[3]);
getSound()->stop(getWorld()->soundResourceIds[4]);
@@ -2085,7 +2085,7 @@ void Special::tentacle(ActorIndex actorIndex, GameFlag flag1, GameFlag flag2, Ga
if (Actor::euclidianDistance(sum, playerSum) > 40) {
getWorld()->tickValueArray[actorIndex + 10] = 0;
actor->show();
- actor->updateStatus(kActorStatusWalking2);
+ actor->changeStatus(kActorStatusWalking2);
actor->setFrameIndex(0);
_vm->setGameFlag(flag2);
}
diff --git a/engines/asylum/shared.h b/engines/asylum/shared.h
index 220893bec9..e23798812d 100644
--- a/engines/asylum/shared.h
+++ b/engines/asylum/shared.h
@@ -438,7 +438,7 @@ enum OpcodeType {
kOpcodeClearActorFields,
kOpcodeSetObjectLastFrameIndex, // 95
kOpcodeSetActionAreaFlags,
- kOpcodeUpdatePlayerChapter9,
+ kOpcodeMorphActor,
kOpcodeShowMenu,
kOpcodeUpdateGlobalFlags
};
diff --git a/engines/asylum/views/menu.cpp b/engines/asylum/views/menu.cpp
index ae0273eda5..587f1e1a6c 100644
--- a/engines/asylum/views/menu.cpp
+++ b/engines/asylum/views/menu.cpp
@@ -372,7 +372,7 @@ bool Menu::init() {
}
if (_gameStarted)
- getScene()->getActor()->update_409230();
+ getScene()->getActor()->stopWalking();
getScreen()->clear();
getText()->loadFont(kFontYellow);
@@ -408,7 +408,7 @@ bool Menu::update() {
Common::Point cursor = getCursor()->position();
if (cursor.x < 230 || cursor.x > 399 || cursor.y < 199 || cursor.y > 259)
- frameIndex = eyeFrameIndex[Actor::directionFromAngle(Common::Point(320, 240), cursor)];
+ frameIndex = eyeFrameIndex[Actor::getAngle(Common::Point(320, 240), cursor)];
else if (cursor.x >= 743 && cursor.x <= 743 && cursor.y >= 587 && cursor.y <= 602)
frameIndex = 9;
}
diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index dd04479155..358faff611 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -336,10 +336,10 @@ void Scene::activate() {
Actor *player = getActor();
if (player->getStatus() == kActorStatusWalking)
- player->updateStatus(kActorStatusEnabled);
+ player->changeStatus(kActorStatusEnabled);
if (player->getStatus() == kActorStatusWalking2)
- player->updateStatus(kActorStatusEnabled2);
+ player->changeStatus(kActorStatusEnabled2);
}
bool Scene::init() {
@@ -378,7 +378,7 @@ bool Scene::update() {
getEncounter()->setShouldEnablePlayer(false);
// Enable player
- getActor()->updateStatus(kActorStatusEnabled);
+ getActor()->changeStatus(kActorStatusEnabled);
}
uint32 ticks = _vm->getTick();
@@ -517,19 +517,19 @@ bool Scene::clickDown(const AsylumEvent &evt) {
stopSpeech();
if (player->getStatus() == kActorStatusShowingInventory || player->getStatus() == kActorStatus10) {
- player->updateStatus(kActorStatusEnabled);
+ player->changeStatus(kActorStatusEnabled);
getSound()->playSound(MAKE_RESOURCE(kResourcePackSound, 5));
} else if (player->getStatus() != kActorStatusDisabled) {
- player->updateStatus(kActorStatusWalking);
+ player->changeStatus(kActorStatusWalking);
}
break;
case Common::EVENT_MBUTTONDOWN:
if (player->getStatus() != kActorStatusDisabled) {
if (player->getStatus() == kActorStatusShowingInventory || player->getStatus() == kActorStatus10)
- player->updateStatus(kActorStatusEnabled);
+ player->changeStatus(kActorStatusEnabled);
else
- player->updateStatus(kActorStatusShowingInventory);
+ player->changeStatus(kActorStatusShowingInventory);
}
break;
@@ -574,10 +574,10 @@ bool Scene::clickDown(const AsylumEvent &evt) {
if (player->getStatus() == kActorStatusShowingInventory || player->getStatus() == kActorStatus10) {
getSound()->playSound(MAKE_RESOURCE(kResourcePackSound, 5));
- player->updateStatus(kActorStatusEnabled);
+ player->changeStatus(kActorStatusEnabled);
} else {
getSound()->playSound(MAKE_RESOURCE(kResourcePackSound, 2));
- player->updateStatus(kActorStatusShowingInventory);
+ player->changeStatus(kActorStatusShowingInventory);
}
break;
}
@@ -792,7 +792,7 @@ void Scene::updateMouse() {
if (newDirection >= kDirectionN)
if (player->getStatus() == kActorStatusWalking || player->getStatus() == kActorStatusWalking2)
- player->updateFromDirection(newDirection);
+ player->changeDirection(newDirection);
}
@@ -1620,7 +1620,7 @@ void Scene::handleHit(int32 index, HitType type) {
if (getSound()->isPlaying(actor->getSoundResourceId())) {
if (actor->getStatus() != kActorStatusEnabled)
- actor->updateStatus(kActorStatusEnabled);
+ actor->changeStatus(kActorStatusEnabled);
getSound()->stop(actor->getSoundResourceId());
actor->setSoundResourceId(kResourceNone);
@@ -1696,7 +1696,7 @@ void Scene::clickInventory() {
}
}
- player->updateStatus(kActorStatusEnabled);
+ player->changeStatus(kActorStatusEnabled);
getSound()->playSound(MAKE_RESOURCE(kResourcePackSound, 5));
}
@@ -1745,7 +1745,7 @@ void Scene::hitActorChapter2(ActorIndex index) {
if (index == 11) {
player->faceTarget((uint32)index, kDirectionFromActor);
- player->updateStatus(kActorStatusAttacking);
+ player->changeStatus(kActorStatusAttacking);
Actor *actor11 = getActor(index);
@@ -1754,17 +1754,17 @@ void Scene::hitActorChapter2(ActorIndex index) {
if (Actor::euclidianDistance(pointPlayer, pointActor11) < 150) {
if (actor11->getStatus() == kActorStatusWalking2)
- actor11->updateStatus(kActorStatus18);
+ actor11->changeStatus(kActorStatus18);
if (actor11->getStatus() == kActorStatusEnabled)
- actor11->updateStatus(kActorStatusEnabled2);
+ actor11->changeStatus(kActorStatusEnabled2);
}
getSharedData()->setChapter2ActorIndex(index);
} else if (index > 12) {
player->faceTarget((uint32)(index + 9), kDirectionFromActor);
- player->updateStatus(kActorStatusAttacking);
+ player->changeStatus(kActorStatusAttacking);
getSharedData()->setChapter2ActorIndex(index);
}
}
More information about the Scummvm-git-logs
mailing list