Compare commits

...
1522 Commits
Author SHA1 Message Date
smallmodel 60faa9dd9b Updated the version number 2023-11-29 17:57:47 +01:00
smallmodel 75f8f86f86 Fixed compilation error on some compilers 2023-11-29 00:08:35 +01:00
smallmodel 0ee1307e75 Fixed missing m_Thread archive 2023-11-28 20:26:40 +01:00
smallmodel f0c38305b5 Fixed defaultEntry having a NULL value even if there are elements 2023-11-28 20:13:55 +01:00
smallmodel e07dda6991 Fixed defaultEntry not being initialized after archiving 2023-11-28 20:10:23 +01:00
smallmodel b10ce9a426 Added GetKey() / SetKey() in con_set's Entry, so ScriptVariable can override it and set the key appropriately 2023-11-28 19:50:19 +01:00
smallmodel 2ac2800ecb Only archive used variables on the local VM stack 2023-11-28 19:14:09 +01:00
smallmodel e59200a7de Fixed cSpline archiving bad values 2023-11-27 20:35:23 +01:00
smallmodel a7902a8837 Added FollowPathRelativeYaw and NormalAngles 2023-11-27 20:30:36 +01:00
smallmodel 615726cc75 Added FollowPathRelativeYaw 2023-11-27 20:22:37 +01:00
smallmodel 839abf6076 Added missing variables to archive 2023-11-27 20:20:00 +01:00
smallmodel c7c8d4580d Added missed archived variables and using a ScriptThreadLabel instead of an event for the killed handler 2023-11-27 20:07:57 +01:00
smallmodel 2cc47e10f9 Added missing iNextLandTime archived variable 2023-11-27 20:06:19 +01:00
smallmodel 8fc5dacebf Removed bBindChilds unused variable + added more variables to archive 2023-11-27 20:06:05 +01:00
smallmodel cb23f3bb70 Added missing weapon_class archived variable 2023-11-27 20:05:36 +01:00
smallmodel d7350d8629 Added Clear() method in ScriptThreadLabel 2023-11-27 20:05:21 +01:00
smallmodel ac6b5ef1f7 Fixed wrong area portal writing 2023-11-27 19:37:29 +01:00
smallmodel 7fdd26c59e Added m_fHealRate archived variable 2023-11-27 19:37:26 +01:00
smallmodel fad555308b Archive ScriptVM and ScriptThread appropriately 2023-11-27 19:30:40 +01:00
smallmodel 969255c48e Fixed areaPortals being broken after reading from archive 2023-11-26 20:44:21 +01:00
smallmodel 433305617c IsAlive: check if the given listener is an actual entity 2023-11-26 20:38:14 +01:00
smallmodel 5418d84c7e Fixed m_fpsTiki being uninitialized when archiving 2023-11-26 20:36:23 +01:00
smallmodel cca37e3dfe Added and using SAVEGAME_STRUCT_VERSION 2023-11-26 20:33:07 +01:00
smallmodel 0e9d83ee14 Added a check to debug the total of archived items 2023-11-26 20:31:58 +01:00
smallmodel ecbf7f6caa Fixed Archive method not calling parent class archive method 2023-11-26 20:00:12 +01:00
smallmodel 5a3638fa68 Better for loop clarity 2023-11-26 19:55:07 +01:00
smallmodel 111088b540 Formatted document 2023-11-26 19:54:07 +01:00
smallmodel ba1703ebf0 When loading an entity from archive, set the model only if the entity allows model to be archived 2023-11-26 19:49:51 +01:00
smallmodel 825df20a72 Fixed game being stuck on mission stats screen in single-player 2023-11-26 19:30:54 +01:00
smallmodel 0a42fd79d2 Clear radar on cgame shutdown 2023-11-26 19:30:28 +01:00
smallmodel e50a041c12 SimpleEntity subclass flags name now starts with ECF_ prefix 2023-11-16 23:17:06 +01:00
smallmodel ce0e9fe77e Added portable turret anim blends + fixed anim blends 2023-11-16 23:03:04 +01:00
smallmodel 5105dcce04 Updated version patch number 2023-11-15 23:17:37 +01:00
smallmodel 58b4a9a676 Added bullet alpha (from moh 2.0 and above) 2023-11-15 21:02:34 +01:00
smallmodel 1146c834fb Fixed bad bullet coords being sent 2023-11-15 21:02:23 +01:00
smallmodel 9068264132 Make sure to remove the view model and detach the player when the turret gun is being removed 2023-11-15 20:42:16 +01:00
smallmodel 59ac8ea437 Clear the partial immobile flag when initializing the player's physics 2023-11-15 20:41:41 +01:00
smallmodel afafacaeec Fixed bullet tracer issues with multiple bullets 2023-11-15 20:41:35 +01:00
smallmodel baf451d2a2 Cleaned up bg_public 2023-11-15 20:39:09 +01:00
smallmodel d588012168 Don't use ANIM_MASK 2023-11-15 19:45:58 +01:00
smallmodel a3ed25cb2e Use WEAPON_CLASS_ITEM1 instead of raw 256 constant value 2023-11-15 19:36:29 +01:00
smallmodel c399f45841 Weapon::SetItemSlot() fixed missing bitwise negate 2023-11-15 19:36:09 +01:00
smallmodel 6a6eeae4ee Updated README 2023-11-14 18:53:40 +01:00
smallmodel 65f36505d1 Updated README 2023-11-14 18:05:50 +01:00
smallmodel b852980842 Fixed bullet tracer speed 2023-11-14 17:55:08 +01:00
smallmodel d351ced78b Added comment for sv_pure 2023-11-14 17:54:53 +01:00
smallmodel 4cd45c63c4 Return fs_gamedir in FS_GetCurrentGameDir() 2023-11-14 17:39:12 +01:00
smallmodel de16a72aed Using droperror instead of print 2023-11-14 17:31:49 +01:00
smallmodel 4b29c63fc9 Added ioq3 features like bans 2023-11-14 17:30:17 +01:00
smallmodel 770e832592 Added Com_strCompare and player name completion 2023-11-14 17:17:36 +01:00
smallmodel 14f9acdb57 Fixed "spin" event name 2023-11-14 14:09:52 +01:00
smallmodel 573a6f5bd5 Updated README 2023-11-14 14:06:57 +01:00
smallmodel 8c64b7aa89 Clear charge start time on respawn 2023-11-14 14:06:39 +01:00
smallmodel 8d49f8935c Added mode parm for IS_WEAPONCLASS_READY_TO_FIRE
This fixes issues with animation being stuck on secondary grenade charge
2023-11-14 14:04:37 +01:00
smallmodel ff8ec63e95 Call IsRepeatType() instead of checking the animFlags 2023-11-14 14:03:23 +01:00
smallmodel 771ee1b5a9 Forward-declare Event and Listener to omit some warnings 2023-11-14 01:08:09 +01:00
smallmodel 096692fec8 Fixed usage of 2D vector array 2023-11-14 01:07:23 +01:00
smallmodel d29454b44d Use %zu instead of %d 2023-11-14 01:06:52 +01:00
smallmodel 30a1ccb2e2 Made stateString const char* 2023-11-14 01:04:22 +01:00
smallmodel ea1b411cc0 Forward-declare skelHeaderGame_s and skelAnimFrame_s to omit some warnings 2023-11-14 01:02:27 +01:00
smallmodel 7794ee8aea Mark Archive() method 'override' 2023-11-14 00:54:20 +01:00
smallmodel 99a9022b53 Fixed Italian player not switching to the Breda weapon after spawning 2023-11-14 00:50:35 +01:00
smallmodel 1255964e6b Added a fix that prevent players from equipping weapons from the other team 2023-11-14 00:49:32 +01:00
smallmodel 37de859bee Fixed field var breaking code position on exception 2023-11-14 00:16:09 +01:00
smallmodel 990aa5cdb2 Initialize m_iBadPlaceIndex to 0 2023-11-14 00:06:26 +01:00
smallmodel befcedcf58 Fixed OPCODE_STORE_FIELD_REF incorrectly not skipping field on exception
It would cause invalid opcode afterwards.
2023-11-14 00:06:23 +01:00
smallmodel eeb697570d Fixed collapse index still being processed with SKB files (would cause crashes) 2023-11-14 00:04:42 +01:00
smallmodel 6410567e9a Initialize obfuscation mapping (still unimplemented) 2023-11-13 23:44:04 +01:00
smallmodel bde7242cc7 Added more screenshots 2023-11-13 23:31:22 +01:00
smallmodel e8aad97975 Fixed alignment issue on ARM CPUs 2023-11-13 23:28:42 +01:00
smallmodel 0662359776 Implemented DamageEvent() / EventGetActivator()
For example, the script in the training map waittill damage on the crate's trigger for bullets, DamageEvent() will unregister the damage event
2023-11-13 22:20:16 +01:00
smallmodel 5568d160ab Fixed uninitialized shader variable in CG_DrawCrosshair() 2023-11-13 22:18:38 +01:00
smallmodel defa297a56 Fixed debug lines being always drawn 2023-11-13 20:39:03 +01:00
smallmodel 782c37c4fe Updated version number 2023-11-13 20:38:49 +01:00
smallmodel 6f03c88ad5 Formatted playerbot source file 2023-11-13 20:33:06 +01:00
smallmodel 3ec980c8ec Fixed bots being blocked 2023-11-13 20:31:50 +01:00
smallmodel c0a50eb2ff Fixed infinite spectator switch loop 2023-11-13 20:31:41 +01:00
smallmodel f73e4b6f22 Check if the turret is valid before detaching remote owner 2023-11-13 20:30:51 +01:00
smallmodel 096972827e Fixed half of archived entities being deleted during restart 2023-11-13 19:35:46 +01:00
smallmodel 08c040d4ea Reset smoke sprites during restart 2023-11-13 19:34:13 +01:00
smallmodel 6d8b6b5f29 Fixed objectives text 2023-11-13 19:25:52 +01:00
smallmodel 410f1c0ed8 Only include listener.h when compiling C++ 2023-11-13 18:36:20 +01:00
smallmodel cb73cfd57b Fixed "unknown game mode" error 2023-11-13 18:23:26 +01:00
smallmodel 8cb8a7f370 Fixed objectives being wrong 2023-11-13 18:23:15 +01:00
smallmodel 8c893acfff Don't spawn the initial player if the game isn't single-player 2023-11-13 18:23:01 +01:00
smallmodel e453d1fa17 Added "none" for teamwin argument 2023-11-13 18:22:35 +01:00
smallmodel a7301ed7b6 Fixed teamwin not working on TOW and Liberation 2023-11-13 18:21:08 +01:00
smallmodel 42ebfd5394 Added ScriptSimpleStrafingGunfire and ScriptAimedStrafingGunfire from moh 2.0 and above 2023-11-13 17:46:33 +01:00
smallmodel cdf2f84b14 Added ScriptModelRealDamage class 2023-11-13 16:33:11 +01:00
smallmodel 2592aeab8b Fixed improper bullet path on wood and metal 2023-11-13 01:21:08 +01:00
smallmodel 34d4225ea0 Trigger must have CONTENTS_CLAYPIDGEON content mask set if it has DAMAGE spawnflag set when setting the model 2023-11-13 01:20:19 +01:00
smallmodel 17dcb4b00e Entity's clipmask must be MASK_SOLID 2023-11-13 00:58:33 +01:00
smallmodel eb1d096539 Fixed vehicle turret gun indefinitely shaking 2023-11-13 00:35:55 +01:00
smallmodel 05c74655be Fixed SimpleActor::SetPath not setting path correctly 2023-11-13 00:35:32 +01:00
smallmodel 3e0e0ba3b1 Fixed FindCover() wrong algorithm 2023-11-13 00:35:11 +01:00
smallmodel f90b6cd18c Fixed State_Turret_Wait() not checking if enemy can shoot, and fixed last enemy visible time not being set 2023-11-13 00:34:26 +01:00
smallmodel f0ecfcb708 Updated README 2023-11-12 21:51:09 +01:00
pryon 177702d027 Implement UISlider (#79)
* Implement UISlider

* Use proper enum type for the left and right arrow key constants
2023-11-12 16:39:22 +00:00
pryon 64429232f8 Add missing virtual calls to UIList methods (#80)
* Add missing virtual calls to UIList methods

* Add missing virtual call in UICheckBox::Draw
2023-11-12 16:39:04 +00:00
smallmodel d6b7fecb69 Refactored navigation with moh 2.0 features 2023-11-09 23:44:53 +01:00
smallmodel 51a0ee56aa Refactored FindNearestSniperNode() 2023-11-09 21:55:28 +01:00
smallmodel 2ed369568c Fixed AllocPathNode() and FreePathNode() not working as intended 2023-11-09 21:10:43 +01:00
smallmodel e5b7e16d1a Added AI_CONCEALMENT_MASK and use AI_LOW_WALL_ARC 2023-11-09 21:10:20 +01:00
smallmodel 4a9f676d5d Tidied up FindPathX methods 2023-11-09 21:01:30 +01:00
smallmodel 0e0da3d767 Added MASK_CORNER_NODE 2023-11-09 21:01:03 +01:00
smallmodel 343ce4a6a7 Using vec3_t type for start/end/position 2023-11-09 19:58:46 +01:00
smallmodel df8b854cb7 Cleaned up GeneratePath methods 2023-11-09 19:52:53 +01:00
smallmodel 831dc770d8 Added droptofloor() 2023-11-09 19:37:25 +01:00
smallmodel 8a9285c64f Cleaned up navigate source files and added low-wall arc 2023-11-09 19:31:20 +01:00
smallmodel 7e4e06b09d Fixed FinishReloading not working properly 2023-11-08 22:24:07 +01:00
smallmodel 96748b3fbc Fixed vote's last text position 2023-11-07 23:06:11 +01:00
smallmodel f1325048e9 Fixed crosshair's endpos friend test 2023-11-07 23:05:54 +01:00
smallmodel deee21eb68 Fixed vote string alignment position 2023-11-07 23:02:07 +01:00
smallmodel 2f43e5c5ea Fixed crosshair friend icon on mohaa 1.11 2023-11-07 23:01:49 +01:00
smallmodel 4766067edb Fixed crosshair incorrectly hiding 2023-11-07 22:54:05 +01:00
smallmodel bc54f22639 Crosshair is now handled by the cgame module 2023-11-07 22:44:13 +01:00
smallmodel 20c8c87e79 Draw vote and crosshair 2023-11-07 22:43:13 +01:00
smallmodel 3a5dcd6a3c Increased MAX_BUFFERS 2023-11-07 22:34:04 +01:00
smallmodel a5ba02c2bb Added crosshair variables 2023-11-07 19:30:46 +01:00
smallmodel e1554efc08 Fixed paused icon location 2023-11-07 19:20:52 +01:00
smallmodel 9d652dd41b Unpause if the game module doesn't allow pausing 2023-11-07 19:20:40 +01:00
smallmodel 22eadf2c08 Removed code that prevent pausing in debug builds 2023-11-07 19:20:26 +01:00
smallmodel d3f1b62208 Added pause command 2023-11-07 19:20:07 +01:00
smallmodel affc28ab79 Removed win32/unix folders (unused) 2023-11-07 18:57:34 +01:00
smallmodel 41be7f44ab Added comment 2023-11-06 20:45:57 +01:00
smallmodel 646c1f0f16 Fixed lightorigin and attach offset being badly calculated 2023-11-06 19:58:36 +01:00
smallmodel 3cea097b48 Added EV_Turret_SetMaxUseAngle and EV_Turret_SetStartYaw to TurretGun's event responses 2023-11-06 19:41:34 +01:00
smallmodel 786d72575e Fixed buggy sky rendering 2023-11-06 19:32:49 +01:00
smallmodel 6d9a794aaf Fixed assertion failed when numskins equals MAX_TIKI_SHADER 2023-11-06 19:17:03 +01:00
smallmodel 9e69df1e94 Check for valid model and anim num in **TIKI_Anim_NameForNum()** 2023-11-06 19:09:06 +01:00
smallmodel 72d4bb0206 Added more checks to avoid crashes 2023-11-06 18:59:18 +01:00
smallmodel f68e06a949 Use MAX_TIKI_ALIASES instead of the constant number (4095) 2023-11-06 18:30:11 +01:00
smallmodel f4da539d95 Use vec3_t type for coordinates/angles 2023-11-06 18:11:12 +01:00
smallmodel 17af75a9bb Formatted TIKI source files 2023-11-06 18:08:53 +01:00
smallmodel dcbb39d640 Formatted skeletor source files 2023-11-06 17:58:58 +01:00
smallmodel d0ba1df4e0 G_BroadcastAIEvent: ignore non-actor and non-bots 2023-11-05 21:02:07 +01:00
smallmodel 2b92869683 Moved eAIEvent enum to entity.h 2023-11-05 21:00:41 +01:00
smallmodel 379a4b0ce4 Fixed AI not being able to open doors 2023-11-05 20:58:37 +01:00
smallmodel d4c7d4a7e1 Avoid broadcasting to AI if the entity has notarget set 2023-11-05 20:58:25 +01:00
smallmodel dcac24c9e2 Fixed EventStopAtEnd() incorrectly stopping the vehicle 2023-11-05 20:39:04 +01:00
smallmodel 753589d840 Made TriggerSave only trigger once 2023-11-05 20:37:37 +01:00
smallmodel 382903c9e1 Added cSpline() constructor (sets points to 0) 2023-11-05 20:09:39 +01:00
smallmodel f29fec0b31 Formatted spline source file 2023-11-05 19:09:29 +01:00
smallmodel f9dc37d60a Fixed HudPrint using argument 0 instead of 1 for the message 2023-11-04 19:02:24 +01:00
smallmodel c5e48c67bb Return "unarmed" for item prefix/name that cannot be found 2023-11-04 19:02:08 +01:00
smallmodel cc62ebcffc Don't display an error for viewmodelanim fps tiki 2023-11-04 19:01:48 +01:00
smallmodel 0f36504959 Implemented vote options for cgame module 2023-11-04 18:43:10 +01:00
smallmodel 1fb8e25209 Use PRId64 and PRIu64 format specifier for sprintf in str with 64-bit int constructor 2023-11-04 00:41:06 +01:00
smallmodel 260876b1a2 Always print messages to console regardless of whether or not it's a game message / death message 2023-11-04 00:23:49 +01:00
smallmodel e4fc074f09 Formatted cl_ui source files 2023-11-04 00:22:35 +01:00
smallmodel 7899e5161e Add a newline at the end of dmmessage errors 2023-11-04 00:20:27 +01:00
smallmodel 95603b1142 Convert chat prefix for localization 2023-11-04 00:08:53 +01:00
smallmodel bf8e0eb812 Other player was not receiving the private message 2023-11-04 00:05:18 +01:00
smallmodel 0c04ffc1e8 Added and implemented InfoLandmark 2023-11-03 22:10:14 +01:00
smallmodel bd86acf118 EV_REMOVE should be -9.0 2023-11-03 22:07:43 +01:00
smallmodel 6caa16444e Return an str for battle language instead of const char* 2023-11-03 22:00:49 +01:00
smallmodel 94d4cbeb82 Enhanced Player's dmmessage implementation (say + voice) 2023-11-03 21:56:31 +01:00
smallmodel b31f4bc00c Added and implemented CG_xxxVote functions 2023-11-03 21:28:46 +01:00
smallmodel cf0808e119 Added client vote options code (partially implemented) 2023-11-03 21:09:18 +01:00
smallmodel 92333909fd Fixed commands being executed twice 2023-11-03 20:40:45 +01:00
smallmodel 9c68af92be Added more console commands to initialize 2023-11-02 20:23:45 +01:00
smallmodel bc5d7f5e93 Added "reloadmap" console command from moh 2.0 and above 2023-11-02 20:20:58 +01:00
smallmodel f2ba9a88be Reimplemented G_ScriptCmd() 2023-11-02 20:15:08 +01:00
smallmodel 81b711364e Use Event::Exists() instead of getting it, to see if an event exists 2023-11-02 20:14:34 +01:00
smallmodel 554e0c7fac Formatted gamecmds source files 2023-11-02 20:07:29 +01:00
smallmodel bd2c1c387b Added Event::Exists() to check if a given command name exists 2023-11-02 20:05:59 +01:00
smallmodel f19edac9ca Fixed audio spatialization
The yaw was inverted specifically for the Miles Sound System. But as the engine was never using Miles, the yaw mustn't be inverted
2023-11-02 19:57:46 +01:00
smallmodel 1698f6d1bf The return value of an event must be the first value 2023-11-02 19:53:26 +01:00
smallmodel 2c3180813a Fixed improper path lookahead 2023-11-02 19:33:10 +01:00
smallmodel a262fe5d9d Removed pAnimThread assert as it can be NULL 2023-11-02 19:11:44 +01:00
smallmodel a69249ee22 Fixed an issue where PathAvoidsSquadMates() would set bad coordinates for path 2023-11-02 19:11:29 +01:00
smallmodel 393c2a81d1 Check for indice bounds 2023-11-01 23:06:14 +01:00
smallmodel 3a6be342ce Added new ScriptModel functions from mohaas 2.0 and above 2023-11-01 22:35:07 +01:00
smallmodel 6616bfe53e Formatted document 2023-11-01 22:21:09 +01:00
smallmodel bafe60f48f Move must fail if the Actor wants to become a runner but the idle think state is neither Runner nor Patrol 2023-11-01 20:16:44 +01:00
smallmodel e306c415f0 Only move the client if there is no turret or if the turret doesn't allow user's aim 2023-11-01 20:15:44 +01:00
smallmodel 56a8c8d48d Set parm.owner, prevent to trigger non-use trigger with EV_USE, set projectile owner 2023-11-01 20:10:57 +01:00
smallmodel 421f1d39a4 SV_HitEntity must return true if something was hit 2023-11-01 20:09:46 +01:00
smallmodel 7c655944a5 Convert fields name to lower 2023-11-01 19:16:01 +01:00
smallmodel 0a27f37dc0 Set the last entity network time
This fixes Actor sometimes stuck on idle state
2023-11-01 18:03:29 +01:00
smallmodel 4695932ea1 Added StoppedNotify()
This fixes scripts waiting for another executing script which fixes Actor being stuck on some animations
2023-11-01 17:31:46 +01:00
smallmodel 7fe7a12167 In CreateThreadInternal and CreateScriptInternal, use GetScriptClass() directly from ScriptThread 2023-11-01 16:53:31 +01:00
smallmodel f9487b0ba3 Ignore CR in source line 2023-11-01 16:53:09 +01:00
smallmodel 7c5c34741c Added more script trace and initialize state to STATE_EXECUTION in ScriptVM constructor 2023-11-01 16:52:30 +01:00
smallmodel d09459f4bf Made Unpause() more explicit 2023-10-31 23:24:11 +01:00
smallmodel c0c6598151 Actor::WeaponSound() was not properly working 2023-10-31 23:23:29 +01:00
smallmodel f52fcc6f0e Process the parent of each entity correctly 2023-10-31 23:22:43 +01:00
smallmodel 2e9ef64bd2 g_timescripts misspell 2023-10-31 23:21:55 +01:00
smallmodel ff3ee39830 Fixed field name not showing in the exception message 2023-10-31 20:39:28 +01:00
smallmodel abd757f3bc Actor health must be above to 0 for NPC to count 2023-10-30 23:01:43 +01:00
smallmodel c741591a36 Syntax clarity 2023-10-30 23:00:21 +01:00
smallmodel 78c481d725 Added g_shownpc support 2023-10-30 23:00:07 +01:00
smallmodel b2ece37819 Added G_ClientDrawTags() 2023-10-30 22:59:39 +01:00
smallmodel a557b29ecf Removed useless SetDirty() call in ScriptMaster::SetTime() 2023-10-30 22:59:25 +01:00
smallmodel 1184843318 Set dirty timer in SetTime() 2023-10-30 22:59:04 +01:00
smallmodel dd1f8bd92a Compare with STATE_RUNNING instead 2023-10-30 22:46:59 +01:00
smallmodel 220c82954c Don't execute script thread now if paused 2023-10-30 22:46:50 +01:00
smallmodel 8879bacb1d Fixed Think_Curious() and LookAtCuriosity() small mistakes 2023-10-30 22:04:09 +01:00
smallmodel 5824022745 Added ScriptRemove 2023-10-30 22:03:37 +01:00
smallmodel 3ecb5bd06a Fixed WaitExecuteThreadInternal() waiting on the group instead of the thread 2023-10-30 21:59:47 +01:00
smallmodel 7de31a776b Added a check to avoid freeing a model that is used more than once 2023-10-29 20:40:37 +01:00
smallmodel 503320d13f Added modelOnly parameter to CG_ProcessConfigString + added votes 2023-10-29 20:40:07 +01:00
smallmodel bd263c5d22 Added condition to check for null model/animation and for out of bound animnum in TIKI_Frame_Commands() 2023-10-29 20:21:58 +01:00
smallmodel b0201aef5d Set number of arguments when constructing a new Event 2023-10-29 20:20:56 +01:00
smallmodel 31014808c8 Added and using AI_COVER_MASK 2023-10-29 20:20:19 +01:00
smallmodel 0906124867 Use CurrentThink() to get the current think 2023-10-28 00:01:57 +02:00
smallmodel 43bb5ce653 Fixed BroadcastEvent not returning true with 1 processed listener + Fixed UnregisterTarget not removing the name 2023-10-27 21:03:07 +02:00
smallmodel 7e66483b1a Added g_timescripts var 2023-10-27 21:02:25 +02:00
smallmodel f96b606a1a Fixed ScriptThread timing 2023-10-27 21:02:18 +02:00
smallmodel 30d26c3e44 Fixed register/unregistration 2023-10-27 20:42:01 +02:00
smallmodel 57e450a745 Thread state fix 2023-10-27 20:41:47 +02:00
smallmodel 24297bf396 Added timescript in ScriptMaster::ExecuteRunning() 2023-10-27 20:02:21 +02:00
smallmodel 481cd760a9 Added ScriptTrace/GetSourcePos 2023-10-27 20:00:48 +02:00
smallmodel 6d6043775e Use const unsigned char* for sourcepos 2023-10-27 19:59:29 +02:00
smallmodel bb97ec8933 Added GetSourceAt() with code pos 2023-10-27 19:59:15 +02:00
smallmodel dc028b87e4 Added const unsigned char* hashcode 2023-10-27 19:58:38 +02:00
smallmodel 0d1b7a9c8a Added int64 support 2023-10-27 19:58:29 +02:00
smallmodel a6e602af1d Renamed variables in ScriptClass::RemoveThread for more clarification 2023-10-26 20:18:50 +02:00
smallmodel 04a6012e5d Renamed thread parameters 2023-10-26 20:17:53 +02:00
smallmodel 0f7691c722 Reordered NotifyDelete switch statement for more clarity 2023-10-26 20:17:42 +02:00
smallmodel f01a0a17c1 Added script traces 2023-10-26 20:13:07 +02:00
smallmodel b291ab92b6 Fixed script class being always created even when a thread was started in the same group 2023-10-26 20:08:09 +02:00
smallmodel fb4bf4fcaa Fixed wrong value() for GetGameScript in CreateScriptInternal() 2023-10-26 20:07:49 +02:00
smallmodel 98816156d7 Delete created scriptclass / thread when there is an exception, in ScriptThreadLabel::Create() 2023-10-26 19:58:26 +02:00
smallmodel 92bfb4c426 Fixed clarity of conditions in Animate::UseSyncTime() 2023-10-26 19:57:39 +02:00
smallmodel cac883c4a0 Drop error to main menu if an hard script exception was encountered while executing running scripts 2023-10-24 23:18:44 +02:00
smallmodel 5a4fb90c96 Fixed THINKSTATE_ATTACK animation inside ChangeAnim() + weight should be 2.0 for ChangeMotionAnim() 2023-10-24 23:16:45 +02:00
smallmodel c4f9eb65ae Use SetWeight() and SetOnceType() instead of setting the frameinfo directly 2023-10-24 22:55:46 +02:00
smallmodel 9f5557b33c Initialize bHasThrowTarget 2023-10-24 22:55:22 +02:00
smallmodel 4d876fdf5d Fixed wrong state being ended in EndState() 2023-10-24 21:35:49 +02:00
smallmodel 978666c946 AssertValidSquad() in DisbandSquadMate() 2023-10-24 21:35:16 +02:00
smallmodel 9b9fa696e8 Added Waypoint and TempWaypoint constructor to set the SimpleEntity subclass type 2023-10-24 20:37:41 +02:00
smallmodel 088b22073c Formatted document 2023-10-24 20:36:53 +02:00
smallmodel 4f9831faa4 Formatted document 2023-10-24 20:27:18 +02:00
smallmodel 3373caa939 DebugNearestStartNode() should return a node only if node_count is higher than 0 2023-10-24 19:37:48 +02:00
smallmodel dc1be17b2a Added badPlaceTeam 2023-10-24 19:35:42 +02:00
smallmodel 64a3b04181 Fixed CM_SightTraceThroughBrush() implementation 2023-10-24 19:29:38 +02:00
smallmodel 57e1920b9c G_SightTrace: only return true if the result is true 2023-10-24 19:29:20 +02:00
smallmodel ddb6236eb9 simplified delta subtraction 2023-10-23 22:55:35 +02:00
smallmodel 4e4af590e5 Added m_pAnimThread assertion check 2023-10-23 22:55:09 +02:00
smallmodel a249f6b29b Fixed parm.previousthread not being actually set to the previous executing thread 2023-10-23 19:31:01 +02:00
smallmodel 7787729b24 Fixed standidentify scr file 2023-10-23 19:26:57 +02:00
smallmodel 45c8c704af Fixed ai_debugpath having an infinite line 2023-10-23 18:58:16 +02:00
smallmodel 31fde1ad94 Unreachable node fix 2023-10-23 18:57:56 +02:00
smallmodel bfb0fbd656 Fixed vision_distance being used even if it's 0 2023-10-23 18:57:44 +02:00
smallmodel 8afb7457c2 Fixed FindPotentialCover never setting found nodes 2023-10-23 17:28:52 +02:00
smallmodel 0ae1c8f771 Fixed origin_ratio uninitialized 2023-10-23 17:28:36 +02:00
smallmodel 6ff046ae29 When spawning pathnodes, use archived instance of pathnodes 2023-10-23 17:17:56 +02:00
smallmodel 6f9f845bb2 Set m_LoadIndex to 0 when loading archived nodes 2023-10-23 17:16:54 +02:00
smallmodel 00033c3a70 SPAWNFLAG_DETAIL must be 0x1000 2023-10-23 15:56:27 +02:00
smallmodel acf71610df Don't inhibit pathnodes 2023-10-23 15:56:14 +02:00
smallmodel 86e9ae343a Don't move to patorl current node with m_bPatrolWaitTrigger 2023-10-23 15:55:58 +02:00
smallmodel 9bbd546d4c Replaced glbs with g_local 2023-10-23 15:54:48 +02:00
smallmodel 31f2573b28 Fixed animations not playing correctly 2023-10-23 14:46:44 +02:00
smallmodel 4d7fcb77c2 Use ANIM_WEIGHT_MOTION enum 2023-10-23 14:46:17 +02:00
smallmodel da02a8c73a Fixed frame delta being wrong 2023-10-23 14:46:01 +02:00
smallmodel dd0b4505a6 Fixed bad pathing 2023-10-23 12:39:09 +02:00
smallmodel eaff26216a Added MASK_ACTORPATH 2023-10-23 12:23:47 +02:00
smallmodel e850dd1963 Make sure to prevent to transition to curious if curious isn't enabled (moh 2.30 feature) 2023-10-23 11:59:06 +02:00
smallmodel cf61ae0332 Fixed crash when driver's client is null 2023-10-22 21:16:07 +02:00
smallmodel 5cffe3fb05 Fixed infinite loop with ai_debugpath 2023-10-22 21:15:58 +02:00
smallmodel b996918d3b Formatted navigate source files 2023-10-22 21:06:43 +02:00
smallmodel 4a9f9a45c2 Fixed infinite loop in SimpleActor::ShortenPathToAvoidSquadMates() 2023-10-22 21:03:39 +02:00
smallmodel 3a75772005 Fixed g_mmove algorithm 2023-10-22 21:03:25 +02:00
smallmodel c196e31c6c Formatted g_mmove.cpp 2023-10-22 20:25:54 +02:00
smallmodel 60ceff5ae0 Initialize is_paused member variable 2023-10-22 20:16:46 +02:00
smallmodel 34a4a0c892 HandleKilled() didn't handle the last param 2023-10-22 20:16:36 +02:00
smallmodel 2a3c42d47b Fixed MINS/MAXS bounding box (especially for Actor) 2023-10-22 20:16:22 +02:00
smallmodel 0b1f796e0a Fixed format string 2023-10-22 20:16:10 +02:00
smallmodel 766d4d23bf Incremented MAX_LOOPBACK otherwise the client would drop the gamestate while loading 2023-10-22 19:47:43 +02:00
smallmodel 6860a1e992 Crash fix 2023-10-22 19:45:48 +02:00
smallmodel 70c628d759 Finalized actor_turret 2023-10-22 17:30:37 +02:00
smallmodel 6eff8bc273 Finalized actor_weaponless 2023-10-22 16:34:15 +02:00
smallmodel 0b1e8cdbf3 Finalized actor_runner 2023-10-22 16:28:06 +02:00
smallmodel 6f58b34f87 Finalized actor_patrol 2023-10-22 16:26:28 +02:00
smallmodel adf081ba3c Finalized actor_pain 2023-10-22 16:23:33 +02:00
smallmodel 6d4a9fde3f Finalized actor_noclip 2023-10-22 16:20:29 +02:00
smallmodel 5a5cc4ea17 Finalized actor_machinegunner 2023-10-22 16:14:52 +02:00
smallmodel 69df583508 Finalized actor_killed 2023-10-22 15:45:08 +02:00
smallmodel 18506d9932 Finalized actor_idle 2023-10-22 15:42:36 +02:00
smallmodel f076e7609e Finalized actor_grenade 2023-10-22 15:41:19 +02:00
smallmodel 0b0d053044 Implemented Projectile::SetMartyr 2023-10-22 15:41:13 +02:00
smallmodel ce7dfdd986 Fixed/finalized actor_dog 2023-10-22 15:03:12 +02:00
smallmodel 50e589f27c Finalized actor_disguise 2023-10-22 14:56:41 +02:00
smallmodel e904dafa38 Finalized actor_curious 2023-10-22 14:29:02 +02:00
smallmodel 6a210fa212 Finalized actor_cover source file 2023-10-21 17:18:49 +02:00
smallmodel ae33155ed3 Added cover states 2023-10-21 17:18:03 +02:00
smallmodel d3d44001ef Fixed CanSee implementation 2023-10-21 16:50:26 +02:00
smallmodel c2aec1ff57 Use named enums for actor states 2023-10-20 23:28:01 +02:00
smallmodel d5f08fe950 Added more states for turret 2023-10-20 23:25:39 +02:00
smallmodel bdf4df9fd0 Finished actor_curious 2023-10-20 23:03:27 +02:00
smallmodel 7481b0939e Finished actor_balcony 2023-10-20 23:03:17 +02:00
smallmodel 346e59f18a Finished actor_animcurious 2023-10-20 23:03:10 +02:00
smallmodel 4725aad3e9 Added more states 2023-10-20 23:02:53 +02:00
smallmodel 59fd1bfdb2 Fixed anim API 2023-10-19 23:15:57 +02:00
smallmodel 7546d91580 Fixed anim state 2023-10-19 23:15:45 +02:00
smallmodel c81df27470 Fixed alarm state 2023-10-19 23:15:36 +02:00
smallmodel bd6232d913 Added more actor state enums 2023-10-19 23:15:23 +02:00
smallmodel 7f6b73e60f Set client's server id acknowledge 2023-10-19 20:20:40 +02:00
smallmodel e3562f9e56 Added serverIdAcknowledge 2023-10-19 20:20:07 +02:00
smallmodel 40141c55de Fixed infinite loop in ShortenPathToAvoidSquadMates 2023-10-19 20:19:52 +02:00
smallmodel a6f6cbd9b5 Fixed a crash in FindCornerNodeForExactPath 2023-10-19 20:19:43 +02:00
smallmodel e9ffb4b9b5 Removed print code that causes crash 2023-10-19 20:19:33 +02:00
smallmodel 1f0418a9cd Fixed TIKI_LoadSetupCaseHeader() not using case value properly 2023-10-19 19:47:06 +02:00
smallmodel e76837b42c Fixed TIKI_GetHeadSkin() wrongly using headmodels 2023-10-19 19:46:12 +02:00
smallmodel 87be7068c9 Added MAX_SKELMODELS 2023-10-19 19:45:56 +02:00
smallmodel 49cb5af265 Shortened GetRandomHeadModel() and GetRandomHeadSkin() 2023-10-19 19:36:32 +02:00
smallmodel f0fe93429f Fixed headmodels/headskins never working 2023-10-19 19:36:07 +02:00
smallmodel c2461f1219 tiki nullity check 2023-10-19 19:35:48 +02:00
smallmodel f82b6b75ff Fixed DetectSmokeGrenades and LookAt crash 2023-10-18 20:00:32 +02:00
smallmodel 3486b590eb Fixed division by zero error when getting a random smoke sprite 2023-10-18 19:57:31 +02:00
smallmodel 5730af672c Fixed event return type 2023-10-18 19:53:04 +02:00
smallmodel 4daff05142 Fixed some methods not working as intended 2023-10-18 19:45:31 +02:00
smallmodel e930768c67 Implemented OpenActorStats and WriteActorStats 2023-10-18 19:34:35 +02:00
smallmodel 6f03e388bf Finished actor source file implementation from moh 2.0 and above 2023-10-18 19:23:55 +02:00
smallmodel 9b340e03c5 Added MASK_LOOK trace mask 2023-10-18 19:20:53 +02:00
smallmodel d5b61fe5cc Pathing fixes, leash fixes 2023-10-17 23:38:33 +02:00
smallmodel 5b46e48a17 Fixed grenade code (path, give), path leash, gun target 2023-10-17 20:38:58 +02:00
smallmodel 585221f7cc Added more eActorState_Turret values 2023-10-17 20:38:03 +02:00
smallmodel 77eb7a5259 Added position and forward parameters to Sentient::GunTarget() 2023-10-17 19:45:22 +02:00
smallmodel 77bfc4b599 Added bDesperate parameter to DecideToThrowGrenade 2023-10-17 19:44:48 +02:00
smallmodel 95bbfba1b8 Added MASK_GRENADEPATH 2023-10-17 18:03:29 +02:00
smallmodel 844a50dfd8 Added more comments in DoUse 2023-10-17 17:51:29 +02:00
smallmodel cd2fea5262 Implemented some but not all features from mohaas and mohaab + lighter implementations + fixed implementations 2023-10-16 23:42:30 +02:00
smallmodel 79d8b4bb0b Fixed wrong value for THINKSTATE_BADPLACE 2023-10-16 23:32:59 +02:00
smallmodel 531825545d Added MASK_AI_CANSEE 2023-10-16 23:32:46 +02:00
smallmodel daab5b9238 Fixed compile error 2023-10-16 00:31:50 +02:00
smallmodel ce59e5e6a7 Fixed mismatched anim methods up to Actor::EventSetSayAnim 2023-10-16 00:29:41 +02:00
smallmodel ea0c4b5060 Implemented actor_runandshoot 2023-10-15 21:53:40 +02:00
smallmodel 9b9908b660 Formatted actor_badplace source file 2023-10-15 20:53:20 +02:00
smallmodel 101894be37 Renamed THINKLEVEL_NORMAL to THINKLEVEL_IDLE 2023-10-15 20:52:06 +02:00
smallmodel 3e314251f2 Implemented actor_badplace 2023-10-15 20:51:11 +02:00
smallmodel 1995c75006 Added eActorState with reserved enums for m_State values 2023-10-15 20:44:44 +02:00
pryon ff85986c44 Fully implement UIList (#78) 2023-10-15 20:23:58 +02:00
smallmodel 9131297d43 Implemented Actor::Archive from mohaas/mohaab 2023-10-15 20:06:37 +02:00
smallmodel 301f3091d1 Fixed whole SimpleActor implementation 2023-10-15 19:52:19 +02:00
smallmodel b59bd449d4 Removed useless Clear() in GetScriptValue() 2023-10-15 19:52:02 +02:00
smallmodel 5e510ef0e2 Fixed ActorPath algorithm 2023-10-15 17:52:00 +02:00
smallmodel c7c3fcd0e0 Use a const float* for PathDelta() 2023-10-15 17:50:28 +02:00
smallmodel a5532ad67b Fixed Actor Enemy system 2023-10-15 17:11:20 +02:00
smallmodel 290cd5501c Obfuscation should be 0 by default 2023-10-15 16:12:01 +02:00
smallmodel 8d1b1410cd Fixed EventSetAimTarget, MoveXX methods and implemented DetectSmokeGrenades 2023-10-15 15:08:01 +02:00
smallmodel df9aead324 In EventSetMood, check for Bored/Nervous/Curious/Alert 2023-10-15 14:03:44 +02:00
smallmodel 851fd240d3 Fixed StartAnimation() constant value 2023-10-15 14:01:48 +02:00
smallmodel 2da03c89d1 Fixed MovePath/MovePathGoal 2023-10-15 14:01:13 +02:00
smallmodel 89cd12d2c1 Fixed CurrentPathDir and CurrentPathGoal return value 2023-10-15 13:43:49 +02:00
smallmodel e21d2a0adb Fixed compile errors 2023-10-14 21:53:17 +02:00
smallmodel 2fad64b08a Reimplemented some methods, added some flags and moved methods to the correct source file 2023-10-14 21:21:45 +02:00
smallmodel 97fd147fbe Fixed SetDesiredYawDir/SetDesiredYawDest 2023-10-14 21:20:59 +02:00
smallmodel 0f01f6af11 Reimplemented actor CanSee/CanShoot/EnemyInFOV 2023-10-14 20:33:50 +02:00
smallmodel a9892c88be Fixed WithinDistance/DistanceTo const and implemented AreasConnected 2023-10-14 20:26:38 +02:00
smallmodel f1d76a042d Added WithinFarplaneDistance 2023-10-14 20:23:35 +02:00
smallmodel 77d4e5d051 Fixed MASK_CANSEE value 2023-10-14 20:23:24 +02:00
smallmodel 7041acfd51 Added visual obfuscation feature (not implemented yet) 2023-10-14 19:56:06 +02:00
smallmodel b27bfbe189 Formatted g_public source file 2023-10-14 19:12:57 +02:00
smallmodel 1c10e7a63d Fixed G_ObfuscationForSmokeSprites parameters 2023-10-14 19:11:48 +02:00
smallmodel 0a7c324d48 setOriginEvent: clear 4th origin history and update bad places. + handle ANIM_MODE_ATTACHED when moving 2023-10-14 18:59:35 +02:00
smallmodel c81d247fbb Reimplemented Actor::UpdateBoneControllers 2023-10-14 18:40:53 +02:00
smallmodel 82294b7b2e Correctly implemented GetMoveInfo 2023-10-14 15:02:07 +02:00
smallmodel d80f55d5bf Added MASK_MOVEINFO 2023-10-14 14:33:55 +02:00
smallmodel 7930cda277 Added and use eAnimMode enum 2023-10-14 14:18:56 +02:00
smallmodel 7870db7202 Made m_groundPlaneNormal a vec3_t 2023-10-14 14:08:52 +02:00
smallmodel 407538fd85 Moved MINS/MAXS to bg_pmove 2023-10-14 13:31:19 +02:00
smallmodel 1a293420c0 Fixed voicetype event 2023-10-14 13:30:35 +02:00
smallmodel 1e94cdd8ca Added AI_EVENT_BADPLACE 2023-10-14 01:16:50 +02:00
smallmodel 7a2311d6e6 Added BadPlace and RunAndShoot state initialization 2023-10-14 01:06:47 +02:00
smallmodel e686937ae9 Added actor_runandshoot source file 2023-10-14 00:54:52 +02:00
smallmodel 8dca8988fe InitRunAndShoot spelling 2023-10-14 00:54:47 +02:00
smallmodel c890ac5944 Added actor_badplace source file 2023-10-14 00:45:51 +02:00
smallmodel 56e52fda80 Implemented Actor::Landed 2023-10-14 00:44:59 +02:00
smallmodel e7786b3192 Added DBCS methods for UIFont 2023-10-13 23:22:13 +02:00
smallmodel 4cc3a84e98 Make the driver non-solid instead of the tank if it's a player 2023-10-13 21:31:47 +02:00
smallmodel 6e0b048ae7 End remote control for all linked turrets (this removes the user camera) 2023-10-13 21:16:56 +02:00
smallmodel 115786798d Remove the user camera when ending the remote control 2023-10-13 21:16:37 +02:00
smallmodel 376db9e9e6 Fixed turret's user camera not being removed when the turret is removed 2023-10-13 21:15:40 +02:00
smallmodel 8abdb80e85 Fixed crashes when spectating, and fixed spectate not working properly under some conditions 2023-10-13 21:15:02 +02:00
smallmodel 656f212608 Fixed tank's driver not being able to remote control the turret under some circumstances 2023-10-13 21:09:47 +02:00
smallmodel 60e07cc4ff Fixed wrong const string values 2023-10-13 19:57:21 +02:00
smallmodel e132c0a015 Player camera view fix
- Add PMF_DAMAGE_ANGLES when camera show quakes
- Fixed spectating angles
- Fixed a crash that can occur if current_torso is NULL
2023-10-13 19:52:12 +02:00
smallmodel 8e63526f2a Camera must calculate m_bShowquakes manually, only if protocol is below version 15 2023-10-13 19:33:32 +02:00
smallmodel a5b7c774c1 Added more clarity for PMF_DAMAGE_ANGLES 2023-10-13 19:33:03 +02:00
smallmodel 130a5bb8c4 Fixed indentation 2023-10-13 19:14:42 +02:00
smallmodel 3802dd9984 Added Camera::ShowQuakes() 2023-10-13 19:14:37 +02:00
smallmodel 7d37397222 Formatted camera source files 2023-10-13 19:11:51 +02:00
smallmodel 932454d7b2 Removed MASK_DAMAGEMODEL, using MASK_SOLID instead 2023-10-13 19:11:14 +02:00
smallmodel 5d2e6c46aa Use MASK_SOLID instead of MASK_DAMAGEMODEL 2023-10-13 19:07:44 +02:00
smallmodel 38089195be Set default fov to 80 and initialize fov fadetime, follow fade time and showquakes fields 2023-10-13 19:07:23 +02:00
smallmodel 85a6c1d145 Implemented Get/SetNationality, IsOnFloor, EventAnimScript_Attached, VirtualEyePosition and FriendlyInLineOfFire 2023-10-12 23:20:57 +02:00
smallmodel 85d034b7fb Added eActorNationality enum from mohaab 2023-10-12 23:16:18 +02:00
smallmodel 82b5468fb4 Implemented Actor destructor 2023-10-12 21:31:22 +02:00
smallmodel 89759c44af Moved some methods to inline + added EV_NoAnimLerp 2023-10-12 21:30:53 +02:00
smallmodel 6f66a1d1c3 Moved Container::Archive to archive.h source file to avoid compilation errors 2023-10-12 20:45:49 +02:00
smallmodel d4bac185f6 Added next enemy time field from moh 2.0 and above 2023-10-12 20:36:08 +02:00
smallmodel 658bba576e Moved methods 2023-10-12 20:35:57 +02:00
smallmodel 31f3c25b18 Implemented Archive with only arc parameter 2023-10-12 20:30:17 +02:00
smallmodel 4a1f149051 Formatted actor source files 2023-10-12 20:18:22 +02:00
smallmodel c55a78b8b4 Moved location of actor methods 2023-10-12 20:17:18 +02:00
smallmodel 3dbf957304 Include scriptthread 2023-10-12 20:06:00 +02:00
smallmodel 8f98f49f1b Renamed source file 2023-10-12 20:05:10 +02:00
smallmodel 0a8322960b Added methods from moh 2.0 and above 2023-10-12 19:57:46 +02:00
smallmodel 63d73c6f86 Added EF_NO_LERP entity flag 2023-10-12 19:57:41 +02:00
smallmodel f8cbbe78a2 Reordered methods 2023-10-12 19:54:00 +02:00
smallmodel 2bb09503c6 Added SimpleActor destructor (it deletes the anim thread) 2023-10-12 19:45:16 +02:00
smallmodel ba313decd1 Formatted simpleactor source files 2023-10-12 19:44:17 +02:00
smallmodel 0d6847c76c Initialize new member fields 2023-10-12 19:42:20 +02:00
smallmodel 7b721c7849 Added fields and methods from mohaas and mohaab 2023-10-12 19:21:41 +02:00
smallmodel 1fb073fd6a Added IsDisabled() 2023-10-12 19:04:47 +02:00
smallmodel 484272aed4 Added OpenActorStats and WriteActorStats (unimplemented) 2023-10-12 18:58:04 +02:00
smallmodel 57422ce793 Formatted actor source files 2023-10-12 18:19:22 +02:00
smallmodel ba855cd064 Added events moved actor methods to the correct source files 2023-10-11 22:49:06 +02:00
smallmodel 39ac9f7de6 Added more const strings from 2.0 and above 2023-10-11 19:31:31 +02:00
smallmodel 4368035da4 Remove the weapon from owner when being destroyed 2023-10-09 19:32:08 +02:00
smallmodel 4391912ee3 Implemented Door::ShowInfo, correctly implemented Door::FieldTouched + minor fixes 2023-10-08 20:56:15 +02:00
smallmodel fc17536f55 Use CONTENTS_WEAPONCLIP for stickybomb when using it 2023-10-08 20:45:34 +02:00
smallmodel 3bae4338c3 Updated README 2023-10-08 20:22:10 +02:00
smallmodel f59bdd6b9f Fully implemented ProjectileGenerator classes + Fixed ThrobbingBox code 2023-10-08 20:21:00 +02:00
smallmodel 03f3676b00 Use correct values for fields 2023-10-08 19:13:16 +02:00
smallmodel e0d7079745 Implemented VehicleWheelsX4 2023-10-08 19:11:23 +02:00
smallmodel b7f421481f Implemented VehicleWheelsX2 2023-10-08 18:52:09 +02:00
smallmodel 3506cb3f94 Fixed vlink's origin being incorrectly set 2023-10-08 18:28:01 +02:00
pryon 7280acee42 Implement UICheckBox (#77)
* Implement UICheckBox

* Remove UICheckBox destructor and unnecessary `str` initializations
2023-10-08 18:03:14 +02:00
smallmodel d757fa6306 Renamed world.cpp and world.h to worldspawn.cpp and worldspawn.h 2023-10-08 00:08:47 +02:00
smallmodel 475fc92629 Fixed str() being passed as an instance for variadic arguments 2023-10-07 23:50:16 +02:00
smallmodel f24303dd78 Use a correct implementation for fSign() 2023-10-07 23:49:49 +02:00
smallmodel 180a20f561 Made wheel_s a struct 2023-10-07 21:56:43 +02:00
smallmodel 2e5ca5b9dc Return an empty string if the item name is not in the prefix list 2023-10-07 14:19:42 +02:00
smallmodel decee20fd8 Fixed GetSentientOwner() not returning the owner if not remote controlled 2023-10-06 22:33:59 +02:00
smallmodel 3d9a60c415 Turn off vehicle sound entities when the tank is idle 2023-10-06 22:12:19 +02:00
smallmodel a4a7002867 ScriptSlave::SetModelEvent: Corrected the case where the model is invalid 2023-10-06 20:18:18 +02:00
smallmodel 96c9a014e6 When getting string from event, store it in an str to avoid potential undefined behavior due to str destruction 2023-10-06 20:13:31 +02:00
smallmodel 11b4471be9 Remove linked turrets of the tandem turret being destroyed 2023-10-06 19:55:36 +02:00
smallmodel 17aea205f7 m_HeadTurret must be initialized to self, fixed SwitchToLinkedTurret() never working, and made IsActiveTurret() return correctly 2023-10-06 19:47:59 +02:00
smallmodel 739f54ed87 Use EV_TakeDamage on pTurret instead, and process all pending events 2023-10-06 19:46:47 +02:00
smallmodel 01be5bee72 Ignore user control when in autopilot 2023-10-04 20:13:00 +02:00
smallmodel dfcf0da710 Added vehicle waittills 2023-10-04 19:17:57 +02:00
smallmodel f47fb87d1b Fixed vehicle path not working properly 2023-10-04 19:17:48 +02:00
smallmodel bd639ba936 Added "info_vehiclepoint" class ID for VehiclePoint 2023-10-04 19:17:26 +02:00
smallmodel e784e62a4e Fixed damage event method
- Don't damage if health is already 0 or below
- Check for immunity
- Error if attacker or inflictor is NULL
- Don't apply velocity for vehicles
- Set the minimum mass to 20 and momentum to 1000
- Still process pain when in godmode
2023-10-04 00:33:27 +02:00
smallmodel e4425dcbf8 Make sure to check if vehicle or turret is valid before locking 2023-10-04 00:25:55 +02:00
smallmodel 0dcffe8771 Fixed means of death strings 2023-10-03 18:40:38 +02:00
smallmodel 2b27f6c452 Formatted document 2023-10-03 18:35:06 +02:00
smallmodel 3ba3c728bc By default, a Vehicle must be removed on death 2023-10-03 18:32:31 +02:00
smallmodel 7193198af2 Set the owner for SmokeGrenades 2023-10-03 18:32:09 +02:00
smallmodel 6691afd160 Use the correct clipmask for VehicleCollisionEntity 2023-10-03 18:30:35 +02:00
smallmodel 59fb220197 Added setOwner/getOwner 2023-10-03 18:30:19 +02:00
smallmodel ff7651d4c8 Fixed a crash when a window breaks on mohaa mode 2023-10-03 18:04:12 +02:00
smallmodel b02abb1f18 Fixed issue when the string is escaped with a newline 2023-10-03 17:54:23 +02:00
smallmodel 9f42da4686 Hide tempmodel when it is outside of the min/max distance range 2023-10-03 17:04:26 +02:00
smallmodel 58e3056374 Fixed coordinates displaying twice in the console 2023-10-03 17:02:36 +02:00
smallmodel 3142865fef Added MacOS support 2023-10-03 17:02:23 +02:00
smallmodel 06e3497a57 Fixed issues with tempmodel origin 2023-10-03 17:02:07 +02:00
smallmodel e49833737d Fixed label showing when stat alpha is 0 2023-10-03 12:21:24 +02:00
smallmodel 7eedc5fef8 Fixed Rend_SetColor() with m_local_alpha 2023-10-03 01:51:31 +02:00
smallmodel c442942022 Using text outlines 2023-10-03 01:49:59 +02:00
smallmodel 2c2652ed1d Fixed outline color 2023-10-03 01:41:35 +02:00
smallmodel 97bcc07aab Made m_bOutlinedText a protected member 2023-10-03 00:54:45 +02:00
smallmodel 001704b22e Implemented LayoutPlayerStatAlpha and LayoutStatbarShader_Marker 2023-10-03 00:48:41 +02:00
smallmodel f1d9cd93ce Added events from moh 2.0 and above 2023-10-02 21:13:48 +02:00
smallmodel 49aa2aa858 Implemented UILabel from moh 2.0 and above 2023-10-02 21:11:48 +02:00
smallmodel 6274d9a1e9 Added UI_StartLocalSoundDialog, UI_FadeSound and UI_StopAll imports 2023-10-02 21:11:32 +02:00
smallmodel 5fa9d91401 Added S_StartLocalSoundChannel 2023-10-02 21:11:16 +02:00
smallmodel 9acb803ffe Implemented getMaxWidthIndex and PrintOutlinedJustified from moh 2.0 2023-10-02 20:38:48 +02:00
smallmodel 105924bca3 Formatted document 2023-10-02 20:18:24 +02:00
smallmodel 5f12be2037 Formatted source files 2023-10-02 19:18:25 +02:00
smallmodel 13931c40cb Added playerstatalpha and statbar_shader_marker from 2.0 2023-10-02 19:16:12 +02:00
smallmodel ada5d614c5 Added comments about versions 2023-10-02 18:49:46 +02:00
smallmodel 7323d51219 Emitter fixes 2023-10-02 18:47:02 +02:00
smallmodel f5071f2667 Fixed out of temp model warning spam 2023-10-02 18:46:45 +02:00
smallmodel 0ca0a81644 Fixed DriverUse and FindExitPosition 2023-10-02 18:46:31 +02:00
smallmodel e1bd69b467 Added SetVehicle / GetTurret / SetTurret 2023-10-02 18:09:55 +02:00
smallmodel b17494519e Tempmodel fixes 2023-10-02 13:41:00 +02:00
smallmodel 13555f505c newEnt's parent entity must be ENTITYNUM_NONE in AddTempModels() 2023-10-02 12:45:51 +02:00
smallmodel 2a65f53084 TagSpawnLinked must initialize the spawnthing origin to the entity's origin 2023-10-02 12:45:34 +02:00
smallmodel 71fe83083e Fixed crash when trying to play non pvs sound with a null alias 2023-10-02 12:13:22 +02:00
smallmodel 0ddb5c859f Fixed CalculateAnimationData using wrong angles for vehicle suspension movement 2023-10-02 12:07:59 +02:00
smallmodel f7b12d5108 Removed unused events 2023-10-02 12:07:26 +02:00
smallmodel baa8f4334b Implemented CG_ClientCommands 2023-10-02 12:07:12 +02:00
smallmodel 24a211b190 Formatted document 2023-10-02 11:56:35 +02:00
smallmodel 6e82f254b7 Formatted document 2023-10-02 11:51:08 +02:00
smallmodel fbfedcf8d6 Fixed vehicle suspensions 2023-10-02 02:15:56 +02:00
smallmodel 5b06a0c2a4 Small code reduction 2023-10-02 02:15:12 +02:00
smallmodel f3204b0845 Fixed animation playing sometimes not being correct 2023-10-02 02:13:42 +02:00
smallmodel 334314a137 Fixed crash when the owner is NULL 2023-10-02 01:45:19 +02:00
smallmodel 8ecc8122b8 Fixed tank turning too fast 2023-10-02 01:11:09 +02:00
smallmodel eb9a119dfe Fixed MoveVehicle not moving correctly 2023-10-02 00:46:37 +02:00
smallmodel 313ece62f7 Fixed turret not turning properly 2023-10-02 00:16:12 +02:00
smallmodel 5799bcceb2 Fixed buffer overflow for szBlah 2023-10-02 00:07:54 +02:00
smallmodel 61e7571388 Added a crash fix in AttachDriverSlot() 2023-10-02 00:07:44 +02:00
smallmodel 6cfd99e40a Fixed AttachPassengerSlot not attaching correctly and call DriverAdded() after attaching the driver 2023-10-02 00:07:30 +02:00
smallmodel b3bdd9d563 Enabled UpdateNormals() 2023-10-01 23:09:55 +02:00
smallmodel 5bec3d8471 sv_maxclients must be initialized to 1 by default 2023-10-01 23:09:26 +02:00
smallmodel 711e46ecfb Added commented code that prevent playing mohaa maps in mohaas/mohaab 2023-10-01 23:08:07 +02:00
smallmodel ddd127352f Initialize svs.numSnapshotEntities in SV_ChangeMaxClients 2023-10-01 23:07:38 +02:00
smallmodel 784fd825bb Formatted level source file 2023-10-01 22:49:10 +02:00
smallmodel 673a42242d Formatted source files 2023-10-01 22:47:25 +02:00
smallmodel 3317345d92 Use a const string for target name 2023-10-01 22:45:41 +02:00
smallmodel 7958ba38d8 Fixed angles being wrong when the vehicle starts + fixed turret slot initial angles, use MAX_CORNERS instead of MAX_SOUND_ENTITIES and fixed UpdateNormals() angles 2023-10-01 21:16:50 +02:00
smallmodel 2dd7e0c03f use a vec3_t for VehicleTurretGun::SetBaseOrientation and use GetTagBarrel() for m_iBarrelTag 2023-10-01 21:15:37 +02:00
smallmodel b94f021567 Refactored setModel() 2023-10-01 21:00:32 +02:00
smallmodel cf50c5b535 Measure SpawnInternal time 2023-10-01 21:00:11 +02:00
smallmodel 1b71169565 Removed non-fgame module code (as g_spawn is only used for fgame) 2023-10-01 20:57:28 +02:00
smallmodel 30f2b9d5ed Formatted document 2023-10-01 20:56:51 +02:00
smallmodel 999d6a449b Fixed toPitch() with zero coordinates 2023-10-01 14:46:06 +02:00
smallmodel a65aa2a0d0 Fixed CrossProduct being wrong due to parameters being modified while doing the operation 2023-10-01 14:45:24 +02:00
smallmodel 36fc0b6e8a Formatted document 2023-10-01 14:21:23 +02:00
smallmodel f97362cdb1 Added MASK_VEHICLE_TIRES 2023-10-01 14:11:49 +02:00
smallmodel 6398484459 Fixed Vehicle::Postthink ignoring g_vehicle 2023-10-01 13:43:42 +02:00
smallmodel 07e8c6feaa Fully implemented cMoveGrid 2023-10-01 13:42:16 +02:00
smallmodel faf351a496 SurfIsOffScreen must only process faces + removed assertion 2023-10-01 11:36:54 +02:00
smallmodel cd9315852e Fixed num not being set when writing to memory archiver in commandthing_t::ArchiveToMemory 2023-09-30 11:57:04 +02:00
smallmodel 8c8487231a Fixed P_DeleteViewModel when the viewmodel is NULL 2023-09-27 23:55:27 +02:00
smallmodel 65ebdf0862 Commented out UpdateNormals() till a solution is found 2023-09-27 23:51:12 +02:00
smallmodel 9704362501 Initialize m_bAnimMove 2023-09-27 23:49:23 +02:00
smallmodel f0e87cd85a Prefixed TIKI import functions 2023-09-27 23:21:34 +02:00
smallmodel f6e6bf1d6b Implemented SlidePush, MoveVehicle and Postthink 2023-09-27 23:20:09 +02:00
smallmodel 4b4e8f806b Fixed vlink angles in Postthink 2023-09-27 23:17:14 +02:00
smallmodel 4141cee13f Added MASK_MOVEVEHICLE 2023-09-27 20:22:33 +02:00
smallmodel b2ee346f68 Formatted documents 2023-09-27 20:10:16 +02:00
smallmodel 2220f1ff05 Fixed vehicle move code 2023-09-27 20:01:08 +02:00
smallmodel 7ba48dd666 Made code lighter 2023-09-27 19:35:24 +02:00
smallmodel 2a48e2fd27 Formatted document 2023-09-27 19:24:41 +02:00
smallmodel 63a24c4448 Reimplemented a few methods (from moh 2.0 and above) 2023-09-26 23:51:12 +02:00
smallmodel 787df3362b Fixed v_angle not being set in SetViewAngles + floor view angles 2023-09-26 20:51:25 +02:00
smallmodel 5ad0f60ee3 G_TestEntityPosition must check for sentient instead of player 2023-09-26 20:50:00 +02:00
smallmodel d42f92361a Fixed slot notsolid/solid for bound entities, for player and for weapons 2023-09-26 20:49:00 +02:00
smallmodel 0693db3ef5 Fixed Vehicle::VehicleDestroyed 2023-09-26 20:33:23 +02:00
smallmodel fafb0e2793 Initialize max speed in EventDriveInternal and use cVehicleSpline instead of cSpline<4, 512> 2023-09-26 20:31:13 +02:00
smallmodel 0a4819d172 Using FindExitPosition() when detaching from driver, turret or passenger 2023-09-26 20:27:59 +02:00
smallmodel ee03f32a3e FindExitPosition() must return a boolean value 2023-09-26 20:14:39 +02:00
smallmodel f4e01917a2 Set turrets target name on initialization + Fixed DetachTurretSlot exit angles + use FindExitPosition() in AttachTurretSlot() 2023-09-26 20:08:25 +02:00
smallmodel eed9b36c9f Added GetRawRemoteOwner() 2023-09-26 20:06:31 +02:00
smallmodel 055192c2a8 Implemented Vehicle::AutoPilot from moh >= 2.0 and above 2023-09-26 19:44:03 +02:00
smallmodel cca39108dc Added cVehicleSpline as an alias to cSpline<4, 512> 2023-09-26 19:43:42 +02:00
smallmodel b1bbd5e366 Implemented mohaas/mohaab methods 2023-09-25 23:17:20 +02:00
smallmodel afb718f01f Removed vm, using m_bAnimMove instead 2023-09-25 21:18:43 +02:00
smallmodel 653b4e0ab7 Added methods, events and fields from moh 2.0 and above 2023-09-24 23:47:28 +02:00
smallmodel c3d228a9f5 Fixed float vote options 2023-09-24 23:37:26 +02:00
smallmodel 15e10caca0 Fixed useless statement 2023-09-24 23:37:18 +02:00
smallmodel 46efa85441 Fixed switch/case no default value 2023-09-24 23:37:03 +02:00
smallmodel bb42456653 Marked overridden methods as "override" 2023-09-24 23:36:30 +02:00
smallmodel 38bf80aa52 Export EV_Turret_SetMaxUseAngle 2023-09-24 23:20:43 +02:00
smallmodel c5c2aa5348 Fully implemented VehicleTank 2023-09-24 19:14:50 +02:00
smallmodel 1e67aeb667 Added AnimMoveVehicle 2023-09-24 18:42:23 +02:00
smallmodel 9ac7bccba5 Added GetUserViewAngles / SetUserViewAngles 2023-09-24 18:42:13 +02:00
smallmodel 610b82cfb7 Added Vehicle::DriverAdded and NUM_VEHICLE_TIRES 2023-09-24 17:47:31 +02:00
smallmodel c8144539d0 Fully implemented VehicleTurretGun 2023-09-24 17:19:23 +02:00
smallmodel 60f83597ee Added HasVehicle() virtual method 2023-09-24 16:38:06 +02:00
smallmodel 46c0c6085d Fixed GetMuzzlePosition using wrong parameters 2023-09-24 16:37:50 +02:00
smallmodel 36d4c4af61 Added MASK_TRANSPARENT 2023-09-24 16:37:36 +02:00
smallmodel 7406c3dc23 Implemented basic VehicleTurretGun methods 2023-09-24 01:14:35 +02:00
smallmodel 24bb15ce29 Renamed SOUND_STATE to SOUND_STATE_TURRET to avoid conflict with Vehicle's SOUND_STATE 2023-09-24 01:07:22 +02:00
smallmodel f3ad05dc85 Added GetVehicle 2023-09-24 00:27:51 +02:00
smallmodel bbae3223cb Fixed virtual methods 2023-09-23 23:13:34 +02:00
smallmodel 8cedb24d31 Using m_SwitchLabel 2023-09-23 23:13:21 +02:00
smallmodel 528414dfef Added new fields from moh >= 2.0 2023-09-23 22:34:08 +02:00
smallmodel 6e1c58e343 Implemented VehicleTurretGunTandem 2023-09-23 21:42:40 +02:00
smallmodel 002e935193 Fixed match start time being wrong and fixed AllowRespawn() 2023-09-23 19:49:44 +02:00
smallmodel e26d7d346a IsReady() should also check for dead 2023-09-23 19:38:17 +02:00
smallmodel 5d917f2578 Made IsDead() const 2023-09-23 19:38:04 +02:00
smallmodel 8aecff1879 Added CTeamSpawnClock and ported fixes from moh >= 2.0 2023-09-23 19:37:55 +02:00
smallmodel 718672119e Fixed roundactive being wrongly set to false 2023-09-23 18:37:33 +02:00
smallmodel 6ec7482662 Implemented FixedTurret 2023-09-23 18:30:59 +02:00
smallmodel 5f3ea7c634 Removed m_countdown 2023-09-23 18:30:45 +02:00
smallmodel 1c813a59d0 Added m_bRoundActive and RoundActive() 2023-09-23 18:30:19 +02:00
smallmodel a66236fc3d Added QUAKED sections 2023-09-23 17:58:14 +02:00
smallmodel ef9b7022df Added World::Archive 2023-09-22 21:04:18 +02:00
smallmodel ad7efce855 VehicleTankTandem 2023-09-20 20:57:58 +02:00
smallmodel 78a9990c3a Implemented DrivableVehicleTandem 2023-09-20 20:57:35 +02:00
smallmodel 422b9eb6c0 Added DamageModel from moh 2.0 2023-09-20 00:02:38 +02:00
smallmodel 703eb271f9 Added MASK_DAMAGEMODEL 2023-09-20 00:01:12 +02:00
smallmodel 2aca32c44a Added "isopen" door event + Renamed Door's class ID to "NormalDoor" 2023-09-19 21:24:00 +02:00
smallmodel 56c30bddb1 Added DrivableVehicleTandem 2023-09-19 21:15:55 +02:00
smallmodel 1179b50ad1 Added VehicleTankTandem 2023-09-19 21:12:57 +02:00
smallmodel 6ad44441a6 Made UpdateTurretSlot a virtual method 2023-09-19 21:12:31 +02:00
smallmodel 2455c09475 Added VehicleTurretGunTandem + more methods from moh 2.40 2023-09-19 21:02:22 +02:00
smallmodel 7a1e07e72a Made ApplyFireKickback() and ReadyToFire() virtual 2023-09-19 21:01:41 +02:00
smallmodel aa8e95885a Formatted document 2023-09-19 21:01:18 +02:00
smallmodel 54bae94ad9 Use Weapon::SetItemSlot when updating stats, instead of setting weapon_class manually 2023-09-19 20:18:27 +02:00
smallmodel 98b7e01069 Implemented Weapon::SetItemSlot 2023-09-19 20:18:13 +02:00
smallmodel 12c7707bc3 Unused variable removal 2023-09-19 20:08:53 +02:00
smallmodel a8a2c7e345 Use result from GetVAngles() in Player::GetViewangles() event 2023-09-19 20:08:35 +02:00
smallmodel 6c7542ec0c Fixed weapon muzzle position 2023-09-18 23:45:17 +02:00
smallmodel 5ec56cbe77 Implemented turret code from mohaas/mohaab 2.40 2023-09-18 23:36:03 +02:00
smallmodel 6b79770783 Fixed HashCode for command_t (must be case-insensitive) 2023-09-18 23:35:11 +02:00
smallmodel e125a83625 Added MASK_GUNTARGET 2023-09-18 23:34:46 +02:00
smallmodel d05b47e996 Fixed SetupVoteOptions not checking length for -1 2023-09-18 23:34:24 +02:00
smallmodel e1093d0c0c Using vec3_t instead of Vector for Weapon::GetMuzzlePosition() 2023-09-18 21:19:08 +02:00
smallmodel 25690648d6 Fixed inventory item having wrong weapon class set, and added support for portable turret 2023-09-17 19:54:45 +02:00
smallmodel 5c3c4f6288 Added and implemented CarryableTurret and PortableTurret 2023-09-17 19:48:20 +02:00
smallmodel 9dec5e9e54 Added fields from mohaas/mohaab 2023-09-17 19:47:02 +02:00
smallmodel ae1fa808da Export DPrintf2 and DebugPrintf for server 2023-09-17 19:34:19 +02:00
smallmodel ed6839dc99 Export DebugPrintf for client 2023-09-17 19:34:10 +02:00
smallmodel e95d71da0d Added Com_DPrintf2 and Com_DebugPrintf 2023-09-17 19:33:17 +02:00
smallmodel 128c8f3c06 Added Sys_DebugPrint 2023-09-17 19:31:37 +02:00
smallmodel 04f61a1af7 Added UI_PrintConsole() and UI_PrintDeveloperConsole() declarations 2023-09-17 19:29:59 +02:00
smallmodel 974e86b698 Fixed weapon being detached even if the holster tag is an empty string 2023-09-17 19:08:11 +02:00
smallmodel 12c03384b2 Fixed item being removed incorrectly 2023-09-17 19:07:46 +02:00
smallmodel 99ba912d7b Fixed radius in Level::GetNearestBadPlace() 2023-09-17 17:12:04 +02:00
smallmodel 7607932216 Added MASK_CARRYABLETURRET 2023-09-17 17:11:44 +02:00
smallmodel acc9c241a3 Added const specifier for Weapon::IsCarryableTurret() 2023-09-17 16:27:58 +02:00
smallmodel 5f5055f4fc Added Sentient::SetHolsteredByCode 2023-09-17 16:27:18 +02:00
smallmodel fc3749e008 Added Event() constructor that accepts another event and the number of arguments 2023-09-17 16:26:48 +02:00
smallmodel 155734370c Using Archive algorithm from mohaas/mohaab 2023-09-14 00:19:55 +02:00
smallmodel 1095e3d509 call arc.Close() after checking if it was Loading 2023-09-14 00:19:17 +02:00
smallmodel f7bfa47f2e Made ScriptVariable classes part of LightClass 2023-09-13 23:51:33 +02:00
smallmodel 9f6ef14ea1 GetCompiledScript should remain unused 2023-09-13 21:32:58 +02:00
smallmodel 15de08556e Formatted document 2023-09-13 19:46:39 +02:00
smallmodel e7dfa8fcfe Fixed command buffer not being able to hold the last character 2023-09-13 00:07:51 +02:00
smallmodel 7a67dc5dfd Implemented bad places 2023-09-13 00:00:42 +02:00
smallmodel 7eb8ef42b7 Update smoke sprites and bad places every frame 2023-09-12 23:59:51 +02:00
smallmodel c9c7a4beed Implemented PathSearch::UpdatePathwaysForBadPlace 2023-09-12 23:59:38 +02:00
smallmodel bcf3aad1b2 Added PointToSegmentDistanceSquared 2023-09-12 23:35:22 +02:00
smallmodel ad75363028 Added more variables to archive for Level 2023-09-12 21:48:08 +02:00
smallmodel f4ec3939a5 Weapon::Shoot(): process default value in switch/case for firemode 2023-09-12 21:47:51 +02:00
smallmodel aead97d29d Implemented landmarks from mohaab 2023-09-12 21:39:19 +02:00
smallmodel f468305a2c Level::Init(): Remove archived entities, reset health queue, initialize vote and free landmarks 2023-09-12 20:37:01 +02:00
smallmodel a962f469eb Added health queue 2023-09-12 20:33:49 +02:00
smallmodel 63e025cc02 Fixed 1022 characters command limit for SV_SendServerCommand (must be MAX_STRING_CHARS) 2023-09-12 20:14:58 +02:00
smallmodel b2d332f152 SV_GameSendServerCommand: Allocate the buffer dynamically on stack
This fixes long commands not being sent
2023-09-12 20:13:37 +02:00
smallmodel e160cf240c Fixed vote not working properly 2023-09-12 20:12:09 +02:00
smallmodel 19a4f70c44 Made ExecuteConsoleCommand accept a const char* instead 2023-09-12 00:19:08 +02:00
smallmodel dcca3901d5 Initialize more Level variables 2023-09-12 00:18:09 +02:00
smallmodel 0ee4ffbfbc Implemented vote system (from mohaas/mohaab) 2023-09-12 00:07:10 +02:00
smallmodel 776bc781cd Added ExecuteConsoleCommand() game import 2023-09-11 21:41:39 +02:00
smallmodel b1bb79e19f Added Player::HasVotedYes() and Player::HasVotedNo() 2023-09-11 21:28:05 +02:00
smallmodel 76c69b7bd1 Implemented Player::CallVote from mohaas/mohaab 2023-09-11 20:45:30 +02:00
smallmodel 15a25a412f Removed m_voteCommand and added m_nextVoteTime 2023-09-11 20:45:07 +02:00
smallmodel b511d89dcc Fixed farplane entity dist check when it is 0 2023-09-11 00:06:21 +02:00
smallmodel 9512ae7aeb Added TurretGun methods from mohaas/mohaab 2023-09-11 00:02:10 +02:00
smallmodel 5db086e470 Made GetMuzzlePosition a virtual method 2023-09-10 23:54:30 +02:00
smallmodel d63f668291 Updated README 2023-09-09 23:24:29 +02:00
smallmodel 35c72a9570 Added more packages to install in docker images 2023-09-09 23:14:16 +02:00
smallmodel b29f62ddd4 Fixed EventSetTurret crashing when the listener is NULL 2023-09-09 20:58:58 +02:00
smallmodel 525dc17573 Ignore NULL tiki
This fixes frequent crashes with NULL models
2023-09-09 20:53:59 +02:00
smallmodel 4d8ed24833 Fixed TIKI_ParseAnimations incorrectly returning 2023-09-09 20:49:08 +02:00
smallmodel aa15d996e0 Removed AnimOnce 2023-09-09 20:41:36 +02:00
smallmodel 0ec846945d Use edict->tiki instead of calling gi.modeltiki (which can crash because of an empty model string) 2023-09-09 20:41:03 +02:00
smallmodel 03ff158e76 Fixed crash when setting actor's patrol node 2023-09-09 20:02:02 +02:00
smallmodel b3371b2d63 Fixed static models collapse array being wrong
This would cause static models to disappear
2023-09-09 17:56:47 +02:00
smallmodel ed64d03bf5 Fixed dlclose() not working when compiled by GCC 2023-09-09 17:54:04 +02:00
smallmodel 3d936dede1 Don't change the protocol when in special game 2023-09-09 16:46:51 +02:00
smallmodel 33e9c5b1ea Formatted source files 2023-09-09 16:46:42 +02:00
smallmodel 078c90bbc9 Create a ScriptThread directly rather than calling Director.CreateScriptThread
This avoids exception when called by ScriptThreadLabel::Execute(). Because Execute() doesn't have try/catch, the program would crash.
2023-09-09 16:42:15 +02:00
smallmodel 2caf2cad5a Fixed improper usage of alloca()
alloca() can cause a stack overflow when it is called multiple times
2023-09-07 20:20:18 +02:00
smallmodel 5dec21dd43 Include <utility> for std::move 2023-09-07 20:01:07 +02:00
smallmodel 36aa9bd802 Don't replace Z_Malloc, Z_TagMalloc and Z_Free in debug memory mode 2023-09-07 19:48:08 +02:00
smallmodel bed2f15a72 Initialize more members for UIWidget
m_scaleCvar was not initialized to NULL, which could cause crashes
fadeSequence was not initialized
2023-09-07 19:32:35 +02:00
smallmodel f949f1e88d Fixed offset of block in Free() with _DEBUG_MEMBLOCK 2023-09-07 19:31:17 +02:00
smallmodel 8af202bd5f Fixed compilation errors with DEBUG_MEMORY on Linux because of CRT 2023-09-07 19:29:24 +02:00
smallmodel 67556a88f1 Fixed errors when compiling with DEBUG_MEMORY 2023-09-07 19:06:06 +02:00
smallmodel 4f8573784d Removed con_set inheritance from con_arrayset 2023-09-07 18:58:27 +02:00
smallmodel c5a46be23e Optimized calls to Event() (avoid allocating a new Event when it can be reused) 2023-09-07 18:22:07 +02:00
smallmodel 47a3c0bf55 Optimized event name
Use a static char*, instead of an allocated str
2023-09-07 18:05:49 +02:00
smallmodel e8d2a2a461 Instantiate AnimationEvent on stack rather than dynamically allocating it. Optimized cmd name for client commands 2023-09-07 17:33:35 +02:00
smallmodel 7b72a3fba4 Fixed MemArchiver improperly working 2023-09-06 23:34:16 +02:00
smallmodel dda79e7f27 Moved some tempmodels code to cg_tempmodels.cpp and implemented FreeSomeTempModels() 2023-09-06 23:25:48 +02:00
smallmodel 9a104566ba Added MemArchive feature from mohaas/mohaab 2023-09-06 23:11:43 +02:00
smallmodel b4d8982341 Implemented CG_ArchiveVSSGlobals() 2023-09-06 20:54:58 +02:00
smallmodel 5ea3fc28f7 Added FS_ListFilteredFiles, FS_FreeFileList, R_GetModelName and R_GetShaderName to client game imports 2023-09-06 20:31:50 +02:00
smallmodel 0bbf39660e Added R_GetShaderName and R_GetModelName 2023-09-06 20:31:28 +02:00
smallmodel 791f38762b Added MemArchiver::ArchiveSize 2023-09-06 19:58:19 +02:00
smallmodel c296b909c7 Fixed iTagR initialization 2023-09-06 00:00:50 +02:00
smallmodel 9c7a54f8fc Added and implemented MemArchiver class 2023-09-05 23:57:51 +02:00
smallmodel 4289eab72b Don't define MemArchiver in cg_archive.h 2023-09-05 23:57:18 +02:00
smallmodel 7b0dbc7445 Save the client game state in SV_ArchiveLevelFile 2023-09-05 20:33:02 +02:00
smallmodel 02db904336 Made CG_SaveStateToBuffer and CG_LoadStateToBuffer use a size_t 2023-09-05 20:31:24 +02:00
smallmodel 55140fee3a Replaced #ifdef CLIENT with #ifndef DEDICATED 2023-09-05 20:22:01 +02:00
smallmodel 96d881a1f1 Made ui_public.h compilable to C code 2023-09-05 20:18:05 +02:00
smallmodel 260a95c05e Added S_SaveData (unimplemented) 2023-09-05 20:17:51 +02:00
smallmodel 99d633587f Renamed S_StopAllSounds to S_StopAllSounds2 2023-09-05 20:17:38 +02:00
smallmodel cf2f0256a2 Moved UI_SetupFiles to ui_public.h 2023-09-05 20:00:54 +02:00
smallmodel dae8e8dfbd Fixed archive not always archiving soundsystemsavegame_t 2023-09-05 19:53:57 +02:00
smallmodel 6d2d35e82d Fixed compile errors on newer versions of clang 2023-09-05 19:39:57 +02:00
smallmodel 5e23a6b640 Added DEBUG_MEM_BLOCK cmake definition to debug MEM_BlockAlloc code 2023-09-04 22:19:01 +02:00
smallmodel f2ec502dc2 Fixed str allocation 2023-09-04 22:06:13 +02:00
smallmodel be04f31256 Replaced eventInfo_t with DataNode
DataNode is now used only at initialization time and is destroyed after initialization
2023-09-04 21:38:58 +02:00
smallmodel 85dd881c97 Removed usage of HeapAlloc/HeapFree 2023-09-04 21:24:48 +02:00
smallmodel 0ef2dccd90 Don't replace cgi.Malloc and cgi.Free with malloc/free 2023-09-04 21:24:17 +02:00
smallmodel 000ec39c81 Added non-pvs landing sound 2023-09-03 22:13:03 +02:00
smallmodel 3160c6ee0b Added _client_sound
Replaced SoundThisFrame by ClientSound
Process client commands with animation events that start with `_client_`
2023-09-03 22:12:45 +02:00
smallmodel 9da403e534 Increased MAX_NONPVS_SOUNDS 2023-09-03 22:11:26 +02:00
smallmodel f19c3408e1 Fixed footonground using right foot 2023-09-03 00:07:40 +02:00
smallmodel 38c0e09e8a Call UpdateFootsteps() even on multiplayer 2023-09-03 00:07:17 +02:00
smallmodel 2be4f7cdaf Fixed EV_Client_Landing event name 2023-09-03 00:07:06 +02:00
smallmodel cd48272fbb Implemented server-side footstep simulation 2023-09-02 23:53:46 +02:00
smallmodel a5a146bb02 Added and using Entity::PlayNonPvsSound 2023-09-02 23:51:37 +02:00
smallmodel c901bcf321 Call Sys_PrintBackTrace() directly from Sys_SigHandler() 2023-09-01 22:53:08 +02:00
smallmodel 8f3142e532 Display the header/footer before printing the backtrace 2023-09-01 22:52:52 +02:00
smallmodel 88438d6db4 Removed signal handlers from g_main.cpp as it's handled by the main app directly 2023-09-01 22:49:58 +02:00
smallmodel 7348734070 Fixed m_bFootOnGround values being set incorrectly 2023-09-01 22:49:53 +02:00
smallmodel a99a4a3a2b Clear the top value of a return command, if the listener is NULL 2023-08-30 23:34:29 +02:00
smallmodel 7bc8c3ab5b Fixed crate overlapping warning (when crates are actually not overlapping) 2023-08-30 23:33:42 +02:00
smallmodel 2a58fbdd22 Formatted document 2023-08-30 23:33:00 +02:00
smallmodel d102f5a88a set EV_LINKDOORS to -6.0f instead of -5.0f 2023-08-30 23:32:36 +02:00
smallmodel 8227f7125b Added SetDoorType and ShowInfo 2023-08-30 23:29:23 +02:00
smallmodel 673535dc08 Clear aliases in CL_Vid_Restart_f 2023-08-30 21:54:15 +02:00
smallmodel 9750489d07 Don't play sound if current_entity is NULL 2023-08-30 21:54:01 +02:00
smallmodel 53c6224ed0 Set ENGINE_VERSION to 3.0 2023-08-30 21:53:40 +02:00
smallmodel f84794acbe Added sv_pure support from ioq3 and mohaas/mohaab 2023-08-30 20:35:47 +02:00
smallmodel 9e535e509a Fixed snapshot ignoring "snaps" value from client 2023-08-30 19:59:45 +02:00
smallmodel 489210424f Fixed SVC_Status infinite loop with names longer than 16 2023-08-30 19:36:38 +02:00
smallmodel 394abbdb6f Fixed IPv6 not working with connect command 2023-08-30 19:36:17 +02:00
smallmodel 5fdeb92429 Readded openmohaa to version string 2023-08-30 01:08:09 +02:00
smallmodel 11cc39e41b Fixed pain animation playing indefinitely 2023-08-30 01:07:52 +02:00
smallmodel b3d5851fdc Fixed optimization not working when a player is visible near a wall 2023-08-30 01:07:32 +02:00
smallmodel 5c25839bab Added a feature that plays sound to clients not seeing entities (like not seeing other players) 2023-08-29 22:05:48 +02:00
smallmodel fbd314b447 Fixed pitch being used instead of volume 2023-08-29 22:04:18 +02:00
smallmodel 86888a32d4 Added SV_ClientSound 2023-08-29 21:55:24 +02:00
smallmodel 37c2d22b10 Added Frame_Commands_Client 2023-08-29 20:25:11 +02:00
smallmodel 19758ef75d Fixed entity optimization
Added a feature to always optimize players who don't see another player
2023-08-29 20:01:51 +02:00
smallmodel 519ccc90f7 Added sv_netoptimize_vistime 2023-08-29 20:00:27 +02:00
smallmodel b592d15d1f Added netoptimize enum types 2023-08-29 20:00:13 +02:00
smallmodel 78d70a892c Fixed leanAngle being never 0 2023-08-29 20:00:03 +02:00
smallmodel dbcf4c1800 Use GT_SINGLE_PLAYER instead of comparing non-zero 2023-08-29 18:48:36 +02:00
smallmodel cbd4630b3c SV_MasterHeartbeat: Use MAX_HEARTBEAT_TIME instead of the constant 2023-08-29 18:48:09 +02:00
smallmodel 92fdfe3f35 Moved MIN_HEARTBEAT_TIME and MAX_HEARTBEAT_TIME to sv_gqueryreporting.h 2023-08-29 18:45:46 +02:00
smallmodel 8b563e5232 Fixed heartbeat being always sent every frame 2023-08-29 08:17:23 +02:00
smallmodel aeb4875fa5 Commented out call to WSACleanup() (as it is already handled by the engine) 2023-08-29 01:08:33 +02:00
smallmodel 5ebb9c61f9 Removed call to NET_Init (already called from main()) 2023-08-29 01:08:09 +02:00
smallmodel c0e5b8fe15 Entities visibility enhancement
Implemented SV_WorldTrace(), SV_ClientIsVisibleTrace(), EntityDistCheck() and SV_ClientIsVisible()
Entities also will be hidden when:
- Their parent are not sent to clients
- They don't have a model
- They are behind t he farplane
- Clients can't see eachother with sv_netoptimize
2023-08-29 00:44:33 +02:00
smallmodel f852efea7d Added cvars 2023-08-29 00:04:07 +02:00
smallmodel 664ae905bb Fixed lastRadarTime and lastVisCheckTime fields 2023-08-29 00:03:44 +02:00
smallmodel 243b0fd109 Added sv_netprofile, sv_netprofileoverlay, sv_netoptimize and g_netoptimize 2023-08-29 00:03:28 +02:00
smallmodel 43b0944403 Added centroid in entityShared_t and removed currentOrigin 2023-08-29 00:03:07 +02:00
smallmodel ecc3c9f7b4 Renamed SVF_HIDEOWNER to SVF_SENT 2023-08-28 23:00:58 +02:00
smallmodel 296249b203 Fixed wrong SVF flags 2023-08-28 22:13:16 +02:00
smallmodel 8c1145bb9f Clear all unsupported farplane fields in protocol below version 15 2023-08-28 20:59:02 +02:00
smallmodel 7ad18a68f8 Rendering fog fixes
Fixed wrong fog flag being used (must be GLS_FOG) in RB_SetupFog().
R_SetupFrustum():
- Use skybox farplane and farplane bias
- RB_SetupFog() is now the only function who handle fog activation

RE_RenderScene():
- Set renderTerrain, skybox_farplane and farplane_bias parameters
- Set color overrides
- Use farclip when necessary

RB_StageIteratorLightmappedMultitextureUnfogged(): Fixed issue with fog being reset
2023-08-28 20:50:32 +02:00
smallmodel 99ba396c24 Make sure to not error out if the map checksum isn't used. Also fixed cg.farclipOverride, must be -1 if the server is a mohaa server 2023-08-28 20:46:48 +02:00
smallmodel f88e9960f2 Use the map's checksum only if the server has sv_mapChecksum exported 2023-08-28 20:45:10 +02:00
smallmodel b53466ea0d Fixed cheats variable being improperly configured 2023-08-28 20:44:33 +02:00
smallmodel 2afda6a470 Check the map checksum in CG_GameStateReceived 2023-08-28 20:29:18 +02:00
smallmodel acc8081ef2 Added checksum return parameter in CL_CM_LoadMap for cgame 2023-08-28 20:28:59 +02:00
smallmodel 7433677ead CG_Init(): clear fog overrides 2023-08-28 20:22:43 +02:00
smallmodel 4132f7efe6 Fixed farplane
Animated farplane is cleared when setting the farplane
Fixed farclip_override and farplane_color_override being mixed up
2023-08-28 20:22:06 +02:00
smallmodel 56e0f5797e Don't iterate the sky when tr.farclip is set 2023-08-28 19:52:12 +02:00
smallmodel 54c142ce78 Flag mistake, now using GLS_MULTITEXTURE_ENV instead of GLS_FOG_WHITE 2023-08-28 19:46:31 +02:00
smallmodel c106aeef2b Clear fog when drawing 2D window 2023-08-28 19:45:54 +02:00
smallmodel 66bde85807 Added GLS_COLOR_MASK and GLS_FOG_BITS 2023-08-28 19:45:40 +02:00
smallmodel 08363511a7 farclip must be an integer 2023-08-28 18:36:03 +02:00
smallmodel d6b93b712c Fixed sound location when in camera view + subtract refdef viewangles when PMF_DAMAGE_ANGLES is set 2023-08-28 18:35:47 +02:00
smallmodel a85d6d0f4c Added PMF_DAMAGE_ANGLES for mohaas/mohaab 2023-08-28 18:34:50 +02:00
smallmodel 2c1f341099 Initialize cg.farplaneColorOverride values to -1 2023-08-28 17:53:47 +02:00
smallmodel 52bb709ca5 Implemented CG_SetupFog() and CG_SetupPortalSky()
CG_SetupFog() must be called by CG_CalcViewValues()
CG_SetupPortalSky() must be called in CG_DrawActiveFrame()
2023-08-28 17:53:35 +02:00
smallmodel 24ea958748 Added R_ClearRealDlights() declaration 2023-08-28 17:45:11 +02:00
smallmodel b6143ce54c Better fog rendering
Implemented RB_SetupFog()
2023-08-28 17:36:57 +02:00
smallmodel 463ea7d34b Using viewParms.isPortalSky 2023-08-28 17:36:34 +02:00
smallmodel 1015302a7f Remove GLS_FOG_ENABLED if stateBits has GLS_FOG_WHITE 2023-08-28 17:36:19 +02:00
smallmodel c73f5917f8 Removed image->UseCount 2023-08-28 17:36:01 +02:00
smallmodel 9315cfa488 Added mohaas/mohaab variables 2023-08-28 17:35:54 +02:00
smallmodel 0f58b5780a Fixed fall damage on mohaas/mohaab
Use a percentage of the health instead
2023-08-28 15:49:28 +02:00
smallmodel edd5f07d48 Added healrate support (from mohaas) 2023-08-28 15:49:07 +02:00
smallmodel a7f258f2b1 Fixed health not healing with the healrate 2023-08-28 15:48:12 +02:00
smallmodel 65dcb72cba Fixed AmmoPickup not sending a message to the player 2023-08-28 15:41:06 +02:00
smallmodel 4885c536c8 Fixed wrong RB_CHECKOVERFLOW call (maybe #67) 2023-08-28 15:20:31 +02:00
smallmodel b6204dab78 Added LOD support 2023-08-28 02:32:33 +02:00
smallmodel 5b5951483a Added GetLodCutoff() and GetToolLodCutoff() 2023-08-28 02:26:36 +02:00
smallmodel 194d53569f Added foliage AFunc 2023-08-28 00:51:43 +02:00
smallmodel 5e8b54be7e Added new cvars from mohaas/mohaab 2023-08-27 23:24:06 +02:00
smallmodel 8dc91e413e Commented out GLS_MULTITEXTURE_ENV since it was removed in mohaas 2023-08-27 23:18:48 +02:00
smallmodel 57cf513b39 Added $bumpmap and normalmap (from mohaab) 2023-08-27 23:18:32 +02:00
smallmodel bb1326860b Added normalmap fields 2023-08-27 23:18:21 +02:00
smallmodel 136838e40b Fixed R_ColorShiftLightingBytes()
The lighting bytes must use tr.overbrightShift instead of tr.overbrightBits.
This makes the rendering more colorful
2023-08-27 22:18:09 +02:00
smallmodel 30d9483504 Decreased SHADERNUM and STATICMODEL shift values
When the number of shaders reached >1023, some surfaces started to be have random shaders started on them
The number of sorted shaders in a single game can now be up to 2048
2023-08-27 22:17:16 +02:00
smallmodel 05d3c50866 Stage fixes
Initialize animation phase to 0
Made CollapseMultitexture() work for more shaders
2023-08-27 22:15:08 +02:00
smallmodel d5e93d863a Set ps.walking in CG_TransitionSnapshot() instead 2023-08-27 19:53:29 +02:00
smallmodel d3f93aae15 Interpolate fLeanAngle #66 2023-08-27 19:32:38 +02:00
smallmodel 963e4aa7ec Restore saved Cgame state if the server is different (clear it otherwise) 2023-08-27 19:31:45 +02:00
smallmodel 5a250ea247 Fill cent->snapShotTime 2023-08-27 19:30:08 +02:00
smallmodel bc8d8aafc0 Fixed the viewmodel not being normal when no prediction is active 2023-08-27 19:14:23 +02:00
smallmodel f67ab4ec7f Fixed HUD being hidden when in camera (like MG42) 2023-08-27 18:56:37 +02:00
smallmodel cf9af20fbd Console history and wheel scroll
Implemented KeyEvent() for both UIConsole and UIDMConsole
Added a call to AddHistory() in UIConsole::KeyEnter()
2023-08-27 18:55:49 +02:00
smallmodel 3be2a3eb79 Made m_caret a size_t 2023-08-27 18:49:39 +02:00
smallmodel 7dfd18f4fb setTopItem(): don't set value below 0 2023-08-27 18:40:58 +02:00
smallmodel 05fc960338 Implemented getCount(), getPosition() and setPosition()
Fixed IteratePrev() being wrong
2023-08-27 18:40:38 +02:00
smallmodel 21d41ce14b Use facfont-20 for objective font 2023-08-27 17:48:18 +02:00
smallmodel 1562ba3f97 Fixed CG_ImpactMark being wrong with fSScale and fTScale 2023-08-27 17:48:10 +02:00
smallmodel 2798e73707 Fixed CG_CastFootShadow not working if only one of the red/green/blue channels was below 0.01 2023-08-27 17:47:49 +02:00
smallmodel 89aeee4269 TIKI_LoadSetupCase: reworked case integer values 2023-08-27 17:29:04 +02:00
smallmodel d50302fa41 Fixed tiki radius being wrong 2023-08-27 17:28:25 +02:00
smallmodel 8efae54450 Removed zero vectors assert in ProjectPointOnPlane(), it was removed since F.A.K.K 2 2023-08-27 17:13:12 +02:00
smallmodel 2785a72789 Fixed R_GatherLightSources crash 2023-08-27 17:01:53 +02:00
smallmodel ac55a44761 Implemented CG_CastFootShadow, CG_CastSimpleFeetShadow
Reimplemented CG_EntityShadow
2023-08-27 17:01:40 +02:00
smallmodel 42f1a286a8 Added MASK_FOOTSHADOW 2023-08-27 16:33:51 +02:00
smallmodel 241fa5d485 Fixed backtrace always showing 0x0 2023-08-26 21:16:48 +02:00
smallmodel e87f9c5710 Removed calls to NET_Init() as this function is already called from main() 2023-08-26 21:14:35 +02:00
smallmodel c95a6ee3fd Cleaned code up 2023-08-26 21:13:14 +02:00
smallmodel 10b954cb1a Added MAX_KEYVALUES_LENGTH 2023-08-26 21:12:32 +02:00
smallmodel cf7914b6f8 Fixed compiler warning about void* to int 2023-08-26 20:23:00 +02:00
smallmodel e58e048f00 Added comment 2023-08-26 20:22:39 +02:00
smallmodel b92cd8a64f Fixed player info for SVC_Status
Fixed "protocol" always returning 17 for SVC_Info
Fixed server not processing gamespy queries (not appearing in the master list)
2023-08-26 18:18:30 +02:00
smallmodel 317aead26d Replaced 1350 with MAX_INFO_STRING
Fixed wrong gamespy query being processed
2023-08-26 18:17:55 +02:00
smallmodel e93780c66c Fixed players_callback always returning players when there are none
Fixed gcd_think() crashing if it wasn't initialized
2023-08-26 18:17:28 +02:00
smallmodel af8990acf0 Added SV_ProcessGamespyQueries() declaration 2023-08-26 18:16:35 +02:00
smallmodel e41dcf03ad Added CVAR_SERVERINFO flag to "protocol"
Removed CVAR_SERVERINFO flag from "com_protocol" (useless)
2023-08-26 18:15:39 +02:00
smallmodel 0209e8f782 Fixed call to GSICancelAvailableCheck() causing socket 0 (STDIN) to be closed, any read() afterwards would hang 2023-08-26 16:18:57 +02:00
smallmodel 50d935171e Updated README 2023-08-25 23:25:04 +02:00
smallmodel 86ee9089e9 Include cg_radar.h 2023-08-25 23:22:44 +02:00
smallmodel ba6fe112bb Using Sys_LoadDll to load modules. Sys_LoadDll uses the binary path instead of the current working directory 2023-08-25 23:00:05 +02:00
smallmodel 15860a7795 Windows NT and Linux being both multi-user system, the homepath now defaults to %APPDATA%\openmohaa (Windows NT) and ~/openmohaa (unix) 2023-08-25 22:58:55 +02:00
smallmodel 78b3ad8075 As modules concern all 3 versions of the game, they're now installed in the root directory 2023-08-25 22:57:31 +02:00
smallmodel f61bda330e Set homepath to "openmohaa" (win32) and ".openmohaa" (unix) 2023-08-25 22:55:27 +02:00
smallmodel 5c9fceea2c Use sizeof sockaddr_in instead of 16 2023-08-25 22:55:22 +02:00
smallmodel 32cceebc47 Use the Git abbreviated commit hash for the product version 2023-08-24 23:33:29 +02:00
smallmodel 9d921df733 Added Git abbreviated commit hash 2023-08-24 23:33:19 +02:00
smallmodel 428f8c183d Put the extension before the platform string 2023-08-24 23:33:07 +02:00
smallmodel 45aae54b32 Renamed "Base" to "Allied Assault" 2023-08-24 23:32:40 +02:00
smallmodel d9ca73bc4c Updated README 2023-08-24 23:20:01 +02:00
smallmodel c2e24da9bd Initialize tracerspeed to 1 (this fixes turret bullets on mohaas/mohaab) 2023-08-24 23:19:49 +02:00
smallmodel c6ae5ed551 Added gamespy cd key authorization code (mohaas/mohaab only) 2023-08-24 23:19:21 +02:00
smallmodel 0f86a5ee8a Fixed "gamename" on mohaab
Use GS_GetCurrentGameName() and GS_GetCurrentGameVersion() in basic_callback
Using DF_ALLOW_LEAN_MOVEMENT instead of raw dmflags
2023-08-23 23:50:40 +02:00
smallmodel 803e53869b Set qr_custom_handler to NULL instead of 0 2023-08-23 23:49:25 +02:00
smallmodel a4fc25cca8 Increased the version number 2023-08-23 23:48:58 +02:00
smallmodel 28fbcf5628 Removed player printf destructor
Remove EF_PLAYER entflags from the Player destructor
2023-08-21 23:44:33 +02:00
smallmodel 3ea73febe4 Fixed spectate num 2023-08-21 23:33:23 +02:00
smallmodel 9eb3b3e1c3 Fixed infinite loop in SetPlayerSpectate() 2023-08-21 21:38:44 +02:00
smallmodel 48e1c39320 Fixed crash due do bad wrong delete after new[]
Fixed crash in ActorPath::ReFindPath when m_path is renewed
2023-08-21 21:38:32 +02:00
smallmodel fe38c7650f Updated the version number 2023-08-21 00:31:14 +02:00
smallmodel 5e2f5010f8 Fixed demo recording with different protocols 2023-08-21 00:20:04 +02:00
smallmodel efce4703ca Initialize demo_protocols from the com_protocol integer value 2023-08-21 00:19:46 +02:00
smallmodel 94ab4a5ac5 Moved MSG_ReadServerFrameTime and MSG_WriteServerFrameTime to qcommon/msg.cpp 2023-08-21 00:09:00 +02:00
smallmodel 58321be1ce sv_fps must have CVAR_SAVEGAME and CVAR_SERVERINFO 2023-08-21 00:08:08 +02:00
smallmodel 20282ffa56 Fixed +speed having inverted up/down 2023-08-20 14:44:46 +02:00
smallmodel ff4987cc81 Added more screenshots 2023-08-20 14:29:50 +02:00
smallmodel 80a22ca2ed Fixed pm error 2023-08-20 14:13:34 +02:00
smallmodel 51ca0a06a7 Fixed death message color on mohaas/mohaab 2023-08-20 14:11:34 +02:00
smallmodel 010794418c Fixed GetSpectateFollowOrientation using forward rather than right 2023-08-20 14:02:55 +02:00
smallmodel 51b5b2571a Set lean info per game for Pmove 2023-08-20 14:02:33 +02:00
smallmodel 182a677337 Script: use AngleVector rather than AngleVectorsLeft for angles methods 2023-08-20 14:02:04 +02:00
smallmodel 17f6c25bc7 Fixed leaning values in mohaas/mohaab 2023-08-20 13:54:25 +02:00
smallmodel 31d19cb0f6 Fixed score entries on FFA gametype 2023-08-20 13:27:09 +02:00
smallmodel 6c65bba279 Fixed MSG_WritePackedAnimTime not writing the animation time sometimes 2023-08-20 02:33:08 +02:00
smallmodel 8ae15be0de Create AnimationEvent with predefined args 2023-08-20 02:32:10 +02:00
smallmodel 11fb5ee2af Fixed removebot never working 2023-08-20 02:23:49 +02:00
smallmodel b68992e55e Added numArgs parameter 2023-08-20 02:23:41 +02:00
smallmodel 007a7681eb G_ClientDisconnect should print differently on mohaas/mohaab 2023-08-20 02:23:29 +02:00
smallmodel 7d4cdac52c Use WaitTillAllowed for waitTillTimeout, waitTillAny and WaitTillAnyTimeout 2023-08-20 01:46:38 +02:00
smallmodel 916f38e1b2 "roundstart" misspell 2023-08-20 01:43:59 +02:00
smallmodel 39ae88a2ab Remove "roundstart" waittill after the round has started 2023-08-20 01:43:37 +02:00
DJs3000 24f82e8e36 Add new arch (#61)
* Update q_platform.h

add e2k arch

* Update TargetArch.cmake

add e2k arch
2023-08-19 21:59:26 +00:00
smallmodel 247d09a09d Fixed strip on windows 2023-08-19 23:29:23 +02:00
smallmodel 030b291af1 Fixed library locations 2023-08-19 23:29:19 +02:00
smallmodel 9d0a5faed3 Fixed errors 2023-08-19 23:23:36 +02:00
smallmodel 261b15851f Fixed string() when no SDL 2023-08-19 23:10:48 +02:00
smallmodel 2929bd82a5 Removed func_expr as it's not used 2023-08-19 23:08:00 +02:00
smallmodel 4939927975 Fixed length decrease with an higher value 2023-08-19 23:07:47 +02:00
smallmodel f9ef6733b9 Fixed errors on CMake 3.5 2023-08-19 23:07:12 +02:00
smallmodel de08fe7ca3 Fixed linux compile error 2023-08-19 21:21:41 +02:00
smallmodel 482536ff1c Added g_bot.h file 2023-08-19 21:21:32 +02:00
smallmodel 3089cc8bc3 Avoid assigning the token to an str 2023-08-19 21:17:52 +02:00
smallmodel a307450e17 Made sourceLine argument optional to avoid string allocation 2023-08-19 21:12:03 +02:00
smallmodel 50cfc7e5ad Added STRING_VIEWMODELANIM_DONE 2023-08-19 21:06:25 +02:00
smallmodel 5b82cc4f11 Made Event::ErrorInternal const
Fixed ProcessEvent() not handling exceptions
2023-08-19 21:00:04 +02:00
smallmodel a83a76da95 Create an event with the argument count 2023-08-19 20:49:39 +02:00
smallmodel 2e4759ab1f Using m_RunLabel instead of trying to get the game script everytime 2023-08-19 20:49:20 +02:00
smallmodel af056d7646 Create an event with pcmd->num_args 2023-08-19 20:49:03 +02:00
smallmodel 46e57f0a1f Added maxDataSize so the event can be preallocated 2023-08-19 20:48:46 +02:00
smallmodel fe5473bc85 Added Set and SetScript with const_str
Fixed try/catch
2023-08-19 20:48:03 +02:00
smallmodel 1a03288144 SetFastData: Move the ScriptVariable instead of copying it 2023-08-19 20:47:36 +02:00
smallmodel 0c2326480b Avoid reallocation if the assigned ScriptVariable is the same as the other ScriptVariable 2023-08-19 20:47:14 +02:00
smallmodel 24f3b3bc93 Added anyValue union field 2023-08-19 20:46:42 +02:00
smallmodel 459aa89ca2 Check if sourceLength is -1 instead 2023-08-19 20:46:24 +02:00
smallmodel ec8eaacc69 Fixed "vstr" in the nextmap argument 2023-08-19 19:49:28 +02:00
smallmodel 84f55f627e Updated README 2023-08-19 19:41:53 +02:00
smallmodel a30f78e834 Prevent sv_maxbots + sv_maxclients from reaching MAX_CLIENTS 2023-08-19 19:35:20 +02:00
smallmodel d22cda594f Fixed TeamHitScoreLimit() (should use m_teamwins) 2023-08-19 19:34:57 +02:00
smallmodel 8cfa909b73 Reset bots on CleanUp
Fixed issues with WaitTill registration
2023-08-19 18:22:01 +02:00
smallmodel 86a6dd020f Check for WaitTillAllowed instead 2023-08-19 18:21:32 +02:00
smallmodel 556133fa11 Use STRING_ROUNDSTART instead of "roundstart" 2023-08-19 18:20:26 +02:00
smallmodel 4001de1dde Implemented WaitTillAllowed for all classes 2023-08-19 18:10:38 +02:00
smallmodel 7a57a25c58 Reworked the bot system 2023-08-19 17:58:54 +02:00
smallmodel d95cdcc142 Moved bot functions to g_bot.cpp 2023-08-19 16:03:42 +02:00
smallmodel d2a967e577 Don't use the explicit class name to access Entry_allocator 2023-08-19 15:48:50 +02:00
smallmodel 84adaa07e0 Removed reverse_label_list (use label_list enumeration instead) 2023-08-19 15:48:29 +02:00
smallmodel 2efeb7e972 Don't call Unregister with "delete" and "remove" in the destructor as UnregisterAll() will already do it
Don't call CancelPendingEvents() if the event system hasn't started
2023-08-19 15:39:59 +02:00
smallmodel b9655e3f19 Fixed memory leaks: free all memory allocated by the game module 2023-08-19 15:24:37 +02:00
smallmodel dce004ef13 Don't FreeAll() when destructing the block allocator, because it could be executed before containers destruction 2023-08-19 15:24:12 +02:00
smallmodel b9f1530eec G_ShutdownGame: shutdown events and deallocate game data 2023-08-19 15:23:48 +02:00
smallmodel 9b15b27f28 Removed CRT check debug flag 2023-08-19 13:36:54 +02:00
smallmodel ff2e64a742 Fixed a tiny mistake present in all mohaa versions, with a possible overflow in client index in PF_centerprintf and PF_locationprintf 2023-08-19 13:36:12 +02:00
smallmodel 4e38b803fb Fixed G_Random/G_CRandom 2023-08-19 13:32:32 +02:00
smallmodel 9825e1e6f2 Formatted source files 2023-08-19 03:02:30 +02:00
smallmodel b278f2eafa Var integer access fix 2023-08-19 03:00:19 +02:00
smallmodel 25912079db Return NULL for ulist::GetPosition 2023-08-19 03:00:07 +02:00
smallmodel b1753df1ed Reworked con_set and con_arrayset so that they have their own Entry class 2023-08-19 02:56:51 +02:00
smallmodel 03143d1341 Added a compilation flag to debug memory 2023-08-19 02:19:09 +02:00
smallmodel 843b49d56b Allow operator new and operator delete to be called when debugging memory 2023-08-19 02:19:01 +02:00
smallmodel 00644e7605 Alloc() and Free() will call malloc directly when debugging memory 2023-08-19 02:18:41 +02:00
smallmodel 93814bd05b Fixed Skel_Alloc and Skel_Free macros when debugging memory 2023-08-19 02:18:11 +02:00
smallmodel 438ed2c0ea Added a way to debug CRT heap (currently only on Windows with MSVC) 2023-08-19 02:17:45 +02:00
smallmodel 0310475957 Don't make "addbot", "removebot" and "bot" public commands 2023-08-19 02:17:12 +02:00
smallmodel 435bfe1271 Initialize angular_delta to 0 2023-08-19 01:38:38 +02:00
smallmodel 7ca532f0e4 FL_ANIMATE is 0x100000 2023-08-19 01:38:25 +02:00
smallmodel 8c3997f13b Implemented Projectile::Think from mohaas/mohaab 2023-08-19 01:32:54 +02:00
smallmodel d8ae1ce6b9 Added NULL to the end of SmokeGrenade event responses 2023-08-19 01:32:33 +02:00
smallmodel 5cb1e5de84 Fixed Vector_DotProduct returning wrong values 2023-08-19 01:02:18 +02:00
smallmodel 7fd2aff17b Fixed entity trace with no valid trace 2023-08-19 00:58:06 +02:00
smallmodel b9f3ee867b Fixed switch label with "default" case 2023-08-19 00:57:29 +02:00
smallmodel f16b992a97 Fixed assignments with case-insensitive event names 2023-08-19 00:57:19 +02:00
smallmodel 9ba5710412 Fixed variable comparison operators with VARIABLE_CHAR 2023-08-19 00:57:02 +02:00
smallmodel 7e6854f96b Fixed EventPointsWithinDist taking the wrong argument number for the distance 2023-08-19 00:35:48 +02:00
smallmodel aa25ef6c68 Removed EV_Player_UseHeld as there is already EV_GetUseHeld 2023-08-19 00:35:32 +02:00
smallmodel 9db1076603 Fixed VM_StepSlideMove using wrong start/end for gi.trace 2023-08-19 00:35:10 +02:00
smallmodel 7b39218af5 Fixed MASK_VEHICLE 2023-08-19 00:34:56 +02:00
smallmodel ba5b2adf94 Fixed rcon command not working 2023-08-19 00:34:47 +02:00
smallmodel ded7d941ea Call SetAngles(ev) when setting the angles 2023-08-19 00:34:27 +02:00
smallmodel 09ed4e4a1d Fixed grammar priorities of the unuary and complement 2023-08-19 00:34:14 +02:00
smallmodel 9b3aaa0f87 Using string+5 rather than string+(4+1) 2023-08-19 00:33:55 +02:00
smallmodel a274325f43 Fixed wrong bounce sound 2023-08-18 15:30:18 +02:00
smallmodel b0da0b8321 Removed nomonsters
Removed some serverinfo cvars
2023-08-18 15:25:26 +02:00
smallmodel a241ea20fa Removed nomonsters 2023-08-18 15:25:17 +02:00
smallmodel f8d5a5ecd2 Fixed TeamWin with the axis team 2023-08-18 15:13:47 +02:00
smallmodel f20b47ebc0 Fixed newlines when printing the teamwin 2023-08-18 15:10:35 +02:00
smallmodel de10ab8df3 Fixed "is preparing for deployment" message location on mohaas/mohaab 2023-08-18 15:10:23 +02:00
smallmodel 47c7c5a5e3 Renamed centerprint to stringToPrint 2023-08-18 15:10:10 +02:00
smallmodel 80ada3225d Fixed centerprint not working as intended 2023-08-18 15:09:32 +02:00
smallmodel a1745829b2 Added product extension, as breakthrough clients rely on the extension word (like "Spearhead") to set g_servertype variable 2023-08-18 14:54:17 +02:00
smallmodel b2853465ed Capitalize first letter in PRODUCT_EXTENSION 2023-08-18 14:53:39 +02:00
smallmodel c89091b4cd Send gamever and serverType in SVC_Info 2023-08-18 14:53:26 +02:00
smallmodel e5beb0d9b9 Explicitly use GT_SINGLE_PLAYER 2023-08-18 14:53:12 +02:00
smallmodel 80ab513d76 Fixed size() returning 0 when the type is VARIABLE_NONE (must return -1) 2023-08-18 14:14:32 +02:00
smallmodel 854136d85b Fixed spelling mistake 2023-08-18 14:14:11 +02:00
smallmodel 25c417187b Removed flex/bison source files from build
Flex/Bison must be used to generate those files
2023-08-18 01:46:16 +02:00
smallmodel e3e9328ba3 Fixed small mistake when comparing with nextTime 2023-08-18 01:46:00 +02:00
smallmodel 3cc0c41b7b Added ScriptArrayHolder constructor 2023-08-18 01:42:10 +02:00
smallmodel 697013bbbf Fixed grammar priorities with const array 2023-08-18 01:18:18 +02:00
smallmodel 0080d4b9a8 Using ScriptError 2023-08-18 01:18:07 +02:00
smallmodel 8c391ef880 set cvar_modifiedFlags to the difference between flags 2023-08-18 01:09:24 +02:00
smallmodel e6d3ca32f4 In CheckEndMatch, don't put any flag in cvars 2023-08-18 01:09:09 +02:00
smallmodel fab78f933e Using SHORT2ANGLE for ucmd angles 2023-08-17 22:44:27 +02:00
smallmodel 5cd7d89e72 Fixed wrong sv flags being used 2023-08-17 22:38:25 +02:00
smallmodel 15e8146306 Don't hide the HUD when in turret or vehicle 2023-08-17 22:38:09 +02:00
smallmodel 250f1d090e Fixed SanitizeName 2023-08-17 22:37:35 +02:00
smallmodel 03c5864034 Fixed secondarycharge animation 2023-08-17 22:37:09 +02:00
smallmodel 07b7f10912 Fixed UnlimitedAmmo() behavior (use the behavior from mohaas/mohaab) 2023-08-17 21:31:22 +02:00
smallmodel 0e1837db31 Fixed smoke and rifle grenade max ammo 2023-08-17 21:30:57 +02:00
smallmodel 070fe17473 G_PushEntity: use cylinder 2023-08-17 21:30:34 +02:00
smallmodel ba607a0aad Ignore the owner of the passEnt entity 2023-08-17 21:30:21 +02:00
smallmodel 2b38a0f48e Fixed wrong opcode for method event 2023-08-17 21:29:55 +02:00
smallmodel a1fb3b283c Remove clipmask flags for physics_on if it has second parameter specified 2023-08-17 20:13:58 +02:00
smallmodel 12e85aba45 Also check if the groundentity has no movetype 2023-08-17 20:05:30 +02:00
smallmodel 44fe18fef1 Added MASK_SCRIPT_SLAVE 2023-08-17 20:04:58 +02:00
smallmodel 28de2543ec Removed listenerVars as it can cause issues 2023-08-17 19:51:53 +02:00
smallmodel 4435984b81 Renamed label to m_Thread 2023-08-17 19:29:03 +02:00
smallmodel 1435489a43 Fixed floats with negative values 2023-08-17 19:17:16 +02:00
smallmodel 3d20b3a232 Using MASK_SHOT_TRIG for BulletAttack, so it touches triggers 2023-08-17 19:17:02 +02:00
smallmodel 97543622bf Added MASK_SHOT_TRIG
Fixed MASK_SHOT values
2023-08-17 19:16:49 +02:00
smallmodel a9374f068b Added a check to avoid packed from being out of bounds in MSG_PackCoord() 2023-08-17 18:24:50 +02:00
smallmodel d80e9d80e7 Fixed getcvar returning wrong values sometimes 2023-08-17 18:24:30 +02:00
smallmodel 4f757445c4 Set vehicle to be in godmode if the player is in godmode 2023-08-17 18:24:20 +02:00
smallmodel 2749ab92b2 trigger_hurt inherits from Trigger and not TriggerUse 2023-08-17 18:23:53 +02:00
smallmodel 011bee9f33 Implemented MSG_HandleCGMBufferOverflow
Fixed CGM buffer error for non-connected clients
2023-08-17 18:23:24 +02:00
smallmodel 1b86e60548 Implemented all mohaas/mohaab features like animated farplanes, skybox speed/farplane, etc. 2023-08-17 17:39:54 +02:00
smallmodel 23e01fc1a7 Make sure to set m_data.containerValue when copying the value 2023-08-17 17:39:26 +02:00
smallmodel 2c9c80d7bc Don't set the targetname if world doesn't exist
Prevent world from being retargeted
2023-08-17 17:39:12 +02:00
smallmodel 5146b1f36b Made SetTargetName virtual functions 2023-08-17 17:37:43 +02:00
smallmodel bc81fe78b2 Check if the ent is inside the hit entity (this fixes trigger_hurt issues in mp_stadt_dm 2023-08-17 16:10:29 +02:00
smallmodel 4de1b7c73b When showing entities number, add maxs.z offset 2023-08-17 16:09:46 +02:00
smallmodel 3c8c4e9f97 Call SetSize() directly from setModel() 2023-08-17 16:09:29 +02:00
smallmodel c366c10530 Fixed level/parm/game vars being overwritten 2023-08-17 16:09:09 +02:00
smallmodel 6f5106803d Made firstLeafBrush and firstLeafSurface as intptr_t, as sometimes it's an offset to an unrelated memory location (in 64-bit, it could be a very far away memory location) 2023-08-17 16:08:40 +02:00
smallmodel 55a6b7956a Changed event priorities 2023-08-17 16:07:51 +02:00
smallmodel 911d1f1706 Fixed OP_STORE_FIELD and OP_STORE_FIELD_REF 2023-08-17 16:07:38 +02:00
smallmodel 56fba733f3 Always cast targetlist to const array value, so the iteration remains untouched 2023-08-17 03:18:41 +02:00
smallmodel a3c65ef7e4 Fixed containerValue allocation (mustn't allocate a new one) 2023-08-17 03:18:19 +02:00
smallmodel 73bc196592 Fixed cmd execution while iterating over a target list 2023-08-17 03:04:01 +02:00
smallmodel 8487099264 Fixed crash due to improper ScriptPointer usage 2023-08-17 03:03:40 +02:00
smallmodel bdcd0dbd56 Fixed EventEnd copying and adding pointer value 2023-08-17 03:03:26 +02:00
smallmodel 3c2600648c Fixed "immediateremove" wrong spelling 2023-08-17 03:03:08 +02:00
smallmodel f1abfeced6 Fixed grammar for if/while/for statements with a single line and a semi-colon 2023-08-17 02:59:54 +02:00
smallmodel 99bce5a11a Fixed identifiers like "break_formation" being treated as "break" and "_formation" separately 2023-08-17 01:08:37 +02:00
smallmodel ab5a3604bf Fixed grammar like "$(value).field"
Fixed newline in if statements
Fixed if/else being ambiguous
2023-08-17 01:05:55 +02:00
smallmodel fab7d8539c Fixed an extremely nasty bug with libmad: mad.h defines SIZEOF_INT to 4, libmad c files don't include this mad.h file, which mean libmad c files will use 8-bytes int, and snd_codec_mp3.c will use 4-bytes int 2023-08-16 20:53:20 +02:00
smallmodel 0347a5ca0b Renamed MAX_CHANNELS to MAX_SKELETOR_CHANNELS to avoid conflict with sound channels (MAX_CHANNELS) 2023-08-16 20:51:19 +02:00
smallmodel 42ad1cb41c Removed libmad from includes 2023-08-16 20:50:26 +02:00
smallmodel 64e3c18fb9 Removed assertion (not present in mohaa) 2023-08-16 19:22:10 +02:00
smallmodel 7e113359b3 Fixed crash with healrate 2023-08-16 19:14:05 +02:00
smallmodel 467802c466 Fixed crash when loading savegame 2023-08-16 19:13:52 +02:00
smallmodel ce1b3aaee9 Fixed ArchiveAliases
Archive PathSearch
2023-08-16 19:13:38 +02:00
smallmodel 1a53bdd584 Implemented PathSearch::ArchiveDynamic 2023-08-16 18:48:38 +02:00
smallmodel 5521e7654d Fixed number of script classes being replaced by the number of threads, causing archive read to go wrong 2023-08-16 18:29:36 +02:00
smallmodel 73716dd624 Fixed silly mistake in the container archive function 2023-08-16 18:29:06 +02:00
smallmodel 840d23dcac Fixed sizeof(index) 2023-08-16 18:28:50 +02:00
smallmodel 525a0c7c82 Renamed and moved soundSystem_t to snd_local_new.h 2023-08-16 18:14:06 +02:00
smallmodel 46c35057fb Made omohserver an interface 2023-08-16 18:13:47 +02:00
smallmodel 6d03b9763a Using S_LoadData 2023-08-16 18:13:30 +02:00
smallmodel 9eaecb0a2a Fixed a crash when loading a script, on non-MSVC binaries 2023-08-16 16:07:42 +02:00
smallmodel c274af839e Updated README 2023-08-16 13:27:29 +02:00
smallmodel f9232840e4 Fixed sprint not working 2023-08-16 13:17:01 +02:00
smallmodel 3ea40fda82 Fixed runspeed values 2023-08-16 13:16:56 +02:00
smallmodel c357c2614a Added DEBUG_DROP_ASSERT CMake definition 2023-08-16 13:16:04 +02:00
smallmodel efed6d0eac Fixed script developer printf 2023-08-16 02:43:22 +02:00
smallmodel 244220f031 Fixed spawnpoint issues due to trace mask 2023-08-16 02:37:57 +02:00
smallmodel 7ce87575bc Added MASK_PLAYERSTART 2023-08-16 02:37:25 +02:00
smallmodel 401cfeda65 Make sure to not call CanSeeEnemy() if the enemy is NULL 2023-08-16 02:31:30 +02:00
smallmodel a45a8c7742 Fixed sentient linking/unlinking 2023-08-16 02:31:12 +02:00
smallmodel c80b360918 Fixed "ignoreclock" event name 2023-08-16 02:22:39 +02:00
smallmodel 8514ef6ef8 Fixed Objective::SetText event parameter 2023-08-16 02:18:23 +02:00
smallmodel 9b1dc34ea1 Fixed score data for mohaas/mohaab 2023-08-16 02:08:00 +02:00
smallmodel f5490321e7 Set default explosion to "fx/fx_explosion.tik" 2023-08-16 02:04:28 +02:00
smallmodel 1f4393e3b2 Call DM_Team::AddKills when the player got killed 2023-08-16 01:32:53 +02:00
smallmodel 8aa6a16a27 Export g_TOWObjectiveMan 2023-08-16 01:32:07 +02:00
smallmodel 286f553a54 Fixed uninitialized variable 2023-08-16 01:06:51 +02:00
smallmodel f0ec50e37b Implemented UIRadar::Draw() 2023-08-16 00:45:40 +02:00
smallmodel c1ee0332e3 Fixed parameter of Draw_StretchPic2 2023-08-16 00:45:26 +02:00
smallmodel d2737f2b40 Fixed CL_UnpackNonPVSClient not unpacking the clientNum 2023-08-16 00:45:12 +02:00
smallmodel 0d501ec38a Fixed CG_SameTeam always returning true 2023-08-16 00:44:44 +02:00
smallmodel d39e6421fe Call CG_UpdateRadarClient() in CG_AddCEntity 2023-08-16 00:44:30 +02:00
smallmodel c2125947ab Removed R_RegisterSkin 2023-08-16 00:20:16 +02:00
smallmodel 953a33a6ff Call CG_InitRadar and restore saved cgame state 2023-08-16 00:20:10 +02:00
smallmodel 883e7884c4 Updated README 2023-08-16 00:19:30 +02:00
smallmodel 508903c3b1 Moved console_spam_filter to Com_Init 2023-08-16 00:08:35 +02:00
smallmodel 9116063d3f Added CL_RestoreSavedCgameState and CL_RestoreSavedCgameState 2023-08-16 00:08:24 +02:00
smallmodel e2a0d2d01e Fixed function parameter 2023-08-16 00:07:45 +02:00
smallmodel 5343949254 Implemented Draw_StretchPic2 2023-08-15 23:52:22 +02:00
smallmodel c17454b124 Renamed bValid to teamShader 2023-08-15 23:24:23 +02:00
smallmodel 4f8dc5dc2a Added radar variables 2023-08-15 22:47:11 +02:00
smallmodel 0fea47bb69 Added Draw_StretchPic2 2023-08-15 22:44:37 +02:00
smallmodel 47665fcd70 Added CL_ReadNonPVSClient and CL_UnpackNonPVSClient 2023-08-15 22:22:35 +02:00
smallmodel 968b073338 Implemented client-game radar code 2023-08-15 22:21:44 +02:00
smallmodel 03582bb59a Added radars and radarShaders in cg_t 2023-08-15 22:21:24 +02:00
smallmodel 149d3ce2fc Added CL_InitRadar 2023-08-15 22:21:01 +02:00
smallmodel fe5e151d89 Added YawToAxis 2023-08-15 22:20:33 +02:00
smallmodel 06a7341eda Moved radarUnpacked_t from server.h to q_shared.h 2023-08-15 22:20:25 +02:00
smallmodel 456ed42e14 Implemented the radar system for non-pvs clients 2023-08-15 19:29:12 +02:00
smallmodel 2337f93df8 Added console_spam_filter 2023-08-15 19:28:38 +02:00
smallmodel ad675b05ac Better wording 2023-08-15 18:09:22 +02:00
smallmodel 44f6de9524 Added riscv and riscv64 2023-08-15 16:45:13 +02:00
smallmodel e25605b898 Updated README 2023-08-15 16:02:02 +02:00
smallmodel 919d14e329 Fixed README 2023-08-15 15:24:56 +02:00
smallmodel 8fc64cd1b1 Using libsdl-org/setup-sdl Github Actions 2023-08-15 15:16:00 +02:00
smallmodel 028a7d6125 Setup SDL for CodeQL 2023-08-15 13:35:16 +02:00
smallmodel 60b9a6e2e0 renamed to playerstart.h 2023-08-15 13:16:36 +02:00
smallmodel 9ad515335a Added g_utils.h 2023-08-15 13:04:18 +02:00
pryon 7593ea53f9 Fix generated executable/lib names missing the -dbg postfix on Visual Studio (#55)
* Fix generated executable/lib names missing the -dbg postfix on Visual Studio

* Spaces to tabs
2023-08-15 10:57:36 +00:00
smallmodel 07374ba1ed Compilation errors fixes 2023-08-15 12:47:49 +02:00
smallmodel 2deba01a5f Updated the README 2023-08-15 01:42:49 +02:00
smallmodel 3daee90b5b Moved functions from game.cpp/game.h to where they should be (g_main, g_utils) 2023-08-15 01:41:35 +02:00
smallmodel c4ba60afbd Added TRANS_BSP to G_BeginIntermission 2023-08-15 01:38:55 +02:00
smallmodel 81e9ce10cd Fixed warning spam if the default value is different 2023-08-15 01:27:54 +02:00
smallmodel c4738966fe Using g_utils.cpp from fakk 2023-08-15 01:27:35 +02:00
smallmodel 0eedc4e2f8 Fixed compilation warnings 2023-08-15 01:26:58 +02:00
smallmodel 14f9368575 Implemented all setters/getters
7 remaining important methods to implement
2023-08-15 00:24:07 +02:00
smallmodel 394546dee7 Added means of death strings 2023-08-14 23:37:14 +02:00
smallmodel e86e5c0d80 Renamed MOD_MINE to MOD_LANDMINE
Added MOD_AAGUN
2023-08-14 23:37:05 +02:00
smallmodel e0b5a62c4f Allow obj maps to be loaded in any game types 2023-08-14 20:44:46 +02:00
smallmodel 7fb42cf655 Fixed message printing on mohaas/mohaab 2023-08-14 20:44:28 +02:00
smallmodel 819f6bcf71 Using DM_Manager::CheckEndMatch() algorithm from mohaab 2.40 2023-08-14 20:35:23 +02:00
smallmodel ad47f8855b Implemented TOW Entities 2023-08-14 19:54:50 +02:00
smallmodel a50102ef52 Changed CONTROLLER_BOTH to CONTROLLER_DRAW
Added GetObjectiveIndex()
2023-08-14 19:53:35 +02:00
smallmodel 0b2a0634f5 Moved eController to Entities.h 2023-08-14 19:21:17 +02:00
smallmodel 8ea32fee31 Added Entities with all classes, methods and events (unimplemented) 2023-08-14 19:20:53 +02:00
smallmodel f0571385d5 Export events for AISpawnPoint 2023-08-14 19:00:16 +02:00
smallmodel 83318af532 Export EV_Weapon_SetProjectile 2023-08-14 17:43:28 +02:00
smallmodel 860c9b33ef Made AddObjective and SetCurrentObjective static 2023-08-14 15:02:25 +02:00
smallmodel ecbd6ae282 Renamed WITH_CLIENT to BUILD_NO_CLIENT 2023-08-14 13:31:42 +02:00
smallmodel 3ec799d150 Compiled parser 2023-08-14 03:15:48 +02:00
smallmodel 72715c1a85 Fixed CL_Disconnect being passed with arguments 2023-08-14 03:15:42 +02:00
smallmodel 16d262f6ee Fixed floats being interpreted as integers sometimes 2023-08-14 03:09:38 +02:00
smallmodel 49850940d6 Using objective flags enumeration 2023-08-14 02:39:32 +02:00
smallmodel e634fb5022 Using objective flags enum 2023-08-14 02:34:06 +02:00
smallmodel c0726f0634 Added objective status and flags enum 2023-08-14 02:33:59 +02:00
smallmodel 91dc3e5884 Fixed configstring index because of denormalization 2023-08-14 02:24:48 +02:00
smallmodel ba2c3ed5fd Fixed lean on protocols before 2.0 2023-08-14 02:12:30 +02:00
smallmodel 161f7e3313 Fixed wrong current objective
Added support for objective location per team
2023-08-14 02:11:26 +02:00
smallmodel f2f7afadef Don't resend the game state if the serverId is the same as the restarted server Id 2023-08-14 01:57:02 +02:00
smallmodel 0898bffb43 Fixed getboundkey1/getboundkey2 crashing when the key is null 2023-08-14 01:56:43 +02:00
smallmodel 99dc7bf7f2 Fixed CL_MapLoading always flushing 2023-08-14 01:56:25 +02:00
smallmodel 64acea9018 Call SV_CheckSaveGame in Com_Frame 2023-08-14 01:27:25 +02:00
smallmodel 8e05347ba0 Moved CL_FinishedIntro and SV_CheckSaveGame to qcommon.h 2023-08-14 01:27:13 +02:00
smallmodel 07e90d37ee Fixed bad angle 2023-08-14 00:22:25 +02:00
smallmodel 71bd04e5b2 Fixed weapon bullet trace
Fixed projectile being always removed in single-player mode
2023-08-14 00:22:05 +02:00
smallmodel 95510279ed Fixed trigger having no contents when a model is set 2023-08-14 00:21:44 +02:00
smallmodel f1502833b2 Fixed primary/secondary attacks not working 2023-08-13 23:21:11 +02:00
smallmodel e6448697d3 Let cg cleanup temp models
Fixed server restart
2023-08-13 23:20:51 +02:00
smallmodel 5a96d6dd96 Added snd_local_new for new local functions 2023-08-13 23:20:15 +02:00
smallmodel 8d6b3d0bd8 Added cg_archive and cg_radar (unimplemented) 2023-08-13 23:20:00 +02:00
smallmodel 1fd0cd097f Fixed the objective index 2023-08-13 22:08:10 +02:00
smallmodel 421126db38 Optimized ScriptVM::EventGoto 2023-08-13 22:07:33 +02:00
smallmodel 7258a2e972 Fixed CG_DrawObjectives stack overflow 2023-08-13 22:07:19 +02:00
smallmodel df66ab0339 Fixed EmitField bug
Clear the previous opcode when a new label is emitted
2023-08-13 21:55:22 +02:00
smallmodel c49d0c7afa Fixed iprintln(bold) not working properly with multiple arguments 2023-08-13 20:22:39 +02:00
smallmodel 421b3d6375 Fixed crouch on mohaa and mohaas/mohaab 2023-08-13 20:20:36 +02:00
smallmodel 11ef489225 Added basic implementation of sound callback
Implemented S_IsSoundPlaying
2023-08-13 20:20:17 +02:00
smallmodel e1da6797c5 Using S_FLAG_DO_CALLBACK 2023-08-13 20:19:51 +02:00
smallmodel 430c7d1a57 Fixed ScriptCheck always failing regardless of the g_scriptcheck value 2023-08-13 20:19:40 +02:00
smallmodel d3794c0dd9 Fixed bad event when using '$' key 2023-08-13 20:19:26 +02:00
smallmodel eef1368083 using g_gametype variable directly instead of using Cvar_VariableValue 2023-08-13 20:19:03 +02:00
smallmodel 6dfefa04f5 Fixed SV_AllowSaveGame always returning true 2023-08-13 20:18:46 +02:00
smallmodel 8b17d81545 Fixed variables improperly used on stack under some circumstances 2023-08-13 20:17:59 +02:00
smallmodel ec58ca0f13 Added S_FLAG_DO_CALLBACK 2023-08-13 20:17:33 +02:00
smallmodel 3fd87f90a2 Fixed objectives not showing properly 2023-08-13 20:17:23 +02:00
smallmodel 9f268b0f6a Using Director.Pause() instead 2023-08-13 17:59:59 +02:00
smallmodel f857116f75 Fixed script crashes 2023-08-13 17:59:49 +02:00
smallmodel ea78d96bc3 Fixed disabled view model animation
Fixed pmove viewheight
2023-08-13 17:59:41 +02:00
smallmodel 0be9e69833 Added protocol for pmove_t for PM_CheckDuck 2023-08-13 17:59:21 +02:00
smallmodel 8171641e3a Fixed "dmmessage" not being logged (it's a bug in all versions of mohaas/mohaab) 2023-08-13 16:13:08 +02:00
smallmodel ee6014a30f Fixed Player::CondCheckMovementSpeed returning wrong value (expects it to return true if below the weapon's max fire movement) 2023-08-13 16:11:59 +02:00
smallmodel 16c22a3ee5 Added "idle0", "idle1", "idle2" view model animations
Fixed respawn time after death
Fixed Sentient not switching to the primary weapon when spawning
Fixed weapon select not showing
Initialize all Player variables
Remove projectiles when switching teams
Set viewmodelanim to disabled when reaching the weapon's max fire movement
2023-08-13 16:11:25 +02:00
smallmodel 571e48fecf Call Weapon::Charge in Sentient::ChargeWeapon
Don't charge again if sentient is already charging weapon
2023-08-13 16:07:46 +02:00
smallmodel 973d7c5f34 Implemented Weapon::Charge
Cancel overcooked events in Weapon::ReleaseFire
2023-08-13 16:07:11 +02:00
smallmodel a1c5ca288a Renamed m_iOwnerTeam to m_iTeam
Implemented SetFuse, ArcToTarget, BecomeBomb, and DieInwater
Fixed projectile life being wrong when charging
2023-08-13 16:06:49 +02:00
smallmodel e330d00565 Added dmmessage monitoring 2023-08-13 14:19:14 +02:00
smallmodel 6feeb21e21 Fixed uninitialized angular delta variable 2023-08-13 14:19:05 +02:00
smallmodel bb5cf24d5f Fixed "isabandoned" mispelling 2023-08-13 03:34:28 +02:00
smallmodel 0dda70cca1 Fixed event parameters being wrong 2023-08-13 03:34:19 +02:00
smallmodel 5e83e03e33 Major grammar/lexer/compiler fixes 2023-08-13 03:34:09 +02:00
smallmodel d2b3f6c12b Added stub yacc / lex 2023-08-12 20:00:12 +02:00
smallmodel f5af33b181 Major script engine fixes 2023-08-12 19:59:40 +02:00
smallmodel 0da1ed8764 Fixed canseenoents having the wrong name 2023-08-12 19:59:17 +02:00
smallmodel 8aa6f29c4c Added all script functions from mohaas/mohaab 2023-08-12 14:02:43 +02:00
smallmodel 1b7a4442d3 Added no_fade parameter to G_BeginIntermission 2023-08-12 14:00:14 +02:00
smallmodel a163df993c Added MOD_MINE_EXPLOSION 2023-08-12 13:59:56 +02:00
smallmodel 2787007b9d Cleaned up class 2023-08-12 03:10:10 +02:00
smallmodel cea2c178b5 Fixed header 2023-08-12 03:05:06 +02:00
smallmodel 77a9cd5a9a Call Director.Unpause() to execute running scripts 2023-08-12 03:04:31 +02:00
smallmodel ec3259271e Removed THREAD_CONTEXT_SWITCH 2023-08-12 03:03:34 +02:00
smallmodel ae02abba3b Cleaned up ScriptMaster 2023-08-12 03:03:26 +02:00
smallmodel bf960f6f32 Cleaned up ScriptThread 2023-08-12 02:40:30 +02:00
smallmodel 66a1087099 Moved ScriptMaster methods here 2023-08-12 02:40:03 +02:00
smallmodel c1a431f857 Added all mohaas/mohaab features (SetWeaponIdleState, PingForMines, ForceLandmineMeasure, ForceDropWeapon and ForceDropHealth)
Set m_fDamageMultipliers depending on whether or not g_realismmode is set
Minor fixes in the sentient constructor
2023-08-12 00:49:07 +02:00
smallmodel dac5279a59 Archive is_paused and angular_delta 2023-08-12 00:47:39 +02:00
smallmodel a175ea27d7 Cleanup weapon class
Added ShowInfo, SetItemSlot and SetIdleState
2023-08-12 00:10:47 +02:00
smallmodel ddac42e21e Call Weapon::GetZoom() instead 2023-08-11 23:54:43 +02:00
smallmodel 34535ad415 Moved AnimationEvent from Animate to a separate source file 2023-08-11 21:48:25 +02:00
smallmodel c0597e441c Moved AnimationEvent from Animate to a separate source file
Implemented whole animate class from mohaas/mohaab
2023-08-11 21:30:47 +02:00
smallmodel 04b66684dd Added a function to get an animation's angular delta over time 2023-08-11 21:11:16 +02:00
smallmodel 244a2e66f9 Added TIKI_Anim_DeltaOverTime 2023-08-11 21:10:29 +02:00
smallmodel 55b737e730 Set global channel from local to -1 2023-08-11 21:10:14 +02:00
smallmodel 059dacf2a7 Added GetAngularDeltaOverTime() to return the animation's angular delta over time 2023-08-11 21:09:47 +02:00
smallmodel 41f7003747 Fixed SetPlayerView, SetupView, PlayerAngles
UpdateStats changes:
- Added support for allied and axis objective locations
- Vehicle health
- Healrate
- Secondary ammo
2023-08-11 03:13:36 +02:00
smallmodel 64ba900511 Use GetRemoteOwner() properly 2023-08-11 03:09:33 +02:00
smallmodel e371b4bbd3 Replaced unused stats 2023-08-11 03:09:19 +02:00
smallmodel aa44150525 Added some mohaas/mohaab methods (stubs) 2023-08-11 03:09:10 +02:00
smallmodel 3572be718a Use usercmd_s instead of usercmd_t 2023-08-11 03:08:56 +02:00
smallmodel a56d74814b Try to play pain animation in DamageFeedback 2023-08-11 01:58:22 +02:00
smallmodel 8d41b58635 Using hitloc enum instead of macros 2023-08-11 01:34:21 +02:00
smallmodel e80f326ee6 Proper implementation of DamageFeedback 2023-08-11 01:21:50 +02:00
smallmodel c5bd64912a Added MOVETYPE_PORTABLE_TURRET 2023-08-11 01:21:29 +02:00
smallmodel 8a808b616e Apply fall damage differently on mohaas/mohaab
Ignore world effects if no-cliping
2023-08-11 00:54:15 +02:00
smallmodel 91bb2f2e0b Enable god mode for the vehicle the player is in 2023-08-11 00:48:09 +02:00
smallmodel aa4e6a0651 Removed SpawnDamageEffect
DoUse: Call RemoveFromVehiclesAndTurretsInternal() directly
Use G_PMDrawTrace if sv_drawtrace is above 1
Set allow lean while moving
Disable movement prediction if player is glued onto something
Multiply the speed by the weapon movement speed
Added Teamkill warn and kick
Added support for invulnerability, sprint and team spawn
Added support for heal rate
Added talk icon
2023-08-11 00:43:40 +02:00
smallmodel 8e9ff2b289 Added G_PMDrawTrace 2023-08-11 00:13:29 +02:00
smallmodel d53ab8540e Fixed Unix compilation warnings/errors 2023-08-10 23:06:03 +02:00
smallmodel 7b133e5b2f Fixed const param 2023-08-10 23:04:47 +02:00
smallmodel 2b72959935 Call Obituary if there is also an inflictor
Clear pain animation when killed
Increment team kills count when a teammate was killed
2023-08-10 21:38:37 +02:00
smallmodel 82d0b62631 Implemented EndAnim_Pain 2023-08-10 21:37:53 +02:00
smallmodel 7205e27c8c Using death messages implementation from mohaas/mohaab 2023-08-10 21:26:28 +02:00
smallmodel c8d1248d86 Added MOD_MINE means of death 2023-08-10 21:26:07 +02:00
smallmodel 845e4556ef Added g_obituarylocation (openmohaa-specific parameter) 2023-08-10 21:23:10 +02:00
smallmodel a92bfbde40 Fixed variable names 2023-08-10 21:22:50 +02:00
smallmodel 999b6409b3 Fixed InitEdict, InitHealth
InitModel: IT/SC skins support, and voiceType fix
Respawn: Set invulnerability
2023-08-10 20:14:34 +02:00
smallmodel 0ae0be4047 Added more ammo to initialize
Added stopwatch parameter for mohaas/mohaab
Initialize mine variables in InitState
2023-08-10 19:36:14 +02:00
smallmodel fc7029c271 Added stopwatch type 2023-08-10 19:32:21 +02:00
smallmodel 307ee117bd Initialize invulnerability
Set the player view accordingly when choosing a spawn point
Don't set m_fDamageMultipliers in realism mode
Score isn't processed in single-player anymore
2023-08-10 19:14:51 +02:00
smallmodel 087d28eb9a Added GT_TOW and GT_LIBERATION for SelectSpawnPoint() 2023-08-10 19:11:39 +02:00
smallmodel 1deea345bc Renamed team to teamnum 2023-08-10 18:49:57 +02:00
smallmodel e0fa706f6c Implemented EquipWeapons, Stats, TickTeamSpawn, UserSelectWeapon, AllowTeamRespawn and EventKillAxis 2023-08-10 18:48:46 +02:00
smallmodel cf794d2b95 Added DF_OLD_SNIPER and DF_DISALLOW_KAR98_MORTAR 2023-08-10 18:42:13 +02:00
smallmodel 391e82bb92 Formatted source files 2023-08-10 18:41:49 +02:00
smallmodel 83a44b3158 Implemented RemoveFromVehiclesAndTurretsInternal 2023-08-10 17:01:55 +02:00
smallmodel 8cd0e6c5bf Added FixedTurret, PortableTurret and CarryableTurret (unimplemented) 2023-08-10 17:01:43 +02:00
smallmodel 619ab00035 Added player-specific methods 2023-08-10 17:01:19 +02:00
smallmodel 4ded5c3380 Added EV_Weapon_SetAmmoClipSize declaration 2023-08-10 17:00:51 +02:00
smallmodel 85fa2185f8 Added DetachRemoteOwner 2023-08-10 17:00:38 +02:00
smallmodel ab39259bbe Moved vote options stuff to bg_voteoptions.h 2023-08-10 17:00:17 +02:00
smallmodel 9bf2065d18 Implemented battle language methods and GetTeamDialogPrefix/GetNationalityPrefix 2023-08-10 14:18:40 +02:00
smallmodel ceb121d588 Added MASK_BATTLELANGUAGE 2023-08-10 14:14:50 +02:00
smallmodel e7dbc25ca0 Made entity parameter a constant instance 2023-08-10 14:14:39 +02:00
smallmodel 7386784765 Renamed clientPersistant_t to client_persistant_t
Named client_peristant_t fields correctly
2023-08-10 13:34:04 +02:00
smallmodel 9062952539 Implemented GiveNewWeaponsCheat, GetSpectateFollowOrientation, EnsurePlayerHasAllowedWeapons, SetPlayerSpectateRandom, RetrieveVoteOptions and GetNationalityPrefix
mohaas/mohaab fixes
2023-08-10 13:31:35 +02:00
smallmodel 9f0a479c3b added playerAnimSlot_t enum 2023-08-10 13:30:32 +02:00
smallmodel 517b9296dc Using sv_walkspeedmult instead of sv_walkspeed 2023-08-10 12:09:07 +02:00
smallmodel 3ca09613e1 Fixed string constants 2023-08-10 12:08:53 +02:00
smallmodel ba931cbedf Added all mohaas/mohaab cvars 2023-08-10 12:04:45 +02:00
smallmodel 090b354b23 Added all mohaas/mohaab events, methods (partially implemented) 2023-08-10 03:56:13 +02:00
smallmodel dd30bfde15 Set protocol from com_protocol 2023-08-10 03:55:50 +02:00
smallmodel 477735cb3d Cleanup player class
Added all mohaas/mohaab methods (partially implemented)
2023-08-10 03:46:28 +02:00
smallmodel 38599f2181 Added more cvars 2023-08-10 03:45:38 +02:00
smallmodel bd794fb286 Cleanup Level 2023-08-10 03:10:51 +02:00
smallmodel ce34b78113 Added CL_LV_ConvertString
Only CL messages are localized now (see comment)
2023-08-10 02:42:57 +02:00
smallmodel b8a87dc6ea Using dm_manager.h instead of dm_team.h 2023-08-10 02:31:48 +02:00
smallmodel 7bdc30936c Added G_SetClientConfigString 2023-08-10 02:31:09 +02:00
smallmodel 9e635a7207 Rearranged DM_Manager
Moved dm_team.cpp code to dm_manager.cpp
2023-08-10 02:31:01 +02:00
smallmodel e5626378ef Added m_bIgnoreClock 2023-08-10 01:42:24 +02:00
smallmodel 73921c116d Made FireWeapon and EventUseWeaponClass virtual methods 2023-08-10 01:42:06 +02:00
smallmodel d4b98ef9dd Added sprint, invulnerable and team spawn variables 2023-08-10 01:41:03 +02:00
smallmodel 40318f052a Set GAMEVERSION to OPENMOHAA 2023-08-09 23:49:47 +02:00
smallmodel a130f45c62 Added GetViewAngles, SetFov and GetFov
Removed SwingAngles
2023-08-09 23:49:38 +02:00
smallmodel e687d97660 Fixed compile errors 2023-08-09 23:48:37 +02:00
smallmodel e4a0406fc2 Removed Player::PlayerDone
Using Player::DeadBody with the event parameter
2023-08-09 23:11:39 +02:00
smallmodel ef18c389be Cleanup entity class
Added new parameter for CanSee
Added Entity::SafeSolid and Entity::Sink
2023-08-09 23:09:09 +02:00
smallmodel 85099801ab Call Player::DeadBody() with the event function instead 2023-08-09 22:09:04 +02:00
smallmodel 3472657f92 Added MASK_SAFESOLID 2023-08-09 22:08:37 +02:00
smallmodel c197513ff3 Fixed mismatched endif 2023-08-09 21:00:56 +02:00
smallmodel 9dca77c2cf Fixed setModel() virtual function 2023-08-09 20:58:36 +02:00
smallmodel f08a7fa21e Removed Player::useWeapon 2023-08-09 20:58:07 +02:00
smallmodel 2df56c810d Set Entity's entnum directly 2023-08-09 20:57:53 +02:00
smallmodel 8c6098f730 Removed SimpleEntity::SetTargetViewAngles() 2023-08-09 20:57:45 +02:00
smallmodel 1462d4f8d9 Removed StunAttack (useless) 2023-08-09 20:57:26 +02:00
smallmodel 5bd49304d7 Cleaned up SimpleEntity 2023-08-09 20:57:17 +02:00
smallmodel f52d648d6f Added InteractObject and ThrowObject 2023-08-09 20:49:43 +02:00
smallmodel 987af7eb81 Cleaned up Sentient class
Moved combat stuff to sentient_combat.cpp
Formatted source files
2023-08-09 19:45:39 +02:00
smallmodel f313b6a058 Formatted item source files 2023-08-09 16:54:38 +02:00
smallmodel 99b989bb63 Added DynItem
Removed unused features
Added remaining mohaa functions
2023-08-09 16:37:08 +02:00
smallmodel 7ebbba6ce5 Made Class::warning and Class::error const methods 2023-08-09 01:53:45 +02:00
smallmodel c2a6db15a6 Reordered and removed useless functions 2023-08-09 01:32:23 +02:00
smallmodel aa58bcf948 Using const_str for trigger 2023-08-09 00:54:06 +02:00
smallmodel fa5b030522 Cleaned up trigger source file 2023-08-09 00:42:09 +02:00
smallmodel 3e44049abf Removed unused trigger features 2023-08-08 23:51:46 +02:00
smallmodel 94c501e71b Formatted document 2023-08-08 23:46:45 +02:00
smallmodel 484b2a8900 Implemented TriggerAll 2023-08-08 23:35:01 +02:00
smallmodel e8ff4fb9a7 Fixed wrong TRIGGER_DAMAGE value 2023-08-08 23:06:28 +02:00
smallmodel b89e10fd5c Reordered conditions 2023-08-08 22:40:23 +02:00
smallmodel d86ea606eb Formatted source files 2023-08-04 00:21:19 +02:00
smallmodel 2135be12b8 Implemented all unimplemented conditions 2023-08-04 00:20:28 +02:00
smallmodel ae5d51f2e9 Reworked the player class
Added player_animation.cpp and player_conditionals.cpp
Renamed conditions functions and moved them to player_conditionals.cpp
2023-08-04 00:04:29 +02:00
smallmodel 6eaf25ff80 Using const for CurrentAnim() and CurrentTime() 2023-08-04 00:03:55 +02:00
smallmodel 17c371c15e Added Entity::BlocksAIMovement 2023-08-03 21:44:16 +02:00
smallmodel 13febc125e Renamed weapon to dm_primary 2023-08-03 21:44:05 +02:00
smallmodel b0f26acc18 Fixed max movement time 2023-08-03 21:43:50 +02:00
smallmodel 8ffa5f15e6 Implemented BulletAttack from mohaas/mohaab
Added more explosion effects
2023-08-03 21:43:38 +02:00
smallmodel f6bcc1ab86 Increased MAX_WEAPONS to 64 2023-08-03 20:14:33 +02:00
smallmodel a4d6442526 Call BulletAttack_Stat instead of putting everything in BulletAttack
Fixed some BulletAttack bugs
2023-08-02 23:09:18 +02:00
smallmodel b7fac3a5b0 Added BulletAttack_Stat 2023-08-02 21:58:47 +02:00
smallmodel 64ebf3ed05 Implemented all landmine related functions 2023-08-02 21:50:11 +02:00
smallmodel 9933612607 Added ScriptVariableList::VariableExists 2023-08-02 21:49:03 +02:00
smallmodel 22ff072b54 Made findKeyValue and findKeyEntry const 2023-08-02 21:48:54 +02:00
smallmodel 73b0a84ad0 Added MASK_LANDMINE_PLACE 2023-08-02 21:05:49 +02:00
smallmodel 7b03f953bf Added Level::RoundStarted 2023-08-02 21:02:19 +02:00
smallmodel 367d6ff6fc Added and implemented TriggerNoDamage, TriggerEntity and TriggerLandmine 2023-08-02 21:00:16 +02:00
smallmodel ca61fde54b Added ScriptThreadLabel::Execute() with safeptr listener, and optionally another listener 2023-08-02 20:59:54 +02:00
smallmodel f739588c73 Cleaned up Player class from all unused action anim
Added all mohaas/mohaab fields
Added m_sDmPrimary to get the player's primary weapon
2023-08-02 20:59:19 +02:00
smallmodel ce02d782c4 Removed Player::FindEnemyInFOV and Player::FindEnemyInFOVFromTagWithOffset (unused) 2023-08-02 20:59:15 +02:00
smallmodel a498b11e20 Added MASK_LANDMINE 2023-08-02 20:56:19 +02:00
smallmodel ffa5a91cd2 Added Landmine and Defuse fire types for Shoot
Added GetUseCrosshair()
2023-08-02 19:53:14 +02:00
smallmodel ae680ffd5d Added Landmine functions from mohaab
Added more parameters for BulletAttack and FakeBulletAttack from mohaas/mohaab
2023-08-02 19:52:04 +02:00
smallmodel 4c17d12fc6 Added new fire types
Added GetFireAnim()
Using m_sTagBarrel rather than an hardcoded tag name
2023-08-01 21:18:35 +02:00
smallmodel 0259f1a251 Reworked Weapon::ReadyToFire and Weapon::PickupWeapon with mohaas/mohaab features 2023-08-01 20:36:52 +02:00
smallmodel 04708aeb67 Fixed CurrentFrame() not found error 2023-08-01 19:59:32 +02:00
smallmodel a47eb1653e Override animation functions from entity 2023-08-01 19:59:19 +02:00
smallmodel 10fda39430 Added animation functions 2023-08-01 19:59:05 +02:00
smallmodel b2be03cce3 Initialize all weapon vars, including mohaas/mohaab variables 2023-08-01 19:31:25 +02:00
smallmodel 84ecf838d4 Optimized G_Command_ProcessFile a little bit 2023-08-01 19:31:08 +02:00
smallmodel c115796137 Optimized GetValue() so it moves value instead of copying it 2023-08-01 19:30:28 +02:00
smallmodel 7e054c8beb Implemented all mohaas/mohaab events 2023-07-31 23:41:53 +02:00
smallmodel e8df36998e Added mohaas/mohaab variables 2023-07-31 23:41:45 +02:00
smallmodel 0cc558f757 Added overcooked field 2023-07-31 23:41:01 +02:00
smallmodel 5c9bc074f4 Removed fov variable (was useless) 2023-07-31 23:40:39 +02:00
smallmodel d89175ebc8 Added "always" parameter for alias registration 2023-07-30 23:02:13 +02:00
smallmodel 727eb71995 Added all mohaas/mohaab entity events 2023-07-30 21:21:00 +02:00
smallmodel 3d48c00902 Added g_realismmode 2023-07-30 20:21:18 +02:00
smallmodel 963318264c Added SV_HitEntity from mohaab 2023-07-30 20:21:08 +02:00
smallmodel d9123799d6 Added CONTENTS_CLAYPIDGEON 2023-07-30 19:48:43 +02:00
smallmodel 6562bcb164 Added mohaas/mohaab weapon events (unimplemented) 2023-07-30 19:41:11 +02:00
smallmodel 4fa8af3b30 Smoke system implementation from mohaas/mohaab 2023-07-30 16:09:54 +02:00
smallmodel 3f4be4f8ef Added MASK_SMOKE_SPRITE 2023-07-30 16:09:36 +02:00
smallmodel 09c7badf4f Added g_debugsmoke cvar 2023-07-30 16:09:22 +02:00
smallmodel 7b9b371cf6 Added RotatePointAroundAxis 2023-07-30 15:42:59 +02:00
smallmodel 25e44e7a45 Added stub source files from mohaas/mohaab 2023-07-30 14:28:58 +02:00
smallmodel 51374729d3 Clear g_iInThinks each frame
Display the memory usage if the g_showmem cvar is set
2023-07-30 14:27:15 +02:00
smallmodel 5a19f7f574 Added LightClass 2023-07-30 14:26:52 +02:00
smallmodel 40ac8a1557 Added watchstring from mohaab 2023-07-30 14:09:22 +02:00
smallmodel ca42a3e08e Implemented View3D::DrawLetterbox, View3D::DrawFades, View3D::DrawSoundOverlay, View3D::ClearCenterPrint, View3D::UpdateCenterPrint, View3D::UpdateLocationPrint, View3D::LetterboxActive, View3D::InitSubtitle 2023-07-30 11:47:20 +02:00
smallmodel 3a04357b71 Fixed enum values and enum names 2023-07-30 11:40:50 +02:00
smallmodel 078223c1b6 Centerprint when screenshotting 2023-07-30 11:40:33 +02:00
smallmodel 3fe7cbf725 Fixed vertex colors spam 2023-07-30 11:38:59 +02:00
smallmodel d6059e42ba Export sound_overlay for View3D 2023-07-30 11:38:41 +02:00
smallmodel 02c1fbe4fc Export LV_ConvertString to ref 2023-07-30 11:38:31 +02:00
smallmodel 6f8fee47f2 Using const char* for LV_ConvertString 2023-07-30 11:38:18 +02:00
smallmodel 6c247b300e Updated README 2023-07-30 11:37:41 +02:00
smallmodel 3627760748 Removed parent entity not found message in CG_GetOrigin 2023-07-30 01:10:26 +02:00
smallmodel f3affb3d4c Implemented DontLocalize and FadeSequence from mohaas 2023-07-30 00:56:54 +02:00
smallmodel a86ed01ba3 Fixed shader tiling being bad with virtual scaling on mohaas/mohaab 2023-07-29 23:18:31 +02:00
smallmodel d40755eb7c Added MouseAwayCommand. (this fixes main menu with items staying hovered in mohaas/mohaab) 2023-07-29 23:18:22 +02:00
smallmodel ce7599cb02 Set column padding 2023-07-29 22:31:16 +02:00
smallmodel 68bf89c522 Fixed entity axis index crash (was using i instead of j) 2023-07-29 21:26:28 +02:00
smallmodel 0c5b57ee05 Fixed MASK_SURF_TYPE not matching all surfaces 2023-07-29 21:25:39 +02:00
smallmodel 69a10da52c Version number increment 2023-07-29 19:57:16 +02:00
smallmodel ab534623c4 Fixed crash due to trace.allSolid not being initialized 2023-07-29 19:56:54 +02:00
smallmodel ae4ea14b35 Fixed crash related to backEnd.currentEntity being null 2023-07-29 19:56:36 +02:00
smallmodel ea3c48af02 Fixed double-click not working 2023-07-29 19:41:29 +02:00
smallmodel 9df0c023ed Fixed the server list
Fully implemented the server list
Added support for mohaas/mohaab server list
2023-07-29 19:31:16 +02:00
smallmodel a5259ebc05 Using MASTER_SERVER_HOST macro 2023-07-29 19:30:39 +02:00
smallmodel add59ad12a Implemented UIListBase::TrySelectItem and UIListBase::KeyEvent 2023-07-29 19:30:22 +02:00
smallmodel 53eecb4d4c Fixed compare function being wrong 2023-07-29 19:29:52 +02:00
smallmodel 77fb47451c Added game_version cvar so it shows on the UI on mohaas/mohaab 2023-07-29 19:29:38 +02:00
smallmodel 80ae39c2a7 Fixed mouse wheel not working 2023-07-29 19:29:13 +02:00
smallmodel 118ce0d550 Implemented all unimplemented functions/methods 2023-07-29 00:47:05 +02:00
smallmodel dfd9afceba Added Cvar_VariableFloatValue 2023-07-28 22:34:29 +02:00
smallmodel 6f7eb93645 Export UI_SetReturnMenuToCurrent() 2023-07-28 22:34:22 +02:00
smallmodel a5268cbd24 Implemented FAKKServerListItem class
Implemented UIFAKKServerList::RefreshServerList, UIFAKKServerList::RefreshLANServerList, UIFAKKServerList::NewServerList, UIFAKKServerList::ServerCompareFunction and UIFAKKServerList::SortByColumn
2023-07-28 21:51:37 +02:00
smallmodel c732ed66b2 Set default alpha to 1.0 2023-07-28 21:45:19 +02:00
smallmodel 10981f706f Added functions to get game key, game name and game ID 2023-07-28 21:45:07 +02:00
smallmodel d61218d7e2 Fixed const parameters 2023-07-28 21:44:43 +02:00
smallmodel 615032bc25 Fixed cross-platform errors 2023-07-27 23:13:57 +02:00
smallmodel ea70be07a2 Added FAKKServerListItem class (with unimplemented methods) 2023-07-27 23:02:39 +02:00
smallmodel 1884d3d23c Using a const char* for ServerListAuxUpdate 2023-07-27 23:00:27 +02:00
smallmodel 3f036cca5e Added GameSpy server list 2023-07-27 22:43:51 +02:00
smallmodel 3e02fe340b Implemented UIFAKKServerList's constructor 2023-07-27 22:43:41 +02:00
smallmodel 50d62f1505 Exported EV_UIListBase_ItemDoubleClicked and EV_UIListBase_ItemSelected 2023-07-27 22:43:24 +02:00
smallmodel 60511ace99 Set maximum parallel job to 1 when publishing a new release 2023-07-25 23:59:20 +02:00
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
573 changed files with 177273 additions and 210509 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
+28 -58
View File
@@ -2,9 +2,7 @@ name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
concurrency:
@@ -29,19 +27,6 @@ jobs:
name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ubuntu-22.04
# container:
# image: ubuntu:22.04
# volumes:
# - ${{github.workspace}}:${{github.workspace}}
#
# steps:
# - name: Install required packages
# run: apt update && apt install -y clang-15 cmake ninja-build flex bison git
#
# - name: Install required cross-platform packages (${{ matrix.architecture.triple }})
# if: matrix.architecture.name != 'amd64'
# run: apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
steps:
- name: Settings
working-directory: ${{github.workspace}}
@@ -56,22 +41,18 @@ jobs:
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
if: matrix.architecture.name != 'amd64'
run: sudo apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
- name: Install dependencies
working-directory: ${{github.workspace}}
run: |
echo Using triple: ${{ matrix.architecture.triple }}
mkdir -p thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' \
./SDL
cmake --build SDL-build --config Release
cmake --install SDL-build
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
build-type: Release
cmake-arguments: "-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }}
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }}"
- uses: actions/checkout@v3
with:
@@ -86,21 +67,17 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/lib/cmake/SDL2' \
-DWITH_CLIENT=1" >> $GITHUB_ENV
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
- 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,16 +86,13 @@ 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'
cp '${{steps.sdl.outputs.prefix}}/lib/libSDL2.so' '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
@@ -145,14 +119,19 @@ jobs:
run: |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors * 16)" >> $GITHUB_ENV
- name: Install required packages
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
build-type: Release
cmake-arguments: "-A ${{ matrix.architecture.config }}"
- name: Install Flex/Bison
working-directory: ${{github.workspace}}
run: |
mkdir thirdparties && cd thirdparties
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
cmake -B SDL-build -A ${{ matrix.architecture.config }} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' ./SDL
cmake --build SDL-build --config Release --parallel
cmake --install SDL-build
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
cmake --build winflexbison-build --config Release --parallel
@@ -168,25 +147,19 @@ jobs:
--log-level=VERBOSE `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++ `
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/cmake' `
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DWITH_CLIENT=1".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- 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,16 +168,13 @@ 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"
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/install'
- uses: actions/upload-artifact@v3
with:
+7
View File
@@ -43,6 +43,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
# Setup SDL
- name: Set up SDL
id: sdl
uses: libsdl-org/setup-sdl@main
with:
version: sdl2-latest
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
+3
View File
@@ -18,6 +18,9 @@ jobs:
deploy_all:
strategy:
# Set the maximum number of parallel jobs to 1, to avoid a race-condition
# while creating a new release
max-parallel: 1
matrix:
target_os: [
'linux-amd64',
-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.
+24 -21
View File
@@ -5,23 +5,14 @@ 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 "./")
set(CMAKE_DEBUG_POSTFIX "-dbg")
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
@@ -31,13 +22,24 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-pointer-bool-conversion)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Add this option on gcc to prevent functions from having the STB_GNU_UNIQUE binding
# Otherwise, it would prevent libraries from being unloaded
# which will cause undefined behavior and crashes due to memory corruption
add_compile_options(-fno-gnu-unique)
endif()
if(DEBUG_MEMORY)
add_definitions(-D_DEBUG_MEM)
endif()
IF("${TARGET_ARCH}" STREQUAL "i386")
set(TARGET_ARCH_SUFFIX "x86")
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 "")
@@ -50,16 +52,14 @@ ELSE()
ENDIF()
IF(CMAKE_BUILD_TYPE MATCHES Debug)
set(TARGET_CONFIG_SUFFIX "-dbg")
add_definitions(-D_DEBUG)
# NOTE: The following may mess up function importation
#if(UNIX)
# # Enable all exports so all functions name can be seen during executable crash
# set(CMAKE_ENABLE_EXPORTS ON)
# message(STATUS "Enabling exports on Unix for backtrace")
#endif()
ELSE()
set(TARGET_CONFIG_SUFFIX "")
ENDIF()
# Common stuff
@@ -81,9 +81,11 @@ target_compile_features(omohaaded PUBLIC c_variadic_macros)
target_link_libraries(omohaaded PRIVATE omohserver)
target_link_libraries(omohaaded PRIVATE syslib)
target_link_libraries(omohaaded PRIVATE qcommon qcommon_standalone)
# Gamespy dependency
target_include_directories(omohaaded PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server")
set_target_properties(omohaaded PROPERTIES OUTPUT_NAME "omohaaded${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(omohaaded PROPERTIES OUTPUT_NAME "omohaaded${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}")
set_target_properties(omohaaded PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
if (MSVC)
target_link_options(omohaaded PRIVATE "/MANIFEST:NO")
@@ -92,7 +94,7 @@ endif()
INSTALL(TARGETS omohaaded DESTINATION "./")
if (WITH_CLIENT)
if (NOT BUILD_NO_CLIENT)
## Client app
add_subdirectory("code/renderer")
@@ -113,7 +115,8 @@ if (WITH_CLIENT)
### Gamespy dependency
target_include_directories(openmohaa PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server" "code/client" "code/uilib" "code/jpeg-8c")
set_target_properties(openmohaa PROPERTIES OUTPUT_NAME "openmohaa${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(openmohaa PROPERTIES OUTPUT_NAME "openmohaa${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}")
set_target_properties(openmohaa PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
target_link_libraries(openmohaa PRIVATE jpeg8)
if (USE_OPENAL)
+153 -66
View File
@@ -1,111 +1,198 @@
# 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 under development. The single-player campaign is not yet functional due to AI not being fully stable. But the `training` map can be played from start to end. The current focus is on multiplayer.
OpenMoHAA is still in its early days.
## Intro
### Server
The server version can successfully be built.
Some stuff are not working as intended, such as Actor or Vehicle. These systems are both almost fully implemented, but not really in stable state.
Overall the server part and the game module are almost fully implemented, but the stability may vary, there may be some minor bugs and crashes.
### Client
The client version of OpenMoHAA is partially implemented and not stable currently. The cgame module is partially implemented as well, but is compatible with the original MOH:AA game. Credits to **Heavy Metal: F.A.K.K. 2**'s SDK for the cgame module.
Here is the current working state for each part of the engine:
| Part name | Full | Almost | Half | Early | Bad | Not working | Comment |
|-------------------------|------|--------|------|-------|-----|-------------|-------------------------------------------------------------------|
| Audio | | | | | x | | Very basic implementation from Quake III |
| CG Module | | x | | | | | Missing FX, Marks and decals |
| Client | | | x | | | | Missing GameSpy, server list, binds, map picker, ... |
| Collision | x | | | | | | |
| Model/TIKI/Skeletor | x | | | | | | |
| Renderer | | | | x | | | Missing ghost, marks, sphere lights, sky portal, sun flare, swipe |
| Server | | x | | | | | Probably a few bugs remaining |
| 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**.
The main goal of OpenMoHAA is to ensure the future and continuity of **Medal of Honor: Allied Assault**. It has always been a dream in the community to provide patches and security fixes for the game. Thanks to the ioquake3 project, F.A.K.K SDK and other quality tools, OpenMoHAA has already reached more than half of its goal: to create an open-source version of MoH:AA (based on version 2.40) that is fully compatible with the original game (in terms of protocol, assets, and scripts).
## Running
Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
Ensure that you download the binaries compatible with your platform.
### Requirements
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
### Client
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.
b) extract archive somewhere on your hard drive, create a shortcut to openmohaa (or omohaaded), and set the start directory to your MOHAA installation directory.
If you have problems running the game :
### Server
You may need to install Microsoft Visual C++ 2015/2017/2019/2022 Redistributable from
Extract the archive to your MOHAA server installation directory. Then proceed like you would do with mohaa server:
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
- `.\omohaaded.exe +exec server.cfg` on Windows
- `./omohaaded +exec server.cfg` on Linux
Only `omohaaded*` and `game*` binaries are required for the server version, other binaries can be omitted.
### Config file
The config file can be found in different locations depending on the platform:
- `%APPDATA%\openmohaa\<game_name>\configs\omconfig.cfg` on Windows
- `~/.openmohaa/<game_name>/configs/omconfig.cfg` on Linux
This has two advantages:
- On a multi-user system, each user will have their own configuration file
- It doesn't overwrite the existing MOHAA configuration in the MOHAA installation directory.
### Game selection
**Medal of Honor: Allied Assault Spearhead** and **Medal of Honor: Allied Assault Breakthrough** are supported in OpenMoHAA using the `com_target_game` variable. To play an expansion, append the following command-line arguments to the executable:
- `+set com_target_game 1` for Spearhead (mohaas/mohta)
- `+set com_target_game 2` for Breakthrough (mohaab/mohtt)
On Windows, you can create a shortcut to OpenMoHAA with these command-line arguments.
The default value of `com_target_game` is 0 for the base game (main).
With `com_target_game`, OpenMoHAA will support the network protocol accordingly.
You can now start a local OpenMOHAA server or play on a server.
### Playing with bots
OpenMoHAA has a basic bot system that emulates real players. The maximum number of bots is defined by the `sv_maxbots` variable, and the number of initial bots is defined by the `sv_numbots` variable. Bots can also be added or removed using the `addbot` and `removebot` commands.
This feature is a great way to test the gameplay and mods.
## Builds
### Server
The server version can be built successfully, but some features are not functional. For example, the Actor system is almost fully implemented, but it is not yet stable. This means that Actor may not work as expected and could cause crashes.
Overall, the server and the fgame components are almost fully implemented, but they may not be completely stable. There could be some minor bugs (and rare crashes), but the game should be playable.
### Client
The client version of OpenMoHAA has undergone partial implementation, with the cgame module being nearly completed. Credits to the SDK of **Heavy Metal: F.A.K.K. 2** both the cgame and fgame modules.
The current operational status for each component is as follow:
| Component | Full | Almost | Half | Early | Bad | Not working | Comment |
|-------------------------|------|--------|------|-------|-----|-------------|-------------------------------------------------------------------|
| Audio | | | | | x | | Very basic implementation from Quake III |
| CG Module | | x | | | | | Missing FX, Marks and decals |
| Client | | x | | | | | Missing GameSpy, server list, binds, map picker, ... |
| Collision | x | | | | | | |
| Model/TIKI/Skeletor | x | | | | | | |
| Renderer | | x | | | | | Missing ghost, marks, sphere lights, sky portal, sun flare, swipe |
| Server | | x | | | | | Probably a few bugs remaining |
| Server module (fgame) | | x | | | | | Actor, and few gameplay bugs |
| UI | | | x | | | | Has core features only (menu, widgets, console, hud, urc loading) |
## Compiling
OpenMoHAA supports both x86 and x64 architectures, and although the target platform is Windows, it still can be compiled for other platforms, and even other architectures.
OpenMoHAA supports any architecture, thanks to the CMake build system and cross-platform code/libraries. While the most common little-Endian architectures (arm, aarch64, x86, x86_64) have been tested and confirmed to work, big-Endian architectures should be supported as well; however, they remain untested.
These are the tools required for all platforms :
The following tools are required for all platforms:
- CMake >= 3.5
- Flex and Bison (currently not used)
- A C++11 compiler is required.
- Flex (>= 2.6.4) and Bison (>= 3.5.1)
- A C++11 compiler is also required.
The installation directory can be set to MOHAA directory.
The installation directory can be set to the 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.
By default, the build will produce both the client and dedicated server versions. The client can be omitted from the build by appending `-DBUILD_NO_CLIENT=1` to the CMake command-line arguments. Using this parameter will result in only the server portion being built.
### Linux
These are the tools required on Unix :
- Clang >= 3.3 or GCC >= 4.8.1
These are the tools required on Linux :
- Clang >= 3.3 or GCC >= 4.8.5
- libsdl2-dev
**clang-3.5** and **gcc-4.8.5** should work (tested on Ubuntu 16.04). Use the latest possible version of those compilers.
**clang-3.5** and **gcc-4.8.5** should work (tested on Ubuntu 16.04), but the latest version should be used.
SDL2 library is required (libsdl2-dev).
Ubuntu 20.04 is the minimum version required to fully compile the project successfully.
1 line install command with latest clang version : `sudo apt-get install -y ninja-build cmake make clang-15 lld-15 flex bison libsdl2-dev`
1 line install command with clang:
```sh
sudo apt-get install -y cmake ninja-build clang lld flex bison libsdl2-dev
```
Example with **CMake**, **clang-15** and **ninja-build** installed:
Example with **CMake** and **ninja-build** installed:
```sh
mkdir .cmake && cd .cmake
cmake -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 -DWITH_CLIENT=1 -G Ninja
cmake -G Ninja ../
```
Other compilers can be specified by appending `-DCMAKE_C_COMPILER=/path/to/compiler -DCMAKE_CXX_COMPILER=path/to/compiler` to the CMake command-line.
### Windows
Visual Studio (2019 or 2022) is generally preferred.
Flex and Bison can be downloaded from here: https://github.com/lexxmark/winflexbison/releases/tag/v2.5.25
Append `-DFLEX_EXECUTABLE=...\win_flex.exe -DBISON_EXECUTABLE=...\win_bison.exe` to the CMake command-line to use the package from the link above.
## 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/v0.60.0-x86_64/mohdm1_1.png) | ![](docs/images/v0.60.0-x86_64/training_1.png) |
| ![](docs/images/v0.60.0-x86_64/flughafen_1.png) | ![](docs/images/v0.60.0-x86_64/flughafen_2.png) |
| ![](docs/images/v0.60.0-x86_64/mohdm2_1.png "Playing Freeze-Tag mode with bots") | ![](docs/images/v0.60.0-x86_64/training_3.png "Single-Player training") |
*More screenshots [here](docs/images)*
## Features
### Features added and not present in MOH:AA
#### Server-side
- Bots
- Spectate players in first-person
- Demo recording
- More script commands for mods
- Non-PVS optimization
##### Non-PVS optimization
For each client, the server optimizes by only sending them information about other players that they can see. Clients won't see other players they can't see.
Enable this feature with `set sv_netoptimize 2`.
#### Client-side and server-side
- Security fixes and features from ioquake3
- IPv6 support (from ioquake3)
### Objectives / planned features
This is a non-exhaustive list of objectives and planned features.
#### Server-side
- 100% compatibility with mohaa content
- More feature for mods
- Anticheat
- Stats system
- Multiple roles/abilities for server admins to reduce password-stealing
## Third party
@@ -113,20 +200,14 @@ Visual Studio (2019 or 2022) is generally preferred.
http://www.libsdl.org/
download Source code, compile
### OpenAL
https://www.openal.org/ download OpenAL soft source
run cmake on OpenAL, compile
https://www.openal.org/
### LibMAD
http://www.underbit.com/products/mad/
download source code, compile
### cURL
https://curl.se/
@@ -143,8 +224,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 ---
+24 -16
View File
@@ -1,36 +1,44 @@
set(archdetect_c_code "
#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH x86
# error cmake_ARCH x86
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
# error cmake_ARCH x86_64
#elif defined(__ppc64__) || defined(__powerpc64__)
#error cmake_ARCH ppc64
# error cmake_ARCH ppc64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__)
#error cmake_ARCH ppc
# error cmake_ARCH ppc
#elif defined __s390__
#error cmake_ARCH s390
# error cmake_ARCH s390
#elif defined __s390x__
#error cmake_ARCH s390x
# error cmake_ARCH s390x
#elif defined __ia64__
#error cmake_ARCH ia64
# error cmake_ARCH ia64
#elif defined __e2k__
# error cmake_ARCH e2k
#elif defined __alpha__
#error cmake_ARCH alpha
# error cmake_ARCH alpha
#elif defined __sparc__
#error cmake_ARCH sparc
# error cmake_ARCH sparc
#elif defined __arm__ || defined (_M_ARM)
#error cmake_ARCH arm
# error cmake_ARCH arm
#elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
#error cmake_ARCH aarch64
# error cmake_ARCH aarch64
#elif defined __cris__
#error cmake_ARCH cris
# error cmake_ARCH cris
#elif defined __hppa__
#error cmake_ARCH hppa
# error cmake_ARCH hppa
#elif defined __mips__
#error cmake_ARCH mips
# error cmake_ARCH mips
#elif defined __sh__
#error cmake_ARCH sh
# error cmake_ARCH sh
#elif defined __riscv
# if __UINTPTR_MAX__ == __UINT64_MAX__
# error cmake_ARCH riscv64
# else
# error cmake_ARCH riscv
# endif
#else
#error cmake_ARCH unknown
# error cmake_ARCH unknown
#endif
")
+6 -6
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(fgame)
project(cgame)
# Shared source files for modules
set(SOURCES_SHARED
@@ -18,23 +18,23 @@ 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" "../fgame/bg_voteoptions.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)
set_target_properties(cgame PROPERTIES PREFIX "${TARGET_PLATFORM_PREFIX}")
set_target_properties(cgame PROPERTIES OUTPUT_NAME "cgame${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(cgame PROPERTIES OUTPUT_NAME "cgame${TARGET_ARCH_SUFFIX}")
set_target_properties(cgame PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_BASE_GAME}")
INSTALL(
TARGETS cgame
DESTINATION "${TARGET_BASE_GAME}"
ARCHIVE EXCLUDE_FROM_ALL
LIBRARY DESTINATION "${TARGET_BASE_GAME}"
RUNTIME DESTINATION "${TARGET_BASE_GAME}"
)
if(MSVC)
+196
View File
@@ -0,0 +1,196 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "cg_archive.h"
#include "cg_commands.h"
#include "memarchiver.h"
#include "../qcommon/tiki.h"
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime)
{
archiver.SetBaseTime(svsTime);
commandManager.ArchiveToMemory(archiver);
CG_ArchiveVSSGlobals(archiver);
}
size_t CG_SaveStateToBuffer(void** out, int svsTime)
{
MemArchiver archiver;
size_t size;
archiver.SetupForWriting(0x200000);
CG_ArchiveStuff(archiver, svsTime);
size = archiver.BufferSize();
if (size && out) {
*out = archiver.ConfiscateBuffer();
}
return size;
}
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime)
{
MemArchiver archiver;
archiver.SetupForReading((byte*)state, size);
CG_ArchiveStuff(archiver, svsTime);
return archiver.FinishedReading();
}
void CG_ArchiveStringContainer(MemArchiver& archiver, Container<str>* container)
{
int num;
int i;
if (archiver.IsReading()) {
str tmp;
archiver.ArchiveInteger(&num);
container->ClearObjectList();
for (i = 0; i < num; i++) {
archiver.ArchiveString(&tmp);
container->AddObject(tmp);
}
} else {
num = container->NumObjects();
archiver.ArchiveInteger(&num);
for (i = 0; i < num; i++) {
str& tmp = container->ObjectAt(i + 1);
archiver.ArchiveString(&tmp);
}
}
}
void CG_ArchiveTikiPointer(MemArchiver& archiver, dtiki_t** pTiki)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*pTiki = cgi.R_Model_GetHandle(cgi.R_RegisterModel(tmp.c_str()));
} else {
*pTiki = NULL;
}
} else {
if (*pTiki) {
tmp = (*pTiki)->name;
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*handle = cgi.R_RegisterModel(tmp.c_str());
} else {
*handle = NULL;
}
} else {
if (*handle) {
tmp = cgi.R_GetModelName(*handle);
} else {
tmp = "";
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle)
{
str tmp;
if (archiver.IsReading()) {
archiver.ArchiveString(&tmp);
if (tmp.length()) {
*handle = cgi.R_RegisterShader(tmp.c_str());
} else {
*handle = NULL;
}
} else {
if (*handle) {
tmp = cgi.R_GetShaderName(*handle);
} else {
tmp = "";
}
archiver.ArchiveString(&tmp);
}
}
void CG_ArchiveRefEntity(MemArchiver& archiver, refEntity_t* ref)
{
archiver.ArchiveRaw(&ref->reType, sizeof(ref->reType));
archiver.ArchiveInteger(&ref->renderfx);
CG_ArchiveModelHandle(archiver, &ref->hModel);
CG_ArchiveModelHandle(archiver, &ref->hOldModel);
archiver.ArchiveVec3(ref->lightingOrigin);
archiver.ArchiveInteger(&ref->parentEntity);
archiver.ArchiveVec3(ref->axis[0]);
archiver.ArchiveVec3(ref->axis[1]);
archiver.ArchiveVec3(ref->axis[2]);
archiver.ArchiveBoolean(&ref->nonNormalizedAxes);
archiver.ArchiveVec3(ref->origin);
archiver.ArchiveRaw(ref->frameInfo, 192);
archiver.ArchiveFloat(&ref->actionWeight);
archiver.ArchiveShort(&ref->wasframe);
archiver.ArchiveFloat(&ref->scale);
archiver.ArchiveVec3(ref->oldorigin);
archiver.ArchiveInteger(&ref->skinNum);
CG_ArchiveShaderHandle(archiver, &ref->customShader);
archiver.ArchiveRaw(ref->shaderRGBA, 4);
archiver.ArchiveFloat(ref->shaderTexCoord);
archiver.ArchiveFloat(&ref->shaderTexCoord[1]);
archiver.ArchiveFloat(&ref->shaderTime);
archiver.ArchiveInteger(&ref->entityNumber);
archiver.ArchiveRaw(ref->surfaces, 32);
archiver.ArchiveFloat(ref->shader_data);
archiver.ArchiveFloat(&ref->shader_data[1]);
ref->bone_tag = NULL;
ref->bone_quat = NULL;
ref->of = NULL;
ref->nf = NULL;
CG_ArchiveTikiPointer(archiver, &ref->tiki);
archiver.ArchiveInteger(&ref->bonestart);
archiver.ArchiveInteger(&ref->morphstart);
archiver.ArchiveBoolean(&ref->hasMorph);
archiver.ArchiveFloat(&ref->radius);
archiver.ArchiveFloat(&ref->rotation);
}
+53
View File
@@ -0,0 +1,53 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
// DESCRIPTION:
// Memory archiver
#pragma once
#ifdef __cplusplus
#include "../qcommon/container.h"
#include "../qcommon/str.h"
class MemArchiver;
extern "C" {
#endif
size_t CG_SaveStateToBuffer(void** out, int svsTime);
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime);
#ifdef __cplusplus
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime);
void CG_ArchiveStringContainer(MemArchiver& archiver, Container<str>* container);
void CG_ArchiveTikiPointer(MemArchiver& archiver, dtiki_t** pTiki);
void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle);
void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle);
void CG_ArchiveRefEntity(MemArchiver& archiver, refEntity_t* ref);
#endif
#ifdef __cplusplus
}
#endif
+437 -595
View File
File diff suppressed because it is too large. Load diff
+2859 -2414
View File
File diff suppressed because it is too large. Load diff
+571 -492
View File
File diff suppressed because it is too large. Load diff
+105 -119
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,33 +88,30 @@ 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)
{
cg.scoresRequestTime = cg.time;
if (cgs.gametype == GT_SINGLE_PLAYER) {
if (cg.scoresRequestTime) {
cg.scoresRequestTime = 0;
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
+346 -358
View File
@@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// cg_ents.c -- present snapshot entities, happens every single frame
#include "cg_local.h"
#include "cg_radar.h"
/*
==========================================================================
@@ -37,48 +38,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 +82,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 +261,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 +319,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 +438,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 +468,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 +500,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 +520,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 +551,13 @@ void CG_AddCEntity(centity_t* cent)
CG_ModelAnim(cent, qtrue);
break;
case ET_PLAYER:
CG_Player(cent);
CG_Player(cent);
CG_Splash(cent);
case ET_ITEM:
CG_ModelAnim(cent, qfalse);
CG_UpdateRadarClient(cent);
break;
case ET_ITEM:
CG_ModelAnim(cent, qfalse);
break;
case ET_GENERAL:
CG_General(cent);
@@ -588,10 +584,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 +597,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,51 +633,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)
{
cgi.DPrintf("CG_GetOrigin: Could not find parent entity\n");
if (!parent) {
return;
}
@@ -689,9 +678,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
+806 -749
View File
File diff suppressed because it is too large. Load diff
+508 -449
View File
File diff suppressed because it is too large. Load diff
+957 -263
View File
File diff suppressed because it is too large. Load diff
+681 -522
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;
+1561 -735
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) {}
+179 -109
View File
@@ -25,14 +25,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// interpolating between snapshots from the server or locally predicting
// ahead the client's movement. It also handles local physics interaction,
// like fragments bouncing off walls
//
// ADDITIONS:
// - CG_InterpolatePlayerState() footer: Interpolate the lean angles
#include "cg_local.h"
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 +50,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 +66,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 +84,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 +162,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 +212,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 +238,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 +253,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 +275,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 +301,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 +317,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 +340,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 +350,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 +365,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 +382,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,15 +402,15 @@ 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]);
}
// interpolate the lean angle
out->fLeanAngle = LerpAngle(prev->ps.fLeanAngle, next->ps.fLeanAngle, f);
}
/*
@@ -388,10 +441,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 +452,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 +466,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 +483,24 @@ void CG_PredictPlayerState(void)
}
cg_pmove.noFootsteps = (cgs.dmflags & DF_NO_FOOTSTEPS) > 0;
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
// Leaning while moving is allowed in mohta and mohtt only with a specific dm flag bit set
cg_pmove.alwaysAllowLean = (cgs.dmflags & DF_ALLOW_LEAN_MOVEMENT) ? qtrue : qfalse;
cg_pmove.leanMax = 45.f;
cg_pmove.leanAdd = 6.f;
cg_pmove.leanRecoverSpeed = 8.5f;
cg_pmove.leanSpeed = 2.f;
} else {
cg_pmove.alwaysAllowLean = qtrue;
cg_pmove.leanMax = 40.f;
cg_pmove.leanAdd = 10.f;
cg_pmove.leanRecoverSpeed = 15.f;
cg_pmove.leanSpeed = 4.f;
}
cg_pmove.protocol = cg_protocol;
// save the state before the pmove so we can detect transitions
oldPlayerState = cg.predicted_player_state;
@@ -448,24 +517,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 +559,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 +573,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 +598,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 +608,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];
+421 -317
View File
@@ -23,62 +23,60 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DESCRIPTION:
// client game public interfaces
#ifndef __CG_PUBLIC_H__
#define __CG_PUBLIC_H__
#pragma once
#include "../renderercommon/tr_types.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;
int eType;
} stopWatch_t;
typedef struct stopWatch_s
{
int iStartTime;
int iEndTime;
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;
} 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;
/*
/*
==================================================================
functions imported from the main executable
@@ -86,9 +84,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 +94,350 @@ 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);
char** (*FS_ListFilteredFiles)(const char* path, const char* extension, const char* filter, qboolean wantSubs, int* numfiles, qboolean allowNonPureFilesOnDisk);
void (*FS_FreeFileList)(char **list);
// 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, int* checksum);
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);
const char * (*R_GetModelName)(qhandle_t hModel);
void (*R_UnregisterServerModel)(qhandle_t hModel);
qhandle_t (*R_RegisterShader)(const char *name);
qhandle_t (*R_RegisterShaderNoMip)(const char *name);
const char* (*R_GetShaderName)(qhandle_t hShader);
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);
void (*CL_InitRadar)(radarClient_t* radars, qhandle_t* shaders, int clientNum); // Added in 2.0
dtiki_t *(*TIKI_FindTiki)(const char *path);
void (*LoadResource)(const char *name);
void (*FS_CanonicalFilename)(char *name);
void (*CL_RestoreSavedCgameState)();
void (*CL_ClearSavedCgameState)();
} clientGameImport_t;
cvar_t *fsDebug;
hdelement_t *HudDrawElements;
clientAnim_t *anim;
stopWatch_t *stopWatch;
} clientGameImport_t;
/*
/*
==================================================================
functions exported to the main executable
@@ -371,54 +445,84 @@ 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;
//
// Added in 2.0
//
void (*CG_ReadNonPVSClient)(radarUnpacked_t* radarUnpacked);
void (*CG_UpdateRadar)();
size_t (*CG_SaveStateToBuffer)(void** out, int svsTime);
qboolean (*CG_LoadStateToBuffer)(void* state, size_t size, int svsTime);
void (*CG_CleanUpTempModels)();
qboolean (*CG_Command_ProcessFile)(const char* name, qboolean quiet, dtiki_t* curTiki);
// FIXME
//prof_cgame_t* profStruct;
} clientGameExport_t;
qboolean (*CG_Command_ProcessFile)(const char *name, qboolean quiet, dtiki_t *curTiki);
} 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
}
#endif
#endif // __CG_PUBLIC_H__
+168
View File
@@ -0,0 +1,168 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "cg_radar.h"
void CG_InitRadar()
{
int i;
cg.radarShaders[0] = cgi.R_RegisterShader("textures/hud/radar_allies.tga");
cg.radarShaders[1] = cgi.R_RegisterShader("textures/hud/radar_axis.tga");
for (i = 0; i < MAX_CLIENTS; i++)
{
cg.radars[i].time = 0;
cg.radars[i].lastSpeakTime = 0;
}
cgi.CL_InitRadar(cg.radars, cg.radarShaders, cg.snap->ps.clientNum);
}
bool CG_InTeamGame(centity_t *ent)
{
return ent->currentState.solid && cg.clientinfo[ent->currentState.number].team;
}
bool CG_SameTeam(centity_t *ent)
{
return cg.clientinfo[ent->currentState.number].team == cg.clientinfo[cg.snap->ps.clientNum].team;
}
bool CG_IsTeamGame()
{
return cgs.gametype >= GT_TEAM;
}
bool CG_ValidRadarClient(centity_t *ent)
{
if (!cg.snap) {
return qfalse;
}
if (!CG_IsTeamGame()) {
return false;
}
if (!CG_InTeamGame(&cg_entities[cg.snap->ps.clientNum])) {
return false;
}
if (!CG_InTeamGame(ent)) {
return false;
}
return CG_SameTeam(ent);
}
int CG_RadarIcon()
{
switch (cg.clientinfo[cg.snap->ps.clientNum].team)
{
case TEAM_ALLIES:
return 0;
default:
case TEAM_AXIS:
return 1;
}
}
void CG_UpdateRadarClient(centity_t* ent)
{
radarClient_t* radar;
radar = &cg.radars[ent->currentState.number];
if (!CG_ValidRadarClient(ent)) {
radar->time = 0;
return;
}
radar->time = cg.time;
radar->teamShader = CG_RadarIcon();
if (cg.snap->ps.clientNum == ent->currentState.number)
{
radar->origin[0] = cg.refdef.vieworg[0];
radar->origin[1] = cg.refdef.vieworg[1];
radar->axis[0] = cg.refdef.viewaxis[0][0];
radar->axis[1] = cg.refdef.viewaxis[0][1];
VectorNormalize2D(radar->axis);
}
else
{
float axis[2];
radar->origin[0] = ent->currentState.origin[0];
radar->origin[1] = ent->currentState.origin[1];
YawToAxis(ent->currentState.angles[1], axis);
radar->axis[0] = axis[0];
radar->axis[1] = axis[1];
VectorNormalize2D(radar->axis);
}
}
void CG_ReadNonPVSClient(radarUnpacked_t* radarUnpacked)
{
radarClient_t* radar;
float axis[2];
if (!CG_ValidRadarClient(&cg_entities[radarUnpacked->clientNum])) {
return;
}
radar = &cg.radars[radarUnpacked->clientNum];
radar->time = cg.time;
radar->teamShader = CG_RadarIcon();
// copy origin
radar->origin[0] = radarUnpacked->x;
radar->origin[1] = radarUnpacked->y;
// copy yaw
YawToAxis(radarUnpacked->yaw, axis);
radar->axis[0] = axis[0];
radar->axis[1] = axis[1];
VectorNormalize2D(radar->axis);
}
void CG_UpdateRadar()
{
int i;
for (i = 0; i < MAX_CLIENTS; i++)
{
if (cg.radars[i].time)
{
if (!CG_ValidRadarClient(&cg_entities[i])) {
cg.radars[i].time = 0;
}
}
}
}
void CG_RadarClientSpeaks(int num)
{
if (!CG_ValidRadarClient(&cg_entities[num])) {
return;
}
cg.radars[num].lastSpeakTime = cg.time;
}
+22 -18
View File
@@ -1,38 +1,42 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
Copyright (C) 2023 the OpenMoHAA team
This file is part of Quake III Arena source code.
This file is part of OpenMoHAA source code.
Quake III Arena source code is free software; you can redistribute it
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.
Quake III Arena source code is distributed in the hope that it will be
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 Foobar; if not, write to the Free Software
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#if !( defined __linux__ || defined __FreeBSD__ )
#error You should include this file only on Linux/FreeBSD platforms
// DESCRIPTION:
// Radar client
#pragma once
#include "cg_local.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __GLW_LINUX_H__
#define __GLW_LINUX_H__
typedef struct
{
void *OpenGLLib; // instance of OpenGL library
FILE *log_fp;
} glwstate_t;
extern glwstate_t glw_state;
void CG_InitRadar();
void CG_UpdateRadarClient(centity_t* ent);
void CG_ReadNonPVSClient(radarUnpacked_t* radarUnpacked);
void CG_UpdateRadar();
void CG_RadarClientSpeaks(int num);
#ifdef __cplusplus
}
#endif
File diff suppressed because it is too large. Load diff
+182 -130
View File
@@ -24,12 +24,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// cg_servercmds.c -- text commands sent by the server
#include "cg_local.h"
#include "../fgame/bg_voteoptions.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 +41,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 +108,26 @@ 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;
const char *mapChecksumStr;
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"));
@@ -115,12 +137,23 @@ void CG_ParseServerinfo(void)
cgi.Cvar_Set("cg_obj_alliedtext1", Info_ValueForKey(info, "g_obj_alliedtext1"));
cgi.Cvar_Set("cg_obj_alliedtext2", Info_ValueForKey(info, "g_obj_alliedtext2"));
cgi.Cvar_Set("cg_obj_alliedtext3", Info_ValueForKey(info, "g_obj_alliedtext3"));
cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "cg_obj_axistext1"));
cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "cg_obj_axistext2"));
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "cg_obj_axistext3"));
cgi.Cvar_Set("cg_obj_alliedtext4", Info_ValueForKey(info, "g_obj_alliedtext4"));
cgi.Cvar_Set("cg_obj_alliedtext5", Info_ValueForKey(info, "g_obj_alliedtext5"));
cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "g_obj_axistext1"));
cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "g_obj_axistext2"));
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "g_obj_axistext3"));
cgi.Cvar_Set("cg_obj_axistext4", Info_ValueForKey(info, "g_obj_axistext4"));
cgi.Cvar_Set("cg_obj_axistext5", Info_ValueForKey(info, "g_obj_axistext5"));
cgi.Cvar_Set("cg_scoreboardpic", Info_ValueForKey(info, "g_scoreboardpic"));
cgi.Cvar_Set("cg_scoreboardpicover", Info_ValueForKey(info, "g_scoreboardpicover"));
cgs.mapChecksum = atoi(Info_ValueForKey(info, "sv_mapChecksum"));
mapChecksumStr = Info_ValueForKey(info, "sv_mapChecksum");
if (mapChecksumStr && mapChecksumStr[0]) {
cgs.mapChecksum = atoi(mapChecksumStr);
cgs.useMapChecksum = qtrue;
} else {
cgs.mapChecksum = 0;
cgs.useMapChecksum = qfalse;
}
mapname = Info_ValueForKey(info, "mapname");
@@ -142,22 +175,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");
@@ -170,17 +197,13 @@ CG_ConfigStringModified
================
*/
static void CG_ConfigStringModified(void)
static void CG_ConfigStringModified(int num, qboolean modelOnly)
{
int num;
num = atoi(cgi.Argv(1));
// get the gamestate from the client system, which will have the
// new configstring already integrated
cgi.GetGameState(&cgs.gameState);
CG_ProcessConfigString(num);
CG_ProcessConfigString(num, modelOnly);
}
/*
@@ -219,32 +242,29 @@ 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));
if (cgi.Argc() > 3) {
cgi.stopWatch->eType = atoi(cgi.Argv(3));
} else {
// Normal stop watch
cgi.stopWatch->eType = SWT_NORMAL;
}
} 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
@@ -264,9 +284,9 @@ The string has been tokenized and can be retrieved with
Cmd_Argc() / Cmd_Argv()
=================
*/
static void CG_ServerCommand(void)
static void CG_ServerCommand(qboolean modelOnly)
{
const char* cmd;
const char *cmd;
cmd = cgi.Argv(0);
@@ -276,7 +296,11 @@ static void CG_ServerCommand(void)
}
if (!strcmp(cmd, "cs")) {
CG_ConfigStringModified();
CG_ConfigStringModified(atoi(cgi.Argv(1)), modelOnly);
return;
}
if (modelOnly) {
return;
}
@@ -286,52 +310,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, * attackerName, * victimName, *type;
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);
attackerName = cgi.Argv(3);
victimName = cgi.Argv(4);
type = cgi.Argv(5);
if (*s5 == tolower(*s5)) {
if (*type == tolower(*type)) {
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(*type) == 's') {
cgi.Printf("%c%s %s\n", hudColor, victimName, result1);
} else if (tolower(*type) == 'p') {
if (*s2 == 'x') {
cgi.Printf("%c%s %s %s\n", hudColor, victimName, result1, attackerName);
} else {
cgi.Printf("%c%s %s %s%s\n", hudColor, victimName, result1, attackerName, result2);
}
} else if (tolower(*type) == 'w') {
cgi.Printf("%c%s %s\n", hudColor, victimName, result1);
} else {
cgi.Printf("%s", cgi.Argv(1));
}
return;
}
if (!strcmp(cmd, "stufftext")) {
cgi.Cmd_Stuff(cgi.Argv(1));
cgi.Cmd_Stuff("\n");
@@ -358,6 +377,28 @@ static void CG_ServerCommand(void)
return;
}
if (!strcmp(cmd, "voteresult")) {
cmd = cgi.Argv(1);
if (*cmd) {
strcmp(cmd, "passed");
}
}
if (!strcmp(cmd, "vo0")) {
CG_VoteOptions_StartReadFromServer(cgi.Argv(1));
return;
}
if (!strcmp(cmd, "vo1")) {
CG_VoteOptions_ContinueReadFromServer(cgi.Argv(1));
return;
}
if (!strcmp(cmd, "vo2")) {
CG_VoteOptions_FinishReadFromServer(cgi.Argv(1));
return;
}
cgi.Printf("Unknown client game command: %s\n", cmd);
}
@@ -371,9 +412,20 @@ with this this snapshot.
*/
void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer)
{
int lastServerCommandSequence;
lastServerCommandSequence = cgs.serverCommandSequence;
while (cgs.serverCommandSequence < latestSequence) {
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
CG_ServerCommand();
CG_ServerCommand(qtrue);
}
}
cgs.serverCommandSequence = lastServerCommandSequence;
while (cgs.serverCommandSequence < latestSequence) {
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
CG_ServerCommand(qfalse);
}
}
}
+69 -64
View File
@@ -23,8 +23,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// DESCRIPTION:
// things that happen on snapshot transition, not necessarily every
// single frame
//
// ADDITIONS:
// - CG_TransitionSnapshot() footer: set ps.walking to true if the ps has a ground entity
#include "cg_local.h"
#include "cg_radar.h"
#include "tiki.h"
/*
@@ -32,10 +36,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 +66,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 +75,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 +93,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 +109,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 +138,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,20 +153,21 @@ 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);
CG_InitRadar();
cgi.CL_RestoreSavedCgameState();
}
/*
@@ -174,9 +179,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 +192,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,9 +207,12 @@ 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);
// remember time of snapshot this entity was last updated in
cent->snapShotTime = cg.snap->serverTime;
}
for (i = 0; i < cg.snap->number_of_sounds; i++) {
@@ -220,31 +228,37 @@ 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);
}
}
if (differentServer) {
cgi.CL_RestoreSavedCgameState();
} else {
cgi.CL_ClearSavedCgameState();
}
// this allows the view model to still look normal when the player is on ground
cg.snap->ps.walking = cg.snap->ps.groundEntityNum != ENTITYNUM_NONE;
}
/*
@@ -254,11 +268,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 +280,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 +314,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 +340,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 +406,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 +456,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 +465,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 +483,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();
}
+7 -13
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);
}
}
@@ -195,7 +189,7 @@ void CG_InstaMessageGroupE_f(void)
void CG_HudPrint_f(void)
{
cgi.Printf("\x1%s", cgi.Argv(0));
cgi.Printf("\x1%s", cgi.Argv(1));
}
int CG_CheckCaptureKey(int key, qboolean down, unsigned int time)
+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
}
+416 -317
View File
File diff suppressed because it is too large. Load diff
+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
+241
View File
@@ -0,0 +1,241 @@
/*
===========================================================================
Copyright (C) 2023 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 "cg_local.h"
#include "memarchiver.h"
#include "../qcommon/vector.h"
#include "../qcommon/str.h"
MemArchiver::MemArchiver()
{
state = MEMARC_WRITING;
buffer = 0;
allocatedSize = 0;
bufferSize = 0;
}
MemArchiver::~MemArchiver()
{
if (state == MEMARC_WRITING && buffer) {
cgi.Free(buffer);
}
}
void MemArchiver::SetupForWriting(size_t initialSize)
{
state = MEMARC_WRITING;
buffer = (byte*)cgi.Malloc(initialSize);
allocatedSize = initialSize;
bufferSize = 0;
}
void MemArchiver::SetupForReading(byte* buffer, size_t size)
{
state = MEMARC_READING;
buffer = buffer;
allocatedSize = size;
bufferSize = 0;
}
void MemArchiver::SetBaseTime(unsigned int time)
{
svsTime = time;
}
size_t MemArchiver::BufferSize() const
{
return bufferSize;
}
byte* MemArchiver::ConfiscateBuffer()
{
byte* confiscatedBuffer = buffer;
buffer = NULL;
allocatedSize = 0;
bufferSize = 0;
return confiscatedBuffer;
}
bool MemArchiver::IsReading() const
{
return !IsWriting();
}
bool MemArchiver::IsWriting() const
{
return state == MEMARC_WRITING;
}
bool MemArchiver::FinishedReading() const
{
return bufferSize == allocatedSize;
}
void MemArchiver::ArchiveByte(byte* value)
{
ArchiveRaw(value, sizeof(byte));
}
void MemArchiver::ArchiveBoolean(qboolean* value)
{
ArchiveRaw(value, sizeof(qboolean));
}
void MemArchiver::ArchiveChar(char* value)
{
ArchiveRaw(value, sizeof(char));
}
void MemArchiver::ArchiveUChar(unsigned char* value)
{
ArchiveRaw(value, sizeof(unsigned char));
}
void MemArchiver::ArchiveShort(short* value)
{
ArchiveRaw(value, sizeof(short));
}
void MemArchiver::ArchiveInteger(int* value)
{
ArchiveRaw(value, sizeof(int));
}
void MemArchiver::ArchiveSize(size_t* value)
{
ArchiveRaw(value, sizeof(size_t));
}
void MemArchiver::ArchiveFloat(float* value)
{
ArchiveRaw(value, sizeof(float));
}
void MemArchiver::ArchiveVec3(vec3_t value)
{
ArchiveRaw(value, sizeof(vec3_t));
}
void MemArchiver::ArchiveVector(Vector* value)
{
ArchiveFloat(&value->x);
ArchiveFloat(&value->y);
ArchiveFloat(&value->z);
}
void MemArchiver::ArchiveString(str* value)
{
char tmp[4096];
int current = 0;
if (IsReading()) {
for (current = 0; current < 4096; current++) {
ArchiveReadRaw(&tmp[current], sizeof(char));
if (!tmp[current]) {
break;
}
}
if (current == 4096) {
tmp[current - 1] = 0;
}
*value = tmp;
} else {
ArchiveWriteRaw(value->c_str(), value->length() + 1);
}
}
void MemArchiver::ArchiveTime(int* value)
{
int time;
if (IsReading()) {
ArchiveReadRaw(&time, sizeof(time));
if (time) {
time += svsTime;
}
*value = time;
} else {
time = *value;
if (time) {
time -= svsTime;
}
ArchiveWriteRaw(&time, sizeof(time));
}
}
void MemArchiver::ArchiveRaw(void* buffer, size_t size)
{
if (IsReading()) {
ArchiveReadRaw(buffer, size);
} else {
ArchiveWriteRaw(buffer, size);
}
}
void MemArchiver::ArchiveReadRaw(void* buffer, size_t size)
{
if (!size) {
return;
}
if (size + this->bufferSize > this->allocatedSize) {
Com_Error(ERR_DROP, "MemArchiver: tried to read past end of buffer");
}
memcpy(buffer, this->buffer + this->bufferSize, size);
this->bufferSize += size;
}
void MemArchiver::ArchiveWriteRaw(const void* buffer, size_t size)
{
if (!size) {
return;
}
if (size + this->bufferSize > this->allocatedSize) {
if (!this->allocatedSize) {
this->allocatedSize = 1024;
this->buffer = (byte*)cgi.Malloc(this->allocatedSize);
} else {
byte* newBuffer;
do {
this->allocatedSize *= 2;
} while (size + this->bufferSize > this->allocatedSize);
newBuffer = (byte*)cgi.Malloc(this->allocatedSize);
memcpy(newBuffer, this->buffer, this->bufferSize);
cgi.Free(this->buffer);
this->buffer = newBuffer;
}
}
memcpy(this->buffer + this->bufferSize, buffer, size);
this->bufferSize += size;
}
+72
View File
@@ -0,0 +1,72 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
// DESCRIPTION:
// In-memory archiver
#include "cg_local.h"
class Vector;
class str;
typedef enum {
MEMARC_WRITING,
MEMARC_READING
} archiverState_e;
class MemArchiver {
public:
MemArchiver();
~MemArchiver();
void SetupForWriting(size_t initialSize);
void SetupForReading(byte* buffer, size_t size);
void SetBaseTime(unsigned int time);
size_t BufferSize() const;
byte* ConfiscateBuffer();
bool IsReading() const;
bool IsWriting() const;
bool FinishedReading() const;
void ArchiveByte(byte* value);
void ArchiveBoolean(qboolean* value);
void ArchiveChar(char* value);
void ArchiveUChar(unsigned char* value);
void ArchiveShort(short* value);
void ArchiveInteger(int* value);
void ArchiveSize(size_t* value);
void ArchiveFloat(float* value);
void ArchiveVec3(vec3_t value);
void ArchiveVector(Vector* value);
void ArchiveString(str* value);
void ArchiveTime(int* value);
void ArchiveRaw(void* buffer, size_t size);
void ArchiveReadRaw(void* buffer, size_t size);
void ArchiveWriteRaw(const void* buffer, size_t size);
private:
archiverState_e state;
byte* buffer;
size_t bufferSize;
size_t allocatedSize;
int svsTime;
};
+1 -2
View File
@@ -19,5 +19,4 @@ target_link_libraries(omohclient INTERFACE gcd)
target_compile_definitions(omohclient INTERFACE USE_CODEC_MP3)
add_subdirectory("../libmad-0.15.1b" "./libmad")
target_link_libraries(omohclient INTERFACE libmad)
target_include_directories(omohclient INTERFACE "../libmad-0.15.1b")
target_link_libraries(omohclient INTERFACE libmad)
+101 -42
View File
@@ -23,8 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h"
#include "cl_ui.h"
#include "cl_uiradar.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 +292,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 +346,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 +398,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 +421,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);
}
@@ -417,10 +435,10 @@ CL_CM_LoadMap
Just adds default parameters that cgame doesn't need to know about
====================
*/
void CL_CM_LoadMap( const char *mapname ) {
int checksum;
CM_LoadMap( mapname, qtrue, &checksum );
void CL_CM_LoadMap( const char *mapname, int *checksum ) {
CM_LoadMap( mapname, qtrue, checksum );
// prepare world vis data
re.SetWorldVisData(CM_VisibilityPointer());
}
/*
@@ -443,6 +461,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
@@ -513,6 +541,29 @@ void CL_StartLocalSound(const char* soundName, qboolean forceLoad) {
S_StartLocalSound(soundName, qfalse );
}
/*
====================
CL_RestoreSavedCgameState
====================
*/
void CL_RestoreSavedCgameState() {
if (cls.savedCgameState) {
cge->CG_LoadStateToBuffer(&cls.savedCgameState, cls.savedCgameStateSize, cl.snap.serverTime);
}
}
/*
====================
CL_ClearSavedCgameState
====================
*/
void CL_ClearSavedCgameState() {
if (cls.savedCgameState) {
cls.savedCgameState = NULL;
cls.savedCgameStateSize = 0;
}
}
/*
====================
CL_InitCGameDLL
@@ -529,6 +580,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->Printf = Com_Printf;
cgi->DPrintf = Com_DPrintf;
cgi->DebugPrintf = Com_DebugPrintf;
cgi->Malloc = CL_CG_Malloc;
cgi->Free = CL_CG_Free;
@@ -554,6 +606,8 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->FS_FreeFile = FS_FreeFile;
cgi->FS_WriteFile = FS_WriteFile;
cgi->FS_WriteTextFile = FS_WriteTextFile;
cgi->FS_ListFilteredFiles = FS_ListFilteredFiles;
cgi->FS_FreeFileList = FS_FreeFileList;
cgi->SendConsoleCommand = Cbuf_AddText;
@@ -572,7 +626,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;
@@ -625,9 +679,11 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->R_RegisterModel = re.RegisterModel;
cgi->R_SpawnEffectModel = re.SpawnEffectModel;
cgi->R_RegisterServerModel = re.RegisterServerModel;
cgi->R_GetModelName = re.GetModelName;
cgi->R_UnregisterServerModel = re.UnregisterServerModel;
cgi->R_RegisterShader = re.RegisterShader;
cgi->R_RegisterShaderNoMip = re.RegisterShaderNoMip;
cgi->R_GetShaderName = re.GetShaderName;
cgi->R_AddRefEntityToScene = re.AddRefEntityToScene;
cgi->R_AddRefSpriteToScene = re.AddRefSpriteToScene;
@@ -718,11 +774,14 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->UI_SetScoreBoardItem = UI_SetScoreBoardItem;
cgi->UI_DeleteScoreBoardItems = UI_DeleteScoreBoardItems;
cgi->UI_ToggleDMMessageConsole = UI_ToggleDMConsole;
cgi->CL_InitRadar = CL_InitRadar;
cgi->TIKI_FindTiki = TIKI_FindTiki;
cgi->LoadResource = UI_LoadResource;
cgi->FS_CanonicalFilename = FS_CanonicalFilename;
cgi->CL_RestoreSavedCgameState = CL_RestoreSavedCgameState;
cgi->CL_ClearSavedCgameState = CL_ClearSavedCgameState;
cgi->fsDebug = fs_debug;
cgi->HudDrawElements = cls.HudDrawElements;
@@ -877,8 +936,6 @@ qboolean CL_GameCommand( void ) {
return cge->CG_ConsoleCommand();
}
/*
=====================
CL_CGameRendering
@@ -893,6 +950,10 @@ void CL_CGameRendering( stereoFrame_t stereo ) {
cge->CG_DrawActiveFrame( cl.serverTime, cl.serverTime - cl.oldServerTime, stereo, clc.demoplaying );
cl.oldServerTime = cl.serverTime;
//
// Let cgame clean up temp models
//
cge->CG_CleanUpTempModels();
}
/*
@@ -1068,16 +1129,14 @@ void CL_SetCGameTime( void ) {
return;
}
// FIXME
//if( ( cl.snap.snapFlags ^ lastSnapFlags ) & SNAPFLAG_SERVERCOUNT ) {
// CL_ServerRestarted();
//} else {
if( ( cl.snap.snapFlags ^ lastSnapFlags ) & SNAPFLAG_SERVERCOUNT ) {
CL_ServerRestarted();
} else {
if( cl.snap.serverTime < cl.oldFrameServerTime ) {
assert( 0 );
Com_Error( ERR_DROP, "cl.snap.serverTime < cl.oldFrameServerTime" );
}
//}
}
cl.oldFrameServerTime = cl.snap.serverTime;
+4 -4
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;
}
@@ -1612,7 +1612,7 @@ void CL_PlayCinematic_f(void) {
bits |= CIN_loop;
}
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
CL_handle = CIN_PlayCinematic( arg, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bits );
if (CL_handle >= 0) {
@@ -1639,7 +1639,7 @@ void SCR_RunCinematic (void)
void SCR_StopCinematic(void) {
if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
CIN_StopCinematic(CL_handle);
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
CL_handle = -1;
}
}
-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 */
+2 -2
View File
@@ -1051,8 +1051,8 @@ void CL_InitInput( void ) {
Cmd_AddCommand("-leanleft", IN_LeanLeftUp);
Cmd_AddCommand("+leanright", IN_LeanRightDown);
Cmd_AddCommand("-leanright", IN_LeanRightUp);
Cmd_AddCommand("+speed", IN_SpeedUp);
Cmd_AddCommand("-speed", IN_SpeedDown);
Cmd_AddCommand("+speed", IN_SpeedDown);
Cmd_AddCommand("-speed", IN_SpeedUp);
Cmd_AddCommand("+button0", IN_Button0Down);
Cmd_AddCommand("-button0", IN_Button0Up);
Cmd_AddCommand("+button1", IN_Button1Down);
+1 -5
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;
@@ -1157,7 +1153,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
}
}
if (!in_guimouse || key <= K_MOUSE3 || key > K_JOY1)
if (!in_guimouse || key <= K_MWHEELUP || key > K_JOY1)
{
// keys can still be used for bound actions
if (down && (key <= K_BACKSPACE || key == K_MOUSE4) &&
+189 -86
View File
@@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cl_ui.h"
#include "../qcommon/tiki.h"
#include "../qcommon/cm_terrain.h"
#include "../qcommon/localization.h"
#include "../qcommon/bg_compat.h"
#include "../sys/sys_local.h"
#ifdef USE_RENDERER_DLL
#include "../sys/sys_loadlib.h"
@@ -102,6 +104,9 @@ cvar_t *cl_inGameVideo;
cvar_t *cl_serverStatusResendTime;
cvar_t *cl_trn;
cvar_t *cl_langamerefreshstatus;
cvar_t *cl_radar_icon_size;
cvar_t *cl_radar_speak_time;
cvar_t *cl_radar_blink_time;
cvar_t *cl_lanForcePackets;
@@ -206,7 +211,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,
@@ -362,14 +367,14 @@ void CL_Record_f( void ) {
if ( Cmd_Argc() == 2 ) {
s = Cmd_Argv(1);
Q_strncpyz( demoName, s, sizeof( demoName ) );
Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, com_protocol->integer );
} else {
int number;
// scan for a free demo name
for ( number = 0 ; number <= 9999 ; number++ ) {
CL_DemoFilename( number, demoName );
Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, com_protocol->integer );
if (!FS_FileExists(name))
break; // file doesn't exist
@@ -404,8 +409,8 @@ void CL_Record_f( void ) {
// NOTE, MRE: all server->client messages now acknowledge
MSG_WriteLong( &buf, clc.reliableSequence );
MSG_WriteByte (&buf, svc_gamestate);
MSG_WriteLong (&buf, clc.serverCommandSequence );
MSG_WriteByte ( &buf, svc_gamestate );
MSG_WriteLong ( &buf, clc.serverCommandSequence );
// configstrings
for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {
@@ -413,21 +418,20 @@ void CL_Record_f( void ) {
continue;
}
s = cl.gameState.stringData + cl.gameState.stringOffsets[i];
MSG_WriteByte (&buf, svc_configstring);
MSG_WriteShort (&buf, i);
MSG_WriteBigString (&buf, s);
MSG_WriteByte ( &buf, svc_configstring );
MSG_WriteShort ( &buf, CPT_DenormalizeConfigstring( i ) );
MSG_WriteScrambledBigString ( &buf, s );
}
// baselines
Com_Memset (&nullstate, 0, sizeof(nullstate));
MSG_GetNullEntityState(&nullstate);
for ( i = 0; i < MAX_GENTITIES ; i++ ) {
ent = &cl.entityBaselines[i];
if ( !ent->number ) {
continue;
}
MSG_WriteByte (&buf, svc_baseline);
// FIXME
MSG_WriteDeltaEntity (&buf, &nullstate, ent, qtrue, 0.0 );
MSG_WriteByte ( &buf, svc_baseline );
MSG_WriteDeltaEntity ( &buf, &nullstate, ent, qtrue, cls.serverFrameTime );
}
MSG_WriteByte( &buf, svc_EOF );
@@ -437,7 +441,10 @@ void CL_Record_f( void ) {
// write the client num
MSG_WriteLong(&buf, clc.clientNum);
// write the checksum feed
MSG_WriteLong(&buf, clc.checksumFeed);
MSG_WriteLong(&buf, clc.checksumFeed);
// write the server frametime to the client (only on TA/TT)
MSG_WriteServerFrameTime( &buf, cls.serverFrameTime );
// finished writing the client packet
MSG_WriteByte( &buf, svc_EOF );
@@ -554,7 +561,7 @@ void CL_DemoCompleted( void )
}
}
CL_Disconnect( qtrue );
CL_Disconnect();
CL_NextDemo();
}
@@ -592,7 +599,7 @@ void CL_ReadDemoMessage( void ) {
return;
}
buf.cursize = LittleLong( buf.cursize );
if ( buf.cursize == -1 ) {
if ( buf.cursize == (uint32_t)-1) {
CL_DemoCompleted ();
return;
}
@@ -658,7 +665,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 +763,7 @@ void CL_NextDemo( void ) {
CL_ShutdownAll
=====================
*/
void CL_ShutdownAll(void) {
void CL_ShutdownAll(qboolean shutdownRef) {
#ifdef USE_CURL
CL_cURL_Shutdown();
@@ -794,7 +801,7 @@ void CL_FlushMemory( void ) {
// shutdown all the client stuff
CL_ShutdownCGame();
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
UI_ClearState();
cls.rendererRegistered = qfalse;
}
@@ -816,6 +823,11 @@ void CL_MapLoading( qboolean flush, const char *pszMapName ) {
UI_ClearState();
UI_ForceMenuOff(false);
if (!flush) {
// Don't do anything if it's not flushingb
return;
}
if (pszMapName) {
// if we are already connected to the local host, stay connected
if (clc.state >= CA_CONNECTED && !Q_stricmp(cls.servername, "localhost")) {
@@ -828,7 +840,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;
@@ -856,7 +868,7 @@ void CL_ClearState( void )
CL_ShutdownCGame();
if( !com_sv_running->integer ) {
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
}
UI_ClearState();
@@ -871,7 +883,7 @@ CL_UpdateGUID
update cl_guid using QKEY_FILE and optional prefix
====================
*/
static void CL_UpdateGUID( char *prefix, int prefix_len )
static void CL_UpdateGUID( const char *prefix, int prefix_len )
{
fileHandle_t f;
int len;
@@ -897,7 +909,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 +939,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 +967,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 +1006,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 +1154,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 +1199,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_StopAllSounds2(1);
S_TriggeredMusic_PlayIntroMusic();
}
UI_FocusMenuIfExists();
if (bConsoleState) {
UI_OpenConsole();
} else {
UI_CloseConsole();
}
}
}
@@ -1199,12 +1242,12 @@ void CL_Reconnect_f( void ) {
/*
================
CL_Connect_f
CL_Connect
================
*/
void CL_Connect( const char *server ) {
char serverString[ 22 ];
void CL_Connect( const char *server, netadrtype_t family ) {
const char *serverString;
Cvar_Set( "ui_singlePlayerActive", "0" );
@@ -1223,7 +1266,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
@@ -1232,21 +1275,24 @@ void CL_Connect( const char *server ) {
Q_strncpyz( cls.servername, server, sizeof( cls.servername ) );
if( !NET_StringToAdr( cls.servername, &clc.serverAddress, NA_IP ) ) {
if( !NET_StringToAdr( cls.servername, &clc.serverAddress, family ) ) {
Com_Printf( "Bad server address\n" );
clc.state = CA_DISCONNECTED;
UI_PushMenu("badserveraddy");
return;
}
if( clc.serverAddress.port == 0 ) {
clc.serverAddress.port = BigShort( PORT_SERVER );
}
Com_sprintf( serverString, sizeof( serverString ), "%i.%i.%i.%i:%i",
clc.serverAddress.ip[ 0 ], clc.serverAddress.ip[ 1 ],
clc.serverAddress.ip[ 2 ], clc.serverAddress.ip[ 3 ],
BigShort( clc.serverAddress.port ) );
serverString = NET_AdrToStringwPort(clc.serverAddress);
Com_Printf( "%s resolved to %s\n", cls.servername, serverString );
if (cl_guidServerUniq->integer)
CL_UpdateGUID(serverString, strlen(serverString));
else
CL_UpdateGUID(NULL, 0);
// if we aren't playing on a lan, we need to authenticate
// with the cd key
// wombat: no authorization in mohaa. need to send challenge to server though
@@ -1255,11 +1301,14 @@ void CL_Connect( const char *server ) {
}
else {
clc.state = CA_CONNECTING;
// Set a client challenge number that ideally is mirrored back by the server.
clc.challenge = (((unsigned int)rand() << 16) ^ (unsigned int)rand()) ^ Com_Milliseconds();
}
clc.connectTime = -99999; // CL_CheckForResend() will fire immediately
clc.connectPacketCount = 0;
clc.connectStartTime = 0;
clc.connectStartTime = cls.realtime;
// server connection string
Cvar_Set( "cl_currentServerAddress", server );
@@ -1272,17 +1321,36 @@ CL_Connect_f
================
*/
// we have our own server provided to us by mohaaaa.co.uk
void CL_Connect_f( void ) {
char *server;
void CL_Connect_f(void) {
const char *server;
int argc = Cmd_Argc();
netadrtype_t family = NA_UNSPEC;
if ( Cmd_Argc() != 2 ) {
Com_Printf( "usage: connect [server]\n");
return;
}
server = Cmd_Argv (1);
CL_Connect( server );
if (argc != 2 && argc != 3) {
Com_Printf("usage: connect [-4|-6] server\n");
return;
}
if (argc == 2)
server = Cmd_Argv(1);
else
{
if (!strcmp(Cmd_Argv(1), "-4"))
family = NA_IP;
else if (!strcmp(Cmd_Argv(1), "-6"))
family = NA_IP6;
else
Com_Printf("warning: only -4 or -6 as address type understood.\n");
server = Cmd_Argv(2);
}
CL_Connect( server, family );
}
/*
@@ -1300,7 +1368,7 @@ void CL_MenuConnect_f( void ) {
server = Cmd_Argv( 1 );
CL_Connect( Cvar_VariableString( server ) );
CL_Connect( Cvar_VariableString( server ), NA_UNSPEC );
}
/*
@@ -1320,7 +1388,7 @@ void CL_FastConnect_f( void ) {
Com_Printf( "Server %i - '%s'\n", i, NET_AdrToString( cls.localServers[ i ].adr ) );
}
CL_Connect( cls.localServers[ 0 ].hostName );
CL_Connect( cls.localServers[ 0 ].hostName, NA_UNSPEC );
Cbuf_AddText( "popmenu 0 ; wait 500 ; popmenu 0 ; wait 500 ; popmenu 0\n" );
endTime = 123456789;
}
@@ -1367,7 +1435,8 @@ void CL_Rcon_f( void ) {
message[1] = -1;
message[2] = -1;
message[3] = -1;
message[4] = 0;
message[4] = 2; // direction
message[5] = 0;
Q_strcat (message, MAX_RCON_MESSAGE, "rcon ");
@@ -1417,7 +1486,7 @@ void CL_SendPureChecksums( void ) {
for (i = 0; i < 2; i++) {
cMsg[i] += 10;
}
CL_AddReliableCommand( cMsg );
CL_AddReliableCommand( cMsg, qfalse );
}
/*
@@ -1426,7 +1495,7 @@ CL_ResetPureClientAtServer
=================
*/
void CL_ResetPureClientAtServer( void ) {
CL_AddReliableCommand( va("vdr") );
CL_AddReliableCommand( va("vdr"), qfalse );
}
qboolean CL_Allowed_Vid_Restart() {
@@ -1452,7 +1521,7 @@ void CL_Vid_Restart_f( void ) {
cls.vid_restart = qtrue;
// don't let them loop during the restart
S_StopAllSounds(qtrue);
S_StopAllSounds2(qtrue);
SV_ClearSvsTimeFixups();
@@ -1466,18 +1535,26 @@ void CL_Vid_Restart_f( void ) {
CL_InitRef();
// initialize the ui library
UI_ResolutionChange();
// clear aliases
Alias_Clear();
cls.rendererRegistered = qfalse;
// unpause so the cgame definately gets a snapshot and renders a frame
Com_Unpause();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SV_FinishSvsTimeFixups();
S_Init();
if (clc.state > CA_CONNECTED && clc.state != CA_CINEMATIC)
{
// send pure checksums
CL_SendPureChecksums();
}
cls.vid_restart = qfalse;
Com_Printf("----- finished CL_Vid_Restart_f ----\n");
}
@@ -1602,7 +1679,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 +1689,18 @@ 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);
// set pure checksums
CL_SendPureChecksums();
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
}
/*
@@ -1646,7 +1730,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 +1926,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 +1975,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 +2283,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 +2384,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 +2436,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 );
}
}
@@ -2386,7 +2477,7 @@ void CL_Frame ( int msec ) {
if ( clc.state == CA_DISCONNECTED && !UI_MenuActive()
&& !com_sv_running->integer ) {
// if disconnected, bring up the menu
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
UI_MenuEscape( "main" );
}
@@ -2566,7 +2657,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;
}
@@ -2602,6 +2693,15 @@ void *CL_RefMalloc(int size) {
return Z_TagMalloc( size, TAG_RENDERER );
}
/*
============
CL_RefFree
============
*/
void CL_RefFree(void* ptr) {
Z_Free(ptr);
}
/*
============
CL_RefClear
@@ -2758,8 +2858,9 @@ void CL_InitRef( void ) {
ri.Printf = CL_RefPrintf;
ri.Error = Com_Error;
ri.Milliseconds = CL_ScaledMilliseconds;
ri.LV_ConvertString = Sys_LV_CL_ConvertString;
ri.Malloc = CL_RefMalloc;
ri.Free = Z_Free;
ri.Free = CL_RefFree;
ri.Clear = CL_RefClear;
ri.Hunk_Clear = CL_RefStaticClear;
#ifdef HUNK_DEBUG
@@ -3087,7 +3188,7 @@ void CL_Init( void ) {
start = Sys_Milliseconds();
CL_ClearState ();
S_StopAllSounds( qtrue );
S_StopAllSounds2( qtrue );
clc.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED
Key_SetCatcher(KEYCATCH_UI);
@@ -3201,6 +3302,9 @@ void CL_Init( void ) {
cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
cl_langamerefreshstatus = Cvar_Get( "cl_langamerefreshstatus", "Ready", 0 );
cl_radar_icon_size = Cvar_Get("cl_radar_icon_size", "10", CVAR_ARCHIVE);
cl_radar_speak_time = Cvar_Get("cl_radar_speak_time", "3", CVAR_ARCHIVE);
cl_radar_blink_time = Cvar_Get("cl_radar_blink_time", "0.333", CVAR_ARCHIVE);
cg_gametype = Cvar_Get( "cg_gametype", "0", 0 );
cl_lanForcePackets = Cvar_Get ("cl_lanForcePackets", "1", CVAR_ARCHIVE);
@@ -3278,7 +3382,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
CL_InitConsoleCommands();
CL_InitRef();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SCR_Init ();
@@ -3286,7 +3390,6 @@ void CL_Init( void ) {
Cvar_Set( "cl_running", "1" );
NET_Init();
S_Init2();
// fixme: should we leave it?
@@ -3294,7 +3397,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 +3429,7 @@ void CL_Shutdown(const char* finalmsg, qboolean disconnect, qboolean quit) {
noGameRestart = quit;
if(disconnect)
CL_Disconnect(qtrue);
CL_Disconnect();
S_Shutdown();
CL_ShutdownRef();
@@ -4209,7 +4312,7 @@ CL_ServerRestarted
==================
*/
void CL_ServerRestarted( void ) {
S_StopAllSounds( qfalse );
S_StopAllSounds2( qfalse );
UI_ServerLoaded();
UI_ClearState();
+93 -43
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",
@@ -193,6 +194,69 @@ void CL_ParsePacketEntities( msg_t *msg, clSnapshot_t *oldframe, clSnapshot_t *n
}
}
/*
================
CL_UnpackNonPVSClient
Unpack info about non-visible client.
================
*/
qboolean CL_UnpackNonPVSClient(int* packed, radarUnpacked_t* unpacked) {
int x, y;
int yaw;
qboolean bValid;
float range;
unpacked->clientNum = *packed & (MAX_CLIENTS - 1);
if (unpacked->clientNum == cl.snap.ps.clientNum) {
return qfalse;
}
x = ((*packed >> 6) & 0x7F) - (MAX_CLIENTS - 1);
y = ((*packed >> 13) & 0x7F) - (MAX_CLIENTS - 1);
yaw = (*packed >> 20) & 0x1F;
bValid = (*packed >> 25) & 1;
if (com_radar_range && com_radar_range->value) {
range = com_radar_range->value;
} else {
range = 0;
}
unpacked->x = x * range / 63.f;
unpacked->y = y * range / 63.f;
if (!bValid)
{
unpacked->x = x * range / 63.f * 1024;
unpacked->y = y * range / 63.f * 1024;
}
unpacked->yaw = yaw * 11.25f;
return qtrue;
}
/*
================
CL_ReadNonPVSClient
Reads packed info about non-visible client.
================
*/
void CL_ReadNonPVSClient(int radarInfo) {
radarUnpacked_t unpacked;
if (!cge) {
return;
}
if (CL_UnpackNonPVSClient(&radarInfo, &unpacked)) {
unpacked.x += cl.snap.ps.origin[0];
unpacked.y += cl.snap.ps.origin[1];
cge->CG_ReadNonPVSClient(&unpacked);
}
}
/*
================
@@ -278,6 +342,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" );
@@ -328,6 +395,9 @@ void CL_ParseSnapshot( msg_t *msg ) {
}
cl.newSnapshots = qtrue;
// read radar info about invisible clients
CL_ReadNonPVSClient(cl.snap.ps.radarInfo);
}
@@ -444,35 +514,13 @@ static void CL_ParseServerInfo(void)
sizeof(clc.sv_dlURL));
}
#if TARGET_GAME_PROTOCOL >= 15
char* MSG_ReadGameStateChar(msg_t* msg) {
return MSG_ReadScrambledBigString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
return MSG_ReadFloat(msg);
}
#else
char* MSG_ReadGameStateChar(msg_t* msg) {
return MSG_ReadString(msg);
}
float MSG_ReadServerFrameTime(msg_t* msg) {
return 1.f / atof(Info_ValueForKey(cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO], "sv_fps"));
}
#endif
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg ) {
int i;
int i, csNum;
entityState_t *es;
int newnum;
entityState_t nullstate;
@@ -502,22 +550,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_ReadScrambledBigString(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 ) {
@@ -536,7 +586,7 @@ void CL_ParseGamestate( msg_t *msg ) {
clc.clientNum = MSG_ReadLong(msg);
// read the checksum feed
clc.checksumFeed = MSG_ReadLong( msg );
cls.serverFrameTime = MSG_ReadServerFrameTime(msg);
cls.serverFrameTime = MSG_ReadServerFrameTime(msg, &cl.gameState);
// parse serverId and other cvars
CL_SystemInfoChanged();
@@ -546,7 +596,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 +701,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 +743,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 +752,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 +766,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
+3834 -4024
View File
File diff suppressed because it is too large. Load diff
+89 -63
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -20,103 +20,129 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef __CL_UI_H__
#define __CL_UI_H__
#pragma once
#include "../uilib/ui_extern.h"
#include "../uilib/uiwidget.h"
typedef struct {
UIReggedMaterial *loading;
UIReggedMaterial *loading;
} static_media_t;
//
// cvars
//
extern cvar_t *ui_health_start;
extern cvar_t *ui_health_end;
extern cvar_t *sound_overlay;
//
// initialization
//
void CL_FillUIDef( void );
void CL_InitializeUI( void );
void CL_ShutdownUI( void );
void CL_FillUIDef(void);
void CL_InitializeUI(void);
void CL_ShutdownUI(void);
//
// general ui stuff
//
extern inventory_t client_inv;
extern bind_t client_bind;
extern cvar_t* cl_greenfps;
extern bind_t client_bind;
extern cvar_t *cl_greenfps;
const char *CvarGetForUI( const char *name, const char *defval );
void UI_ClearState( void );
void CL_BeginRegistration( void );
void CL_EndRegistration(void);
const char *CvarGetForUI(const char *name, const char *defval);
void UI_ClearState(void);
void CL_BeginRegistration(void);
void CL_EndRegistration(void);
//
// menu
//
extern Menu *ui_pLoadingMenu;
void UI_ShowMenu( const char *name, qboolean bForce );
void UI_HideMenu( const char *name, qboolean bForce );
void UI_ForceMenuOff( bool force );
void UI_PushMenu( const char *name );
void UI_ForceMenu( const char *name );
qboolean UI_BindActive( void );
void UI_ActivateView3D( void );
void UI_MenuEscape( const char *name );
void UI_CreateScoreboard( void );
qboolean UI_MenuActive( void );
qboolean UI_MenuUp( 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 );
void UI_ShowScoreboard_f( const char *pszMenuName );
void UI_HideScoreboard_f( void );
void UI_SetScoreBoardItem( int iItemNumber,
const char *pszData1, const char *pszData2, const char *pszData3, const char *pszData4,
const char *pszData5, const char *pszData6, const char *pszData7, const char *pszData8,
const vec4_t pTextColor, const vec4_t pBackColor, qboolean bIsHeader );
void UI_DeleteScoreBoardItems( int iMaxIndex );
void UI_ShowMenu(const char *name, qboolean bForce);
void UI_HideMenu(const char *name, qboolean bForce);
void UI_ForceMenuOff(bool force);
void UI_PushMenu(const char *name);
void UI_ForceMenu(const char *name);
qboolean UI_BindActive(void);
void UI_SetReturnMenuToCurrent(void);
void UI_ActivateView3D(void);
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);
void UI_ShowScoreboard_f(const char *pszMenuName);
void UI_HideScoreboard_f(void);
void UI_SetScoreBoardItem(
int iItemNumber,
const char *pszData1,
const char *pszData2,
const char *pszData3,
const char *pszData4,
const char *pszData5,
const char *pszData6,
const char *pszData7,
const char *pszData8,
const vec4_t pTextColor,
const vec4_t pBackColor,
qboolean bIsHeader
);
void UI_DeleteScoreBoardItems(int iMaxIndex);
//
// ressources
//
void UI_BeginLoad( const char *pszMapName );
void UI_EndLoad( void );
void UI_AbortLoad( void );
void UI_BeginLoadResource( void );
void UI_EndLoadResource( void );
void UI_EndLoadResource( const char *name );
qboolean UI_IsResourceLoaded( const char *name );
void UI_RegisterLoadResource( const char *name );
void UI_ClearResource( void );
void UI_LoadResource( const char *name );
void UI_BeginLoad(const char *pszMapName);
void UI_EndLoad(void);
void UI_AbortLoad(void);
void UI_BeginLoadResource(void);
void UI_EndLoadResource(void);
void UI_EndLoadResource(const char *name);
qboolean UI_IsResourceLoaded(const char *name);
void UI_RegisterLoadResource(const char *name);
void UI_ClearResource(void);
void UI_LoadResource(const char *name);
//
// windows
//
void UI_DeactiveFloatingWindows( void );
void UI_DeactiveFloatingWindows(void);
//
// console
//
void UI_OpenConsole( void );
qboolean UI_ConsoleIsVisible( void );
qboolean UI_ConsoleIsOpen( void );
void UI_CloseConsole( void );
void UI_ToggleConsole( void );
void UI_OpenDMConsole( int iMode );
void UI_CloseDMConsole( void );
void UI_ToggleDMConsole( int iMode );
void UI_OpenDeveloperConsole( void );
void UI_CloseDeveloperConsole( void );
void UI_PrintConsole(const char* msg);
void UI_OpenConsole(void);
qboolean UI_ConsoleIsVisible(void);
qboolean UI_ConsoleIsOpen(void);
void UI_CloseConsole(void);
void UI_ToggleConsole(void);
void UI_OpenDMConsole(int iMode);
void UI_CloseDMConsole(void);
void UI_ToggleDMConsole(int iMode);
void UI_OpenDeveloperConsole(void);
void UI_CloseDeveloperConsole(void);
void UI_PrintConsole(const char *msg);
//
// callbacks
//
void UI_Update( void );
void UI_ServerLoaded( void );
void UI_ResolutionChange( void );
void UI_KeyEvent( int key, unsigned int time );
void UI_CharEvent( int ch );
#endif /* __CL_UI_H__ */
void UI_Update(void);
void UI_ServerLoaded(void);
void UI_ResolutionChange(void);
void UI_KeyEvent(int key, unsigned int time);
void UI_CharEvent(int ch);
+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;
+1 -14
View File
@@ -20,8 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef __CL_UILOADSAVE_H__
#define __CL_UILOADSAVE_H__
#pragma once
class UIFAKKLoadGameClass : public UIListCtrl {
bool m_bRemovePending;
@@ -43,15 +42,3 @@ public:
void SetupFiles( void );
};
#ifdef __cplusplus
extern "C" {
#endif
void UI_SetupFiles( void );
#ifdef __cplusplus
}
#endif
#endif
+167
View File
@@ -0,0 +1,167 @@
/*
===========================================================================
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
===========================================================================
*/
// cl_uiradar.cpp: draw teammates
// since 2.0
#include "cl_uiradar.h"
#include "client.h"
radarClient_t* g_radarClients;
qhandle_t* g_radarShaders;
int g_radarClientNum;
void CL_InitRadar(radarClient_t* radars, qhandle_t* shaders, int clientNum)
{
g_radarClients = radars;
g_radarShaders = shaders;
g_radarClientNum = clientNum;
}
CLASS_DECLARATION( UIWidget, UIRadar, NULL )
{
{ NULL, NULL }
};
UIRadar::UIRadar()
{
m_fRadius = 32.f;
g_radarClients = NULL;
}
UIRadar::~UIRadar()
{
}
void UIRadar::Draw(void)
{
radarClient_t* radar;
float inv;
float iconSize;
int blinkTime, speakTime;
float origin[2], axis[2];
float halfScale;
int i;
if (!g_radarClients) {
return;
}
if (!cl.snap.valid) {
return;
}
if (g_radarClientNum < 0) {
return;
}
cge->CG_UpdateRadar();
radar = &g_radarClients[g_radarClientNum];
if (!radar->time) {
return;
}
if (com_radar_range && com_radar_range->value > 0) {
inv = 1.f / com_radar_range->value;
} else {
inv = 0;
}
if (cl_radar_icon_size->value > 0) {
iconSize = cl_radar_icon_size->value;
} else {
iconSize = 0;
}
axis[0] = radar->axis[0];
axis[1] = radar->axis[1];
origin[0] = radar->origin[0];
origin[1] = radar->origin[1];
blinkTime = cl_radar_blink_time->value * 1000;
speakTime = cl_radar_speak_time->value * 1000;
if (blinkTime < 100) blinkTime = 100;
halfScale = iconSize * 0.5f;
for (i = 0; i < MAX_CLIENTS; i++) {
float delta[2];
float newOrg[2];
float screenOrg[2];
float length;
radar = &g_radarClients[i];
if (i == g_radarClientNum) {
continue;
}
if (!g_radarClients[i].time) {
continue;
}
if (cl.snap.serverTime - radar->time >= 5000) {
continue;
}
if (radar->lastSpeakTime) {
int delta = cl.snap.serverTime - radar->lastSpeakTime;
// make the icon blink
if (delta >= 0 && delta < speakTime && ((delta / blinkTime) % 2) == 0) {
continue;
}
}
radar->lastSpeakTime = 0;
delta[0] = radar->origin[0] - origin[0];
delta[1] = radar->origin[1] - origin[1];
newOrg[0] = -(delta[0] * axis[0] + delta[1] * axis[1]) * inv;
newOrg[1] = (delta[0] * axis[1] + delta[1] * -axis[0]) * inv;
length = VectorLength2D(newOrg);
if (length > 1)
{
newOrg[0] = -(delta[0] * axis[0] + delta[1] * axis[1]) * inv * (1.f / length);
newOrg[1] = (delta[0] * axis[1] + delta[1] * -axis[0]) * inv * (1.f / length);
}
screenOrg[0] = -((halfScale * (1.141f * newOrg[1] + m_vVirtualScale[0])) - ((1.f + newOrg[1]) * 0.5f * m_frame.size.width));
screenOrg[1] = -((halfScale * (1.141f * newOrg[0] + m_vVirtualScale[1])) - ((1.f + newOrg[0]) * 0.5f * m_frame.size.height));
uii.Rend_DrawPicStretched2(
screenOrg[0],
screenOrg[1],
m_vVirtualScale[0] * iconSize,
m_vVirtualScale[1] * iconSize,
0,
0,
1,
1,
radar->axis[0] * axis[0] - (-radar->axis[1] * axis[1]),
radar->axis[0] * axis[1] + (-radar->axis[1] * axis[0]),
g_radarShaders[radar->teamShader]
);
}
}
+40
View File
@@ -0,0 +1,40 @@
/*
===========================================================================
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"
#include "../cgame/cg_public.h"
class UIRadar : public UIWidget {
public:
CLASS_PROTOTYPE(UIRadar);
public:
UIRadar();
~UIRadar();
void Draw(void) override;
private:
float m_fRadius;
};
void CL_InitRadar(radarClient_t* radars, qhandle_t* shaders, int clientNum);
File diff suppressed because it is too large. Load diff
+3 -6
View File
@@ -20,20 +20,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef __CL_UISERVERLIST_H__
#define __CL_UISERVERLIST_H__
#pragma once
class UIFAKKServerList : public UIListCtrl {
protected:
// need a new struct instead of gamespy
void *m_serverList;
struct GServerListImplementation *m_serverList[2];
bool m_bHasList;
bool m_bLANListing;
public:
CLASS_PROTOTYPE( UIFAKKServerList );
bool m_bGettingList;
bool m_bGettingList[2];
bool m_bUpdatingList;
protected:
@@ -54,5 +53,3 @@ public:
void Draw( void ) override;
void SortByColumn( int column ) override;
};
#endif /* __CL_UISERVERLIST_H__ */
+1428 -915
View File
File diff suppressed because it is too large. Load diff
+71 -70
View File
@@ -20,85 +20,86 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef __CL_UISTD_H__
#define __CL_UISTD_H__
#pragma once
typedef enum {
L_STATBAR_NONE,
L_STATBAR_HORIZONTAL,
L_STATBAR_VERTICAL,
L_STATBAR_VERTICAL_REVERSE,
L_STATBAR_VERTICAL_STAGGER_EVEN,
L_STATBAR_VERTICAL_STAGGER_ODD,
L_STATBAR_CIRCULAR,
L_STATBAR_NEEDLE,
L_STATBAR_ROTATOR,
L_STATBAR_COMPASS,
L_STATBAR_SPINNER,
L_STATBAR_HEADING_SPINNER
L_STATBAR_NONE,
L_STATBAR_HORIZONTAL,
L_STATBAR_VERTICAL,
L_STATBAR_VERTICAL_REVERSE,
L_STATBAR_VERTICAL_STAGGER_EVEN,
L_STATBAR_VERTICAL_STAGGER_ODD,
L_STATBAR_CIRCULAR,
L_STATBAR_NEEDLE,
L_STATBAR_ROTATOR,
L_STATBAR_COMPASS,
L_STATBAR_SPINNER,
L_STATBAR_HEADING_SPINNER
} statbar_orientation_t;
class UIFakkLabel : public UILabel {
class UIFakkLabel : public UILabel
{
protected:
SafePtr<inventory_item_t> m_lastitem;
int m_lastitemindex;
int m_stat;
int m_stat_configstring;
int m_maxstat;
int m_itemindex;
int m_inventoryrendermodelindex;
str m_sDrawModelName;
qboolean m_rendermodel;
statbar_orientation_t m_statbar_or;
float m_statbar_min;
float m_statbar_max;
float m_lastfrac;
float m_flashtime;
vec3_t m_offset;
vec3_t m_rotateoffset;
vec3_t m_angles;
float m_scale;
str m_anim;
UIReggedMaterial *m_statbar_material;
UIReggedMaterial *m_statbar_material_flash;
SafePtr<inventory_item_t> m_lastitem;
int m_lastitemindex;
int m_stat;
int m_stat_alpha;
int m_stat_configstring;
int m_maxstat;
int m_itemindex;
int m_inventoryrendermodelindex;
str m_sDrawModelName;
qboolean m_rendermodel;
statbar_orientation_t m_statbar_or;
float m_statbar_min;
float m_statbar_max;
float m_lastfrac;
float m_flashtime;
vec3_t m_offset;
vec3_t m_rotateoffset;
vec3_t m_angles;
float m_scale;
str m_anim;
UIReggedMaterial *m_statbar_material;
UIReggedMaterial *m_statbar_material_flash;
UIReggedMaterial *m_statbar_material_marker;
public:
CLASS_PROTOTYPE( UIFakkLabel );
CLASS_PROTOTYPE(UIFakkLabel);
UIFakkLabel();
UIFakkLabel();
void LayoutPlayerStat( Event *ev );
void LayoutPlayerStatConfigstring( Event *ev );
void LayoutMaxPlayerStat( Event *ev );
void LayoutItemIndex( Event *ev );
void InventoryRenderModelIndex( Event *ev );
void LayoutModelName( Event *ev );
void ClearInvItemReference( Event *ev );
void LayoutStatbar( Event *ev );
void LayoutStatbarShader( Event *ev );
void LayoutStatbarTileShader( Event *ev );
void LayoutStatbarShader_Flash( Event *ev );
void LayoutStatbarEndAngles( Event *ev );
void LayoutStatbarNeedleWidth( Event *ev );
void LayoutStatbarRotatorSize( Event *ev );
void LayoutStatbarTileShader_Flash( Event *ev );
void LayoutRenderModel( Event *ev );
void LayoutRenderModelOffset( Event *ev );
void LayoutRenderModelRotateOffset( Event *ev );
void LayoutRenderModelAngles( Event *ev );
void LayoutRenderModelScale( Event *ev );
void LayoutRenderModelAnim( Event *ev );
void LayoutPlayerStat(Event *ev);
void LayoutPlayerStatAlpha(Event *ev); // Added in 2.0
void LayoutPlayerStatConfigstring(Event *ev);
void LayoutMaxPlayerStat(Event *ev);
void LayoutItemIndex(Event *ev);
void InventoryRenderModelIndex(Event *ev);
void LayoutModelName(Event *ev);
void ClearInvItemReference(Event *ev);
void LayoutStatbar(Event *ev);
void LayoutStatbarShader(Event *ev);
void LayoutStatbarTileShader(Event *ev);
void LayoutStatbarShader_Flash(Event *ev);
void LayoutStatbarShader_Marker(Event *ev); // Added in 2.0
void LayoutStatbarEndAngles(Event *ev);
void LayoutStatbarNeedleWidth(Event *ev);
void LayoutStatbarRotatorSize(Event *ev);
void LayoutStatbarTileShader_Flash(Event *ev);
void LayoutRenderModel(Event *ev);
void LayoutRenderModelOffset(Event *ev);
void LayoutRenderModelRotateOffset(Event *ev);
void LayoutRenderModelAngles(Event *ev);
void LayoutRenderModelScale(Event *ev);
void LayoutRenderModelAnim(Event *ev);
void DrawStatbar( float frac );
void DrawStatCircle( float frac );
void DrawStatNeedle( float frac );
void DrawStatRotator( float frac );
void DrawStatCompass( float frac );
void DrawStatSpinner( float frac );
void StatCircleTexCoord( float fAng, vec3_t vTexCoord );
void DrawStatbar(float frac);
void DrawStatCircle(float frac);
void DrawStatNeedle(float frac);
void DrawStatRotator(float frac);
void DrawStatCompass(float frac);
void DrawStatSpinner(float frac);
void StatCircleTexCoord(float fAng, vec3_t vTexCoord);
void Draw( void ) override;
void Draw(void) override;
};
#endif
+82 -13
View File
@@ -30,6 +30,15 @@ CLASS_DECLARATION( UIWidget, View3D, NULL )
{ NULL, NULL }
};
#define MAX_SUBTITLES 4
cvar_t* subs[MAX_SUBTITLES];
cvar_t* teams[MAX_SUBTITLES];
float fadeTime[MAX_SUBTITLES];
float subLife[MAX_SUBTITLES];
float alpha[MAX_SUBTITLES];
char oldStrings[MAX_SUBTITLES][2048];
View3D::View3D()
{
// set as transparent
@@ -66,7 +75,22 @@ void View3D::DrawLetterbox
)
{
// FIXME: stub
float frac;
vec4_t col;
col[0] = col[1] = col[2] = 0;
col[3] = 1;
frac = cl.snap.ps.stats[STAT_LETTERBOX] / 32767.0;
if (frac > 0.0) {
m_letterbox_active = true;
re.SetColor(col);
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
re.DrawBox(0.0, m_screenframe.size.height - m_screenframe.size.height * frac, m_screenframe.size.width, m_screenframe.size.height);
} else {
m_letterbox_active = false;
}
}
void View3D::DrawFades
@@ -75,7 +99,14 @@ void View3D::DrawFades
)
{
// FIXME: stub
if (cl.snap.ps.blend[3] > 0) {
re.SetColor(cl.snap.ps.blend);
if (cl.snap.ps.stats[STAT_ADDFADE]) {
re.AddBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
} else {
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
}
}
}
void View3D::Draw2D
@@ -200,7 +231,7 @@ void View3D::DrawProf
)
{
// FIXME: stub
// Normal empty function
}
void View3D::PrintSound
@@ -215,7 +246,7 @@ void View3D::PrintSound
)
{
// FIXME: stub
// FIXME: unimplemented
}
void View3D::DrawSoundOverlay
@@ -224,7 +255,13 @@ void View3D::DrawSoundOverlay
)
{
// FIXME: stub
setFont("verdana-14");
m_font->setColor(UWhite);
if (sound_overlay->integer) {
Com_Printf("sound_overlay isn't supported with OpenAL/SDL right now.\n");
Cvar_Set("sound_overlay", "0");
}
}
void View3D::CenterPrint
@@ -233,7 +270,7 @@ void View3D::CenterPrint
)
{
// FIXME: stub
// FIXME: unimplemented
}
void View3D::LocationPrint
@@ -242,7 +279,7 @@ void View3D::LocationPrint
)
{
// FIXME: stub
// FIXME: unimplemented
}
void View3D::OnActivate
@@ -287,7 +324,7 @@ void View3D::DrawSubtitleOverlay
)
{
// FIXME: stub
// FIXME: unimplemented
}
void View3D::ClearCenterPrint
@@ -296,7 +333,7 @@ void View3D::ClearCenterPrint
)
{
// FIXME: stub
m_printfadetime = 0.0;
}
void View3D::UpdateCenterPrint
@@ -306,7 +343,17 @@ void View3D::UpdateCenterPrint
)
{
// FIXME: stub
m_printstring = s;
if (s[0] == '@') {
m_print_mat = uWinMan.RegisterShader(s + 1);
} else {
m_print_mat = NULL;
}
m_printalpha = alpha;
m_printfadetime = 4000.0;
m_locationprint = qfalse;
}
void View3D::UpdateLocationPrint
@@ -318,7 +365,12 @@ void View3D::UpdateLocationPrint
)
{
// FIXME: stub
m_printstring = s;
m_printalpha = alpha;
m_printfadetime = 4000.0;
m_x_coord = x;
m_y_coord = y;
m_locationprint = qtrue;
}
qboolean View3D::LetterboxActive
@@ -330,13 +382,30 @@ qboolean View3D::LetterboxActive
return m_letterbox_active;
}
float avWidth = 0.0;
void View3D::InitSubtitle
(
void
)
{
// FIXME: stub
float totalWidth;
for (int i = 0; i < 4; i++) {
subs[i] = Cvar_Get(va("subtitle%d", i), "", 0);
teams[i] = Cvar_Get(va("subteam%d", i), "0", 0);
strcpy(oldStrings[i], subs[i]->string);
fadeTime[i] = 4000.0;
subLife[i] = 4000.0;
}
totalWidth = 0.0;
for (char j = 'A'; j <= 'Z'; j++) {
totalWidth += m_font->getCharWidth(j);
}
avWidth = totalWidth / 26.0;
}
void View3D::FrameInitialized
@@ -370,6 +439,6 @@ void ConsoleView::Draw
)
{
// FIXME: stub
// FIXME: unimplemented
}
+10 -12
View File
@@ -21,8 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// client.h -- primary header for client
#ifndef __CLIENT_H__
#define __CLIENT_H__
#pragma once
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
@@ -352,7 +351,7 @@ typedef struct {
clientAnim_t anim;
stopWatch_t stopwatch;
void* savedCgameState;
int savedCgameStateSize;
size_t savedCgameStateSize;
char gcdResponse[73];
int unknown3_0;
int currentRate;
@@ -437,6 +436,9 @@ extern cvar_t *cl_inGameVideo;
extern cvar_t *cl_lanForcePackets;
extern cvar_t *cl_langamerefreshstatus;
extern cvar_t *cl_radar_icon_size;
extern cvar_t *cl_radar_speak_time;
extern cvar_t *cl_radar_blink_time;
extern cvar_t *cl_autoRecordDemo;
extern cvar_t *cl_r_fullscreen;
@@ -463,15 +465,12 @@ 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 );
void CL_Connect( const char *server, netadrtype_t family );
void CL_Disconnect_f (void);
void CL_GetChallengePacket (void);
@@ -573,6 +572,7 @@ void CL_FavoriteServers_f( void );
void CL_Ping_f( void );
void CL_SaveShot_f( void );
void CL_Dialog_f( void );
void CL_ServerRestarted( void );
qboolean CL_UpdateVisiblePings_f( int source );
@@ -689,5 +689,3 @@ void CL_InitConsoleCommands( void );
#ifdef __cplusplus
}
#endif
#endif // __CLIENT_H__
+65
View File
@@ -0,0 +1,65 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int iFlags;
char szName[64];
} soundSfx_t;
typedef struct {
qboolean bPlaying;
int iStatus;
soundSfx_t sfx;
int iEntNum;
int iEntChannel;
float vOrigin[3];
float fVolume;
int iBaseRate;
float fNewPitchMult;
float fMinDist;
float fMaxDist;
int iStartTime;
int iTime;
int iNextCheckObstructionTime;
int iEndTime;
int iFlags;
int iOffset;
int iLoopCount;
} channelbasesavegame_t;
typedef struct {
channelbasesavegame_t Channels[MAX_CHANNELS];
} soundsystemsavegame_t;
void S_ChannelFree_Callback(channel_t* v);
void S_LoadData(soundsystemsavegame_t* pSave);
void S_SaveData(soundsystemsavegame_t* pSave);
#ifdef __cplusplus
}
#endif
+95 -33
View File
@@ -1,3 +1,25 @@
/*
===========================================================================
Copyright (C) 2023 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 "../snd_local.h"
void S_Init2()
@@ -33,7 +55,7 @@ void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t s
S_StopAllSounds
=================
*/
void S_StopAllSounds(qboolean stop_music)
void S_StopAllSounds2(qboolean stop_music)
{
// Call the original function
S_StopAllSounds();
@@ -61,12 +83,23 @@ void S_Respatialize(int entityNum, const vec3_t origin,
{
S_Respatialize(entityNum, origin, axis, 0);
}
/*
=================
S_StartLocalSoundChannel
=================
*/
void S_StartLocalSound(const char* sound_name, qboolean force_load)
{
// FIXME: unimplemented
}
/*
=================
S_StartLocalSound
=================
*/
void S_StartLocalSound(const char* sound_name, qboolean force_load)
void S_StartLocalSoundChannel(const char* sound_name, qboolean force_load, int channel)
{
// FIXME: unimplemented
}
@@ -90,11 +123,16 @@ void S_StopSound(int entnum, int channel)
S_IsSoundPlaying
=================
*/
int S_IsSoundPlaying(int channelNumber, const char* name)
qboolean S_IsSoundPlaying(int channelNumber, const char* name)
{
// FIXME: stub
STUB();
return 0;
channel_t* v;
if (channelNumber >= MAX_CHANNELS) {
return qfalse;
}
v = &s_channels[channelNumber];
return v->thesfx ? qtrue : qfalse;
}
/*
@@ -104,7 +142,7 @@ MUSIC_Pause
*/
void MUSIC_Pause()
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -115,7 +153,7 @@ MUSIC_Unpause
*/
void MUSIC_Unpause()
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -126,7 +164,7 @@ MUSIC_LoadSoundtrackFile
*/
qboolean MUSIC_LoadSoundtrackFile(const char* filename)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -138,7 +176,7 @@ MUSIC_SongValid
*/
qboolean MUSIC_SongValid(const char* mood)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -150,7 +188,7 @@ MUSIC_Loaded
*/
qboolean MUSIC_Loaded(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -162,7 +200,7 @@ Music_Update
*/
void Music_Update(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -173,7 +211,7 @@ MUSIC_SongEnded
*/
void MUSIC_SongEnded(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -184,7 +222,7 @@ S_StartSound
*/
void MUSIC_NewSoundtrack(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -195,7 +233,7 @@ MUSIC_UpdateMood
*/
void MUSIC_UpdateMood(int current, int fallback)
{
// FIXME: stub
// FIXME: unimplemented
//STUB();
}
@@ -206,7 +244,7 @@ MUSIC_UpdateVolume
*/
void MUSIC_UpdateVolume(float volume, float fade_time)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -217,7 +255,7 @@ MUSIC_StopAllSongs
*/
void MUSIC_StopAllSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -228,7 +266,7 @@ MUSIC_FreeAllSongs
*/
void MUSIC_FreeAllSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -239,7 +277,7 @@ MUSIC_Playing
*/
qboolean MUSIC_Playing(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -251,7 +289,7 @@ MUSIC_FindSong
*/
int MUSIC_FindSong(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0;
}
@@ -263,7 +301,7 @@ MUSIC_CurrentSongChannel
*/
int MUSIC_CurrentSongChannel(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0;
}
@@ -275,7 +313,7 @@ MUSIC_StopChannel
*/
void MUSIC_StopChannel(int channel_number)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -286,7 +324,7 @@ MUSIC_PlaySong
*/
qboolean MUSIC_PlaySong(const char* alias)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return qfalse;
}
@@ -298,7 +336,7 @@ MUSIC_UpdateMusicVolumes
*/
void MUSIC_UpdateMusicVolumes(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -309,7 +347,7 @@ MUSIC_CheckForStoppedSongs
*/
void MUSIC_CheckForStoppedSongs(void)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -320,7 +358,7 @@ S_IsSoundRegistered
*/
qboolean S_IsSoundRegistered(const char* name)
{
// FIXME: stub
// FIXME: unimplemented
return qfalse;
}
/*
@@ -330,7 +368,7 @@ S_GetSoundTime
*/
float S_GetSoundTime(sfxHandle_t handle)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
return 0.0;
}
@@ -342,7 +380,7 @@ S_SetGlobalAmbientVolumeLevel
*/
void S_SetGlobalAmbientVolumeLevel(float volume)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -353,7 +391,7 @@ S_SetReverb
*/
void S_SetReverb(int reverb_type, float reverb_level)
{
// FIXME: stub
// FIXME: unimplemented
STUB();
}
@@ -364,15 +402,39 @@ 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
}
void callbackServer(int entnum, int channel_number, const char* name) {
if (com_sv_running->integer) {
SV_SoundCallback(entnum, channel_number, name);
}
}
void S_ChannelFree_Callback(channel_t* v) {
if (v->entnum & S_FLAG_DO_CALLBACK) {
callbackServer(v->entnum & ~S_FLAG_DO_CALLBACK, v - s_channels, v->thesfx->soundName);
}
}
void S_LoadData(soundsystemsavegame_t* pSave) {
// FIXME: unimplemented
}
void S_SaveData(soundsystemsavegame_t* pSave) {
// FIXME: unimplemented
}
+26 -2
View File
@@ -1,3 +1,25 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
#pragma once
#ifdef __cplusplus
@@ -8,8 +30,8 @@ void S_Respatialize(int entityNum, const vec3_t origin, vec3_t axis[3]);
sfxHandle_t S_RegisterSound(const char* sample, qboolean compressed, qboolean streamed);
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_StartLocalSound(const char* name, qboolean force_load);
void S_StartLocalSoundChannel(const char* sound_name, qboolean force_load, int channel);
void S_StartSound(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, qboolean streamed);
void S_StopAllSounds(qboolean stop_music);
void S_ClearLoopingSounds(void);
qboolean S_IsSoundRegistered(const char* name);
void S_Init2();
@@ -43,13 +65,15 @@ void MUSIC_UpdateMusicVolumes(void);
void MUSIC_CheckForStoppedSongs(void);
void S_StopSound(int entnum, int channel);
void S_StopAllSounds2(qboolean stop_music);
float S_GetSoundTime(sfxHandle_t handle);
void S_SetGlobalAmbientVolumeLevel(float volume);
void S_SetReverb(int reverb_type, float reverb_level);
int S_IsSoundPlaying(int channelNumber, const char* name);
qboolean 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
}
+1 -1
View File
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "snd_codec.h"
// includes for the MP3 codec
#include <mad.h>
#include "../libmad-0.15.1b/synth.h"
#define MP3_SAMPLE_WIDTH 2
#define MP3_PCMSAMPLES_PERSLICE 32
+1
View File
@@ -181,6 +181,7 @@ void S_Base_SoundList( void ) {
void S_ChannelFree(channel_t *v) {
S_ChannelFree_Callback(v);
v->thesfx = NULL;
*(channel_t **)v = freelist;
freelist = (channel_t*)v;
+3
View File
@@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// snd_local.h -- private sound definations
#pragma once
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
@@ -275,6 +276,8 @@ qboolean S_AL_Init( soundInterface_t *si );
void S_PaintChannelFrom16_altivec( portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE], int snd_vol, channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset );
#endif
#include "new/snd_local_new.h"
#ifdef __cplusplus
}
#endif
+1 -1
View File
@@ -120,7 +120,7 @@ bool UConnection::SendEvent
ptr = m_listeners.ObjectAt( i );
if( ptr )
{
Event *e = new Event( m_events.ObjectAt( i ) );
Event *e = new Event( *m_events.ObjectAt( i ) );
for( j = 1; j < numargs; j++ )
{
+11 -4
View File
@@ -16,7 +16,14 @@ set(SOURCES_SHARED
"../qcommon/str.cpp"
)
file(GLOB_RECURSE SOURCES_GAME "./*.c*" "../parser/*.c*" "../script/*.c*")
file(
GLOB_RECURSE
SOURCES_GAME
"./*.c*"
"../script/*.c*"
"../parser/generated/*.c*"
"../parser/parsetree.cpp"
)
add_library(fgame SHARED ${SOURCES_GAME})
@@ -44,13 +51,13 @@ target_compile_features(fgame PUBLIC c_variadic_macros)
target_link_libraries(fgame PUBLIC qcommon)
set_target_properties(fgame PROPERTIES PREFIX "${TARGET_PLATFORM_PREFIX}")
set_target_properties(fgame PROPERTIES OUTPUT_NAME "game${TARGET_ARCH_SUFFIX}${TARGET_CONFIG_SUFFIX}")
set_target_properties(fgame PROPERTIES OUTPUT_NAME "game${TARGET_ARCH_SUFFIX}")
set_target_properties(fgame PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TARGET_BASE_GAME}")
INSTALL(
TARGETS fgame
DESTINATION "${TARGET_BASE_GAME}"
ARCHIVE EXCLUDE_FROM_ALL
LIBRARY DESTINATION "${TARGET_BASE_GAME}"
RUNTIME DESTINATION "${TARGET_BASE_GAME}"
)
if(MSVC)
+66
View File
@@ -0,0 +1,66 @@
/*
===========================================================================
Copyright (C) 2023 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 "DrivableVehicleTandem.h"
#include "vehicleturret.h"
CLASS_DECLARATION(DrivableVehicle, DrivableVehicleTandem, "DrivableVehicleTandem") {
{NULL, NULL}
};
DrivableVehicleTandem::DrivableVehicleTandem()
{
}
DrivableVehicleTandem::~DrivableVehicleTandem()
{
}
void DrivableVehicleTandem::SpawnTurret(Event* ev)
{
VehicleTurretGunTandem* pTurret = new VehicleTurretGunTandem();
int slot;
pTurret->SetBaseOrientation(orientation, NULL);
pTurret->setModel(ev->GetString(2));
slot = ev->GetInteger(1);
AttachTurretSlot(slot, pTurret, vec_zero, NULL);
pTurret->SetVehicleOwner(this);
pTurret->PostEvent(EV_TakeDamage, EV_POSTSPAWN);
UpdateTurretSlot(slot);
pTurret->ProcessPendingEvents();
}
void DrivableVehicleTandem::UpdateTurretSlot(int iSlot)
{
DrivableVehicle::UpdateTurretSlot(iSlot);
if (Turrets[iSlot].ent && Turrets[iSlot].ent->isSubclassOf(VehicleTurretGunTandem)) {
VehicleTurretGunTandem* pTurret = static_cast<VehicleTurretGunTandem*>(Turrets[iSlot].ent.Pointer());
pTurret->UpdateLinkedTurret();
}
}
+37
View File
@@ -0,0 +1,37 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
#pragma once
#include "vehicle.h"
class DrivableVehicleTandem : public DrivableVehicle {
private:
CLASS_PROTOTYPE(DrivableVehicleTandem);
public:
DrivableVehicleTandem();
~DrivableVehicleTandem();
void SpawnTurret(Event* ev) override;
void UpdateTurretSlot(int iSlot) override;
};
File diff suppressed because it is too large. Load diff
+473
View File
@@ -0,0 +1,473 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
#pragma once
#include "entity.h"
#include "animate.h"
typedef enum {
CONTROLLER_ALLIES,
CONTROLLER_AXIS,
CONTROLLER_DRAW
} eController;
#define PT_SPAWNFLAG_PLAY_FIRE_SOUND 1
#define PT_SPAWNFLAG_PLAY_MOTION_SOUND 2
#define PT_SPAWNFLAG_TARGET_RANDOM 4
#define PT_SPAWNFLAG_TURN_ON 8
#define PT_SPAWNFLAG_ROTATE_YAW 16
#define PT_SPAWNFLAG_ROTATE_ROLL 32
#define PT_SPAWNFLAG_TARGET_PLAYER 64
#define PT_SPAWNFLAG_HIDDEN 128
void ClearProjectileTargets();
class ProjectileTarget : public Entity
{
private:
int m_iTarget;
public:
CLASS_PROTOTYPE(ProjectileTarget);
ProjectileTarget();
void EventSetId(Event *ev);
int GetTarget() const;
};
#define MAX_PROJECTILE_GENERATOR_TARGETS 16
class ProjectileGenerator : public Animate
{
protected:
int m_iId;
int m_iCycles;
float m_fMinDuration;
float m_fMaxDuration;
int m_iMinNumShots;
int m_iMaxNumShots;
float m_fMinDelay;
float m_fMaxDelay;
float m_fAccuracy;
str m_sLaunchSound;
bool m_bFireOnStartUp;
qboolean m_bIsDonut;
float m_fArcDonut;
float m_fMinDonut;
float m_fMaxDonut;
float m_fCycleTime;
float m_fShotsPerSec;
float m_fCurrentTime;
int m_iTargetIndex;
float m_fLastShotTime;
int m_iAnimSlot;
bool m_bIsTurnedOn;
int m_iCurrentCycle;
Entity *m_pTarget;
Container<ProjectileTarget *> m_projectileTargets;
Entity *m_pCurrent;
Vector m_vTargetOrg;
public:
CLASS_PROTOTYPE(ProjectileGenerator);
ProjectileGenerator();
virtual void SetupNextCycle();
virtual void BeginCycle(Event *ev);
virtual void TickCycle(Event *ev);
virtual void EndCycle(Event *ev);
bool ShouldStartOn() const;
bool ShouldHideModel() const;
bool ShouldPlayFireSound() const;
bool ShouldPlayMotionSound() const;
bool ShouldRotateYaw() const;
bool ShouldRotateRoll() const;
void EventIsTurnedOn(Event *ev);
void EventGetTargetEntity(Event *ev);
void EventLaunchSound(Event *ev);
void SetTarget(Event *ev);
void SetTarget(Entity* ent);
void OnInitialize(Event *ev);
void TurnOff(Event *ev);
void TurnOn(Event *ev);
bool ShouldTargetRandom() const;
Entity* ChooseTarget();
void GetLocalTargets();
bool ShouldTargetPlayer() const;
Vector GetTargetPos(Entity *target);
void GetMuzzlePos(Vector& pos);
void Fire();
void TryLaunchSound();
void SetWeaponAnim(const char* name, Event* ev);
void EventAccuracy(Event *ev);
void EventMaxDelay(Event *ev);
void EventMinDelay(Event *ev);
void EventFireOnStartUp(Event *ev);
void EventMaxNumShots(Event *ev);
void EventMinNumShots(Event *ev);
void EventCycles(Event *ev);
void EventMaxDuration(Event *ev);
void EventMinDuration(Event *ev);
void SetWeaponModel(Event *ev);
void EventSetId(Event* ev);
void EventmaxDonut(Event* ev);
void EventminDonut(Event* ev);
void EventarcDonut(Event* ev);
void EventisDonut(Event* ev);
virtual bool Attack(int count);
void Archive(Archiver& arc) override;
};
class ProjectileGenerator_Projectile : public ProjectileGenerator
{
private:
str m_sProjectileModel;
str m_sPreImpactSound;
float m_fImpactSoundTime;
float m_fImpactSoundProbability;
public:
CLASS_PROTOTYPE(ProjectileGenerator_Projectile);
ProjectileGenerator_Projectile();
void SetPreImpactSoundProbability(Event *ev);
void SetPreImpactSoundTime(Event *ev);
void SetPreImpactSound(Event *ev);
void PlayPreImpactSound(Event *ev);
void SetProjectileModel(Event *ev);
float EstimateImpactTime(const Vector& targetOrigin, const Vector& fromOrigin, float speed) const;
bool Attack(int count) override;
void Archive(Archiver& arc) override;
};
class ProjectileGenerator_Gun : public ProjectileGenerator
{
private:
float m_fBulletRange;
float m_fBulletDamage;
int m_iBulletCount;
Vector m_vBulletSpread;
int m_iTracerFrequency;
int m_iBulletLarge;
qboolean m_bFakeBullets;
int m_iMeansOfDeath;
float m_fBulletThroughWood;
float m_fBulletThroughMetal;
float m_iBulletKnockback;
int m_iAttackCount;
float m_fFireDelay;
float m_fTracerSpeed;
public:
CLASS_PROTOTYPE(ProjectileGenerator_Gun);
ProjectileGenerator_Gun();
void SetFireDelay(Event *ev);
void SetMeansOfDeath(Event *ev);
void SetBulletThroughWood(Event *ev);
void SetBulletThroughMetal(Event *ev);
void SetBulletKnockback(Event *ev);
void SetTracerSpeed(Event *ev);
void SetBulletLarge(Event *ev);
void SetFakeBullets(Event *ev);
void SetBulletCount(Event *ev);
void SetBulletDamage(Event *ev);
void SetTracerFrequency(Event *ev);
void SetBulletSpread(Event *ev);
void SetBulletRange(Event *ev);
bool Attack(int count) override;
bool TickWeaponAnim();
void TickCycle(Event *ev) override;
void Archive(Archiver& arc) override;
};
class ProjectileGenerator_Heavy : public ProjectileGenerator
{
private:
str m_sProjectileModel;
public:
CLASS_PROTOTYPE(ProjectileGenerator_Heavy);
ProjectileGenerator_Heavy();
void SetProjectileModel(Event *ev);
bool Attack(int count) override;
void Archive(Archiver& arc) override;
};
class ThrobbingBox_Explosive : public Animate
{
protected:
str m_sUsedModel;
str m_sSound;
bool m_bUsed;
float m_fExplosionDamage;
float m_fRadius;
float m_fStopwatchDuration;
str m_sActivateSound;
str m_sTickSound;
str m_sDestroyedModel;
ScriptThreadLabel m_thread;
ScriptThreadLabel m_useThread;
str m_sEffect;
Vector m_vOffset;
public:
CLASS_PROTOTYPE(ThrobbingBox_Explosive);
ThrobbingBox_Explosive();
bool ShouldDoExplosion();
void SetExplosionOffset(Event *ev);
void SetExplosionEffect(Event *ev);
void SetTriggered(Event *ev);
void DoExplosion(Event *ev);
void SetUseThread(Event *ev);
void SetThread(Event *ev);
void SetStopWatchDuration(Event *ev);
void SetRadius(Event *ev);
void SetDamage(Event *ev);
void TickSound(Event *ev);
void ActivateSound(Event *ev);
void ExplosionSound(Event *ev);
void UsedModel(Event *ev);
void SetDestroyModel(Event *ev);
void OnBlowUp(Event *ev);
void OnUse(Event *ev);
void Archive(Archiver& arc) override;
};
class ThrobbingBox_ExplodePlayerFlak88 : public ThrobbingBox_Explosive
{
public:
CLASS_PROTOTYPE(ThrobbingBox_ExplodePlayerFlak88);
};
class ThrobbingBox_ExplodeFlak88 : public ThrobbingBox_Explosive
{
public:
CLASS_PROTOTYPE(ThrobbingBox_ExplodeFlak88);
};
class ThrobbingBox_ExplodeNebelwerfer : public ThrobbingBox_Explosive
{
public:
CLASS_PROTOTYPE(ThrobbingBox_ExplodeNebelwerfer);
};
class ThrobbingBox_ExplodePlayerNebelwerfer : public ThrobbingBox_Explosive
{
public:
CLASS_PROTOTYPE(ThrobbingBox_ExplodePlayerNebelwerfer);
};
#define TBE_SPAWNFLAG_DESTROYED_MODEL 1
#define TBE_SPAWNFLAG_MAKE_WET 2
class ThrobbingBox_Stickybomb : public ThrobbingBox_Explosive
{
private:
float m_fStopwatchStartTime;
public:
CLASS_PROTOTYPE(ThrobbingBox_Stickybomb);
void OnStickyBombWet(Event *ev);
void OnStickyBombUse(Event *ev);
void Archive(Archiver& arc) override;
};
#define OBJECTIVE_SPAWNFLAG_TURN_ON 1
class Objective : public Entity
{
private:
str m_sText;
int m_iObjectiveIndex;
public:
CLASS_PROTOTYPE(Objective);
Objective();
void Archive(Archiver &arc) override;
void TurnOn(Event *ev);
void TurnOff(Event *ev);
void Complete(Event *ev);
void SetCurrent(Event *ev);
Vector GetOrigin() const;
void SetObjectiveNbr(Event *ev);
void SetText(Event *ev);
int GetObjectiveIndex() const;
};
class FencePost : public Entity
{
public:
CLASS_PROTOTYPE(FencePost);
};
class AISpawnPoint : public SimpleArchivedEntity
{
private:
str m_sModel;
int m_iHealth;
str m_sEnemyName;
float m_iAccuracy;
int m_iAmmoGrenade;
float m_iBalconyHeight;
int m_iDisguiseLevel;
float m_fDisguisePeriod;
float m_fDisguiseRange;
float m_fEnemyShareRange;
float m_fFixedLeash;
float m_fGrenadeAwareness;
str m_sGun;
float m_fMaxNoticeTimeScale;
float m_fSoundAwareness;
str m_sTypeAttack;
str m_sTypeDisguise;
str m_sTypeGrenade;
str m_sTypeIdle;
bool m_bPatrolWaitTrigger;
float m_fHearing;
float m_fSight;
float m_fFov;
float m_fLeash;
float m_fMinDist;
float m_fMaxDist;
float m_fInterval;
bool m_bDontDropWeapons;
bool m_bDontDropHealth;
str m_sFavoriteEnemy;
bool m_bNoSurprise;
str m_sPatrolPath;
str m_sTurret;
str m_sAlarmNode;
str m_sWeapon;
str m_sTarget;
str m_sVoiceType;
bool m_bForceDropWeapon;
bool m_bForceDropHealth;
public:
CLASS_PROTOTYPE(AISpawnPoint);
AISpawnPoint();
void GetForceDropHealth(Event *ev);
void SetForceDropHealth(Event *ev);
void GetForceDropWeapon(Event *ev);
void SetForceDropWeapon(Event *ev);
void GetVoiceType(Event *ev);
void SetVoiceType(Event *ev);
void GetTarget(Event *ev);
void SetTarget(Event *ev);
void GetWeapon(Event *ev);
void SetWeapon(Event *ev);
void GetAlarmNode(Event *ev);
void SetAlarmNode(Event *ev);
void GetTurret(Event *ev);
void SetTurret(Event *ev);
void GetPatrolPath(Event *ev);
void SetPatrolPath(Event *ev);
void GetNoSurprise(Event *ev);
void SetNoSurprise(Event *ev);
void SetFavoriteEnemy(Event *ev);
void GetFavoriteEnemy(Event *ev);
void GetDontDropHealth(Event *ev);
void SetDontDropHealth(Event *ev);
void GetDontDropWeapons(Event *ev);
void SetDontDropWeapons(Event *ev);
void GetInterval(Event *ev);
void SetInterval(Event *ev);
void GetMaxDistance(Event *ev);
void SetMaxDistance(Event *ev);
void GetMinDistance(Event *ev);
void SetMinDistance(Event *ev);
void GetLeash(Event *ev);
void SetLeash(Event *ev);
void GetFov(Event *ev);
void SetFov(Event *ev);
void SetSight(Event *ev);
void GetSight(Event *ev);
void GetHearing(Event *ev);
void SetHearing(Event *ev);
void GetPatrolWaitTrigger(Event *ev);
void SetPatrolWaitTrigger(Event *ev);
void GetTypeIdle(Event *ev);
void SetTypeIdle(Event *ev);
void GetTypeGrenade(Event *ev);
void SetTypeGrenade(Event *ev);
void GetTypeDisguise(Event *ev);
void SetTypeDisguise(Event *ev);
void GetTypeAttack(Event *ev);
void SetTypeAttack(Event *ev);
void SetSoundAwareness(Event *ev);
void GetSoundAwareness(Event *ev);
void SetMaxNoticeTimeScale(Event *ev);
void GetMaxNoticeTimeScale(Event *ev);
void GetGun(Event *ev);
void SetGun(Event *ev);
void GetGrenadeAwareness(Event *ev);
void SetGrenadeAwareness(Event *ev);
void SetFixedLeash(Event *ev);
void GetFixedLeash(Event *ev);
void GetEnemyShareRange(Event *ev);
void SetEnemyShareRange(Event *ev);
void GetDisguiseRange(Event *ev);
void SetDisguiseRange(Event *ev);
void GetDisguisePeriod(Event *ev);
void SetDisguisePeriod(Event *ev);
void GetDisguiseLevel(Event *ev);
void SetDisguiseLevel(Event *ev);
void GetBalconyHeight(Event *ev);
void SetBalconyHeight(Event *ev);
void GetAmmoGrenade(Event *ev);
void SetAmmoGrenade(Event *ev);
void GetAccuracy(Event *ev);
void SetAccuracy(Event *ev);
void GetEnemyName(Event *ev);
void SetEnemyName(Event *ev);
void GetHealth(Event *ev);
void SetHealth(Event *ev);
void GetModel(Event *ev);
void SetModel(Event *ev);
void Archive(Archiver& arc) override;
};
+359
View File
@@ -0,0 +1,359 @@
/*
===========================================================================
Copyright (C) 2023 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 "Tow_Entities.h"
#include "player.h"
#include "scriptthread.h"
TOWObjectiveMan g_TOWObjectiveMan;
TOWObjectiveMan::TOWObjectiveMan()
{
Reset();
}
void TOWObjectiveMan::Reset()
{
m_towObjectives.ClearObjectList();
m_iNumAxisObjectives = 0;
m_iNumAlliesObjectives = 0;
}
void TOWObjectiveMan::AddObjective(TOWObjective *objective)
{
if (!objective) {
return;
}
switch (objective->GetController()) {
case CONTROLLER_ALLIES:
m_iNumAlliesObjectives++;
break;
case CONTROLLER_AXIS:
m_iNumAxisObjectives++;
break;
}
m_towObjectives.AddObject(objective);
}
void TOWObjectiveMan::TakeOverObjective(eController controller, eController controllingTeam)
{
int i;
if (controllingTeam == CONTROLLER_DRAW) {
return;
}
switch (controllingTeam) {
case CONTROLLER_ALLIES:
m_iNumAlliesObjectives++;
if (m_iNumAxisObjectives) {
m_iNumAxisObjectives--;
}
dmManager.CheckEndMatch();
break;
case CONTROLLER_AXIS:
m_iNumAxisObjectives++;
if (m_iNumAlliesObjectives) {
m_iNumAlliesObjectives--;
}
dmManager.CheckEndMatch();
break;
default:
break;
}
for (i = 0; i < game.maxclients; i++) {
gentity_t *ent = &g_entities[i];
Player *player;
bool bSameTeam;
if (!ent->inuse || !ent->entity) {
continue;
}
player = static_cast<Player *>(ent->entity);
switch (controllingTeam) {
case CONTROLLER_ALLIES:
bSameTeam = player->GetTeam() == TEAM_ALLIES;
break;
case CONTROLLER_AXIS:
bSameTeam = player->GetTeam() == TEAM_AXIS;
break;
default:
break;
}
// play a different sound for the losing team
if (bSameTeam) {
player->PlayInstantMessageSound("success");
} else {
player->PlayInstantMessageSound("failure");
}
}
}
//---------------------------------------------------------------------------------------------
/*QUAKED func_TOWObjective (1.0 0.0 1.0) (-12 -12 -12) (12 12 12) StartOn Respawner
This object is an extension of the standard objective object. It is used for Tug of War
Maps.
object used to simplify placing objectives. You may optionally connect this object to the
target you want to use for the compass position....
Checkboxes:
StartOn - check this if you want this objective to be displayed when the level first loads
Respawner - check this if the objective is the respawn point for a team. If you set this
you must set ControlledBy to a valid team and not Neutral.
Parameters:
ControlledBy 0 = Axis, 1 = Allies, 2 = Neutral
AxisObjNum 1 - 5. Set the objective number for the axis. This will associate the objective with
the check box for the corresponding text in the score screen.
AlliesObjNum 1 - 5. Set the objective number for the allies. This will associate the objective with
the check box for the corresponding text in the score screen.
ObjectiveNbr <nObjNbr=0> Please ignore this for now.
Events:
TurnOn
TurnOff
Complete
Text <sNewText>
SetCurrent
SetController <ControlledBy> - This will set the starting controller default is neutral. See ControlledBy var above.
//---------------------------------------------------------------------------------------------
*/
Event EV_SetController
(
"ControlledBy",
EV_DEFAULT,
"i",
"ControlledBy",
"Sets the team controlling the objective",
EV_NORMAL
);
Event EV_TakeOver
(
"TakeOver",
EV_DEFAULT,
"i",
"TeamNum",
"Sets the team controlling the objective. 0 = Axis, 1 = Allies",
EV_NORMAL
);
Event EV_SetAxisObjNum
(
"AxisObjNum",
EV_DEFAULT,
"i",
"AxisObjNum",
"Sets the objective number for the axis team",
EV_NORMAL
);
Event EV_SetAlliesObjNum
(
"AlliesObjNum",
EV_DEFAULT,
"i",
"AlliesObjNum",
"Sets the objective number for the allies team",
EV_NORMAL
);
static Event EV_Initialize
(
"initialize",
EV_DEFAULT,
0,
0,
"Initialize object",
EV_NORMAL
);
static Event EV_SetCurrent
(
"SetCurrent",
EV_DEFAULT,
"i",
"TeamNum",
"Set this objective as the current objective for the specified team.",
EV_NORMAL
);
Event EV_GetController
(
"ControlledBy",
EV_DEFAULT,
0,
0,
"Objective controller",
EV_GETTER
);
CLASS_DECLARATION(Objective, TOWObjective, "func_towobjective") {
{&EV_SetController, &TOWObjective::SetController },
{&EV_TakeOver, &TOWObjective::TakeOver },
{&EV_SetAxisObjNum, &TOWObjective::SetAxisObjNum },
{&EV_SetAlliesObjNum, &TOWObjective::SetAlliesObjNum},
{&EV_Initialize, &TOWObjective::OnInitialize },
{&EV_SetCurrent, &TOWObjective::SetCurrent },
{&EV_GetController, &TOWObjective::GetController },
{NULL, NULL }
};
TOWObjective::TOWObjective()
{
m_eController = CONTROLLER_DRAW;
m_eLeadingController = CONTROLLER_DRAW;
m_bNoRespawnForLeading = false;
m_iAxisObjNum = 1;
m_iAlliesObjNum = 1;
m_sAxisObjName = "default";
m_sAlliesObjName = "default";
if (spawnflags & TOWOBJECTIVE_SPAWNFLAG_NO_RESPAWN) {
m_bNoRespawnForLeading = true;
}
PostEvent(EV_Initialize, 0.001f);
}
void TOWObjective::SetController(Event *ev)
{
m_eController = static_cast<eController>(ev->GetInteger(1));
if (m_bNoRespawnForLeading) {
m_eLeadingController = m_eController;
}
if (m_eController != CONTROLLER_ALLIES && m_eController != CONTROLLER_AXIS) {
m_eController = CONTROLLER_DRAW;
}
}
void TOWObjective::GetController(Event *ev)
{
ev->AddInteger(m_eController);
}
void TOWObjective::TakeOver(Event *ev)
{
eController controller = static_cast<eController>(ev->GetInteger(1));
if (controller == m_eController || controller == CONTROLLER_DRAW) {
return;
}
switch (controller) {
case CONTROLLER_ALLIES:
gi.cvar_set(m_sAxisObjName.c_str(), "1");
gi.cvar_set(m_sAlliesObjName.c_str(), "0");
break;
case CONTROLLER_AXIS:
gi.cvar_set(m_sAxisObjName.c_str(), "0");
gi.cvar_set(m_sAlliesObjName.c_str(), "1");
break;
default:
break;
}
g_TOWObjectiveMan.TakeOverObjective(m_eController, controller);
m_eController = controller;
if (m_bNoRespawnForLeading) {
//
// Disable team respawn for the leading team
//
dmManager.StopTeamRespawn(m_eLeadingController);
}
}
void TOWObjective::SetAlliesObjNum(Event *ev)
{
m_iAlliesObjNum = ev->GetInteger(1);
}
void TOWObjective::SetAxisObjNum(Event *ev)
{
m_iAxisObjNum = ev->GetInteger(1);
}
void TOWObjective::OnInitialize(Event *ev)
{
m_sAlliesObjName = "tow_allied_obj" + str(m_iAlliesObjNum);
m_sAxisObjName = "tow_axis_obj" + str(m_iAxisObjNum);
switch (m_eController) {
case CONTROLLER_ALLIES:
gi.cvar_set(m_sAxisObjName.c_str(), "1");
gi.cvar_set(m_sAlliesObjName.c_str(), "0");
break;
case CONTROLLER_AXIS:
gi.cvar_set(m_sAxisObjName.c_str(), "0");
gi.cvar_set(m_sAlliesObjName.c_str(), "1");
break;
case CONTROLLER_DRAW:
gi.cvar_set(m_sAxisObjName.c_str(), "0");
gi.cvar_set(m_sAlliesObjName.c_str(), "0");
break;
}
if (!LoadingSavegame) {
g_TOWObjectiveMan.AddObjective(this);
}
}
void TOWObjective::SetCurrent(Event *ev)
{
eController controller = static_cast<eController>(ev->GetInteger(1));
switch (controller) {
case CONTROLLER_ALLIES:
ScriptThread::SetCurrentObjective(GetObjectiveIndex(), TEAM_ALLIES);
break;
case CONTROLLER_AXIS:
ScriptThread::SetCurrentObjective(GetObjectiveIndex(), TEAM_AXIS);
break;
default:
SetCurrent(ev);
break;
}
}
int TOWObjective::GetController() const
{
return m_eController;
}
void TOWObjective::Archive(Archiver& arc)
{
arc.ArchiveInteger(&m_iAxisObjNum);
arc.ArchiveInteger(&m_iAlliesObjNum);
ArchiveEnum(m_eController, eController);
ArchiveEnum(m_eLeadingController, eController);
arc.ArchiveBool(&m_bNoRespawnForLeading);
arc.ArchiveString(&m_sAxisObjName);
arc.ArchiveString(&m_sAlliesObjName);
}
+73
View File
@@ -0,0 +1,73 @@
/*
===========================================================================
Copyright (C) 2023 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
===========================================================================
*/
#pragma once
#include "Entities.h"
#define TOWOBJECTIVE_SPAWNFLAG_NO_RESPAWN 2
class TOWObjective : public Objective
{
private:
int m_iAxisObjNum;
int m_iAlliesObjNum;
eController m_eController;
eController m_eLeadingController;
bool m_bNoRespawnForLeading;
str m_sAxisObjName;
str m_sAlliesObjName;
public:
CLASS_PROTOTYPE(TOWObjective);
TOWObjective();
void SetController(Event *ev);
void GetController(Event *ev);
void TakeOver(Event *ev);
void SetAlliesObjNum(Event *ev);
void SetAxisObjNum(Event *ev);
void OnInitialize(Event *ev);
void SetCurrent(Event *ev);
int GetController() const;
void Archive(Archiver& arc) override;
};
class TOWObjectiveMan
{
private:
Container<TOWObjective *> m_towObjectives;
int m_iNumAxisObjectives;
int m_iNumAlliesObjectives;
public:
TOWObjectiveMan();
void Reset();
void AddObjective(TOWObjective *objective);
void TakeOverObjective(eController controller, eController controllingTeam);
};
extern TOWObjectiveMan g_TOWObjectiveMan;
+4 -12
View File
@@ -34,7 +34,6 @@ VehicleCollisionEntity::VehicleCollisionEntity
(
Entity *ent
)
{
if( LoadingSavegame )
{
@@ -46,12 +45,11 @@ VehicleCollisionEntity::VehicleCollisionEntity
m_pOwner = ent;
takedamage = DAMAGE_YES;
edict->s.renderfx &= ~RF_DONTDRAW;
edict->r.svFlags &= ~SVF_NOCLIENT;
showModel();
setMoveType( MOVETYPE_PUSH );
setSolidType(SOLID_NOT);
edict->clipmask |= MASK_CLIP;
edict->clipmask |= MASK_VEHICLE;
edict->s.eFlags |= EF_LINKANGLES;
}
@@ -59,7 +57,6 @@ VehicleCollisionEntity::VehicleCollisionEntity
(
void
)
{
if( LoadingSavegame )
{
@@ -73,18 +70,14 @@ void VehicleCollisionEntity::EventDamage
(
Event *ev
)
{
Event *event = new Event( ev );
m_pOwner->ProcessEvent( event );
m_pOwner->ProcessEvent(*ev);
}
void VehicleCollisionEntity::Solid
(
void
)
{
setContents( CONTENTS_SOLID );
setSolidType( SOLID_BSP );
@@ -94,7 +87,6 @@ void VehicleCollisionEntity::NotSolid
(
void
)
{
setSolidType( SOLID_NOT );
}
-1
View File
@@ -51,7 +51,6 @@ void VehicleCollisionEntity::Archive
(
Archiver& arc
)
{
Entity::Archive( arc );
+124 -100
View File
@@ -28,135 +28,159 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cVehicleSlot::cVehicleSlot()
{
prev_takedamage = ( damage_t )-1;
prev_solid = ( solid_t )-1;
prev_contents = -1;
prev_takedamage = (damage_t)-1;
prev_solid = (solid_t)-1;
prev_contents = -1;
}
void cVehicleSlot::NotSolid
(
void
)
void cVehicleSlot::NotSolid(void)
{
if( !( flags & FL_SWIM ) )
{
return;
}
int i;
if( !ent )
{
return;
}
if (!(flags & SLOT_BUSY)) {
return;
}
// Save previous values
prev_takedamage = ent->takedamage;
prev_solid = ent->edict->solid;
prev_contents = ent->edict->r.contents;
ent->takedamage = DAMAGE_NO;
ent->setSolidType( SOLID_NOT );
if (!ent) {
return;
}
// Save previous values
prev_takedamage = ent->takedamage;
prev_solid = ent->edict->solid;
prev_contents = ent->edict->r.contents;
ent->takedamage = DAMAGE_NO;
ent->setSolidType(SOLID_NOT);
for (i = 0; i < ent->numchildren; i++) {
Entity *sub = G_GetEntity(ent->children[i]);
if (sub && !sub->IsSubclassOfWeapon()) {
sub->setSolidType(SOLID_NOT);
}
}
if (!ent->IsSubclassOfPlayer()) {
ent->setSolidType(SOLID_NOT);
}
}
void cVehicleSlot::Solid
(
void
)
void cVehicleSlot::Solid(void)
{
if( !( flags & FL_SWIM ) )
{
return;
}
int i;
if( !ent )
{
return;
}
if (!(flags & FL_SWIM)) {
return;
}
// Restore previous values
ent->takedamage = prev_takedamage;
ent->setSolidType( prev_solid );
ent->edict->r.contents = prev_contents;
if (!ent) {
return;
}
// Save previous values
prev_takedamage = ( damage_t )-1;
prev_solid = ( solid_t )-1;
prev_contents = -1;
// Restore previous values
ent->takedamage = prev_takedamage;
ent->setSolidType(prev_solid);
ent->setContents(prev_contents);
// Save previous values
prev_takedamage = (damage_t)-1;
prev_solid = (solid_t)-1;
prev_contents = -1;
for (i = 0; i < ent->numchildren; i++) {
Entity *sub = G_GetEntity(ent->children[i]);
if (sub && !sub->IsSubclassOfWeapon()) {
sub->setSolidType(SOLID_BBOX);
}
}
}
cTurretSlot::cTurretSlot()
{
owner_prev_takedamage = ( damage_t )-1;
owner_prev_solid = ( solid_t )-1;
owner_prev_contents = -1;
owner_prev_takedamage = (damage_t)-1;
owner_prev_solid = (solid_t)-1;
owner_prev_contents = -1;
}
void cTurretSlot::NotSolid
(
void
)
void cTurretSlot::NotSolid(void)
{
if( !( flags & FL_SWIM ) )
{
return;
}
int i;
if( !ent )
{
return;
}
if (!(flags & FL_SWIM)) {
return;
}
cVehicleSlot::NotSolid();
if (!ent) {
return;
}
if( ent->IsSubclassOfTurretGun() )
{
TurretGun *turret = ( TurretGun * )ent.Pointer();
Entity *owner = turret->GetOwner();
// Save previous values
prev_takedamage = ent->takedamage;
prev_solid = ent->edict->solid;
prev_contents = ent->edict->r.contents;
if( owner )
{
owner_prev_takedamage = owner->takedamage;
owner_prev_solid = owner->edict->solid;
owner_prev_contents = owner->edict->r.contents;
ent->takedamage = DAMAGE_NO;
ent->setSolidType(SOLID_NOT);
owner->takedamage = DAMAGE_NO;
owner->setSolidType( SOLID_NOT );
}
}
if (ent->IsSubclassOfTurretGun()) {
TurretGun *turret = static_cast<TurretGun *>(ent.Pointer());
Entity *owner = turret->GetOwner();
if (owner) {
owner_prev_takedamage = owner->takedamage;
owner_prev_solid = owner->edict->solid;
owner_prev_contents = owner->edict->r.contents;
owner->takedamage = DAMAGE_NO;
owner->setSolidType(SOLID_NOT);
}
}
for (i = 0; i < ent->numchildren; i++) {
Entity *sub = G_GetEntity(ent->children[i]);
if (sub && !sub->IsSubclassOfWeapon()) {
sub->setSolidType(SOLID_NOT);
}
}
}
void cTurretSlot::Solid
(
void
)
void cTurretSlot::Solid(void)
{
if( !( flags & FL_SWIM ) )
{
return;
}
int i;
if( !ent )
{
return;
}
if (!(flags & FL_SWIM)) {
return;
}
cVehicleSlot::NotSolid();
if (!ent) {
return;
}
if( ent->IsSubclassOfTurretGun() )
{
TurretGun *turret = ( TurretGun * )ent.Pointer();
Entity *owner = turret->GetOwner();
// Restore previous values
ent->takedamage = prev_takedamage;
ent->setSolidType(prev_solid);
if( owner )
{
owner->takedamage = owner_prev_takedamage;
owner->setSolidType( owner_prev_solid );
// Save previous values
prev_takedamage = (damage_t)-1;
prev_solid = (solid_t)-1;
owner_prev_takedamage = ( damage_t )-1;
owner_prev_solid = ( solid_t )-1;
}
}
if (ent->IsSubclassOfTurretGun()) {
TurretGun *turret = static_cast<TurretGun *>(ent.Pointer());
Entity *owner = turret->GetOwner();
if (owner) {
owner->takedamage = owner_prev_takedamage;
owner->setSolidType(owner_prev_solid);
owner_prev_takedamage = (damage_t)-1;
owner_prev_solid = (solid_t)-1;
}
}
for (i = 0; i < ent->numchildren; i++) {
Entity *sub = G_GetEntity(ent->children[i]);
if (sub && !sub->IsSubclassOfWeapon()) {
sub->setSolidType(SOLID_BBOX);
}
}
}
+41 -52
View File
@@ -23,80 +23,69 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// VehicleSlot.h
//
#ifndef __VEHICLESLOT_H__
#define __VEHICLESLOT_H__
#pragma once
#include "g_local.h"
#include "class.h"
#include "entity.h"
#define SLOT_FREE 1
#define SLOT_BUSY 2
#define SLOT_UNUSED 4
#define SLOT_FREE 1
#define SLOT_BUSY 2
#define SLOT_UNUSED 4
class cVehicleSlot : public Class {
class cVehicleSlot : public Class
{
public:
SafePtr<Entity> ent;
int flags;
int boneindex;
int enter_boneindex;
SafePtr<Entity> ent;
int flags;
int boneindex;
int enter_boneindex;
private:
damage_t prev_takedamage;
solid_t prev_solid;
int prev_contents;
protected:
damage_t prev_takedamage;
solid_t prev_solid;
int prev_contents;
public:
cVehicleSlot();
cVehicleSlot();
virtual void NotSolid( void );
virtual void Solid( void );
void Archive( Archiver& arc ) override;
virtual void NotSolid(void);
virtual void Solid(void);
void Archive(Archiver &arc) override;
};
inline
void cVehicleSlot::Archive
(
Archiver& arc
)
inline void cVehicleSlot::Archive(Archiver& arc)
{
Class::Archive( arc );
Class::Archive(arc);
arc.ArchiveSafePointer( &ent );
arc.ArchiveInteger( &flags );
arc.ArchiveInteger( &boneindex );
arc.ArchiveInteger( &enter_boneindex );
ArchiveEnum( prev_takedamage, damage_t );
ArchiveEnum( prev_solid, solid_t );
arc.ArchiveInteger( &prev_contents );
arc.ArchiveSafePointer(&ent);
arc.ArchiveInteger(&flags);
arc.ArchiveInteger(&boneindex);
arc.ArchiveInteger(&enter_boneindex);
ArchiveEnum(prev_takedamage, damage_t);
ArchiveEnum(prev_solid, solid_t);
arc.ArchiveInteger(&prev_contents);
}
class cTurretSlot : public cVehicleSlot {
damage_t owner_prev_takedamage;
solid_t owner_prev_solid;
int owner_prev_contents;
class cTurretSlot : public cVehicleSlot
{
damage_t owner_prev_takedamage;
solid_t owner_prev_solid;
int owner_prev_contents;
public:
cTurretSlot();
cTurretSlot();
void NotSolid( void ) override;
void Solid( void ) override;
void Archive( Archiver& arc ) override;
void NotSolid(void) override;
void Solid(void) override;
void Archive(Archiver& arc) override;
};
inline
void cTurretSlot::Archive
(
Archiver& arc
)
inline void cTurretSlot::Archive(Archiver& arc)
{
cVehicleSlot::Archive( arc );
cVehicleSlot::Archive(arc);
ArchiveEnum( owner_prev_takedamage, damage_t );
ArchiveEnum( owner_prev_solid, solid_t );
arc.ArchiveInteger( &owner_prev_contents );
ArchiveEnum(owner_prev_takedamage, damage_t);
ArchiveEnum(owner_prev_solid, solid_t);
arc.ArchiveInteger(&owner_prev_contents);
}
#endif // __VEHICLESLOT_H__
-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 );
+494 -74
View File
@@ -23,127 +23,547 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vehicle.h"
#include "vehicleturret.h"
#include "player.h"
#include "g_phys.h"
CLASS_DECLARATION(DrivableVehicle, VehicleTank, "VehicleTank")
{
{ &EV_Damage, &VehicleTank::EventDamage },
{ NULL, NULL }
CLASS_DECLARATION(DrivableVehicle, VehicleTank, "VehicleTank") {
{&EV_Damage, &VehicleTank::EventDamage},
{NULL, NULL }
};
VehicleTank::VehicleTank()
{
entflags |= FL_ROTATEDBOUNDS;
entflags |= FL_ROTATEDBOUNDS;
}
VehicleTank::~VehicleTank()
{
entflags &= ~FL_ROTATEDBOUNDS;
entflags &= ~FL_ROTATEDBOUNDS;
}
qboolean VehicleTank::Drive(usercmd_t *ucmd)
{
Vector i;
Vector j;
Vector k;
Vector vTmp;
Vector i;
Vector j;
Vector k;
Vector vTmp;
vTmp = velocity;
VectorNormalize(vTmp);
vTmp = velocity;
vTmp.normalize();
if (!driver.ent || !driver.ent->client)
{
return qfalse;
}
if (!driver.ent || !driver.ent->isClient()) {
return qfalse;
}
if (!drivable)
{
driver.ent->client->ps.pm_flags |= PMF_FROZEN;
ucmd->forwardmove = 0;
ucmd->rightmove = 0;
ucmd->upmove = 0;
return qfalse;
}
if (!drivable) {
driver.ent->client->ps.pm_flags |= PMF_FROZEN;
ucmd->forwardmove = 0;
ucmd->rightmove = 0;
ucmd->upmove = 0;
return qfalse;
}
moveimpulse = ucmd->forwardmove * (vTmp.length() + 1.0);
m_bIsBraking = ucmd->forwardmove >> 31;
if (!m_bAutoPilot) {
//
// ignore client's control if the vehicle is in auto-pilot mode
//
moveimpulse = ucmd->forwardmove * (vTmp.length() + 1.0);
m_bIsBraking = ucmd->forwardmove < 0;
m_fAccelerator += ucmd->forwardmove * 0.005;
// acceleration must be an alpha value between [0, 1]
m_fAccelerator = Q_clamp_float(m_fAccelerator, 0, 1);
m_fAccelerator += ucmd->forwardmove * 0.005;
turnimpulse = -ucmd->rightmove;
jumpimpulse = ucmd->upmove;
}
if (m_fAccelerator < 0)
{
m_fAccelerator = 0.0;
}
VehicleTurretGun *vtg = (VehicleTurretGun *)Turrets[0].ent.Pointer();
turnimpulse = -ucmd->rightmove;
if (vtg && vtg->IsSubclassOfVehicleTurretGun() && driver.ent->IsSubclassOfSentient()) {
vtg->RemoteControl(ucmd, (Sentient *)driver.ent.Pointer());
VehicleTurretGun *vtg = (VehicleTurretGun *)Turrets[0].ent.Pointer();
if (vtg && vtg->IsSubclassOfVehicleTurretGun() && driver.ent->IsSubclassOfSentient())
{
vtg->RemoteControl(ucmd, (Sentient *)driver.ent.Pointer());
if (ucmd->upmove)
turnimpulse -= AngleSubtract(angles[1], vtg->angles[1]);
}
return qtrue;
if (ucmd->upmove) {
turnimpulse -= AngleSubtract(angles[1], vtg->angles[1]);
}
}
return qtrue;
}
void VehicleTank::EventDamage(Event *ev)
{
int mod;
mod = ev->GetInteger(9);
int mod;
mod = ev->GetInteger(9);
if (mod > MOD_VEHICLE && mod != MOD_SHOTGUN && mod != MOD_GRENADE)
{
Vehicle::EventDamage(ev);
if (g_gametype->integer == GT_SINGLE_PLAYER)
{
Player *p = (Player *)driver.ent.Pointer();
if (p)
{
if (p->IsSubclassOfPlayer())
{
p->m_iNumHitsTaken++;
}
}
}
}
if (g_gametype->integer == GT_TOW && !dmManager.RoundActive()) {
return;
}
switch (mod) {
case MOD_BULLET:
case MOD_BASH:
case MOD_FAST_BULLET:
case MOD_VEHICLE:
case MOD_SHOTGUN:
case MOD_GRENADE:
return;
}
Vehicle::EventDamage(ev);
if (g_gametype->integer == GT_SINGLE_PLAYER) {
Player *p = (Player *)driver.ent.Pointer();
if (p) {
if (p->IsSubclassOfPlayer()) {
p->m_iNumHitsTaken++;
}
}
}
}
void VehicleTank::Think()
{
flags |= FL_POSTTHINK;
flags |= FL_POSTTHINK;
}
void VehicleTank::Postthink()
{
// FIXME: STUB
float turn;
Vector i, j, k;
Vector normalsum;
Vector temp;
Vector pitch, roll;
Vector acceleration;
Vector atmp, atmp2, aup;
VehicleBase *v, *last;
float drivespeed;
Vector primal_angles, primal_origin;
Vector vTmp;
Vector vAddedAngles;
Vector n_angles;
float dot;
Vector newvel, flatvel;
Vector anglediff;
primal_angles = angles;
primal_origin = origin;
if (!g_vehicle->integer || edict->s.renderfx & RF_DONTDRAW) {
// don't process physics
return;
}
if (m_pCollisionEntity) {
// use the collision entity for collision
setSolidType(SOLID_NOT);
m_pCollisionEntity->Solid();
}
prev_velocity = velocity;
SetSlotsNonSolid();
if (m_bAnimMove) {
AnimMoveVehicle();
} else {
if (!m_bMovementLocked) {
FactorOutAnglesOffset();
FactorOutOriginOffset();
}
MoveVehicle();
}
SetSlotsSolid();
if (m_vOldMins != vec_zero && m_vOldMaxs != vec_zero) {
mins = m_vOldMins;
maxs = m_vOldMaxs;
} else if (mins != vec_zero && maxs != vec_zero) {
m_vOldMins = mins;
m_vOldMaxs = maxs;
}
if (m_bAnimMove) {
moveimpulse = velocity.length() * level.frametime;
turnimpulse = avelocity[1] * level.frametime;
} else if (m_bAutoPilot) {
AutoPilot();
}
currentspeed = moveimpulse;
turnangle = turnangle * 0.25 + turnimpulse;
turnangle = Q_clamp_float(turnangle, -maxturnrate, maxturnrate);
real_velocity = origin - prev_origin;
prev_origin = origin;
prev_acceleration = real_acceleration;
real_acceleration = real_velocity - prev_velocity;
prev_velocity = real_velocity;
acceleration = real_acceleration - prev_acceleration;
UpdateBones();
UpdateShaderOffset();
UpdateTires();
UpdateNormals();
temp = angles;
temp.AngleVectorsLeft(&i, &j, &k);
velocity[0] *= 0.925f;
velocity[1] *= 0.925f;
turn = turnangle / 200.0;
flatvel = orientation[0];
velocity += flatvel * currentspeed;
flatvel[2] = 0;
dot = velocity * flatvel;
dot = Q_clamp_float(dot, -speed, speed);
newvel = flatvel * dot;
velocity[0] = newvel[0];
velocity[1] = newvel[1];
avelocity *= 0.05f;
if (dot < 350) {
dot = 350;
}
avelocity.y += turn * dot;
angles += avelocity * level.frametime;
setAngles(angles);
if (Turrets[0].ent && Turrets[0].ent->IsSubclassOfVehicleTurretGun() && driver.ent
&& driver.ent->IsSubclassOfSentient()) {
VehicleTurretGun *pTurret = static_cast<VehicleTurretGun *>(Turrets[0].ent.Pointer());
if (jumpimpulse != 0) {
pTurret->SetUserViewAngles(pTurret->GetUserViewAngles() - Vector(0, avelocity[1] * level.frametime, 0));
}
}
drivespeed = acceleration * orientation[0];
UpdateSound();
if (AssertRotation(angles, primal_angles) != true) {
angles = primal_angles;
}
CalculateAnglesOffset(acceleration);
CalculateOriginOffset();
last_origin = origin;
anglediff = (angles - primal_angles) * level.frametime;
if (anglediff.x > 180 || anglediff.x < -180) anglediff.x = 0;
if (anglediff.y > 180 || anglediff.y < -180) anglediff.y = 0;
if (anglediff.z > 180 || anglediff.z < -180) anglediff.z = 0;
if (anglediff.x > -1 || anglediff.x < 1) anglediff.x = 0;
if (anglediff.y > -1 || anglediff.y < 1) anglediff.y = 0;
if (anglediff.z > -1 || anglediff.z < 1) anglediff.z = 0;
avelocity = anglediff;
if (!m_bAnimMove && !m_bMovementLocked) {
FactorInOriginOffset();
FactorInAnglesOffset(&vAddedAngles);
}
CalculateAnimationData(vAddedAngles, m_vOriginOffset + m_vOriginOffset2);
if (m_pCollisionEntity) {
Vector vaDelta;
SetSlotsNonSolid();
vaDelta[0] = angledist(angles[0] - m_pCollisionEntity->angles[0]);
vaDelta[1] = angledist(angles[1] - m_pCollisionEntity->angles[1]);
vaDelta[2] = angledist(angles[2] - m_pCollisionEntity->angles[2]);
m_pCollisionEntity->Solid();
G_PushMove(m_pCollisionEntity, origin - primal_origin, vaDelta);
G_TouchTriggers(m_pCollisionEntity);
SetSlotsSolid();
m_pCollisionEntity->setOrigin(origin);
m_pCollisionEntity->setAngles(angles);
}
SetupVehicleSoundEntities();
i = orientation[0];
j = orientation[1];
k = orientation[2];
//
// update slots
//
for (int ii = 0; ii < MAX_PASSENGERS; ii++) {
UpdatePassengerSlot(ii);
}
for (int ii = 0; ii < MAX_TURRETS; ii++) {
UpdateTurretSlot(ii);
}
for (last = this; last->vlink; last = v) {
v = last->vlink;
v->setOrigin(origin + i * v->offset.x + j * v->offset.y + k * v->offset.z);
v->avelocity = avelocity;
v->velocity = velocity;
v->angles[ROLL] = angles[ROLL];
v->angles[YAW] = angles[YAW];
v->angles[PITCH] = (int)(drivespeed / 4.f + v->angles[PITCH]) % 360;
v->setAngles(v->angles);
}
CheckWater();
WorldEffects();
if (m_pCollisionEntity) {
setSolidType(SOLID_NOT);
m_pCollisionEntity->Solid();
} else {
setSolidType(SOLID_BBOX);
setContents(CONTENTS_UNKNOWN2);
}
if ((driver.flags & SLOT_BUSY) && driver.ent) {
if (driver.ent->IsSubclassOfPlayer()) {
driver.ent->takedamage = DAMAGE_YES;
// Fixed in OPM.
// It's probably a mistake in moh 2.0 and above,
// the tank was non-solid with a player driver,
// instead of the driver being non-solid.
//setSolidType(SOLID_NOT);
driver.ent->setSolidType(SOLID_NOT);
} else {
driver.ent->takedamage = DAMAGE_NO;
driver.ent->setSolidType(SOLID_NOT);
}
}
}
void VehicleTank::CalculateOriginOffset()
{
// FIXME: STUB
int index;
Vector vTireAvg;
Vector vMissHit;
Vector temp;
int iNum = 0;
Vector acceleration;
Vector oldoffset;
oldoffset = m_vOriginOffset;
m_vOriginOffset += m_vOriginOffset2;
m_vOriginOffset2 = vec_zero;
for (index = 0; index < NUM_VEHICLE_TIRES; index++) {
if (m_bTireHit[index]) {
vTireAvg += origin - m_vTireEnd[index];
iNum++;
} else {
vMissHit = Corners[index];
}
}
if (m_iNumNormals > 0 && iNum == NUM_VEHICLE_TIRES - 1) {
Vector point;
temp = m_vNormalSum * (1.f / m_iNumNormals);
temp.normalize();
ProjectPointOnPlane(point, vMissHit, temp);
vTireAvg += point;
iNum++;
}
if (iNum == NUM_VEHICLE_TIRES) {
vec3_t vOriginCornerOffset;
vTireAvg *= 1.f / NUM_VEHICLE_TIRES;
MatrixTransformVector(m_vOriginCornerOffset, orientation, vOriginCornerOffset);
vTireAvg -= vOriginCornerOffset;
m_vOriginOffset2 += vTireAvg;
}
//m_vOriginOffset2 += vec_zero;
m_vOriginOffset -= m_vOriginOffset2;
if (!isfinite(m_vOriginOffset[0]) || !isfinite(m_vOriginOffset[1]) || !isfinite(m_vOriginOffset[2])) {
m_vOriginOffset = oldoffset;
}
}
void VehicleTank::UpdateSound()
{
// FIXME: STUB
float pitch = 1.f;
float volume = 1.f;
if (level.time < m_fNextSoundState) {
return;
}
pitch = (velocity.length() - m_fSoundMinSpeed) / (m_fSoundMaxSpeed - m_fSoundMinSpeed);
pitch = Q_clamp_float(pitch, 0, 1);
pitch = (m_fSoundMaxPitch - m_fSoundMinPitch) * pitch + m_fSoundMinPitch;
volume = (velocity.length() - m_fVolumeMinSpeed) / (m_fVolumeMaxSpeed - m_fVolumeMinSpeed);
volume = Q_clamp_float(volume, 0, 1);
volume = (m_fVolumeMaxPitch - m_fVolumeMinPitch) * volume + m_fVolumeMinPitch;
if (level.intermissiontime) {
m_eSoundState = ST_OFF;
}
switch (m_eSoundState) {
case ST_OFF:
StopLoopSound();
TurnOffVehicleSoundEntities();
m_fNextSoundState = level.time;
if (driver.ent || m_bAutoPilot) {
m_eSoundState = ST_OFF_TRANS_IDLE;
}
break;
case ST_OFF_TRANS_IDLE:
m_fNextSoundState = level.time;
m_eSoundState = ST_IDLE;
Sound(m_sSoundSet + "snd_on", CHAN_AUTO);
LoopSound(m_sSoundSet + "snd_idle");
break;
case ST_IDLE_TRANS_OFF:
m_fNextSoundState = level.time;
m_eSoundState = ST_OFF;
Sound(m_sSoundSet + "snd_off", CHAN_AUTO);
StopLoopSound();
break;
case ST_IDLE:
m_fNextSoundState = level.time;
if (driver.ent || m_bAutoPilot) {
if (fabs(velocity * orientation[0]) > 150) {
m_eSoundState = ST_IDLE_TRANS_RUN;
} else if (fabs(turnimpulse) > 1) {
m_eSoundState = ST_IDLE_TRANS_TURN;
}
} else {
m_eSoundState = ST_IDLE_TRANS_OFF;
}
LoopSound(m_sSoundSet + "snd_idle");
TurnOffVehicleSoundEntities();
break;
case ST_IDLE_TRANS_RUN:
m_fNextSoundState = level.time;
m_eSoundState = ST_RUN;
Sound(m_sSoundSet + "snd_revup", CHAN_AUTO);
Sound(m_sSoundSet + "snd_shift", CHAN_AUTO);
LoopSound(m_sSoundSet + "snd_run", volume, -1, -1, pitch);
break;
case ST_RUN:
m_fNextSoundState = level.time;
if (fabs(velocity * orientation[0]) < 150) {
m_eSoundState = ST_RUN_TRANS_IDLE;
}
TurnOnVehicleSoundEntities();
LoopSound(m_sSoundSet + "snd_run", volume, -1, -1, pitch);
break;
case ST_RUN_TRANS_IDLE:
m_fNextSoundState = level.time;
m_eSoundState = ST_IDLE;
Sound(m_sSoundSet + "snd_revdown", CHAN_AUTO);
LoopSound(m_sSoundSet + "snd_idle");
break;
case ST_IDLE_TRANS_TURN:
m_fNextSoundState = level.time;
m_eSoundState = ST_TURN;
Sound(m_sSoundSet + "snd_revup", CHAN_AUTO);
Sound(m_sSoundSet + "snd_shift", CHAN_AUTO);
LoopSound(m_sSoundSet + "snd_run", volume, -1, -1, pitch);
break;
case ST_TURN:
m_fNextSoundState = level.time;
if (fabs(turnimpulse) < 1) {
m_eSoundState = ST_TURN_TRANS_IDLE;
}
LoopSound(m_sSoundSet + "snd_run", volume, -1, -1, pitch);
break;
case ST_TURN_TRANS_IDLE:
m_fNextSoundState = level.time;
m_eSoundState = ST_IDLE;
Sound(m_sSoundSet + "snd_revdown", CHAN_AUTO);
LoopSound(m_sSoundSet + "snd_idle");
break;
default:
m_fNextSoundState = level.time;
m_eSoundState = ST_OFF;
break;
}
}
void VehicleTank::AttachDriverSlot(Event* ev)
//
// Fixed in OPM:
// This method only work when called from script.
// But it is not called automatically when the player actually uses the vehicle
// when that vehicle is unlocked.
// So the other native method is overriden instead
/*
void VehicleTank::AttachDriverSlot(Event *ev)
{
Vehicle::AttachDriverSlot(ev);
Vehicle::AttachDriverSlot(ev);
VehicleTurretGun *vtg = (VehicleTurretGun *)Turrets[0].ent.Pointer();
if (!driver.ent) {
//
// Added in OPM.
// original mohaa doesn't check if driver.ent is valid, which can cause crash if the attached entity is null.
// on single-player, it would crash while loading m5l2a when sv_maxclients is above 1.
// The reason of the crash is that attachdriverslot is called with $player which can be NULL on prespawn.
// $player is not created on prespawn when sv_maxclients is above 1
//
return;
}
if (vtg && vtg->IsSubclassOfVehicleTurretGun() && driver.ent->IsSubclassOfSentient())
{
vtg->SetOwner((Sentient *)driver.ent.Pointer());
Think();
Postthink();
vtg->Think();
}
VehicleTurretGun *vtg = (VehicleTurretGun *)Turrets[0].ent.Pointer();
if (vtg && vtg->IsSubclassOfVehicleTurretGun() && driver.ent->IsSubclassOfSentient()) {
vtg->SetRemoteOwner(static_cast<Sentient *>(driver.ent.Pointer()));
Think();
Postthink();
vtg->Think();
}
}
*/
void VehicleTank::AttachDriverSlot(int slot, Entity* ent, Vector vExitPosition)
{
Vehicle::AttachDriverSlot(slot, ent, vExitPosition);
if (!driver.ent) {
//
// Added in OPM.
// original mohaa doesn't check if driver.ent is valid, which can cause crash if the attached entity is null.
// on single-player, it would crash while loading m5l2a when sv_maxclients is above 1.
// The reason of the crash is that attachdriverslot is called with $player which can be NULL on prespawn.
// $player is not created on prespawn when sv_maxclients is above 1
//
return;
}
VehicleTurretGun* vtg = static_cast<VehicleTurretGun*>(Turrets[0].ent.Pointer());
if (vtg && vtg->IsSubclassOfVehicleTurretGun() && driver.ent->IsSubclassOfSentient()) {
vtg->SetRemoteOwner(static_cast<Sentient*>(driver.ent.Pointer()));
Think();
Postthink();
vtg->Think();
}
}
void VehicleTank::DriverAdded()
{
int i;
for (i = 0; i < MAX_TURRETS; i++) {
if (Turrets[i].flags & SLOT_BUSY && Turrets[i].ent && Turrets[i].ent->IsSubclassOfVehicleTurretGun()) {
VehicleTurretGun *pTurret = static_cast<VehicleTurretGun *>(Turrets[i].ent.Pointer());
pTurret->TurretHasBeenMounted();
}
}
}
+641 -38
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2018 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -22,64 +22,667 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vehicle.h"
#include "player.h"
#include "debuglines.h"
#include "g_phys.h"
CLASS_DECLARATION(DrivableVehicle, VehicleWheelsX2, "VehicleWheelsX2")
{
{ &EV_Damage, &VehicleWheelsX2::EventDamage },
{ &EV_Killed, &VehicleWheelsX2::Killed },
{ NULL, NULL }
CLASS_DECLARATION(DrivableVehicle, VehicleWheelsX2, "VehicleWheelsX2") {
{&EV_Damage, &VehicleWheelsX2::EventDamage},
{&EV_Killed, &VehicleWheelsX2::Killed },
{NULL, NULL }
};
VehicleWheelsX2::VehicleWheelsX2()
{
m_iGear = 1;
m_iRPM = 0;
gravity = 1.0;
m_fDifferentialRatio = 4.8800001f;
m_fGearEfficiency = 0.69999999f;
m_fGearRatio[0] = -2.9400001f;
m_fGearRatio[1] = 2.9400001f;
m_fGearRatio[2] = 1.9400001f;
m_fGearRatio[3] = 1.0f;
m_fAccelerator = 0.0f;
m_bAutomatic = qtrue;
m_bBackSlipping = qfalse;
m_bFrontSlipping = qfalse;
gravity = 1.0;
m_fDifferentialRatio = 4.88f;
m_fGearEfficiency = 0.7f;
m_fGearRatio[0] = -2.95f;
m_fGearRatio[1] = 2.95f;
m_fGearRatio[2] = 1.95f;
m_fGearRatio[3] = 1.0f;
m_iGear = 1;
m_iRPM = 0;
m_fAccelerator = 0.0f;
m_bAutomatic = qtrue;
m_bBackSlipping = qfalse;
m_bFrontSlipping = qfalse;
}
void VehicleWheelsX2::UpdateVariables(Vector *acceleration, Vector *vpn, Vector *vup, Vector *vright, Vector *t_vpn, Vector *t_vup, Vector *t_vright)
void VehicleWheelsX2::Killed(Event *ev)
{
// FIXME: STUB
deadflag = DEAD_DEAD;
}
float VehicleWheelsX2::TorqueLookup(int rpm)
{
if (rpm <= 2099)
return 100.0;
if (rpm > 3599)
return 0.0;
return (100 * (3600 - rpm)) * 0.001;
if (rpm < 2100) {
return 100.0;
} else if (rpm >= 3600) {
return 0.0;
} else {
return (100 * (3600 - rpm)) / 1000.f;
}
}
void VehicleWheelsX2::UpdateVariables(
Vector *acceleration, Vector *vpn, Vector *vup, Vector *vright, Vector *t_vpn, Vector *t_vup, Vector *t_vright
)
{
int i;
Vector vNewCG;
Vector vBoxSize;
float longspeed;
Vector _i, _j, _k;
Vector r_i, r_j, r_k;
Vector r_velocity;
float dots[4];
r_velocity = velocity;
m_bIsSkidding = false;
vBoxSize = maxs - mins;
SetControllerAngles(0, Vector(0, turnangle, 0));
SetControllerAngles(1, Vector(0, turnangle, 0));
vNewCG = localorigin;
if (vNewCG != m_vCG) {
m_vCG = vNewCG;
vNewCG -= localorigin;
m_fWheelBase = vBoxSize.x;
m_fWheelFrontDist = vBoxSize.x * 0.5 - vNewCG.x;
m_fWheelBackDist = vBoxSize.x * -0.5 + vNewCG.x;
m_fTrackWidth = vBoxSize.y;
}
Vector vNewVpn = angles;
vNewVpn.AngleVectorsLeft(&r_i, &r_j, &r_k);
vNewVpn.y += turnangle;
vNewVpn.AngleVectorsLeft(&_i, &_j, &_k);
dots[3] = r_velocity * *vpn * 0.02;
dots[2] = r_velocity * *vright * 0.02;
dots[1] = r_velocity * *t_vpn * 0.02;
dots[0] = r_velocity * *t_vright * 0.02;
m_sWheels[0].fTraction = 0.8f;
m_sWheels[1].fTraction = 0.9f;
m_sWheels[0].fYawOffset = 0;
m_sWheels[1].fYawOffset = DEG2RAD(turnangle);
m_sWheels[0].fLongDist = m_fWheelBackDist * 0.02;
m_sWheels[1].fLongDist = m_fWheelFrontDist * 0.02;
m_sWheels[0].fLatDist = m_fTrackWidth * -0.02;
m_sWheels[1].fLatDist = m_fTrackWidth * 0.02;
// initialize the wheels
for (i = 0; i < 2; i++) {
m_sWheels[i].fLongForce = 0;
m_sWheels[i].fForce = 0;
m_sWheels[i].vLongForce = vec_zero;
m_sWheels[i].vLatForce = vec_zero;
m_sWheels[i].vForce = vec_zero;
m_sWheels[i].vVelocity = vec_zero;
m_sWheels[i].bSkidding = false;
m_sWheels[i].bSpinning = false;
m_sWheels[i].fTorque = 0;
m_sWheels[i].fLatTorque = 0;
m_sWheels[i].fLongTorque = 0;
}
for (i = 0; i < 2; i++) {
Vector p1, p3, p4;
Vector vTp, vTr, vTu;
vec3_t p2;
p3 = Corners[i];
p3.normalize();
vectoangles(p3, p2);
p1 = vec_zero;
p1[1] = angles[1] + p2[1] + 90;
p1.AngleVectorsLeft(&vTp, &vTr, &vTu);
m_sWheels[i].vVelocity = vTp * RAD2DEG(m_vAngularVelocity.y) * fabs(m_sWheels[i].fLongDist) * level.frametime;
G_LineWidth(5.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vVelocity * 50,
0.7f,
0.5f,
1.0f,
1.0f
);
p1 = vec_zero;
p1[1] = angles[1] + RAD2DEG(m_sWheels[i].fYawOffset);
p1.AngleVectorsLeft(&vTp, &vTr, &vTu);
m_sWheels[i].vOrientation = vTp;
G_LineWidth(5.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vOrientation * 50,
0.7f,
0.0f,
1.0f,
1.0f
);
}
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
trace_t trace;
start = origin + *vpn * (m_vCG[0] - localorigin[0]) + *vright * (m_vCG[1] - localorigin[1])
+ *vup * (m_vCG[2] - localorigin[2]);
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, t_mins, t_maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
m_fInertia = m_fMass * 100;
m_fWheelFrontLoad = m_fMass * 9.81 * fabs(m_fWheelFrontDist / m_fWheelBase);
m_fWheelBackLoad = m_fMass * 9.81 * fabs(m_fWheelBackDist / m_fWheelBase);
longspeed = m_vAcceleration.length() * 0.02 * m_fMass / m_fWheelBase;
m_fWheelFrontLoad -= longspeed;
m_fWheelBackLoad += longspeed;
m_sWheels[0].fLoad = m_fWheelBackLoad;
m_sWheels[1].fLoad = m_fWheelFrontLoad;
float fMassShifted = m_fTireRadius * M_PI;
m_fTireRotationalSpeed = dots[3] / (fMassShifted + fMassShifted);
m_iRPM = m_fTireRotationalSpeed * m_fGearRatio[m_iGear] * m_fDifferentialRatio * 10;
m_fMaxTraction =
TorqueLookup(m_iRPM) * m_fGearRatio[m_iGear] * m_fDifferentialRatio * m_fGearEfficiency / m_fTireRadius;
m_fTractionForce = m_fAccelerator * m_fMaxTraction;
if (m_bIsBraking && dots[3] > 0) {
m_fTractionForce = -fSign(dots[3]) * 1000 * dots[3];
}
for (i = 0; i < 2; i++) {
float maxgrip;
maxgrip = m_sWheels[i].fTraction * m_sWheels[i].fLoad * 9.81;
if (m_fTractionForce > maxgrip) {
m_fTractionForce = maxgrip * 0.6;
m_sWheels[i].bSpinning = true;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding!\n");
}
if (m_fTractionForce < -maxgrip) {
m_fTractionForce = -maxgrip * 0.6;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding!\n");
}
m_sWheels[i].fLongForce = this->m_sWheels[i].fLongForce + m_fTractionForce;
m_sWheels[i].vLongForce += m_sWheels[i].vOrientation * m_sWheels[i].fLongForce;
}
m_vResistance[0] =
-(velocity[0] * 0.02 * m_fRollingResistance + velocity[0] * 0.02 * m_fDrag * fabs(velocity[0] * 0.02));
m_vResistance[1] =
-(velocity[1] * 0.02 * m_fRollingResistance + velocity[1] * 0.02 * m_fDrag * fabs(velocity[1] * 0.02));
m_vResistance[2] =
-(velocity[2] * 0.02 * m_fRollingResistance + velocity[2] * 0.02 * m_fDrag * fabs(velocity[2] * 0.02));
m_fBrakingPerformance = -m_fRollingResistance - *vpn * Vector(0, 0, -1) * m_fMass;
if (dots[3] == 0) {
m_fBrakingPerformance = 0;
} else {
m_fBrakingPerformance = (dots[3] - (m_fTireRotationalSpeed * m_fTireRadius - m_fBrakingPerformance)) / dots[3];
m_fBrakingPerformance = (1.0 - m_fBrakingPerformance) * -(-m_fFrontBrakingForce - m_fBackBrakingForce);
}
if (r_velocity.length() * 0.02 > 0.01) {
m_fTangForce = 0;
m_vTangForce = vec_zero;
for (i = 0; i < 2; i++) {
Vector va, vr;
Vector vVel;
Vector v1, v2;
va = angles;
va.x = 0;
va.y += RAD2DEG(m_sWheels[i].fYawOffset);
va.z = 0;
va.AngleVectorsLeft(NULL, &vr, NULL);
vVel = m_sWheels[i].vVelocity + velocity;
// get the direction
v1 = vVel;
v1.normalize();
// get the angles
vectoangles(v1, v2);
m_sWheels[i].fSlipAngle = DEG2RAD(angledist(va.y - v2.y));
m_sWheels[i].fGripCoef = m_sWheels[i].fSlipAngle * 0.15;
m_sWheels[i].fGripCoef = Q_clamp_float(m_sWheels[i].fGripCoef, -1.2f, 1.2f);
m_sWheels[i].fLatForce += m_sWheels[i].fGripCoef * m_sWheels[i].fLoad * 9.81;
if (m_sWheels[i].fLoad * 2 * m_sWheels[i].fTraction < fabs(m_sWheels[i].fLatForce)) {
m_sWheels[i].fLatForce = m_sWheels[i].fLatForce / 9.81;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding %i!\n", i);
}
m_sWheels[i].vLatForce += vr * m_sWheels[i].fLatForce;
G_LineWidth(3.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vLatForce * 50 * (1.0 / m_fMass),
0.7f,
0.5f,
0.2f,
1.0f
);
}
} else {
m_fTangForce = 0;
m_vTangForce = vec_zero;
}
m_vForce = vec_zero;
for (i = 0; i < 2; i++) {
m_sWheels[i].vForce = m_sWheels[i].vLatForce + m_sWheels[i].vLongForce;
m_vForce += m_sWheels[i].vForce;
}
m_vForce += m_vResistance;
G_LineWidth(5.0);
G_DebugLine(origin, origin + m_vTangForce * (1.0 / m_fMass) * 50, 1.0, 0.0, 1.0, 1.0);
m_vAcceleration = m_vForce * (1.0 / m_fMass) * 50;
m_fTorque = 0;
for (i = 0; i < 2; i++) {
m_sWheels[i].fTorque += m_sWheels[i].fLongTorque + m_sWheels[i].fLatTorque;
m_fTorque += m_sWheels[i].fTorque;
}
m_vAngularAcceleration[1] = angledist(RAD2DEG(m_fTorque));
m_vAngularVelocity += m_vAngularAcceleration * level.frametime;
m_vAngularVelocity *= 0.825f;
avelocity = m_vAngularVelocity;
if (m_bAutomatic) {
//
// set the gear
//
if (m_iRPM >= 2100 && m_iGear <= 2) {
m_iGear++;
}
if (m_iRPM <= 600 && m_iGear > 1) {
m_iGear--;
}
}
prev_moveimpulse = moveimpulse;
}
void VehicleWheelsX2::Think()
{
vmove_t vm;
vmove_t vm;
flags |= FL_POSTTHINK;
prev_velocity = velocity;
flags |= FL_POSTTHINK;
prev_velocity = velocity;
SetMoveInfo(&vm);
VmoveSingle(&vm);
GetMoveInfo(&vm);
SetMoveInfo(&vm);
VmoveSingle(&vm);
GetMoveInfo(&vm);
}
void VehicleWheelsX2::Postthink()
{
// FIXME: STUB
}
float turn;
Vector i, j, k;
int index;
trace_t trace;
Vector normalsum;
Vector normalsum_Front;
int numnormals_Front;
Vector normalsum_Back;
int numnormals_Back;
Vector temp;
Vector pitch, roll;
Vector acceleration;
Vector atmp, atmp2, aup;
VehicleBase *v;
VehicleBase *last;
float drivespeed;
Vector primal_angles;
Vector vTmp;
Vector n_angles;
void VehicleWheelsX2::Killed(Event* ev)
{
deadflag = DEAD_DEAD;
}
primal_angles = angles;
if (drivable) {
currentspeed = moveimpulse;
turnangle = turnangle * 0.25f + turnimpulse;
turnangle = Q_clamp_float(turnangle, -maxturnrate, maxturnrate);
if (turnangle > maxturnrate) {
turnangle = maxturnrate;
} else if (turnangle < -maxturnrate) {
turnangle = -maxturnrate;
} else if (fabs(turnangle) < 2) {
turnangle = 0;
}
real_velocity = origin - prev_origin;
prev_origin = origin;
prev_acceleration = real_acceleration;
real_acceleration = real_velocity - prev_velocity;
prev_velocity = real_velocity;
acceleration = real_acceleration - prev_acceleration;
angles[0] = 0;
angles[2] = 0;
temp[0] = angles[0];
temp[1] = angles[1];
temp[2] = angles[2];
temp.AngleVectorsLeft(&i, &j, &k);
j = vec_zero - j;
index = 0;
numnormals_Front = 0;
numnormals_Back = 0;
for (index = 0; index < 4; index++) {
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
boxoffset = Corners[index];
start = origin + i * boxoffset[0] + j * boxoffset[1] + k * boxoffset[2];
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, mins, maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
if (trace.fraction != 1 && !trace.startsolid) {
if (index > 2) {
normalsum_Front += trace.plane.normal;
numnormals_Front++;
} else {
normalsum_Back += trace.plane.normal;
numnormals_Back++;
}
normalsum += trace.plane.normal;
}
}
if (angles[2] < 60 || angles[2] > 300) {
if (numnormals_Front > 1) {
m_vFrontNormal = normalsum_Front * (1.0 / numnormals_Front);
temp = m_vFrontNormal;
m_vFrontAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vFrontAngles[1] = 0;
temp = m_vFrontNormal;
m_vFrontAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
if (numnormals_Back > 1) {
m_vBackNormal = normalsum_Back * (1.0 / numnormals_Back);
temp = m_vBackNormal;
m_vBackAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vBackAngles[1] = 0;
temp = m_vBackNormal;
m_vBackAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
if (numnormals_Front + numnormals_Back > 1) {
m_vBaseNormal = (normalsum_Front + normalsum_Back) * (1.0 / numnormals_Front + numnormals_Back);
temp = m_vBaseNormal;
m_vBaseAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vBaseAngles[1] = 0;
temp = m_vBaseNormal;
m_vBaseAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
}
n_angles = m_vBaseAngles - angles;
n_angles[0] = angledist(n_angles[0]);
n_angles[1] = angledist(n_angles[1]);
n_angles[2] = angledist(n_angles[2]);
angles[0] += n_angles[0] * 4.5 * level.frametime;
angles[2] += n_angles[2] * 4.5 * level.frametime;
m_vPrevNormal = m_vBaseNormal;
if (currentspeed < 0 && velocity * i > 0) {
m_fFrontBrakingForce = 0.2f;
m_fBackBrakingForce = 0.1f;
} else {
m_fFrontBrakingForce = 0;
m_fBackBrakingForce = 0;
}
turn = turnangle * 0.005;
Vector _i, _j, _k;
Vector vNewVpn = angles;
vNewVpn.y += turnangle;
vNewVpn.AngleVectorsLeft(&_i, &_j, &_k);
UpdateVariables(&acceleration, &i, &j, &k, &_i, &_j, &_k);
m_vAngles = angles;
if (currentspeed < 0 && velocity * i > 0) {
currentspeed = 0;
}
normalsum = vec_zero;
for (index = 0; index < 4; index++) {
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
boxoffset = Corners[index];
start = origin + i * boxoffset[0] + j * boxoffset[1] + k * boxoffset[2] + Vector(0, 0, 10);
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, mins, maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
if (trace.fraction != 1.0) {
float fCoef;
if (index > 2) {
fCoef = m_fWheelFrontLoad / (m_fWheelFrontDist / m_fWheelBase * m_fMass);
fCoef = Q_clamp_float(fCoef, 0, 1);
normalsum += _i * currentspeed * fCoef;
normalsum += i * currentspeed * (1.0 - fCoef);
} else {
fCoef = m_fWheelBackLoad / (m_fWheelBackDist / m_fWheelBase * m_fMass);
fCoef = Q_clamp_float(fCoef, 0, 1);
normalsum += i * currentspeed * fCoef;
normalsum += _i * currentspeed * (1.0 - fCoef);
}
}
}
AnglesToAxis(angles, orientation);
vmove_t vm;
SetMoveInfo(&vm);
m_sMoveGrid->SetMoveInfo(&vm);
m_sMoveGrid->SetOrientation(orientation);
if (m_sMoveGrid->CheckStuck()) {
angles = primal_angles;
AnglesToAxis(angles, orientation);
}
if (groundentity && (angles[2] < 60 || angles[2] > 300)) {
float dot;
Vector newvel, flatvel;
velocity[0] *= 0.925f;
velocity[1] *= 0.925f;
newvel = orientation[0];
velocity += newvel * currentspeed;
newvel[2] = 0;
dot = velocity * newvel;
dot = Q_clamp_float(dot, -speed, speed);
if (dot > speed) {
dot = speed;
} else if (dot < -speed) {
dot = -speed;
} else if (fabs(dot) < 20) {
dot = 0;
}
flatvel = newvel * dot;
velocity[0] = flatvel[0];
velocity[1] = flatvel[1];
velocity[2] += jumpimpulse * dot;
avelocity *= 0.05f;
if (steerinplace) {
if (dot < 350) {
dot = 350;
}
avelocity.y += turn * dot;
} else {
avelocity.y += turn * dot;
}
} else {
if (angles[2] > 60) {
angles[2]; // FIXME: ??
}
velocity += m_vAcceleration * level.frametime;
}
angles += avelocity * level.frametime;
setAngles(angles);
prev_origin = origin;
}
drivespeed = acceleration * orientation[0];
if (drivable && driver.ent) {
str sound_name;
if (currentspeed > 0) {
sound_name = "snd_forward";
} else if (currentspeed == 0) {
sound_name = "snd_idle";
} else {
sound_name = "snd_backward";
}
LoopSound(sound_name);
}
i = orientation[0];
j = orientation[1];
k = orientation[2];
if (driver.ent) {
driver.ent->setOrigin(origin + i * driveroffset[0] + j * driveroffset[1] + k * driveroffset[2]);
if (drivable) {
// clear the driver velocity
driver.ent->velocity = vec_zero;
// set the driver angles to the vehicle's angle
driver.ent->setAngles(angles);
}
}
vTmp = (angles - primal_angles) * level.frametime;
if (vTmp.x > 180 || vTmp.x < -180) {
vTmp.x = 0;
}
if (vTmp.y > 180 || vTmp.y < -180) {
vTmp.y = 0;
}
if (vTmp.z > 180 || vTmp.z < -180) {
vTmp.z = 0;
}
if (vTmp.x > -1 || vTmp.x < 1) {
vTmp.x = 0;
}
if (vTmp.y > -1 || vTmp.y < 1) {
vTmp.y = 0;
}
if (vTmp.z > -1 || vTmp.z < 1) {
vTmp.z = 0;
}
avelocity = vTmp;
for (last = this; last->vlink; last = v) {
v = last->vlink;
v->setOrigin(origin + i * v->offset.x + j * v->offset.y + k * v->offset.z);
v->avelocity = avelocity;
v->velocity = velocity;
v->angles[ROLL] = angles[ROLL];
v->angles[YAW] = angles[YAW];
v->angles[PITCH] = (int)(drivespeed / 4.f + v->angles[PITCH]) % 360;
v->setAngles(v->angles);
}
CheckWater();
WorldEffects();
last_origin = origin;
if (!driver.ent && !velocity.length() && groundentity && !(watertype & CONTENTS_LAVA)) {
// make the vehicle stationary if it's completely immobile
flags &= ~FL_POSTTHINK;
if (drivable) {
setMoveType(MOVETYPE_STATIONARY);
}
}
}
+653 -42
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2018 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -22,69 +22,680 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vehicle.h"
#include "player.h"
#include "debuglines.h"
#include "g_phys.h"
CLASS_DECLARATION(DrivableVehicle, VehicleWheelsX4, "VehicleWheelsX4")
{
{ &EV_Damage, &VehicleWheelsX4::EventDamage },
{ &EV_Killed, &VehicleWheelsX4::Killed },
{ NULL, NULL }
CLASS_DECLARATION(DrivableVehicle, VehicleWheelsX4, "VehicleWheelsX4") {
{&EV_Damage, &VehicleWheelsX4::EventDamage},
{&EV_Killed, &VehicleWheelsX4::Killed },
{NULL, NULL }
};
VehicleWheelsX4::VehicleWheelsX4()
{
m_iGear = 1;
m_iRPM = 0;
gravity = 1.0;
m_fDifferentialRatio = 4.8800001f;
m_fGearEfficiency = 0.69999999f;
m_fGearRatio[0] = -2.9400001f;
m_fGearRatio[1] = 2.9400001f;
m_fGearRatio[2] = 1.9400001f;
m_fGearRatio[3] = 1.0f;
m_fAccelerator = 0.0f;
m_bBackSlipping = qfalse;
m_bAutomatic = qtrue;
m_bFrontSlipping = qfalse;
gravity = 1.0;
m_fDifferentialRatio = 4.88f;
m_fGearEfficiency = 0.7f;
m_fGearRatio[0] = -2.95f;
m_fGearRatio[1] = 2.95f;
m_fGearRatio[2] = 1.95f;
m_fGearRatio[3] = 1.0f;
m_iGear = 1;
m_iRPM = 0;
m_fAccelerator = 0.0f;
m_bAutomatic = qtrue;
m_bBackSlipping = qfalse;
m_bFrontSlipping = qfalse;
}
void VehicleWheelsX4::UpdateVariables(Vector *acceleration, Vector *vpn, Vector *vup, Vector *vright, Vector *t_vpn, Vector *t_vup, Vector *t_vright)
void VehicleWheelsX4::UpdateVariables(
Vector *acceleration, Vector *vpn, Vector *vup, Vector *vright, Vector *t_vpn, Vector *t_vup, Vector *t_vright
)
{
// FIXME: STUB
int i;
Vector vNewCG;
Vector vBoxSize;
float longspeed;
Vector _i, _j, _k;
Vector r_i, r_j, r_k;
Vector r_velocity;
float dots[4];
r_velocity = velocity;
m_bIsSkidding = false;
vBoxSize = maxs - mins;
SetControllerAngles(0, Vector(0, turnangle, 0));
SetControllerAngles(1, Vector(0, turnangle, 0));
vNewCG = localorigin;
if (vNewCG != m_vCG) {
m_vCG = vNewCG;
vNewCG -= localorigin;
m_fWheelBase = vBoxSize.x;
m_fWheelFrontDist = vBoxSize.x * 0.5 - vNewCG.x;
m_fWheelBackDist = vBoxSize.x * -0.5 + vNewCG.x;
m_fTrackWidth = vBoxSize.y;
}
Vector vNewVpn = angles;
vNewVpn.AngleVectorsLeft(&r_i, &r_j, &r_k);
vNewVpn.y += turnangle;
vNewVpn.AngleVectorsLeft(&_i, &_j, &_k);
dots[3] = r_velocity * *vpn * 0.02;
dots[2] = r_velocity * *vright * 0.02;
dots[1] = r_velocity * *t_vpn * 0.02;
dots[0] = r_velocity * *t_vright * 0.02;
m_sWheels[0].fTraction = 0.8f;
m_sWheels[1].fTraction = 0.9f;
m_sWheels[2].fTraction = 0.8f;
m_sWheels[3].fTraction = 0.9f;
m_sWheels[0].fYawOffset = 0;
m_sWheels[1].fYawOffset = DEG2RAD(turnangle);
m_sWheels[2].fYawOffset = 0;
m_sWheels[3].fYawOffset = DEG2RAD(turnangle);
m_sWheels[0].fLongDist = m_fWheelBackDist * 0.02;
m_sWheels[1].fLongDist = m_fWheelFrontDist * 0.02;
m_sWheels[2].fLongDist = m_fWheelBackDist * 0.02;
m_sWheels[3].fLongDist = m_fWheelFrontDist * 0.02;
m_sWheels[0].fLatDist = m_fTrackWidth * 0.5 * -0.02;
m_sWheels[1].fLatDist = m_fTrackWidth * 0.5 * 0.02;
m_sWheels[2].fLatDist = m_fTrackWidth * 0.5 * -0.02;
m_sWheels[3].fLatDist = m_fTrackWidth * 0.5 * 0.02;
// initialize the wheels
for (i = 0; i < 4; i++) {
m_sWheels[i].fLongForce = 0;
m_sWheels[i].fForce = 0;
m_sWheels[i].vLongForce = vec_zero;
m_sWheels[i].vLatForce = vec_zero;
m_sWheels[i].vForce = vec_zero;
m_sWheels[i].vVelocity = vec_zero;
m_sWheels[i].bSkidding = false;
m_sWheels[i].bSpinning = false;
m_sWheels[i].fTorque = 0;
m_sWheels[i].fLatTorque = 0;
m_sWheels[i].fLongTorque = 0;
}
for (i = 0; i < 4; i++) {
Vector p1, p3, p4;
Vector vTp, vTr, vTu;
vec3_t p2;
p3 = Corners[i];
p3.normalize();
vectoangles(p3, p2);
p1 = vec_zero;
p1[1] = angles[1] + p2[1] + 90;
p1.AngleVectorsLeft(&vTp, &vTr, &vTu);
m_sWheels[i].vVelocity = vTp * RAD2DEG(m_vAngularVelocity.y) * fabs(m_sWheels[i].fLongDist) * level.frametime;
G_LineWidth(5.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vVelocity * 50,
0.7f,
0.5f,
1.0f,
1.0f
);
p1 = vec_zero;
p1[1] = angles[1] + RAD2DEG(m_sWheels[i].fYawOffset);
p1.AngleVectorsLeft(&vTp, &vTr, &vTu);
m_sWheels[i].vOrientation = vTp;
G_LineWidth(5.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vOrientation * 50,
0.7f,
0.0f,
1.0f,
1.0f
);
}
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
trace_t trace;
start = origin + *vpn * (m_vCG[0] - localorigin[0]) + *vright * (m_vCG[1] - localorigin[1])
+ *vup * (m_vCG[2] - localorigin[2]);
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, t_mins, t_maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
m_fInertia = m_fMass * 100;
m_fWheelFrontLoad = m_fMass * 9.81 * fabs(m_fWheelFrontDist / m_fWheelBase);
m_fWheelBackLoad = m_fMass * 9.81 * fabs(m_fWheelBackDist / m_fWheelBase);
longspeed = m_vAcceleration.length() * 0.02 * m_fMass / m_fWheelBase;
m_fWheelFrontLoad -= longspeed;
m_fWheelBackLoad += longspeed;
m_sWheels[0].fLoad = m_fWheelBackLoad / 2.0;
m_sWheels[1].fLoad = m_fWheelBackLoad / 2.0;
m_sWheels[2].fLoad = m_fWheelFrontLoad / 2.0;
m_sWheels[3].fLoad = m_fWheelFrontLoad / 2.0;
float fMassShifted = m_fTireRadius * M_PI;
m_fTireRotationalSpeed = dots[3] / (fMassShifted + fMassShifted);
m_iRPM = m_fTireRotationalSpeed * m_fGearRatio[m_iGear] * m_fDifferentialRatio * 10;
m_fMaxTraction =
TorqueLookup(m_iRPM) * m_fGearRatio[m_iGear] * m_fDifferentialRatio * m_fGearEfficiency / m_fTireRadius;
m_fTractionForce = m_fAccelerator * m_fMaxTraction;
if (m_bIsBraking && dots[3] > 0) {
m_fTractionForce = -fSign(dots[3]) * 1000 * dots[3];
}
for (i = 0; i < 4; i++) {
float maxgrip;
maxgrip = m_sWheels[i].fTraction * m_sWheels[i].fLoad * 9.81;
if (m_fTractionForce > maxgrip) {
m_fTractionForce = maxgrip * 0.6;
m_sWheels[i].bSpinning = true;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding!\n");
}
if (m_fTractionForce < -maxgrip) {
m_fTractionForce = -maxgrip * 0.6;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding!\n");
}
m_sWheels[i].fLongForce = this->m_sWheels[i].fLongForce + m_fTractionForce;
m_sWheels[i].vLongForce += m_sWheels[i].vOrientation * m_sWheels[i].fLongForce;
}
m_vResistance[0] =
-(velocity[0] * 0.02 * m_fRollingResistance + velocity[0] * 0.02 * m_fDrag * fabs(velocity[0] * 0.02));
m_vResistance[1] =
-(velocity[1] * 0.02 * m_fRollingResistance + velocity[1] * 0.02 * m_fDrag * fabs(velocity[1] * 0.02));
m_vResistance[2] =
-(velocity[2] * 0.02 * m_fRollingResistance + velocity[2] * 0.02 * m_fDrag * fabs(velocity[2] * 0.02));
m_fBrakingPerformance = -m_fRollingResistance - *vpn * Vector(0, 0, -1) * m_fMass;
if (dots[3] == 0) {
m_fBrakingPerformance = 0;
} else {
m_fBrakingPerformance = (dots[3] - (m_fTireRotationalSpeed * m_fTireRadius - m_fBrakingPerformance)) / dots[3];
m_fBrakingPerformance = (1.0 - m_fBrakingPerformance) * -(-m_fFrontBrakingForce - m_fBackBrakingForce);
}
if (r_velocity.length() * 0.02 > 0.01) {
m_fTangForce = 0;
m_vTangForce = vec_zero;
for (i = 0; i < 2; i++) {
Vector va, vr;
Vector vVel;
Vector v1, v2;
va = angles;
va.x = 0;
va.y += RAD2DEG(m_sWheels[i].fYawOffset);
va.z = 0;
va.AngleVectorsLeft(NULL, &vr, NULL);
vVel = m_sWheels[i].vVelocity + velocity;
// get the direction
v1 = vVel;
v1.normalize();
// get the angles
vectoangles(v1, v2);
m_sWheels[i].fSlipAngle = DEG2RAD(angledist(va.y - v2.y));
m_sWheels[i].fGripCoef = m_sWheels[i].fSlipAngle * 0.15;
m_sWheels[i].fGripCoef = Q_clamp_float(m_sWheels[i].fGripCoef, -1.2f, 1.2f);
m_sWheels[i].fLatForce += m_sWheels[i].fGripCoef * m_sWheels[i].fLoad * 9.81;
if (m_sWheels[i].fLoad * 2 * m_sWheels[i].fTraction < fabs(m_sWheels[i].fLatForce)) {
m_sWheels[i].fLatForce = m_sWheels[i].fLatForce / 9.81;
m_sWheels[i].bSkidding = true;
Com_Printf("Skidding %i!\n", i);
}
m_sWheels[i].vLatForce += vr * m_sWheels[i].fLatForce;
G_LineWidth(3.0);
G_DebugLine(
origin + Corners[i][0] * r_i + Corners[i][1] * r_j,
origin + Corners[i][0] * r_i + Corners[i][1] * r_j + m_sWheels[i].vLatForce * 50 * (1.0 / m_fMass),
0.7f,
0.5f,
0.2f,
1.0f
);
}
} else {
m_fTangForce = 0;
m_vTangForce = vec_zero;
}
m_vForce = vec_zero;
for (i = 0; i < 4; i++) {
m_sWheels[i].vForce = m_sWheels[i].vLatForce + m_sWheels[i].vLongForce;
m_vForce += m_sWheels[i].vForce;
}
m_vForce += m_vResistance;
G_LineWidth(5.0);
G_DebugLine(origin, origin + m_vTangForce * (1.0 / m_fMass) * 50, 1.0, 0.0, 1.0, 1.0);
m_vAcceleration = m_vForce * (1.0 / m_fMass) * 50;
m_fTorque = 0;
for (i = 0; i < 4; i++) {
m_sWheels[i].fTorque += m_sWheels[i].fLongTorque + m_sWheels[i].fLatTorque;
m_fTorque += m_sWheels[i].fTorque;
}
m_vAngularAcceleration[1] = angledist(RAD2DEG(m_fTorque));
m_vAngularVelocity += m_vAngularAcceleration * level.frametime;
m_vAngularVelocity *= 0.825f;
avelocity = m_vAngularVelocity;
if (m_bAutomatic) {
//
// set the gear
//
if (m_iRPM >= 2100 && m_iGear <= 2) {
m_iGear++;
}
if (m_iRPM <= 600 && m_iGear > 1) {
m_iGear--;
}
}
prev_moveimpulse = moveimpulse;
}
void VehicleWheelsX4::Killed(Event *ev)
{
deadflag = DEAD_DEAD;
}
float VehicleWheelsX4::TorqueLookup(int rpm)
{
if (rpm <= 2099)
return 20.0;
if (rpm > 3599)
return 0.0;
return (20 * (3600 - rpm)) * 0.001;
if (rpm <= 2099) {
return 20.0;
}
if (rpm > 3599) {
return 0.0;
}
return (20 * (3600 - rpm)) * 0.001;
}
void VehicleWheelsX4::Think()
{
vmove_t vm;
flags |= FL_POSTTHINK;
prev_velocity = velocity;
vmove_t vm;
flags |= FL_POSTTHINK;
angles -= m_vAnglesOffset;
origin -= m_vOriginOffset;
prev_velocity = velocity;
mins = m_vOldMins;
maxs = m_vOldMaxs;
angles -= m_vAnglesOffset;
origin -= m_vOriginOffset;
SetMoveInfo(&vm);
VmoveSingle(&vm);
GetMoveInfo(&vm);
mins = m_vOldMins;
maxs = m_vOldMaxs;
SetMoveInfo(&vm);
VmoveSingle(&vm);
GetMoveInfo(&vm);
}
void VehicleWheelsX4::Postthink()
{
// FIXME: STUB
}
float turn;
Vector i, j, k;
int index;
trace_t trace;
Vector normalsum;
Vector normalsum_Front;
int numnormals_Front;
Vector normalsum_Back;
int numnormals_Back;
Vector temp;
Vector pitch, roll;
Vector acceleration;
Vector atmp, atmp2, aup;
VehicleBase *v;
VehicleBase *last;
float drivespeed;
Vector primal_angles;
Vector vTmp;
Vector n_angles;
void VehicleWheelsX4::Killed(Event* ev)
{
deadflag = DEAD_DEAD;
primal_angles = angles;
if (drivable) {
if (m_bAutoPilot) {
AutoPilot();
} else {
moveimpulse *= 0.825f;
turnimpulse *= 0.825f;
}
currentspeed = moveimpulse;
turnangle = turnangle * 0.25f + turnimpulse;
turnangle = Q_clamp_float(turnangle, -maxturnrate, maxturnrate);
if (turnangle > maxturnrate) {
turnangle = maxturnrate;
} else if (turnangle < -maxturnrate) {
turnangle = -maxturnrate;
} else if (fabs(turnangle) < 2) {
turnangle = 0;
}
real_velocity = origin - prev_origin;
prev_origin = origin;
prev_acceleration = real_acceleration;
real_acceleration = real_velocity - prev_velocity;
prev_velocity = real_velocity;
acceleration = real_acceleration - prev_acceleration;
angles[0] = 0;
angles[2] = 0;
temp[0] = angles[0];
temp[1] = angles[1];
temp[2] = angles[2];
temp.AngleVectorsLeft(&i, &j, &k);
j = vec_zero - j;
index = 0;
numnormals_Front = 0;
numnormals_Back = 0;
for (index = 0; index < 4; index++) {
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
boxoffset = Corners[index];
start = origin + i * boxoffset[0] + j * boxoffset[1] + k * boxoffset[2];
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, mins, maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
if (trace.fraction != 1 && !trace.startsolid) {
if (index > 2) {
normalsum_Front += trace.plane.normal;
numnormals_Front++;
} else {
normalsum_Back += trace.plane.normal;
numnormals_Back++;
}
normalsum += trace.plane.normal;
}
}
if (angles[2] < 60 || angles[2] > 300) {
if (numnormals_Front > 1) {
m_vFrontNormal = normalsum_Front * (1.0 / numnormals_Front);
temp = m_vFrontNormal;
m_vFrontAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vFrontAngles[1] = 0;
temp = m_vFrontNormal;
m_vFrontAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
if (numnormals_Back > 1) {
m_vBackNormal = normalsum_Back * (1.0 / numnormals_Back);
temp = m_vBackNormal;
m_vBackAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vBackAngles[1] = 0;
temp = m_vBackNormal;
m_vBackAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
if (numnormals_Front + numnormals_Back > 1) {
m_vBaseNormal = (normalsum_Front + normalsum_Back) * (1.0 / numnormals_Front + numnormals_Back);
temp = m_vBaseNormal;
m_vBaseAngles[0] = -temp.CrossProduct(temp, j).toPitch();
// no yaw
m_vBaseAngles[1] = 0;
temp = m_vBaseNormal;
m_vBaseAngles[2] = temp.CrossProduct(temp, i).toPitch();
}
}
n_angles = m_vBaseAngles - angles;
n_angles[0] = angledist(n_angles[0]);
n_angles[1] = angledist(n_angles[1]);
n_angles[2] = angledist(n_angles[2]);
angles[0] += n_angles[0] * 4.5 * level.frametime;
angles[2] += n_angles[2] * 4.5 * level.frametime;
m_vPrevNormal = m_vBaseNormal;
if (currentspeed < 0 && velocity * i > 0) {
m_fFrontBrakingForce = 0.2f;
m_fBackBrakingForce = 0.1f;
} else {
m_fFrontBrakingForce = 0;
m_fBackBrakingForce = 0;
}
turn = turnangle * 0.005;
Vector _i, _j, _k;
Vector vNewVpn = angles;
vNewVpn.y += turnangle;
vNewVpn.AngleVectorsLeft(&_i, &_j, &_k);
UpdateVariables(&acceleration, &i, &j, &k, &_i, &_j, &_k);
m_vAngles = angles;
if (currentspeed < 0 && velocity * i > 0) {
currentspeed = 0;
}
normalsum = vec_zero;
for (index = 0; index < 4; index++) {
Vector start, end;
Vector boxoffset;
Vector t_mins(-8, -8, -8);
Vector t_maxs(8, 8, 8);
boxoffset = Corners[index];
start = origin + i * boxoffset[0] + j * boxoffset[1] + k * boxoffset[2] + Vector(0, 0, 10);
end = start;
end[2] -= maxtracedist;
trace = G_Trace(start, mins, maxs, end, this, MASK_SOLID, qfalse, "Vehicle::PostThink Corners");
if (trace.fraction != 1.0) {
float fCoef;
if (index > 2) {
fCoef = m_fWheelFrontLoad / (m_fWheelFrontDist / m_fWheelBase * m_fMass);
fCoef = Q_clamp_float(fCoef, 0, 1);
normalsum += _i * currentspeed * fCoef;
normalsum += i * currentspeed * (1.0 - fCoef);
} else {
fCoef = m_fWheelBackLoad / (m_fWheelBackDist / m_fWheelBase * m_fMass);
fCoef = Q_clamp_float(fCoef, 0, 1);
normalsum += i * currentspeed * fCoef;
normalsum += _i * currentspeed * (1.0 - fCoef);
}
}
}
AnglesToAxis(angles, orientation);
vmove_t vm;
SetMoveInfo(&vm);
m_sMoveGrid->SetMoveInfo(&vm);
m_sMoveGrid->SetOrientation(orientation);
if (m_sMoveGrid->CheckStuck()) {
angles = primal_angles;
AnglesToAxis(angles, orientation);
}
m_fForwardForce = acceleration * i * 0.1;
m_fBackForce += -m_vAnglesOffset[0] * m_fBouncyCoef;
m_fBackForce *= m_fSpringyCoef;
m_vAnglesOffset[0] += m_fForwardForce + m_fBackForce * 12.0 * level.frametime;
m_vAnglesOffset[0] = Q_clamp_float(m_vAnglesOffset[0], m_fYawMin, m_fYawMax);
m_fLeftForce += acceleration * j * 0.1;
m_fRightForce += -m_vAnglesOffset[2] * m_fBouncyCoef;
m_fRightForce *= m_fSpringyCoef;
m_vAnglesOffset[2] += (m_fLeftForce + m_fRightForce) * 12.0 * level.frametime;
m_vAnglesOffset[2] = Q_clamp_float(m_vAnglesOffset[2], m_fRollMin, m_fRollMax);
m_fDownForce = acceleration[2];
m_fUpForce += -m_vOriginOffset[2] * m_fBouncyCoef;
m_fUpForce *= m_fSpringyCoef;
m_vAnglesOffset[2] += (m_fDownForce + m_fUpForce) * 12.0 * level.frametime;
m_vAnglesOffset[2] = Q_clamp_float(m_vAnglesOffset[2], m_fZMin, m_fZMax);
if (groundentity && (angles[2] < 60 || angles[2] > 300)) {
velocity += m_vAcceleration * level.frametime;
} else {
if (angles[2] > 60) {
angles[2]; // FIXME: ??
}
velocity += m_vAcceleration * level.frametime;
}
angles += avelocity * level.frametime;
setAngles(angles);
prev_origin = origin;
}
drivespeed = acceleration * orientation[0];
if (drivable && driver.ent) {
str sound_name;
if (currentspeed > 0) {
sound_name = "snd_forward";
} else if (currentspeed == 0) {
sound_name = "snd_idle";
} else {
sound_name = "snd_backward";
}
LoopSound(sound_name);
}
i = orientation[0];
j = orientation[1];
k = orientation[2];
last_origin = origin;
vTmp = (angles - primal_angles) * level.frametime;
if (vTmp.x > 180 || vTmp.x < -180) {
vTmp.x = 0;
}
if (vTmp.y > 180 || vTmp.y < -180) {
vTmp.y = 0;
}
if (vTmp.z > 180 || vTmp.z < -180) {
vTmp.z = 0;
}
if (vTmp.x > -1 || vTmp.x < 1) {
vTmp.x = 0;
}
if (vTmp.y > -1 || vTmp.y < 1) {
vTmp.y = 0;
}
if (vTmp.z > -1 || vTmp.z < 1) {
vTmp.z = 0;
}
avelocity = vTmp;
origin += m_vOriginOffset;
setOrigin(origin);
angles += m_vAnglesOffset;
setAngles(angles);
if (driver.ent) {
driver.ent->setOrigin(origin + i * driveroffset[0] + j * driveroffset[1] + k * driveroffset[2]);
if (drivable) {
// clear the driver velocity
driver.ent->velocity = vec_zero;
// set the driver angles to the vehicle's angle
driver.ent->setAngles(angles);
}
}
for (last = this; last->vlink; last = v) {
v = last->vlink;
v->setOrigin(origin + i * v->offset.x + j * v->offset.y + k * v->offset.z);
v->avelocity = avelocity;
v->velocity = velocity;
v->angles[ROLL] = angles[ROLL];
v->angles[YAW] = angles[YAW];
v->angles[PITCH] = (int)(drivespeed / 4.f + v->angles[PITCH]) % 360;
v->setAngles(v->angles);
}
CheckWater();
WorldEffects();
if (!driver.ent && !velocity.length() && groundentity && !(watertype & CONTENTS_LAVA)) {
// make the vehicle stationary if it's completely immobile
flags &= ~FL_POSTTHINK;
if (drivable) {
setMoveType(MOVETYPE_STATIONARY);
}
}
}
+10937 -14248
View File
File diff suppressed because it is too large. Load diff
+2015 -1371
View File
File diff suppressed because it is too large. Load diff
+35 -49
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -24,56 +24,42 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "actor.h"
void Actor::InitAim
(
GlobalFuncs_t *func
)
void Actor::InitAim(GlobalFuncs_t *func)
{
func->BeginState = &Actor::Begin_Aim;
func->ThinkState = &Actor::Think_Aim;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Idle;
func->ShowInfo = &Actor::ShowInfo_Aim;
func->IsState = &Actor::IsIdleState;
}
void Actor::Begin_Aim
(
void
)
{
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
ClearPath();
}
void Actor::Think_Aim
(
void
)
{
if( !RequireThink() )
return;
UpdateEyeOrigin();
NoPoint();
m_pszDebugState = "";
Anim_Aim();
if( m_aimNode )
{
AimAtAimNode();
}
CheckForThinkStateTransition();
PostThink( true );
func->BeginState = &Actor::Begin_Aim;
func->ThinkState = &Actor::Think_Aim;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Idle;
func->ShowInfo = &Actor::ShowInfo_Aim;
func->IsState = &Actor::IsIdleState;
}
void Actor::ShowInfo_Aim
(
void
)
void Actor::Begin_Aim(void)
{
ShowInfo_AimNode();
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
ClearPath();
}
void Actor::Think_Aim(void)
{
if (!RequireThink()) {
return;
}
UpdateEyeOrigin();
NoPoint();
m_pszDebugState = "";
Anim_Aim();
if (m_aimNode) {
AimAtAimNode();
}
CheckForThinkStateTransition();
PostThink(true);
}
void Actor::ShowInfo_Aim(void)
{
ShowInfo_AimNode();
}
+73 -118
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -24,151 +24,106 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "actor.h"
void Actor::InitAlarm
(
GlobalFuncs_t *func
)
void Actor::InitAlarm(GlobalFuncs_t *func)
{
func->BeginState = &Actor::Begin_Alarm;
func->EndState = &Actor::End_Alarm;
func->ThinkState = &Actor::Think_Alarm;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Attack;
func->IsState = &Actor::IsAttackState;
func->BeginState = &Actor::Begin_Alarm;
func->EndState = &Actor::End_Alarm;
func->ThinkState = &Actor::Think_Alarm;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Attack;
func->IsState = &Actor::IsAttackState;
}
void Actor::Begin_Alarm
(
void
)
void Actor::Begin_Alarm(void)
{
DoForceActivate();
DoForceActivate();
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
m_csMood = STRING_ALERT;
m_csIdleMood = STRING_NERVOUS;
if( m_AlarmNode )
{
SetPath( m_AlarmNode, "Actor::Begin_Alarm", 0 );
if (!m_AlarmNode) {
State_Alarm_StartThread();
return;
}
if( PathExists() )
{
TransitionState(601, 0);
}
else
{
TransitionState(600, 0);
parm.movefail = true;
}
}
else
{
SetLeashHome( origin );
TransitionState(600, 0);
m_AlarmThread.Execute( this );
}
SetPath(m_AlarmNode, "Actor::Begin_Alarm", 0);
if (PathExists()) {
TransitionState(ACTOR_STATE_ALARM_MOVE, 0);
} else {
TransitionState(ACTOR_STATE_ALARM_IDLE, 0);
parm.movefail = true;
}
}
void Actor::End_Alarm
(
void
)
void Actor::End_Alarm(void)
{
parm.movefail = true;
parm.movefail = true;
}
void Actor::State_Alarm_StartThread
(
void
)
void Actor::State_Alarm_StartThread(void)
{
if( m_AlarmNode )
SetLeashHome( m_AlarmNode->origin );
else
SetLeashHome( origin );
SetLeashHome(m_AlarmNode ? m_AlarmNode->origin : origin);
// Added in 2.30.
// Execute the pre-alarm thread
m_PreAlarmThread.Execute(this);
TransitionState(600, 0);
m_AlarmThread.Execute();
TransitionState(ACTOR_STATE_ALARM_IDLE, 0);
m_AlarmThread.Execute(this);
}
void Actor::State_Alarm_Move
(
void
)
void Actor::State_Alarm_Move(void)
{
if( PathExists() )
{
if( PathComplete() )
{
Anim_Aim();
AimAtTargetPos();
}
else
{
Anim_RunToAlarm( 2 );
FaceMotion();
}
}
else
{
TransitionState(600, 0);
parm.movefail = true;
if (!PathExists()) {
TransitionState(ACTOR_STATE_ALARM_IDLE, 0);
parm.movefail = true;
Anim_Aim();
AimAtTargetPos();
}
Anim_Aim();
AimAtTargetPos();
} else if (PathComplete()) {
Anim_Aim();
AimAtTargetPos();
State_Alarm_StartThread();
} else {
Anim_RunToAlarm(ANIM_MODE_PATH);
FaceMotion();
}
}
void Actor::State_Alarm_Idle
(
void
)
void Actor::State_Alarm_Idle(void)
{
AimAtTargetPos();
SetThink(THINKSTATE_ATTACK, THINK_TURRET);
Anim_Aim();
AimAtTargetPos();
SetThink(THINKSTATE_ATTACK, THINK_TURRET);
}
void Actor::Think_Alarm
(
void
)
void Actor::Think_Alarm(void)
{
if( !RequireThink() )
return;
if (!RequireThink()) {
return;
}
parm.movefail = false;
parm.movefail = false;
UpdateEyeOrigin();
NoPoint();
UpdateEyeOrigin();
NoPoint();
if( m_State == 600 )
{
m_pszDebugState = "idle";
State_Alarm_Idle();
}
else if( m_State == 601 )
{
m_pszDebugState = "move";
State_Alarm_Move();
}
else
{
Com_Printf( "Actor::Think_Alarm: invalid think state %i\n", m_State );
}
switch (m_State) {
case ACTOR_STATE_ALARM_IDLE:
m_pszDebugState = "idle";
State_Alarm_Idle();
break;
case ACTOR_STATE_ALARM_MOVE:
m_pszDebugState = "move";
State_Alarm_Move();
break;
default:
Com_Printf("Actor::Think_Alarm: invalid think state %i\n", m_State);
break;
}
}
void Actor::FinishedAnimation_Alarm
(
void
)
void Actor::FinishedAnimation_Alarm(void)
{
// not needed
return;
// not needed
return;
}
+48 -68
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -24,86 +24,66 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "actor.h"
void Actor::InitAnim
(
GlobalFuncs_t *func
)
void Actor::InitAnim(GlobalFuncs_t *func)
{
func->ThinkState = &Actor::Think_Anim;
func->BeginState = &Actor::Begin_Anim;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Idle;
func->FinishedAnimation = &Actor::FinishedAnimation_Anim;
func->ShowInfo = &Actor::ShowInfo_Anim;
func->IsState = &Actor::IsIdleState;
func->ThinkState = &Actor::Think_Anim;
func->BeginState = &Actor::Begin_Anim;
func->PassesTransitionConditions = &Actor::PassesTransitionConditions_Idle;
func->FinishedAnimation = &Actor::FinishedAnimation_Anim;
func->ShowInfo = &Actor::ShowInfo_Anim;
func->IsState = &Actor::IsIdleState;
}
void Actor::Begin_Anim
(
void
)
void Actor::Begin_Anim(void)
{
m_csMood = m_csIdleMood;
ClearPath();
StopTurning();
TransitionState(1000, 0);
m_csMood = m_csIdleMood;
ClearPath();
StopTurning();
TransitionState(ACTOR_STATE_ANIMATION_INITIAL, 0);
}
void Actor::Think_Anim
(
void
)
void Actor::Think_Anim(void)
{
if (RequireThink())
{
UpdateEyeOrigin();
IdlePoint();
IdleLook();
if (m_State == 1000)
{
m_bNextForceStart = true;
if (!RequireThink()) {
return;
}
m_bAnimScriptSet = false;
m_pszDebugState = "initial";
TransitionState(1001, 0);
}
else if (m_State == 1001)
{
m_bNextForceStart = false;
m_pszDebugState = "main";
}
m_eNextAnimMode = m_AnimMode;
m_csNextAnimString = m_csAnimScript;
UpdateEyeOrigin();
IdlePoint();
IdleLook();
CheckForThinkStateTransition();
IdleTurn();
PostThink(false);
}
if (m_State == ACTOR_STATE_ANIMATION_INITIAL) {
m_pszDebugState = "initial";
m_bAnimScriptSet = false;
StartAnimation(m_AnimMode, m_csAnimScript);
TransitionState(ACTOR_STATE_ANIMATION_MAIN, 0);
} else if (m_State == ACTOR_STATE_ANIMATION_MAIN) {
m_bNextForceStart = false;
m_pszDebugState = "main";
DesiredAnimation(m_AnimMode, m_csAnimScript);
}
CheckForThinkStateTransition();
IdleTurn();
PostThink(false);
}
void Actor::FinishedAnimation_Anim
(
void
)
void Actor::FinishedAnimation_Anim(void)
{
if (!m_bAnimScriptSet)
{
if (m_bNoIdleAfterAnim)
m_csAnimScript = STRING_ANIM_CONTINUE_LAST_ANIM_SCR;
else
SetThinkIdle(THINK_IDLE);
Unregister(STRING_ANIMDONE);
}
if (m_bAnimScriptSet) {
return;
}
if (m_bNoIdleAfterAnim) {
m_csAnimScript = STRING_ANIM_CONTINUE_LAST_ANIM_SCR;
} else {
SetThinkIdle(THINK_IDLE);
}
Unregister(STRING_ANIMDONE);
}
void Actor::ShowInfo_Anim
(
void
)
void Actor::ShowInfo_Anim(void)
{
Com_Printf("anim script: %s, anim mode %d\n", Director.GetString(m_csAnimScript).c_str(), m_AnimMode);
Com_Printf("anim script: %s, anim mode %d\n", Director.GetString(m_csAnimScript).c_str(), m_AnimMode);
}
+103 -223
View File
@@ -1,6 +1,6 @@
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
Copyright (C) 2023 the OpenMoHAA team
This file is part of OpenMoHAA source code.
@@ -23,321 +23,201 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// actor_animapi.cpp: Base actor animation script
#include "actor.h"
#include "scriptthread.h"
const_str SimpleActor::GetRunAnim
(
void
)
const_str SimpleActor::GetRunAnim(void)
{
if( m_csCurrentPosition != STRING_PRONE && ( m_csCurrentPosition < STRING_PRONE || m_csCurrentPosition > STRING_CROUCHRUN ) )
return STRING_ANIM_RUN_SCR;
else
return STRING_ANIM_CROUCH_RUN_SCR;
if (m_csCurrentPosition == STRING_PRONE) {
return STRING_ANIM_CROUCH_RUN_SCR;
}
if (m_csCurrentPosition >= STRING_PRONE && m_csCurrentPosition <= STRING_CROUCHRUN && m_csCurrentPosition >= STRING_CROUCH) {
return STRING_ANIM_CROUCH_RUN_SCR;
} else {
return STRING_ANIM_RUN_SCR;
}
}
const_str SimpleActor::GetWalkAnim
(
void
)
const_str SimpleActor::GetWalkAnim(void)
{
if( m_csCurrentPosition != STRING_PRONE && ( m_csCurrentPosition < STRING_PRONE || m_csCurrentPosition > STRING_CROUCHRUN ) )
return STRING_ANIM_WALK_SCR;
else
return STRING_ANIM_CROUCH_WALK_SCR;
if (m_csCurrentPosition == STRING_PRONE) {
return STRING_ANIM_CROUCH_WALK_SCR;
}
if (m_csCurrentPosition >= STRING_PRONE && m_csCurrentPosition <= STRING_CROUCHRUN && m_csCurrentPosition >= STRING_CROUCH) {
return STRING_ANIM_CROUCH_WALK_SCR;
} else {
return STRING_ANIM_WALK_SCR;
}
}
void SimpleActor::Anim_Attack
(
void
)
void SimpleActor::Anim_Attack(void)
{
DesiredAnimation(1, m_AttackHandler);
DesiredAnimation(ANIM_MODE_NORMAL, m_AttackHandler);
}
void SimpleActor::Anim_Sniper
(
void
)
void SimpleActor::Anim_Suppress(void)
{
DesiredAnimation(1, m_SniperHandler);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_SUPPRESS_SCR);
}
void SimpleActor::Anim_Aim
(
void
)
void SimpleActor::Anim_Sniper(void)
{
DesiredAnimation(1, STRING_ANIM_AIM_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, m_SniperHandler);
}
void SimpleActor::Anim_Shoot
(
void
)
void SimpleActor::Anim_Aim(void)
{
DesiredAnimation(1, STRING_ANIM_SHOOT_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_AIM_SCR);
}
void SimpleActor::Anim_Idle
(
void
)
void SimpleActor::Anim_Shoot(void)
{
DesiredAnimation(1, STRING_ANIM_IDLE_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_SHOOT_SCR);
}
void SimpleActor::Anim_Crouch
(
void
)
void SimpleActor::Anim_Idle(void)
{
DesiredAnimation(1, STRING_ANIM_CROUCH_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_IDLE_SCR);
}
void SimpleActor::Anim_Prone
(
void
)
void SimpleActor::Anim_Crouch(void)
{
DesiredAnimation(1, STRING_ANIM_PRONE_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_CROUCH_SCR);
}
void SimpleActor::Anim_Stand
(
void
)
void SimpleActor::Anim_Prone(void)
{
DesiredAnimation(1, STRING_ANIM_STAND_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_PRONE_SCR);
}
void SimpleActor::Anim_Cower
(
void
)
void SimpleActor::Anim_Stand(void)
{
DesiredAnimation(1, STRING_ANIM_COWER_SCR);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_STAND_SCR);
}
void SimpleActor::Anim_Killed
(
void
)
void SimpleActor::Anim_Cower(void)
{
Com_Printf("m_eAnimMode Anim_Killed \n");
DesiredAnimation(1, m_DeathHandler);
DesiredAnimation(ANIM_MODE_NORMAL, STRING_ANIM_COWER_SCR);
}
void SimpleActor::Anim_StartPain
(
void
)
void SimpleActor::Anim_Killed(void)
{
Com_Printf("m_eAnimMode Anim_StartPain \n");
StartAnimation(1, m_PainHandler);
DesiredAnimation(ANIM_MODE_NORMAL, m_DeathHandler);
}
void SimpleActor::Anim_Pain
(
void
)
void SimpleActor::Anim_StartPain(void)
{
ContinueAnimation();
StartAnimation(ANIM_MODE_NORMAL, m_PainHandler);
}
void SimpleActor::Anim_CrouchRunTo
(
int eAnimMode
)
void SimpleActor::Anim_Pain(void)
{
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_RUN_SCR);
ContinueAnimation();
}
void SimpleActor::Anim_CrouchWalkTo
(
int eAnimMode
)
void SimpleActor::Anim_CrouchRunTo(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_WALK_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_RUN_SCR);
}
void SimpleActor::Anim_StandRunTo
(
int eAnimMode
)
void SimpleActor::Anim_CrouchWalkTo(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_CROUCH_WALK_SCR);
}
void SimpleActor::Anim_StandWalkTo
(
int eAnimMode
)
void SimpleActor::Anim_StandRunTo(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_WALK_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SCR);
}
void SimpleActor::Anim_RunTo
(
int eAnimMode
)
void SimpleActor::Anim_StandWalkTo(int eAnimMode)
{
DesiredAnimation(eAnimMode, GetRunAnim());
DesiredAnimation(eAnimMode, STRING_ANIM_WALK_SCR);
}
void SimpleActor::Anim_WalkTo
(
int eAnimMode
)
void SimpleActor::Anim_RunTo(int eAnimMode)
{
DesiredAnimation(eAnimMode, GetWalkAnim());
DesiredAnimation(eAnimMode, GetRunAnim());
}
void SimpleActor::Anim_RunAwayFiring
(
int eAnimMode
)
void SimpleActor::Anim_RunAwayFiring(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNAWAYFIRING_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNAWAYFIRING_SCR);
}
void SimpleActor::Anim_RunToShooting
(
int eAnimMode
)
void SimpleActor::Anim_RunToShooting(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SHOOT_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUN_SHOOT_SCR);
}
void SimpleActor::Anim_RunToAlarm
(
int eAnimMode
)
void SimpleActor::Anim_RunToAlarm(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_ALARM_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_ALARM_SCR);
}
void SimpleActor::Anim_RunToCasual
(
int eAnimMode
)
void SimpleActor::Anim_RunToCasual(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_CASUAL_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_CASUAL_SCR);
}
void SimpleActor::Anim_RunToCover
(
int eAnimMode
)
void SimpleActor::Anim_RunToCover(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_COVER_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_COVER_SCR);
}
void SimpleActor::Anim_RunToDanger
(
int eAnimMode
)
void SimpleActor::Anim_RunToDanger(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DANGER_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DANGER_SCR);
}
void SimpleActor::Anim_RunToDive
(
int eAnimMode
)
void SimpleActor::Anim_RunToDive(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DIVE_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_DIVE_SCR);
}
void SimpleActor::Anim_RunToFlee
(
int eAnimMode
)
void SimpleActor::Anim_RunToFlee(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_FLEE_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_FLEE_SCR);
}
void SimpleActor::Anim_RunToInOpen
(
int eAnimMode
)
void SimpleActor::Anim_RunToInOpen(int eAnimMode)
{
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_INOPEN_SCR);
DesiredAnimation(eAnimMode, STRING_ANIM_RUNTO_INOPEN_SCR);
}
void SimpleActor::Anim_Emotion
(
eEmotionMode eEmotMode
)
void SimpleActor::Anim_WalkTo(int eAnimMode)
{
m_eEmotionMode = eEmotMode;
DesiredAnimation(eAnimMode, GetWalkAnim());
}
void SimpleActor::Anim_Say
(
const_str csSayAnimScript,
int iMinTimeSinceLastSay,
bool bCanInterrupt
)
void SimpleActor::Anim_Emotion(eEmotionMode eEmotMode)
{
if (!m_bSayAnimSet || bCanInterrupt)
{
if (level.inttime > m_iVoiceTime + iMinTimeSinceLastSay)
{
ScriptThreadLabel label;
label.TrySetScript(csSayAnimScript);
label.Execute(this);
}
}
m_eEmotionMode = eEmotMode;
}
void SimpleActor::Anim_FullBody
(
const_str csFullBodyAnim,
int eAnimMode
)
void SimpleActor::Anim_Say(const_str csSayAnimScript, int iMinTimeSinceLastSay, bool bCanInterrupt)
{
if( m_csAnimName == csFullBodyAnim )
{
DesiredAnimation(eAnimMode, STRING_ANIM_FULLBODY_SCR);
}
else
{
m_csAnimName = csFullBodyAnim;
StartAnimation(eAnimMode, STRING_ANIM_FULLBODY_SCR);
}
if (m_bSayAnimSet && !bCanInterrupt) {
return;
}
if (level.inttime <= iMinTimeSinceLastSay + m_iVoiceTime) {
return;
}
ScriptThreadLabel label;
label.TrySetScript(csSayAnimScript);
label.Create(this)->Execute();
}
void SimpleActor::Anim_FullBody(const_str csFullBodyAnim, int eAnimMode)
{
if (m_csAnimName == csFullBodyAnim) {
DesiredAnimation(eAnimMode, STRING_ANIM_FULLBODY_SCR);
} else {
m_csAnimName = csFullBodyAnim;
StartAnimation(eAnimMode, STRING_ANIM_FULLBODY_SCR);
}
}
Loaded 100 of 573 files, more files were not shown because too many files have changed in this diff. Show more