]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/menu/nexuiz/modbutton.c
a very simple approach at switching between havoc and data
[divverent/nexuiz.git] / data / qcsrc / menu / nexuiz / modbutton.c
1 #ifdef INTERFACE
2 CLASS(NexuizModButton) EXTENDS(NexuizButton)
3         METHOD(NexuizModButton, configureNexuizModButton, void(entity))
4 ENDCLASS(NexuizModButton)
5 entity makeNexuizModButton();
6 void NexuizModButton_Click(entity me, entity other);
7 #endif
8
9 #ifdef IMPLEMENTATION
10 entity makeNexuizModButton()
11 {
12         entity me;
13         me = spawnNexuizModButton();
14         me.configureNexuizModButton(me);
15         return me;
16 }
17
18 void NexuizModButton_Click(entity me, entity other)
19 {
20         if (cvar_string("menu_slist_modfilter") == "havoc")
21                 cmd("gamedir data; menu_restart");
22         else
23                 cmd("gamedir havoc; menu_restart");
24 }
25
26 void configureNexuizModButtonNexuizModButton(entity me)
27 {
28         me.configureNexuizButton(me, "", '0 0 0');
29         me.onClick = NexuizModButton_Click;
30         me.onClickEntity = me;
31
32         if (cvar_string("menu_slist_modfilter") == "havoc")
33                 me.text = "Switch to Nexuiz mode";
34         else
35                 me.text = "Switch to Havoc mode";
36 }
37 #endif