]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_multiplayer_media_demo.c
Merge remote-tracking branch 'origin/master' into samual/combined_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_multiplayer_media_demo.c
1 #ifdef INTERFACE
2 CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
3         METHOD(XonoticDemoBrowserTab, fill, void(entity))
4         ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
5         ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
6         ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
7         ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
8         ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
9 ENDCLASS(XonoticDemoBrowserTab)
10 entity makeXonoticDemoBrowserTab();
11 void Demo_Confirm(entity me, entity btn);
12 #endif
13
14 #ifdef IMPLEMENTATION
15 void DemoConfirm_Check_Gamestatus(entity me, entity btn)
16 {
17         if not(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)) // we're not in a match, lets watch the demo
18         {
19                 //TimeDemo_Click;
20                 //StartDemo_Click;
21                 return;
22         }
23         else // already in a match, player has to confirm
24         {
25                 Demo_Confirm(me, btn);
26         }
27 }
28
29 entity makeXonoticDemoBrowserTab()
30 {
31         entity me;
32         me = spawnXonoticDemoBrowserTab();
33         me.configureDialog(me);
34         return me;
35 }
36 void XonoticDemoBrowserTab_fill(entity me)
37 {
38         entity e, dlist;
39
40         me.TR(me);
41                 me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "cl_autodemo", _("Automatically record demos while playing")));
42         me.TR(me);
43         me.TR(me);
44                 me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, _("Filter:")));
45                 me.TD(me, 1, 6, e = makeXonoticInputBox(0, string_null));
46                         dlist = makeXonoticDemoList();
47                         e.onChange = DemoList_Filter_Change;
48                         e.onChangeEntity = dlist;
49                         dlist.controlledTextbox = e;
50
51         me.TR(me);
52                 me.TD(me, me.rows - 4, me.columns, dlist);
53
54         me.gotoRC(me, me.rows - 1, 0);
55                 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
56                         e.onClick = DemoConfirm_Check_Gamestatus;
57                         e.onClickEntity = dlist;
58                 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
59                         e.onClick = DemoConfirm_Check_Gamestatus;
60                         e.onClickEntity = dlist;
61 }
62 #endif