From 046d0197b36e1fd85d4a35a88b4b35f0418ff429 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Mon, 7 Sep 2009 09:03:03 +0000
Subject: [PATCH] stead fixes + gfx mouse fix
---
src/sdl-instead/game.c | 6 ++++--
src/sdl-instead/game.h | 1 +
src/sdl-instead/graphics.c | 2 ++
stead/stead.lua | 8 ++++----
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index 3aca300..3ae0519 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -8,7 +8,7 @@ char *curgame_dir = NULL;
int game_own_theme = 0;
-static void game_cursor(int on);
+void game_cursor(int on);
static void mouse_reset(void);
static void menu_toggle(void);
@@ -1096,6 +1096,7 @@ int game_cmd(char *cmd)
/* draw title and ways */
if (new_pict || new_place) {
+ game_cursor(-1);
img_t offscreen = gfx_new(game_theme.w, game_theme.h);
oldscreen = gfx_screen(offscreen);
gfx_draw(oldscreen, 0, 0);
@@ -1138,6 +1139,7 @@ int game_cmd(char *cmd)
// scene_scrollbar();
if (new_pict || new_place) {
img_t offscreen;
+ game_cursor(-1);
offscreen = gfx_screen(oldscreen);
gfx_change_screen(offscreen);
gfx_free_image(offscreen);
@@ -1453,7 +1455,7 @@ int game_click(int x, int y, int action)
return 0;
}
-static void game_cursor(int on)
+void game_cursor(int on)
{
static img_t grab = NULL;
static img_t cur;
diff --git a/src/sdl-instead/game.h b/src/sdl-instead/game.h
index 4e63eb1..0c71748 100644
--- a/src/sdl-instead/game.h
+++ b/src/sdl-instead/game.h
@@ -52,6 +52,7 @@ extern char *game_cfg_path(void);
extern char *game_save_path(int rc, int nr);
extern char *game_locale(void);
+extern void game_cursor(int on); /* must be called with -1 before gfx change and 1 after */
struct game {
char *path;
diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c
index 82f300c..a802cd0 100644
--- a/src/sdl-instead/graphics.c
+++ b/src/sdl-instead/graphics.c
@@ -2097,8 +2097,10 @@ static void update_gfx(void *aux)
img_t img = (img_t) aux;
if (step_nr == -1)
return;
+ game_cursor(-1);
gfx_set_alpha(img, (255 * (step_nr + 1)) / ALPHA_STEPS);
gfx_draw(img, 0, 0);
+ game_cursor(1);
gfx_flip();
step_nr ++;
if (step_nr == ALPHA_STEPS) {
diff --git a/stead/stead.lua b/stead/stead.lua
index 572a2eb..7298507 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -351,7 +351,7 @@ function list_add(self, name, pos)
-- error "No string adding to list."
-- end
nam = deref(name);
- if list_find(self, nam) then
+ if self:look(nam) then
return nil
end
self.__modifyed__ = true;
@@ -425,12 +425,12 @@ end
function list_search(self, n)
local i;
- i = list_find(self, n);
+ i = self:look(n);
if not i then
- i = list_name(self, n);
+ i = self:name(n);
end
if not i and tonumber(n) then
- i = list_id(self, tonumber(n));
+ i = self:byid(tonumber(n));
if not i then
return nil
end