📄 g_main.cpp
字号:
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
// $Revision:: 170 $
// $Author:: Jimdose $
// $Date:: 2/16/99 8:37p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
//
// 170 2/16/99 8:37p Jimdose
// moved sin arcade comm stuff to client
// made dmflags, timelimit, and fraglimit archived under SIN_ARCADE
//
// 169 1/22/99 8:00p Jimdose
// added "showvar" command for inspecting script variables
//
// 168 12/08/98 7:04p Aldie
// Added setup and shutdown calls to comm for arcade
//
// 167 11/17/98 6:21p Aldie
// Put a check for DM in the fixbodies
//
// 166 11/17/98 4:07a Markd
// put in stopsound when changing levels
//
// 165 11/15/98 11:31p Markd
// changed default fat rocket setting
//
// 164 11/15/98 9:02p Jimdose
// added sv_fatrockets
//
// 163 11/14/98 2:55a Aldie
// Don't update skin in single player in the clientuserinfo. The player Init
// function will take care of it.
//
// 162 11/13/98 11:02p Jimdose
// made fov persistant across levels and after zooming in and out
//
// 161 11/13/98 10:05p Jimdose
// G_SaveClientData is now called when exiting the level, instead of when the
// level is saved. This should fix the problem of the player keeping objects
// from the previous level when he crosses an episode (when savegames are
// cleared out).
//
// 160 11/13/98 2:38a Aldie
// Fixed userinfo changed so manumit is preserved in loadgames
//
// 159 11/11/98 2:56p Aldie
// Fix for deadbody code
//
// 158 11/10/98 8:05p Aldie
// Fix dead bodies for players changing models
//
// 157 11/10/98 4:34p Jimdose
// added clearsavegames to level
//
// 156 11/09/98 1:04a Markd
// made parentmode not LATCHED
//
// 155 11/09/98 12:55a Jimdose
// added sv_footsteps cvar so that server admins can turn footsteps off
// completely
// added CVAR_USERINFO to parentmode
//
// 154 11/08/98 10:48p Jimdose
// moved earthquake to level struct
// upped savegame version
//
// 153 11/08/98 8:09p Aldie
// Upped the savegame version
//
// 152 11/06/98 10:04p Jimdose
// Added G_AllocDebugLines
//
// 151 11/06/98 5:32p Jimdose
// added missionfailed and missionfailedtime to level vars
// when a mission has failed or the player is dead in single player, the game
// code immediately shows the loadmenu, preventing them from letting the game
// continue running if they exit the menu
//
// 150 10/27/98 9:46p Aldie
// Changed training cvar to level.training
//
// 149 10/27/98 6:52p Jimdose
// changed savegame version
//
// 148 10/27/98 5:41a Jimdose
// upped the savegame version
//
// 147 10/27/98 3:43a Aldie
// Removed the "loading" command string
//
// 146 10/26/98 5:14p Jimdose
// change recalcpaths to ai_recalcpaths
//
// 145 10/26/98 4:42p Jimdose
// added recalcpaths
//
// 144 10/26/98 2:17p Aldie
// Added AirClamp
//
// 143 10/25/98 11:56p Jimdose
// moved playerfrozen from game to level
//
// 142 10/25/98 10:11p Markd
// made default dialog be mode 2 instead of mode 3
//
// 141 10/25/98 9:10p Markd
// made dialog variable archived
//
// 140 10/25/98 6:26p Markd
// Added in no_jc abililty
//
// 139 10/25/98 6:09p Aldie
// Added training cvar
//
// 138 10/25/98 4:53a Jimdose
// Increased the savegame version
//
// 137 10/25/98 12:48a Markd
// changed manumit.def to manumit_pl.def
//
// 136 10/24/98 6:05p Jimdose
// made waitForPlayer work in change level threads
// upped the savegame version number
//
// 135 10/24/98 3:34p Markd
// Added loading command, fixed typo
//
// 134 10/24/98 2:17p Markd
// Put in a loading in exit level
//
// 133 10/24/98 12:42a Markd
// changed origins to worldorigins where appropriate
//
// 132 10/23/98 6:46p Aldie
// Archive maxclients
//
// 131 10/22/98 4:57p Aldie
// Removed blastscale_z value
//
// 130 10/22/98 3:27a Jimdose
// changed the savegame version
//
// 129 10/21/98 6:42p Markd
// Added sv_drawtrace
//
// 128 10/20/98 10:30p Jimdose
// added savegame version
//
// 127 10/20/98 2:21a Aldie
// Added sv_maplist for map rotation
//
// 126 10/19/98 9:54p Jimdose
// changed slime variables to lightvolume
//
// 125 10/19/98 12:07a Jimdose
// made all code use fast checks for inheritance (no text lookups when
// possible)
// isSubclassOf no longer requires ::_classinfo()
//
// 124 10/18/98 8:42p Jimdose
// Cleaned unnecessary or slow stuff from G_RunFrame
//
// 123 10/18/98 3:23a Jimdose
// Added code for timing entities
//
// 122 10/17/98 12:20a Jimdose
// Save games now archive paths
// Fixed bug due to ReadLevel not freeing the spawned entities
// G_SaveClientData doesn't save data during deathmatch
//
// 121 10/16/98 1:50a Jimdose
// Added FL_DONTSAVE flag to mark entities that shouldn't be saved to savegames
// Send end level event to clients on level exit
// Added autosave variable to WriteLevel
//
// 120 10/14/98 11:55p Markd
// put in assert( 0 ) in G_Error
//
// 119 10/14/98 10:55p Jimdose
// More work on persitant data
//
// 118 10/14/98 1:17a Jimdose
// Got cross-level persistant info working
//
// 117 10/11/98 8:51p Jimdose
// Added LoadingServer variable
//
// 116 10/10/98 1:26a Jimdose
// added G_Precache
//
// 115 10/08/98 7:18p Jimdose
// Added IP filtering
// Removed noexit and samelevel cvars since they are dmflags
// fixed bug with restarting level
//
// 114 10/08/98 12:38a Jimdose
// Made savegames work
//
// 113 9/30/98 5:39p Aldie
// Added showinfo command
//
// 112 9/26/98 4:44p Aldie
// Added mutant mode
//
// 111 9/25/98 4:36p Markd
// replaced Event::Find with Event::Exists
//
// 110 9/24/98 1:49a Jimdose
// Added g_showmem
//
// 109 9/22/98 3:21p Markd
// put in parentmode lockout for blood and gibs
//
// 108 9/19/98 5:01p Markd
// took out current_music and fallback_music
//
// 107 9/19/98 4:33p Jimdose
// added eventlist client command
//
// 106 9/18/98 5:37p Aldie
// Removed dead code
//
// 105 9/11/98 2:49p Aldie
// Cleaned up intermission stuff
//
// 104 9/10/98 8:38p Aldie
// Electrical beam effects
//
// 103 9/09/98 3:03p Markd
// Fixed deathmatch camera
//
// 102 9/07/98 8:29p Markd
// Added fulltrace bboxes
//
// 101 9/03/98 2:49p Aldie
// Changed default of sv_showdamagelocation to 0
//
// 100 9/02/98 7:46p Aldie
// Added ValidPlayerModels list
//
// 99 8/31/98 4:44p Markd
// fixed setting on non-blade in demo and non-deathmatch
//
// 98 8/29/98 9:41p Jimdose
// Made all function names consistantly begin with G_
// Added call info to G_Trace
//
// 97 8/21/98 5:26p Markd
// Added sv_precache and cl_precache
//
// 96 8/19/98 8:49p Aldie
// Added sv_showdamagelocation for kicks
//
// 95 8/13/98 8:10p Aldie
// Deathmatch score bug
//
// 94 8/13/98 7:30p Aldie
// New deathmatch scoreboard
//
// 93 8/08/98 7:29p Aldie
// Added intermissions for deathmatch
//
// 92 8/07/98 4:20p Aldie
// Fixed say command when command is not known
//
// 91 8/07/98 2:28p Aldie
// Fixed a bug where dead person could go into idle animation
//
// 90 8/03/98 7:54p Jimdose
// Added sv_showentnums to show the entity number above any entity
//
// 89 8/02/98 9:00p Markd
// Merged code 3.17
//
// 88 7/31/98 8:08p Jimdose
// Script commands now include flags to indicate cheats and console commands
//
// 87 7/31/98 4:19p Jimdose
// Fixed deathmatch cheats
//
// 86 7/26/98 9:29a Aldie
// Fixed parameter error on skin checking
//
// 85 7/26/98 9:12a Aldie
// Fix multiplayer skin lookups for invalid models
//
// 84 7/26/98 5:32a Markd
// put in rudimentary savegame
//
// 83 7/25/98 3:12p Aldie
// Initialize showdamage to 0
//
// 82 7/24/98 10:03p Aldie
// Changed the gibs layout
//
// 81 7/24/98 6:17p Aldie
// Dialog checking
//
// 80 7/24/98 4:51p Jimdose
// Bounding boxes no longer show up in deathmatch
//
// 79 7/24/98 3:47p Aldie
// Don't allow invalid models, skins, etc...
//
// 78 7/23/98 6:17p Aldie
// Updated damage system and fixed some damage related bugs. Also put tracers
// back to the way they were, and added gib event to funcscriptmodels
//
// 77 7/23/98 2:32p Aldie
// Made speed of rocket a tweak cvar
//
// 76 7/21/98 9:04p Markd
// Added current_mood and fallback mood for music
//
// 75 7/18/98 5:04p Aldie
// Added showdamage
//
// 74 7/13/98 4:59p Aldie
// Added dead player bodies with gibbing
//
// 73 7/11/98 8:58p Markd
// Removed testthread command
//
// 72 7/11/98 8:42p Markd
// Added testthread command
//
// 71 7/10/98 6:20a Jimdose
// Added "add" command to add a value to a cvar
// Added G_DrawCSystem for use in debugging orientations
//
// 70 7/09/98 10:38p Aldie
// Put bodyparts into game init
//
// 69 7/08/98 12:54p Jimdose
// Made developer c_var global
//
// 68 7/08/98 12:23p Aldie
// Updated deathmatch scoreboard
//
// 67 7/03/98 12:01p Aldie
// New userinfo stuff
//
// 66 7/01/98 7:02p Aldie
// Removed zoom crosshair stuff
//
// 65 6/23/98 9:54p Jimdose
// Fixed infinite loop bug in G_RunFrame
//
// 64 6/21/98 6:11p Jimdose
// set level.current_entity in G_ClientThink
//
// 63 6/19/98 6:37p Aldie
// Removed one of the stat #defines
//
// 62 6/18/98 8:46p Jimdose
// Added better event error handling
// Added source info to events
//
// 61 6/15/98 8:04p Markd
// changed max_entities
//
// 60 6/10/98 9:31p Markd
// Put in infiite loop checking into main loop
//
// 59 6/09/98 4:19p Jimdose
// Fixed infinite loop bug in G_RunFrame
//
// 58 5/27/98 5:27a Aldie
// added sv_gibs flag
//
// 57 5/27/98 5:02a Aldie
// Added gibs and gore
//
// 56 5/25/98 6:51a Aldie
// Added sv_maxbulletholes
//
// 55 5/24/98 9:10p Markd
// added another mode to sv_showbboxes
//
// 54 5/24/98 8:34p Markd
// changed max_entities
//
// 53 5/24/98 4:48p Jimdose
// Made char *'s const
//
// 52 5/20/98 7:16p Markd
// Added ClientDrawBoundingBoxes
//
// 51 5/18/98 8:13p Jimdose
// Renamed Navigator back to PathManager
//
// 50 5/14/98 10:11p Jimdose
// g_edicts is now initialized to NULL
//
// 49 5/09/98 8:02p Jimdose
// Added ai commands to Clientcommand.
// Disables Cmd_Say_f
// Added path saving
//
// 48 5/08/98 2:54p Jimdose
// working on Cmd_Say_f
//
// 47 5/07/98 10:57p Jimdose
// Fixed gi.error crashing in ClientCommand
//
// 46 5/05/98 2:43p Aldie
// Added server side surface states
//
// 45 5/03/98 4:31p Jimdose
// Increased MAX_DEBUG_LINES
//
// 44 5/02/98 8:37p Aldie
// More console stuff for demos
//
// 43 4/29/98 5:04p Jimdose
// Fixed gi.error so that it doesn't crash when called from C++
//
// 42 4/28/98 8:16p Jimdose
// Added checks to ensure that SOLID_BSP objects have models
//
// 41 4/28/98 6:59p Aldie
// Added server side console buffer
//
// 40 4/27/98 6:09p Jimdose
// Added debug lines
//
// 39 4/27/98 5:28p Aldie
// Added server side console states.
//
// 38 4/23/98 5:00p Jimdose
// Added ai_debugpath
//
// 37 4/20/98 2:45p Jimdose
// working on ai
//
// 36 4/18/98 3:01p Jimdose
// Added ai_createnodes and ai_showpath
//
// 35 4/16/98 2:03p Jimdose
// edict->s.prevframe is set to -1 (cleared) at the beginning of each frame
// Removed pathmanager
//
// 34 4/08/98 12:20a Jimdose
// Made viewcommands unavailble without cheats enabled.
//
// 33 4/07/98 3:48p Aldie
// Added zooming crosshair
//
// 32 4/06/98 7:10p Aldie
// Added zooming for SniperRifle
//
// 31 4/06/98 5:42p Jimdose
// G_RunFrame now clears RF_FRAMELERP in renderfx and sets the oldorigin on
// entities
//
// 30 4/05/98 11:02p Jimdose
// Took out that lastorigin bullshit
//
// 29 4/05/98 10:34p Jimdose
// Added lastorigin to entity so that we can properly track oldorigin since
// worldorigin may be changed prior to setting oldorigin
//
// 28 4/05/98 2:56a Jimdose
// fixed bug where deathmatch scores never went away
//
// 27 4/05/98 1:56a Jimdose
// Fixed bug where oldorigin was being updated with origin instead of
// worldorigin
//
// 26 4/04/98 6:03p Jimdose
// Got rid of unreferenced variable
//
// 25 4/03/98 3:36p Jimdose
// Defined draw flags for STAT_LAYOUTS
//
// 24 4/03/98 1:10p Aldie
// Added consolevar
//
// 23 4/02/98 4:49p Jimdose
// Added stats and scoreboard
//
// 22 3/30/98 2:43p Jimdose
// Started on status bar and dm scores
//
// 21 3/27/98 5:36p Jimdose
// Enabled level changing
//
// 20 3/27/98 12:05p Aldie
// Added consolecmd
//
// 19 3/26/98 8:23p Jimdose
// Added coop variable
// made deathmatch work
// changed groundentity to an edict_t *
// Changed assertions when traversing active entities so that it doesn't crash
// out
//
// 18 3/24/98 4:54p Jimdose
// G_RunFrame now does pre and post physics checks for pending events
//
// 17 3/23/98 1:31p Jimdose
// Revamped event and command system
//
// 16 3/15/98 5:06p Aldie
// fixed bug with viewspan and appending models
//
// 15 3/13/98 10:52a Markd
// fixed bug
//
// 14 3/13/98 10:48a Markd
// Prepended "models/" to the beginning of viewmodel and viewspawn
//
// 13 3/12/98 9:49a Markd
// Re-worked viewthing commands
//
// 12 3/11/98 11:31a Markd
// Re-worked viewthing commands a bunch
//
// 11 3/07/98 2:04p Markd
// Fixed View* commands
//
// 10 3/05/98 6:43p Markd
// Added viewthing support
//
// 9 3/02/98 5:47p Jimdose
// ShutdownGame now frees all entities and paths before exiting
//
// 8 2/21/98 7:32p Jimdose
// Added checks for cl_oldladders and cl_oldnoclip in ClientUserinfoChanged
//
// 7 2/21/98 1:14p Jimdose
// Temporarily bumped up maxentities
// Made player commands act as script commands
// Fixed physics loop so that old_origin is only set when RF_BEAM is not set.
//
// 6 2/17/98 7:01p Jimdose
// gameVars are cleared upon game startup
//
// 5 2/16/98 2:22p Jimdose
// Added active_edicts and free_edicts for faster entity processing and for
// operations that depend on the order that physics is processed on entities
// (such as binding).
//
// 4 2/09/98 2:35p Aldie
// Removed const of vec_origin and vec_zero
//
// 3 2/09/98 11:54a Jimdose
// Made vec_zero and vec_origin const
//
// 2 2/03/98 11:05a Jimdose
// In process of converting to work with Sin progs
//
// 1 1/23/98 5:53p Jimdose
//
// 3 12/30/97 6:04p Jimdose
// Added header text
//
// DESCRIPTION:
//
#define SAVEGAME_VERSION 13
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -