diff --git a/game/engines/default/engine/Entity.lua b/game/engines/default/engine/Entity.lua index 72172816fe9d6511839c7b721959549f8d47e4bc..fa7f1d4094084ad3947197299e51f6fa0489d743 100644 --- a/game/engines/default/engine/Entity.lua +++ b/game/engines/default/engine/Entity.lua @@ -212,7 +212,8 @@ function _M:defineDisplayCallback() for i = 1, #ps do e = ps[i] e:checkDisplay() - if e.ps:isAlive() then e.ps:toScreen(x + w / 2, y + h / 2, true, w / game.level.map.tile_w) + if e.ps:isAlive() then + e.ps:toScreen(x + w / 2, y + h / 2, true, w / game.level.map.tile_w) else end end diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua index a444872d735562efbda757d1e7618b4b6db40319..a83ae392eec2a840d2f40779e48166e9e4cf29d3 100644 --- a/game/engines/default/engine/Map.lua +++ b/game/engines/default/engine/Map.lua @@ -1014,6 +1014,7 @@ function _M:displayParticles(nb_keyframes) local alive local del = {} local e = next(self.particles) + local dx, dy = self.display_x, self.display_y while e do if e.ps then adx, ady = 0, 0 @@ -1030,14 +1031,14 @@ function _M:displayParticles(nb_keyframes) if nb_keyframes == 0 and e.x and e.y then -- Just display it, not updating, no emitting if e.x + e.radius >= self.mx and e.x - e.radius < self.mx + self.viewport.mwidth and e.y + e.radius >= self.my and e.y - e.radius < self.my + self.viewport.mheight then - e.ps:toScreen(self.display_x + (adx + e.x - self.mx + 0.5) * self.tile_w * self.zoom, self.display_y + (ady + e.y - self.my + 0.5) * self.tile_h * self.zoom, self.seens(e.x, e.y) or e.always_seen, e.zoom * self.zoom) + e.ps:toScreen(dx + (adx + e.x - self.mx + 0.5) * self.tile_w * self.zoom, dy + (ady + e.y - self.my + 0.5) * self.tile_h * self.zoom, self.seens(e.x, e.y) or e.always_seen, e.zoom * self.zoom) end elseif e.x and e.y then alive = e.ps:isAlive() -- Update more, if needed if alive and e.x + e.radius >= self.mx and e.x - e.radius < self.mx + self.viewport.mwidth and e.y + e.radius >= self.my and e.y - e.radius < self.my + self.viewport.mheight then - e.ps:toScreen(self.display_x + (adx + e.x - self.mx + 0.5) * self.tile_w * self.zoom, self.display_y + (ady + e.y - self.my + 0.5) * self.tile_h * self.zoom, self.seens(e.x, e.y) or e.always_seen) + e.ps:toScreen(dx + (adx + e.x - self.mx + 0.5) * self.tile_w * self.zoom, dy + (ady + e.y - self.my + 0.5) * self.tile_h * self.zoom, self.seens(e.x, e.y) or e.always_seen) end if not alive then diff --git a/src/map.c b/src/map.c index 86bb3903e18bfe088c70b04a9fd1803af9e3f6c7..0a5d9ea398ebdee52cc6ce625832b05e983ac816 100644 --- a/src/map.c +++ b/src/map.c @@ -276,11 +276,13 @@ static int map_object_get_move_anim(lua_State *L) if (!obj->move_max || obj->display_last == DL_NONE) { +// printf("==== GET %f x %f\n", mapdx, mapdy); lua_pushnumber(L, mapdx); lua_pushnumber(L, mapdy); } else { +// printf("==== GET %f x %f :: %f x %f\n", mapdx, mapdy,obj->animdx,obj->animdy); lua_pushnumber(L, mapdx + obj->animdx); lua_pushnumber(L, mapdy + obj->animdy); } @@ -1195,6 +1197,7 @@ void display_map_quad(GLuint *cur_tex, int *vert_idx, int *col_idx, map_type *ma // Final step animdx = adx * m->move_step / (float)m->move_max - adx; animdy = ady * m->move_step / (float)m->move_max - ady; +// printf("==computing %f x %f : %f x %f // %d/%d\n", animdx, animdy, adx, ady, m->move_step, m->move_max); } } diff --git a/src/particles.c b/src/particles.c index 08e9913e9f80cdb45b28134312824db1b757288f..c44fcf19b5bc4c8ce3b085fff194c8611c16574c 100644 --- a/src/particles.c +++ b/src/particles.c @@ -162,15 +162,21 @@ static int particles_to_screen(lua_State *L) GLfloat *colors = ps->colors; GLshort *texcoords = ps->texcoords; - SDL_mutexP(ps->lock); + if (x < -10000) x = -10000; + if (x > 10000) x = 10000; + if (y < -10000) y = -10000; + if (y > 10000) y = 10000; // No texture? abord if (!ps->texture) return 0; + SDL_mutexP(ps->lock); + glBindTexture(GL_TEXTURE_2D, ps->texture); glTexCoordPointer(2, GL_SHORT, 0, texcoords); glColorPointer(4, GL_FLOAT, 0, colors); glVertexPointer(2, GL_FLOAT, 0, vertices); + glTranslatef(x, y, 0); glPushMatrix(); glScalef(ps->zoom * zoom, ps->zoom * zoom, ps->zoom * zoom); @@ -184,12 +190,12 @@ static int particles_to_screen(lua_State *L) } if (remaining) glDrawArrays(GL_QUADS, 0, remaining); - SDL_mutexV(ps->lock); - glRotatef(-ps->rotate, 0, 0, 1); glPopMatrix(); glTranslatef(-x, -y, 0); + SDL_mutexV(ps->lock); + return 0; }