Nuclide
Software Development Kit for id Technology (BETA)
map.h
1
3void
4Map_NewGame(int skillValue)
5{
6 if (fileExists("cfg/chapter1.cfg")) {
7 localcmd("maxplayers 1\ndeathmatch 0\ncoop 0\nexec cfg/chapter1.cfg");
8 } else {
9 localcmd( sprintf("skill %i\nmaxplayers 1\ndeathmatch 0\ncoop 0\nset g_gametype \"\"\n%s", skillValue, GameLibrary_GetInfo(GAMEINFO_STARTMAP)) );
10 }
11
13 switch (skillValue) {
14 case 1:
15 RichPresence_Set("status", "Singleplayer: Normal");
16 break;
17 case 2:
18 RichPresence_Set("status", "Singleplayer: Medium");
19 break;
20 case 3:
21 RichPresence_Set("status", "Singleplayer: Hard");
22 break;
23 }
24}
25
27void
28Map_Training(void)
29{
31 RichPresence_Set("status", "Training");
32 localcmd( sprintf("maxplayers 1\ndeathmatch 0\ncoop 0\nskill 2\nset g_gametype \"\"\n%s", GameLibrary_GetInfo(GAMEINFO_TRAININGMAP)) );
33}
34
36void
37Map_SpawnServer(string hostName, string mapName, int maxPlayers, string gameType, string passWord)
38{
39 localcmd( sprintf( "hostname %s\n", hostName ) );
40 localcmd( sprintf( "maxplayers %i\n", maxPlayers ) );
41 localcmd( sprintf( "sv_password %s\n", passWord ) );
42 localcmd( sprintf( "g_gametype %s\n", gameType ) );
43 localcmd( sprintf( "map %s\n", mapName ) );
45 RichPresence_Set("status", sprintf("Multiplayer: %s", mapName));
46}
__variant GameLibrary_GetInfo(gameInfo_t)
Retrieves fields for the currently running game.
Definition: gamelibrary.qc:789
@ GAMEINFO_STARTMAP
(string) The command for starting a new game.
Definition: gamelibrary.h:70
@ GAMEINFO_TRAININGMAP
(string) The command for starting the training.
Definition: gamelibrary.h:71
void RichPresence_Set(string strKey, string strValue)
Sets a rich-presence key to the desired value.
Definition: richpresence.qc:32
void RichPresence_Clear(void)
Clears the current rich-presence status.
Definition: richpresence.qc:52