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, intendedWidth, float, 0.9)
7 ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
8 ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
9 ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
10 ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
11 ENDCLASS(XonoticDemoBrowserTab)
12 entity makeXonoticDemoBrowserTab();
16 const float DMO_PLAY = 1;
17 const float DMO_TIME = 2;
18 void DemoConfirm_Check_Gamestatus(entity btn, entity me)
20 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
22 if(btn.democlicktype == DMO_PLAY)
23 { demolist.startDemo(demolist); }
24 else if(btn.democlicktype == DMO_TIME)
25 { demolist.timeDemo(demolist); }
27 else // already in a match, player has to confirm
29 if(btn.democlicktype == DMO_PLAY)
30 { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
31 else if(btn.democlicktype == DMO_TIME)
32 { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
36 entity makeXonoticDemoBrowserTab()
39 me = NEW(XonoticDemoBrowserTab);
40 me.configureDialog(me);
43 void XonoticDemoBrowserTab_fill(entity me)
46 demolist = makeXonoticDemoList();
49 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
50 me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
51 e.onChange = DemoList_Filter_Change;
52 e.onChangeEntity = demolist;
54 me.gotoRC(me, 0, 3.7);
55 me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
56 me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
57 e.onClick = DemoList_Refresh_Click;
58 e.onClickEntity = demolist;
60 me.gotoRC(me, 1.5, 0);
61 me.TD(me, me.rows - 2.5, me.columns, demolist);
63 me.gotoRC(me, me.rows - 1, 0);
64 me.TD(me, 1, me.columns / 2, e = makeXonoticButton_T(_("Timedemo"), '0 0 0',
65 _("Benchmark how fast your computer can run the highlighted demo")));
66 e.democlicktype = DMO_TIME;
67 e.onClick = DemoConfirm_Check_Gamestatus;
68 e.onClickEntity = me; // demolist is global anyway
69 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
70 e.democlicktype = DMO_PLAY;
71 e.onClick = DemoConfirm_Check_Gamestatus;
72 e.onClickEntity = me; // demolist is global anyway