]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/inputbox.qc
Put GameLogInit() code in there instead of in spawnfunc(worldspawn)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / inputbox.qc
index 6dc49c02ea7ec9df3c7d6e9437d0898b4acd0240..4a3f905288fbc6ebecc7cd34dabd38d5e00ce801 100644 (file)
@@ -1,43 +1,5 @@
-#ifndef INPUTBOX_H
-#define INPUTBOX_H
-#include "../item/inputbox.qc"
-CLASS(XonoticInputBox, InputBox)
-       METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string, string));
-       METHOD(XonoticInputBox, focusLeave, void(entity));
-       METHOD(XonoticInputBox, setText, void(entity, string));
-       METHOD(XonoticInputBox, keyDown, float(entity, float, float, float));
-       ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
-       ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
-       ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
-       ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
-       ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
-       ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
-       ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+#include "inputbox.qh"
 
-       ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
-
-       // Clear button attributes
-       ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
-       ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
-       ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
-       ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
-       ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
-
-       ATTRIB(XonoticInputBox, cvarName, string, string_null)
-       METHOD(XonoticInputBox, loadCvars, void(entity));
-       METHOD(XonoticInputBox, saveCvars, void(entity));
-       ATTRIB(XonoticInputBox, sendCvars, float, 0)
-
-       ATTRIB(XonoticInputBox, saveImmediately, float, 0)
-ENDCLASS(XonoticInputBox)
-entity makeXonoticInputBox_T(float, string, string theTooltip);
-entity makeXonoticInputBox(float, string);
-#endif
-
-#ifdef IMPLEMENTATION
 entity makeXonoticInputBox_T(float doEditColorCodes, string theCvar, string theTooltip)
 {
        entity me;
@@ -53,7 +15,7 @@ void XonoticInputBox_configureXonoticInputBox(entity me, float doEditColorCodes,
 {
        me.configureInputBox(me, "", 0, me.fontSize, me.image);
        me.editColorCodes = doEditColorCodes;
-       me.cvarName = (theCvar) ? theCvar : string_null;
+       me.controlledCvar = (theCvar) ? theCvar : string_null;
        me.loadCvars(me);
        setZonedTooltip(me, theTooltip, theCvar);
        me.cursorPos = strlen(me.text);
@@ -77,16 +39,16 @@ void XonoticInputBox_setText(entity me, string val)
 }
 void XonoticInputBox_loadCvars(entity me)
 {
-       if (!me.cvarName)
+       if (!me.controlledCvar)
                return;
-       SUPER(XonoticInputBox).setText(me, cvar_string(me.cvarName));
+       SUPER(XonoticInputBox).setText(me, cvar_string(me.controlledCvar));
 }
 void XonoticInputBox_saveCvars(entity me)
 {
-       if (!me.cvarName)
+       if (!me.controlledCvar)
                return;
-       cvar_set(me.cvarName, me.text);
-       CheckSendCvars(me, me.cvarName);
+       cvar_set(me.controlledCvar, me.text);
+       CheckSendCvars(me, me.controlledCvar);
 }
 float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
 {
@@ -94,7 +56,7 @@ float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
        r = 0;
        if(key == K_ENTER || key == K_KP_ENTER)
        {
-               if(me.cvarName)
+               if(me.controlledCvar)
                {
                        me.saveCvars(me);
                        r = 1;
@@ -106,4 +68,3 @@ float XonoticInputBox_keyDown(entity me, float key, float ascii, float shift)
                r = 1;
        return r;
 }
-#endif