Guest User

Untitled

a guest
Sep 7th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.05 KB | None | 0 0
  1. diff -urN a/neo/framework/UsercmdGen.h b/neo/framework/UsercmdGen.h
  2. --- a/neo/framework/UsercmdGen.h 2012-01-07 12:45:20.000000000 +0100
  3. +++ b/neo/framework/UsercmdGen.h 2012-01-10 01:19:49.695084393 +0100
  4. @@ -81,6 +81,7 @@
  5. const int IMPULSE_27 = 27; // <unused>
  6. const int IMPULSE_28 = 28; // vote yes
  7. const int IMPULSE_29 = 29; // vote no
  8. +const int IMPULSE_30 = 30; // SnoopJeDi - Toggle Stats Debug
  9. const int IMPULSE_40 = 40; // use vehicle
  10.  
  11. // usercmd_t->flags
  12. diff -urN a/neo/game/ai/AI.cpp b/neo/game/ai/AI.cpp
  13. --- a/neo/game/ai/AI.cpp 2012-01-07 12:45:20.000000000 +0100
  14. +++ b/neo/game/ai/AI.cpp 2012-01-10 00:08:32.657159375 +0100
  15. @@ -719,6 +719,8 @@
  16. return;
  17. }
  18.  
  19. + gameLocal.monsters++; // SnoopJeDi
  20. +
  21. spawnArgs.GetInt( "team", "1", team );
  22. spawnArgs.GetInt( "rank", "0", rank );
  23. spawnArgs.GetInt( "fly_offset", "0", fly_offset );
  24. @@ -1053,6 +1055,9 @@
  25. if ( CheckDormant() ) {
  26. return;
  27. }
  28. + if ( gameLocal.GetLocalPlayer()->statsUIopen ) //SnoopJeDi - Don't Think() so!
  29. + return;
  30. +
  31.  
  32. if ( thinkFlags & TH_THINK ) {
  33. // clear out the enemy when he dies or is hidden
  34. @@ -3395,9 +3400,15 @@
  35. kv = spawnArgs.MatchPrefix( "def_drops", kv );
  36. }
  37.  
  38. - if ( ( attacker && attacker->IsType( idPlayer::Type ) ) && ( inflictor && !inflictor->IsType( idSoulCubeMissile::Type ) ) ) {
  39. + /*if ( ( attacker && attacker->IsType( idPlayer::Type ) ) && ( inflictor && !inflictor->IsType( idSoulCubeMissile::Type ) ) ) {
  40. static_cast< idPlayer* >( attacker )->AddAIKill();
  41. - }
  42. + }*/
  43. + // SnoopJeDi - If stats makes it to coop, this needs to be unborked, and
  44. + // original attacker info needs to be passed along the barrel chain.
  45. +
  46. + if ( !gameLocal.isMultiplayer )
  47. + gameLocal.GetLocalPlayer()->AddAIKill();
  48. +
  49. }
  50.  
  51. /***********************************************************************
  52. diff -urN a/neo/game/Entity.cpp b/neo/game/Entity.cpp
  53. --- a/neo/game/Entity.cpp 2012-01-07 12:45:20.000000000 +0100
  54. +++ b/neo/game/Entity.cpp 2012-01-10 00:08:32.658159447 +0100
  55. @@ -4103,6 +4103,17 @@
  56.  
  57. /*
  58. ================
  59. +idEntity::FadeMusic
  60. +================
  61. +*/
  62. +void idEntity::FadeMusic( int channel, float to, float over ) { //SnoopJeDi
  63. + if ( spawnArgs.GetBool( "s_music" ) ) {
  64. + Event_FadeSound( channel, to, over );
  65. + }
  66. +}
  67. +
  68. +/*
  69. +================
  70. idEntity::Event_GetWorldOrigin
  71. ================
  72. */
  73. diff -urN a/neo/game/Entity.h b/neo/game/Entity.h
  74. --- a/neo/game/Entity.h 2012-01-07 12:45:20.000000000 +0100
  75. +++ b/neo/game/Entity.h 2012-01-10 00:08:32.658159447 +0100
  76. @@ -360,6 +360,7 @@
  77.  
  78. void ServerSendEvent( int eventId, const idBitMsg *msg, bool saveEvent, int excludeClient ) const;
  79. void ClientSendEvent( int eventId, const idBitMsg *msg ) const;
  80. + void FadeMusic( int channel, float to, float over ); // SnoopJeDi
  81.  
  82. protected:
  83. renderEntity_t renderEntity; // used to present a model to the renderer
  84. diff -urN a/neo/game/Game_local.cpp b/neo/game/Game_local.cpp
  85. --- a/neo/game/Game_local.cpp 2012-01-07 12:45:20.000000000 +0100
  86. +++ b/neo/game/Game_local.cpp 2012-01-10 01:45:07.570047682 +0100
  87. @@ -46,6 +46,7 @@
  88. #include "WorldSpawn.h"
  89. #include "Misc.h"
  90. #include "Trigger.h"
  91. +#include "Sound.h"
  92.  
  93. #include "Game_local.h"
  94.  
  95. @@ -187,6 +188,7 @@
  96. num_entities = 0;
  97. spawnedEntities.Clear();
  98. activeEntities.Clear();
  99. + musicSpeakers.Clear(); // SnoopJeDi - Housekeeping!
  100. numEntitiesToDeactivate = 0;
  101. sortPushers = false;
  102. sortTeamMasters = false;
  103. @@ -307,6 +309,15 @@
  104.  
  105. InitConsoleCommands();
  106.  
  107. + if ( !g_lms_bind_run_once.GetBool() ) { // SnoopJeDi - LMS addition
  108. + //The default config file contains proper value for mod_validSkins cvar.
  109. + //We want to run this once after the base doom config file has run so we can
  110. + //have the correct xp binds
  111. + cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "exec default.cfg\n" );
  112. + cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "seta g_lms_bind_run_once 1\n" );
  113. + cmdSystem->ExecuteCommandBuffer();
  114. + }
  115. +
  116. // load default scripts
  117. program.Startup( SCRIPT_DEFAULT );
  118.  
  119. @@ -525,6 +536,14 @@
  120. savegame.WriteInt( framenum );
  121. savegame.WriteInt( previousTime );
  122. savegame.WriteInt( time );
  123. +
  124. + savegame.WriteInt( monsters ); // SnoopJeDi - Added by deadite4
  125. + savegame.WriteInt( items ); // SnoopJeDi
  126. + int numsecrets = secretAreas.Num();
  127. + savegame.WriteInt( numsecrets );
  128. + for ( i = 0; i != numsecrets; i++ ) {
  129. + savegame.WriteInt( secretAreas[ i ] );
  130. + }
  131.  
  132. savegame.WriteInt( vacuumAreaNum );
  133.  
  134. @@ -875,6 +894,13 @@
  135. memset( spawnIds, -1, sizeof( spawnIds ) );
  136. spawnCount = INITIAL_SPAWN_COUNT;
  137.  
  138. + //musicSpeakers.Clear(); // SnoopJeDi: This doesn't feel right, might cause some weird bugs if more than one music speaker is used.
  139. + s_music_vol.ClearModified();
  140. + s_music_vol.SetModified(); // SnoopJeDi: we want to fade on level start
  141. + secretAreas.Clear(); // SnoopJeDi
  142. + monsters = 0;
  143. + items = 0;
  144. +
  145. spawnedEntities.Clear();
  146. activeEntities.Clear();
  147. numEntitiesToDeactivate = 0;
  148. @@ -1169,6 +1195,9 @@
  149. */
  150. void idGameLocal::InitFromNewMap( const char *mapName, idRenderWorld *renderWorld, idSoundWorld *soundWorld, bool isServer, bool isClient, int randseed ) {
  151.  
  152. + musicSpeakers.Clear(); // SnoopJeDi: new map, not reload, so clear the list
  153. + cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "heartbeat\n" ); // SnoopJeDi - iddevnet fix to keep server from dropping off master list
  154. +
  155. this->isServer = isServer;
  156. this->isClient = isClient;
  157. this->isMultiplayer = isServer || isClient;
  158. @@ -1188,6 +1217,9 @@
  159.  
  160. InitScriptForMap();
  161.  
  162. + monsters = 0; // SnoopJeDi
  163. + items = 0; // SnoopJeDi
  164. +
  165. MapPopulate();
  166.  
  167. mpGame.Reset();
  168. @@ -1346,7 +1378,16 @@
  169. savegame.ReadInt( framenum );
  170. savegame.ReadInt( previousTime );
  171. savegame.ReadInt( time );
  172. -
  173. +
  174. + savegame.ReadInt( monsters ); // SnoopJeDi
  175. + savegame.ReadInt( items ); // SnoopJeDi
  176. + int numsecrets;
  177. + savegame.ReadInt( numsecrets );
  178. + secretAreas.SetNum( numsecrets, true ); // Resize the list so we don't violate memory rules
  179. + for ( i = 0; i != numsecrets; i++ ) {
  180. + savegame.ReadInt( secretAreas[ i ] );
  181. + }
  182. +
  183. savegame.ReadInt( vacuumAreaNum );
  184.  
  185. savegame.ReadInt( entityDefBits );
  186. @@ -2198,6 +2239,8 @@
  187. previousTime = time;
  188. time += msec;
  189. realClientTime = time;
  190. + if ( !isMultiplayer )
  191. + GetLocalPlayer()->inventory.time = time; // SnoopJeDi - source of dedserver bug 5/21/06
  192.  
  193. #ifdef GAME_DLL
  194. // allow changing SIMD usage on the fly
  195. @@ -2453,6 +2496,16 @@
  196. ================
  197. */
  198. bool idGameLocal::Draw( int clientNum ) {
  199. +
  200. + if ( s_music_vol.IsModified() ) { //SnoopJeDi, fade that sound!
  201. + for ( int i = 0; i < musicSpeakers.Num(); i++ ) {
  202. + idSound* ent = static_cast<idSound *>(entities[ musicSpeakers[ i ] ]);
  203. + if (ent)
  204. + ent->FadeMusic( 0, s_music_vol.GetFloat(), 0 );
  205. + }
  206. + s_music_vol.ClearModified();
  207. + }
  208. +
  209. if ( isMultiplayer ) {
  210. return mpGame.Draw( clientNum );
  211. }
  212. @@ -3127,6 +3180,8 @@
  213.  
  214. if ( isMultiplayer ) {
  215. spawnArgs.GetBool( "not_multiplayer", "0", result );
  216. +// } else if ( !isMultiplayer ) {
  217. +// spawnArgs.GetBool( "not_sp", "0", result ); // SnoopJeDi - MP stuff
  218. } else if ( g_skill.GetInteger() == 0 ) {
  219. spawnArgs.GetBool( "not_easy", "0", result );
  220. } else if ( g_skill.GetInteger() == 1 ) {
  221. @@ -4225,7 +4280,7 @@
  222. */
  223. void idGameLocal::UpdateServerInfoFlags() {
  224. gameType = GAME_SP;
  225. - if ( ( idStr::Icmp( serverInfo.GetString( "si_gameType" ), "deathmatch" ) == 0 ) ) {
  226. + if ( ( ( idStr::Icmp( serverInfo.GetString( "si_gameType" ), "deathmatch" ) == 0 ) ) || ( ( idStr::Icmp( serverInfo.GetString( "si_gameType" ), "cdoomDM" ) == 0 ) ) ) {
  227. gameType = GAME_DM;
  228. } else if ( ( idStr::Icmp( serverInfo.GetString( "si_gameType" ), "Tourney" ) == 0 ) ) {
  229. gameType = GAME_TOURNEY;
  230. @@ -4376,3 +4431,22 @@
  231. ===============
  232. */
  233. void idGameLocal::GetMapLoadingGUI( char gui[ MAX_STRING_CHARS ] ) { }
  234. +
  235. +/*
  236. +====================
  237. +idGameLocal::DeactivateSecretAreas - SnoopJeDi
  238. +Multiple func_secret entities can be used for one secret (ie. E1M1 hallway).
  239. +Once triggered, all entities with the same SecretNum will be deactivated.
  240. +====================
  241. +*/
  242. +void idGameLocal::DeactivateSecretAreas( int areanum ) {
  243. + for ( idEntity * ent = spawnedEntities.Next(); ent != NULL; ent = ent->spawnNode.Next() ) {
  244. + if ( ent->IsType( idSecret::Type ) ) {
  245. + idSecret *secret = static_cast<idSecret *>(ent);
  246. + if ( secret->GetNum() == areanum ) {
  247. + secret->Deactivate();
  248. + }
  249. + }
  250. + }
  251. +}
  252. +
  253. diff -urN a/neo/game/Game_local.h b/neo/game/Game_local.h
  254. --- a/neo/game/Game_local.h 2012-01-07 12:45:20.000000000 +0100
  255. +++ b/neo/game/Game_local.h 2012-01-10 00:28:16.030925739 +0100
  256. @@ -447,6 +447,14 @@
  257. int GetGibTime() { return nextGibTime; };
  258.  
  259. bool NeedRestart();
  260. +
  261. + // void UpdateMusicVol( idSoundEmitter *ent );
  262. + idList<int> musicSpeakers; //SnoopJeDi - holds entitynum values for speakers with s_music set
  263. + void DeactivateSecretAreas( int areanum );
  264. + int monsters;
  265. + int items;
  266. + idList<int> secretAreas;
  267. +
  268.  
  269. private:
  270. const static int INITIAL_SPAWN_COUNT = 1;
  271. diff -urN a/neo/game/gamesys/SysCmds.cpp b/neo/game/gamesys/SysCmds.cpp
  272. --- a/neo/game/gamesys/SysCmds.cpp 2012-01-07 12:45:20.000000000 +0100
  273. +++ b/neo/game/gamesys/SysCmds.cpp 2012-01-10 00:08:32.662159735 +0100
  274. @@ -317,7 +317,9 @@
  275. player->GiveItem( name );
  276. return;
  277. }
  278. -
  279. + if ( give_all ) {
  280. + player->Give( "extraammo", "1" ); // SnoopJeDi
  281. + }
  282. if ( give_all || idStr::Icmp( name, "health" ) == 0 ) {
  283. player->health = player->inventory.maxHealth;
  284. if ( !give_all ) {
  285. diff -urN a/neo/game/gamesys/SysCvar.cpp b/neo/game/gamesys/SysCvar.cpp
  286. --- a/neo/game/gamesys/SysCvar.cpp 2012-01-07 12:45:20.000000000 +0100
  287. +++ b/neo/game/gamesys/SysCvar.cpp 2012-01-10 00:11:08.171392165 +0100
  288. @@ -47,11 +47,13 @@
  289.  
  290. */
  291.  
  292. -const char *si_gameTypeArgs[] = { "singleplayer", "deathmatch", "Tourney", "Team DM", "Last Man", NULL };
  293. +const char *si_gameTypeArgs[] = { "singleplayer", "cdoomDM", "Tourney", "Team DM", "Last Man", NULL }; // SnoopJeDi
  294. const char *si_readyArgs[] = { "Not Ready", "Ready", NULL };
  295. const char *si_spectateArgs[] = { "Play", "Spectate", NULL };
  296.  
  297. -const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/characters/player/marine_mp_red", "skins/characters/player/marine_mp_blue", "skins/characters/player/marine_mp_green", "skins/characters/player/marine_mp_yellow", NULL };
  298. +const char *ui_skinArgs[] = { "skins/characters/player/doomguy_green", "skins/characters/player/doomguy_red", "skins/characters/player/doomguy_blue", "skins/characters/player/doomguy_yellow", "skins/characters/player/doomguy_indigo", "skins/characters/player/doomguy_black", "skins/characters/player/doomguy_tan", "skins/characters/player/doomguy_white", NULL };
  299. +//SnoopJeDi - Modified to allow cdoom skins 5/24/06
  300. +
  301. const char *ui_teamArgs[] = { "Red", "Blue", NULL };
  302.  
  303. struct gameVersion_s {
  304. @@ -67,7 +69,7 @@
  305.  
  306. // server info
  307. idCVar si_name( "si_name", "DOOM Server", CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE, "name of the server" );
  308. -idCVar si_gameType( "si_gameType", si_gameTypeArgs[ 0 ], CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE, "game type - singleplayer, deathmatch, Tourney, Team DM or Last Man", si_gameTypeArgs, idCmdSystem::ArgCompletion_String<si_gameTypeArgs> );
  309. +idCVar si_gameType( "si_gameType", si_gameTypeArgs[ 0 ], CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE, "game type - singleplayer, cdoomDM, Tourney, Team DM or Last Man", si_gameTypeArgs, idCmdSystem::ArgCompletion_String<si_gameTypeArgs> ); // SnoopJeDi
  310. idCVar si_map( "si_map", "game/mp/d3dm1",CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE, "map to be played next on server", idCmdSystem::ArgCompletion_MapName );
  311. idCVar si_maxPlayers( "si_maxPlayers", "4", CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_INTEGER, "max number of players allowed on the server", 1, 4 );
  312. idCVar si_fragLimit( "si_fragLimit", "10", CVAR_GAME | CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_INTEGER, "frag limit", 1, MP_PLAYER_MAXFRAGS );
  313. @@ -89,8 +91,14 @@
  314. idCVar ui_ready( "ui_ready", si_readyArgs[ 0 ], CVAR_GAME | CVAR_USERINFO, "player is ready to start playing", idCmdSystem::ArgCompletion_String<si_readyArgs> );
  315. idCVar ui_spectate( "ui_spectate", si_spectateArgs[ 0 ], CVAR_GAME | CVAR_USERINFO, "play or spectate", idCmdSystem::ArgCompletion_String<si_spectateArgs> );
  316. idCVar ui_chat( "ui_chat", "0", CVAR_GAME | CVAR_USERINFO | CVAR_BOOL | CVAR_ROM | CVAR_CHEAT, "player is chatting" );
  317. +// SnoopJeDi: autoRun
  318. +idCVar ui_autoRun( "ui_autoRun", "0", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "whether or not the player should run while not holding the run button" );
  319. +
  320.  
  321. // change anytime vars
  322. +// SnoopJeDi: music volume
  323. +idCVar s_music_vol( "s_music_vol", "0", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE , "the volume in dB of all speakers with the s_music key set" );
  324. +
  325. idCVar developer( "developer", "0", CVAR_GAME | CVAR_BOOL, "" );
  326.  
  327. idCVar r_aspectRatio( "r_aspectRatio", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "aspect ratio of view:\n0 = 4:3\n1 = 16:9\n2 = 16:10", 0, 2 );
  328. @@ -110,6 +118,9 @@
  329. idCVar g_gravity( "g_gravity", DEFAULT_GRAVITY_STRING, CVAR_GAME | CVAR_FLOAT, "" );
  330. idCVar g_skipFX( "g_skipFX", "0", CVAR_GAME | CVAR_BOOL, "" );
  331. idCVar g_skipParticles( "g_skipParticles", "0", CVAR_GAME | CVAR_BOOL, "" );
  332. +// SnoopJeDi - just so grepping can pick up my name
  333. +idCVar g_lms_bind_run_once( "g_lms_bind_run_once", "0", CVAR_GAME | CVAR_BOOL | CVAR_ARCHIVE, "Rebind all controls once for LMS." );//deadite4, thanks to Hobbes
  334. +
  335.  
  336. idCVar g_disasm( "g_disasm", "0", CVAR_GAME | CVAR_BOOL, "disassemble script into base/script/disasm.txt on the local drive when script is compiled" );
  337. idCVar g_debugBounds( "g_debugBounds", "0", CVAR_GAME | CVAR_BOOL, "checks for models with bounds > 2048" );
  338. diff -urN a/neo/game/gamesys/SysCvar.h b/neo/game/gamesys/SysCvar.h
  339. --- a/neo/game/gamesys/SysCvar.h 2012-01-07 12:45:20.000000000 +0100
  340. +++ b/neo/game/gamesys/SysCvar.h 2012-01-10 00:08:32.663159807 +0100
  341. @@ -118,6 +118,9 @@
  342. extern idCVar g_vehicleSuspensionKCompress;
  343. extern idCVar g_vehicleSuspensionDamping;
  344. extern idCVar g_vehicleTireFriction;
  345. +extern idCVar g_lms_bind_run_once; // SnoopJeDi
  346. +extern idCVar s_music_vol; // SnoopJeDi
  347. +
  348.  
  349. extern idCVar ik_enable;
  350. extern idCVar ik_debug;
  351. diff -urN a/neo/game/Item.cpp b/neo/game/Item.cpp
  352. --- a/neo/game/Item.cpp 2012-01-07 12:45:20.000000000 +0100
  353. +++ b/neo/game/Item.cpp 2012-01-10 00:08:32.663159807 +0100
  354. @@ -275,6 +275,13 @@
  355. idStr giveTo;
  356. idEntity * ent;
  357. float tsize;
  358. + const char *kv;
  359. +
  360. + kv = spawnArgs.GetString( "inv_name", "" );
  361. + if ( kv[ 0 ] ) { // SnoopJeDi - Only if it's something good to eat!
  362. + gameLocal.items++;
  363. + }
  364. +
  365.  
  366. if ( spawnArgs.GetBool( "dropToFloor" ) ) {
  367. PostEventMS( &EV_DropToFloor, 0 );
  368. @@ -364,6 +371,8 @@
  369. return false;
  370. }
  371.  
  372. + player->inventory.itemspickedup++; // SnoopJeDi
  373. +
  374. if ( gameLocal.isServer ) {
  375. ServerSendEvent( EVENT_PICKUP, NULL, false, -1 );
  376. }
  377. @@ -636,6 +645,17 @@
  378. if ( player->spectating ) {
  379. return false;
  380. }
  381. + if ( !idStr::Icmp( spawnArgs.GetString( "type" ), "4" ) ) {
  382. + if (player->health >= player->spawnArgs.GetInt( "maxbonushealth" )) {
  383. + return false;
  384. + }
  385. + }
  386. + if ( !idStr::Icmp( spawnArgs.GetString( "type" ), "5" ) || !idStr::Icmp( spawnArgs.GetString( "type" ), "6" ) ) {
  387. + if (player->inventory.armor >= player->spawnArgs.GetInt( "maxbonusarmor" )) {
  388. + return false;
  389. + }
  390. + }
  391. +
  392. player->GivePowerUp( type, time * 1000 );
  393. return true;
  394. }
  395. diff -urN a/neo/game/Misc.cpp b/neo/game/Misc.cpp
  396. --- a/neo/game/Misc.cpp 2012-01-07 12:45:20.000000000 +0100
  397. +++ b/neo/game/Misc.cpp 2012-01-10 00:08:32.664159879 +0100
  398. @@ -3156,3 +3156,90 @@
  399. BecomeInactive( TH_THINK );
  400. }
  401. }
  402. +
  403. +// SnoopJeDi -- Begin
  404. +
  405. +CLASS_DECLARATION( idEntity, idSecret )
  406. + EVENT( EV_Touch, idSecret::Event_Touch )
  407. +END_CLASS
  408. +
  409. +/*
  410. +===========================
  411. +idSecret::idSecret()
  412. +===========================
  413. +*/
  414. +idSecret::idSecret( void ) {
  415. +}
  416. +
  417. +/*
  418. +===========================
  419. +idSecret::Think()
  420. +===========================
  421. +*/
  422. +void idSecret::Think() {
  423. +}
  424. +
  425. +/*
  426. +===========================
  427. +idSecret::Spawn()
  428. +===========================
  429. +*/
  430. +void idSecret::Spawn( void ) {
  431. + SecretNum = spawnArgs.GetInt( "SecretNum", "0" ); //Todo: Increment secret areas automatically for newb mappers?
  432. + if ( gameLocal.secretAreas.FindIndex( SecretNum ) < 0 ) {
  433. + gameLocal.secretAreas.Append( SecretNum );
  434. + }
  435. + activated = false;
  436. + GetPhysics()->SetContents( CONTENTS_TRIGGER ); // Can be Touch()-ed, but not solid.
  437. +}
  438. +
  439. +/*
  440. +===========================
  441. +idSecret::Event_Activate()
  442. +===========================
  443. +*/
  444. +void idSecret::Event_Activate( idEntity *activator ) {
  445. + Deactivate();
  446. +}
  447. +
  448. +/*
  449. +===========================
  450. +idSecret::Save()
  451. +===========================
  452. +*/
  453. +void idSecret::Save( idSaveGame *savefile ) const {
  454. + savefile->WriteInt( SecretNum );
  455. +}
  456. +
  457. +/*
  458. +===========================
  459. +idSecret::Restore()
  460. +===========================
  461. +*/
  462. +void idSecret::Restore( idRestoreGame *savefile ) {
  463. + savefile->ReadInt( SecretNum );
  464. +}
  465. +
  466. +/*
  467. +===========================
  468. +idSecret::Event_Touch()
  469. +===========================
  470. +*/
  471. +void idSecret::Event_Touch( idEntity *other, trace_t *trace ) {
  472. + if ( !gameLocal.isMultiplayer && !activated && other->IsType(
  473. +idPlayer::Type) ) {
  474. + gameLocal.GetLocalPlayer()->SecretArea( SecretNum );
  475. + Deactivate(); // Don't touch me again!
  476. + }
  477. +}
  478. +
  479. +void idSecret::Deactivate() {
  480. + activated = true;
  481. +}
  482. +
  483. +int idSecret::GetNum() {
  484. + return SecretNum;
  485. +}
  486. +
  487. +// SnoopJeDi -- End
  488. +
  489. diff -urN a/neo/game/Misc.h b/neo/game/Misc.h
  490. --- a/neo/game/Misc.h 2012-01-07 12:45:20.000000000 +0100
  491. +++ b/neo/game/Misc.h 2012-01-10 00:08:32.664159879 +0100
  492. @@ -765,4 +765,36 @@
  493. idList<idVec3> lastTargetPos;
  494. };
  495.  
  496. +// SnoopJeDi -- Begin
  497. +/*
  498. +==================================
  499. +
  500. + idSecret - Simple entity for activating secret areas
  501. +
  502. +==================================
  503. +*/
  504. +class idSecret : public idEntity {
  505. +public:
  506. + CLASS_PROTOTYPE( idSecret );
  507. +
  508. + idSecret();
  509. + void Spawn ( void );
  510. + void Save( idSaveGame *savefile ) const;
  511. + void Restore( idRestoreGame *savefile );
  512. + void Think( void );
  513. + void Deactivate();
  514. + int GetNum();
  515. +
  516. +private:
  517. + void Event_Touch( idEntity *other, trace_t *trace );
  518. + int SecretNum;
  519. + bool activated;
  520. +
  521. + void Event_Activate( idEntity *activator ); // SnoopJeDi - added 2/13/07, allows mappers to trigger secrets (guis, etc)
  522. +};
  523. +// SnoopJeDi -- End
  524. +
  525. +
  526. +
  527. +
  528. #endif /* !__GAME_MISC_H__ */
  529. diff -urN a/neo/game/MultiplayerGame.cpp b/neo/game/MultiplayerGame.cpp
  530. --- a/neo/game/MultiplayerGame.cpp 2012-01-07 12:45:20.000000000 +0100
  531. +++ b/neo/game/MultiplayerGame.cpp 2012-01-10 00:08:32.665159951 +0100
  532. @@ -2767,7 +2767,7 @@
  533. assert( vote_gameTypeIndex >= 0 && vote_gameTypeIndex <= 3 );
  534. switch ( vote_gameTypeIndex ) {
  535. case 0:
  536. - strcpy( value, "Deathmatch" );
  537. + strcpy( value, "cdoomDM" );//deadite4
  538. break;
  539. case 1:
  540. strcpy( value, "Tourney" );
  541. diff -urN a/neo/game/Player.cpp b/neo/game/Player.cpp
  542. --- a/neo/game/Player.cpp 2012-01-07 12:45:20.000000000 +0100
  543. +++ b/neo/game/Player.cpp 2012-01-10 01:54:16.216473423 +0100
  544. @@ -143,6 +143,9 @@
  545. deplete_rate = 0.0f;
  546. deplete_ammount = 0;
  547. nextArmorDepleteTime = 0;
  548. + Secrets = 0; // SnoopJeDi
  549. + kills = 0; // SnoopJeDi
  550. + itemspickedup = 0; // SnoopJeDi
  551.  
  552. memset( ammo, 0, sizeof( ammo ) );
  553.  
  554. @@ -202,6 +205,9 @@
  555. case ADRENALINE:
  556. def = gameLocal.FindEntityDef( "powerup_adrenaline", false );
  557. break;
  558. + case HEALTHVIAL:
  559. + def = gameLocal.FindEntityDef( "item_health_vial", false );
  560. + break; // SnoopJeDi
  561. }
  562. assert( def );
  563. msec = def->dict.GetInt( "time" ) * 1000;
  564. @@ -278,6 +284,9 @@
  565. dict.SetInt( "selAudio", selAudio );
  566. dict.SetInt( "pdaOpened", pdaOpened );
  567. dict.SetInt( "turkeyScore", turkeyScore );
  568. + dict.SetInt( "Secrets", Secrets ); //SnoopJeDi
  569. + dict.SetInt( "kills", kills ); // SnoopJeDi
  570. + dict.SetInt( "itemspickedup", itemspickedup ); // SnoopJeDi
  571.  
  572. // pdas
  573. for ( i = 0; i < pdas.Num(); i++ ) {
  574. @@ -335,6 +344,9 @@
  575. deplete_armor = dict.GetInt( "deplete_armor", "0" );
  576. deplete_rate = dict.GetFloat( "deplete_rate", "2.0" );
  577. deplete_ammount = dict.GetInt( "deplete_ammount", "1" );
  578. + Secrets = dict.GetInt( "Secrets", "0" ); //SnoopJeDi
  579. + kills = dict.GetInt( "kills", "0" ); // SnoopJeDi
  580. + itemspickedup = dict.GetInt( "itemspickedup", "0" ); // SnoopJeDi
  581.  
  582. // the clip and powerups aren't restored
  583.  
  584. @@ -441,6 +453,10 @@
  585. savefile->WriteFloat( deplete_rate );
  586. savefile->WriteInt( deplete_ammount );
  587. savefile->WriteInt( nextArmorDepleteTime );
  588. + savefile->WriteInt( Secrets ); // SnoopJeDi
  589. + savefile->WriteInt( kills ); // SnoopJeDi
  590. + savefile->WriteInt( itemspickedup ); // SnoopJeDi
  591. + savefile->WriteInt( time ); //SnoopJeDi
  592.  
  593. for( i = 0; i < AMMO_NUMTYPES; i++ ) {
  594. savefile->WriteInt( ammo[ i ] );
  595. @@ -537,6 +553,10 @@
  596. savefile->ReadFloat( deplete_rate );
  597. savefile->ReadInt( deplete_ammount );
  598. savefile->ReadInt( nextArmorDepleteTime );
  599. + savefile->ReadInt( Secrets ); // SnoopJeDi
  600. + savefile->ReadInt( kills ); // SnoopJeDi
  601. + savefile->ReadInt( itemspickedup ); // SnoopJeDi
  602. + savefile->ReadInt( time ); // SnoopJeDi
  603.  
  604. for( i = 0; i < AMMO_NUMTYPES; i++ ) {
  605. savefile->ReadInt( ammo[ i ] );
  606. @@ -654,7 +674,11 @@
  607. ==============
  608. */
  609. int idInventory::MaxAmmoForAmmoClass( idPlayer *owner, const char *ammo_classname ) const {
  610. - return owner->spawnArgs.GetInt( va( "max_%s", ammo_classname ), "0" );
  611. + if ( owner->extraammo ) { //SnoopJedi - Moved by deadite4 in 1.3.1
  612. + return owner->spawnArgs.GetInt( va( "backpack_max_%s", ammo_classname ), "0" );
  613. + } else {
  614. + return owner->spawnArgs.GetInt( va( "max_%s", ammo_classname ), "0" );
  615. + }
  616. }
  617.  
  618. /*
  619. @@ -789,6 +813,8 @@
  620. GivePowerUp( owner, BERSERK, SEC2MS( atof( value ) ) );
  621. } else if ( !idStr::Icmp( statname, "mega" ) ) {
  622. GivePowerUp( owner, MEGAHEALTH, SEC2MS( atof( value ) ) );
  623. + } else if ( !idStr::Icmp( statname, "item_health_vial" ) ) { // don't need this, it's not an inventory item.
  624. + GivePowerUp( owner, HEALTHVIAL, SEC2MS( atof( value ) ) );
  625. } else if ( !idStr::Icmp( statname, "weapon" ) ) {
  626. tookWeapon = false;
  627. for( pos = value; pos != NULL; pos = end ) {
  628. @@ -844,6 +870,8 @@
  629. } else if ( !idStr::Icmp( statname, "item" ) || !idStr::Icmp( statname, "icon" ) || !idStr::Icmp( statname, "name" ) ) {
  630. // ignore these as they're handled elsewhere
  631. return false;
  632. + } else if ( !idStr::Icmp( statname, "extraammo" ) ) { // SnoopJeDi
  633. + owner->extraammo = true;
  634. } else {
  635. // unknown item
  636. gameLocal.Warning( "Unknown stat '%s' added to player's inventory", statname );
  637. @@ -971,6 +999,10 @@
  638. buttonMask = 0;
  639. oldFlags = 0;
  640.  
  641. + statsUI = NULL; // SnoopJeDi
  642. + statsUIopen = false; // SnoopJeDi
  643. + statsDebug = false; // SnoopJeDi
  644. +
  645. lastHitTime = 0;
  646. lastSndHitTime = 0;
  647. lastSavingThrowTime = 0;
  648. @@ -994,6 +1026,7 @@
  649. healthPulse = false;
  650. nextHealthTake = 0;
  651. healthTake = false;
  652. + extraammo = false; // SnoopJeDi
  653.  
  654. scoreBoardOpen = false;
  655. forceScoreBoard = false;
  656. @@ -1413,6 +1446,7 @@
  657. }
  658.  
  659. cvarSystem->SetCVarBool( "ui_chat", false );
  660. + ClearStats(); // SnoopJeDi
  661. }
  662.  
  663. /*
  664. @@ -1430,6 +1464,8 @@
  665. gameLocal.Error( "entityNum > MAX_CLIENTS for player. Player may only be spawned with a client." );
  666. }
  667.  
  668. + s_music_vol.SetModified(); // SnoopJeDi - To make sure we get music faded properly
  669. +
  670. // allow thinking during cinematics
  671. cinematic = true;
  672.  
  673. @@ -1473,6 +1509,9 @@
  674.  
  675. objectiveSystem = uiManager->FindGui( "guis/pda.gui", true, false, true );
  676. objectiveSystemOpen = false;
  677. + statsUI = uiManager->FindGui( "guis/stats.gui", true, false, true ); //SnoopJeDi - Set 'er up!
  678. + statsUIopen = false;
  679. + statsDebug = false;
  680. }
  681.  
  682. SetLastHitTime( 0 );
  683. @@ -1638,6 +1677,8 @@
  684. savefile->WriteInt( lastSndHitTime );
  685. savefile->WriteInt( lastSavingThrowTime );
  686.  
  687. + savefile->WriteBool( extraammo ); // SnoopJeDi
  688. +
  689. // idBoolFields don't need to be saved, just re-linked in Restore
  690.  
  691. inventory.Save( savefile );
  692. @@ -1646,6 +1687,9 @@
  693. savefile->WriteUserInterface( hud, false );
  694. savefile->WriteUserInterface( objectiveSystem, false );
  695. savefile->WriteBool( objectiveSystemOpen );
  696. + savefile->WriteUserInterface( statsUI, false ); //SnoopJeDi
  697. + savefile->WriteBool( statsUIopen ); //SnoopJeDi
  698. + savefile->WriteBool( statsDebug ); //SnoopJeDi
  699.  
  700. savefile->WriteInt( weapon_soulcube );
  701. savefile->WriteInt( weapon_pda );
  702. @@ -1856,6 +1900,7 @@
  703. savefile->ReadInt( lastHitTime );
  704. savefile->ReadInt( lastSndHitTime );
  705. savefile->ReadInt( lastSavingThrowTime );
  706. + savefile->ReadBool( extraammo ); //SnoopJeDi
  707.  
  708. // Re-link idBoolFields to the scriptObject, values will be restored in scriptObject's restore
  709. LinkScriptVariables();
  710. @@ -1870,6 +1915,9 @@
  711. savefile->ReadUserInterface( hud );
  712. savefile->ReadUserInterface( objectiveSystem );
  713. savefile->ReadBool( objectiveSystemOpen );
  714. + savefile->ReadUserInterface( statsUI ); //SnoopJeDi
  715. + savefile->ReadBool( statsUIopen ); //SnoopJeDi
  716. + savefile->ReadBool( statsDebug ); //SnoopJeDi
  717.  
  718. savefile->ReadInt( weapon_soulcube );
  719. savefile->ReadInt( weapon_pda );
  720. @@ -2298,6 +2346,7 @@
  721. inventory.GetPersistantData( playerInfo );
  722. playerInfo.SetInt( "health", health );
  723. playerInfo.SetInt( "current_weapon", currentWeapon );
  724. + playerInfo.SetBool( "extraammo", extraammo ); // SnoopJeDi
  725. }
  726.  
  727. /*
  728. @@ -2316,6 +2365,7 @@
  729.  
  730. inventory.RestoreInventory( this, spawnArgs );
  731. health = spawnArgs.GetInt( "health", "100" );
  732. + extraammo = spawnArgs.GetBool( "extraammo", 0 );
  733. if ( !gameLocal.isClient ) {
  734. idealWeapon = spawnArgs.GetInt( "current_weapon", "1" );
  735. }
  736. @@ -2498,6 +2548,17 @@
  737. _hud->SetStateString( "player_clips", weapon.GetEntity()->ClipSize() ? va( "%i", ammoamount / weapon.GetEntity()->ClipSize() ) : "--" );
  738. _hud->SetStateString( "player_allammo", va( "%i/%i", inclip, ammoamount - inclip ) );
  739. }
  740. + const idDict *ammoDef = gameLocal.FindEntityDefDict("ammo_types", false);
  741. +
  742. + if (ammoDef) {
  743. + for (int i = 0; i < AMMO_NUMTYPES; i++) {
  744. + const idKeyValue *ammoType = ammoDef->GetKeyVal(i);
  745. +
  746. + if (ammoType) {
  747. + _hud->SetStateInt( va("player_%s", ammoType->GetKey().c_str()), inventory.ammo[i] );
  748. + }
  749. + }
  750. + }
  751.  
  752. _hud->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) );
  753. _hud->SetStateBool( "player_clip_empty", ( weapon.GetEntity()->ClipSize() ? inclip == 0 : false ) );
  754. @@ -2531,6 +2592,31 @@
  755. _hud->SetStateInt( "player_hr", heartRate );
  756. _hud->SetStateInt( "player_nostamina", ( max_stamina == 0 ) ? 1 : 0 );
  757.  
  758. + if ( statsDebug ) { // SnoopJeDi
  759. + int secrets = inventory.Secrets;
  760. + int totalsecrets = gameLocal.secretAreas.Num();
  761. + int kills = inventory.kills;
  762. + int monsters = gameLocal.monsters;
  763. + float time = inventory.time;
  764. + int min = idMath::Ftoi( ( float )time/60000 );
  765. + int sec = (time - 60000 * min)/1000;
  766. + int pickedup = inventory.itemspickedup;
  767. + int totalitems = gameLocal.items;
  768. + idStr timestr;
  769. + if ( sec > 9 ) {
  770. + timestr = va( "Time: %i:%i", min, sec );
  771. + } else {
  772. + timestr = va( "Time: %i:0%i", min, sec );
  773. + }
  774. + _hud->SetStateBool( "statsDebug", true );
  775. + _hud->SetStateString( "secrets", va( "Secrets: %i/%i (%i%%)", secrets, totalsecrets, totalsecrets != 0 ? idMath::FtoiFast( 100.0f * ( float )secrets/( float )totalsecrets ) : 0 ) );
  776. + _hud->SetStateString( "kills", va( "Kills: %i/%i (%i%%)", kills, monsters, monsters != 0 ? idMath::Ftoi( 100.0f * ( float )kills/( float )monsters ) : 0 ) );
  777. + _hud->SetStateString( "time", timestr );
  778. + _hud->SetStateString( "items", va( "Items: %i/%i (%i%%)", pickedup, totalitems, totalitems != 0 ? idMath::Ftoi( 100.0f * ( float )pickedup/( float )totalitems ) : 0 ) );
  779. + } else {
  780. + _hud->SetStateBool( "statsDebug", false );
  781. + }
  782. +
  783. _hud->HandleNamedEvent( "updateArmorHealthAir" );
  784.  
  785. if ( healthPulse ) {
  786. @@ -2632,7 +2718,7 @@
  787.  
  788. // weapon targeting crosshair
  789. if ( !GuiActive() ) {
  790. - if ( cursor && weapon.GetEntity()->ShowCrosshair() ) {
  791. + if ( cursor && weapon.GetEntity()->ShowCrosshair() && !statsUIopen ) { // SnoopJeDi
  792. cursor->Redraw( gameLocal.realClientTime );
  793. }
  794. }
  795. @@ -3031,7 +3117,8 @@
  796.  
  797. if ( powerup >= 0 && powerup < MAX_POWERUPS ) {
  798.  
  799. - if ( gameLocal.isServer ) {
  800. + if ( gameLocal.isServer && powerup != MEGAHEALTH && powerup != HEALTHVIAL && powerup != ARMORBONUS && powerup != MEGAARMOR ) { // SnoopJeDi - LMS fix
  801. + // CDoom powerups now work for clients
  802. idBitMsg msg;
  803. byte msgBuf[MAX_EVENT_PARAM_SIZE];
  804.  
  805. @@ -3041,7 +3128,7 @@
  806. ServerSendEvent( EVENT_POWERUP, &msg, false, -1 );
  807. }
  808.  
  809. - if ( powerup != MEGAHEALTH ) {
  810. + if ( powerup != MEGAHEALTH && powerup != HEALTHVIAL && powerup != ARMORBONUS && powerup != MEGAARMOR ) { //SnoopJeDi - LMS fix
  811. inventory.GivePowerUp( this, powerup, time );
  812. }
  813.  
  814. @@ -3080,12 +3167,59 @@
  815. break;
  816. }
  817. case MEGAHEALTH: {
  818. + inventory.AddPickupName("Mega Health", "");
  819. if ( spawnArgs.GetString( "snd_megahealth", "", &sound ) ) {
  820. StartSoundShader( declManager->FindSound( sound ), SND_CHANNEL_ANY, 0, false, NULL );
  821. }
  822. def = gameLocal.FindEntityDef( "powerup_megahealth", false );
  823. if ( def ) {
  824. - health = def->dict.GetInt( "inv_health" );
  825. + health += def->dict.GetInt( "inv_health" );
  826. + }
  827. + if ( health > 200 ) {
  828. + health = 200;
  829. + }
  830. + break;
  831. + }
  832. + case HEALTHVIAL: { //SnoopJeDi
  833. + inventory.AddPickupName("Health Vial", "");
  834. +
  835. + def = gameLocal.FindEntityDef( "item_health_vial", false );
  836. + if ( def && def->dict.GetString( "snd_acquire", "", &sound ) ) {
  837. + StartSoundShader( declManager->FindSound( sound ), SND_CHANNEL_ANY, 0, false, NULL );
  838. + }
  839. + if ( def ) {
  840. +// gameLocal.Printf ( "Gave player 1 health: GivePowerUp()\n" );
  841. + health += def->dict.GetInt( "inv_health" );
  842. + //health += 1;
  843. + //} else {
  844. + // gameLocal.Printf ( "Didn't give player health: GivePowerUp()\n" );
  845. + if ( health > spawnArgs.GetInt( "maxbonushealth" ) ) {
  846. + health = spawnArgs.GetInt( "maxbonushealth" );
  847. + }
  848. + }
  849. + break;
  850. + }
  851. + case ARMORBONUS: { //SnoopJeDi
  852. + inventory.AddPickupName("Armor Bonus", "");
  853. + def = gameLocal.FindEntityDef( "item_armor_shard", false );
  854. + if ( def && inventory.armor < spawnArgs.GetInt ( "maxbonusarmor" ) ) {
  855. + inventory.armor += def->dict.GetInt( "inv_armor" );
  856. + if ( inventory.armor > spawnArgs.GetInt ( "maxbonusarmor" ) ) {
  857. + inventory.armor = spawnArgs.GetInt ( "maxbonusarmor" );
  858. + }
  859. + inventory.nextArmorDepleteTime = 0;
  860. + inventory.armorPulse = true;
  861. + }
  862. + break;
  863. + }
  864. + case MEGAARMOR: { //SnoopJeDi
  865. + inventory.AddPickupName("Mega Armor", "");
  866. + def = gameLocal.FindEntityDef( "item_mega_armor", false );
  867. + if ( def && inventory.armor < spawnArgs.GetInt ( "maxbonusarmor" ) ) {
  868. + inventory.armor += def->dict.GetInt( "inv_armor" );
  869. + if ( inventory.armor > spawnArgs.GetInt ( "maxbonusarmor" ) ) {
  870. + inventory.armor = spawnArgs.GetInt ( "maxbonusarmor" );
  871. + }
  872. }
  873. break;
  874. }
  875. @@ -3531,7 +3665,7 @@
  876. const char *weap;
  877. int w;
  878.  
  879. - if ( !weaponEnabled || spectating || hiddenWeapon || gameLocal.inCinematic || gameLocal.world->spawnArgs.GetBool( "no_Weapons" ) || health < 0 ) {
  880. + if ( !weaponEnabled || spectating || hiddenWeapon || gameLocal.inCinematic || gameLocal.world->spawnArgs.GetBool( "no_Weapons" ) || health < 0 || statsUIopen ) { //SnoopJeDi
  881. return;
  882. }
  883.  
  884. @@ -3581,7 +3715,7 @@
  885. const char *weap;
  886. int w;
  887.  
  888. - if ( !weaponEnabled || spectating || hiddenWeapon || gameLocal.inCinematic || gameLocal.world->spawnArgs.GetBool( "no_Weapons" ) || health < 0 ) {
  889. + if ( !weaponEnabled || spectating || hiddenWeapon || gameLocal.inCinematic || gameLocal.world->spawnArgs.GetBool( "no_Weapons" ) || health < 0 || statsUIopen ) { //SnoopJeDi
  890. return;
  891. }
  892.  
  893. @@ -3630,7 +3764,7 @@
  894. void idPlayer::SelectWeapon( int num, bool force ) {
  895. const char *weap;
  896.  
  897. - if ( !weaponEnabled || spectating || gameLocal.inCinematic || health < 0 ) {
  898. + if ( !weaponEnabled || spectating || gameLocal.inCinematic || health < 0 || statsUIopen ) { // SnoopJeDi
  899. return;
  900. }
  901.  
  902. @@ -3806,7 +3940,9 @@
  903. if ( objectiveSystemOpen ) {
  904. return objectiveSystem;
  905. }
  906. -
  907. + if ( statsUIopen ) { //SnoopJeDi
  908. + return statsUI;
  909. + }
  910. return focusUI;
  911. }
  912.  
  913. @@ -3976,7 +4112,7 @@
  914. */
  915. void idPlayer::Weapon_GUI( void ) {
  916.  
  917. - if ( !objectiveSystemOpen ) {
  918. + if ( !objectiveSystemOpen && !statsUIopen ) { // SnoopJeDi
  919. if ( idealWeapon != currentWeapon ) {
  920. Weapon_Combat();
  921. }
  922. @@ -4175,6 +4311,11 @@
  923. return false;
  924. }
  925.  
  926. + if ( token.Icmp( "statsOver" ) == 0 ) { // SnoopJeDi
  927. + StatsProceed();
  928. + return true;
  929. + }
  930. +
  931. if ( token.Icmp( "addhealth" ) == 0 ) {
  932. if ( entityGui && health < 100 ) {
  933. int _health = entityGui->spawnArgs.GetInt( "gui_parm1" );
  934. @@ -4867,7 +5008,7 @@
  935. int i;
  936. idAngles delta;
  937.  
  938. - if ( !noclip && ( gameLocal.inCinematic || privateCameraView || gameLocal.GetCamera() || influenceActive == INFLUENCE_LEVEL2 || objectiveSystemOpen ) ) {
  939. + if ( !noclip && ( gameLocal.inCinematic || privateCameraView || gameLocal.GetCamera() || influenceActive == INFLUENCE_LEVEL2 || objectiveSystemOpen || statsUIopen ) ) { // SnoopJeDi
  940. // no view changes at all, but we still want to update the deltas or else when
  941. // we get out of this mode, our view will snap to a kind of random angle
  942. UpdateDeltaViewAngles( viewAngles );
  943. @@ -5362,7 +5503,7 @@
  944. }
  945.  
  946. if ( inventory.pdas.Num() == 0 ) {
  947. - ShowTip( spawnArgs.GetString( "text_infoTitle" ), spawnArgs.GetString( "text_noPDA" ), true );
  948. + //ShowTip( spawnArgs.GetString( "text_infoTitle" ), spawnArgs.GetString( "text_noPDA" ), true ); // SnoopJeDi - Removed "no PDA" text
  949. return;
  950. }
  951.  
  952. @@ -5586,7 +5727,7 @@
  953. case IMPULSE_19: {
  954. // when we're not in single player, IMPULSE_19 is used for showScores
  955. // otherwise it opens the pda
  956. - if ( !gameLocal.isMultiplayer ) {
  957. + if ( !gameLocal.isMultiplayer && !statsUIopen ) { // SnoopJeDi
  958. if ( objectiveSystemOpen ) {
  959. TogglePDA();
  960. } else if ( weapon_pda >= 0 ) {
  961. @@ -5619,6 +5760,10 @@
  962. }
  963. break;
  964. }
  965. + case IMPULSE_30: { // SnoopJeDi - At the request of many.
  966. + ToggleStatsDebug();
  967. + break;
  968. + }
  969. case IMPULSE_40: {
  970. UseVehicle();
  971. break;
  972. @@ -5688,6 +5833,9 @@
  973. float speed;
  974. float rate;
  975.  
  976. + if ( GetUserInfo()->GetBool( "ui_autoRun" ) ) {
  977. + usercmd.buttons ^= BUTTON_RUN; //SnoopJeDi: cusTom3 is briliant!
  978. + }
  979. if ( spectating ) {
  980. speed = pm_spectatespeed.GetFloat();
  981. bobFrac = 0.0f;
  982. @@ -6215,7 +6363,7 @@
  983. oldFlags = usercmd.flags;
  984. }
  985.  
  986. - if ( objectiveSystemOpen || gameLocal.inCinematic || influenceActive ) {
  987. + if ( objectiveSystemOpen || gameLocal.inCinematic || influenceActive || statsUIopen ) { // SnoopJeDi
  988. if ( objectiveSystemOpen && AI_PAIN ) {
  989. TogglePDA();
  990. }
  991. @@ -6247,7 +6395,7 @@
  992. }
  993.  
  994. // zooming
  995. - if ( ( usercmd.buttons ^ oldCmd.buttons ) & BUTTON_ZOOM ) {
  996. + if ( ( ( usercmd.buttons ^ oldCmd.buttons ) & BUTTON_ZOOM ) && !statsUIopen ) { //SnoopJeDi
  997. if ( ( usercmd.buttons & BUTTON_ZOOM ) && weapon.GetEntity() ) {
  998. zoomFov.Init( gameLocal.time, 200.0f, CalcFov( false ), weapon.GetEntity()->GetZoomFov() );
  999. } else {
  1000. @@ -7381,6 +7529,8 @@
  1001. int max_souls;
  1002. int ammo_souls;
  1003.  
  1004. + inventory.kills++; // SnoopJeDi
  1005. +
  1006. if ( ( weapon_soulcube < 0 ) || ( inventory.weapons & ( 1 << weapon_soulcube ) ) == 0 ) {
  1007. return;
  1008. }
  1009. @@ -7713,7 +7863,7 @@
  1010. ==================
  1011. */
  1012. void idPlayer::Event_OpenPDA( void ) {
  1013. - if ( !gameLocal.isMultiplayer ) {
  1014. + if ( !gameLocal.isMultiplayer && !statsUIopen ) { // SnoopJeDi
  1015. TogglePDA();
  1016. }
  1017. }
  1018. @@ -7806,7 +7956,7 @@
  1019. buttonMask &= usercmd.buttons;
  1020. usercmd.buttons &= ~buttonMask;
  1021.  
  1022. - if ( objectiveSystemOpen ) {
  1023. + if ( objectiveSystemOpen || statsUIopen ) { // SnoopJeDi
  1024. usercmd.forwardmove = 0;
  1025. usercmd.rightmove = 0;
  1026. usercmd.upmove = 0;
  1027. @@ -8126,7 +8276,7 @@
  1028. common->Warning( "NET: no damage def for damage feedback '%d'\n", lastDamageDef );
  1029. }
  1030. }
  1031. - } else if ( health > oldHealth && PowerUpActive( MEGAHEALTH ) && !stateHitch ) {
  1032. + } else if ( health > oldHealth && PowerUpActive( MEGAHEALTH ) && PowerUpActive( HEALTHVIAL ) && !stateHitch ) {
  1033. // just pulse, for any health raise
  1034. healthPulse = true;
  1035. }
  1036. @@ -8526,3 +8676,103 @@
  1037. // local clients don't render their own icons... they're only info for other clients
  1038. return entityNumber != gameLocal.localClientNum && ( isLagged || isChatting );
  1039. }
  1040. +
  1041. +//SnoopJeDi -- BEGIN
  1042. +
  1043. +/*
  1044. +================
  1045. +idPlayer::SecretArea
  1046. +================
  1047. +*/
  1048. +void idPlayer::SecretArea( int areanum ) {
  1049. + inventory.Secrets++;
  1050. + //common->Printf( "^1Secrets Incremented\n" );
  1051. + gameLocal.DeactivateSecretAreas( areanum );
  1052. +}
  1053. +
  1054. +/*
  1055. +================
  1056. +idPlayer::OpenStats
  1057. +================
  1058. +*/
  1059. +
  1060. +void idPlayer::OpenStats( idStr nextMap, int level_no ) {
  1061. + StopFiring();
  1062. + int secrets = inventory.Secrets;
  1063. + int totalsecrets = gameLocal.secretAreas.Num();
  1064. + int kills = inventory.kills;
  1065. + int monsters = gameLocal.monsters;
  1066. + float time = inventory.time;
  1067. + int min = idMath::Ftoi( ( float )time/60000 );
  1068. + int sec = (time - 60000 * min)/1000;
  1069. + int pickedup = inventory.itemspickedup;
  1070. + int totalitems = gameLocal.items;
  1071. + float psecrets = ( float )secrets/( float )totalsecrets;
  1072. + float pkills = ( float )kills/( float )monsters;
  1073. + float pitems = ( float )pickedup/( float )totalitems;
  1074. + idStr timestr;
  1075. + if ( sec > 9 ) {
  1076. + timestr = va( "Time: %i:%i", min, sec );
  1077. + } else {
  1078. + timestr = va( "Time: %i:0%i", min, sec );
  1079. + }
  1080. + statsUI->Activate( true, gameLocal.time );
  1081. + statsUIopen = true;
  1082. + statsUI->SetStateString( "secrets_found", va( "Secrets: %i/%i (%i%%)", secrets, totalsecrets, totalsecrets != 0 ? idMath::FtoiFast( 100.0f * psecrets ) : 0 ) );
  1083. + statsUI->SetStateString( "kills", va( "Kills: %i/%i (%i%%)", kills, monsters, monsters != 0 ? idMath::Ftoi( 100.0f * pkills ) : 0 ) );
  1084. + statsUI->SetStateString( "time", timestr );
  1085. + statsUI->SetStateString( "items", va( "Items: %i/%i (%i%%)", pickedup, totalitems, totalitems != 0 ? idMath::Ftoi( 100.0f * pitems ) : 0 ) );
  1086. + statsUI->SetStateFloat( "psecrets", psecrets );
  1087. + statsUI->SetStateFloat( "pkills", pkills );
  1088. + statsUI->SetStateFloat( "pitems", pitems );
  1089. + statsUI->SetStateInt( "health", health );
  1090. + statsUI->SetStateInt( "level_no", level_no );
  1091. + //statsUI->SetStateString( "entering", va( "Now Entering: %s", nextMapName ) );
  1092. + statsUI->SetStateString( "nextMap", va( nextMap ) );
  1093. + gameSoundWorld->PlayShaderDirectly( "music_stats", SND_CHANNEL_ANY );
  1094. + //common->Printf( "^1Nextmap is: %s", va( nextMap ) );
  1095. +}
  1096. +
  1097. +/*
  1098. +================
  1099. +idPlayer::StatsProceed
  1100. +================
  1101. +*/
  1102. +
  1103. +void idPlayer::StatsProceed() { //Ripped un-ceremoniously from idTarget_EndLevel
  1104. + idStr nextMap;
  1105. +
  1106. + nextMap = statsUI->GetStateString( "nextMap", "" );
  1107. + if ( !nextMap ) {
  1108. + gameLocal.Printf( "idPlayer::StatsProceed: no nextMap key\n" );
  1109. + return;
  1110. + }
  1111. + gameLocal.sessionCommand = "map ";
  1112. + gameLocal.sessionCommand += nextMap;
  1113. +
  1114. +}
  1115. +
  1116. +/*
  1117. +==================
  1118. +idPlayer::ClearStats
  1119. +==================
  1120. +*/
  1121. +
  1122. +void idPlayer::ClearStats() {
  1123. + inventory.kills = 0;
  1124. + inventory.Secrets = 0;
  1125. + inventory.itemspickedup = 0;
  1126. + //common->Printf( "^1ClearStats reset integers\n" );
  1127. +}
  1128. +
  1129. +/*
  1130. +==================
  1131. +idPlayer::ToggleStatsDebug
  1132. +==================
  1133. +*/
  1134. +
  1135. +void idPlayer::ToggleStatsDebug( void ) { // SnoopJeDi
  1136. + statsDebug = !statsDebug;
  1137. +}
  1138. +
  1139. +//SnoopJeDi -- END
  1140. diff -urN a/neo/game/Player.h b/neo/game/Player.h
  1141. --- a/neo/game/Player.h 2012-01-07 12:45:20.000000000 +0100
  1142. +++ b/neo/game/Player.h 2012-01-10 00:08:36.962470180 +0100
  1143. @@ -103,6 +103,9 @@
  1144. INVISIBILITY,
  1145. MEGAHEALTH,
  1146. ADRENALINE,
  1147. + HEALTHVIAL, // SnoopJeDi
  1148. + ARMORBONUS, // SnoopJeDi
  1149. + MEGAARMOR, // SnoopJeDi
  1150. MAX_POWERUPS
  1151. };
  1152.  
  1153. @@ -132,6 +135,10 @@
  1154. int ammo[ AMMO_NUMTYPES ];
  1155. int clip[ MAX_WEAPONS ];
  1156. int powerupEndTime[ MAX_POWERUPS ];
  1157. + int Secrets; //SnoopJeDi
  1158. + int kills; //SnoopJeDi
  1159. + int itemspickedup; // SnoopJeDi
  1160. + int time; // SnoopJeDi - For saved games
  1161.  
  1162. // mp
  1163. int ammoPredictTime;
  1164. @@ -265,6 +272,15 @@
  1165. idUserInterface * objectiveSystem;
  1166. bool objectiveSystemOpen;
  1167.  
  1168. + idUserInterface * statsUI; // SnoopJeDi
  1169. + bool statsUIopen; // SnoopJeDi
  1170. + bool statsDebug; // SnoopJeDi
  1171. + void OpenStats( idStr nextMap, int level_no ); // SnoopJeDi
  1172. + void StatsProceed(); // SnoopJeDi
  1173. + void ClearStats(); // SnoopJeDi
  1174. + void ToggleStatsDebug(); // SnoopJeDi
  1175. +
  1176. +
  1177. int weapon_soulcube;
  1178. int weapon_pda;
  1179. int weapon_fists;
  1180. @@ -283,6 +299,8 @@
  1181. bool healthPulse;
  1182. bool healthTake;
  1183. int nextHealthTake;
  1184. + bool extraammo; // SnoopJeDi
  1185. +
  1186.  
  1187.  
  1188. bool hiddenWeapon; // if the weapon is hidden ( in noWeapons maps )
  1189. @@ -521,6 +539,9 @@
  1190. virtual void HidePlayerIcons( void );
  1191. bool NeedsIcon( void );
  1192.  
  1193. + void SecretArea( int areanum ); //SnoopJeDi
  1194. +
  1195. +
  1196. bool SelfSmooth( void );
  1197. void SetSelfSmooth( bool b );
  1198.  
  1199. diff -urN a/neo/game/PlayerView.cpp b/neo/game/PlayerView.cpp
  1200. --- a/neo/game/PlayerView.cpp 2012-01-07 12:45:20.000000000 +0100
  1201. +++ b/neo/game/PlayerView.cpp 2012-01-10 00:08:36.962470180 +0100
  1202. @@ -536,6 +536,10 @@
  1203. renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, mtr );
  1204. }
  1205. }
  1206. + if ( player->statsUIopen ) { //SnoopJeDi - Draw over world.
  1207. + player->statsUI->Redraw( gameLocal.time );
  1208. + }
  1209. +
  1210. }
  1211.  
  1212. /*
  1213. diff -urN a/neo/game/Sound.cpp b/neo/game/Sound.cpp
  1214. --- a/neo/game/Sound.cpp 2012-01-07 12:45:20.000000000 +0100
  1215. +++ b/neo/game/Sound.cpp 2012-01-10 00:08:36.962470180 +0100
  1216. @@ -128,6 +128,10 @@
  1217. } else {
  1218. timerOn = false;
  1219. }
  1220. + if ( spawnArgs.GetBool( "s_music" ) ) { //SnoopJeDi
  1221. + gameLocal.musicSpeakers.Append( entityNumber );
  1222. + }
  1223. +
  1224. }
  1225.  
  1226. /*
  1227. diff -urN a/neo/game/Target.cpp b/neo/game/Target.cpp
  1228. --- a/neo/game/Target.cpp 2012-01-07 12:45:20.000000000 +0100
  1229. +++ b/neo/game/Target.cpp 2012-01-10 00:08:36.963470252 +0100
  1230. @@ -223,6 +223,75 @@
  1231. gameLocal.sessionCommand += nextMap;
  1232. }
  1233.  
  1234. +//SnoopJeDi -- BEGIN
  1235. +//Zombie class!
  1236. +
  1237. +CLASS_DECLARATION( idEntity, idTarget_EndLevelCdoom )
  1238. + EVENT( EV_Activate, idTarget_EndLevelCdoom::Event_Trigger )
  1239. +END_CLASS
  1240. +
  1241. +
  1242. +
  1243. +/*
  1244. +================
  1245. +idTarget_EndLevelCdoom::Spawn
  1246. +================
  1247. +*/
  1248. +void idTarget_EndLevelCdoom::Spawn( void ) {
  1249. +}
  1250. +
  1251. +/*
  1252. +================
  1253. +idTarget_EndLevelCdoom::~idTarget_EndLevelCdoom()
  1254. +================
  1255. +*/
  1256. +idTarget_EndLevelCdoom::~idTarget_EndLevelCdoom() {
  1257. +}
  1258. +
  1259. +/*
  1260. +================
  1261. +idTarget_EndLevelCdoom::Event_Trigger
  1262. +================
  1263. +*/
  1264. +void idTarget_EndLevelCdoom::Event_Trigger( idEntity *activator ) {
  1265. +
  1266. + if ( !activator->IsType( idPlayer::Type ) )
  1267. + return;
  1268. + gameSoundWorld->StopAllSounds();
  1269. + renderView_t renderView;
  1270. +
  1271. + memset( &renderView, 0, sizeof( renderView ) );
  1272. +
  1273. + renderView.width = SCREEN_WIDTH;
  1274. + renderView.height = SCREEN_HEIGHT;
  1275. + renderView.x = 0;
  1276. + renderView.y = 0;
  1277. +
  1278. + renderView.fov_x = 90;
  1279. + renderView.fov_y = 90; // FIXME!
  1280. + renderView.time = gameLocal.time;
  1281. +
  1282. +#if 0
  1283. + renderView.vieworg = initialViewOrg;
  1284. + renderView.viewaxis = idAngles(initialViewAngles).toMat3();
  1285. +#else
  1286. + renderView.vieworg = renderEntity.origin;
  1287. + renderView.viewaxis = renderEntity.axis;
  1288. +#endif
  1289. +
  1290. + gameRenderWorld->RenderScene( &renderView );
  1291. +
  1292. + // draw the gui on top of the 3D view
  1293. +
  1294. + idPlayer * player = gameLocal.GetLocalPlayer();
  1295. + player->OpenStats( idStr(spawnArgs.GetString("nextMap", "")), spawnArgs.GetInt( "level_no", "-1" ) );
  1296. +}
  1297. +
  1298. +
  1299. +
  1300. +// SnoopJeDi -- END
  1301. +
  1302. +
  1303.  
  1304. /*
  1305. ===============================================================================
  1306. diff -urN a/neo/game/Target.h b/neo/game/Target.h
  1307. --- a/neo/game/Target.h 2012-01-07 12:45:20.000000000 +0100
  1308. +++ b/neo/game/Target.h 2012-01-10 00:08:36.963470252 +0100
  1309. @@ -566,5 +566,34 @@
  1310. void Event_RestoreVolume();
  1311. };
  1312.  
  1313. +// SnoopJeDi -- BEGIN
  1314. +/*
  1315. +================================
  1316. +
  1317. +idTarget_EndLevelCdoom
  1318. +
  1319. +This is the illegitimate child of idTarget_EndLevel and my desire for a stats screen.
  1320. +It's a zombie entity, which only really serves to stop game sounds and bring up the stats screen.
  1321. +Everything else is handled in Player.cpp
  1322. +
  1323. +================================
  1324. +*/
  1325. +
  1326. +
  1327. +class idTarget_EndLevelCdoom : public idEntity {
  1328. +public:
  1329. + CLASS_PROTOTYPE( idTarget_EndLevelCdoom );
  1330. +
  1331. + void Spawn( void );
  1332. + ~idTarget_EndLevelCdoom();
  1333. + idUserInterface * gui;
  1334. +
  1335. +private:
  1336. + void Event_Trigger( idEntity *activator );
  1337. +};
  1338. +
  1339. +// SnoopJeDi -- END
  1340. +
  1341. +
  1342.  
  1343. #endif /* !__GAME_TARGET_H__ */
Advertisement
Add Comment
Please, Sign In to add comment