Visplanes?
parent
d130a86287
commit
28f799d51b
|
@ -20,21 +20,29 @@ pub const ML_MAPPED: u32 = 256;
|
|||
// to handle IWAD dependend animations etc.
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub enum GameMode {
|
||||
Shareware, // DOOM 1 shareware, E1, M9
|
||||
Registered, // DOOM 1 registered, E3, M27
|
||||
Commercial, // DOOM 2 retail, E1 M34
|
||||
Shareware,
|
||||
// DOOM 1 shareware, E1, M9
|
||||
Registered,
|
||||
// DOOM 1 registered, E3, M27
|
||||
Commercial,
|
||||
// DOOM 2 retail, E1 M34
|
||||
// DOOM 2 german edition not handled
|
||||
Retail, // DOOM 1 retail, E4, M36
|
||||
Retail,
|
||||
// DOOM 1 retail, E4, M36
|
||||
Indetermined, // Well, no IWAD found.
|
||||
}
|
||||
|
||||
// Mission packs - might be useful for TC stuff?
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub enum GameMission {
|
||||
Doom, // DOOM 1
|
||||
Doom2, // DOOM 2
|
||||
PackTnt, // TNT mission pack
|
||||
PackPlut, // Plutonia pack
|
||||
Doom,
|
||||
// DOOM 1
|
||||
Doom2,
|
||||
// DOOM 2
|
||||
PackTnt,
|
||||
// TNT mission pack
|
||||
PackPlut,
|
||||
// Plutonia pack
|
||||
None,
|
||||
}
|
||||
|
||||
|
@ -149,7 +157,8 @@ pub enum PowerType {
|
|||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum PowerDuration {
|
||||
INVULNTICS = (30 * TICRATE) as isize,
|
||||
INVISTICS = (61 * TICRATE) as isize, // TODO: fix back to 60
|
||||
INVISTICS = (61 * TICRATE) as isize,
|
||||
// TODO: fix back to 60
|
||||
INFRATICS = (120 * TICRATE) as isize,
|
||||
IRONTICS = (60 * TICRATE) as isize,
|
||||
}
|
||||
|
|
|
@ -508,8 +508,9 @@ impl Game {
|
|||
|
||||
let player = &mut self.players[self.consoleplayer];
|
||||
|
||||
level.visplanes.clear_planes();
|
||||
level.bsp_renderer.clear_clip_segs();
|
||||
level.r_data.portal_clip.clear();
|
||||
level.r_data.clear_data();
|
||||
// The state machine will handle which state renders to the surface
|
||||
//self.states.render(dt, &mut self.canvas);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ use wad::{lumps::WadThing, WadData};
|
|||
|
||||
use crate::level_data::map_data::MapData;
|
||||
use crate::renderer::bsp::BspRenderer;
|
||||
use crate::renderer::plane::VisPlaneCtrl;
|
||||
use crate::renderer::RenderData;
|
||||
use crate::{
|
||||
d_main::Skill,
|
||||
|
@ -26,6 +27,7 @@ pub(crate) struct Level {
|
|||
pub map_data: MapData,
|
||||
pub bsp_renderer: BspRenderer,
|
||||
pub r_data: RenderData,
|
||||
pub visplanes: VisPlaneCtrl,
|
||||
pub mobj_ctrl: SubSectorMinMax,
|
||||
pub thinkers: Vec<Option<Thinker<MapObject>>>,
|
||||
max_thinker_capacity: usize,
|
||||
|
@ -83,6 +85,7 @@ impl Level {
|
|||
let mut level = Level {
|
||||
map_data,
|
||||
r_data: RenderData::default(),
|
||||
visplanes: VisPlaneCtrl::default(),
|
||||
bsp_renderer: BspRenderer::default(),
|
||||
mobj_ctrl: SubSectorMinMax::default(),
|
||||
thinkers: Vec::with_capacity(thinker_count + 50),
|
||||
|
|
|
@ -252,15 +252,15 @@ impl MapObject {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.flags
|
||||
& (MapObjectFlag::MF_DROPOFF as u32
|
||||
| MapObjectFlag::MF_FLOAT as u32)
|
||||
!= 0
|
||||
&& portal.bottom_z - portal.lowest_z > 24.0
|
||||
{
|
||||
contacts.push(contact);
|
||||
return;
|
||||
}
|
||||
// if self.flags
|
||||
// & (MapObjectFlag::MF_DROPOFF as u32
|
||||
// | MapObjectFlag::MF_FLOAT as u32)
|
||||
// != 0
|
||||
// && portal.bottom_z - portal.lowest_z > 24.0
|
||||
// {
|
||||
// contacts.push(contact);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,6 @@ impl BspRenderer {
|
|||
});
|
||||
}
|
||||
self.new_end = 2;
|
||||
// self.r_segs = SegRender::default();
|
||||
}
|
||||
|
||||
/// R_ClipSolidWallSegment - r_bsp
|
||||
|
|
|
@ -29,3 +29,7 @@ pub(crate) struct RenderData {
|
|||
/// Used in r_segs and r_things
|
||||
pub ds_p: usize, // Or, depending on place in code this can be skipped and a new
|
||||
}
|
||||
|
||||
impl RenderData {
|
||||
pub fn clear_data(&mut self) { self.portal_clip.clear(); }
|
||||
}
|
||||
|
|
|
@ -4,19 +4,23 @@ use crate::renderer::defs::{
|
|||
|
||||
pub(crate) struct VisPlaneCtrl {
|
||||
// Here comes the obnoxious "visplane".
|
||||
pub visplanes: [Visplane; MAXVISPLANES],
|
||||
pub visplanes: Vec<Visplane>,
|
||||
pub lastvisplane: usize,
|
||||
/// Index of current visplane in `self.visplanes` for floor
|
||||
pub floorplane: usize,
|
||||
/// Index of current visplane in `self.visplanes` for ceiling
|
||||
pub ceilingplane: usize,
|
||||
|
||||
// ?
|
||||
pub openings: [i16; MAXOPENINGS],
|
||||
pub lastopening: usize,
|
||||
|
||||
pub floorclip: [i32; SCREENWIDTH],
|
||||
pub ceilingclip: [i32; SCREENWIDTH],
|
||||
/// spanstart holds the start of a plane span
|
||||
/// initialized to 0 at start
|
||||
pub spanstart: [i32; SCREENHEIGHT],
|
||||
pub spanstop: [i32; SCREENHEIGHT],
|
||||
pub spanstart: [i32; SCREENHEIGHT],
|
||||
pub spanstop: [i32; SCREENHEIGHT],
|
||||
|
||||
//lighttable_t **planezlight;
|
||||
pub planeheight: f32,
|
||||
|
@ -32,15 +36,21 @@ pub(crate) struct VisPlaneCtrl {
|
|||
pub cachedystep: [f32; SCREENHEIGHT],
|
||||
}
|
||||
|
||||
impl Default for VisPlaneCtrl {
|
||||
fn default() -> Self { VisPlaneCtrl::new() }
|
||||
}
|
||||
|
||||
impl VisPlaneCtrl {
|
||||
pub(crate) fn new() -> Self {
|
||||
VisPlaneCtrl {
|
||||
visplanes: [Visplane::default(); MAXVISPLANES],
|
||||
visplanes: vec![Visplane::default(); MAXVISPLANES],
|
||||
lastvisplane: 0,
|
||||
floorplane: 0,
|
||||
ceilingplane: 0,
|
||||
openings: [0; MAXOPENINGS],
|
||||
lastopening: 0,
|
||||
floorclip: [0; SCREENWIDTH],
|
||||
ceilingclip: [0; SCREENWIDTH],
|
||||
spanstart: [0; SCREENHEIGHT],
|
||||
spanstop: [0; SCREENHEIGHT],
|
||||
planeheight: 0.0,
|
||||
|
@ -54,4 +64,41 @@ impl VisPlaneCtrl {
|
|||
cachedystep: [0.0; SCREENHEIGHT],
|
||||
}
|
||||
}
|
||||
|
||||
/// R_ClearPlanes
|
||||
/// At begining of frame.
|
||||
pub fn clear_planes(&mut self) {
|
||||
// opening / clipping determination
|
||||
for i in 0..SCREENWIDTH {
|
||||
self.floorclip[i] = SCREENHEIGHT as i32;
|
||||
self.ceilingclip[i] = -1;
|
||||
}
|
||||
|
||||
self.lastvisplane = 0;
|
||||
self.lastopening = 0;
|
||||
|
||||
// texture calculation
|
||||
for i in self.cachedheight.iter_mut() {
|
||||
*i = 0.0;
|
||||
}
|
||||
|
||||
// left to right mapping
|
||||
// TODO: angle = (viewangle - ANG90) >> ANGLETOFINESHIFT;
|
||||
|
||||
// TODO: Don't hardcode this; centerxfrac
|
||||
// scale will be unit scale at SCREENWIDTH/2 distance
|
||||
self.basexscale = (160.0f32).cos();
|
||||
self.baseyscale = -(160.0f32).sin();
|
||||
}
|
||||
|
||||
pub fn current_floor_plane(&self) -> &Visplane {
|
||||
&self.visplanes[self.floorplane]
|
||||
}
|
||||
|
||||
pub fn current_ceiling_plane(&self) -> &Visplane {
|
||||
&self.visplanes[self.ceilingplane]
|
||||
}
|
||||
|
||||
// R_CheckPlane
|
||||
//pub fn check_set_floor_plane
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ impl PortalClip {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn clear(&mut self) {
|
||||
pub(super) fn clear(&mut self) {
|
||||
for i in 0..SCREENWIDTH {
|
||||
self.floorclip[i] = SCREENHEIGHT as f32;
|
||||
self.ceilingclip[i] = -1.0;
|
||||
|
|
|
@ -380,7 +380,7 @@ impl SegRender {
|
|||
// above view plane
|
||||
self.markfloor = false;
|
||||
}
|
||||
// TDOD: if frontsector.ceilingheight <= viewz && frontsector.ceilingpic != skyflatnum
|
||||
// TODO: if frontsector.ceilingheight <= viewz && frontsector.ceilingpic != skyflatnum
|
||||
if frontsector.ceilingheight <= viewz {
|
||||
// below view plane
|
||||
self.markceiling = false;
|
||||
|
@ -405,6 +405,15 @@ impl SegRender {
|
|||
}
|
||||
}
|
||||
|
||||
// render it
|
||||
if self.markceiling {
|
||||
// ceilingplane = R_CheckPlane(ceilingplane, self.rw_x, self.rw_stopx - 1);
|
||||
}
|
||||
|
||||
if self.markfloor {
|
||||
// floorplane = R_CheckPlane(floorplane, self.rw_x, self.rw_stopx - 1);
|
||||
}
|
||||
|
||||
self.render_seg_loop(object, seg, rdata, canvas);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue