]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
MENUQC loading screen TimePath/loading
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 3 Sep 2015 02:03:48 +0000 (12:03 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 3 Sep 2015 02:03:48 +0000 (12:03 +1000)
qcsrc/menu/classes.inc
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/xonotic/dialog_tip.qc [new file with mode: 0644]
qcsrc/menu/xonotic/loadingwindow.qc [new file with mode: 0644]

index 08563a118ac7f486ddb1955887e8a8ef54294f03..a10476ab7c996c34d22fb25f79959fd3797ea2ba 100644 (file)
 #include "xonotic/dialog_singleplayer.qc"
 #include "xonotic/dialog_singleplayer_winner.qc"
 #include "xonotic/dialog_teamselect.qc"
+#include "xonotic/dialog_tip.qc"
 #include "xonotic/gametypelist.qc"
 #include "xonotic/image.qc"
 #include "xonotic/inputbox.qc"
 #include "xonotic/keybinder.qc"
 #include "xonotic/languagelist.qc"
 #include "xonotic/listbox.qc"
+#include "xonotic/loadingwindow.qc"
 #include "xonotic/mainwindow.qc"
 #include "xonotic/maplist.qc"
 #include "xonotic/nexposee.qc"
index 89966dde15a41a017a70e7fef9b09e8bc8c50c5e..225de873e26e70665003a6a662076d247f57f824 100644 (file)
@@ -145,6 +145,7 @@ void UpdateConWidthHeight(float w, float h, float p)
                {
                        draw_reset_cropped();
                        main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
+                       loading.resizeNotify(loading, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
                }
        }
        else
@@ -216,10 +217,13 @@ void m_init_delayed()
        loadTooltips();
        anim = NEW(AnimHost);
        main = NEW(MainWindow); main.configureMainWindow(main);
+       loading = NEW(LoadingWindow);
        unloadTooltips();
 
        main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
        main.focused = 1;
+       loading.resizeNotify(loading, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
+       loading.focused = true;
        menuShiftState = 0;
        menuMousePos = '0.5 0.5 0';
 
@@ -677,10 +681,11 @@ void m_tooltip(vector pos)
        }
 }
 
+float realFrametime;
+
 void m_draw(float width, float height)
 {
        float t;
-       float realFrametime;
 
        m_gamestatus();
 
@@ -1026,3 +1031,30 @@ void m_play_click_sound(string soundfile)
        if(cvar("menu_sounds"))
                localsound(soundfile);
 }
+
+void m_loading(bool signingon)
+{
+       if (!menuInitialized) return;
+
+       static float fadetime = 2;
+       static float a;
+       a = bound(0, a - 1 / fadetime * realFrametime, 1);
+
+       if (!(gamestatus & GAME_CONNECTED)) return;
+       if (signingon) a = 1;
+       cvar_set("scr_loadingscreen_scale", "0");
+       if (a) {
+               drawfill('0 0 0', eX * realconwidth + eY * realconheight, '0 0 0', a, DRAWFLAG_NORMAL);
+               string s = "gfx/loading";
+               string mapshot = cvar_string("cl_worldnamenoextension");
+               if (mapshot != "" && precache_pic(mapshot)) s = mapshot;
+               drawpic('0 0 0', s, eX * realconwidth + eY * realconheight, '1 1 1', a, DRAWFLAG_NORMAL);
+
+               float _draw_alpha = draw_alpha;
+               draw_alpha = a;
+               loading.draw(loading);
+               draw_alpha = _draw_alpha;
+       } else {
+               cvar_set("cl_worldnamenoextension", "");
+       }
+}
index 0ece40c88e4fe78f5d0c9bb14fec958fabb2ebf7..f12fc0c99a12ddc7eb4425d747dafe10b51eee9c 100644 (file)
@@ -31,6 +31,7 @@ float time;
 
 entity anim;
 entity main;
+entity loading;
 void m_hide();
 void m_display();
 void m_goto(string name);
diff --git a/qcsrc/menu/xonotic/dialog_tip.qc b/qcsrc/menu/xonotic/dialog_tip.qc
new file mode 100644 (file)
index 0000000..93c6d77
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef DIALOG_TIP_H
+#define DIALOG_TIP_H
+CLASS(XonoticTipDialog, XonoticDialog)
+    METHOD(XonoticTipDialog, fill, void(entity));
+    ATTRIB(XonoticTipDialog, title, string, _("Tip"))
+    ATTRIB(XonoticTipDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
+    ATTRIB(XonoticTipDialog, intendedWidth, float, 0.7)
+    ATTRIB(XonoticTipDialog, rows, float, 2)
+    ATTRIB(XonoticTipDialog, columns, float, 2)
+    ATTRIB(XonoticTipDialog, name, string, "Tip")
+
+    ATTRIB(XonoticTipDialog, closable, float, 0)
+
+ENDCLASS(XonoticTipDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticTipDialog_fill(entity this)
+{
+    entity e;
+    this.TR(this);
+        this.TD(this, 2, 2, e = makeXonoticTextLabel(0, "Loading"));
+        e.allowWrap = 1;
+}
+#endif
diff --git a/qcsrc/menu/xonotic/loadingwindow.qc b/qcsrc/menu/xonotic/loadingwindow.qc
new file mode 100644 (file)
index 0000000..9bdfbf3
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef LOADINGWINDOW_H
+#define LOADINGWINDOW_H
+CLASS(LoadingWindow, ModalController)
+    METHOD(LoadingWindow, configureLoadingWindow, void(entity));
+    METHOD(LoadingWindow, draw, void(entity));
+    ATTRIB(LoadingWindow, tipDialog, entity, NULL)
+    ATTRIB(LoadingWindow, fadedAlpha, float, SKINALPHA_BEHIND)
+    ATTRIB(LoadingWindow, dialogToShow, entity, NULL)
+    INIT(LoadingWindow) {
+        entity e;
+
+        this.tipDialog = e = NEW(XonoticTipDialog);
+        e.configureDialog(e);
+        this.addItemCentered(this, e, e.intendedWidth * eX + e.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
+        this.dialogToShow = this.tipDialog;
+    }
+ENDCLASS(LoadingWindow)
+#endif
+
+#ifdef IMPLEMENTATION
+void LoadingWindow_draw(entity this)
+{
+    super.draw(this);
+
+    if (this.dialogToShow)
+    {
+        DialogOpenButton_Click_withCoords(world, this.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
+        this.dialogToShow = NULL;
+    }
+}
+
+#endif