diff --git a/src/command.c b/src/command.c index 8659ce3a4..3d3271ddb 100644 --- a/src/command.c +++ b/src/command.c @@ -312,6 +312,7 @@ typedef struct xcommand_s const char *name; struct xcommand_s *next; com_func_t function; + com_flags_t flags; } xcommand_t; static xcommand_t *com_commands = NULL; // current commands @@ -332,16 +333,16 @@ void COM_Init(void) VS_Alloc(&com_text, COM_BUF_SIZE); // add standard commands - COM_AddCommand("alias", COM_Alias_f); - COM_AddCommand("echo", COM_Echo_f); - COM_AddCommand("cecho", COM_CEcho_f); - COM_AddCommand("cechoflags", COM_CEchoFlags_f); - COM_AddCommand("cechoduration", COM_CEchoDuration_f); - COM_AddCommand("exec", COM_Exec_f); - COM_AddCommand("wait", COM_Wait_f); - COM_AddCommand("help", COM_Help_f); - COM_AddCommand("toggle", COM_Toggle_f); - COM_AddCommand("add", COM_Add_f); + COM_AddCommand("alias", COM_Alias_f, 0); + COM_AddCommand("echo", COM_Echo_f, 0); + COM_AddCommand("cecho", COM_CEcho_f, 0); + COM_AddCommand("cechoflags", COM_CEchoFlags_f, 0); + COM_AddCommand("cechoduration", COM_CEchoDuration_f, 0); + COM_AddCommand("exec", COM_Exec_f, 0); + COM_AddCommand("wait", COM_Wait_f, 0); + COM_AddCommand("help", COM_Help_f, 0); + COM_AddCommand("toggle", COM_Toggle_f, 0); + COM_AddCommand("add", COM_Add_f, 0); RegisterNetXCmd(XD_NETVAR, Got_NetVar); } @@ -480,7 +481,7 @@ static void COM_TokenizeString(char *ptext) * \param name Name of the command. * \param func Function called when the command is run. */ -void COM_AddCommand(const char *name, com_func_t func) +void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags) { xcommand_t *cmd; @@ -510,6 +511,7 @@ void COM_AddCommand(const char *name, com_func_t func) cmd = ZZ_Alloc(sizeof *cmd); cmd->name = name; cmd->function = func; + cmd->flags = flags; cmd->next = com_commands; com_commands = cmd; } @@ -542,6 +544,7 @@ int COM_AddLuaCommand(const char *name) cmd = ZZ_Alloc(sizeof *cmd); cmd->name = name; cmd->function = COM_Lua_f; + cmd->flags = 0; cmd->next = com_commands; com_commands = cmd; return 0; diff --git a/src/command.h b/src/command.h index ea5d525a7..93adfd418 100644 --- a/src/command.h +++ b/src/command.h @@ -34,7 +34,7 @@ typedef enum typedef void (*com_func_t)(void); -void COM_AddCommand(const char *name, com_func_t func); +void COM_AddCommand(const char *name, com_func_t func, com_flags_t flags); int COM_AddLuaCommand(const char *name); size_t COM_Argc(void); diff --git a/src/console.c b/src/console.c index 40fb43121..9b464e31b 100644 --- a/src/console.c +++ b/src/console.c @@ -443,7 +443,7 @@ void CON_Init(void) // register our commands // - COM_AddCommand("cls", CONS_Clear_f); + COM_AddCommand("cls", CONS_Clear_f, 0); //COM_AddCommand("english", CONS_English_f); // set console full screen for game startup MAKE SURE VID_Init() done !!! Lock_state(); @@ -470,7 +470,7 @@ void CON_Init(void) CV_RegisterVar(&cons_height); CV_RegisterVar(&cons_backpic); CV_RegisterVar(&cons_backcolor); - COM_AddCommand("bind", CONS_Bind_f); + COM_AddCommand("bind", CONS_Bind_f, 0); } else { diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 19e6bf0f7..232b41bd0 100755 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3537,22 +3537,22 @@ void D_ClientServerInit(void) VERSION/100, VERSION%100, SUBVERSION)); #ifndef NONET - COM_AddCommand("getplayernum", Command_GetPlayerNum); - COM_AddCommand("kick", Command_Kick); - COM_AddCommand("ban", Command_Ban); - COM_AddCommand("banip", Command_BanIP); - COM_AddCommand("clearbans", Command_ClearBans); - COM_AddCommand("showbanlist", Command_ShowBan); - COM_AddCommand("reloadbans", Command_ReloadBan); - COM_AddCommand("connect", Command_connect); - COM_AddCommand("nodes", Command_Nodes); - COM_AddCommand("resendgamestate", Command_ResendGamestate); + COM_AddCommand("getplayernum", Command_GetPlayerNum, 0); + COM_AddCommand("kick", Command_Kick, 0); + COM_AddCommand("ban", Command_Ban, 0); + COM_AddCommand("banip", Command_BanIP, 0); + COM_AddCommand("clearbans", Command_ClearBans, 0); + COM_AddCommand("showbanlist", Command_ShowBan, 0); + COM_AddCommand("reloadbans", Command_ReloadBan, 0); + COM_AddCommand("connect", Command_connect, 0); + COM_AddCommand("nodes", Command_Nodes, 0); + COM_AddCommand("resendgamestate", Command_ResendGamestate, 0); #ifdef PACKETDROP - COM_AddCommand("drop", Command_Drop); - COM_AddCommand("droprate", Command_Droprate); + COM_AddCommand("drop", Command_Drop, 0); + COM_AddCommand("droprate", Command_Droprate, 0); #endif #ifdef _DEBUG - COM_AddCommand("numnodes", Command_Numnodes); + COM_AddCommand("numnodes", Command_Numnodes, 0); #endif #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 67099e848..ef00ec431 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -464,57 +464,57 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_LUAFILE, Got_LuaFile); // Remote Administration - COM_AddCommand("password", Command_Changepassword_f); - COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin - COM_AddCommand("promote", Command_Verify_f); + COM_AddCommand("password", Command_Changepassword_f, 0); + COM_AddCommand("login", Command_Login_f, 0); // useful in dedicated to kick off remote admin + COM_AddCommand("promote", Command_Verify_f, 0); RegisterNetXCmd(XD_VERIFIED, Got_Verification); - COM_AddCommand("demote", Command_RemoveAdmin_f); + COM_AddCommand("demote", Command_RemoveAdmin_f, 0); RegisterNetXCmd(XD_DEMOTED, Got_Removal); - COM_AddCommand("motd", Command_MotD_f); + COM_AddCommand("motd", Command_MotD_f, 0); RegisterNetXCmd(XD_SETMOTD, Got_MotD_f); // For remote admin RegisterNetXCmd(XD_TEAMCHANGE, Got_Teamchange); - COM_AddCommand("serverchangeteam", Command_ServerTeamChange_f); + COM_AddCommand("serverchangeteam", Command_ServerTeamChange_f, 0); RegisterNetXCmd(XD_CLEARSCORES, Got_Clearscores); - COM_AddCommand("clearscores", Command_Clearscores_f); - COM_AddCommand("map", Command_Map_f); + COM_AddCommand("clearscores", Command_Clearscores_f, 0); + COM_AddCommand("map", Command_Map_f, 0); - COM_AddCommand("exitgame", Command_ExitGame_f); - COM_AddCommand("retry", Command_Retry_f); - COM_AddCommand("exitlevel", Command_ExitLevel_f); - COM_AddCommand("showmap", Command_Showmap_f); - COM_AddCommand("mapmd5", Command_Mapmd5_f); + COM_AddCommand("exitgame", Command_ExitGame_f, 0); + COM_AddCommand("retry", Command_Retry_f, 0); + COM_AddCommand("exitlevel", Command_ExitLevel_f, 0); + COM_AddCommand("showmap", Command_Showmap_f, 0); + COM_AddCommand("mapmd5", Command_Mapmd5_f, 0); - COM_AddCommand("addfolder", Command_Addfolder); - COM_AddCommand("addfile", Command_Addfile); - COM_AddCommand("listwad", Command_ListWADS_f); + COM_AddCommand("addfolder", Command_Addfolder, 0); + COM_AddCommand("addfile", Command_Addfile, 0); + COM_AddCommand("listwad", Command_ListWADS_f, 0); - COM_AddCommand("runsoc", Command_RunSOC); - COM_AddCommand("pause", Command_Pause); - COM_AddCommand("suicide", Command_Suicide); + COM_AddCommand("runsoc", Command_RunSOC, 0); + COM_AddCommand("pause", Command_Pause, 0); + COM_AddCommand("suicide", Command_Suicide, 0); - COM_AddCommand("gametype", Command_ShowGametype_f); - COM_AddCommand("version", Command_Version_f); + COM_AddCommand("gametype", Command_ShowGametype_f, 0); + COM_AddCommand("version", Command_Version_f, 0); #ifdef UPDATE_ALERT - COM_AddCommand("mod_details", Command_ModDetails_f); + COM_AddCommand("mod_details", Command_ModDetails_f, 0); #endif - COM_AddCommand("quit", Command_Quit_f); + COM_AddCommand("quit", Command_Quit_f, 0); - COM_AddCommand("saveconfig", Command_SaveConfig_f); - COM_AddCommand("loadconfig", Command_LoadConfig_f); - COM_AddCommand("changeconfig", Command_ChangeConfig_f); - COM_AddCommand("isgamemodified", Command_Isgamemodified_f); // test - COM_AddCommand("showscores", Command_ShowScores_f); - COM_AddCommand("showtime", Command_ShowTime_f); - COM_AddCommand("cheats", Command_Cheats_f); // test + COM_AddCommand("saveconfig", Command_SaveConfig_f, 0); + COM_AddCommand("loadconfig", Command_LoadConfig_f, 0); + COM_AddCommand("changeconfig", Command_ChangeConfig_f, 0); + COM_AddCommand("isgamemodified", Command_Isgamemodified_f, 0); // test + COM_AddCommand("showscores", Command_ShowScores_f, 0); + COM_AddCommand("showtime", Command_ShowTime_f, 0); + COM_AddCommand("cheats", Command_Cheats_f, 0); // test #ifdef _DEBUG - COM_AddCommand("togglemodified", Command_Togglemodified_f); - COM_AddCommand("archivetest", Command_Archivetest_f); + COM_AddCommand("togglemodified", Command_Togglemodified_f, 0); + COM_AddCommand("archivetest", Command_Archivetest_f, 0); #endif - COM_AddCommand("downloads", Command_Downloads_f); + COM_AddCommand("downloads", Command_Downloads_f, 0); // for master server connection AddMServCommands(); @@ -601,7 +601,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_blamecfail); #endif - COM_AddCommand("ping", Command_Ping_f); + COM_AddCommand("ping", Command_Ping_f, 0); CV_RegisterVar(&cv_nettimeout); CV_RegisterVar(&cv_jointimeout); @@ -645,25 +645,25 @@ void D_RegisterClientCommands(void) if (dedicated) return; - COM_AddCommand("numthinkers", Command_Numthinkers_f); - COM_AddCommand("countmobjs", Command_CountMobjs_f); + COM_AddCommand("numthinkers", Command_Numthinkers_f, 0); + COM_AddCommand("countmobjs", Command_CountMobjs_f, 0); - COM_AddCommand("changeteam", Command_Teamchange_f); - COM_AddCommand("changeteam2", Command_Teamchange2_f); + COM_AddCommand("changeteam", Command_Teamchange_f, 0); + COM_AddCommand("changeteam2", Command_Teamchange2_f, 0); - COM_AddCommand("playdemo", Command_Playdemo_f); - COM_AddCommand("timedemo", Command_Timedemo_f); - COM_AddCommand("stopdemo", Command_Stopdemo_f); - COM_AddCommand("playintro", Command_Playintro_f); + COM_AddCommand("playdemo", Command_Playdemo_f, 0); + COM_AddCommand("timedemo", Command_Timedemo_f, 0); + COM_AddCommand("stopdemo", Command_Stopdemo_f, 0); + COM_AddCommand("playintro", Command_Playintro_f, 0); - COM_AddCommand("resetcamera", Command_ResetCamera_f); + COM_AddCommand("resetcamera", Command_ResetCamera_f, 0); - COM_AddCommand("setcontrol", Command_Setcontrol_f); - COM_AddCommand("setcontrol2", Command_Setcontrol2_f); + COM_AddCommand("setcontrol", Command_Setcontrol_f, 0); + COM_AddCommand("setcontrol2", Command_Setcontrol2_f, 0); - COM_AddCommand("screenshot", M_ScreenShot); - COM_AddCommand("startmovie", Command_StartMovie_f); - COM_AddCommand("stopmovie", Command_StopMovie_f); + COM_AddCommand("screenshot", M_ScreenShot, 0); + COM_AddCommand("startmovie", Command_StartMovie_f, 0); + COM_AddCommand("stopmovie", Command_StopMovie_f, 0); CV_RegisterVar(&cv_screenshot_option); CV_RegisterVar(&cv_screenshot_folder); @@ -725,7 +725,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ghost_last); CV_RegisterVar(&cv_ghost_guest); - COM_AddCommand("displayplayer", Command_Displayplayer_f); + COM_AddCommand("displayplayer", Command_Displayplayer_f, 0); // FIXME: not to be here.. but needs be done for config loading CV_RegisterVar(&cv_globalgamma); @@ -881,7 +881,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ps_descriptor); // ingame object placing - COM_AddCommand("objectplace", Command_ObjectPlace_f); + COM_AddCommand("objectplace", Command_ObjectPlace_f, 0); //COM_AddCommand("writethings", Command_Writethings_f); CV_RegisterVar(&cv_speed); CV_RegisterVar(&cv_opflags); @@ -893,32 +893,32 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_freedemocamera); // add cheat commands - COM_AddCommand("noclip", Command_CheatNoClip_f); - COM_AddCommand("god", Command_CheatGod_f); - COM_AddCommand("notarget", Command_CheatNoTarget_f); - COM_AddCommand("getallemeralds", Command_Getallemeralds_f); - COM_AddCommand("resetemeralds", Command_Resetemeralds_f); - COM_AddCommand("setrings", Command_Setrings_f); - COM_AddCommand("setlives", Command_Setlives_f); - COM_AddCommand("setcontinues", Command_Setcontinues_f); - COM_AddCommand("devmode", Command_Devmode_f); - COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f); - COM_AddCommand("scale", Command_Scale_f); - COM_AddCommand("gravflip", Command_Gravflip_f); - COM_AddCommand("hurtme", Command_Hurtme_f); - COM_AddCommand("jumptoaxis", Command_JumpToAxis_f); - COM_AddCommand("charability", Command_Charability_f); - COM_AddCommand("charspeed", Command_Charspeed_f); - COM_AddCommand("teleport", Command_Teleport_f); - COM_AddCommand("rteleport", Command_RTeleport_f); - COM_AddCommand("skynum", Command_Skynum_f); - COM_AddCommand("weather", Command_Weather_f); - COM_AddCommand("toggletwod", Command_Toggletwod_f); + COM_AddCommand("noclip", Command_CheatNoClip_f, 0); + COM_AddCommand("god", Command_CheatGod_f, 0); + COM_AddCommand("notarget", Command_CheatNoTarget_f, 0); + COM_AddCommand("getallemeralds", Command_Getallemeralds_f, 0); + COM_AddCommand("resetemeralds", Command_Resetemeralds_f, 0); + COM_AddCommand("setrings", Command_Setrings_f, 0); + COM_AddCommand("setlives", Command_Setlives_f, 0); + COM_AddCommand("setcontinues", Command_Setcontinues_f, 0); + COM_AddCommand("devmode", Command_Devmode_f, 0); + COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f, 0); + COM_AddCommand("scale", Command_Scale_f, 0); + COM_AddCommand("gravflip", Command_Gravflip_f, 0); + COM_AddCommand("hurtme", Command_Hurtme_f, 0); + COM_AddCommand("jumptoaxis", Command_JumpToAxis_f, 0); + COM_AddCommand("charability", Command_Charability_f, 0); + COM_AddCommand("charspeed", Command_Charspeed_f, 0); + COM_AddCommand("teleport", Command_Teleport_f, 0); + COM_AddCommand("rteleport", Command_RTeleport_f, 0); + COM_AddCommand("skynum", Command_Skynum_f, 0); + COM_AddCommand("weather", Command_Weather_f, 0); + COM_AddCommand("toggletwod", Command_Toggletwod_f, 0); #ifdef _DEBUG - COM_AddCommand("causecfail", Command_CauseCfail_f); + COM_AddCommand("causecfail", Command_CauseCfail_f, 0); #endif #ifdef LUA_ALLOW_BYTECODE - COM_AddCommand("dumplua", Command_Dumplua_f); + COM_AddCommand("dumplua", Command_Dumplua_f, 0); #endif } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c037abcd7..2b1cbfcaf 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -328,10 +328,10 @@ void HU_LoadGraphics(void) void HU_Init(void) { #ifndef NONET - COM_AddCommand("say", Command_Say_f); - COM_AddCommand("sayto", Command_Sayto_f); - COM_AddCommand("sayteam", Command_Sayteam_f); - COM_AddCommand("csay", Command_CSay_f); + COM_AddCommand("say", Command_Say_f, 0); + COM_AddCommand("sayto", Command_Sayto_f, 0); + COM_AddCommand("sayteam", Command_Sayteam_f, 0); + COM_AddCommand("csay", Command_CSay_f, 0); RegisterNetXCmd(XD_SAY, Got_Saycmd); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 82d078062..9ca21841b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3909,7 +3909,7 @@ void M_Init(void) { int i; - COM_AddCommand("manual", Command_Manual_f); + COM_AddCommand("manual", Command_Manual_f, 0); CV_RegisterVar(&cv_nextmap); CV_RegisterVar(&cv_newgametype); diff --git a/src/mserv.c b/src/mserv.c index 5e198c9fd..376774b23 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -97,8 +97,8 @@ void AddMServCommands(void) CV_RegisterVar(&cv_masterserver_token); CV_RegisterVar(&cv_servername); #ifdef MASTERSERVER - COM_AddCommand("listserv", Command_Listserv_f); - COM_AddCommand("masterserver_update", Update_parameters); // allows people to updates manually in case you were delisted by accident + COM_AddCommand("listserv", Command_Listserv_f, 0); + COM_AddCommand("masterserver_update", Update_parameters, 0); // allows people to updates manually in case you were delisted by accident #endif #endif } diff --git a/src/s_sound.c b/src/s_sound.c index f28a77a80..c230ea3c4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -289,8 +289,8 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_miditimiditypath); #endif - COM_AddCommand("tunes", Command_Tunes_f); - COM_AddCommand("restartaudio", Command_RestartAudio_f); + COM_AddCommand("tunes", Command_Tunes_f, 0); + COM_AddCommand("restartaudio", Command_RestartAudio_f, 0); } static void SetChannelsNum(void) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 02f0e462e..2ad97108c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1784,10 +1784,10 @@ void I_StartupGraphics(void) if (graphics_started) return; - COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f); - COM_AddCommand ("vid_info", VID_Command_Info_f); - COM_AddCommand ("vid_modelist", VID_Command_ModeList_f); - COM_AddCommand ("vid_mode", VID_Command_Mode_f); + COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f, 0); + COM_AddCommand ("vid_info", VID_Command_Info_f, 0); + COM_AddCommand ("vid_modelist", VID_Command_ModeList_f, 0); + COM_AddCommand ("vid_mode", VID_Command_Mode_f, 0); CV_RegisterVar (&cv_vidwait); CV_RegisterVar (&cv_stretch); CV_RegisterVar (&cv_alwaysgrabmouse); diff --git a/src/z_zone.c b/src/z_zone.c index b949730e3..d0722b84c 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -116,10 +116,10 @@ void Z_Init(void) CONS_Printf("System memory: %uMB - Free: %uMB\n", total>>20, memfree); // Note: This allocates memory. Watch out. - COM_AddCommand("memfree", Command_Memfree_f); + COM_AddCommand("memfree", Command_Memfree_f, 0); #ifdef ZDEBUG - COM_AddCommand("memdump", Command_Memdump_f); + COM_AddCommand("memdump", Command_Memdump_f, 0); #endif }