From 9fb781d27e98464f677d50e1a7b503f4a553b8cc Mon Sep 17 00:00:00 2001 From: Allanis Date: Sun, 21 Jul 2013 13:29:05 +0100 Subject: [PATCH] [Fix] Rumble no longer affects nebulae. --- src/nebulae.c | 11 ++++++++++- src/spfx.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/nebulae.c b/src/nebulae.c index 6c64efe..cdaccdb 100644 --- a/src/nebulae.c +++ b/src/nebulae.c @@ -16,7 +16,9 @@ #define NEBULAE_Z 16 /* Z plane. */ #define NEBULAE_PATH "gen/nebu_%02d.png" +/* Extern. */ extern double gui_xoff, gui_yoff; +extern Vec2 shake_pos; /* The nebulae textures. */ static GLuint nebu_textures[NEBULAE_Z]; @@ -168,6 +170,11 @@ void nebu_render(void) { glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); + /* Compensate possible rubmle. */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glTranslated(shake_pos.x, shake_pos.y, 0.); + /* Now render. */ glBegin(GL_QUADS); glMultiTexCoord2d(GL_TEXTURE0, 0., 0.); @@ -187,6 +194,8 @@ void nebu_render(void) { glVertex2d(-SCREEN_W/2., SCREEN_H/2.); glEnd(); + glPopMatrix(); /* GL_PROJECTION */ + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glDisable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); @@ -204,7 +213,7 @@ void nebu_renderOverlay(double density) { glShadeModel(GL_SMOOTH); glMatrixMode(GL_PROJECTION); glPushMatrix(); - glTranslated(gui_xoff, gui_yoff, 0.); + glTranslated(gui_xoff+shake_pos.x, gui_yoff+shake_pos.y, 0.); /* Stuff player partially sees. */ glBegin(GL_TRIANGLE_FAN); diff --git a/src/spfx.c b/src/spfx.c index e4fab07..0bfe905 100644 --- a/src/spfx.c +++ b/src/spfx.c @@ -16,7 +16,7 @@ /* Shake, AKA RUMBLE! */ static double shake_rad = 0.; -static Vec2 shake_pos = { .x = 0., .y = 0. }; +Vec2 shake_pos = { .x = 0., .y = 0. }; /* Used in nebulae.c */ static Vec2 shake_vel = { .x = 0., .y = 0. }; static int shake_off = 1;