[Fix] Rumble can no longer "leak" over to menu, nebulae etc.
This commit is contained in:
parent
7eca1ff5b9
commit
dcaa96b5e9
@ -212,9 +212,11 @@ void nebu_render(const double dt) {
|
||||
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.);
|
||||
if(!paused) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glTranslated(shake_pos.x, shake_pos.y, 0.);
|
||||
}
|
||||
|
||||
/* Now render. */
|
||||
glBegin(GL_QUADS);
|
||||
@ -235,7 +237,8 @@ void nebu_render(const double dt) {
|
||||
glVertex2d(-SCREEN_W/2., SCREEN_H/2.);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix(); /* GL_PROJECTION */
|
||||
if(!paused)
|
||||
glPopMatrix(); /* GL_PROJECTION */
|
||||
|
||||
/* Set values to defaults. */
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
@ -262,7 +265,9 @@ void nebu_renderOverlay(const double dt) {
|
||||
/* Prepare the matrix. */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glTranslated(gui_xoff+shake_pos.x, gui_yoff+shake_pos.y, 0.);
|
||||
glTranslated(gui_xoff, gui_yoff, 0.);
|
||||
if(!paused)
|
||||
glTranslated(gui_xoff+shake_pos.x, gui_yoff+shake_pos.y, 0.);
|
||||
|
||||
/* Mask for area player can still see (partially). */
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
18
src/opengl.c
18
src/opengl.c
@ -936,6 +936,17 @@ int gl_init(void) {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* Good blend model. */
|
||||
|
||||
/* Set up the matrix. */
|
||||
gl_defViewport();
|
||||
|
||||
/* Finishing touches. */
|
||||
glClear(GL_COLOR_BUFFER_BIT); /* Must clear the buffer first. */
|
||||
gl_checkErr();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reset viewport to default. */
|
||||
void gl_defViewport(void) {
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-SCREEN_W /2, /* Left edge. */
|
||||
@ -944,13 +955,6 @@ int gl_init(void) {
|
||||
SCREEN_H /2, /* Top edge. */
|
||||
-1., /* Near. */
|
||||
1.); /* Far. */
|
||||
|
||||
|
||||
/* Finishing touches. */
|
||||
glClear(GL_COLOR_BUFFER_BIT); /* Must clear the buffer first. */
|
||||
gl_checkErr();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Clean up our mess. */
|
||||
|
@ -104,6 +104,7 @@ int gl_init(void);
|
||||
void gl_exit(void);
|
||||
|
||||
/* Misc. */
|
||||
void gl_defViewport(void);
|
||||
int gl_pot(int n);
|
||||
int gl_isTrans(const glTexture* t, const int x, const int y);
|
||||
void gl_getSpriteFromDir(int* x, int* y, const glTexture* t, const double dir);
|
||||
|
@ -58,9 +58,11 @@ static int spfx_base_load(char* name, int anim, char* gfx, int sx, int sy) {
|
||||
SPFX_Base* cur;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
/* Create new effect. */
|
||||
spfx_effects = realloc(spfx_effects, ++spfx_neffects*sizeof(SPFX_Base));
|
||||
cur = &spfx_effects[spfx_neffects-1];
|
||||
|
||||
/* Fill it with the data. */
|
||||
cur->name = strdup(name);
|
||||
cur->anim = (double)anim / 1000.;
|
||||
sprintf(buf, SPFX_GFX"%s", gfx);
|
||||
@ -83,8 +85,11 @@ int spfx_get(char* name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Load/Unload. */
|
||||
/* Load/Unload.
|
||||
* TODO: make it customizable?
|
||||
*/
|
||||
int spfx_load(void) {
|
||||
/* Standard explosion effects. */
|
||||
spfx_base_load("ExpS", 400, "exps.png", 6, 5);
|
||||
spfx_base_load("ExpM", 450, "expm.png", 6, 5);
|
||||
spfx_base_load("ExpL", 500, "expl.png", 6, 5);
|
||||
@ -207,6 +212,7 @@ void spfx_start(double dt) {
|
||||
vect_pset(&shake_vel, shake_rad,
|
||||
-VANGLE(shake_pos) + (RNGF()-0.5) * M_PI);
|
||||
}
|
||||
/* The shake decays over time. */
|
||||
shake_rad -= SHAKE_DECAY * dt;
|
||||
if(shake_rad < 0.) shake_rad = 0.;
|
||||
|
||||
|
@ -498,6 +498,7 @@ unsigned int window_create(char* name, const int x, const int y,
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
toolkit = 1; /* Enable it. */
|
||||
pause_game();
|
||||
gl_defViewport(); /* Reset the default viewport. */
|
||||
}
|
||||
|
||||
return wid;
|
||||
|
Loading…
Reference in New Issue
Block a user