Convert anim step hashes from uint64 to int64, because blueprint has no uint64

This commit is contained in:
2025-10-10 19:03:04 -04:00
parent e7cb47db5b
commit 63dcbb7434
4 changed files with 45 additions and 28 deletions

View File

@@ -4,7 +4,7 @@
#include "GameFramework/Actor.h"
#include <iostream>
FlxAnimationStep::FlxAnimationStep(uint64 hash, std::string_view body) {
FlxAnimationStep::FlxAnimationStep(int64 hash, std::string_view body) {
Finished = false;
Hash = hash;
Body.SetNum(body.size());
@@ -107,7 +107,7 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(bool &bChanged, FString &Actio
}
FlxAnimationStep* stepstorage = stepproperty->ContainerPtrToValuePtr<FlxAnimationStep>(target);
uint64 oldhash = stepstorage->Hash;
int64 oldhash = stepstorage->Hash;
FlxAnimationField actionfield;
actionfield.Name = "action";
@@ -265,7 +265,7 @@ FlxAnimationField FlxAnimationStepDecoder::ReadField() {
return result;
}
FString FlxAnimationStepDecoder::DebugString(bool finished, uint64 hash, std::string_view body) {
FString FlxAnimationStepDecoder::DebugString(bool finished, int64 hash, std::string_view body) {
FString result;
FlxAnimationStepDecoder decoder(body);
result.Appendf(TEXT("Hash=%016llx"), hash);
@@ -300,14 +300,14 @@ FString FlxAnimationStepDecoder::DebugString(bool finished, uint64 hash, std::st
FlxAnimationStepView FlxAnimQueueDecoder::ReadStep() {
FlxAnimationStepView result;
result.Hash = Decoder.read_uint64();
result.Hash = Decoder.read_int64();
result.Body = Decoder.read_string_view();
return result;
}
uint64 FlxAnimQueueDecoder::PeekHash() {
int64 FlxAnimQueueDecoder::PeekHash() {
int64_t read_count = Decoder.total_reads();
uint64 result = Decoder.read_uint64();
int64 result = Decoder.read_int64();
Decoder.unread_to(read_count);
return result;
}
@@ -337,7 +337,7 @@ void FlxAnimTracker::Clear() {
Changed = true;
}
void FlxAnimTracker::FinishedAnimation(uint64 hash) {
void FlxAnimTracker::FinishedAnimation(int64 hash) {
for (int i = 0; i < AQ.Num(); i++) {
if (AQ[i].Hash == hash) {
AQ[i].Finished = true;
@@ -346,7 +346,7 @@ void FlxAnimTracker::FinishedAnimation(uint64 hash) {
}
}
bool FlxAnimTracker::IsFinished(uint64 hash) {
bool FlxAnimTracker::IsFinished(int64 hash) {
for (int i = 0; i < AQ.Num(); i++) {
if (AQ[i].Hash == hash) {
return AQ[i].Finished;
@@ -364,6 +364,17 @@ void FlxAnimTracker::SkipToEnd() {
}
}
TArray<int64> FlxAnimTracker::GetHashes()
{
TArray<int64> Result;
Result.SetNum(AQ.Num());
for (int i = 0; i < AQ.Num(); i++)
{
Result[i] = AQ[i].Hash;
}
return Result;
}
const FlxAnimationStep *FlxAnimTracker::FirstUnfinished() const
{
for (int i = 0; i < AQ.Num(); i++) {
@@ -380,7 +391,7 @@ const FlxAnimationStep *FlxAnimTracker::LastFinished() const
return nullptr;
}
const FlxAnimationStep *FlxAnimTracker::FindAnimation(uint64 hash) const
const FlxAnimationStep *FlxAnimTracker::FindAnimation(int64 hash) const
{
for (int i = 0; i < AQ.Num(); i++) {
if (AQ[i].Hash == hash) return &AQ[i];
@@ -408,7 +419,7 @@ void FlxAnimTracker::Update(std::string_view encqueue) {
// Build a map indexing the steps in AQ.
//
TMap<uint64, int32> HashToIndex;
TMap<int64, int32> HashToIndex;
for (int i = 0; i < AQ.Num(); i++) {
HashToIndex.Emplace(AQ[i].Hash, i);
}