Fix geometry collision traps and implement authentic sector morphing
This commit is contained in:
1 parent
cd63921ea4
commit
b9353f552c
16 files changed
+1470
-131
No files matched your search
+45
-4
@@ -63,7 +63,9 @@ struct Projectile {
|
||||
struct PickupItem {
|
||||
uint16_t entity_id = 0;
|
||||
uint8_t subtype = 0;
|
||||
uint16_t group = 1;
|
||||
Vec3 pos{0, 0, 0};
|
||||
bool group_unlocked = true;
|
||||
bool active = true;
|
||||
float respawn_timer = 0.0f;
|
||||
};
|
||||
@@ -96,6 +98,17 @@ struct CloneRecording {
|
||||
std::vector<CraftPose> frames; // 60 Hz sampled poses
|
||||
};
|
||||
|
||||
struct DirtyRect {
|
||||
int x0 = 0, z0 = 0, x1 = 0, z1 = 0;
|
||||
};
|
||||
|
||||
struct ProjectileTrace {
|
||||
Vec3 p0{0, 0, 0};
|
||||
Vec3 p1{0, 0, 0};
|
||||
int owner_player = -1;
|
||||
bool is_missile = false;
|
||||
};
|
||||
|
||||
struct RaceSetup {
|
||||
GameMode mode = GameMode::SingleRace;
|
||||
int track_number = 1; // 1..6
|
||||
@@ -144,14 +157,38 @@ public:
|
||||
CraftPose interpolated_clone_pose(float alpha) const;
|
||||
const CloneRecording& current_recording() const { return recording_; }
|
||||
|
||||
// Checks if morph triggers fired and changed terrain heights
|
||||
// Checks if morph triggers fired and changed terrain heights or columns
|
||||
bool consume_terrain_dirty(int& x0, int& z0, int& x1, int& z1);
|
||||
bool consume_world_dirty(std::vector<DirtyRect>& out_terrain_rects, bool& out_columns_dirty);
|
||||
|
||||
private:
|
||||
struct TriggerRuntime {
|
||||
bool armed = false;
|
||||
bool fired = false;
|
||||
bool pending = false;
|
||||
float timer = 0.0f;
|
||||
int hit_accum = 0;
|
||||
int pending_player = -1;
|
||||
};
|
||||
|
||||
struct ActiveMorph {
|
||||
size_t morph_idx = 0;
|
||||
float elapsed = 0.0f;
|
||||
float duration = 0.50f;
|
||||
std::vector<assets::MapEntry> orig_dst;
|
||||
std::vector<assets::MapEntry> orig_src;
|
||||
};
|
||||
|
||||
void compute_start_grid(int count, std::vector<CraftPose>& out_poses) const;
|
||||
void update_checkpoints_and_laps(CraftState& c);
|
||||
void update_recharge_pads(CraftState& c, float dt);
|
||||
void update_triggers(CraftState& c);
|
||||
void update_timed_triggers(float dt);
|
||||
void update_rocket_triggers(const std::vector<ProjectileTrace>& traces);
|
||||
void update_active_morphs(float dt);
|
||||
void apply_morph_fraction(const ActiveMorph& am, float s);
|
||||
void push_dirty_rect(int x0, int z0, int x1, int z1);
|
||||
void activate_group(uint16_t group, int actor_player, bool allow_banner, bool fast_morph = false);
|
||||
void update_standings();
|
||||
void update_particles(float dt);
|
||||
|
||||
@@ -171,9 +208,13 @@ private:
|
||||
int winner_id_ = -1;
|
||||
|
||||
// Trigger/morph tracking
|
||||
std::vector<bool> trigger_fired_;
|
||||
bool terrain_dirty_ = false;
|
||||
int dirty_x0_ = 0, dirty_z0_ = 0, dirty_x1_ = 0, dirty_z1_ = 0;
|
||||
std::vector<TriggerRuntime> trigger_states_;
|
||||
std::vector<bool> morph_is_repeating_;
|
||||
std::vector<bool> morph_fired_once_;
|
||||
std::vector<ActiveMorph> active_morphs_;
|
||||
std::vector<DirtyRect> dirty_rects_;
|
||||
bool columns_dirty_ = false;
|
||||
float morph_banner_cd_ = 0.0f;
|
||||
|
||||
// Clone race recording & playback
|
||||
CloneRecording recording_;
|
||||
|
||||
Reference in new issue
Block a user