Compare commits

...
220 Commits
Author SHA1 Message Date
smallmodel aef54d05ae Incremented version number 2023-07-25 23:27:07 +02:00
smallmodel 15633626fe Implemented R_GatherLightSources, R_CheckAddLightToList and R_InsertLightIntoList 2023-07-25 22:01:28 +02:00
smallmodel d43b60c818 Don't lean while moving if alwaysAllowLean is not set 2023-07-25 20:59:52 +02:00
smallmodel 7941524aad Set alwaysAllowLean depending on the game version and the dmflags 2023-07-25 20:59:34 +02:00
smallmodel 3aa4a6157c Added PMF_NO_LEAN pmflags
Added alwaysAllowLean pmove_t field from mohta
2023-07-25 20:59:04 +02:00
smallmodel fc9cf41557 Implemented R_GetLightingGridValue (better lighting) 2023-07-25 20:03:07 +02:00
smallmodel 527131e513 R_LoadLightGrid: Set light grid size depending on the map version 2023-07-25 20:02:56 +02:00
smallmodel b79163f998 Fixed sqrt non-constant expression 2023-07-25 18:46:05 +02:00
smallmodel 121aaa164a Implemented sphere light 2023-07-24 20:18:14 +02:00
smallmodel 2522559a04 Implemented R_SphereInLeafs 2023-07-24 20:14:23 +02:00
smallmodel cf61471b2d Added MAX_REAL_LIGHTS 2023-07-24 20:14:16 +02:00
smallmodel 9ebdc6a238 Replaced 2 with RDF_HUD 2023-07-24 20:13:43 +02:00
smallmodel 0c65f5dab3 Incremented version number 2023-07-24 11:47:09 +02:00
smallmodel 12d6b064ec Increased tempmodel count 2023-07-23 19:24:07 +02:00
smallmodel 9de676a86b Set the correct special effect for CG_Splash 2023-07-23 19:21:53 +02:00
smallmodel 087d0047b3 Implemented AGEN_DIST_FADE, AGEN_ONE_MINUS_DIST_FADE, AGEN_TIKI_DIST_FADE, AGEN_ONE_MINUS_TIKI_DIST_FADE and AGEN_HEIGHT_FADE 2023-07-23 19:08:57 +02:00
smallmodel d6952b8915 Implemented RB_CalcAlphaFromHeightFade 2023-07-23 18:43:35 +02:00
smallmodel 396e543b74 Removed tess.numVertexes check from RB_CheckOverflow 2023-07-23 18:21:09 +02:00
smallmodel fa3479cc96 Fixed entities with RF_DONTDRAW being drawn 2023-07-23 18:19:26 +02:00
smallmodel 0e27ebb3e4 Fixed modelanim skyorigin 2023-07-23 18:19:08 +02:00
smallmodel cd3e9bec03 Don't draw NODRAW surface 2023-07-23 15:07:20 +02:00
smallmodel 6082e0abe1 Workaround to fix crash on mohaa fx 2023-07-23 13:46:32 +02:00
smallmodel 23cf561405 Fixed infinite loop in VSS_CalcRepulsionForces 2023-07-23 13:46:15 +02:00
smallmodel a6c7f7d4e0 Fixed animation map 2023-07-23 13:44:30 +02:00
smallmodel 74f230077d Fixed ClientGameCommandManager::BeginTagSpawnLinked incorrectly working
Implemented ClientGameCommandManager::IsBlockCommand
Support for T_WAVE in ClientGameCommandManager::UpdateEmitter
2023-07-22 21:34:18 +02:00
smallmodel c2cc57fa6b Made model check case-insensitive (this fixes thing like recaching, and this fixes cgame crashing with m_spawnthing being null during model parsing) 2023-07-22 21:27:56 +02:00
smallmodel 7b1ab5fea6 Fixed wrong emitter being used
Free temp model if it has no dlight and no model name
2023-07-22 20:36:11 +02:00
smallmodel 3161f28da6 Initialize pEvent to 0 2023-07-22 20:06:16 +02:00
smallmodel 403e98fba6 Implemented ClientGameCommandManager::BeginTagSpawnLinked 2023-07-22 17:45:27 +02:00
smallmodel 3e657679a0 Replaced calls to SpawnTempModel by calls to SpawnEffect call
Set m_spawnthing to m_localemitter if the current SFX is null
2023-07-22 17:35:06 +02:00
smallmodel 7c2cdd52b0 Using SFX enum to spawn SFX 2023-07-22 17:35:02 +02:00
smallmodel 6c46c5d5c0 Fixed life_random not working 2023-07-22 15:49:44 +02:00
smallmodel 930784bdf3 Don't initialize the spawnthing if there is a current SFX 2023-07-22 15:33:31 +02:00
smallmodel 92efd2a4bb Using RF_FLAGS_NOT_INHERITED for CG_AttachEyeEntity 2023-07-22 15:23:12 +02:00
smallmodel 751283aeb5 AllocateTempModel will just return null if there are no free tempmodels
Removed timealive parameter
Using T_SPHERE instead of T_INWARDSPHERE
Using T2_RELATIVEANGLES
2023-07-22 15:22:54 +02:00
smallmodel e97250875c Added relative angles from mohta
Calling SpawnEffect instead of SpawnTempModel
2023-07-22 15:21:57 +02:00
smallmodel c5f853aa1f Added relative angles from mohta 2023-07-22 15:20:51 +02:00
smallmodel 00c07b4e10 Implemented CG_AttachEyeEntity and CG_UpdateForceModels, which fixes turrets, and entity attachment to player 2023-07-21 23:43:57 +02:00
smallmodel 783cefacf9 Fixed surfaces crash 2023-07-21 23:42:09 +02:00
smallmodel 832067d967 Fixed (a little bit) R_RealDlightPatch 2023-07-21 23:36:02 +02:00
smallmodel 8e60786307 Added Q_clamp_int and Q_clamp_float 2023-07-21 23:35:44 +02:00
smallmodel 7172f480eb Added "wrongver" connectionless packet command response
Fixed disconnect not returning to main menu
Implemented CL_AbnormalDisconnect
Removed CL_Disconnect parameter
Using short version for version when connecting
2023-07-21 20:37:45 +02:00
smallmodel b1c732eeb9 Fixed MSG string reading functions returning bad strings 2023-07-21 20:35:41 +02:00
smallmodel 4aad275e3b Removed buffer from Message_Key 2023-07-21 20:35:26 +02:00
smallmodel 2a34e54000 Fixed MSG_ReadGameStateChar not returning correctly 2023-07-21 20:35:13 +02:00
smallmodel f725192d7d Removed float warning 2023-07-21 20:34:59 +02:00
smallmodel 3682d3b799 Export UI_FocusMenuIfExists 2023-07-21 20:34:50 +02:00
smallmodel 24b22392ff Removed CL_Disconnect parameter 2023-07-21 20:34:42 +02:00
smallmodel 035ed1fe24 Added com_target_version and removed CL_Disconnect parameter 2023-07-21 20:32:58 +02:00
smallmodel 129e3bfe6e Removed comment 2023-07-21 20:32:43 +02:00
smallmodel 134873cc51 Removed CL_Disconnect parameter
Added com_target_version
2023-07-21 20:32:33 +02:00
smallmodel d3bda17814 Fixed vertice steps 2023-07-21 20:30:44 +02:00
smallmodel 29c321d2cc Added S_TriggeredMusic_PlayIntroMusic 2023-07-21 20:30:11 +02:00
smallmodel 7106396b3e Implemented R_RecursiveDlightPatch, R_RealDlightPatch and R_RealDlightTerrain 2023-07-20 23:59:52 +02:00
smallmodel ea7ee996a0 Make sure to zero out value at index 3 of static normal and xyz 2023-07-20 23:59:27 +02:00
smallmodel a2808a0dbf Fixed dlightmap being wrong 2023-07-20 23:58:33 +02:00
smallmodel d0a8ac91a7 ParseFace: skip if surface shader has nodraw flags 2023-07-20 23:58:17 +02:00
smallmodel 58b88201dd Using LIGHTMAP_SIZE instead of a constant value 2023-07-19 22:41:14 +02:00
smallmodel eceef48267 Made lightmap_buffer access self-explanatory 2023-07-19 22:40:58 +02:00
smallmodel f32d32f720 Made lightmap_buffer variable 1D 2023-07-19 22:40:40 +02:00
smallmodel c269a4f034 Fixed missing semicolon 2023-07-19 20:59:04 +02:00
smallmodel 9189538410 Fixed LIGHTMAP_SIZE usage 2023-07-19 20:37:05 +02:00
smallmodel 00b028b381 Fixed texture env
Fixed wrong dlight image being used
2023-07-19 20:30:43 +02:00
smallmodel 7d309553cc Fixed dlight byte 2023-07-19 20:30:22 +02:00
smallmodel 8c7dd5fad6 Set DLIGHT_SIZE to 32 instead of 16 2023-07-19 20:21:06 +02:00
smallmodel a5ff63cd01 Fixed env values 2023-07-19 20:20:16 +02:00
smallmodel 5e55e72b5c Set tess.dlightMap to 0 in RB_AddQuadStampExt
Clear dynamic light bits when surface is a sky or has nodlight set
2023-07-19 20:19:54 +02:00
smallmodel 01fbba74ef Code cleanup 2023-07-19 00:40:25 +02:00
smallmodel c7de9048e5 Fixed index mistake 2023-07-19 00:40:14 +02:00
smallmodel 6faded773c Removed (int) useless cast 2023-07-19 00:39:54 +02:00
smallmodel ca4e55fad8 Using LIGHTMAP_SIZE 2023-07-19 00:08:49 +02:00
smallmodel bcf58f90d6 Implemented R_RealDlightFace and R_DlightSample 2023-07-18 22:31:55 +02:00
smallmodel 3f8db539af Fixed lightmap vecs loading 2023-07-18 22:31:45 +02:00
smallmodel e181e00807 Added R_FastDlightTerrain
implemented R_DlightTerrain
Fixed R_DlightSurface (this fixes issues with dynamic lighting)
2023-07-18 21:39:14 +02:00
smallmodel 22fdf36cc6 Added reallight functions, unimplemented 2023-07-18 21:19:16 +02:00
smallmodel 415a5e60da Fixed uninitialized variables 2023-07-18 21:19:01 +02:00
smallmodel 7828cddc2a Implemented DrawStatCircle, DrawStatNeedle, DrawStatRotator DrawStatSpinner and StatCircleTexCoord. The compass HUD is now fully functional 2023-07-18 20:50:40 +02:00
smallmodel 83a6493024 Export ui_health_start and ui_health_end 2023-07-18 20:49:33 +02:00
smallmodel e763d2b17d Added cl_uiradar 2023-07-18 00:10:56 +02:00
smallmodel ae8d26ce18 Use crandom() instead of random() 2023-07-18 00:09:02 +02:00
smallmodel 1438c052b4 Rearranged include files 2023-07-18 00:08:30 +02:00
smallmodel 8489059ea8 Implemented R_TessellateMarkFragments, and R_AddMarkFragmentsToTerrain 2023-07-17 23:28:06 +02:00
smallmodel 2866bfdd04 Fix for DrawStretchRaw and const params 2023-07-17 20:44:09 +02:00
smallmodel 52f60e647d Implemented R_MarkFragmentsForInlineModel and R_BoxSurfacesForBModel_r 2023-07-17 20:09:00 +02:00
smallmodel 66213821c5 Using const parameters for BoxOnPlaneSide 2023-07-17 20:08:26 +02:00
smallmodel baee33e07f Added chrono stuff for C++ 2023-07-17 19:28:55 +02:00
smallmodel 800ccaf020 Fixed animation crossblend not working correctly 2023-07-17 19:24:53 +02:00
smallmodel 7e526ca9a5 Fixed scrambled string errors with accents 2023-07-17 19:13:05 +02:00
smallmodel b07784d884 Merge branch 'main' of github.com:openmoh/openmohaa 2023-07-17 00:25:21 +02:00
pryon 6891d297d2 Implement R_CountTikiLodTris (#48)
* Implement R_CountTikiLodTris

* Fix several bugs in R_DrawDebugNumber and a buffer overrun in R_DebugLine
2023-07-17 00:24:56 +02:00
smallmodel 69c2ea4614 Using font system from SH/BT to support different code pages 2023-07-17 00:24:04 +02:00
smallmodel 7515c99195 Fixed string being wrong if there is a char above 128 (like accents), causing network glitches 2023-07-17 00:22:15 +02:00
smallmodel 70463db037 Fixed normals being corrupted/uninitialized and causing weird artifacts, such as strange water lines in some maps 2023-07-15 21:21:27 +02:00
smallmodel 2015fbda4d Initialize fragment iIndex to 0 2023-07-15 20:50:58 +02:00
smallmodel f227fcdcaa Implemented most mark functions 2023-07-15 20:41:52 +02:00
smallmodel 3a27275cb2 Implemented CG_GetBrushEntitiesInBounds 2023-07-15 20:41:27 +02:00
smallmodel c05403d5d3 Set fov sin/cos
Implemented CG_FrustumCullSphere (from BT code)
2023-07-15 20:41:14 +02:00
smallmodel 89b2c9be9d Added fov sin/cos variables 2023-07-15 20:40:26 +02:00
smallmodel e288272c4a Added CG_FrustumCullSphere and CG_GetBrushEntitiesInBounds 2023-07-15 20:19:08 +02:00
smallmodel fc362fbe6b Made pointBuffer const 2023-07-15 20:18:47 +02:00
smallmodel 113e3c3d87 Added CG_GetBrushEntitiesInBounds 2023-07-15 20:18:33 +02:00
smallmodel 1ae812af96 Added CG_FrustumCullSphere 2023-07-15 20:18:20 +02:00
smallmodel f66ce78a56 Using const for pointBuffer 2023-07-15 20:18:08 +02:00
smallmodel 9882a20a95 Added iIndex in markFragment_t 2023-07-15 20:17:52 +02:00
smallmodel 7458077346 Added more marks variables and struct fields
Reimplemented CG_InitMarks, CG_AllocMark
Implemented CG_FreeMarkPoly, CG_FreeMarkObj, CG_FreeBestMarkObj
2023-07-12 23:53:30 +02:00
smallmodel 483df8ef87 Implemented CG_MakeBulletHoleSound 2023-07-10 23:58:05 +02:00
smallmodel 6318a606e8 Fixed MASK_SHOT value 2023-07-10 23:49:54 +02:00
smallmodel 608b8bec30 Implemented CG_CheckMakeMarkOnEntity, CG_InitTestTreadMark
Added CG_AssembleFinalMarks
2023-07-10 23:28:17 +02:00
smallmodel ac8f34a40c Implemented CG_MakeBubbleTrail, CG_BulletTracerEffect and CG_AddBulletImpacts 2023-07-10 23:08:27 +02:00
smallmodel 7cc687e110 Fixed beam const vec3_t parameter 2023-07-10 23:07:57 +02:00
smallmodel 819fe53eaa Implemented CG_MakeBulletTracerInternal 2023-07-10 21:11:01 +02:00
smallmodel e0a4661ec0 Added CONTENTS_FLUID 2023-07-10 21:10:33 +02:00
smallmodel 8b83b8e5bb Replaced vec_t with vec3_t 2023-07-10 21:10:23 +02:00
smallmodel a2e7a4b4a6 CG_ImpactMark parameters modification 2023-07-10 21:09:56 +02:00
smallmodel f164bc638b Put variables in CG_MakeBulletTracerInternal 2023-07-09 23:36:21 +02:00
smallmodel 68df65994a Name fix 2023-07-09 21:48:37 +02:00
smallmodel 2dc43f9104 Fixed wrong view model animations for mohta and mohtt weapons 2023-07-09 21:24:57 +02:00
smallmodel b8ff6d0f21 Updated README with better screenshots 2023-07-09 21:16:42 +02:00
smallmodel 7063469585 Added death dm flags to increase the duration of the decay time 2023-07-09 21:16:28 +02:00
smallmodel 84f785a872 Fixed TIKI autosteps flags (this fixes footsteps) 2023-07-09 20:36:42 +02:00
smallmodel d7700ea1c2 Call ReregisterMaterial instead of RefreshMaterial 2023-07-09 20:15:47 +02:00
smallmodel 4e4e82c874 Fixed bad fog 2023-07-09 20:12:45 +02:00
smallmodel 0c57ec27e6 Added nodepthwrite, nodepthmask, nocolorwrite and nocolormask
Removed FixRenderCommandList from SortNewShader
Fixed shader.sort being wrongly SS_BLEND0 (this fixes issues when seeing through translucent textures like water)
2023-07-09 19:40:12 +02:00
smallmodel bc249844bf Added GLS_COLOR_NOMASK 2023-07-09 19:39:00 +02:00
smallmodel 7da3432b8c Implemented RE_RefreshShaderNoMip 2023-07-09 18:15:21 +02:00
smallmodel e8ecd1ca9e Implemented R_RefreshImageFile 2023-07-09 18:15:04 +02:00
smallmodel ec21e2e4d0 Added flags parameter for DrawTris 2023-07-09 17:48:31 +02:00
smallmodel 83d8fcb0e6 Reimplemented Autosprite2Deform, this fixes trees sprite rendering 2023-07-09 16:36:35 +02:00
smallmodel dc2b99fb58 Fixed fog extrafrustums above 1 (caused issues with culling) 2023-07-09 15:37:24 +02:00
smallmodel 0f05f8356f Support r_showcull debugging, as well as r_showstaticlod and r_showstaticbboxes 2023-07-09 15:14:11 +02:00
smallmodel 34a426adf1 Implemented R_DrawDebugNumber 2023-07-09 15:13:39 +02:00
smallmodel f4790a0e50 Added R_CountTikiLodTris (unimplemented) 2023-07-09 15:13:24 +02:00
smallmodel e943b95025 Implemented R_DrawDebugLines and R_DrawDebugStrings 2023-07-09 14:38:22 +02:00
smallmodel 981610b13f Declared R_DrawFloatingString 2023-07-09 14:37:57 +02:00
smallmodel 50098b3aed Implemented R_DebugRotatedBBox 2023-07-09 14:37:43 +02:00
smallmodel e3f1705065 Implemented RB_CalcFlapVertexes and RB_CalcEnvironmentTexCoords2 2023-07-09 13:47:42 +02:00
smallmodel 25d526ade5 Moved "flap" above "normal" 2023-07-09 13:47:05 +02:00
Zack Middleton 9c0d66c9f2 Don't list mod directories at Windows drive root
The mod list on Windows would search the root of the drive if
fs_basepath, fs_homepath, fs_steampath, or fs_gogpath are blank ("")
(which is usually the case).

The issue is in the low-level Sys_ListFiles() but it only affects the
mod menu, on Windows. It cannot be abused by console commands to
list system files outside of the virtual filesystem.

---

If a directory at the root of the drive of the working directory
contained a pk3 file, the directory was listed in the mods menu. The
virtual filesystem doesn't add blank directory names to the search path
so it cannot load mods from the drive root. (Unless of course you set a
fs_*path cvar to "C:\".)

Sys_ListFiles() with blank directory caused Windows to use "\*" for the
search path and "\" prefix means root of drive. Unix opendir("") failed
so nothing was listed for blank directory.

Sys_ListFilteredFiles() with blank directory _and_ specifying subdirs
could access any directory (on Windows and Unix-like) but no code uses
this or makes it accessible.

These functions are only used for initializing the virtual filesystem
and listing mods. They are not accessible by anything else such as a
console command. Only the mods menu, on Windows, is affected.
2023-07-06 19:46:01 +02:00
smallmodel db216a56bf Improved the README file 2023-07-06 18:32:14 +02:00
smallmodel 8a46597820 Added a new constructor that accepts numArgs as parameters
(this fixes bad script commands)
2023-07-05 21:42:36 +02:00
smallmodel 75572eb1b9 Fixed testthread crashing the game when the label parameter is unspecified 2023-07-05 21:41:43 +02:00
smallmodel f930d39a42 Used clang-format on cgame module 2023-07-05 21:24:23 +02:00
smallmodel 13828994fb Used clang-format on gamespy files 2023-07-05 21:24:14 +02:00
smallmodel 68d48d9889 Used clang-format on some common files 2023-07-05 21:24:02 +02:00
smallmodel 37d8938e91 Updated clang-format 2023-07-05 21:05:33 +02:00
smallmodel 5333c7ff4a Removed empty line before opening braces 2023-07-05 20:52:55 +02:00
smallmodel 4d3fe0fd73 Added .clang-format (currently experimental) 2023-07-05 20:51:05 +02:00
smallmodel 61650a22fd Removed TODO/CHANGELOG as they are no longer accurate 2023-07-05 19:33:38 +02:00
OM 7a6d6070dc Removed MAX_TEAMNAME (useless) 2023-07-05 18:36:49 +02:00
OM 51116b933d Fixed code_pos being wrong after loadTop/storeTop 2023-07-04 23:16:35 +02:00
OM 4263b2843a Fixed code_pos not being incremented in EmitField 2023-07-04 23:15:45 +02:00
OM fd871d6c8f avoid incrementing m_CodePos in OP_STORE_STRING and OP_STORE_VECTOR as fetchOpcodeValue() already does that 2023-07-04 23:06:33 +02:00
OM 1776ac2344 Fixed configstring not sending after post-loading 2023-07-04 23:06:02 +02:00
OM b0b80dda6f Added single-player note 2023-07-04 20:06:52 +02:00
OM b5dd79287a Fixed colors segmentation fault (because it was grabbing 4 bytes instead of 3 thanks to unsigned int*) 2023-07-02 21:22:15 +02:00
OM d4fb368dab Increased version number 2023-07-02 21:21:42 +02:00
OM 53e6391c54 GitHub actions now run on different branches 2023-07-02 20:14:25 +02:00
OM 805a101978 Removed commented-out lines 2023-07-02 20:12:33 +02:00
OM 837fb40732 Completely removed TARGET_GAME_TYPE detection 2023-07-02 20:10:53 +02:00
OM 668f74ffc0 Set the game name depending on com_target_game 2023-07-02 20:10:38 +02:00
OM d3a4b3e53d Removed extension from full product name 2023-07-02 20:08:37 +02:00
OM 087f1d38f5 Replaced TARGET_GAME_VERSION with com_version->string 2023-07-02 20:08:18 +02:00
OM 6e1fbbaddc Removed com_gamename as it was useless 2023-07-02 20:07:59 +02:00
OM 17b63e56ca Set PROTOCOL_VERSION to 17 by default 2023-07-02 20:07:30 +02:00
OM 4841d8026f Allow gamespy to run on the 3 different games at runtime 2023-07-02 20:07:15 +02:00
OM 942bc9e523 Removed TARGET_GAME_TYPE definition 2023-07-02 20:06:35 +02:00
OM 08fec1a8c5 Removed -DTARGET_GAME_TYPE parameter 2023-07-02 20:05:50 +02:00
OM 41cfac1ec4 Updated the README file 2023-07-02 19:47:41 +02:00
OM 4d75c9ad05 Don't produce TT builds as expansions can be switched at runtime 2023-07-02 19:43:46 +02:00
OM 96f72c0bb8 Denormalize configstrings when sending the game state 2023-07-02 19:42:03 +02:00
OM a3755ff308 Set GAME_API_VERSION to 15 2023-07-02 19:41:46 +02:00
OM 87b238e6de Renamed gameImport to game_import_t, and gameExport_t to game_export_t 2023-07-02 19:22:17 +02:00
OM 7db4d1a3f4 Newline fix 2023-07-02 19:18:37 +02:00
OM 7b34f064d0 Moved gi.protocol to a new variable called g_protocol 2023-07-02 19:17:15 +02:00
OM 36dce22071 Moved cgi.protocol to a new variable called cg_protocol instead, due to issues like GetCGameAPI being loaded before having client imports (cgi) 2023-07-02 19:16:48 +02:00
OM fa69717bed Using "main" for loading DLLs as they are now combined 2023-07-02 19:15:35 +02:00
OM 174d3f7447 Send the correct CGM number depending on the protocol used 2023-07-02 18:32:26 +02:00
OM b6a44fe810 Send fog info depending on the protocol used 2023-07-02 18:31:58 +02:00
OM b9c5a4d5ba Write server frametime depending on the protocol used 2023-07-02 18:31:43 +02:00
OM b67b3863ba Added view model anim normalization 2023-07-02 18:31:18 +02:00
OM 1947c30d3d Export MSG_IsProtocolVersion15 2023-07-02 18:30:52 +02:00
OM 9d3fa377df Set breakthrough clientType if maintt is the target 2023-07-02 18:29:42 +02:00
OM 9603f8e38a Parse the fog info depending on the game version 2023-07-01 21:20:15 +02:00
OM cb95284d0c Draw spectator view depending on the protocol version 2023-07-01 21:18:58 +02:00
OM 00b926db29 Init the client game export for scores and CG message 2023-07-01 21:18:30 +02:00
OM cf009a4628 Parse CG message based on game protocol version 2023-07-01 21:17:59 +02:00
OM e456964be4 Parse the scores based on the game version 2023-07-01 21:17:42 +02:00
OM 8418da422c Stopwatch: checking protocol at runtime instead 2023-07-01 21:17:30 +02:00
OM 0f0fbb7b0d Merge branch 'main' into features/universal-client 2023-07-01 20:52:39 +02:00
OM 8a7cb7fb24 Merge branch 'main' of github.com:openmoh/openmohaa 2023-07-01 20:52:18 +02:00
pryon ca468b9407 Implement RB_SurfaceMarkFragment (#47)
Looks good
Btw it won't be possible to make a common function, because like others `RB_Surface*`, both functions use a different struct (even if some of the fields have the same name between structures)
2023-07-01 20:51:14 +02:00
OM 7eac426e31 Added net_pm_flags field for denormalized pm_flags (depending on the target game) 2023-06-29 22:16:46 +02:00
OM e33a562c04 CG_PlayerTeamIcon: Removed TARGET_GAME_PROTOCOL check 2023-06-29 21:29:57 +02:00
OM dbfa741a06 Unified configstrings and player state flags (they will be normalized by the client/server instead) 2023-06-29 21:29:38 +02:00
OM f1aecd3939 Removed compile-time TARGET_GAME_PROTOCOL check (use runtime detection instead) 2023-06-29 21:29:14 +02:00
OM e8a9eb775e Added protocol/targetGame variables 2023-06-29 21:28:43 +02:00
OM a4d71bb150 Added bg_compat.cpp 2023-06-29 21:28:19 +02:00
OM 3def146e90 Get normalized playerstate flags and configstring when receiving them 2023-06-29 21:28:08 +02:00
OM 906f9cb89d Denormalize player state flags when sending them to client 2023-06-29 21:27:45 +02:00
OM cbe6354d2d Denormalize configstring when sending it to the client 2023-06-29 21:27:19 +02:00
OM 931c3147f8 Initialize targetGame and protocol in imports 2023-06-29 21:26:34 +02:00
OM f02cc7942d Added bg_compat to translate configstrings and playerstate flags for target games 2023-06-29 21:26:02 +02:00
OM 75aeba31c6 Added com_target_game startup variable
FS_Startup now uses `fs_basegame` variable for mainta/maintt
2023-06-29 21:25:26 +02:00
OM ff0474a483 Adding specific bg_x files manually 2023-06-29 21:24:11 +02:00
OM 7e18d51550 Added Com_InitHunkMemory 2023-06-28 22:48:28 +02:00
OM ba4680d510 Added defines for each moh games 2023-06-28 22:48:10 +02:00
OM c83bbd6a58 Disabled pak files checking because it was causing trouble between languages 2023-06-27 21:05:38 +02:00
OM 79ce5261a5 Bumped version number 2023-06-27 00:28:58 +02:00
OM 9fdda882e5 Execute known commands in a separate function called CL_ProcessServerCommand
Also fixed crash with server quitting: Com_Error was called immediately with the cgame module in stack - Com_Error would call CL_Disconnect which would unload cgame module, invalidating stack frames and rendering longjmp impossible
2023-06-27 00:23:11 +02:00
OM 55e07205e3 Fixed sval_func1 not having a sourcepos (leading to invalid memory access) 2023-06-27 00:01:30 +02:00
OM 3ff4a7b8e4 Removed Quake III arena's boring call to Hunk_ClearTempMemory from FS_FreeFile 2023-06-27 00:01:12 +02:00
OM f6c25921dc Fixed linux compilation errors 2023-06-25 22:07:17 +02:00
OM f38645d19f Removed static variables from extern 2023-06-25 21:34:53 +02:00
OM 6134b150c1 ioq3 files backport 2023-06-25 20:26:47 +02:00
OM e275c4692e Fixed linked doors assertion failure 2023-06-25 20:04:11 +02:00
OM fdd4968ba9 Set homePath to an empty string 2023-06-25 19:35:53 +02:00
OM 02993eaa9b Backported ioq3 features 2023-06-25 19:35:41 +02:00
OM 7e44b955d7 newline 2023-06-25 19:35:13 +02:00
OM 1855bf1bd4 Removed cl_curl.cpp as there is cl_curl.c 2023-06-25 19:34:42 +02:00
pryon adc6a6579f Implement R_TerrainHeightForPoly (#45)
* Implement R_TerrainHeightForPoly

* Add back the original assert messages using the && va trick
2023-06-25 00:09:35 +02:00
264 changed files with 28563 additions and 25583 deletions

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
---
Language: Cpp
Standard: c++17
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: Consecutive
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: True
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterClass: true
AfterEnum: false
AfterExternBlock: false
AfterFunction: true
AfterNamespace: true
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyNamespace: false
SplitEmptyRecord: false
BreakArrays: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: Always
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ColumnLimit: 120
CompactNamespaces: false
Cpp11BracedListStyle: true
EmptyLineBeforeAccessModifier: Always
IndentAccessModifiers: false
IndentCaseBlocks: true
IndentCaseLabels: false
IndentExternBlock: Indent
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentRequiresClause: true
IndentWidth: 4
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: LF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PackConstructorInitializers: Never
PointerAlignment: Right
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: false
RequiresClausePosition: WithFollowing
SeparateDefinitionBlocks: Always
SortIncludes: false
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeParens: ControlStatements
SpacesInAngles: Never
UseTab: Never
+2 -14
View File
@@ -2,9 +2,7 @@ name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
concurrency:
@@ -93,14 +91,12 @@ jobs:
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=0 ./source
cmake -B ./buildtt ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=2 ./source
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}
@@ -109,15 +105,12 @@ jobs:
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
cd "${{github.workspace}}/buildtt"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --install ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
cp '${{github.workspace}}/thirdparties/SDL-install/lib/libSDL2.so' '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
@@ -179,14 +172,12 @@ jobs:
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
cmake -B ./build ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=0 ./source
cmake -B ./buildtt ${{ env.CMAKE_PARAM }} -DTARGET_GAME_TYPE=2 ./source
cmake -B ./build ${{ env.CMAKE_PARAM }} ./source
- name: Build
working-directory: ${{github.workspace}}
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}
@@ -195,15 +186,12 @@ jobs:
run: |
cd "${{github.workspace}}/build"
ctest -C ${{env.BUILD_TYPE}}
cd "${{github.workspace}}/buildtt"
ctest -C ${{env.BUILD_TYPE}}
- name: Install
working-directory: ${{github.workspace}}
# Install to the directory defined in CMAKE_INSTALL_PREFIX
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
cmake --install ${{github.workspace}}/buildtt --config ${{env.BUILD_TYPE}}
Copy-Item "${{github.workspace}}/thirdparties/SDL-install/bin/*.dll" -Destination "${{github.workspace}}/install"
- uses: actions/upload-artifact@v3
-13
View File
@@ -1,13 +0,0 @@
=== Patch 1.12 ===
>>> Client :
- Added GFX features such as bloom, SSAO & FXAA
- Added support of .vision files
- Added support of custom weapons and view model animations
>>> Game :
- Added more scripting functions
- Lot more..
THIS CHANGELOG IS NOT COMPLETED YET.
+5 -15
View File
@@ -5,23 +5,13 @@ include(TargetArch.cmake)
target_architecture(TARGET_ARCH)
if(TARGET_GAME_TYPE)
if(TARGET_GAME_TYPE EQUAL 1)
# Build for Team Assault (Spearhead)
set(TARGET_BASE_SUFFIX "ta")
elseif(TARGET_GAME_TYPE EQUAL 2)
# Build for Team Tactics (Breakthrough)
set(TARGET_BASE_SUFFIX "tt")
else()
set(TARGET_BASE_SUFFIX)
message(SEND_ERROR "Invalid game type. Game type can be 0, 1 or 2")
endif()
else()
set(TARGET_BASE_SUFFIX)
set(TARGET_GAME_TYPE 0)
message(SEND_ERROR "TARGET_GAME_TYPE is now unsupported, it is now done at runtime.")
endif()
set(TARGET_BASE_GAME "main${TARGET_BASE_SUFFIX}")
set(TARGET_BASE_GAME "main")
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
@@ -37,7 +27,7 @@ ELSE()
set(TARGET_ARCH_SUFFIX ${TARGET_ARCH})
ENDIF()
message(STATUS "Architecture detected: ${TARGET_ARCH}, suffix set to ${TARGET_ARCH_SUFFIX}")
message(STATUS "Architecture detected: ${TARGET_ARCH}, suffix set to ${TARGET_ARCH_SUFFIX}.")
IF(WIN32)
set(TARGET_PLATFORM_PREFIX "")
+43 -34
View File
@@ -1,22 +1,45 @@
# OpenMoHAA
![Build](https://github.com/openmoh/openmohaa/actions/workflows/build-cmake.yml/badge.svg?branch=main) [![Release](https://img.shields.io/github/v/release/openmoh/openmohaa)](https://github.com/openmoh/openmohaa/releases) [![Downloads](https://img.shields.io/github/downloads/openmoh/openmohaa/total)](https://github.com/openmoh/openmohaa/releases)
![License](https://img.shields.io/github/license/openmoh/openmohaa) ![Commits](https://img.shields.io/github/commit-activity/t/openmoh/openmohaa)
![Discord](https://img.shields.io/discord/596049712579215361?logo=discord&logoColor=white&color=5865F2)
```
/ _ \ _ __ ___ _ __ | \/ |/ _ \| | | | / \ / \
| | | | '_ \ / _ \ '_ \| |\/| | | | | |_| | / _ \ / _ \
| |_| | |_) | __/ | | | | | | |_| | _ |/ ___ \ / ___ \
\___/| .__/ \___|_| |_|_| |_|\___/|_| |_/_/ \_\/_/ \_\
|_|
## Discord
[![Discord Banner 1](https://discordapp.com/api/guilds/596049712579215361/widget.png?style=banner2)](https://discord.gg/NYtH58R)
```
## Current State
[![Build](https://github.com/openmoh/openmohaa/actions/workflows/build-cmake.yml/badge.svg)](https://github.com/openmoh/openmohaa/actions/workflows/build-cmake.yml)
OpenMoHAA is still in its early days. The singleplayer part is not working correctly, the current usage is multiplayer.
OpenMoHAA is still in its early days.
## Running
Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
a) extract archive to your MOHAA installation directory.
-or-
b) Copy all pak*.pk3 files and the sound/ directory from your **MOHAA/main** directory into openmohaa's 'main' directory.
If you have problems running the game :
You may need to install Microsoft Visual C++ 2015/2017/2019/2022 Redistributable from
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
You can now start a local OpenMOHAA server or play on a server.
To play expansions, append to the executable `+set com_target_game 1` for Spearhead, and `+set com_target_game 2` for Breakthrough. On windows you can make a shortcut.
## Builds
### Server
@@ -43,25 +66,7 @@ Here is the current working state for each part of the engine:
| Server module (fgame) | | x | | | | | Actor, vehicle, and few gameplay bugs |
| UI | | | | x | | | Has core features only (menu, widgets, console, hud, urc loading) |
NOTE: Both client and server version can be compiled to target **Medal of Honor: Spearhead** and **Medal of Honor: Breakthrough**.
## Running
Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
a) extract archive to your MOHAA installation directory.
-or-
b) Copy all pak*.pk3 files and the sound/ directory from your **MOHAA/main** directory into openmohaa's 'main' directory.
If you have problems running the game :
You may need to install Microsoft Visual C++ 2015/2017/2019/2022 Redistributable from
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
You can now start a local OpenMOHAA server or play on a server.
**Medal of Honor: Allied Assault Spearhead** and **Medal of Honor: Allied Assault Breakthrough** are supported in OpenMoHAA with the `com_target_game` variable. See the **Running** section for the usage.
## Compiling
@@ -76,8 +81,6 @@ The installation directory can be set to MOHAA directory.
The client build can be built by adding `-DWITH_CLIENT=1` to the CMake command line. This will compile the cgame module and the full app with rendering, ui and sound suppport, alongside the dedicated server version.
To compile for either Spearhead or Breakthrough, append `-DTARGET_GAME_TYPE=x` where x can be 1 for Team Assault (Spearhead), and 2 for Team Tactics (Breakthrough). 2 is recommended because Team Tactics can connect to both Spearhead and Breakthrough servers.
### Linux
These are the tools required on Unix :
@@ -101,10 +104,10 @@ Visual Studio (2019 or 2022) is generally preferred.
## Screenshots
| | |
|---------------------------------------------------------------------|---------------------------------------------------------------------------|
| ![](docs/images/opm_53_tt_1.png "Playing on a Breakthrough server") | ![](docs/images/opm_50b_1.png) |
| ![](docs/images/opm_50b_2.png) | ![](docs/images/opm-arm_53_tt_1.png "OpenMoHAA on Raspberry") |
| | |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------|
| ![](docs/images/opmtt-x86_64_0.56.0_1.png "Playing on a Breakthrough server") | ![](docs/images/opmtt-x86_64_0.56.0_2.png) |
| ![](docs/images/opmtt-x86_64_0.56.0_3.png) | ![](docs/images/opm-arm_53_tt_1.png "OpenMoHAA on Raspberry") |
## Third party
@@ -143,8 +146,14 @@ https://xiph.org/vorbis/
https://opus-codec.org/
## URLs and communities
## Communities
### URLs
- https://github.com/openmoh/openmohaa/
- https://mohaaaa.co.uk/AAAAMOHAA/index.php
- https://x-null.net/
### Discord
[![Discord Banner 1](https://discordapp.com/api/guilds/596049712579215361/widget.png?style=banner2)](https://discord.gg/NYtH58R)
-25
View File
@@ -1,25 +0,0 @@
//// //// //// //// ////
/// OpenMoHAA - TODO ///
//// //// //// //// ////
================
= Server code =
================
1) Fix some crashes
================
= Client =
================
2) Better client/sound implementation
3) Better renderer implementation (light, fog)
4) Better cgame implementation (using FAKK2)
5) UI implementation (unfortunately, the mohaa UI is fully based on FAKK 2 sources but isn't available anywhere)
================
= Game code =
================
6) Finish the vehicle implementation
--- Open Beta ---
7) Actors/SinglePlayer
8) SH/BT features (there are not much things to implement I guess)
--- Release ---
+2 -2
View File
@@ -18,11 +18,11 @@ set(SOURCES_SHARED
"../script/scriptvariable.cpp"
)
file(GLOB_RECURSE SOURCES_BG "../fgame/bg_*.cpp")
file(GLOB_RECURSE SOURCES_BG "../fgame/bg_misc.cpp" "../fgame/bg_pmove.cpp" "../fgame/bg_slidemove.cpp")
file(GLOB_RECURSE SOURCES_CGAME "./*.c" "./*.cpp")
add_library(cgame SHARED ${SOURCES_CGAME} ${SOURCES_BG})
target_compile_definitions(cgame PRIVATE CGAME_DLL TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_definitions(cgame PRIVATE CGAME_DLL)
target_compile_features(cgame PUBLIC cxx_nullptr)
target_compile_features(cgame PUBLIC c_variadic_macros)
target_link_libraries(cgame PUBLIC qcommon)
+437 -595
View File
File diff suppressed because it is too large. Load diff
+1991 -2393
View File
File diff suppressed because it is too large. Load diff
+492 -489
View File
File diff suppressed because it is too large. Load diff
+104 -118
View File
@@ -61,22 +61,25 @@ Debugging command to print the current position
*/
static void CG_Viewpos_f(void)
{
cgi.Printf("(%i %i %i) : %i\n", (int)cg.refdef.vieworg[0],
(int)cg.refdef.vieworg[1], (int)cg.refdef.vieworg[2],
(int)cg.refdefViewAngles[YAW]);
cgi.Printf(
"(%i %i %i) : %i\n",
(int)cg.refdef.vieworg[0],
(int)cg.refdef.vieworg[1],
(int)cg.refdef.vieworg[2],
(int)cg.refdefViewAngles[YAW]
);
}
void CG_SetDesiredObjectiveAlpha(float fAlpha)
{
cg.ObjectivesDesiredAlpha = fAlpha;
cg.ObjectivesAlphaTime = (float)(cg.time + 250);
cg.ObjectivesBaseAlpha = cg.ObjectivesCurrentAlpha;
cg.ObjectivesAlphaTime = (float)(cg.time + 250);
cg.ObjectivesBaseAlpha = cg.ObjectivesCurrentAlpha;
}
void CG_ScoresDown_f( void )
void CG_ScoresDown_f(void)
{
if (cgs.gametype == GT_SINGLE_PLAYER)
{
if (cgs.gametype == GT_SINGLE_PLAYER) {
if (!cg.scoresRequestTime) {
cg.scoresRequestTime = cg.time;
CG_SetDesiredObjectiveAlpha(1.0f);
@@ -85,32 +88,29 @@ void CG_ScoresDown_f( void )
return;
}
if ( cg.scoresRequestTime + 2000 >= cg.time )
{
if (cg.scoresRequestTime + 2000 >= cg.time) {
// send another request
cg.showScores = qtrue;
CG_PrepScoreBoardInfo();
cgi.UI_ShowScoreBoard(cg.scoresMenuName);
return;
}
cg.scoresRequestTime = cg.time;
cgi.SendClientCommand( "score" );
return;
}
if ( !cg.showScores ) {
// don't display anything until first score returns
cg.showScores = qtrue;
cg.scoresRequestTime = cg.time;
cgi.SendClientCommand("score");
if (!cg.showScores) {
// don't display anything until first score returns
cg.showScores = qtrue;
CG_PrepScoreBoardInfo();
cgi.UI_ShowScoreBoard(cg.scoresMenuName);
}
}
}
void CG_ScoresUp_f( void )
void CG_ScoresUp_f(void)
{
if (cgs.gametype == GT_SINGLE_PLAYER)
{
if (!cg.scoresRequestTime)
{
if (cgs.gametype == GT_SINGLE_PLAYER) {
if (!cg.scoresRequestTime) {
cg.scoresRequestTime = cg.time;
CG_SetDesiredObjectiveAlpha(0.0f);
}
@@ -126,12 +126,12 @@ void CG_ScoresUp_f( void )
cgi.UI_HideScoreBoard();
}
baseshader_t* CG_GetShaderUnderCrosshair(qboolean bVerbose, trace_t* pRetTrace)
baseshader_t *CG_GetShaderUnderCrosshair(qboolean bVerbose, trace_t *pRetTrace)
{
vec3_t vPos, vEnd;
vec3_t axis[3];
baseshader_t* pShader;
trace_t trace;
vec3_t vPos, vEnd;
vec3_t axis[3];
baseshader_t *pShader;
trace_t trace;
AnglesToAxis(cg.refdefViewAngles, axis);
vPos[0] = cg.refdef.vieworg[0];
@@ -140,18 +140,13 @@ baseshader_t* CG_GetShaderUnderCrosshair(qboolean bVerbose, trace_t* pRetTrace)
VectorMA(vPos, 4096.0, axis[0], vEnd);
CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_SHOT, 0, 0, "CG_GetShaderUnderCrosshair");
if (trace.startsolid || trace.fraction == 1.0) {
return NULL;
}
if (bVerbose)
{
cgi.Printf(
"Surface hit at (%i %i %i)\n",
(int)trace.endpos[0],
(int)trace.endpos[1],
(int)trace.endpos[2]);
if (bVerbose) {
cgi.Printf("Surface hit at (%i %i %i)\n", (int)trace.endpos[0], (int)trace.endpos[1], (int)trace.endpos[2]);
}
pShader = cgi.GetShader(trace.shaderNum);
@@ -179,19 +174,15 @@ static void CG_PrintSurfaceType(int iSurfType)
void CG_GetCHShader(void)
{
trace_t trace;
baseshader_t* pShader;
trace_t trace;
baseshader_t *pShader;
pShader = CG_GetShaderUnderCrosshair(qtrue, &trace);
cgi.Printf("\n");
if (pShader)
{
if (pShader->surfaceFlags & SURF_SKY)
{
if (pShader) {
if (pShader->surfaceFlags & SURF_SKY) {
cgi.Printf("Hit the sky\n");
}
else
{
} else {
cgi.Printf("Shader: %s\n", pShader->shader);
cgi.Printf("Shader Contents:");
CG_PrintContentTypes(pShader->contentFlags);
@@ -212,28 +203,23 @@ void CG_GetCHShader(void)
CG_PrintSurfaceType(trace.surfaceFlags);
cgi.Printf("\n\n");
}
}
else
{
} else {
cgi.Printf("No surface selected\n");
}
}
void CG_EditCHShader(void)
{
char name[1024];
baseshader_t* pShader;
char name[1024];
baseshader_t *pShader;
pShader = CG_GetShaderUnderCrosshair(qfalse, NULL);
if (pShader)
{
if (pShader) {
strcpy(name, "editspecificshader ");
strcat(name, pShader->shader);
strcat(name, "\n");
cgi.AddCommand(name);
}
else
{
} else {
cgi.Printf("No surface selected\n");
}
}
@@ -348,61 +334,61 @@ void CG_AddTestModel (void) {
#endif
typedef struct {
char* cmd;
char *cmd;
void (*function)(void);
} consoleCommand_t;
static consoleCommand_t commands[] = {
{ "useweaponclass", &CG_UseWeaponClass_f },
{ "weapnext", &CG_NextWeapon_f },
{ "weapprev", &CG_PrevWeapon_f },
{ "uselast", &CG_UseLastWeapon_f },
{ "holster", &CG_HolsterWeapon_f },
{ "weapdrop", &CG_DropWeapon_f },
{ "toggleitem", &CG_ToggleItem_f },
{ "+scores", &CG_ScoresDown_f },
{ "-scores", &CG_ScoresUp_f },
{ "viewpos", &CG_Viewpos_f },
{ "sizeup", &CG_SizeUp_f },
{ "sizedown", &CG_SizeDown_f },
{ "cg_eventlist", &CG_EventList_f },
{ "cg_eventhelp", &CG_EventHelp_f },
{ "cg_dumpevents", &CG_DumpEventHelp_f },
{ "cg_pendingevents", &CG_PendingEvents_f },
{ "cg_classlist", &CG_ClassList_f },
{ "cg_classtree", &CG_ClassTree_f },
{ "cg_classevents", &CG_ClassEvents_f },
{ "cg_dumpclassevents", &CG_DumpClassEvents_f },
{ "cg_dumpallclasses", &CG_DumpAllClasses_f },
{ "testemitter", &CG_TestEmitter_f },
{ "triggertestemitter", &CG_TriggerTestEmitter_f },
{ "prevemittercommand", &CG_PrevEmitterCommand_f },
{ "nextemittercommand", &CG_NextEmitterCommand_f },
{ "newemittercommand", &CG_NewEmitterCommand_f },
{ "deleteemittercommand", &CG_DeleteEmitterCommand_f },
{ "dumpemitter", &CG_DumpEmitter_f },
{ "loademitter", &CG_LoadEmitter_f },
{ "resetvss", &CG_ResetVSSSources },
{ "getchshader", &CG_GetCHShader },
{ "editchshader", &CG_EditCHShader },
{ "messagemode", &CG_MessageMode_f },
{ "messagemode_all", &CG_MessageMode_All_f },
{ "messagemode_team", &CG_MessageMode_Team_f },
{ "messagemode_private", &CG_MessageMode_Private_f },
{ "say", &CG_MessageSingleAll_f },
{ "sayteam", &CG_MessageSingleTeam_f },
{ "teamsay", &CG_MessageSingleTeam_f },
{ "sayprivate", &CG_MessageSingleClient_f },
{ "sayone", &CG_MessageSingleClient_f },
{ "wisper", &CG_MessageSingleClient_f },
{ "instamsg_main", &CG_InstaMessageMain_f },
{ "instamsg_group_a", &CG_InstaMessageGroupA_f },
{ "instamsg_group_b", &CG_InstaMessageGroupB_f },
{ "instamsg_group_c", &CG_InstaMessageGroupC_f },
{ "instamsg_group_d", &CG_InstaMessageGroupD_f },
{ "instamsg_group_e", &CG_InstaMessageGroupE_f },
{ "pushmenu_teamselect", &CG_PushMenuTeamSelect_f },
{ "pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f },
{"useweaponclass", &CG_UseWeaponClass_f },
{"weapnext", &CG_NextWeapon_f },
{"weapprev", &CG_PrevWeapon_f },
{"uselast", &CG_UseLastWeapon_f },
{"holster", &CG_HolsterWeapon_f },
{"weapdrop", &CG_DropWeapon_f },
{"toggleitem", &CG_ToggleItem_f },
{"+scores", &CG_ScoresDown_f },
{"-scores", &CG_ScoresUp_f },
{"viewpos", &CG_Viewpos_f },
{"sizeup", &CG_SizeUp_f },
{"sizedown", &CG_SizeDown_f },
{"cg_eventlist", &CG_EventList_f },
{"cg_eventhelp", &CG_EventHelp_f },
{"cg_dumpevents", &CG_DumpEventHelp_f },
{"cg_pendingevents", &CG_PendingEvents_f },
{"cg_classlist", &CG_ClassList_f },
{"cg_classtree", &CG_ClassTree_f },
{"cg_classevents", &CG_ClassEvents_f },
{"cg_dumpclassevents", &CG_DumpClassEvents_f },
{"cg_dumpallclasses", &CG_DumpAllClasses_f },
{"testemitter", &CG_TestEmitter_f },
{"triggertestemitter", &CG_TriggerTestEmitter_f },
{"prevemittercommand", &CG_PrevEmitterCommand_f },
{"nextemittercommand", &CG_NextEmitterCommand_f },
{"newemittercommand", &CG_NewEmitterCommand_f },
{"deleteemittercommand", &CG_DeleteEmitterCommand_f},
{"dumpemitter", &CG_DumpEmitter_f },
{"loademitter", &CG_LoadEmitter_f },
{"resetvss", &CG_ResetVSSSources },
{"getchshader", &CG_GetCHShader },
{"editchshader", &CG_EditCHShader },
{"messagemode", &CG_MessageMode_f },
{"messagemode_all", &CG_MessageMode_All_f },
{"messagemode_team", &CG_MessageMode_Team_f },
{"messagemode_private", &CG_MessageMode_Private_f },
{"say", &CG_MessageSingleAll_f },
{"sayteam", &CG_MessageSingleTeam_f },
{"teamsay", &CG_MessageSingleTeam_f },
{"sayprivate", &CG_MessageSingleClient_f },
{"sayone", &CG_MessageSingleClient_f },
{"wisper", &CG_MessageSingleClient_f },
{"instamsg_main", &CG_InstaMessageMain_f },
{"instamsg_group_a", &CG_InstaMessageGroupA_f },
{"instamsg_group_b", &CG_InstaMessageGroupB_f },
{"instamsg_group_c", &CG_InstaMessageGroupC_f },
{"instamsg_group_d", &CG_InstaMessageGroupD_f },
{"instamsg_group_e", &CG_InstaMessageGroupE_f },
{"pushmenu_teamselect", &CG_PushMenuTeamSelect_f },
{"pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f},
};
/*
@@ -415,8 +401,8 @@ Cmd_Argc() / Cmd_Argv()
*/
qboolean CG_ConsoleCommand(void)
{
const char* cmd;
int i;
const char *cmd;
int i;
cmd = cgi.Argv(0);
@@ -475,7 +461,7 @@ void CG_PushMenuTeamSelect_f(void)
default:
cgi.Cmd_Execute(EXEC_NOW, "pushmenu SelectTeam\n");
break;
}
}
}
void CG_PushMenuWeaponSelect_f(void)
@@ -489,7 +475,7 @@ void CG_PushMenuWeaponSelect_f(void)
void CG_UseWeaponClass_f(void)
{
const char* cmd;
const char *cmd;
cmd = cgi.Argv(1);
@@ -520,37 +506,37 @@ void CG_UseWeaponClass_f(void)
void CG_NextWeapon_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_USE_NEXT_WEAPON;
cg.iWeaponCommand = WEAPON_COMMAND_USE_NEXT_WEAPON;
cg.iWeaponCommandSend = 0;
}
void CG_PrevWeapon_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_USE_PREV_WEAPON;
cg.iWeaponCommand = WEAPON_COMMAND_USE_PREV_WEAPON;
cg.iWeaponCommandSend = 0;
}
void CG_UseLastWeapon_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_USE_LAST_WEAPON;
cg.iWeaponCommand = WEAPON_COMMAND_USE_LAST_WEAPON;
cg.iWeaponCommandSend = 0;
}
void CG_HolsterWeapon_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_HOLSTER;
cg.iWeaponCommand = WEAPON_COMMAND_HOLSTER;
cg.iWeaponCommandSend = 0;
}
void CG_DropWeapon_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_DROP;
cg.iWeaponCommand = WEAPON_COMMAND_DROP;
cg.iWeaponCommandSend = 0;
}
void CG_ToggleItem_f(void)
{
cg.iWeaponCommand = WEAPON_COMMAND_USE_ITEM1;
cg.iWeaponCommand = WEAPON_COMMAND_USE_ITEM1;
cg.iWeaponCommandSend = 0;
}
@@ -562,7 +548,7 @@ int CG_WeaponCommandButtonBits(void)
return 0;
}
iShiftedWeaponCommand = cg.iWeaponCommand << 7;
iShiftedWeaponCommand = cg.iWeaponCommand << 7;
cg.iWeaponCommandSend++;
if (cg.iWeaponCommandSend > 2) {
File diff suppressed because it is too large. Load diff
+344 -359
View File
@@ -37,48 +37,42 @@ FUNCTIONS CALLED EACH FRAME
CG_SetEntitySoundPosition
======================
*/
void CG_SetEntitySoundPosition( centity_t *cent )
{
vec3_t origin;
void CG_SetEntitySoundPosition(centity_t *cent)
{
vec3_t origin;
if ( cent->currentState.solid == SOLID_BMODEL )
{
float *v;
vec3_t vel;
if (cent->currentState.solid == SOLID_BMODEL) {
float *v;
vec3_t vel;
v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
VectorAdd( cent->lerpOrigin, v, origin );
v = cgs.inlineModelMidpoints[cent->currentState.modelindex];
VectorAdd(cent->lerpOrigin, v, origin);
vel[0] = 0.0;
vel[1] = 0.0;
vel[2] = 0.0;
vel[0] = 0.0;
vel[1] = 0.0;
vel[2] = 0.0;
cgi.S_UpdateEntity( cent->currentState.number, origin, vel, qfalse );
}
else
{
if ( cent && cg.snap && cent->currentState.parent == cg.snap->ps.clientNum )
{
vec3_t origin;
vec3_t velocity;
cgi.S_UpdateEntity(cent->currentState.number, origin, vel, qfalse);
} else {
if (cent && cg.snap && cent->currentState.parent == cg.snap->ps.clientNum) {
vec3_t origin;
vec3_t velocity;
origin[0] = 0;
origin[1] = 0;
origin[2] = 0;
origin[0] = 0;
origin[1] = 0;
origin[2] = 0;
velocity[0] = 0;
velocity[1] = 0;
velocity[2] = 0;
velocity[0] = 0;
velocity[1] = 0;
velocity[2] = 0;
cgi.S_UpdateEntity( cent->currentState.number, origin, velocity, qtrue );
}
else
{
CG_GetOrigin( cent, origin );
cgi.S_UpdateEntity( cent->currentState.number, origin, cent->currentState.pos.trDelta, qfalse );
}
}
}
cgi.S_UpdateEntity(cent->currentState.number, origin, velocity, qtrue);
} else {
CG_GetOrigin(cent, origin);
cgi.S_UpdateEntity(cent->currentState.number, origin, cent->currentState.pos.trDelta, qfalse);
}
}
}
/*
==================
@@ -87,165 +81,173 @@ CG_EntityEffects
Add continuous entity effects, like local entity emission and lighting
==================
*/
void CG_EntityEffects( centity_t *cent )
{
// initialize with the client colors
cent->color[ 0 ] = cent->client_color[ 0 ];
cent->color[ 1 ] = cent->client_color[ 1 ];
cent->color[ 2 ] = cent->client_color[ 2 ];
cent->color[ 3 ] = cent->client_color[ 3 ];
void CG_EntityEffects(centity_t *cent)
{
// initialize with the client colors
cent->color[0] = cent->client_color[0];
cent->color[1] = cent->client_color[1];
cent->color[2] = cent->client_color[2];
cent->color[3] = cent->client_color[3];
if ( cent->currentState.constantLight != 0xffffff )
{
int style;
unsigned cl;
float i, r, g, b;
if (cent->currentState.constantLight != 0xffffff) {
int style;
unsigned cl;
float i, r, g, b;
cl = cent->currentState.constantLight;
style = ( cl & 255 );
r = ( float )style / 255.0f;
g = ( float )( ( cl >> 8 ) & 255 ) / 255.0f;
b = ( float )( ( cl >> 16 ) & 255 ) / 255.0f;
i = ( ( cl >> 24 ) & 255 ) * CONSTANTLIGHT_RADIUS_SCALE;
if ( cent->currentState.renderfx & RF_LIGHTSTYLE_DLIGHT )
{
float color[ 4 ];
cl = cent->currentState.constantLight;
style = (cl & 255);
r = (float)style / 255.0f;
g = (float)((cl >> 8) & 255) / 255.0f;
b = (float)((cl >> 16) & 255) / 255.0f;
i = ((cl >> 24) & 255) * CONSTANTLIGHT_RADIUS_SCALE;
if (cent->currentState.renderfx & RF_LIGHTSTYLE_DLIGHT) {
float color[4];
CG_LightStyleColor( style, cg.time, color, qfalse );
r = color[ 0 ];
g = color[ 1 ];
b = color[ 2 ];
i *= color[ 3 ];
}
if ( i )
{
int flags;
CG_LightStyleColor(style, cg.time, color, qfalse);
r = color[0];
g = color[1];
b = color[2];
i *= color[3];
}
if (i) {
int flags;
flags = 0;
if ( cent->currentState.renderfx & RF_LENSFLARE )
{
flags |= lensflare;
flags = 0;
if (cent->currentState.renderfx & RF_LENSFLARE) {
flags |= lensflare;
} else if (cent->currentState.renderfx & RF_VIEWLENSFLARE) {
flags |= viewlensflare;
}
else if ( cent->currentState.renderfx & RF_VIEWLENSFLARE )
{
flags |= viewlensflare;
if (cent->currentState.renderfx & RF_ADDITIVE_DLIGHT) {
flags |= additive;
}
if ( cent->currentState.renderfx & RF_ADDITIVE_DLIGHT )
{
flags |= additive;
}
cgi.R_AddLightToScene( cent->lerpOrigin, i, r, g, b, flags );
}
if ( r < cent->color[ 0 ] )
cent->color[ 0 ] = r;
if ( g < cent->color[ 1 ] )
cent->color[ 1 ] = g;
if ( b < cent->color[ 2 ] )
cent->color[ 2 ] = b;
}
}
cgi.R_AddLightToScene(cent->lerpOrigin, i, r, g, b, flags);
}
if (r < cent->color[0]) {
cent->color[0] = r;
}
if (g < cent->color[1]) {
cent->color[1] = g;
}
if (b < cent->color[2]) {
cent->color[2] = b;
}
}
}
/*
==================
CG_General
==================
*/
void CG_General( centity_t *cent ) {
refEntity_t ent;
entityState_t *s1;
int i;
vec3_t vMins, vMaxs, vTmp;
void CG_General(centity_t *cent)
{
refEntity_t ent;
entityState_t *s1;
int i;
vec3_t vMins, vMaxs, vTmp;
s1 = &cent->currentState;
s1 = &cent->currentState;
// add loop sound
if ( s1->loopSound )
{
cgi.S_AddLoopingSound( cent->lerpOrigin, vec3_origin, cgs.sound_precache[s1->loopSound], s1->loopSoundVolume, s1->loopSoundMinDist, s1->loopSoundMaxDist, s1->loopSoundPitch, s1->loopSoundFlags );
}
if ( cent->tikiLoopSound )
cgi.S_AddLoopingSound( cent->lerpOrigin, vec3_origin, cent->tikiLoopSound, cent->tikiLoopSoundVolume, cent->tikiLoopSoundMinDist, cent->tikiLoopSoundMaxDist, cent->tikiLoopSoundPitch, cent->tikiLoopSoundFlags );
// add loop sound
if (s1->loopSound) {
cgi.S_AddLoopingSound(
cent->lerpOrigin,
vec3_origin,
cgs.sound_precache[s1->loopSound],
s1->loopSoundVolume,
s1->loopSoundMinDist,
s1->loopSoundMaxDist,
s1->loopSoundPitch,
s1->loopSoundFlags
);
}
if (cent->tikiLoopSound) {
cgi.S_AddLoopingSound(
cent->lerpOrigin,
vec3_origin,
cent->tikiLoopSound,
cent->tikiLoopSoundVolume,
cent->tikiLoopSoundMinDist,
cent->tikiLoopSoundMaxDist,
cent->tikiLoopSoundPitch,
cent->tikiLoopSoundFlags
);
}
// if set to invisible, skip
if (!s1->modelindex) {
return;
}
if (s1->renderfx & RF_SKYORIGIN) {
AnglesToAxis(cent->lerpAngles, cg.sky_axis);
VectorCopy(cent->lerpOrigin, cg.sky_origin);
}
memset (&ent, 0, sizeof(ent));
// if set to invisible, skip
if (!s1->modelindex) {
return;
}
// set frame
if (s1->renderfx & RF_DONTDRAW) {
return;
}
ent.wasframe = s1->wasframe;
memset(&ent, 0, sizeof(ent));
VectorCopy( cent->lerpOrigin, ent.origin);
VectorCopy( cent->lerpOrigin, ent.oldorigin);
// set frame
// set skin
IntegerToBoundingBox(s1->solid, vMins, vMaxs);
VectorSubtract(vMins, vMaxs, vTmp);
ent.lightingOrigin[0] = ent.origin[0] + (vMins[0] + vMaxs[0]) * 0.5;
ent.lightingOrigin[1] = ent.origin[1] + (vMins[1] + vMaxs[1]) * 0.5;
ent.lightingOrigin[2] = ent.origin[2] + (vMins[2] + vMaxs[2]) * 0.5;
ent.radius = VectorLength(vTmp) * 0.5;
ent.wasframe = s1->wasframe;
ent.skinNum = s1->skinNum;
VectorCopy(cent->lerpOrigin, ent.origin);
VectorCopy(cent->lerpOrigin, ent.oldorigin);
ent.hModel = cgs.model_draw[s1->modelindex];
// set skin
IntegerToBoundingBox(s1->solid, vMins, vMaxs);
VectorMA(ent.origin, 0.5f, ent.lightingOrigin, ent.lightingOrigin);
VectorSubtract(vMins, vMaxs, vTmp);
ent.radius = VectorLength(vTmp) * 0.5;
// set surfaces
memcpy( ent.surfaces, s1->surfaces, MAX_MODEL_SURFACES );
ent.skinNum = s1->skinNum;
// Modulation based off the color
for( i=0; i<3; i++ )
ent.shaderRGBA[ i ] = cent->color[ i ] * 255;
ent.hModel = cgs.model_draw[s1->modelindex];
// take the alpha from the entity if less than 1, else grab it from the client commands version
if ( s1->alpha < 1 )
{
ent.shaderRGBA[ 3 ] = s1->alpha * 255;
}
else
{
ent.shaderRGBA[ 3 ] = cent->color[ 3 ] * 255;
}
// set surfaces
memcpy(ent.surfaces, s1->surfaces, MAX_MODEL_SURFACES);
// convert angles to axis
AnglesToAxis( cent->lerpAngles, ent.axis );
// Modulation based off the color
for (i = 0; i < 3; i++) {
ent.shaderRGBA[i] = cent->color[i] * 255;
}
// Interpolated state variables
if ( cent->interpolate )
{
ent.scale = s1->scale + cg.frameInterpolation * ( cent->nextState.scale - cent->currentState.scale );
}
else
{
ent.scale = s1->scale;
}
// set the entity number
ent.entityNumber = s1->number;
// take the alpha from the entity if less than 1, else grab it from the client commands version
if (s1->alpha < 1) {
ent.shaderRGBA[3] = s1->alpha * 255;
} else {
ent.shaderRGBA[3] = cent->color[3] * 255;
}
// copy shader specific data
ent.shader_data[ 0 ] = s1->tag_num;
ent.shader_data[ 1 ] = s1->skinNum;
ent.renderfx |= s1->renderfx;
// convert angles to axis
AnglesToAxis(cent->lerpAngles, ent.axis);
if ( ent.renderfx & RF_SKYORIGIN )
{
memcpy( cg.sky_axis, ent.axis, sizeof( cg.sky_axis ) );
VectorCopy( ent.origin, cg.sky_origin );
}
// Interpolated state variables
if (cent->interpolate) {
ent.scale = s1->scale + cg.frameInterpolation * (cent->nextState.scale - cent->currentState.scale);
} else {
ent.scale = s1->scale;
}
// set the entity number
ent.entityNumber = s1->number;
ent.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]);
ent.frameInfo[0].index = s1->frameInfo[0].index;
ent.frameInfo[0].time = s1->frameInfo[0].time;
ent.frameInfo[0].weight = s1->frameInfo[0].weight;
ent.actionWeight = 1.0;
// copy shader specific data
ent.shader_data[0] = s1->tag_num;
ent.shader_data[1] = s1->skinNum;
ent.renderfx |= s1->renderfx;
// add to refresh list
cgi.R_AddRefEntityToScene (&ent, ENTITYNUM_NONE);
ent.tiki = cgi.R_Model_GetHandle(cgs.model_draw[s1->modelindex]);
ent.frameInfo[0] = s1->frameInfo[0];
ent.actionWeight = 1.0;
if (ent.tiki)
{
// add to refresh list
cgi.R_AddRefEntityToScene(&ent, ENTITYNUM_NONE);
if (ent.tiki) {
// update any emitter's...
CG_UpdateEntityEmitters(s1->number, &ent, cent);
}
@@ -258,58 +260,57 @@ CG_Speaker
Speaker entities can automatically play sounds
==================
*/
void CG_Speaker( centity_t *cent )
{
if ( ! cent->currentState.clientNum ) // FIXME: use something other than clientNum...
{
return; // not auto triggering
}
void CG_Speaker(centity_t *cent)
{
if (!cent->currentState.clientNum) // FIXME: use something other than clientNum...
{
return; // not auto triggering
}
if ( cg.time < cent->miscTime )
{
return;
}
// FIXME
//cgi.S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.sound_precache[cent->currentState.eventParm] );
if (cg.time < cent->miscTime) {
return;
}
// ent->s.frame = ent->wait * 10;
// ent->s.clientNum = ent->random * 10;
cent->miscTime = cg.time + cent->currentState.wasframe * 100 + cent->currentState.clientNum * 100 * crandom();
}
// FIXME
//cgi.S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.sound_precache[cent->currentState.eventParm] );
// ent->s.frame = ent->wait * 10;
// ent->s.clientNum = ent->random * 10;
cent->miscTime = cg.time + cent->currentState.wasframe * 100 + cent->currentState.clientNum * 100 * crandom();
}
/*
===============
CG_Mover
===============
*/
void CG_Mover( centity_t *cent ) {
refEntity_t ent;
entityState_t *s1;
void CG_Mover(centity_t *cent)
{
refEntity_t ent;
entityState_t *s1;
s1 = &cent->currentState;
s1 = &cent->currentState;
// create the render entity
memset (&ent, 0, sizeof(ent));
VectorCopy( cent->lerpOrigin, ent.origin);
VectorCopy( cent->lerpOrigin, ent.oldorigin);
AnglesToAxis( cent->lerpAngles, ent.axis );
// create the render entity
memset(&ent, 0, sizeof(ent));
VectorCopy(cent->lerpOrigin, ent.origin);
VectorCopy(cent->lerpOrigin, ent.oldorigin);
AnglesToAxis(cent->lerpAngles, ent.axis);
ent.renderfx &= ~RF_SHADOW;
ent.renderfx &= ~RF_SHADOW;
// flicker between two skins (FIXME?)
ent.skinNum = ( cg.time >> 6 ) & 1;
// flicker between two skins (FIXME?)
ent.skinNum = (cg.time >> 6) & 1;
// get the model, either as a bmodel or a modelindex
if ( s1->solid == SOLID_BMODEL ) {
ent.hModel = cgs.inlineDrawModel[s1->modelindex];
} else {
ent.hModel = cgs.model_draw[s1->modelindex];
}
// get the model, either as a bmodel or a modelindex
if (s1->solid == SOLID_BMODEL) {
ent.hModel = cgs.inlineDrawModel[s1->modelindex];
} else {
ent.hModel = cgs.model_draw[s1->modelindex];
}
// add to refresh list
cgi.R_AddRefEntityToScene(&ent, ENTITYNUM_NONE);
// add to refresh list
cgi.R_AddRefEntityToScene(&ent, ENTITYNUM_NONE);
}
/*
@@ -317,120 +318,117 @@ void CG_Mover( centity_t *cent ) {
CG_Beam
===============
*/
void CG_Beam( centity_t *cent ) {
entityState_t *s1;
vec3_t vz={0,0,0},origin={0,0,0};
float modulate[4];
int i;
void CG_Beam(centity_t *cent)
{
entityState_t *s1;
vec3_t vz = {0, 0, 0}, origin = {0, 0, 0};
float modulate[4];
int i;
s1 = &cent->currentState;
s1 = &cent->currentState;
for ( i=0;i<4;i++ )
modulate[i] = cent->color[i];
for (i = 0; i < 4; i++) {
modulate[i] = cent->color[i];
}
if ( s1->beam_entnum != ENTITYNUM_NONE )
{
refEntity_t *parent;
parent = cgi.R_GetRenderEntity( s1->beam_entnum);
if (s1->beam_entnum != ENTITYNUM_NONE) {
refEntity_t *parent;
parent = cgi.R_GetRenderEntity(s1->beam_entnum);
if ( !parent )
{
cgi.DPrintf( "CG_Beam: Could not find parent entity\n" );
return;
}
if (!parent) {
cgi.DPrintf("CG_Beam: Could not find parent entity\n");
return;
}
VectorAdd( s1->origin, parent->origin, origin );
}
else
{
VectorCopy( s1->origin, origin );
}
VectorAdd(s1->origin, parent->origin, origin);
} else {
VectorCopy(s1->origin, origin);
}
CG_CreateBeam( origin, // start
vz, // dir ( auto calculated by using origin2-origin )
s1->number, // owner number
cgs.model_draw[s1->modelindex], //hModel
s1->alpha, // alpha
s1->scale, // scale
s1->skinNum, // flags
0, // length ( auto calculated )
PKT_TO_BEAM_PARM( s1->surfaces[0] ) * 1000, // life
qfalse, // don't always create the beam, just update it
s1->origin2, // endpoint
s1->bone_angles[0][0], // min offset
s1->bone_angles[0][1], // max offset
PKT_TO_BEAM_PARM( s1->surfaces[3] ), // overlap
s1->surfaces[4], // subdivisions
PKT_TO_BEAM_PARM( s1->surfaces[5] ) * 1000, // delay
CG_ConfigString( CS_IMAGES + s1->tag_num ), // index for shader configstring
modulate, // modulate color
s1->surfaces[6], // num sphere beams
PKT_TO_BEAM_PARM( s1->surfaces[7] ), // sphere radius
PKT_TO_BEAM_PARM( s1->surfaces[8] ), // toggle delay
PKT_TO_BEAM_PARM( s1->surfaces[9] ), // end alpha
s1->renderfx,
""
);
CG_CreateBeam(
origin, // start
vz, // dir ( auto calculated by using origin2-origin )
s1->number, // owner number
cgs.model_draw[s1->modelindex], //hModel
s1->alpha, // alpha
s1->scale, // scale
s1->skinNum, // flags
0, // length ( auto calculated )
PKT_TO_BEAM_PARM(s1->surfaces[0]) * 1000, // life
qfalse, // don't always create the beam, just update it
s1->origin2, // endpoint
s1->bone_angles[0][0], // min offset
s1->bone_angles[0][1], // max offset
PKT_TO_BEAM_PARM(s1->surfaces[3]), // overlap
s1->surfaces[4], // subdivisions
PKT_TO_BEAM_PARM(s1->surfaces[5]) * 1000, // delay
CG_ConfigString(CS_IMAGES + s1->tag_num), // index for shader configstring
modulate, // modulate color
s1->surfaces[6], // num sphere beams
PKT_TO_BEAM_PARM(s1->surfaces[7]), // sphere radius
PKT_TO_BEAM_PARM(s1->surfaces[8]), // toggle delay
PKT_TO_BEAM_PARM(s1->surfaces[9]), // end alpha
s1->renderfx,
""
);
}
void CG_Decal(centity_t *cent)
void CG_Decal
(
centity_t *cent
)
{
qhandle_t shader;
vec3_t dir;
entityState_t *s1;
{
qhandle_t shader;
vec3_t dir;
entityState_t *s1;
s1 = &cent->currentState;
s1 = &cent->currentState;
shader = cgi.R_RegisterShader( CG_ConfigString( CS_IMAGES + s1->tag_num ) );
ByteToDir( s1->surfaces[0], dir );
CG_ImpactMark( shader,
s1->origin,
dir,
s1->angles[2],
cent->color[0],
cent->color[1],
cent->color[2],
cent->color[3],
qtrue,
s1->scale,
qfalse,
-1,
qfalse,
0.f,
0.f);
}
shader = cgi.R_RegisterShader(CG_ConfigString(CS_IMAGES + s1->tag_num));
ByteToDir(s1->surfaces[0], dir);
CG_ImpactMark(
shader,
s1->origin,
dir,
s1->angles[2],
s1->scale,
s1->scale,
cent->color[0],
cent->color[1],
cent->color[2],
cent->color[3],
qtrue,
qfalse,
qtrue,
qfalse,
0.5f,
0.5f
);
}
/*
===============
CG_Portal
===============
*/
void CG_Portal(centity_t* cent)
{
}
void CG_Portal(centity_t *cent) {}
/*
================
BG_EvaluateTrajectory
================
*/
void BG_EvaluateTrajectory(const trajectory_t* tr, int atTime, const vec3_t base, vec3_t result) {
float deltaTime;
void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, const vec3_t base, vec3_t result)
{
float deltaTime;
if (atTime > cg_smoothClientsTime->integer + tr->trTime) {
atTime = cg_smoothClientsTime->integer + tr->trTime;
}
if (atTime > cg_smoothClientsTime->integer + tr->trTime) {
atTime = cg_smoothClientsTime->integer + tr->trTime;
}
deltaTime = (float)(atTime - tr->trTime) / 1000.0;
deltaTime = (float)(atTime - tr->trTime) / 1000.0;
result[0] = tr->trDelta[0] * deltaTime + base[0];
result[1] = tr->trDelta[1] * deltaTime + base[1];
result[2] = tr->trDelta[2] * deltaTime + base[2];
result[0] = tr->trDelta[0] * deltaTime + base[0];
result[1] = tr->trDelta[1] * deltaTime + base[1];
result[2] = tr->trDelta[2] * deltaTime + base[2];
}
/*
@@ -439,17 +437,15 @@ CG_CalcEntityLerpPositions
===============
*/
void CG_CalcEntityLerpPositions( centity_t *cent )
void CG_CalcEntityLerpPositions(centity_t *cent)
{
int i;
float f;
float f;
f = cg.frameInterpolation;
if (cent->currentState.eType == ET_PLAYER)
{
if (cent->currentState.number == cg.snap->ps.clientNum)
{
if (cent->currentState.eType == ET_PLAYER) {
if (cent->currentState.number == cg.snap->ps.clientNum) {
// if the player, take position from prediction
VectorCopy(cg.predicted_player_state.origin, cent->lerpOrigin);
for (i = 0; i < 3; i++) {
@@ -471,28 +467,26 @@ void CG_CalcEntityLerpPositions( centity_t *cent )
}
for (i = 0; i < 3; i++) {
cent->lerpOrigin[i] = cent->currentState.origin[i] +
f * (cent->nextState.origin[i] - cent->currentState.origin[i]);
cent->lerpOrigin[i] =
cent->currentState.origin[i] + f * (cent->nextState.origin[i] - cent->currentState.origin[i]);
}
if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) {
VectorCopy(cent->currentState.angles, cent->lerpAngles);
}
else {
} else {
// use spherical interpolation using quaternions so that bound objects
// rotate properly without gimble lock.
SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat);
QuatToMat(quat, mat);
MatrixToEulerAngles(mat, cent->lerpAngles);
}
}
else if (cent->interpolate) {
} else if (cent->interpolate) {
float quat[4];
float mat[3][3];
// if the entity has a valid next state, interpolate a value between the frames
// unless it is a mover with a known start and stop
vec3_t current, next;
vec3_t current, next;
// this will linearize a sine or parabolic curve, but it is important
// to not extrapolate player positions if more recent data is available
@@ -505,16 +499,14 @@ void CG_CalcEntityLerpPositions( centity_t *cent )
if (!memcmp(cent->currentState.angles, cent->nextState.angles, sizeof(vec3_t))) {
VectorCopy(cent->currentState.angles, cent->lerpAngles);
}
else {
} else {
// use spherical interpolation using quaternions so that bound objects
// rotate properly without gimble lock.
SlerpQuaternion(cent->currentState.quat, cent->nextState.quat, f, quat);
QuatToMat(quat, mat);
MatrixToEulerAngles(mat, cent->lerpAngles);
}
}
else {
} else {
// just use the current frame and evaluate as best we can
BG_EvaluateTrajectory(&cent->currentState.pos, cg.time, cent->currentState.origin, cent->lerpOrigin);
VectorCopy(cent->currentState.angles, cent->lerpAngles);
@@ -527,7 +519,7 @@ CG_AddCEntity
===============
*/
void CG_AddCEntity(centity_t* cent)
void CG_AddCEntity(centity_t *cent)
{
// event-only entities will have been dealt with already
if (cent->currentState.eType >= ET_EVENTS) {
@@ -558,10 +550,10 @@ void CG_AddCEntity(centity_t* cent)
CG_ModelAnim(cent, qtrue);
break;
case ET_PLAYER:
CG_Player(cent);
CG_Splash(cent);
case ET_ITEM:
CG_ModelAnim(cent, qfalse);
CG_Player(cent);
CG_Splash(cent);
case ET_ITEM:
CG_ModelAnim(cent, qfalse);
break;
case ET_GENERAL:
CG_General(cent);
@@ -588,10 +580,10 @@ void CG_AddCEntity(centity_t* cent)
break;
case ET_ROPE: // skip
CG_Rope(cent);
break;
case ET_EXEC_COMMANDS:
CG_ModelAnim(cent, qfalse);
break;
break;
case ET_EXEC_COMMANDS:
CG_ModelAnim(cent, qfalse);
break;
}
}
@@ -601,29 +593,30 @@ CG_AddPacketEntities
===============
*/
void CG_AddPacketEntities( void ) {
int num;
centity_t *cent;
int child, parent;
qboolean processed[MAX_ENTITIES];
int i;
void CG_AddPacketEntities(void)
{
int num;
centity_t *cent;
int child, parent;
qboolean processed[MAX_ENTITIES];
int i;
// the auto-rotating items will all have the same axis
cg.autoAngles[0] = 0;
cg.autoAngles[1] = ( cg.time & 2047 ) * 360 / 2048.0;
cg.autoAngles[2] = 0;
// the auto-rotating items will all have the same axis
cg.autoAngles[0] = 0;
cg.autoAngles[1] = (cg.time & 2047) * 360 / 2048.0;
cg.autoAngles[2] = 0;
cg.autoAnglesSlow[0] = 0;
cg.autoAnglesSlow[1] = ( cg.time & 4095 ) * 360 / 4096.0f;
cg.autoAnglesSlow[2] = 0;
cg.autoAnglesSlow[0] = 0;
cg.autoAnglesSlow[1] = (cg.time & 4095) * 360 / 4096.0f;
cg.autoAnglesSlow[2] = 0;
cg.autoAnglesFast[0] = 0;
cg.autoAnglesFast[1] = ( cg.time & 1023 ) * 360 / 1024.0f;
cg.autoAnglesFast[2] = 0;
cg.autoAnglesFast[0] = 0;
cg.autoAnglesFast[1] = (cg.time & 1023) * 360 / 1024.0f;
cg.autoAnglesFast[2] = 0;
AnglesToAxis( cg.autoAngles, cg.autoAxis );
AnglesToAxis( cg.autoAnglesSlow, cg.autoAxisSlow );
AnglesToAxis( cg.autoAnglesFast, cg.autoAxisFast );
AnglesToAxis(cg.autoAngles, cg.autoAxis);
AnglesToAxis(cg.autoAnglesSlow, cg.autoAxisSlow);
AnglesToAxis(cg.autoAnglesFast, cg.autoAxisFast);
for (i = 0; i < MAX_ENTITIES; i++) {
processed[i] = qtrue;
@@ -636,50 +629,43 @@ void CG_AddPacketEntities( void ) {
// add each entity sent over by the server
for (num = 0; num < cg.snap->numEntities; num++) {
child = cg.snap->entities[num].number;
cent = &cg_entities[child];
cent = &cg_entities[child];
// add the parent first
// so attachments are consistent
for (parent = cent->currentState.parent;
parent != ENTITYNUM_NONE && !processed[parent];
parent = cg_entities[parent].currentState.parent)
{
for (parent = cent->currentState.parent; parent != ENTITYNUM_NONE && !processed[parent];
parent = cg_entities[parent].currentState.parent) {
processed[parent] = qtrue;
CG_AddCEntity(&cg_entities[parent]);
}
if (!processed[child])
{
if (!processed[child]) {
// now add the children if not processed
processed[child] = qtrue;
CG_AddCEntity(cent);
}
}
// Add in the multibeams at the end
for ( num = 0 ; num < cg.snap->numEntities ; num++ ) {
cent = &cg_entities[ cg.snap->entities[ num ].number ];
if ( cent->currentState.eType == ET_MULTIBEAM )
CG_MultiBeam( cent );
}
// Add in the multibeams at the end
for (num = 0; num < cg.snap->numEntities; num++) {
cent = &cg_entities[cg.snap->entities[num].number];
if (cent->currentState.eType == ET_MULTIBEAM) {
CG_MultiBeam(cent);
}
}
}
void CG_GetOrigin(centity_t* cent, vec3_t origin)
void CG_GetOrigin(centity_t *cent, vec3_t origin)
{
if (cent->currentState.parent == ENTITYNUM_NONE)
{
if (cent->currentState.parent == ENTITYNUM_NONE) {
VectorCopy(cent->lerpOrigin, origin);
}
else
{
} else {
int i;
orientation_t or;
refEntity_t* parent;
orientation_t or ;
refEntity_t *parent;
parent = cgi.R_GetRenderEntity(cent->currentState.parent);
if (!parent)
{
if (!parent) {
cgi.DPrintf("CG_GetOrigin: Could not find parent entity\n");
return;
}
@@ -689,9 +675,8 @@ void CG_GetOrigin(centity_t* cent, vec3_t origin)
VectorCopy(parent->origin, origin);
for (i = 0; i < 3; i++)
{
VectorMA(origin, or .origin[i], parent->axis[i], origin);
for (i = 0; i < 3; i++) {
VectorMA(origin, or.origin[i], parent->axis[i], origin);
}
}
}
+1 -4
View File
@@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
/*
==============
CG_EntityEvent
@@ -34,6 +33,4 @@ An entity has an event value
==============
*/
void CG_EntityEvent( centity_t *cent, vec3_t position )
{
}
void CG_EntityEvent(centity_t *cent, vec3_t position) {}
File diff suppressed because it is too large. Load diff
+782 -749
View File
File diff suppressed because it is too large. Load diff
+373 -397
View File
@@ -27,81 +27,83 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_parsemsg.h"
#ifdef _WIN32
#include <windows.h>
# include <windows.h>
#endif
clientGameImport_t cgi;
clientGameImport_t cgi;
static clientGameExport_t cge;
cvar_t* paused;
cvar_t* developer;
cg_t cg;
cgs_t cgs;
centity_t cg_entities[MAX_GENTITIES];
cvar_t *paused;
cvar_t *developer;
cg_t cg;
cgs_t cgs;
int cg_protocol;
centity_t cg_entities[MAX_GENTITIES];
cvar_t* cg_animSpeed;
cvar_t* cg_debugAnim;
cvar_t* cg_debugAnimWatch;
cvar_t* cg_errorDecay;
cvar_t* cg_nopredict;
cvar_t* cg_showmiss;
cvar_t* cg_addMarks;
cvar_t* cg_maxMarks;
cvar_t* cg_viewsize;
cvar_t* cg_3rd_person;
cvar_t* cg_drawviewmodel;
cvar_t* cg_synchronousClients;
cvar_t* cg_stereoSeparation;
cvar_t* cg_stats;
cvar_t* cg_lagometer;
cvar_t* r_lerpmodels;
cvar_t* cg_cameraheight;
cvar_t* cg_cameradist;
cvar_t* cg_cameraverticaldisplacement;
cvar_t* cg_camerascale;
cvar_t* cg_shadows;
cvar_t* cg_hidetempmodels;
cvar_t* cg_traceinfo;
cvar_t* cg_debugFootsteps;
cvar_t* cg_smoothClients;
cvar_t* cg_smoothClientsTime;
cvar_t* pmove_fixed;
cvar_t* pmove_msec;
cvar_t* cg_pmove_msec;
cvar_t* dm_playermodel;
cvar_t* dm_playergermanmodel;
cvar_t* cg_forceModel;
cvar_t* cg_animationviewmodel;
cvar_t* cg_hitmessages;
cvar_t* cg_acidtrip;
cvar_t* cg_hud;
cvar_t* cg_huddraw_force;
cvar_t* cg_drawsvlag;
cvar_t* vm_offset_max;
cvar_t* vm_offset_speed;
cvar_t* vm_sway_front;
cvar_t* vm_sway_side;
cvar_t* vm_sway_up;
cvar_t* vm_offset_air_front;
cvar_t* vm_offset_air_side;
cvar_t* vm_offset_air_up;
cvar_t* vm_offset_crouch_front;
cvar_t* vm_offset_crouch_side;
cvar_t* vm_offset_crouch_up;
cvar_t* vm_offset_rocketcrouch_front;
cvar_t* vm_offset_rocketcrouch_side;
cvar_t* vm_offset_rocketcrouch_up;
cvar_t* vm_offset_shotguncrouch_front;
cvar_t* vm_offset_shotguncrouch_side;
cvar_t* vm_offset_shotguncrouch_up;
cvar_t* vm_offset_vel_base;
cvar_t* vm_offset_vel_front;
cvar_t* vm_offset_vel_side;
cvar_t* vm_offset_vel_up;
cvar_t* vm_offset_upvel;
cvar_t* vm_lean_lower;
cvar_t* voiceChat;
cvar_t* cg_shadowscount;
cvar_t* cg_shadowdebug;
cvar_t *cg_animSpeed;
cvar_t *cg_debugAnim;
cvar_t *cg_debugAnimWatch;
cvar_t *cg_errorDecay;
cvar_t *cg_nopredict;
cvar_t *cg_showmiss;
cvar_t *cg_addMarks;
cvar_t *cg_maxMarks;
cvar_t *cg_viewsize;
cvar_t *cg_3rd_person;
cvar_t *cg_drawviewmodel;
cvar_t *cg_synchronousClients;
cvar_t *cg_stereoSeparation;
cvar_t *cg_stats;
cvar_t *cg_lagometer;
cvar_t *r_lerpmodels;
cvar_t *cg_cameraheight;
cvar_t *cg_cameradist;
cvar_t *cg_cameraverticaldisplacement;
cvar_t *cg_camerascale;
cvar_t *cg_shadows;
cvar_t *cg_hidetempmodels;
cvar_t *cg_traceinfo;
cvar_t *cg_debugFootsteps;
cvar_t *cg_smoothClients;
cvar_t *cg_smoothClientsTime;
cvar_t *pmove_fixed;
cvar_t *pmove_msec;
cvar_t *cg_pmove_msec;
cvar_t *dm_playermodel;
cvar_t *dm_playergermanmodel;
cvar_t *cg_forceModel;
cvar_t *cg_animationviewmodel;
cvar_t *cg_hitmessages;
cvar_t *cg_acidtrip;
cvar_t *cg_hud;
cvar_t *cg_huddraw_force;
cvar_t *cg_drawsvlag;
cvar_t *vm_offset_max;
cvar_t *vm_offset_speed;
cvar_t *vm_sway_front;
cvar_t *vm_sway_side;
cvar_t *vm_sway_up;
cvar_t *vm_offset_air_front;
cvar_t *vm_offset_air_side;
cvar_t *vm_offset_air_up;
cvar_t *vm_offset_crouch_front;
cvar_t *vm_offset_crouch_side;
cvar_t *vm_offset_crouch_up;
cvar_t *vm_offset_rocketcrouch_front;
cvar_t *vm_offset_rocketcrouch_side;
cvar_t *vm_offset_rocketcrouch_up;
cvar_t *vm_offset_shotguncrouch_front;
cvar_t *vm_offset_shotguncrouch_side;
cvar_t *vm_offset_shotguncrouch_up;
cvar_t *vm_offset_vel_base;
cvar_t *vm_offset_vel_front;
cvar_t *vm_offset_vel_side;
cvar_t *vm_offset_vel_up;
cvar_t *vm_offset_upvel;
cvar_t *vm_lean_lower;
cvar_t *voiceChat;
cvar_t *cg_shadowscount;
cvar_t *cg_shadowdebug;
/*
=================
@@ -110,78 +112,78 @@ CG_RegisterCvars
*/
void CG_RegisterCvars(void)
{
cvar_t* temp;
cvar_t *temp;
cgi.Cvar_Get("g_subtitle", "0", CVAR_ARCHIVE);
cg_viewsize = cgi.Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
cg_addMarks = cgi.Cvar_Get("cg_marks_add", "0", CVAR_ARCHIVE);
cg_maxMarks = cgi.Cvar_Get("cg_marks_max", "256", CVAR_ARCHIVE | CVAR_LATCH);
cg_animSpeed = cgi.Cvar_Get("cg_animspeed", "1", CVAR_CHEAT);
cg_debugAnim = cgi.Cvar_Get("cg_debuganim", "0", CVAR_CHEAT);
cg_debugAnimWatch = cgi.Cvar_Get("cg_debuganimwatch", "0", CVAR_CHEAT);
cg_errorDecay = cgi.Cvar_Get("cg_errordecay", "100", 0);
cg_nopredict = cgi.Cvar_Get("cg_nopredict", "0", 0);
cg_showmiss = cgi.Cvar_Get("cg_showmiss", "0", 0);
cg_stats = cgi.Cvar_Get("cg_stats", "0", 0);
cg_hidetempmodels = cgi.Cvar_Get("cg_hidetempmodels", "0", 0);
cg_synchronousClients = cgi.Cvar_Get("g_synchronousClients", "0", 0);
cg_stereoSeparation = cgi.Cvar_Get("cg_stereosep", "0.4", CVAR_ARCHIVE);
cg_lagometer = cgi.Cvar_Get("cg_lagometer", "0", 0);
paused = cgi.Cvar_Get("paused", "0", 0);
r_lerpmodels = cgi.Cvar_Get("r_lerpmodels", "1", 0);
cg_3rd_person = cgi.Cvar_Get("cg_3rd_person", "0", CVAR_CHEAT);
cg_drawviewmodel = cgi.Cvar_Get("cg_drawviewmodel", "2", CVAR_ARCHIVE);
cg_cameraheight = cgi.Cvar_Get("cg_cameraheight", "18", CVAR_ARCHIVE);
cg_cameradist = cgi.Cvar_Get("cg_cameradist", "120", CVAR_ARCHIVE);
cg_viewsize = cgi.Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
cg_addMarks = cgi.Cvar_Get("cg_marks_add", "0", CVAR_ARCHIVE);
cg_maxMarks = cgi.Cvar_Get("cg_marks_max", "256", CVAR_ARCHIVE | CVAR_LATCH);
cg_animSpeed = cgi.Cvar_Get("cg_animspeed", "1", CVAR_CHEAT);
cg_debugAnim = cgi.Cvar_Get("cg_debuganim", "0", CVAR_CHEAT);
cg_debugAnimWatch = cgi.Cvar_Get("cg_debuganimwatch", "0", CVAR_CHEAT);
cg_errorDecay = cgi.Cvar_Get("cg_errordecay", "100", 0);
cg_nopredict = cgi.Cvar_Get("cg_nopredict", "0", 0);
cg_showmiss = cgi.Cvar_Get("cg_showmiss", "0", 0);
cg_stats = cgi.Cvar_Get("cg_stats", "0", 0);
cg_hidetempmodels = cgi.Cvar_Get("cg_hidetempmodels", "0", 0);
cg_synchronousClients = cgi.Cvar_Get("g_synchronousClients", "0", 0);
cg_stereoSeparation = cgi.Cvar_Get("cg_stereosep", "0.4", CVAR_ARCHIVE);
cg_lagometer = cgi.Cvar_Get("cg_lagometer", "0", 0);
paused = cgi.Cvar_Get("paused", "0", 0);
r_lerpmodels = cgi.Cvar_Get("r_lerpmodels", "1", 0);
cg_3rd_person = cgi.Cvar_Get("cg_3rd_person", "0", CVAR_CHEAT);
cg_drawviewmodel = cgi.Cvar_Get("cg_drawviewmodel", "2", CVAR_ARCHIVE);
cg_cameraheight = cgi.Cvar_Get("cg_cameraheight", "18", CVAR_ARCHIVE);
cg_cameradist = cgi.Cvar_Get("cg_cameradist", "120", CVAR_ARCHIVE);
cg_cameraverticaldisplacement = cgi.Cvar_Get("cg_cameraverticaldisplacement", "-2", CVAR_ARCHIVE);
cg_camerascale = cgi.Cvar_Get("cg_camerascale", "0.3", CVAR_ARCHIVE);
cg_traceinfo = cgi.Cvar_Get("cg_traceinfo", "0", CVAR_ARCHIVE);
cg_debugFootsteps = cgi.Cvar_Get("cg_debugfootsteps", "0", CVAR_CHEAT);
cg_smoothClients = cgi.Cvar_Get("cg_smoothClients", "1", CVAR_ARCHIVE);
cg_smoothClientsTime = cgi.Cvar_Get("cg_smoothClientsTime", "100", CVAR_ARCHIVE);
pmove_fixed = cgi.Cvar_Get("pmove_fixed", "0", 0);
pmove_msec = cgi.Cvar_Get("pmove_msec", "8", 0);
cg_pmove_msec = cgi.Cvar_Get("cg_pmove_msec", "8", 0);
cg_shadows = cgi.Cvar_Get("cg_shadows", "0", CVAR_ARCHIVE);
cg_shadowscount = cgi.Cvar_Get("cg_shadowscount", "8", 0);
cg_shadowdebug = cgi.Cvar_Get("cg_shadowdebug", "0", 0);
developer = cgi.Cvar_Get("developer", "0", 0);
dm_playermodel = cgi.Cvar_Get("dm_playermodel", "american_army", 3);
dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", 3);
cg_forceModel = cgi.Cvar_Get("cg_forceModel", "0", CVAR_ARCHIVE);
cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", 8);
cg_hitmessages = cgi.Cvar_Get("cg_hitmessages", "1", CVAR_ARCHIVE);
cg_acidtrip = cgi.Cvar_Get("cg_acidtrip", "0", CVAR_CHEAT);
cg_hud = cgi.Cvar_Get("cg_hud", "0", 0);
cg_huddraw_force = cgi.Cvar_Get("cg_huddraw_force", "0", CVAR_SAVEGAME);
cg_drawsvlag = cgi.Cvar_Get("cg_drawsvlag", "1", CVAR_ARCHIVE);
vm_offset_max = cgi.Cvar_Get("vm_offset_max", "8.0", 0);
vm_offset_speed = cgi.Cvar_Get("vm_offset_speed", "8.0", 0);
vm_sway_front = cgi.Cvar_Get("vm_sway_front", "0.1", 0);
vm_sway_side = cgi.Cvar_Get("vm_sway_side", "0.005", 0);
vm_sway_up = cgi.Cvar_Get("vm_sway_up", "0.003", 0);
vm_offset_air_front = cgi.Cvar_Get("vm_offset_air_front", "-3.0", 0);
vm_offset_air_side = cgi.Cvar_Get("vm_offset_air_side", "1.5", 0);
vm_offset_air_up = cgi.Cvar_Get("vm_offset_air_up", "-6.0", 0);
vm_offset_crouch_front = cgi.Cvar_Get("vm_offset_crouch_front", "-0.5", 0);
vm_offset_crouch_side = cgi.Cvar_Get("vm_offset_crouch_side", "2.25", 0);
vm_offset_crouch_up = cgi.Cvar_Get("vm_offset_crouch_up", "0.2", 0);
vm_offset_rocketcrouch_front = cgi.Cvar_Get("vm_offset_rocketcrouch_front", "0", 0);
vm_offset_rocketcrouch_side = cgi.Cvar_Get("vm_offset_rocketcrouch_side", "0", 0);
vm_offset_rocketcrouch_up = cgi.Cvar_Get("vm_offset_rocketcrouch_up", "0", 0);
cg_camerascale = cgi.Cvar_Get("cg_camerascale", "0.3", CVAR_ARCHIVE);
cg_traceinfo = cgi.Cvar_Get("cg_traceinfo", "0", CVAR_ARCHIVE);
cg_debugFootsteps = cgi.Cvar_Get("cg_debugfootsteps", "0", CVAR_CHEAT);
cg_smoothClients = cgi.Cvar_Get("cg_smoothClients", "1", CVAR_ARCHIVE);
cg_smoothClientsTime = cgi.Cvar_Get("cg_smoothClientsTime", "100", CVAR_ARCHIVE);
pmove_fixed = cgi.Cvar_Get("pmove_fixed", "0", 0);
pmove_msec = cgi.Cvar_Get("pmove_msec", "8", 0);
cg_pmove_msec = cgi.Cvar_Get("cg_pmove_msec", "8", 0);
cg_shadows = cgi.Cvar_Get("cg_shadows", "0", CVAR_ARCHIVE);
cg_shadowscount = cgi.Cvar_Get("cg_shadowscount", "8", 0);
cg_shadowdebug = cgi.Cvar_Get("cg_shadowdebug", "0", 0);
developer = cgi.Cvar_Get("developer", "0", 0);
dm_playermodel = cgi.Cvar_Get("dm_playermodel", "american_army", 3);
dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", 3);
cg_forceModel = cgi.Cvar_Get("cg_forceModel", "0", CVAR_ARCHIVE);
cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", 8);
cg_hitmessages = cgi.Cvar_Get("cg_hitmessages", "1", CVAR_ARCHIVE);
cg_acidtrip = cgi.Cvar_Get("cg_acidtrip", "0", CVAR_CHEAT);
cg_hud = cgi.Cvar_Get("cg_hud", "0", 0);
cg_huddraw_force = cgi.Cvar_Get("cg_huddraw_force", "0", CVAR_SAVEGAME);
cg_drawsvlag = cgi.Cvar_Get("cg_drawsvlag", "1", CVAR_ARCHIVE);
vm_offset_max = cgi.Cvar_Get("vm_offset_max", "8.0", 0);
vm_offset_speed = cgi.Cvar_Get("vm_offset_speed", "8.0", 0);
vm_sway_front = cgi.Cvar_Get("vm_sway_front", "0.1", 0);
vm_sway_side = cgi.Cvar_Get("vm_sway_side", "0.005", 0);
vm_sway_up = cgi.Cvar_Get("vm_sway_up", "0.003", 0);
vm_offset_air_front = cgi.Cvar_Get("vm_offset_air_front", "-3.0", 0);
vm_offset_air_side = cgi.Cvar_Get("vm_offset_air_side", "1.5", 0);
vm_offset_air_up = cgi.Cvar_Get("vm_offset_air_up", "-6.0", 0);
vm_offset_crouch_front = cgi.Cvar_Get("vm_offset_crouch_front", "-0.5", 0);
vm_offset_crouch_side = cgi.Cvar_Get("vm_offset_crouch_side", "2.25", 0);
vm_offset_crouch_up = cgi.Cvar_Get("vm_offset_crouch_up", "0.2", 0);
vm_offset_rocketcrouch_front = cgi.Cvar_Get("vm_offset_rocketcrouch_front", "0", 0);
vm_offset_rocketcrouch_side = cgi.Cvar_Get("vm_offset_rocketcrouch_side", "0", 0);
vm_offset_rocketcrouch_up = cgi.Cvar_Get("vm_offset_rocketcrouch_up", "0", 0);
vm_offset_shotguncrouch_front = cgi.Cvar_Get("vm_offset_shotguncrouch_front", "-1", 0);
vm_offset_shotguncrouch_side = cgi.Cvar_Get("vm_offset_shotguncrouch_side", "2.5", 0);
vm_offset_shotguncrouch_up = cgi.Cvar_Get("vm_offset_shotguncrouch_up", "-1.1", 0);
vm_offset_vel_base = cgi.Cvar_Get("vm_offset_vel_base", "100", 0);
vm_offset_vel_front = cgi.Cvar_Get("vm_offset_vel_front", "-2.0", 0);
vm_offset_vel_side = cgi.Cvar_Get("vm_offset_vel_side", "1.5", 0);
vm_offset_vel_up = cgi.Cvar_Get("vm_offset_vel_up", "-4.0", 0);
vm_offset_upvel = cgi.Cvar_Get("vm_offset_upvel", "0.0025", 0);
vm_lean_lower = cgi.Cvar_Get("vm_lean_lower", "0.1", 0);
voiceChat = cgi.Cvar_Get("cg_voicechat", "1", 0);
vm_offset_shotguncrouch_side = cgi.Cvar_Get("vm_offset_shotguncrouch_side", "2.5", 0);
vm_offset_shotguncrouch_up = cgi.Cvar_Get("vm_offset_shotguncrouch_up", "-1.1", 0);
vm_offset_vel_base = cgi.Cvar_Get("vm_offset_vel_base", "100", 0);
vm_offset_vel_front = cgi.Cvar_Get("vm_offset_vel_front", "-2.0", 0);
vm_offset_vel_side = cgi.Cvar_Get("vm_offset_vel_side", "1.5", 0);
vm_offset_vel_up = cgi.Cvar_Get("vm_offset_vel_up", "-4.0", 0);
vm_offset_upvel = cgi.Cvar_Get("vm_offset_upvel", "0.0025", 0);
vm_lean_lower = cgi.Cvar_Get("vm_lean_lower", "0.1", 0);
voiceChat = cgi.Cvar_Get("cg_voicechat", "1", 0);
// see if we are also running the server on this machine
temp = cgi.Cvar_Get("sv_running", "0", 0);
temp = cgi.Cvar_Get("sv_running", "0", 0);
cgs.localServer = temp->integer;
}
@@ -192,17 +194,18 @@ CG_RegisterSounds
called during a precache command
=================
*/
void CG_RegisterSounds( void )
void CG_RegisterSounds(void)
{
int startTime;
int endTime;
int startTime;
int endTime;
char filename[MAX_QPATH];
Com_Printf("\n\n-----------PARSING UBERSOUND------------\n");
Com_Printf(
"Any SetCurrentTiki errors means that tiki wasn't prefetched and "
"tiki-specific sounds for it won't work. To fix prefe"
"tch the tiki. Ignore if you don't use that tiki on this level.\n");
"tch the tiki. Ignore if you don't use that tiki on this level.\n"
);
Com_sprintf(filename, sizeof(filename), "ubersound/ubersound.scr");
startTime = cgi.Milliseconds();
@@ -216,7 +219,8 @@ void CG_RegisterSounds( void )
Com_Printf(
"Any SetCurrentTiki errors means that tiki wasn't prefetched and "
"tiki-specific sounds for it won't work. To fix prefe"
"tch the tiki. Ignore if you don't use that tiki on this level.\n");
"tch the tiki. Ignore if you don't use that tiki on this level.\n"
);
Com_sprintf(filename, sizeof(filename), "ubersound/uberdialog.scr");
startTime = cgi.Milliseconds();
@@ -234,157 +238,132 @@ CG_ProcessConfigString
*/
void CG_ProcessConfigString(int num)
{
const char* str = CG_ConfigString(num);
int i;
const char *str = CG_ConfigString(num);
int i;
switch (num)
{
case CS_RAIN_DENSITY:
cg.rain.density = atof(str);
return;
switch (num) {
case CS_RAIN_DENSITY:
cg.rain.density = atof(str);
return;
case CS_RAIN_SPEED:
cg.rain.speed = atof(str);
return;
return;
case CS_RAIN_SPEEDVARY:
cg.rain.speed_vary = atoi(str);
return;
return;
case CS_RAIN_SLANT:
cg.rain.slant = atoi(str);
return;
return;
case CS_RAIN_LENGTH:
cg.rain.length = atof(str);
return;
return;
case CS_RAIN_MINDIST:
cg.rain.min_dist = atof(str);
return;
return;
case CS_RAIN_WIDTH:
cg.rain.width = atof(str);
return;
case CS_RAIN_SHADER:
if (cg.rain.numshaders)
{
for (i = 0; i < cg.rain.numshaders; i++)
{
sprintf(cg.rain.shader[i], "%s%i", str, i);
}
}
else {
strcpy(cg.rain.shader[0], str);
}
return;
case CS_RAIN_NUMSHADERS:
return;
case CS_RAIN_SHADER:
if (cg.rain.numshaders) {
for (i = 0; i < cg.rain.numshaders; i++) {
sprintf(cg.rain.shader[i], "%s%i", str, i);
}
} else {
strcpy(cg.rain.shader[0], str);
}
return;
case CS_RAIN_NUMSHADERS:
cg.rain.numshaders = atoi(str);
if (cg.rain.numshaders)
{
for (i = 0; i < cg.rain.numshaders; i++)
{
if (cg.rain.numshaders) {
for (i = 0; i < cg.rain.numshaders; i++) {
sprintf(cg.rain.shader[i], "%s%i", str, i);
}
}
return;
}
return;
}
if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES)
{
cobjective_t* objective = &cg.Objectives[num - CS_OBJECTIVES];
objective->flags = atoi(Info_ValueForKey(str, "flags"));
strcpy(objective->text, Info_ValueForKey(str, "text"));
}
if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES) {
cobjective_t *objective = &cg.Objectives[num - CS_OBJECTIVES];
objective->flags = atoi(Info_ValueForKey(str, "flags"));
strcpy(objective->text, Info_ValueForKey(str, "text"));
}
switch (num)
{
switch (num) {
case CS_MUSIC:
cgi.MUSIC_NewSoundtrack(str);
return;
case CS_WARMUP:
cg.matchStartTime = atoi(str);
return;
return;
case CS_WARMUP:
cg.matchStartTime = atoi(str);
return;
case CS_FOGINFO:
CG_ParseFogInfo(str);
return;
return;
case CS_SKYINFO:
sscanf
(
str,
"%f %d",
&cg.sky_alpha,
&cg.sky_portal
);
return;
case CS_SERVERINFO:
sscanf(str, "%f %d", &cg.sky_alpha, &cg.sky_portal);
return;
case CS_SERVERINFO:
CG_ParseServerinfo();
return;
return;
case CS_LEVEL_START_TIME:
cgs.levelStartTime = atoi(str);
return;
return;
case CS_MATCHEND:
cgs.matchEndTime = atoi(str);
return;
}
return;
}
if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS)
{
if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {
qhandle_t hOldModel = cgs.model_draw[num - CS_MODELS];
if (str && str[0])
{
qhandle_t hModel = cgi.R_RegisterServerModel(str);
dtiki_t* tiki;
if (str && str[0]) {
qhandle_t hModel = cgi.R_RegisterServerModel(str);
dtiki_t *tiki;
if (hModel != hOldModel)
{
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
if (hModel != hOldModel) {
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = hModel;
}
tiki = cgi.R_Model_GetHandle(hModel);
cgs.model_draw[num - CS_MODELS] = hModel;
}
tiki = cgi.R_Model_GetHandle(hModel);
if (tiki) {
CG_ProcessCacheInitCommands(tiki);
}
} else {
// clear out the model
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = 0;
}
else
{
// clear out the model
if (hOldModel) {
cgi.R_UnregisterServerModel(hOldModel);
}
cgs.model_draw[num - CS_MODELS] = 0;
}
}
else if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS)
{
size_t len = strlen(str);
if (len)
{
qboolean streamed;
char buf[1024];
strcpy(buf, str);
} else if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS) {
size_t len = strlen(str);
if (len) {
qboolean streamed;
char buf[1024];
strcpy(buf, str);
streamed = buf[len - 1] != '0';
buf[len - 1] = 0;
streamed = buf[len - 1] != '0';
buf[len - 1] = 0;
if (buf[0] != '*') {
cgs.sound_precache[num - CS_SOUNDS] = cgi.S_RegisterSound(buf, streamed);
}
}
}
else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES)
{
CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
}
else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS)
{
const char* value;
value = Info_ValueForKey(str, "name");
if (value) {
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
}
else {
strncpy(cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name));
}
}
} else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES) {
CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
} else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS) {
const char *value;
value = Info_ValueForKey(str, "name");
if (value) {
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
} else {
strncpy(
cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name)
);
}
value = Info_ValueForKey(str, "team");
if (value) {
cg.clientinfo[num - CS_PLAYERS].team = atoi(value);
@@ -404,7 +383,7 @@ Call before entering a new level, or after changing renderers
This function may execute for a couple of minutes with a slow disk.
=================
*/
void CG_PrepRefresh( void )
void CG_PrepRefresh(void)
{
int i;
@@ -415,43 +394,40 @@ void CG_PrepRefresh( void )
// register the inline models
cgs.numInlineModels = cgi.CM_NumInlineModels();
for (i = 1; i < cgs.numInlineModels; i++)
{
char name[10];
vec3_t mins, maxs;
int j;
for (i = 1; i < cgs.numInlineModels; i++) {
char name[10];
vec3_t mins, maxs;
int j;
Com_sprintf(name, sizeof(name), "*%i", i);
cgs.inlineDrawModel[i] = cgi.R_RegisterModel(name);
cgi.R_ModelBounds(cgs.inlineDrawModel[i], mins, maxs);
for (j = 0; j < 3; j++)
{
for (j = 0; j < 3; j++) {
cgs.inlineModelMidpoints[i][j] = mins[j] + 0.5 * (maxs[j] - mins[j]);
}
}
// register media shaders
cgs.media.shadowMarkShader = cgi.R_RegisterShader("markShadow");
cgs.media.footShadowMarkShader = cgi.R_RegisterShader("footShadow");
cgs.media.wakeMarkShader = cgi.R_RegisterShader("ripple.spr");
cgs.media.lagometerShader = cgi.R_RegisterShaderNoMip("gfx/2d/blank");
cgs.media.levelExitShader = cgi.R_RegisterShaderNoMip("textures/menu/exit");
cgs.media.pausedShader = cgi.R_RegisterShaderNoMip("textures/menu/paused");
cgs.media.backTileShader = cgi.R_RegisterShader("gfx/2d/backtile");
cgs.media.zoomOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/zoomoverlay");
cgs.media.kar98TopOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/kartop.tga");
cgs.media.shadowMarkShader = cgi.R_RegisterShader("markShadow");
cgs.media.footShadowMarkShader = cgi.R_RegisterShader("footShadow");
cgs.media.wakeMarkShader = cgi.R_RegisterShader("ripple.spr");
cgs.media.lagometerShader = cgi.R_RegisterShaderNoMip("gfx/2d/blank");
cgs.media.levelExitShader = cgi.R_RegisterShaderNoMip("textures/menu/exit");
cgs.media.pausedShader = cgi.R_RegisterShaderNoMip("textures/menu/paused");
cgs.media.backTileShader = cgi.R_RegisterShader("gfx/2d/backtile");
cgs.media.zoomOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/zoomoverlay");
cgs.media.kar98TopOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/kartop.tga");
cgs.media.kar98BottomOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/karbottom.tga");
cgs.media.binocularsOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/binocularsoverlay");
cgs.media.hudDrawFont = cgi.R_LoadFont("verdana-14");
cgs.media.attackerFont = cgi.R_LoadFont("facfont-20");
cgs.media.objectiveFont = cgi.R_LoadFont("courier-16");
cgs.media.objectivesBackShader = cgi.R_RegisterShaderNoMip("textures/hud/objectives_backdrop");
cgs.media.checkedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/filledbox");
cgs.media.uncheckedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/emptybox");
cgs.media.binocularsOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/binocularsoverlay");
cgs.media.hudDrawFont = cgi.R_LoadFont("verdana-14");
cgs.media.attackerFont = cgi.R_LoadFont("facfont-20");
cgs.media.objectiveFont = cgi.R_LoadFont("courier-16");
cgs.media.objectivesBackShader = cgi.R_RegisterShaderNoMip("textures/hud/objectives_backdrop");
cgs.media.checkedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/filledbox");
cgs.media.uncheckedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/emptybox");
// go through all the configstrings and process them
for (i = CS_SYSTEMINFO + 1; i < MAX_CONFIGSTRINGS; i++)
{
for (i = CS_SYSTEMINFO + 1; i < MAX_CONFIGSTRINGS; i++) {
CG_ProcessConfigString(i);
}
}
@@ -463,16 +439,16 @@ void CG_PrepRefresh( void )
CG_ConfigString
=================
*/
const char *CG_ConfigString( int index ) {
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
cgi.Error( ERR_DROP, "CG_ConfigString: bad index: %i", index );
}
return cgs.gameState.stringData + cgs.gameState.stringOffsets[ index ];
const char *CG_ConfigString(int index)
{
if (index < 0 || index >= MAX_CONFIGSTRINGS) {
cgi.Error(ERR_DROP, "CG_ConfigString: bad index: %i", index);
}
return cgs.gameState.stringData + cgs.gameState.stringOffsets[index];
}
//==================================================================
void CG_GetRendererConfig(void)
{
// get the rendering configuration from the client system
@@ -488,9 +464,9 @@ CG_GameStateReceived
Displays the info screen while loading media
======================
*/
void CG_GameStateReceived( void )
void CG_GameStateReceived(void)
{
const char* s;
const char *s;
// clear everything
memset(&cg, 0, sizeof(cg));
@@ -511,7 +487,7 @@ void CG_GameStateReceived( void )
cgi.Error(ERR_DROP, "Client/Server game mismatch: %s/%s", GAME_VERSION, s);
}
s = CG_ConfigString(CS_LEVEL_START_TIME);
s = CG_ConfigString(CS_LEVEL_START_TIME);
cgs.levelStartTime = atoi(s);
CG_ParseServerinfo();
@@ -537,11 +513,11 @@ CG_ServerRestarted
The server has beeen restarted, adjust our cgame data accordingly
======================
*/
void CG_ServerRestarted( void )
void CG_ServerRestarted(void)
{
const char* s;
const char *s;
s = CG_ConfigString(CS_LEVEL_START_TIME);
s = CG_ConfigString(CS_LEVEL_START_TIME);
cgs.levelStartTime = atoi(s);
CG_ParseServerinfo();
@@ -561,7 +537,7 @@ void CG_ServerRestarted( void )
CG_InitializeObjectives();
}
void* CG_Malloc(int size)
void *CG_Malloc(int size)
{
return malloc(size);
}
@@ -578,20 +554,23 @@ CG_Init
Called after every level change or subsystem restart
=================
*/
void CG_Init(clientGameImport_t* imported, int serverMessageNum,
int serverCommandSequence, int clientNum)
void CG_Init(clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum)
{
cgi = *imported;
#if _DEBUG
cgi.Malloc = &CG_Malloc;
cgi.Free = &CG_Free;
cgi.Free = &CG_Free;
#endif
cg_protocol = cgi.Cvar_Get("com_protocol", "", 0)->integer;
CG_InitCGMessageAPI(&cge);
CG_InitScoresAPI(&cge);
memset(&cg, 0, sizeof(cg));
memset(&cgs, 0, sizeof(cgs));
cg.clientNum = clientNum;
cgs.processedSnapshotNum = serverMessageNum;
cg.clientNum = clientNum;
cgs.processedSnapshotNum = serverMessageNum;
cgs.serverCommandSequence = serverCommandSequence;
CG_RegisterCvars();
@@ -607,21 +586,21 @@ void CG_Init(clientGameImport_t* imported, int serverMessageNum,
CG_InitConsoleCommands();
cg.vEyeOffsetMax[0] = 40.0f;
cg.vEyeOffsetMax[1] = 45.0f;
cg.vEyeOffsetMax[2] = 60.0f;
cg.fEyeOffsetFrac = 0.1f;
cg.fCurrentViewHeight = 0.0f;
cg.fCurrentViewBobPhase = 0.0f;
cg.fCurrentViewBobAmp = 0.0f;
cg.pLastPlayerWorldModel = NULL;
cg.pPlayerFPSModel = NULL;
cg.hPlayerFPSModelHandle = 0;
cg.pAlliedPlayerModel = NULL;
cg.vEyeOffsetMax[0] = 40.0f;
cg.vEyeOffsetMax[1] = 45.0f;
cg.vEyeOffsetMax[2] = 60.0f;
cg.fEyeOffsetFrac = 0.1f;
cg.fCurrentViewHeight = 0.0f;
cg.fCurrentViewBobPhase = 0.0f;
cg.fCurrentViewBobAmp = 0.0f;
cg.pLastPlayerWorldModel = NULL;
cg.pPlayerFPSModel = NULL;
cg.hPlayerFPSModelHandle = 0;
cg.pAlliedPlayerModel = NULL;
cg.hAlliedPlayerModelHandle = 0;
cg.pAxisPlayerModel = NULL;
cg.hAxisPlayerModelHandle = 0;
cg.bFPSOnGround = qtrue;
cg.pAxisPlayerModel = NULL;
cg.hAxisPlayerModelHandle = 0;
cg.bFPSOnGround = qtrue;
// Pop the stats UI screen menu
cgi.UI_HideMenu("StatsScreen", 1);
@@ -658,7 +637,7 @@ void CG_Shutdown(void)
int CG_GetParent(int entnum)
{
return cg_entities[entnum].currentState.parent;
return cg_entities[entnum].currentState.parent;
}
float CG_GetObjectiveAlpha()
@@ -675,42 +654,34 @@ The only exported function from this module
*/
clientGameExport_t *GetCGameAPI(void)
{
static clientGameExport_t cge;
cge.CG_Init = CG_Init;
cge.CG_DrawActiveFrame = CG_DrawActiveFrame;
cge.CG_Shutdown = CG_Shutdown;
cge.CG_ConsoleCommand = CG_ConsoleCommand;
cge.CG_GetRendererConfig = CG_GetRendererConfig;
cge.CG_Draw2D = CG_Draw2D;
cge.CG_EyePosition = CG_EyePosition;
cge.CG_EyeOffset = CG_EyeOffset;
cge.CG_EyeAngles = CG_EyeAngles;
cge.CG_SensitivityScale = CG_SensitivityScale;
cge.CG_RefreshHudDrawElements = CG_RefreshHudDrawElements;
cge.CG_HudDrawShader = CG_HudDrawShader;
cge.CG_HudDrawFont = CG_HudDrawFont;
cge.CG_PermanentMark = CG_PermanentMark;
cge.CG_PermanentTreadMarkDecal = CG_PermanentTreadMarkDecal;
cge.CG_PermanentUpdateTreadMark = CG_PermanentUpdateTreadMark;
cge.CG_Command_ProcessFile = CG_Command_ProcessFile;
cge.CG_ProcessInitCommands = CG_ProcessInitCommands;
cge.CG_EndTiki = CG_EndTiki;
cge.CG_GetParent = CG_GetParent;
cge.CG_GetObjectiveAlpha = CG_GetObjectiveAlpha;
cge.CG_WeaponCommandButtonBits = CG_WeaponCommandButtonBits;
cge.CG_CheckCaptureKey = CG_CheckCaptureKey;
cge.CG_Init = CG_Init;
cge.CG_DrawActiveFrame = CG_DrawActiveFrame;
cge.CG_Shutdown = CG_Shutdown;
cge.CG_ConsoleCommand = CG_ConsoleCommand;
cge.CG_GetRendererConfig = CG_GetRendererConfig;
cge.CG_Draw2D = CG_Draw2D;
cge.CG_EyePosition = CG_EyePosition;
cge.CG_EyeOffset = CG_EyeOffset;
cge.CG_EyeAngles = CG_EyeAngles;
cge.CG_SensitivityScale = CG_SensitivityScale;
cge.CG_ParseCGMessage = CG_ParseCGMessage;
cge.CG_RefreshHudDrawElements = CG_RefreshHudDrawElements;
cge.CG_HudDrawShader = CG_HudDrawShader;
cge.CG_HudDrawFont = CG_HudDrawFont;
cge.CG_PermanentMark = CG_PermanentMark;
cge.CG_PermanentTreadMarkDecal = CG_PermanentTreadMarkDecal;
cge.CG_PermanentUpdateTreadMark = CG_PermanentUpdateTreadMark;
cge.CG_Command_ProcessFile = CG_Command_ProcessFile;
cge.CG_ProcessInitCommands = CG_ProcessInitCommands;
cge.CG_EndTiki = CG_EndTiki;
cge.CG_GetParent = CG_GetParent;
cge.CG_GetObjectiveAlpha = CG_GetObjectiveAlpha;
cge.CG_GetColumnName = CG_GetColumnName;
cge.CG_GetScoreBoardColor = CG_GetScoreBoardColor;
cge.CG_GetScoreBoardFontColor = CG_GetScoreBoardFontColor;
cge.CG_GetScoreBoardPosition = CG_GetScoreBoardPosition;
cge.CG_GetScoreBoardDrawHeader = CG_GetScoreBoardDrawHeader;
cge.CG_WeaponCommandButtonBits = CG_WeaponCommandButtonBits;
cge.CG_CheckCaptureKey = CG_CheckCaptureKey;
// FIXME
//cge.profStruct = NULL;
// FIXME
//cge.profStruct = NULL;
return &cge;
return &cge;
}
/*
@@ -722,7 +693,7 @@ Perform all drawing needed to completely fill the screen
*/
void CG_DrawActive(stereoFrame_t stereoView)
{
float separation;
float separation;
vec3_t baseOrg;
switch (stereoView) {
@@ -746,8 +717,7 @@ void CG_DrawActive(stereoFrame_t stereoView)
// offset vieworg appropriately if we're doing stereo separation
VectorCopy(cg.refdef.vieworg, baseOrg);
if (separation != 0) {
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1],
cg.refdef.vieworg);
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
}
// draw 3D view
@@ -762,69 +732,75 @@ void CG_DrawActive(stereoFrame_t stereoView)
#ifndef CGAME_HARD_LINKED
// this is only here so the functions in q_shared.c and bg_*.c can link (FIXME)
void Com_Error( int level, const char *error, ... ) {
va_list argptr;
char text[1024];
void Com_Error(int level, const char *error, ...)
{
va_list argptr;
char text[1024];
va_start (argptr, error);
vsprintf (text, error, argptr);
va_end (argptr);
va_start(argptr, error);
vsprintf(text, error, argptr);
va_end(argptr);
cgi.Error( level, "%s", text);
cgi.Error(level, "%s", text);
}
void Com_Printf( const char *msg, ... ) {
va_list argptr;
char text[1024];
void Com_Printf(const char *msg, ...)
{
va_list argptr;
char text[1024];
va_start (argptr, msg);
vsprintf (text, msg, argptr);
va_end (argptr);
va_start(argptr, msg);
vsprintf(text, msg, argptr);
va_end(argptr);
cgi.Printf( "%s", text);
cgi.Printf("%s", text);
}
#endif
#if TARGET_GAME_PROTOCOL >= 15
void CG_ParseFogInfo(const char* str) {
sscanf(
void CG_ParseFogInfo_ver_15(const char *str)
{
sscanf(
str,
"%d %f %f %f %f %f %f %f %d %f %f %f %f",
&cg.farplane_cull,
&cg.farplane_distance,
&cg.farplane_bias,
&cg.skyboxFarplane,
&cg.skyboxSpeed,
&cg.farplane_color[0],
&cg.farplane_color[1],
&cg.farplane_color[2],
&cg.renderTerrain,
&cg.farclipOverride,
&cg.farplaneColorOverride[0],
&cg.farplaneColorOverride[1],
&cg.farplaneColorOverride[2]
"%d %f %f %f %f %f %f %f %d %f %f %f %f",
&cg.farplane_cull,
&cg.farplane_distance,
&cg.farplane_bias,
&cg.skyboxFarplane,
&cg.skyboxSpeed,
&cg.farplane_color[0],
&cg.farplane_color[1],
&cg.farplane_color[2],
&cg.renderTerrain,
&cg.farclipOverride,
&cg.farplaneColorOverride[0],
&cg.farplaneColorOverride[1],
&cg.farplaneColorOverride[2]
);
}
#else
void CG_ParseFogInfo(const char* str) {
cg.farclipOverride = 0.0;
cg.farplaneColorOverride[0] = -1.0;
cg.farplaneColorOverride[1] = -1.0;
cg.farplaneColorOverride[2] = -1.0;
sscanf
(
str,
"%d %f %f %f %f",
&cg.farplane_cull,
&cg.farplane_distance,
&cg.farplane_color[0],
&cg.farplane_color[1],
&cg.farplane_color[2]
);
void CG_ParseFogInfo_ver_6(const char *str)
{
cg.farclipOverride = 0.0;
cg.farplaneColorOverride[0] = -1.0;
cg.farplaneColorOverride[1] = -1.0;
cg.farplaneColorOverride[2] = -1.0;
sscanf(
str,
"%d %f %f %f %f",
&cg.farplane_cull,
&cg.farplane_distance,
&cg.farplane_color[0],
&cg.farplane_color[1],
&cg.farplane_color[2]
);
}
#endif
void CG_ParseFogInfo(const char *str)
{
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
CG_ParseFogInfo_ver_15(str);
} else {
CG_ParseFogInfo_ver_6(str);
}
}
+957 -263
View File
File diff suppressed because it is too large. Load diff
+412 -519
View File
File diff suppressed because it is too large. Load diff
+44 -55
View File
@@ -26,22 +26,22 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
#include "cg_commands.h"
cvar_t* cg_rain;
cvar_t* cg_rain_drawcoverage;
cvar_t *cg_rain;
cvar_t *cg_rain_drawcoverage;
void RainTouch(ctempmodel_t* ct, trace_t* trace)
void RainTouch(ctempmodel_t *ct, trace_t *trace)
{
Vector norm, neworg;
ct->ent.hModel = cgi.R_RegisterModel("splash_z.spr");
ct->cgd.velocity = vec_zero;
ct->cgd.accel = vec_zero;
ct->killTime = cg.time + 400;
norm = trace->plane.normal;
norm.x = -norm.x;
norm.y = -norm.y;
ct->cgd.angles = norm.toAngles();
ct->ent.scale = 0.3f;
ct->ent.hModel = cgi.R_RegisterModel("splash_z.spr");
ct->cgd.velocity = vec_zero;
ct->cgd.accel = vec_zero;
ct->killTime = cg.time + 400;
norm = trace->plane.normal;
norm.x = -norm.x;
norm.y = -norm.y;
ct->cgd.angles = norm.toAngles();
ct->ent.scale = 0.3f;
ct->cgd.scaleRate = 4.0;
ct->cgd.flags |= T_FADE;
@@ -49,7 +49,7 @@ void RainTouch(ctempmodel_t* ct, trace_t* trace)
VectorCopy(neworg, ct->ent.origin);
}
void ClientGameCommandManager::RainTouch(Event* ev)
void ClientGameCommandManager::RainTouch(Event *ev)
{
// FIXME: unimplemented
}
@@ -59,15 +59,16 @@ void ClientGameCommandManager::InitializeRainCvars()
int i;
cg_rain = cgi.Cvar_Get("cg_rain", "0", CVAR_ARCHIVE);
cg_rain_drawcoverage = cgi.Cvar_Get("cg_rain_drawcoverage", "0", CVAR_SAVEGAME | CVAR_SERVER_CREATED | CVAR_SYSTEMINFO);
cg_rain_drawcoverage =
cgi.Cvar_Get("cg_rain_drawcoverage", "0", CVAR_SAVEGAME | CVAR_SERVER_CREATED | CVAR_SYSTEMINFO);
cg.rain.density = 0.0;
cg.rain.speed = 2048.0f;
cg.rain.length = 90.0f;
cg.rain.min_dist = 512.0f;
cg.rain.width = 1.0f;
cg.rain.density = 0.0;
cg.rain.speed = 2048.0f;
cg.rain.length = 90.0f;
cg.rain.min_dist = 512.0f;
cg.rain.width = 1.0f;
cg.rain.speed_vary = 512;
cg.rain.slant = 50;
cg.rain.slant = 50;
for (i = 0; i < MAX_RAIN_SHADERS; i++) {
cg.rain.shader[i][0] = 0;
@@ -76,19 +77,19 @@ void ClientGameCommandManager::InitializeRainCvars()
cg.rain.numshaders = 0;
}
void CG_Rain(centity_t* cent)
void CG_Rain(centity_t *cent)
{
int iLife;
vec3_t mins, maxs;
vec3_t vOmins, vOmaxs, vOe;
float fcolor[4];
vec3_t vStart, vEnd;
int iNumSpawn;
int i;
int iRandom;
float fDensity;
vec3_t vLength;
const char* shadername;
int iLife;
vec3_t mins, maxs;
vec3_t vOmins, vOmaxs, vOe;
float fcolor[4];
vec3_t vStart, vEnd;
int iNumSpawn;
int i;
int iRandom;
float fDensity;
vec3_t vLength;
const char *shadername;
fcolor[0] = 1.0;
fcolor[1] = 1.0;
@@ -133,35 +134,26 @@ void CG_Rain(centity_t* cent)
return;
}
if (cg_rain_drawcoverage->integer)
{
if (cg_rain_drawcoverage->integer) {
cgi.R_DebugLine(
Vector(vOmins[0], vOmins[1], vOmins[2]),
Vector(vOmaxs[0], vOmins[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
Vector(vOmins[0], vOmins[1], vOmins[2]), Vector(vOmaxs[0], vOmins[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0
);
cgi.R_DebugLine(
Vector(vOmaxs[0], vOmins[1], vOmins[2]),
Vector(vOmaxs[0], vOmaxs[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
Vector(vOmaxs[0], vOmins[1], vOmins[2]), Vector(vOmaxs[0], vOmaxs[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0
);
cgi.R_DebugLine(
Vector(vOmaxs[0], vOmaxs[1], vOmins[2]),
Vector(vOmins[0], vOmaxs[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
Vector(vOmaxs[0], vOmaxs[1], vOmins[2]), Vector(vOmins[0], vOmaxs[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0
);
cgi.R_DebugLine(
Vector(vOmins[0], vOmaxs[1], vOmins[2]),
Vector(vOmins[0], vOmins[1], vOmins[2]),
1.0, 0.0, 0.0, 1.0
Vector(vOmins[0], vOmaxs[1], vOmins[2]), Vector(vOmins[0], vOmins[1], vOmins[2]), 1.0, 0.0, 0.0, 1.0
);
}
VectorSubtract(vOmaxs, vOmins, vOe);
fDensity = cg.rain.density / 200.0;
fDensity = cg.rain.density / 200.0;
iNumSpawn = (int)(sqrt(vOe[0] * vOe[1]) * fDensity);
if (iNumSpawn > MAX_BEAMS) {
iNumSpawn = MAX_BEAMS;
@@ -171,21 +163,18 @@ void CG_Rain(centity_t* cent)
if (cg.rain.numshaders) {
shadername = cg.rain.shader[iRandom % cg.rain.numshaders];
}
else {
} else {
shadername = cg.rain.shader[0];
}
for (i = 0; i < iNumSpawn; ++i)
{
iLife = (int)(vOe[2] / ((float)(iRandom % cg.rain.speed_vary) + cg.rain.speed) * 1000.0);
for (i = 0; i < iNumSpawn; ++i) {
iLife = (int)(vOe[2] / ((float)(iRandom % cg.rain.speed_vary) + cg.rain.speed) * 1000.0);
vStart[0] = (float)(iRandom % (int)(vOe[0] + 1.0)) + vOmins[0];
iRandom = ((214013 * iRandom + 2531011) >> 16) & 0x7FFF;
iRandom = ((214013 * iRandom + 2531011) >> 16) & 0x7FFF;
vStart[1] = (float)(iRandom % (int)(vOe[1] + 1.0)) + vOmins[1];
vStart[2] = vOmaxs[2];
if (cg.snap)
{
if (cg.snap) {
vLength[0] = cg.snap->ps.origin[0] - vStart[0];
vLength[1] = cg.snap->ps.origin[1] - vStart[1];
vLength[2] = 0.0;
+1604 -737
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -29,9 +29,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
extern "C" {
#endif
void CG_AddBulletTracers();
void CG_AddBulletImpacts();
void CG_ParseCGMessage();
void CG_AddBulletTracers();
void CG_AddBulletImpacts();
void CG_InitCGMessageAPI(clientGameExport_t *cge);
#ifdef __cplusplus
}
+8 -9
View File
@@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// DESCRIPTION:
// Player functions for the cgame
// Player functions for the cgame
#include "cg_local.h"
#include "cg_commands.h"
@@ -42,9 +42,9 @@ CG_ResetPlayerEntity
A player just came into view or teleported, so reset all animation info
===============
*/
void CG_ResetPlayerEntity( centity_t *cent )
void CG_ResetPlayerEntity(centity_t *cent)
{
cent->errorTime = -99999; // guarantee no error decay added
cent->errorTime = -99999; // guarantee no error decay added
cent->extrapolated = qfalse;
VectorCopy(cent->currentState.origin, cent->lerpOrigin);
@@ -53,8 +53,7 @@ void CG_ResetPlayerEntity( centity_t *cent )
VectorCopy(cent->currentState.angles, cent->lerpAngles);
VectorCopy(cent->lerpAngles, cent->rawAngles);
if (cent->currentState.number == cg.snap->ps.clientNum)
{
if (cent->currentState.number == cg.snap->ps.clientNum) {
// initialize the camera position
VectorCopy(cent->lerpOrigin, cg.currentViewPos);
// initialize the camera angles
@@ -70,7 +69,7 @@ void CG_ResetPlayerEntity( centity_t *cent )
CG_Player
===============
*/
void CG_Player( centity_t *cent )
{
//CG_PlayerSplash( cent );
}
void CG_Player(centity_t *cent)
{
//CG_PlayerSplash( cent );
}
+2 -6
View File
@@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// DESCRIPTION:
//
//
// this file acts on changes in a new playerState_t.
// With normal play, this will be done after local prediction, but when
// following another player or playing back a demo, it will be checked
@@ -35,8 +35,4 @@ CG_TransitionPlayerState
===============
*/
void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops )
{
}
void CG_TransitionPlayerState(playerState_t *ps, playerState_t *ops) {}
+157 -109
View File
@@ -30,9 +30,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static pmove_t cg_pmove;
static int cg_numSolidEntities;
static centity_t* cg_solidEntities[MAX_ENTITIES_IN_SNAPSHOT];
static int cg_numTriggerEntities;
static int cg_numSolidEntities;
static centity_t *cg_solidEntities[MAX_ENTITIES_IN_SNAPSHOT];
static int cg_numTriggerEntities;
// static centity_t *cg_triggerEntities[MAX_ENTITIES_IN_SNAPSHOT];
/*
@@ -46,12 +47,12 @@ efficient collision detection
*/
void CG_BuildSolidList(void)
{
int i;
centity_t* cent;
snapshot_t* snap;
entityState_t* ent;
int i;
centity_t *cent;
snapshot_t *snap;
entityState_t *ent;
cg_numSolidEntities = 0;
cg_numSolidEntities = 0;
cg_numTriggerEntities = 0;
if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport) {
@@ -62,10 +63,9 @@ void CG_BuildSolidList(void)
for (i = 0; i < snap->numEntities; i++) {
cent = &cg_entities[snap->entities[i].number];
ent = &cent->currentState;
ent = &cent->currentState;
if (ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER ||
ent->eType == ET_TELEPORT_TRIGGER) {
if (ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER || ent->eType == ET_TELEPORT_TRIGGER) {
/*
cg_triggerEntities[cg_numTriggerEntities] = cent;
cg_numTriggerEntities++;
@@ -81,29 +81,71 @@ void CG_BuildSolidList(void)
}
}
int CG_GetBrushEntitiesInBounds(int iMaxEnts, centity_t** pEntList, const vec3_t vMins, const vec3_t vMaxs)
{
int i;
int iEntCount;
clipHandle_t cmodel;
vec3_t vEntMins, vEntMaxs;
centity_t* cent;
iEntCount = 0;
for (i = 0; i < cg_numSolidEntities; i++) {
cent = cg_solidEntities[i];
if (cent->currentState.solid != SOLID_BMODEL) {
continue;
}
cmodel = cgi.CM_InlineModel(cent->currentState.modelindex);
cgi.R_GetInlineModelBounds(cmodel, vEntMins, vEntMaxs);
if (cent->lerpAngles[0] || cent->lerpAngles[1] || cent->lerpAngles[2]) {
CalculateRotatedBounds(cent->lerpAngles, vEntMins, vEntMaxs);
}
VectorAdd(vEntMins, cent->lerpOrigin, vEntMins);
VectorAdd(vEntMaxs, cent->lerpOrigin, vEntMaxs);
if (vEntMins[0] <= vMaxs[0] && vEntMaxs[0] >= vMins[0]
&& vEntMins[1] <= vMaxs[1] && vEntMaxs[1] >= vMins[1]
&& vEntMins[2] <= vMaxs[2] && vEntMaxs[2] >= vMins[2]) {
pEntList[iEntCount++] = cent;
if (iEntCount >= iMaxEnts) {
return iEntCount;
}
}
}
return iEntCount;
}
/*
====================
CG_ClipMoveToEntities
====================
*/
void CG_ClipMoveToEntities(const vec3_t start, const vec3_t mins,
const vec3_t maxs, const vec3_t end,
int skipNumber, int mask, trace_t* tr,
qboolean cylinder)
void CG_ClipMoveToEntities(
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
trace_t *tr,
qboolean cylinder
)
{
int i;
trace_t trace;
entityState_t* ent;
clipHandle_t cmodel;
vec3_t bmins, bmaxs;
vec3_t origin, angles;
centity_t* cent;
int i;
trace_t trace;
entityState_t *ent;
clipHandle_t cmodel;
vec3_t bmins, bmaxs;
vec3_t origin, angles;
centity_t *cent;
for (i = 0; i < cg_numSolidEntities; i++) {
cent = cg_solidEntities[i];
ent = &cent->currentState;
ent = &cent->currentState;
if (ent->number == skipNumber) {
continue;
@@ -117,42 +159,43 @@ void CG_ClipMoveToEntities(const vec3_t start, const vec3_t mins,
}
} else {
IntegerToBoundingBox(ent->solid, bmins, bmaxs);
cmodel = cgi.CM_TempBoxModel(
bmins, bmaxs,
CONTENTS_BBOX);
cmodel = cgi.CM_TempBoxModel(bmins, bmaxs, CONTENTS_BBOX);
}
VectorCopy(cent->lerpOrigin, origin);
if (ent->eFlags & EF_LINKANGLES) {
VectorCopy(cent->lerpAngles, angles);
}
else {
} else {
VectorClear(angles);
}
cgi.CM_TransformedBoxTrace(&trace, start, end, mins, maxs, cmodel, mask,
origin, angles, cylinder);
cgi.CM_TransformedBoxTrace(&trace, start, end, mins, maxs, cmodel, mask, origin, angles, cylinder);
if (trace.allsolid || trace.fraction < tr->fraction) {
trace.entityNum = ent->number;
*tr = trace;
*tr = trace;
} else if (trace.startsolid) {
tr->startsolid = qtrue;
}
}
}
void CG_ShowTrace(trace_t* trace, int passent, const char* reason)
void CG_ShowTrace(trace_t *trace, int passent, const char *reason)
{
char text[1024];
assert(reason);
assert(trace);
sprintf(text, "%0.2f : Pass (%d) Frac %f Hit (%d): '%s'\n",
(float)cg.time / 1000.0f, passent, trace->fraction,
trace->entityNum, reason ? reason : "");
sprintf(
text,
"%0.2f : Pass (%d) Frac %f Hit (%d): '%s'\n",
(float)cg.time / 1000.0f,
passent,
trace->fraction,
trace->entityNum,
reason ? reason : ""
);
if (cg_traceinfo->integer == 3) {
cgi.DebugPrintf(text);
@@ -166,11 +209,18 @@ void CG_ShowTrace(trace_t* trace, int passent, const char* reason)
CG_Trace
================
*/
void CG_Trace(trace_t* result, const vec3_t start, const vec3_t mins,
const vec3_t maxs, const vec3_t end, int skipNumber, int mask,
qboolean cylinder, qboolean cliptoentities,
const char* description)
void CG_Trace(
trace_t *result,
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
qboolean cylinder,
qboolean cliptoentities,
const char *description
)
{
trace_t t;
@@ -185,8 +235,7 @@ void CG_Trace(trace_t* result, const vec3_t start, const vec3_t mins,
if (cliptoentities) {
// check all other solid models
CG_ClipMoveToEntities(start, mins, maxs, end, skipNumber, mask, &t,
cylinder);
CG_ClipMoveToEntities(start, mins, maxs, end, skipNumber, mask, &t, cylinder);
}
*result = t;
@@ -201,13 +250,19 @@ void CG_Trace(trace_t* result, const vec3_t start, const vec3_t mins,
CG_PlayerTrace
================
*/
void CG_PlayerTrace(trace_t* result, const vec3_t start, const vec3_t mins,
const vec3_t maxs, const vec3_t end, int skipNumber,
int mask, qboolean cylinder, qboolean tracedeep)
void CG_PlayerTrace(
trace_t *result,
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
const vec3_t end,
int skipNumber,
int mask,
qboolean cylinder,
qboolean tracedeep
)
{
CG_Trace(result, start, mins, maxs, end, skipNumber, mask, cylinder, qtrue,
"PlayerTrace");
CG_Trace(result, start, mins, maxs, end, skipNumber, mask, cylinder, qtrue, "PlayerTrace");
}
/*
@@ -217,11 +272,11 @@ CG_PointContents
*/
int CG_PointContents(const vec3_t point, int passEntityNum)
{
int i;
entityState_t* ent;
centity_t* cent;
clipHandle_t cmodel;
int contents;
int i;
entityState_t *ent;
centity_t *cent;
clipHandle_t cmodel;
int contents;
contents = cgi.CM_PointContents(point, 0);
@@ -243,8 +298,7 @@ int CG_PointContents(const vec3_t point, int passEntityNum)
continue;
}
contents |= cgi.CM_TransformedPointContents(point, cmodel, ent->origin,
ent->angles);
contents |= cgi.CM_TransformedPointContents(point, cmodel, ent->origin, ent->angles);
}
return contents;
@@ -260,8 +314,8 @@ cg.snap->player_state and cg.nextFrame->player_state
*/
static void CG_InterpolatePlayerStateCamera(void)
{
float f;
int i;
float f;
int i;
snapshot_t *prev, *next;
prev = cg.snap;
@@ -283,8 +337,7 @@ static void CG_InterpolatePlayerStateCamera(void)
return;
}
f = (float)(cg.time - prev->serverTime) /
(next->serverTime - prev->serverTime);
f = (float)(cg.time - prev->serverTime) / (next->serverTime - prev->serverTime);
// interpolate fov
cg.camera_fov = prev->ps.fov + f * (next->ps.fov - prev->ps.fov);
@@ -294,11 +347,8 @@ static void CG_InterpolatePlayerStateCamera(void)
}
for (i = 0; i < 3; i++) {
cg.camera_origin[i] =
prev->ps.camera_origin[i] +
f * (next->ps.camera_origin[i] - prev->ps.camera_origin[i]);
cg.camera_angles[i] =
LerpAngle(prev->ps.camera_angles[i], next->ps.camera_angles[i], f);
cg.camera_origin[i] = prev->ps.camera_origin[i] + f * (next->ps.camera_origin[i] - prev->ps.camera_origin[i]);
cg.camera_angles[i] = LerpAngle(prev->ps.camera_angles[i], next->ps.camera_angles[i], f);
}
}
@@ -312,12 +362,12 @@ cg.snap->player_state and cg.nextFrame->player_state
*/
static void CG_InterpolatePlayerState(qboolean grabAngles)
{
float f;
int i;
playerState_t* out;
snapshot_t *prev, *next;
float f;
int i;
playerState_t *out;
snapshot_t *prev, *next;
out = &cg.predicted_player_state;
out = &cg.predicted_player_state;
prev = cg.snap;
next = cg.nextSnap;
@@ -329,7 +379,7 @@ static void CG_InterpolatePlayerState(qboolean grabAngles)
// if we are still allowing local input, short circuit the view angles
if (grabAngles) {
usercmd_t cmd;
int cmdNum;
int cmdNum;
cmdNum = cgi.GetCurrentCmdNumber();
cgi.GetUserCmd(cmdNum, &cmd);
@@ -349,14 +399,11 @@ static void CG_InterpolatePlayerState(qboolean grabAngles)
f = cg.frameInterpolation;
for (i = 0; i < 3; i++) {
out->origin[i] =
prev->ps.origin[i] + f * (next->ps.origin[i] - prev->ps.origin[i]);
out->origin[i] = prev->ps.origin[i] + f * (next->ps.origin[i] - prev->ps.origin[i]);
if (!grabAngles) {
out->viewangles[i] =
LerpAngle(prev->ps.viewangles[i], next->ps.viewangles[i], f);
out->viewangles[i] = LerpAngle(prev->ps.viewangles[i], next->ps.viewangles[i], f);
}
out->velocity[i] = prev->ps.velocity[i] +
f * (next->ps.velocity[i] - prev->ps.velocity[i]);
out->velocity[i] = prev->ps.velocity[i] + f * (next->ps.velocity[i] - prev->ps.velocity[i]);
}
}
@@ -388,10 +435,10 @@ to ease the jerk.
*/
void CG_PredictPlayerState(void)
{
int cmdNum, current;
int cmdNum, current;
playerState_t oldPlayerState;
qboolean moved;
usercmd_t latestCmd;
qboolean moved;
usercmd_t latestCmd;
cg.hyperspace = qfalse; // will be set if touching a trigger_teleport
@@ -399,13 +446,12 @@ void CG_PredictPlayerState(void)
// predicted_player_state is valid even if there is some
// other error condition
if (!cg.validPPS) {
cg.validPPS = qtrue;
cg.validPPS = qtrue;
cg.predicted_player_state = cg.snap->ps;
}
// demo playback just copies the moves
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) ||
(cg.snap->ps.pm_flags & PMF_FROZEN)) {
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) || (cg.snap->ps.pm_flags & PMF_FROZEN)) {
CG_InterpolatePlayerState(qfalse);
return;
}
@@ -414,15 +460,14 @@ void CG_PredictPlayerState(void)
// FIXME
// Noclip is jittery for some reason, so I'm disabling prediction while
// noclipping
if (cg_nopredict->integer || cg_synchronousClients->integer ||
(cg.snap->ps.pm_type == PM_NOCLIP)) {
if (cg_nopredict->integer || cg_synchronousClients->integer || (cg.snap->ps.pm_type == PM_NOCLIP)) {
CG_InterpolatePlayerState(qtrue);
return;
}
// prepare for pmove
cg_pmove.ps = &cg.predicted_player_state;
cg_pmove.trace = CG_PlayerTrace;
cg_pmove.ps = &cg.predicted_player_state;
cg_pmove.trace = CG_PlayerTrace;
cg_pmove.pointcontents = CG_PointContents;
if (cg_pmove.ps->pm_type == PM_DEAD) {
@@ -432,6 +477,8 @@ void CG_PredictPlayerState(void)
}
cg_pmove.noFootsteps = (cgs.dmflags & DF_NO_FOOTSTEPS) > 0;
// Leaning while moving is allowed in mohta and mohtt only with a specific dm flag bit set
cg_pmove.alwaysAllowLean = (cg_protocol < PROTOCOL_MOHTA_MIN) || (cgs.dmflags & DF_ALLOW_LEAN_MOVEMENT);
// save the state before the pmove so we can detect transitions
oldPlayerState = cg.predicted_player_state;
@@ -448,24 +495,22 @@ void CG_PredictPlayerState(void)
// be ahead of everything else anyway
if (cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport) {
cg.predicted_player_state = cg.nextSnap->ps;
cg.physicsTime = cg.nextSnap->serverTime;
cg.physicsTime = cg.nextSnap->serverTime;
} else {
cg.predicted_player_state = cg.snap->ps;
cg.physicsTime = cg.snap->serverTime;
cg.physicsTime = cg.snap->serverTime;
}
if (pmove_msec->integer >= 8)
{
if (pmove_msec->integer > 33)
if (pmove_msec->integer >= 8) {
if (pmove_msec->integer > 33) {
cgi.Cvar_Set("pmove_msec", "33");
}
else
{
}
} else {
cgi.Cvar_Set("pmove_msec", "8");
}
cg_pmove.pmove_fixed = pmove_fixed->integer;
cg_pmove.pmove_msec = pmove_msec->integer;
cg_pmove.pmove_msec = pmove_msec->integer;
// run cmds
moved = qfalse;
@@ -492,9 +537,7 @@ void CG_PredictPlayerState(void)
// from the snapshot, but on a wan we will have
// to predict several commands to get to the point
// we want to compare
if (cg.predicted_player_state.commandTime ==
oldPlayerState.commandTime) {
if (cg.predicted_player_state.commandTime == oldPlayerState.commandTime) {
if (cg.thisFrameTeleport) {
// a teleport will not cause an error decay
VectorClear(cg.predictedError);
@@ -508,13 +551,12 @@ void CG_PredictPlayerState(void)
// if our feet are falling, don't try to move
if (cg_pmove.ps->feetfalling && (cg_pmove.waterlevel < 2)) {
cg_pmove.cmd.forwardmove = 0;
cg_pmove.cmd.rightmove = 0;
cg_pmove.cmd.rightmove = 0;
}
if (cg_pmove.pmove_fixed) {
cg_pmove.cmd.serverTime = pmove_msec->integer
* ((cg_pmove.cmd.serverTime + pmove_msec->integer - 1)
/ pmove_msec->integer);
cg_pmove.cmd.serverTime =
pmove_msec->integer * ((cg_pmove.cmd.serverTime + pmove_msec->integer - 1) / pmove_msec->integer);
}
Pmove(&cg_pmove);
@@ -534,8 +576,8 @@ void CG_PredictPlayerState(void)
// Interpolate the player position
if (cg.predicted_player_state.groundEntityNum != ENTITYNUM_WORLD) {
centity_t* cent;
vec3_t offset;
centity_t *cent;
vec3_t offset;
cent = &cg_entities[cg.predicted_player_state.groundEntityNum];
@@ -544,9 +586,15 @@ void CG_PredictPlayerState(void)
f = cg.frameInterpolation - 1.0;
offset[0] = (cent->nextState.origin[0] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[0]) * f;
offset[1] = (cent->nextState.origin[1] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[1]) * f;
offset[2] = (cent->nextState.origin[2] - cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[2]) * f;
offset[0] = (cent->nextState.origin[0]
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[0])
* f;
offset[1] = (cent->nextState.origin[1]
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[1])
* f;
offset[2] = (cent->nextState.origin[2]
- cg_entities[cg.predicted_player_state.groundEntityNum].currentState.origin[2])
* f;
cg.predicted_player_state.origin[0] += offset[0];
cg.predicted_player_state.origin[1] += offset[1];
+402 -312
View File
@@ -27,58 +27,55 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define __CG_PUBLIC_H__
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
#define MAGIC_UNUSED_NUMBER 7777
#define CMD_BACKUP 128
#define CMD_MASK (CMD_BACKUP - 1)
// allow a lot of command backups for very fast systems
// multiple commands may be combined into a single packet, so this
// needs to be larger than PACKET_BACKUP
#define MAGIC_UNUSED_NUMBER 7777
#define CMD_BACKUP 128
#define CMD_MASK (CMD_BACKUP - 1)
// allow a lot of command backups for very fast systems
// multiple commands may be combined into a single packet, so this
// needs to be larger than PACKET_BACKUP
#define MAX_ENTITIES_IN_SNAPSHOT 1024
#define MAX_ENTITIES_IN_SNAPSHOT 1024
// snapshots are a view of the server at a given time
// snapshots are a view of the server at a given time
// Snapshots are generated at regular time intervals by the server,
// but they may not be sent if a client's rate level is exceeded, or
// they may be dropped by the network.
typedef struct {
int snapFlags; // SNAPFLAG_RATE_DELAYED, etc
int ping;
// Snapshots are generated at regular time intervals by the server,
// but they may not be sent if a client's rate level is exceeded, or
// they may be dropped by the network.
typedef struct {
int snapFlags; // SNAPFLAG_RATE_DELAYED, etc
int ping;
int serverTime; // server time the message is valid for (in msec)
int serverTime; // server time the message is valid for (in msec)
byte areamask[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
byte areamask[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
playerState_t ps; // complete information about the current player at this time
playerState_t ps; // complete information about the current player at this time
int numEntities; // all of the entities that need to be presented
entityState_t entities[MAX_ENTITIES_IN_SNAPSHOT]; // at the time of this snapshot
int numEntities; // all of the entities that need to be presented
entityState_t entities[MAX_ENTITIES_IN_SNAPSHOT]; // at the time of this snapshot
int numServerCommands; // text based server commands to execute when this
int serverCommandSequence; // snapshot becomes current
int numServerCommands; // text based server commands to execute when this
int serverCommandSequence; // snapshot becomes current
int number_of_sounds;
server_sound_t sounds[MAX_SERVER_SOUNDS];
} snapshot_t;
int number_of_sounds;
server_sound_t sounds[ MAX_SERVER_SOUNDS ];
} snapshot_t;
typedef struct stopWatch_s {
int iStartTime;
int iEndTime;
typedef struct stopWatch_s
{
int iStartTime;
int iEndTime;
} stopWatch_t;
} stopWatch_t;
typedef struct AliasList_s AliasList_t;
typedef struct AliasListNode_s AliasListNode_t;
typedef struct dtiki_s dtiki_t;
typedef struct tiki_cmd_s tiki_cmd_t;
typedef struct AliasList_s AliasList_t;
typedef struct AliasListNode_s AliasListNode_t;
typedef struct dtiki_s dtiki_t;
typedef struct tiki_cmd_s tiki_cmd_t;
/*
/*
==================================================================
functions imported from the main executable
@@ -86,9 +83,9 @@ functions imported from the main executable
==================================================================
*/
#define CGAME_IMPORT_API_VERSION 3
#define CGAME_IMPORT_API_VERSION 3
/*
/*
==================================================================
functions exported to the main executable
@@ -96,274 +93,344 @@ functions exported to the main executable
==================================================================
*/
typedef struct
{
int apiversion;
//============== general services ==================
typedef struct {
int apiversion;
// print message on the local console
void (*Printf)( const char *fmt, ...);
void (*DPrintf)( const char *fmt, ...);
void (*DebugPrintf)( const char *fmt, ...);
//============== general services ==================
// managed memory allocation
void *(*Malloc)( int size );
void (*Free)( void *block );
// print message on the local console
void (*Printf)(const char *fmt, ...);
void (*DPrintf)(const char *fmt, ...);
void (*DebugPrintf)(const char *fmt, ...);
// abort the game
void (*Error)( int errorLevel, const char *fmt, ...);
// managed memory allocation
void *(*Malloc)(int size);
void (*Free)(void *block);
// milliseconds should only be used for profiling, never
// for anything game related. Get time from CG_ReadyToBuildScene.
int (*Milliseconds)( void );
// abort the game
void (*Error)(int errorLevel, const char *fmt, ...);
// localization
const char* (*LV_ConvertString)(const char* string);
// milliseconds should only be used for profiling, never
// for anything game related. Get time from CG_ReadyToBuildScene.
int (*Milliseconds)(void);
// console variable interaction
cvar_t * (*Cvar_Get)( const char *var_name, const char *value, int flags );
void (*Cvar_Set)( const char *var_name, const char *value );
// localization
const char *(*LV_ConvertString)(const char *string);
// ClientCommand and ConsoleCommand parameter access
int (*Argc)( void );
char * (*Argv)( int n );
char * (*Args)( void ); // concatenation of all argv >= 1
void (*AddCommand)( const char *cmd );
void (*Cmd_Stuff)(const char* text);
void (*Cmd_Execute)(int execWhen, const char* text);
void (*Cmd_TokenizeString)(const char* textIn);
// console variable interaction
cvar_t *(*Cvar_Get)(const char *var_name, const char *value, int flags);
void (*Cvar_Set)(const char *var_name, const char *value);
// a -1 return means the file does not exist
// NULL can be passed for buf to just determine existance
long (*FS_ReadFile)( const char *name, void **buf, qboolean quiet );
void (*FS_FreeFile)( void *buf );
int (*FS_WriteFile)( const char *qpath, const void *buffer, int size );
void (*FS_WriteTextFile)( const char *qpath, const void *buffer, int size );
// add commands to the local console as if they were typed in
// for map changing, etc. The command is not executed immediately,
// but will be executed in order the next time console commands
// are processed
void (*SendConsoleCommand)( const char *text );
// ClientCommand and ConsoleCommand parameter access
int (*Argc)(void);
char *(*Argv)(int n);
char *(*Args)(void); // concatenation of all argv >= 1
void (*AddCommand)(const char *cmd);
void (*Cmd_Stuff)(const char *text);
void (*Cmd_Execute)(int execWhen, const char *text);
void (*Cmd_TokenizeString)(const char *textIn);
// =========== client specific functions ===============
// a -1 return means the file does not exist
// NULL can be passed for buf to just determine existance
long (*FS_ReadFile)(const char *name, void **buf, qboolean quiet);
void (*FS_FreeFile)(void *buf);
int (*FS_WriteFile)(const char *qpath, const void *buffer, int size);
void (*FS_WriteTextFile)(const char *qpath, const void *buffer, int size);
// add commands to the local console as if they were typed in
// for map changing, etc. The command is not executed immediately,
// but will be executed in order the next time console commands
// are processed
void (*SendConsoleCommand)(const char *text);
// send a string to the server over the network
int (*MSG_ReadBits)(int bits);
int (*MSG_ReadChar)();
int (*MSG_ReadByte)();
int (*MSG_ReadSVC)();
int (*MSG_ReadShort)();
int (*MSG_ReadLong)();
float (*MSG_ReadFloat)();
char* (*MSG_ReadString)();
char* (*MSG_ReadStringLine)();
float (*MSG_ReadAngle8)();
float (*MSG_ReadAngle16)();
void (*MSG_ReadData)(void* data, int len);
float (*MSG_ReadCoord)();
void (*MSG_ReadDir)(vec3_t dir);
void (*SendClientCommand)( const char *s );
// =========== client specific functions ===============
// CM functions
void (*CM_LoadMap)( const char *name );
clipHandle_t (*CM_InlineModel)( int index ); // 0 = world, 1+ = bmodels
int (*CM_NumInlineModels)( void );
int (*CM_PointContents)( const vec3_t p, int headnode );
int (*CM_TransformedPointContents)(const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles);
void (*CM_BoxTrace)( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
int headnode, int brushmask, qboolean cylinder );
void (*CM_TransformedBoxTrace)( trace_t *results, const vec3_t start, const vec3_t end,
const vec3_t mins, const vec3_t maxs,
int headnode, int brushmask,
const vec3_t origin, const vec3_t angles,
qboolean cylinder
);
clipHandle_t (*CM_TempBoxModel)( const vec3_t mins, const vec3_t maxs, int contents );
void (*CM_PrintBSPFileSizes)();
qboolean (*CM_LeafInPVS)(int leaf1, int leaf2);
int (*CM_PointLeafnum)(const vec3_t p);
int (*R_MarkFragments)( int numPoints, const vec3_t *points, const vec3_t projection,
int maxPoints, vec3_t pointBuffer,
int maxFragments, markFragment_t *fragmentBuffer, float fRadiusSquared );
int (*R_MarkFragmentsForInlineModel)(clipHandle_t bmodel, const vec3_t vAngles, const vec3_t vOrigin,
int numPoints, const vec3_t *points, const vec3_t projection,
int maxPoints, vec3_t pointBuffer,
int maxFragments, markFragment_t *fragmentBuffer, float fRadiusSquared );
// send a string to the server over the network
int (*MSG_ReadBits)(int bits);
int (*MSG_ReadChar)();
int (*MSG_ReadByte)();
int (*MSG_ReadSVC)();
int (*MSG_ReadShort)();
int (*MSG_ReadLong)();
float (*MSG_ReadFloat)();
char *(*MSG_ReadString)();
char *(*MSG_ReadStringLine)();
float (*MSG_ReadAngle8)();
float (*MSG_ReadAngle16)();
void (*MSG_ReadData)(void *data, int len);
float (*MSG_ReadCoord)();
void (*MSG_ReadDir)(vec3_t dir);
void (*SendClientCommand)(const char *s);
void (*R_GetInlineModelBounds)(int index, vec3_t mins, vec3_t maxs);
void (*R_GetLightingForDecal)(vec3_t light, vec3_t facing, vec3_t origin);
void (*R_GetLightingForSmoke)(vec3_t light, vec3_t origin);
int (*R_GatherLightSources)(const vec3_t pos, vec3_t* lightPos, vec3_t* lightIntensity, int maxLights);
// CM functions
void (*CM_LoadMap)(const char *name);
clipHandle_t (*CM_InlineModel)(int index); // 0 = world, 1+ = bmodels
int (*CM_NumInlineModels)(void);
int (*CM_PointContents)(const vec3_t p, int headnode);
int (*CM_TransformedPointContents)(
const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles
);
void (*CM_BoxTrace)(
trace_t *results,
const vec3_t start,
const vec3_t end,
const vec3_t mins,
const vec3_t maxs,
int headnode,
int brushmask,
qboolean cylinder
);
void (*CM_TransformedBoxTrace)(
trace_t *results,
const vec3_t start,
const vec3_t end,
const vec3_t mins,
const vec3_t maxs,
int headnode,
int brushmask,
const vec3_t origin,
const vec3_t angles,
qboolean cylinder
);
clipHandle_t (*CM_TempBoxModel)(const vec3_t mins, const vec3_t maxs, int contents);
void (*CM_PrintBSPFileSizes)();
qboolean (*CM_LeafInPVS)(int leaf1, int leaf2);
int (*CM_PointLeafnum)(const vec3_t p);
int (*R_MarkFragments)(
int numPoints,
const vec3_t *points,
const vec3_t projection,
int maxPoints,
vec3_t pointBuffer,
int maxFragments,
markFragment_t *fragmentBuffer,
float fRadiusSquared
);
int (*R_MarkFragmentsForInlineModel)(
clipHandle_t bmodel,
const vec3_t vAngles,
const vec3_t vOrigin,
int numPoints,
const vec3_t *points,
const vec3_t projection,
int maxPoints,
vec3_t pointBuffer,
int maxFragments,
markFragment_t *fragmentBuffer,
float fRadiusSquared
);
// =========== sound function calls ===============
void (*R_GetInlineModelBounds)(int index, vec3_t mins, vec3_t maxs);
void (*R_GetLightingForDecal)(vec3_t light, const vec3_t facing, const vec3_t origin);
void (*R_GetLightingForSmoke)(vec3_t light, const vec3_t origin);
int (*R_GatherLightSources)(const vec3_t pos, vec3_t *lightPos, vec3_t *lightIntensity, int maxLights);
void (*S_StartSound)(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, int streamed);
void (*S_StartLocalSound)(const char* soundName, qboolean forceLoad);
void (*S_StopSound)( int entnum, int channel );
void (*S_ClearLoopingSounds)(void);
void (*S_AddLoopingSound)(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags);
void (*S_Respatialize)( int entityNum, const vec3_t origin, vec3_t axis[3] );
void (*S_BeginRegistration)( void );
sfxHandle_t (*S_RegisterSound)( const char *sample, int streamed );
void (*S_EndRegistration)( void );
void (*S_UpdateEntity)( int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener );
void (*S_SetReverb)( int reverb_type, float reverb_level );
void (*S_SetGlobalAmbientVolumeLevel)( float volume );
float (*S_GetSoundTime)(sfxHandle_t handle);
int (*S_ChannelNameToNum)(const char* name);
const char* (*S_ChannelNumToName)(int channel);
int (*S_IsSoundPlaying)(int channelNumber, const char* name);
// =========== sound function calls ===============
// =========== music function calls ===============
void (*S_StartSound)(
const vec3_t origin,
int entNum,
int entChannel,
sfxHandle_t sfxHandle,
float volume,
float minDist,
float pitch,
float maxDist,
int streamed
);
void (*S_StartLocalSound)(const char *soundName, qboolean forceLoad);
void (*S_StopSound)(int entnum, int channel);
void (*S_ClearLoopingSounds)(void);
void (*S_AddLoopingSound)(
const vec3_t origin,
const vec3_t velocity,
sfxHandle_t sfxHandle,
float volume,
float minDist,
float maxDist,
float pitch,
int flags
);
void (*S_Respatialize)(int entityNum, const vec3_t origin, vec3_t axis[3]);
void (*S_BeginRegistration)(void);
sfxHandle_t (*S_RegisterSound)(const char *sample, int streamed);
void (*S_EndRegistration)(void);
void (*S_UpdateEntity)(int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener);
void (*S_SetReverb)(int reverb_type, float reverb_level);
void (*S_SetGlobalAmbientVolumeLevel)(float volume);
float (*S_GetSoundTime)(sfxHandle_t handle);
int (*S_ChannelNameToNum)(const char *name);
const char *(*S_ChannelNumToName)(int channel);
int (*S_IsSoundPlaying)(int channelNumber, const char *name);
void (*MUSIC_NewSoundtrack)( const char *name );
void (*MUSIC_UpdateMood)( int current_mood, int fallback_mood );
void (*MUSIC_UpdateVolume)( float volume, float fade_time );
// =========== music function calls ===============
// =========== camera function calls ===============
void (*MUSIC_NewSoundtrack)(const char *name);
void (*MUSIC_UpdateMood)(int current_mood, int fallback_mood);
void (*MUSIC_UpdateVolume)(float volume, float fade_time);
float * (*get_camera_offset)( qboolean *lookactive, qboolean *resetview );
// =========== camera function calls ===============
// =========== renderer function calls ================
void (*R_ClearScene)( void );
void (*R_RenderScene)( const refdef_t *fd );
void (*R_LoadWorldMap)(const char* mapname);
void (*R_PrintBSPFileSizes)();
int (*MapVersion)();
int (*R_MapVersion)();
qhandle_t (*R_RegisterModel)( const char *name );
qhandle_t (*R_SpawnEffectModel)(const char* name, vec3_t pos, vec3_t axis[3]);
qhandle_t (*R_RegisterServerModel)(const char* name);
void (*R_UnregisterServerModel)(qhandle_t hModel);
qhandle_t (*R_RegisterSkin)( const char *name );
qhandle_t (*R_RegisterShader)( const char *name );
qhandle_t (*R_RegisterShaderNoMip)( const char *name );
void (*R_AddRefEntityToScene)(const refEntity_t *ent, int parentEntityNumber );
void (*R_AddRefSpriteToScene)(const refEntity_t *ent );
void (*R_AddLightToScene)(const vec3_t origin, float intensity, float r, float g, float b, int type );
qboolean (*R_AddPolyToScene)(qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderfx);
void (*R_AddTerrainMarkToScene)(int terrainIndex, qhandle_t hShader, int numVerts, const polyVert_t* verts, int renderFx);
void (*R_SetColor)( const vec4_t rgba ); // NULL = 1,1,1,1
void (*R_DrawStretchPic) ( float x, float y, float w, float h,
float s1, float t1, float s2, float t2,
qhandle_t hShader ); // 0 = white
fontheader_t* (*R_LoadFont)(const char* name);
void (*R_DrawString)(fontheader_t* font, const char* text, float x, float y, int maxLen, qboolean virtualScreen);
refEntity_t * (*R_GetRenderEntity)( int entityNumber );
void (*R_ModelBounds)( clipHandle_t model, vec3_t mins, vec3_t maxs );
float (*R_ModelRadius)( clipHandle_t model );
float (*R_Noise)( float x, float y, float z, float t );
void (*R_DebugLine)(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha);
baseshader_t* (*GetShader)(int shaderNum);
// =========== Swipes =============
void (*R_SwipeBegin) ( float thistime, float life, qhandle_t shader );
void (*R_SwipePoint) ( vec3_t p1, vec3_t p2, float time );
void (*R_SwipeEnd) ( void );
int (*R_GetShaderWidth)( qhandle_t shader );
int (*R_GetShaderHeight)( qhandle_t shader );
void (*R_DrawBox)( float x, float y, float w, float h );
float *(*get_camera_offset)(qboolean *lookactive, qboolean *resetview);
// =========== data shared with the client =============
void (*GetGameState)( gameState_t *gamestate );
int (*GetSnapshot)( int snapshotNumber, snapshot_t *snapshot );
int (*GetServerStartTime)();
void (*SetTime)(int time);
void (*GetCurrentSnapshotNumber)( int *snapshotNumber, int *serverTime );
void (*GetGlconfig)( glconfig_t *glconfig );
// =========== renderer function calls ================
void (*R_ClearScene)(void);
void (*R_RenderScene)(const refdef_t *fd);
void (*R_LoadWorldMap)(const char *mapname);
void (*R_PrintBSPFileSizes)();
int (*MapVersion)();
int (*R_MapVersion)();
qhandle_t (*R_RegisterModel)(const char *name);
qhandle_t (*R_SpawnEffectModel)(const char *name, vec3_t pos, vec3_t axis[3]);
qhandle_t (*R_RegisterServerModel)(const char *name);
void (*R_UnregisterServerModel)(qhandle_t hModel);
qhandle_t (*R_RegisterSkin)(const char *name);
qhandle_t (*R_RegisterShader)(const char *name);
qhandle_t (*R_RegisterShaderNoMip)(const char *name);
void (*R_AddRefEntityToScene)(const refEntity_t *ent, int parentEntityNumber);
void (*R_AddRefSpriteToScene)(const refEntity_t *ent);
void (*R_AddLightToScene)(const vec3_t origin, float intensity, float r, float g, float b, int type);
qboolean (*R_AddPolyToScene)(qhandle_t hShader, int numVerts, const polyVert_t *verts, int renderfx);
void (*R_AddTerrainMarkToScene)(
int terrainIndex, qhandle_t hShader, int numVerts, const polyVert_t *verts, int renderFx
);
void (*R_SetColor)(const vec4_t rgba); // NULL = 1,1,1,1
void (*R_DrawStretchPic)(
float x,
float y,
float w,
float h,
float s1,
float t1,
float s2,
float t2,
qhandle_t hShader
); // 0 = white
fontheader_t *(*R_LoadFont)(const char *name);
void (*R_DrawString)(
fontheader_t *font, const char *text, float x, float y, int maxLen, qboolean virtualScreen
);
refEntity_t *(*R_GetRenderEntity)(int entityNumber);
void (*R_ModelBounds)(clipHandle_t model, vec3_t mins, vec3_t maxs);
float (*R_ModelRadius)(clipHandle_t model);
float (*R_Noise)(float x, float y, float z, float t);
void (*R_DebugLine)(const vec3_t start, const vec3_t end, float r, float g, float b, float alpha);
baseshader_t *(*GetShader)(int shaderNum);
// =========== Swipes =============
void (*R_SwipeBegin)(float thistime, float life, qhandle_t shader);
void (*R_SwipePoint)(vec3_t p1, vec3_t p2, float time);
void (*R_SwipeEnd)(void);
int (*R_GetShaderWidth)(qhandle_t shader);
int (*R_GetShaderHeight)(qhandle_t shader);
void (*R_DrawBox)(float x, float y, float w, float h);
// will return false if the number is so old that it doesn't exist in the buffer anymore
qboolean (*GetParseEntityState)( int parseEntityNumber, entityState_t *state );
int (*GetCurrentCmdNumber)( void ); // returns the most recent command number
// which is the local predicted command for
// the following frame
qboolean (*GetUserCmd)( int cmdNumber, usercmd_t *ucmd );
qboolean (*GetServerCommand)(int serverCommandNumber, qboolean differentServer);
// =========== data shared with the client =============
void (*GetGameState)(gameState_t *gamestate);
int (*GetSnapshot)(int snapshotNumber, snapshot_t *snapshot);
int (*GetServerStartTime)();
void (*SetTime)(int time);
void (*GetCurrentSnapshotNumber)(int *snapshotNumber, int *serverTime);
void (*GetGlconfig)(glconfig_t *glconfig);
// ALIAS STUFF
qboolean (*Alias_Add)( const char * alias, const char * name, const char *parameters );
qboolean (*Alias_ListAdd)(AliasList_t* list, const char* alias, const char* name, const char* parameters);
const char* (*Alias_FindRandom)(const char* alias, AliasListNode_t **ret);
const char* (*Alias_ListFindRandom)(AliasList_t* list, const char* alias, AliasListNode_t** ret);
void (*Alias_Dump)( void );
void (*Alias_Clear)( void );
AliasList_t* (*AliasList_New)(const char* name);
void (*Alias_ListFindRandomRange)(AliasList_t* list, const char* alias, int* minIndex, int* maxIndex, float* totalWeight);
AliasList_t* (*Alias_GetGlobalList)();
// will return false if the number is so old that it doesn't exist in the buffer anymore
qboolean (*GetParseEntityState)(int parseEntityNumber, entityState_t *state);
int (*GetCurrentCmdNumber)(void); // returns the most recent command number
// which is the local predicted command for
// the following frame
qboolean (*GetUserCmd)(int cmdNumber, usercmd_t *ucmd);
qboolean (*GetServerCommand)(int serverCommandNumber, qboolean differentServer);
// ==================== UI STUFF ==========================
void (*UI_ShowMenu)(const char* name, qboolean bForce);
void (*UI_HideMenu)(const char* name, qboolean bForce);
int (*UI_FontStringWidth)(fontheader_t* font, const char* string, int maxLen);
// ALIAS STUFF
qboolean (*Alias_Add)(const char *alias, const char *name, const char *parameters);
qboolean (*Alias_ListAdd)(AliasList_t *list, const char *alias, const char *name, const char *parameters);
const char *(*Alias_FindRandom)(const char *alias, AliasListNode_t **ret);
const char *(*Alias_ListFindRandom)(AliasList_t *list, const char *alias, AliasListNode_t **ret);
void (*Alias_Dump)(void);
void (*Alias_Clear)(void);
AliasList_t *(*AliasList_New)(const char *name);
void (*Alias_ListFindRandomRange)(
AliasList_t *list, const char *alias, int *minIndex, int *maxIndex, float *totalWeight
);
AliasList_t *(*Alias_GetGlobalList)();
int (*Key_StringToKeynum)(const char* str);
const char* (*Key_KeynumToBindString)(int keyNum);
void (*Key_GetKeysForCommand)(const char* command, int* key1, int* key2);
// ==================== UI STUFF ==========================
void (*UI_ShowMenu)(const char *name, qboolean bForce);
void (*UI_HideMenu)(const char *name, qboolean bForce);
int (*UI_FontStringWidth)(fontheader_t *font, const char *string, int maxLen);
// ==================== TIKI STUFF ==========================
// TIKI SPECIFIC STUFF
dtiki_t* (*R_Model_GetHandle)(qhandle_t handle);
int (*TIKI_NumAnims)(dtiki_t* pmdl);
void (*TIKI_CalculateBounds)(dtiki_t* pmdl, float scale, vec3_t mins, vec3_t maxs);
const char* (*TIKI_Name)(dtiki_t* tiki);
void* (*TIKI_GetSkeletor)(dtiki_t* tiki, int entNum);
void (*TIKI_SetEyeTargetPos)(dtiki_t* tiki, int entNum, vec3_t pos);
int (*Key_StringToKeynum)(const char *str);
const char *(*Key_KeynumToBindString)(int keyNum);
void (*Key_GetKeysForCommand)(const char *command, int *key1, int *key2);
// ANIM SPECIFIC STUFF
const char * (*Anim_NameForNum) (dtiki_t* tiki, int animnum );
int (*Anim_NumForName) (dtiki_t* tiki, const char * name );
int (*Anim_Random) (dtiki_t* tiki, const char * name );
int (*Anim_NumFrames) (dtiki_t* tiki, int animnum );
float (*Anim_Time) (dtiki_t* tiki, int animnum);
float (*Anim_Frametime) (dtiki_t* tiki, int animnum);
void (*Anim_Delta) (dtiki_t* tiki, int animnum, vec3_t delta );
int (*Anim_Flags) (dtiki_t* tiki, int animnum);
int (*Anim_FlagsSkel) (dtiki_t* tiki, int animnum);
float (*Anim_CrossblendTime) (dtiki_t* tiki, int animnum );
qboolean (*Anim_HasCommands) (dtiki_t* tiki, int animnum );
// ==================== TIKI STUFF ==========================
// TIKI SPECIFIC STUFF
dtiki_t *(*R_Model_GetHandle)(qhandle_t handle);
int (*TIKI_NumAnims)(dtiki_t *pmdl);
void (*TIKI_CalculateBounds)(dtiki_t *pmdl, float scale, vec3_t mins, vec3_t maxs);
const char *(*TIKI_Name)(dtiki_t *tiki);
void *(*TIKI_GetSkeletor)(dtiki_t *tiki, int entNum);
void (*TIKI_SetEyeTargetPos)(dtiki_t *tiki, int entNum, vec3_t pos);
// FRAME SPECIFIC STUFF
qboolean (*Frame_Commands) (dtiki_t* tiki, int animnum, int framenum, tiki_cmd_t * tiki_cmd );
qboolean (*Frame_CommandsTime) (dtiki_t* tiki, int animnum, float start, float end, tiki_cmd_t * tiki_cmd );
// ANIM SPECIFIC STUFF
const char *(*Anim_NameForNum)(dtiki_t *tiki, int animnum);
int (*Anim_NumForName)(dtiki_t *tiki, const char *name);
int (*Anim_Random)(dtiki_t *tiki, const char *name);
int (*Anim_NumFrames)(dtiki_t *tiki, int animnum);
float (*Anim_Time)(dtiki_t *tiki, int animnum);
float (*Anim_Frametime)(dtiki_t *tiki, int animnum);
void (*Anim_Delta)(dtiki_t *tiki, int animnum, vec3_t delta);
int (*Anim_Flags)(dtiki_t *tiki, int animnum);
int (*Anim_FlagsSkel)(dtiki_t *tiki, int animnum);
float (*Anim_CrossblendTime)(dtiki_t *tiki, int animnum);
qboolean (*Anim_HasCommands)(dtiki_t *tiki, int animnum);
// SURFACE SPECIFIC STUFF
int (*Surface_NameToNum) (dtiki_t* tiki, const char * name );
//const char * (*Surface_NumToName) (dtiki_t* tiki, int num );
//int (*Surface_Flags) (dtiki_t* tiki, int num );
//int (*Surface_NumSkins) (dtiki_t* tiki, int num );
// FRAME SPECIFIC STUFF
qboolean (*Frame_Commands)(dtiki_t *tiki, int animnum, int framenum, tiki_cmd_t *tiki_cmd);
qboolean (*Frame_CommandsTime)(dtiki_t *tiki, int animnum, float start, float end, tiki_cmd_t *tiki_cmd);
// TAG SPECIFIC STUFF
int (*Tag_NumForName) (dtiki_t* tiki, const char * name );
const char * (*Tag_NameForNum) (dtiki_t* tiki, int num );
void (*ForceUpdatePose)(refEntity_t* model);
orientation_t (*TIKI_Orientation)(refEntity_t* model, int tagNum);
qboolean (*TIKI_IsOnGround)(refEntity_t* model, int tagNum, float threshold);
// SURFACE SPECIFIC STUFF
int (*Surface_NameToNum)(dtiki_t *tiki, const char *name);
//const char * (*Surface_NumToName) (dtiki_t* tiki, int num );
//int (*Surface_Flags) (dtiki_t* tiki, int num );
//int (*Surface_NumSkins) (dtiki_t* tiki, int num );
// MISCELLANEOUS SPECIFIC STUFF
void (*UI_ShowScoreBoard)(const char* menuName);
void (*UI_HideScoreBoard)();
void (*UI_SetScoreBoardItem)(int itemNumber, const char* data1,
const char* data2, const char* data3,
const char* data4, const char* data5,
const char* data6, const char* data7,
const char* data8, const vec4_t textColor,
const vec4_t backColor, qboolean isHeader);
void (*UI_DeleteScoreBoardItems)(int maxIndex);
void (*UI_ToggleDMMessageConsole)(int consoleMode);
dtiki_t* (*TIKI_FindTiki)(const char* path);
void (*LoadResource)(const char* name);
void (*FS_CanonicalFilename)(char* name);
// TAG SPECIFIC STUFF
int (*Tag_NumForName)(dtiki_t *tiki, const char *name);
const char *(*Tag_NameForNum)(dtiki_t *tiki, int num);
void (*ForceUpdatePose)(refEntity_t *model);
orientation_t (*TIKI_Orientation)(refEntity_t *model, int tagNum);
qboolean (*TIKI_IsOnGround)(refEntity_t *model, int tagNum, float threshold);
cvar_t* fsDebug;
hdelement_t* HudDrawElements;
clientAnim_t* anim;
stopWatch_t* stopWatch;
// MISCELLANEOUS SPECIFIC STUFF
void (*UI_ShowScoreBoard)(const char *menuName);
void (*UI_HideScoreBoard)();
void (*UI_SetScoreBoardItem)(
int itemNumber,
const char *data1,
const char *data2,
const char *data3,
const char *data4,
const char *data5,
const char *data6,
const char *data7,
const char *data8,
const vec4_t textColor,
const vec4_t backColor,
qboolean isHeader
);
void (*UI_DeleteScoreBoardItems)(int maxIndex);
void (*UI_ToggleDMMessageConsole)(int consoleMode);
dtiki_t *(*TIKI_FindTiki)(const char *path);
void (*LoadResource)(const char *name);
void (*FS_CanonicalFilename)(char *name);
} clientGameImport_t;
cvar_t *fsDebug;
hdelement_t *HudDrawElements;
clientAnim_t *anim;
stopWatch_t *stopWatch;
} clientGameImport_t;
/*
/*
==================================================================
functions exported to the main executable
@@ -371,51 +438,74 @@ functions exported to the main executable
==================================================================
*/
typedef struct {
void (*CG_Init)( clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum );
void (*CG_Shutdown)( void );
void (*CG_DrawActiveFrame)( int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback );
qboolean (*CG_ConsoleCommand)( void );
void (*CG_GetRendererConfig)( void );
void (*CG_Draw2D)( void );
void (*CG_EyePosition)(vec3_t* eyePos);
void (*CG_EyeOffset)(vec3_t* eyeOffset);
void (*CG_EyeAngles)(vec3_t* eyeAngles);
float (*CG_SensitivityScale)();
void (*CG_ParseCGMessage)();
void (*CG_RefreshHudDrawElements)();
void (*CG_HudDrawShader)(int info);
void (*CG_HudDrawFont)(int info);
int (*CG_GetParent)(int entNum);
float (*CG_GetObjectiveAlpha)();
int (*CG_PermanentMark)(const vec3_t origin, const vec3_t dir, float orientation, float sScale, float tScale, float red, float green, float blue, float alpha, qboolean doLighting, float sCenter, float tCenter, markFragment_t* markFragments, void* polyVerts);
int (*CG_PermanentTreadMarkDecal)(treadMark_t* treadMark, qboolean startSegment, qboolean doLighting, markFragment_t* markFragments, void* polyVerts);
int (*CG_PermanentUpdateTreadMark)(treadMark_t* treadMark, float alpha, float minSegment, float maxSegment, float maxOffset, float texScale);
void (*CG_ProcessInitCommands)(dtiki_t* tiki, refEntity_t* ent);
void (*CG_EndTiki)(dtiki_t* tiki);
const char* (*CG_GetColumnName)(int columnNum, int* columnWidth);
void (*CG_GetScoreBoardColor)(float* red, float* green, float* blue, float* alpha);
void (*CG_GetScoreBoardFontColor)(float* red, float* green, float* blue, float* alpha);
int (*CG_GetScoreBoardDrawHeader)();
void (*CG_GetScoreBoardPosition)(float* x, float* y, float* width, float* height);
int (*CG_WeaponCommandButtonBits)();
int (*CG_CheckCaptureKey)(int key, qboolean down, unsigned int time);
typedef struct {
void (*CG_Init)(clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum);
void (*CG_Shutdown)(void);
void (*CG_DrawActiveFrame)(int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback);
qboolean (*CG_ConsoleCommand)(void);
void (*CG_GetRendererConfig)(void);
void (*CG_Draw2D)(void);
void (*CG_EyePosition)(vec3_t *eyePos);
void (*CG_EyeOffset)(vec3_t *eyeOffset);
void (*CG_EyeAngles)(vec3_t *eyeAngles);
float (*CG_SensitivityScale)();
void (*CG_ParseCGMessage)();
void (*CG_RefreshHudDrawElements)();
void (*CG_HudDrawShader)(int info);
void (*CG_HudDrawFont)(int info);
int (*CG_GetParent)(int entNum);
float (*CG_GetObjectiveAlpha)();
int (*CG_PermanentMark)(
const vec3_t origin,
const vec3_t dir,
float orientation,
float sScale,
float tScale,
float red,
float green,
float blue,
float alpha,
qboolean doLighting,
float sCenter,
float tCenter,
markFragment_t *markFragments,
void *polyVerts
);
int (*CG_PermanentTreadMarkDecal)(
treadMark_t *treadMark,
qboolean startSegment,
qboolean doLighting,
markFragment_t *markFragments,
void *polyVerts
);
int (*CG_PermanentUpdateTreadMark)(
treadMark_t *treadMark, float alpha, float minSegment, float maxSegment, float maxOffset, float texScale
);
void (*CG_ProcessInitCommands)(dtiki_t *tiki, refEntity_t *ent);
void (*CG_EndTiki)(dtiki_t *tiki);
const char *(*CG_GetColumnName)(int columnNum, int *columnWidth);
void (*CG_GetScoreBoardColor)(float *red, float *green, float *blue, float *alpha);
void (*CG_GetScoreBoardFontColor)(float *red, float *green, float *blue, float *alpha);
int (*CG_GetScoreBoardDrawHeader)();
void (*CG_GetScoreBoardPosition)(float *x, float *y, float *width, float *height);
int (*CG_WeaponCommandButtonBits)();
int (*CG_CheckCaptureKey)(int key, qboolean down, unsigned int time);
// FIXME
//prof_cgame_t* profStruct;
// FIXME
//prof_cgame_t* profStruct;
qboolean (*CG_Command_ProcessFile)(const char* name, qboolean quiet, dtiki_t* curTiki);
qboolean (*CG_Command_ProcessFile)(const char *name, qboolean quiet, dtiki_t *curTiki);
} clientGameExport_t;
} clientGameExport_t;
#ifdef CGAME_DLL
#ifdef WIN32
__declspec(dllexport)
#else
__attribute__((visibility("default")))
# ifdef WIN32
__declspec(dllexport)
# else
__attribute__((visibility("default")))
# endif
#endif
#endif
clientGameExport_t* GetCGameAPI(void);
clientGameExport_t *GetCGameAPI(void);
#ifdef __cplusplus
}
File diff suppressed because it is too large. Load diff
+115 -116
View File
@@ -25,11 +25,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
static const char* IsWeaponAllowed(int dmFlags, int flags) {
static const char *IsWeaponAllowed(int dmFlags, int flags)
{
return (dmFlags & flags) ? "0" : "1";
}
static qboolean QueryLandminesAllowed2(const char* mapname, int dmflags) {
static qboolean QueryLandminesAllowed2(const char *mapname, int dmflags)
{
if (dmflags & DF_WEAPON_NO_LANDMINE) {
return qfalse;
}
@@ -38,43 +40,61 @@ static qboolean QueryLandminesAllowed2(const char* mapname, int dmflags) {
return qtrue;
}
if (!Q_stricmpn(mapname, "obj/obj_", 8u))
return qfalse;
if (!Q_stricmpn(mapname, "dm/mohdm", 8u))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Bahnhof_DM"))
return qfalse;
if (!Q_stricmp(mapname, "obj/MP_Ardennes_TOW"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Bazaar_DM"))
return qfalse;
if (!Q_stricmp(mapname, "obj/MP_Berlin_TOW"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Brest_DM"))
return qfalse;
if (!Q_stricmp(mapname, "obj/MP_Druckkammern_TOW"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Gewitter_DM"))
return qfalse;
if (!Q_stricmp(mapname, "obj/MP_Flughafen_TOW"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Holland_DM"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Malta_DM"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Stadt_DM"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Unterseite_DM"))
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
if (!Q_stricmpn(mapname, "obj/obj_", 8u)) {
return qfalse;
if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
}
if (!Q_stricmpn(mapname, "dm/mohdm", 8u)) {
return qfalse;
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM"))
}
if (!Q_stricmp(mapname, "DM/MP_Bahnhof_DM")) {
return qfalse;
if (!Q_stricmp(mapname, "lib/mp_ship_lib"))
}
if (!Q_stricmp(mapname, "obj/MP_Ardennes_TOW")) {
return qfalse;
return qtrue;
}
if (!Q_stricmp(mapname, "DM/MP_Bazaar_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "obj/MP_Berlin_TOW")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Brest_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "obj/MP_Druckkammern_TOW")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Gewitter_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "obj/MP_Flughafen_TOW")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Holland_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Malta_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Stadt_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Unterseite_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "lib/mp_ship_lib")) {
return qfalse;
}
if (!Q_stricmp(mapname, "DM/MP_Verschneit_DM")) {
return qfalse;
}
if (!Q_stricmp(mapname, "lib/mp_ship_lib")) {
return qfalse;
}
return qtrue;
}
/*
@@ -87,25 +107,25 @@ and whenever the server updates any serverinfo flagged cvars
*/
void CG_ParseServerinfo(void)
{
const char* info;
const char* mapname;
char map[MAX_QPATH];
char* spawnpos;
const char* version;
const char *info;
const char *mapname;
char map[MAX_QPATH];
char *spawnpos;
const char *version;
info = CG_ConfigString(CS_SERVERINFO);
cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype"));
cgs.dmflags = atoi(Info_ValueForKey(info, "dmflags"));
cgs.teamflags = atoi(Info_ValueForKey(info, "teamflags"));
cgs.fraglimit = atoi(Info_ValueForKey(info, "fraglimit"));
cgs.timelimit = atoi(Info_ValueForKey(info, "timelimit"));
info = CG_ConfigString(CS_SERVERINFO);
cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype"));
cgs.dmflags = atoi(Info_ValueForKey(info, "dmflags"));
cgs.teamflags = atoi(Info_ValueForKey(info, "teamflags"));
cgs.fraglimit = atoi(Info_ValueForKey(info, "fraglimit"));
cgs.timelimit = atoi(Info_ValueForKey(info, "timelimit"));
cgs.maxclients = atoi(Info_ValueForKey(info, "sv_maxclients"));
version = Info_ValueForKey(info, "version");
if (strstr(version, "Spearhead")) {
cgi.Cvar_Set("g_servertype", "1");
} else {
cgi.Cvar_Set("g_servertype", "2");
cgi.Cvar_Set("g_servertype", "2");
}
cgi.Cvar_Set("cg_gametype", Info_ValueForKey(info, "g_gametype"));
@@ -142,22 +162,16 @@ void CG_ParseServerinfo(void)
Com_sprintf(cgs.mapname, sizeof(cgs.mapname), "maps/%s.bsp", map);
// hide/show huds
if (cgs.gametype)
{
if (cgs.gametype) {
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_timelimit\n");
if (cgs.fraglimit)
{
if (cgs.fraglimit) {
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_fraglimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n");
}
else
{
} else {
cgi.Cmd_Execute(EXEC_NOW, "ui_addhud hud_score\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n");
}
}
else
{
} else {
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_timelimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_fraglimit\n");
cgi.Cmd_Execute(EXEC_NOW, "ui_removehud hud_score\n");
@@ -219,32 +233,22 @@ CG_Stopwatch_f
================
*/
#if TARGET_GAME_PROTOCOL >= 15
static void CG_Stopwatch_f()
{
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
cgi.stopWatch->iStartTime = atoi(cgi.Argv(1));
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
cgi.stopWatch->iStartTime = atoi(cgi.Argv(1));
} else {
// The base game has it wrong
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
}
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
}
#else
static void CG_Stopwatch_f()
{
if (cgi.Argc() < 3) {
Com_Error(ERR_DROP, "stopwatch didn't have 2 parameters");
}
cgi.stopWatch->iStartTime = 1000 * atoi(cgi.Argv(1));
cgi.stopWatch->iEndTime = cgi.stopWatch->iStartTime + 1000 * atoi(cgi.Argv(2));
}
#endif
/*
================
CG_ServerLag_f
@@ -266,7 +270,7 @@ Cmd_Argc() / Cmd_Argv()
*/
static void CG_ServerCommand(void)
{
const char* cmd;
const char *cmd;
cmd = cgi.Argv(0);
@@ -286,52 +290,47 @@ static void CG_ServerCommand(void)
CG_HudPrint_f();
}
return;
}
else if (!strcmp(cmd, "printdeathmsg")) {
const char* s1, * s2, * s3, * s4, * s5;
const char* result1, * result2;
int hudColor;
} else if (!strcmp(cmd, "printdeathmsg")) {
const char *s1, *s2, *s3, *s4, *s5;
const char *result1, *result2;
int hudColor;
result1 = NULL;
result2 = NULL;
s1 = cgi.Argv(1);
s2 = cgi.Argv(2);
s3 = cgi.Argv(3);
s4 = cgi.Argv(4);
s5 = cgi.Argv(5);
result1 = NULL;
result2 = NULL;
s1 = cgi.Argv(1);
s2 = cgi.Argv(2);
s3 = cgi.Argv(3);
s4 = cgi.Argv(4);
s5 = cgi.Argv(5);
if (*s5 == tolower(*s5)) {
hudColor = 4;
} else {
hudColor = 5;
hudColor = 5;
}
if (*s1 != 'x')
result1 = cgi.LV_ConvertString(s1);
if (*s2 != 'x')
result2 = cgi.LV_ConvertString(s2);
if (tolower(*s5) == 's')
{
cgi.Printf("%c%s %s\n", hudColor, s4, result1);
}
else if (tolower(*s5) == 'p')
{
if (*s2 == 'x')
cgi.Printf("%c%s %s %s\n", hudColor, s4, result1, s3);
else
cgi.Printf("%c%s %s %s%s\n", hudColor, s4, result1, s3, result2);
}
else if (tolower(*s5) == 'w')
{
cgi.Printf("%c%s %s\n", hudColor, s4, result1);
}
else
{
cgi.Printf("%s", cgi.Argv(1));
}
if (*s1 != 'x') {
result1 = cgi.LV_ConvertString(s1);
}
if (*s2 != 'x') {
result2 = cgi.LV_ConvertString(s2);
}
if (tolower(*s5) == 's') {
cgi.Printf("%c%s %s\n", hudColor, s4, result1);
} else if (tolower(*s5) == 'p') {
if (*s2 == 'x') {
cgi.Printf("%c%s %s %s\n", hudColor, s4, result1, s3);
} else {
cgi.Printf("%c%s %s %s%s\n", hudColor, s4, result1, s3, result2);
}
} else if (tolower(*s5) == 'w') {
cgi.Printf("%c%s %s\n", hudColor, s4, result1);
} else {
cgi.Printf("%s", cgi.Argv(1));
}
return;
}
if (!strcmp(cmd, "stufftext")) {
cgi.Cmd_Stuff(cgi.Argv(1));
cgi.Cmd_Stuff("\n");
+50 -64
View File
@@ -32,10 +32,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CG_ResetEntity
==================
*/
static void CG_ResetEntity(centity_t* cent)
static void CG_ResetEntity(centity_t *cent)
{
dtiki_t* tiki;
int i;
dtiki_t *tiki;
int i;
VectorCopy(cent->currentState.origin, cent->lerpOrigin);
@@ -62,7 +62,7 @@ static void CG_ResetEntity(centity_t* cent)
// Reset splash info
cent->splash_last_spawn_time = 0;
cent->splash_still_count = -1;
cent->splash_still_count = -1;
tiki = cgi.R_Model_GetHandle(cgs.model_draw[cent->currentState.modelindex]);
// reset client command
@@ -71,7 +71,7 @@ static void CG_ResetEntity(centity_t* cent)
// reset the animation for the entities
if (tiki && tiki->a->bIsCharacter) {
for (i = 0; i < MAX_FRAMEINFOS; i++) {
cent->animLast[i] = cent->currentState.frameInfo[i].index;
cent->animLast[i] = cent->currentState.frameInfo[i].index;
cent->animLastTimes[i] = cent->currentState.frameInfo[i].time;
if (cent->currentState.frameInfo[i].weight) {
cent->animLastWeight |= 1 << i;
@@ -89,8 +89,8 @@ static void CG_ResetEntity(centity_t* cent)
cent->animLastWeight = 0;
}
cent->usageIndexLast = 0;
cent->bFootOnGround_Left = qtrue;
cent->usageIndexLast = 0;
cent->bFootOnGround_Left = qtrue;
cent->bFootOnGround_Right = qtrue;
if (cent->currentState.eType == ET_PLAYER) {
@@ -105,7 +105,7 @@ CG_TransitionEntity
cent->nextState is moved to cent->currentState and events are fired
===============
*/
static void CG_TransitionEntity(centity_t* cent)
static void CG_TransitionEntity(centity_t *cent)
{
cent->currentState = cent->nextState;
cent->currentValid = qtrue;
@@ -134,11 +134,11 @@ on tourney restarts. All other times will use
CG_TransitionSnapshot instead.
==================
*/
void CG_SetInitialSnapshot(snapshot_t* snap)
void CG_SetInitialSnapshot(snapshot_t *snap)
{
int i;
centity_t* cent;
entityState_t* state;
int i;
centity_t *cent;
entityState_t *state;
cg.snap = snap;
@@ -149,19 +149,17 @@ void CG_SetInitialSnapshot(snapshot_t* snap)
for (i = 0; i < cg.snap->numEntities; i++) {
state = &cg.snap->entities[i];
cent = &cg_entities[state->number];
cent = &cg_entities[state->number];
cent->currentState = *state;
cent->interpolate = qfalse;
cent->interpolate = qfalse;
cent->currentValid = qtrue;
CG_ResetEntity(cent);
}
cgi.MUSIC_UpdateMood(snap->ps.current_music_mood,
snap->ps.fallback_music_mood);
cgi.MUSIC_UpdateVolume(snap->ps.music_volume,
snap->ps.music_volume_fade_time);
cgi.MUSIC_UpdateMood(snap->ps.current_music_mood, snap->ps.fallback_music_mood);
cgi.MUSIC_UpdateVolume(snap->ps.music_volume, snap->ps.music_volume_fade_time);
cgi.S_SetReverb(snap->ps.reverb_type, snap->ps.reverb_level);
}
@@ -174,9 +172,9 @@ The transition point from snap to nextSnap has passed
*/
static void CG_TransitionSnapshot(qboolean differentServer)
{
centity_t* cent;
snapshot_t* oldFrame;
int i;
centity_t *cent;
snapshot_t *oldFrame;
int i;
if (differentServer) {
CG_ServerRestarted();
@@ -187,13 +185,13 @@ static void CG_TransitionSnapshot(qboolean differentServer)
// clear the currentValid flag for all entities in the existing snapshot
for (i = 0; i < cg.snap->numEntities; i++) {
cent = &cg_entities[cg.snap->entities[i].number];
cent = &cg_entities[cg.snap->entities[i].number];
cent->currentValid = qfalse;
}
// move nextSnap to snap and do the transitions
oldFrame = cg.snap;
cg.snap = cg.nextSnap;
cg.snap = cg.nextSnap;
// FAKK: Commented out to make our stuff work
// cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse;
@@ -202,7 +200,7 @@ static void CG_TransitionSnapshot(qboolean differentServer)
cent = &cg_entities[cg.snap->entities[i].number];
if (differentServer) {
cent->interpolate = qfalse;
cent->teleported = qfalse;
cent->teleported = qfalse;
}
CG_TransitionEntity(cent);
}
@@ -220,28 +218,25 @@ static void CG_TransitionSnapshot(qboolean differentServer)
playerState_t *ops, *ps;
ops = &oldFrame->ps;
ps = &cg.snap->ps;
ps = &cg.snap->ps;
// teleporting checks are irrespective of prediction
if (ps->pm_flags & PMF_RESPAWNED) {
cg.thisFrameTeleport = qtrue;
}
if ((ops->music_volume != ps->music_volume) ||
(ops->music_volume_fade_time != ps->music_volume_fade_time)) {
cgi.MUSIC_UpdateVolume(ps->music_volume,
ps->music_volume_fade_time);
if ((ops->music_volume != ps->music_volume) || (ops->music_volume_fade_time != ps->music_volume_fade_time)) {
cgi.MUSIC_UpdateVolume(ps->music_volume, ps->music_volume_fade_time);
}
if ((ops->reverb_type != ps->reverb_type) ||
(ops->reverb_level != ps->reverb_level)) {
if ((ops->reverb_type != ps->reverb_type) || (ops->reverb_level != ps->reverb_level)) {
cgi.S_SetReverb(ps->reverb_type, ps->reverb_level);
}
// if we are not doing client side movement prediction for any
// reason, then the client events and view changes will be issued now
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) ||
cg_nopredict->integer || cg_synchronousClients->integer) {
if (cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_NO_PREDICTION) || cg_nopredict->integer
|| cg_synchronousClients->integer) {
CG_TransitionPlayerState(ps, ops);
}
}
@@ -254,11 +249,11 @@ CG_SetNextSnap
A new snapshot has just been read in from the client system.
===================
*/
static void CG_SetNextSnap(snapshot_t* snap)
static void CG_SetNextSnap(snapshot_t *snap)
{
int num;
entityState_t* es;
centity_t* cent;
int num;
entityState_t *es;
centity_t *cent;
cg.nextSnap = snap;
@@ -266,17 +261,15 @@ static void CG_SetNextSnap(snapshot_t* snap)
// check for extrapolation errors
for (num = 0; num < snap->numEntities; num++) {
es = &snap->entities[num];
es = &snap->entities[num];
cent = &cg_entities[es->number];
cent->nextState = *es;
// if this frame is a teleport, or the entity wasn't in the
// previous frame, don't interpolate
if (!cent->currentValid ||
((cent->currentState.eFlags ^ es->eFlags) & EF_TELEPORT_BIT) ||
(cent->currentState.parent != es->parent) ||
(cent->currentState.modelindex != es->modelindex)) {
if (!cent->currentValid || ((cent->currentState.eFlags ^ es->eFlags) & EF_TELEPORT_BIT)
|| (cent->currentState.parent != es->parent) || (cent->currentState.modelindex != es->modelindex)) {
cent->interpolate = qfalse;
// if this isn't the first frame and we have valid data, set the
// teleport flag
@@ -302,8 +295,7 @@ static void CG_SetNextSnap(snapshot_t* snap)
}
// if the camera cut bit changed, than the next frame is a camera cut
if ((cg.nextSnap->ps.camera_flags & CF_CAMERA_CUT_BIT) !=
(cg.snap->ps.camera_flags & CF_CAMERA_CUT_BIT)) {
if ((cg.nextSnap->ps.camera_flags & CF_CAMERA_CUT_BIT) != (cg.snap->ps.camera_flags & CF_CAMERA_CUT_BIT)) {
cg.nextFrameCameraCut = qtrue;
} else {
cg.nextFrameCameraCut = qfalse;
@@ -329,14 +321,15 @@ times if the client system fails to return a
valid snapshot.
========================
*/
static snapshot_t* CG_ReadNextSnapshot(void)
static snapshot_t *CG_ReadNextSnapshot(void)
{
qboolean r;
snapshot_t* dest;
qboolean r;
snapshot_t *dest;
if (cg.latestSnapshotNum > cgs.processedSnapshotNum + 1000) {
cgi.Error(ERR_DROP, "CG_ReadNextSnapshot: way out of range, %i > %i",
cg.latestSnapshotNum, cgs.processedSnapshotNum);
cgi.Error(
ERR_DROP, "CG_ReadNextSnapshot: way out of range, %i > %i", cg.latestSnapshotNum, cgs.processedSnapshotNum
);
}
while (cgs.processedSnapshotNum < cg.latestSnapshotNum) {
@@ -394,17 +387,16 @@ of an interpolating one)
*/
void CG_ProcessSnapshots(void)
{
snapshot_t* snap;
int n;
qboolean differentServer;
snapshot_t *snap;
int n;
qboolean differentServer;
// see what the latest snapshot the client system has is
cgi.GetCurrentSnapshotNumber(&n, &cg.latestSnapshotTime);
if (n != cg.latestSnapshotNum) {
if (n < cg.latestSnapshotNum) {
// this should never happen
cgi.Error(ERR_DROP,
"CG_ProcessSnapshots: n < cg.latestSnapshotNum");
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: n < cg.latestSnapshotNum");
}
cg.latestSnapshotNum = n;
}
@@ -445,11 +437,8 @@ void CG_ProcessSnapshots(void)
// if time went backwards, we have a level restart
if (cg.nextSnap->serverTime < cg.snap->serverTime) {
// only drop if this is not a restart or loadgame
if (!((cg.nextSnap->snapFlags ^ cg.snap->snapFlags) &
SNAPFLAG_SERVERCOUNT)) {
cgi.Error(
ERR_DROP,
"CG_ProcessSnapshots: Server time went backwards");
if (!((cg.nextSnap->snapFlags ^ cg.snap->snapFlags) & SNAPFLAG_SERVERCOUNT)) {
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: Server time went backwards");
}
}
}
@@ -457,9 +446,7 @@ void CG_ProcessSnapshots(void)
differentServer = cg.snap->serverTime <= cgi.GetServerStartTime();
// if our time is < nextFrame's, we have a nice interpolating state
if (cg.time >= cg.snap->serverTime &&
cg.time < cg.nextSnap->serverTime &&
!differentServer) {
if (cg.time >= cg.snap->serverTime && cg.time < cg.nextSnap->serverTime && !differentServer) {
break;
}
@@ -477,7 +464,6 @@ void CG_ProcessSnapshots(void)
cgi.SetTime(cg.time);
}
if (cg.nextSnap != NULL && cg.nextSnap->serverTime <= cg.time) {
cgi.Error(ERR_DROP,
"CG_ProcessSnapshots: cg.nextSnap->serverTime <= cg.time");
cgi.Error(ERR_DROP, "CG_ProcessSnapshots: cg.nextSnap->serverTime <= cg.time");
}
}
+18 -12
View File
@@ -25,15 +25,21 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
void CG_ProcessSound( server_sound_t *sound )
{
if ( sound->stop_flag )
{
cgi.S_StopSound( sound->entity_number, sound->channel );
}
else
{
cgi.S_StartSound( sound->origin, sound->entity_number, sound->channel, cgs.sound_precache[sound->sound_index],
sound->volume, sound->min_dist, sound->pitch, sound->maxDist, sound->streamed );
}
}
void CG_ProcessSound(server_sound_t *sound)
{
if (sound->stop_flag) {
cgi.S_StopSound(sound->entity_number, sound->channel);
} else {
cgi.S_StartSound(
sound->origin,
sound->entity_number,
sound->channel,
cgs.sound_precache[sound->sound_index],
sound->volume,
sound->min_dist,
sound->pitch,
sound->maxDist,
sound->streamed
);
}
}
File diff suppressed because it is too large. Load diff
+133 -16
View File
@@ -31,11 +31,127 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_SPECIAL_EFFECT_COMMANDS 32
class specialeffectcommand_t : public Class {
typedef enum {
SFX_BHIT_PAPER_LITE,
SFX_BHIT_PAPER_HARD,
SFX_BHIT_WOOD_LITE,
SFX_BHIT_WOOD_HARD,
SFX_BHIT_METAL_LITE,
SFX_BHIT_METAL_HARD,
SFX_BHIT_STONE_LITE,
SFX_BHIT_STONE_HARD,
SFX_BHIT_DIRT_LITE,
SFX_BHIT_DIRT_HARD,
SFX_BHIT_GRILL_LITE,
SFX_BHIT_GRILL_HARD,
SFX_BHIT_GRASS_LITE,
SFX_BHIT_GRASS_HARD,
SFX_BHIT_MUD_LITE,
SFX_BHIT_MUD_HARD,
SFX_BHIT_PUDDLE_LITE,
SFX_BHIT_PUDDLE_HARD,
SFX_BHIT_GLASS_LITE,
SFX_BHIT_GLASS_HARD,
SFX_BHIT_GRAVEL_LITE,
SFX_BHIT_GRAVEL_HARD,
SFX_BHIT_SAND_LITE,
SFX_BHIT_SAND_HARD,
SFX_BHIT_FOLIAGE_LITE,
SFX_BHIT_FOLIAGE_HARD,
SFX_BHIT_SNOW_LITE,
SFX_BHIT_SNOW_HARD,
SFX_BHIT_CARPET_LITE,
SFX_BHIT_CARPET_HARD,
SFX_BHIT_HUMAN_UNIFORM_LITE,
SFX_BHIT_HUMAN_UNIFORM_HARD,
SFX_WATER_TRAIL_BUBBLE,
SFX_VFX_PAPER_LITE,
SFX_VFX_PAPER_HARD,
SFX_VFX_WOOD_LITE,
SFX_VFX_WOOD_HARD,
SFX_VFX_METAL_LITE,
SFX_VFX_METAL_HARD,
SFX_VFX_STONE_LITE,
SFX_VFX_STONE_HARD,
SFX_VFX_DIRT_LITE,
SFX_VFX_DIRT_HARD,
SFX_VFX_GRILL_LITE,
SFX_VFX_GRILL_HARD,
SFX_VFX_GRASS_LITE,
SFX_VFX_GRASS_HARD,
SFX_VFX_MUD_LITE,
SFX_VFX_MUD_HARD,
SFX_VFX_PUDDLE_LITE,
SFX_VFX_PUDDLE_HARD,
SFX_VFX_GLASS_LITE,
SFX_VFX_GLASS_HARD,
SFX_VFX_GRAVEL_LITE,
SFX_VFX_GRAVEL_HARD,
SFX_VFX_SAND_LITE,
SFX_VFX_SAND_HARD,
SFX_VFX_FOLIAGE_LITE,
SFX_VFX_FOLIAGE_HARD,
SFX_VFX_SNOW_LITE,
SFX_VFX_SNOW_HARD,
SFX_VFX_CARPET_LITE,
SFX_VFX_CARPET_HARD,
SFX_EXP_GREN_BASE,
SFX_EXP_BAZOOKA_BASE,
SFX_EXP_HEAVYSHELL_BASE,
SFX_EXP_TANK_BASE,
SFX_EXP_GREN_PAPER,
SFX_EXP_GREN_WOOD,
SFX_EXP_GREN_METAL,
SFX_EXP_GREN_STONE,
SFX_EXP_GREN_DIRT,
SFX_EXP_GREN_GRILL,
SFX_EXP_GREN_GRASS,
SFX_EXP_GREN_MUD,
SFX_EXP_GREN_PUDDLE,
SFX_EXP_GREN_GLASS,
SFX_EXP_GREN_GRAVEL,
SFX_EXP_GREN_SAND,
SFX_EXP_GREN_FOLIAGE,
SFX_EXP_GREN_SNOW,
SFX_EXP_GREN_CARPET,
SFX_EXP_HEAVYSHELL_DIRT,
SFX_EXP_HEAVYSHELL_STONE,
SFX_EXP_HEAVYSHELL_SNOW,
SFX_EXP_TANK_DIRT,
SFX_EXP_TANK_STONE,
SFX_EXP_TANK_SNOW,
SFX_EXP_BAZOOKA_DIRT,
SFX_EXP_BAZOOKA_STONE,
SFX_EXP_BAZOOKA_SNOW,
SFX_WATER_RIPPLE_STILL,
SFX_WATER_RIPPLE_MOVING,
SFX_OIL_LEAK_BIG,
SFX_OIL_LEAK_MEDIUM,
SFX_OIL_LEAK_SMALL,
SFX_OIL_LEAK_SPLAT,
SFX_WATER_LEAK_BIG,
SFX_WATER_LEAK_MEDIUM,
SFX_WATER_LEAK_SMALL,
SFX_WATER_LEAK_SPLAT,
SFX_FOOT_LIGHT_DUST,
SFX_FOOT_HEAVY_DUST,
SFX_FOOT_DIRT,
SFX_FOOT_GRASS,
SFX_FOOT_MUD,
SFX_FOOT_PUDDLE,
SFX_FOOT_SAND,
SFX_FOOT_SNOW,
SFX_FENCE_WOOD,
SFX_TEST_EFFECT,
SFX_COUNT
} SpecialEffects;
class specialeffectcommand_t : public Class
{
public:
spawnthing_t* emitter;
spawnthing_t *emitter;
float fCommandTime;
void (*endfcn)();
void (ClientGameCommandManager::*endfcn)();
Event *pEvent;
public:
@@ -45,39 +161,40 @@ public:
class specialeffect_t : public Class
{
public:
int m_iCommandCount;
specialeffectcommand_t* m_commands[MAX_SPECIAL_EFFECT_COMMANDS];
int m_iCommandCount;
specialeffectcommand_t *m_commands[MAX_SPECIAL_EFFECT_COMMANDS];
public:
specialeffect_t();
specialeffectcommand_t* AddNewCommand();
specialeffectcommand_t *AddNewCommand();
};
#define MAX_SPECIAL_EFFECTS 99
#define SPECIAL_EFFECT_TEST MAX_SPECIAL_EFFECTS - 1
class ClientSpecialEffectsManager : public Listener {
class ClientSpecialEffectsManager : public Listener
{
specialeffect_t m_effects[99];
qboolean m_bEffectsLoaded;
int m_iNumPendingEvents;
qboolean m_bEffectsLoaded;
int m_iNumPendingEvents;
public:
CLASS_PROTOTYPE(ClientSpecialEffectsManager);
private:
void ContinueEffectExecution(Event* ev);
void ContinueEffectExecution(Event *ev);
void ExecuteEffect(int iEffect, int iStartCommand, Vector vPos, Vector vAngles, float axis[3][3]);
public:
ClientSpecialEffectsManager();
void LoadEffects();
qboolean EffectsPending();
void MakeEffect_Normal(int iEffect, Vector vPos, Vector vNormal);
void MakeEffect_Angles(int iEffect, Vector vPos, Vector vAngles);
void MakeEffect_Axis(int iEffect, Vector vPos, float axis[3][3]);
specialeffect_t* GetTestEffectPointer();
void LoadEffects();
qboolean EffectsPending();
void MakeEffect_Normal(int iEffect, Vector vPos, Vector vNormal);
void MakeEffect_Angles(int iEffect, Vector vPos, Vector vAngles);
void MakeEffect_Axis(int iEffect, Vector vPos, float axis[3][3]);
specialeffect_t *GetTestEffectPointer();
};
extern ClientSpecialEffectsManager sfxManager;
+175 -203
View File
@@ -25,256 +25,228 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_commands.h"
swipething_t m_swipes[MAX_SWIPES];
extern int current_entity_number;
swipething_t m_swipes[MAX_SWIPES];
extern int current_entity_number;
extern refEntity_t *current_entity;
extern dtiki_t* current_tiki;
extern centity_t *current_centity;
extern dtiki_t *current_tiki;
extern centity_t *current_centity;
void ClientGameCommandManager::SwipeOn
(
Event *ev
)
void ClientGameCommandManager::SwipeOn(Event *ev)
{
// Make a swipe for this if available
int i;
int freeswipe = -1;
str tagname_start,tagname_end;
qhandle_t shader;
{
// Make a swipe for this if available
int i;
int freeswipe = -1;
str tagname_start, tagname_end;
qhandle_t shader;
if ( ev->NumArgs () != 4 )
return;
if (ev->NumArgs() != 4) {
return;
}
shader = cgi.R_RegisterShader( ev->GetString( 1 ) );
tagname_start = ev->GetString( 2 );
tagname_end = ev->GetString( 3 );
for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i];
shader = cgi.R_RegisterShader(ev->GetString(1));
tagname_start = ev->GetString(2);
tagname_end = ev->GetString(3);
if ( !swipe.enabled ||
(
( swipe.entitynum == current_entity_number ) &&
( tagname_start == swipe.tagname_start ) &&
( tagname_end == swipe.tagname_end ) &&
( shader == swipe.shader )
)
)
{
freeswipe = i;
break;
}
}
for (i = 0; i < MAX_SWIPES; i++) {
swipething_t& swipe = m_swipes[i];
if ( freeswipe == -1 )
return;
if (!swipe.enabled
|| ((swipe.entitynum == current_entity_number) && (tagname_start == swipe.tagname_start)
&& (tagname_end == swipe.tagname_end) && (shader == swipe.shader))) {
freeswipe = i;
break;
}
}
swipething_t &swipe = m_swipes[freeswipe];
if (freeswipe == -1) {
return;
}
if ( !swipe.enabled )
{
swipe.Init ();
swipe.enabled = qtrue;
swipe.entitynum = current_entity_number;
}
swipething_t& swipe = m_swipes[freeswipe];
swipe.shader = cgi.R_RegisterShader( ev->GetString( 1 ) );
swipe.tagname_start = ev->GetString ( 2 );
swipe.tagname_end = ev->GetString ( 3 );
swipe.life = ev->GetFloat ( 4 ) * 1000.f;
if (!swipe.enabled) {
swipe.Init();
swipe.enabled = qtrue;
swipe.entitynum = current_entity_number;
}
if ( current_centity )
current_centity->clientFlags |= CF_UPDATESWIPE;
}
swipe.shader = cgi.R_RegisterShader(ev->GetString(1));
swipe.tagname_start = ev->GetString(2);
swipe.tagname_end = ev->GetString(3);
swipe.life = ev->GetFloat(4) * 1000.f;
void ClientGameCommandManager::SwipeOff
(
Event *ev
)
if (current_centity) {
current_centity->clientFlags |= CF_UPDATESWIPE;
}
}
{
qboolean was_enabled;
int i;
void ClientGameCommandManager::SwipeOff(Event *ev)
was_enabled = qfalse;
for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i];
{
qboolean was_enabled;
int i;
if ( swipe.enabled && swipe.entitynum == current_entity_number )
{
swipe.enabled = qfalse;
was_enabled = qtrue;
}
}
was_enabled = qfalse;
for (i = 0; i < MAX_SWIPES; i++) {
swipething_t& swipe = m_swipes[i];
if ( was_enabled )
{
//cgi.R_SwipeBegin ( 0.f, 0.f, -1 );
//cgi.R_SwipeEnd ();
if (swipe.enabled && swipe.entitynum == current_entity_number) {
swipe.enabled = qfalse;
was_enabled = qtrue;
}
}
if ( current_centity )
current_centity->clientFlags &= ~CF_UPDATESWIPE;
}
}
if (was_enabled) {
//cgi.R_SwipeBegin ( 0.f, 0.f, -1 );
//cgi.R_SwipeEnd ();
void ClientGameCommandManager::Swipe
(
Event *ev
)
if (current_centity) {
current_centity->clientFlags &= ~CF_UPDATESWIPE;
}
}
}
{
// This does a swipe effect on the entity
int i,swipenum;
orientation_t _or;
int tagnum_start,tagnum_end;
qboolean add_cnt_point = qfalse;
vec3_t tmp;
void ClientGameCommandManager::Swipe(Event *ev)
assert(current_entity);
assert(current_tiki);
{
// This does a swipe effect on the entity
int i, swipenum;
orientation_t _or;
int tagnum_start, tagnum_end;
qboolean add_cnt_point = qfalse;
vec3_t tmp;
if (!current_entity || !current_tiki)
{
return;
}
assert(current_entity);
assert(current_tiki);
// Let's find us a new (or current) swipe
for ( swipenum=0; swipenum < MAX_SWIPES; swipenum++ )
{
swipething_t &swipe = m_swipes[swipenum];
if (!current_entity || !current_tiki) {
return;
}
if ( swipe.enabled && swipe.entitynum == current_entity_number )
{
while ( swipe.num_live_swipes > 1 )
{
i = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
swipepoint_t &swipepoint = swipe.swipepoints[i];
// Let's find us a new (or current) swipe
for (swipenum = 0; swipenum < MAX_SWIPES; swipenum++) {
swipething_t& swipe = m_swipes[swipenum];
if ( swipepoint.time < cg.time - swipe.life )
{
// then let's delete the previous
swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
swipe.num_live_swipes--;
}
else
{
break;
}
if (swipe.enabled && swipe.entitynum == current_entity_number) {
while (swipe.num_live_swipes > 1) {
i = (swipe.first_swipe + 1) % MAX_SWIPE_POINTS;
swipepoint_t& swipepoint = swipe.swipepoints[i];
if (swipepoint.time < cg.time - swipe.life) {
// then let's delete the previous
swipe.first_swipe = (swipe.first_swipe + 1) % MAX_SWIPE_POINTS;
swipe.num_live_swipes--;
} else {
break;
}
}
if ( swipe.num_live_swipes == 1 )
{
swipepoint_t &swipepoint = swipe.swipepoints[swipe.first_swipe];
if ( swipepoint.time < cg.time - swipe.life )
{
swipe.num_live_swipes = 0;
}
if (swipe.num_live_swipes == 1) {
swipepoint_t& swipepoint = swipe.swipepoints[swipe.first_swipe];
if (swipepoint.time < cg.time - swipe.life) {
swipe.num_live_swipes = 0;
}
}
swipe.cntPoint.time = cg.time;
VectorCopy ( current_entity->origin, swipe.cntPoint.points[0] );
swipe.cntPoint.time = cg.time;
VectorCopy(current_entity->origin, swipe.cntPoint.points[0]);
tagnum_start = cgi.Tag_NumForName( current_tiki, swipe.tagname_start.c_str() );
_or = cgi.TIKI_Orientation(current_entity, tagnum_start);
tagnum_start = cgi.Tag_NumForName(current_tiki, swipe.tagname_start.c_str());
_or = cgi.TIKI_Orientation(current_entity, tagnum_start);
// Clear out the points
VectorClear ( tmp );
VectorClear ( swipe.cntPoint.points[0] );
VectorClear ( swipe.cntPoint.points[1] );
// Clear out the points
VectorClear(tmp);
VectorClear(swipe.cntPoint.points[0]);
VectorClear(swipe.cntPoint.points[1]);
if ( ev->NumArgs() > 0 )
VectorCopy( ev->GetVector( 1 ), tmp );
else
VectorCopy ( current_entity->origin, tmp );
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for ( i = 0; i < 3; i++ )
{
VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp );
if (ev->NumArgs() > 0) {
VectorCopy(ev->GetVector(1), tmp);
} else {
VectorCopy(current_entity->origin, tmp);
}
// Copy tmp into the startpoint
VectorCopy ( tmp, swipe.cntPoint.points[0] );
tagnum_end = cgi.Tag_NumForName( current_tiki, swipe.tagname_end.c_str() );
_or = cgi.TIKI_Orientation(current_entity, tagnum_end);
if ( ev->NumArgs() > 0 )
VectorCopy( ev->GetVector( 1 ), tmp );
else
VectorCopy ( current_entity->origin, tmp );
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for ( i = 0; i < 3; i++ )
{
VectorMA ( tmp, _or.origin[i], current_entity->axis[i], tmp );
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for (i = 0; i < 3; i++) {
VectorMA(tmp, _or.origin[i], current_entity->axis[i], tmp);
}
// Copy tmp into the startpoint
VectorCopy ( tmp, swipe.cntPoint.points[1] );
// Copy tmp into the startpoint
VectorCopy(tmp, swipe.cntPoint.points[0]);
if ( swipe.num_live_swipes == 0 )
add_cnt_point = qtrue;
else
{
float deltime = swipe.life / float ( MAX_SWIPES );
swipepoint_t &lastpoint = swipe.swipepoints[ ( swipe.first_swipe + swipe.num_live_swipes - 1 ) % MAX_SWIPE_POINTS];
tagnum_end = cgi.Tag_NumForName(current_tiki, swipe.tagname_end.c_str());
_or = cgi.TIKI_Orientation(current_entity, tagnum_end);
if ( swipe.cntPoint.time - lastpoint.time >= deltime )
add_cnt_point = qtrue;
if (ev->NumArgs() > 0) {
VectorCopy(ev->GetVector(1), tmp);
} else {
VectorCopy(current_entity->origin, tmp);
}
cgi.R_SwipeBegin ( cg.time, swipe.life, swipe.shader );
if ( add_cnt_point )
{
swipepoint_t &swipepoint = swipe.swipepoints[ ( swipe.first_swipe + swipe.num_live_swipes ) % MAX_SWIPE_POINTS];
swipepoint = swipe.cntPoint;
if ( swipe.num_live_swipes == MAX_SWIPE_POINTS )
swipe.first_swipe = ( swipe.first_swipe + 1 ) % MAX_SWIPE_POINTS;
else
swipe.num_live_swipes++;
// Transform the origin of the tag by the axis of the entity and add it to the origin of the entity
for (i = 0; i < 3; i++) {
VectorMA(tmp, _or.origin[i], current_entity->axis[i], tmp);
}
for ( i = 0; i != swipe.num_live_swipes; i++ )
{
swipepoint_t &swipepoint = swipe.swipepoints[ ( swipe.first_swipe + i ) % MAX_SWIPE_POINTS];
// Copy tmp into the startpoint
VectorCopy(tmp, swipe.cntPoint.points[1]);
cgi.R_SwipePoint ( swipepoint.points[0], swipepoint.points[1], swipepoint.time );
if (swipe.num_live_swipes == 0) {
add_cnt_point = qtrue;
} else {
float deltime = swipe.life / float(MAX_SWIPES);
swipepoint_t& lastpoint =
swipe.swipepoints[(swipe.first_swipe + swipe.num_live_swipes - 1) % MAX_SWIPE_POINTS];
if (swipe.cntPoint.time - lastpoint.time >= deltime) {
add_cnt_point = qtrue;
}
}
if ( !add_cnt_point )
cgi.R_SwipePoint ( swipe.cntPoint.points[0], swipe.cntPoint.points[1], swipe.cntPoint.time );
cgi.R_SwipeBegin(cg.time, swipe.life, swipe.shader);
cgi.R_SwipeEnd ();
}
}
}
if (add_cnt_point) {
swipepoint_t& swipepoint =
swipe.swipepoints[(swipe.first_swipe + swipe.num_live_swipes) % MAX_SWIPE_POINTS];
void ClientGameCommandManager::ClearSwipes
(
void
)
swipepoint = swipe.cntPoint;
{
int i;
if (swipe.num_live_swipes == MAX_SWIPE_POINTS) {
swipe.first_swipe = (swipe.first_swipe + 1) % MAX_SWIPE_POINTS;
} else {
swipe.num_live_swipes++;
}
}
for ( i=0; i < MAX_SWIPES; i++ )
{
swipething_t &swipe = m_swipes[i];
for (i = 0; i != swipe.num_live_swipes; i++) {
swipepoint_t& swipepoint = swipe.swipepoints[(swipe.first_swipe + i) % MAX_SWIPE_POINTS];
swipe.enabled = qfalse;
}
cgi.R_SwipePoint(swipepoint.points[0], swipepoint.points[1], swipepoint.time);
}
cgi.R_SwipeBegin ( 0.f, 0.f, -1 );
cgi.R_SwipeEnd ();
}
if (!add_cnt_point) {
cgi.R_SwipePoint(swipe.cntPoint.points[0], swipe.cntPoint.points[1], swipe.cntPoint.time);
}
cgi.R_SwipeEnd();
}
}
}
void ClientGameCommandManager::ClearSwipes(void)
{
int i;
for (i = 0; i < MAX_SWIPES; i++) {
swipething_t& swipe = m_swipes[i];
swipe.enabled = qfalse;
}
cgi.R_SwipeBegin(0.f, 0.f, -1);
cgi.R_SwipeEnd();
}
/*
===================
@@ -283,7 +255,7 @@ CG_ClearSwipes
This is called at startup and for tournement restarts
===================
*/
void CG_ClearSwipes( void )
{
commandManager.ClearSwipes();
}
void CG_ClearSwipes(void)
{
commandManager.ClearSwipes();
}
File diff suppressed because it is too large. Load diff
+276 -274
View File
@@ -26,103 +26,103 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_commands.h"
#include "cg_specialfx.h"
cvar_t* cg_te_alpha;
cvar_t* cg_te_dietouch;
cvar_t* cg_te_bouncefactor;
cvar_t* cg_te_scale;
cvar_t* cg_te_scalemin;
cvar_t* cg_te_scalemax;
cvar_t* cg_te_model;
cvar_t* cg_te_life;
cvar_t* cg_te_color_r;
cvar_t* cg_te_color_g;
cvar_t* cg_te_color_b;
cvar_t* cg_te_accel_x;
cvar_t* cg_te_accel_y;
cvar_t* cg_te_accel_z;
cvar_t* cg_te_count;
cvar_t* cg_te_fade;
cvar_t* cg_te_fadedelay;
cvar_t* cg_te_fadein;
cvar_t* cg_te_spawnrate;
cvar_t* cg_te_offsbase_x;
cvar_t* cg_te_offsbase_y;
cvar_t* cg_te_offsbase_z;
cvar_t* cg_te_offsamp_x;
cvar_t* cg_te_offsamp_y;
cvar_t* cg_te_offsamp_z;
cvar_t* cg_te_scalerate;
cvar_t* cg_te_circle;
cvar_t* cg_te_sphere;
cvar_t* cg_te_insphere;
cvar_t* cg_te_radius;
cvar_t* cg_te_align;
cvar_t* cg_te_flickeralpha;
cvar_t* cg_te_collision;
cvar_t* cg_te_randomroll;
cvar_t* cg_te_anglesbase_p;
cvar_t* cg_te_anglesbase_y;
cvar_t* cg_te_anglesbase_r;
cvar_t* cg_te_anglesamp_p;
cvar_t* cg_te_anglesamp_y;
cvar_t* cg_te_anglesamp_r;
cvar_t* cg_te_forwardvel;
cvar_t* cg_te_randvelbase_x;
cvar_t* cg_te_randvelbase_y;
cvar_t* cg_te_randvelbase_z;
cvar_t* cg_te_randvelamp_x;
cvar_t* cg_te_randvelamp_y;
cvar_t* cg_te_randvelamp_z;
cvar_t* cg_te_clampvelmin_x;
cvar_t* cg_te_clampvelmax_x;
cvar_t* cg_te_clampvelmin_y;
cvar_t* cg_te_clampvelmax_y;
cvar_t* cg_te_clampvelmin_z;
cvar_t* cg_te_clampvelmax_z;
cvar_t* cg_te_clampvelaxis;
cvar_t* cg_te_volumetric;
cvar_t* cg_te_randaxis;
cvar_t* cg_te_axisoffsbase_x;
cvar_t* cg_te_axisoffsbase_y;
cvar_t* cg_te_axisoffsbase_z;
cvar_t* cg_te_axisoffsamp_x;
cvar_t* cg_te_axisoffsamp_y;
cvar_t* cg_te_axisoffsamp_z;
cvar_t* cg_te_swarm_freq;
cvar_t* cg_te_swarm_maxspeed;
cvar_t* cg_te_swarm_delta;
cvar_t* cg_te_avelbase_p;
cvar_t* cg_te_avelbase_y;
cvar_t* cg_te_avelbase_r;
cvar_t* cg_te_avelamp_p;
cvar_t* cg_te_avelamp_y;
cvar_t* cg_te_avelamp_r;
cvar_t* cg_te_radial_scale;
cvar_t* cg_te_radial_min;
cvar_t* cg_te_radial_max;
cvar_t* cg_te_friction;
cvar_t* cg_te_varycolor;
cvar_t* cg_te_spritegridlighting;
cvar_t* cg_te_cone_height;
cvar_t* cg_te_alignstretch_scale;
cvar_t* cg_te_spawnrange_a;
cvar_t* cg_te_spawnrange_b;
cvar_t* cg_te_command_time;
cvar_t* cg_te_singlelinecommand;
cvar_t* cg_te_tag;
cvar_t* cg_te_xangles;
cvar_t* cg_te_yangles;
cvar_t* cg_te_zangles;
cvar_t *cg_te_alpha;
cvar_t *cg_te_dietouch;
cvar_t *cg_te_bouncefactor;
cvar_t *cg_te_scale;
cvar_t *cg_te_scalemin;
cvar_t *cg_te_scalemax;
cvar_t *cg_te_model;
cvar_t *cg_te_life;
cvar_t *cg_te_color_r;
cvar_t *cg_te_color_g;
cvar_t *cg_te_color_b;
cvar_t *cg_te_accel_x;
cvar_t *cg_te_accel_y;
cvar_t *cg_te_accel_z;
cvar_t *cg_te_count;
cvar_t *cg_te_fade;
cvar_t *cg_te_fadedelay;
cvar_t *cg_te_fadein;
cvar_t *cg_te_spawnrate;
cvar_t *cg_te_offsbase_x;
cvar_t *cg_te_offsbase_y;
cvar_t *cg_te_offsbase_z;
cvar_t *cg_te_offsamp_x;
cvar_t *cg_te_offsamp_y;
cvar_t *cg_te_offsamp_z;
cvar_t *cg_te_scalerate;
cvar_t *cg_te_circle;
cvar_t *cg_te_sphere;
cvar_t *cg_te_insphere;
cvar_t *cg_te_radius;
cvar_t *cg_te_align;
cvar_t *cg_te_flickeralpha;
cvar_t *cg_te_collision;
cvar_t *cg_te_randomroll;
cvar_t *cg_te_anglesbase_p;
cvar_t *cg_te_anglesbase_y;
cvar_t *cg_te_anglesbase_r;
cvar_t *cg_te_anglesamp_p;
cvar_t *cg_te_anglesamp_y;
cvar_t *cg_te_anglesamp_r;
cvar_t *cg_te_forwardvel;
cvar_t *cg_te_randvelbase_x;
cvar_t *cg_te_randvelbase_y;
cvar_t *cg_te_randvelbase_z;
cvar_t *cg_te_randvelamp_x;
cvar_t *cg_te_randvelamp_y;
cvar_t *cg_te_randvelamp_z;
cvar_t *cg_te_clampvelmin_x;
cvar_t *cg_te_clampvelmax_x;
cvar_t *cg_te_clampvelmin_y;
cvar_t *cg_te_clampvelmax_y;
cvar_t *cg_te_clampvelmin_z;
cvar_t *cg_te_clampvelmax_z;
cvar_t *cg_te_clampvelaxis;
cvar_t *cg_te_volumetric;
cvar_t *cg_te_randaxis;
cvar_t *cg_te_axisoffsbase_x;
cvar_t *cg_te_axisoffsbase_y;
cvar_t *cg_te_axisoffsbase_z;
cvar_t *cg_te_axisoffsamp_x;
cvar_t *cg_te_axisoffsamp_y;
cvar_t *cg_te_axisoffsamp_z;
cvar_t *cg_te_swarm_freq;
cvar_t *cg_te_swarm_maxspeed;
cvar_t *cg_te_swarm_delta;
cvar_t *cg_te_avelbase_p;
cvar_t *cg_te_avelbase_y;
cvar_t *cg_te_avelbase_r;
cvar_t *cg_te_avelamp_p;
cvar_t *cg_te_avelamp_y;
cvar_t *cg_te_avelamp_r;
cvar_t *cg_te_radial_scale;
cvar_t *cg_te_radial_min;
cvar_t *cg_te_radial_max;
cvar_t *cg_te_friction;
cvar_t *cg_te_varycolor;
cvar_t *cg_te_spritegridlighting;
cvar_t *cg_te_cone_height;
cvar_t *cg_te_alignstretch_scale;
cvar_t *cg_te_spawnrange_a;
cvar_t *cg_te_spawnrange_b;
cvar_t *cg_te_command_time;
cvar_t *cg_te_singlelinecommand;
cvar_t *cg_te_tag;
cvar_t *cg_te_xangles;
cvar_t *cg_te_yangles;
cvar_t *cg_te_zangles;
class specialeffect_t;
refEntity_t te_refEnt;
cvar_t* cg_te_emittermodel;
cvar_t* cg_te_mode;
cvar_t* cg_te_mode_name;
cvar_t* cg_te_currCommand;
cvar_t* cg_te_numCommands;
float te_vEmitterOrigin[3];
int te_iNumCommands;
int te_iCurrCommand;
refEntity_t te_refEnt;
cvar_t *cg_te_emittermodel;
cvar_t *cg_te_mode;
cvar_t *cg_te_mode_name;
cvar_t *cg_te_currCommand;
cvar_t *cg_te_numCommands;
float te_vEmitterOrigin[3];
int te_iNumCommands;
int te_iCurrCommand;
specialeffect_t *pTesteffect;
#define MAX_TESTEMITTERS_SAVE 32
@@ -212,94 +212,94 @@ str cg_te_command_timeG[MAX_TESTEMITTERS_SAVE];
str cg_te_singlelinecommandG[MAX_TESTEMITTERS_SAVE];
str cg_te_tagG[MAX_TESTEMITTERS_SAVE];
spawnthing_t* testspawnthing = NULL;
spawnthing_t *testspawnthing = NULL;
void CG_SaveEffectCommandCvars(int iCommand)
{
cg_te_alphaG[iCommand] = cg_te_alpha->string;
cg_te_dietouchG[iCommand] = cg_te_dietouch->string;
cg_te_bouncefactorG[iCommand] = cg_te_bouncefactor->string;
cg_te_scaleG[iCommand] = cg_te_scale->string;
cg_te_scaleminG[iCommand] = cg_te_scalemin->string;
cg_te_scalemaxG[iCommand] = cg_te_scalemax->string;
cg_te_modelG[iCommand] = cg_te_model->string;
cg_te_lifeG[iCommand] = cg_te_life->string;
cg_te_color_rG[iCommand] = cg_te_color_r->string;
cg_te_color_gG[iCommand] = cg_te_color_g->string;
cg_te_color_bG[iCommand] = cg_te_color_b->string;
cg_te_accel_xG[iCommand] = cg_te_accel_x->string;
cg_te_accel_yG[iCommand] = cg_te_accel_y->string;
cg_te_accel_zG[iCommand] = cg_te_accel_z->string;
cg_te_countG[iCommand] = cg_te_count->string;
cg_te_fadeG[iCommand] = cg_te_fade->string;
cg_te_fadedelayG[iCommand] = cg_te_fadedelay->string;
cg_te_fadeinG[iCommand] = cg_te_fadein->string;
cg_te_spawnrateG[iCommand] = cg_te_spawnrate->string;
cg_te_offsbase_xG[iCommand] = cg_te_offsbase_x->string;
cg_te_offsbase_yG[iCommand] = cg_te_offsbase_y->string;
cg_te_offsbase_zG[iCommand] = cg_te_offsbase_z->string;
cg_te_offsamp_xG[iCommand] = cg_te_offsamp_x->string;
cg_te_offsamp_yG[iCommand] = cg_te_offsamp_y->string;
cg_te_offsamp_zG[iCommand] = cg_te_offsamp_z->string;
cg_te_scalerateG[iCommand] = cg_te_scalerate->string;
cg_te_circleG[iCommand] = cg_te_circle->string;
cg_te_sphereG[iCommand] = cg_te_sphere->string;
cg_te_insphereG[iCommand] = cg_te_insphere->string;
cg_te_radiusG[iCommand] = cg_te_radius->string;
cg_te_alignG[iCommand] = cg_te_align->string;
cg_te_flickeralphaG[iCommand] = cg_te_flickeralpha->string;
cg_te_collisionG[iCommand] = cg_te_collision->string;
cg_te_randomrollG[iCommand] = cg_te_randomroll->string;
cg_te_anglesbase_pG[iCommand] = cg_te_anglesbase_p->string;
cg_te_anglesbase_yG[iCommand] = cg_te_anglesbase_y->string;
cg_te_anglesbase_rG[iCommand] = cg_te_anglesbase_r->string;
cg_te_anglesamp_pG[iCommand] = cg_te_anglesamp_p->string;
cg_te_anglesamp_yG[iCommand] = cg_te_anglesamp_y->string;
cg_te_anglesamp_rG[iCommand] = cg_te_anglesamp_r->string;
cg_te_forwardvelG[iCommand] = cg_te_forwardvel->string;
cg_te_randvelbase_xG[iCommand] = cg_te_randvelbase_x->string;
cg_te_randvelbase_yG[iCommand] = cg_te_randvelbase_y->string;
cg_te_randvelbase_zG[iCommand] = cg_te_randvelbase_z->string;
cg_te_randvelamp_xG[iCommand] = cg_te_randvelamp_x->string;
cg_te_randvelamp_yG[iCommand] = cg_te_randvelamp_y->string;
cg_te_randvelamp_zG[iCommand] = cg_te_randvelamp_z->string;
cg_te_clampvelmin_xG[iCommand] = cg_te_clampvelmin_x->string;
cg_te_clampvelmax_xG[iCommand] = cg_te_clampvelmax_x->string;
cg_te_clampvelmin_yG[iCommand] = cg_te_clampvelmin_y->string;
cg_te_clampvelmax_yG[iCommand] = cg_te_clampvelmax_y->string;
cg_te_clampvelmin_zG[iCommand] = cg_te_clampvelmin_z->string;
cg_te_clampvelmax_zG[iCommand] = cg_te_clampvelmax_z->string;
cg_te_clampvelaxisG[iCommand] = cg_te_clampvelaxis->string;
cg_te_volumetricG[iCommand] = cg_te_volumetric->string;
cg_te_randaxisG[iCommand] = cg_te_randaxis->string;
cg_te_axisoffsbase_xG[iCommand] = cg_te_axisoffsbase_x->string;
cg_te_axisoffsbase_yG[iCommand] = cg_te_axisoffsbase_y->string;
cg_te_axisoffsbase_zG[iCommand] = cg_te_axisoffsbase_z->string;
cg_te_axisoffsamp_xG[iCommand] = cg_te_axisoffsamp_x->string;
cg_te_axisoffsamp_yG[iCommand] = cg_te_axisoffsamp_y->string;
cg_te_axisoffsamp_zG[iCommand] = cg_te_axisoffsamp_z->string;
cg_te_swarm_freqG[iCommand] = cg_te_swarm_freq->string;
cg_te_swarm_maxspeedG[iCommand] = cg_te_swarm_maxspeed->string;
cg_te_swarm_deltaG[iCommand] = cg_te_swarm_delta->string;
cg_te_avelbase_pG[iCommand] = cg_te_avelbase_p->string;
cg_te_avelbase_yG[iCommand] = cg_te_avelbase_y->string;
cg_te_avelbase_rG[iCommand] = cg_te_avelbase_r->string;
cg_te_avelamp_pG[iCommand] = cg_te_avelamp_p->string;
cg_te_avelamp_yG[iCommand] = cg_te_avelamp_y->string;
cg_te_avelamp_rG[iCommand] = cg_te_avelamp_r->string;
cg_te_radial_scaleG[iCommand] = cg_te_radial_scale->string;
cg_te_radial_minG[iCommand] = cg_te_radial_min->string;
cg_te_radial_maxG[iCommand] = cg_te_radial_max->string;
cg_te_frictionG[iCommand] = cg_te_friction->string;
cg_te_varycolorG[iCommand] = cg_te_varycolor->string;
cg_te_alphaG[iCommand] = cg_te_alpha->string;
cg_te_dietouchG[iCommand] = cg_te_dietouch->string;
cg_te_bouncefactorG[iCommand] = cg_te_bouncefactor->string;
cg_te_scaleG[iCommand] = cg_te_scale->string;
cg_te_scaleminG[iCommand] = cg_te_scalemin->string;
cg_te_scalemaxG[iCommand] = cg_te_scalemax->string;
cg_te_modelG[iCommand] = cg_te_model->string;
cg_te_lifeG[iCommand] = cg_te_life->string;
cg_te_color_rG[iCommand] = cg_te_color_r->string;
cg_te_color_gG[iCommand] = cg_te_color_g->string;
cg_te_color_bG[iCommand] = cg_te_color_b->string;
cg_te_accel_xG[iCommand] = cg_te_accel_x->string;
cg_te_accel_yG[iCommand] = cg_te_accel_y->string;
cg_te_accel_zG[iCommand] = cg_te_accel_z->string;
cg_te_countG[iCommand] = cg_te_count->string;
cg_te_fadeG[iCommand] = cg_te_fade->string;
cg_te_fadedelayG[iCommand] = cg_te_fadedelay->string;
cg_te_fadeinG[iCommand] = cg_te_fadein->string;
cg_te_spawnrateG[iCommand] = cg_te_spawnrate->string;
cg_te_offsbase_xG[iCommand] = cg_te_offsbase_x->string;
cg_te_offsbase_yG[iCommand] = cg_te_offsbase_y->string;
cg_te_offsbase_zG[iCommand] = cg_te_offsbase_z->string;
cg_te_offsamp_xG[iCommand] = cg_te_offsamp_x->string;
cg_te_offsamp_yG[iCommand] = cg_te_offsamp_y->string;
cg_te_offsamp_zG[iCommand] = cg_te_offsamp_z->string;
cg_te_scalerateG[iCommand] = cg_te_scalerate->string;
cg_te_circleG[iCommand] = cg_te_circle->string;
cg_te_sphereG[iCommand] = cg_te_sphere->string;
cg_te_insphereG[iCommand] = cg_te_insphere->string;
cg_te_radiusG[iCommand] = cg_te_radius->string;
cg_te_alignG[iCommand] = cg_te_align->string;
cg_te_flickeralphaG[iCommand] = cg_te_flickeralpha->string;
cg_te_collisionG[iCommand] = cg_te_collision->string;
cg_te_randomrollG[iCommand] = cg_te_randomroll->string;
cg_te_anglesbase_pG[iCommand] = cg_te_anglesbase_p->string;
cg_te_anglesbase_yG[iCommand] = cg_te_anglesbase_y->string;
cg_te_anglesbase_rG[iCommand] = cg_te_anglesbase_r->string;
cg_te_anglesamp_pG[iCommand] = cg_te_anglesamp_p->string;
cg_te_anglesamp_yG[iCommand] = cg_te_anglesamp_y->string;
cg_te_anglesamp_rG[iCommand] = cg_te_anglesamp_r->string;
cg_te_forwardvelG[iCommand] = cg_te_forwardvel->string;
cg_te_randvelbase_xG[iCommand] = cg_te_randvelbase_x->string;
cg_te_randvelbase_yG[iCommand] = cg_te_randvelbase_y->string;
cg_te_randvelbase_zG[iCommand] = cg_te_randvelbase_z->string;
cg_te_randvelamp_xG[iCommand] = cg_te_randvelamp_x->string;
cg_te_randvelamp_yG[iCommand] = cg_te_randvelamp_y->string;
cg_te_randvelamp_zG[iCommand] = cg_te_randvelamp_z->string;
cg_te_clampvelmin_xG[iCommand] = cg_te_clampvelmin_x->string;
cg_te_clampvelmax_xG[iCommand] = cg_te_clampvelmax_x->string;
cg_te_clampvelmin_yG[iCommand] = cg_te_clampvelmin_y->string;
cg_te_clampvelmax_yG[iCommand] = cg_te_clampvelmax_y->string;
cg_te_clampvelmin_zG[iCommand] = cg_te_clampvelmin_z->string;
cg_te_clampvelmax_zG[iCommand] = cg_te_clampvelmax_z->string;
cg_te_clampvelaxisG[iCommand] = cg_te_clampvelaxis->string;
cg_te_volumetricG[iCommand] = cg_te_volumetric->string;
cg_te_randaxisG[iCommand] = cg_te_randaxis->string;
cg_te_axisoffsbase_xG[iCommand] = cg_te_axisoffsbase_x->string;
cg_te_axisoffsbase_yG[iCommand] = cg_te_axisoffsbase_y->string;
cg_te_axisoffsbase_zG[iCommand] = cg_te_axisoffsbase_z->string;
cg_te_axisoffsamp_xG[iCommand] = cg_te_axisoffsamp_x->string;
cg_te_axisoffsamp_yG[iCommand] = cg_te_axisoffsamp_y->string;
cg_te_axisoffsamp_zG[iCommand] = cg_te_axisoffsamp_z->string;
cg_te_swarm_freqG[iCommand] = cg_te_swarm_freq->string;
cg_te_swarm_maxspeedG[iCommand] = cg_te_swarm_maxspeed->string;
cg_te_swarm_deltaG[iCommand] = cg_te_swarm_delta->string;
cg_te_avelbase_pG[iCommand] = cg_te_avelbase_p->string;
cg_te_avelbase_yG[iCommand] = cg_te_avelbase_y->string;
cg_te_avelbase_rG[iCommand] = cg_te_avelbase_r->string;
cg_te_avelamp_pG[iCommand] = cg_te_avelamp_p->string;
cg_te_avelamp_yG[iCommand] = cg_te_avelamp_y->string;
cg_te_avelamp_rG[iCommand] = cg_te_avelamp_r->string;
cg_te_radial_scaleG[iCommand] = cg_te_radial_scale->string;
cg_te_radial_minG[iCommand] = cg_te_radial_min->string;
cg_te_radial_maxG[iCommand] = cg_te_radial_max->string;
cg_te_frictionG[iCommand] = cg_te_friction->string;
cg_te_varycolorG[iCommand] = cg_te_varycolor->string;
cg_te_spritegridlightingG[iCommand] = cg_te_spritegridlighting->string;
cg_te_spawnrange_aG[iCommand] = cg_te_spawnrange_a->string;
cg_te_spawnrange_bG[iCommand] = cg_te_spawnrange_b->string;
cg_te_cone_heightG[iCommand] = cg_te_cone_height->string;
cg_te_spawnrange_aG[iCommand] = cg_te_spawnrange_a->string;
cg_te_spawnrange_bG[iCommand] = cg_te_spawnrange_b->string;
cg_te_cone_heightG[iCommand] = cg_te_cone_height->string;
cg_te_alignstretch_scaleG[iCommand] = cg_te_alignstretch_scale->string;
cg_te_command_timeG[iCommand] = cg_te_command_time->string;
cg_te_singlelinecommandG[iCommand] = cg_te_singlelinecommand->string;
cg_te_tagG[iCommand] = cg_te_tag->string;
cg_te_command_timeG[iCommand] = cg_te_command_time->string;
cg_te_singlelinecommandG[iCommand] = cg_te_singlelinecommand->string;
cg_te_tagG[iCommand] = cg_te_tag->string;
}
void CG_ResetEffectCommandCvars()
@@ -327,7 +327,7 @@ void CG_TriggerTestEmitter_f(void)
// FIXME: unimplemented
}
void CG_DumpBaseAndAmplitude(str* buff, char* prefix, Vector* base, Vector* amplitude)
void CG_DumpBaseAndAmplitude(str *buff, char *prefix, Vector *base, Vector *amplitude)
{
// FIXME: unimplemented
}
@@ -337,7 +337,9 @@ void CG_DumpEmitter_f(void)
// FIXME: unimplemented
}
void CG_LoadBaseAndAmplitude(char** pBufer, char* szCvarX, char* szCvarY, char* szCvarZ, char* szCvarXAmp, char* szCvarYAmp, char* szCvarZAmp)
void CG_LoadBaseAndAmplitude(
char **pBufer, char *szCvarX, char *szCvarY, char *szCvarZ, char *szCvarXAmp, char *szCvarYAmp, char *szCvarZAmp
)
{
// FIXME: unimplemented
}
@@ -374,111 +376,111 @@ void CG_DeleteEmitterCommand_f(void)
void CG_InitTestEmitter(void)
{
cg_te_life = cgi.Cvar_Get("cg_te_life", "1", 0);
cg_te_alpha = cgi.Cvar_Get("cg_te_alpha", "1", 0);
cg_te_dietouch = cgi.Cvar_Get("cg_te_dietouch", "0", 0);
cg_te_bouncefactor = cgi.Cvar_Get("cg_te_bouncefactor", "0.3", 0);
cg_te_scale = cgi.Cvar_Get("cg_te_scale", "1", 0);
cg_te_scalemin = cgi.Cvar_Get("cg_te_scalemin", "0", 0);
cg_te_scalemax = cgi.Cvar_Get("cg_te_scalemax", "0", 0);
cg_te_model = cgi.Cvar_Get("cg_te_model", "none", 0);
cg_te_life = cgi.Cvar_Get("cg_te_life", "1", 0);
cg_te_color_r = cgi.Cvar_Get("cg_te_color_r", "1", 0);
cg_te_color_g = cgi.Cvar_Get("cg_te_color_g", "1", 0);
cg_te_color_b = cgi.Cvar_Get("cg_te_color_b", "1", 0);
cg_te_accel_x = cgi.Cvar_Get("cg_te_accel_x", "0", 0);
cg_te_accel_y = cgi.Cvar_Get("cg_te_accel_y", "0", 0);
cg_te_accel_z = cgi.Cvar_Get("cg_te_accel_z", "0", 0);
cg_te_count = cgi.Cvar_Get("cg_te_count", "1", 0);
cg_te_fade = cgi.Cvar_Get("cg_te_fade", "0", 0);
cg_te_fadedelay = cgi.Cvar_Get("cg_te_fadedelay", "0", 0);
cg_te_fadein = cgi.Cvar_Get("cg_te_fadein", "0", 0);
cg_te_spawnrate = cgi.Cvar_Get("cg_te_spawnrate", "1", 0);
cg_te_scalerate = cgi.Cvar_Get("cg_te_scalerate", "0", 0);
cg_te_circle = cgi.Cvar_Get("cg_te_circle", "0", 0);
cg_te_sphere = cgi.Cvar_Get("cg_te_sphere", "0", 0);
cg_te_insphere = cgi.Cvar_Get("cg_te_insphere", "0", 0);
cg_te_radius = cgi.Cvar_Get("cg_te_radius", "0", 0);
cg_te_align = cgi.Cvar_Get("cg_te_align", "0", 0);
cg_te_flickeralpha = cgi.Cvar_Get("cg_te_flickeralpha", "0", 0);
cg_te_collision = cgi.Cvar_Get("cg_te_collision", "0", 0);
cg_te_randomroll = cgi.Cvar_Get("cg_te_randomroll", "0", 0);
cg_te_offsbase_x = cgi.Cvar_Get("cg_te_offsbase_x", "0", 0);
cg_te_offsbase_y = cgi.Cvar_Get("cg_te_offsbase_y", "0", 0);
cg_te_offsbase_z = cgi.Cvar_Get("cg_te_offsbase_z", "0", 0);
cg_te_offsamp_x = cgi.Cvar_Get("cg_te_offsamp_x", "0", 0);
cg_te_offsamp_y = cgi.Cvar_Get("cg_te_offsamp_y", "0", 0);
cg_te_offsamp_z = cgi.Cvar_Get("cg_te_offsamp_z", "0", 0);
cg_te_anglesbase_p = cgi.Cvar_Get("cg_te_anglesbase_p", "0", 0);
cg_te_anglesbase_y = cgi.Cvar_Get("cg_te_anglesbase_y", "0", 0);
cg_te_anglesbase_r = cgi.Cvar_Get("cg_te_anglesbase_r", "0", 0);
cg_te_anglesamp_p = cgi.Cvar_Get("cg_te_anglesamp_p", "0", 0);
cg_te_anglesamp_y = cgi.Cvar_Get("cg_te_anglesamp_y", "0", 0);
cg_te_anglesamp_r = cgi.Cvar_Get("cg_te_anglesamp_r", "0", 0);
cg_te_randvelbase_x = cgi.Cvar_Get("cg_te_randvelbase_x", "0", 0);
cg_te_randvelbase_y = cgi.Cvar_Get("cg_te_randvelbase_y", "0", 0);
cg_te_randvelbase_z = cgi.Cvar_Get("cg_te_randvelbase_z", "0", 0);
cg_te_randvelamp_x = cgi.Cvar_Get("cg_te_randvelamp_x", "0", 0);
cg_te_randvelamp_y = cgi.Cvar_Get("cg_te_randvelamp_y", "0", 0);
cg_te_randvelamp_z = cgi.Cvar_Get("cg_te_randvelamp_z", "0", 0);
cg_te_clampvelmin_x = cgi.Cvar_Get("cg_te_clampvelmin_x", "-9999", 0);
cg_te_clampvelmax_x = cgi.Cvar_Get("cg_te_clampvelmax_x", "9999", 0);
cg_te_clampvelmin_y = cgi.Cvar_Get("cg_te_clampvelmin_y", "-9999", 0);
cg_te_clampvelmax_y = cgi.Cvar_Get("cg_te_clampvelmax_y", "9999", 0);
cg_te_clampvelmin_z = cgi.Cvar_Get("cg_te_clampvelmin_z", "-9999", 0);
cg_te_clampvelmax_z = cgi.Cvar_Get("cg_te_clampvelmax_z", "9999", 0);
cg_te_clampvelaxis = cgi.Cvar_Get("cg_te_clampvelaxis", "0", 0);
cg_te_forwardvel = cgi.Cvar_Get("cg_te_forwardvel", "0", 0);
cg_te_volumetric = cgi.Cvar_Get("cg_te_volumetric", "0", 0);
cg_te_randaxis = cgi.Cvar_Get("cg_te_randaxis", "0", 0);
cg_te_axisoffsbase_x = cgi.Cvar_Get("cg_te_axisoffsbase_x", "0", 0);
cg_te_axisoffsbase_y = cgi.Cvar_Get("cg_te_axisoffsbase_y", "0", 0);
cg_te_axisoffsbase_z = cgi.Cvar_Get("cg_te_axisoffsbase_z", "0", 0);
cg_te_axisoffsamp_x = cgi.Cvar_Get("cg_te_axisoffsamp_x", "0", 0);
cg_te_axisoffsamp_y = cgi.Cvar_Get("cg_te_axisoffsamp_y", "0", 0);
cg_te_axisoffsamp_z = cgi.Cvar_Get("cg_te_axisoffsamp_z", "0", 0);
cg_te_swarm_freq = cgi.Cvar_Get("cg_te_swarm_freq", "0", 0);
cg_te_swarm_maxspeed = cgi.Cvar_Get("cg_te_swarm_maxspeed", "0", 0);
cg_te_swarm_delta = cgi.Cvar_Get("cg_te_swarm_delta", "0", 0);
cg_te_avelbase_p = cgi.Cvar_Get("cg_te_avelbase_p", "0", 0);
cg_te_avelbase_y = cgi.Cvar_Get("cg_te_avelbase_y", "0", 0);
cg_te_avelbase_r = cgi.Cvar_Get("cg_te_avelbase_r", "0", 0);
cg_te_avelamp_p = cgi.Cvar_Get("cg_te_avelamp_p", "0", 0);
cg_te_avelamp_y = cgi.Cvar_Get("cg_te_avelamp_y", "0", 0);
cg_te_avelamp_r = cgi.Cvar_Get("cg_te_avelamp_r", "0", 0);
cg_te_radial_scale = cgi.Cvar_Get("cg_te_radial_scale", "0", 0);
cg_te_radial_min = cgi.Cvar_Get("cg_te_radial_min", "0", 0);
cg_te_radial_max = cgi.Cvar_Get("cg_te_radial_max", "0", 0);
cg_te_friction = cgi.Cvar_Get("cg_te_friction", "0", 0);
cg_te_varycolor = cgi.Cvar_Get("cg_te_varycolor", "0", 0);
cg_te_life = cgi.Cvar_Get("cg_te_life", "1", 0);
cg_te_alpha = cgi.Cvar_Get("cg_te_alpha", "1", 0);
cg_te_dietouch = cgi.Cvar_Get("cg_te_dietouch", "0", 0);
cg_te_bouncefactor = cgi.Cvar_Get("cg_te_bouncefactor", "0.3", 0);
cg_te_scale = cgi.Cvar_Get("cg_te_scale", "1", 0);
cg_te_scalemin = cgi.Cvar_Get("cg_te_scalemin", "0", 0);
cg_te_scalemax = cgi.Cvar_Get("cg_te_scalemax", "0", 0);
cg_te_model = cgi.Cvar_Get("cg_te_model", "none", 0);
cg_te_life = cgi.Cvar_Get("cg_te_life", "1", 0);
cg_te_color_r = cgi.Cvar_Get("cg_te_color_r", "1", 0);
cg_te_color_g = cgi.Cvar_Get("cg_te_color_g", "1", 0);
cg_te_color_b = cgi.Cvar_Get("cg_te_color_b", "1", 0);
cg_te_accel_x = cgi.Cvar_Get("cg_te_accel_x", "0", 0);
cg_te_accel_y = cgi.Cvar_Get("cg_te_accel_y", "0", 0);
cg_te_accel_z = cgi.Cvar_Get("cg_te_accel_z", "0", 0);
cg_te_count = cgi.Cvar_Get("cg_te_count", "1", 0);
cg_te_fade = cgi.Cvar_Get("cg_te_fade", "0", 0);
cg_te_fadedelay = cgi.Cvar_Get("cg_te_fadedelay", "0", 0);
cg_te_fadein = cgi.Cvar_Get("cg_te_fadein", "0", 0);
cg_te_spawnrate = cgi.Cvar_Get("cg_te_spawnrate", "1", 0);
cg_te_scalerate = cgi.Cvar_Get("cg_te_scalerate", "0", 0);
cg_te_circle = cgi.Cvar_Get("cg_te_circle", "0", 0);
cg_te_sphere = cgi.Cvar_Get("cg_te_sphere", "0", 0);
cg_te_insphere = cgi.Cvar_Get("cg_te_insphere", "0", 0);
cg_te_radius = cgi.Cvar_Get("cg_te_radius", "0", 0);
cg_te_align = cgi.Cvar_Get("cg_te_align", "0", 0);
cg_te_flickeralpha = cgi.Cvar_Get("cg_te_flickeralpha", "0", 0);
cg_te_collision = cgi.Cvar_Get("cg_te_collision", "0", 0);
cg_te_randomroll = cgi.Cvar_Get("cg_te_randomroll", "0", 0);
cg_te_offsbase_x = cgi.Cvar_Get("cg_te_offsbase_x", "0", 0);
cg_te_offsbase_y = cgi.Cvar_Get("cg_te_offsbase_y", "0", 0);
cg_te_offsbase_z = cgi.Cvar_Get("cg_te_offsbase_z", "0", 0);
cg_te_offsamp_x = cgi.Cvar_Get("cg_te_offsamp_x", "0", 0);
cg_te_offsamp_y = cgi.Cvar_Get("cg_te_offsamp_y", "0", 0);
cg_te_offsamp_z = cgi.Cvar_Get("cg_te_offsamp_z", "0", 0);
cg_te_anglesbase_p = cgi.Cvar_Get("cg_te_anglesbase_p", "0", 0);
cg_te_anglesbase_y = cgi.Cvar_Get("cg_te_anglesbase_y", "0", 0);
cg_te_anglesbase_r = cgi.Cvar_Get("cg_te_anglesbase_r", "0", 0);
cg_te_anglesamp_p = cgi.Cvar_Get("cg_te_anglesamp_p", "0", 0);
cg_te_anglesamp_y = cgi.Cvar_Get("cg_te_anglesamp_y", "0", 0);
cg_te_anglesamp_r = cgi.Cvar_Get("cg_te_anglesamp_r", "0", 0);
cg_te_randvelbase_x = cgi.Cvar_Get("cg_te_randvelbase_x", "0", 0);
cg_te_randvelbase_y = cgi.Cvar_Get("cg_te_randvelbase_y", "0", 0);
cg_te_randvelbase_z = cgi.Cvar_Get("cg_te_randvelbase_z", "0", 0);
cg_te_randvelamp_x = cgi.Cvar_Get("cg_te_randvelamp_x", "0", 0);
cg_te_randvelamp_y = cgi.Cvar_Get("cg_te_randvelamp_y", "0", 0);
cg_te_randvelamp_z = cgi.Cvar_Get("cg_te_randvelamp_z", "0", 0);
cg_te_clampvelmin_x = cgi.Cvar_Get("cg_te_clampvelmin_x", "-9999", 0);
cg_te_clampvelmax_x = cgi.Cvar_Get("cg_te_clampvelmax_x", "9999", 0);
cg_te_clampvelmin_y = cgi.Cvar_Get("cg_te_clampvelmin_y", "-9999", 0);
cg_te_clampvelmax_y = cgi.Cvar_Get("cg_te_clampvelmax_y", "9999", 0);
cg_te_clampvelmin_z = cgi.Cvar_Get("cg_te_clampvelmin_z", "-9999", 0);
cg_te_clampvelmax_z = cgi.Cvar_Get("cg_te_clampvelmax_z", "9999", 0);
cg_te_clampvelaxis = cgi.Cvar_Get("cg_te_clampvelaxis", "0", 0);
cg_te_forwardvel = cgi.Cvar_Get("cg_te_forwardvel", "0", 0);
cg_te_volumetric = cgi.Cvar_Get("cg_te_volumetric", "0", 0);
cg_te_randaxis = cgi.Cvar_Get("cg_te_randaxis", "0", 0);
cg_te_axisoffsbase_x = cgi.Cvar_Get("cg_te_axisoffsbase_x", "0", 0);
cg_te_axisoffsbase_y = cgi.Cvar_Get("cg_te_axisoffsbase_y", "0", 0);
cg_te_axisoffsbase_z = cgi.Cvar_Get("cg_te_axisoffsbase_z", "0", 0);
cg_te_axisoffsamp_x = cgi.Cvar_Get("cg_te_axisoffsamp_x", "0", 0);
cg_te_axisoffsamp_y = cgi.Cvar_Get("cg_te_axisoffsamp_y", "0", 0);
cg_te_axisoffsamp_z = cgi.Cvar_Get("cg_te_axisoffsamp_z", "0", 0);
cg_te_swarm_freq = cgi.Cvar_Get("cg_te_swarm_freq", "0", 0);
cg_te_swarm_maxspeed = cgi.Cvar_Get("cg_te_swarm_maxspeed", "0", 0);
cg_te_swarm_delta = cgi.Cvar_Get("cg_te_swarm_delta", "0", 0);
cg_te_avelbase_p = cgi.Cvar_Get("cg_te_avelbase_p", "0", 0);
cg_te_avelbase_y = cgi.Cvar_Get("cg_te_avelbase_y", "0", 0);
cg_te_avelbase_r = cgi.Cvar_Get("cg_te_avelbase_r", "0", 0);
cg_te_avelamp_p = cgi.Cvar_Get("cg_te_avelamp_p", "0", 0);
cg_te_avelamp_y = cgi.Cvar_Get("cg_te_avelamp_y", "0", 0);
cg_te_avelamp_r = cgi.Cvar_Get("cg_te_avelamp_r", "0", 0);
cg_te_radial_scale = cgi.Cvar_Get("cg_te_radial_scale", "0", 0);
cg_te_radial_min = cgi.Cvar_Get("cg_te_radial_min", "0", 0);
cg_te_radial_max = cgi.Cvar_Get("cg_te_radial_max", "0", 0);
cg_te_friction = cgi.Cvar_Get("cg_te_friction", "0", 0);
cg_te_varycolor = cgi.Cvar_Get("cg_te_varycolor", "0", 0);
cg_te_spritegridlighting = cgi.Cvar_Get("cg_te_spritegridlighting", "0", 0);
cg_te_spawnrange_a = cgi.Cvar_Get("cg_te_spawnrange_a", "0", 0);
cg_te_spawnrange_b = cgi.Cvar_Get("cg_te_spawnrange_b", "0", 0);
cg_te_cone_height = cgi.Cvar_Get("cg_te_cone_height", "0", 0);
cg_te_spawnrange_a = cgi.Cvar_Get("cg_te_spawnrange_a", "0", 0);
cg_te_spawnrange_b = cgi.Cvar_Get("cg_te_spawnrange_b", "0", 0);
cg_te_cone_height = cgi.Cvar_Get("cg_te_cone_height", "0", 0);
cg_te_alignstretch_scale = cgi.Cvar_Get("cg_te_alignstretch_scale", "0", 0);
cg_te_command_time = cgi.Cvar_Get("cg_te_command_time", "0", 0);
cg_te_singlelinecommand = cgi.Cvar_Get("cg_te_singlelinecommand", "", 0);
cg_te_tag = cgi.Cvar_Get("cg_te_tag", "", 0);
cg_te_command_time = cgi.Cvar_Get("cg_te_command_time", "0", 0);
cg_te_singlelinecommand = cgi.Cvar_Get("cg_te_singlelinecommand", "", 0);
cg_te_tag = cgi.Cvar_Get("cg_te_tag", "", 0);
for (int i = 0; i < MAX_TESTEMITTERS_SAVE; ++i) {
CG_SaveEffectCommandCvars(i);
}
cg_te_xangles = cgi.Cvar_Get("cg_te_xangles", "0", 0);
cg_te_yangles = cgi.Cvar_Get("cg_te_yangles", "0", 0);
cg_te_zangles = cgi.Cvar_Get("cg_te_zangles", "0", 0);
cg_te_xangles = cgi.Cvar_Get("cg_te_xangles", "0", 0);
cg_te_yangles = cgi.Cvar_Get("cg_te_yangles", "0", 0);
cg_te_zangles = cgi.Cvar_Get("cg_te_zangles", "0", 0);
cg_te_emittermodel = cgi.Cvar_Get("cg_te_emittermodel", "", 0);
cg_te_mode = cgi.Cvar_Get("cg_te_mode", "0", 0);
cg_te_mode_name = cgi.Cvar_Get("cg_te_mode_name", "Emitter Mode", 0);
cg_te_currCommand = cgi.Cvar_Get("cg_te_currCommand", "0", 0);
cg_te_mode = cgi.Cvar_Get("cg_te_mode", "0", 0);
cg_te_mode_name = cgi.Cvar_Get("cg_te_mode_name", "Emitter Mode", 0);
cg_te_currCommand = cgi.Cvar_Get("cg_te_currCommand", "0", 0);
te_vEmitterOrigin[2] = 0.0;
te_vEmitterOrigin[1] = 0.0;
te_vEmitterOrigin[0] = 0.0;
te_refEnt.scale = 0.0;
cg_te_numCommands = cgi.Cvar_Get("cg_te_numCommands", "0", 0);
te_iNumCommands = 0;
te_iCurrCommand = 0;
te_refEnt.scale = 0.0;
cg_te_numCommands = cgi.Cvar_Get("cg_te_numCommands", "0", 0);
te_iNumCommands = 0;
te_iCurrCommand = 0;
pTesteffect = sfxManager.GetTestEffectPointer();
}
+6 -12
View File
@@ -62,8 +62,7 @@ void CG_MessageMode_Private_f(void)
}
clientNum = atoi(cgi.Argv(1)) - 1;
if (clientNum < 0 || clientNum >= MAX_CLIENTS)
{
if (clientNum < 0 || clientNum >= MAX_CLIENTS) {
cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1));
return;
}
@@ -79,8 +78,7 @@ void CG_MessageSingleAll_f(void)
if (cgi.Argc() > 1) {
cgi.SendClientCommand(va("dmmessage 0 %s\n", cgi.Args()));
}
else {
} else {
cgi.UI_ToggleDMMessageConsole(-100);
}
}
@@ -93,8 +91,7 @@ void CG_MessageSingleTeam_f(void)
if (cgi.Argc() > 1) {
cgi.SendClientCommand(va("dmmessage -1 %s\n", cgi.Args()));
}
else {
} else {
cgi.UI_ToggleDMMessageConsole(-200);
}
}
@@ -108,14 +105,12 @@ void CG_MessageSingleClient_f(void)
}
clientNum = atoi(cgi.Argv(1));
if (clientNum < 1 || clientNum > MAX_CLIENTS)
{
if (clientNum < 1 || clientNum > MAX_CLIENTS) {
cgi.Printf(HUD_MESSAGE_CHAT_WHITE "Message Error: %s is a bad client number\n", cgi.Argv(1));
return;
}
if (cgi.Argc() > 2)
{
if (cgi.Argc() > 2) {
int i;
str sString;
@@ -129,8 +124,7 @@ void CG_MessageSingleClient_f(void)
sString += "\n";
cgi.SendClientCommand(sString.c_str());
}
else {
} else {
cgi.UI_ToggleDMMessageConsole(-clientNum);
}
}
+3 -6
View File
@@ -26,17 +26,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
#include "cg_commands.h"
void CG_Vehicle(centity_t* cent)
{
void CG_Vehicle(centity_t *cent) {}
}
void ClientGameCommandManager::SpawnTreads(Event* ev)
void ClientGameCommandManager::SpawnTreads(Event *ev)
{
// stub
}
void ClientGameCommandManager::TreadsOff(Event* ev)
void ClientGameCommandManager::TreadsOff(Event *ev)
{
// stub
}
+292 -313
View File
@@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//============================================================================
/*
=================
CG_CalcVrect
@@ -33,38 +32,37 @@ CG_CalcVrect
Sets the coordinates of the rendered window
=================
*/
static void CG_CalcVrect (void) {
int size;
static void CG_CalcVrect(void)
{
int size;
// the intermission should allways be full screen
if ( cg.snap->ps.pm_flags & PMF_INTERMISSION ) {
size = 100;
} else {
// bound normal viewsize
if (cg_viewsize->integer < 30) {
cgi.Cvar_Set ("viewsize","30");
size = 30;
} else if (cg_viewsize->integer > 100) {
cgi.Cvar_Set ("viewsize","100");
size = 100;
} else {
size = cg_viewsize->integer;
}
// the intermission should allways be full screen
if (cg.snap->ps.pm_flags & PMF_INTERMISSION) {
size = 100;
} else {
// bound normal viewsize
if (cg_viewsize->integer < 30) {
cgi.Cvar_Set("viewsize", "30");
size = 30;
} else if (cg_viewsize->integer > 100) {
cgi.Cvar_Set("viewsize", "100");
size = 100;
} else {
size = cg_viewsize->integer;
}
}
cg.refdef.width = cgs.glconfig.vidWidth * size / 100;
cg.refdef.width &= ~1;
}
cg.refdef.width = cgs.glconfig.vidWidth*size/100;
cg.refdef.width &= ~1;
cg.refdef.height = cgs.glconfig.vidHeight * size / 100;
cg.refdef.height &= ~1;
cg.refdef.height = cgs.glconfig.vidHeight*size/100;
cg.refdef.height &= ~1;
cg.refdef.x = (cgs.glconfig.vidWidth - cg.refdef.width)/2;
cg.refdef.y = (cgs.glconfig.vidHeight - cg.refdef.height)/2;
cg.refdef.x = (cgs.glconfig.vidWidth - cg.refdef.width) / 2;
cg.refdef.y = (cgs.glconfig.vidHeight - cg.refdef.height) / 2;
}
//==============================================================================
/*
===============
CG_OffsetThirdPersonView
@@ -72,110 +70,100 @@ CG_OffsetThirdPersonView
===============
*/
#define CAMERA_MINIMUM_DISTANCE 40
static void CG_OffsetThirdPersonView( void )
static void CG_OffsetThirdPersonView(void)
{
vec3_t forward;
vec3_t original_camera_position;
vec3_t new_vieworg;
trace_t trace;
vec3_t min, max;
float *look_offset;
float *target_angles;
float *target_position;
vec3_t delta;
vec3_t original_angles;
qboolean lookactive, resetview;
static vec3_t saved_look_offset;
vec3_t camera_offset;
vec3_t forward;
vec3_t original_camera_position;
vec3_t new_vieworg;
trace_t trace;
vec3_t min, max;
float *look_offset;
float *target_angles;
float *target_position;
vec3_t delta;
vec3_t original_angles;
qboolean lookactive, resetview;
static vec3_t saved_look_offset;
vec3_t camera_offset;
target_angles = cg.refdefViewAngles;
target_position = cg.refdef.vieworg;
target_angles = cg.refdefViewAngles;
target_position = cg.refdef.vieworg;
// see if angles are absolute
if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ABSOLUTE )
{
VectorClear( target_angles );
}
// see if angles are absolute
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ABSOLUTE) {
VectorClear(target_angles);
}
// see if we need to ignore yaw
if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_YAW )
{
target_angles[ YAW ] = 0;
}
// see if we need to ignore yaw
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_YAW) {
target_angles[YAW] = 0;
}
// see if we need to ignore pitch
if ( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_PITCH )
{
target_angles[ PITCH ] = 0;
}
// see if we need to ignore pitch
if (cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_IGNORE_PITCH) {
target_angles[PITCH] = 0;
}
// offset the current angles by the camera offset
VectorSubtract( target_angles, cg.predicted_player_state.camera_offset, target_angles );
// offset the current angles by the camera offset
VectorSubtract(target_angles, cg.predicted_player_state.camera_offset, target_angles);
// Get the position of the camera after any needed rotation
look_offset = cgi.get_camera_offset( &lookactive, &resetview );
// Get the position of the camera after any needed rotation
look_offset = cgi.get_camera_offset(&lookactive, &resetview);
if (
( !resetview ) &&
(
( cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ALLOWOFFSET ) ||
( lookactive )
)
)
{
VectorSubtract( look_offset, saved_look_offset, camera_offset );
VectorAdd( target_angles, camera_offset, target_angles );
if ( target_angles[ PITCH ] > 90 )
target_angles[ PITCH ] = 90;
else if ( target_angles[ PITCH ] < -90 )
target_angles[ PITCH ] = -90;
}
else
{
VectorCopy( look_offset, saved_look_offset );
}
if ((!resetview) && ((cg.predicted_player_state.camera_flags & CF_CAMERA_ANGLES_ALLOWOFFSET) || (lookactive))) {
VectorSubtract(look_offset, saved_look_offset, camera_offset);
VectorAdd(target_angles, camera_offset, target_angles);
if (target_angles[PITCH] > 90) {
target_angles[PITCH] = 90;
} else if (target_angles[PITCH] < -90) {
target_angles[PITCH] = -90;
}
} else {
VectorCopy(look_offset, saved_look_offset);
}
target_angles[ YAW ] = AngleNormalize360( target_angles[ YAW ] );
target_angles[ PITCH ] = AngleNormalize180( target_angles[ PITCH ] );
target_angles[YAW] = AngleNormalize360(target_angles[YAW]);
target_angles[PITCH] = AngleNormalize180(target_angles[PITCH]);
// Move reference point up
// Move reference point up
target_position[2] += cg_cameraheight->value;
target_position[2] += cg_cameraheight->value;
VectorCopy(target_position, original_camera_position);
VectorCopy(target_position, original_camera_position);
// Move camera back from reference point
// Move camera back from reference point
AngleVectors(target_angles, forward, NULL, NULL);
AngleVectors(target_angles, forward, NULL, NULL);
VectorMA(target_position, -cg_cameradist->value, forward, new_vieworg);
VectorMA(target_position, -cg_cameradist->value, forward, new_vieworg);
new_vieworg[ 2 ] += cg_cameraverticaldisplacement->value;
new_vieworg[2] += cg_cameraverticaldisplacement->value;
// Create a bounding box for our camera
// Create a bounding box for our camera
min[0] = -5;
min[1] = -5;
min[2] = -5;
min[0] = -5;
min[1] = -5;
min[2] = -5;
max[0] = 5;
max[1] = 5;
max[2] = 5;
max[0] = 5;
max[1] = 5;
max[2] = 5;
// Make sure camera does not collide with anything
CG_Trace(&trace, cg.playerHeadPos, min, max, new_vieworg, 0, MASK_CAMERASOLID, qfalse, qtrue, "ThirdPersonTrace 1" );
// Make sure camera does not collide with anything
CG_Trace(&trace, cg.playerHeadPos, min, max, new_vieworg, 0, MASK_CAMERASOLID, qfalse, qtrue, "ThirdPersonTrace 1");
VectorCopy(trace.endpos, target_position);
VectorCopy(trace.endpos, target_position);
// calculate distance from end position to head position
VectorSubtract( target_position, cg.playerHeadPos, delta );
// kill any negative z difference in delta
if ( delta[ 2 ] < CAMERA_MINIMUM_DISTANCE )
delta[ 2 ] = 0;
if ( VectorLength( delta ) < CAMERA_MINIMUM_DISTANCE )
{
VectorNormalize( delta);
/*
// calculate distance from end position to head position
VectorSubtract(target_position, cg.playerHeadPos, delta);
// kill any negative z difference in delta
if (delta[2] < CAMERA_MINIMUM_DISTANCE) {
delta[2] = 0;
}
if (VectorLength(delta) < CAMERA_MINIMUM_DISTANCE) {
VectorNormalize(delta);
/*
// see if we are going straight up
if ( ( delta[ 2 ] > 0.75 ) && ( height > 0.85f * cg.predicted_player_state.viewheight ) )
{
@@ -186,46 +174,55 @@ static void CG_OffsetThirdPersonView( void )
}
else
*/
{
// we are probably up against the wall so we want the camera to pitch up on top of the player
// save off the original angles
VectorCopy( target_angles, original_angles );
// start cranking up the target angles, pitch until we are the correct distance away from the player
while ( target_angles[ PITCH ] < 90 )
{
target_angles[ PITCH ] += 2;
{
// we are probably up against the wall so we want the camera to pitch up on top of the player
// save off the original angles
VectorCopy(target_angles, original_angles);
// start cranking up the target angles, pitch until we are the correct distance away from the player
while (target_angles[PITCH] < 90) {
target_angles[PITCH] += 2;
AngleVectors(target_angles, forward, NULL, NULL);
AngleVectors(target_angles, forward, NULL, NULL);
VectorMA( original_camera_position, -cg_cameradist->value, forward, new_vieworg);
VectorMA(original_camera_position, -cg_cameradist->value, forward, new_vieworg);
new_vieworg[ 2 ] += cg_cameraverticaldisplacement->value;
new_vieworg[2] += cg_cameraverticaldisplacement->value;
CG_Trace(&trace, cg.playerHeadPos, min, max, new_vieworg, 0, MASK_CAMERASOLID, qfalse, qtrue, "ThirdPersonTrace 3" );
CG_Trace(
&trace,
cg.playerHeadPos,
min,
max,
new_vieworg,
0,
MASK_CAMERASOLID,
qfalse,
qtrue,
"ThirdPersonTrace 3"
);
VectorCopy(trace.endpos, target_position);
VectorCopy(trace.endpos, target_position);
// calculate distance from end position to head position
VectorSubtract( target_position, cg.playerHeadPos, delta );
// kill any negative z difference in delta
if ( delta[ 2 ] < 0 )
delta[ 2 ] = 0;
if ( VectorLength( delta ) >= CAMERA_MINIMUM_DISTANCE )
{
target_angles[ PITCH ] = ( 0.25f * target_angles[ PITCH ] ) + ( 0.75f * original_angles[ PITCH ] );
// set the pitch to be that of the angle we are currently looking
//target_angles[ PITCH ] = original_angles[ PITCH ];
break;
}
// calculate distance from end position to head position
VectorSubtract(target_position, cg.playerHeadPos, delta);
// kill any negative z difference in delta
if (delta[2] < 0) {
delta[2] = 0;
}
if (VectorLength(delta) >= CAMERA_MINIMUM_DISTANCE) {
target_angles[PITCH] = (0.25f * target_angles[PITCH]) + (0.75f * original_angles[PITCH]);
// set the pitch to be that of the angle we are currently looking
//target_angles[ PITCH ] = original_angles[ PITCH ];
break;
}
}
if ( target_angles[ PITCH ] > 90 )
{
// if we failed, go with the original angles
target_angles[ PITCH ] = original_angles[ PITCH ];
if (target_angles[PITCH] > 90) {
// if we failed, go with the original angles
target_angles[PITCH] = original_angles[PITCH];
}
}
}
}
}
}
}
/*
===============
@@ -233,23 +230,23 @@ CG_OffsetFirstPersonView
===============
*/
void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
void CG_OffsetFirstPersonView(refEntity_t *pREnt, qboolean bUseWorldPosition)
{
float* origin;
centity_t* pCent;
dtiki_t* tiki;
int iTag;
int i;
int iMask;
vec3_t vDelta;
float mat[3][3];
vec3_t vOldOrigin;
vec3_t vStart, vEnd, vMins, vMaxs;
trace_t trace;
float *origin;
centity_t *pCent;
dtiki_t *tiki;
int iTag;
int i;
int iMask;
vec3_t vDelta;
float mat[3][3];
vec3_t vOldOrigin;
vec3_t vStart, vEnd, vMins, vMaxs;
trace_t trace;
VectorSet(vMins, -6, -6, -6);
VectorSet(vMaxs, 6, 6, 6);
//
//
//
@@ -260,32 +257,28 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
tiki = cgi.R_Model_GetHandle(cgs.model_draw[pCent->currentState.modelindex]);
iTag = cgi.Tag_NumForName(tiki, "eyes bone");
if (iTag != -1)
{
if (bUseWorldPosition)
{
if (iTag != -1) {
if (bUseWorldPosition) {
orientation_t oHead;
float mat3[3][3];
vec3_t vHeadAng, vDelta;
float mat3[3][3];
vec3_t vHeadAng, vDelta;
VectorCopy(pCent->lerpOrigin, origin);
AxisCopy(pREnt->axis, mat);
oHead = cgi.TIKI_Orientation(pREnt, iTag);
for (i = 0; i < 3; i++ ) {
for (i = 0; i < 3; i++) {
VectorMA(origin, oHead.origin[i], mat[i], origin);
}
R_ConcatRotations(oHead.axis, mat, mat3);
MatrixToEulerAngles(mat3, vHeadAng);
AnglesSubtract(vHeadAng, cg.refdefViewAngles, vDelta);
VectorMA(cg.refdefViewAngles, cg.fEyeOffsetFrac, vDelta, cg.refdefViewAngles);
VectorCopy(vHeadAng, cg.refdefViewAngles);
}
else
{
} else {
orientation_t oHead;
vec3_t vHeadAng;
vec3_t vHeadAng;
VectorCopy(pCent->lerpOrigin, origin);
AxisCopy(pREnt->axis, mat);
@@ -298,44 +291,35 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
cg.refdefViewAngles[2] += cg.predicted_player_state.fLeanAngle * 0.3;
}
}
else
{
} else {
cgi.DPrintf("CG_OffsetFirstPersonView warning: Couldn't find 'eyes bone' for player\n");
}
VectorCopy(origin, vOldOrigin);
if (bUseWorldPosition)
{
if (bUseWorldPosition) {
iMask = MASK_VIEWSOLID;
}
else
{
float fTargHeight;
float fHeightDelta, fHeightChange;
float fPhase, fVel;
} else {
float fTargHeight;
float fHeightDelta, fHeightChange;
float fPhase, fVel;
vec3_t vDelta;
vec3_t vPivotPoint;
vec3_t vForward, vLeft;
origin[0] = cg.predicted_player_state.origin[0];
origin[1] = cg.predicted_player_state.origin[1];
fTargHeight = cg.predicted_player_state.origin[2] + cg.predicted_player_state.viewheight;
origin[0] = cg.predicted_player_state.origin[0];
origin[1] = cg.predicted_player_state.origin[1];
fTargHeight = cg.predicted_player_state.origin[2] + cg.predicted_player_state.viewheight;
fHeightDelta = fTargHeight - cg.fCurrentViewHeight;
if (fabs(fHeightDelta) < 0.1 || !cg.fCurrentViewHeight)
{
if (fabs(fHeightDelta) < 0.1 || !cg.fCurrentViewHeight) {
cg.fCurrentViewHeight = fTargHeight;
}
else
{
} else {
if (fHeightDelta > 32.f) {
fHeightDelta = 32.f;
fHeightDelta = 32.f;
cg.fCurrentViewHeight = fTargHeight - 32.0;
}
else if (fHeightDelta < -32.f) {
fHeightDelta = -32.f;
} else if (fHeightDelta < -32.f) {
fHeightDelta = -32.f;
cg.fCurrentViewHeight = fTargHeight + 32.0;
}
@@ -351,7 +335,7 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
cg.fCurrentViewHeight += fHeightChange;
}
origin[2] = cg.fCurrentViewHeight;
origin[2] = cg.fCurrentViewHeight;
vPivotPoint[0] = cg.refdefViewAngles[0];
vPivotPoint[1] = cg.refdefViewAngles[1];
vPivotPoint[2] = 0.0;
@@ -359,16 +343,13 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
VectorCopy(origin, vStart);
if (cg.predicted_player_state.pm_type != PM_CLIMBWALL)
{
if (cg.predicted_player_state.pm_type != PM_CLIMBWALL) {
if (cg.refdefViewAngles[0] > 0.0) {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.4;
}
else {
} else {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.2;
}
}
else {
} else {
vStart[2] -= (cg.fCurrentViewHeight - cg.predicted_player_state.origin[2]) * 0.15;
}
@@ -385,16 +366,14 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
VectorAdd(vStart, vEnd, origin);
}
if (cg.predicted_player_state.walking)
{
fVel = VectorLength(cg.predicted_player_state.velocity);
if (cg.predicted_player_state.walking) {
fVel = VectorLength(cg.predicted_player_state.velocity);
fPhase = fVel * 0.0015 + 0.9;
cg.fCurrentViewBobPhase += (cg.frametime / 1000.0 + cg.frametime / 1000.0) * M_PI * fPhase;
if (cg.fCurrentViewBobAmp) {
cg.fCurrentViewBobAmp = fVel;
}
else {
} else {
cg.fCurrentViewBobAmp = fVel * 0.5;
}
@@ -403,25 +382,21 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
}
cg.fCurrentViewBobAmp *= (1.0 - fabs(cg.refdefViewAngles[0]) * (1.0 / 90.0) * 0.5) * 0.5;
}
else if (cg.fCurrentViewBobAmp > 0.0)
{
cg.fCurrentViewBobAmp -= (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp)
+ (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp);
} else if (cg.fCurrentViewBobAmp > 0.0) {
cg.fCurrentViewBobAmp -=
(cg.frametime / 1000.0 * cg.fCurrentViewBobAmp) + (cg.frametime / 1000.0 * cg.fCurrentViewBobAmp);
if (cg.fCurrentViewBobAmp < 0.1) {
cg.fCurrentViewBobAmp = 0.0;
}
}
if (cg.fCurrentViewBobAmp > 0.0)
{
if (cg.fCurrentViewBobAmp > 0.0) {
fPhase = sin(cg.fCurrentViewBobPhase) * cg.fCurrentViewBobAmp * 0.03;
if (fPhase > 16.0) {
fPhase = 16.0;
}
else if (fPhase < -16.0) {
} else if (fPhase < -16.0) {
fPhase = -16.0;
}
@@ -432,8 +407,7 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
if (fPhase > 16.0) {
fPhase = 16.0;
}
else if (fPhase < -16.0) {
} else if (fPhase < -16.0) {
fPhase = -16.0;
}
@@ -446,11 +420,13 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
vStart[0] = cg.predicted_player_state.origin[0];
vStart[1] = cg.predicted_player_state.origin[1];
vStart[2] = cg.predicted_player_state.origin[2] + cg.predicted_player_state.viewheight;
vEnd[0] = cg.predicted_player_state.origin[0];
vEnd[1] = cg.predicted_player_state.origin[1];
vEnd[2] = origin[2];
vEnd[0] = cg.predicted_player_state.origin[0];
vEnd[1] = cg.predicted_player_state.origin[1];
vEnd[2] = origin[2];
CG_Trace(&trace, vStart, vMins, vMaxs, vEnd, cg.snap->ps.clientNum, iMask, qfalse, qtrue, "FirstPerson Height Check");
CG_Trace(
&trace, vStart, vMins, vMaxs, vEnd, cg.snap->ps.clientNum, iMask, qfalse, qtrue, "FirstPerson Height Check"
);
VectorCopy(trace.endpos, vStart);
vEnd[0] = origin[0];
@@ -462,8 +438,7 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
VectorSubtract(origin, vOldOrigin, vDelta);
VectorAdd(pREnt->origin, vDelta, pREnt->origin);
if (!bUseWorldPosition)
{
if (!bUseWorldPosition) {
VectorCopy(cg.refdefViewAngles, vDelta);
vDelta[0] *= 0.5;
vDelta[2] *= 0.75;
@@ -471,10 +446,7 @@ void CG_OffsetFirstPersonView(refEntity_t* pREnt, qboolean bUseWorldPosition)
AngleVectorsLeft(vDelta, mat[0], mat[1], mat[2]);
CG_CalcViewModelMovement(
cg.fCurrentViewBobPhase,
cg.fCurrentViewBobAmp,
cg.predicted_player_state.velocity,
vDelta
cg.fCurrentViewBobPhase, cg.fCurrentViewBobAmp, cg.predicted_player_state.velocity, vDelta
);
VectorMA(pREnt->origin, vDelta[0], mat[0], pREnt->origin);
@@ -492,20 +464,20 @@ CG_CalcFov
Fixed fov at intermissions, otherwise account for fov variable and zooms.
====================
*/
#define WAVE_AMPLITUDE 1
#define WAVE_FREQUENCY 0.4
#define WAVE_AMPLITUDE 1
#define WAVE_FREQUENCY 0.4
static int CG_CalcFov( void )
static int CG_CalcFov(void)
{
float x;
float phase;
float v;
int contents;
float fov_x, fov_y;
int inwater;
float x;
float phase;
float v;
int contents;
float fov_x, fov_y;
int inwater;
fov_x = cg.camera_fov;
x = cg.refdef.width / tan(fov_x / 360 * M_PI);
x = cg.refdef.width / tan(fov_x / 360 * M_PI);
fov_y = atan2(cg.refdef.height, x);
fov_y = fov_y * 360 / M_PI;
@@ -513,24 +485,25 @@ static int CG_CalcFov( void )
contents = CG_PointContents(cg.refdef.vieworg, -1);
if (contents & (CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA)) {
phase = cg.time / 1000.0 * WAVE_FREQUENCY * M_PI * 2;
v = WAVE_AMPLITUDE * sin(phase);
v = WAVE_AMPLITUDE * sin(phase);
fov_x += v;
fov_y -= v;
inwater = qtrue;
}
else {
} else {
inwater = qfalse;
}
// set it
cg.refdef.fov_x = fov_x;
cg.refdef.fov_y = fov_y;
cg.refdef.fov_x = fov_x;
cg.refdef.fov_y = fov_y;
cg.fRefFovXCos = cos(fov_x / 114.0f);
cg.fRefFovXSin = sin(fov_x / 114.0f);
cg.fRefFovYCos = cos(fov_y / 114.0f);
cg.fRefFovYSin = sin(fov_y / 114.0f);
cg.zoomSensitivity = cg.refdef.fov_y / 75.0;
return inwater;
}
/*
===============
CG_CalcViewValues
@@ -540,8 +513,8 @@ Sets cg.refdef view values
*/
static int CG_CalcViewValues(void)
{
playerState_t* ps;
float SoundAngles[3];
playerState_t *ps;
float SoundAngles[3];
memset(&cg.refdef, 0, sizeof(cg.refdef));
@@ -554,7 +527,7 @@ static int CG_CalcViewValues(void)
cg.refdef.farplane_cull = cg.farplane_cull;
// setup portal sky
cg.refdef.sky_alpha = cg.sky_alpha;
cg.refdef.sky_alpha = cg.sky_alpha;
cg.refdef.sky_portal = cg.sky_portal;
memcpy(cg.refdef.sky_axis, cg.sky_axis, sizeof(cg.sky_axis));
VectorCopy(cg.sky_origin, cg.refdef.sky_origin);
@@ -564,47 +537,37 @@ static int CG_CalcViewValues(void)
VectorCopy(ps->origin, cg.refdef.vieworg);
VectorCopy(ps->viewangles, cg.refdefViewAngles);
if (cg.snap->ps.stats[STAT_HEALTH] > 0)
{
if (cg.snap->ps.stats[STAT_HEALTH] > 0) {
VectorSubtract(cg.refdefViewAngles, cg.predicted_player_state.damage_angles, cg.refdefViewAngles);
cg.refdefViewAngles[0] += cg.viewkick[0];
cg.refdefViewAngles[1] += cg.viewkick[1];
if (cg.viewkick[0] || cg.viewkick[1])
{
int i;
if (cg.viewkick[0] || cg.viewkick[1]) {
int i;
float fDecay;
for (i = 0; i < 2; i++)
{
for (i = 0; i < 2; i++) {
fDecay = cg.viewkick[i] * cg.viewkickRecenter;
if (fDecay > cg.viewkickMaxDecay)
{
if (fDecay > cg.viewkickMaxDecay) {
fDecay = cg.viewkickMaxDecay;
}
else if (fDecay < -cg.viewkickMaxDecay) {
} else if (fDecay < -cg.viewkickMaxDecay) {
fDecay = -cg.viewkickMaxDecay;
}
if (fabs(fDecay) < cg.viewkickMinDecay)
{
if (fabs(fDecay) < cg.viewkickMinDecay) {
if (fDecay > 0.0) {
fDecay = cg.viewkickMinDecay;
}
else {
} else {
fDecay = -cg.viewkickMinDecay;
}
}
if (cg.viewkick[i] > 0.0)
{
if (cg.viewkick[i] > 0.0) {
cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0;
if (cg.viewkick[i] < 0.0) {
cg.viewkick[i] = 0.0;
}
}
else
{
} else {
cg.viewkick[i] -= fDecay * (float)cg.frametime / 1000.0;
if (cg.viewkick[i] > 0.0) {
cg.viewkick[i] = 0.0;
@@ -617,19 +580,15 @@ static int CG_CalcViewValues(void)
// FIXME: fffx screen shake on win32 builds?
// add error decay
if (cg_errorDecay->value > 0)
{
int t;
float f;
if (cg_errorDecay->value > 0) {
int t;
float f;
t = cg.time - cg.predictedErrorTime;
f = (cg_errorDecay->value - t) / cg_errorDecay->value;
if (f > 0 && f < 1)
{
if (f > 0 && f < 1) {
VectorMA(cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg);
}
else
{
} else {
cg.predictedErrorTime = 0;
}
}
@@ -651,23 +610,20 @@ static int CG_CalcViewValues(void)
// decide on third person view
cg.renderingThirdPerson = cg_3rd_person->integer;
if (cg.renderingThirdPerson)
{
if (cg.renderingThirdPerson) {
// back away from character
CG_OffsetThirdPersonView();
}
// if we are in a camera view, we take our audio cues directly from the camera
if (ps->pm_flags & PMF_CAMERA_VIEW)
{
if (ps->pm_flags & PMF_CAMERA_VIEW) {
// Set the aural position to that of the camera
VectorCopy(cg.camera_origin, cg.refdef.vieworg);
// Set the aural axis to the camera's angles
VectorCopy(cg.camera_angles, cg.refdefViewAngles);
if (ps->camera_posofs[0] || ps->camera_posofs[1] || ps->camera_posofs[2])
{
if (ps->camera_posofs[0] || ps->camera_posofs[1] || ps->camera_posofs[2]) {
vec3_t vAxis[3], vOrg;
AnglesToAxis(cg.refdefViewAngles, vAxis);
MatrixTransformVector(ps->camera_posofs, vAxis, vOrg);
@@ -690,21 +646,21 @@ static int CG_CalcViewValues(void)
return CG_CalcFov();
}
void CG_EyePosition(vec3_t* o_vPos)
void CG_EyePosition(vec3_t *o_vPos)
{
(*o_vPos)[0] = cg.playerHeadPos[0];
(*o_vPos)[1] = cg.playerHeadPos[1];
(*o_vPos)[2] = cg.playerHeadPos[2];
}
void CG_EyeOffset(vec3_t* o_vOfs)
void CG_EyeOffset(vec3_t *o_vOfs)
{
(*o_vOfs)[0] = cg.playerHeadPos[0] - cg.predicted_player_state.origin[0];
(*o_vOfs)[1] = cg.playerHeadPos[1] - cg.predicted_player_state.origin[1];
(*o_vOfs)[2] = cg.playerHeadPos[2] - cg.predicted_player_state.origin[2];
}
void CG_EyeAngles(vec3_t* o_vAngles)
void CG_EyeAngles(vec3_t *o_vAngles)
{
(*o_vAngles)[0] = cg.refdefViewAngles[0];
(*o_vAngles)[1] = cg.refdefViewAngles[1];
@@ -721,6 +677,42 @@ void CG_AddLightShow()
// FIXME: unimplemented
}
qboolean CG_FrustumCullSphere(const vec3_t vPos, float fRadius) {
vec3_t delta;
float fDotFwd, fDotSide, fDotUp;
VectorSubtract(vPos, cg.refdef.vieworg, delta);
fDotFwd = DotProduct(delta, cg.refdef.viewaxis[0]);
if (-fRadius >= fDotFwd) {
return qtrue;
}
if (cg.refdef.farplane_distance && cg.refdef.farplane_distance + fRadius <= fDotFwd) {
return qtrue;
}
fDotSide = DotProduct(delta, cg.refdef.viewaxis[1]);
if (fDotSide < 1.f) {
fDotSide = -fDotSide;
}
if (fDotSide * cg.fRefFovXCos - fDotFwd * cg.fRefFovXSin >= fRadius) {
return qtrue;
}
fDotUp = DotProduct(delta, cg.refdef.viewaxis[2]);
if (fDotUp < 0.f) {
fDotUp = -fDotUp;
}
if (fDotUp * cg.fRefFovYCos - fDotFwd * cg.fRefFovYSin >= fRadius) {
return qtrue;
}
return qfalse;
}
//=========================================================================
/*
@@ -730,10 +722,10 @@ CG_DrawActiveFrame
Generates and draws a game scene and status information at the given time.
=================
*/
void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback )
void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView, qboolean demoPlayback)
{
cg.time = serverTime;
cg.frametime = frameTime;
cg.time = serverTime;
cg.frametime = frameTime;
cg.demoPlayback = demoPlayback;
// any looped sounds will be respecified as entities
@@ -748,8 +740,7 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
// if we haven't received any snapshots yet, all
// we can draw is the information screen
if (!cg.snap || (cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE))
{
if (!cg.snap || (cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE)) {
return;
}
@@ -758,18 +749,16 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
// set cg.frameInterpolation
if (cg.nextSnap && r_lerpmodels->integer) {
int delta;
int delta;
delta = (cg.nextSnap->serverTime - cg.snap->serverTime);
if (delta == 0) {
cg.frameInterpolation = 0;
}
else {
} else {
cg.frameInterpolation = (float)(cg.time - cg.snap->serverTime) / delta;
}
}
else {
cg.frameInterpolation = 0; // actually, it should never be used, because
} else {
cg.frameInterpolation = 0; // actually, it should never be used, because
// no entities should be marked as interpolating
}
@@ -780,19 +769,15 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
CG_CalcViewValues();
// display the intermission
if (cg.snap->ps.pm_flags & PMF_INTERMISSION)
{
if (cg.snap->ps.pm_flags & PMF_INTERMISSION) {
if (cgs.gametype != GT_SINGLE_PLAYER) {
CG_ScoresDown_f();
}
else if (cg.bIntermissionDisplay)
{
if (cg.nextSnap)
{
} else if (cg.bIntermissionDisplay) {
if (cg.nextSnap) {
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
} else {
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
}
}
} else {
@@ -800,14 +785,10 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
}
cg.bIntermissionDisplay = qtrue;
}
else if (cg.bIntermissionDisplay)
{
} else if (cg.bIntermissionDisplay) {
if (cgs.gametype != GT_SINGLE_PLAYER) {
CG_ScoresUp_f();
}
else
{
} else {
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
} else {
@@ -819,9 +800,8 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
}
// build the render lists
if (!cg.hyperspace)
{
CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct
if (!cg.hyperspace) {
CG_AddPacketEntities(); // after calcViewValues, so predicted player state is correct
CG_AddMarks();
}
@@ -841,8 +821,9 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
CG_UpdateTestEmitter();
CG_AddPendingEffects();
if (!cg_hidetempmodels->integer)
if (!cg_hidetempmodels->integer) {
CG_AddTempModels();
}
if (vss_draw->integer) {
CG_AddVSSSources();
@@ -860,9 +841,7 @@ void CG_DrawActiveFrame( int serverTime, int frameTime, stereoFrame_t stereoView
// actually issue the rendering calls
CG_DrawActive(stereoView);
if (cg_stats->integer)
{
if (cg_stats->integer) {
cgi.Printf("cg.clientFrame:%i\n", cg.clientFrame);
}
}
+282 -295
View File
@@ -26,8 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
#include "tiki.h"
static const char* AnimPrefixList[] =
{
static const char *AnimPrefixList[] = {
"",
"papers",
"colt45",
@@ -60,7 +59,6 @@ static const char* AnimPrefixList[] =
"enfieldl42a1",
"carcano",
"delisle",
"thompson",
"sten",
"ppsh",
"moschetto",
@@ -82,8 +80,7 @@ static const char* AnimPrefixList[] =
"PIAT"
};
enum animPrefix_e
{
enum animPrefix_e {
WPREFIX_NONE,
WPREFIX_PAPERS,
WPREFIX_COLT45,
@@ -102,191 +99,224 @@ enum animPrefix_e
WPREFIX_BAZOOKA,
WPREFIX_PANZERSCHRECK,
WPREFIX_SHOTGUN,
WPREFIX_UNARMED,
//
// Team Assault and Team Tactics weapons
WPREFIX_MG42_PORTABLE,
WPREFIX_WEBLEY,
WPREFIX_NAGANTREV,
WPREFIX_BERETTA,
WPREFIX_ENFIELD,
WPREFIX_SVT,
WPREFIX_MOSIN,
WPREFIX_G43,
WPREFIX_ENFIELDL42A,
WPREFIX_CARCANO,
WPREFIX_DELISLE,
WPREFIX_STEN,
WPREFIX_PPSH,
WPREFIX_MOSCHETTO,
WPREFIX_FG42,
WPREFIX_VICKERS,
WPREFIX_BREDA,
WPREFIX_F1_GRENADE,
WPREFIX_MILLS_GRENADE,
WPREFIX_NEBELHANDGRANATE,
WPREFIX_M18_SMOKE_GRENADE,
WPREFIX_RDG1_SMOKE_GRENADE,
WPREFIX_UNARMED,
//
// Team Assault and Team Tactics weapons
WPREFIX_MG42_PORTABLE,
WPREFIX_WEBLEY,
WPREFIX_NAGANTREV,
WPREFIX_BERETTA,
WPREFIX_ENFIELD,
WPREFIX_SVT,
WPREFIX_MOSIN,
WPREFIX_G43,
WPREFIX_ENFIELDL42A,
WPREFIX_CARCANO,
WPREFIX_DELISLE,
WPREFIX_STEN,
WPREFIX_PPSH,
WPREFIX_MOSCHETTO,
WPREFIX_FG42,
WPREFIX_VICKERS,
WPREFIX_BREDA,
WPREFIX_F1_GRENADE,
WPREFIX_MILLS_GRENADE,
WPREFIX_NEBELHANDGRANATE,
WPREFIX_M18_SMOKE_GRENADE,
WPREFIX_RDG1_SMOKE_GRENADE,
WPREFIX_BOMBA,
WPREFIX_BOMBA_BREDA,
WPREFIX_MINE,
WPREFIX_MINE_DETECTOR,
WPREFIX_MINE_DETECTOR_AXIS,
WPREFIX_DETONATOR,
WPREFIX_KAR98_MORTAR,
WPREFIX_PIAT
WPREFIX_BOMBA_BREDA,
WPREFIX_MINE,
WPREFIX_MINE_DETECTOR,
WPREFIX_MINE_DETECTOR_AXIS,
WPREFIX_DETONATOR,
WPREFIX_KAR98_MORTAR,
WPREFIX_PIAT
};
int CG_GetVMAnimPrefixIndex()
{
const char* szWeaponName;
int iWeaponClass;
const char *szWeaponName;
int iWeaponClass;
iWeaponClass = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON];
szWeaponName = CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]);
if (iWeaponClass & WEAPON_CLASS_ANY_ITEM)
{
if (!Q_stricmp(szWeaponName, "Papers"))
return WPREFIX_PAPERS;
if (!Q_stricmp(szWeaponName, "Packed MG42 Turret"))
return WPREFIX_MG42_PORTABLE;
}
else if (iWeaponClass & WEAPON_CLASS_PISTOL)
{
if (!Q_stricmp(szWeaponName, "Colt 45"))
if (iWeaponClass & WEAPON_CLASS_ANY_ITEM) {
if (!Q_stricmp(szWeaponName, "Papers")) {
return WPREFIX_PAPERS;
}
if (!Q_stricmp(szWeaponName, "Packed MG42 Turret")) {
return WPREFIX_MG42_PORTABLE;
}
} else if (iWeaponClass & WEAPON_CLASS_PISTOL) {
if (!Q_stricmp(szWeaponName, "Colt 45")) {
return WPREFIX_COLT45;
if (!Q_stricmp(szWeaponName, "Walther P38"))
}
if (!Q_stricmp(szWeaponName, "Walther P38")) {
return WPREFIX_P38;
if (!Q_stricmp(szWeaponName, "Hi-Standard Silenced"))
return WPREFIX_HISTANDARD;
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "Webley Revolver"))
return WPREFIX_WEBLEY;
if (!Q_stricmp(szWeaponName, "Nagant Revolver"))
return WPREFIX_NAGANTREV;
if (!Q_stricmp(szWeaponName, "Beretta"))
return WPREFIX_BERETTA;
return WPREFIX_COLT45;
}
else if (iWeaponClass & WEAPON_CLASS_RIFLE)
{
if (!Q_stricmp(szWeaponName, "M1 Garand"))
return WPREFIX_GARAND;
if (!Q_stricmp(szWeaponName, "Mauser KAR 98K"))
return WPREFIX_KAR98;
if (!Q_stricmp(szWeaponName, "KAR98 - Sniper"))
return WPREFIX_KAR98SNIPER;
if (!Q_stricmp(szWeaponName, "Springfield '03 Sniper"))
return WPREFIX_SPRINGFIELD;
}
if (!Q_stricmp(szWeaponName, "Hi-Standard Silenced")) {
return WPREFIX_HISTANDARD;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "Lee-Enfield"))
return WPREFIX_SPRINGFIELD;
if (!Q_stricmp(szWeaponName, "SVT 40"))
return WPREFIX_SVT;
if (!Q_stricmp(szWeaponName, "Mosin Nagant Rifle"))
return WPREFIX_MOSIN;
if (!Q_stricmp(szWeaponName, "G 43"))
return WPREFIX_G43;
if (!Q_stricmp(szWeaponName, "Enfield L42A1"))
return WPREFIX_ENFIELD;
if (!Q_stricmp(szWeaponName, "Carcano"))
return WPREFIX_CARCANO;
if (!Q_stricmp(szWeaponName, "DeLisle"))
return WPREFIX_DELISLE;
if (!Q_stricmp(szWeaponName, "Webley Revolver")) {
return WPREFIX_WEBLEY;
}
if (!Q_stricmp(szWeaponName, "Nagant Revolver")) {
return WPREFIX_NAGANTREV;
}
if (!Q_stricmp(szWeaponName, "Beretta")) {
return WPREFIX_BERETTA;
}
return WPREFIX_COLT45;
} else if (iWeaponClass & WEAPON_CLASS_RIFLE) {
if (!Q_stricmp(szWeaponName, "M1 Garand")) {
return WPREFIX_GARAND;
}
if (!Q_stricmp(szWeaponName, "Mauser KAR 98K")) {
return WPREFIX_KAR98;
}
if (!Q_stricmp(szWeaponName, "KAR98 - Sniper")) {
return WPREFIX_KAR98SNIPER;
}
if (!Q_stricmp(szWeaponName, "Springfield '03 Sniper")) {
return WPREFIX_SPRINGFIELD;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "Lee-Enfield")) {
return WPREFIX_ENFIELD;
}
if (!Q_stricmp(szWeaponName, "SVT 40")) {
return WPREFIX_SVT;
}
if (!Q_stricmp(szWeaponName, "Mosin Nagant Rifle")) {
return WPREFIX_MOSIN;
}
if (!Q_stricmp(szWeaponName, "G 43")) {
return WPREFIX_G43;
}
if (!Q_stricmp(szWeaponName, "Enfield L42A1")) {
return WPREFIX_ENFIELDL42A;
}
if (!Q_stricmp(szWeaponName, "Carcano")) {
return WPREFIX_CARCANO;
}
if (!Q_stricmp(szWeaponName, "DeLisle")) {
return WPREFIX_DELISLE;
}
return WPREFIX_GARAND;
}
else if (iWeaponClass & WEAPON_CLASS_SMG)
{
if (!Q_stricmp(szWeaponName, "Thompson"))
} else if (iWeaponClass & WEAPON_CLASS_SMG) {
if (!Q_stricmp(szWeaponName, "Thompson")) {
return WPREFIX_THOMPSON;
if (!Q_stricmp(szWeaponName, "MP40"))
return WPREFIX_MP40;
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "Sten Mark II"))
return WPREFIX_STEN;
if (!Q_stricmp(szWeaponName, "PPSH SMG"))
return WPREFIX_PPSH;
if (!Q_stricmp(szWeaponName, "Moschetto"))
return WPREFIX_MOSCHETTO;
}
if (!Q_stricmp(szWeaponName, "MP40")) {
return WPREFIX_MP40;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "Sten Mark II")) {
return WPREFIX_STEN;
}
if (!Q_stricmp(szWeaponName, "PPSH SMG")) {
return WPREFIX_PPSH;
}
if (!Q_stricmp(szWeaponName, "Moschetto")) {
return WPREFIX_MOSCHETTO;
}
return WPREFIX_THOMPSON;
}
else if (iWeaponClass & WEAPON_CLASS_MG)
{
if (!Q_stricmp(szWeaponName, "BAR"))
} else if (iWeaponClass & WEAPON_CLASS_MG) {
if (!Q_stricmp(szWeaponName, "BAR")) {
return WPREFIX_BAR;
if (!Q_stricmp(szWeaponName, "StG 44"))
return WPREFIX_MP44;
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "FG 42"))
return WPREFIX_MP44;
if (!Q_stricmp(szWeaponName, "Vickers-Berthier"))
return WPREFIX_MP44;
if (!Q_stricmp(szWeaponName, "Breda"))
return WPREFIX_MP44;
}
if (!Q_stricmp(szWeaponName, "StG 44")) {
return WPREFIX_MP44;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "FG 42")) {
return WPREFIX_MP44;
}
if (!Q_stricmp(szWeaponName, "Vickers-Berthier")) {
return WPREFIX_VICKERS;
}
if (!Q_stricmp(szWeaponName, "Breda")) {
return WPREFIX_BREDA;
}
return WPREFIX_BAR;
}
else if (iWeaponClass & WEAPON_CLASS_GRENADE)
{
if (!Q_stricmp(szWeaponName, "Frag Grenade"))
} else if (iWeaponClass & WEAPON_CLASS_GRENADE) {
if (!Q_stricmp(szWeaponName, "Frag Grenade")) {
return WPREFIX_FRAGGRENADE;
if (!Q_stricmp(szWeaponName, "Stielhandgranate"))
return WPREFIX_STIELHANDGRANATE;
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "F1 Grenade"))
return WPREFIX_F1_GRENADE;
if (!Q_stricmp(szWeaponName, "Mills Grenade"))
return WPREFIX_MILLS_GRENADE;
if (!Q_stricmp(szWeaponName, "Nebelhandgranate"))
}
if (!Q_stricmp(szWeaponName, "Stielhandgranate")) {
return WPREFIX_STIELHANDGRANATE;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "F1 Grenade")) {
return WPREFIX_F1_GRENADE;
}
if (!Q_stricmp(szWeaponName, "Mills Grenade")) {
return WPREFIX_MILLS_GRENADE;
}
if (!Q_stricmp(szWeaponName, "Nebelhandgranate")) {
return WPREFIX_NEBELHANDGRANATE;
if (!Q_stricmp(szWeaponName, "M18 Smoke Grenade"))
return WPREFIX_M18_SMOKE_GRENADE;
if (!Q_stricmp(szWeaponName, "RDG-1 Smoke Grenade"))
return WPREFIX_RDG1_SMOKE_GRENADE;
if (!Q_stricmp(szWeaponName, "Bomba A Mano"))
}
if (!Q_stricmp(szWeaponName, "M18 Smoke Grenade")) {
return WPREFIX_M18_SMOKE_GRENADE;
}
if (!Q_stricmp(szWeaponName, "RDG-1 Smoke Grenade")) {
return WPREFIX_RDG1_SMOKE_GRENADE;
}
if (!Q_stricmp(szWeaponName, "Bomba A Mano")) {
return WPREFIX_BOMBA;
if (!Q_stricmp(szWeaponName, "Bomba A Mano Breda"))
return WPREFIX_BOMBA_BREDA;
if (!Q_stricmp(szWeaponName, "LandmineAllies"))
return WPREFIX_MINE;
if (!Q_stricmp(szWeaponName, "LandmineAxis"))
return WPREFIX_MINE;
if (!Q_stricmp(szWeaponName, "Minensuchgerat"))
return WPREFIX_MINE_DETECTOR_AXIS;
if (!Q_stricmp(szWeaponName, "Minedetector"))
return WPREFIX_MINE_DETECTOR;
}
if (!Q_stricmp(szWeaponName, "Bomba A Mano Breda")) {
return WPREFIX_BOMBA_BREDA;
}
if (!Q_stricmp(szWeaponName, "LandmineAllies")) {
return WPREFIX_MINE;
}
if (!Q_stricmp(szWeaponName, "LandmineAxis")) {
return WPREFIX_MINE;
}
if (!Q_stricmp(szWeaponName, "Minensuchgerat")) {
return WPREFIX_MINE_DETECTOR_AXIS;
}
if (!Q_stricmp(szWeaponName, "Minedetector")) {
return WPREFIX_MINE_DETECTOR;
}
return WPREFIX_FRAGGRENADE;
}
else if (iWeaponClass & WEAPON_CLASS_HEAVY)
{
if (!Q_stricmp(szWeaponName, "Bazooka"))
} else if (iWeaponClass & WEAPON_CLASS_HEAVY) {
if (!Q_stricmp(szWeaponName, "Bazooka")) {
return WPREFIX_BAZOOKA;
if (!Q_stricmp(szWeaponName, "Panzerschreck"))
}
if (!Q_stricmp(szWeaponName, "Panzerschreck")) {
return WPREFIX_PANZERSCHRECK;
if (!Q_stricmp(szWeaponName, "Shotgun"))
return WPREFIX_SHOTGUN;
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "PIAT"))
return WPREFIX_PIAT;
}
if (!Q_stricmp(szWeaponName, "Shotgun")) {
return WPREFIX_SHOTGUN;
}
//
// Team Assault and Team Tactics
//
if (!Q_stricmp(szWeaponName, "PIAT")) {
return WPREFIX_PIAT;
}
return WPREFIX_BAZOOKA;
}
@@ -294,63 +324,55 @@ int CG_GetVMAnimPrefixIndex()
return WPREFIX_UNARMED;
}
void CG_ViewModelAnimation(refEntity_t* pModel)
void CG_ViewModelAnimation(refEntity_t *pModel)
{
int i;
int iAnimFlags;
float fCrossblendTime, fCrossblendFrac, fCrossblendAmount;
float fAnimLength;
int iAnimPrefixIndex;
const char* pszAnimSuffix;
char szAnimName[MAX_QPATH];
dtiki_t* pTiki;
qboolean bAnimChanged;
int i;
int iAnimFlags;
float fCrossblendTime, fCrossblendFrac, fCrossblendAmount;
float fAnimLength;
int iAnimPrefixIndex;
const char *pszAnimSuffix;
char szAnimName[MAX_QPATH];
dtiki_t *pTiki;
qboolean bAnimChanged;
fCrossblendFrac = 0.0;
bAnimChanged = 0;
pTiki = pModel->tiki;
bAnimChanged = 0;
pTiki = pModel->tiki;
if (cgi.anim->g_iLastEquippedWeaponStat == cg.snap->ps.stats[STAT_EQUIPPED_WEAPON]
&& !strcmp(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1])))
{
&& !strcmp(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]))) {
iAnimPrefixIndex = cgi.anim->g_iLastAnimPrefixIndex;
}
else
{
iAnimPrefixIndex = CG_GetVMAnimPrefixIndex();
} else {
iAnimPrefixIndex = CG_GetVMAnimPrefixIndex();
cgi.anim->g_iLastEquippedWeaponStat = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON];
strcpy(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]));
cgi.anim->g_iLastAnimPrefixIndex = iAnimPrefixIndex;
bAnimChanged = qtrue;
bAnimChanged = qtrue;
}
if (cgi.anim->g_iLastVMAnim == -1)
{
if (cgi.anim->g_iLastVMAnim == -1) {
sprintf(szAnimName, "%s_idle", AnimPrefixList[iAnimPrefixIndex]);
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName);
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1)
{
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1) {
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle");
cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName);
}
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].time = 0.0;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].time = 0.0;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].weight = 1.0;
cgi.anim->g_iLastVMAnim = 0;
cgi.anim->g_iLastVMAnim = 0;
}
if (cg.snap->ps.iViewModelAnimChanged != cgi.anim->g_iLastVMAnimChanged)
{
bAnimChanged = qtrue;
cgi.anim->g_iLastVMAnim = cg.snap->ps.iViewModelAnim;
if (cg.snap->ps.iViewModelAnimChanged != cgi.anim->g_iLastVMAnimChanged) {
bAnimChanged = qtrue;
cgi.anim->g_iLastVMAnim = cg.snap->ps.iViewModelAnim;
cgi.anim->g_iLastVMAnimChanged = cg.snap->ps.iViewModelAnimChanged;
}
if (bAnimChanged)
{
switch (cgi.anim->g_iLastVMAnim)
{
if (bAnimChanged) {
switch (cgi.anim->g_iLastVMAnim) {
case VM_ANIM_CHARGE:
pszAnimSuffix = "charge";
break;
@@ -381,39 +403,35 @@ void CG_ViewModelAnimation(refEntity_t* pModel)
case VM_ANIM_LADDERSTEP:
pszAnimSuffix = "ladderstep";
break;
case VM_ANIM_IDLE_0:
pszAnimSuffix = "idle0";
break;
case VM_ANIM_IDLE_1:
pszAnimSuffix = "idle1";
break;
case VM_ANIM_IDLE_2:
pszAnimSuffix = "idle2";
break;
case VM_ANIM_DISABLED:
pszAnimSuffix = "disabled";
break;
case VM_ANIM_IDLE_0:
pszAnimSuffix = "idle0";
break;
case VM_ANIM_IDLE_1:
pszAnimSuffix = "idle1";
break;
case VM_ANIM_IDLE_2:
pszAnimSuffix = "idle2";
break;
case VM_ANIM_DISABLED:
pszAnimSuffix = "disabled";
break;
default:
case VM_ANIM_IDLE:
pszAnimSuffix = "idle";
break;
case VM_ANIM_IDLE:
pszAnimSuffix = "idle";
break;
}
sprintf(szAnimName, "%s_%s", AnimPrefixList[iAnimPrefixIndex], pszAnimSuffix);
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0)
{
if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0) {
fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
for (i = 0; i < MAX_FRAMEINFOS; ++i)
{
if (cgi.anim->g_VMFrameInfo[i].weight)
{
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
if (cgi.anim->g_VMFrameInfo[i].weight) {
if (i == cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = fCrossblendFrac;
}
else {
} else {
cgi.anim->g_VMFrameInfo[i].weight *= (1.0 - fCrossblendFrac);
}
}
@@ -423,94 +441,79 @@ void CG_ViewModelAnimation(refEntity_t* pModel)
cgi.anim->g_iCurrentVMAnimSlot = (cgi.anim->g_iCurrentVMAnimSlot + 1) % MAX_FRAMEINFOS;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, szAnimName);
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1)
{
if (cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index == -1) {
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index = cgi.Anim_NumForName(pTiki, "idle");
cgi.DPrintf("Warning: Couldn't find view model animation %s\n", szAnimName);
}
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].time = 0.0;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].time = 0.0;
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].weight = 1.0;
cgi.anim->g_iCurrentVMDuration = 0;
cgi.anim->g_iCurrentVMDuration = 0;
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
if (!fCrossblendTime)
{
for (i = 0; i < MAX_FRAMEINFOS; ++i)
{
if (!fCrossblendTime) {
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
if (i != cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = 0.0;
}
}
cgi.anim->g_bCrossblending = qfalse;
}
else
{
} else {
cgi.anim->g_bCrossblending = qtrue;
}
}
cgi.anim->g_iCurrentVMDuration += cg.frametime;
if (cgi.anim->g_bCrossblending)
{
if (cgi.anim->g_bCrossblending) {
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
if (fCrossblendAmount >= fCrossblendTime || fCrossblendAmount <= 0.0)
{
if (fCrossblendAmount >= fCrossblendTime || fCrossblendAmount <= 0.0) {
// clear crossblend values
for (i = 0; i < MAX_FRAMEINFOS; ++i)
{
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
if (i != cgi.anim->g_iCurrentVMAnimSlot) {
cgi.anim->g_VMFrameInfo[i].weight = 0.0;
}
}
cgi.anim->g_bCrossblending = qfalse;
}
else {
} else {
fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
}
}
for (i = 0; i < MAX_FRAMEINFOS; ++i)
{
if (!cgi.anim->g_VMFrameInfo[i].weight)
{
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
if (!cgi.anim->g_VMFrameInfo[i].weight) {
// clear the weight values of the ref entity
pModel->frameInfo[i].index = 0;
pModel->frameInfo[i].time = 0.0;
pModel->frameInfo[i].index = 0;
pModel->frameInfo[i].time = 0.0;
pModel->frameInfo[i].weight = 0.0;
}
else
{
} else {
fAnimLength = cgi.Anim_Time(pTiki, cgi.anim->g_VMFrameInfo[i].index);
cgi.anim->g_VMFrameInfo[i].time += cg.frametime / 1000.0;
if (cgi.anim->g_VMFrameInfo[i].time > fAnimLength)
{
if (cgi.Anim_Flags(pTiki, cgi.anim->g_VMFrameInfo[i].index) & TAF_DELTADRIVEN) {
cgi.anim->g_VMFrameInfo[i].time -= fAnimLength;
}
else {
cgi.anim->g_VMFrameInfo[i].time = fAnimLength;
if (cgi.anim->g_VMFrameInfo[i].time > fAnimLength) {
if (pTiki) {
if (cgi.Anim_Flags(pTiki, cgi.anim->g_VMFrameInfo[i].index) & TAF_DELTADRIVEN) {
cgi.anim->g_VMFrameInfo[i].time -= fAnimLength;
} else {
cgi.anim->g_VMFrameInfo[i].time = fAnimLength;
}
} else {
cgi.anim->g_VMFrameInfo[i].time = 0.f;
}
}
pModel->frameInfo[i].index = cgi.anim->g_VMFrameInfo[i].index;
pModel->frameInfo[i].time = cgi.anim->g_VMFrameInfo[i].time;
pModel->frameInfo[i].time = cgi.anim->g_VMFrameInfo[i].time;
if (cgi.anim->g_bCrossblending)
{
if (cgi.anim->g_bCrossblending) {
if (i == cgi.anim->g_iCurrentVMAnimSlot) {
pModel->frameInfo[i].weight = fCrossblendFrac;
} else {
pModel->frameInfo[i].weight = cgi.anim->g_VMFrameInfo[i].weight * (1.0 - fCrossblendFrac);
}
else {
pModel->frameInfo[i].weight *= (1.0 - fCrossblendFrac);
}
}
else
{
} else {
pModel->frameInfo[i].weight = 1.0;
}
}
@@ -519,60 +522,48 @@ void CG_ViewModelAnimation(refEntity_t* pModel)
pModel->actionWeight = 1.0;
}
void CG_CalcViewModelMovement(float fViewBobPhase, float fViewBobAmp, vec_t* vVelocity, vec_t* vMovement)
void CG_CalcViewModelMovement(float fViewBobPhase, float fViewBobAmp, vec_t *vVelocity, vec_t *vMovement)
{
int i;
float fPhase, fDelta;
int i;
float fPhase, fDelta;
vec3_t vTargOfs;
vec3_t vNorm;
fPhase = sin(fViewBobPhase + M_PI / 10) * fViewBobAmp * vm_sway_side->value;
fPhase = sin(fViewBobPhase + M_PI / 10) * fViewBobAmp * vm_sway_side->value;
vMovement[0] = fPhase * vm_sway_front->value;
vMovement[1] = fPhase;
fPhase = sin(fViewBobPhase - 0.94 + fViewBobPhase - 0.94 + M_PI);
fPhase = sin(fViewBobPhase - 0.94 + fViewBobPhase - 0.94 + M_PI);
vMovement[2] = (sin((fViewBobPhase - 0.94) * 4.0 + M_PI / 2) * 0.125 + fPhase) * fViewBobAmp * vm_sway_up->value;
if (cg.predicted_player_state.walking)
{
if (cg.predicted_player_state.viewheight == CROUCH_EYE_HEIGHT)
{
if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_BAZOOKA || cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_PANZERSCHRECK)
{
if (cg.predicted_player_state.walking) {
if (cg.predicted_player_state.viewheight == CROUCH_EYE_HEIGHT) {
if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_BAZOOKA
|| cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_PANZERSCHRECK) {
vTargOfs[0] = vm_offset_rocketcrouch_front->value;
vTargOfs[1] = vm_offset_rocketcrouch_side->value;
vTargOfs[2] = vm_offset_rocketcrouch_up->value;
}
else if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_SHOTGUN)
{
} else if (cgi.anim->g_iLastAnimPrefixIndex == WPREFIX_SHOTGUN) {
vTargOfs[0] = vm_offset_shotguncrouch_front->value;
vTargOfs[1] = vm_offset_shotguncrouch_side->value;
vTargOfs[2] = vm_offset_shotguncrouch_up->value;
}
else
{
} else {
vTargOfs[0] = vm_offset_crouch_front->value;
vTargOfs[1] = vm_offset_crouch_side->value;
vTargOfs[2] = vm_offset_crouch_up->value;
}
}
else
{
} else {
memset(vTargOfs, 0, sizeof(vTargOfs));
}
}
else
{
} else {
vTargOfs[0] = vm_offset_air_front->value;
vTargOfs[1] = vm_offset_air_side->value;
vTargOfs[2] = vm_offset_air_up->value;
}
if (cg.predicted_player_state.walking)
{
if (cg.predicted_player_state.walking) {
fDelta = VectorLength(vVelocity) - vm_offset_vel_base->value;
if (fDelta > 0.0)
{
if (fDelta > 0.0) {
if (fDelta > 250.0 - vm_offset_vel_base->value) {
fDelta = 250.0 - vm_offset_vel_base->value;
}
@@ -582,23 +573,19 @@ void CG_CalcViewModelMovement(float fViewBobPhase, float fViewBobAmp, vec_t* vVe
vTargOfs[1] += fPhase * vm_offset_vel_side->value;
vTargOfs[2] += fPhase * vm_offset_vel_up->value;
}
}
else if (vVelocity[2]) {
} else if (vVelocity[2]) {
vTargOfs[2] -= vVelocity[2] * vm_offset_upvel->value;
}
for (i = 0; i < 3; i++)
{
for (i = 0; i < 3; i++) {
fDelta = vTargOfs[i] - cgi.anim->g_vCurrentVMPosOffset[i];
cgi.anim->g_vCurrentVMPosOffset[i] += cg.frametime / 1000.0 * fDelta * vm_offset_speed->value;
if (fDelta > 0.0)
{
if (fDelta > 0.0) {
if (cgi.anim->g_vCurrentVMPosOffset[i] > vTargOfs[i]) {
cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i];
}
}
else if (fDelta < 0.0) {
} else if (fDelta < 0.0) {
if (cgi.anim->g_vCurrentVMPosOffset[i] < vTargOfs[i]) {
cgi.anim->g_vCurrentVMPosOffset[i] = vTargOfs[i];
}
File diff suppressed because it is too large. Load diff
+57 -30
View File
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cl_ui.h"
#include "../qcommon/tiki.h"
#include "../qcommon/localization.h"
#include "../qcommon/bg_compat.h"
extern qboolean loadCamera(const char *name);
extern void startCamera(int time);
@@ -290,19 +291,17 @@ void CL_CgameError( const char *string ) {
CL_ConfigstringModified
=====================
*/
void CL_ConfigstringModified( void ) {
char *old, *s;
int i, index;
void CL_ConfigstringModified(int index, char* s) {
char *old;
int i;
char *dup;
gameState_t oldGs;
size_t len;
index = atoi( Cmd_Argv(1) );
index = CPT_NormalizeConfigstring(index);
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
// get everything after "cs <num>"
s = Cmd_ArgsFrom(2);
old = cl.gameState.stringData + cl.gameState.stringOffsets[ index ];
if ( !strcmp( old, s ) ) {
@@ -346,6 +345,46 @@ void CL_ConfigstringModified( void ) {
}
/*
=====================
CL_ProcessServerCommand
=====================
*/
qboolean CL_ProcessServerCommand(const char* origString, const char* cmd, qboolean differentServer) {
if (!strcmp(cmd, "disconnect")) {
// Execute the disconnect command in the main loop
// Never call Com_Error there:
// because this function might be called from a module that would be unloaded
// inside Com_Error
UI_ForceMenuOff(1);
Cbuf_AddText("disconnect;pushmenu disconnected");
return qtrue;
}
if (!strcmp(cmd, "cs")) {
CL_ConfigstringModified(atoi(Cmd_Argv(1)), Cmd_ArgsFrom(2));
// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
Cmd_TokenizeString(origString);
return qtrue;
}
if (!strcmp(cmd, "fadesound")) {
Com_Printf("CL_ProcessServerCommand: fadesound '%s'\n", Cmd_Argv(1));
if (differentServer) {
Com_Printf("^~^~^ fadesound from previous map ignored\n");
return qfalse;
}
S_FadeSound(atof(Cmd_Argv(1)));
return qfalse;
}
// we may want to put a "connect to other server" command here
// cgame can now act on the command
return qtrue;
}
/*
===================
@@ -358,7 +397,6 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
char *s;
char *cmd;
static char bigConfigString[BIG_INFO_STRING];
int argc;
// if we have irretrievably lost a reliable command, drop the connection
if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) {
@@ -382,31 +420,10 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s );
}
rescan:
Cmd_TokenizeString( s );
cmd = Cmd_Argv(0);
argc = Cmd_Argc();
if ( !strcmp( cmd, "disconnect" ) ) {
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=552
// allow server to indicate why they were disconnected
if ( argc >= 2 )
Com_Error( ERR_SERVERDISCONNECT, "Server disconnected - %s", Cmd_Argv( 1 ) );
else
Com_Error( ERR_SERVERDISCONNECT, "Server disconnected\n" );
}
if ( !strcmp( cmd, "cs" ) ) {
CL_ConfigstringModified();
// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
Cmd_TokenizeString( s );
return qtrue;
}
// we may want to put a "connect to other server" command here
// cgame can now act on the command
return qtrue;
return CL_ProcessServerCommand(s, cmd, differentServer);
}
@@ -443,6 +460,16 @@ void CL_CG_Free( void *ptr )
Z_Free( ptr );
}
/*
====================
CL_CG_AddReliableCommand
====================
*/
void CL_CG_AddReliableCommand(const char* cmd)
{
CL_AddReliableCommand(cmd, qfalse);
}
/*
====================
CL_R_AddPolyToScene
@@ -572,7 +599,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->MSG_ReadCoord = CL_MSG_ReadCoord;
cgi->MSG_ReadDir = CL_MSG_ReadDir;
cgi->SendClientCommand = CL_AddReliableCommand;
cgi->SendClientCommand = CL_CG_AddReliableCommand;
cgi->CM_LoadMap = CL_CM_LoadMap;
cgi->CM_NumInlineModels = CM_NumInlineModels;
+2 -2
View File
@@ -1583,13 +1583,13 @@ void CIN_DrawCinematic (int handle) {
CIN_ResampleCinematic(handle, buf2);
re.DrawStretchRaw( x, y, w, h, 256, 256, (byte *)buf2, 0, qfalse);
re.DrawStretchRaw( x, y, w, h, 256, 256, 0, (byte *)buf2);
cinTable[handle].dirty = qfalse;
Hunk_FreeTempMemory(buf2);
return;
}
re.DrawStretchRaw( x, y, w, h, cinTable[handle].drawX, cinTable[handle].drawY, buf, 0, qfalse);
re.DrawStretchRaw( x, y, w, h, cinTable[handle].drawX, cinTable[handle].drawY, 0, buf);
cinTable[handle].dirty = qfalse;
}
-330
View File
@@ -1,330 +0,0 @@
/*
===========================================================================
Copyright (C) 2006 Tony J. White (tjw@tjw.org)
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifdef USE_CURL
#include "client.h"
cvar_t *cl_cURLLib;
#ifdef USE_CURL_DLOPEN
#include "../sys/sys_loadlib.h"
char* (*qcurl_version)(void);
CURL* (*qcurl_easy_init)(void);
CURLcode (*qcurl_easy_setopt)(CURL *curl, CURLoption option, ...);
CURLcode (*qcurl_easy_perform)(CURL *curl);
void (*qcurl_easy_cleanup)(CURL *curl);
CURLcode (*qcurl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
CURL* (*qcurl_easy_duphandle)(CURL *curl);
void (*qcurl_easy_reset)(CURL *curl);
const char *(*qcurl_easy_strerror)(CURLcode);
CURLM* (*qcurl_multi_init)(void);
CURLMcode (*qcurl_multi_add_handle)(CURLM *multi_handle,
CURL *curl_handle);
CURLMcode (*qcurl_multi_remove_handle)(CURLM *multi_handle,
CURL *curl_handle);
CURLMcode (*qcurl_multi_fdset)(CURLM *multi_handle,
fd_set *read_fd_set,
fd_set *write_fd_set,
fd_set *exc_fd_set,
int *max_fd);
CURLMcode (*qcurl_multi_perform)(CURLM *multi_handle,
int *running_handles);
CURLMcode (*qcurl_multi_cleanup)(CURLM *multi_handle);
CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
int *msgs_in_queue);
const char *(*qcurl_multi_strerror)(CURLMcode);
static void *cURLLib = NULL;
/*
=================
GPA
=================
*/
static void *GPA(char *str)
{
void *rv;
rv = Sys_LoadFunction(cURLLib, str);
if(!rv)
{
Com_Printf("Can't load symbol %s\n", str);
clc.cURLEnabled = qfalse;
return NULL;
}
else
{
Com_DPrintf("Loaded symbol %s (0x%p)\n", str, rv);
return rv;
}
}
#endif /* USE_CURL_DLOPEN */
/*
=================
CL_cURL_Init
=================
*/
qboolean CL_cURL_Init()
{
#ifdef USE_CURL_DLOPEN
if(cURLLib)
return qtrue;
Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
if( (cURLLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
#endif /* _WIN32 */
}
clc.cURLEnabled = qtrue;
qcurl_version = GPA("curl_version");
qcurl_easy_init = GPA("curl_easy_init");
qcurl_easy_setopt = GPA("curl_easy_setopt");
qcurl_easy_perform = GPA("curl_easy_perform");
qcurl_easy_cleanup = GPA("curl_easy_cleanup");
qcurl_easy_getinfo = GPA("curl_easy_getinfo");
qcurl_easy_duphandle = GPA("curl_easy_duphandle");
qcurl_easy_reset = GPA("curl_easy_reset");
qcurl_easy_strerror = GPA("curl_easy_strerror");
qcurl_multi_init = GPA("curl_multi_init");
qcurl_multi_add_handle = GPA("curl_multi_add_handle");
qcurl_multi_remove_handle = GPA("curl_multi_remove_handle");
qcurl_multi_fdset = GPA("curl_multi_fdset");
qcurl_multi_perform = GPA("curl_multi_perform");
qcurl_multi_cleanup = GPA("curl_multi_cleanup");
qcurl_multi_info_read = GPA("curl_multi_info_read");
qcurl_multi_strerror = GPA("curl_multi_strerror");
if(!clc.cURLEnabled)
{
CL_cURL_Shutdown();
Com_Printf("FAIL One or more symbols not found\n");
return qfalse;
}
Com_Printf("OK\n");
return qtrue;
#else
clc.cURLEnabled = qtrue;
return qtrue;
#endif /* USE_CURL_DLOPEN */
}
/*
=================
CL_cURL_Shutdown
=================
*/
void CL_cURL_Shutdown( void )
{
CL_cURL_Cleanup();
#ifdef USE_CURL_DLOPEN
if(cURLLib)
{
Sys_UnloadLibrary(cURLLib);
cURLLib = NULL;
}
qcurl_easy_init = NULL;
qcurl_easy_setopt = NULL;
qcurl_easy_perform = NULL;
qcurl_easy_cleanup = NULL;
qcurl_easy_getinfo = NULL;
qcurl_easy_duphandle = NULL;
qcurl_easy_reset = NULL;
qcurl_multi_init = NULL;
qcurl_multi_add_handle = NULL;
qcurl_multi_remove_handle = NULL;
qcurl_multi_fdset = NULL;
qcurl_multi_perform = NULL;
qcurl_multi_cleanup = NULL;
qcurl_multi_info_read = NULL;
qcurl_multi_strerror = NULL;
#endif /* USE_CURL_DLOPEN */
}
void CL_cURL_Cleanup(void)
{
if(clc.downloadCURLM) {
if(clc.downloadCURL) {
qcurl_multi_remove_handle(clc.downloadCURLM,
clc.downloadCURL);
qcurl_easy_cleanup(clc.downloadCURL);
}
qcurl_multi_cleanup(clc.downloadCURLM);
clc.downloadCURLM = NULL;
clc.downloadCURL = NULL;
}
else if(clc.downloadCURL) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
}
}
static int CL_cURL_CallbackProgress( void *dummy, double dltotal, double dlnow,
double ultotal, double ulnow )
{
clc.downloadSize = (int)dltotal;
Cvar_SetValue( "cl_downloadSize", clc.downloadSize );
clc.downloadCount = (int)dlnow;
Cvar_SetValue( "cl_downloadCount", clc.downloadCount );
return 0;
}
static int CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
void *stream)
{
FS_Write( buffer, size*nmemb, ((fileHandle_t*)stream)[0] );
return size*nmemb;
}
void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
{
clc.cURLUsed = qtrue;
Com_Printf("URL: %s\n", remoteURL);
Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
"Localname: %s\n"
"RemoteURL: %s\n"
"****************************\n", localName, remoteURL);
CL_cURL_Cleanup();
Q_strncpyz(clc.downloadURL, remoteURL, sizeof(clc.downloadURL));
Q_strncpyz(clc.downloadName, localName, sizeof(clc.downloadName));
Com_sprintf(clc.downloadTempName, sizeof(clc.downloadTempName),
"%s.tmp", localName);
// Set so UI gets access to it
Cvar_Set("cl_downloadName", localName);
Cvar_Set("cl_downloadSize", "0");
Cvar_Set("cl_downloadCount", "0");
Cvar_SetValue("cl_downloadTime", cls.realtime);
clc.downloadBlock = 0; // Starting new file
clc.downloadCount = 0;
clc.downloadCURL = qcurl_easy_init();
if(!clc.downloadCURL) {
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_easy_init() "
"failed\n");
return;
}
clc.download = FS_SV_FOpenFileWrite(clc.downloadTempName);
if(!clc.download) {
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: failed to open "
"%s for writing\n", clc.downloadTempName);
return;
}
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
if(developer->integer)
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
NET_AdrToString(clc.serverAddress)));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
Q3_VERSION, qcurl_version()));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
CL_cURL_CallbackWrite);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
CL_cURL_CallbackProgress);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
clc.downloadCURLM = qcurl_multi_init();
if(!clc.downloadCURLM) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_multi_init() "
"failed\n");
return;
}
qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
!clc.cURLDisconnected) {
CL_AddReliableCommand("disconnect");
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
clc.cURLDisconnected = qtrue;
}
}
void CL_cURL_PerformDownload(void)
{
CURLMcode res;
CURLMsg *msg;
int c;
int i = 0;
res = qcurl_multi_perform(clc.downloadCURLM, &c);
while(res == CURLM_CALL_MULTI_PERFORM && i < 100) {
res = qcurl_multi_perform(clc.downloadCURLM, &c);
i++;
}
if(res == CURLM_CALL_MULTI_PERFORM)
return;
msg = qcurl_multi_info_read(clc.downloadCURLM, &c);
if(msg == NULL) {
return;
}
FS_FCloseFile(clc.download);
if(msg->msg == CURLMSG_DONE && msg->data.result == CURLE_OK) {
FS_SV_Rename(clc.downloadTempName, clc.downloadName);
clc.downloadRestart = qtrue;
}
else {
long code;
qcurl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE,
&code);
Com_Error(ERR_DROP, "Download Error: %s Code: %ld URL: %s",
qcurl_easy_strerror(msg->data.result),
code, clc.downloadURL);
}
*clc.downloadTempName = *clc.downloadName = 0;
Cvar_Set( "cl_downloadName", "" );
CL_NextDownload();
}
#endif /* USE_CURL */
-4
View File
@@ -344,10 +344,6 @@ In game talk message
================
*/
void Message_Key( int key ) {
char buffer[MAX_STRING_CHARS];
if (key == K_ESCAPE) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_MESSAGE );
return;
+85 -47
View File
@@ -206,7 +206,7 @@ The given command will be transmitted to the server, and is gauranteed to
not have future usercmd_t executed before it is executed
======================
*/
void CL_AddReliableCommand( const char *cmd ) {
void CL_AddReliableCommand( const char *cmd, qboolean isDisconnectCmd ) {
int index;
// if we would be losing an old command that hasn't been acknowledged,
@@ -554,7 +554,7 @@ void CL_DemoCompleted( void )
}
}
CL_Disconnect( qtrue );
CL_Disconnect();
CL_NextDemo();
}
@@ -658,7 +658,7 @@ void CL_PlayDemo_f( void ) {
// 2 means don't force disconnect of local client
Cvar_Set( "sv_killserver", "2" );
CL_Disconnect( qtrue );
CL_Disconnect();
// open the demo file
arg = Cmd_Argv(1);
@@ -756,7 +756,7 @@ void CL_NextDemo( void ) {
CL_ShutdownAll
=====================
*/
void CL_ShutdownAll(void) {
void CL_ShutdownAll(qboolean shutdownRef) {
#ifdef USE_CURL
CL_cURL_Shutdown();
@@ -828,7 +828,7 @@ void CL_MapLoading( qboolean flush, const char *pszMapName ) {
else {
// clear nextmap so the cinematic shutdown doesn't execute it
Cvar_Set("nextmap", "");
CL_Disconnect(qtrue);
CL_Disconnect();
Q_strncpyz(cls.servername, "localhost", sizeof(cls.servername));
clc.state = CA_CHALLENGING; // so the connect screen is drawn
clc.connectStartTime = cls.realtime;
@@ -897,7 +897,7 @@ Sends a disconnect message to the server
This is also called on Com_Error and Com_Quit, so it shouldn't cause any errors
=====================
*/
void CL_Disconnect( qboolean showMainMenu ) {
void CL_Disconnect() {
if ( !com_cl_running || !com_cl_running->integer ) {
return;
}
@@ -927,7 +927,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
// send a disconnect message to the server
// send it a few times in case one is dropped
if ( clc.state >= CA_CONNECTED ) {
CL_AddReliableCommand( "disconnect" );
CL_AddReliableCommand( "disconnect", qtrue );
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
@@ -955,6 +955,19 @@ void CL_Disconnect( qboolean showMainMenu ) {
CL_UpdateGUID( NULL, 0 );
}
/*
===================
CL_AbnormalDisconnect
===================
*/
void CL_AbnormalDisconnect() {
CL_Disconnect();
UI_ServerLoaded();
if (developer->integer) {
UI_OpenConsole();
}
}
/*
===================
@@ -981,9 +994,9 @@ void CL_ForwardCommandToServer( const char *string ) {
}
if ( Cmd_Argc() > 1 ) {
CL_AddReliableCommand( string );
CL_AddReliableCommand( string, qfalse );
} else {
CL_AddReliableCommand( cmd );
CL_AddReliableCommand( cmd, qfalse );
}
}
@@ -1129,7 +1142,7 @@ void CL_ForwardToServer_f( void ) {
// don't forward the first argument
if ( Cmd_Argc() > 1 ) {
CL_AddReliableCommand( Cmd_Args() );
CL_AddReliableCommand( Cmd_Args(), qfalse );
}
}
@@ -1174,10 +1187,28 @@ CL_Disconnect_f
==================
*/
void CL_Disconnect_f( void ) {
SCR_StopCinematic();
Cvar_Set("ui_singlePlayerActive", "0");
if ( clc.state != CA_DISCONNECTED && clc.state != CA_CINEMATIC ) {
Com_Error (ERR_DISCONNECT, "Disconnected from server");
if ( clc.state != CA_DISCONNECTED ) {
qboolean bConsoleState = UI_ConsoleIsOpen();
Com_Printf("\nDisconnected from server\n");
SV_Shutdown("Disconnected from server\n");
if (com_cl_running && com_cl_running->integer)
{
CL_AbnormalDisconnect();
CL_FlushMemory();
CL_StartHunkUsers(qfalse);
S_StopAllSounds(1);
S_TriggeredMusic_PlayIntroMusic();
}
UI_FocusMenuIfExists();
if (bConsoleState) {
UI_OpenConsole();
} else {
UI_CloseConsole();
}
}
}
@@ -1223,7 +1254,7 @@ void CL_Connect( const char *server ) {
Cvar_Set( "sv_killserver", "1" );
SV_Frame( 0 );
CL_Disconnect( qtrue );
CL_Disconnect();
UI_CloseConsole();
/* MrE: 2000-09-13: now called in CL_DownloadsComplete
@@ -1417,7 +1448,7 @@ void CL_SendPureChecksums( void ) {
for (i = 0; i < 2; i++) {
cMsg[i] += 10;
}
CL_AddReliableCommand( cMsg );
CL_AddReliableCommand( cMsg, qfalse );
}
/*
@@ -1426,7 +1457,7 @@ CL_ResetPureClientAtServer
=================
*/
void CL_ResetPureClientAtServer( void ) {
CL_AddReliableCommand( va("vdr") );
CL_AddReliableCommand( va("vdr"), qfalse );
}
qboolean CL_Allowed_Vid_Restart() {
@@ -1472,7 +1503,7 @@ void CL_Vid_Restart_f( void ) {
// unpause so the cgame definately gets a snapshot and renders a frame
Com_Unpause();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SV_FinishSvsTimeFixups();
@@ -1602,7 +1633,7 @@ void CL_DownloadsComplete( void ) {
FS_Restart(clc.checksumFeed); // We possibly downloaded a pak, restart the file system to load it
// inform the server so we get new gamestate info
CL_AddReliableCommand( "donedl" );
CL_AddReliableCommand( "donedl", qfalse );
// by sending the donedl command we request a new gamestate
// so we don't want to load stuff yet
@@ -1612,11 +1643,11 @@ void CL_DownloadsComplete( void ) {
// let the client game init and load data
clc.state = CA_LOADING;
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
// Pump the loop, this may change gamestate!
Com_EventLoop();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
}
/*
@@ -1646,7 +1677,7 @@ void CL_BeginDownload( const char *localName, const char *remoteName ) {
clc.downloadBlock = 0; // Starting new file
clc.downloadCount = 0;
CL_AddReliableCommand( va("download %s", remoteName) );
CL_AddReliableCommand( va("download %s", remoteName), qfalse );
}
/*
@@ -1842,10 +1873,11 @@ wombat: sending conect here: an example connect string from MOHAA looks like thi
Info_SetValueForKey(info, "protocol", va("%i", com_protocol->integer));
Info_SetValueForKey( info, "qport", va("%i", port ) );
Info_SetValueForKey(info, "challenge", va("%i", clc.challenge));
Info_SetValueForKey(info, "version", TARGET_GAME_VERSION);
#if TARGET_GAME_PROTOCOL >= 15
Info_SetValueForKey(info, "clientType", "Breakthrough");
#endif
Info_SetValueForKey(info, "version", com_shortversion->string);
if (com_target_game->integer == target_game_e::TG_MOHTT) {
// only send if maintt is loaded
Info_SetValueForKey(info, "clientType", "Breakthrough");
}
strcpy(data, "connect ");
// TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
@@ -1890,16 +1922,11 @@ void CL_DisconnectPacket( netadr_t from ) {
return;
}
// if we have received packets within three seconds, ignore it
// (it might be a malicious spoof)
if ( cls.realtime - clc.lastPacketTime < 3000 ) {
return;
}
// drop the connection
Com_Printf( "Server disconnected for unknown reason\n" );
Cvar_Set("com_errorMessage", "Server disconnected for unknown reason\n" );
CL_Disconnect( qtrue );
Com_Printf("Server disconnected for unknown reason\n");
CL_Disconnect_f();
UI_ForceMenuOff(qtrue);
UI_PushMenu("serverdisconnected");
}
@@ -2203,15 +2230,26 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
CL_ServersResponsePacket( from, msg );
return;
}
// wombat: mohaa servers send this to reject clients
// TODO: tell the UI to draw serverdisconnect.urc serverfull.urc or servertimeout.urc
if ( !Q_stricmp(c, "droperror") ) {
reason = MSG_ReadString( msg );
Com_Printf( "Server dropped connection. Reason: %s", reason );
Cvar_Set("com_errorMessage", reason );
CL_Disconnect( qtrue );
reason = MSG_ReadString(msg);
Com_Printf("Server dropped connection. Reason: %s", reason);
Cvar_Set("com_errorMessage", reason);
CL_Disconnect_f();
UI_ForceMenuOff(qtrue);
UI_PushMenu("errormessage");
return;
}
}
if (!Q_stricmp(c, "wrongver")) {
reason = MSG_ReadString(msg);
Cvar_Set("com_errorMessage", va("Server is version %s, you are using %s, from base '%s'", reason, com_target_version->string, Cvar_VariableString("fs_basegame")));
CL_Disconnect_f();
UI_ForceMenuOff(qtrue);
UI_PushMenu("errormessage");
return;
}
Com_DPrintf ("Unknown connectionless packet command: \"%s\".\n", c);
}
@@ -2293,7 +2331,7 @@ void CL_CheckTimeout( void ) {
if (++cl.timeoutcount > 5) { // timeoutcount saves debugger
Com_Printf ("\nServer connection timed out.\n");
Cbuf_AddText( "pushmenu servertimeout\n" );
CL_Disconnect( qtrue );
CL_Disconnect();
return;
}
} else {
@@ -2345,7 +2383,7 @@ void CL_CheckUserinfo( void ) {
}
cvar_modifiedFlags &= ~CVAR_USERINFO;
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ) );
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ), qfalse );
}
}
@@ -2566,7 +2604,7 @@ After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
void CL_StartHunkUsers( qboolean rendererOnly ) {
if( !com_cl_running ) {
return;
}
@@ -3278,7 +3316,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
CL_InitConsoleCommands();
CL_InitRef();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SCR_Init ();
@@ -3294,7 +3332,7 @@ void CL_Init( void ) {
Cvar_Get( "cl_guid", "", CVAR_USERINFO | CVAR_ROM );
CL_UpdateGUID( NULL, 0 );
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
end = Sys_Milliseconds();
@@ -3326,7 +3364,7 @@ void CL_Shutdown(const char* finalmsg, qboolean disconnect, qboolean quit) {
noGameRestart = quit;
if(disconnect)
CL_Disconnect(qtrue);
CL_Disconnect();
S_Shutdown();
CL_ShutdownRef();
+47 -29
View File
@@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h"
#include "cl_ui.h"
#include "../qcommon/bg_compat.h"
const char *svc_strings[256] = {
"svc_bad",
@@ -278,6 +279,9 @@ void CL_ParseSnapshot( msg_t *msg ) {
} else {
MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps, cls.serverFrameTime);
}
// get normalized flags
newSnap.ps.pm_flags = CPT_NormalizePlayerStateFlags(newSnap.ps.net_pm_flags);
newSnap.ps.iViewModelAnim = CPT_NormalizeViewModelAnim(newSnap.ps.iNetViewModelAnim);
// read packet entities
SHOWNET( msg, "packet entities" );
@@ -444,27 +448,39 @@ static void CL_ParseServerInfo(void)
sizeof(clc.sv_dlURL));
}
#if TARGET_GAME_PROTOCOL >= 15
char* MSG_ReadGameStateChar(msg_t* msg) {
char* MSG_ReadGameStateChar_ver_15(msg_t* msg) {
return MSG_ReadScrambledBigString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
float MSG_ReadServerFrameTime_ver_15(msg_t* msg) {
return MSG_ReadFloat(msg);
}
#else
char* MSG_ReadGameStateChar(msg_t* msg) {
char* MSG_ReadGameStateChar_ver_6(msg_t* msg) {
return MSG_ReadString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
float MSG_ReadServerFrameTime_ver_6(msg_t* msg) {
return 1.f / atof(Info_ValueForKey(cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO], "sv_fps"));
}
#endif
char* MSG_ReadGameStateChar(msg_t* msg) {
if (MSG_IsProtocolVersion15()) {
return MSG_ReadGameStateChar_ver_15(msg);
} else {
// smaller below version 15
return MSG_ReadGameStateChar_ver_6(msg);
}
}
float MSG_ReadServerFrameTime(msg_t* msg) {
if (MSG_IsProtocolVersion15()) {
return MSG_ReadServerFrameTime_ver_15(msg);
} else {
// smaller below version 15
return MSG_ReadServerFrameTime_ver_6(msg);
}
}
/*
==================
@@ -472,7 +488,7 @@ CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg ) {
int i;
int i, csNum;
entityState_t *es;
int newnum;
entityState_t nullstate;
@@ -502,22 +518,24 @@ void CL_ParseGamestate( msg_t *msg ) {
}
if ( cmd == svc_configstring ) {
int len;
int len;
i = MSG_ReadShort( msg );
if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
s = MSG_ReadGameStateChar( msg );
len = strlen( s );
i = MSG_ReadShort(msg);
csNum = CPT_NormalizeConfigstring(i);
if (csNum < 0 || csNum >= MAX_CONFIGSTRINGS) {
Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
}
s = MSG_ReadGameStateChar(msg);
len = strlen(s);
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
}
// append it to the gameState string buffer
cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
cl.gameState.dataCount += len + 1;
if (len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS) {
Com_Error(ERR_DROP, "MAX_GAMESTATE_CHARS exceeded");
}
// append it to the gameState string buffer
cl.gameState.stringOffsets[csNum] = cl.gameState.dataCount;
Com_Memcpy(cl.gameState.stringData + cl.gameState.dataCount, s, len + 1);
cl.gameState.dataCount += len + 1;
} else if ( cmd == svc_baseline ) {
newnum = MSG_ReadEntityNum(msg);
if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
@@ -546,7 +564,7 @@ void CL_ParseGamestate( msg_t *msg ) {
CL_StopRecord_f();
// reinitialize the filesystem if the game directory has changed
FS_ConditionalRestart( clc.checksumFeed );
FS_ConditionalRestart( clc.checksumFeed, qfalse );
clc.state = CA_LOADING;
if (!com_sv_running->integer)
@@ -651,7 +669,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (!*clc.downloadTempName) {
Com_Printf("Server sending download, but no download was requested\n");
CL_AddReliableCommand( "stopdl" );
CL_AddReliableCommand( "stopdl", qfalse );
return;
}
@@ -693,7 +711,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (!clc.download) {
Com_Printf( "Could not create %s\n", clc.downloadTempName );
CL_AddReliableCommand( "stopdl" );
CL_AddReliableCommand( "stopdl", qfalse );
CL_NextDownload();
return;
}
@@ -702,7 +720,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (size)
FS_Write( data, size, clc.download );
CL_AddReliableCommand( va("nextdl %d", clc.downloadBlock) );
CL_AddReliableCommand( va("nextdl %d", clc.downloadBlock), qfalse );
clc.downloadBlock++;
clc.downloadCount += size;
@@ -716,7 +734,7 @@ void CL_ParseDownload ( msg_t *msg ) {
clc.download = 0;
// rename the file
FS_SV_Rename ( clc.downloadTempName, clc.downloadName );
FS_SV_Rename ( clc.downloadTempName, clc.downloadName, qfalse );
}
*clc.downloadTempName = *clc.downloadName = 0;
Cvar_Set( "cl_downloadName", "" );
+1 -1
View File
@@ -531,7 +531,7 @@ void SCR_UpdateScreen( void ) {
}
recursive = 1;
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SCR_SimpleUpdateScreen();
// set the fps value
+3 -3
View File
@@ -1114,7 +1114,7 @@ static void DMConsoleCommandHandler( const char *txt ) {
}
Com_sprintf(szStringOut, sizeof(szStringOut), "dmmessage %i %s\n", iMode, txt);
CL_AddReliableCommand(szStringOut);
CL_AddReliableCommand(szStringOut, qfalse);
}
/*
@@ -4399,7 +4399,7 @@ void StatsUpdater::UpdateStats( Event *ev )
}
if( paused && !paused->integer ) {
CL_AddReliableCommand( "stats" );
CL_AddReliableCommand( "stats", qfalse );
}
Event *event = new Event( EV_StatsUpdater_UpdateStats );
@@ -5019,7 +5019,7 @@ void UI_ShowStatistics_f() {
if( paused && !paused->integer )
{
statsRequestTime = cls.realtime;
CL_AddReliableCommand( "stats" );
CL_AddReliableCommand( "stats", qfalse );
Event *event = new Event( EV_StatsUpdater_UpdateStats );
statsUpdater.PostEvent( event, 2.0 );
}
+7
View File
@@ -30,6 +30,12 @@ typedef struct {
UIReggedMaterial *loading;
} static_media_t;
//
// cvars
//
extern cvar_t* ui_health_start;
extern cvar_t* ui_health_end;
//
// initialization
//
@@ -65,6 +71,7 @@ void UI_MenuEscape( const char *name );
void UI_CreateScoreboard( void );
qboolean UI_MenuActive( void );
qboolean UI_MenuUp( void );
void UI_FocusMenuIfExists(void);
void UI_DrawConnect( void );
void UI_CreateDialog( const char *title, char *cvarname, const char *command, const char *cancelCommand, int width, int height, const char *shader, const char *okshader, const char *cancelshader );
void UI_ToggleDMConsole( int iMode );
+12 -9
View File
@@ -161,10 +161,13 @@ void UIDMBox::PostDecayEvent( void )
}
}
//
// Bold as twice more decay
//
if (m_items[0].flags & DMBOX_ITEM_FLAG_BOLD) {
if (m_items[0].flags & DMBOX_ITEM_FLAG_BOLD) {
fDelayTime = iNumLines * 8.0;
}
//
// Bold as twice more decay
//
else if (m_items[0].flags & DMBOX_ITEM_FLAG_DEATH) {
fDelayTime = iNumLines * 6.0;
}
else {
@@ -285,7 +288,7 @@ void UIDMBox::Print( const char *text )
{
const char* text1 = text;
if (m_numitems > 4)
if (m_numitems > 5)
{
//
// Overwrite an item
@@ -307,15 +310,15 @@ void UIDMBox::Print( const char *text )
{
m_items[m_numitems].color = ULightRed;
m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
text1 = text + 1;
}
else if (*text == MESSAGE_CHAT_GREEN)
{
m_items[m_numitems].color = UGreen;
m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_BOLD;
m_items[m_numitems].font = m_fontbold;
m_items[m_numitems].flags |= DMBOX_ITEM_FLAG_DEATH;
text1 = text + 1;
}
@@ -377,7 +380,7 @@ void UIDMBox::Draw( void )
float alpha;
float alphaScale;
alphaScale = 0.8;
alphaScale = 0.8f;
HandleBoxMoving();
if (!m_numitems) {
+2 -1
View File
@@ -23,7 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef __CL_UIDMBOX_H__
#define __CL_UIDMBOX_H__
static constexpr unsigned int DMBOX_ITEM_FLAG_BOLD = 1u;
static constexpr unsigned int DMBOX_ITEM_FLAG_BOLD = 2u;
static constexpr unsigned int DMBOX_ITEM_FLAG_DEATH = 4u;
typedef enum { box_moving_out, box_moving_in, box_out, box_in } boxstate_t;
+34
View File
@@ -0,0 +1,34 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "cl_uiradar.h"
CLASS_DECLARATION( UIWidget, UIRadar, NULL )
{
{ NULL, NULL }
};
UIRadar::UIRadar()
{
m_fRadius = 32.f;
}
+34
View File
@@ -0,0 +1,34 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "../uilib/uiwidget.h"
class UIRadar : public UIWidget {
public:
CLASS_PROTOTYPE(UIRadar);
public:
UIRadar();
private:
float m_fRadius;
};
+447 -5
View File
@@ -614,17 +614,336 @@ void UIFakkLabel::DrawStatbar( float frac )
void UIFakkLabel::DrawStatCircle( float frac )
{
// FIXME: stub
vec4_t col;
float alpha;
float fCurrAng, fEndAng, fNextAng;
vec2_t vVerts[3];
vec2_t vTexCoords[3];
col[0] = 1.f;
col[1] = 1.f;
col[2] = 1.f;
col[3] = 1.f;
if (m_lastfrac != frac) {
m_flashtime = uid.time;
}
m_lastfrac = frac;
alpha = 1.f - (uid.time - m_flashtime) / 1500.f;
if (alpha < 0.f) alpha = 0.f;
else if (alpha > 1.f) alpha = 1.f;
col[3] = alpha;
vVerts[0][0] = m_frame.size.width * 0.5f;
vVerts[0][1] = m_frame.size.height * 0.5f;
vTexCoords[0][0] = 0.5f;
vTexCoords[0][1] = 0.5f;
if (ui_health_start->value && ui_health_end->value) {
m_angles[0] = ui_health_start->value;
m_angles[1] = ui_health_end->value;
}
fCurrAng = m_angles[0];
fEndAng = frac * (m_angles[1] - fCurrAng) + fCurrAng;
if (m_angles[1] > fCurrAng) {
StatCircleTexCoord(fCurrAng, vTexCoords[1]);
vVerts[1][0] = m_frame.size.width * vTexCoords[1][0];
vVerts[1][1] = m_frame.size.height * vTexCoords[1][1];
if ((int)fCurrAng - (((int)fCurrAng - 45) % 90 + 90) % 90 == (int)fEndAng - (((int)fEndAng - 45) % 90 + 90) % 90)
{
StatCircleTexCoord(fEndAng, vTexCoords[2]);
vVerts[2][0] = m_frame.size.width * vTexCoords[2][0];
vVerts[2][1] = m_frame.size.height * vTexCoords[2][1];
if (alpha && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha && m_statbar_material_flash) {
re.SetColor(col);
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
}
else
{
while (fCurrAng > fEndAng)
{
fNextAng = ((int)fCurrAng - (((int)fCurrAng - 45) % 90 + 90) % 90) + 90.0;
if (fNextAng > fEndAng) {
fNextAng = fEndAng;
}
StatCircleTexCoord(fNextAng, vTexCoords[2]);
vVerts[2][0] = m_frame.size.width * vTexCoords[2][0];
vVerts[2][1] = m_frame.size.height * vTexCoords[2][1];
if (alpha && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha && m_statbar_material_flash) {
re.SetColor(col);
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
vTexCoords[1][0] = vTexCoords[2][0];
vTexCoords[1][1] = vTexCoords[2][1];
vVerts[1][0] = vVerts[2][0];
vVerts[1][1] = vVerts[2][1];
fCurrAng = fNextAng;
}
}
} else {
StatCircleTexCoord(fCurrAng, vTexCoords[2]);
vVerts[2][0] = m_frame.size.width * vTexCoords[2][0];
vVerts[2][1] = m_frame.size.height * vTexCoords[2][1];
if ((int)fCurrAng - (((int)fCurrAng - 45) % 90 + 90) % 90 == (int)fEndAng
- (((int)fEndAng - 45) % 90 + 90) % 90)
{
StatCircleTexCoord(fEndAng, vTexCoords[1]);
vVerts[1][0] = m_frame.size.width * vTexCoords[1][0];
vVerts[1][1] = m_frame.size.height * vTexCoords[1][1];
if (alpha && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha && m_statbar_material_flash) {
re.SetColor(col);
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
}
else
{
while (fCurrAng > fEndAng)
{
fNextAng = ((int)fCurrAng - (((int)fCurrAng + 45) % 90 + 90) % 90);
if (fNextAng == fCurrAng) {
fNextAng -= 90.f;
}
if (fNextAng < fEndAng) {
fNextAng = fEndAng;
}
StatCircleTexCoord(fNextAng, vTexCoords[1]);
vVerts[1][0] = m_frame.size.width * vTexCoords[1][0];
vVerts[1][1] = m_frame.size.height * vTexCoords[1][1];
if (alpha && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha && m_statbar_material_flash) {
re.SetColor(col);
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
vTexCoords[2][0] = vTexCoords[1][0];
vTexCoords[2][1] = vTexCoords[1][1];
vVerts[2][0] = vVerts[1][0];
vVerts[2][1] = vVerts[1][1];
fCurrAng = fNextAng;
}
}
}
}
void UIFakkLabel::DrawStatNeedle( float frac )
{
// FIXME: stub
vec4_t col;
float alpha;
float fTargAng;
float fSinVal;
float fCosVal;
vec2_t vCenter;
vec2_t vVerts[3];
vec2_t vTexCoords[3];
vec2_t vNeedleDir;
vec2_t vSideDir;
col[0] = 1.f;
col[1] = 1.f;
col[2] = 1.f;
col[3] = 1.f;
if (m_lastfrac != frac) {
m_flashtime = uid.time;
}
m_lastfrac = frac;
alpha = 1.f - (uid.time - m_flashtime) / 1500.f;
if (alpha < 0.f) alpha = 0.f;
else if (alpha > 1.f) alpha = 1.f;
col[3] = alpha;
fTargAng = DEG2RAD(frac * (m_angles[1] - m_angles[0]) + m_angles[0]);
fSinVal = sin(fTargAng);
fCosVal = cos(fTargAng);
vSideDir[0] = m_frame.size.width * 0.5f;
vSideDir[1] = m_frame.size.height * 0.5f;
vCenter[0] = m_frame.size.width + fSinVal * vSideDir[0];
vCenter[1] = m_frame.size.height + -fCosVal * vSideDir[1];
vNeedleDir[0] = m_angles[2] * fCosVal;
vNeedleDir[1] = m_angles[2] * fSinVal;
vVerts[0][0] = vCenter[0] - vNeedleDir[0];
vVerts[0][1] = vCenter[1] - vNeedleDir[1];
vVerts[1][0] = vCenter[0] + vNeedleDir[0];
vVerts[1][1] = vCenter[1] + vNeedleDir[1];
vVerts[2][0] = vSideDir[0] - vNeedleDir[1] - vNeedleDir[0];
vVerts[2][1] = vSideDir[1] + vNeedleDir[0] - vNeedleDir[1];
vTexCoords[0][0] = 0.f;
vTexCoords[0][1] = 0.f;
vTexCoords[1][0] = 1.f;
vTexCoords[1][1] = 0.f;
vTexCoords[2][0] = 0.f;
vTexCoords[2][1] = 1.f;
if (alpha != 0.f) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(col);
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
vVerts[0][0] = vVerts[2][0];
vVerts[0][1] = vVerts[2][1];
vVerts[2][0] = m_angles[2] * vCenter[0] + m_frame.size.width * 0.5f - m_angles[2] * vCenter[1];
vVerts[2][1] = m_angles[2] * vCenter[1] + m_frame.size.height * 0.5f - m_angles[2] * -vCenter[0];
vTexCoords[0][0] = vTexCoords[2][0];
vTexCoords[0][1] = vTexCoords[2][1];
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
}
void UIFakkLabel::DrawStatRotator( float frac )
{
// FIXME: stub
vec4_t col;
float alpha;
float fTargAng;
float fSinVal, fCosVal;
vec2_t vCenter;
vec2_t vVerts[3];
vec2_t vTexCoords[3];
vec2_t vNeedleDir;
vec2_t vSize;
col[0] = 1.f;
col[1] = 1.f;
col[2] = 1.f;
col[3] = 1.f;
if (m_lastfrac != frac) {
m_flashtime = uid.time;
}
m_lastfrac = frac;
alpha = 1.f - (uid.time - m_flashtime) / 1500.f;
if (alpha < 0.f) alpha = 0.f;
else if (alpha > 1.f) alpha = 1.f;
col[3] = alpha;
fTargAng = DEG2RAD(frac * (m_angles[1] - m_angles[0]) + m_angles[0]);
fSinVal = sin(fTargAng);
fCosVal = cos(fTargAng);
vNeedleDir[0] = fSinVal;
vNeedleDir[1] = -fCosVal;
vSize[0] = (m_frame.size.width + m_frame.size.height) / m_frame.size.width * m_angles[2] * m_vVirtualScale[0];
vSize[1] = (m_frame.size.width + m_frame.size.height) / m_frame.size.height * m_scale * m_vVirtualScale[1];
vCenter[0] = (m_frame.size.width * 0.5f - vSize[0]) * vNeedleDir[0] + m_frame.size.width * 0.5f;
vCenter[1] = (m_frame.size.height * 0.5f - vSize[1]) * vNeedleDir[1] + m_frame.size.height * 0.5f;
vVerts[0][0] = vCenter[0] - vSize[0];
vVerts[0][1] = vCenter[1] - vSize[1];
vVerts[1][0] = vCenter[0] + vSize[0];
vVerts[1][1] = vCenter[1] - vSize[1];
vVerts[2][0] = vCenter[0] - vSize[0];
vVerts[2][1] = vCenter[1] + vSize[1];
vTexCoords[0][0] = 0.f;
vTexCoords[0][1] = 0.f;
vTexCoords[1][0] = 1.f;
vTexCoords[1][1] = 0.f;
vTexCoords[2][0] = 0.f;
vTexCoords[2][1] = 1.f;
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
vVerts[0][0] = vVerts[2][0];
vVerts[0][1] = vVerts[2][1];
vVerts[2][0] = vCenter[0] + vSize[0];
vVerts[2][1] = vCenter[1] + vSize[1];
vTexCoords[0][0] = vTexCoords[2][0];
vTexCoords[0][1] = vTexCoords[2][1];
vTexCoords[2][0] = 1.f;
vTexCoords[2][1] = 1.f;
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
}
void UIFakkLabel::DrawStatCompass( float frac )
@@ -839,12 +1158,135 @@ void UIFakkLabel::DrawStatCompass( float frac )
void UIFakkLabel::DrawStatSpinner( float frac )
{
// FIXME: stub
vec4_t col;
float alpha;
float fTargAng;
float fSinVal, fCosVal;
vec2_t vCenter;
vec2_t vVerts[3];
vec2_t vTexCoords[3];
vec2_t vCompassDir;
vec2_t vSideDir;
col[0] = 1.f;
col[1] = 1.f;
col[2] = 1.f;
col[3] = 1.f;
if (m_lastfrac != frac) {
m_flashtime = uid.time;
}
m_lastfrac = frac;
alpha = 1.f - (uid.time - m_flashtime) / 1500.f;
if (alpha < 0.f) alpha = 0.f;
else if (alpha > 1.f) alpha = 1.f;
col[3] = alpha;
if (m_statbar_or == L_STATBAR_HEADING_SPINNER) {
if (cge) {
vec3_t vViewAngles;
float fAngAlpha;
cge->CG_EyeAngles(&vViewAngles);
frac = (AngleSubtract(vViewAngles[1], frac * 360.f + 180.f) + 180.f) / 360.f;
if (frac < 0.f || frac > 1.f) {
frac = 0.f;
}
}
}
fTargAng = DEG2RAD(frac * (m_angles[1] - m_angles[0]) + m_angles[0]);
fSinVal = sin(fTargAng);
fCosVal = cos(fTargAng);
vSideDir[0] = fCosVal;
vSideDir[1] = fSinVal;
vCompassDir[0] = fSinVal;
vCompassDir[1] = -fCosVal;
vCenter[0] = m_frame.size.width * 0.5f;
vCenter[1] = m_frame.size.height * 0.5f;
vVerts[0][0] = (fSinVal * vCenter[0] + vCenter[0]) - (fCosVal * vCenter[1]);
vVerts[0][1] = (vCompassDir[1] * vCenter[1] + vCenter[1]) - (vSideDir[1] * vCenter[0]);
vVerts[1][0] = (fSinVal * vCenter[0] + vCenter[0]) + (fCosVal * vCenter[1]);
vVerts[1][1] = (vSideDir[1] * vCenter[0]) + (vCompassDir[1] * vCenter[1] + vCenter[1]);
vVerts[2][0] = vCenter[0] - fSinVal * vCenter[0] - fCosVal * vCenter[1];
vVerts[2][1] = vCenter[1] - vCompassDir[1] * vCenter[1] - vSideDir[1] * vCenter[0];
vTexCoords[0][0] = 0.f;
vTexCoords[0][1] = 0.f;
vTexCoords[1][0] = 1.f;
vTexCoords[1][1] = 0.f;
vTexCoords[2][0] = 0.f;
vTexCoords[2][1] = 1.f;
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
vVerts[0][0] = vVerts[2][0];
vVerts[0][1] = vVerts[2][1];
vVerts[2][0] = vCenter[1] * fCosVal + vCenter[0] - vCompassDir[0] * vCenter[0];
vVerts[2][1] = vCenter[0] * vSideDir[1] + vCenter[1] - vCompassDir[1] * vCenter[1];
vTexCoords[0][0] = vTexCoords[2][0];
vTexCoords[0][1] = vTexCoords[2][1];
vTexCoords[2][0] = 1.f;
vTexCoords[2][1] = 1.f;
if (alpha != 0.f && m_statbar_material_flash) {
re.SetColor(m_foreground_color);
}
m_statbar_material->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material->GetMaterial());
if (alpha != 0.f && m_statbar_material_flash) {
m_statbar_material_flash->ReregisterMaterial();
re.DrawTrianglePic(vVerts, vTexCoords, m_statbar_material_flash->GetMaterial());
}
}
void UIFakkLabel::StatCircleTexCoord( float fAng, vec3_t vTexCoord )
{
// FIXME: stub
int iSector;
float fSinVal, fCosVal;
iSector = (AngleMod(fAng) + 45.f) / 90;
fSinVal = sin(DEG2RAD(fAng));
fCosVal = cos(DEG2RAD(fAng));
if (iSector >= 0) {
if (iSector == 0) {
vTexCoord[0] = 0.f;
vTexCoord[1] = 0.5f / fCosVal * fSinVal + 0.5f;
} else if (iSector == 1) {
vTexCoord[0] = 1.f;
vTexCoord[1] = -0.5f / fSinVal * fCosVal + 0.5f;
} else if (iSector == 2) {
vTexCoord[0] = fSinVal * (-0.5f * fCosVal) + 0.5f;
vTexCoord[1] = 1.f;
} else if (iSector == 4) {
vTexCoord[0] = 0.5f / fCosVal * fSinVal + 0.5f;
vTexCoord[1] = 0.f;
} else {
vTexCoord[0] = 0.f;
vTexCoord[1] = 0.5f / fSinVal * fCosVal + 0.5f;
}
} else {
vTexCoord[0] = 0.f;
vTexCoord[1] = 0.5f / fSinVal * fCosVal + 0.5f;
}
}
void UIFakkLabel::Draw( void )
+3 -6
View File
@@ -463,13 +463,10 @@ extern cvar_t* j_up_axis;
//
void CL_Init (void);
void CL_InitClientSavedData( void );
void CL_InitRef( void );
void CL_FlushMemory(void);
void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd );
void CL_InitClientSavedData(void);
void CL_AddReliableCommand(const char *cmd, qboolean isDisconnectCmd);
void CL_StartHunkUsers( void );
void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Connect( const char *server );
+31 -27
View File
@@ -92,7 +92,7 @@ S_IsSoundPlaying
*/
int S_IsSoundPlaying(int channelNumber, const char* name)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0;
}
@@ -104,7 +104,7 @@ MUSIC_Pause
*/
void MUSIC_Pause()
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -115,7 +115,7 @@ MUSIC_Unpause
*/
void MUSIC_Unpause()
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -126,7 +126,7 @@ MUSIC_LoadSoundtrackFile
*/
qboolean MUSIC_LoadSoundtrackFile(const char* filename)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -138,7 +138,7 @@ MUSIC_SongValid
*/
qboolean MUSIC_SongValid(const char* mood)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -150,7 +150,7 @@ MUSIC_Loaded
*/
qboolean MUSIC_Loaded(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -162,7 +162,7 @@ Music_Update
*/
void Music_Update(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -173,7 +173,7 @@ MUSIC_SongEnded
*/
void MUSIC_SongEnded(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -184,7 +184,7 @@ S_StartSound
*/
void MUSIC_NewSoundtrack(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -195,7 +195,7 @@ MUSIC_UpdateMood
*/
void MUSIC_UpdateMood(int current, int fallback)
{
// FIXME: stub
// FIXME: unimplemented
//STUB();
}
@@ -206,7 +206,7 @@ MUSIC_UpdateVolume
*/
void MUSIC_UpdateVolume(float volume, float fade_time)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -217,7 +217,7 @@ MUSIC_StopAllSongs
*/
void MUSIC_StopAllSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -228,7 +228,7 @@ MUSIC_FreeAllSongs
*/
void MUSIC_FreeAllSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -239,7 +239,7 @@ MUSIC_Playing
*/
qboolean MUSIC_Playing(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -251,7 +251,7 @@ MUSIC_FindSong
*/
int MUSIC_FindSong(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0;
}
@@ -263,7 +263,7 @@ MUSIC_CurrentSongChannel
*/
int MUSIC_CurrentSongChannel(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0;
}
@@ -275,7 +275,7 @@ MUSIC_StopChannel
*/
void MUSIC_StopChannel(int channel_number)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -286,7 +286,7 @@ MUSIC_PlaySong
*/
qboolean MUSIC_PlaySong(const char* alias)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -298,7 +298,7 @@ MUSIC_UpdateMusicVolumes
*/
void MUSIC_UpdateMusicVolumes(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -309,7 +309,7 @@ MUSIC_CheckForStoppedSongs
*/
void MUSIC_CheckForStoppedSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -320,7 +320,7 @@ S_IsSoundRegistered
*/
qboolean S_IsSoundRegistered(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
return qfalse;
}
/*
@@ -330,7 +330,7 @@ S_GetSoundTime
*/
float S_GetSoundTime(sfxHandle_t handle)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0.0;
}
@@ -342,7 +342,7 @@ S_SetGlobalAmbientVolumeLevel
*/
void S_SetGlobalAmbientVolumeLevel(float volume)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -353,7 +353,7 @@ S_SetReverb
*/
void S_SetReverb(int reverb_type, float reverb_level)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -364,15 +364,19 @@ S_EndRegistration
*/
void S_EndRegistration(void)
{
// FIXME: stub
// FIXME: unimplemented
}
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener)
{
// FIXME: stub
// FIXME: unimplemented
}
void S_FadeSound(float fTime)
{
// FIXME: stub
// FIXME: unimplemented
}
void S_TriggeredMusic_PlayIntroMusic() {
// FIXME: unimplemented
}
+1
View File
@@ -50,6 +50,7 @@ int S_IsSoundPlaying(int channelNumber, const char* name);
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener);
void S_FadeSound(float fTime);
void S_TriggeredMusic_PlayIntroMusic();
#ifdef __cplusplus
}
-5
View File
@@ -34,7 +34,6 @@ VehicleCollisionEntity::VehicleCollisionEntity
(
Entity *ent
)
{
if( LoadingSavegame )
{
@@ -59,7 +58,6 @@ VehicleCollisionEntity::VehicleCollisionEntity
(
void
)
{
if( LoadingSavegame )
{
@@ -73,7 +71,6 @@ void VehicleCollisionEntity::EventDamage
(
Event *ev
)
{
Event *event = new Event( ev );
@@ -84,7 +81,6 @@ void VehicleCollisionEntity::Solid
(
void
)
{
setContents( CONTENTS_SOLID );
setSolidType( SOLID_BSP );
@@ -94,7 +90,6 @@ void VehicleCollisionEntity::NotSolid
(
void
)
{
setSolidType( SOLID_NOT );
}
-1
View File
@@ -51,7 +51,6 @@ void VehicleCollisionEntity::Archive
(
Archiver& arc
)
{
Entity::Archive( arc );
-4
View File
@@ -37,7 +37,6 @@ void cVehicleSlot::NotSolid
(
void
)
{
if( !( flags & FL_SWIM ) )
{
@@ -62,7 +61,6 @@ void cVehicleSlot::Solid
(
void
)
{
if( !( flags & FL_SWIM ) )
{
@@ -96,7 +94,6 @@ void cTurretSlot::NotSolid
(
void
)
{
if( !( flags & FL_SWIM ) )
{
@@ -131,7 +128,6 @@ void cTurretSlot::Solid
(
void
)
{
if( !( flags & FL_SWIM ) )
{
-2
View File
@@ -59,7 +59,6 @@ void cVehicleSlot::Archive
(
Archiver& arc
)
{
Class::Archive( arc );
@@ -90,7 +89,6 @@ void cTurretSlot::Archive
(
Archiver& arc
)
{
cVehicleSlot::Archive( arc );
-4
View File
@@ -73,7 +73,6 @@ void VehicleSoundEntity::Start
(
void
)
{
m_bDoSoundStuff = true;
}
@@ -82,7 +81,6 @@ void VehicleSoundEntity::Stop
(
void
)
{
m_bDoSoundStuff = false;
}
@@ -91,7 +89,6 @@ void VehicleSoundEntity::Think
(
void
)
{
DoSoundStuff();
}
@@ -142,7 +139,6 @@ void VehicleSoundEntity::DoSoundStuff
(
void
)
{
float pitch;
-1
View File
@@ -56,7 +56,6 @@ void VehicleSoundEntity::Archive
(
Archiver& arc
)
{
Entity::Archive( arc );
File diff suppressed because it is too large. Load diff
-2
View File
@@ -1289,7 +1289,6 @@ inline void Actor::ArchiveStatic
(
Archiver &arc
)
{
for( int i = MAX_BODYQUEUE - 1; i >= 0; i-- )
{
@@ -1303,7 +1302,6 @@ inline void Actor::Archive
(
Archiver &arc
)
{
SimpleActor::Archive( arc );
-4
View File
@@ -28,7 +28,6 @@ void Actor::InitAim
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Aim;
func->ThinkState = &Actor::Think_Aim;
@@ -40,7 +39,6 @@ void Actor::Begin_Aim
(
void
)
{
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
@@ -50,7 +48,6 @@ void Actor::Think_Aim
(
void
)
{
if( !RequireThink() )
return;
@@ -73,7 +70,6 @@ void Actor::ShowInfo_Aim
(
void
)
{
ShowInfo_AimNode();
}
-8
View File
@@ -28,7 +28,6 @@ void Actor::InitAlarm
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Alarm;
func->EndState = &Actor::End_Alarm;
@@ -41,7 +40,6 @@ void Actor::Begin_Alarm
(
void
)
{
DoForceActivate();
@@ -74,7 +72,6 @@ void Actor::End_Alarm
(
void
)
{
parm.movefail = true;
}
@@ -83,7 +80,6 @@ void Actor::State_Alarm_StartThread
(
void
)
{
if( m_AlarmNode )
SetLeashHome( m_AlarmNode->origin );
@@ -98,7 +94,6 @@ void Actor::State_Alarm_Move
(
void
)
{
if( PathExists() )
{
@@ -127,7 +122,6 @@ void Actor::State_Alarm_Idle
(
void
)
{
AimAtTargetPos();
SetThink(THINKSTATE_ATTACK, THINK_TURRET);
@@ -137,7 +131,6 @@ void Actor::Think_Alarm
(
void
)
{
if( !RequireThink() )
return;
@@ -167,7 +160,6 @@ void Actor::FinishedAnimation_Alarm
(
void
)
{
// not needed
return;
-5
View File
@@ -28,7 +28,6 @@ void Actor::InitAnim
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Anim;
func->BeginState = &Actor::Begin_Anim;
@@ -42,7 +41,6 @@ void Actor::Begin_Anim
(
void
)
{
m_csMood = m_csIdleMood;
ClearPath();
@@ -54,7 +52,6 @@ void Actor::Think_Anim
(
void
)
{
if (RequireThink())
{
@@ -87,7 +84,6 @@ void Actor::FinishedAnimation_Anim
(
void
)
{
if (!m_bAnimScriptSet)
{
@@ -103,7 +99,6 @@ void Actor::ShowInfo_Anim
(
void
)
{
Com_Printf("anim script: %s, anim mode %d\n", Director.GetString(m_csAnimScript).c_str(), m_AnimMode);
}
-32
View File
@@ -28,7 +28,6 @@ const_str SimpleActor::GetRunAnim
(
void
)
{
if( m_csCurrentPosition != STRING_PRONE && ( m_csCurrentPosition < STRING_PRONE || m_csCurrentPosition > STRING_CROUCHRUN ) )
return STRING_ANIM_RUN_SCR;
@@ -40,7 +39,6 @@ const_str SimpleActor::GetWalkAnim
(
void
)
{
if( m_csCurrentPosition != STRING_PRONE && ( m_csCurrentPosition < STRING_PRONE || m_csCurrentPosition > STRING_CROUCHRUN ) )
return STRING_ANIM_WALK_SCR;
@@ -52,7 +50,6 @@ void SimpleActor::Anim_Attack
(
void
)
{
DesiredAnimation(1, m_AttackHandler);
}
@@ -61,7 +58,6 @@ void SimpleActor::Anim_Sniper
(
void
)
{
DesiredAnimation(1, m_SniperHandler);
}
@@ -70,7 +66,6 @@ void SimpleActor::Anim_Aim
(
void
)
{
DesiredAnimation(1, STRING_ANIM_AIM_SCR);
}
@@ -79,7 +74,6 @@ void SimpleActor::Anim_Shoot
(
void
)
{
DesiredAnimation(1, STRING_ANIM_SHOOT_SCR);
}
@@ -88,7 +82,6 @@ void SimpleActor::Anim_Idle
(
void
)
{
DesiredAnimation(1, STRING_ANIM_IDLE_SCR);
}
@@ -97,7 +90,6 @@ void SimpleActor::Anim_Crouch
(
void
)
{
DesiredAnimation(1, STRING_ANIM_CROUCH_SCR);
}
@@ -106,7 +98,6 @@ void SimpleActor::Anim_Prone
(
void
)
{
DesiredAnimation(1, STRING_ANIM_PRONE_SCR);
}
@@ -115,7 +106,6 @@ void SimpleActor::Anim_Stand
(
void
)
{
DesiredAnimation(1, STRING_ANIM_STAND_SCR);
}
@@ -124,7 +114,6 @@ void SimpleActor::Anim_Cower
(
void
)
{
DesiredAnimation(1, STRING_ANIM_COWER_SCR);
}
@@ -133,7 +122,6 @@ void SimpleActor::Anim_Killed
(
void
)
{
Com_Printf("m_eAnimMode Anim_Killed \n");
DesiredAnimation(1, m_DeathHandler);
@@ -143,7 +131,6 @@ void SimpleActor::Anim_StartPain
(
void
)
{
Com_Printf("m_eAnimMode Anim_StartPain \n");
StartAnimation(1, m_PainHandler);
@@ -154,7 +141,6 @@ void SimpleActor::Anim_Pain
(
void
)
{
ContinueAnimation();
}
@@ -164,7 +150,6 @@ void SimpleActor::Anim_CrouchRunTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_RUN_SCR);
}
@@ -173,7 +158,6 @@ void SimpleActor::Anim_CrouchWalkTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_WALK_SCR);
}
@@ -182,7 +166,6 @@ void SimpleActor::Anim_StandRunTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SCR);
}
@@ -191,7 +174,6 @@ void SimpleActor::Anim_StandWalkTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_WALK_SCR);
}
@@ -200,7 +182,6 @@ void SimpleActor::Anim_RunTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, GetRunAnim());
}
@@ -209,7 +190,6 @@ void SimpleActor::Anim_WalkTo
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, GetWalkAnim());
}
@@ -218,7 +198,6 @@ void SimpleActor::Anim_RunAwayFiring
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNAWAYFIRING_SCR);
}
@@ -227,7 +206,6 @@ void SimpleActor::Anim_RunToShooting
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SHOOT_SCR);
}
@@ -236,7 +214,6 @@ void SimpleActor::Anim_RunToAlarm
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_ALARM_SCR);
}
@@ -245,7 +222,6 @@ void SimpleActor::Anim_RunToCasual
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_CASUAL_SCR);
}
@@ -254,7 +230,6 @@ void SimpleActor::Anim_RunToCover
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_COVER_SCR);
}
@@ -263,7 +238,6 @@ void SimpleActor::Anim_RunToDanger
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DANGER_SCR);
}
@@ -272,7 +246,6 @@ void SimpleActor::Anim_RunToDive
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DIVE_SCR);
}
@@ -281,7 +254,6 @@ void SimpleActor::Anim_RunToFlee
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_FLEE_SCR);
}
@@ -290,7 +262,6 @@ void SimpleActor::Anim_RunToInOpen
(
int eAnimMode
)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_INOPEN_SCR);
}
@@ -299,7 +270,6 @@ void SimpleActor::Anim_Emotion
(
eEmotionMode eEmotMode
)
{
m_eEmotionMode = eEmotMode;
}
@@ -310,7 +280,6 @@ void SimpleActor::Anim_Say
int iMinTimeSinceLastSay,
bool bCanInterrupt
)
{
if (!m_bSayAnimSet || bCanInterrupt)
{
@@ -329,7 +298,6 @@ void SimpleActor::Anim_FullBody
const_str csFullBodyAnim,
int eAnimMode
)
{
if( m_csAnimName == csFullBodyAnim )
{
-4
View File
@@ -28,7 +28,6 @@ void Actor::InitAnimCurious
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_AnimCurious;
func->BeginState = &Actor::Begin_AnimCurious;
@@ -42,7 +41,6 @@ void Actor::Begin_AnimCurious
(
void
)
{
DoForceActivate();
@@ -56,7 +54,6 @@ void Actor::Think_AnimCurious
(
void
)
{
if( !RequireThink() )
return;
@@ -74,7 +71,6 @@ void Actor::FinishedAnimation_AnimCurious
(
void
)
{
if( m_State == 1101 )
{
-20
View File
@@ -29,7 +29,6 @@ void Actor::InitBalconyIdle
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Idle;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Idle;
@@ -42,7 +41,6 @@ void Actor::InitBalconyCurious
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Curious;
func->BeginState = &Actor::Begin_Curious;
@@ -60,7 +58,6 @@ void Actor::InitBalconyAttack
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_BalconyAttack;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Attack;
@@ -76,7 +73,6 @@ void Actor::InitBalconyDisguise
(
GlobalFuncs_t *func
)
{
func->IsState = &Actor::IsDisguiseState;
}
@@ -85,7 +81,6 @@ void Actor::InitBalconyGrenade
(
GlobalFuncs_t *func
)
{
func->IsState = &Actor::IsGrenadeState;
}
@@ -94,7 +89,6 @@ void Actor::InitBalconyPain
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Pain;
func->ThinkState = &Actor::Think_Pain;
@@ -108,7 +102,6 @@ void Actor::InitBalconyKilled
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_BalconyKilled;
func->EndState = &Actor::End_BalconyKilled;
@@ -121,7 +114,6 @@ void Actor::Pain_Balcony
(
Event *ev
)
{
SetThink( THINKSTATE_PAIN, THINK_BALCONY_PAIN);
HandlePain( ev );
@@ -132,7 +124,6 @@ void Actor::Killed_Balcony
Event *ev,
bool bPlayDeathAnim
)
{
ClearStates();
SetThink( THINKSTATE_KILLED, THINK_BALCONY_KILLED);
@@ -146,7 +137,6 @@ void Actor::Begin_BalconyAttack
(
void
)
{
TransitionState(200, 0);
}
@@ -155,7 +145,6 @@ void Actor::State_Balcony_PostShoot
(
void
)
{
if( m_Enemy )
{
@@ -167,7 +156,6 @@ void Actor::State_Balcony_FindEnemy
(
void
)
{
m_bHasDesiredLookAngles = false;
Anim_Aim();
@@ -182,7 +170,6 @@ void Actor::State_Balcony_Target
(
void
)
{
Anim_Aim();
AimAtTargetPos();
@@ -205,7 +192,6 @@ void Actor::State_Balcony_Shoot
(
void
)
{
Anim_Shoot();
AimAtTargetPos();
@@ -215,7 +201,6 @@ void Actor::Think_BalconyAttack
(
void
)
{
if( !RequireThink() )
return;
@@ -260,7 +245,6 @@ void Actor::FinishedAnimation_BalconyAttack
(
void
)
{
if( m_State == 202 )
State_Balcony_PostShoot();
@@ -270,7 +254,6 @@ void Actor::Begin_BalconyKilled
(
void
)
{
ClearPath();
ResetBoneControllers();
@@ -287,7 +270,6 @@ void Actor::End_BalconyKilled
(
void
)
{
if( m_pFallPath )
{
@@ -300,7 +282,6 @@ void Actor::Think_BalconyKilled
(
void
)
{
int animnum;
@@ -395,7 +376,6 @@ void Actor::FinishedAnimation_BalconyKilled
(
void
)
{
if( m_State == 804 || m_State == 806 )
{
-23
View File
@@ -28,7 +28,6 @@ void Actor::InitCover
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Cover;
func->BeginState = &Actor::Begin_Cover;
@@ -44,7 +43,6 @@ void Actor::Begin_Cover
(
void
)
{
DoForceActivate();
m_csIdleMood = STRING_NERVOUS;
@@ -74,7 +72,6 @@ void Actor::End_Cover
(
void
)
{
m_pszDebugState = "";
@@ -91,7 +88,6 @@ void Actor::Suspend_Cover
(
void
)
{
if( m_pCoverNode )
{
@@ -107,7 +103,6 @@ void Actor::State_Cover_NewEnemy
(
void
)
{
m_bHasDesiredLookAngles = true;
@@ -130,7 +125,6 @@ void Actor::State_Cover_FindCover
(
void
)
{
Anim_Aim();
AimAtTargetPos();
@@ -161,7 +155,6 @@ void Actor::State_Cover_TakeCover
(
void
)
{
if( PathExists() && !PathComplete() )
{
@@ -194,7 +187,6 @@ void Actor::State_Cover_FinishReloading
(
void
)
{
if( m_bInReload )
{
@@ -238,7 +230,6 @@ void Actor::State_Cover_Target
(
void
)
{
DontFaceWall();
@@ -279,7 +270,6 @@ void Actor::State_Cover_Hide
(
void
)
{
if (m_Enemy)
{
@@ -456,7 +446,6 @@ void Actor::State_Cover_Shoot
(
void
)
{
if (m_bNeedReload)
{
@@ -486,7 +475,6 @@ void Actor::State_Cover_Grenade
(
void
)
{
GenericGrenadeTossThink();
}
@@ -495,7 +483,6 @@ void Actor::State_Cover_SpecialAttack
(
void
)
{
m_bHasDesiredLookAngles = false;
@@ -543,7 +530,6 @@ void Actor::State_Cover_FindEnemy
(
void
)
{
if( m_Team == TEAM_AMERICAN )
{
@@ -590,7 +576,6 @@ void Actor::State_Cover_SearchNode
(
void
)
{
m_bHasDesiredLookAngles = false;
@@ -623,7 +608,6 @@ void Actor::State_Cover_HuntEnemy
(
void
)
{
FaceEnemyOrMotion( level.inttime - m_iStateTime );
MovePathWithLeash();
@@ -651,7 +635,6 @@ void Actor::State_Cover_FakeEnemy
(
void
)
{
AimAtTargetPos();
Anim_Aim();
@@ -666,7 +649,6 @@ void Actor::Think_Cover
(
void
)
{
if( !RequireThink() )
{
@@ -776,7 +758,6 @@ void Actor::FinishedAnimation_Cover
(
void
)
{
if( m_State == 309 )
{
@@ -799,7 +780,6 @@ void Actor::PathnodeClaimRevoked_Cover
(
void
)
{
TransitionState(301, 0);
}
@@ -808,7 +788,6 @@ bool Actor::Cover_IsValid
(
PathNode *node
)
{
if( !node->IsClaimedByOther( this ) )
{
@@ -845,7 +824,6 @@ bool Actor::Cover_SetPath
(
PathNode *node
)
{
SetPathWithLeash( node, NULL, 0 );
@@ -912,7 +890,6 @@ void Actor::Cover_FindCover
(
bool bCheckAll
)
{
if( m_pCoverNode )
-9
View File
@@ -28,7 +28,6 @@ void Actor::InitCurious
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Curious;
func->BeginState = &Actor::Begin_Curious;
@@ -44,7 +43,6 @@ void Actor::Begin_Curious
(
void
)
{
Vector vDelta;
//float fDistSquared;
@@ -157,7 +155,6 @@ void Actor::End_Curious
(
void
)
{
m_iCuriousTime = 0;
m_iCuriousLevel = 0;
@@ -167,7 +164,6 @@ void Actor::Resume_Curious
(
void
)
{
Begin_Curious();
}
@@ -176,7 +172,6 @@ void Actor::Suspend_Curious
(
void
)
{
End_Curious();
}
@@ -185,7 +180,6 @@ void Actor::Think_Curious
(
void
)
{
//horrible function!
if (RequireThink())
@@ -427,7 +421,6 @@ void Actor::FinishedAnimation_Curious
(
void
)
{
FinishedAnimation_AnimCurious();
}
@@ -437,7 +430,6 @@ void Actor::LookAtCuriosity
(
void
)
{
Vector vAngles;
float fLookScale;
@@ -495,7 +487,6 @@ void Actor::TimeOutCurious
(
void
)
{
//FIXME: macros
if (!m_Enemy || EnemyIsDisguised())
-8
View File
@@ -29,7 +29,6 @@ void Actor::InitDisguiseNone
(
GlobalFuncs_t *func
)
{
func->IsState = &Actor::IsDisguiseState;
}
@@ -38,7 +37,6 @@ void Actor::State_Disguise_Wait
(
void
)
{
vec2_t vDelta;
float fDistSquared;
@@ -74,7 +72,6 @@ void Actor::State_Disguise_Papers
(
void
)
{
vec2_t vDelta;
@@ -116,7 +113,6 @@ void Actor::State_Disguise_Fake_Papers
(
void
)
{
vec2_t vDelta;
@@ -143,7 +139,6 @@ void Actor::State_Disguise_Enemy
(
void
)
{
m_eNextAnimMode = 1;
m_csNextAnimString = STRING_ANIM_DISGUISE_ENEMY_SCR;
@@ -159,7 +154,6 @@ void Actor::State_Disguise_Halt
(
void
)
{
m_eNextAnimMode = 1;
m_csNextAnimString = STRING_ANIM_DISGUISE_HALT_SCR;
@@ -175,7 +169,6 @@ void Actor::State_Disguise_Accept
(
void
)
{
m_eNextAnimMode = 1;
m_csNextAnimString = STRING_ANIM_DISGUISE_ACCEPT_SCR;
@@ -192,7 +185,6 @@ void Actor::State_Disguise_Deny
(
void
)
{
m_eNextAnimMode = 1;
m_csNextAnimString = STRING_ANIM_DISGUISE_DENY_SCR;
-6
View File
@@ -29,7 +29,6 @@ void Actor::InitDisguiseOfficer
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_DisguiseOfficer;
func->BeginState = &Actor::Begin_DisguiseOfficer;
@@ -44,7 +43,6 @@ void Actor::Begin_DisguiseOfficer
(
void
)
{
vec2_t vDelta;
m_csMood = STRING_BORED;
@@ -86,7 +84,6 @@ void Actor::End_DisguiseOfficer
(
void
)
{
m_iNextDisguiseTime = level.inttime + (m_State ? m_iDisguisePeriod : 500);
}
@@ -95,7 +92,6 @@ void Actor::Resume_DisguiseOfficer
(
void
)
{
Begin_DisguiseOfficer();
}
@@ -104,7 +100,6 @@ void Actor::Suspend_DisguiseOfficer
(
void
)
{
End_DisguiseOfficer();
}
@@ -113,7 +108,6 @@ void Actor::Think_DisguiseOfficer
(
void
)
{
if (RequireThink())
{
-6
View File
@@ -28,7 +28,6 @@ void Actor::InitDisguiseRover
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_DisguiseRover;
func->BeginState = &Actor::Begin_DisguiseRover;
@@ -43,7 +42,6 @@ void Actor::Begin_DisguiseRover
(
void
)
{
vec2_t vDelta;
@@ -85,7 +83,6 @@ void Actor::End_DisguiseRover
(
void
)
{
m_iNextDisguiseTime = level.inttime + (m_State ? m_iDisguisePeriod : 500);
}
@@ -94,7 +91,6 @@ void Actor::Resume_DisguiseRover
(
void
)
{
Begin_DisguiseRover();
}
@@ -103,7 +99,6 @@ void Actor::Suspend_DisguiseRover
(
void
)
{
End_DisguiseRover();
}
@@ -112,7 +107,6 @@ void Actor::Think_DisguiseRover
(
void
)
{
if (!RequireThink())
{
-7
View File
@@ -28,7 +28,6 @@ void Actor::InitDisguiseSalute
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_DisguiseSalute;
func->BeginState = &Actor::Begin_DisguiseSalute;
@@ -43,7 +42,6 @@ void Actor::Begin_DisguiseSalute
(
void
)
{
vec2_t vDelta;
@@ -89,7 +87,6 @@ void Actor::End_DisguiseSalute
(
void
)
{
m_iNextDisguiseTime = level.inttime + m_iDisguisePeriod;
}
@@ -98,7 +95,6 @@ void Actor::Resume_DisguiseSalute
(
void
)
{
Begin_DisguiseSalute();
}
@@ -107,7 +103,6 @@ void Actor::Suspend_DisguiseSalute
(
void
)
{
End_DisguiseSalute();
}
@@ -116,7 +111,6 @@ void Actor::Think_DisguiseSalute
(
void
)
{
NoPoint();
ContinueAnimation();
@@ -157,7 +151,6 @@ void Actor::FinishedAnimation_DisguiseSalute
(
void
)
{
SetThinkState(THINKSTATE_IDLE, THINKLEVEL_NORMAL);
}
-6
View File
@@ -28,7 +28,6 @@ void Actor::InitDisguiseSentry
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_DisguiseSentry;
func->BeginState = &Actor::Begin_DisguiseSentry;
@@ -43,7 +42,6 @@ void Actor::Begin_DisguiseSentry
(
void
)
{
vec2_t vDelta;
@@ -87,7 +85,6 @@ void Actor::End_DisguiseSentry
(
void
)
{
m_iNextDisguiseTime = level.inttime + (m_State ? m_iDisguisePeriod : 500);
}
@@ -96,7 +93,6 @@ void Actor::Resume_DisguiseSentry
(
void
)
{
Begin_DisguiseSentry();
}
@@ -105,7 +101,6 @@ void Actor::Suspend_DisguiseSentry
(
void
)
{
End_DisguiseSentry();
}
@@ -114,7 +109,6 @@ void Actor::Think_DisguiseSentry
(
void
)
{
if (RequireThink())
{
-8
View File
@@ -28,7 +28,6 @@ void Actor::InitDogIdle
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Dog;
func->EndState = &Actor::End_Dog;
@@ -41,7 +40,6 @@ void Actor::InitDogAttack
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Dog;
func->EndState = &Actor::End_Dog;
@@ -54,7 +52,6 @@ void Actor::InitDogCurious
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Dog;
func->EndState = &Actor::End_Dog;
@@ -67,7 +64,6 @@ void Actor::Begin_Dog
(
void
)
{
m_bDog = true;
}
@@ -76,7 +72,6 @@ void Actor::End_Dog
(
void
)
{
;
}
@@ -85,7 +80,6 @@ void Actor::Think_Dog_Idle
(
void
)
{
if( !RequireThink() )
{
@@ -105,7 +99,6 @@ void Actor::Think_Dog_Attack
(
void
)
{
if (!RequireThink())
{
@@ -177,7 +170,6 @@ void Actor::Think_Dog_Curious
(
void
)
{
if (RequireThink())
{
-18
View File
@@ -29,7 +29,6 @@ void Actor::InitGrenade
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Grenade;
func->BeginState = &Actor::Begin_Grenade;
@@ -46,7 +45,6 @@ bool Actor::Grenade_Acquire
eGrenadeState eNextState,
const_str csReturnAnim
)
{
bool bRetVal = false;
Vector vDest;
@@ -117,7 +115,6 @@ void Actor::Grenade_Flee
(
void
)
{
//float origin_ratio;
float fMinCloseDistSquared;
@@ -209,7 +206,6 @@ void Actor::Grenade_ThrowAcquire
(
void
)
{
if (!Grenade_Acquire(AI_GRENSTATE_THROW, STRING_ANIM_GRENADERETURN_SCR)
&& !CanGetGrenadeFromAToB(
@@ -229,7 +225,6 @@ void Actor::Grenade_Throw
(
void
)
{
m_bHasDesiredLookAngles = false;
@@ -242,7 +237,6 @@ void Actor::Grenade_KickAcquire
(
void
)
{
Vector vFace = vec_zero;
if (!Grenade_Acquire(AI_GRENSTATE_KICK, STRING_ANIM_GRENADEKICK_SCR))
@@ -267,7 +261,6 @@ void Actor::Grenade_Kick
(
void
)
{
m_bHasDesiredLookAngles = false;
ContinueAnimation();
@@ -277,7 +270,6 @@ void Actor::Grenade_MartyrAcquire
(
void
)
{
Vector vDest;
if (m_bGrenadeBounced)
@@ -340,7 +332,6 @@ void Actor::Grenade_Martyr
(
void
)
{
if (m_pGrenade && level.inttime >= (m_iStateTime + 1000) - 0.5)
{
@@ -359,7 +350,6 @@ void Actor::Grenade_Wait
(
void
)
{
if (rand() & 0xF)
{
@@ -377,7 +367,6 @@ void Actor::Grenade_NextThinkState
(
void
)
{
if (m_Enemy && !(m_Enemy->IsSubclassOfActor()))
SetThinkState(THINKSTATE_ATTACK, THINKLEVEL_NORMAL);
@@ -389,7 +378,6 @@ void Actor::Grenade_EventAttach
(
Event *ev
)
{
if (m_pGrenade)
{
@@ -426,7 +414,6 @@ void Actor::Grenade_EventDetach
(
Event *ev
)
{
if (m_pGrenade)
{
@@ -444,7 +431,6 @@ void Actor::Begin_Grenade
(
void
)
{
DoForceActivate();
m_csMood = STRING_ALERT;
@@ -571,7 +557,6 @@ void Actor::End_Grenade
(
void
)
{
m_pszDebugState = "";
}
@@ -580,7 +565,6 @@ void Actor::Resume_Grenade
(
void
)
{
if (m_pGrenade)
Begin_Grenade();
@@ -592,7 +576,6 @@ void Actor::Think_Grenade
(
void
)
{
if (m_bEnableEnemy)
UpdateEnemy(200);
@@ -677,7 +660,6 @@ void Actor::FinishedAnimation_Grenade
(
void
)
{
switch (m_eGrenadeState)
{
-6
View File
@@ -28,7 +28,6 @@ void Actor::InitIdle
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Idle;
func->ThinkState = &Actor::Think_Idle;
@@ -40,7 +39,6 @@ void Actor::Begin_Idle
(
void
)
{
glbs.Printf("Begin_Idle\n");
m_csMood = m_csIdleMood;
@@ -51,7 +49,6 @@ void Actor::Think_Idle
(
void
)
{
if (RequireThink())
{
@@ -66,7 +63,6 @@ void Actor::IdleThink
(
void
)
{
IdlePoint();
IdleLook();
@@ -109,7 +105,6 @@ bool Actor::PassesTransitionConditions_Idle
(
void
)
{
glbs.Printf("PassesTransitionConditions_Idle\n");
@@ -128,7 +123,6 @@ bool Actor::IsIdleState
(
int state
)
{
return state == THINKSTATE_IDLE;
}
-5
View File
@@ -28,7 +28,6 @@ void Actor::InitDead
(
GlobalFuncs_t *func
)
{
func->IsState = &Actor::IsKilledState;
}
@@ -37,7 +36,6 @@ void Actor::InitKilled
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Killed;
func->ThinkState = &Actor::Think_Killed;
@@ -49,7 +47,6 @@ void Actor::Begin_Killed
(
void
)
{
Event e1(EV_Actor_DeathEmbalm); // ebx
@@ -66,7 +63,6 @@ void Actor::Think_Killed
(
void
)
{
Unregister(STRING_ANIMDONE);
if (m_State == 700)
@@ -88,7 +84,6 @@ void Actor::FinishedAnimation_Killed
(
void
)
{
BecomeCorpse();
TransitionState(701, 0);
-8
View File
@@ -32,7 +32,6 @@ void Actor::InitMachineGunner
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_MachineGunner;
func->EndState = &Actor::End_MachineGunner;
@@ -45,7 +44,6 @@ void Actor::Begin_MachineGunner
(
void
)
{
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
@@ -91,7 +89,6 @@ void Actor::End_MachineGunner
(
void
)
{
if (!GetWeapon(WEAPON_MAIN))
giveItem("models/weapons/mp40.tik");
@@ -109,7 +106,6 @@ void Actor::BecomeTurretGuy
(
void
)
{
SetThinkIdle(THINK_IDLE);
@@ -127,7 +123,6 @@ void Actor::Think_MachineGunner
(
void
)
{
if (RequireThink())
{
@@ -197,7 +192,6 @@ void Actor::ThinkHoldGun
(
void
)
{
Vector end;
trace_t trace;
@@ -325,7 +319,6 @@ void Actor::FinishedAnimation_MachineGunner
(
void
)
{
if (!m_bAnimScriptSet && m_State == 1201)
{
@@ -340,7 +333,6 @@ bool Actor::MachineGunner_CanSee
float fov,
float vision_distance
)
{
float delta[2];
-3
View File
@@ -28,7 +28,6 @@ void Actor::InitNoClip
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_NoClip;
func->IsState = &Actor::IsIdleState;
@@ -38,7 +37,6 @@ bool Actor::IsNoClipState
(
int state
)
{
return state == THINKSTATE_NOCLIP;
}
@@ -47,7 +45,6 @@ void Actor::Think_NoClip
(
void
)
{
//FIXME: not sure of naming
bool done = false;
-4
View File
@@ -28,7 +28,6 @@ void Actor::InitPain
(
GlobalFuncs_t *func
)
{
func->BeginState = &Actor::Begin_Pain;
func->ThinkState = &Actor::Think_Pain;
@@ -40,7 +39,6 @@ void Actor::Begin_Pain
(
void
)
{
m_PainState = 500;
}
@@ -49,7 +47,6 @@ void Actor::Think_Pain
(
void
)
{
NoPoint();
@@ -75,7 +72,6 @@ void Actor::FinishedAnimation_Pain
(
void
)
{
if (m_PainState != 500)
EndCurrentThinkState();
-6
View File
@@ -28,7 +28,6 @@ void Actor::InitPatrol
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Patrol;
func->BeginState = &Actor::Begin_Patrol;
@@ -43,7 +42,6 @@ void Actor::Begin_Patrol
(
void
)
{
m_csMood = STRING_BORED;
StopTurning();
@@ -54,7 +52,6 @@ void Actor::End_Patrol
(
void
)
{
parm.movefail = true;
@@ -64,7 +61,6 @@ void Actor::Resume_Patrol
(
void
)
{
;
}
@@ -73,7 +69,6 @@ void Actor::Think_Patrol
(
void
)
{
if (Actor::RequireThink())
{
@@ -115,7 +110,6 @@ void Actor::ShowInfo_Patrol
(
void
)
{
ShowInfo_PatrolCurrentNode();
}
-6
View File
@@ -28,7 +28,6 @@ void Actor::InitRunner
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Runner;
func->BeginState = &Actor::Begin_Runner;
@@ -43,7 +42,6 @@ void Actor::Begin_Runner
(
void
)
{
m_csMood = STRING_NERVOUS;
m_csIdleMood = STRING_NERVOUS;
@@ -55,7 +53,6 @@ void Actor::End_Runner
(
void
)
{
parm.movefail = true;
}
@@ -64,7 +61,6 @@ void Actor::Resume_Runner
(
void
)
{
;
}
@@ -73,7 +69,6 @@ void Actor::Think_Runner
(
void
)
{
if (RequireThink())
{
@@ -113,7 +108,6 @@ void Actor::ShowInfo_Runner
(
void
)
{
ShowInfo_PatrolCurrentNode();
}
-35
View File
@@ -28,7 +28,6 @@ void Actor::InitTurret
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Turret;
func->BeginState = &Actor::Begin_Turret;
@@ -47,7 +46,6 @@ void Actor::Begin_Turret
(
void
)
{
DoForceActivate();
m_csMood = STRING_ALERT;
@@ -68,7 +66,6 @@ void Actor::End_Turret
(
void
)
{
if (m_pCoverNode && m_State != 111)
{
@@ -82,7 +79,6 @@ void Actor::Suspend_Turret
(
void
)
{
if (!m_Enemy)
{
@@ -103,7 +99,6 @@ void Actor::Think_Turret
(
void
)
{
@@ -300,7 +295,6 @@ void Actor::FinishedAnimation_Turret
(
void
)
{
if (m_State <= 108)
{
@@ -316,7 +310,6 @@ void Actor::ReceiveAIEvent_Turret
float fDistSquared,
float fMaxDistSquared
)
{
if (iType == AI_EVENT_WEAPON_IMPACT)
{
@@ -340,7 +333,6 @@ void Actor::InterruptPoint_Turret
(
void
)
{
if (m_Enemy && !Turret_TryToBecomeCoverGuy() && m_State == 100)
{
@@ -353,7 +345,6 @@ void Actor::PathnodeClaimRevoked_Turret
(
void
)
{
if (m_Enemy == NULL)
{
@@ -369,7 +360,6 @@ bool Actor::Turret_IsRetargeting
(
void
) const
{
return m_State <= 120;
}
@@ -378,7 +368,6 @@ bool Actor::Turret_DecideToSelectState
(
void
)
{
switch (m_State)
{
@@ -401,7 +390,6 @@ void Actor::Turret_SelectState
(
void
)
{
vec2_t vDelta;
float fDistSquared;
@@ -511,7 +499,6 @@ bool Actor::Turret_CheckRetarget
(
void
)
{
if (level.inttime < m_iStateTime + 5000 || level.inttime < m_iLastHitTime + 5000)
return false;
@@ -525,7 +512,6 @@ bool Actor::Turret_TryToBecomeCoverGuy
(
void
)
{
PathNode* pOldCover = m_pCoverNode;
Cover_FindCover(true);
@@ -550,7 +536,6 @@ void Actor::Turret_BeginRetarget
(
void
)
{
SetEnemyPos(m_Enemy->origin);
AimAtEnemyBehavior();
@@ -563,7 +548,6 @@ void Actor::Turret_NextRetarget
(
void
)
{
vec2_t vDelta;
float fDistSquared;
@@ -629,7 +613,6 @@ void Actor::Turret_SideStep
int iStepSize,
vec3_t vDir
)
{
AimAtEnemyBehavior();
//v3 = iStepSize;
@@ -654,7 +637,6 @@ void Actor::State_Turret_Combat
(
void
)
{
if (CanSeeEnemy(200))
{
@@ -703,7 +685,6 @@ void Actor::State_Turret_Reacquire
(
void
)
{
/*Sentient *v1; // ecx
float v2; // ST08_4
@@ -737,7 +718,6 @@ void Actor::State_Turret_TakeSniperNode
(
void
)
{
if (PathExists() && !PathComplete())
{
@@ -755,7 +735,6 @@ void Actor::State_Turret_SniperNode
(
void
)
{
AimAtTargetPos();
Anim_Sniper();
@@ -771,7 +750,6 @@ bool Actor::State_Turret_RunHome
(
bool bAttackOnFail
)
{
SetPath(m_vHome, NULL, 0, NULL, 0.0);
@@ -802,7 +780,6 @@ void Actor::State_Turret_RunAway
(
void
)
{
if (!PathExists() || PathComplete())
{
@@ -828,7 +805,6 @@ void Actor::State_Turret_Charge
(
void
)
{
SetPathWithLeash(m_vLastEnemyPos, NULL, 0);
ShortenPathToAvoidSquadMates();
@@ -881,7 +857,6 @@ void Actor::State_Turret_Grenade
(
void
)
{
GenericGrenadeTossThink();
}
@@ -890,7 +865,6 @@ void Actor::State_Turret_FakeEnemy
(
void
)
{
AimAtTargetPos();
Anim_Aim();
@@ -902,7 +876,6 @@ void Actor::State_Turret_Wait
(
void
)
{
PathNode *pNode;
if (CanSeeEnemy(500) || CanShootEnemy(500))
@@ -977,7 +950,6 @@ void Actor::State_Turret_Retarget_Sniper_Node
(
void
)
{
PathNode *pSniperNode;
bool bTryAgain;
@@ -1011,7 +983,6 @@ void Actor::State_Turret_Retarget_Path_Exact
(
void
)
{
AimAtEnemyBehavior();
SetPathWithLeash(m_vLastEnemyPos, NULL, 0);
@@ -1030,7 +1001,6 @@ void Actor::State_Turret_Retarget_Path_Near
(
void
)
{
AimAtEnemyBehavior();
FindPathNearWithLeash(m_vLastEnemyPos, m_fMinDistanceSquared);
@@ -1048,7 +1018,6 @@ void Actor::State_Turret_Retarget_Step_Side_Small
(
void
)
{
int iRand; // esi
@@ -1073,7 +1042,6 @@ void Actor::State_Turret_Retarget_Step_Side_Medium
(
void
)
{
int iRand; // esi
@@ -1098,7 +1066,6 @@ void Actor::State_Turret_Retarget_Step_Side_Large
(
void
)
{
int iRand; // esi
@@ -1123,7 +1090,6 @@ void Actor::State_Turret_Retarget_Step_Face_Medium
(
void
)
{
int iRand; // esi
@@ -1148,7 +1114,6 @@ void Actor::State_Turret_Retarget_Step_Face_Large
(
void
)
{
int iRand; // esi
-7
View File
@@ -28,7 +28,6 @@ void Actor::InitWeaponless
(
GlobalFuncs_t *func
)
{
func->ThinkState = &Actor::Think_Weaponless;
func->BeginState = &Actor::Begin_Weaponless;
@@ -42,7 +41,6 @@ void Actor::Begin_Weaponless
(
void
)
{
DoForceActivate();
@@ -67,7 +65,6 @@ void Actor::Suspend_Weaponless
(
void
)
{
if (m_State <= 902)
{
@@ -80,7 +77,6 @@ void Actor::Think_Weaponless
(
void
)
{
if (RequireThink())
@@ -131,7 +127,6 @@ void Actor::FinishedAnimation_Weaponless
(
void
)
{
if (m_State <= 902)
{
@@ -143,7 +138,6 @@ void Actor::State_Weaponless_Normal
(
void
)
{
int iStateTime;
if (m_bScriptGoalValid)
@@ -192,7 +186,6 @@ void Actor::State_Weaponless_Grenade
(
void
)
{
GenericGrenadeTossThink();
}
-18
View File
@@ -44,7 +44,6 @@ float ActorEnemy::UpdateVisibility
bool *pbInFovAndRange,
bool *pbVisible
)
{
float fLMRF, fFrameTime;
@@ -80,7 +79,6 @@ int ActorEnemy::UpdateThreat
(
Actor *pSelf
)
{
//FIXME: macro
static float fRangeThreatSquared[15];
@@ -237,7 +235,6 @@ Sentient *ActorEnemy::GetEnemy
(
void
) const
{
return m_pEnemy;
}
@@ -246,7 +243,6 @@ float ActorEnemy::GetVisibility
(
void
) const
{
return m_fVisibility;
}
@@ -255,7 +251,6 @@ int ActorEnemy::GetThreat
(
void
) const
{
return m_iThreat;
}
@@ -264,7 +259,6 @@ float ActorEnemy::GetRangeSquared
(
void
) const
{
return m_fCurrentRangeSquared;
}
@@ -365,7 +359,6 @@ ActorEnemy *ActorEnemySet::AddPotentialEnemy
(
Sentient *pEnemy
)
{
ActorEnemy NewEnemy;
@@ -408,7 +401,6 @@ void ActorEnemySet::FlagBadEnemy
(
Sentient *pEnemy
)
{
ActorEnemy *pActorEnemy;
for (int i = 0; i < m_Enemies.NumObjects(); i++)
@@ -447,7 +439,6 @@ void ActorEnemySet::CheckEnemies
(
Actor *pSelf
)
{
float fRangeSquared;
bool bVisible;
@@ -588,7 +579,6 @@ Sentient *ActorEnemySet::GetCurrentEnemy
(
void
) const
{
return m_pCurrentEnemy;
}
@@ -597,7 +587,6 @@ float ActorEnemySet::GetCurrentVisibility
(
void
) const
{
return m_fCurrentVisibility;
}
@@ -606,7 +595,6 @@ int ActorEnemySet::GetCurrentThreat
(
void
) const
{
return m_iCurrentThreat;
}
@@ -615,7 +603,6 @@ qboolean ActorEnemySet::IsEnemyConfirmed
(
void
) const
{
// not found in ida
return false;
@@ -625,7 +612,6 @@ bool ActorEnemySet::HasAlternateEnemy
(
void
) const
{
ActorEnemy *pActorEnemy;
for (int i = 0; i < m_Enemies.NumObjects(); i++)
@@ -643,7 +629,6 @@ void ActorEnemySet::RemoveAll
(
void
)
{
m_Enemies.ClearObjectList();
m_iCheckCount = 0;
@@ -661,7 +646,6 @@ void ActorEnemySet::ConfirmEnemy
Actor *pSelf,
Sentient *pEnemy
)
{
pSelf->m_bEnemyIsDisguised = false;
ActorEnemy *pActorEnemy = ActorEnemySet::AddPotentialEnemy(pEnemy);
@@ -685,7 +669,6 @@ void ActorEnemySet::ConfirmEnemyIfCanSeeSharerOrEnemy
Actor *pSharer,
Sentient *pEnemy
)
{
pSelf->m_bEnemyIsDisguised = false;
ActorEnemy *pActorEnemy = ActorEnemySet::AddPotentialEnemy(pEnemy);
@@ -720,7 +703,6 @@ bool ActorEnemySet::CaresAboutPerfectInfo
(
Sentient *pEnemy
)
{
ActorEnemy *pActorEnemy = ActorEnemySet::AddPotentialEnemy(pEnemy);
if (pActorEnemy)
-2
View File
@@ -64,7 +64,6 @@ inline void ActorEnemy::Archive
(
Archiver& arc
)
{
Class::Archive( arc );
@@ -111,7 +110,6 @@ inline void ActorEnemySet::Archive
(
Archiver& arc
)
{
Class::Archive( arc );
-26
View File
@@ -45,7 +45,6 @@ void ActorPath::Clear
(
void
)
{
m_startpathpos = 0;
m_pathpos = 0;
@@ -64,7 +63,6 @@ bool ActorPath::DoesTheoreticPathExist
float *vLeashHome,
float fLeashDistSquared
)
{
return PathSearch::FindPath( start, end, ent, maxPath, NULL, 0, m_FallHeight ) != 0;
}
@@ -78,7 +76,6 @@ void ActorPath::FindPath
float *vLeashHome,
float fLeashDistSquared
)
{
int depth = PathManager.FindPath( start, end, ent, maxPath, vLeashHome, fLeashDistSquared, m_FallHeight );
@@ -116,7 +113,6 @@ void ActorPath::FindPathAway
float *vLeashHome,
float fLeashDistSquared
)
{
int depth = PathManager.FindPathAway( start, avoid, vPreferredDir, ent, fMinSafeDist, vLeashHome, fLeashDistSquared, m_FallHeight );
@@ -154,7 +150,6 @@ void ActorPath::FindPathNear
float *vLeashHome,
float fLeashDistSquared
)
{
int depth = PathManager.FindPathNear( start, nearby, ent, maxPath, fRadiusSquared, vLeashHome, fLeashDistSquared, m_FallHeight );
@@ -187,7 +182,6 @@ void ActorPath::ReFindPath
float *start,
Entity *ent
)
{
int depth = PathManager.FindPath( start, m_path->point, ent, 0, NULL, 0, m_FallHeight );
@@ -221,7 +215,6 @@ float ActorPath::PathLookAhead
Vector& end,
float *origin
)
{
float area = total_area;
float s;
@@ -286,7 +279,6 @@ void ActorPath::UpdatePos
float *origin,
float fNodeRadius
)
{
Vector end;
float s = 0;
@@ -477,7 +469,6 @@ bool ActorPath::Complete
(
const float *origin
) const
{
if( !m_HasCompleteLookahead )
return false;
@@ -498,7 +489,6 @@ PathInfo *ActorPath::StartNode
(
void
) const
{
return m_startpathpos;
}
@@ -507,7 +497,6 @@ PathInfo *ActorPath::CurrentNode
(
void
) const
{
return m_pathpos;
}
@@ -516,7 +505,6 @@ int ActorPath::CurrentNodeIndex
(
void
) const
{
return m_pathpos ? m_pathpos - m_path : -1;
}
@@ -525,7 +513,6 @@ PathInfo *ActorPath::NextNode
(
void
) const
{
return m_pathpos == m_path ? NULL : m_pathpos - 1;
}
@@ -534,7 +521,6 @@ PathInfo *ActorPath::LastNode
(
void
) const
{
return m_path;
}
@@ -543,7 +529,6 @@ Vector ActorPath::CurrentPathDir
(
void
) const
{
return Vector( m_pathpos->dir[ 0 ], m_pathpos->dir[ 1 ], 0 );
}
@@ -552,7 +537,6 @@ float *ActorPath::CurrentPathGoal
(
void
) const
{
return m_pathpos->point;
}
@@ -561,7 +545,6 @@ int ActorPath::Time
(
void
) const
{
return m_Time;
}
@@ -570,7 +553,6 @@ Vector ActorPath::CurrentDelta
(
void
) const
{
return Vector( m_delta[ 0 ], m_delta[ 1 ], 0 );
}
@@ -579,7 +561,6 @@ bool ActorPath::IsAccurate
(
void
) const
{
return m_pathpos->bAccurate;
}
@@ -588,7 +569,6 @@ float ActorPath::TotalDist
(
void
) const
{
return m_TotalDist;
}
@@ -597,7 +577,6 @@ void ActorPath::SetFallHeight
(
float fHeight
)
{
m_FallHeight = fHeight;
}
@@ -606,7 +585,6 @@ float ActorPath::GetFallHeight
(
void
) const
{
return m_FallHeight;
}
@@ -615,7 +593,6 @@ void ActorPath::TrimPathFromEnd
(
int nNodesPop
)
{
int iLastPos = m_path - m_pathpos;
@@ -636,7 +613,6 @@ void ActorPath::Shorten
(
float fDistRemove
)
{
if( m_path->dist > fDistRemove )
{
@@ -661,7 +637,6 @@ bool ActorPath::HasCompleteLookahead
(
void
) const
{
return m_HasCompleteLookahead;
}
@@ -678,7 +653,6 @@ void ActorPath::ForceShortLookahead
(
void
)
{
m_fLookAhead = 4096.0f;
}
-1
View File
@@ -88,7 +88,6 @@ inline void ActorPath::Archive
(
Archiver& arc
)
{
int pos;
int startpathpos;
-4
View File
@@ -681,7 +681,6 @@ void Animate::DumpAnimInfo
(
void
)
{
MPrintf( "----------------------------------------\n" );
@@ -704,7 +703,6 @@ void Animate::ForwardExec
(
Event *ev
)
{
int slot = 0;
float weight = 1.0f;
@@ -737,7 +735,6 @@ void Animate::EventSetSyncTime
(
Event *ev
)
{
SetSyncTime( ev->GetFloat( 1 ) );
}
@@ -746,7 +743,6 @@ void Animate::EventIsLoopingAnim
(
Event *ev
)
{
str anim_name = ev->GetString( 1 );
int animnum;
-30
View File
@@ -73,7 +73,6 @@ void FileRead::Close
(
bool bDoCompression
)
{
if( bDoCompression )
{
@@ -115,7 +114,6 @@ const char *FileRead::Filename
(
void
)
{
return filename.c_str();
}
@@ -124,7 +122,6 @@ size_t FileRead::Length
(
void
)
{
return length;
}
@@ -133,7 +130,6 @@ size_t FileRead::Pos
(
void
)
{
return pos - buffer;
}
@@ -142,7 +138,6 @@ qboolean FileRead::Seek
(
size_t newpos
)
{
if( !buffer )
{
@@ -163,7 +158,6 @@ qboolean FileRead::Open
(
const char *name
)
{
byte *tempbuf;
assert( name );
@@ -228,7 +222,6 @@ qboolean FileRead::Read
void *dest,
size_t size
)
{
assert( dest );
assert( buffer );
@@ -285,7 +278,6 @@ void Archiver::FileError
const char *fmt,
...
)
{
va_list argptr;
char text[ 1024 ];
@@ -324,7 +316,6 @@ void Archiver::Close
(
void
)
{
if( file )
{
@@ -391,7 +382,6 @@ qboolean Archiver::Read
const char *name,
qboolean harderror
)
{
unsigned header;
unsigned version;
@@ -467,7 +457,6 @@ qboolean Archiver::Create
const char *name,
qboolean harderror
)
{
unsigned header;
unsigned version;
@@ -516,7 +505,6 @@ inline void Archiver::CheckRead
(
void
)
{
assert( archivemode == ARCHIVE_READ );
if( !fileerror && ( archivemode != ARCHIVE_READ ) )
@@ -529,7 +517,6 @@ inline void Archiver::CheckWrite
(
void
)
{
assert( archivemode == ARCHIVE_WRITE );
if( !fileerror && ( archivemode != ARCHIVE_WRITE ) )
@@ -542,7 +529,6 @@ inline fileSize_t Archiver::ReadSize
(
void
)
{
fileSize_t s;
@@ -560,7 +546,6 @@ inline void Archiver::CheckSize
int type,
fileSize_t size
)
{
fileSize_t s;
@@ -584,7 +569,6 @@ inline int Archiver::ReadType
(
void
)
{
int t;
@@ -602,7 +586,6 @@ inline void Archiver::WriteType
(
int type
)
{
glbs.FS_Write( &type, sizeof( type ), file );
}
@@ -612,7 +595,6 @@ inline void Archiver::CheckType
(
int type
)
{
int t;
@@ -650,7 +632,6 @@ inline void Archiver::ArchiveData
void *data,
size_t size
)
{
if( archivemode == ARCHIVE_READ )
{
@@ -714,7 +695,6 @@ void Archiver::ArchiveSvsTime
(
int *time
)
{
#ifdef GAME_DLL
if( archivemode == ARCHIVE_READ )
@@ -735,7 +715,6 @@ void Archiver::ArchiveVec2
(
vec2_t vec
)
{
ArchiveData( ARC_Vec2, vec, sizeof( vec2_t ) );
}
@@ -744,7 +723,6 @@ void Archiver::ArchiveVec3
(
vec3_t vec
)
{
ArchiveData( ARC_Vec3, vec, sizeof( vec3_t ) );
}
@@ -753,7 +731,6 @@ void Archiver::ArchiveVec4
(
vec4_t vec
)
{
ArchiveData( ARC_Vec4, vec, sizeof( vec4_t ) );
}
@@ -762,7 +739,6 @@ void Archiver::ArchiveObjectPointer
(
Class ** ptr
)
{
int index = 0;
@@ -831,7 +807,6 @@ void Archiver::ArchiveSafePointer
(
SafePtrBase * ptr
)
{
int index = 0;
@@ -889,7 +864,6 @@ void Archiver::ArchiveEventPointer
(
Event ** ev
)
{
int index;
@@ -947,7 +921,6 @@ void Archiver::ArchiveRaw
void *data,
size_t size
)
{
ArchiveData( ARC_Raw, data, size );
}
@@ -956,7 +929,6 @@ void Archiver::ArchiveString
(
str * string
)
{
if( archivemode == ARCHIVE_READ )
{
@@ -1026,7 +998,6 @@ Class * Archiver::ReadObject
(
void
)
{
ClassDef *cls;
Class *obj;
@@ -1117,7 +1088,6 @@ void Archiver::ArchiveObject
(
Class *obj
)
{
str classname;
int index;
-6
View File
@@ -162,7 +162,6 @@ inline qboolean Archiver::Read
str &name,
qboolean harderror
)
{
return Read( name.c_str(), harderror );
}
@@ -172,7 +171,6 @@ inline qboolean Archiver::Create
str &name,
qboolean harderror
)
{
return Create( name.c_str(), harderror );
}
@@ -207,7 +205,6 @@ inline void Container<Type>::Archive
Archiver& arc,
void( *ArchiveFunc )( Archiver& arc, Type *obj )
)
{
int num;
int i;
@@ -339,7 +336,6 @@ inline void ArchiveClass
Archiver& arc,
c *obj
)
{
arc.ArchiveObject( obj );
}
@@ -351,7 +347,6 @@ void con_set< key, value >::Archive
(
Archiver& arc
)
{
Entry< key, value > *e;
int hash;
@@ -399,7 +394,6 @@ void con_map< key, value >::Archive
(
Archiver& arc
)
{
m_con_set.Archive( arc );
}
+12 -18
View File
@@ -117,7 +117,6 @@ int BarrelObject::PickBarrelLeak
(
void
)
{
int iHighest;
float fHighestHeight;
@@ -148,7 +147,6 @@ void BarrelObject::BarrelSetup
(
Event *ev
)
{
setMoveType( MOVETYPE_PUSH );
setSolidType( SOLID_BSP );
@@ -167,7 +165,6 @@ void BarrelObject::BarrelSetType
(
Event *ev
)
{
str sType = ev->GetString( 1 );
@@ -210,7 +207,6 @@ void BarrelObject::BarrelThink
(
Event *ev
)
{
int i;
int iBiggestLeak;
@@ -238,11 +234,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_1);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_1));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_5);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_5));
}
m_fFluidAmount -= 1.0f;
@@ -254,11 +250,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_2);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_2));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_6);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_6));
}
m_fFluidAmount -= 0.75f;
@@ -271,11 +267,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_3));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_7));
}
m_fFluidAmount -= 0.5f;
@@ -294,11 +290,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_3));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_7));
}
gi.MSG_WriteCoord( m_vLeaks[ i ][ 0 ] );
@@ -415,7 +411,6 @@ void BarrelObject::BarrelDamaged
(
Event *ev
)
{
Vector vDir;
Vector vForward;
@@ -506,18 +501,18 @@ void BarrelObject::BarrelDamaged
gi.SetBroadcastVisible( vHitPos, vHitPos );
if( m_iBarrelType == BARREL_OIL )
gi.MSG_StartCGM(CGM_MAKE_EFFECT_4);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_4));
else
gi.MSG_StartCGM(CGM_MAKE_EFFECT_8);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_8));
}
else
{
gi.SetBroadcastVisible( vHitPos, vHitPos );
if( m_iBarrelType == BARREL_OIL )
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_3));
else
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(g_protocol, CGM_MAKE_EFFECT_7));
}
gi.MSG_WriteCoord( vHitPos[ 0 ] );
@@ -532,7 +527,6 @@ void BarrelObject::BarrelKilled
(
Event *ev
)
{
float fFluidTop;
Vector vPos;
-1
View File
@@ -71,7 +71,6 @@ inline void BarrelObject::Archive
(
Archiver& arc
)
{
Entity::Archive( arc );
-5
View File
@@ -442,7 +442,6 @@ void FuncBeam::setAngles
(
Vector angles
)
{
trace_t trace;
Vector endpoint;
@@ -467,7 +466,6 @@ void FuncBeam::SetEndPoint
(
Event *ev
)
{
trace_t trace;
@@ -483,7 +481,6 @@ void FuncBeam::SetModel
(
Event *ev
)
{
setModel( ev->GetString( 1 ) );
edict->s.renderfx &= ~RF_BEAM;
@@ -688,7 +685,6 @@ void FuncBeam::SetIgnoreWalls
(
Event *ev
)
{
if( ev->NumArgs() > 0 )
{
@@ -704,7 +700,6 @@ void FuncBeam::Activate
(
Event *ev
)
{
Vector forward;
trace_t trace;
+38
View File
@@ -387,3 +387,41 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
s->groundEntityNum = ps->groundEntityNum;
}
/*
========================
BG_MapCGMToProtocol
This is done after each set of usercmd_t on the server,
and after local prediction on the client
========================
*/
int BG_MapCGMToProtocol(int protocol, int messageNumber)
{
int newMessageNumber = messageNumber;
if (protocol >= PROTOCOL_MOHTA_MIN) {
// no need translation
return messageNumber;
}
if (messageNumber > 40) {
// unsupported...
return messageNumber;
}
if (messageNumber >= 17) {
return messageNumber - 3;
}
if (messageNumber == 15 || messageNumber == 16) {
// return explosion effect number 2
return 14;
}
if (messageNumber > 10) {
return messageNumber - 1;
}
return newMessageNumber;
}
Loaded 100 of 264 files, more files were not shown because too many files have changed in this diff. Show more