Fix pickup billboards, AI stuck recovery, vehicle top speeds, and add Revision assets
This commit is contained in:
1 parent
d001f214aa
commit
5a42ca9968
48 files changed
+995
-160
No files matched your search
+82
-31
@@ -59,48 +59,61 @@ void apply_damage(CraftState& victim, int attacker_id, const std::vector<CraftSt
|
||||
}
|
||||
|
||||
void apply_pickup(CraftState& c, uint8_t subtype, std::vector<SimEvent>& events) {
|
||||
// Map Bullfrog type-5 subtypes to authentic Hi-Octane powerups
|
||||
// Authentic HIOCTANE.EXE Type-5 subtype table (0..13 -> TMAPS 29..42)
|
||||
const VehicleSpec& sp = kVehicleSpecs[std::clamp(c.vehicle_idx, 0, 5)];
|
||||
std::string msg;
|
||||
SimSoundCue cue = SimSoundCue::Pickup;
|
||||
switch (subtype) {
|
||||
case 0:
|
||||
c.invincible_timer = 15.0f;
|
||||
msg = "INVINCIBLE";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 1:
|
||||
c.fuel = std::min(c.max_fuel, c.fuel + 35.0f);
|
||||
msg = "FUEL";
|
||||
c.invisible_timer = 15.0f;
|
||||
msg = "INVISIBLE";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 2:
|
||||
c.max_fuel = std::min(220.0f, c.max_fuel + 25.0f);
|
||||
c.fuel = c.max_fuel;
|
||||
msg = "EXTRA FUEL";
|
||||
cue = SimSoundCue::Powerup;
|
||||
c.shield = std::min(c.max_shield, c.shield + std::max(25.0f, c.max_shield * 0.30f));
|
||||
msg = "SHIELD EXTRA";
|
||||
break;
|
||||
case 3:
|
||||
c.shield = std::min(c.max_shield, c.shield + 40.0f);
|
||||
msg = "SHIELD";
|
||||
c.shield = std::max(c.shield, c.max_shield);
|
||||
msg = "SHIELD FULL";
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
c.max_shield = std::min(260.0f, c.max_shield + 30.0f);
|
||||
c.max_shield = std::max(c.max_shield, sp.max_shield * 2.0f);
|
||||
c.shield = c.max_shield;
|
||||
msg = "EXTRA SHIELD";
|
||||
msg = "DOUBLE SHIELD";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 5:
|
||||
c.ammo = std::min(c.max_ammo, c.ammo + std::max(25.0f, c.max_ammo * 0.30f));
|
||||
msg = "AMMO EXTRA";
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
c.ammo = std::min(c.max_ammo, c.ammo + 45.0f);
|
||||
msg = "AMMO";
|
||||
c.ammo = std::max(c.ammo, c.max_ammo);
|
||||
msg = "AMMO FULL";
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
c.max_ammo = std::min(250.0f, c.max_ammo + 30.0f);
|
||||
case 7:
|
||||
c.max_ammo = std::max(c.max_ammo, sp.max_ammo * 2.0f);
|
||||
c.ammo = c.max_ammo;
|
||||
msg = "EXTRA AMMO";
|
||||
msg = "DOUBLE AMMO";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 8:
|
||||
c.fuel = std::min(c.max_fuel, c.fuel + std::max(25.0f, c.max_fuel * 0.30f));
|
||||
msg = "FUEL EXTRA";
|
||||
break;
|
||||
case 9:
|
||||
c.fuel = std::max(c.fuel, c.max_fuel);
|
||||
msg = "FUEL FULL";
|
||||
break;
|
||||
case 10:
|
||||
c.booster_level = std::min(3, c.booster_level + 1);
|
||||
c.fuel = std::min(c.max_fuel, c.fuel + 30.0f);
|
||||
msg = "BOOSTER UPGRADED";
|
||||
c.max_fuel = std::max(c.max_fuel, sp.max_fuel * 2.0f);
|
||||
c.fuel = c.max_fuel;
|
||||
msg = "DOUBLE FUEL";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 11:
|
||||
@@ -110,13 +123,18 @@ void apply_pickup(CraftState& c, uint8_t subtype, std::vector<SimEvent>& events)
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 12:
|
||||
case 13:
|
||||
default:
|
||||
c.missile_level = std::min(3, c.missile_level + 1);
|
||||
c.ammo = std::min(c.max_ammo, c.ammo + 35.0f);
|
||||
msg = "MISSILE UPGRADED";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
case 13:
|
||||
default:
|
||||
c.booster_level = std::min(3, c.booster_level + 1);
|
||||
c.fuel = std::min(c.max_fuel, c.fuel + 35.0f);
|
||||
msg = "BOOSTER UPGRADED";
|
||||
cue = SimSoundCue::Powerup;
|
||||
break;
|
||||
}
|
||||
events.push_back({cue, c.curr_pose.pos, c.is_human ? c.player_index : -1,
|
||||
c.is_human ? msg : "", 0.25f});
|
||||
@@ -278,15 +296,45 @@ void step_combat_and_world(
|
||||
c.shield = c.max_shield;
|
||||
c.fuel = c.max_fuel;
|
||||
c.ammo = std::max(c.ammo, c.max_ammo * 0.5f);
|
||||
// Place gently at nearest main waypoint if available
|
||||
// Place cleanly at nearest clear main waypoint and resolve against morphed walls
|
||||
if (!level.main_waypoints.empty()) {
|
||||
const auto& wp = level.main_waypoints[c.current_wp % level.main_waypoints.size()];
|
||||
const auto& wpn = level.main_waypoints[(c.current_wp + 1) % level.main_waypoints.size()];
|
||||
c.curr_pose.pos = Vec3(wp.x, level.sample_height_world(wp.x, wp.z) + 0.45f, wp.z);
|
||||
size_t best_wp = 0;
|
||||
float best_d2 = 1e18f;
|
||||
for (size_t wi = 0; wi < level.main_waypoints.size(); ++wi) {
|
||||
const auto& w = level.main_waypoints[wi];
|
||||
float dx = w.x - c.curr_pose.pos.x;
|
||||
float dz = w.z - c.curr_pose.pos.z;
|
||||
float d2 = dx * dx + dz * dz;
|
||||
if (d2 < best_d2) {
|
||||
best_d2 = d2;
|
||||
best_wp = wi;
|
||||
}
|
||||
}
|
||||
const auto& wp = level.main_waypoints[best_wp];
|
||||
const auto& wpn = level.main_waypoints[(best_wp + 1) % level.main_waypoints.size()];
|
||||
const VehicleSpec& sp_rec = kVehicleSpecs[std::clamp(c.vehicle_idx, 0, 5)];
|
||||
float fy = 0.0f, cy = 1e6f;
|
||||
level.sample_surface_and_ceiling(wp.x, wp.z, c.curr_pose.pos.y, fy, cy);
|
||||
c.curr_pose.pos = Vec3(wp.x, fy + sp_rec.hover_offset, wp.z);
|
||||
c.curr_pose.yaw = std::atan2(wpn.x - wp.x, wpn.z - wp.z);
|
||||
c.prev_pose = c.curr_pose;
|
||||
c.curr_pose.pitch = 0.0f;
|
||||
c.curr_pose.roll = 0.0f;
|
||||
c.vel = Vec3(0, 0, 0);
|
||||
float dummy_imp = 0.0f;
|
||||
bool dummy_scr = false;
|
||||
resolve_world_collisions(c, level, dummy_imp, dummy_scr);
|
||||
c.prev_pose = c.curr_pose;
|
||||
c.current_wp = static_cast<int>(best_wp);
|
||||
c.ai_target_wp = static_cast<int>((best_wp + 1) % level.main_waypoints.size());
|
||||
}
|
||||
c.ai_stuck_timer = 0.0f;
|
||||
c.ai_unstuck_timer = 0.0f;
|
||||
c.ai_progress_timer = 0.0f;
|
||||
c.ai_pit_stay_timer = 0.0f;
|
||||
c.ai_pit_cooldown = 0.0f;
|
||||
c.ai_seeking_pit = false;
|
||||
c.ai_progress_anchor = c.curr_pose.pos;
|
||||
c.ai_anchor_init = true;
|
||||
} else if (c.shield <= 0.1f) {
|
||||
int rec_ticks = static_cast<int>(std::lround(c.recovery_timer * 60.0f));
|
||||
if (rec_ticks % 4 == 0) {
|
||||
@@ -329,7 +377,10 @@ void step_combat_and_world(
|
||||
int best_tgt = -1;
|
||||
float best_score = 0.72f; // ~44 deg half-cone
|
||||
for (size_t j = 0; j < crafts.size(); ++j) {
|
||||
if (i == j || crafts[j].recovery_state != RecoveryState::Active) continue;
|
||||
if (i == j || crafts[j].recovery_state != RecoveryState::Active ||
|
||||
crafts[j].invisible_timer > 0.0f) {
|
||||
continue;
|
||||
}
|
||||
Vec3 to_tgt = crafts[j].curr_pose.pos - c.curr_pose.pos;
|
||||
float dist = to_tgt.len();
|
||||
if (dist < 1.0f || dist > 38.0f) continue;
|
||||
@@ -487,7 +538,7 @@ void step_combat_and_world(
|
||||
victim.is_human ? victim.player_index : -1, "", 0.20f});
|
||||
}
|
||||
|
||||
if (setup.damage_enabled) {
|
||||
if (setup.damage_enabled && victim.invincible_timer <= 0.0f) {
|
||||
victim.shield -= pr.damage;
|
||||
victim.armour_used += pr.damage;
|
||||
if (victim.shield <= 0.0f) {
|
||||
|
||||
Reference in new issue
Block a user