Merge branch 'master' of ssh+git://git.axiodl.com:6431/AxioDl/urde

This commit is contained in:
Phillip Stephens 2021-03-06 18:47:41 -08:00
commit c350f0a812
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
35 changed files with 507 additions and 412 deletions

View File

@ -1,85 +0,0 @@
############################################################################
# URDE appveyor build configuration
############################################################################
clone_depth: 1
platform:
- x64
build_cloud: AXIODL-BUILDBOT
image: Windows
build:
verbosity: detailed
configuration:
- Release
cache:
- C:\projects\deps
install:
############################################################################
# All external dependencies are installed in C:\projects\deps
############################################################################
- if not exist C:\projects\deps mkdir C:\projects\deps
- cd C:\projects\deps
############################################################################
# Install Ninja
############################################################################
- set NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip
- if not exist ninja.zip appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
- if not exist ninja 7z x ninja.zip -oC:\projects\deps\ninja > nul
############################################################################
# Install a recent CMake
############################################################################
- set CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-win64-x64.zip
- if not exist cmake.zip appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip
- if not exist cmake 7z x cmake.zip -oC:\projects\deps\cmake > nul
############################################################################
# Install custom LLVM
############################################################################
- set LLVM_URL=https://axiodl.com/files/LLVM-10.0.1-win64.exe
- if not exist LLVM-10.0.1-win64.exe appveyor DownloadFile %LLVM_URL% -FileName LLVM-10.0.1-win64.exe
- if not exist llvm-10.0.1 LLVM-10.0.1-win64.exe /S /D=C:\projects\deps\llvm-10.0.1
before_build:
# Configure ninja
- set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version
# Configure cmake
- set PATH=C:\projects\deps\cmake\cmake-3.16.4-win64-x64\bin;%PATH%
- cmake --version
# Configure LLVM
- set PATH=C:\projects\deps\llvm-10.0.1\bin;%PATH%
- llvm-config --version
- clang-cl -v
# Configure VS
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" amd64
# Fetch submodules
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive
build_script:
- mkdir build
- cd build
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DLLVM_ROOT_DIR=C:\projects\deps\llvm-10.0.1 -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_LINKER=lld-link -DCMAKE_AR=llvm-ar -DCMAKE_RANLIB=llvm-ranlib -GNinja ..
- ninja urde
#notifications:
# - provider: Slack
# incoming_webhook:
# secure: uoO0I0PWyCx0KLjBOG6d17aSVuEEvYztB/UiF8J0LmTb2O735mAdWcuZHTImDFUGZxeI34/qzOB2JKqF+h8dZA5yiprSTkWIookqQjUokAM=
# - provider: Webhook
# url: https://skyhook.glitch.me/api/webhooks/345359672326356993/M8kBYpqr1JyVNhnAHBwNN5TnZmtWy9_msxAQoeOlaa73UhPn8gLU5uYZCjU1qsAi3sGN/appveyor
# method: POST
# on_build_success: true
# on_build_failure: true
# on_build_status_changed: false
# Uncomment this to debug AppVeyor failures.
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

142
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,142 @@
name: Build
on:
push:
branches:
- master
pull_request:
jobs:
build-linux-gcc:
name: Build Linux (GCC x86_64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install build-essential curl git cmake ninja-build llvm-dev libclang-dev clang lld \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 qt5-default
- name: Create build directory
shell: bash
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41
- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
build-linux-clang:
name: Build Linux (Clang x86_64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install build-essential curl git cmake ninja-build llvm-dev libclang-dev clang lld \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 qt5-default
- name: Create build directory
shell: bash
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
build-macos:
name: Build macOS (Clang x86_64)
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: brew install ninja qt
- name: Create build directory
shell: bash
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41
- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
build-windows-msvc:
name: Build Windows (MSVC x86_64)
runs-on: [self-hosted, windows, x64]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# - name: Download LLVM
# uses: suisei-cn/actions-download-file@v1
# id: download-llvm
# with:
# url: https://axiodl.com/files/LLVM-10.0.1-win64.exe
# target: ${{github.workspace}}/temp
# - name: Install LLVM
# shell: cmd
# working-directory: ${{github.workspace}}/temp
# run: ${{steps.download-llvm.outputs.filename}} /S
# - name: Install ninja
# run: choco install ninja
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Create build directory
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake .. -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_CXX_FLAGS= -DCMAKE_C_FLAGS=
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
build-windows-clang:
name: Build Windows (Clang x86_64)
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Download LLVM
uses: suisei-cn/actions-download-file@v1
id: download-llvm
with:
url: https://axiodl.com/files/LLVM-10.0.1-win64.exe
target: ${{github.workspace}}/temp
- name: Install LLVM
shell: cmd
working-directory: ${{github.workspace}}/temp
run: ${{steps.download-llvm.outputs.filename}} /S
- name: Install ninja
run: choco install ninja
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Create build directory
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake .. -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel -DURDE_VECTOR_ISA=sse41 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_LINKER="C:/Program Files/LLVM/bin/lld-link.exe"
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE

View File

@ -54,11 +54,9 @@ set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake")
find_package(Sanitizers) find_package(Sanitizers)
if (NX) if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(URDE_VECTOR_ISA "neon") set(URDE_VECTOR_ISA "sse41" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)")
else() endif ()
set(URDE_VECTOR_ISA "sse2" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)")
endif()
if(MSVC) if(MSVC)
if(${URDE_VECTOR_ISA} STREQUAL "avx2") if(${URDE_VECTOR_ISA} STREQUAL "avx2")
@ -71,6 +69,10 @@ if(MSVC)
message(STATUS "Building with AVX Vector ISA") message(STATUS "Building with AVX Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "sse41") elseif(${URDE_VECTOR_ISA} STREQUAL "sse41")
add_compile_definitions(__SSE4_1__=1) add_compile_definitions(__SSE4_1__=1)
# clang-cl 10 requires -msse4.1, may be fixed in newer versions?
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL Clang)
add_compile_options(-msse4.1)
endif()
message(STATUS "Building with SSE4.1 Vector ISA") message(STATUS "Building with SSE4.1 Vector ISA")
else() else()
message(STATUS "Building with SSE2 Vector ISA") message(STATUS "Building with SSE2 Vector ISA")
@ -150,8 +152,6 @@ else()
elseif(${URDE_VECTOR_ISA} STREQUAL "sse2") elseif(${URDE_VECTOR_ISA} STREQUAL "sse2")
add_compile_options(-msse2) add_compile_options(-msse2)
message(STATUS "Building with SSE2 Vector ISA") message(STATUS "Building with SSE2 Vector ISA")
elseif(${URDE_VECTOR_ISA} STREQUAL "neon")
message(STATUS "Building with NEON Vector ISA")
else() else()
message(STATUS "Building with x87 Vector ISA") message(STATUS "Building with x87 Vector ISA")
endif() endif()
@ -181,7 +181,7 @@ else()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field) add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wno-lto-type-mismatch) add_compile_options(-Wno-lto-type-mismatch -Wno-maybe-uninitialized)
endif() endif()
add_compile_definitions(FMT_EXCEPTIONS=0) add_compile_definitions(FMT_EXCEPTIONS=0)

View File

@ -11,11 +11,11 @@ namespace urde {
void CABSAim::Start(CBodyController& bc, CStateManager& mgr) { void CABSAim::Start(CBodyController& bc, CStateManager& mgr) {
// const CBCAdditiveAimCmd* cmd = // const CBCAdditiveAimCmd* cmd =
// static_cast<const CBCAdditiveAimCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveAim)); // static_cast<const CBCAdditiveAimCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveAim));
const CPASAnimState* aimState = bc.GetPASDatabase().GetAnimState(22); const CPASAnimState* aimState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::AdditiveAim);
// Left, Right, Up, Down // Left, Right, Up, Down
for (size_t i = 0; i < x8_anims.size(); ++i) { for (size_t i = 0; i < x8_anims.size(); ++i) {
const CPASAnimParmData parms(22, CPASAnimParm::FromEnum(s32(i))); const CPASAnimParmData parms(pas::EAnimationState::AdditiveAim, CPASAnimParm::FromEnum(s32(i)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x8_anims[i] = best.second; x8_anims[i] = best.second;
x18_angles[i] = zeus::degToRad(aimState->GetAnimParmData(x8_anims[i], 1).GetReal32Value()); x18_angles[i] = zeus::degToRad(aimState->GetAnimParmData(x8_anims[i], 1).GetReal32Value());
@ -99,7 +99,7 @@ void CABSFlinch::Start(CBodyController& bc, CStateManager& mgr) {
static_cast<const CBCAdditiveFlinchCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveFlinch)); static_cast<const CBCAdditiveFlinchCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveFlinch));
x4_weight = cmd->GetWeight(); x4_weight = cmd->GetWeight();
CPASAnimParmData parms(23); CPASAnimParmData parms(pas::EAnimationState::AdditiveFlinch);
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x8_anim = best.second; x8_anim = best.second;
@ -145,7 +145,7 @@ void CABSReaction::Start(CBodyController& bc, CStateManager& mgr) {
xc_type = cmd->GetType(); xc_type = cmd->GetType();
x10_active = cmd->GetIsActive(); x10_active = cmd->GetIsActive();
CPASAnimParmData parms(24, CPASAnimParm::FromEnum(s32(xc_type))); CPASAnimParmData parms(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(s32(xc_type)));
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x8_anim = best.second; x8_anim = best.second;

View File

@ -80,7 +80,7 @@ void CBodyController::Update(float dt, CStateManager& mgr) {
} }
} }
bool CBodyController::HasBodyState(pas::EAnimationState state) const { return GetPASDatabase().HasState(s32(state)); } bool CBodyController::HasBodyState(pas::EAnimationState state) const { return GetPASDatabase().HasState(state); }
void CBodyController::SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans) { void CBodyController::SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans) {
x0_actor.GetModelData()->GetAnimationData()->SetAnimation(parms, noTrans); x0_actor.GetModelData()->GetAnimationData()->SetAnimation(parms, noTrans);
@ -269,7 +269,8 @@ void CBodyController::UpdateFrozenInfo(float dt, CStateManager& mgr) {
} }
bool CBodyController::HasIceBreakoutState() const { bool CBodyController::HasIceBreakoutState() const {
CPASAnimParmData parms(24, CPASAnimParm::FromEnum(3)); CPASAnimParmData parms(pas::EAnimationState::AdditiveReaction,
CPASAnimParm::FromEnum(static_cast<s32>(pas::EAdditiveReactionType::IceBreakout)));
std::pair<float, s32> best = GetPASDatabase().FindBestAnimation(parms, -1); std::pair<float, s32> best = GetPASDatabase().FindBestAnimation(parms, -1);
return best.first > 0.f; return best.first > 0.f;
} }

View File

@ -13,7 +13,7 @@ namespace urde {
void CBSAttack::Start(CBodyController& bc, CStateManager& mgr) { void CBSAttack::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCMeleeAttackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::MeleeAttack)); const auto* cmd = static_cast<const CBCMeleeAttackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::MeleeAttack));
const CPASDatabase& pasDatabase = bc.GetPASDatabase(); const CPASDatabase& pasDatabase = bc.GetPASDatabase();
const CPASAnimParmData parms(7, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), const CPASAnimParmData parms(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())),
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -121,13 +121,14 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr) {
zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x()); zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x());
angle.makeRel(); angle.makeRel();
const float attackAngle = angle.asDegrees(); const float attackAngle = angle.asDegrees();
const CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), const CPASAnimParmData parms(
CPASAnimParm::FromReal32(angle.asDegrees()), pas::EAnimationState::ProjectileAttack, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())),
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
const std::pair<float, s32> best1 = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best1 = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (cmd->BlendTwoClosest()) { if (cmd->BlendTwoClosest()) {
const std::pair<float, s32> best2 = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), best1.second); const std::pair<float, s32> best2 =
const CPASAnimState* projAttackState = bc.GetPASDatabase().GetAnimState(18); bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), best1.second);
const CPASAnimState* projAttackState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::ProjectileAttack);
float angle1 = projAttackState->GetAnimParmData(best1.second, 1).GetReal32Value(); float angle1 = projAttackState->GetAnimParmData(best1.second, 1).GetReal32Value();
float angle2 = projAttackState->GetAnimParmData(best2.second, 1).GetReal32Value(); float angle2 = projAttackState->GetAnimParmData(best2.second, 1).GetReal32Value();
if (angle1 - angle2 > 180.f) { if (angle1 - angle2 > 180.f) {
@ -178,7 +179,7 @@ pas::EAnimationState CBSProjectileAttack::UpdateBody(float dt, CBodyController&
void CBSDie::Start(CBodyController& bc, CStateManager& mgr) { void CBSDie::Start(CBodyController& bc, CStateManager& mgr) {
bool shouldReset = true; bool shouldReset = true;
if (bc.ShouldPlayDeathAnims()) { if (bc.ShouldPlayDeathAnims()) {
const CPASAnimParmData parms(4, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); const CPASAnimParmData parms(pas::EAnimationState::Death, CPASAnimParm::FromEnum(s32(bc.GetFallState())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 0.f) { if (best.first > 0.f) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -210,12 +211,12 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) {
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z());
angle.makeRel(); angle.makeRel();
const CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()), const CPASAnimParmData parms(pas::EAnimationState::Fall, CPASAnimParm::FromReal32(angle.asDegrees()),
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const CPASAnimState* knockdownState = bc.GetPASDatabase().GetAnimState(0); const CPASAnimState* knockdownState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Fall);
if (!knockdownState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!knockdownState->GetAnimParmData(best.second, 2).GetBoolValue()) {
const float animAngle = zeus::degToRad(knockdownState->GetAnimParmData(best.second, 0).GetReal32Value()); const float animAngle = zeus::degToRad(knockdownState->GetAnimParmData(best.second, 0).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
@ -255,7 +256,7 @@ void CBSFall::Shutdown(CBodyController& bc) { bc.SetFallState(xc_fallState); }
void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) { void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCGetupCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Getup)); const auto* cmd = static_cast<const CBCGetupCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Getup));
const CPASAnimParmData parms(1, CPASAnimParm::FromEnum(s32(bc.GetFallState())), const CPASAnimParmData parms(pas::EAnimationState::Getup, CPASAnimParm::FromEnum(s32(bc.GetFallState())),
CPASAnimParm::FromEnum(s32(cmd->GetGetupType()))); CPASAnimParm::FromEnum(s32(cmd->GetGetupType())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > FLT_EPSILON) { if (best.first > FLT_EPSILON) {
@ -263,7 +264,8 @@ void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} }
x4_fallState = pas::EFallState(bc.GetPASDatabase().GetAnimState(1)->GetAnimParmData(best.second, 2).GetEnumValue()); x4_fallState = pas::EFallState(
bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Getup)->GetAnimParmData(best.second, 2).GetEnumValue());
} else { } else {
x4_fallState = pas::EFallState::Zero; x4_fallState = pas::EFallState::Zero;
} }
@ -296,12 +298,12 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) {
const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel(); angle.makeRel();
const CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()), const CPASAnimParmData parms(pas::EAnimationState::KnockBack, CPASAnimParm::FromReal32(angle.asDegrees()),
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const CPASAnimState* knockbackState = bc.GetPASDatabase().GetAnimState(6); const CPASAnimState* knockbackState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::KnockBack);
if (!knockbackState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!knockbackState->GetAnimParmData(best.second, 2).GetBoolValue()) {
const float animAngle = zeus::degToRad(knockbackState->GetAnimParmData(best.second, 0).GetReal32Value()); const float animAngle = zeus::degToRad(knockbackState->GetAnimParmData(best.second, 0).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
@ -353,11 +355,12 @@ pas::EAnimationState CBSKnockBack::UpdateBody(float dt, CBodyController& bc, CSt
} }
CBSLieOnGround::CBSLieOnGround(CActor& actor) { CBSLieOnGround::CBSLieOnGround(CActor& actor) {
x4_24_hasGroundHit = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().HasState(11); x4_24_hasGroundHit = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().HasState(
pas::EAnimationState::GroundHit);
} }
void CBSLieOnGround::Start(CBodyController& bc, CStateManager& mgr) { void CBSLieOnGround::Start(CBodyController& bc, CStateManager& mgr) {
const CPASAnimParmData parms(2, CPASAnimParm::FromEnum(s32(bc.GetFallState()))); const CPASAnimParmData parms(pas::EAnimationState::LieOnGround, CPASAnimParm::FromEnum(s32(bc.GetFallState())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 0.f) { if (best.first > 0.f) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -388,7 +391,7 @@ void CBSLieOnGround::Shutdown(CBodyController& bc) { bc.EnableAnimation(true); }
void CBSStep::Start(CBodyController& bc, CStateManager& mgr) { void CBSStep::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCStepCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Step)); const auto* cmd = static_cast<const CBCStepCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Step));
const CPASAnimParmData parms(3, CPASAnimParm::FromEnum(s32(cmd->GetStepDirection())), const CPASAnimParmData parms(pas::EAnimationState::Step, CPASAnimParm::FromEnum(s32(cmd->GetStepDirection())),
CPASAnimParm::FromEnum(s32(cmd->GetStepType()))); CPASAnimParm::FromEnum(s32(cmd->GetStepType())));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
@ -450,12 +453,14 @@ void CBSTurn::Start(CBodyController& bc, CStateManager& mgr) {
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f());
const float deltaAngle = zeus::radToDeg(zeus::CVector2f::getAngleDiff(lookDir2d, x8_dest)); const float deltaAngle = zeus::radToDeg(zeus::CVector2f::getAngleDiff(lookDir2d, x8_dest));
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f);
const CPASAnimParmData parms(8, CPASAnimParm::FromEnum(s32(x10_turnDir)), CPASAnimParm::FromReal32(deltaAngle), const CPASAnimParmData parms(pas::EAnimationState::Turn, CPASAnimParm::FromEnum(s32(x10_turnDir)),
CPASAnimParm::FromReal32(deltaAngle),
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const float animAngle = bc.GetPASDatabase().GetAnimState(8)->GetAnimParmData(best.second, 1).GetReal32Value(); const float animAngle =
bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->GetAnimParmData(best.second, 1).GetReal32Value();
x4_rotateSpeed = x4_rotateSpeed =
zeus::degToRad((x10_turnDir == pas::ETurnDirection::Left) ? animAngle - deltaAngle : deltaAngle - animAngle); zeus::degToRad((x10_turnDir == pas::ETurnDirection::Left) ? animAngle - deltaAngle : deltaAngle - animAngle);
const float timeRem = bc.GetAnimTimeRemaining(); const float timeRem = bc.GetAnimTimeRemaining();
@ -539,14 +544,15 @@ pas::EAnimationState CBSTurn::UpdateBody(float dt, CBodyController& bc, CStateMa
} }
void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) { void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) {
if (bc.GetPASDatabase().GetAnimState(8)->HasAnims()) { if (bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->HasAnims()) {
CBSTurn::Start(bc, mgr); CBSTurn::Start(bc, mgr);
} else { } else {
x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f()); x8_dest = zeus::CVector2f(bc.GetCommandMgr().GetFaceVector().toVec2f());
const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1]; const zeus::CVector3f& lookDir = bc.GetOwner().GetTransform().basis[1];
const zeus::CVector2f lookDir2d(lookDir.toVec2f()); const zeus::CVector2f lookDir2d(lookDir.toVec2f());
x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f); x10_turnDir = pas::ETurnDirection(zeus::CVector2f(lookDir2d.y(), -lookDir2d.x()).dot(x8_dest) > 0.f);
const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(s32(bc.GetLocomotionType()))); const CPASAnimParmData parms(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0),
CPASAnimParm::FromEnum(s32(bc.GetLocomotionType())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.second != bc.GetCurrentAnimId()) { if (best.second != bc.GetCurrentAnimId()) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -556,7 +562,7 @@ void CBSFlyerTurn::Start(CBodyController& bc, CStateManager& mgr) {
} }
pas::EAnimationState CBSFlyerTurn::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) { pas::EAnimationState CBSFlyerTurn::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) {
if (bc.GetPASDatabase().GetAnimState(8)->HasAnims()) { if (bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Turn)->HasAnims()) {
return CBSTurn::UpdateBody(dt, bc, mgr); return CBSTurn::UpdateBody(dt, bc, mgr);
} }
@ -580,12 +586,12 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) {
xc_25_advance = false; xc_25_advance = false;
if (bc.GetLocomotionType() == pas::ELocomotionType::Crouch) { if (bc.GetLocomotionType() == pas::ELocomotionType::Crouch) {
const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_loopAttackType))); CPASAnimParm::FromEnum(s32(x8_loopAttackType)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} else { } else {
x4_state = pas::ELoopState::Begin; x4_state = pas::ELoopState::Begin;
const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_loopAttackType))); CPASAnimParm::FromEnum(s32(x8_loopAttackType)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > FLT_EPSILON) { if (best.first > FLT_EPSILON) {
@ -593,7 +599,7 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) {
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} else { } else {
x4_state = pas::ELoopState::Loop; x4_state = pas::ELoopState::Loop;
const CPASAnimParmData loopParms(9, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData loopParms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_loopAttackType))); CPASAnimParm::FromEnum(s32(x8_loopAttackType)));
bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom());
} }
@ -652,7 +658,8 @@ pas::EAnimationState CBSLoopAttack::UpdateBody(float dt, CBodyController& bc, CS
return pas::EAnimationState::Locomotion; return pas::EAnimationState::Locomotion;
} }
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(1),
CPASAnimParm::FromEnum(s32(x8_loopAttackType)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
x4_state = pas::ELoopState::Loop; x4_state = pas::ELoopState::Loop;
} else if (!bc.GetCommandMgr().GetTargetVector().isZero()) { } else if (!bc.GetCommandMgr().GetTargetVector().isZero()) {
@ -662,7 +669,8 @@ pas::EAnimationState CBSLoopAttack::UpdateBody(float dt, CBodyController& bc, CS
case pas::ELoopState::Loop: case pas::ELoopState::Loop:
if (xc_25_advance && (!xc_24_waitForAnimOver || bc.IsAnimationOver())) { if (xc_25_advance && (!xc_24_waitForAnimOver || bc.IsAnimationOver())) {
if (bc.GetLocomotionType() != pas::ELocomotionType::Crouch) { if (bc.GetLocomotionType() != pas::ELocomotionType::Crouch) {
const CPASAnimParmData parms(9, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(s32(x8_loopAttackType))); const CPASAnimParmData parms(pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(2),
CPASAnimParm::FromEnum(s32(x8_loopAttackType)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
x4_state = pas::ELoopState::End; x4_state = pas::ELoopState::End;
} else { } else {
@ -697,14 +705,15 @@ void CBSLoopReaction::Start(CBodyController& bc, CStateManager& mgr) {
} }
x4_state = pas::ELoopState::Begin; x4_state = pas::ELoopState::Begin;
const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)),
CPASAnimParm::FromEnum(s32(x4_state)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > FLT_EPSILON) { if (best.first > FLT_EPSILON) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} else { } else {
x4_state = pas::ELoopState::Loop; x4_state = pas::ELoopState::Loop;
const CPASAnimParmData loopParms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), const CPASAnimParmData loopParms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)),
CPASAnimParm::FromEnum(s32(x4_state))); CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom());
} }
@ -748,7 +757,8 @@ pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, const CBo
} }
bool CBSLoopReaction::PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const { bool CBSLoopReaction::PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const {
const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(int(x8_reactionType)), CPASAnimParm::FromEnum(2)); const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(int(x8_reactionType)),
CPASAnimParm::FromEnum(2));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 0.f) { if (best.first > 0.f) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -772,7 +782,8 @@ pas::EAnimationState CBSLoopReaction::UpdateBody(float dt, CBodyController& bc,
} }
} else { } else {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
const CPASAnimParmData parms(10, CPASAnimParm::FromEnum(s32(x8_reactionType)), CPASAnimParm::FromEnum(1)); const CPASAnimParmData parms(pas::EAnimationState::LoopReaction, CPASAnimParm::FromEnum(s32(x8_reactionType)),
CPASAnimParm::FromEnum(1));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
x4_state = pas::ELoopState::Loop; x4_state = pas::ELoopState::Loop;
} else if (!bc.GetCommandMgr().GetTargetVector().isZero()) { } else if (!bc.GetCommandMgr().GetTargetVector().isZero()) {
@ -810,12 +821,12 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) {
const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel(); angle.makeRel();
const CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())), const CPASAnimParmData parms(pas::EAnimationState::GroundHit, CPASAnimParm::FromEnum(s32(bc.GetFallState())),
CPASAnimParm::FromReal32(angle.asDegrees())); CPASAnimParm::FromReal32(angle.asDegrees()));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const CPASAnimState* groundHitState = bc.GetPASDatabase().GetAnimState(11); const CPASAnimState* groundHitState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::GroundHit);
if (!groundHitState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!groundHitState->GetAnimParmData(best.second, 2).GetBoolValue()) {
const float animAngle = zeus::degToRad(groundHitState->GetAnimParmData(best.second, 1).GetReal32Value()); const float animAngle = zeus::degToRad(groundHitState->GetAnimParmData(best.second, 1).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
@ -860,7 +871,7 @@ void CBSGenerate::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCGenerateCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Generate)); const auto* cmd = static_cast<const CBCGenerateCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Generate));
s32 anim; s32 anim;
if (!cmd->UseSpecialAnimId()) { if (!cmd->UseSpecialAnimId()) {
const CPASAnimParmData parms(12, CPASAnimParm::FromEnum(s32(cmd->GetGenerateType()))); const CPASAnimParmData parms(pas::EAnimationState::Generate, CPASAnimParm::FromEnum(s32(cmd->GetGenerateType())));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
anim = best.second; anim = best.second;
} else { } else {
@ -918,7 +929,8 @@ void CBSJump::Start(CBodyController& bc, CStateManager& mgr) {
} }
if (!cmd->StartInJumpLoop()) { if (!cmd->StartInJumpLoop()) {
x4_state = pas::EJumpState::IntoJump; x4_state = pas::EJumpState::IntoJump;
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} else { } else {
PlayJumpLoop(mgr, bc); PlayJumpLoop(mgr, bc);
@ -949,7 +961,8 @@ bool CBSJump::CheckForWallJump(CBodyController& bc, CStateManager& mgr) {
const float xExtent = (aabb.max.x() - aabb.min.x()) * 0.5f; const float xExtent = (aabb.max.x() - aabb.min.x()) * 0.5f;
if (distToWall < 1.414f * xExtent || (act->MadeSolidCollision() && distToWall < 3.f * xExtent)) { if (distToWall < 1.414f * xExtent || (act->MadeSolidCollision() && distToWall < 3.f * xExtent)) {
x4_state = x30_26_wallBounceRight ? pas::EJumpState::WallBounceRight : pas::EJumpState::WallBounceLeft; x4_state = x30_26_wallBounceRight ? pas::EJumpState::WallBounceRight : pas::EJumpState::WallBounceLeft;
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor);
return true; return true;
@ -963,7 +976,8 @@ void CBSJump::CheckForLand(CBodyController& bc, CStateManager& mgr) {
if (const TCastToPtr<CPatterned> act = bc.GetOwner()) { if (const TCastToPtr<CPatterned> act = bc.GetOwner()) {
if (act->MadeSolidCollision() || act->IsOnGround()) { if (act->MadeSolidCollision() || act->IsOnGround()) {
x4_state = pas::EJumpState::OutOfJump; x4_state = pas::EJumpState::OutOfJump;
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), CPASAnimParm::FromEnum(s32(x8_jumpType))); const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor);
} }
@ -971,7 +985,8 @@ void CBSJump::CheckForLand(CBodyController& bc, CStateManager& mgr) {
} }
void CBSJump::PlayJumpLoop(CStateManager& mgr, CBodyController& bc) { void CBSJump::PlayJumpLoop(CStateManager& mgr, CBodyController& bc) {
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(s32(x8_jumpType))); const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(1),
CPASAnimParm::FromEnum(s32(x8_jumpType)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 99.f) { if (best.first > 99.f) {
x4_state = pas::EJumpState::AmbushJump; x4_state = pas::EJumpState::AmbushJump;
@ -979,7 +994,7 @@ void CBSJump::PlayJumpLoop(CStateManager& mgr, CBodyController& bc) {
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} else { } else {
x4_state = pas::EJumpState::Loop; x4_state = pas::EJumpState::Loop;
const CPASAnimParmData loopParms(13, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData loopParms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType))); CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom());
} }
@ -1013,7 +1028,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa
} }
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EJumpState::Loop; x4_state = pas::EJumpState::Loop;
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType))); CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} else { } else {
@ -1045,7 +1060,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling); mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling);
x4_state = pas::EJumpState::Loop; x4_state = pas::EJumpState::Loop;
const CPASAnimParmData parms(13, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_jumpType))); CPASAnimParm::FromEnum(s32(x8_jumpType)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
x30_27_wallBounceComplete = true; x30_27_wallBounceComplete = true;
@ -1070,10 +1085,7 @@ pas::EAnimationState CBSJump::UpdateBody(float dt, CBodyController& bc, CStateMa
} }
bool CBSJump::ApplyAnimationDeltas() const { bool CBSJump::ApplyAnimationDeltas() const {
if (x4_state == pas::EJumpState::AmbushJump || x4_state == pas::EJumpState::Loop) { return !(x4_state == pas::EJumpState::AmbushJump || x4_state == pas::EJumpState::Loop);
return false;
}
return true;
} }
bool CBSJump::IsInAir(const CBodyController& bc) const { bool CBSJump::IsInAir(const CBodyController& bc) const {
@ -1089,12 +1101,12 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) {
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel(); angle.makeRel();
x8_knockAngle = angle.asDegrees(); x8_knockAngle = angle.asDegrees();
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1), CPASAnimParm::FromReal32(x8_knockAngle), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(-1),
CPASAnimParm::FromEnum(s32(x4_state))); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(14); const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Hurled);
xc_animSeries = hurledState->GetAnimParmData(best.second, 0).GetInt32Value(); xc_animSeries = hurledState->GetAnimParmData(best.second, 0).GetInt32Value();
mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling); mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Falling);
mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Jumped); mgr.SendScriptMsg(&bc.GetOwner(), kInvalidUniqueId, EScriptObjectMessage::Jumped);
@ -1132,8 +1144,8 @@ pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController
} }
void CBSHurled::Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledState state) { void CBSHurled::Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledState state) {
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries),
CPASAnimParm::FromEnum(s32(state))); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(state)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > FLT_EPSILON) { if (best.first > FLT_EPSILON) {
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
@ -1147,8 +1159,8 @@ void CBSHurled::Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledSta
} }
void CBSHurled::PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr) { void CBSHurled::PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr) {
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries),
CPASAnimParm::FromEnum(3)); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(3));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first <= FLT_EPSILON) { if (best.first <= FLT_EPSILON) {
@ -1161,12 +1173,12 @@ void CBSHurled::PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr)
} }
void CBSHurled::PlayLandAnimation(CBodyController& bc, CStateManager& mgr) { void CBSHurled::PlayLandAnimation(CBodyController& bc, CStateManager& mgr) {
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), CPASAnimParm::FromReal32(x8_knockAngle), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries),
CPASAnimParm::FromEnum(s32(x4_state))); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(14); const CPASAnimState* hurledState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Hurled);
bc.SetFallState(pas::EFallState(hurledState->GetAnimParmData(best.second, 3).GetEnumValue())); bc.SetFallState(pas::EFallState(hurledState->GetAnimParmData(best.second, 3).GetEnumValue()));
if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) { if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) {
mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); mgr.SendScriptMsg(act.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor);
@ -1220,7 +1232,7 @@ pas::EAnimationState CBSHurled::UpdateBody(float dt, CBodyController& bc, CState
switch (x4_state) { switch (x4_state) {
case pas::EHurledState::KnockIntoAir: { case pas::EHurledState::KnockIntoAir: {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries),
CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(1)); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(1));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
x4_state = pas::EHurledState::KnockLoop; x4_state = pas::EHurledState::KnockLoop;
@ -1244,7 +1256,7 @@ pas::EAnimationState CBSHurled::UpdateBody(float dt, CBodyController& bc, CState
case pas::EHurledState::StrikeWall: case pas::EHurledState::StrikeWall:
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EHurledState::StrikeWallFallLoop; x4_state = pas::EHurledState::StrikeWallFallLoop;
const CPASAnimParmData parms(14, CPASAnimParm::FromInt32(xc_animSeries), const CPASAnimParmData parms(pas::EAnimationState::Hurled, CPASAnimParm::FromInt32(xc_animSeries),
CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state))); CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
x28_landedDur = 0.f; x28_landedDur = 0.f;
@ -1289,14 +1301,14 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCSlideCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Slide)); const auto* cmd = static_cast<const CBCSlideCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Slide));
const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetSlideDirection()); const zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetSlideDirection());
const float angle = std::atan2(localDir.y(), localDir.x()); const float angle = std::atan2(localDir.y(), localDir.x());
const CPASAnimParmData parms(15, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())), const CPASAnimParmData parms(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(s32(cmd->GetSlideType())),
CPASAnimParm::FromReal32(zeus::radToDeg(angle))); CPASAnimParm::FromReal32(zeus::radToDeg(angle)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true); const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
const float timeRem = bc.GetAnimTimeRemaining(); const float timeRem = bc.GetAnimTimeRemaining();
if (timeRem > FLT_EPSILON) { if (timeRem > FLT_EPSILON) {
const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(15); const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(pas::EAnimationState::Slide);
const float animAngle = zeus::degToRad(slideState->GetAnimParmData(best.second, 1).GetReal32Value()); const float animAngle = zeus::degToRad(slideState->GetAnimParmData(best.second, 1).GetReal32Value());
const float delta1 = zeus::CRelAngle(angle - animAngle).asRel(); const float delta1 = zeus::CRelAngle(angle - animAngle).asRel();
const float flippedAngle = (delta1 > M_PIF) ? delta1 - 2.f * M_PIF : delta1; const float flippedAngle = (delta1 > M_PIF) ? delta1 - 2.f * M_PIF : delta1;
@ -1337,7 +1349,7 @@ pas::EAnimationState CBSSlide::UpdateBody(float dt, CBodyController& bc, CStateM
void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) { void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCTauntCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Taunt)); const auto* cmd = static_cast<const CBCTauntCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Taunt));
const CPASAnimParmData parms(16, CPASAnimParm::FromEnum(s32(cmd->GetTauntType()))); const CPASAnimParmData parms(pas::EAnimationState::Taunt, CPASAnimParm::FromEnum(s32(cmd->GetTauntType())));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
@ -1425,7 +1437,7 @@ void CBSCover::Start(CBodyController& bc, CStateManager& mgr) {
const auto* cmd = static_cast<const CBCCoverCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Cover)); const auto* cmd = static_cast<const CBCCoverCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Cover));
x8_coverDirection = cmd->GetDirection(); x8_coverDirection = cmd->GetDirection();
x4_state = pas::ECoverState::IntoCover; x4_state = pas::ECoverState::IntoCover;
const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_coverDirection))); CPASAnimParm::FromEnum(s32(x8_coverDirection)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const zeus::CQuaternion orientDelta = const zeus::CQuaternion orientDelta =
@ -1466,7 +1478,7 @@ pas::EAnimationState CBSCover::UpdateBody(float dt, CBodyController& bc, CStateM
case pas::ECoverState::IntoCover: case pas::ECoverState::IntoCover:
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::ECoverState::Cover; x4_state = pas::ECoverState::Cover;
const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_coverDirection))); CPASAnimParm::FromEnum(s32(x8_coverDirection)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} }
@ -1481,12 +1493,12 @@ pas::EAnimationState CBSCover::UpdateBody(float dt, CBodyController& bc, CStateM
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || xc_needsExit) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || xc_needsExit) {
xc_needsExit = false; xc_needsExit = false;
x4_state = pas::ECoverState::OutOfCover; x4_state = pas::ECoverState::OutOfCover;
const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_coverDirection))); CPASAnimParm::FromEnum(s32(x8_coverDirection)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::LeanFromCover)) { } else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::LeanFromCover)) {
x4_state = pas::ECoverState::Lean; x4_state = pas::ECoverState::Lean;
const CPASAnimParmData parms(19, CPASAnimParm::FromEnum(s32(x4_state)), const CPASAnimParmData parms(pas::EAnimationState::Cover, CPASAnimParm::FromEnum(s32(x4_state)),
CPASAnimParm::FromEnum(s32(x8_coverDirection))); CPASAnimParm::FromEnum(s32(x8_coverDirection)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
@ -1509,7 +1521,7 @@ void CBSWallHang::Start(CBodyController& bc, CStateManager& mgr) {
x4_state = pas::EWallHangState::IntoJump; x4_state = pas::EWallHangState::IntoJump;
x8_wpId = cmd->GetTarget(); x8_wpId = cmd->GetTarget();
x18_25_needsExit = false; x18_25_needsExit = false;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
@ -1534,7 +1546,7 @@ bool CBSWallHang::CheckForLand(CBodyController& bc, CStateManager& mgr) {
if (const TCastToPtr<CPatterned> ai = bc.GetOwner()) { if (const TCastToPtr<CPatterned> ai = bc.GetOwner()) {
if (ai->MadeSolidCollision() || ai->IsOnGround()) { if (ai->MadeSolidCollision() || ai->IsOnGround()) {
x4_state = pas::EWallHangState::DetachOutOfJump; x4_state = pas::EWallHangState::DetachOutOfJump;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
mgr.SendScriptMsg(ai.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor); mgr.SendScriptMsg(ai.GetPtr(), kInvalidUniqueId, EScriptObjectMessage::OnFloor);
return true; return true;
@ -1553,7 +1565,7 @@ bool CBSWallHang::CheckForWall(CBodyController& bc, CStateManager& mgr) {
if (magSq < 1.f || ai->MadeSolidCollision()) { if (magSq < 1.f || ai->MadeSolidCollision()) {
x4_state = pas::EWallHangState::IntoWallHang; x4_state = pas::EWallHangState::IntoWallHang;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
const zeus::CVector3f& target = wp ? wp->GetTranslation() : ai->GetTranslation(); const zeus::CVector3f& target = wp ? wp->GetTranslation() : ai->GetTranslation();
const CAnimPlaybackParms playParms(best.second, nullptr, &target, &bc.GetOwner().GetTransform(), const CAnimPlaybackParms playParms(best.second, nullptr, &target, &bc.GetOwner().GetTransform(),
@ -1586,7 +1598,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
if (st == pas::EAnimationState::Invalid) { if (st == pas::EAnimationState::Invalid) {
switch (x4_state) { switch (x4_state) {
case pas::EWallHangState::IntoJump: { case pas::EWallHangState::IntoJump: {
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(1)); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(1));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 0.f) { if (best.first > 0.f) {
x4_state = pas::EWallHangState::JumpArc; x4_state = pas::EWallHangState::JumpArc;
@ -1594,7 +1606,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} else { } else {
x4_state = pas::EWallHangState::JumpAirLoop; x4_state = pas::EWallHangState::JumpAirLoop;
const CPASAnimParmData loopParms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData loopParms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom());
} }
if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) { if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) {
@ -1616,7 +1628,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
SetLaunchVelocity(bc); SetLaunchVelocity(bc);
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EWallHangState::JumpAirLoop; x4_state = pas::EWallHangState::JumpAirLoop;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} else { } else {
CheckForWall(bc, mgr); CheckForWall(bc, mgr);
@ -1633,7 +1645,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
case pas::EWallHangState::IntoWallHang: { case pas::EWallHangState::IntoWallHang: {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EWallHangState::WallHang; x4_state = pas::EWallHangState::WallHang;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState)) { } else if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState)) {
x18_25_needsExit = true; x18_25_needsExit = true;
@ -1655,7 +1667,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
} }
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || x18_25_needsExit) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::ExitState) || x18_25_needsExit) {
x4_state = pas::EWallHangState::OutOfWallHang; x4_state = pas::EWallHangState::OutOfWallHang;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); bc.PlayBestAnimation(parms, *mgr.GetActiveRandom());
} }
FixInPlace(bc); FixInPlace(bc);
@ -1664,7 +1676,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
case pas::EWallHangState::Five: { case pas::EWallHangState::Five: {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EWallHangState::WallHang; x4_state = pas::EWallHangState::WallHang;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} }
FixInPlace(bc); FixInPlace(bc);
@ -1672,7 +1684,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
} }
case pas::EWallHangState::OutOfWallHang: { case pas::EWallHangState::OutOfWallHang: {
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(7)); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(7));
const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); const std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (best.first > 0.f) { if (best.first > 0.f) {
x4_state = pas::EWallHangState::OutOfWallHangTurn; x4_state = pas::EWallHangState::OutOfWallHangTurn;
@ -1680,7 +1692,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
bc.SetCurrentAnimation(playParms, false, false); bc.SetCurrentAnimation(playParms, false, false);
} else { } else {
x4_state = pas::EWallHangState::DetachJumpLoop; x4_state = pas::EWallHangState::DetachJumpLoop;
const CPASAnimParmData loopParms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData loopParms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(loopParms, *mgr.GetActiveRandom());
} }
if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) { if (const TCastToPtr<CPhysicsActor> act = bc.GetOwner()) {
@ -1701,7 +1713,7 @@ pas::EAnimationState CBSWallHang::UpdateBody(float dt, CBodyController& bc, CSta
SetLaunchVelocity(bc); SetLaunchVelocity(bc);
if (bc.IsAnimationOver()) { if (bc.IsAnimationOver()) {
x4_state = pas::EWallHangState::DetachJumpLoop; x4_state = pas::EWallHangState::DetachJumpLoop;
const CPASAnimParmData parms(20, CPASAnimParm::FromEnum(s32(x4_state))); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(s32(x4_state)));
bc.LoopBestAnimation(parms, *mgr.GetActiveRandom()); bc.LoopBestAnimation(parms, *mgr.GetActiveRandom());
} else { } else {
CheckForLand(bc, mgr); CheckForLand(bc, mgr);
@ -1923,7 +1935,8 @@ CBSBiPedLocomotion::CBSBiPedLocomotion(CActor& actor) {
for (int i = 0; i < 14; ++i) { for (int i = 0; i < 14; ++i) {
rstl::reserved_vector<std::pair<s32, float>, 8>& innerVec = x8_anims.emplace_back(); rstl::reserved_vector<std::pair<s32, float>, 8>& innerVec = x8_anims.emplace_back();
for (int j = 0; j < 8; ++j) { for (int j = 0; j < 8; ++j) {
const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(j), CPASAnimParm::FromEnum(i)); const CPASAnimParmData parms(pas::EAnimationState::WallHang, CPASAnimParm::FromEnum(j),
CPASAnimParm::FromEnum(i));
const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1); const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1);
float avgVel = 0.f; float avgVel = 0.f;
if (best.second != -1) { if (best.second != -1) {
@ -2159,7 +2172,8 @@ float CBSNewFlyerLocomotion::UpdateLocomotionAnimation(float dt, float velMag, C
CBSRestrictedLocomotion::CBSRestrictedLocomotion(CActor& actor) { CBSRestrictedLocomotion::CBSRestrictedLocomotion(CActor& actor) {
const CPASDatabase& pasDatabase = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = actor.GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
for (int i = 0; i < 14; ++i) { for (int i = 0; i < 14; ++i) {
const CPASAnimParmData parms(5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(i)); const CPASAnimParmData parms(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0),
CPASAnimParm::FromEnum(i));
const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1); const std::pair<float, s32> best = pasDatabase.FindBestAnimation(parms, -1);
x8_anims.push_back(best.second); x8_anims.push_back(best.second);
} }

View File

@ -48,321 +48,321 @@ CBodyStateInfo::CBodyStateInfo(CActor& actor, EBodyType type) {
x1c_additiveStates.emplace_back(pas::EAnimationState::AdditiveReaction, std::make_unique<CABSReaction>()); x1c_additiveStates.emplace_back(pas::EAnimationState::AdditiveReaction, std::make_unique<CABSReaction>());
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSRestrictedFlyerLocomotion>(actor); return std::make_unique<CBSRestrictedFlyerLocomotion>(actor);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSTurn>(); return std::make_unique<CBSTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupNewFlyerBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupNewFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSNewFlyerLocomotion>(actor); return std::make_unique<CBSNewFlyerLocomotion>(actor);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSTurn>(); return std::make_unique<CBSTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupWallWalkerBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupWallWalkerBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSWallWalkerLocomotion>(actor); return std::make_unique<CBSWallWalkerLocomotion>(actor);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSFlyerTurn>(); return std::make_unique<CBSFlyerTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupPitchableBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupPitchableBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSFlyerLocomotion>(actor, true); return std::make_unique<CBSFlyerLocomotion>(actor, true);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSFlyerTurn>(); return std::make_unique<CBSFlyerTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupFlyerBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSFlyerLocomotion>(actor, false); return std::make_unique<CBSFlyerLocomotion>(actor, false);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSFlyerTurn>(); return std::make_unique<CBSFlyerTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupRestrictedBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupRestrictedBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSRestrictedLocomotion>(actor); return std::make_unique<CBSRestrictedLocomotion>(actor);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSTurn>(); return std::make_unique<CBSTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
case 19: case pas::EAnimationState::Cover:
return std::make_unique<CBSCover>(); return std::make_unique<CBSCover>();
default: default:
return {}; return {};
} }
} }
std::unique_ptr<CBodyState> CBodyStateInfo::SetupBiPedalBodyStates(int stateId, CActor& actor) const { std::unique_ptr<CBodyState> CBodyStateInfo::SetupBiPedalBodyStates(pas::EAnimationState stateId, CActor& actor) const {
switch (stateId) { switch (stateId) {
case 0: case pas::EAnimationState::Fall:
return std::make_unique<CBSFall>(); return std::make_unique<CBSFall>();
case 1: case pas::EAnimationState::Getup:
return std::make_unique<CBSGetup>(); return std::make_unique<CBSGetup>();
case 2: case pas::EAnimationState::LieOnGround:
return std::make_unique<CBSLieOnGround>(actor); return std::make_unique<CBSLieOnGround>(actor);
case 3: case pas::EAnimationState::Step:
return std::make_unique<CBSStep>(); return std::make_unique<CBSStep>();
case 4: case pas::EAnimationState::Death:
return std::make_unique<CBSDie>(); return std::make_unique<CBSDie>();
case 5: case pas::EAnimationState::Locomotion:
return std::make_unique<CBSBiPedLocomotion>(actor); return std::make_unique<CBSBiPedLocomotion>(actor);
case 6: case pas::EAnimationState::KnockBack:
return std::make_unique<CBSKnockBack>(); return std::make_unique<CBSKnockBack>();
case 7: case pas::EAnimationState::MeleeAttack:
return std::make_unique<CBSAttack>(); return std::make_unique<CBSAttack>();
case 18: case pas::EAnimationState::ProjectileAttack:
return std::make_unique<CBSProjectileAttack>(); return std::make_unique<CBSProjectileAttack>();
case 9: case pas::EAnimationState::LoopAttack:
return std::make_unique<CBSLoopAttack>(); return std::make_unique<CBSLoopAttack>();
case 8: case pas::EAnimationState::Turn:
return std::make_unique<CBSTurn>(); return std::make_unique<CBSTurn>();
case 10: case pas::EAnimationState::LoopReaction:
return std::make_unique<CBSLoopReaction>(); return std::make_unique<CBSLoopReaction>();
case 11: case pas::EAnimationState::GroundHit:
return std::make_unique<CBSGroundHit>(); return std::make_unique<CBSGroundHit>();
case 12: case pas::EAnimationState::Generate:
return std::make_unique<CBSGenerate>(); return std::make_unique<CBSGenerate>();
case 13: case pas::EAnimationState::Jump:
return std::make_unique<CBSJump>(); return std::make_unique<CBSJump>();
case 14: case pas::EAnimationState::Hurled:
return std::make_unique<CBSHurled>(); return std::make_unique<CBSHurled>();
case 15: case pas::EAnimationState::Slide:
return std::make_unique<CBSSlide>(); return std::make_unique<CBSSlide>();
case 16: case pas::EAnimationState::Taunt:
return std::make_unique<CBSTaunt>(); return std::make_unique<CBSTaunt>();
case 17: case pas::EAnimationState::Scripted:
return std::make_unique<CBSScripted>(); return std::make_unique<CBSScripted>();
case 19: case pas::EAnimationState::Cover:
return std::make_unique<CBSCover>(); return std::make_unique<CBSCover>();
case 20: case pas::EAnimationState::WallHang:
return std::make_unique<CBSWallHang>(); return std::make_unique<CBSWallHang>();
default: default:
return {}; return {};

View File

@ -22,13 +22,13 @@ class CBodyStateInfo {
pas::EAnimationState x2c_additiveState = pas::EAnimationState::AdditiveIdle; pas::EAnimationState x2c_additiveState = pas::EAnimationState::AdditiveIdle;
float x30_maxPitch = 0.f; float x30_maxPitch = 0.f;
bool x34_24_changeLocoAtEndOfAnimOnly; bool x34_24_changeLocoAtEndOfAnimOnly;
std::unique_ptr<CBodyState> SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupRestrictedFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupNewFlyerBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupNewFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupWallWalkerBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupWallWalkerBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupPitchableBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupPitchableBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupFlyerBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupFlyerBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupRestrictedBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupRestrictedBodyStates(pas::EAnimationState stateId, CActor& actor) const;
std::unique_ptr<CBodyState> SetupBiPedalBodyStates(int stateId, CActor& actor) const; std::unique_ptr<CBodyState> SetupBiPedalBodyStates(pas::EAnimationState stateId, CActor& actor) const;
public: public:
CBodyStateInfo(CActor& actor, EBodyType type); CBodyStateInfo(CActor& actor, EBodyType type);

View File

@ -2,7 +2,7 @@
namespace urde { namespace urde {
CPASAnimParmData::CPASAnimParmData(s32 stateId, const CPASAnimParm& parm1, const CPASAnimParm& parm2, CPASAnimParmData::CPASAnimParmData(pas::EAnimationState stateId, const CPASAnimParm& parm1, const CPASAnimParm& parm2,
const CPASAnimParm& parm3, const CPASAnimParm& parm4, const CPASAnimParm& parm5, const CPASAnimParm& parm3, const CPASAnimParm& parm4, const CPASAnimParm& parm5,
const CPASAnimParm& parm6, const CPASAnimParm& parm7, const CPASAnimParm& parm8) const CPASAnimParm& parm6, const CPASAnimParm& parm7, const CPASAnimParm& parm8)
: x0_stateId(stateId) { : x0_stateId(stateId) {

View File

@ -2,17 +2,18 @@
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp" #include "Runtime/rstl.hpp"
#include "Runtime/Character/CharacterCommon.hpp"
#include "Runtime/Character/CPASAnimParm.hpp" #include "Runtime/Character/CPASAnimParm.hpp"
namespace urde { namespace urde {
class CPASAnimParmData { class CPASAnimParmData {
s32 x0_stateId; pas::EAnimationState x0_stateId;
rstl::reserved_vector<CPASAnimParm, 8> x4_parms; rstl::reserved_vector<CPASAnimParm, 8> x4_parms;
public: public:
CPASAnimParmData() = default; CPASAnimParmData() = default;
explicit CPASAnimParmData(s32 stateId, const CPASAnimParm& parm1 = CPASAnimParm::NoParameter(), explicit CPASAnimParmData(pas::EAnimationState stateId, const CPASAnimParm& parm1 = CPASAnimParm::NoParameter(),
const CPASAnimParm& parm2 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm2 = CPASAnimParm::NoParameter(),
const CPASAnimParm& parm3 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm3 = CPASAnimParm::NoParameter(),
const CPASAnimParm& parm4 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm4 = CPASAnimParm::NoParameter(),
@ -21,9 +22,9 @@ public:
const CPASAnimParm& parm7 = CPASAnimParm::NoParameter(), const CPASAnimParm& parm7 = CPASAnimParm::NoParameter(),
const CPASAnimParm& parm8 = CPASAnimParm::NoParameter()); const CPASAnimParm& parm8 = CPASAnimParm::NoParameter());
s32 GetStateId() const { return x0_stateId; } pas::EAnimationState GetStateId() const { return x0_stateId; }
const rstl::reserved_vector<CPASAnimParm, 8>& GetAnimParmData() const { return x4_parms; } const rstl::reserved_vector<CPASAnimParm, 8>& GetAnimParmData() const { return x4_parms; }
static auto NoParameters(s32 stateId) { return CPASAnimParmData(stateId); } static auto NoParameters(pas::EAnimationState stateId) { return CPASAnimParmData(stateId); }
}; };
} // namespace urde } // namespace urde

View File

@ -2,6 +2,7 @@
#include "Runtime/CRandom16.hpp" #include "Runtime/CRandom16.hpp"
#include "Runtime/rstl.hpp" #include "Runtime/rstl.hpp"
#include "Runtime/Character/CharacterCommon.hpp"
#include "Runtime/Character/CPASAnimParmData.hpp" #include "Runtime/Character/CPASAnimParmData.hpp"
#include <algorithm> #include <algorithm>
@ -13,7 +14,7 @@
namespace urde { namespace urde {
CPASAnimState::CPASAnimState(CInputStream& in) { CPASAnimState::CPASAnimState(CInputStream& in) {
x0_id = in.readUint32Big(); x0_id = static_cast<pas::EAnimationState>(in.readUint32Big());
u32 parmCount = in.readUint32Big(); u32 parmCount = in.readUint32Big();
u32 animCount = in.readUint32Big(); u32 animCount = in.readUint32Big();
@ -58,7 +59,7 @@ CPASAnimState::CPASAnimState(CInputStream& in) {
} }
} }
CPASAnimState::CPASAnimState(int stateId) : x0_id(stateId) {} CPASAnimState::CPASAnimState(pas::EAnimationState stateId) : x0_id(stateId) {}
CPASAnimParm CPASAnimState::GetAnimParmData(s32 animId, size_t parmIdx) const { CPASAnimParm CPASAnimState::GetAnimParmData(s32 animId, size_t parmIdx) const {
const auto search = rstl::binary_find(x14_anims.cbegin(), x14_anims.cend(), animId, const auto search = rstl::binary_find(x14_anims.cbegin(), x14_anims.cend(), animId,

View File

@ -4,6 +4,7 @@
#include <vector> #include <vector>
#include "Runtime/IOStreams.hpp" #include "Runtime/IOStreams.hpp"
#include "Runtime/Character/CharacterCommon.hpp"
#include "Runtime/Character/CPASAnimInfo.hpp" #include "Runtime/Character/CPASAnimInfo.hpp"
#include "Runtime/Character/CPASParmInfo.hpp" #include "Runtime/Character/CPASParmInfo.hpp"
@ -11,7 +12,7 @@ namespace urde {
class CRandom16; class CRandom16;
class CPASAnimParmData; class CPASAnimParmData;
class CPASAnimState { class CPASAnimState {
s32 x0_id; pas::EAnimationState x0_id;
std::vector<CPASParmInfo> x4_parms; std::vector<CPASParmInfo> x4_parms;
std::vector<CPASAnimInfo> x14_anims; std::vector<CPASAnimInfo> x14_anims;
mutable std::vector<s32> x24_selectionCache; mutable std::vector<s32> x24_selectionCache;
@ -24,8 +25,8 @@ class CPASAnimState {
public: public:
explicit CPASAnimState(CInputStream& in); explicit CPASAnimState(CInputStream& in);
explicit CPASAnimState(int stateId); explicit CPASAnimState(pas::EAnimationState stateId);
s32 GetStateId() const { return x0_id; } pas::EAnimationState GetStateId() const { return x0_id; }
size_t GetNumAnims() const { return x14_anims.size(); } size_t GetNumAnims() const { return x14_anims.size(); }
bool HasAnims() const { return !x14_anims.empty(); } bool HasAnims() const { return !x14_anims.empty(); }
CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) const; CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) const;

View File

@ -24,7 +24,7 @@ public:
std::pair<float, s32> FindBestAnimation(const CPASAnimParmData& data, CRandom16& rand, s32 ignoreAnim) const; std::pair<float, s32> FindBestAnimation(const CPASAnimParmData& data, CRandom16& rand, s32 ignoreAnim) const;
s32 GetDefaultState() const { return x10_defaultState; } s32 GetDefaultState() const { return x10_defaultState; }
size_t GetNumAnimStates() const { return x0_states.size(); } size_t GetNumAnimStates() const { return x0_states.size(); }
const CPASAnimState* GetAnimState(s32 id) const { const CPASAnimState* GetAnimState(pas::EAnimationState id) const {
for (const CPASAnimState& state : x0_states) for (const CPASAnimState& state : x0_states)
if (id == state.GetStateId()) if (id == state.GetStateId())
return &state; return &state;
@ -39,7 +39,7 @@ public:
return &x0_states[index]; return &x0_states[index];
} }
bool HasState(s32 id) const { bool HasState(pas::EAnimationState id) const {
const auto& st = std::find_if(x0_states.begin(), x0_states.end(), const auto& st = std::find_if(x0_states.begin(), x0_states.end(),
[&id](const CPASAnimState& other) -> bool { return other.GetStateId() == id; }); [&id](const CPASAnimState& other) -> bool { return other.GetStateId() == id; });
return st != x0_states.end(); return st != x0_states.end();

View File

@ -25,31 +25,31 @@ enum class ELocomotionAnim { Invalid = -1, Idle, Walk, Run, BackUp, StrafeLeft,
enum class EAnimationState { enum class EAnimationState {
Invalid = -1, Invalid = -1,
Fall, Fall = 0,
Getup, Getup = 1,
LieOnGround, LieOnGround = 2,
Step, Step = 3,
Death, Death = 4,
Locomotion, Locomotion = 5,
KnockBack, KnockBack = 6,
MeleeAttack, MeleeAttack = 7,
Turn, Turn = 8,
LoopAttack, LoopAttack = 9,
LoopReaction, LoopReaction = 10,
GroundHit, GroundHit = 11,
Generate, Generate = 12,
Jump, Jump = 13,
Hurled, Hurled = 14,
Slide, Slide = 15,
Taunt, Taunt = 16,
Scripted, Scripted = 17,
ProjectileAttack, ProjectileAttack = 18,
Cover, Cover = 19,
WallHang, WallHang = 20,
AdditiveIdle, AdditiveIdle = 21,
AdditiveAim, AdditiveAim = 22,
AdditiveFlinch, AdditiveFlinch = 23,
AdditiveReaction AdditiveReaction = 24
}; };
enum class EHurledState { enum class EHurledState {
@ -64,7 +64,7 @@ enum class EHurledState {
Seven Seven
}; };
enum class EFallState { Invalid = -1, Zero, One , Two}; enum class EFallState { Invalid = -1, Zero, One, Two };
enum class EReactionType { Invalid = -1, Zero, One, Two, Three }; enum class EReactionType { Invalid = -1, Zero, One, Two, Three };

View File

@ -97,7 +97,7 @@ CBabygoth::CBabygoth(TUniqueId uid, std::string_view name, const CEntityInfo& in
x460_knockBackController.SetEnableShock(true); x460_knockBackController.SetEnableShock(true);
x460_knockBackController.SetEnableExplodeDeath(true); x460_knockBackController.SetEnableExplodeDeath(true);
x8d4_stepBackwardDist = x8d4_stepBackwardDist =
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) *
GetModelData()->GetScale().y(); // B_backward_sheegoth GetModelData()->GetScale().y(); // B_backward_sheegoth
xa08_noShellModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo()); xa08_noShellModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo());
MakeThermalColdAndHot(); MakeThermalColdAndHot();

View File

@ -32,10 +32,10 @@ CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info,
, x7ac_tailVuln(tailVuln) , x7ac_tailVuln(tailVuln)
, x814_attackDelayTimer(initialAttackDelay) , x814_attackDelayTimer(initialAttackDelay)
, x834_retreatTime(retreatTime) { , x834_retreatTime(retreatTime) {
x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1))); x5a0_headbuttDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(1)));
x5a4_jumpBackwardDist = x5a4_jumpBackwardDist =
x64_modelData->GetScale().y() * x64_modelData->GetScale().y() *
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0)));
MakeThermalColdAndHot(); MakeThermalColdAndHot();
if (x3fc_flavor == EFlavorType::One) if (x3fc_flavor == EFlavorType::One)
x460_knockBackController.SetLocomotionDuringElectrocution(true); x460_knockBackController.SetLocomotionDuringElectrocution(true);

View File

@ -105,11 +105,11 @@ CChozoGhost::CChozoGhost(TUniqueId uid, std::string_view name, const CEntityInfo
x578_.Token().Lock(); x578_.Token().Lock();
x5a0_.Token().Lock(); x5a0_.Token().Lock();
x668_ = GetModelData()->GetScale().z() * x668_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(13, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(0)));
x66c_ = GetModelData()->GetScale().z() * x66c_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(15, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Slide, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f)));
x670_ = GetModelData()->GetScale().z() * x670_ = GetModelData()->GetScale().z() *
GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(1))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(1)));
if (projectileVisorEffect.IsValid()) if (projectileVisorEffect.IsValid())
x640_projectileVisor = g_SimplePool->GetObj({SBIG('PART'), projectileVisorEffect}); x640_projectileVisor = g_SimplePool->GetObj({SBIG('PART'), projectileVisorEffect});

View File

@ -322,7 +322,7 @@ CFlyingPirate::CFlyingPirate(TUniqueId uid, std::string_view name, const CEntity
x864_missileSegments.push_back(animData->GetLocatorSegId("L_Missile_LCTR"sv)); x864_missileSegments.push_back(animData->GetLocatorSegId("L_Missile_LCTR"sv));
x864_missileSegments.push_back(animData->GetLocatorSegId("R_Missile_LCTR"sv)); x864_missileSegments.push_back(animData->GetLocatorSegId("R_Missile_LCTR"sv));
x850_height = modelData->GetScale().x() * x850_height = modelData->GetScale().x() *
GetAnimationDistance(CPASAnimParmData{3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)}); GetAnimationDistance(CPASAnimParmData{pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)});
if (x568_data.xd8_particleGen1.IsValid() && x568_data.xdc_particleGen2.IsValid() && if (x568_data.xd8_particleGen1.IsValid() && x568_data.xdc_particleGen2.IsValid() &&
x568_data.xe0_particleGen3.IsValid()) { x568_data.xe0_particleGen3.IsValid()) {
x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xd8_particleGen1})); x65c_particleGenDescs.push_back(g_SimplePool->GetObj({SBIG('PART'), x568_data.xd8_particleGen1}));
@ -747,7 +747,7 @@ void CFlyingPirate::FireProjectile(CStateManager& mgr, float dt) {
} }
if (projectileFired) { if (projectileFired) {
const std::pair<float, s32> anim = x450_bodyController->GetPASDatabase().FindBestAnimation( const std::pair<float, s32> anim = x450_bodyController->GetPASDatabase().FindBestAnimation(
CPASAnimParmData{24, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1);
if (anim.first > 0.f) { if (anim.first > 0.f) {
GetModelData()->GetAnimationData()->AddAdditiveAnimation(anim.second, 1.f, false, true); GetModelData()->GetAnimationData()->AddAdditiveAnimation(anim.second, 1.f, false, true);
} }

View File

@ -32,7 +32,8 @@ CGrenadeLauncher::CGrenadeLauncher(TUniqueId uid, std::string_view name, const C
GetModelData()->EnableLooping(true); GetModelData()->EnableLooping(true);
const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase();
for (size_t i = 0; i < x3c8_animIds.size(); ++i) { for (size_t i = 0; i < x3c8_animIds.size(); ++i) {
const auto result = pasDatabase.FindBestAnimation(CPASAnimParmData{22, CPASAnimParm::FromEnum(int(i))}, -1); const auto result = pasDatabase.FindBestAnimation(
CPASAnimParmData{pas::EAnimationState::AdditiveAim, CPASAnimParm::FromEnum(int(i))}, -1);
x3c8_animIds[i] = result.second; x3c8_animIds[i] = result.second;
} }
} }
@ -286,7 +287,9 @@ void CGrenadeLauncher::UpdateStartAnimation() {
constexpr std::array arr{0, 3}; constexpr std::array arr{0, 3};
const auto anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation( const auto anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation(
CPASAnimParmData{5, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(arr[x258_started])}, -1); CPASAnimParmData{pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0),
CPASAnimParm::FromEnum(arr[x258_started])},
-1);
if (anim.first > 0.f) { if (anim.first > 0.f) {
animData->SetAnimation({anim.second, -1, 1.f, true}, false); animData->SetAnimation({anim.second, -1, 1.f, true}, false);
modelData->EnableLooping(true); modelData->EnableLooping(true);
@ -300,7 +303,8 @@ void CGrenadeLauncher::LaunchGrenade(CStateManager& mgr) {
return; return;
} }
const auto& anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation(CPASAnimParmData{23}, -1); const auto& anim = animData->GetCharacterInfo().GetPASDatabase().FindBestAnimation(
CPASAnimParmData{pas::EAnimationState::AdditiveFlinch}, -1);
if (anim.first > 0.f) { if (anim.first > 0.f) {
animData->AddAdditiveAnimation(anim.second, 1.f, false, true); animData->AddAdditiveAnimation(anim.second, 1.f, false, true);
const zeus::CVector3f origin = const zeus::CVector3f origin =

View File

@ -112,7 +112,8 @@ CIceSheegoth::CIceSheegoth(TUniqueId uid, std::string_view name, const CEntityIn
x460_knockBackController.SetX82_24(false); x460_knockBackController.SetX82_24(false);
x460_knockBackController.SetEnableLaggedBurnDeath(false); x460_knockBackController.SetEnableLaggedBurnDeath(false);
x460_knockBackController.SetEnableExplodeDeath(false); x460_knockBackController.SetEnableExplodeDeath(false);
x950_ = GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) * x950_ = GetAnimationDistance(
CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(1), CPASAnimParm::FromEnum(0))) *
GetModelData()->GetScale().y(); GetModelData()->GetScale().y();
xa9c_->SetGlobalScale(GetModelData()->GetScale()); xa9c_->SetGlobalScale(GetModelData()->GetScale());
xab0_->SetGlobalScale(GetModelData()->GetScale()); xab0_->SetGlobalScale(GetModelData()->GetScale());

View File

@ -89,8 +89,8 @@ CMetroid::CMetroid(TUniqueId uid, std::string_view name, EFlavorType flavor, con
, x81c_patternedInfo(pInfo) , x81c_patternedInfo(pInfo)
, x954_actParams(aParms) , x954_actParams(aParms)
, x9bc_parent(other) { , x9bc_parent(other) {
x808_loopAttackDistance = x808_loopAttackDistance = GetAnimationDistance(
GetAnimationDistance(CPASAnimParmData{9, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(3)}); CPASAnimParmData{pas::EAnimationState::LoopAttack, CPASAnimParm::FromEnum(2), CPASAnimParm::FromEnum(3)});
UpdateTouchBounds(); UpdateTouchBounds();
SetCoefficientOfRestitutionModifier(0.9f); SetCoefficientOfRestitutionModifier(0.9f);
x460_knockBackController.SetX82_24(false); x460_knockBackController.SetX82_24(false);

View File

@ -283,7 +283,8 @@ CRidley::CRidley(TUniqueId uid, std::string_view name, const CEntityInfo& info,
} }
xae4_ = GetModelData()->GetScale().x() * xae4_ = GetModelData()->GetScale().x() *
GetAnimationDistance(CPASAnimParmData(7, CPASAnimParm::FromEnum(4), CPASAnimParm::FromEnum(3))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::MeleeAttack, CPASAnimParm::FromEnum(4),
CPASAnimParm::FromEnum(3)));
x460_knockBackController.SetAnimationStateRange(EKnockBackAnimationState::Flinch, EKnockBackAnimationState::Flinch); x460_knockBackController.SetAnimationStateRange(EKnockBackAnimationState::Flinch, EKnockBackAnimationState::Flinch);
x460_knockBackController.SetEnableBurn(false); x460_knockBackController.SetEnableBurn(false);
x460_knockBackController.SetEnableFreeze(false); x460_knockBackController.SetEnableFreeze(false);

View File

@ -416,10 +416,10 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn
if (!x634_29_onlyAttackInRange) { if (!x634_29_onlyAttackInRange) {
x7a4_intoJumpDist = x7a4_intoJumpDist =
GetAnimationDistance(CPASAnimParmData(13, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(0))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Jump, CPASAnimParm::FromEnum(0), CPASAnimParm::FromEnum(0)));
x848_dodgeDist = GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1))); x848_dodgeDist = GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(1)));
x84c_breakDodgeDist = x84c_breakDodgeDist =
GetAnimationDistance(CPASAnimParmData(3, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(2))); GetAnimationDistance(CPASAnimParmData(pas::EAnimationState::Step, CPASAnimParm::FromEnum(3), CPASAnimParm::FromEnum(2)));
} else { } else {
x450_bodyController->BodyStateInfo().SetLocoAnimChangeAtEndOfAnimOnly(true); x450_bodyController->BodyStateInfo().SetLocoAnimChangeAtEndOfAnimOnly(true);
} }
@ -588,7 +588,7 @@ bool CSpacePirate::FireProjectile(float dt, CStateManager& mgr) {
} }
if (ret) { if (ret) {
const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation( const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation(
CPASAnimParmData{24, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); CPASAnimParmData{pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1);
if (bestAnim.first > 0.f) { if (bestAnim.first > 0.f) {
x64_modelData->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true); x64_modelData->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true);
} }
@ -1847,7 +1847,7 @@ void CSpacePirate::Taunt(CStateManager& mgr, EStateMsg msg, float dt) {
bool withOtherPirate = true; bool withOtherPirate = true;
if (x634_27_melee) { if (x634_27_melee) {
const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation( const auto bestAnim = x450_bodyController->GetPASDatabase().FindBestAnimation(
CPASAnimParmData{16, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1); CPASAnimParmData{pas::EAnimationState::Taunt, CPASAnimParm::FromEnum(2)}, *mgr.GetActiveRandom(), -1);
if (bestAnim.first > 0.f) { if (bestAnim.first > 0.f) {
withOtherPirate = false; withOtherPirate = false;
x760_taunt = pas::ETauntType::Two; x760_taunt = pas::ETauntType::Two;

View File

@ -46,7 +46,8 @@ s32 CGSComboFire::SetAnim(CAnimData& data, s32 gunId, s32 loopState, CStateManag
useLoopState = loopState; useLoopState = loopState;
x10_25_idle = false; x10_25_idle = false;
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
CPASAnimParmData parms(4, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromEnum(useLoopState)); CPASAnimParmData parms(pas::EAnimationState::Death, CPASAnimParm::FromInt32(gunId),
CPASAnimParm::FromEnum(useLoopState));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x10_24_over = false; x10_24_over = false;
xc_gunId = gunId; xc_gunId = gunId;

View File

@ -12,10 +12,10 @@ bool CGSFidget::Update(CAnimData& data, float dt, CStateManager& mgr) {
s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) { s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) {
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), CPASAnimParmData parms(pas::EAnimationState::Getup, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId),
CPASAnimParm::FromInt32(animSet)); CPASAnimParm::FromInt32(animSet));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
bool loop = pas.GetAnimState(1)->GetAnimParmData(anim.second, 3).GetBoolValue(); bool loop = pas.GetAnimState(pas::EAnimationState::Getup)->GetAnimParmData(anim.second, 3).GetBoolValue();
x14_gunId = gunId; x14_gunId = gunId;
x18_animSet = animSet; x18_animSet = animSet;
if (anim.second != -1) { if (anim.second != -1) {
@ -28,7 +28,7 @@ s32 CGSFidget::SetAnim(CAnimData& data, s32 type, s32 gunId, s32 animSet, CState
} }
void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) { void CGSFidget::LoadAnimAsync(CAnimData& data, s32 type, s32 gunId, s32 animSet, CStateManager& mgr) {
CPASAnimParmData parms(1, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId), CPASAnimParmData parms(pas::EAnimationState::Getup, CPASAnimParm::FromEnum(type), CPASAnimParm::FromInt32(gunId),
CPASAnimParm::FromInt32(animSet)); CPASAnimParm::FromInt32(animSet));
auto anim = data.GetCharacterInfo().GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = data.GetCharacterInfo().GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
if (anim.second != -1) if (anim.second != -1)

View File

@ -36,11 +36,11 @@ s32 CGSFreeLook::SetAnim(CAnimData& data, s32 gunId, s32 setId, s32 loopState, C
useLoopState = loopState; useLoopState = loopState;
x14_idle = false; x14_idle = false;
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
CPASAnimParmData parms(3, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId), CPASAnimParmData parms(pas::EAnimationState::Step, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId),
CPASAnimParm::FromEnum(useLoopState)); CPASAnimParm::FromEnum(useLoopState));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
xc_gunId = gunId; xc_gunId = gunId;
x10_setId = pas.GetAnimState(3)->GetAnimParmData(anim.second, 1).GetInt32Value(); x10_setId = pas.GetAnimState(pas::EAnimationState::Step)->GetAnimParmData(anim.second, 1).GetInt32Value();
x8_loopState = useLoopState; x8_loopState = useLoopState;
if (delay != 0.f) { if (delay != 0.f) {
x0_delay = delay; x0_delay = delay;

View File

@ -48,8 +48,9 @@ void CGunController::EnterStruck(CStateManager& mgr, float angle, bool bigStrike
} }
const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase();
CPASAnimParmData parms(2, CPASAnimParm::FromInt32(x4_freeLook.GetGunId()), CPASAnimParm::FromReal32(angle), CPASAnimParmData parms(pas::EAnimationState::LieOnGround, CPASAnimParm::FromInt32(x4_freeLook.GetGunId()),
CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(b2)); CPASAnimParm::FromReal32(angle), CPASAnimParm::FromBool(bigStrike),
CPASAnimParm::FromBool(b2));
std::pair<float, s32> anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x0_modelData.GetAnimationData()->EnableLooping(false); x0_modelData.GetAnimationData()->EnableLooping(false);
CAnimPlaybackParms aparms(anim.second, -1, 1.f, true); CAnimPlaybackParms aparms(anim.second, -1, 1.f, true);
@ -75,7 +76,7 @@ void CGunController::EnterIdle(CStateManager& mgr) {
} }
const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase();
CPASAnimParmData parms(5, parm); CPASAnimParmData parms(pas::EAnimationState::Locomotion, parm);
std::pair<float, s32> anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> anim = pasDatabase.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
x0_modelData.GetAnimationData()->EnableLooping(false); x0_modelData.GetAnimationData()->EnableLooping(false);
CAnimPlaybackParms aparms(anim.second, -1, 1.f, true); CAnimPlaybackParms aparms(anim.second, -1, 1.f, true);
@ -161,7 +162,8 @@ void CGunController::ReturnToDefault(CStateManager& mgr, float dt, bool setState
void CGunController::ReturnToBasePosition(CStateManager& mgr, float) { void CGunController::ReturnToBasePosition(CStateManager& mgr, float) {
const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase(); const CPASDatabase& pasDatabase = x0_modelData.GetAnimationData()->GetCharacterInfo().GetPASDatabase();
std::pair<float, s32> anim = pasDatabase.FindBestAnimation(CPASAnimParmData(6), *mgr.GetActiveRandom(), -1); std::pair<float, s32> anim =
pasDatabase.FindBestAnimation(CPASAnimParmData(pas::EAnimationState::KnockBack), *mgr.GetActiveRandom(), -1);
x0_modelData.GetAnimationData()->EnableLooping(false); x0_modelData.GetAnimationData()->EnableLooping(false);
CAnimPlaybackParms parms(anim.second, -1, 1.f, true); CAnimPlaybackParms parms(anim.second, -1, 1.f, true);
x0_modelData.GetAnimationData()->SetAnimation(parms, false); x0_modelData.GetAnimationData()->SetAnimation(parms, false);

View File

@ -22,19 +22,19 @@ bool CGunMotion::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr
bool loop = true; bool loop = true;
switch (state) { switch (state) {
case SamusGun::EAnimationState::Wander: { case SamusGun::EAnimationState::Wander: {
CPASAnimParmData parms((s32(state))); CPASAnimParmData parms((pas::EAnimationState(state)));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
animId = anim.second; animId = anim.second;
break; break;
} }
case SamusGun::EAnimationState::Idle: { case SamusGun::EAnimationState::Idle: {
CPASAnimParmData parms(s32(state), CPASAnimParm::FromEnum(0)); CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromEnum(0));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
animId = anim.second; animId = anim.second;
break; break;
} }
case SamusGun::EAnimationState::Struck: { case SamusGun::EAnimationState::Struck: {
CPASAnimParmData parms(s32(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle), CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle),
CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(false)); CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(false));
auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); auto anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
animId = anim.second; animId = anim.second;

View File

@ -494,8 +494,8 @@ void CKnockBackController::DoKnockBackAnimation(const zeus::CVector3f& backVec,
break; break;
} }
case EKnockBackAnimationState::Flinch: { case EKnockBackAnimationState::Flinch: {
const std::pair<float, s32> bestAnim = const std::pair<float, s32> bestAnim = parent.GetBodyController()->GetPASDatabase().FindBestAnimation(
parent.GetBodyController()->GetPASDatabase().FindBestAnimation(CPASAnimParmData(23), *mgr.GetActiveRandom(), -1); CPASAnimParmData(pas::EAnimationState::AdditiveFlinch), *mgr.GetActiveRandom(), -1);
if (bestAnim.first > 0.f) { if (bestAnim.first > 0.f) {
parent.GetModelData()->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true); parent.GetModelData()->GetAnimationData()->AddAdditiveAnimation(bestAnim.second, 1.f, false, true);
x64_flinchRemTime = x64_flinchRemTime =

View File

@ -1024,8 +1024,8 @@ void CPatterned::BuildBodyController(EBodyType bodyType) {
} }
x450_bodyController = std::make_unique<CBodyController>(*this, x3b8_turnSpeed, bodyType); x450_bodyController = std::make_unique<CBodyController>(*this, x3b8_turnSpeed, bodyType);
auto anim = auto anim = x450_bodyController->GetPASDatabase().FindBestAnimation(
x450_bodyController->GetPASDatabase().FindBestAnimation(CPASAnimParmData(24, CPASAnimParm::FromEnum(0)), -1); CPASAnimParmData(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(0)), -1);
x460_knockBackController.x81_26_enableShock = anim.first > 0.f; x460_knockBackController.x81_26_enableShock = anim.first > 0.f;
} }

View File

@ -439,10 +439,11 @@ void CScriptGunTurret::LaunchProjectile(CStateManager& mgr) {
GetAreaIdAlways(), GetUniqueId(), kInvalidUniqueId, EProjectileAttrib::None, false, GetAreaIdAlways(), GetUniqueId(), kInvalidUniqueId, EProjectileAttrib::None, false,
zeus::skOne3f, x458_visorEffectDesc, x2d4_data.GetVisorSoundId(), false); zeus::skOne3f, x458_visorEffectDesc, x2d4_data.GetVisorSoundId(), false);
mgr.AddObject(proj); mgr.AddObject(proj);
const auto pair = const auto pair = x64_modelData->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(
x64_modelData->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( CPASAnimParmData(pas::EAnimationState::ProjectileAttack, CPASAnimParm::FromEnum(1),
CPASAnimParmData(18, CPASAnimParm::FromEnum(1), CPASAnimParm::FromReal32(90.f), CPASAnimParm::FromReal32(90.f),
CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])), -1); CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])),
-1);
if (pair.first > 0.f) { if (pair.first > 0.f) {
x64_modelData->EnableLooping(false); x64_modelData->EnableLooping(false);
x64_modelData->GetAnimationData()->SetAnimation(CAnimPlaybackParms(pair.second, -1, 1.f, true), false); x64_modelData->GetAnimationData()->SetAnimation(CAnimPlaybackParms(pair.second, -1, 1.f, true), false);
@ -451,7 +452,7 @@ void CScriptGunTurret::LaunchProjectile(CStateManager& mgr) {
void CScriptGunTurret::PlayAdditiveFlinchAnimation(CStateManager& mgr) { void CScriptGunTurret::PlayAdditiveFlinchAnimation(CStateManager& mgr) {
const auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( const auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(
CPASAnimParmData(23), *mgr.GetActiveRandom(), -1); CPASAnimParmData(pas::EAnimationState::AdditiveFlinch), *mgr.GetActiveRandom(), -1);
if (pair.first > 0.f) { if (pair.first > 0.f) {
GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, false, true); GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, false, true);
} }
@ -727,7 +728,7 @@ void CScriptGunTurret::UpdateTurretAnimation() {
return; return;
} }
const auto parmData = CPASAnimParmData(5, CPASAnimParm::FromEnum(0), const auto parmData = CPASAnimParmData(pas::EAnimationState::Locomotion, CPASAnimParm::FromEnum(0),
CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)])); CPASAnimParm::FromEnum(skStateToLocoTypeLookup[size_t(x520_state)]));
const auto pair = const auto pair =
GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(parmData, -1); GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(parmData, -1);
@ -1214,7 +1215,8 @@ void CScriptGunTurret::PlayAdditiveChargingAnimation(CStateManager& mgr) {
} }
const auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation( const auto pair = GetModelData()->GetAnimationData()->GetCharacterInfo().GetPASDatabase().FindBestAnimation(
CPASAnimParmData(24, CPASAnimParm::FromEnum(2)), *mgr.GetActiveRandom(), -1); CPASAnimParmData(pas::EAnimationState::AdditiveReaction, CPASAnimParm::FromEnum(2)), *mgr.GetActiveRandom(),
-1);
if (pair.first > 0.f) { if (pair.first > 0.f) {
x55c_additiveChargeAnim = pair.second; x55c_additiveChargeAnim = pair.second;
GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, true, false); GetModelData()->GetAnimationData()->AddAdditiveAnimation(pair.second, 1.f, true, false);

View File

@ -328,7 +328,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
std::stringstream out; std::stringstream out;
int nextTex = 0; int nextTex = 0;
int nextTCG = 3; int nextTCG = 3;
int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; int bumpMapUv = -1;
int envBumpMapUv = -1;
int envMapUv = -1;
int lightmapUv = -1;
out << "#define TEXTURE_DECLS "; out << "#define TEXTURE_DECLS ";
if (info.m_hasPatternTex1) if (info.m_hasPatternTex1)

View File

@ -364,7 +364,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
int nextTex = 0; int nextTex = 0;
int nextTCG = 3; int nextTCG = 3;
int nextMtx = 4; int nextMtx = 4;
int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; int bumpMapUv = -1;
int envBumpMapUv = -1;
int envMapUv = -1;
int lightmapUv = -1;
out << "#define TEXTURE_DECLS "; out << "#define TEXTURE_DECLS ";
if (info.m_hasPatternTex1) if (info.m_hasPatternTex1)

View File

@ -362,7 +362,10 @@ static std::string _BuildFS(const SFluidPlaneShaderInfo& info) {
std::stringstream out; std::stringstream out;
int nextTex = 0; int nextTex = 0;
int nextTCG = 3; int nextTCG = 3;
int bumpMapUv, envBumpMapUv, envMapUv, lightmapUv; int bumpMapUv = -1;
int envBumpMapUv = -1;
int envMapUv = -1;
int lightmapUv = -1;
out << "#define TEXTURE_PARAMS "; out << "#define TEXTURE_PARAMS ";
if (info.m_hasPatternTex1) if (info.m_hasPatternTex1)

2
amuse

@ -1 +1 @@
Subproject commit 2ec749e6c7d69ce85bf2fad09339eeead02f209f Subproject commit 217e791b882c39e9608e16d13a69643b711f2cbd