1 #ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_H
2 #define DIALOG_MULTIPLAYER_MEDIA_DEMO_H
4 CLASS(XonoticDemoBrowserTab, XonoticTab)
5 METHOD(XonoticDemoBrowserTab, fill, void(entity))
6 ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
7 ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
8 ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
9 ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
10 ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
11 ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
12 ENDCLASS(XonoticDemoBrowserTab)
13 entity makeXonoticDemoBrowserTab();
17 const float DMO_PLAY = 1;
18 const float DMO_TIME = 2;
19 void DemoConfirm_Check_Gamestatus(entity btn, entity me)
21 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
23 if(btn.democlicktype == DMO_PLAY)
24 { demolist.startDemo(demolist); }
25 else if(btn.democlicktype == DMO_TIME)
26 { demolist.timeDemo(demolist); }
28 else // already in a match, player has to confirm
30 if(btn.democlicktype == DMO_PLAY)
31 { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
32 else if(btn.democlicktype == DMO_TIME)
33 { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
37 entity makeXonoticDemoBrowserTab()
40 me = NEW(XonoticDemoBrowserTab);
41 me.configureDialog(me);
44 void XonoticDemoBrowserTab_fill(entity me)
47 demolist = makeXonoticDemoList();
50 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
51 me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
52 e.onChange = DemoList_Filter_Change;
53 e.onChangeEntity = demolist;
54 demolist.controlledTextbox = e;
56 me.gotoRC(me, 0, 3.7);
57 me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
58 me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
59 e.onClick = DemoList_Refresh_Click;
60 e.onClickEntity = demolist;
62 me.gotoRC(me, 1.5, 0);
63 me.TD(me, me.rows - 2.5, me.columns, demolist);
65 me.gotoRC(me, me.rows - 1, 0);
66 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
67 e.democlicktype = DMO_TIME;
68 e.onClick = DemoConfirm_Check_Gamestatus;
69 e.onClickEntity = me; // demolist is global anyway
70 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
71 e.democlicktype = DMO_PLAY;
72 e.onClick = DemoConfirm_Check_Gamestatus;
73 e.onClickEntity = me; // demolist is global anyway