Some cleanup
This commit is contained in:
1 parent
4e40a1825a
commit
c1be26023b
20 files changed
+451
-1330
No files matched your search
+11
-21
@@ -14,7 +14,12 @@
|
||||
namespace FRG {
|
||||
|
||||
constexpr float VISIBLE_RANGE = 6.f;
|
||||
// Distance at which a character starts attacking its target.
|
||||
constexpr float kAttackRange = 1.25f;
|
||||
// How close the player must be to a peaceful NPC to start a conversation.
|
||||
constexpr float kNpcTalkDistance = 1.35f;
|
||||
|
||||
struct CharacterObservation;
|
||||
struct CharacterUpdateContext;
|
||||
struct CharacterUpdateEvents;
|
||||
struct LocationNetworkState;
|
||||
@@ -42,16 +47,6 @@ struct CharacterCreationInfo {
|
||||
std::unordered_map<std::string, std::string> meshTexturePaths;
|
||||
// Single shared texture path (used when setTexture(shared_ptr) was called on all meshes).
|
||||
std::string singleTexturePath;
|
||||
// Weapon asset paths and attachment setup
|
||||
std::string weaponMeshPath;
|
||||
std::string weaponTexturePath;
|
||||
std::string weaponAttachBoneName = "RightHand";
|
||||
Eigen::Vector3f weaponInitialPosition = Eigen::Vector3f::Zero();
|
||||
// Weapon orientation stored as a quaternion (serializable as 4 floats).
|
||||
Eigen::Quaternionf weaponInitialRotation = Eigen::Quaternionf::Identity();
|
||||
// Optional mesh-space transformations applied after loading the weapon mesh.
|
||||
Eigen::Vector3f weaponMeshMove = Eigen::Vector3f::Zero();
|
||||
float weaponMeshScale = 1.0f;
|
||||
};
|
||||
|
||||
// All serializable authoritative state for a character. GameState or
|
||||
@@ -99,7 +94,6 @@ public:
|
||||
|
||||
// --- Home position for drift recovery ---
|
||||
Vec3fp homePosition;
|
||||
fp maxHomeDriftSquared = static_cast<fp>(3.f*3.f);
|
||||
|
||||
// --- Authoritative logical animation clock ---
|
||||
// Frame counts are immutable metadata copied from loaded clips during
|
||||
@@ -117,7 +111,6 @@ public:
|
||||
|
||||
float modelScale = 0.12f;
|
||||
Eigen::Quaternionf modelCorrectionRotation = Eigen::Quaternionf::Identity();
|
||||
bool useGpuSkinning = true;
|
||||
|
||||
//fp collisionRadius = static_cast<fp>(0.4f); // Радиус капсулы персонажа
|
||||
fp collisionRadius = static_cast<fp>(kCharacterAgentRadius); // Радиус капсулы персонажа
|
||||
@@ -128,7 +121,6 @@ public:
|
||||
Vec2fp preferredVelocity{ fp(0), fp(0) }; // Желаемая скорость к waypoint'у на текущем тике
|
||||
|
||||
fp interactionRadius = static_cast<fp>(0.0f);
|
||||
bool movedLastTick = false;
|
||||
|
||||
// --- Pathfinding data (serializable parts) ---
|
||||
Vec3fp walkTarget;
|
||||
@@ -140,7 +132,6 @@ public:
|
||||
|
||||
// Internal drift-check timer (serializable so it survives save/load).
|
||||
fp homeDriftCheckTimer = static_cast<fp>(5.0f);
|
||||
int movementBlockedTicks = 0;
|
||||
int navigationRetryTicks = 0;
|
||||
std::vector<int> navigationRetryCooldownTicks;
|
||||
std::size_t navigationRetryCooldownIndex = 0;
|
||||
@@ -158,20 +149,16 @@ public:
|
||||
const std::string& entityId,
|
||||
std::vector<int> cooldownTicks = {});
|
||||
bool isMoving() const;
|
||||
const Vec3fp& getRequestedWalkTarget() const { return requestedWalkTarget; }
|
||||
PathFinder::PathOutcome getNavigationOutcome() const { return navigationOutcome; }
|
||||
Vec3fp getCurrentNavigationTarget() const;
|
||||
void stopInPlace();
|
||||
void setTarget(const Vec3fp& target,
|
||||
std::string callbackName,
|
||||
const LocationNetworkState& location,
|
||||
const std::string& entityId);
|
||||
void forceReplan(const LocationNetworkState& location,
|
||||
const std::string& entityId);
|
||||
const LocationNetworkState& location);
|
||||
void forceReplan(const LocationNetworkState& location);
|
||||
void stopAndRotateToTarget(std::string characterId);
|
||||
void resetPlayerAfterDeath();
|
||||
void tryAttackCombo();
|
||||
float getHp() const { return hp; }
|
||||
void setHp(float newHp);
|
||||
CharacterUpdateEvents update(std::int64_t deltaMs, const CharacterUpdateContext& context);
|
||||
void setAnimationMetadata(AnimationState state, int startFrame, int frameCount);
|
||||
@@ -181,6 +168,10 @@ public:
|
||||
|
||||
private:
|
||||
void scheduleNextNavigationRetry();
|
||||
// Queries the active navigation map for a path to `target` and applies it.
|
||||
void applyPathTo(const Vec3fp& target, const LocationNetworkState& location);
|
||||
// Points targetFacingAngle at `faceTarget`, or clears a stale faceTargetId.
|
||||
void updateFaceTarget(const CharacterObservation* faceTarget);
|
||||
};
|
||||
|
||||
using PlayerStateMap =
|
||||
@@ -192,7 +183,6 @@ struct CharacterObservation {
|
||||
};
|
||||
|
||||
struct CharacterUpdateContext {
|
||||
std::string characterId;
|
||||
const CharacterObservation* attackTarget = nullptr;
|
||||
const CharacterObservation* faceTarget = nullptr;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user