1 #include "dialog_multiplayer_media_demo.qh"
4 #include "textlabel.qh"
9 const float DMO_PLAY = 1;
10 const float DMO_TIME = 2;
11 void DemoConfirm_Check_Gamestatus(entity btn, entity me)
13 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
15 if(btn.democlicktype == DMO_PLAY)
16 { demolist.startDemo(demolist); }
17 else if(btn.democlicktype == DMO_TIME)
18 { demolist.timeDemo(demolist); }
20 else // already in a match, player has to confirm
22 if(btn.democlicktype == DMO_PLAY)
23 { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
24 else if(btn.democlicktype == DMO_TIME)
25 { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
29 entity makeXonoticDemoBrowserTab()
32 me = NEW(XonoticDemoBrowserTab);
33 me.configureDialog(me);
36 void XonoticDemoBrowserTab_fill(entity me)
39 demolist = makeXonoticDemoList();
42 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
43 me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
44 e.onChange = DemoList_Filter_Change;
45 e.onChangeEntity = demolist;
47 me.gotoRC(me, 0, 3.7);
48 me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
49 me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
50 e.onClick = DemoList_Refresh_Click;
51 e.onClickEntity = demolist;
53 me.gotoRC(me, 1.5, 0);
54 me.TD(me, me.rows - 2.5, me.columns, demolist);
56 me.gotoRC(me, me.rows - 1, 0);
57 me.TD(me, 1, me.columns / 2, e = makeXonoticButton_T(_("Timedemo"), '0 0 0',
58 _("Benchmark how fast your computer can run the highlighted demo")));
59 e.democlicktype = DMO_TIME;
60 e.onClick = DemoConfirm_Check_Gamestatus;
61 e.onClickEntity = me; // demolist is global anyway
62 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
63 e.democlicktype = DMO_PLAY;
64 e.onClick = DemoConfirm_Check_Gamestatus;
65 e.onClickEntity = me; // demolist is global anyway