#ifdef CSQC
#include <client/commands/cl_cmd.qc>
#endif
+#include <client/commands/impulse.qc>
#ifdef CSQC
#include <client/commands/cl_cmd.qh>
#endif
+#include <client/commands/impulse.qh>
// ==============================================
#include <common/command/_mod.qh>
-#include "cl_cmd.qh"
+#include "impulse.qh"
#include "../autocvars.qh"
#include "../defs.qh"
{
int argc = tokenize_console(command);
string s = strtolower(argv(0));
+ if (s == "impulse" && impulse_handle(argv(1))) {
+ return true;
+ }
// Return value should be true if CSQC handled the command, otherwise return false to have the engine handle it.
return ConsoleCommand_macro_normal(s, argc)
|| ConsoleCommand_macro_movement(s, argc)
--- /dev/null
+#include "impulse.qh"
+
+STATIC_INIT(impulse) {
+ registercommand("impulse");
+}
+
+string impulse_sentinel = "!";
+
+bool impulse_handle(string arg)
+{
+ // taking advantage of atoi's behaviour in the engine to ignore non-digits to prevent re-entry
+ if (endsWith(arg, impulse_sentinel)) {
+ // pass to engine
+ return false;
+ }
+ int req = stoi(arg);
+ switch (req) {
+ default: {
+ impulse_var = req;
+ break;
+ }
+ }
+ return true;
+}
+
+void impulse_set(int value)
+{
+ localcmd(sprintf("impulse %d%s\n", value, impulse_sentinel));
+}
+
+void impulse_frame_end()
+{
+ impulse_set(impulse_var);
+}
--- /dev/null
+#pragma once
+
+/** impulse is an extra byte sent in input packets */
+int impulse_var;
+
+bool impulse_handle(string arg);
+
+void impulse_set(int value);
+
+void impulse_frame_end();
#include "view.qh"
-#include "autocvars.qh"
-#include "miscfunctions.qh"
#include "announcer.qh"
-#include "hud/_mod.qh"
+#include "autocvars.qh"
#include "mapvoting.qh"
+#include "miscfunctions.qh"
#include "shownames.qh"
+#include "commands/impulse.qh"
+#include "hud/_mod.qh"
#include "hud/panel/scoreboard.qh"
#include "hud/panel/quickmenu.qh"
cl_notice_run();
unpause_update();
+ impulse_frame_end();
Net_Flush();
// let's reset the view back to normal for the end