This commit is contained in:
Vladislav Khorev committed 2026-05-01 20:01:06 +03:00
1 parent 16d250a51d
commit 519d780b3c
9 files changed
+25 -126

No files matched your search

+1 -27
View File
@@ -127,15 +127,7 @@ void Character::setTexture(std::shared_ptr<ZL::Texture> texture)
void Character::setTexture(const std::string& meshName, std::shared_ptr<Texture> tex) {
meshTextures[meshName] = std::move(tex);
}
/*
void Character::setTexture(std::shared_ptr<Texture> tex) {
for (auto& animEntry : animations) {
for (const auto& name : animEntry.second.model.meshNamesOrdered) {
meshTextures[name] = tex;
}
}
}
*/
AnimationState Character::resolveActiveState() const {
if (animations.count(currentState)) return currentState;
@@ -174,14 +166,6 @@ void Character::update(int64_t deltaMs) {
deltaMs = static_cast<int64_t>(static_cast<float>(deltaMs) * speedMultiplier);
}
//weaponInitialRotation = Eigen::AngleAxisf(x/180.0, Eigen::Vector3f::UnitZ()).toRotationMatrix();
//weaponInitialRotation = Eigen::AngleAxisf(-M_PI*0.5, Eigen::Vector3f::UnitZ()).toRotationMatrix();
//weaponInitialPosition = Eigen::Vector3f(0, 0.09, 0.016);
/*if (deltaMs > 200)
{
deltaMs = 200;
}*/
Eigen::Vector3f activeTarget;
Eigen::Vector3f lookTarget;
@@ -373,14 +357,8 @@ void Character::update(int64_t deltaMs) {
resetAnim = false;
anim.currentFrame = 0;
}
//19
int prevFrame = anim.currentFrame;
anim.currentFrame += static_cast<float>(deltaMs) / 24.f;
/*
if (npcId == "ghost_01x")
{
std::cout << "Current animation frame: " << anim.currentFrame << " / " << anim.totalFrames << " -- " << anim.lastFrame << std::endl;
}*/
if (static_cast<int>(anim.currentFrame) >= 20 && currentState == AnimationState::STAND_TO_ACTION)
{
@@ -436,25 +414,21 @@ void Character::update(int64_t deltaMs) {
if (currentState == AnimationState::STAND_TO_ACTION)
{
currentState = AnimationState::ACTION_IDLE;
//resetAnim = true;
}
if (currentState == AnimationState::ACTION_TO_STAND)
{
currentState = AnimationState::STAND;
//resetAnim = true;
}
if (currentState == AnimationState::ACTION_ATTACK)
{
currentState = AnimationState::ACTION_IDLE;
//resetAnim = true;
attack = 0;
}
if (currentState == AnimationState::ACTION_TO_DEATH)
{
currentState = AnimationState::DEATH_IDLE;
//resetAnim = true;
}
}