Minor fix to skybox. Remove same type conversions

embedded
Luke D. Jones 2023-07-24 20:51:09 +12:00
parent 5ecc6cb56d
commit 2bdaabc0b8
20 changed files with 134 additions and 191 deletions

View File

@ -1,71 +0,0 @@
[e1m1]
name=E1M1
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom.wad -w1024 -h768 -e1 -m1
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true
[e1m2]
name=E1M2
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom.wad -w1024 -h768 -e1 -m2
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true
[e1m3]
name=E1M3
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom.wad -w1024 -h768 -e1 -m3
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true
[e5m2]
name=E5M2
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom.wad --iwad /home/luke/DOOM/sigil.wad -w1024 -h768 -e5 -m2
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true
[map01]
name=MAP01
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom2.wad -w1024 -h768 -m1
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true
[map01]
name=MAP03
runtime=host
toolchain=default
config-opts=
run-opts=-- --iwad /home/luke/DOOM/doom2.wad -w1024 -h768 -m3
prefix=/home/luke/.var/app/org.gnome.Builder/cache/gnome-builder/install/diy-doom-rs/host
app-id=
postbuild=
prebuild=
default=true

156
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "aho-corasick"
version = "0.7.20"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [
"memchr",
]
@ -30,9 +30,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bumpalo"
version = "3.12.0"
version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bytemuck"
@ -74,9 +74,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.9.0"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
dependencies = [
"atty",
"log",
@ -132,9 +132,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.7"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
@ -143,15 +143,15 @@ dependencies = [
[[package]]
name = "glam"
version = "0.21.3"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815"
checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226"
[[package]]
name = "glow"
version = "0.12.1"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e007a07a24de5ecae94160f141029e9a347282cfe25d1d58d85d845cf3130f1"
checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728"
dependencies = [
"js-sys",
"slotmap",
@ -187,7 +187,7 @@ checksum = "729f9bd3449d77e7831a18abfb7ba2f99ee813dfd15b8c2167c9a54ba20aa99d"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -239,9 +239,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.61"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [
"wasm-bindgen",
]
@ -266,7 +266,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
"syn",
"syn 1.0.109",
]
[[package]]
@ -277,18 +277,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.132"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "log"
version = "0.4.17"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]]
name = "memchr"
@ -315,24 +312,24 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.17.1"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "proc-macro2"
version = "1.0.52"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [
"proc-macro2",
]
@ -359,9 +356,21 @@ dependencies = [
[[package]]
name = "regex"
version = "1.7.1"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
dependencies = [
"aho-corasick",
"memchr",
@ -370,9 +379,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.28"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
[[package]]
name = "render-soft"
@ -421,7 +430,7 @@ dependencies = [
[[package]]
name = "sdl2"
version = "0.35.2"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#98d54c3d630a0d5101797489e7d1182d11b826f5"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#8613c502a6081ef1a218ad1d6aecf7c6bd7cf65c"
dependencies = [
"bitflags",
"lazy_static",
@ -432,7 +441,7 @@ dependencies = [
[[package]]
name = "sdl2-sys"
version = "0.35.2"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#98d54c3d630a0d5101797489e7d1182d11b826f5"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#8613c502a6081ef1a218ad1d6aecf7c6bd7cf65c"
dependencies = [
"cfg-if",
"libc",
@ -441,22 +450,22 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.144"
version = "1.0.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.144"
version = "1.0.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.27",
]
[[package]]
@ -517,54 +526,65 @@ dependencies = [
]
[[package]]
name = "termcolor"
version = "1.1.3"
name = "syn"
version = "2.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "termcolor"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.33"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d0a539a918745651435ac7db7a18761589a94cd7e94cd56999f828bf73c8a57"
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.33"
version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c251e90f708e16c49a16f4917dc2131e75222b72edfa9cb7f7c58ae56aae0c09"
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.27",
]
[[package]]
name = "toml"
version = "0.5.9"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]]
name = "unicode-ident"
version = "1.0.3"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "version-compare"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]]
name = "version_check"
@ -587,9 +607,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.84"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -597,24 +617,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.84"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn",
"syn 2.0.27",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.84"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -622,28 +642,28 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.84"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.27",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.84"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "web-sys"
version = "0.3.61"
version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
"js-sys",
"wasm-bindgen",

View File

@ -5,6 +5,7 @@ authors = ["Luke Jones <luke@ljones.dev>"]
edition = "2021"
license = "MPL-2.0"
build = "../build.rs"
default-run = "room4doom"
[[bin]]
name = "room4doom"

View File

@ -144,7 +144,7 @@ pub fn p_use_special_line(_side: i32, line: DPtr<LineDef>, thing: &mut MapObject
// Switches that other things can activate
if thing.player().is_none() {
// never open secret doors
if (line.flags as u32) & LineDefFlags::Secret as u32 != 0 {
if line.flags & LineDefFlags::Secret as u32 != 0 {
return false;
}

View File

@ -1,6 +1,7 @@
//! THIS FILE IS GENERATED WITH MULTIGEN
//!
//! Contains all Map Object info, States and State numbers, and Sprite names/indexing.
#![allow(clippy::upper_case_acronyms, clippy::derivable_impls)]
const NUM_SPRNAMES: usize = SpriteNum::Count as usize;
pub const SPRNAMES: [&str; NUM_SPRNAMES] = [

View File

@ -140,8 +140,8 @@ impl MapData {
}
fn set_scale(&mut self) {
let map_width = self.extents.width as f32;
let map_height = self.extents.height as f32;
let map_width = self.extents.width;
let map_height = self.extents.height;
if map_height > map_width {
self.extents.automap_scale = map_height / 400.0 * 1.1;

View File

@ -72,22 +72,17 @@ impl fmt::Display for DoomArgError {
}
#[repr(i32)]
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
#[derive(Debug, Default, Copy, Clone, PartialEq, PartialOrd)]
pub enum Skill {
NoItems = -1, // the "-skill 0" hack
Baby = 0,
Easy = 1,
#[default]
Medium = 2,
Hard = 3,
Nightmare = 4,
}
impl Default for Skill {
fn default() -> Self {
Skill::Medium
}
}
impl From<i32> for Skill {
fn from(w: i32) -> Self {
if w > Skill::Nightmare as i32 {

View File

@ -120,7 +120,7 @@ impl PicData {
break;
}
for (y, p) in c.pixels.iter().enumerate() {
let y_pos = y as i32 + c.y_offset as i32;
let y_pos = y as i32 + c.y_offset;
if y_pos >= 0 && y_pos < patch.height as i32 && x_pos >= 0 {
compose[x_pos as usize][y_pos as usize] = *p;
}
@ -337,7 +337,7 @@ impl PicData {
break;
}
for (y, p) in c.pixels.iter().enumerate() {
let y_pos = y as i32 + patch_pos.origin_y + c.y_offset as i32;
let y_pos = y as i32 + patch_pos.origin_y + c.y_offset;
if y_pos >= 0 && y_pos < texture.height as i32 && x_pos >= 0 {
compose[x_pos as usize][y_pos as usize] = *p;
}
@ -485,7 +485,7 @@ impl PicData {
}
let colourmap = self.colourmap_for_scale(wall_scale);
&self.light_scale[light_level as usize][colourmap as usize]
&self.light_scale[light_level as usize][colourmap]
}
/// Light may need right-shifting by 4
@ -500,7 +500,7 @@ impl PicData {
}
let colourmap = self.colourmap_for_scale(scale);
&self.light_scale[light_level as usize][colourmap as usize]
&self.light_scale[light_level][colourmap]
}
// pub fn light_colourmap(&self, light_level: usize, colourmap: usize) -> &[usize] {

View File

@ -92,7 +92,7 @@ pub struct WBStartStruct {
pub partime: i32,
/// index of this player in game-exe
pub pnum: i32,
pub plyr: [WBPlayerStruct; MAXPLAYERS as usize],
pub plyr: [WBPlayerStruct; MAXPLAYERS],
}
/// Contains the players current status such as attacking, loadout, health. This
@ -169,7 +169,7 @@ pub struct Player {
pub(crate) powers: [i32; PowerType::NumPowers as usize],
/// Frags, kills of other players.
pub frags: [i32; MAXPLAYERS as usize],
pub frags: [i32; MAXPLAYERS],
/// Is wp_nochange if not changing.
pub pendingweapon: WeaponType,
@ -358,8 +358,8 @@ impl Player {
fn thrust(&mut self, angle: Angle, mv: i32) {
// mv is in a fixed float format, we need to convert it
let mv = fixed_to_float(mv);
let x = mv as f32 * angle.cos();
let y = mv as f32 * angle.sin();
let x = mv * angle.cos();
let y = mv * angle.sin();
let mxy = Vec2::new(x, y);
if let Some(mobj) = self.mobj_mut() {
mobj.momxy += mxy;

View File

@ -199,6 +199,7 @@ impl Debug for MapObject {
}
impl MapObject {
#[allow(clippy::too_many_arguments)]
fn new(
x: f32,
y: f32,
@ -350,8 +351,7 @@ impl MapObject {
let mobj_ptr_mut = unsafe { &mut *mobj };
if mthing.kind > 1 {
mobj_ptr_mut.flags = mobj_ptr_mut.flags as u32
| (mthing.kind as u32 - 1) << MapObjFlag::Transshift as u8;
mobj_ptr_mut.flags |= (mthing.kind as u32 - 1) << MapObjFlag::Transshift as u8;
}
// TODO: check this angle stuff

View File

@ -269,8 +269,8 @@ impl ThinkerAlloc {
if ptr::eq(thinker, self.head) {
self.head = thinker.next;
}
(*thinker.next).prev = (*thinker).prev;
(*thinker.prev).next = (*thinker).next;
(*thinker.next).prev = thinker.prev;
(*thinker.prev).next = thinker.next;
self.len -= 1;
self.next_free = thinker; // reuse the slot on next insert

View File

@ -75,8 +75,8 @@ pub fn m_clear_random() {
}
pub fn p_subrandom() -> i32 {
let r = p_random() as i32;
r - p_random() as i32
let r = p_random();
r - p_random()
}
/// Used in path tracing for intercepts

View File

@ -160,6 +160,7 @@ pub fn write_info_file(data: Data, path: PathBuf) {
// MOBJ INFO
file.write_all(MOBJ_INFO_HEADER_STR.as_bytes()).unwrap();
file.write_all(CLIPPY_ALLOW.as_bytes()).unwrap();
file.write_all(MOBJ_INFO_TYPE_STR.as_bytes()).unwrap();
file.write_all(MOBJ_INFO_ARRAY_STR.as_bytes()).unwrap();
for key in data.mobj_order.iter() {

View File

@ -8,6 +8,10 @@ use crate::thing::MapObjFlag;
use sound_traits::SfxName;
"#;
pub const CLIPPY_ALLOW: &str = r#"
#![allow(clippy::upper_case_acronyms, clippy::derivable_impls)]
"#;
pub const MOBJ_INFO_TYPE_STR: &str = r#"
#[derive(Debug, Copy, Clone)]
pub struct MapObjInfo {

View File

@ -134,29 +134,30 @@ impl SoftwareRenderer {
let visplanes = &mut self.r_data.visplanes;
let textures = self.texture_data.borrow();
let sky_doubled = !(pixels.height() == 200);
let down_shift = if sky_doubled { 12 } else { 6 };
for plane in &mut visplanes.visplanes[0..=visplanes.lastvisplane] {
if plane.minx >= plane.maxx {
if plane.minx > plane.maxx {
continue;
}
if plane.picnum == self.texture_data.borrow().sky_num() {
let colourmap = textures.colourmap(0);
let sky_mid = pixels.height() / 2;
let sky_mid = pixels.height() / 2 - down_shift; // shift down by 6 pixels
let skytex = textures.sky_pic();
for x in plane.minx.floor() as i32..=plane.maxx.floor() as i32 {
for x in plane.minx.floor() as i32..=plane.maxx.ceil() as i32 {
let dc_yl = plane.top[x as usize];
let dc_yh = plane.bottom[x as usize];
if dc_yl <= dc_yh {
let angle = (view_angle.rad().to_degrees()
+ screen_to_x_view(x as f32, pixels.width() as f32).to_degrees())
* 2.8444;
* 2.8444; // 2.8444 seems to give the corect skybox width
let texture_column = textures.wall_pic_column(skytex, angle.floor() as i32);
let mut dc = DrawColumn::new(
texture_column,
colourmap,
1.0,
0.94,
x as f32,
sky_mid as f32,
dc_yl,

View File

@ -150,11 +150,11 @@ impl VisPlaneRender {
(stop, plane.maxx)
};
// if intrh <= intrl {
// plane.minx = unionl;
// plane.maxx = unionh;
// return plane_idx;
// }
if intrh <= intrl {
plane.minx = unionl;
plane.maxx = unionh;
return plane_idx;
}
for i in intrl.floor() as i32..=self.screen_width as i32 {
if i >= intrh.floor() as i32 {

View File

@ -698,9 +698,9 @@ impl<'a> DrawColumn<'a> {
// jaggy line across horizontal center. It tips the number *just enough*
// without throwing all the alignment out of wack.
let mut select = if doubled {
((frac - 0.51).round() as i32 / 2) & 0xff
((frac - 0.01).round() as i32 / 2) & 0xff
} else {
((frac - 0.51).round() as i32) & 0xff
((frac - 0.01).round() as i32) & 0xff
};
if select >= self.texture_column.len() as i32 {
select %= self.texture_column.len() as i32;

View File

@ -28,18 +28,18 @@ impl PixelBuf {
// }
#[inline]
pub fn width(&self) -> u32 {
pub const fn width(&self) -> u32 {
self.width
}
#[inline]
pub fn height(&self) -> u32 {
pub const fn height(&self) -> u32 {
self.height
}
/// Get width and height as a tuple
#[inline]
pub fn size(&self) -> (u32, u32) {
pub const fn size(&self) -> (u32, u32) {
(self.width, self.height)
}

View File

@ -1,9 +0,0 @@
# If you see this, run "rustup self update" to get rustup 1.23 or newer.
# NOTE: above comment is for older `rustup` (before TOML support was added),
# which will treat the first line as the toolchain name, and therefore show it
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain]
channel = "1.65.0"
components = [ "rustfmt", "clippy" ]

View File

@ -401,10 +401,10 @@ pub fn read_mus_to_midi(buf: &[u8]) -> Option<Vec<u8>> {
// write the length
let len = (out.len() as u32 - 22).to_be_bytes();
out[18] = len[0] as u8;
out[19] = len[1] as u8;
out[20] = len[2] as u8;
out[21] = len[3] as u8;
out[18] = len[0];
out[19] = len[1];
out[20] = len[2];
out[21] = len[3];
Some(out)
}