From fc439d19cef28214daebe68c77c2154300be255a Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Tue, 29 Mar 2011 10:12:17 +0000
Subject: [PATCH] add_sound, 1.3.5 up
---
Makefile.mingw32ce | 2 +-
PKGBUILD.in | 2 +-
Rules.make.macosx | 2 +-
Rules.make.standalone | 2 +-
Rules.make.system | 2 +-
Rules.mingw | 2 +-
Rules.windows | 2 +-
debian/changelog | 11 ++++++++
desktop/instead.desktop.in | 2 +-
doc/index.html | 2 +-
doc/instead.6 | 2 +-
instead.pkg | 2 +-
instead.spec | 2 +-
readme.txt | 2 +-
setup-kit.iss | 4 +--
setup.iss | 4 +--
src/sdl-instead/game.c | 53 +++++++++++++++++++++++++++++++++-----
src/sdl-instead/s60.h | 2 +-
stead/stead.lua | 27 ++++++++++++++++++-
19 files changed, 101 insertions(+), 26 deletions(-)
diff --git a/Makefile.mingw32ce b/Makefile.mingw32ce
index bc08860..b80bc74 100644
--- a/Makefile.mingw32ce
+++ b/Makefile.mingw32ce
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
PREFIX=./
DESTDIR=
diff --git a/PKGBUILD.in b/PKGBUILD.in
index 131825d..8738bd1 100644
--- a/PKGBUILD.in
+++ b/PKGBUILD.in
@@ -1,6 +1,6 @@
# Contributor: Peter Kosyh
pkgname=instead
-pkgver=1.3.4
+pkgver=1.3.5
pkgrel=1
pkgdesc="instead quest interpreter"
arch=('i686' 'x86_64')
diff --git a/Rules.make.macosx b/Rules.make.macosx
index 72855d8..74ae165 100644
--- a/Rules.make.macosx
+++ b/Rules.make.macosx
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
DESTDIR=
BIN=
diff --git a/Rules.make.standalone b/Rules.make.standalone
index b506311..957282e 100644
--- a/Rules.make.standalone
+++ b/Rules.make.standalone
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
DESTDIR=
BIN=
diff --git a/Rules.make.system b/Rules.make.system
index a940001..b74bf06 100644
--- a/Rules.make.system
+++ b/Rules.make.system
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
PREFIX=/usr/local
DESTDIR=
diff --git a/Rules.mingw b/Rules.mingw
index 49c3a04..7d421b0 100644
--- a/Rules.mingw
+++ b/Rules.mingw
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
PREFIX=./
DESTDIR=
diff --git a/Rules.windows b/Rules.windows
index 59c166a..2ae29ed 100644
--- a/Rules.windows
+++ b/Rules.windows
@@ -1,4 +1,4 @@
-VERSION := 1.3.4
+VERSION := 1.3.5
PREFIX=
DESTDIR=
diff --git a/debian/changelog b/debian/changelog
index dd0e4c8..56d37e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+instead (1.3.5) unstable; urgency=low
+
+ * bug fix in imgl/imgr;
+ * bug fix in xact;
+ * bug fix in jump to pos logic;
+ * global dir is now readdir;
+ * multichannal sound system (add_sound);
+ * show dir to be deleted while remove game;
+
+ -- Peter Kosyh Tue, 29 Mar 2011 14:08:00 +0300
+
instead (1.3.4) unstable; urgency=low
* bug fix in text renderer with italic text;
diff --git a/desktop/instead.desktop.in b/desktop/instead.desktop.in
index ebb5be0..6dab952 100644
--- a/desktop/instead.desktop.in
+++ b/desktop/instead.desktop.in
@@ -1,6 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
-Version=1.3.4
+Version=1.3.5
Type=Application
Name=INSTEAD
Name[ru]=INSTEAD
diff --git a/doc/index.html b/doc/index.html
index 1a73833..214cd6f 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -13,7 +13,7 @@ body { font-family: Verdana, Arial, Helvetica, sans-serif;
INSTEAD -- interpreter of simple text adventures for Unix and Windows
-INSTEAD 1.3.4
+INSTEAD 1.3.5
INSTEAD -- interpreter of simple text adventures for Unix and Windows.
INSTEAD was designed to interpret the games that are the mix of visual novels, text quests and classical 90'ss quests.
diff --git a/doc/instead.6 b/doc/instead.6
index bd597aa..d64461b 100644
--- a/doc/instead.6
+++ b/doc/instead.6
@@ -1,4 +1,4 @@
-.TH INSTEAD 6 "Version 1.3.4" Instead GAMES
+.TH INSTEAD 6 "Version 1.3.5" Instead GAMES
.SH NAME
diff --git a/instead.pkg b/instead.pkg
index 7888c4e..465dcc7 100644
--- a/instead.pkg
+++ b/instead.pkg
@@ -8,7 +8,7 @@
&EN
; standard SIS file header
-#{"INSTEAD"},(0xA0020410),1,3,4
+#{"INSTEAD"},(0xA0020410),1,3,5
;Localised Vendor name
%{"Peter Kosyh"}
diff --git a/instead.spec b/instead.spec
index 60e7416..5dccfb5 100644
--- a/instead.spec
+++ b/instead.spec
@@ -1,6 +1,6 @@
Summary: simply text adventures/visual novels engine and game
Name: instead
-Version: 1.3.4
+Version: 1.3.5
Release: 1%{?dist}
License: GPLv2
URL: http://instead.googlecode.com
diff --git a/readme.txt b/readme.txt
index f7f7167..21f0875 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,4 +1,4 @@
-INSTEAD 1.3.4
+INSTEAD 1.3.5
=============
WARNING! For successfull building you must install these development packages (names may vary in your distribution):
diff --git a/setup-kit.iss b/setup-kit.iss
index a1ee0bb..b9436e6 100644
--- a/setup-kit.iss
+++ b/setup-kit.iss
@@ -1,11 +1,11 @@
[Setup]
AppName=INSTEAD-KIT
-AppVerName=INSTEAD 1.3.4
+AppVerName=INSTEAD 1.3.5
DefaultDirName={pf}\Pinebrush games\INSTEAD
DefaultGroupName=Pinebrush games
UninstallDisplayIcon={app}\sdl-instead.exe
OutputDir=.
-OutputBaseFilename=instead-kit-1.3.4
+OutputBaseFilename=instead-kit-1.3.5
AllowNoIcons=true
[Languages]
diff --git a/setup.iss b/setup.iss
index 0a9629d..cb663d3 100644
--- a/setup.iss
+++ b/setup.iss
@@ -1,11 +1,11 @@
[Setup]
AppName=INSTEAD
-AppVerName=INSTEAD 1.3.4
+AppVerName=INSTEAD 1.3.5
DefaultDirName={pf}\Pinebrush games\INSTEAD
DefaultGroupName=Pinebrush games
UninstallDisplayIcon={app}\sdl-instead.exe
OutputDir=.
-OutputBaseFilename=instead-1.3.4
+OutputBaseFilename=instead-1.3.5
AllowNoIcons=true
[Languages]
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index b03a7f5..b2ece51 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -1322,6 +1322,8 @@ static int wavs_pos = 0;
static wav_t sound_add(const char *fname)
{
wav_t w;
+ if (!fname || !*fname)
+ return NULL;
w = snd_load_wav(dirpath(fname));
if (!w)
return NULL;
@@ -1366,9 +1368,51 @@ static void sounds_reload(void)
}
}
+static int _play_combined_snd(char *filename, int chan, int loop)
+{
+ char *str;
+ char *p, *ep;
+ wav_t w;
+
+ p = str = strdup(filename);
+ if (!str)
+ return -1;
+
+ p = strip(p);
+ while (*p) {
+ int c = chan, l = loop;
+ ep = p + strcspn(p, ";@");
+
+ if (*ep == '@') {
+ *ep = 0; ep ++;
+ sscanf(ep, "%d,%d", &c, &l);
+ ep += strcspn(ep, ";");
+ if (*ep)
+ ep ++;
+ } else if (*ep == ';') {
+ *ep = 0; ep ++;
+ } else if (*ep) {
+ goto err;
+ }
+ p = strip(p);
+ w = sound_find(p);
+ if (!w)
+ w = sound_add(p);
+ if (w)
+ snd_play(w, c, l - 1);
+ else
+ snd_halt_chan(c, 500);
+ p = ep;
+ }
+ free(str);
+ return 0;
+err:
+ free(str);
+ return -1;
+}
+
void game_sound_player(void)
{
- wav_t w;
char *snd;
int chan = -1;
int loop = 1;
@@ -1398,13 +1442,8 @@ void game_sound_player(void)
instead_function("instead.set_sound", args); instead_clear();
unix_path(snd);
- w = sound_find(snd);
- if (!w)
- w = sound_add(snd);
+ _play_combined_snd(snd, chan, loop);
free(snd);
- if (!w)
- return;
- snd_play(w, chan, loop - 1);
}
static char *get_inv(void)
diff --git a/src/sdl-instead/s60.h b/src/sdl-instead/s60.h
index 1cc3cdd..236c05e 100644
--- a/src/sdl-instead/s60.h
+++ b/src/sdl-instead/s60.h
@@ -1,7 +1,7 @@
#ifndef S60_H
#define S60_H
#define PATH_MAX 256
-#define VERSION "1.3.4"
+#define VERSION "1.3.5"
#define DATAPATH "./"
#define STEAD_PATH DATAPATH"stead/"
#define THEMES_PATH DATAPATH"themes/"
diff --git a/stead/stead.lua b/stead/stead.lua
index 48cbb5e..cd1c1b1 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -1,5 +1,5 @@
stead = {
- version = "1.3.4",
+ version = "1.3.5",
api_version = "1.1.6", -- last version before 1.2.0
table = table,
delim = ',',
@@ -2635,6 +2635,31 @@ function get_sound_loop()
return game._sound_loop
end
+function stop_sound(chan)
+ if not tonumber(chan) then
+ set_sound('@');
+ return
+ end
+ set_sound('@'..tostring(chan));
+end
+
+function add_sound(s, chan, loop)
+ if type(s) ~= 'string' then
+ return
+ end
+ if type(game._sound) == 'string' then
+ if tonumber(chan) then
+ s = s..'@'..tostring(chan);
+ end
+ if tonumber(loop) then
+ s = s..','..tostring(loop)
+ end
+ set_sound(game._sound..';'..s, get_sound_chan(), get_sound_loop());
+ else
+ set_sound(s, chan, loop);
+ end
+end
+
function set_sound(s, chan, loop)
game._sound = s;
if not tonumber(loop) then