Fix geometry collision traps and implement authentic sector morphing

This commit is contained in:
Luxferre committed 2026-12-01 08:05:04 +02:00
1 parent cd63921ea4
commit b9353f552c
16 files changed
+1470 -131

No files matched your search

+23
View File
@@ -78,6 +78,23 @@ struct WaypointNode {
uint16_t next_id = 0;
};
struct MorphDefinition {
uint16_t entity_id = 0;
uint16_t source_id = 0;
uint16_t group = 0;
bool permanent = false; // subtype 23 (MorphPermanent) vs 16 (MorphOnce)
int dst_x = 0, dst_z = 0;
int src_x = 0, src_z = 0;
int size_x = 0, size_z = 0; // inclusive cell span [0..size_x] x [0..size_z]
};
struct EffectEntity {
uint16_t entity_id = 0;
uint8_t subtype = 0; // 1=ExplosionParticles, 2=DamageCraft, 3=Explosion, 5=SteamStrong, 8=SteamLight
uint16_t group = 0;
float x = 0.0f, z = 0.0f;
};
struct LevelData {
int level_number = 1; // 1..6
int world_index = 0; // 0..5 (corresponding to TEXTU0-x / SKY0-x / TABLE0-x)
@@ -94,6 +111,8 @@ struct LevelData {
std::vector<LevelEntity> pickups; // type 5
std::vector<LevelEntity> props; // type 3
std::vector<LevelEntity> triggers; // type 8
std::vector<MorphDefinition> morphs; // type 2 subtype 16/23 paired with subtype 9/7 source
std::vector<EffectEntity> effects; // type 2 subtype 1/2/3/5/8
std::vector<LevelEntity> pads; // type 10
int min_x = 0, max_x = kMapWidth - 1;
@@ -110,8 +129,12 @@ struct LevelData {
float cell_height_world(int x, int z) const;
float sample_height_world(float wx, float wz) const;
float sample_height_alt_diag(float wx, float wz) const;
Vec3 sample_normal_world(float wx, float wz) const;
bool is_cell_solid_at_point(int x, int z, float qx, float qz,
float world_y, float craft_height = 0.42f) const;
bool is_cell_solid_at_y(int x, int z, float world_y, float craft_height = 0.42f) const;
bool is_cliff_blocking_at_y(int x, int z, float world_y) const;
void sample_surface_and_ceiling(float wx, float wz, float craft_y,
float& out_floor_y, float& out_ceil_y) const;
};