RD-2: Implemented W_Init. This adds W_InitMultipleFiles and W_CheckNumForName

This commit was merged in pull request #2.
This commit is contained in:
Jim
2026-05-22 21:24:32 +01:00
parent f0b04bbcc2
commit fd9bbaee2d
7 changed files with 253 additions and 14 deletions

View File

@@ -9,6 +9,8 @@ use crate::m_argv::M_CheckParm;
use crate::m_argv::M_GetOptionalArgumentValueByArgument;
use crate::m_argv::PARM_NOT_FOUND;
use crate::w_wad::{W_CheckNumForName, W_InitMultipleFiles};
use crate::doomdef::{
VERSION,
// D_DEVSTR,
@@ -407,10 +409,10 @@ pub fn D_DoomMain() {
println!("Z_init: Init zone memory allocation daemon.");
Z_Init();
println!("W_Init: Init WADfiles");
W_InitMultipleFiles(wadfiles);
*/
println!("W_Init: Init WADfiles");
W_InitMultipleFiles(DOOMGLOBALS::with_ref(|g| g.wadfiles.clone())); // we are loading so how cares about a borrow
let is_modified = DOOMGLOBALS::with_ref(|g| g.modifiedgame);
@@ -426,12 +428,13 @@ pub fn D_DoomMain() {
}
if g_mode == GameMode::Registered {
for lump in iwads_lumps_to_check.iter().take(24) {
// TODO: Implement check
// for (i = 0;i < 23; i++)
// if (W_CheckNumForName(name[i])<0)
// I_Error("\nThis is not the registered version.");
}
let missing_registered_lump = iwads_lumps_to_check
.iter()
.any(|lump_name| W_CheckNumForName(lump_name) == -1);
if missing_registered_lump {
// TODO: Implement I_Error
// I_Error("\nThis is not the registered version.");
}
}
}
@@ -541,7 +544,7 @@ pub fn D_DoomMain() {
}
let g_action = DOOMGLOBALS::with_ref(|g| g.gameaction);
// let g_action = DOOMGLOBALS::with_ref(|g| g.gameaction);
// TODO: Impement Game actions
// if g_action != ga_loadgame {