From 160fb2141d09fd8ba540f866ff2ab9e2ce01e7d7 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 9 Dec 2009 22:06:57 +0000
Subject: [PATCH] fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@108 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/data/gfx/border_7.png       | Bin 206 -> 224 bytes
 game/engine/Map.lua              |  17 +++++++++++++----
 game/modules/tome/class/Grid.lua |   6 ++++++
 src/core_lua.c                   |   6 +++---
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/game/data/gfx/border_7.png b/game/data/gfx/border_7.png
index d8061a78e7ea5faa7ccf27740c352169ce9b6852..51c1ecb1d947edf38ea088270f813386c588656d 100644
GIT binary patch
delta 38
rcmX@d_<(VOAwOG^x4R3&e-K=-clqRrdh(n+oWksyL49F<6T>P14!R9>

delta 22
dcmaFBc#d&`;Y4Q{PHss~GXrLW5YdSl6#z?c1`7ZH

diff --git a/game/engine/Map.lua b/game/engine/Map.lua
index 90aad086a9..656af802a5 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 8c9a2029e0..cc516c6394 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 98481dcee7..7d0024ff3c 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;
 }
 
-- 
GitLab