diff --git a/game/data/gfx/border_7.png b/game/data/gfx/border_7.png index d8061a78e7ea5faa7ccf27740c352169ce9b6852..51c1ecb1d947edf38ea088270f813386c588656d 100644 Binary files a/game/data/gfx/border_7.png and b/game/data/gfx/border_7.png differ diff --git a/game/engine/Map.lua b/game/engine/Map.lua index 90aad086a93b07ce35e985da77294d95e9882ca3..656af802a555e73132259b0c6143f23ca7b8b095 100644 --- a/game/engine/Map.lua +++ b/game/engine/Map.lua @@ -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 diff --git a/game/modules/tome/class/Grid.lua b/game/modules/tome/class/Grid.lua index 8c9a2029e091b230bdefaf45df4dc66ee9394811..cc516c639401280018453647860b2b279769ebb5 100644 --- a/game/modules/tome/class/Grid.lua +++ b/game/modules/tome/class/Grid.lua @@ -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 diff --git a/src/core_lua.c b/src/core_lua.c index 98481dcee70c42c05ce038942fc3a43f902d6ec5..7d0024ff3c59beb8007c693b23afe6cafc653a0b 100644 --- a/src/core_lua.c +++ b/src/core_lua.c @@ -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; }