2 CLASS(NexuizSingleplayerDialog) EXTENDS(NexuizDialog)
3 METHOD(NexuizSingleplayerDialog, fill, void(entity))
4 ATTRIB(NexuizSingleplayerDialog, title, string, "Singleplayer")
5 ATTRIB(NexuizSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
6 ATTRIB(NexuizSingleplayerDialog, intendedWidth, float, 0.80)
7 ATTRIB(NexuizSingleplayerDialog, rows, float, 24)
8 ATTRIB(NexuizSingleplayerDialog, columns, float, 5)
9 ATTRIB(NexuizSingleplayerDialog, campaignBox, entity, NULL)
10 ENDCLASS(NexuizSingleplayerDialog)
15 void InstantAction_LoadMap(entity btn, entity dummy)
19 glob = search_begin("maps/*.instantaction", TRUE, TRUE);
22 i = ceil(random() * search_getsize(glob)) - 1;
23 fh = fopen(search_getfilename(glob, i), FILE_READ);
27 while((s = fgets(fh)))
29 if(substring(s, 0, 4) == "set ")
30 s = substring(s, 4, strlen(s) - 4);
32 if(argv(0) == "bot_number")
33 cvar_set("bot_number", argv(1));
34 else if(argv(0) == "skill")
35 cvar_set("skill", argv(1));
36 else if(argv(0) == "timelimit")
37 cvar_set("timelimit_override", argv(1));
38 else if(argv(0) == "fraglimit")
39 cvar_set("fraglimit_override", argv(1));
40 else if(argv(0) == "changelevel")
43 MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH);
44 MapInfo_LoadMap(argv(1));
45 cvar_set("lastlevel", "1");
52 void fillNexuizSingleplayerDialog(entity me)
57 me.TDempty(me, (me.columns - 2) / 2);
58 me.TD(me, 2, 2, e = makeNexuizButton("Instant action!", '0 0 0'));
59 e.onClick = InstantAction_LoadMap;
60 e.onClickEntity = NULL;
64 me.TD(me, me.rows - 5, me.columns, me.campaignBox = makeNexuizCampaignList());
66 me.gotoXY(me, me.rows - 1, 0);
67 me.TD(me, 1, me.columns, e = makeNexuizButton("Start!", '0 0 0'));
68 e.onClick = CampaignList_LoadMap;
69 e.onClickEntity = me.campaignBox;