Skip to content
Snippets Groups Projects
Commit 48af8607 authored by dg's avatar dg
Browse files

Fixed particles staying in the faded log

git-svn-id: http://svn.net-core.org/repos/t-engine4@6121 51575b47-30f0-44d4-a5cc-537603b46e54
parent d8449d20
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
......@@ -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++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment