BLADERUNNER: Added stairs & ladder support

This commit is contained in:
Peter Kohaut 2018-03-06 21:10:48 +01:00
parent 09ebefe961
commit 2a0bdd7df8
7 changed files with 111 additions and 30 deletions

View File

@ -569,7 +569,15 @@ enum AnimationModes {
kAnimationModeCombatShoot = 6,
kAnimationModeCombatWalk = 7,
kAnimationModeCombatRun = 8,
kAnimationModeFeeding = 52
kAnimationModeWalkUp = 44,
kAnimationModeWalkDown = 45,
kAnimationModeCombatWalkUp = 46,
kAnimationModeCombatWalkDown = 47,
kAnimationModeFeeding = 52,
kAnimationModeClimbUp = 64,
kAnimationModeClimbDown = 65,
kAnimationModeCombatClimbUp = 66,
kAnimationModeCombatClimbDown = 67
};
enum SceneLoopMode {

View File

@ -244,7 +244,6 @@ bool AIScriptLeon::GoalChanged(int currentGoalNumber, int newGoalNumber) {
}
bool AIScriptLeon::UpdateAnimation(int *animation, int *frame) {
switch (_animationState) {
case 10:
*animation = 856;
@ -382,7 +381,7 @@ bool AIScriptLeon::ChangeAnimationMode(int mode) {
_animationState = 1;
_animationFrame = 0;
break;
case 3:
case kAnimationModeTalk:
_animationState = 2;
_animationFrame = 0;
var_45EDAC = 0;

View File

@ -1313,7 +1313,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
}
}
break;
case 3:
case kAnimationModeTalk:
if (_animationState < 3 || _animationState > 12) {
_animationState = 13;
_animationStateNext = 3;
@ -1362,7 +1362,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
break;
}
break;
case 5:
case kAnimationModeCombatAim:
switch (_animationState) {
case 17:
case 18:
@ -1571,19 +1571,19 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
_animationFrame = 0;
Player_Loses_Control();
break;
case 44:
case kAnimationModeWalkUp:
_animationState = 38;
_animationFrame = 0;
break;
case 45:
case kAnimationModeWalkDown:
_animationState = 39;
_animationFrame = 0;
break;
case 46:
case kAnimationModeCombatWalkUp:
_animationState = 40;
_animationFrame = 0;
break;
case 47:
case kAnimationModeCombatWalkDown:
_animationState = 41;
_animationFrame = 0;
break;
@ -1631,13 +1631,13 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
_animationState = 70;
}
break;
case 64:
case 66:
case kAnimationModeClimbUp:
case kAnimationModeCombatClimbUp:
_animationState = 42;
_animationFrame = 0;
break;
case 65:
case 67:
case kAnimationModeClimbDown:
case kAnimationModeCombatClimbDown:
_animationState = 43;
_animationFrame = 0;
break;

View File

@ -941,7 +941,7 @@ bool AIScriptOfficerLeary::ChangeAnimationMode(int mode) {
_animationState = 4;
_animationFrame = 0;
break;
case 3:
case kAnimationModeTalk:
if (_animationState == 1) {
_animationState = 2;
_animationStateNext = 11;
@ -979,7 +979,7 @@ bool AIScriptOfficerLeary::ChangeAnimationMode(int mode) {
break;
}
break;
case 6:
case kAnimationModeCombatShoot:
_animationState = 24;
_animationFrame = 0;
break;
@ -1140,19 +1140,19 @@ bool AIScriptOfficerLeary::ChangeAnimationMode(int mode) {
case 28:
Game_Flag_Set(199);
break;
case 44:
case kAnimationModeWalkUp:
_animationState = 5;
_animationFrame = 0;
break;
case 45:
case kAnimationModeWalkDown:
_animationState = 6;
_animationFrame = 0;
break;
case 46:
case kAnimationModeCombatWalkUp:
_animationState = 9;
_animationFrame = 0;
break;
case 47:
case kAnimationModeCombatWalkDown:
_animationState = 10;
_animationFrame = 0;
break;

View File

@ -500,7 +500,7 @@ bool AIScriptRunciter::ChangeAnimationMode(int mode) {
_animationNext = 526;
}
break;
case 3:
case kAnimationModeTalk:
if (_animationState != 0) {
_animationState = 2;
_animationFrame = 0;

View File

@ -553,16 +553,90 @@ void ScriptBase::Actor_Force_Stop_Walking(int actorId) {
warning("Loop_Actor_Travel_Stairs(%d)", actorId);
}
bool ScriptBase::Loop_Actor_Travel_Stairs(int actorId, int a2, int a3, int a4) {
//TODO
warning("Loop_Actor_Travel_Stairs(%d, %d, %d, %d)", actorId, a2, a3, a4);
return false;
void ScriptBase::Loop_Actor_Travel_Stairs(int actorId, int stepCount, bool up, int animationModeEnd) {
_vm->gameWaitForActive();
Player_Loses_Control();
Actor *actor = _vm->_actors[actorId];
int animationModeWalk = 0;
if (actor->inCombat()) {
animationModeWalk = up ? kAnimationModeCombatWalkUp : kAnimationModeCombatWalkDown;
if (animationModeEnd == kAnimationModeIdle) {
animationModeEnd = kAnimationModeCombatIdle;
}
} else {
animationModeWalk = up ? kAnimationModeWalkUp : kAnimationModeWalkDown;
}
actor->changeAnimationMode(animationModeWalk, false);
int stairsHeight = stepCount * 9 * (up ? 1 : -1);
float targetY = actor->getY() + stairsHeight;
bool immunityToObstacles = actor->isImmuneToObstacles();
actor->setImmunityToObstacles(true);
do {
_vm->gameTick();
if (up) {
if (targetY <= actor->getY()) {
break;
}
} else {
if (targetY >= actor->getY()) {
break;
}
}
} while (true);
actor->setImmunityToObstacles(immunityToObstacles);
actor->setAtXYZ(Vector3(actor->getX(), targetY, actor->getZ()), actor->getFacing(), true, false, false);
actor->changeAnimationMode(animationModeEnd, false);
Player_Gains_Control();
}
bool ScriptBase::Loop_Actor_Travel_Ladder(int actorId, int a2, int a3, int a4) {
//TODO
warning("Loop_Actor_Travel_Ladder(%d, %d, %d, %d)", actorId,a2,a3,a4);
return false;
void ScriptBase::Loop_Actor_Travel_Ladder(int actorId, int stepCount, bool up, int animationModeEnd) {
_vm->gameWaitForActive();
Player_Loses_Control();
Actor *actor = _vm->_actors[actorId];
int animationModeWalk = 0;
if (actor->inCombat()) {
animationModeWalk = up ? kAnimationModeCombatClimbUp : kAnimationModeCombatClimbDown;
if (animationModeEnd == kAnimationModeIdle) {
animationModeEnd = kAnimationModeCombatIdle;
}
} else {
animationModeWalk = up ? kAnimationModeClimbUp : kAnimationModeClimbDown;
}
actor->changeAnimationMode(animationModeWalk, false);
int ladderHeight = stepCount * 12 * (up ? 1 : -1);
float targetY = actor->getY() + ladderHeight;
bool immunityToObstacles = actor->isImmuneToObstacles();
actor->setImmunityToObstacles(true);
do {
_vm->gameTick();
if (up) {
if (targetY <= actor->getY()) {
break;
}
} else {
if (targetY >= actor->getY()) {
break;
}
}
} while (true);
actor->setImmunityToObstacles(immunityToObstacles);
actor->setAtXYZ(Vector3(actor->getX(), targetY, actor->getZ()), actor->getFacing(), true, false, false);
actor->changeAnimationMode(animationModeEnd, false);
Player_Gains_Control();
}
void ScriptBase::Actor_Clue_Add_To_Database(int actorId, int clueId, int weight, bool clueAcquired, bool unknownFlag, int fromActorId) {

View File

@ -109,8 +109,8 @@ protected:
void Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, bool run);
void Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run);
void Actor_Force_Stop_Walking(int actorId);
bool Loop_Actor_Travel_Stairs(int actorId, int a2, int a3, int a4);
bool Loop_Actor_Travel_Ladder(int actorId, int a2, int a3, int a4);
void Loop_Actor_Travel_Stairs(int actorId, int stepCount, bool up, int animationModeEnd);
void Loop_Actor_Travel_Ladder(int actorId, int stepCount, bool up, int animationModeEnd);
void Actor_Clue_Add_To_Database(int actorId, int clueId, int weight, bool clueAcquired, bool unknownFlag, int fromActorId);
void Actor_Clue_Acquire(int actorId, int clueId, bool unknownFlag, int fromActorId);
void Actor_Clue_Lose(int actorId, int clueId);