r5512 - in trunk/data: . qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Jan 13 14:46:54 EST 2009
Author: mand1nga
Date: 2009-01-13 14:46:53 -0500 (Tue, 13 Jan 2009)
New Revision: 5512
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/csqc_constants.qc
Log:
Added camera for demo playback.
Use camera_enable for testing
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-01-13 19:13:56 UTC (rev 5511)
+++ trunk/data/defaultNexuiz.cfg 2009-01-13 19:46:53 UTC (rev 5512)
@@ -1294,3 +1294,34 @@
sv_status_show_qcstatus 1 // Nexuiz uses this field instead of frags
set g_full_getstatus_responses 0 // this currently breaks qstat
+
+// Defaults and aliases for the demo camera
+alias camera_enable "set cl_demo_mousegrab 1; chase_active 2;" // Enables the camera for demo playback
+
+set chase_active_rolling_step 1 // Camera rotation speed
+set chase_active_direction_step 3 // Camera movement speed on the x/y/z axis
+set chase_active_free 0 // Free camera instead of chasing the player
+set chase_active_reset 0 // Reset the camera position
+set chase_active_direction_x 0 // Move the camera on the x axis (relative to the camera angle)
+set chase_active_direction_y 0 // Move the camera on the y axis (relative to the camera angle)
+set chase_active_direction_z 0 // Move the camera on the z axis (relative to the camera rotation)
+
+alias +camera_move_forward "set chase_active_direction_x 1"
+alias -camera_move_forward "set chase_active_direction_x 0"
+alias +camera_move_backward "set chase_active_direction_x -1"
+alias -camera_move_backward -camera_move_forward
+
+alias +camera_move_left "set chase_active_direction_y 1"
+alias -camera_move_left "set chase_active_direction_y 0"
+alias +camera_move_right "set chase_active_direction_y -1"
+alias -camera_move_right -camera_move_left
+
+alias +camera_move_up "set chase_active_direction_z 1"
+alias -camera_move_up "set chase_active_direction_z 0"
+alias +camera_move_down "set chase_active_direction_z -1"
+alias -camera_move_down -camera_move_up
+
+alias +camera_roll_right "set chase_active_roll 1"
+alias -camera_roll_right "set chase_active_roll 0"
+alias +camera_roll_left "set chase_active_roll -1"
+alias -camera_roll_left -camera_roll_right
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-01-13 19:13:56 UTC (rev 5511)
+++ trunk/data/qcsrc/client/View.qc 2009-01-13 19:46:53 UTC (rev 5512)
@@ -190,6 +190,8 @@
float Sbar_WouldDrawScoreboard ();
float zoomscript_caught;
float view_set;
+float camera_mode;
+vector camera_offset, new_angles;
void CSQC_UpdateView(float w, float h)
{
entity e;
@@ -305,6 +307,70 @@
R_SetView(VF_DRAWWORLD, 1);
R_SetView(VF_FOV, GetCurrentFov(fov));
+
+ if (cvar("chase_active") > 1 && isdemo())
+ {
+ float distance, chase_view_angle, step;
+ vector new_origin, m;
+
+ step = cvar("chase_active_direction_step");
+
+ if( cvar("chase_active_reset") || !camera_mode )
+ {
+ camera_offset = '0 0 0';
+ new_angles = view_angles;
+ camera_offset_z += 20;
+ camera_offset_x -= 20 * cos(new_angles_y * DEG2RAD);
+ camera_offset_y -= 20 * sin(new_angles_y * DEG2RAD);
+ }
+
+ if( cvar("chase_active_roll") )
+ new_angles_z += cvar("chase_active_roll") * cvar("chase_active_rolling_step");
+
+ m = getmousepos() * 0.1;
+ new_angles_x += m_y * cos(new_angles_z * DEG2RAD) + (m_x * sin(new_angles_z * DEG2RAD));
+ new_angles_y -= m_x * cos(new_angles_z * DEG2RAD) + (m_y * -sin(new_angles_z * DEG2RAD));
+
+ if( cvar("chase_active_direction_x") )
+ {
+ camera_offset_x += cvar("chase_active_direction_x") * step * cos(new_angles_y * DEG2RAD);
+ camera_offset_y += cvar("chase_active_direction_x") * step * sin(new_angles_y * DEG2RAD);
+ }
+
+ if( cvar("chase_active_direction_y") )
+ {
+ camera_offset_y += cvar("chase_active_direction_y") * step * cos(new_angles_y * DEG2RAD) * cos(new_angles_z * DEG2RAD);
+ camera_offset_x += cvar("chase_active_direction_y") * step * -sin(new_angles_y * DEG2RAD);
+ camera_offset_z += cvar("chase_active_direction_y") * step * sin(new_angles_z * DEG2RAD);
+ }
+
+ if( cvar("chase_active_direction_z") )
+ camera_offset_z += cvar("chase_active_direction_z") * step * cos(new_angles_z * DEG2RAD);
+
+ if( cvar("chase_active_free") )
+ {
+ if ( camera_mode == CAMERA_CHASE ){
+ camera_offset = view_origin + camera_offset;
+ }
+
+ camera_mode = CAMERA_FREE;
+
+ new_origin = camera_offset;
+ }
+ else
+ {
+ if ( camera_mode == CAMERA_FREE )
+ {
+ camera_offset = camera_offset - view_origin;
+ }
+
+ camera_mode = CAMERA_CHASE;
+ new_origin = view_origin + camera_offset;
+ }
+
+ R_SetView(VF_ANGLES, new_angles);
+ R_SetView(VF_ORIGIN, new_origin);
+ }
// Draw the Crosshair
float scoreboard_active;
Modified: trunk/data/qcsrc/client/csqc_constants.qc
===================================================================
--- trunk/data/qcsrc/client/csqc_constants.qc 2009-01-13 19:13:56 UTC (rev 5511)
+++ trunk/data/qcsrc/client/csqc_constants.qc 2009-01-13 19:46:53 UTC (rev 5512)
@@ -183,3 +183,6 @@
float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
float MOVE_HITMODEL = 4;
float MOVE_WORLDONLY = 3;
+
+float CAMERA_FREE = 1;
+float CAMERA_CHASE = 2;
More information about the nexuiz-commits
mailing list