From 05ed57907ff70f35aeb801c2796ef6aaeec052c7 Mon Sep 17 00:00:00 2001 From: Allanis Date: Thu, 23 May 2013 15:06:25 +0100 Subject: [PATCH] [Change] Seperated cinematics into spfx. --- src/player.c | 19 ++----------------- src/spfx.c | 20 ++++++++++++++++++++ src/spfx.h | 3 +++ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/player.c b/src/player.c index a87cee5..2e32fb1 100644 --- a/src/player.c +++ b/src/player.c @@ -498,23 +498,8 @@ void player_render(void) { pilot_render(player); // Fancy cinematic scene borders. - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); // Translation matrix. - glTranslated(x-(double)gl_screen.w/2., y-(double)gl_screen.h/2., 0); - - COLOUR(cBlack); - glBegin(GL_QUADS); - glVertex2d(0., 0.); - glVertex2d(0., gl_screen.h*0.2); - glVertex2d(gl_screen.w, gl_screen.h*0.2); - glVertex2d(gl_screen.w, 0.); - glVertex2d(0., gl_screen.h); - glVertex2d(gl_screen.w, gl_screen.h); - glVertex2d(0., gl_screen.h*0.8); - glEnd(); - - glPopMatrix(); // Translation matrix. - + spfx_cinematic(); + return; } diff --git a/src/spfx.c b/src/spfx.c index 10548a0..ecd1370 100644 --- a/src/spfx.c +++ b/src/spfx.c @@ -229,6 +229,26 @@ void spfx_shake(double mod) { vect_pset(&shake_vel, shake_rad, RNGF() * 2. * M_PI); } +void spfx_cinematic(void) { + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); // Translation matrix. + glTranslated(-(double)gl_screen.w/2., -(double)gl_screen.h/2., 0); + + COLOUR(cBlack); + glBegin(GL_QUADS); + glVertex2d(0., 0.); + glVertex2d(0., gl_screen.h*0.2); + glVertex2d(gl_screen.w, gl_screen.h*0.2); + glVertex2d(gl_screen.w, 0.); + glVertex2d(0., gl_screen.h); + glVertex2d(gl_screen.w, gl_screen.h); + glVertex2d(gl_screen.w, gl_screen.h*0.8); + glVertex2d(0., gl_screen.h*0.8); + glEnd(); + + glPopMatrix(); // Translation matrix. +} + void spfx_render(const int layer) { SPFX* spfx_stack; int i, spfx_nstack; diff --git a/src/spfx.h b/src/spfx.h index e3fe43d..70174d6 100644 --- a/src/spfx.h +++ b/src/spfx.h @@ -23,6 +23,9 @@ void spfx_clear(void); void spfx_start(double dt); void spfx_shake(double mod); +// Other effects. +void spfx_cinematic(void); + // Load/free. int spfx_load(void); void spfx_free(void);