Re-organise workspace again

shader120
Luke D. Jones 2022-05-06 11:32:10 +12:00
parent f5bc70fbcc
commit 8c41d77d89
59 changed files with 87 additions and 77 deletions

2
.gitignore vendored
View File

@ -19,4 +19,4 @@ SDL2.dll
cargo-sources.json
player_movement_test.wad
sound-sdl2/tmp.mid
sound/sdl2/tmp.mid

View File

@ -1,5 +1,5 @@
[workspace]
members = ["wad", "game", "gameplay", "render-traits", "render-soft", "sound-traits", "sound-sdl2", "multigen"]
members = ["wad", "game-exe", "gameplay", "render/traits", "render/software", "sound/traits", "sound/sdl2", "multigen"]
[profile.release]
lto = true

View File

@ -58,6 +58,15 @@ I keep a list of things to do in [TODO](./TODO.md). It's worth looking at I gues
it serves sort of as a list of major points of interest, a kinda-sorta changelog, and a
snapshot of where the engine state is right now.
**Functionality TODO:**
- Menu screens
- Intermissions and finale
- HUD messages
- Automap
- Status bar drawing
- Save/load game
## Building
I use and develop on Linux exclusively so although I once did a Windows build I don't maintain it.

View File

@ -3,6 +3,7 @@
## FUNCTIONALITY
- [ ] Menu screens
- [ ] Intermissions and finale]
- [ ] HUD (gameplay crate inserts messages in to player struct)
- [ ] Automap
- [ ] Status bar drawing

View File

@ -18,10 +18,10 @@ sdl2-bundled = ["sdl2/bundled", "sound-sdl2/sdl2-bundled"]
sdl2 = { version = "~0.35.2", features = ["mixer"] }
gumdrop = "~0.8"
gameplay = { path = "../gameplay" }
sound-traits = { path = "../sound-traits" }
sound-sdl2 = { path = "../sound-sdl2" }
render-traits = { path = "../render-traits" }
render-soft = { path = "../render-soft" }
sound-traits = { path = "../sound/traits" }
sound-sdl2 = { path = "../sound/sdl2" }
render-traits = { path = "../render/traits" }
render-soft = { path = "../render/software" }
wad = { path = "../wad" }
golem = { git = "https://github.com/flukejones/golem/" }
# utility deps

View File

@ -59,7 +59,7 @@ impl Cheats {
}
}
/// Cheats skip the ticcmd system and directly affect a game
/// Cheats skip the ticcmd system and directly affect a game-exe
pub fn check_input(&mut self, sc: Scancode, game: &mut Game) {
let key = if let Some(key) = Keycode::from_scancode(sc) {
key as u8 as char

View File

@ -1,5 +1,5 @@
//! The main loop driver. The primary function is the main loop which attempts to
//! run all tics then dislpay the result. Handling of actual game state is done
//! run all tics then dislpay the result. Handling of actual game-exe state is done
//! withing the `Game` object.
use std::error::Error;
@ -94,11 +94,11 @@ pub fn d_doom_loop(
if !game.running() {
break;
}
// The game is split in to two parts:
// - tickers, these update all states (game, menu, hud, automap etc)
// The game-exe is split in to two parts:
// - tickers, these update all states (game-exe, menu, hud, automap etc)
// - drawers, these take a state from above and display it to the user
// Update the game state
// Update the game-exe state
try_run_tics(&mut game, &mut input, &mut timestep);
// Update the positional sounds

View File

@ -1,4 +1,4 @@
//! Game structure. Holds game state, menu state, runs various display routines
//! Game structure. Holds game-exe state, menu state, runs various display routines
//! and other stuff. Functions as a state machine.
//!
//! Various states can be:
@ -33,8 +33,8 @@ use wad::WadData;
use crate::{config::UserConfig, DoomOptions, SOUND_DIR, TIMIDITY_CFG};
use sound_sdl2::timidity::{make_timidity_cfg, GusMemSize};
/// The current state of the game: whether we are playing, gazing at the intermission screen,
/// the game final animation, or a demo.
/// The current state of the game-exe: whether we are playing, gazing at the intermission screen,
/// the game-exe final animation, or a demo.
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum GameState {
ForceWipe = -1,
@ -137,7 +137,7 @@ pub struct Game {
pub wipe_game_state: GameState,
usergame: bool,
/// The options the game exe was started with
/// The options the game-exe exe was started with
pub options: DoomOptions,
/// Sound tx
@ -161,7 +161,7 @@ impl Game {
snd_ctx: AudioSubsystem,
user_config: UserConfig,
) -> Game {
// TODO: a bunch of version checks here to determine what game mode
// TODO: a bunch of version checks here to determine what game-exe mode
let respawn_monsters = matches!(options.skill, Skill::Nightmare);
let (game_mode, game_mission, game_description) = identify_version(&wad);
@ -350,9 +350,9 @@ impl Game {
/// consoleplayer, displayplayer, playeringame[] should be set.
///
/// This appears to be defered because the function call can happen at any time
/// in the game. So rather than just abruptly stop everything we should set
/// in the game-exe. So rather than just abruptly stop everything we should set
/// the action so that the right sequences are run. Unsure of impact of
/// changing game vars beyong action here, probably nothing.
/// changing game-exe vars beyong action here, probably nothing.
pub fn defered_init_new(&mut self, skill: Skill, episode: i32, map: i32) {
self.game_skill = skill;
self.game_episode = episode;
@ -465,7 +465,7 @@ impl Game {
.borrow_mut()
.set_sky_pic(self.game_mode, self.game_episode, self.game_map);
info!("New game!");
info!("New game-exe!");
self.do_load_level();
}
@ -539,7 +539,7 @@ impl Game {
self.wminfo.maxfrags = 0;
self.wminfo.partime = 180;
self.players[self.consoleplayer].viewz = 1.0;
// TODO: remove after new-game stuff done
// TODO: remove after new-game-exe stuff done
self.pic_data
.borrow_mut()
.set_sky_pic(self.game_mode, self.game_episode, self.game_map);
@ -715,9 +715,9 @@ impl Game {
self.game_state = GameState::Intermission;
}
/// The ticker which controls the state the game is in. For example the game could be
/// The ticker which controls the state the game-exe is in. For example the game-exe could be
/// in menu mode, demo play, intermission (`GameState`). A state may also be
/// running other functions that can change the game state or cause an action
/// running other functions that can change the game-exe state or cause an action
/// through `GameAction`.
///
/// Doom function name `G_Ticker`
@ -737,7 +737,7 @@ impl Game {
}
}
// do things to change the game state
// do things to change the game-exe state
match self.game_action {
GameAction::LoadLevel => self.do_load_level(),
GameAction::NewGame => self.do_new_game(),
@ -843,7 +843,7 @@ impl Game {
}
}
/// Gameplay ticker. Updates the game level state along with all thinkers inside
/// Gameplay ticker. Updates the game-exe level state along with all thinkers inside
/// that level. Also watches for `TicCmd` that initiate another action or state such
/// as pausing in menus, demo recording, save/load.
///
@ -856,7 +856,7 @@ impl Game {
// if ( !netgame
// && menuactive
// && !demoplayback
// if game.players[game.consoleplayer].viewz as i32 != 1 {
// if game-exe.players[game-exe.consoleplayer].viewz as i32 != 1 {
// return;
// }

View File

@ -201,8 +201,8 @@ impl Input {
}
}
/// The way this is set up to work is that for each `game tick`, a fresh set of event is
/// gathered and stored. Then for that single game tick, every part of the game can ask
/// The way this is set up to work is that for each `game-exe tick`, a fresh set of event is
/// gathered and stored. Then for that single game-exe tick, every part of the game-exe can ask
/// `Input` for results without the results being removed.
///
/// The results of the `update` are valid until the next `update` whereupon they are refreshed.

View File

@ -85,7 +85,7 @@ impl FromStr for ShaderType {
}
}
/// CLI options for the game
/// CLI options for the game-exe
#[derive(Debug, Clone, Options)]
pub struct CLIOptions {
#[options(
@ -93,7 +93,7 @@ pub struct CLIOptions {
default = "info"
)]
pub verbose: log::LevelFilter,
#[options(no_short, meta = "", help = "path to game WAD")]
#[options(no_short, meta = "", help = "path to game-exe WAD")]
pub iwad: String,
#[options(free, help = "path to patch WAD")]
pub pwad: Vec<String>,
@ -117,17 +117,17 @@ pub struct CLIOptions {
// pub dev_parm: bool,
// #[options(
// meta = "",
// help = "Start a deathmatch game: 1 = classic, 2 = Start a deathmatch 2.0 game. Weapons do not stay in place and all items respawn after 30 seconds"
// help = "Start a deathmatch game-exe: 1 = classic, 2 = Start a deathmatch 2.0 game-exe. Weapons do not stay in place and all items respawn after 30 seconds"
// )]
// pub deathmatch: u8,
// pub autostart: bool,
#[options(meta = "", help = "Set the game skill, 0-4 (0: easiest, 4: hardest)")]
#[options(meta = "", help = "Set the game-exe skill, 0-4 (0: easiest, 4: hardest)")]
pub skill: Skill,
#[options(meta = "", help = "Select episode", default = "1")]
pub episode: i32,
#[options(meta = "", help = "Select level in episode", default = "1")]
pub map: i32,
#[options(help = "game options help")]
#[options(help = "game-exe options help")]
pub help: bool,
#[options(help = "palette test, cycles through palette display")]
@ -167,7 +167,7 @@ impl From<CLIOptions> for DoomOptions {
}
}
/// The main `game` crate should take care of initialising a few things
/// The main `game-exe` crate should take care of initialising a few things
fn main() -> Result<(), Box<dyn Error>> {
let mut options = CLIOptions::parse_args_default_or_exit();

View File

@ -10,8 +10,8 @@ default = []
null_check = []
[dependencies]
sound-traits = { path = "../sound-traits" }
sound-sdl2 = { path = "../sound-sdl2" }
sound-traits = { path = "../sound/traits" }
sound-sdl2 = { path = "../sound/sdl2" }
wad = { path = "../wad" }
glam = "~0.20"
log = "^0.4"

View File

@ -25,7 +25,7 @@ pub struct MapExtents {
}
/// A `Map` contains everything required for building the actual level the
/// player will see in-game, such as the data to build a level, the textures used,
/// player will see in-game-exe, such as the data to build a level, the textures used,
/// `Things`, `Sounds` and others.
///
/// `nodes`, `subsectors`, and `segments` are what get used most to render the

View File

@ -1,7 +1,7 @@
//! The data that makes up an entire level, along with functions to record state,
//! or get ref/mutable-ref to parts of it.
//!
//! Some of the state is mirrored from the overall game state, or ref by pointer.
//! Some of the state is mirrored from the overall game-exe state, or ref by pointer.
pub mod flags;
pub mod map_data;
@ -47,7 +47,7 @@ pub struct Level {
/// The `Things` for deathmatch start locations
pub(super) deathmatch_starts: [Option<WadThing>; MAX_DEATHMATCH_STARTS],
pub(super) deathmatch_p: Vec<WadThing>,
/// Was the level set for deathmatch game
/// Was the level set for deathmatch game-exe
pub(super) deathmatch: bool,
/// for intermission
pub totalkills: i32,
@ -55,7 +55,7 @@ pub struct Level {
pub totalitems: i32,
/// for intermission
pub totalsecret: i32,
/// To change the game state via switches in the level
/// To change the game-exe state via switches in the level
pub game_action: Option<GameAction>,
/// Record how the level was exited
pub secret_exit: bool,
@ -68,7 +68,7 @@ pub struct Level {
pub(super) line_special_list: Vec<DPtr<LineDef>>,
/// Need access to texture data for a few things
pub(super) pic_data: Rc<RefCell<PicData>>,
/// Some stuff needs to know the game mode (e.g, switching weapons)
/// Some stuff needs to know the game-exe mode (e.g, switching weapons)
pub(super) game_mode: GameMode,
/// Provides ability for things to start a sound
pub(super) snd_command: SndServerTx,

View File

@ -21,7 +21,7 @@ mod pic;
pub mod thing;
mod thinker;
pub mod tic_cmd;
// info, level data, game, bsp
// info, level data, game-exe, bsp
pub mod player;
pub mod player_sprite;
pub(crate) mod utilities;

View File

@ -51,7 +51,7 @@ pub fn init_spritedefs(names: &[&str], patches: &[SpritePic]) -> Vec<SpriteDef>
"1. Matched {name}, {}, frame {}, rotate {}",
patch.name, frame, rotation
);
// TODO: check for modified game and fetch new lump from name
// TODO: check for modified game-exe and fetch new lump from name
install_sprite(
pindex,

View File

@ -61,7 +61,7 @@ pub enum PlayerCheat {
/// Structure passed e.g. to WI_Start(wb)
#[derive(Default)]
pub struct WBPlayerStruct {
/// whether the player is in game
/// whether the player is in game-exe
pub inn: bool,
// Player stats, kills, collected items etc.
pub skills: i32,
@ -89,7 +89,7 @@ pub struct WBStartStruct {
pub maxfrags: i32,
/// the par time
pub partime: i32,
/// index of this player in game
/// index of this player in game-exe
pub pnum: i32,
pub plyr: [WBPlayerStruct; MAXPLAYERS as usize],
}

View File

@ -106,7 +106,7 @@ impl MapObject {
let special = unsafe { (*self.subsector).sector.special };
let mobj_health = self.health;
if let Some(player) = self.player_mut() {
// end of game hell hack
// end of game-exe hell hack
if special == 11 && damage >= mobj_health {
damage = mobj_health - 1;
}

View File

@ -309,7 +309,7 @@ impl MapObject {
/// Most of the player structure stays unchanged
/// between levels.
///
/// Called in game.c
/// Called in game-exe.c
fn p_spawn_player(
mthing: &WadThing,
level: &mut Level,
@ -497,7 +497,7 @@ impl MapObject {
}
}
/// Blood! In a game!
/// Blood! In a game-exe!
pub(crate) fn spawn_blood(x: f32, y: f32, mut z: i32, damage: f32, level: &mut Level) {
z += (p_random() - p_random()) / 64;
let mobj = MapObject::spawn_map_object(x, y, z, MapObjKind::MT_BLOOD, level);

View File

@ -171,7 +171,7 @@ impl MapObject {
}
// This whole loop is a bit crusty. It consists of looping over progressively smaller
// moves until we either hit 0, or get a move. Because the whole game is 2D we can
// moves until we either hit 0, or get a move. Because the whole game-exe is 2D we can
// use modern 2D collision detection where if there is a seg/wall penetration then we
// move the player back by the penetration amount. This would also make the "slide" stuff
// a lot easier (but perhaps not as accurate to Doom classic?)

View File

@ -345,7 +345,7 @@ impl Debug for ThinkerData {
/// 'dead' thinkers and it would also impact the order of thinkers, which then means
/// recorded demo playback may be quite different to OG Doom.
///
/// Inserting the `Thinker` in to the game is done in p_tick.c with `P_RunThinkers`.
/// Inserting the `Thinker` in to the game-exe is done in p_tick.c with `P_RunThinkers`.
///
/// The LinkedList style serves to give the Objects a way to find the next/prev of
/// its neighbours and more, without having to pass in a ref to the Thinker container,

View File

@ -12,7 +12,7 @@ pub struct ButtonCode {
// Use button, to open doors, activate switches.
pub bt_use: u8,
// Flag: game events, not really buttons.
// Flag: game-exe events, not really buttons.
pub bt_special: u8,
pub bt_specialmask: u8,
@ -23,9 +23,9 @@ pub struct ButtonCode {
pub bt_weaponmask: u8,
pub bt_weaponshift: u8,
// Pause the game.
// Pause the game-exe.
pub bts_pause: u8,
// Save the game at each console.
// Save the game-exe at each console.
pub bts_savegame: u8,
// Savegame slot numbers
@ -40,7 +40,7 @@ pub const TIC_CMD_BUTTONS: ButtonCode = ButtonCode {
// Use button, to open doors, activate switches.
bt_use: 2,
// Flag: game events, not really buttons.
// Flag: game-exe events, not really buttons.
bt_special: 128,
bt_specialmask: 3,
@ -51,9 +51,9 @@ pub const TIC_CMD_BUTTONS: ButtonCode = ButtonCode {
bt_weaponmask: (8 + 16 + 32),
bt_weaponshift: 3,
// Pause the game.
// Pause the game-exe.
bts_pause: 1,
// Save the game at each console.
// Save the game-exe at each console.
bts_savegame: 2,
// Savegame slot numbers
@ -64,7 +64,7 @@ pub const TIC_CMD_BUTTONS: ButtonCode = ButtonCode {
/// The data sampled per tick (single player)
/// and transmitted to other peers (multiplayer).
/// Mainly movements/button commands per game tick,
/// Mainly movements/button commands per game-exe tick,
/// plus a checksum for internal state consistency.
// G_BuildTiccmd
#[derive(Default, Copy, Clone)]
@ -75,7 +75,7 @@ pub struct TicCmd {
pub sidemove: i8,
/// <<16 for angle delta
pub angleturn: i16,
/// checks for net game
/// checks for net game-exe
pub consistancy: i16,
pub chatchar: u8,
pub buttons: u8,

View File

@ -45,7 +45,7 @@ struct CLIOptions {
info: PathBuf,
#[options(no_short, meta = "", help = "path to write generated files to")]
out: PathBuf,
#[options(help = "game options help")]
#[options(help = "game-exe options help")]
help: bool,
}

View File

@ -3,12 +3,12 @@ name = "render-soft"
version = "0.9.1"
authors = ["Luke Jones <luke@ljones.dev>"]
edition = "2021"
build = "../build.rs"
build = "../../build.rs"
[dependencies]
glam = "*"
gameplay = { path = "../gameplay" }
render-traits = { path = "../render-traits" }
gameplay = { path = "../../gameplay" }
render-traits = { path = "../traits" }
[dev-dependencies]
wad = { path = "../wad" }
wad = { path = "../../wad" }

View File

@ -3,7 +3,7 @@ name = "render-traits"
version = "1.0.0"
authors = ["Luke Jones <luke@ljones.dev>"]
edition = "2021"
build = "../build.rs"
build = "../../build.rs"
[dependencies]
gameplay = { path = "../gameplay" }
gameplay = { path = "../../gameplay" }

View File

@ -1,4 +1,4 @@
//! A generic pixel buffer plus trits for rendering parts of the game
//! A generic pixel buffer plus trits for rendering parts of the game-exe
use gameplay::{Level, Player};
@ -85,7 +85,7 @@ pub trait AutomapRenderer {
}
pub trait MenuRenderer {
/// Draw game menus on top of the `PixelBuf`.
/// Draw game-exe menus on top of the `PixelBuf`.
fn render_menu(&mut self, player: &Player, buffer: &mut PixelBuf);
}

View File

@ -3,18 +3,18 @@ name = "sound-sdl2"
version = "0.1.0"
authors = ["Luke Jones <luke@ljones.dev>"]
edition = "2021"
build = "../build.rs"
build = "../../build.rs"
[features]
default = []
sdl2-bundled = ["sdl2/bundled"]
[dependencies]
wad = { path = "../wad" }
sound-traits = { path = "../sound-traits" }
# versions are set by game crate
wad = { path = "../../wad" }
sound-traits = { path = "../traits" }
# versions are set by game-exe crate
log = "*"
glam = "*"
sdl2 = { version = "*", features = ["mixer"] }
# Required for config options
serde = { version = "*", features = ["serde_derive"] }
serde = { version = "*", features = ["serde_derive"] }

View File

@ -3,6 +3,6 @@ name = "sound-traits"
version = "0.1.0"
authors = ["Luke Jones <luke@ljones.dev>"]
edition = "2021"
build = "../build.rs"
build = "../../build.rs"
[dependencies]

View File

@ -60,7 +60,7 @@ where
{
/// Start up all sound stuff and grab the `Sender` channel for cloning, and an
/// `AtomicBool` to stop sound and deinitialise devices etc in preparation for
/// game exit.
/// game-exe exit.
fn init(&mut self) -> InitResult<S, M, E>;
/// Playback a sound

View File

@ -1,4 +1,4 @@
/// Identifiers for all sfx in game.
/// Identifiers for all sfx in game-exe.
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum SfxNum {
None,

View File

@ -184,7 +184,7 @@ impl WadThing {
}
/// A `Vertex` is the basic struct used for any type of coordinate
/// in the game
/// in the game-exe
///
/// The data in the WAD lump is structured as follows:
///
@ -580,7 +580,7 @@ impl WadNode {
}
}
/// The `BLOCKMAP` is a pre-calculated structure that the game engine uses to simplify
/// The `BLOCKMAP` is a pre-calculated structure that the game-exe engine uses to simplify
/// collision-detection between moving things and walls.
///
/// Each "block" is 128 square.

View File

@ -68,7 +68,7 @@ impl ToString for MapLump {
/// | 0x08-0x0b | unsigned int | Offset in bytes to the directory in the WAD file |
///
pub struct WadHeader {
/// Will be either `IWAD` for game, or `PWAD` for patch
/// Will be either `IWAD` for game-exe, or `PWAD` for patch
wad_type: [u8; 4],
/// The count of "lumps" of data
dir_count: u32,