Merge in xonotic/xonotic-data.pk3dir.git: mirceakitsune/event_chasecam
git-manager created issue #402 (closed) on 2011-04-10T20:14:28Z:
Purpose of the branch:
Posting another merge request for this feature. Not sure why the old one expired. And AFAIK, this code is ready, except for a small inconvenience that isn't really an issue and can be found and changed later. Samual mentioned approving of it too on IRC.
Repository: xonotic/xonotic-data.pk3dir.git Commit: 56240052 Branch: mirceakitsune/event_chasecam
Merge commands:
cd data/xonotic-data.pk3dir
git checkout master
git reset --hard origin/master
git pull && git diff '562400529261cf9509d6f508d625de4ff0f35f33'..'origin/mirceakitsune/event_chasecam'
git merge --no-ff 'origin/mirceakitsune/event_chasecam'
git push && git push --delete origin 'mirceakitsune/event_chasecam'
Diffstat:
defaultXonotic.cfg | 7 ++++++-
qcsrc/client/View.qc | 41 +++++++++++++++++++++++++++++++++++++++--
qcsrc/client/autocvars.qh | 4 ++++
3 files changed, 49 insertions(+), 3 deletions(-)
Revision log:
commit 562400529261cf9509d6f508d625de4ff0f35f33
Merge: 5dd9cd6 0df96e4
Author: Mircea Kitsune
Commit: Mircea Kitsune
Merge branch 'master' into mirceakitsune/event_chasecam
commit 5dd9cd68d9db68adef7efeee9adf09980dc9677c
Author: Mircea Kitsune
Commit: Mircea Kitsune
Remove useless double cvar checks, and always set chase_active to 0 if it's -1. This should make the code all ready now.
commit d76a2632a8d3edb6d4edf3a88a217f7334131050
Author: Mircea Kitsune
Commit: Mircea Kitsune
Cvar description fix
commit 690d4a24b5843200c654b3b670b8de976f309766
Author: Mircea Kitsune
Commit: Mircea Kitsune
No need to keep eventchase_target_origin a global any more.
commit 22e55f919fcafe1d922c3c9e7be69a6ffab66de9
Author: Mircea Kitsune
Commit: Mircea Kitsune
Rename functions the same way
commit c57d55cfb27abaff0ff26d8f1154412e1ce2562f
Author: Mircea Kitsune
Commit: Mircea Kitsune
More descriptive cvar names
commit 75833b4b1333cccee715d22c2c633c27e8ee02e3
Author: Mircea Kitsune
Commit: Mircea Kitsune
Much better defaults
commit bf2e72e4ef69ebd99af6aef97a895451b65887f8
Author: Mircea Kitsune
Commit: Mircea Kitsune
No need to stop updating the view origin while in the map voting screen. As long as the view *angles* are blocked there, the camera won't move while using the mouse in map voting.
commit 121d8572afcb63d04345258d52fecc205265bfbf
Author: Mircea Kitsune
Commit: Mircea Kitsune
Fix some comments
commit 525aa9731df8e7a35ac766a91d46e169550b4603
Author: Mircea Kitsune
Commit: Mircea Kitsune
Many code comments
commit 37bece06e371506e4b4d24dce0ab06508db85475
Author: Mircea Kitsune
Commit: Mircea Kitsune
Decrease trace_fraction by 0.1 to avoid the camera getting limited exactly at the surface of the wall. That allowed the view to poke through at some angles.
commit deca86d0b25c85d9970b641a454098f9fca63cd2
Author: Mircea Kitsune
Commit: Mircea Kitsune
Fix some comments
commit 7972d4372c80567c91cb0758e55b1a973751bdaa
Author: Mircea Kitsune
Commit: Mircea Kitsune
Do that last code properly
commit 0fa904dada3c3b0cd22c436a263fd37316add947
Author: Mircea Kitsune
Commit: Mircea Kitsune
Fix the intermission chasecam during the map voting screen. No longer revert to 1st person mode when entering map voting, but freeze any mouse input. Works well but the code needs to be better.
commit 3a08177bdea290ff307905d327138298f1997f3c
Author: Mircea Kitsune
Commit: Mircea Kitsune
Properly unstick the camera from going through walls. The code is a little tricky, but hopefully alright. Thanks Samual for the very useful tips :)
commit 50c25048e68f502096b09d4fbc74067bb8882337
Author: Mircea Kitsune
Commit: Mircea Kitsune
Simplify that last code, but it still needs to be done properly
commit a4dfa7b527983e408daf76f1b95b3265132cf18a
Author: Mircea Kitsune
Commit: Mircea Kitsune
A slightly better way of sticking the camera above the ground. Still bad though, need to figure the correct maths
commit cba56bd1534b24ed1f6a0ed2dff3dc77a20abeaf
Author: Mircea Kitsune
Commit: Mircea Kitsune
Properly fix the intermission chase camera, by also updating / rendering the view during intermission as long as the intermission chase cam cvar is enabled
commit d23393228c090ff3cf87e997465fc16c61a0f3d8
Author: Mircea Kitsune
Commit: Mircea Kitsune
Temporarily move the camera better when it touches a wall. Needs to be improved.
commit dc7774c74124e7d04c44896cd30cbc9ad60035a5
Author: Mircea Kitsune
Commit: Mircea Kitsune
makevectors goes before view_forward. Though it worked fine before too, so I'm not sure if makevectors is even needed. Just following the classic design for maximum safety :)
commit 52d6ec9e0028e5a5fd0df4d0f3ed2bc427e833cd
Author: Mircea Kitsune
Commit: Mircea Kitsune
Rename a function
commit 28e3196c902c748597820d6b3f20bfc2140711a6
Author: Mircea Kitsune
Commit: Mircea Kitsune
Add a comment about the usage of chase_active
commit 624acc7330757b4a993e263763eced27f475c4f7
Merge: 5786dc0 57c2420
Author: Mircea Kitsune
Commit: Mircea Kitsune
Merge branch 'master' into mirceakitsune/event_chasecam
commit 5786dc06d6269b2949ec045ab89c2a7603b20782
Author: Mircea Kitsune
Commit: Mircea Kitsune
Don't allow the camera to go through walls. Thanks tZork for the help :)
commit 87dcae1ca34504023c3c30c6a2fa1450adc9bf76
Author: Mircea Kitsune
Commit: Mircea Kitsune
Disable intermission chase cam when reaching the map voting screen. It caused the mouse cursor to move the view as well, which looked kinda odd. Don't think this is bad looking either.
commit bbb1fa4124c0fae1f9e77e580ea103ba1945a34f
Author: Mircea Kitsune
Commit: Mircea Kitsune
This fixes that issue with the intermission camera, so I can enable it by default as well now.
commit d8ddc6f0fdda987a3739c3d7222c4ee000de18f0
Author: Mircea Kitsune
Commit: Mircea Kitsune
Set all angles as the camera smooths back, not only X and Y (making height annoying when moving the mouse)
commit 65a1df4a4d60c7f005103985378f7ba8a6cfb5f7
Author: Mircea Kitsune
Commit: Mircea Kitsune
Use chase_active -1 in the code, which behaves just like 1. This can be used to mark chase_active as set by the code and thus avoid any risk of it getting stuck.
commit 21a63c6161ed0d4b35ddd1182ded8536bbe1858b
Author: Mircea Kitsune
Commit: Mircea Kitsune
Change how the camera position is set. No more setting the chase_back cvar, but use R_SetView to change the origin. Thanks for the help to tZork and Samual :)
commit 8d38094d25d25906d1f92b3c85524204c91044ce
Author: Mircea Kitsune
Commit: Mircea Kitsune
Allow chase_active to be used normally while not dead or during an intermission. Still has the issue that chase_active will remain 1 if you disconnect while dead, when you start Xonotic next time. Perhaps this can be fixed by simply set-ing the cvars in defaultXonotic.cfg?
commit c3096e146a625879ee53c035725b5fb922d101ea
Author: Mircea Kitsune
Commit: Mircea Kitsune
Disable intermission chase by default. The camera stays very close to the player for some unknown reason, and doesn't go all the way to the required distance.
commit 1abc06e959a446c21864455572c86b8fa8127af1
Author: Mircea Kitsune
Commit: Mircea Kitsune
Bring back cl_deathfade, but make it very slow.
commit 96cc518dc21ab64fb1033cf167c7c40661c72e92
Author: Mircea Kitsune
Commit: Mircea Kitsune
Cvar descriptions
commit 90c42b46c2f224ad571c1e594212f0db5ae92f8b
Author: Mircea Kitsune
Commit: Mircea Kitsune
Smooth the fading effect
commit 1452057c6604bd884ee3a179afaa28bf7c41e858
Author: Mircea Kitsune
Commit: Mircea Kitsune
Fade the chase cam back when dying or entering intermission
commit bf00dde699c9bd6737b7fe3a6f1337de4b2cd4ea
Author: Mircea Kitsune
Commit: Mircea Kitsune
Disable cl_deathfade by default (filling the screen with a red tint) as long as death chasecam is active by default too.
commit aa7cdafcdd8298f248536afccc3a2fc82c749d65
Author: Mircea Kitsune
Commit: Mircea Kitsune
Code cleanup
commit 2499b71f0d92c2add8c5e9a9b13e7252dc085d58
Author: Mircea Kitsune
Commit: Mircea Kitsune
Cvar the two chase cam types
commit 3657e31329b340e7a7683f6d57cedfa72934be44
Author: Mircea Kitsune
Commit: Mircea Kitsune
Intermission chase cam (player goes into 3rd person mode at after match end)
commit 1907291bff9a5dacab37e91988db6713b39c0141
Author: Mircea Kitsune
Commit: Mircea Kitsune
Chase camera when dead. Pretty effect used in many shooters. Its usefulness will be increased when we'll have ragdoll physics :)
User agreed to the GPLv2*.
Diff:
<pre>diff —git a/defaultXonotic.cfg b/defaultXonotic.cfg
index bddddb1..6a5a8ae 100644
— a/defaultXonotic.cfg
**+ b/defaultXonotic.cfg
@ -241,8 +241,8
@ vid_conheight 600
v_deathtilt 0 // needed for spectators
// these settings determine how much the view is affected by movement/damage
*cl_deathfade 0.03 // fade screen to dark red when dead, value represents how fast the fade is (higher is faster)
cl_smoothviewheight 0.05 // time of the averaging to the viewheight value so that it creates a smooth transition for crouching and such. 0 for instant transition
~~cl_deathfade 1 // fade screen to dark red when dead, value represents how fast the fade is
cl_bobcycle 0 // how long the cycle of up/down view movement takes , default is 0.6
cl_bob 0.01 // how much view moves up/down when moving , default is 0.02
cl_bob2cycle 0 // how long the cycle of left/right view movement takes , default is 0.6
@ -316,6 +316,11
@ set sv_ready_restart_repeatable 0 “allows the players to restart the game as oft
seta cl_hitsound 1”play a hit notifier sound when you have hit an enemy"
set cl_hitsound_antispam_time 0.05 “don’t play the hitsound more often than this”
*seta cl_eventchase_death 1 “camera goes into 3rd person mode when the player is dead”
*seta cl_eventchase_intermission 1 “camera goes into 3rd person mode when the match ends”
*seta cl_eventchase_distance 140 “final camera distance”
*seta cl_eventchase_speed 1.3 “how fast the camera slides back, 0 is instant”
+
//nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
set teamplay_lockonrestart 0 “it set to 1 in a team-based game, the teams are locked once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)”
diff —git a/qcsrc/client/View.qc b/qcsrc/client/View.qc
index 09ec96e..4a0d486 100644
— a/qcsrc/client/View.qc
**+ b/qcsrc/client/View.qc
@ -366,6 +366,8
@ vector myhealth_gentlergb;
float contentavgalpha, liquidalpha_prev;
vector liquidcolor_prev;
*float eventchase_current_distance;
*
void CSQC_UpdateView
{
entity e;
@ -401,7 +403,7
@ void CSQC_UpdateView
input_angles = warpzone_fixview_cl_viewangles;
view_angles = warpzone_fixview_angles;
~~ if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0))
-
if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0) || intermission > 1) { pmove_org = freeze_pmove_org; input_angles = view_angles = freeze_input_angles;
@ -412,8 +414,43
@ void CSQC_UpdateView(float w, float h) freeze_pmove_org = pmove_org; freeze_input_angles = input_angles; -
// event chase camera
-
if(autocvar_chase_active <= 0) // greater than 0 means it’s enabled manually, and this code is skipped
-
{
-
if(spectatee_status >= 0 && (autocvar_cl_eventchase_death && getstati(STAT_HEALTH) <= 0 && !intermission) || (autocvar_cl_eventchase_intermission && intermission))
-
{
-
// We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
-
// Ideally, there should be another way to enable third person cameras, such as through R_SetView()
-
if(!autocvar_chase_active)
-
cvar_set(“chase_active”, “~~1"); //~~1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)
-
// make the camera smooth back
-
if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance)
-
eventchase_current_distance *= autocvar_cl_eventchase_speed * * frametime; // slow down the further we get
- else if(eventchase_current_distance != autocvar_cl_eventchase_distance)
- eventchase_current_distance = autocvar_cl_eventchase_distance;
- vector eventchase_target_origin;
- makevectors(view_angles);
- // pass 1, used to check where the camera would go and obtain the trace_fraction
- eventchase_target_origin = pmove_org - view_forward * eventchase_current_distance;
- traceline(pmove_org, eventchase_target_origin, MOVE_NORMAL, self);
- // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls
- // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through
- eventchase_target_origin = pmove_org - view_forward * eventchase_current_distance * (trace_fraction - 0.1);
- R_SetView(VF_ORIGIN, eventchase_target_origin);
- }
- else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
- {
- cvar_set(”chase_active“,”0");
- eventchase_current_distance = 0; // start from 0 next time
- }
- }
// Render the Scene
- if(![](intermission || )view_set)
- if(![](intermission || )view_set || (intermission && autocvar_cl_eventchase_intermission))
{
view_origin = pmove_org + vo;
view_angles = input_angles;
diff —git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh
index e11266c..bc5c16f 100644
— a/qcsrc/client/autocvars.qh
**+ b/qcsrc/client/autocvars.qh
@ -305,3 +305,7
@ float autocvar_viewsize; float autocvar_crosshair_color_by_health; float autocvar_cl_hitsound; float autocvar_cl_hitsound_antispam_time; *float autocvar_cl_eventchase_death; *float autocvar_cl_eventchase_intermission; *float autocvar_cl_eventchase_distance; *float autocvar_cl_eventchase_speed;