1 //************************************************************************** 2 //** 3 //** ## ## ## ## ## #### #### ### ### 4 //** ## ## ## ## ## ## ## ## ## ## #### #### 5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## 6 //** ## ## ######## ## ## ## ## ## ## ## ### ## 7 //** ### ## ## ### ## ## ## ## ## ## 8 //** # ## ## # #### #### ## ## 9 //** 10 //** $Id: p_gameinfo.cpp 4109 2009-11-13 20:30:09Z dj_jl $ 11 //** 12 //** Copyright (C) 1999-2006 Jānis Legzdiņš 13 //** 14 //** This program is free software; you can redistribute it and/or 15 //** modify it under the terms of the GNU General Public License 16 //** as published by the Free Software Foundation; either version 2 17 //** of the License, or (at your option) any later version. 18 //** 19 //** This program is distributed in the hope that it will be useful, 20 //** but WITHOUT ANY WARRANTY; without even the implied warranty of 21 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 //** GNU General Public License for more details. 23 //** 24 //************************************************************************** 25 26 // HEADER FILES ------------------------------------------------------------ 27 28 #include "gamedefs.h" 29 #include "cl_local.h" 30 #include "sv_local.h" 31 32 // MACROS ------------------------------------------------------------------ 33 34 // TYPES ------------------------------------------------------------------- 35 36 // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- 37 38 // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- 39 40 // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- 41 42 // EXTERNAL DATA DECLARATIONS ---------------------------------------------- 43 44 // PUBLIC DATA DEFINITIONS ------------------------------------------------- 45 46 IMPLEMENT_CLASS(V, GameInfo) 47 48 VGameInfo* GGameInfo; 49 50 // PRIVATE DATA DEFINITIONS ------------------------------------------------ 51 52 // CODE -------------------------------------------------------------------- 53 54 //========================================================================== 55 // 56 // VGameInfo::VGameInfo 57 // 58 //========================================================================== 59 VGameInfo()60VGameInfo::VGameInfo() 61 : PlayerClasses(E_NoInit) 62 { 63 } 64 65 //========================================================================== 66 // 67 // VGameInfo::IsPaused 68 // 69 //========================================================================== 70 IsPaused()71bool VGameInfo::IsPaused() 72 { 73 guard(VGameInfo::IsPaused); 74 if (NetMode <= NM_TitleMap) 75 { 76 return false; 77 } 78 #ifdef CLIENT 79 // In single player pause game if in menu or console. 80 return (Flags & GIF_Paused) || (NetMode == NM_Standalone && 81 (MN_Active() || C_Active())); 82 #endif 83 return !!(Flags & GIF_Paused); 84 unguard; 85 } 86 87 //========================================================================== 88 // 89 // COMMAND ClearPlayerClasses 90 // 91 //========================================================================== 92 COMMAND(ClearPlayerClasses)93COMMAND(ClearPlayerClasses) 94 { 95 guard(COMMAND ClearPlayerClasses); 96 if (!ParsingKeyConf) 97 { 98 return; 99 } 100 101 GGameInfo->PlayerClasses.Clear(); 102 unguard; 103 } 104 105 //========================================================================== 106 // 107 // COMMAND AddPlayerClass 108 // 109 //========================================================================== 110 COMMAND(AddPlayerClass)111COMMAND(AddPlayerClass) 112 { 113 guard(COMMAND AddPlayerClass); 114 if (!ParsingKeyConf) 115 { 116 return; 117 } 118 119 if (Args.Num() < 2) 120 { 121 GCon->Logf("Player class name missing"); 122 return; 123 } 124 125 VClass* Class = VClass::FindClassNoCase(*Args[1]); 126 if (!Class) 127 { 128 GCon->Logf("No such class %s", *Args[1]); 129 return; 130 } 131 132 VClass* PPClass = VClass::FindClass("PlayerPawn"); 133 if (!PPClass) 134 { 135 GCon->Logf("Can't find PlayerPawn class"); 136 return; 137 } 138 139 if (!Class->IsChildOf(PPClass)) 140 { 141 GCon->Logf("%s is not a player pawn class", *Args[1]); 142 return; 143 } 144 145 GGameInfo->PlayerClasses.Append(Class); 146 unguard; 147 } 148 149 //========================================================================== 150 // 151 // COMMAND WeaponSection 152 // 153 //========================================================================== 154 COMMAND(WeaponSection)155COMMAND(WeaponSection) 156 { 157 guard(COMMAND WeaponSection); 158 GGameInfo->eventCmdWeaponSection(Args.Num() > 1 ? Args[1] : ""); 159 unguard; 160 } 161 162 //========================================================================== 163 // 164 // COMMAND SetSlot 165 // 166 //========================================================================== 167 COMMAND(SetSlot)168COMMAND(SetSlot) 169 { 170 guard(COMMAND SetSlot); 171 GGameInfo->eventCmdSetSlot(&Args); 172 unguard; 173 } 174 175 //========================================================================== 176 // 177 // COMMAND AddSlotDefault 178 // 179 //========================================================================== 180 COMMAND(AddSlotDefault)181COMMAND(AddSlotDefault) 182 { 183 guard(COMMAND AddSlotDefault); 184 GGameInfo->eventCmdAddSlotDefault(&Args); 185 unguard; 186 } 187