From: LMH Date: Mon, 16 Jan 2012 22:10:40 +0000 (-1000) Subject: bug fix to lighting and hitbox for mriceblock (bug 832 & 856) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=aef919e9eb1d47b7389119d19f90e21b1b14625f;p=supertux.git bug fix to lighting and hitbox for mriceblock (bug 832 & 856) --- diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 932eb167b..75aac2e2e 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -230,6 +230,7 @@ MrIceBlock::set_state(IceState state, bool up) switch(state) { case ICESTATE_NORMAL: + this->set_action(dir == LEFT ? "left" : "right", /* loops = */ -1); WalkingBadguy::initialize(); break; case ICESTATE_FLAT: diff --git a/src/video/gl/gl_lightmap.cpp b/src/video/gl/gl_lightmap.cpp index 5722d9217..2ac49efd7 100644 --- a/src/video/gl/gl_lightmap.cpp +++ b/src/video/gl/gl_lightmap.cpp @@ -72,7 +72,7 @@ GLLightmap::start_draw(const Color &ambient_color) { glGetFloatv(GL_VIEWPORT, old_viewport); //save viewport - glViewport(old_viewport[0], SCREEN_HEIGHT - lightmap_height + old_viewport[1], lightmap_width, lightmap_height); + glViewport(old_viewport[0], old_viewport[3] - lightmap_height + old_viewport[1], lightmap_width, lightmap_height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); #ifdef GL_VERSION_ES_CM_1_0 @@ -92,7 +92,7 @@ GLLightmap::end_draw() { glDisable(GL_BLEND); glBindTexture(GL_TEXTURE_2D, lightmap->get_handle()); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, old_viewport[0], SCREEN_HEIGHT - lightmap_height + old_viewport[1], lightmap_width, lightmap_height); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, old_viewport[0], old_viewport[3] - lightmap_height + old_viewport[1], lightmap_width, lightmap_height); glViewport(old_viewport[0], old_viewport[1], old_viewport[2], old_viewport[3]); glMatrixMode(GL_PROJECTION); @@ -105,7 +105,9 @@ GLLightmap::end_draw() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_BLEND); - //glClear(GL_COLOR_BUFFER_BIT); + + glClearColor(0, 0, 0, 1 ); + glClear(GL_COLOR_BUFFER_BIT); } void @@ -270,7 +272,7 @@ GLLightmap::get_light(const DrawingRequest& request) const pixels[i] = 0.0f; //set to black float posX = request.pos.x * lightmap_width / SCREEN_WIDTH + old_viewport[0]; - float posY = SCREEN_HEIGHT + old_viewport[1] - request.pos.y * lightmap_height / SCREEN_HEIGHT; + float posY = old_viewport[3] + old_viewport[1] - request.pos.y * lightmap_height / SCREEN_HEIGHT; glReadPixels((GLint) posX, (GLint) posY , 1, 1, GL_RGB, GL_FLOAT, pixels); *(getlightrequest->color_ptr) = Color( pixels[0], pixels[1], pixels[2]); }