Skip to content
Snippets Groups Projects
Commit 160fb214 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@108 51575b47-30f0-44d4-a5cc-537603b46e54
parent be933156
No related branches found
No related tags found
No related merge requests found
game/data/gfx/border_7.png

206 B | W: | H:

game/data/gfx/border_7.png

224 B | W: | H:

game/data/gfx/border_7.png
game/data/gfx/border_7.png
game/data/gfx/border_7.png
game/data/gfx/border_7.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -91,6 +91,11 @@ function _M:loaded()
self._fov = core.fov.new(_M.opaque, _M.apply, self)
self._fov_lite = core.fov.new(_M.opaque, _M.applyLite, self)
self.changed = true
self._map = core.map.newMap(self.w, self.h, self.mx, self.my, self.viewport.mwidth, self.viewport.mheight)
for i = 0, self.w - 1 do for j = 0, self.h - 1 do
self:updateMap(i, j)
end end
end
--- Closes things in the object to allow it to be garbage collected
......@@ -111,7 +116,9 @@ function _M:fov(x, y, d)
if self.clean_fov then
self.clean_fov = false
for i = 0, self.w - 1 do for j = 0, self.h - 1 do
self.seens(i, j, false)
t[i + j * self.w] = nil
self:updateMap(i, j)
-- self.seens(i, j, false)
end end
-- for i = 0, self.w * self.h - 1 do self.seens[i] = nil end
end
......@@ -127,7 +134,9 @@ function _M:fovLite(x, y, d)
if self.clean_fov then
self.clean_fov = false
for i = 0, self.w - 1 do for j = 0, self.h - 1 do
self.seens(i, j, false)
t[i + j * self.w] = nil
self:updateMap(i, j)
-- self.seens(i, j, false)
end end
-- for i = 0, self.w * self.h - 1 do self.seens[i] = nil end
self._fov_lite(x, y, d)
......@@ -144,9 +153,9 @@ function _M:updateMap(x, y)
while not e and si <= #order do e = self(x, y, order[si]) si = si + 1 end
if e then
if self.seens[z] then
self._map:setGrid(x, y, self.tiles:get(e.display, e.color_r, e.color_g, e.color_b, e.color_br, e.color_bg, e.color_bb, e.image))
self._map:setGrid(x, y, self.tiles:get(e.display, e.color_r, e.color_g, e.color_b, e.color_br, e.color_bg, e.color_bb, e.image), 255)
elseif self.remembers[z] then
self._map:setGrid(x, y, self.tiles:get(e.display, e.color_r/3, e.color_g/3, e.color_b/3, e.color_br/3, e.color_bg/3, e.color_bb/3, e.image))
self._map:setGrid(x, y, self.tiles:get(e.display, e.color_r, e.color_g, e.color_b, e.color_br, e.color_bg, e.color_bb, e.image), 85)
end
end
end
......
......@@ -15,3 +15,9 @@ function _M:block_move(x, y, e)
end
return false
end
function _M:tooltip()
local mx, my = core.mouse.get()
local tmx, tmy = game.level.map:getMouseTile(mx, my)
return ("%d:%d\nSeen %s\nRemember %s\nLite %s"):format(tmx,tmy,tostring(game.level.map.seens(tmx, tmy)), tostring(game.level.map.remembers(tmx, tmy)), tostring(game.level.map.lites(tmx, tmy)))
end
......@@ -453,7 +453,7 @@ static int sdl_surface_erase(lua_State *L)
int r = lua_tonumber(L, 2);
int g = lua_tonumber(L, 3);
int b = lua_tonumber(L, 4);
SDL_FillRect(*s, NULL, SDL_MapRGB(screen->format, r, g, b));
SDL_FillRect(*s, NULL, SDL_MapRGBA((*s)->format, r, g, b, 125));
return 0;
}
......@@ -500,7 +500,7 @@ static int sdl_surface_toscreen(lua_State *L)
}
// Jonction entre OpenGL et SDL.
glTexImage2D(GL_TEXTURE_2D, 0, 3, (*s)->w, (*s)->h, 0, texture_format, GL_UNSIGNED_BYTE, (*s)->pixels);
glTexImage2D(GL_TEXTURE_2D, 0, nOfColors, (*s)->w, (*s)->h, 0, texture_format, GL_UNSIGNED_BYTE, (*s)->pixels);
glBegin( GL_QUADS ); /* Draw A Quad */
glTexCoord2f(0,0); glVertex2f(0 + x, 0 + y);
......@@ -571,7 +571,7 @@ static int sdl_surface_alpha(lua_State *L)
{
SDL_Surface **s = (SDL_Surface**)auxiliar_checkclass(L, "sdl{surface}", 1);
int a = luaL_checknumber(L, 2);
SDL_SetAlpha(*s, SDL_SRCALPHA | SDL_RLEACCEL, (a < 0) ? 0 : (a > 255) ? 255 : a);
// SDL_SetAlpha(*s, SDL_SRCALPHA | SDL_RLEACCEL, (a < 0) ? 0 : (a > 255) ? 255 : a);
return 0;
}
......
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