From 48af860718aeca6e27f453eaae222004052c5eef Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 17 Dec 2012 23:52:39 +0000 Subject: [PATCH] Fixed particles staying in the faded log git-svn-id: http://svn.net-core.org/repos/t-engine4@6121 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/engine/Entity.lua | 4 ++-- game/engines/default/engine/LogDisplay.lua | 2 +- src/map.c | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/game/engines/default/engine/Entity.lua b/game/engines/default/engine/Entity.lua index 60212d79c0..a18e6a48c5 100644 --- a/game/engines/default/engine/Entity.lua +++ b/game/engines/default/engine/Entity.lua @@ -483,7 +483,7 @@ end -- @param w the width -- @param h the height -- @param a the alpha setting, defaults to 1 -function _M:toScreen(tiles, x, y, w, h, a) +function _M:toScreen(tiles, x, y, w, h, a, allow_cb, allow_shader) local Map = require "engine.Map" tiles = tiles or Map.tiles @@ -493,7 +493,7 @@ function _M:toScreen(tiles, x, y, w, h, a) for i = 1, Map.zdepth do if mos[i] then list[#list+1] = mos[i] end end - core.map.mapObjectsToScreen(x, y, w, h, a, unpack(list)) + core.map.mapObjectsToScreen(x, y, w, h, a, allow_cb, allow_shader, unpack(list)) end --- Resolves an entity diff --git a/game/engines/default/engine/LogDisplay.lua b/game/engines/default/engine/LogDisplay.lua index 4c84818603..3c77940774 100644 --- a/game/engines/default/engine/LogDisplay.lua +++ b/game/engines/default/engine/LogDisplay.lua @@ -244,7 +244,7 @@ function _M:toScreen() self.dlist[i].dh = h if self.shadow then item._tex:toScreenFull(self.display_x+2, h+2, item.w, item.h, item._tex_w, item._tex_h, 0,0,0, self.shadow * fade) end item._tex:toScreenFull(self.display_x, h, item.w, item.h, item._tex_w, item._tex_h, 1, 1, 1, fade) - for di = 1, #item._dduids do item._dduids[di].e:toScreen(nil, self.display_x + item._dduids[di].x, h, item._dduids[di].w, item._dduids[di].w, fade) end + for di = 1, #item._dduids do item._dduids[di].e:toScreen(nil, self.display_x + item._dduids[di].x, h, item._dduids[di].w, item._dduids[di].w, fade, false, false) end h = h - self.fh end diff --git a/src/map.c b/src/map.c index 9bef3140f1..602f361b40 100644 --- a/src/map.c +++ b/src/map.c @@ -376,6 +376,10 @@ static int map_objects_toscreen(lua_State *L) int w = luaL_checknumber(L, 3); int h = luaL_checknumber(L, 4); float a = (lua_isnumber(L, 5) ? lua_tonumber(L, 5) : 1); + bool allow_cb = TRUE; + bool allow_shader = TRUE; + if (lua_isboolean(L, 6)) allow_cb = lua_toboolean(L, 6); + if (lua_isboolean(L, 7)) allow_shader = lua_toboolean(L, 7); GLfloat vertices[3*4]; GLfloat texcoords[2*4] = { @@ -398,14 +402,14 @@ static int map_objects_toscreen(lua_State *L) /*************************************************** * Render ***************************************************/ - int moid = 6; + int moid = 8; while (lua_isuserdata(L, moid)) { map_object *m = (map_object*)auxiliar_checkclass(L, "core{mapobj}", moid); map_object *dm; int z; - if (m->shader) useShader(m->shader, 1, 1, 1, 1, 1, 1, 1, 1); + if (allow_shader && m->shader) useShader(m->shader, 1, 1, 1, 1, 1, 1, 1, 1); for (z = (!shaders_active) ? 0 : (m->nb_textures - 1); z >= 0; z--) { if (multitexture_active && shaders_active) tglActiveTexture(GL_TEXTURE0+z); @@ -434,9 +438,9 @@ static int map_objects_toscreen(lua_State *L) vertices[9] = dx; vertices[10] = dh + dy; vertices[11] = dz; glDrawArrays(GL_QUADS, 0, 4); - if (dm->cb_ref != LUA_NOREF) + if (allow_cb && (dm->cb_ref != LUA_NOREF)) { - if (m->shader) glUseProgramObjectARB(0); + if (allow_shader && m->shader) glUseProgramObjectARB(0); int dx = x + dm->dx * w, dy = y + dm->dy * h; float dw = w * dm->dw; float dh = h * dm->dh; @@ -459,14 +463,14 @@ static int map_objects_toscreen(lua_State *L) } lua_pop(L, 1); - if (m->shader) useShader(m->shader, 1, 1, 1, 1, 1, 1, 1, 1); + if (allow_shader && m->shader) useShader(m->shader, 1, 1, 1, 1, 1, 1, 1, 1); } dm = dm->next; nb++; } - if (m->shader) glUseProgramObjectARB(0); + if (allow_shader && m->shader) glUseProgramObjectARB(0); moid++; } -- GitLab