Attached Files |
-
cutscene_bars_fix.patch (5,640 bytes) 2008-09-25 14:11
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 4831)
+++ code/freespace2/freespace.cpp (working copy)
@@ -6283,21 +6283,23 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
- //Set rectangles
- gr_set_color(0,0,0);
- gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- //Set teh clipping
- //gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
+ //Set scissors
+ gr_set_scissor(0, 0, gr_screen.max_w, yborder);
+ gr_clear();
+ gr_set_scissor(0, gr_screen.max_h - yborder, gr_screen.max_w, gr_screen.max_h);
+ gr_clear();
+ gr_unset_scissor();
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
- gr_set_color(0,0,0);
- gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- //gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
+ //Set scissors
+ gr_set_scissor(0, 0, gr_screen.max_w, yborder);
+ gr_clear();
+ gr_set_scissor(0, gr_screen.max_h - yborder, gr_screen.max_w, gr_screen.max_h);
+ gr_clear();
+ gr_unset_scissor();
}
}
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 4831)
+++ code/graphics/2d.h (working copy)
@@ -928,7 +928,13 @@
// resets the clipping region to entire screen
void (*gf_reset_clip)();
+
+ // sets the scissor region
+ void (*gf_set_scissor)(int x, int y, int w, int h);
+ // resets the scissor region to entire screen
+ void (*gf_unset_scissor)();
+
//void (*gf_set_color)( int r, int g, int b );
//void (*gf_get_color)( int * r, int * g, int * b );
//void (*gf_init_color)( color * dst, int r, int g, int b );
@@ -1229,6 +1235,12 @@
(*gr_screen.gf_set_clip)(x,y,w,h,resize);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
+
+__inline void gr_set_scissor(int x, int y, int w, int h)
+{
+ (*gr_screen.gf_set_scissor)(x,y,w,h);
+}
+#define gr_unset_scissor GR_CALL(gr_screen.gf_unset_scissor)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
//#define gr_init_color GR_CALL(gr_screen.gf_init_color)
Index: code/graphics/grd3d.cpp
===================================================================
--- code/graphics/grd3d.cpp (revision 4831)
+++ code/graphics/grd3d.cpp (working copy)
@@ -1582,6 +1582,48 @@
}
+void gr_d3d_set_scissor(int x, int y, int w, int h)
+{
+ // check for sanity of parameters
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
+ int max_w = gr_screen.max_w;
+ int max_h = gr_screen.max_h;
+
+ if (x >= max_w)
+ x = max_w - 1;
+ if (y >= max_h)
+ y = max_h - 1;
+
+ if (x + w > max_w)
+ w = max_w - x;
+ if (y + h > max_h)
+ h = max_h - y;
+
+ if (w > max_w)
+ w = max_w;
+ if (h > max_h)
+ h = max_h;
+
+ // just return early if we aren't actually going to need the scissor test
+ if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
+ GlobalD3DVars::lpD3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE , FALSE);
+ return;
+ }
+
+ RECT rect = {x, y, w, h};
+ GlobalD3DVars::lpD3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
+ GlobalD3DVars::lpD3DDevice->SetScissorRect(&rect);
+}
+
+void gr_d3d_unset_scissor()
+{
+ GlobalD3DVars::lpD3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE , FALSE);
+}
+
void gr_d3d_flip_cleanup()
{
d3d_stop_frame();
Index: code/graphics/grd3dsetup.cpp
===================================================================
--- code/graphics/grd3dsetup.cpp (revision 4831)
+++ code/graphics/grd3dsetup.cpp (working copy)
@@ -799,6 +799,8 @@
{
// Set all the pointer to functions to the correct D3D functions
gr_screen.gf_flip = gr_d3d_flip;
+ gr_screen.gf_set_scissor = gr_d3d_set_scissor;
+ gr_screen.gf_unset_scissor = gr_d3d_unset_scissor;
gr_screen.gf_set_clip = gr_d3d_set_clip;
gr_screen.gf_reset_clip = gr_d3d_reset_clip;
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 4831)
+++ code/graphics/gropengl.cpp (working copy)
@@ -1510,6 +1510,47 @@
#endif
}
+void gr_opengl_set_scissor(int x, int y, int w, int h)
+{
+ // check for sanity of parameters
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
+ int max_w = gr_screen.max_w;
+ int max_h = gr_screen.max_h;
+
+ if (x >= max_w)
+ x = max_w - 1;
+ if (y >= max_h)
+ y = max_h - 1;
+
+ if (x + w > max_w)
+ w = max_w - x;
+ if (y + h > max_h)
+ h = max_h - y;
+
+ if (w > max_w)
+ w = max_w;
+ if (h > max_h)
+ h = max_h;
+
+ // just return early if we aren't actually going to need the scissor test
+ if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
+ glDisable(GL_SCISSOR_TEST);
+ return;
+ }
+
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(x, gr_screen.max_h - y - h, w, h);
+}
+
+void gr_opengl_unset_scissor()
+{
+ glDisable(GL_SCISSOR_TEST);
+}
+
void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
{
// check for sanity of parameters
@@ -2824,6 +2865,8 @@
// if they shouldn't be run in non-HTL mode, Don't keep separate entries.
gr_screen.gf_flip = gr_opengl_flip;
+ gr_screen.gf_set_scissor = gr_opengl_set_scissor;
+ gr_screen.gf_unset_scissor = gr_opengl_unset_scissor;
gr_screen.gf_set_clip = gr_opengl_set_clip;
gr_screen.gf_reset_clip = gr_opengl_reset_clip;
-
-
skybox_default.pof (3,483 bytes) 2009-03-07 06:29
-
-
-
cutscene_bars_rtt.patch (1,627 bytes) 2009-11-17 11:58
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5660)
+++ code/freespace2/freespace.cpp (working copy)
@@ -3818,11 +3818,6 @@
// setup neb2 rendering
neb2_render_setup(Main_camera);
- if(!Time_compression_locked)
- game_set_view_clip(flFrametime);
- else
- game_set_view_clip(flRealframetime);
-
return Main_camera;
}
@@ -3833,6 +3828,8 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
+void clip_frame_view();
+
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
@@ -3885,6 +3882,8 @@
Env_cubemap_drawn = true;
}
}
+ gr_zbuffer_clear(TRUE);
+ clip_frame_view();
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
@@ -4564,6 +4563,22 @@
}
}
+void clip_frame_view() {
+ if(!Time_compression_locked) {
+ // Player is dead
+ game_set_view_clip(flFrametime);
+
+ // Cutscene bars
+ bars_do_frame(flRealframetime);
+ } else {
+ // Player is dead
+ game_set_view_clip(flRealframetime);
+
+ // Cutscene bars
+ bars_do_frame(flRealframetime);
+ }
+}
+
//WMC - This does stuff like fading in and out and subtitles. Special FX?
//Basically stuff you need rendered after everything else (including HUD)
void game_render_post_frame()
@@ -4708,9 +4723,6 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- // WMC's cutscene bars function
- bars_do_frame(Time_compression_locked ? flRealframetime : flFrametime);
-
game_render_frame( cid );
// save the eye position and orientation
-
1768_patch_18122009.patch (4,782 bytes) 2009-12-18 12:06
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5725)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2824,11 +2824,10 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
@@ -3863,6 +3862,26 @@
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ clip_frame_view();
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3902,22 +3921,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_set_frame_backg();
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4585,11 +4588,10 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_reset_clip();
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
@@ -4599,10 +4601,10 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
}
+
+ gr_reset_clip();
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
}
}
Index: code/nebula/neb.cpp
===================================================================
--- code/nebula/neb.cpp (revision 5725)
+++ code/nebula/neb.cpp (working copy)
@@ -470,23 +470,6 @@
}
}
-void neb2_set_frame_backg() {
- ubyte tr = gr_screen.current_clear_color.red;
- ubyte tg = gr_screen.current_clear_color.green;
- ubyte tb = gr_screen.current_clear_color.blue;
-
- neb2_get_fog_color(
- &gr_screen.current_clear_color.red,
- &gr_screen.current_clear_color.green,
- &gr_screen.current_clear_color.blue);
-
- gr_clear();
-
- gr_screen.current_clear_color.red = tr;
- gr_screen.current_clear_color.green = tg;
- gr_screen.current_clear_color.blue = tb;
-}
-
// call before beginning all rendering
void neb2_render_setup(camid cid)
{
@@ -502,8 +485,21 @@
if (Neb2_render_mode == NEB2_RENDER_HTL) {
// RT The background needs to be the same colour as the fog and this seems
// to be the ideal place to do it
- neb2_set_frame_backg();
+ ubyte tr = gr_screen.current_clear_color.red;
+ ubyte tg = gr_screen.current_clear_color.green;
+ ubyte tb = gr_screen.current_clear_color.blue;
+ neb2_get_fog_color(
+ &gr_screen.current_clear_color.red,
+ &gr_screen.current_clear_color.green,
+ &gr_screen.current_clear_color.blue);
+
+ gr_clear();
+
+ gr_screen.current_clear_color.red = tr;
+ gr_screen.current_clear_color.green = tg;
+ gr_screen.current_clear_color.blue = tb;
+
return;
}
Index: code/nebula/neb.h
===================================================================
--- code/nebula/neb.h (revision 5725)
+++ code/nebula/neb.h (working copy)
@@ -140,8 +140,5 @@
void neb2_get_fog_color(ubyte *r, ubyte *g, ubyte *b);
-// set frame background color
-void neb2_set_frame_backg();
-
#endif
-
cutscene_bars.patch (8,652 bytes) 2009-12-18 15:36
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5726)
+++ code/freespace2/freespace.cpp (working copy)
@@ -198,6 +198,7 @@
bool Env_cubemap_drawn = false;
+void bars_do_frame(float frametime);
void game_reset_view_clip();
void game_reset_shade_frame();
void game_post_level_init();
@@ -2812,48 +2813,6 @@
Cutscene_bars_progress = 1.0f;
}
-void game_set_view_clip(float frametime)
-{
- if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
- {
- // Set the clip region for the letterbox "dead view"
- int yborder = gr_screen.max_h/4;
-
- if (g3_in_frame() == 0) {
- // Ensure that the bars are black
- gr_set_color(0,0,0);
- gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
- }
- else {
- // Set the clip region for normal view
- if ( View_percent >= 100 ) {
- gr_reset_clip();
- } else {
- int xborder, yborder;
-
- if ( View_percent < 5 ) {
- View_percent = 5;
- }
-
- float fp = i2fl(View_percent)/100.0f;
- int fi = fl2i(fl_sqrt(fp)*100.0f);
- if ( fi > 100 ) fi=100;
-
- xborder = ( gr_screen.max_w*(100-fi) )/200;
- yborder = ( gr_screen.max_h*(100-fi) )/200;
-
- gr_set_clip(xborder, yborder, gr_screen.max_w-xborder*2,gr_screen.max_h-yborder*2, false );
- }
- }
-}
-
-
void show_debug_stuff()
{
int i;
@@ -3855,14 +3814,28 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+ }
+ gr_zbuffer_clear(TRUE);
+
+ gr_screen.gf_post_process_before();
+
+ bars_do_frame(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3902,22 +3875,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_set_frame_backg();
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4557,11 +4514,19 @@
gr_flash_alpha(Viewer_shader.r, Viewer_shader.g, Viewer_shader.b, Viewer_shader.c);
}
+const static int DEAD_VIEW_DIVISOR = 4;
const static int CUTSCENE_BAR_DIVISOR = 8;
void bars_do_frame(float frametime)
{
- if((Cutscene_bar_flags & CUB_GRADUAL) && Cutscene_bars_progress < 1.0f)
+ if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
{
+ // Set the clip region for the letterbox "dead view"
+ int yborder = gr_screen.max_h/DEAD_VIEW_DIVISOR;
+
+ gr_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);
+ }
+ else if((Cutscene_bar_flags & CUB_GRADUAL) && Cutscene_bars_progress < 1.0f)
+ {
//Determine how far along we are
Assert(Cutscene_delta_time > 0.0f);
@@ -4574,51 +4539,42 @@
}
//Figure out where the bars should be
- int yborder;
- if(Cutscene_bar_flags & CUB_CUTSCENE)
+ int yborder = 0;
+ if(Cutscene_bar_flags & CUB_CUTSCENE) {
yborder = fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
- else
- yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
-
- if (g3_in_frame() == 0) {
- //Set rectangles
- gr_set_color(0,0,0);
- gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
} else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
+ yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
}
+
+ gr_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
- if (g3_in_frame() == 0) {
- gr_set_color(0,0,0);
- gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
- }
+ gr_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);
}
-}
+ else
+ {
+ // Set the clip region for normal view
+ if ( View_percent >= 100 ) {
+ gr_no_scissor();
+ } else {
+ int xborder, yborder;
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
+ if ( View_percent < 5 ) {
+ View_percent = 5;
+ }
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
+ float fp = i2fl(View_percent)/100.0f;
+ int fi = fl2i(fl_sqrt(fp)*100.0f);
+ if ( fi > 100 ) fi=100;
+
+ xborder = ( gr_screen.max_w*(100-fi) )/200;
+ yborder = ( gr_screen.max_h*(100-fi) )/200;
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ gr_scissor(xborder, yborder, gr_screen.max_w-xborder*2,gr_screen.max_h-yborder*2);
+ }
}
}
@@ -4766,7 +4722,7 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ bars_do_frame(flRealframetime);
game_render_frame( cid );
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 5726)
+++ code/graphics/2d.h (working copy)
@@ -229,6 +229,12 @@
// resets the clipping region to entire screen
void (*gf_reset_clip)();
+ // sets the scissor region
+ void (*gf_scissor)(int x, int y, int w, int h);
+
+ // resets the scissor region to entire screen
+ void (*gf_no_scissor)();
+
//void (*gf_set_color)( int r, int g, int b );
//void (*gf_get_color)( int * r, int * g, int * b );
//void (*gf_init_color)( color * dst, int r, int g, int b );
@@ -537,6 +543,13 @@
(*gr_screen.gf_set_clip)(x,y,w,h,resize);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
+
+__inline void gr_scissor(int x, int y, int w, int h)
+{
+ (*gr_screen.gf_scissor)(x,y,w,h);
+}
+#define gr_no_scissor GR_CALL(gr_screen.gf_no_scissor)
+
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
//#define gr_init_color GR_CALL(gr_screen.gf_init_color)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 5726)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,6 +375,47 @@
#endif
}
+void gr_opengl_scissor(int x, int y, int w, int h)
+{
+ // Check for sanity of parameters
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
+ int max_w = gr_screen.max_w;
+ int max_h = gr_screen.max_h;
+
+ if (x >= max_w)
+ x = max_w - 1;
+ if (y >= max_h)
+ y = max_h - 1;
+
+ if (x + w > max_w)
+ w = max_w - x;
+ if (y + h > max_h)
+ h = max_h - y;
+
+ if (w > max_w)
+ w = max_w;
+ if (h > max_h)
+ h = max_h;
+
+ // Disable scissor test if we're rendering the full screen again
+ if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
+ glDisable(GL_SCISSOR_TEST);
+ return;
+ }
+
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(x, gr_screen.max_h - y - h, w, h);
+}
+
+void gr_opengl_no_scissor()
+{
+ glDisable(GL_SCISSOR_TEST);
+}
+
void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
{
// check for sanity of parameters
@@ -1702,6 +1743,8 @@
gr_screen.gf_flip = gr_opengl_flip;
gr_screen.gf_set_clip = gr_opengl_set_clip;
gr_screen.gf_reset_clip = gr_opengl_reset_clip;
+ gr_screen.gf_scissor = gr_opengl_scissor;
+ gr_screen.gf_no_scissor = gr_opengl_no_scissor;
gr_screen.gf_clear = gr_opengl_clear;
// gr_screen.gf_bitmap = gr_opengl_bitmap;
-
1768_patch_fov_change.patch (14,591 bytes) 2009-12-18 17:14
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5726)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2812,6 +2812,8 @@
Cutscene_bars_progress = 1.0f;
}
+void bars_do_frame(float frametime);
+
void game_set_view_clip(float frametime)
{
if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
@@ -2824,16 +2826,15 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
if ( View_percent >= 100 ) {
- gr_reset_clip();
+ bars_do_frame(frametime);
} else {
int xborder, yborder;
@@ -3855,14 +3856,35 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3902,22 +3924,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_set_frame_backg();
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4580,46 +4586,37 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
//Set rectangles
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false, Cutscene_fov_change );
+
+ Cutscene_bar_size = yborder;
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
+ gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false );
}
- }
-}
+
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false, Cutscene_fov_change );
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ Cutscene_bar_size = yborder;
}
+ else if(Cutscene_bar_size)
+ Cutscene_bar_size = 0;
}
//WMC - This does stuff like fading in and out and subtitles. Special FX?
@@ -4766,7 +4763,10 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
game_render_frame( cid );
Index: code/globalincs/systemvars.cpp
===================================================================
--- code/globalincs/systemvars.cpp (revision 5726)
+++ code/globalincs/systemvars.cpp (working copy)
@@ -33,6 +33,10 @@
float Cutscene_delta_time = 1.0f;
//How far along a change is (0 to 1)
float Cutscene_bars_progress = 1.0f;
+//Change FOV?
+bool Cutscene_fov_change = true;
+//Size of the bar
+int Cutscene_bar_size = 0;
//FADEIN STUFF
shader Viewer_shader;
Index: code/globalincs/systemvars.h
===================================================================
--- code/globalincs/systemvars.h (revision 5726)
+++ code/globalincs/systemvars.h (working copy)
@@ -57,7 +57,8 @@
//Styles to get to bars
#define CUB_GRADUAL (1<<15)
extern float Cutscene_bars_progress, Cutscene_delta_time;
-extern int Cutscene_bar_flags;
+extern int Cutscene_bar_flags, Cutscene_bar_size;
+extern bool Cutscene_fov_change;
//-----Fadein stuff
struct shader;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 5726)
+++ code/graphics/2d.h (working copy)
@@ -224,7 +224,7 @@
void (*gf_flash_alpha)(int r, int g, int b, int a);
// sets the clipping region
- void (*gf_set_clip)(int x, int y, int w, int h, bool resize);
+ void (*gf_set_clip)(int x, int y, int w, int h, bool resize, bool change_fov);
// resets the clipping region to entire screen
void (*gf_reset_clip)();
@@ -532,9 +532,9 @@
void gr_flip();
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
-__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
+__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true, bool change_fov=true)
{
- (*gr_screen.gf_set_clip)(x,y,w,h,resize);
+ (*gr_screen.gf_set_clip)(x,y,w,h,resize,change_fov);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 5726)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,7 +375,7 @@
#endif
}
-void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
+void gr_opengl_set_clip(int x, int y, int w, int h, bool resize, bool change_fov)
{
// check for sanity of parameters
if (x < 0) {
@@ -415,37 +415,39 @@
h = max_h;
}
- gr_screen.offset_x_unscaled = x;
- gr_screen.offset_y_unscaled = y;
- gr_screen.clip_left_unscaled = 0;
- gr_screen.clip_right_unscaled = w-1;
- gr_screen.clip_top_unscaled = 0;
- gr_screen.clip_bottom_unscaled = h-1;
- gr_screen.clip_width_unscaled = w;
- gr_screen.clip_height_unscaled = h;
+ if (change_fov) {
+ gr_screen.offset_x_unscaled = x;
+ gr_screen.offset_y_unscaled = y;
+ gr_screen.clip_left_unscaled = 0;
+ gr_screen.clip_right_unscaled = w-1;
+ gr_screen.clip_top_unscaled = 0;
+ gr_screen.clip_bottom_unscaled = h-1;
+ gr_screen.clip_width_unscaled = w;
+ gr_screen.clip_height_unscaled = h;
+
- if (to_resize) {
- gr_resize_screen_pos(&x, &y);
- gr_resize_screen_pos(&w, &h);
- } else {
- gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
- }
+ if (to_resize) {
+ gr_resize_screen_pos(&x, &y);
+ gr_resize_screen_pos(&w, &h);
+ } else {
+ gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
+ }
- gr_screen.offset_x = x;
- gr_screen.offset_y = y;
- gr_screen.clip_left = 0;
- gr_screen.clip_right = w-1;
- gr_screen.clip_top = 0;
- gr_screen.clip_bottom = h-1;
- gr_screen.clip_width = w;
- gr_screen.clip_height = h;
+ gr_screen.offset_x = x;
+ gr_screen.offset_y = y;
+ gr_screen.clip_left = 0;
+ gr_screen.clip_right = w-1;
+ gr_screen.clip_top = 0;
+ gr_screen.clip_bottom = h-1;
+ gr_screen.clip_width = w;
+ gr_screen.clip_height = h;
- gr_screen.clip_aspect = i2fl(w) / i2fl(h);
- gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
- gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
-
+ gr_screen.clip_aspect = i2fl(w) / i2fl(h);
+ gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
+ gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
+ }
// just return early if we aren't actually going to need the scissor test
if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
GL_state.ScissorTest(GL_FALSE);
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp (revision 5726)
+++ code/graphics/gropenglpostprocessing.cpp (working copy)
@@ -1,6 +1,7 @@
#include "graphics/gropenglpostprocessing.h"
#include "graphics/gropenglshader.h"
+#include "globalincs/systemvars.h"
#include "io/timer.h"
#include "nebula/neb.h"
#include "parse/parselo.h"
@@ -367,8 +368,13 @@
}
// Fix problems when player is dead and the screen is clipped.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ if (gr_screen.max_h != gr_screen.clip_height) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ } else if (Cutscene_bar_size) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, Cutscene_bar_size, gr_screen.max_w, gr_screen.max_h - Cutscene_bar_size * 2);
+ }
// Main post-processing render
render_target::apply_default();
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (revision 5726)
+++ code/graphics/grstub.cpp (working copy)
@@ -256,7 +256,7 @@
{
}
-void gr_stub_set_clip(int x, int y, int w, int h, bool resize)
+void gr_stub_set_clip(int x, int y, int w, int h, bool resize,bool fov_change)
{
}
Index: code/nebula/neb.cpp
===================================================================
--- code/nebula/neb.cpp (revision 5726)
+++ code/nebula/neb.cpp (working copy)
@@ -470,23 +470,6 @@
}
}
-void neb2_set_frame_backg() {
- ubyte tr = gr_screen.current_clear_color.red;
- ubyte tg = gr_screen.current_clear_color.green;
- ubyte tb = gr_screen.current_clear_color.blue;
-
- neb2_get_fog_color(
- &gr_screen.current_clear_color.red,
- &gr_screen.current_clear_color.green,
- &gr_screen.current_clear_color.blue);
-
- gr_clear();
-
- gr_screen.current_clear_color.red = tr;
- gr_screen.current_clear_color.green = tg;
- gr_screen.current_clear_color.blue = tb;
-}
-
// call before beginning all rendering
void neb2_render_setup(camid cid)
{
@@ -502,8 +485,21 @@
if (Neb2_render_mode == NEB2_RENDER_HTL) {
// RT The background needs to be the same colour as the fog and this seems
// to be the ideal place to do it
- neb2_set_frame_backg();
+ ubyte tr = gr_screen.current_clear_color.red;
+ ubyte tg = gr_screen.current_clear_color.green;
+ ubyte tb = gr_screen.current_clear_color.blue;
+ neb2_get_fog_color(
+ &gr_screen.current_clear_color.red,
+ &gr_screen.current_clear_color.green,
+ &gr_screen.current_clear_color.blue);
+
+ gr_clear();
+
+ gr_screen.current_clear_color.red = tr;
+ gr_screen.current_clear_color.green = tg;
+ gr_screen.current_clear_color.blue = tb;
+
return;
}
Index: code/nebula/neb.h
===================================================================
--- code/nebula/neb.h (revision 5726)
+++ code/nebula/neb.h (working copy)
@@ -140,8 +140,5 @@
void neb2_get_fog_color(ubyte *r, ubyte *g, ubyte *b);
-// set frame background color
-void neb2_set_frame_backg();
-
#endif
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 5726)
+++ code/parse/sexp.cpp (working copy)
@@ -529,7 +529,7 @@
{ "set-training-context-speed", OP_SET_TRAINING_CONTEXT_SPEED, 2, 2, },
//Cutscene stuff
- { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 1, },
+ { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 2, },
{ "unset-cutscene-bars", OP_CUTSCENES_UNSET_CUTSCENE_BARS, 0, 1, },
{ "fade-in", OP_CUTSCENES_FADE_IN, 0, 1, },
{ "fade-out", OP_CUTSCENES_FADE_OUT, 0, 2, },
@@ -15546,8 +15546,10 @@
float delta_speed = 0.0f;
- if(node != -1)
+ if(node != -1) {
delta_speed = eval_num(node)/1000.0f;
+ node = CDR(node);
+ }
if(delta_speed > 0.0f)
{
@@ -15559,6 +15561,10 @@
{
Cutscene_bar_flags &= ~CUB_GRADUAL;
}
+
+ Cutscene_fov_change = true;
+ if(node != -1)
+ Cutscene_fov_change = is_sexp_true(node);
}
void sexp_unset_cutscene_bars(int node)
@@ -20146,6 +20152,11 @@
return OPF_NONE;
case OP_CUTSCENES_SET_CUTSCENE_BARS:
+ if (argnum==0)
+ return OPF_POSITIVE;
+ else
+ return OPF_BOOL;
+
case OP_CUTSCENES_UNSET_CUTSCENE_BARS:
case OP_CUTSCENES_FADE_IN:
case OP_CUTSCENES_FADE_OUT:
@@ -24212,8 +24223,9 @@
{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
"\tShows bars at the top and bottom of screen "
- "Takes 0 or 1 arguments...\r\n"
+ "Takes 0, 1 or 2 arguments...\r\n"
"\t1:\tMilliseconds for bars to slide in\r\n"
+ "\t2:\tWhether FOV should be changed (defaults to true)\r\n"
},
{ OP_CUTSCENES_UNSET_CUTSCENE_BARS, "unset-cutscene-bars\r\n"
-
1768_patch_19122009.patch (14,596 bytes) 2009-12-19 06:22
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5726)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2812,6 +2812,8 @@
Cutscene_bars_progress = 1.0f;
}
+void bars_do_frame(float frametime);
+
void game_set_view_clip(float frametime)
{
if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
@@ -2824,16 +2826,16 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
if ( View_percent >= 100 ) {
gr_reset_clip();
+ bars_do_frame(frametime);
} else {
int xborder, yborder;
@@ -3855,14 +3857,35 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3902,22 +3925,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_set_frame_backg();
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4580,46 +4587,37 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
//Set rectangles
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false, Cutscene_fov_change );
+
+ Cutscene_bar_size = yborder;
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
+ gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false );
}
- }
-}
+
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false, Cutscene_fov_change );
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ Cutscene_bar_size = yborder;
}
+ else if(Cutscene_bar_size)
+ Cutscene_bar_size = 0;
}
//WMC - This does stuff like fading in and out and subtitles. Special FX?
@@ -4766,7 +4764,10 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
game_render_frame( cid );
Index: code/globalincs/systemvars.cpp
===================================================================
--- code/globalincs/systemvars.cpp (revision 5726)
+++ code/globalincs/systemvars.cpp (working copy)
@@ -33,6 +33,10 @@
float Cutscene_delta_time = 1.0f;
//How far along a change is (0 to 1)
float Cutscene_bars_progress = 1.0f;
+//Change FOV?
+bool Cutscene_fov_change = true;
+//Size of the bar
+int Cutscene_bar_size = 0;
//FADEIN STUFF
shader Viewer_shader;
Index: code/globalincs/systemvars.h
===================================================================
--- code/globalincs/systemvars.h (revision 5726)
+++ code/globalincs/systemvars.h (working copy)
@@ -57,7 +57,8 @@
//Styles to get to bars
#define CUB_GRADUAL (1<<15)
extern float Cutscene_bars_progress, Cutscene_delta_time;
-extern int Cutscene_bar_flags;
+extern int Cutscene_bar_flags, Cutscene_bar_size;
+extern bool Cutscene_fov_change;
//-----Fadein stuff
struct shader;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 5726)
+++ code/graphics/2d.h (working copy)
@@ -224,7 +224,7 @@
void (*gf_flash_alpha)(int r, int g, int b, int a);
// sets the clipping region
- void (*gf_set_clip)(int x, int y, int w, int h, bool resize);
+ void (*gf_set_clip)(int x, int y, int w, int h, bool resize, bool change_fov);
// resets the clipping region to entire screen
void (*gf_reset_clip)();
@@ -532,9 +532,9 @@
void gr_flip();
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
-__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
+__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true, bool change_fov=true)
{
- (*gr_screen.gf_set_clip)(x,y,w,h,resize);
+ (*gr_screen.gf_set_clip)(x,y,w,h,resize,change_fov);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 5726)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,7 +375,7 @@
#endif
}
-void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
+void gr_opengl_set_clip(int x, int y, int w, int h, bool resize, bool change_fov)
{
// check for sanity of parameters
if (x < 0) {
@@ -415,37 +415,39 @@
h = max_h;
}
- gr_screen.offset_x_unscaled = x;
- gr_screen.offset_y_unscaled = y;
- gr_screen.clip_left_unscaled = 0;
- gr_screen.clip_right_unscaled = w-1;
- gr_screen.clip_top_unscaled = 0;
- gr_screen.clip_bottom_unscaled = h-1;
- gr_screen.clip_width_unscaled = w;
- gr_screen.clip_height_unscaled = h;
+ if (change_fov) {
+ gr_screen.offset_x_unscaled = x;
+ gr_screen.offset_y_unscaled = y;
+ gr_screen.clip_left_unscaled = 0;
+ gr_screen.clip_right_unscaled = w-1;
+ gr_screen.clip_top_unscaled = 0;
+ gr_screen.clip_bottom_unscaled = h-1;
+ gr_screen.clip_width_unscaled = w;
+ gr_screen.clip_height_unscaled = h;
+
- if (to_resize) {
- gr_resize_screen_pos(&x, &y);
- gr_resize_screen_pos(&w, &h);
- } else {
- gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
- }
+ if (to_resize) {
+ gr_resize_screen_pos(&x, &y);
+ gr_resize_screen_pos(&w, &h);
+ } else {
+ gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
+ }
- gr_screen.offset_x = x;
- gr_screen.offset_y = y;
- gr_screen.clip_left = 0;
- gr_screen.clip_right = w-1;
- gr_screen.clip_top = 0;
- gr_screen.clip_bottom = h-1;
- gr_screen.clip_width = w;
- gr_screen.clip_height = h;
+ gr_screen.offset_x = x;
+ gr_screen.offset_y = y;
+ gr_screen.clip_left = 0;
+ gr_screen.clip_right = w-1;
+ gr_screen.clip_top = 0;
+ gr_screen.clip_bottom = h-1;
+ gr_screen.clip_width = w;
+ gr_screen.clip_height = h;
- gr_screen.clip_aspect = i2fl(w) / i2fl(h);
- gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
- gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
-
+ gr_screen.clip_aspect = i2fl(w) / i2fl(h);
+ gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
+ gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
+ }
// just return early if we aren't actually going to need the scissor test
if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
GL_state.ScissorTest(GL_FALSE);
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp (revision 5726)
+++ code/graphics/gropenglpostprocessing.cpp (working copy)
@@ -1,6 +1,7 @@
#include "graphics/gropenglpostprocessing.h"
#include "graphics/gropenglshader.h"
+#include "globalincs/systemvars.h"
#include "io/timer.h"
#include "nebula/neb.h"
#include "parse/parselo.h"
@@ -367,8 +368,13 @@
}
// Fix problems when player is dead and the screen is clipped.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ if (gr_screen.max_h != gr_screen.clip_height) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ } else if (Cutscene_bar_size) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, Cutscene_bar_size, gr_screen.max_w, gr_screen.max_h - Cutscene_bar_size * 2);
+ }
// Main post-processing render
render_target::apply_default();
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (revision 5726)
+++ code/graphics/grstub.cpp (working copy)
@@ -256,7 +256,7 @@
{
}
-void gr_stub_set_clip(int x, int y, int w, int h, bool resize)
+void gr_stub_set_clip(int x, int y, int w, int h, bool resize,bool fov_change)
{
}
Index: code/nebula/neb.cpp
===================================================================
--- code/nebula/neb.cpp (revision 5726)
+++ code/nebula/neb.cpp (working copy)
@@ -470,23 +470,6 @@
}
}
-void neb2_set_frame_backg() {
- ubyte tr = gr_screen.current_clear_color.red;
- ubyte tg = gr_screen.current_clear_color.green;
- ubyte tb = gr_screen.current_clear_color.blue;
-
- neb2_get_fog_color(
- &gr_screen.current_clear_color.red,
- &gr_screen.current_clear_color.green,
- &gr_screen.current_clear_color.blue);
-
- gr_clear();
-
- gr_screen.current_clear_color.red = tr;
- gr_screen.current_clear_color.green = tg;
- gr_screen.current_clear_color.blue = tb;
-}
-
// call before beginning all rendering
void neb2_render_setup(camid cid)
{
@@ -502,8 +485,21 @@
if (Neb2_render_mode == NEB2_RENDER_HTL) {
// RT The background needs to be the same colour as the fog and this seems
// to be the ideal place to do it
- neb2_set_frame_backg();
+ ubyte tr = gr_screen.current_clear_color.red;
+ ubyte tg = gr_screen.current_clear_color.green;
+ ubyte tb = gr_screen.current_clear_color.blue;
+ neb2_get_fog_color(
+ &gr_screen.current_clear_color.red,
+ &gr_screen.current_clear_color.green,
+ &gr_screen.current_clear_color.blue);
+
+ gr_clear();
+
+ gr_screen.current_clear_color.red = tr;
+ gr_screen.current_clear_color.green = tg;
+ gr_screen.current_clear_color.blue = tb;
+
return;
}
Index: code/nebula/neb.h
===================================================================
--- code/nebula/neb.h (revision 5726)
+++ code/nebula/neb.h (working copy)
@@ -140,8 +140,5 @@
void neb2_get_fog_color(ubyte *r, ubyte *g, ubyte *b);
-// set frame background color
-void neb2_set_frame_backg();
-
#endif
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 5726)
+++ code/parse/sexp.cpp (working copy)
@@ -529,7 +529,7 @@
{ "set-training-context-speed", OP_SET_TRAINING_CONTEXT_SPEED, 2, 2, },
//Cutscene stuff
- { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 1, },
+ { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 2, },
{ "unset-cutscene-bars", OP_CUTSCENES_UNSET_CUTSCENE_BARS, 0, 1, },
{ "fade-in", OP_CUTSCENES_FADE_IN, 0, 1, },
{ "fade-out", OP_CUTSCENES_FADE_OUT, 0, 2, },
@@ -15546,8 +15546,10 @@
float delta_speed = 0.0f;
- if(node != -1)
+ if(node != -1) {
delta_speed = eval_num(node)/1000.0f;
+ node = CDR(node);
+ }
if(delta_speed > 0.0f)
{
@@ -15559,6 +15561,10 @@
{
Cutscene_bar_flags &= ~CUB_GRADUAL;
}
+
+ Cutscene_fov_change = true;
+ if(node != -1)
+ Cutscene_fov_change = is_sexp_true(node) != 0;
}
void sexp_unset_cutscene_bars(int node)
@@ -20146,6 +20152,11 @@
return OPF_NONE;
case OP_CUTSCENES_SET_CUTSCENE_BARS:
+ if (argnum==0)
+ return OPF_POSITIVE;
+ else
+ return OPF_BOOL;
+
case OP_CUTSCENES_UNSET_CUTSCENE_BARS:
case OP_CUTSCENES_FADE_IN:
case OP_CUTSCENES_FADE_OUT:
@@ -24212,8 +24223,9 @@
{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
"\tShows bars at the top and bottom of screen "
- "Takes 0 or 1 arguments...\r\n"
+ "Takes 0, 1 or 2 arguments...\r\n"
"\t1:\tMilliseconds for bars to slide in\r\n"
+ "\t2:\tWhether FOV should be changed (defaults to true)\r\n"
},
{ OP_CUTSCENES_UNSET_CUTSCENE_BARS, "unset-cutscene-bars\r\n"
-
M1768_patch_31122009.patch (13,140 bytes) 2009-12-31 07:20
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5755)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2814,6 +2814,8 @@
Cutscene_bars_progress = 1.0f;
}
+void bars_do_frame(float frametime);
+
void game_set_view_clip(float frametime)
{
if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
@@ -2826,16 +2828,16 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
if ( View_percent >= 100 ) {
gr_reset_clip();
+ bars_do_frame(frametime);
} else {
int xborder, yborder;
@@ -3857,14 +3859,35 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3904,22 +3927,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_render_setup(cid);
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4582,46 +4589,37 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
//Set rectangles
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false, Cutscene_fov_change );
+
+ Cutscene_bar_size = yborder;
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
+ gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false );
}
- }
-}
+
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false, Cutscene_fov_change );
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ Cutscene_bar_size = yborder;
}
+ else if(Cutscene_bar_size)
+ Cutscene_bar_size = 0;
}
//WMC - This does stuff like fading in and out and subtitles. Special FX?
@@ -4768,7 +4765,10 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
game_render_frame( cid );
Index: code/globalincs/systemvars.cpp
===================================================================
--- code/globalincs/systemvars.cpp (revision 5755)
+++ code/globalincs/systemvars.cpp (working copy)
@@ -33,6 +33,10 @@
float Cutscene_delta_time = 1.0f;
//How far along a change is (0 to 1)
float Cutscene_bars_progress = 1.0f;
+//Change FOV?
+bool Cutscene_fov_change = true;
+//Size of the bar
+int Cutscene_bar_size = 0;
//FADEIN STUFF
shader Viewer_shader;
Index: code/globalincs/systemvars.h
===================================================================
--- code/globalincs/systemvars.h (revision 5755)
+++ code/globalincs/systemvars.h (working copy)
@@ -57,7 +57,8 @@
//Styles to get to bars
#define CUB_GRADUAL (1<<15)
extern float Cutscene_bars_progress, Cutscene_delta_time;
-extern int Cutscene_bar_flags;
+extern int Cutscene_bar_flags, Cutscene_bar_size;
+extern bool Cutscene_fov_change;
//-----Fadein stuff
struct shader;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 5755)
+++ code/graphics/2d.h (working copy)
@@ -224,7 +224,7 @@
void (*gf_flash_alpha)(int r, int g, int b, int a);
// sets the clipping region
- void (*gf_set_clip)(int x, int y, int w, int h, bool resize);
+ void (*gf_set_clip)(int x, int y, int w, int h, bool resize, bool change_fov);
// resets the clipping region to entire screen
void (*gf_reset_clip)();
@@ -525,9 +525,9 @@
void gr_flip();
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
-__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
+__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true, bool change_fov=true)
{
- (*gr_screen.gf_set_clip)(x,y,w,h,resize);
+ (*gr_screen.gf_set_clip)(x,y,w,h,resize,change_fov);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 5755)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,7 +375,7 @@
#endif
}
-void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
+void gr_opengl_set_clip(int x, int y, int w, int h, bool resize, bool change_fov)
{
// check for sanity of parameters
if (x < 0) {
@@ -415,37 +415,39 @@
h = max_h;
}
- gr_screen.offset_x_unscaled = x;
- gr_screen.offset_y_unscaled = y;
- gr_screen.clip_left_unscaled = 0;
- gr_screen.clip_right_unscaled = w-1;
- gr_screen.clip_top_unscaled = 0;
- gr_screen.clip_bottom_unscaled = h-1;
- gr_screen.clip_width_unscaled = w;
- gr_screen.clip_height_unscaled = h;
+ if (change_fov) {
+ gr_screen.offset_x_unscaled = x;
+ gr_screen.offset_y_unscaled = y;
+ gr_screen.clip_left_unscaled = 0;
+ gr_screen.clip_right_unscaled = w-1;
+ gr_screen.clip_top_unscaled = 0;
+ gr_screen.clip_bottom_unscaled = h-1;
+ gr_screen.clip_width_unscaled = w;
+ gr_screen.clip_height_unscaled = h;
+
- if (to_resize) {
- gr_resize_screen_pos(&x, &y);
- gr_resize_screen_pos(&w, &h);
- } else {
- gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
- }
+ if (to_resize) {
+ gr_resize_screen_pos(&x, &y);
+ gr_resize_screen_pos(&w, &h);
+ } else {
+ gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
+ }
- gr_screen.offset_x = x;
- gr_screen.offset_y = y;
- gr_screen.clip_left = 0;
- gr_screen.clip_right = w-1;
- gr_screen.clip_top = 0;
- gr_screen.clip_bottom = h-1;
- gr_screen.clip_width = w;
- gr_screen.clip_height = h;
+ gr_screen.offset_x = x;
+ gr_screen.offset_y = y;
+ gr_screen.clip_left = 0;
+ gr_screen.clip_right = w-1;
+ gr_screen.clip_top = 0;
+ gr_screen.clip_bottom = h-1;
+ gr_screen.clip_width = w;
+ gr_screen.clip_height = h;
- gr_screen.clip_aspect = i2fl(w) / i2fl(h);
- gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
- gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
-
+ gr_screen.clip_aspect = i2fl(w) / i2fl(h);
+ gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
+ gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
+ }
// just return early if we aren't actually going to need the scissor test
if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
GL_state.ScissorTest(GL_FALSE);
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp (revision 5755)
+++ code/graphics/gropenglpostprocessing.cpp (working copy)
@@ -1,6 +1,7 @@
#include "graphics/gropenglpostprocessing.h"
#include "graphics/gropenglshader.h"
+#include "globalincs/systemvars.h"
#include "io/timer.h"
#include "nebula/neb.h"
#include "parse/parselo.h"
@@ -367,8 +368,13 @@
}
// Fix problems when player is dead and the screen is clipped.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ if (gr_screen.max_h != gr_screen.clip_height) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ } else if (Cutscene_bar_size) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, Cutscene_bar_size, gr_screen.max_w, gr_screen.max_h - Cutscene_bar_size * 2);
+ }
// Main post-processing render
render_target::apply_default();
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (revision 5755)
+++ code/graphics/grstub.cpp (working copy)
@@ -256,7 +256,7 @@
{
}
-void gr_stub_set_clip(int x, int y, int w, int h, bool resize)
+void gr_stub_set_clip(int x, int y, int w, int h, bool resize,bool fov_change)
{
}
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 5755)
+++ code/parse/sexp.cpp (working copy)
@@ -529,7 +529,7 @@
{ "set-training-context-speed", OP_SET_TRAINING_CONTEXT_SPEED, 2, 2, },
//Cutscene stuff
- { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 1, },
+ { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 2, },
{ "unset-cutscene-bars", OP_CUTSCENES_UNSET_CUTSCENE_BARS, 0, 1, },
{ "fade-in", OP_CUTSCENES_FADE_IN, 0, 1, },
{ "fade-out", OP_CUTSCENES_FADE_OUT, 0, 2, },
@@ -15546,8 +15546,10 @@
float delta_speed = 0.0f;
- if(node != -1)
+ if(node != -1) {
delta_speed = eval_num(node)/1000.0f;
+ node = CDR(node);
+ }
if(delta_speed > 0.0f)
{
@@ -15559,6 +15561,10 @@
{
Cutscene_bar_flags &= ~CUB_GRADUAL;
}
+
+ Cutscene_fov_change = true;
+ if(node != -1)
+ Cutscene_fov_change = is_sexp_true(node) != 0;
}
void sexp_unset_cutscene_bars(int node)
@@ -20146,6 +20152,11 @@
return OPF_NONE;
case OP_CUTSCENES_SET_CUTSCENE_BARS:
+ if (argnum==0)
+ return OPF_POSITIVE;
+ else
+ return OPF_BOOL;
+
case OP_CUTSCENES_UNSET_CUTSCENE_BARS:
case OP_CUTSCENES_FADE_IN:
case OP_CUTSCENES_FADE_OUT:
@@ -24212,8 +24223,9 @@
{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
"\tShows bars at the top and bottom of screen "
- "Takes 0 or 1 arguments...\r\n"
+ "Takes 0, 1 or 2 arguments...\r\n"
"\t1:\tMilliseconds for bars to slide in\r\n"
+ "\t2:\tWhether FOV should be changed (defaults to true)\r\n"
},
{ OP_CUTSCENES_UNSET_CUTSCENE_BARS, "unset-cutscene-bars\r\n"
-
M1768_patch_20100102.patch (13,140 bytes) 2010-01-02 10:36
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5755)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2817,6 +2817,8 @@
Cutscene_bars_progress = 1.0f;
}
+void bars_do_frame(float frametime);
+
void game_set_view_clip(float frametime)
{
if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
@@ -2829,16 +2831,16 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
if ( View_percent >= 100 ) {
gr_reset_clip();
+ bars_do_frame(frametime);
} else {
int xborder, yborder;
@@ -3860,14 +3862,35 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3907,22 +3930,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_render_setup(cid);
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4585,46 +4592,37 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
//Set rectangles
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false, Cutscene_fov_change );
+
+ Cutscene_bar_size = yborder;
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
- gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
+ gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false );
}
- }
-}
+
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false, Cutscene_fov_change );
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ Cutscene_bar_size = yborder;
}
+ else if(Cutscene_bar_size)
+ Cutscene_bar_size = 0;
}
//WMC - This does stuff like fading in and out and subtitles. Special FX?
@@ -4771,7 +4768,10 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
game_render_frame( cid );
Index: code/globalincs/systemvars.cpp
===================================================================
--- code/globalincs/systemvars.cpp (revision 5755)
+++ code/globalincs/systemvars.cpp (working copy)
@@ -33,6 +33,10 @@
float Cutscene_delta_time = 1.0f;
//How far along a change is (0 to 1)
float Cutscene_bars_progress = 1.0f;
+//Change FOV?
+bool Cutscene_fov_change = true;
+//Size of the bar
+int Cutscene_bar_size = 0;
//FADEIN STUFF
shader Viewer_shader;
Index: code/globalincs/systemvars.h
===================================================================
--- code/globalincs/systemvars.h (revision 5755)
+++ code/globalincs/systemvars.h (working copy)
@@ -57,7 +57,8 @@
//Styles to get to bars
#define CUB_GRADUAL (1<<15)
extern float Cutscene_bars_progress, Cutscene_delta_time;
-extern int Cutscene_bar_flags;
+extern int Cutscene_bar_flags, Cutscene_bar_size;
+extern bool Cutscene_fov_change;
//-----Fadein stuff
struct shader;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 5755)
+++ code/graphics/2d.h (working copy)
@@ -224,7 +224,7 @@
void (*gf_flash_alpha)(int r, int g, int b, int a);
// sets the clipping region
- void (*gf_set_clip)(int x, int y, int w, int h, bool resize);
+ void (*gf_set_clip)(int x, int y, int w, int h, bool resize, bool change_fov);
// resets the clipping region to entire screen
void (*gf_reset_clip)();
@@ -525,9 +525,9 @@
void gr_flip();
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
-__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
+__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true, bool change_fov=true)
{
- (*gr_screen.gf_set_clip)(x,y,w,h,resize);
+ (*gr_screen.gf_set_clip)(x,y,w,h,resize,change_fov);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 5755)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,7 +375,7 @@
#endif
}
-void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
+void gr_opengl_set_clip(int x, int y, int w, int h, bool resize, bool change_fov)
{
// check for sanity of parameters
if (x < 0) {
@@ -415,37 +415,39 @@
h = max_h;
}
- gr_screen.offset_x_unscaled = x;
- gr_screen.offset_y_unscaled = y;
- gr_screen.clip_left_unscaled = 0;
- gr_screen.clip_right_unscaled = w-1;
- gr_screen.clip_top_unscaled = 0;
- gr_screen.clip_bottom_unscaled = h-1;
- gr_screen.clip_width_unscaled = w;
- gr_screen.clip_height_unscaled = h;
+ if (change_fov) {
+ gr_screen.offset_x_unscaled = x;
+ gr_screen.offset_y_unscaled = y;
+ gr_screen.clip_left_unscaled = 0;
+ gr_screen.clip_right_unscaled = w-1;
+ gr_screen.clip_top_unscaled = 0;
+ gr_screen.clip_bottom_unscaled = h-1;
+ gr_screen.clip_width_unscaled = w;
+ gr_screen.clip_height_unscaled = h;
+
- if (to_resize) {
- gr_resize_screen_pos(&x, &y);
- gr_resize_screen_pos(&w, &h);
- } else {
- gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
- }
+ if (to_resize) {
+ gr_resize_screen_pos(&x, &y);
+ gr_resize_screen_pos(&w, &h);
+ } else {
+ gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
+ }
- gr_screen.offset_x = x;
- gr_screen.offset_y = y;
- gr_screen.clip_left = 0;
- gr_screen.clip_right = w-1;
- gr_screen.clip_top = 0;
- gr_screen.clip_bottom = h-1;
- gr_screen.clip_width = w;
- gr_screen.clip_height = h;
+ gr_screen.offset_x = x;
+ gr_screen.offset_y = y;
+ gr_screen.clip_left = 0;
+ gr_screen.clip_right = w-1;
+ gr_screen.clip_top = 0;
+ gr_screen.clip_bottom = h-1;
+ gr_screen.clip_width = w;
+ gr_screen.clip_height = h;
- gr_screen.clip_aspect = i2fl(w) / i2fl(h);
- gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
- gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
-
+ gr_screen.clip_aspect = i2fl(w) / i2fl(h);
+ gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
+ gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
+ }
// just return early if we aren't actually going to need the scissor test
if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
GL_state.ScissorTest(GL_FALSE);
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp (revision 5755)
+++ code/graphics/gropenglpostprocessing.cpp (working copy)
@@ -1,6 +1,7 @@
#include "graphics/gropenglpostprocessing.h"
#include "graphics/gropenglshader.h"
+#include "globalincs/systemvars.h"
#include "io/timer.h"
#include "nebula/neb.h"
#include "parse/parselo.h"
@@ -367,8 +368,13 @@
}
// Fix problems when player is dead and the screen is clipped.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ if (gr_screen.max_h != gr_screen.clip_height) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ } else if (Cutscene_bar_size) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, Cutscene_bar_size, gr_screen.max_w, gr_screen.max_h - Cutscene_bar_size * 2);
+ }
// Main post-processing render
render_target::apply_default();
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (revision 5755)
+++ code/graphics/grstub.cpp (working copy)
@@ -256,7 +256,7 @@
{
}
-void gr_stub_set_clip(int x, int y, int w, int h, bool resize)
+void gr_stub_set_clip(int x, int y, int w, int h, bool resize,bool fov_change)
{
}
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 5755)
+++ code/parse/sexp.cpp (working copy)
@@ -529,7 +529,7 @@
{ "set-training-context-speed", OP_SET_TRAINING_CONTEXT_SPEED, 2, 2, },
//Cutscene stuff
- { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 1, },
+ { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 2, },
{ "unset-cutscene-bars", OP_CUTSCENES_UNSET_CUTSCENE_BARS, 0, 1, },
{ "fade-in", OP_CUTSCENES_FADE_IN, 0, 1, },
{ "fade-out", OP_CUTSCENES_FADE_OUT, 0, 2, },
@@ -15546,8 +15546,10 @@
float delta_speed = 0.0f;
- if(node != -1)
+ if(node != -1) {
delta_speed = eval_num(node)/1000.0f;
+ node = CDR(node);
+ }
if(delta_speed > 0.0f)
{
@@ -15559,6 +15561,10 @@
{
Cutscene_bar_flags &= ~CUB_GRADUAL;
}
+
+ Cutscene_fov_change = true;
+ if(node != -1)
+ Cutscene_fov_change = is_sexp_true(node) != 0;
}
void sexp_unset_cutscene_bars(int node)
@@ -20146,6 +20152,11 @@
return OPF_NONE;
case OP_CUTSCENES_SET_CUTSCENE_BARS:
+ if (argnum==0)
+ return OPF_POSITIVE;
+ else
+ return OPF_BOOL;
+
case OP_CUTSCENES_UNSET_CUTSCENE_BARS:
case OP_CUTSCENES_FADE_IN:
case OP_CUTSCENES_FADE_OUT:
@@ -24212,8 +24223,9 @@
{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
"\tShows bars at the top and bottom of screen "
- "Takes 0 or 1 arguments...\r\n"
+ "Takes 0, 1 or 2 arguments...\r\n"
"\t1:\tMilliseconds for bars to slide in\r\n"
+ "\t2:\tWhether FOV should be changed (defaults to true)\r\n"
},
{ OP_CUTSCENES_UNSET_CUTSCENE_BARS, "unset-cutscene-bars\r\n"
-
M1768_patch_20100727.patch (12,714 bytes) 2010-07-27 23:22
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 6329)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2780,6 +2780,8 @@
Cutscene_bars_progress = 1.0f;
}
+void bars_do_frame(float frametime);
+
void game_set_view_clip(float frametime)
{
if ((Game_mode & GM_DEAD) || (supernova_active() >= 2))
@@ -2792,16 +2794,16 @@
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
- // J.S. I've changed my ways!! See the new "no constants" code!!!
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
- }
+ }
+ // Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
+ // J.S. I've changed my ways!! See the new "no constants" code!!!
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
else {
// Set the clip region for normal view
if ( View_percent >= 100 ) {
gr_reset_clip();
+ bars_do_frame(frametime);
} else {
int xborder, yborder;
@@ -3825,14 +3827,35 @@
int Game_subspace_effect = 0;
DCF_BOOL( subspace, Game_subspace_effect )
-void clip_frame_view();
-
// Does everything needed to render a frame
void game_render_frame( camid cid )
{
g3_start_frame(game_zbuffer);
+ // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
+ if ( Cmdline_env && !Env_cubemap_drawn ) {
+ setup_environment_mapping(cid);
+
+ if ( !Dynamic_environment ) {
+ Env_cubemap_drawn = true;
+ }
+
+ }
+
+ gr_zbuffer_clear(TRUE);
+
+ gr_reset_clip();
+
+ gr_screen.gf_post_process_before();
+
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
+
+ neb2_render_setup(cid);
+
camera *cam = cid.getCamera();
matrix eye_no_jitter = vmd_identity_matrix;
if(cam != NULL)
@@ -3872,22 +3895,6 @@
shield_point_multi_setup();
}
- // this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
- if ( Cmdline_env && !Env_cubemap_drawn ) {
- setup_environment_mapping(cid);
-
- if ( !Dynamic_environment ) {
- Env_cubemap_drawn = true;
- }
- }
- gr_zbuffer_clear(TRUE);
-
- gr_screen.gf_post_process_before();
-
- clip_frame_view();
-
- neb2_render_setup(cid);
-
#ifndef DYN_CLIP_DIST
if (!Cmdline_nohtl) {
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
@@ -4546,46 +4553,37 @@
else
yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR - fl2i(Cutscene_bars_progress*(gr_screen.max_h/CUTSCENE_BAR_DIVISOR));
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
//Set rectangles
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- //Set clipping
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );
}
+ //Set clipping
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false, Cutscene_fov_change );
+
+ Cutscene_bar_size = yborder;
}
else if(Cutscene_bar_flags & CUB_CUTSCENE)
{
int yborder = gr_screen.max_h/CUTSCENE_BAR_DIVISOR;
+ gr_reset_clip();
+
if (g3_in_frame() == 0) {
gr_set_color(0,0,0);
gr_rect(0, 0, gr_screen.max_w, yborder, false);
gr_rect(0, gr_screen.max_h-yborder, gr_screen.max_w, yborder, false);
- } else {
- gr_reset_clip();
- gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false );
}
- }
-}
+
+ gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - (yborder*2), false, Cutscene_fov_change );
-void clip_frame_view() {
- if(!Time_compression_locked) {
- // Player is dead
- game_set_view_clip(flFrametime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
- } else {
- // Player is dead
- game_set_view_clip(flRealframetime);
-
- // Cutscene bars
- bars_do_frame(flRealframetime);
+ Cutscene_bar_size = yborder;
}
+ else if(Cutscene_bar_size)
+ Cutscene_bar_size = 0;
}
//WMC - This does stuff like fading in and out and subtitles. Special FX?
@@ -4732,7 +4730,10 @@
DEBUG_GET_TIME( render3_time1 )
camid cid = game_render_frame_setup();
- clip_frame_view();
+ if(!Time_compression_locked)
+ game_set_view_clip(flFrametime);
+ else
+ game_set_view_clip(flRealframetime);
game_render_frame( cid );
Index: code/globalincs/systemvars.cpp
===================================================================
--- code/globalincs/systemvars.cpp (revision 6329)
+++ code/globalincs/systemvars.cpp (working copy)
@@ -33,6 +33,10 @@
float Cutscene_delta_time = 1.0f;
//How far along a change is (0 to 1)
float Cutscene_bars_progress = 1.0f;
+//Change FOV?
+bool Cutscene_fov_change = true;
+//Size of the bar
+int Cutscene_bar_size = 0;
//FADEIN STUFF
shader Viewer_shader;
Index: code/globalincs/systemvars.h
===================================================================
--- code/globalincs/systemvars.h (revision 6329)
+++ code/globalincs/systemvars.h (working copy)
@@ -57,7 +57,8 @@
//Styles to get to bars
#define CUB_GRADUAL (1<<15)
extern float Cutscene_bars_progress, Cutscene_delta_time;
-extern int Cutscene_bar_flags;
+extern int Cutscene_bar_flags, Cutscene_bar_size;
+extern bool Cutscene_fov_change;
//-----Fadein stuff
struct shader;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h (revision 6329)
+++ code/graphics/2d.h (working copy)
@@ -224,7 +224,7 @@
void (*gf_flash_alpha)(int r, int g, int b, int a);
// sets the clipping region
- void (*gf_set_clip)(int x, int y, int w, int h, bool resize);
+ void (*gf_set_clip)(int x, int y, int w, int h, bool resize, bool change_fov);
// resets the clipping region to entire screen
void (*gf_reset_clip)();
@@ -525,9 +525,9 @@
void gr_flip();
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
-__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
+__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true, bool change_fov=true)
{
- (*gr_screen.gf_set_clip)(x,y,w,h,resize);
+ (*gr_screen.gf_set_clip)(x,y,w,h,resize,change_fov);
}
#define gr_reset_clip GR_CALL(gr_screen.gf_reset_clip)
//#define gr_set_font GR_CALL(gr_screen.gf_set_font)
Index: code/graphics/gropengl.cpp
===================================================================
--- code/graphics/gropengl.cpp (revision 6329)
+++ code/graphics/gropengl.cpp (working copy)
@@ -375,7 +375,7 @@
#endif
}
-void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
+void gr_opengl_set_clip(int x, int y, int w, int h, bool resize, bool change_fov)
{
// check for sanity of parameters
if (x < 0) {
@@ -415,37 +415,39 @@
h = max_h;
}
- gr_screen.offset_x_unscaled = x;
- gr_screen.offset_y_unscaled = y;
- gr_screen.clip_left_unscaled = 0;
- gr_screen.clip_right_unscaled = w-1;
- gr_screen.clip_top_unscaled = 0;
- gr_screen.clip_bottom_unscaled = h-1;
- gr_screen.clip_width_unscaled = w;
- gr_screen.clip_height_unscaled = h;
+ if (change_fov) {
+ gr_screen.offset_x_unscaled = x;
+ gr_screen.offset_y_unscaled = y;
+ gr_screen.clip_left_unscaled = 0;
+ gr_screen.clip_right_unscaled = w-1;
+ gr_screen.clip_top_unscaled = 0;
+ gr_screen.clip_bottom_unscaled = h-1;
+ gr_screen.clip_width_unscaled = w;
+ gr_screen.clip_height_unscaled = h;
+
- if (to_resize) {
- gr_resize_screen_pos(&x, &y);
- gr_resize_screen_pos(&w, &h);
- } else {
- gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
- gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
- }
+ if (to_resize) {
+ gr_resize_screen_pos(&x, &y);
+ gr_resize_screen_pos(&w, &h);
+ } else {
+ gr_unsize_screen_pos( &gr_screen.offset_x_unscaled, &gr_screen.offset_y_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_right_unscaled, &gr_screen.clip_bottom_unscaled );
+ gr_unsize_screen_pos( &gr_screen.clip_width_unscaled, &gr_screen.clip_height_unscaled );
+ }
- gr_screen.offset_x = x;
- gr_screen.offset_y = y;
- gr_screen.clip_left = 0;
- gr_screen.clip_right = w-1;
- gr_screen.clip_top = 0;
- gr_screen.clip_bottom = h-1;
- gr_screen.clip_width = w;
- gr_screen.clip_height = h;
+ gr_screen.offset_x = x;
+ gr_screen.offset_y = y;
+ gr_screen.clip_left = 0;
+ gr_screen.clip_right = w-1;
+ gr_screen.clip_top = 0;
+ gr_screen.clip_bottom = h-1;
+ gr_screen.clip_width = w;
+ gr_screen.clip_height = h;
- gr_screen.clip_aspect = i2fl(w) / i2fl(h);
- gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
- gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
-
+ gr_screen.clip_aspect = i2fl(w) / i2fl(h);
+ gr_screen.clip_center_x = (gr_screen.clip_left + gr_screen.clip_right) * 0.5f;
+ gr_screen.clip_center_y = (gr_screen.clip_top + gr_screen.clip_bottom) * 0.5f;
+ }
// just return early if we aren't actually going to need the scissor test
if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
GL_state.ScissorTest(GL_FALSE);
Index: code/graphics/gropenglpostprocessing.cpp
===================================================================
--- code/graphics/gropenglpostprocessing.cpp (revision 6329)
+++ code/graphics/gropenglpostprocessing.cpp (working copy)
@@ -1,6 +1,7 @@
#include "graphics/gropenglpostprocessing.h"
#include "graphics/gropenglshader.h"
+#include "globalincs/systemvars.h"
#include "io/timer.h"
#include "nebula/neb.h"
#include "parse/parselo.h"
@@ -446,8 +447,13 @@
}
// Fix problems when player is dead and the screen is clipped.
- glEnable(GL_SCISSOR_TEST);
- glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ if (gr_screen.max_h != gr_screen.clip_height) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, (gr_screen.max_h-gr_screen.clip_height)/2, gr_screen.max_w, gr_screen.clip_height);
+ } else if (Cutscene_bar_size) {
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0, Cutscene_bar_size, gr_screen.max_w, gr_screen.max_h - Cutscene_bar_size * 2);
+ }
// Main post-processing render
render_target::apply_default();
Index: code/graphics/grstub.cpp
===================================================================
--- code/graphics/grstub.cpp (revision 6329)
+++ code/graphics/grstub.cpp (working copy)
@@ -257,7 +257,7 @@
{
}
-void gr_stub_set_clip(int x, int y, int w, int h, bool resize)
+void gr_stub_set_clip(int x, int y, int w, int h, bool resize,bool fov_change)
{
}
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 6329)
+++ code/parse/sexp.cpp (working copy)
@@ -541,7 +541,7 @@
{ "set-training-context-speed", OP_SET_TRAINING_CONTEXT_SPEED, 2, 2, },
//Cutscene stuff
- { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 1, },
+ { "set-cutscene-bars", OP_CUTSCENES_SET_CUTSCENE_BARS, 0, 2, },
{ "unset-cutscene-bars", OP_CUTSCENES_UNSET_CUTSCENE_BARS, 0, 1, },
{ "fade-in", OP_CUTSCENES_FADE_IN, 0, 1, },
{ "fade-out", OP_CUTSCENES_FADE_OUT, 0, 2, },
@@ -16062,8 +16062,10 @@
float delta_speed = 0.0f;
- if(node != -1)
+ if(node != -1) {
delta_speed = eval_num(node)/1000.0f;
+ node = CDR(node);
+ }
if(delta_speed > 0.0f)
{
@@ -16075,6 +16077,10 @@
{
Cutscene_bar_flags &= ~CUB_GRADUAL;
}
+
+ Cutscene_fov_change = true;
+ if(node != -1)
+ Cutscene_fov_change = is_sexp_true(node) != 0;
}
void sexp_unset_cutscene_bars(int node)
@@ -20942,6 +20948,11 @@
return OPF_NONE;
case OP_CUTSCENES_SET_CUTSCENE_BARS:
+ if (argnum==0)
+ return OPF_POSITIVE;
+ else
+ return OPF_BOOL;
+
case OP_CUTSCENES_UNSET_CUTSCENE_BARS:
case OP_CUTSCENES_FADE_IN:
case OP_CUTSCENES_FADE_OUT:
@@ -25026,8 +25037,9 @@
{ OP_CUTSCENES_SET_CUTSCENE_BARS, "set-cutscene-bars\r\n"
"\tShows bars at the top and bottom of screen. "
- "Takes 0 or 1 arguments...\r\n"
+ "Takes 0, 1 or 2 arguments...\r\n"
"\t1:\tMilliseconds for bars to slide in\r\n"
+ "\t2:\tWhether FOV should be changed (defaults to true)\r\n"
},
{ OP_CUTSCENES_UNSET_CUTSCENE_BARS, "unset-cutscene-bars\r\n"
-
test_cutbar.fs2 (2,389 bytes) 2011-08-09 09:19
|
---|