ULTIMA8: Set correct animations for large weapons

This commit is contained in:
Matthew Duggan 2020-11-02 16:16:25 +09:00
parent ef725b0965
commit 3d16e9e564
2 changed files with 33 additions and 11 deletions

View File

@ -29,6 +29,7 @@
#include "ultima/ultima8/world/actors/anim_action.h"
#include "ultima/ultima8/world/actors/animation.h"
#include "ultima/ultima8/world/actors/actor.h"
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/kernel/core_app.h"
#include "ultima/ultima8/games/game_info.h"
@ -63,12 +64,24 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
if (GAME_IS_U8) {
return static_cast<uint32>(action);
} else {
bool smallwpn = (actor && actor->activeWeaponIsSmall());
bool smallwpn = true;
bool altfire = false;
bool isavatar = (actor && actor->getShape() == 1);
if (isavatar && actor->getActiveWeapon()) {
const Item *wpn = getItem(actor->getActiveWeapon());
const ShapeInfo *shapeinfo = wpn->getShapeInfo();
const WeaponInfo *wpninfo = (shapeinfo ? shapeinfo->_weaponInfo : nullptr);
smallwpn = (wpninfo && wpninfo->_small);
altfire = (wpninfo && (wpninfo->_overlayShape == 0x36e || wpninfo->_overlayShape == 0x33b));
}
// For crusader the actions have different IDs. Rather than
// rewrite everything, we just translate them here for all the ones
// we want to use programmatically. There are more, but they are
// called from usecode so don't need translation.
//
// We also translate based on weapon. See the function at 1128:2104
//
// TODO: Also handle kneeling weapon animations
switch (action) {
case Animation::stand:
@ -78,9 +91,11 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
case Animation::walk:
return 1;
case Animation::retreat:
return 2; // TODO: 28 is also a retreat move, which is right?
return (smallwpn ? 2 : 45);
case Animation::run:
return 3;
return (smallwpn ? 3 : 49);
case Animation::combatRun:
return (smallwpn ? 48 : 49);
case Animation::combatStand:
return (smallwpn ? 4 : 37);
// Note: 5, 6, 9, 10 == nothing (for avatar)?
@ -88,22 +103,29 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
return (smallwpn ? 11: 16);
case Animation::readyWeapon:
return (smallwpn ? 7 : 12);
case Animation::attack:
return (smallwpn ? 8 : 13);
case Animation::attack: {
if (smallwpn)
return 8;
return (altfire ? 54 : 13);
}
// Note: 14, 17, 21, 22, 29 == nothing for avatar
case Animation::fallBackwards:
return 18;
case Animation::die:
return 20; // maybe? falls over forwards
case Animation::advance:
return 36; // TODO: 44 is also advance
return (smallwpn ? 36 : 44);
case Animation::startKneeling:
return 40;
case Animation::stopKneeling:
return 41;
case Animation::kneel:
return 46; // 47 is knee with a larger weapon
// 48 is nothing for avatar
return (smallwpn ? 46 : 47);
case Animation::kneelAndFire: {
if (smallwpn)
return 42;
return (altfire ? 50 : 43);
}
case Animation::lookLeft:
return 0;
case Animation::lookRight:

View File

@ -119,9 +119,9 @@ enum Sequence {
quickRetreat = 45,
kneelingWithSmallWeapon = 46,
kneelingWithLargeWeapon = 47,
run2 = 48,
runWithSmallWeapon = 49,
runWithLargeWeapon = 50,
combatRun = 48,
runWithLargeWeapon = 49,
runWithLargeWeapon2 = 50,
kneelingRetreat = 51,
kneelingAdvance = 52,
kneelingSlowRetreat = 53,