X(vector)
X(entity)
X(string)
-USING(rawfunc, float(...));
-X(rawfunc)
+
+USING(func_v, void(...));
+X(func_v)
+
+USING(func_f, float(...));
+X(func_f)
+
+USING(func_v_v, void());
+X(func_v_v)
+
+USING(func_bool_v, void(bool));
+X(func_bool_v)
+
#undef X
#define _strid(s) ITOF(reinterpret_cast(int, s))
}
// needs to be done so early because of the constants they create
+ static_init_early();
static_init();
static_init_late();
static_init_precache();
// generated file; do not modify
#include <menu/modules/chat/_mod.inc>
+#include <menu/modules/extensions/_mod.inc>
// generated file; do not modify
#include <menu/modules/chat/_mod.qh>
+#include <menu/modules/extensions/_mod.qh>
{
case CMD_REQUEST_COMMAND:
{
+ if (!autoextension_chat) {
+ return;
+ }
string prefix = arguments > 1 ? strcat(substring(command, argv_start_index(1), argv_end_index(-1)), " ") : "";
chat_command = "";
strcpy(chat_text, prefix);
{
case CMD_REQUEST_COMMAND:
{
+ if (!autoextension_chat) {
+ return;
+ }
string prefix = arguments > 1 ? strcat(substring(command, argv_start_index(1), argv_end_index(-1)), " ") : "";
chat_command = "say ";
strcpy(chat_text, prefix);
{
case CMD_REQUEST_COMMAND:
{
+ if (!autoextension_chat) {
+ return;
+ }
string prefix = arguments > 1 ? strcat(substring(command, argv_start_index(1), argv_end_index(-1)), " ") : "";
chat_command = "say_team ";
strcpy(chat_text, prefix);
#pragma once
+#include <menu/modules/extensions/interface.qh>
+
#include "commands.qh"
string autocvar__cl_hook_print;
+
+STATIC_INIT(extension_chat)
+{
+ extensions_report("org.xonotic:chat:1");
+}
}
int chat_lines_count() {
- return chat_buffer_idx + 1;
+ return chat_buffer_idx;
}
string chat_lines_get(int i) {
#pragma once
+#include <menu/modules/extensions/interface.qh>
+
string chat_command;
string chat_text;
string chat_lines_get(int i);
void chat_lines_push(string s);
+
+AUTOEXTENSION(chat, "org.xonotic:chat:1");
--- /dev/null
+// generated file; do not modify
+#include <menu/modules/extensions/commands.qc>
+#include <menu/modules/extensions/state.qc>
--- /dev/null
+// generated file; do not modify
+#include <menu/modules/extensions/commands.qh>
+#include <menu/modules/extensions/state.qh>
--- /dev/null
+#include "commands.qh"
+
+#include "state.qh"
+
+// space separated list of extensions
+void extensions_set(string s)
+{
+ for (int i = 0, n = extensions_count(); i < n; ++i) {
+ string id = extensions_get_name(i);
+ void(bool) set = extensions_get_setter(i);
+ bool enable = strhasword(s, id);
+ set(enable);
+ }
+}
+
+GENERIC_COMMAND(_cl_hook_gamestart, "_cl_hook_gamestart")
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ string s = substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
+ localcmd("\nset _cl_hook_gametype ", s, "; _cl_hook_gamestart_stage2\n");
+ extensions_set(cvar_string("_cl_extensions"));
+ cvar_set("_cl_extensions", "");
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ return;
+ }
+ }
+}
+
+GENERIC_COMMAND(_cl_extensions, "_cl_extensions")
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ string s = substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
+ extensions_set(s);
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ return;
+ }
+ }
+}
--- /dev/null
+#pragma once
--- /dev/null
+#pragma once
+
+#ifdef MENUQC
+void extensions_register(string id, void(bool) set);
+#endif
+
+#define AUTOEXTENSION(var, id) \
+ bool autoextension_##var; \
+ void autoextension_##var##_set(bool val) { \
+ autoextension_##var = val; \
+ } \
+ STATIC_INIT(autoextension_##var) \
+ { \
+ extensions_register(id, autoextension_##var##_set); \
+ }
+
+noref string autocvar__cl_extensions;
+STATIC_INIT(extensions)
+{
+ cvar_set("_cl_extensions", "");
+}
+
+#define extensions_report(id) \
+ cvar_set("_cl_extensions", cons(cvar_string("_cl_extensions"), id))
--- /dev/null
+#include "state.qh"
+
+int extensions_buffer;
+int extensions_buffer_idx;
+
+STATIC_INIT_EARLY(extensions_buffer)
+{
+ extensions_buffer = buf_create();
+}
+
+int extensions_count()
+{
+ return extensions_buffer_idx;
+}
+
+string extensions_get(int i, int fld)
+{
+ return bufstr_get(extensions_buffer, i * _EXTENSIONS_FIELDS + fld);
+}
+
+void extensions_register(string id, void(bool) set)
+{
+ int i = extensions_buffer_idx++ * _EXTENSIONS_FIELDS;
+ bufstr_set(extensions_buffer, i + EXTENSIONS_NAME, id);
+ bufstr_set(extensions_buffer, i + EXTENSIONS_SETTER, ftos(ITOF(reinterpret_cast(int, set))));
+}
--- /dev/null
+#pragma once
+
+int extensions_count();
+
+enum {
+ EXTENSIONS_NAME,
+ EXTENSIONS_SETTER,
+ _EXTENSIONS_FIELDS,
+};
+
+string extensions_get(int i, int fld);
+
+#define extensions_get_name(i) extensions_get(i, EXTENSIONS_NAME)
+
+#define extensions_get_setter(i) reinterpret_cast(func_bool_v, FTOI(stof(extensions_get(i, EXTENSIONS_SETTER))))
+