From cc4c772e230ce09416ec0457787dd9314be8898b Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Sun, 4 Oct 2009 11:59:09 +0000
Subject: [PATCH] gfx in layouts. Undocumented? + version changes
---
Rules.make.standalone | 2 +-
Rules.make.system | 2 +-
Rules.windows | 2 +-
desktop/instead.desktop.in | 2 +-
doc/index-en.html | 2 +-
doc/index.html | 2 +-
doc/instead.6 | 4 ++--
src/sdl-instead/graphics.c | 16 +++++++++++++++-
stead/gui.lua | 4 ++++
stead/stead.lua | 9 ++++++++-
10 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/Rules.make.standalone b/Rules.make.standalone
index 88b5292..2b2c298 100644
--- a/Rules.make.standalone
+++ b/Rules.make.standalone
@@ -1,4 +1,4 @@
-VERSION := \"0.9.1\"
+VERSION := \"0.9.2\"
DESTDIR=
BIN=
diff --git a/Rules.make.system b/Rules.make.system
index 524272e..6f4fa21 100644
--- a/Rules.make.system
+++ b/Rules.make.system
@@ -1,4 +1,4 @@
-VERSION := \"0.9.1\"
+VERSION := \"0.9.2\"
PREFIX=/usr/local
DESTDIR=
diff --git a/Rules.windows b/Rules.windows
index 1b65444..8ffde83 100644
--- a/Rules.windows
+++ b/Rules.windows
@@ -1,4 +1,4 @@
-VERSION := \"0.9.1\"
+VERSION := \"0.9.2\"
PREFIX=
DESTDIR=
diff --git a/desktop/instead.desktop.in b/desktop/instead.desktop.in
index b66e69c..498cdec 100644
--- a/desktop/instead.desktop.in
+++ b/desktop/instead.desktop.in
@@ -1,6 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
-Version=0.9.1
+Version=0.9.2
Type=Application
Name=INSTEAD
Name[ru]=INSTEAD
diff --git a/doc/index-en.html b/doc/index-en.html
index 2341e50..046cdcb 100644
--- a/doc/index-en.html
+++ b/doc/index-en.html
@@ -4,7 +4,7 @@
[ What is it? ] [ Screenshots ] [ Download ]
-INSTEAD 0.9.1 — interpreter of simple text adventures
+INSTEAD 0.9.2 — interpreter of simple text adventures
The interpreter of STEAD (Simple Text Adventures) allows to play games, combining visual novels, text adventure and classic quests of 1990-s. The STEAD games features are:
diff --git a/doc/index.html b/doc/index.html
index bd04857..5dd4c45 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -4,7 +4,7 @@
[ Что это такое? ] [ Скриншоты ] [ Скачать ]
-INSTEAD 0.9.1 -- интерпретатор простых текстовых приключений для Unix
+INSTEAD 0.9.2 -- интерпретатор простых текстовых приключений для Unix
Интерпретатор STEAD (Simply Text Adventure) позволяет проигрывать игры, которые по жанру являются
смесью визуальной новеллы, текстового квеста и классических квестов 90-х. Особенности STEAD игры:
diff --git a/doc/instead.6 b/doc/instead.6
index 70ae8ea..6f14c57 100644
--- a/doc/instead.6
+++ b/doc/instead.6
@@ -1,4 +1,4 @@
-.TH INSTEAD 6 "Version 0.9.1" Instead GAMES
+.TH INSTEAD 6 "Version 0.9.2" Instead GAMES
.SH NAME
@@ -54,7 +54,7 @@ Runs the game in fullscreen mode.
.B -window
Runs the game in windowed mode.
.TP
-.B -noautosave
+.B -noautosave
Disable autosave/autoload.
.PP
Configuration file name is 'insteadrc' and it's located in ~/.instead/.
diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c
index 735e739..ff6dc06 100644
--- a/src/sdl-instead/graphics.c
+++ b/src/sdl-instead/graphics.c
@@ -1044,6 +1044,7 @@ struct image {
struct image *next;
char *name;
img_t image;
+ int free_it;
};
struct image *image_new(const char *name, img_t img)
@@ -1054,6 +1055,7 @@ struct image *image_new(const char *name, img_t img)
g->image = img;
g->name = strdup(name);
g->next = NULL;
+ g->free_it = 0;
return g;
}
@@ -1063,7 +1065,8 @@ void image_free(struct image *image)
return;
if (image->name)
free(image->name);
-// gfx_free_image(image->image);
+ if (image->free_it)
+ gfx_free_image(image->image);
free(image);
}
@@ -1927,6 +1930,7 @@ void txt_layout_update_links(layout_t layout, int x, int y, clear_fn clear)
txt_layout_draw_ex(lay, lay->lines, x, y, 0, lay->h, clear);
// gfx_noclip();
}
+
img_t get_img(struct layout *layout, char *p)
{
int len;
@@ -1942,6 +1946,16 @@ img_t get_img(struct layout *layout, char *p)
return NULL;
p[len] = 0;
img = layout_lookup_image(layout, p);
+ if (!img && (img = gfx_load_image(p))) {
+ struct image *image = image_new(p, img);
+ if (!image) {
+ gfx_free_image(img);
+ img = NULL;
+ } else {
+ layout_add_image(layout, image);
+ image->free_it = 1; /* free on layout destroy */
+ }
+ }
p[len] = '>';
return img;
}
diff --git a/stead/gui.lua b/stead/gui.lua
index 1d2b846..302c6ea 100644
--- a/stead/gui.lua
+++ b/stead/gui.lua
@@ -1,6 +1,10 @@
game.hinting = true;
game.showlast = true;
+iface.img = function(self, str)
+ return "";
+end;
+
iface.xref = function(self, str, obj)
local o = ref(here():srch(obj));
local cmd=''
diff --git a/stead/stead.lua b/stead/stead.lua
index 9e8ac38..22ee0d4 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -1,5 +1,5 @@
stead = {
- version = "0.9.1",
+ version = "0.9.2",
table = table,
string = string,
math = math,
@@ -38,6 +38,10 @@ function cat(v,...)
return res;
end
+function img(v)
+ return iface:img(v);
+end
+
function txtem(v)
return iface:em(v)
end
@@ -1355,6 +1359,9 @@ function strip(s)
return s;
end
iface = {
+ img = function(self, str)
+ return '';
+ end,
em = function(self, str)
return str;
end,