From: TimePath Date: Sun, 3 May 2015 23:24:19 +0000 (+1000) Subject: Make menu includes order insensitive X-Git-Tag: xonotic-v0.8.1~61^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b24dabd36554f22b7b62525fe58c5022584461f5;p=xonotic%2Fxonotic-data.pk3dir.git Make menu includes order insensitive --- diff --git a/qcsrc/menu/command/commands.qc b/qcsrc/menu/command/commands.qc index 9d74fbb54..5b5911fa9 100644 --- a/qcsrc/menu/command/commands.qc +++ b/qcsrc/menu/command/commands.qc @@ -1,3 +1,5 @@ +#include "../menu.qh" + #include "../../common/command/commands.qc" #include "menu_cmd.qc" diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc index 93825cd56..3f3f72f57 100644 --- a/qcsrc/menu/command/menu_cmd.qc +++ b/qcsrc/menu/command/menu_cmd.qc @@ -1,7 +1,12 @@ #include "menu_cmd.qh" +#include "../menu.qh" +#include "../oo/classes.qc" + #include "../../common/command/generic.qh" +.entity firstChild, nextSibling; + string _dumptree_space; void _dumptree_open(entity pass, entity me) { @@ -29,6 +34,8 @@ void _dumptree_close(entity pass, entity me) } } +float updateConwidths(float width, float height, float pixelheight); + void GameCommand(string theCommand) { float argc; diff --git a/qcsrc/menu/draw.qc b/qcsrc/menu/draw.qc index 05e7af227..2796c0570 100644 --- a/qcsrc/menu/draw.qc +++ b/qcsrc/menu/draw.qc @@ -1,7 +1,6 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "draw.qh" +#include "../common/util.qh" +#include "../common/constants.qh" string draw_mousepointer; vector draw_mousepointer_offset; diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index a8a3213f2..669e08fe7 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -1,7 +1,9 @@ -#if defined(CSQC) -#elif defined(MENUQC) -#elif defined(SVQC) -#endif +#include "menu.qh" +#include "oo/classes.qc" +#include "xonotic/util.qh" + +#include "../common/weapons/weapons.qh" +#include "../common/mapinfo.qh" /////////////////////////////////////////////// // Menu Source File diff --git a/qcsrc/menu/menu.qh b/qcsrc/menu/menu.qh index 33d467c2a..020a65a20 100644 --- a/qcsrc/menu/menu.qh +++ b/qcsrc/menu/menu.qh @@ -50,6 +50,8 @@ void postMenuDraw(); // this is run just after the menu is drawn (or not). Usefu void m_sync(); +void draw_reset_cropped(); + // sounds const string MENU_SOUND_CLEAR = "sound/menu/clear.wav"; diff --git a/qcsrc/menu/oo/base.qh b/qcsrc/menu/oo/base.qh index 60b2f8b31..db1dfcf6a 100644 --- a/qcsrc/menu/oo/base.qh +++ b/qcsrc/menu/oo/base.qh @@ -1,6 +1,9 @@ #ifndef BASE_H #define BASE_H +#include "../../common/util.qh" +#include "../../dpdefs/keycodes.qh" + #define NULL (null_entity) #define world NULL @@ -28,4 +31,37 @@ entity spawnObject(entity this, entity) #define NEW(cname) (spawn##cname(null_entity, null_entity)) +#define CLASS(cname, base) \ +entity spawn##cname(entity this, entity basevtbl) { \ + this = NEW(base); basevtbl = base##_vtbl; \ +} + +#define METHOD(cname, name, prototype) \ +prototype cname##_##name; \ +.prototype name; \ +[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \ + this.name = cname##_##name; \ +} + +#define ATTRIB(cname, name, type, val) \ +.type name; \ +[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \ + this.name = val; \ +} + +#define ATTRIBARRAY(cname, name, type, cnt) \ +.type name[cnt]; + +#define ENDCLASS(cname) \ +.bool instanceOf##cname; \ +entity cname##_vtbl; \ +[[last]] entity spawn##cname(entity this, entity basevtbl) { \ + this.instanceOf##cname = true; \ + this.classname = #cname; \ + if (!cname##_vtbl) cname##_vtbl = spawnVtbl(this, basevtbl); \ + return this; \ +} + +#define SUPER(cname) (cname##_vtbl.vtblbase) + #endif diff --git a/qcsrc/menu/oo/classes.qc b/qcsrc/menu/oo/classes.qc index 95bc0b28b..2170a83fc 100644 --- a/qcsrc/menu/oo/classes.qc +++ b/qcsrc/menu/oo/classes.qc @@ -1,55 +1,9 @@ +#ifndef CLASSES_H +#define CLASSES_H #include "base.qh" -#ifdef CLASS -#undef CLASS -#undef METHOD -#undef ATTRIB -#undef ATTRIBARRAY -#undef ENDCLASS -#undef SUPER -#endif - -#define CLASS(cname, base) \ -entity spawn##cname(entity this, entity basevtbl) { \ - this = NEW(base); basevtbl = base##_vtbl; \ -} - -#define METHOD(cname, name, prototype) \ -prototype cname##_##name; \ -.prototype name; \ -[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \ - this.name = cname##_##name; \ -} - -#define ATTRIB(cname, name, type, val) \ -.type name; \ -[[accumulate]] entity spawn##cname(entity this, entity basevtbl) { \ - this.name = val; \ -} - -#define ATTRIBARRAY(cname, name, type, cnt) \ -.type name[cnt]; - -#define ENDCLASS(cname) \ -.bool instanceOf##cname; \ -entity cname##_vtbl; \ -[[last]] entity spawn##cname(entity this, entity basevtbl) { \ - this.instanceOf##cname = true; \ - this.classname = #cname; \ - if (!cname##_vtbl) cname##_vtbl = spawnVtbl(this, basevtbl); \ - return this; \ -} - -#define SUPER(cname) (cname##_vtbl.vtblbase) - -#ifdef IMPLEMENTATION -#undef IMPLEMENTATION -#endif - #include "../classes.inc" - -#ifndef IMPLEMENTATION #define IMPLEMENTATION -#endif - #include "../classes.inc" + +#endif diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 330b2bb72..444292712 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -1,4 +1,12 @@ +#include "util.qh" +#include "../menu.qh" +#include "../oo/base.qh" +#include "../../common/campaign_common.qh" +#include "../../common/constants.qh" +#include "../../common/mapinfo.qh" #include "../../common/urllib.qh" +#include "../../common/util.qh" +#include "../../common/command/generic.qh" float GL_CheckExtension(string ext) { @@ -43,6 +51,7 @@ string getZonedTooltipForIdentifier(string s) return string_null; } +.entity parent, firstChild, nextSibling; void forAllDescendants(entity root, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass) { depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass); @@ -52,11 +61,15 @@ void forAllDescendants(entity root, void(entity, entity) funcPre, void(entity, e void SUB_Null_ee(entity e1, entity e2) { } + +.void(entity) saveCvars; void saveCvarsOf(entity ignore, entity e) { if(e.saveCvars) e.saveCvars(e); } + +.void(entity) loadCvars; void loadCvarsOf(entity ignore, entity e) { if(e.loadCvars) @@ -135,6 +148,7 @@ void makeCallback(entity e, entity cbent, void(entity, entity) cbfunc) .string cvarString_setDependent; .string cvarValue_setDependent; .float(entity) func_setDependent; +.bool disabled; void setDependent_Check(entity e) { float f; @@ -181,6 +195,7 @@ void setDependent_Draw(entity e) setDependent_Check(e); e.draw_setDependent(e); } +.void(entity) draw; void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax) { e.draw_setDependent = e.draw; @@ -529,6 +544,8 @@ void postMenuDraw() draw_CenterText('0.5 0.1 0', sprintf(_("^1%s TEST BUILD"), autocvar_menu_watermark), globalToBoxSize('32 32 0', draw_scale), '1 1 1', 0.05, 1); } } +void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize); +.entity winnerDialog; void preMenuDraw() { vector fs, sz = '0 0 0', line, mid; @@ -709,6 +726,18 @@ string GameType_GetIcon(int cnt) return ""; } +.void(entity) TR; +.void(entity, float, float, entity) TD; +.void(entity, float) TDempty; +entity makeXonoticTextLabel(float theAlign, string theText); +entity makeXonoticTextSlider(string); +.void(entity, string, string) addValue; +.void(entity) configureXonoticTextSliderValues; +entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar); +entity makeXonoticCheckBoxString(string, string, string, string); +entity makeXonoticCheckBox(float, string, string); +.bool sendCvars; + void dialog_hudpanel_common_notoggle(entity me, string panelname) { float i; diff --git a/qcsrc/test/compilationunit.sh b/qcsrc/test/compilationunit.sh index 784784f3b..e4f387861 100755 --- a/qcsrc/test/compilationunit.sh +++ b/qcsrc/test/compilationunit.sh @@ -29,5 +29,5 @@ check "client" clientdefs[@] serverdefs=("-DSVQC" "common/util-pre.qh" "server/sys-pre.qh" "dpdefs/progsdefs.qh" "dpdefs/dpextensions.qh" "server/sys-post.qh" "server/defs.qh" "server/autocvars.qh") check "server" serverdefs[@] -# menudefs=("-DMENUQC" "common/util-pre.qh" "dpdefs/menudefs.qh" "menu/oo/interface.qc" "menu/oo/implementation.qc") -# check "menu" menudefs[@] +menudefs=("-DMENUQC" "common/util-pre.qh" "dpdefs/menudefs.qh") +check "menu" menudefs[@]