diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml
new file mode 100644
index 0000000..530a253
--- /dev/null
+++ b/.idea/dictionaries/project.xml
@@ -0,0 +1,7 @@
+
+
+
+ convar
+
+
+
\ No newline at end of file
diff --git a/.idea/editor.xml b/.idea/editor.xml
index ca29dcc..fef590b 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -1,6 +1,255 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 38983c8..1cf61a2 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,9 +3,13 @@
-
+
+
+
+
+ {
+ "useNewFormat": true
+}
@@ -23,8 +27,77 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -38,6 +111,9 @@
+
+
+
@@ -47,10 +123,10 @@
-
+ {
+ "associatedIndex": 6,
+ "fromUser": false
+}
@@ -64,13 +140,15 @@
"RunOnceActivity.RadMigrateCodeStyle": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true",
+ "RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.readMode.enableVisualFormatting": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
"cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true",
"codeWithMe.voiceChat.enabledByDefault": "false",
"git-widget-placeholder": "master",
- "last_opened_file_path": "/home/iikorni/Downloads/quakespasm-0.96.3",
+ "last_opened_file_path": "/home/iikorni/Downloads/DOOM-master/linuxdoom-1.10",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.jshint": "true",
"node.js.detected.package.tslint": "true",
@@ -86,29 +164,24 @@
-
-
-
-
-
- {
+ "profileIdByStamp": [
{
- "first": {
- "##RUN_CONFIGURATION##": "CMake Application.quakespasm",
- "cmake": "CMakeBuildProfile:Debug"
+ "first": {
+ "##RUN_CONFIGURATION##": "CMake Application.quakespasm",
+ "cmake": "CMakeBuildProfile:Debug"
},
- "second": "27852a6b-aee6-4e6c-a703-78c08d632bb7"
+ "second": "27852a6b-aee6-4e6c-a703-78c08d632bb7"
}
],
- "modificationCount": 4
-}]]>
+ "modificationCount": 4
+}
@@ -139,4 +212,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ac2018..cc17ed1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ find_package(SDL)
find_package(SDL_net)
find_package(OpenGL)
-add_executable(quakespasm Quake/bgmusic.cpp Quake/cd_sdl.cpp Quake/cfgfile.cpp Quake/chase.cpp Quake/cl_demo.cpp Quake/cl_input.cpp Quake/cl_main.cpp Quake/cl_parse.cpp Quake/cl_tent.cpp Quake/cmd.cpp Quake/common.cpp Quake/console.cpp Quake/crc.cpp Quake/cvar.cpp Quake/gl_draw.cpp Quake/gl_fog.cpp Quake/gl_mesh.cpp Quake/gl_model.cpp Quake/gl_refrag.cpp Quake/gl_rlight.cpp Quake/gl_rmain.cpp Quake/gl_rmisc.cpp Quake/gl_screen.cpp Quake/gl_sky.cpp Quake/gl_texmgr.cpp Quake/gl_vidsdl.cpp Quake/gl_warp.cpp Quake/host.cpp Quake/host_cmd.cpp Quake/image.cpp Quake/in_sdl.cpp Quake/keys.cpp Quake/main_sdl.cpp Quake/mathlib.cpp Quake/menu.cpp Quake/miniz.cpp Quake/net_bsd.cpp Quake/net_dgrm.cpp Quake/net_loop.cpp Quake/net_main.cpp Quake/net_udp.cpp Quake/pl_linux.cpp Quake/pr_cmds.cpp Quake/pr_edict.cpp Quake/pr_exec.cpp Quake/r_alias.cpp Quake/r_brush.cpp Quake/r_part.cpp Quake/r_sprite.cpp Quake/r_world.cpp Quake/sbar.cpp Quake/snd_codec.cpp Quake/snd_dma.cpp Quake/snd_flac.cpp Quake/snd_mem.cpp Quake/snd_mikmod.cpp Quake/snd_mix.cpp Quake/snd_modplug.cpp Quake/snd_mp3.cpp Quake/snd_mp3tag.cpp Quake/snd_mpg123.cpp Quake/snd_opus.cpp Quake/snd_sdl.cpp Quake/snd_umx.cpp Quake/snd_vorbis.cpp Quake/snd_wave.cpp Quake/snd_xmp.cpp Quake/strlcat.cpp Quake/strlcpy.cpp Quake/sv_main.cpp Quake/sv_move.cpp Quake/sv_phys.cpp Quake/sv_user.cpp Quake/sys_sdl_unix.cpp Quake/view.cpp Quake/wad.cpp Quake/world.cpp Quake/zone.cpp )
+add_executable(quakespasm Quake/bgmusic.cpp Quake/cd_sdl.cpp Quake/cfgfile.cpp Quake/chase.cpp Quake/cl_demo.cpp Quake/cl_input.cpp Quake/cl_main.cpp Quake/cl_parse.cpp Quake/cl_tent.cpp Quake/cmd.cpp Quake/common.cpp Quake/console.cpp Quake/crc.cpp Quake/convar.cpp Quake/gl_draw.cpp Quake/gl_fog.cpp Quake/gl_mesh.cpp Quake/gl_model.cpp Quake/gl_refrag.cpp Quake/gl_rlight.cpp Quake/gl_rmain.cpp Quake/gl_rmisc.cpp Quake/gl_screen.cpp Quake/gl_sky.cpp Quake/gl_texmgr.cpp Quake/gl_vidsdl.cpp Quake/gl_warp.cpp Quake/host.cpp Quake/host_cmd.cpp Quake/image.cpp Quake/in_sdl.cpp Quake/keys.cpp Quake/main_sdl.cpp Quake/mathlib.cpp Quake/menu.cpp Quake/miniz.cpp Quake/net_bsd.cpp Quake/net_dgrm.cpp Quake/net_loop.cpp Quake/net_main.cpp Quake/net_udp.cpp Quake/pl_linux.cpp Quake/pr_cmds.cpp Quake/pr_edict.cpp Quake/pr_exec.cpp Quake/r_alias.cpp Quake/r_brush.cpp Quake/r_part.cpp Quake/r_sprite.cpp Quake/r_world.cpp Quake/sbar.cpp Quake/snd_codec.cpp Quake/snd_dma.cpp Quake/snd_flac.cpp Quake/snd_mem.cpp Quake/snd_mikmod.cpp Quake/snd_mix.cpp Quake/snd_modplug.cpp Quake/snd_mp3.cpp Quake/snd_mp3tag.cpp Quake/snd_mpg123.cpp Quake/snd_opus.cpp Quake/snd_sdl.cpp Quake/snd_umx.cpp Quake/snd_vorbis.cpp Quake/snd_wave.cpp Quake/snd_xmp.cpp Quake/strlcat.cpp Quake/strlcpy.cpp Quake/sv_main.cpp Quake/sv_move.cpp Quake/sv_phys.cpp Quake/sv_user.cpp Quake/sys_sdl_unix.cpp Quake/view.cpp Quake/wad.cpp Quake/world.cpp Quake/zone.cpp )
target_link_libraries(quakespasm OpenGL::GL)
target_link_libraries(quakespasm SDL::SDL)
diff --git a/Misc/fix_externaltex.patch b/Misc/fix_externaltex.patch
index d18ac0f..2459a82 100644
--- a/Misc/fix_externaltex.patch
+++ b/Misc/fix_externaltex.patch
@@ -104,10 +104,10 @@ index 963d55e..e9b251b 100644
extern gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz
@@ -230,6 +231,7 @@ void R_Init (void)
- Cvar_SetCallback (&r_lavaalpha, R_SetLavaalpha_f);
- Cvar_SetCallback (&r_telealpha, R_SetTelealpha_f);
- Cvar_SetCallback (&r_slimealpha, R_SetSlimealpha_f);
-+ Cvar_RegisterVariable (&r_externaltexture_fix);//mk
+ r_lavaalpha.set_callback(R_SetLavaalpha_f);
+ r_telealpha.set_callback(R_SetTelealpha_f);
+ r_slimealpha.set_callback(R_SetSlimealpha_f);
++ r_externaltexture_fix.inscribe();//mk
R_InitParticles ();
R_SetClearColor_f (&r_clearcolor); //johnfitz
diff --git a/Quake/bgmusic.cpp b/Quake/bgmusic.cpp
index 65902df..aa612e3 100644
--- a/Quake/bgmusic.cpp
+++ b/Quake/bgmusic.cpp
@@ -29,7 +29,7 @@
#define MUSIC_DIRNAME "music"
qboolean bgmloop;
-cvar_t bgm_extmusic = {"bgm_extmusic", "1", CVAR_ARCHIVE};
+convar bgm_extmusic{"bgm_extmusic", "1", {.archive = true}};
static qboolean no_extmusic= false;
static float old_volume = -1.0f;
@@ -76,8 +76,8 @@ static snd_stream_t *bgmstream = NULL;
static void BGM_Play_f (void)
{
- if (Cmd_Argc() == 2) {
- BGM_Play (Cmd_Argv(1));
+ if (command::argc() == 2) {
+ BGM_Play (command::argv(1)->c_str());
}
else {
Con_Printf ("music \n");
@@ -96,14 +96,14 @@ static void BGM_Resume_f (void)
static void BGM_Loop_f (void)
{
- if (Cmd_Argc() == 2) {
- if (q_strcasecmp(Cmd_Argv(1), "0") == 0 ||
- q_strcasecmp(Cmd_Argv(1),"off") == 0)
+ if (command::argc() == 2) {
+ if (q_strcasecmp(command::argv(1)->c_str(), "0") == 0 ||
+ q_strcasecmp(command::argv(1)->c_str(),"off") == 0)
bgmloop = false;
- else if (q_strcasecmp(Cmd_Argv(1), "1") == 0 ||
- q_strcasecmp(Cmd_Argv(1),"on") == 0)
+ else if (q_strcasecmp(command::argv(1)->c_str(), "1") == 0 ||
+ q_strcasecmp(command::argv(1)->c_str(),"on") == 0)
bgmloop = true;
- else if (q_strcasecmp(Cmd_Argv(1),"toggle") == 0)
+ else if (q_strcasecmp(command::argv(1)->c_str(),"toggle") == 0)
bgmloop = !bgmloop;
if (bgmstream) bgmstream->loop = bgmloop;
@@ -122,11 +122,11 @@ static void BGM_Stop_f (void)
static void BGM_Jump_f (void)
{
- if (Cmd_Argc() != 2) {
+ if (command::argc() != 2) {
Con_Printf ("music_jump \n");
}
else if (bgmstream) {
- S_CodecJumpToOrder(bgmstream, atoi(Cmd_Argv(1)));
+ S_CodecJumpToOrder(bgmstream, atoi(command::argv(1)->c_str()));
}
}
@@ -135,13 +135,13 @@ qboolean BGM_Init (void)
music_handler_t *handlers = NULL;
int i;
- Cvar_RegisterVariable(&bgm_extmusic);
- Cmd_AddCommand("music", BGM_Play_f);
- Cmd_AddCommand("music_pause", BGM_Pause_f);
- Cmd_AddCommand("music_resume", BGM_Resume_f);
- Cmd_AddCommand("music_loop", BGM_Loop_f);
- Cmd_AddCommand("music_stop", BGM_Stop_f);
- Cmd_AddCommand("music_jump", BGM_Jump_f);
+ bgm_extmusic.inscribe();
+ command::add("music", BGM_Play_f);
+ command::add("music_pause", BGM_Pause_f);
+ command::add("music_resume", BGM_Resume_f);
+ command::add("music_loop", BGM_Loop_f);
+ command::add("music_stop", BGM_Stop_f);
+ command::add("music_jump", BGM_Jump_f);
if (COM_CheckParm("-noextmusic") != 0)
no_extmusic = true;
@@ -467,9 +467,9 @@ void BGM_Update (void)
if (old_volume != bgmvolume.value)
{
if (bgmvolume.value < 0)
- Cvar_SetQuick (&bgmvolume, "0");
+ bgmvolume.set("0");
else if (bgmvolume.value > 1)
- Cvar_SetQuick (&bgmvolume, "1");
+ bgmvolume.set("1");
old_volume = bgmvolume.value;
}
if (bgmstream)
diff --git a/Quake/bgmusic.hpp b/Quake/bgmusic.hpp
index ec30820..0337d05 100644
--- a/Quake/bgmusic.hpp
+++ b/Quake/bgmusic.hpp
@@ -26,7 +26,7 @@
#define _BGMUSIC_H_
extern qboolean bgmloop;
-extern cvar_t bgm_extmusic;
+extern convar bgm_extmusic;
qboolean BGM_Init (void);
void BGM_Shutdown (void);
diff --git a/Quake/cd_sdl.cpp b/Quake/cd_sdl.cpp
index 1acd9d9..efa9579 100644
--- a/Quake/cd_sdl.cpp
+++ b/Quake/cd_sdl.cpp
@@ -221,7 +221,7 @@ static void CD_f (void)
const char *command;
int ret, n;
- if (Cmd_Argc() < 2)
+ if (command::argc() < 2)
{
Con_Printf("commands:");
Con_Printf("on, off, reset, remap, \n");
@@ -230,7 +230,7 @@ static void CD_f (void)
return;
}
- command = Cmd_Argv (1);
+ command = command::argv (1)->c_str();
if (q_strcasecmp(command, "on") == 0)
{
@@ -259,7 +259,7 @@ static void CD_f (void)
if (q_strcasecmp(command, "remap") == 0)
{
- ret = Cmd_Argc() - 2;
+ ret = command::argc() - 2;
if (ret <= 0)
{
for (n = 1; n < 100; n++)
@@ -268,7 +268,7 @@ static void CD_f (void)
return;
}
for (n = 1; n <= ret; n++)
- remap[n] = atoi(Cmd_Argv (n + 1));
+ remap[n] = atoi(command::argv (n + 1)->c_str());
return;
}
@@ -284,7 +284,7 @@ static void CD_f (void)
if (q_strcasecmp(command, "play") == 0)
{
- n = atoi(Cmd_Argv (2));
+ n = atoi(command::argv (2)->c_str());
if (n == 0)
n = 1;
CDAudio_Play((byte)n, false);
@@ -293,7 +293,7 @@ static void CD_f (void)
if (q_strcasecmp(command, "loop") == 0)
{
- CDAudio_Play((byte)atoi(Cmd_Argv (2)), true);
+ CDAudio_Play((byte)atoi(command::argv (2)->c_str()), true);
return;
}
@@ -564,7 +564,7 @@ int CDAudio_Init(void)
cdValid = false;
}
- Cmd_AddCommand ("cd", CD_f);
+ command::add ("cd", CD_f);
hw_vol_works = CD_GetVolume (NULL); /* no SDL support at present. */
if (hw_vol_works)
diff --git a/Quake/cfgfile.cpp b/Quake/cfgfile.cpp
index 00c459d..7679356 100644
--- a/Quake/cfgfile.cpp
+++ b/Quake/cfgfile.cpp
@@ -94,7 +94,7 @@ void CFG_ReadCvars (const char **vars, int num_vars)
tmp = strchr(buff, '\"');
if (tmp)
{
- Cvar_Set (vars[i], tmp + 1);
+ convar::set(vars[i], tmp + 1);
j++;
break;
}
@@ -135,7 +135,7 @@ void CFG_ReadCvarOverrides (const char **vars, int num_vars)
if (j != 0 && j < com_argc - 1)
{
if (com_argv[j + 1][0] != '-' && com_argv[j + 1][0] != '+')
- Cvar_Set(vars[i], com_argv[j + 1]);
+ convar::set(vars[i], com_argv[j + 1]);
}
}
}
diff --git a/Quake/chase.cpp b/Quake/chase.cpp
index 870312b..e1c4462 100644
--- a/Quake/chase.cpp
+++ b/Quake/chase.cpp
@@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.hpp"
-cvar_t chase_back = {"chase_back", "100", CVAR_NONE};
-cvar_t chase_up = {"chase_up", "16", CVAR_NONE};
-cvar_t chase_right = {"chase_right", "0", CVAR_NONE};
-cvar_t chase_active = {"chase_active", "0", CVAR_NONE};
+convar chase_back{"chase_back", "100"};
+convar chase_up{"chase_up", "16"};
+convar chase_right{"chase_right", "0"};
+convar chase_active{"chase_active", "0"};
/*
==============
@@ -35,10 +35,10 @@ Chase_Init
*/
void Chase_Init (void)
{
- Cvar_RegisterVariable (&chase_back);
- Cvar_RegisterVariable (&chase_up);
- Cvar_RegisterVariable (&chase_right);
- Cvar_RegisterVariable (&chase_active);
+ chase_back.inscribe();
+ chase_up.inscribe();
+ chase_right.inscribe();
+ chase_active.inscribe();
}
/*
diff --git a/Quake/cl_demo.cpp b/Quake/cl_demo.cpp
index 331f975..f97411c 100644
--- a/Quake/cl_demo.cpp
+++ b/Quake/cl_demo.cpp
@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include
+#include
#include "quakedef.hpp"
@@ -202,7 +203,7 @@ stop recording a demo
*/
void CL_Stop_f (void)
{
- if (cmd_source != src_command)
+ if (command::last_source != command::source::command)
return;
if (!cls.demorecording)
@@ -239,7 +240,7 @@ void CL_Record_f (void)
char name[MAX_OSPATH];
int track;
- if (cmd_source != src_command)
+ if (command::last_source != command::source::command)
return;
if (cls.demoplayback)
@@ -251,14 +252,14 @@ void CL_Record_f (void)
if (cls.demorecording)
CL_Stop_f();
- c = Cmd_Argc();
+ c = command::argc();
if (c != 2 && c != 3 && c != 4)
{
Con_Printf ("record [