Skip to content
Snippets Groups Projects
Commit 6a291ba3 authored by dg's avatar dg
Browse files

Demon/Naga invasions can not happen in Reknor

git-svn-id: http://svn.net-core.org/repos/t-engine4@5418 51575b47-30f0-44d4-a5cc-537603b46e54
parent 9450e40d
No related branches found
No related tags found
No related merge requests found
......@@ -188,9 +188,10 @@ end
function _M:generateRow(row, force)
local max_h = 0
row.cells = {}
local text
for j=1, #self.columns do
local col = self.columns[j]
row.cells[j] = row.cells[j] or {}
row.cells[j] = {}
-- if color for each column is different
if row.color and type(row.color[1]) == "table" then
......@@ -200,31 +201,15 @@ function _M:generateRow(row, force)
row.color = row.color or {255,255,255}
end
if not row.cells[j]._tex then
if col.direct_draw then
row.cells[j].w, row.cells[j].h = col.direct_draw(row, 0, 0, col.width, self.row_height, 0, 0, 0, 0, self.dest_area) or self.row_height, self.row_height
else
if type(col.display_prop) == "function" then
text = col.display_prop(row)
else
text = row[col.display_prop or col.sort]
end
if type(text) ~= "table" or not text.is_tstring then
text = util.getval(text, row)
if type(text) ~= "table" then text = tstring.from(tostring(text)) end
end
if text.is_tstring then
gen = self.font:draw(text:toString(), text:maxWidth(self.font), 255, 255, 255)
else
gen = self.font:draw(text, text:toTString():maxWidth(self.font), 255, 255, 255)
end
row.cells[j]._tex, row.cells[j]._tex_w, row.cells[j]._tex_h, row.cells[j].w, row.cells[j].h = gen[1]._tex, gen[1]._tex_w, gen[1]._tex_h, gen[1].w, gen[1].h
if col.direct_draw then
row.cells[j].w, row.cells[j].h = col.direct_draw(row, 0, 0, col.width, self.row_height, 0, 0, 0, 0, self.dest_area) or self.row_height, self.row_height
else
text = tostring(row[col.display_prop or col.sort])
gen = self.font:draw(text, text:toTString():maxWidth(self.font), 255, 255, 255)
row.cells[j]._tex, row.cells[j]._tex_w, row.cells[j]._tex_h, row.cells[j].w, row.cells[j].h = gen[1]._tex, gen[1]._tex_w, gen[1]._tex_h, gen[1].w, gen[1].h
if row.cells[j].w > col.width - 2 * col.frame_sel.b4.w then
row.cells[j].display_offset = { x = 0, x_dir = 0 }
end
if row.cells[j].w > col.width - 2 * col.frame_sel.b4.w then
row.cells[j].display_offset = { x = 0, x_dir = 0 }
end
end
if row.cells[j].h > max_h then max_h = row.cells[j].h end
......@@ -306,7 +291,7 @@ function _M:drawRow(row, row_i, nb_keyframes, x, y, total_w, total_h, loffset_x,
local one_by_tex_h = 1 / row.cells[j]._tex_h -- precalculate for using it to multiply instead of division
local one_by_tex_w = 1 / row.cells[j]._tex_w
if row.cells[j].display_offset then
if row.cells[j].display_offset and not self.only_display then
if self.sel == row_i then
-- if we are going right
if row.cells[j].display_offset.x_dir == 0 then
......@@ -405,7 +390,7 @@ function _M:setList(list, force)
self.max_h = self.max_h_columns
for i=1, #self.list do
local row = self.list[i]
if self.focus_decay_max then self.list[i].focus_decay = 0 end
if self.focus_decay_max then row.focus_decay = 0 end
self:generateRow(row)
self.max_h = self.max_h + row.h
end
......
......@@ -102,7 +102,7 @@ function _M:createItem(item, text)
if self.scrollbar then
gen = self.font:draw(text:toString(), self.fw - self.scrollbar.w , 255, 255, 255)
else
gen = self.font:draw(text:toString(), self.fw, 255, 255, 255) -- bug with UIDs displaying
gen = self.font:draw(text:toString(), self.fw, 255, 255, 255)
end
self.max_h = 0
......
......@@ -18,7 +18,6 @@
-- darkgod@te4.org
return { one_per_level=true,
{group="fareast-generic", percent_factor=1.5},
{group="majeyal-generic", percent_factor=1.5},
{name="cultists", percent=10},
}
......@@ -145,15 +145,9 @@ static int map_object_free(lua_State *L)
static int map_object_cb(lua_State *L)
{
map_object *obj = (map_object*)auxiliar_checkclass(L, "core{mapobj}", 1);
if (lua_isfunction(L, 2))
{
obj->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
}
else
{
if (obj->cb_ref != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, obj->cb_ref);
obj->cb_ref = LUA_NOREF;
}
if (obj->cb_ref != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, obj->cb_ref);
if (lua_isfunction(L, 2)) obj->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
else obj->cb_ref = LUA_NOREF;
return 0;
}
......@@ -492,7 +486,7 @@ static int map_objects_display(lua_State *L)
CHECKGL(glPushMatrix());
/* Reset The View */
glLoadIdentity();
tglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
CHECKGL(glClear(GL_COLOR_BUFFER_BIT));
......@@ -567,7 +561,7 @@ static int map_objects_display(lua_State *L)
glMatrixMode(GL_PROJECTION);
CHECKGL(glPopMatrix());
glMatrixMode( GL_MODELVIEW );
tglClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
......@@ -1456,9 +1450,9 @@ static int map_to_screen(lua_State *L)
map->used_mx = mx;
map->used_my = my;
int mini = mx - 1, maxi = mx + map->mwidth + 2, minj = my - 1, maxj = my + map->mheight + 2;
if(mini < 0)
mini = 0;
if(minj < 0)
......@@ -1578,9 +1572,9 @@ static int minimap_to_screen(lua_State *L)
int ptr;
GLubyte *mm = map->minimap;
memset(mm, 0, map->mm_rh * map->mm_rw * 4 * sizeof(GLubyte));
int mini = mdx, maxi = mdx + mdw, minj = mdy, maxj = mdy + mdh;
if(mini < 0)
mini = 0;
if(minj < 0)
......@@ -1589,7 +1583,7 @@ static int minimap_to_screen(lua_State *L)
maxi = map->w;
if(maxj > map->h)
maxj = map->h;
for (z = 0; z < map->zdepth; z++)
{
for (j = minj; j < maxj; j++)
......
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