Replays in full HD with shader effects driven by the recording (#56), recorded clock survives gaps (#57), cinematic intercepts: layered sound with travel delay, big flash, light burst, exposure punch, shock ring (#51) (fork patch 31)
build / mod (push) Successful in 3m21s
build / mod (push) Successful in 3m21s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::sim::record::{EventKind, Recording, STEP, What};
|
||||
use std::cell::Cell;
|
||||
use crate::sim::{Class, DroneKind, Out, Sim};
|
||||
use glam::DVec3;
|
||||
use horizon_mod_sdk::render::{CameraView, FillShape, Point, QuadShape, Rect, Shape, TextShape, ViewShape};
|
||||
use horizon_mod_sdk::render::{CameraView, FillShape, Point, QuadShape, Rect, Shape, TextShape};
|
||||
|
||||
/// Ghost models' ids, clear of the live ones.
|
||||
const GHOSTS: u32 = 0x5000_0000;
|
||||
@@ -37,6 +37,8 @@ pub struct Player {
|
||||
pub mode: Mode,
|
||||
t: f64,
|
||||
speed: f64,
|
||||
/// How fast the replay's time ran this tick (0 paused or held on a card; slowed round a moment).
|
||||
rate: f64,
|
||||
/// The director's current shot (event, shot) and the view id it films with.
|
||||
shot: (usize, u8),
|
||||
view: u32,
|
||||
@@ -213,6 +215,7 @@ impl Player {
|
||||
mode,
|
||||
t: start,
|
||||
speed,
|
||||
rate: 0.0,
|
||||
shot: (usize::MAX, 0),
|
||||
view: VIEW,
|
||||
fade: 0,
|
||||
@@ -297,6 +300,26 @@ impl Player {
|
||||
self.fade = 6;
|
||||
}
|
||||
|
||||
/// Where the camera is this tick.
|
||||
pub fn eye(&self) -> DVec3 {
|
||||
self.eye
|
||||
}
|
||||
/// The replay's moment, in the recording's ticks.
|
||||
pub fn time(&self) -> f64 {
|
||||
self.t
|
||||
}
|
||||
/// How fast the replay's time runs now, as a share of real time (1 normal, 0 held).
|
||||
pub fn rate(&self) -> f32 {
|
||||
self.rate as f32
|
||||
}
|
||||
/// Whether the world is filmed (the map is drawn on the HUD instead).
|
||||
pub fn filming(&self) -> bool {
|
||||
!matches!(self.mode, Mode::Map)
|
||||
}
|
||||
/// The camera the world is rendered from (`set-main-view`).
|
||||
pub fn view_id(&self) -> u32 {
|
||||
self.view
|
||||
}
|
||||
/// The time of day the raid was flown in, as of the replay's moment now.
|
||||
pub fn day_time(&self, sim: &Sim) -> Option<u64> {
|
||||
sim.replay(self.rec)?.day_time(self.t)
|
||||
@@ -325,6 +348,7 @@ impl Player {
|
||||
speed = 0.0;
|
||||
}
|
||||
}
|
||||
self.rate = if self.paused { 0.0 } else { speed };
|
||||
if !self.paused {
|
||||
self.t += speed;
|
||||
}
|
||||
@@ -365,7 +389,8 @@ impl Player {
|
||||
EventKind::SamLost { .. } => "airdef:blast.big",
|
||||
EventKind::Split { .. } => "airdef:boom.sonic",
|
||||
};
|
||||
out.sound(event, heard(e.pos), 1.0, 1.0);
|
||||
let gain = if let EventKind::Kill { kind, .. } = e.kind { crate::sim::record::kill_look(kind).2 } else { 1.0 };
|
||||
out.sound(event, heard(e.pos), gain, 1.0);
|
||||
}
|
||||
for tr in rec.tracks.iter().filter(|tr| (self.heard..self.t).contains(&(tr.first as f64))) {
|
||||
if let What::Missile(kind, _) = tr.what
|
||||
@@ -508,8 +533,8 @@ impl Player {
|
||||
if matches!(self.mode, Mode::Map) {
|
||||
return self.map(rec, gw, gh);
|
||||
}
|
||||
let mut s = vec![fill(0.0, 0.0, gw, gh, 0xFF000000)];
|
||||
s.push(Shape::View(ViewShape { view: self.view, rect: Rect { x: 0.0, y: 0.0, w: gw, h: gh }, mode: 0 }));
|
||||
// The world itself is the camera's (`set-main-view`): the HUD only frames it.
|
||||
let mut s: Vec<Shape> = Vec::new();
|
||||
// Letterbox, the recording's marks.
|
||||
let bar = (gh * 0.09).round();
|
||||
s.push(fill(0.0, 0.0, gw, bar, 0xFF000000));
|
||||
|
||||
Reference in New Issue
Block a user