diff --git a/build.rs b/build.rs index 1f7211c1..b697e98a 100755 --- a/build.rs +++ b/build.rs @@ -2,6 +2,7 @@ use std::env; use std::path::PathBuf; fn main() { + println!("cargo::rustc-check-cfg=cfg(Debug)"); // #[cfg(all(target_os = "macos", feature = "sdl2-bundled"))] // println!("cargo:rustc-link-arg=-Wl,-rpath,@loader_path"); diff --git a/game-exe/src/d_main.rs b/game-exe/src/d_main.rs index 26be79a4..1249a211 100644 --- a/game-exe/src/d_main.rs +++ b/game-exe/src/d_main.rs @@ -29,7 +29,7 @@ use gamestate::Game; use gamestate_traits::sdl2::keyboard::Scancode; use gamestate_traits::sdl2::pixels::PixelFormatEnum; use gamestate_traits::sdl2::render::Canvas; -use gamestate_traits::sdl2::video::{Window, WindowPos}; +use gamestate_traits::sdl2::video::Window; use gamestate_traits::{sdl2, GameState, SubsystemTrait}; use hud_doom::Messages; use input::Input; @@ -453,7 +453,7 @@ fn process_events( let event_callback = |event: sdl2::event::Event| match event { sdl2::event::Event::Window { timestamp: _, - window_id, + window_id: _, win_event, } => { match win_event { diff --git a/game-exe/src/main.rs b/game-exe/src/main.rs index 82f9380c..440d6e33 100644 --- a/game-exe/src/main.rs +++ b/game-exe/src/main.rs @@ -97,7 +97,6 @@ fn main() -> Result<(), Box> { for n in 0..num_disp { info!("Found display {:?}", video_ctx.display_name(n)?); } - let b = video_ctx.display_bounds(1)?; let mut window = video_ctx .window("ROOM4DOOM", 0, 0) .opengl() diff --git a/gameplay/src/thing/movement.rs b/gameplay/src/thing/movement.rs index dce992d1..3bb0c641 100755 --- a/gameplay/src/thing/movement.rs +++ b/gameplay/src/thing/movement.rs @@ -16,7 +16,7 @@ use crate::level::flags::LineDefFlags; use crate::level::map_data::BSPTrace; use crate::level::map_defs::{BBox, LineDef, SlopeType}; use crate::utilities::{ - box_on_line_side, circle_circle_intersect, p_random, path_traverse, BestSlide, Intercept, PortalZ, FRACUNIT_DIV4 + box_on_line_side, circle_circle_intersect, fixed_to_float, p_random, path_traverse, BestSlide, Intercept, PortalZ, FRACUNIT_DIV4 }; use crate::{MapObjKind, MapObject, MapPtr}; @@ -24,8 +24,8 @@ use super::MapObjFlag; pub const GRAVITY: f32 = 1.0; pub const MAXMOVE: f32 = 30.0; -pub const STOPSPEED: f32 = 0.06250095; // 0x1000 -pub const FRICTION: f32 = 0.9062638; // 0xE800 +pub const STOPSPEED: f32 = fixed_to_float(0x1000); +pub const FRICTION: f32 = fixed_to_float(0xE800); //const MAXSPECIALCROSS: i32 = 8; pub const PT_ADDLINES: i32 = 1; @@ -235,11 +235,10 @@ impl MapObject { if let Some(player) = self.player_mut() { if player.cmd.forwardmove == 0 && player.cmd.sidemove == 0 { self.set_state(StateNum::PLAY); - self.momxyz = Vec3::default(); } - } else { - self.momxyz = Vec3::default(); } + self.momxyz.x = 0.0; + self.momxyz.y = 0.0; } else { self.momxyz.x *= FRICTION; self.momxyz.y *= FRICTION; diff --git a/gameplay/src/utilities.rs b/gameplay/src/utilities.rs index 0862ca0b..9dc2d9de 100755 --- a/gameplay/src/utilities.rs +++ b/gameplay/src/utilities.rs @@ -17,14 +17,14 @@ const FRACUNIT: f32 = (1 << FRACBITS) as f32; pub const FRACUNIT_DIV4: f32 = FRACUNIT / 4.0; /// Convert a Doom `fixed_t` fixed-point float to `f32` -pub fn fixed_to_float(value: i32) -> f32 { +pub const fn fixed_to_float(value: i32) -> f32 { value as f32 / FRACUNIT } const DEG_TO_RAD: f32 = PI / 180.0; /// Convert a BAM (Binary Angle Measure) to radians -pub fn bam_to_radian(value: u32) -> f32 { +pub const fn bam_to_radian(value: u32) -> f32 { (value as f32 * 8.381_903e-8) * DEG_TO_RAD } @@ -47,21 +47,21 @@ pub const RNDTABLE: [i32; 256] = [ 84, 118, 222, 187, 136, 120, 163, 236, 249, ]; -pub fn p_random() -> i32 { +pub const fn p_random() -> i32 { unsafe { PRNDINDEX = (PRNDINDEX + 1) & 0xFF; RNDTABLE[PRNDINDEX] } } -pub fn m_random() -> i32 { +pub const fn m_random() -> i32 { unsafe { RNDINDEX = (RNDINDEX + 1) & 0xFF; RNDTABLE[RNDINDEX] } } -pub fn m_clear_random() { +pub const fn m_clear_random() { unsafe { // Not clearing this random as it's used only by screen wipe so far //RNDINDEX = 0; @@ -69,7 +69,7 @@ pub fn m_clear_random() { } } -pub fn p_subrandom() -> i32 { +pub const fn p_subrandom() -> i32 { let r = p_random(); r - p_random() } @@ -83,7 +83,7 @@ pub struct Trace { } impl Trace { - pub fn new(xyz: Vec3, dxyz: Vec3) -> Self { + pub const fn new(xyz: Vec3, dxyz: Vec3) -> Self { Self { xyz, dxyz } } } diff --git a/intermission/doom/src/defs.rs b/intermission/doom/src/defs.rs index 93485f57..70000bd1 100644 --- a/intermission/doom/src/defs.rs +++ b/intermission/doom/src/defs.rs @@ -11,23 +11,23 @@ pub(crate) struct Patches { // pub minus: WadPatch, pub percent: WadPatch, pub kills: WadPatch, - pub secret: WadPatch, pub sp_secret: WadPatch, pub items: WadPatch, - pub frags: WadPatch, pub colon: WadPatch, pub time: WadPatch, - pub sucks: WadPatch, pub par: WadPatch, - pub killers: WadPatch, - pub victims: WadPatch, - pub total: WadPatch, - pub star: WadPatch, - pub bstar: WadPatch, pub enter: WadPatch, pub finish: WadPatch, - pub players: [WadPatch; MAXPLAYERS], - pub bplayers: [WadPatch; MAXPLAYERS], + // secret: WadPatch, + // frags: WadPatch, + // killers: WadPatch, + // victims: WadPatch, + // total: WadPatch, + // sucks: WadPatch, + // star: WadPatch, + // bstar: WadPatch, + // players: [WadPatch; MAXPLAYERS], + // bplayers: [WadPatch; MAXPLAYERS], } impl Patches { @@ -58,23 +58,23 @@ impl Patches { nums: get_num_sprites("WINUM", 0, wad), percent: WadPatch::from_lump(wad.get_lump("WIPCNT").unwrap()), kills: WadPatch::from_lump(wad.get_lump("WIOSTK").unwrap()), - secret: WadPatch::from_lump(wad.get_lump("WIOSTS").unwrap()), sp_secret: WadPatch::from_lump(wad.get_lump("WISCRT2").unwrap()), items: WadPatch::from_lump(wad.get_lump("WIOSTI").unwrap()), - frags: WadPatch::from_lump(wad.get_lump("WIFRGS").unwrap()), colon: WadPatch::from_lump(wad.get_lump("WICOLON").unwrap()), time: WadPatch::from_lump(wad.get_lump("WITIME").unwrap()), - sucks: WadPatch::from_lump(wad.get_lump("WISUCKS").unwrap()), par: WadPatch::from_lump(wad.get_lump("WIPAR").unwrap()), - killers: WadPatch::from_lump(wad.get_lump("WIKILRS").unwrap()), - victims: WadPatch::from_lump(wad.get_lump("WIVCTMS").unwrap()), - total: WadPatch::from_lump(wad.get_lump("WIMSTT").unwrap()), - star: WadPatch::from_lump(wad.get_lump("STFST01").unwrap()), - bstar: WadPatch::from_lump(wad.get_lump("STFDEAD0").unwrap()), enter: WadPatch::from_lump(wad.get_lump("WIENTER").unwrap()), finish: WadPatch::from_lump(wad.get_lump("WIF").unwrap()), - players: unsafe { players.map(|n| n.assume_init()) }, - bplayers: unsafe { bplayers.map(|n| n.assume_init()) }, + // secret: WadPatch::from_lump(wad.get_lump("WIOSTS").unwrap()), + // frags: WadPatch::from_lump(wad.get_lump("WIFRGS").unwrap()), + // sucks: WadPatch::from_lump(wad.get_lump("WISUCKS").unwrap()), + // killers: WadPatch::from_lump(wad.get_lump("WIKILRS").unwrap()), + // victims: WadPatch::from_lump(wad.get_lump("WIVCTMS").unwrap()), + // total: WadPatch::from_lump(wad.get_lump("WIMSTT").unwrap()), + // star: WadPatch::from_lump(wad.get_lump("STFST01").unwrap()), + // bstar: WadPatch::from_lump(wad.get_lump("STFDEAD0").unwrap()), + // players: unsafe { players.map(|n| n.assume_init()) }, + // bplayers: unsafe { bplayers.map(|n| n.assume_init()) }, } } } @@ -149,12 +149,12 @@ pub(crate) struct Animation { // following must be initialized to zero before use! // next value of bcnt (used in conjunction with period) pub next_tic: i32, - // last drawn animation frame (Doom II) - pub last_drawn: i32, // next frame number to animate pub counter: i32, - // used by RANDOM and LEVEL when animating (Doom II) - pub state: i32, + // // used by RANDOM and LEVEL when animating (Doom II) + // pub state: i32, + // // last drawn animation frame (Doom II) + // pub last_drawn: i32, } impl Animation { @@ -174,9 +174,9 @@ impl Animation { data2: 0, patches: Vec::new(), next_tic: 0, - last_drawn: 0, counter: 0, - state: 0, + // state: 0, + // last_drawn: 0, } } }