debian/0000755000000000000000000000000012164046614007172 5ustar debian/source/0000755000000000000000000000000012164046614010472 5ustar debian/source/format0000644000000000000000000000001412164046614011700 0ustar 3.0 (quilt) debian/docs0000644000000000000000000000003012164046614010036 0ustar readme_e.txt readme.txt debian/tumiki-fighters.desktop0000644000000000000000000000027412164046614013703 0ustar [Desktop Entry] Type=Application Name=Tumiki Fighters GenericName= Comment=Kenta Cho's Tumiki Fighters Icon=tumiki-fighters Exec=tumiki-fighters Terminal=false Categories=Game;ArcadeGame; debian/tumiki-fighters.60000644000000000000000000000477112164046614012405 0ustar .\" (c) 2007 Miriam Ruiz .\" (c) 2004 Kenta Cho .\" .\" This document is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" .\" This package is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this package; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA .TH "Tumiki Fighters" "6" "" "" "" .SH "NAME" tumiki\-fighters \- sticky 2D shooter .SH "DESCRIPTION" .SH "OPTIONS" These options are available: .TP \fB\-brightness n\fR Set the brightness of the screen.(n = 0 \- 100, default = 100) .TP \fB\-res x y\fR Set the screen resolution to (x, y). .TP \fB\-nosound\fR Stop the sound. .TP \fB\-window\fR Launch the game in a window. .TP \fB\-fullscreen\fR Launch the game in fullscreen. .TP \fB\-reverse\fR Reverse the shot key and the slow key. .SH "USAGE" How to play: .TP \fBMovement\fR Arrow / Num / [WASD] / Joystick .TP \fBShot\fR [Z][L\-Ctrl][.] / Trigger 1, 4, 5, 8 .TP \fBSlow/Pull in\fR [X][L\-Alt][L\-Shift][/] / Trigger 2, 3, 6, 7 .TP \fBPause\fR [P] .P At the title screen, push a shot key to start the game. Control your ship and destroy enemies. You can catch the enemy's broken piece. Pieces are stuck to your ship and counterattack to enemies. You can earn the bonus score by keeping many pieces stuck. Stuck pieces are destroyed when they touch a enemy's bullet. While holding a slow key, the ship becomes slow and the ship direction is fixed. Stuck pieces are pulled in and you can prevent a crash of them, but the bonus score reduces to one fifth. Enemy's pieces are not stuck while holding this key. If you stick many pieces, enemies become more offensive and tend to fire more bullets. The ship is destroyed when it is hit by a bullet. The body of the enemy has no collision damage. The ship extends at 200,000 and every 500,000 points. .SH "SEE ALSO" You can find more about the game on its homepage: http://www.asahi\-net.or.jp/~cs8k\-cyu/windows/tf_e.html .SH "AUTHOR" This game has been written by Kenta Cho debian/copyright0000644000000000000000000000517712164046614011137 0ustar This package was debianized by Miriam Ruiz on Sat, 25 Aug 2007 19:58:40 +0000. It was downloaded from http://www.asahi-net.or.jp/~cs8k-cyu/windows/tf_e.html Upstream Author: Kenta Cho Copyright: Copyright 2004 Kenta Cho import/SDL* : Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import/SDL*: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU Lesser General Public License can be found in `/usr/share/common-licenses/LGPL-2'. The Debian packaging is Copyright (C) 2007, Miriam Ruiz and is licensed under the GPL, see `/usr/share/common-licenses/GPL-3'. debian/README.source0000644000000000000000000000043512164046614011353 0ustar This package uses quilt to manage all modifications to the upstream source. The fully patched source can be generated using the patch target provided by `debian/rules'. If you want to know more about how to use quilt to manage Debian patches, read /usr/share/doc/quilt/README.source. debian/tumiki-fighters-data.install0000644000000000000000000000035712164046614014611 0ustar sounds usr/share/games/tumiki-fighters/ barrage usr/share/games/tumiki-fighters/ enemy usr/share/games/tumiki-fighters/ stage usr/share/games/tumiki-fighters/ tumiki usr/share/games/tumiki-fighters/ field usr/share/games/tumiki-fighters/ debian/menu0000644000000000000000000000025712164046614010065 0ustar ?package(tumiki-fighters):needs="X11" section="Games/Action"\ title="Tumiki Fighters" command="/usr/games/tumiki-fighters" \ icon="/usr/share/pixmaps/tumiki-fighters.xpm" debian/changelog0000644000000000000000000000371412164046614011051 0ustar tumiki-fighters (0.2.dfsg1-6) unstable; urgency=low * Ported to D language version 2 (closes: #707273) * Added build-depends on libphobos-dev * Switch dh-style minimal rules file * Mark -data package as Multi-Arch: foreign * Conforms to standards 3.9.4 -- Peter De Wachter Sun, 30 Jun 2013 13:09:10 +0200 tumiki-fighters (0.2.dfsg1-5) unstable; urgency=low * Team upload. * Explicitly build with D version 1 (closes: #653093) * Switch to format 3.0 (quilt) and drop build-dep on quilt * Provide build-arch and build-indep targets * Conforms to standards 3.9.2 -- Vincent Fourmond Sat, 07 Jan 2012 16:51:52 +0100 tumiki-fighters (0.2.dfsg1-4) unstable; urgency=low * Patched for changes in the D language. (Closes: #574327) -- Peter De Wachter Wed, 17 Mar 2010 23:49:43 +0100 tumiki-fighters (0.2.dfsg1-3) unstable; urgency=low [ Miriam Ruiz ] * Removed Homepage from long description. * Replaced XS-DM-Upload-Allowed by DM-Upload-Allowed in debian/control. [ Ansgar Burchardt ] * Remove deprecated Encoding key from .desktop file [ Peter De Wachter ] * Fix "fixes.patch". The stage 4 boss fight now plays correctly. * Update Standards-Version to 3.8.0: added patch target and README.source. -- Peter De Wachter Thu, 17 Jul 2008 23:33:58 +0200 tumiki-fighters (0.2.dfsg1-2) unstable; urgency=low [ Barry deFreese ] * Add watch file * Add Homepage field to control * Remove XS- from VCS fields [ Peter De Wachter ] * Fixed link command, patch from Arthur Loiret. (Closes: #458280, #458633) [ Miriam Ruiz ] * Added XS-DM-Upload-Allowed tag to control to allow uploads from Debian Maintainers. -- Miriam Ruiz Thu, 03 Jan 2008 12:12:59 +0000 tumiki-fighters (0.2.dfsg1-1) unstable; urgency=low * Initial release (Closes: #439713) -- Miriam Ruiz Sat, 25 Aug 2007 19:58:40 +0000 debian/compat0000644000000000000000000000000212164046614010370 0ustar 9 debian/tumiki-fighters.manpages0000644000000000000000000000003112164046614014014 0ustar debian/tumiki-fighters.6 debian/watch0000644000000000000000000000022712164046614010224 0ustar version=3 opts="uversionmangle=s/_/\./,dversionmangle=s/[+.]dfsg(.?\d+)?$//" \ http://www.asahi-net.or.jp/~cs8k-cyu/windows/tf_e.html tf([\d_]+)\.zip debian/rules0000755000000000000000000000071112164046614010251 0ustar #!/usr/bin/make -f ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) DFLAGS = -fdebug else DFLAGS = -frelease endif %: dh $@ override_dh_auto_build: dh_auto_build -- DFLAGS="$(DFLAGS)" get-orig-source: dh_testdir dh_testroot wget http://www.asahi-net.or.jp/~cs8k-cyu/windows/tf0_2.zip unzip tf0_2.zip rm tf/*.dll rm tf/*.exe rm tf/lib/*.lib rm tf/resource/*.RES tar cvfz ../tumiki-fighters_0.2.dfsg1.orig.tar.gz tf rm -rf tf0_2.zip tf debian/control0000644000000000000000000000341412164046614010577 0ustar Source: tumiki-fighters Section: games Priority: extra Maintainer: Debian Games Team Uploaders: Miriam Ruiz , Peter De Wachter , Barry deFreese Build-Depends: debhelper (>= 9), gdc (>= 4.8.1), libphobos-dev, libglu1-mesa-dev | libglu-dev, libgl1-mesa-dev | libgl-dev, libsdl1.2-dev, libsdl-mixer1.2-dev, libbulletml-dev Build-Conflicts: libphobos-4.4-dev Standards-Version: 3.9.4 Homepage: http://www.asahi-net.or.jp/~cs8k-cyu/windows/tf_e.html Vcs-Svn: svn://anonscm.debian.org/pkg-games/packages/trunk/tumiki-fighters/ Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-games/packages/trunk/tumiki-fighters/ Package: tumiki-fighters Architecture: any Depends: tumiki-fighters-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} Description: sticky 2D shooter Tumiki Fighters brings a different twist to the side-scrolling shooter genre. With simple 3D graphics, the player has to control a ship and shoot down the enemies. The player can swoop in and attach the wreckage to its own hull for bonus points and protection from enemy attacks. . . Tumiki Fighters is another gem among many by Kenta Cho. Package: tumiki-fighters-data Architecture: all Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: tumiki-fighters Description: sticky 2D shooter - game data Tumiki Fighters brings a different twist to the side-scrolling shooter genre. With simple 3D graphics, the player has to control a ship and shoot down the enemies. The player can swoop in and attach the wreckage to its own hull for bonus points and protection from enemy attacks. . . This package includes the architecture-independent data for the Kenta Cho's game Tumiki Fighters. debian/tumiki-fighters.xpm0000644000000000000000000000246312164046614013040 0ustar /* XPM */ static char *dummy[]={ "32 32 9 1", ". c None", "a c #00dc00", "d c #0155ff", "f c #b2c7fe", "b c #b2fec7", "# c #fcff01", "g c #feb2c7", "e c #ff0155", "c c #ffffb1", "................................", "..............#..aaaaaaaaaaaaaa.", ".............##..abbbbbbbbbbbba.", "............#c#..abbbbbbbbbbbba.", "...........#cc#..abbbbbbbbbbbba.", "..........#ccc#..abbbbbbbbbbbba.", ".........#cccc#..abbbbbbbbbbbba.", "........#ccccc#..abbbbbbbbbbbba.", ".......#cccccc#..abbbbbbbbbbbba.", "......#ccccccc#..abbbbbbbbbbbba.", ".....#cccccccc#..abbbbbbbbbbbba.", "....#ccccccccc#..abbbbbbbbbbbba.", "...#cccccccccc#..abbbbbbbbbbbba.", "..#ccccccccccc#..abbbbbbbbbbbba.", ".##############..aaaaaaaaaaaaaa.", "................................", "................................", ".dddddddddddddd..eeeeeeeeeeeeee.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dffffffffffffd..egggggggggggge.", ".dddddddddddddd..eeeeeeeeeeeeee.", "................................"}; debian/tumiki-fighters.install0000644000000000000000000000014412164046614013674 0ustar tumiki-fighters usr/games/ debian/*.xpm usr/share/pixmaps/ debian/*.desktop usr/share/applications/ debian/patches/0000755000000000000000000000000012164046614010621 5ustar debian/patches/series0000644000000000000000000000017512164046614012041 0ustar imports.patch fixes.patch directories.patch windowed.patch dotfile.patch makefile.patch window-resizing.patch dlang_v2.patch debian/patches/dotfile.patch0000644000000000000000000000403012164046614013265 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/prefmanager.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/prefmanager.d 2004-05-14 23:35:38.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/prefmanager.d 2007-09-08 17:35:31.000000000 +0000 @@ -6,6 +6,8 @@ module abagames.tf.prefmanager; private import std.stream; +private import std.string; +private import std.c.stdlib; private import abagames.util.prefmanager; /** @@ -14,7 +16,7 @@ public class PrefManager: abagames.util.prefmanager.PrefManager { public: static const int VERSION_NUM = 20; - static const char[] PREF_FILE = "tf.prf"; + static const char[] PREF_FILE = ".tumiki-fighters.prf"; static const int RANKING_NUM = 10; static const int DEFAULT_HISCORE = 10000; RankingItem[RANKING_NUM] ranking; @@ -24,6 +26,13 @@ ri = new RankingItem; } + public static char[] home_dir() { + char * home = getenv("HOME"); + if (home is null) + throw new Error("HOME environment variable is not defined"); + return std.string.toString(home); + } + private void init() { int sc = DEFAULT_HISCORE * RANKING_NUM; foreach (RankingItem ri; ranking) { @@ -37,13 +46,13 @@ auto File fd = new File; try { int ver; - fd.open(PREF_FILE); + fd.open(home_dir() ~ "/" ~ PREF_FILE); fd.read(ver); if (ver != VERSION_NUM) throw new Error("Wrong version num"); foreach (RankingItem ri; ranking) ri.load(fd); - } catch (Error e) { + } catch (Exception e) { init(); } finally { fd.close(); @@ -52,7 +61,7 @@ public void save() { auto File fd = new File; - fd.create(PREF_FILE); + fd.create(home_dir() ~ "/" ~ PREF_FILE); fd.write(VERSION_NUM); foreach (RankingItem ri; ranking) ri.save(fd); debian/patches/windowed.patch0000644000000000000000000000307612164046614013470 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/boot.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/boot.d 2007-09-08 17:35:04.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/boot.d 2007-09-08 17:35:30.000000000 +0000 @@ -27,7 +27,7 @@ private void usage(char[] args0) { Logger.error - ("Usage: " ~ args0 ~ " [-brightness [0-100]] [-window] [-res x y] [-nosound] [-reverse]"); + ("Usage: " ~ args0 ~ " [-brightness [0-100]] [-window] [-fullscreen] [-res x y] [-nosound] [-reverse]"); } private void parseArgs(char[][] args) { @@ -49,6 +49,9 @@ case "-window": Screen.windowMode = true; break; + case "-fullscreen": + Screen.windowMode = false; + break; case "-res": if (i >= args.length - 2) { usage(args[0]); Index: tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/screen3d.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2004-05-14 23:35:40.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/screen3d.d 2007-09-08 17:36:21.000000000 +0000 @@ -20,7 +20,7 @@ static float brightness = 1; static int width = 640; static int height = 480; - static bool windowMode = false; + static bool windowMode = true; static float nearPlane = 0.1; static float farPlane = 1000; debian/patches/makefile.patch0000644000000000000000000000100112164046614013407 0ustar # Copyright (C) 2007 Marcel Unbehaun # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +GDC=gdc +DSRC=$(shell find import src/abagames -name "*.d" | sort) +EXE=tumiki-fighters + +all: $(EXE) + +$(EXE): $(DSRC) + $(GDC) -o $@ -Wno-deprecated -Iimport -Isrc $(DFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(DSRC) -lSDL -lGL -lSDL_mixer -lbulletml + +clean: + rm -f $(EXE) debian/patches/directories.patch0000644000000000000000000001112612164046614014157 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/barragemanager.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/barragemanager.d 2007-09-08 19:38:19.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/barragemanager.d 2007-09-08 19:39:10.000000000 +0000 @@ -18,7 +18,7 @@ public class BarrageManager { private: static BulletMLParserTinyXML *parser[char[]]; - static const char[] BARRAGE_DIR_NAME = "barrage"; + static const char[] BARRAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/barrage"; public static void loadBulletMLs() { char[][] dirs = listdir(BARRAGE_DIR_NAME); Index: tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/sound.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/util/sdl/sound.d 2007-09-08 19:38:19.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/sound.d 2007-09-08 19:39:10.000000000 +0000 @@ -62,7 +62,7 @@ public class Music: Sound { public: static int fadeOutSpeed = 1280; - static char[] dir = "sounds/"; + static char[] dir = "/usr/share/games/tumiki-fighters/sounds/"; private: Mix_Music* music; @@ -122,7 +122,7 @@ public class Chunk: Sound { public: - static char[] dir = "sounds/"; + static char[] dir = "/usr/share/games/tumiki-fighters/sounds/"; private: Mix_Chunk* chunk; int chunkChannel; Index: tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/texture.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/util/sdl/texture.d 2007-09-08 19:38:19.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/texture.d 2007-09-08 19:39:10.000000000 +0000 @@ -15,7 +15,7 @@ */ public class Texture { public: - static char[] imagesDir = "images/"; + static char[] imagesDir = "/usr/share/games/tumiki-fighters/images/"; private: GLuint num; Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/enemyspec.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/enemyspec.d 2007-09-08 19:38:28.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/enemyspec.d 2007-09-08 19:39:10.000000000 +0000 @@ -22,7 +22,7 @@ float sizeXm, sizeXp, sizeYm, sizeYp; private: static EnemySpec[char[]] instances; - static const char[] ENEMYSPEC_DIR_NAME = "enemy"; + static const char[] ENEMYSPEC_DIR_NAME = "/usr/share/games/tumiki-fighters/enemy"; // Initialize EnemySpec with the array. // Tumiki file name(main), Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/field.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/field.d 2007-09-08 19:38:19.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/field.d 2007-09-08 19:39:10.000000000 +0000 @@ -249,7 +249,7 @@ float mtr, mtg, mtb; float mrr, mrg, mrb; private: - static const char[] FIELD_DIR_NAME = "field"; + static const char[] FIELD_DIR_NAME = "/usr/share/games/tumiki-fighters/field"; // Initialize FieldPattern with the array. // randSeed, scrollSpeed, Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/stagemanager.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/stagemanager.d 2007-09-08 19:38:19.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/stagemanager.d 2007-09-08 19:39:10.000000000 +0000 @@ -171,7 +171,7 @@ long randSeed; int warningCnt; private: - static const char[] STAGE_DIR_NAME = "stage"; + static const char[] STAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/stage"; static int[char[]] posTypeStr; public static this() { Index: tumiki-fighters-0.2.dfsg1/src/abagames/tf/tumikiset.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/tf/tumikiset.d 2007-09-08 19:39:18.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/tf/tumikiset.d 2007-09-08 19:39:24.000000000 +0000 @@ -29,7 +29,7 @@ float sizeXm, sizeXp, sizeYm, sizeYp, size; private: static TumikiSet[char[]] instances; - static const char[] TUMIKI_DIR_NAME = "tumiki"; + static const char[] TUMIKI_DIR_NAME = "/usr/share/games/tumiki-fighters/tumiki"; static const float BULLET_SPEED_RATIO = 1.2; static int[char[]] shapeStr; static char[][] SHAPE_STR = debian/patches/window-resizing.patch0000644000000000000000000000237612164046614015011 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/screen3d.d =================================================================== --- tumiki-fighters-0.2.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-09-08 17:35:30.000000000 +0000 +++ tumiki-fighters-0.2.dfsg1/src/abagames/util/sdl/screen3d.d 2007-09-08 17:35:32.000000000 +0000 @@ -23,6 +23,7 @@ static bool windowMode = true; static float nearPlane = 0.1; static float farPlane = 1000; + static Uint32 videoFlags; private: @@ -36,7 +37,6 @@ "Unable to initialize SDL: " ~ std.string.toString(SDL_GetError())); } // Create an OpenGL screen. - Uint32 videoFlags; if (windowMode) { videoFlags = SDL_OPENGL | SDL_RESIZABLE; } else { @@ -56,6 +56,10 @@ // Reset viewport when the screen is resized. public void screenResized() { + if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) { + throw new Exception + ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError())); + } glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); debian/patches/dlang_v2.patch0000644000000000000000000015565512164046614013357 0ustar Description: port to D language version 2 With this patch the code is accapted by gdc-4.6 0.29.1-4.6.4-3 without triggering deprecated feature warnings/errors. Author: Peter De Wachter --- a/src/abagames/tf/attractmanager.d +++ b/src/abagames/tf/attractmanager.d @@ -6,6 +6,7 @@ module abagames.tf.attractmanager; private import std.string; +private import std.conv; private import opengl; private import abagames.util.sdl.pad; private import abagames.tf.gamemanager; @@ -65,7 +66,7 @@ if (dr > PrefManager.RANKING_NUM) dr = PrefManager.RANKING_NUM; for (int i = 0; i < dr; i++) { - char[] rs = std.string.toString(i + 1); + string rs = to!string(i + 1); float x = 100; float y = i * 30 + 32; switch (i) { @@ -91,7 +92,7 @@ if (prefManager.ranking[i].stage >= StageManager.STAGE_NUM) rs = "A"; else - rs = std.string.toString(prefManager.ranking[i].stage + 1); + rs = to!string(prefManager.ranking[i].stage + 1); LetterRender.drawString (rs, 500, y, 9, LetterRender.Direction.TO_RIGHT, 3); } @@ -123,7 +124,7 @@ glScalef(s, s, s); int tx, ty; ty = 0; - foreach (int[] tpl; TITLE_PTN) { + foreach (const(int[]) tpl; TITLE_PTN) { tx = 0; foreach (int tp; tpl) { int c = TITLE_CLR[ty][tx]; --- a/src/abagames/tf/barragemanager.d +++ b/src/abagames/tf/barragemanager.d @@ -17,17 +17,18 @@ */ public class BarrageManager { private: - static BulletMLParserTinyXML *parser[char[]]; - static const char[] BARRAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/barrage"; + static BulletMLParserTinyXML *parser[string]; + static const string BARRAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/barrage"; public static void loadBulletMLs() { - char[][] dirs = listdir(BARRAGE_DIR_NAME); - foreach (char[] dirName; dirs) { - char[][] files = listdir(BARRAGE_DIR_NAME ~ "/" ~ dirName); - foreach (char[] fileName; files) { - if (getExt(fileName) != "xml") + auto dirs = dirEntries(BARRAGE_DIR_NAME, SpanMode.shallow); + foreach (string dirName; dirs) { + auto files = dirEntries(dirName, SpanMode.shallow); + foreach (string fullName; files) { + string fileName = baseName(fullName); + if (extension(fileName) != ".xml") continue; - char[] barrageName = dirName ~ "/" ~ fileName; + string barrageName = baseName(dirName) ~ "/" ~ fileName; Logger.info("Load BulletML: " ~ barrageName); parser[barrageName] = BulletMLParserTinyXML_new(std.string.toStringz(BARRAGE_DIR_NAME ~ "/" ~ barrageName)); @@ -42,7 +43,7 @@ } } - public static BulletMLParserTinyXML* getInstance(char[] fileName) { + public static BulletMLParserTinyXML* getInstance(string fileName) { return parser[fileName]; } } --- a/src/abagames/tf/boot.d +++ b/src/abagames/tf/boot.d @@ -7,6 +7,7 @@ private import std.c.string; private import std.c.stdlib; +private import std.conv; private import abagames.util.logger; private import abagames.util.sdl.mainloop; private import abagames.util.sdl.pad; @@ -25,12 +26,12 @@ PrefManager prefManager; MainLoop mainLoop; -private void usage(char[] args0) { +private void usage(string args0) { Logger.error ("Usage: " ~ args0 ~ " [-brightness [0-100]] [-window] [-fullscreen] [-res x y] [-nosound] [-reverse]"); } -private void parseArgs(char[][] args) { +private void parseArgs(string[] args) { for (int i = 1; i < args.length; i++) { switch (args[i]) { case "-brightness": @@ -39,7 +40,7 @@ throw new Exception("Invalid options"); } i++; - float b = cast(float) atoi(args[i]) / 100; + float b = cast(float) to!int(args[i]) / 100; if (b < 0 || b > 1) { usage(args[0]); throw new Exception("Invalid options"); @@ -58,9 +59,9 @@ throw new Exception("Invalid options"); } i++; - int w = atoi(args[i]); + int w = to!int(args[i]); i++; - int h = atoi(args[i]); + int h = to!int(args[i]); Screen.width = w; Screen.height = h; break; @@ -80,7 +81,7 @@ } } -public int boot(char[][] args) { +public int boot(string[] args) { screen = new Screen; input = new Pad; try { @@ -103,6 +104,7 @@ // Boot as the Windows executable. import std.c.windows.windows; import std.string; +private import std.conv; extern (C) void gc_init(); extern (C) void gc_term(); @@ -122,10 +124,10 @@ _moduleCtor(); char exe[4096]; GetModuleFileNameA(null, exe, 4096); - char[][1] prog; - prog[0] = std.string.toString(exe); - result = boot(prog ~ std.string.split(std.string.toString(lpCmdLine))); - } catch (Object o) { + string[1] prog; + prog[0] = to!string(exe); + result = boot(prog ~ std.string.split(to!string(lpCmdLine))); + } catch (Throwable o) { //Logger.error("Exception: " ~ o.toString()); Logger.info("Exception: " ~ o.toString()); result = EXIT_FAILURE; @@ -137,7 +139,7 @@ } else { // Boot as the general executable. -public int main(char[][] args) { +public int main(string[] args) { return boot(args); } --- a/src/abagames/tf/bulletactor.d +++ b/src/abagames/tf/bulletactor.d @@ -244,7 +244,7 @@ bullet.pos.y += (cos(bullet.deg) * bullet.speed - bullet.acc.y) * bullet.speedRank * bullet.yReverse; if (isVisible) { - switch (bullet.type) { + switch (bullet.type) { default: break; case BulletInst.Type.ENEMY: totalBulletsSpeed += bullet.speed * bullet.speedRank; if (splinters.checkHit(bullet.pos)) { @@ -291,7 +291,7 @@ glPushMatrix(); glTranslatef(bullet.pos.x, bullet.pos.y, 0); int s; - switch (bullet.shape) { + switch (bullet.shape) { default: break; case 0: glRotatef(rtod(d), 0, 0, 1); glScalef(bullet.bulletSize * 0.2, bullet.bulletSize * 0.5, 0.3); --- a/src/abagames/tf/bulletactorpool.d +++ b/src/abagames/tf/bulletactorpool.d @@ -27,7 +27,7 @@ int cnt; public this(int n, ActorInitializer ini) { - auto BulletActor bulletActorClass = new BulletActor; + scope BulletActor bulletActorClass = new BulletActor; super(n, bulletActorClass, ini); Bullet.setBulletsManager(this); BulletActor.init(); @@ -98,7 +98,7 @@ ba.set(runner, x, y, deg, speed, ranks[0], speeds[0], shape, color, size, xReverse, yReverse, target, type, - parser, ranks, speeds, parser.length, 0); + parser, ranks, speeds, cast(uint)parser.length, 0); ba.setWait(prevWait, postWait); ba.setTop(); return ba; --- a/src/abagames/tf/bullettarget.d +++ b/src/abagames/tf/bullettarget.d @@ -3,7 +3,7 @@ * * Copyright 2004 Kenta Cho. All rights reserved. */ -module abagames.tf.bullettaget; +module abagames.tf.bullettarget; private import abagames.util.vector; --- a/src/abagames/tf/damagegauge.d +++ b/src/abagames/tf/damagegauge.d @@ -19,7 +19,7 @@ DamageGaugeItem[3] item; public this() { - foreach (inout DamageGaugeItem dgi; item) + foreach (ref DamageGaugeItem dgi; item) dgi = new DamageGaugeItem; } --- a/src/abagames/tf/enemy.d +++ b/src/abagames/tf/enemy.d @@ -69,7 +69,7 @@ gauge = ei.gauge; pos = new Vector; mv = new EnemyMovement; - foreach (inout EnemyPart ep; parts) + foreach (ref EnemyPart ep; parts) ep = new EnemyPart(ship, bullets, fragments); } @@ -399,7 +399,7 @@ private: public this(int n, ActorInitializer ini) { - auto Enemy enemyClass = new Enemy; + scope Enemy enemyClass = new Enemy; super(n, enemyClass, ini); } @@ -437,7 +437,7 @@ this.target = target; this.bullets = bullets; this.fragments = fragments; - foreach (inout EnemyTopBullet etb; topBullet) + foreach (ref EnemyTopBullet etb; topBullet) etb = new EnemyTopBullet; } @@ -497,8 +497,8 @@ etb.actor.bullet.pos.x = x + ofsx; etb.actor.bullet.pos.y = y + ofsy; if (coverPartsNum > 0 && !etb.coverChecked) { - for (int i = 0; i < coverPartsNum; i++) { - if (coverParts[i].shield > 0 && coverParts[i].covers(ofsx, ofsy)) { + for (int j = 0; j < coverPartsNum; j++) { + if (coverParts[j].shield > 0 && coverParts[j].covers(ofsx, ofsy)) { etb.actor.removeForced(); etb.actor = null; etb.deactivated = true; --- a/src/abagames/tf/enemyspec.d +++ b/src/abagames/tf/enemyspec.d @@ -6,6 +6,7 @@ module abagames.tf.enemyspec; private import std.string; +private import std.conv; private import abagames.util.vector; private import abagames.util.csv; private import abagames.util.iterator; @@ -21,26 +22,26 @@ AttackForm[] attackForm; float sizeXm, sizeXp, sizeYm, sizeYp; private: - static EnemySpec[char[]] instances; - static const char[] ENEMYSPEC_DIR_NAME = "/usr/share/games/tumiki-fighters/enemy"; + static EnemySpec[string] instances; + static const string ENEMYSPEC_DIR_NAME = "/usr/share/games/tumiki-fighters/enemy"; // Initialize EnemySpec with the array. // Tumiki file name(main), // [shield, [attackPeriod, breakPeriod]], // (end when breakPeriod == e, shield == e) // [Tumiki file name(part), x, y, shield, destroyedFormIdx, damageToMainBody], - private this(char[][] data) { + private this(string[] data) { StringIterator si = new StringIterator(data); - char[] fn = si.next; + string fn = si.next; EnemyPartSpec bodySpec = new EnemyPartSpec(fn); parts ~= bodySpec; bool bodyShieldSet = false; int ai = 0; for (;;) { - char[] v = si.next; + string v = si.next; if (v == "e") break; - float shield = atof(v); + float shield = to!float(v); if (!bodyShieldSet) { bodySpec.shield = shield; bodyShieldSet = true; @@ -50,8 +51,8 @@ v = si.next; if (v == "e") break; - int attackPeriod = atoi(v); - int breakPeriod = atoi(si.next); + int attackPeriod = to!int(v); + int breakPeriod = to!int(si.next); af.addPeriod(attackPeriod, breakPeriod); ai++; } @@ -60,13 +61,13 @@ for (;;) { if (!si.hasNext) break; - char[] fn = si.next; - float x = atof(si.next); - float y = atof(si.next); - float shield = atof(si.next); - int dfi = atoi(si.next); - float dtm = atof(si.next); - EnemyPartSpec tp = new EnemyPartSpec(fn, x, y, shield, dfi, dtm); + string fn_ = si.next; + float x = to!float(si.next); + float y = to!float(si.next); + float shield = to!float(si.next); + int dfi = to!int(si.next); + float dtm = to!float(si.next); + EnemyPartSpec tp = new EnemyPartSpec(fn_, x, y, shield, dfi, dtm); parts ~= tp; } sizeXm = sizeYm = float.max; @@ -83,12 +84,12 @@ } } - private this(char[] fileName) { - char[][] data = CSVTokenizer.readFile(ENEMYSPEC_DIR_NAME ~ "/" ~ fileName); + private this(string fileName) { + string[] data = CSVTokenizer.readFile(ENEMYSPEC_DIR_NAME ~ "/" ~ fileName); this(data); } - public static EnemySpec getInstance(char[] fileName) { + public static EnemySpec getInstance(string fileName) { if ((fileName in instances) == null) { Logger.info("Load enemy spec: " ~ fileName); instances[fileName] = new EnemySpec(fileName); @@ -107,20 +108,20 @@ private: - public this(char[] fileName) { + public this(string fileName) { tumikiSet = TumikiSet.getInstance(fileName); ofs = new Vector; destroyedFormIdx = 99999; damageToMainBody = 0; } - public this(char[] fileName, float x, float y) { + public this(string fileName, float x, float y) { this(fileName); ofs.x = x; ofs.y = y; } - public this(char[] fileName, float x, float y, float s, int dfi, float dtm) { + public this(string fileName, float x, float y, float s, int dfi, float dtm) { this(fileName, x, y); shield = s; destroyedFormIdx = dfi; --- a/src/abagames/tf/field.d +++ b/src/abagames/tf/field.d @@ -6,6 +6,7 @@ module abagames.tf.field; private import std.string; +private import std.conv; private import std.math; private import opengl; private import abagames.util.vector; @@ -41,14 +42,14 @@ size.y = 16; eyeZ = 20; uint sn = 1; - foreach (inout FieldPattern fp; fieldPattern) { - Logger.info("Load field: " ~ std.string.toString(sn)); - fp = new FieldPattern("fld" ~ std.string.toString(sn) ~ ".fld"); + foreach (ref FieldPattern fp; fieldPattern) { + Logger.info("Load field: " ~ to!string(sn)); + fp = new FieldPattern("fld" ~ to!string(sn) ~ ".fld"); sn++; } Logger.info("Load fields completed."); - auto FieldObj fieldObjClass = new FieldObj; - auto FieldObjInitializer foi = new FieldObjInitializer(this); + scope FieldObj fieldObjClass = new FieldObj; + scope FieldObjInitializer foi = new FieldObjInitializer(this); fieldObjs = new ActorPool(64, fieldObjClass, foi); rand = new Rand; } @@ -61,7 +62,7 @@ rand.setSeed(pattern.randSeed); Screen.setClearColor(pattern.br, pattern.bg, pattern.bb, 1); foreach (FieldLinePattern flp; pattern.line) - flp.cnt = flp.interval[rand.nextInt(flp.interval.length)]; + flp.cnt = flp.interval[rand.nextInt(cast(uint)flp.interval.length)]; fieldObjs.clear(); float x = 0, nx, tx, ty; for (int i = 0; i < 4; i++) { @@ -86,13 +87,13 @@ if (flp.cnt <= 0) { FieldObj fo = cast(FieldObj) fieldObjs.getInstance(); if (fo) { - TumikiSet ts = flp.tumikiSet[rand.nextInt(flp.tumikiSet.length)]; + TumikiSet ts = flp.tumikiSet[rand.nextInt(cast(uint)flp.tumikiSet.length)]; if (flp.onGround) fo.setGround(ts, flp.z, pattern.scrollSpeed); else fo.setSky(ts, flp.z, pattern.scrollSpeed / 3 * 2, rand); } - flp.cnt = flp.interval[rand.nextInt(flp.interval.length)]; + flp.cnt = flp.interval[rand.nextInt(cast(uint)flp.interval.length)]; } } mnx += pattern.scrollSpeed; @@ -249,26 +250,26 @@ float mtr, mtg, mtb; float mrr, mrg, mrb; private: - static const char[] FIELD_DIR_NAME = "/usr/share/games/tumiki-fighters/field"; + static const string FIELD_DIR_NAME = "/usr/share/games/tumiki-fighters/field"; // Initialize FieldPattern with the array. // randSeed, scrollSpeed, // [z, [interval], [TumikiSetName]] // (end when interval == "e", TumikiSetName == "e") - public this(char[][] data) { + public this(string[] data) { StringIterator si = new StringIterator(data); - randSeed = atoi(si.next); - scrollSpeed = atof(si.next); - br = atof(si.next); bg = atof(si.next); bb = atof(si.next); - gr = atof(si.next); gg = atof(si.next); gb = atof(si.next); - mtr = atof(si.next); mtg = atof(si.next); mtb = atof(si.next); + randSeed = to!int(si.next); + scrollSpeed = to!float(si.next); + br = to!float(si.next); bg = to!float(si.next); bb = to!float(si.next); + gr = to!float(si.next); gg = to!float(si.next); gb = to!float(si.next); + mtr = to!float(si.next); mtg = to!float(si.next); mtb = to!float(si.next); mrr = (br * 2+ gr) / 3; mrg = (bg * 2+ gg) / 3; mrb = (bb * 2+ gb) / 3; for (;;) { if (!si.hasNext) break; - float z = atof(si.next); + float z = to!float(si.next); FieldLinePattern flp = new FieldLinePattern; if (z > 0) { flp.z = -z; @@ -278,13 +279,13 @@ flp.onGround = false; } for (;;) { - char[] v = si.next; + string v = si.next; if (v == "e") break; - flp.addInterval(atoi(v)); + flp.addInterval(to!int(v)); } for (;;) { - char[] v = si.next; + string v = si.next; if (v == "e") break; flp.addTumikiSet(TumikiSet.getInstance(v)); @@ -293,8 +294,8 @@ } } - public this(char[] fileName) { - char[][] data = CSVTokenizer.readFile(FIELD_DIR_NAME ~ "/" ~ fileName); + public this(string fileName) { + string[] data = CSVTokenizer.readFile(FIELD_DIR_NAME ~ "/" ~ fileName); this(data); } } --- a/src/abagames/tf/gamemanager.d +++ b/src/abagames/tf/gamemanager.d @@ -6,6 +6,7 @@ module abagames.tf.gamemanager; private import std.math; +private import std.conv; private import opengl; private import SDL; private import bulletml; @@ -92,7 +93,7 @@ int credit; // Initialize actor pools, load BGMs/SEfs and textures. - public void init() { + public override void init() { BarrageManager.loadBulletMLs(); pad = cast(Pad) input; prefManager = cast(PrefManager) abstPrefManager; @@ -101,28 +102,28 @@ rand = new Rand; field = new Field; field.init(); - auto ParticleInitializer pi = new ParticleInitializer; + scope ParticleInitializer pi = new ParticleInitializer; particles = new ParticlePool(128, pi); - auto Fragment fragmentClass = new Fragment; - auto FragmentInitializer fi = new FragmentInitializer; + scope Fragment fragmentClass = new Fragment; + scope FragmentInitializer fi = new FragmentInitializer; fragments = new ActorPool(128, fragmentClass, fi); ship = new Ship; ship.init(pad, field, particles, fragments, this); - auto SplinterInitializer si = new SplinterInitializer(ship, field, particles, this); + scope SplinterInitializer si = new SplinterInitializer(ship, field, particles, this); splinters = new SplinterPool(144, si); - auto BulletActorInitializer bi = new BulletActorInitializer(field, ship, particles, splinters); + scope BulletActorInitializer bi = new BulletActorInitializer(field, ship, particles, splinters); bullets = new BulletActorPool(512, bi); ship.setBulletActorPool(bullets); ship.initStuckEnemies(splinters); gauge = new DamageGauge; - auto EnemyInitializer ei = new EnemyInitializer + scope EnemyInitializer ei = new EnemyInitializer (this, field, bullets, ship, splinters, particles, fragments, gauge); enemies = new EnemyPool(64, ei); bullets.setEnemies(enemies); - auto ScoreSignInitializer ssi = new ScoreSignInitializer; - auto ScoreSign scoreSignClass = new ScoreSign; + scope ScoreSignInitializer ssi = new ScoreSignInitializer; + scope ScoreSign scoreSignClass = new ScoreSign; signs = new ActorPool(32, scoreSignClass, ssi); - auto MobileLetterInitializer mli = new MobileLetterInitializer; + scope MobileLetterInitializer mli = new MobileLetterInitializer; letters = new MobileLetterPool(32, mli, field); stageManager = new StageManager(this, enemies, field); bullets.setStageManager(stageManager); @@ -132,12 +133,12 @@ LetterRender.createDisplayLists(); } - public void start() { + public override void start() { stage = 0; startTitle(); } - public void close() { + public override void close() { BarrageManager.unloadBulletMLs(); SoundManager.close(); LetterRender.deleteDisplayLists(); @@ -204,7 +205,7 @@ state = State.IN_GAME; } - private const char[][] stageMessage = + private const string[] stageMessage = [ "WE ARE TUMIKI FIGHTERS!", "JUST OVER THE HORIZON", @@ -225,7 +226,7 @@ gauge.init(); bossTimer = BOSSTIMER_FREEZED; bossDstCnt = -1; - letters.add("STAGE " ~ std.string.toString(stage + 1), 180, 150, 24, 240, -4); + letters.add("STAGE " ~ to!string(stage + 1), 180, 150, 24, 240, -4); letters.add(stageMessage[stage], 320 - stageMessage[stage].length * 10, 270, 10, 240, -2); int si = stage % (SoundManager.STAGE_BGM_NUM * 2 - 1); if (si >= SoundManager.STAGE_BGM_NUM) @@ -306,12 +307,12 @@ } // Move actors in game(called once per frame). - public void move() { + public override void move() { if (pad.keys[SDLK_ESCAPE] == SDL_PRESSED) { mainLoop.breakLoop(); return; } - switch (state) { + switch (state) { default: break; case State.START_GAME: case State.IN_GAME: case State.END_GAME: @@ -479,7 +480,7 @@ } // Draw actors in game(called once per frame). - public void draw() { + public override void draw() { SDL_Event e = mainLoop.event; if (e.type == SDL_VIDEORESIZE) { SDL_ResizeEvent re = e.resize; @@ -495,7 +496,7 @@ glPushMatrix(); setEyepos(); - switch (state) { + switch (state) { default: break; case State.START_GAME: case State.IN_GAME: case State.PAUSE: @@ -514,7 +515,7 @@ screen.viewOrthoFixed(); glDisable(GL_CULL_FACE); letters.draw(); - switch (state) { + switch (state) { default: break; case State.IN_GAME: drawStatusInGame(); break; @@ -616,7 +617,7 @@ LetterRender.drawString("YES", 483, 402, 8, LetterRender.Direction.TO_RIGHT, 2); LetterRender.drawString("NO", 560, 400, 12, LetterRender.Direction.TO_RIGHT, 0); } - LetterRender.drawString("CREDIT " ~ std.string.toString(credit), 32, 420, 8, + LetterRender.drawString("CREDIT " ~ to!string(credit), 32, 420, 8, LetterRender.Direction.TO_RIGHT, 3); } } --- a/src/abagames/tf/letterrender.d +++ b/src/abagames/tf/letterrender.d @@ -19,8 +19,8 @@ static const float LETTER_WIDTH = 2.1f; static const float LETTER_HEIGHT = 3.0f; static const int COLOR_NUM = 6; - private: static const int LETTER_NUM = 43; + private: static const int DISPLAY_LIST_NUM = LETTER_NUM * COLOR_NUM; static Rand rand; @@ -76,7 +76,7 @@ return idx; } - public static void drawString(char[] str, float lx, float y, float s, int d, int cl, + public static void drawString(string str, float lx, float y, float s, int d, int cl, bool rev) { if (cl < 0) rand.setSeed(-cl); @@ -85,7 +85,7 @@ float x = lx; int idx; float ld; - switch (d) { + switch (d) { default: break; case Direction.TO_RIGHT: ld = 0; break; @@ -114,7 +114,7 @@ drawLetter(idx, x, y, s, ld, rand.nextInt(COLOR_NUM)); } } - switch(d) { + switch(d) { default: break; case Direction.TO_RIGHT: x += s * LETTER_WIDTH; break; @@ -131,7 +131,7 @@ } } - public static void drawString(char[] str, float lx, float y, float s, int d, int cl) { + public static void drawString(string str, float lx, float y, float s, int d, int cl) { drawString(str, lx, y, s, d, cl, false); } @@ -141,7 +141,7 @@ int n = num; float x = lx; float ld; - switch (d) { + switch (d) { default: break; case Direction.TO_RIGHT: ld = 0; break; @@ -157,7 +157,7 @@ } for (;;) { drawLetter(n % 10, x, y, s, ld, cl); - switch(d) { + switch(d) { default: break; case Direction.TO_RIGHT: x -= s * LETTER_WIDTH; break; --- a/src/abagames/tf/mobileletter.d +++ b/src/abagames/tf/mobileletter.d @@ -31,8 +31,8 @@ float size; int cnt; - public static this() { - rand = new Rand; + public this() { + if (rand is null) rand = new Rand; } public override Actor newActor() { @@ -103,12 +103,12 @@ public this(int n, ActorInitializer ini, Field f) { field = f; - auto MobileLetter mlClass = new MobileLetter; + scope MobileLetter mlClass = new MobileLetter; super(n, mlClass, ini); rand = new Rand; } - public void add(char[] str, float x, float lgt, float size, int cnt, int col) { + public void add(string str, float x, float lgt, float size, int cnt, int col) { int color = col; if (col < 0) rand.setSeed(-col); --- a/src/abagames/tf/particle.d +++ b/src/abagames/tf/particle.d @@ -30,8 +30,8 @@ int type; int cnt; - public static this() { - rand = new Rand; + public this() { + if (rand is null) rand = new Rand; } public override Actor newActor() { @@ -67,7 +67,7 @@ pos.add(vel); vel.mul(0.9); alpha *= 0.9; - switch (type) { + switch (type) { default: break; case TypeName.SMOKE: size *= 1.025; break; @@ -78,12 +78,12 @@ } public override void draw() { - switch (type) { + switch (type) { default: break; case TypeName.SMOKE: Screen.setColor(0.8, 0.8, 0.8, alpha); break; case TypeName.SPARK: - if (cnt & 1 == 0) + if ((cnt & 1) == 0) Screen.setColor(1, 0.4, 0.2, alpha); else Screen.setColor(1, 1, 0.1, alpha); @@ -103,7 +103,7 @@ private: public this(int n, ActorInitializer ini) { - auto Particle particleClass = new Particle; + scope Particle particleClass = new Particle; super(n, particleClass, ini); } --- a/src/abagames/tf/prefmanager.d +++ b/src/abagames/tf/prefmanager.d @@ -7,6 +7,7 @@ private import std.stream; private import std.string; +private import std.conv; private import std.c.stdlib; private import abagames.util.prefmanager; @@ -16,21 +17,21 @@ public class PrefManager: abagames.util.prefmanager.PrefManager { public: static const int VERSION_NUM = 20; - static const char[] PREF_FILE = ".tumiki-fighters.prf"; + static const string PREF_FILE = ".tumiki-fighters.prf"; static const int RANKING_NUM = 10; static const int DEFAULT_HISCORE = 10000; RankingItem[RANKING_NUM] ranking; public this() { - foreach (inout RankingItem ri; ranking) + foreach (ref RankingItem ri; ranking) ri = new RankingItem; } - public static char[] home_dir() { - char * home = getenv("HOME"); + public static string home_dir() { + const(char)* home = getenv("HOME"); if (home is null) throw new Error("HOME environment variable is not defined"); - return std.string.toString(home); + return to!string(home); } private void init() { @@ -43,7 +44,7 @@ } public void load() { - auto File fd = new File; + scope File fd = new File; try { int ver; fd.open(home_dir() ~ "/" ~ PREF_FILE); @@ -60,7 +61,7 @@ } public void save() { - auto File fd = new File; + scope File fd = new File; fd.create(home_dir() ~ "/" ~ PREF_FILE); fd.write(VERSION_NUM); foreach (RankingItem ri; ranking) --- a/src/abagames/tf/screen.d +++ b/src/abagames/tf/screen.d @@ -3,7 +3,7 @@ * * Copyright 2004 Kenta Cho. All rights reserved. */ -module abagames.tf.playscreen; +module abagames.tf.screen; private import std.math; private import opengl; @@ -14,7 +14,7 @@ */ public class Screen: Screen3D { public: - static const char[] CAPTION = "TUMIKI Fighters"; + static const string CAPTION = "TUMIKI Fighters"; protected override void init() { setCaption(CAPTION); --- a/src/abagames/tf/ship.d +++ b/src/abagames/tf/ship.d @@ -88,7 +88,7 @@ target = new VirtualBulletTarget; etb[0] = new EnemyTopBullet; createTumiki(); - foreach (inout Vector fp; friendPos) { + foreach (ref Vector fp; friendPos) { fp = new Vector; } } --- a/src/abagames/tf/soundmanager.d +++ b/src/abagames/tf/soundmanager.d @@ -28,14 +28,14 @@ GameManager manager; Music bgm[BGM_NUM]; Chunk se[SE_NUM]; - const char[][] bgmFileName = + const string[] bgmFileName = ["we_are_tumiki_fighters.ogg", "just_over_the_horizon.ogg", "panic_on_meadow.ogg", "here_comes_a_gigantic_toy.ogg", "battle_over_the_junk_city.ogg", "return_to_home.ogg"]; - const char[][] seFileName = + const string[] seFileName = ["ship_shot.wav", "stuck.wav", "stuck_bonus.wav", "stuck_destroyed.wav", "ship_destroyed.wav", "enemy_damaged.wav", "small_enemy_destroyed.wav", "enemy_destroyed.wav", "boss_destroyed.wav", @@ -52,13 +52,13 @@ if (Sound.noSound) return; int i = 0; - foreach (inout Music b; bgm) { + foreach (ref Music b; bgm) { b = new Music; b.load(bgmFileName[i]); i++; } i = 0; - foreach (inout Chunk c; se) { + foreach (ref Chunk c; se) { c = new Chunk; c.load(seFileName[i], seChannel[i]); i++; --- a/src/abagames/tf/splinter.d +++ b/src/abagames/tf/splinter.d @@ -40,8 +40,8 @@ bool isBoss; bool flyin; - public static this() { - rand = new Rand; + public this() { + if (rand is null) rand = new Rand; } public static void setSignNum(int n) { @@ -60,7 +60,7 @@ manager = si.manager; pos = new Vector; vel = new Vector; - foreach (inout Vector cd; colDatums) + foreach (ref Vector cd; colDatums) cd = new Vector; } @@ -153,8 +153,8 @@ } if (ship.cnt < -Ship.INVINCIBLE_CNT) return; - foreach (Vector cd; colDatums) { - if (ship.stuckEnemies.checkHit(cd)) { + foreach (Vector cd_; colDatums) { + if (ship.stuckEnemies.checkHit(cd_)) { StuckEnemy se = cast(StuckEnemy) ship.stuckEnemies.getInstance(); if (se) { float ox = pos.x - ship.pos.x, oy = pos.y - ship.pos.y; @@ -228,7 +228,7 @@ private: public this(int n, ActorInitializer ini) { - auto Splinter splinterClass = new Splinter; + scope Splinter splinterClass = new Splinter; super(n, splinterClass, ini); } --- a/src/abagames/tf/stagemanager.d +++ b/src/abagames/tf/stagemanager.d @@ -6,6 +6,7 @@ module abagames.tf.stagemanager; private import std.string; +private import std.conv; private import std.math; private import bulletml; private import abagames.util.logger; @@ -52,13 +53,13 @@ this.enemies = enemies; this.field = field; rand = new Rand; - foreach (inout EnemyAppearance ea; appearance) + foreach (ref EnemyAppearance ea; appearance) ea = new EnemyAppearance; eaIdx = appearance.length; uint sn = 1; - foreach (inout StagePattern sp; stage) { - Logger.info("Load stage: " ~ std.string.toString(sn)); - sp = new StagePattern("stg" ~ std.string.toString(sn) ~ ".stg"); + foreach (ref StagePattern sp; stage) { + Logger.info("Load stage: " ~ to!string(sn)); + sp = new StagePattern("stg" ~ to!string(sn) ~ ".stg"); sn++; } Logger.info("Load stages completed."); @@ -124,7 +125,7 @@ if ((ea.cnt % ea.pattern.interval) == 0) { EnemyAppearancePattern p = ea.pattern; float x, y; - switch (p.posType) { + switch (p.posType) { default: break; case EnemyAppearancePattern.AppearancePos.FRONT: x = field.size.x - p.spec.sizeXm * 1.1f; y = field.size.y * (p.pos + rand.nextSignedFloat(p.width)); @@ -171,8 +172,8 @@ long randSeed; int warningCnt; private: - static const char[] STAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/stage"; - static int[char[]] posTypeStr; + static const string STAGE_DIR_NAME = "/usr/share/games/tumiki-fighters/stage"; + static int[string] posTypeStr; public static this() { posTypeStr["f"] = 0; @@ -186,20 +187,20 @@ // EnemySpec file name, // move BulletML file name, {speedRank}/{withdrawCnt, speed, [x, y], [idx, speed, [x, y]]}], // (use PointsMovePattern when moveBulletML == "p", end when x == "e", idx == "e") - public this(char[][] data) { + public this(string[] data) { StringIterator si = new StringIterator(data); - randSeed = atoi(si.next); - warningCnt = atoi(si.next); + randSeed = to!int(si.next); + warningCnt = to!int(si.next); for (;;) { if (!si.hasNext) break; - int startTime = atoi(si.next); - int duration = atoi(si.next); - int interval = atoi(si.next); - char[] v = si.next; + int startTime = to!int(si.next); + int duration = to!int(si.next); + int interval = to!int(si.next); + string v = si.next; int posType = posTypeStr[v]; - float pos = atof(si.next); - float width = atof(si.next); + float pos = to!float(si.next); + float width = to!float(si.next); v = si.next; bool wted; if (v == "y") @@ -214,29 +215,29 @@ v = si.next; if (v == "p") { eap.startSetPointsMove(); - eap.setWithdrawCnt(atoi(si.next)); + eap.setWithdrawCnt(to!int(si.next)); int atIdx = PointsMovePattern.BASIC_PATTERN_IDX; for (;;) { - float speed = atof(si.next); + float speed = to!float(si.next); eap.setMoveSpeed(atIdx, speed); for (;;) { v = si.next; if (v == "e") break; - float x = atof(v); - float y = atof(si.next); + float x = to!float(v); + float y = to!float(si.next); eap.addMovePoint(atIdx, x, y); } v = si.next; if (v == "e") break; - atIdx = atoi(v); + atIdx = to!int(v); } } else { eap.setMoveBulletML(v); - eap.setSpeedRank(atof(si.next)); + eap.setSpeedRank(to!float(si.next)); } - switch (posType) { + switch (posType) { default: break; case EnemyAppearancePattern.AppearancePos.FRONT: d = PI / 2 * 3; break; @@ -249,8 +250,8 @@ } } - public this(char[] fileName) { - char[][] data = CSVTokenizer.readFile(STAGE_DIR_NAME ~ "/" ~ fileName); + public this(string fileName) { + string[] data = CSVTokenizer.readFile(STAGE_DIR_NAME ~ "/" ~ fileName); this(data); } } @@ -298,7 +299,7 @@ (cast(PointsMovePattern) move).point[idx] ~= new Vector(x, y); } - public void setMoveBulletML(char[] fn) { + public void setMoveBulletML(string fn) { move = new BulletMLMovePattern; (cast(BulletMLMovePattern) move).parser = BarrageManager.getInstance(fn); if (!(cast(BulletMLMovePattern) move).parser) --- a/src/abagames/tf/stuckenemy.d +++ b/src/abagames/tf/stuckenemy.d @@ -69,9 +69,9 @@ lofs = new Vector; pos = new Vector; target = new VirtualBulletTarget; - foreach (inout Vector cd; colDatums) + foreach (ref Vector cd; colDatums) cd = new Vector; - foreach (inout EnemyTopBullet etb; topBullet) + foreach (ref EnemyTopBullet etb; topBullet) etb = new EnemyTopBullet; } @@ -328,7 +328,7 @@ GameManager manager; public this(int n, ActorInitializer ini) { - auto StuckEnemy seClass = new StuckEnemy; + scope StuckEnemy seClass = new StuckEnemy; super(n, seClass, ini); manager = (cast(StuckEnemyInitializer) ini).manager; } --- a/src/abagames/tf/tumiki.d +++ b/src/abagames/tf/tumiki.d @@ -32,7 +32,7 @@ Barrage[] barrage; static int propellerCnt = 0; - private final const float CHECK_HIT_SIZE_RETIO = 0.7; + private const float CHECK_HIT_SIZE_RETIO = 0.7; public this(int shape, int color, float x, float y, float sx, float sy, float sizeRatio) { @@ -218,10 +218,10 @@ return checkDistHit(p.x - px, p.y - py, ofs, size); } - private static const int DISPLAY_LIST_NUM = SHAPE_NUM * COLOR_NUM * SHADE_NUM; public static const int COLOR_NUM = 12; public static const int DAMAGED_COLOR = 6; public static const int WOUNDED_COLOR = 0; + private static const int DISPLAY_LIST_NUM = SHAPE_NUM * COLOR_NUM * SHADE_NUM; private static const float[3][COLOR_NUM] colorParams = [ [0.9, 0.6, 0.6], [0.6, 0.9, 0.6], [0.6, 0.6, 0.9], @@ -251,7 +251,7 @@ } private static void setSideColor(int j, int i) { - switch (i) { + switch (i) { default: break; case 0: Screen.setColor (colorParams[j][0] * 0.7, colorParams[j][1] * 0.7, colorParams[j][2] * 0.7); @@ -506,7 +506,7 @@ this.postWait = postWait; } - public void addBml(char[] bmlFileName, float r, float s) { + public void addBml(string bmlFileName, float r, float s) { BulletMLParser *p = BarrageManager.getInstance(bmlFileName); if (!p) throw new Error("File not found: " ~ bmlFileName); @@ -523,7 +523,7 @@ return null; int cl; float xrev, yrev; - switch (type) { + switch (type) { default: break; case BulletInst.Type.ENEMY: cl = color; xrev = yrev = 1; --- a/src/abagames/tf/tumikiset.d +++ b/src/abagames/tf/tumikiset.d @@ -6,6 +6,7 @@ module abagames.tf.tumikiset; private import std.string; +private import std.conv; private import std.math; private import abagames.util.vector; private import abagames.util.csv; @@ -28,42 +29,42 @@ int score, fireScore, fireScoreInterval; float sizeXm, sizeXp, sizeYm, sizeYp, size; private: - static TumikiSet[char[]] instances; - static const char[] TUMIKI_DIR_NAME = "/usr/share/games/tumiki-fighters/tumiki"; + static TumikiSet[string] instances; + static const string TUMIKI_DIR_NAME = "/usr/share/games/tumiki-fighters/tumiki"; static const float BULLET_SPEED_RATIO = 1.2; - static int[char[]] shapeStr; - static char[][] SHAPE_STR = + static int[string] shapeStr; + static string[] SHAPE_STR = ["s", "ul", "ur", "dr", "dl", "u", "r", "d", "l", "pu", "pdr", "pr", "pur", "pd", "pf"]; - static int[char[]] colorStr; - static char[][] COLOR_STR = + static int[string] colorStr; + static string[] COLOR_STR = ["r", "g", "b", "y", "p", "a", "w", "gr"]; - static int[char[]] bulletShapeStr; - static char[][] BULLET_SHAPE_STR = + static int[string] bulletShapeStr; + static string[] BULLET_SHAPE_STR = ["b", "a", "r"]; - static int[char[]] bulletColorStr; - static char[][] BULLET_COLOR_STR = + static int[string] bulletColorStr; + static string[] BULLET_COLOR_STR = ["r", "a", "p"]; private static void init() { if (shapeStr.length != 0) return; // already initialized int i = 0; - foreach (char[] s; SHAPE_STR) { + foreach (string s; SHAPE_STR) { shapeStr[s] = i; i++; } i = 0; - foreach (char[] s; COLOR_STR) { + foreach (string s; COLOR_STR) { colorStr[s] = i; i++; } i = 0; - foreach (char[] s; BULLET_SHAPE_STR) { + foreach (string s; BULLET_SHAPE_STR) { bulletShapeStr[s] = i; i++; } i = 0; - foreach (char[] s; BULLET_COLOR_STR) { + foreach (string s; BULLET_COLOR_STR) { bulletColorStr[s] = i; i++; } @@ -77,26 +78,26 @@ // [BulletML, rank, speed]], // (end when BulletML == e, shape == e)(set a empty barrage when shape == s), // ], - private this(char[][] data) { + private this(string[] data) { init(); sizeXm = sizeYm = float.max; sizeXp = sizeYp = float.min; StringIterator si = new StringIterator(data); - float sizeRatio = atof(si.next); - score = atoi(si.next); - fireScore = atoi(si.next); - fireScoreInterval = atoi(si.next); + float sizeRatio = to!float(si.next); + score = to!int(si.next); + fireScore = to!int(si.next); + fireScoreInterval = to!int(si.next); for (;;) { if (!si.hasNext) break; - char[] v = si.next; + string v = si.next; int shape = ((v in shapeStr) != null) ? shapeStr[v] : 0; //the data files contain undefined codes v = si.next; int color = ((v in colorStr) != null) ? colorStr[v] : 0; - float x = atof(si.next); - float y = atof(si.next); - float sizex = atof(si.next); - float sizey = atof(si.next); + float x = to!float(si.next); + float y = to!float(si.next); + float sizex = to!float(si.next); + float sizey = to!float(si.next); Tumiki ti = new Tumiki(shape, color, x, y, sizex, sizey, sizeRatio); if (sizeXp < ti.ofs.x + ti.size.x) sizeXp = ti.ofs.x + ti.size.x; @@ -114,21 +115,21 @@ ti.addBarrage(new Barrage); continue; } - int shape = ((v in bulletShapeStr) != null) ? bulletShapeStr[v] : 0; + int shape_ = ((v in bulletShapeStr) != null) ? bulletShapeStr[v] : 0; v = si.next; - int color = ((v in bulletColorStr) != null) ? bulletColorStr[v] : 0; - float size = atof(si.next); - float yReverse = atof(si.next); - int prevWait = atoi(si.next); - int postWait = atoi(si.next); + int color_ = ((v in bulletColorStr) != null) ? bulletColorStr[v] : 0; + float size = to!float(si.next); + float yReverse = to!float(si.next); + int prevWait = to!int(si.next); + int postWait = to!int(si.next); Barrage br = new Barrage - (shape, color, size, yReverse, prevWait, postWait); + (shape_, color_, size, yReverse, prevWait, postWait); for (;;) { - char[] bml = si.next; + string bml = si.next; if (bml == "e") break; - float rank = atof(si.next); - float speed = atof(si.next); + float rank = to!float(si.next); + float speed = to!float(si.next); br.addBml(bml, rank, speed * BULLET_SPEED_RATIO); } ti.addBarrage(br); @@ -139,13 +140,13 @@ } // Initialize TumikiSet from the file. - public this(char[] fileName) { + public this(string fileName) { Logger.info("Load tumiki set: " ~ fileName); - char[][] data = CSVTokenizer.readFile(TUMIKI_DIR_NAME ~ "/" ~ fileName); + string[] data = CSVTokenizer.readFile(TUMIKI_DIR_NAME ~ "/" ~ fileName); this(data); } - public static TumikiSet getInstance(char[] fileName) { + public static TumikiSet getInstance(string fileName) { if ((fileName in instances) == null) { instances[fileName] = new TumikiSet(fileName); } --- a/src/abagames/util/actorpool.d +++ b/src/abagames/util/actorpool.d @@ -14,11 +14,11 @@ public: Actor[] actor; protected: - int actorIdx; + ptrdiff_t actorIdx; public this(int n, Actor act, ActorInitializer ini) { actor = new Actor[n]; - foreach (inout Actor a; actor) { + foreach (ref Actor a; actor) { a = act.newActor(); a.isExist = false; a.init(ini); --- a/src/abagames/util/csv.d +++ b/src/abagames/util/csv.d @@ -7,6 +7,7 @@ private import std.stream; private import std.string; +private import std.conv; /** * CSV format Tokenizer. @@ -14,17 +15,17 @@ public class CSVTokenizer { private: - public static char[][] readFile(char[] fileName) { - char[][] result; - auto File fd = new File; + public static string[] readFile(string fileName) { + string[] result; + scope File fd = new File; fd.open(fileName); for (;;) { - char[] line = fd.readLine(); + string line = to!string(fd.readLine()); if (!line) break; - char[][] spl = split(line, ","); - foreach (char[] s; spl) { - char[] r = strip(s); + string[] spl = split(line, ","); + foreach (string s; spl) { + string r = strip(s); if (r.length > 0) result ~= r; } --- a/src/abagames/util/iterator.d +++ b/src/abagames/util/iterator.d @@ -36,4 +36,4 @@ } } -alias ArrayIterator!(char[]) StringIterator; +alias ArrayIterator!(string) StringIterator; --- a/src/abagames/util/logger.d +++ b/src/abagames/util/logger.d @@ -7,6 +7,7 @@ private import std.cstream; private import std.string; +private import std.conv; /** * Logger(error/info). @@ -18,32 +19,28 @@ public class Logger { - public static void info(char[] msg) { + public static void info(string msg) { // Win32 exe file crashes if it writes something to stderr. //stderr.writeLine("Info: " ~ msg); } public static void info(int n) { - //stderr.writeLine("Info: " ~ std.string.toString(n)); + //stderr.writeLine("Info: " ~ to!string(n)); } public static void info(float n) { - //stderr.writeLine("Info: -" ~ std.string.toString(n)); + //stderr.writeLine("Info: -" ~ to!string(n)); } - private static void putMessage(char[] msg) { + private static void putMessage(string msg) { MessageBoxA(null, std.string.toStringz(msg), "Error", MB_OK | MB_ICONEXCLAMATION); } - public static void error(char[] msg) { + public static void error(string msg) { putMessage("Error: " ~ msg); } - public static void error(Exception e) { - putMessage("Error: " ~ e.toString()); - } - - public static void error(Error e) { + public static void error(Throwable e) { putMessage("Error: " ~ e.toString()); } } @@ -52,27 +49,23 @@ public class Logger { - public static void info(char[] msg) { + public static void info(string msg) { derr.writeLine("Info: " ~ msg); } public static void info(int n) { - derr.writeLine("Info: " ~ std.string.toString(n)); + derr.writeLine("Info: " ~ to!string(n)); } public static void info(float n) { - derr.writeLine("Info: -" ~ std.string.toString(n)); + derr.writeLine("Info: -" ~ to!string(n)); } - public static void error(char[] msg) { + public static void error(string msg) { derr.writeLine("Error: " ~ msg); } - public static void error(Exception e) { - derr.writeLine("Error: " ~ e.toString()); - } - - public static void error(Error e) { + public static void error(Throwable e) { derr.writeLine("Error: " ~ e.toString()); if (e.next) error(e.next); --- a/src/abagames/util/rand.d +++ b/src/abagames/util/rand.d @@ -6,7 +6,7 @@ module abagames.util.rand; private import std.stream; -private import std.date; +private import std.datetime; /** * Random number generator. @@ -14,12 +14,12 @@ public class Rand { public this() { - d_time timer = getUTCtime(); - init_genrand(timer); + long timer = Clock.currStdTime(); + init_genrand(cast(uint)timer); } public void setSeed(long n) { - init_genrand(n); + init_genrand(cast(uint)n); } public int nextInt(int n) { @@ -45,7 +45,7 @@ Matthe Bellew, and Isaku Wada Andrew C. Edwards v0.1 30 September 2003 edwardsac@ieee.org - Before using, initialize the state by using init_genrand(seed) + Before using, initialize the state by using init_genrand(cast(uint)seed) or init_by_array(init_key, key_length). Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, @@ -113,7 +113,7 @@ { state[0]= s & 0xffffffffUL; for (int j=1; j> 30)) + j); + state[j] = (1812433253U * (state[j-1] ^ (state[j-1] >> 30)) + j); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array state[]. */ @@ -131,11 +131,11 @@ void init_by_array(uint init_key[], uint key_length) { int i, j, k; - init_genrand(19650218UL); + init_genrand(cast(uint)19650218UL); i=1; j=0; k = (N>key_length ? N : key_length); for (; k; k--) { - state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL)) + state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525U)) + init_key[j] + j; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; j++; @@ -143,7 +143,7 @@ if (j>=key_length) j=0; } for (k=N-1; k; k--) { - state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL)) + state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941U)) - i; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; @@ -156,14 +156,14 @@ void next_state() { - uint *p=state; + uint *p=state.ptr; - /* if init_genrand() has not been called, */ + /* if init_genrand(cast(uint)) has not been called, */ /* a default initial seed is used */ - if (initf==0) init_genrand(5489UL); + if (initf==0) init_genrand(cast(uint)5489UL); left = N; - next = state; + next = state.ptr; for (int j=N-M+1; --j; p++) *p = p[M] ^ TWIST(p[0], p[1]); --- a/src/abagames/util/sdl/mainloop.d +++ b/src/abagames/util/sdl/mainloop.d @@ -91,7 +91,7 @@ frame = cast(int) (nowTick-prvTickCount) / interval; if (frame <= 0) { frame = 1; - SDL_Delay(prvTickCount+interval-nowTick); + SDL_Delay(cast(uint)(prvTickCount+interval-nowTick)); if (accframe) { prvTickCount = SDL_GetTicks(); } else { --- a/src/abagames/util/sdl/pad.d +++ b/src/abagames/util/sdl/pad.d @@ -6,6 +6,7 @@ module abagames.util.sdl.pad; private import std.string; +private import std.conv; private import SDL; private import abagames.util.sdl.input; private import abagames.util.sdl.sdlexception; @@ -31,7 +32,7 @@ public void openJoystick() { if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) { throw new SDLInitFailedException( - "Unable to init SDL joystick: " ~ std.string.toString(SDL_GetError())); + "Unable to init SDL joystick: " ~ to!string(SDL_GetError())); } stick = SDL_JoystickOpen(0); } --- a/src/abagames/util/sdl/screen3d.d +++ b/src/abagames/util/sdl/screen3d.d @@ -6,6 +6,7 @@ module abagames.util.sdl.screen3d; private import std.string; +private import std.conv; private import SDL; private import opengl; private import abagames.util.logger; @@ -34,7 +35,7 @@ // Initialize SDL. if (SDL_Init(SDL_INIT_VIDEO) < 0) { throw new SDLInitFailedException( - "Unable to initialize SDL: " ~ std.string.toString(SDL_GetError())); + "Unable to initialize SDL: " ~ to!string(SDL_GetError())); } // Create an OpenGL screen. if (windowMode) { @@ -44,7 +45,7 @@ } if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) { throw new SDLInitFailedException - ("Unable to create SDL screen: " ~ std.string.toString(SDL_GetError())); + ("Unable to create SDL screen: " ~ to!string(SDL_GetError())); } glViewport(0, 0, width, height); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); @@ -58,7 +59,7 @@ public void screenResized() { if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) { throw new Exception - ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError())); + ("Unable to resize SDL screen: " ~ to!string(SDL_GetError())); } glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); @@ -98,7 +99,7 @@ throw new Exception("OpenGL error"); } - protected void setCaption(char[] name) { + protected void setCaption(string name) { SDL_WM_SetCaption(std.string.toStringz(name), null); } --- a/src/abagames/util/sdl/sdlexception.d +++ b/src/abagames/util/sdl/sdlexception.d @@ -9,7 +9,7 @@ * SDL initialize failed. */ public class SDLInitFailedException: Exception { - public this(char[] msg) { + public this(string msg) { super(msg); } } --- a/src/abagames/util/sdl/sound.d +++ b/src/abagames/util/sdl/sound.d @@ -6,6 +6,7 @@ module abagames.util.sdl.sound; private import std.string; +private import std.conv; private import SDL; private import SDL_mixer; private import abagames.util.sdl.sdlexception; @@ -28,7 +29,7 @@ if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { noSound = 1; throw new SDLInitFailedException - ("Unable to initialize SDL_AUDIO: " ~ std.string.toString(SDL_GetError())); + ("Unable to initialize SDL_AUDIO: " ~ to!string(SDL_GetError())); } audio_rate = 44100; audio_format = AUDIO_S16; @@ -37,7 +38,7 @@ if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) { noSound = 1; throw new SDLInitFailedException - ("Couldn't open audio: " ~ std.string.toString(SDL_GetError())); + ("Couldn't open audio: " ~ to!string(SDL_GetError())); } Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); } @@ -51,8 +52,8 @@ Mix_CloseAudio(); } - public abstract void load(char[] name); - public abstract void load(char[] name, int ch); + public abstract void load(string name); + public abstract void load(string name, int ch); public abstract void free(); public abstract void play(); public abstract void fade(); @@ -62,34 +63,34 @@ public class Music: Sound { public: static int fadeOutSpeed = 1280; - static char[] dir = "/usr/share/games/tumiki-fighters/sounds/"; + static string dir = "/usr/share/games/tumiki-fighters/sounds/"; private: Mix_Music* music; - public void load(char[] name) { + public override void load(string name) { if (noSound) return; - char[] fileName = dir ~ name; + string fileName = dir ~ name; music = Mix_LoadMUS(std.string.toStringz(fileName)); if (!music) { noSound = true; throw new SDLInitFailedException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } } - public void load(char[] name, int ch) { + public override void load(string name, int ch) { load(name); } - public void free() { + public override void free() { if (music) { halt(); Mix_FreeMusic(music); } } - public void play() { + public override void play() { if (noSound) return; Mix_PlayMusic(music, -1); } @@ -99,11 +100,11 @@ Mix_PlayMusic(music, 1); } - public void fade() { + public override void fade() { Music.fadeMusic(); } - public void halt() { + public override void halt() { Music.haltMusic(); } @@ -122,46 +123,46 @@ public class Chunk: Sound { public: - static char[] dir = "/usr/share/games/tumiki-fighters/sounds/"; + static string dir = "/usr/share/games/tumiki-fighters/sounds/"; private: Mix_Chunk* chunk; int chunkChannel; - public void load(char[] name) { + public override void load(string name) { load(name, 0); } - public void load(char[] name, int ch) { + public override void load(string name, int ch) { if (noSound) return; - char[] fileName = dir ~ name; + string fileName = dir ~ name; chunk = Mix_LoadWAV(std.string.toStringz(fileName)); if (!chunk) { noSound = true; throw new SDLInitFailedException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } chunkChannel = ch; } - public void free() { + public override void free() { if (chunk) { halt(); Mix_FreeChunk(chunk); } } - public void play() { + public override void play() { if (noSound) return; Mix_PlayChannel(chunkChannel, chunk, 0); } - public void halt() { + public override void halt() { if (noSound) return; Mix_HaltChannel(chunkChannel); } - public void fade() { + public override void fade() { halt(); } } --- a/src/abagames/util/sdl/texture.d +++ b/src/abagames/util/sdl/texture.d @@ -15,13 +15,13 @@ */ public class Texture { public: - static char[] imagesDir = "/usr/share/games/tumiki-fighters/images/"; + static string imagesDir = "/usr/share/games/tumiki-fighters/images/"; private: GLuint num; - public this(char[] name) { - char[] fileName = imagesDir ~ name; + public this(string name) { + string fileName = imagesDir ~ name; SDL_Surface *surface; surface = SDL_LoadBMP(std.string.toStringz(fileName)); if (!surface) { --- a/src/abagames/tf/fragment.d +++ b/src/abagames/tf/fragment.d @@ -26,8 +26,8 @@ int shape, color; int cnt; - public static this() { - rand = new Rand; + public this() { + if (rand is null) rand = new Rand; } public override Actor newActor() { debian/patches/imports.patch0000644000000000000000000007157412164046614013355 0ustar Description: port import/ code to D language version 2 With this patch the code is accapted by GDC 4.8 without triggering deprecation warnings/errors. Author: Peter De Wachter --- a/import/SDL.d +++ b/import/SDL.d @@ -20,18 +20,28 @@ slouken@devolution.com */ -import SDL_types; -import SDL_getenv; -import SDL_error; -import SDL_rwops; -import SDL_timer; -import SDL_audio; -import SDL_cdrom; -import SDL_joystick; -import SDL_events; -import SDL_video; -import SDL_byteorder; -import SDL_version_; +public import SDL_keysym_; +public import SDL_version_; +public import SDL_active; +public import SDL_audio; +public import SDL_byteorder; +public import SDL_cdrom; +public import SDL_copying; +public import SDL_endian; +public import SDL_error; +public import SDL_events; +public import SDL_getenv; +public import SDL_joystick; +public import SDL_keyboard; +public import SDL_mouse; +public import SDL_mutex; +public import SDL_quit; +public import SDL_rwops; +public import SDL_syswm; +public import SDL_thread; +public import SDL_timer; +public import SDL_types; +public import SDL_video; extern(C): @@ -73,18 +83,3 @@ */ void SDL_Quit(); -void SDL_SetModuleHandle(void *hInst); -extern(Windows) void* GetModuleHandle(char*); - -static this() -{ - /* Load SDL dynamic link library */ - if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) - throw new Error("Error loading SDL"); - SDL_SetModuleHandle(GetModuleHandle(null)); -} - -static ~this() -{ - SDL_Quit(); -} --- a/import/SDL_audio.d +++ b/import/SDL_audio.d @@ -24,6 +24,7 @@ import SDL_error; import SDL_rwops; import SDL_byteorder; +import std.string; extern(C): @@ -42,7 +43,7 @@ Once the callback returns, the buffer will no longer be valid. Stereo samples are stored in a LRLRLR ordering. */ - void (*callback)(void *userdata, Uint8 *stream, int len); + void function(void *userdata, Uint8 *stream, int len) callback; void *userdata; } @@ -74,7 +75,7 @@ int len_cvt; /* Length of converted audio buffer */ int len_mult; /* buffer must be len*len_mult big */ double len_ratio; /* Given len, final size is len*len_ratio */ - void (*filters[10])(SDL_AudioCVT *cvt, Uint16 format); + void function(SDL_AudioCVT *cvt, Uint16 format)[10] filters; int filter_index; /* Current audio conversion function */ } @@ -161,7 +162,7 @@ * This function loads a WAVE from the data source, automatically freeing * that source if 'freesrc' is non-zero. For example, to load a WAVE file, * you could do: - * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", toStringz("rb")), 1, ...); * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets @@ -178,7 +179,7 @@ SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /* Compatibility convenience function -- loads a WAV from a file */ -SDL_AudioSpec *SDL_LoadWAV(char* file, SDL_AudioSpec* spec, +SDL_AudioSpec *SDL_LoadWAV(const(char)* file, SDL_AudioSpec* spec, Uint8 **audio_buf, Uint32 *audio_len) { return SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1, spec, --- a/import/SDL_cdrom.d +++ b/import/SDL_cdrom.d @@ -49,7 +49,7 @@ } /* Given a status, returns true if there's a disk in the drive */ -bit CD_INDRIVE(int status) { return status > 0; } +bool CD_INDRIVE(int status) { return status > 0; } struct SDL_CDtrack { Uint8 id; /* Track number */ --- a/import/SDL_endian.d +++ b/import/SDL_endian.d @@ -47,7 +47,7 @@ */ Uint16 SDL_Swap16(Uint16 D) { - return((D<<8)|(D>>8)); + return cast(Uint16)((D<<8)|(D>>8)); } Uint32 SDL_Swap32(Uint32 D) { @@ -57,9 +57,9 @@ Uint64 SDL_Swap64(Uint64 val) { Uint32 hi, lo; /* Separate into high and low 32-bit values and swap them */ - lo = (Uint32)(val&0xFFFFFFFF); + lo = cast(Uint32)(val&0xFFFFFFFF); val >>= 32; - hi = (Uint32)(val&0xFFFFFFFF); + hi = cast(Uint32)(val&0xFFFFFFFF); val = SDL_Swap32(lo); val <<= 32; val |= SDL_Swap32(hi); --- a/import/SDL_events.d +++ b/import/SDL_events.d @@ -271,7 +271,7 @@ The filter is protypted as: */ -alias int (*SDL_EventFilter)(SDL_Event *event); +alias int function(SDL_Event *event) SDL_EventFilter; /* If the filter returns 1, then the event will be added to the internal queue. If it returns 0, then the event will be dropped from the queue, but the @@ -304,8 +304,8 @@ If 'state' is set to SDL_QUERY, SDL_EventState() will return the current processing state of the specified event. */ -const uint SDL_QUERY = -1; -const uint SDL_IGNORE = 0; -const uint SDL_DISABLE = 0; -const uint SDL_ENABLE = 1; +const int SDL_QUERY = -1; +const int SDL_IGNORE = 0; +const int SDL_DISABLE = 0; +const int SDL_ENABLE = 1; Uint8 SDL_EventState(Uint8 type, int state); --- a/import/SDL_getenv.d +++ b/import/SDL_getenv.d @@ -2,6 +2,7 @@ extern(C): +/+ /* Put a variable of the form "name=value" into the environment */ int SDL_putenv(char *variable); int putenv(char* X) { return SDL_putenv(X); } @@ -9,3 +10,4 @@ /* Retrieve a variable named "name" from the environment */ char *SDL_getenv(char *name); char *getenv(char* X) { return SDL_getenv(X); } ++/ --- a/import/SDL_mixer.d +++ b/import/SDL_mixer.d @@ -22,7 +22,7 @@ // convert to D by shinichiro.h -/* $Id: SDL_mixer.d,v 1.1.1.1 2004/04/03 10:36:30 kenta Exp $ */ +/* $Id: SDL_mixer.d,v 1.1.1.1 2006/11/19 07:54:54 kenta Exp $ */ import SDL; @@ -104,10 +104,10 @@ /* Load a wave file or a music (.mod .s3m .it .xm) file */ Mix_Chunk * Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); - Mix_Chunk * Mix_LoadWAV(char *file) { + Mix_Chunk * Mix_LoadWAV(const(char) *file) { return Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1); } - Mix_Music * Mix_LoadMUS(char *file); + Mix_Music * Mix_LoadMUS(const(char) *file); /* Load a wave file of the mixer format from a memory buffer */ Mix_Chunk * Mix_QuickLoad_WAV(Uint8 *mem); @@ -128,19 +128,17 @@ This can be used to provide real-time visual display of the audio stream or add a custom mixer filter for the stream data. */ - void Mix_SetPostMix(void (*mix_func) - (void *udata, Uint8 *stream, int len), void *arg); + void Mix_SetPostMix(void function(void *udata, Uint8 *stream, int len) mix_func, void *arg); /* Add your own music player or additional mixer function. If 'mix_func' is NULL, the default music player is re-enabled. */ - void Mix_HookMusic(void (*mix_func) - (void *udata, Uint8 *stream, int len), void *arg); + void Mix_HookMusic(void function(void *udata, Uint8 *stream, int len) mix_func, void *arg); /* Add your own callback when the music has finished playing. This callback is only called if the music finishes naturally. */ - void Mix_HookMusicFinished(void (*music_finished)()); + void Mix_HookMusicFinished(void function() music_finished); /* Get a pointer to the user data for the current music hook */ void * Mix_GetMusicHookData(); @@ -153,7 +151,7 @@ * inside the audio callback, or SDL_mixer will explicitly lock the audio * before calling your callback. */ - void Mix_ChannelFinished(void (*channel_finished)(int channel)); + void Mix_ChannelFinished(void function(int channel) channel_finished); /* Special Effects API by ryan c. gordon. (icculus@linuxgames.com) */ @@ -177,7 +175,7 @@ * * DO NOT EVER call SDL_LockAudio() from your callback function! */ - typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + alias void function(int chan, void *stream, int len, void *udata) Mix_EffectFunc_t; /* * This is a callback that signifies that a channel has finished all its @@ -188,7 +186,7 @@ * * DO NOT EVER call SDL_LockAudio() from your callback function! */ - typedef void (*Mix_EffectDone_t)(int chan, void *udata); + alias void function(int chan, void *udata) Mix_EffectDone_t; /* Register a special effect function. At mixing time, the channel data is @@ -510,7 +508,7 @@ int Mix_PlayingMusic(); /* Stop music and set external music playback command */ - int Mix_SetMusicCMD(char *command); + int Mix_SetMusicCMD(const(char) *command); /* Synchro value is set by MikMod from modules while playing */ int Mix_SetSynchroValue(int value); --- a/import/SDL_mouse.d +++ b/import/SDL_mouse.d @@ -109,6 +109,8 @@ const uint SDL_BUTTON_LEFT = 1; const uint SDL_BUTTON_MIDDLE = 2; const uint SDL_BUTTON_RIGHT = 3; +const uint SDL_BUTTON_WHEELUP = 4; +const uint SDL_BUTTON_WHEELDOWN = 5; const uint SDL_BUTTON_LMASK = SDL_PRESSED << (SDL_BUTTON_LEFT - 1); const uint SDL_BUTTON_MMASK = SDL_PRESSED << (SDL_BUTTON_MIDDLE - 1); const uint SDL_BUTTON_RMASK = SDL_PRESSED << (SDL_BUTTON_RIGHT - 1); --- a/import/SDL_quit.d +++ b/import/SDL_quit.d @@ -40,8 +40,8 @@ */ /* There are no functions directly affecting the quit event */ -bit SDL_QuitRequested() +bool SDL_QuitRequested() { SDL_PumpEvents(); - return cast(bit)SDL_PeepEvents(null, 0, SDL_PEEKEVENT, SDL_QUITMASK); + return 0 != SDL_PeepEvents(null, 0, SDL_PEEKEVENT, SDL_QUITMASK); } --- a/import/SDL_rwops.d +++ b/import/SDL_rwops.d @@ -28,11 +28,6 @@ extern(C): -typedef int (*_seek_func_t)(SDL_RWops *context, int offset, int whence); -typedef int (*_read_func_t)(SDL_RWops *context, void *ptr, int size, int maxnum); -typedef int (*_write_func_t)(SDL_RWops *context, void *ptr, int size, int num); -typedef int (*_close_func_t)(SDL_RWops *context); - /* This is the read/write operation structure -- very basic */ struct SDL_RWops { @@ -40,26 +35,22 @@ SEEK_SET, SEEK_CUR, SEEK_END Returns the final offset in the data source. */ - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); + int function(SDL_RWops *context, int offset, int whence) seek; /* Read up to 'num' objects each of size 'objsize' from the data source to the area pointed at by 'ptr'. Returns the number of objects read, or -1 if the read failed. */ - _read_func_t read; -// int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum); + int function(SDL_RWops *context, void *ptr, int size, int maxnum) read; /* Write exactly 'num' objects each of size 'objsize' from the area pointed at by 'ptr' to data source. Returns 'num', or -1 if the write failed. */ - _write_func_t write; -// int (*write)(SDL_RWops *context, void *ptr, int size, int num); + int function(SDL_RWops *context, void *ptr, int size, int num) write; /* Close and free an allocated SDL_FSops structure */ - _close_func_t close; -// int (*close)(SDL_RWops *context); + int function(SDL_RWops *context) close; Uint32 type; union { @@ -81,7 +72,7 @@ /* Functions to create SDL_RWops structures from various data sources */ -SDL_RWops * SDL_RWFromFile(char *file, char *mode); +SDL_RWops * SDL_RWFromFile(const(char)* file, const(char)* mode); SDL_RWops * SDL_RWFromFP(void *fp, int autoclose); @@ -93,40 +84,25 @@ /* Macros to easily read and write from an SDL_RWops structure */ int SDL_RWseek(SDL_RWops *ctx, int offset, int whence) { - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); - seek = ctx.seek; - return (*seek)(ctx, offset, whence); + return ctx.seek(ctx, offset, whence); } int SDL_RWtell(SDL_RWops *ctx) { - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); - seek = ctx.seek; - return (*seek)(ctx, 0, 1); + return ctx.seek(ctx, 0, 1); } int SDL_RWread(SDL_RWops *ctx, void* ptr, int size, int n) { - _read_func_t read; -// int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum); - read = ctx.read; - return (*read)(ctx, ptr, size, n); + return ctx.read(ctx, ptr, size, n); } int SDL_RWwrite(SDL_RWops *ctx, void* ptr, int size, int n) { - _write_func_t write; -// int (*write)(SDL_RWops *context, void *ptr, int size, int num); - write = ctx.write; - return (*write)(ctx, ptr, size, n); + return ctx.write(ctx, ptr, size, n); } int SDL_RWclose(SDL_RWops *ctx) { - _close_func_t close; -// int (*close)(SDL_RWops *context); - close = ctx.close; - return (*close)(ctx); + return ctx.close(ctx); } --- a/import/SDL_thread.d +++ b/import/SDL_thread.d @@ -34,7 +34,7 @@ struct SDL_Thread { } /* Create a thread */ -SDL_Thread * SDL_CreateThread(int (*fn)(void *), void *data); +SDL_Thread * SDL_CreateThread(int function(void *) fn, void *data); /* Get the 32-bit thread identifier for the current thread */ Uint32 SDL_ThreadID(); --- a/import/SDL_timer.d +++ b/import/SDL_timer.d @@ -39,7 +39,7 @@ void SDL_Delay(Uint32 ms); /* Function prototype for the timer callback function */ -alias Uint32 (*SDL_TimerCallback)(Uint32 interval); +alias Uint32 function(Uint32 interval) SDL_TimerCallback; /* Set a callback to run after the specified number of milliseconds has * elapsed. The callback function is passed the current timer interval @@ -79,7 +79,7 @@ * passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is cancelled. */ -alias Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param); +alias Uint32 function(Uint32 interval, void *param) SDL_NewTimerCallback; /* Definition of the timer ID type */ alias void *SDL_TimerID; --- a/import/SDL_types.d +++ b/import/SDL_types.d @@ -33,7 +33,7 @@ alias ushort Uint16; alias short Sint16; alias uint Uint32; -alias int Sint32; +alias int Sint32; alias ulong Uint64; alias long Sint64; --- a/import/SDL_version_.d +++ b/import/SDL_version_.d @@ -63,7 +63,7 @@ SDL_PATCHLEVEL; /* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ -bit SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) +bool SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) { return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); } --- a/import/SDL_video.d +++ b/import/SDL_video.d @@ -74,9 +74,9 @@ Uint8 alpha; } -/* typedef for private surface blitting functions */ -typedef int (*SDL_blit)(SDL_Surface *src, SDL_Rect *srcrect, - SDL_Surface *dst, SDL_Rect *dstrect); +/* alias for private surface blitting functions */ +alias int function(SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect) SDL_blit; /* This structure should be treated as read-only, except for 'pixels', which, if not NULL, contains the raw pixel data for the surface. @@ -132,7 +132,7 @@ const uint SDL_PREALLOC = 0x01000000; /* Surface uses preallocated memory */ /* Evaluates to true if the surface needs to be locked before access */ -bit SDL_MUSTLOCK(SDL_Surface *surface) +bool SDL_MUSTLOCK(SDL_Surface *surface) { return surface.offset || ((surface.flags & (SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_RLEACCEL)) != 0); @@ -186,7 +186,7 @@ /* Special flags */ union { - bit hw_overlay; + bool hw_overlay; Uint32 _dummy; } // Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ @@ -540,7 +540,7 @@ SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); /* Convenience macro -- load a surface from a file */ -SDL_Surface * SDL_LoadBMP(char* file) +SDL_Surface * SDL_LoadBMP(const(char)* file) { return SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1); } @@ -554,7 +554,7 @@ (SDL_Surface *surface, SDL_RWops *dst, int freedst); /* Convenience macro -- save a surface to a file */ -int SDL_SaveBMP(SDL_Surface *surface, char* file) +int SDL_SaveBMP(SDL_Surface *surface, const(char)* file) { return SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1); } @@ -837,7 +837,7 @@ /* * Sets/Gets the title and icon text of the display window */ -void SDL_WM_SetCaption(char *title, char *icon); +void SDL_WM_SetCaption(const(char) *title, char *icon); void SDL_WM_GetCaption(char **title, char **icon); /* --- a/import/bulletml.d +++ b/import/bulletml.d @@ -1,7 +1,7 @@ extern (C) { alias int BulletMLParserTinyXML; -int* BulletMLParserTinyXML_new(char*); -void BulletMLParserTinyXML_parse(int* ); +int* BulletMLParserTinyXML_new(const(char)*); +void BulletMLParserTinyXML_parse(int*); void BulletMLParserTinyXML_delete(int*); alias int BulletMLParser; alias int BulletMLState; @@ -10,22 +10,22 @@ int* BulletMLRunner_new_parser(BulletMLParser*); int* BulletMLRunner_new_state(BulletMLState*); void BulletMLRunner_delete(int*); -void BulletMLRunner_run(int* ); -bool BulletMLRunner_isEnd(int* ); -void BulletMLRunner_set_getBulletDirection(int*, double (*fp) (int* )); -void BulletMLRunner_set_getAimDirection(int*, double (*fp) (int* )); -void BulletMLRunner_set_getBulletSpeed(int*, double (*fp) (int* )); -void BulletMLRunner_set_getDefaultSpeed(int*, double (*fp) (int* )); -void BulletMLRunner_set_getRank(int*, double (*fp) (int* )); -void BulletMLRunner_set_createSimpleBullet(int*, void (*fp) (int* , double, double)); -void BulletMLRunner_set_createBullet(int*, void (*fp) (int* , BulletMLState*, double, double)); -void BulletMLRunner_set_getTurn(int*, int (*fp) (int* )); -void BulletMLRunner_set_doVanish(int*, void (*fp) (int* )); -void BulletMLRunner_set_doChangeDirection(int*, void (*fp) (int* , double)); -void BulletMLRunner_set_doChangeSpeed(int*, void (*fp) (int* , double)); -void BulletMLRunner_set_doAccelX(int*, void (*fp) (int* , double)); -void BulletMLRunner_set_doAccelY(int*, void (*fp) (int* , double)); -void BulletMLRunner_set_getBulletSpeedX(int*, double (*fp) (int* )); -void BulletMLRunner_set_getBulletSpeedY(int*, double (*fp) (int* )); -void BulletMLRunner_set_getRand(int*, double (*fp) (int* )); +void BulletMLRunner_run(int*); +bool BulletMLRunner_isEnd(int*); +void BulletMLRunner_set_getBulletDirection(int*, double function(int*) fp); +void BulletMLRunner_set_getAimDirection(int*, double function(int*) fp); +void BulletMLRunner_set_getBulletSpeed(int*, double function(int*) fp); +void BulletMLRunner_set_getDefaultSpeed(int*, double function(int*) fp); +void BulletMLRunner_set_getRank(int*, double function(int*) fp); +void BulletMLRunner_set_createSimpleBullet(int*, void function(int*, double, double) fp); +void BulletMLRunner_set_createBullet(int*, void function(int*, BulletMLState*, double, double) fp); +void BulletMLRunner_set_getTurn(int*, int function(int*) fp); +void BulletMLRunner_set_doVanish(int*, void function(int*) fp); +void BulletMLRunner_set_doChangeDirection(int*, void function(int*, double) fp); +void BulletMLRunner_set_doChangeSpeed(int*, void function(int*, double) fp); +void BulletMLRunner_set_doAccelX(int*, void function(int*, double) fp); +void BulletMLRunner_set_doAccelY(int*, void function(int*, double) fp); +void BulletMLRunner_set_getBulletSpeedX(int*, double function(int*) fp); +void BulletMLRunner_set_getBulletSpeedY(int*, double function(int*) fp); +void BulletMLRunner_set_getRand(int*, double function(int*) fp); } --- a/import/opengl.d +++ b/import/opengl.d @@ -1,10 +1,4 @@ -version (Win32) { - private import std.c.windows.windows; - extern(Windows): -} -version (linux) { - extern(C): -} +extern(System): alias uint GLenum; alias ubyte GLboolean; @@ -165,6 +159,7 @@ const uint GL_3_BYTES = 0x1408; const uint GL_4_BYTES = 0x1409; const uint GL_DOUBLE = 0x140A; +const uint GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; /* DepthFunction */ /* GL_NEVER */ @@ -1116,7 +1111,7 @@ /*************************************************************/ void /*APIENTRY*/glAccum (GLenum op, GLfloat value); -void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref); +void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref_); GLboolean /*APIENTRY*/glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences); void /*APIENTRY*/glArrayElement (GLint i); void /*APIENTRY*/glBegin (GLenum mode); @@ -1369,7 +1364,7 @@ void /*APIENTRY*/glScissor (GLint x, GLint y, GLsizei width, GLsizei height); void /*APIENTRY*/glSelectBuffer (GLsizei size, GLuint *buffer); void /*APIENTRY*/glShadeModel (GLenum mode); -void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref, GLuint mask); +void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref_, GLuint mask); void /*APIENTRY*/glStencilMask (GLuint mask); void /*APIENTRY*/glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); void /*APIENTRY*/glTexCoord1d (GLdouble s); @@ -1454,35 +1449,30 @@ /* EXT_vertex_array */ -typedef void (* PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (* PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (* PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, GLboolean *pointer); -typedef void (* PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (* PFNGLARRAYELEMENTARRAYEXTPROC)(GLenum mode, GLsizei count, GLvoid* pi); +alias void function(GLint i) PFNGLARRAYELEMENTEXTPROC; +alias void function(GLenum mode, GLint first, GLsizei count) PFNGLDRAWARRAYSEXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLVERTEXPOINTEREXTPROC; +alias void function(GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLNORMALPOINTEREXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLCOLORPOINTEREXTPROC; +alias void function(GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLINDEXPOINTEREXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLTEXCOORDPOINTEREXTPROC; +alias void function(GLsizei stride, GLsizei count, GLboolean *pointer) PFNGLEDGEFLAGPOINTEREXTPROC; +alias void function(GLenum pname, GLvoid* *params) PFNGLGETPOINTERVEXTPROC; +alias void function(GLenum mode, GLsizei count, GLvoid* pi) PFNGLARRAYELEMENTARRAYEXTPROC; /* WIN_draw_range_elements */ -typedef void (* PFNGLDRAWRANGEELEMENTSWINPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices); +alias void function(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices) PFNGLDRAWRANGEELEMENTSWINPROC; /* WIN_swap_hint */ -typedef void (* PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +alias void function(GLint x, GLint y, GLsizei width, GLsizei height) PFNGLADDSWAPHINTRECTWINPROC; /* EXT_paletted_texture */ -typedef void (* PFNGLCOLORTABLEEXTPROC) - (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, - GLenum type, GLvoid *data); -typedef void (* PFNGLCOLORSUBTABLEEXTPROC) - (GLenum target, GLsizei start, GLsizei count, GLenum format, - GLenum type, GLvoid *data); -typedef void (* PFNGLGETCOLORTABLEEXTPROC) - (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (* PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) - (GLenum target, GLenum pname, GLint *params); -typedef void (* PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) - (GLenum target, GLenum pname, GLfloat *params); +alias void function(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, + GLenum type, GLvoid *data) PFNGLCOLORTABLEEXTPROC; +alias void function(GLenum target, GLsizei start, GLsizei count, GLenum format, + GLenum type, GLvoid *data) PFNGLCOLORSUBTABLEEXTPROC; +alias void function(GLenum target, GLenum format, GLenum type, GLvoid *data) PFNGLGETCOLORTABLEEXTPROC; +alias void function(GLenum target, GLenum pname, GLint *params) PFNGLGETCOLORTABLEPARAMETERIVEXTPROC; +alias void function(GLenum target, GLenum pname, GLfloat *params) PFNGLGETCOLORTABLEPARAMETERFVEXTPROC; //import openglu; --- a/import/openglu.d +++ b/import/openglu.d @@ -1,11 +1,6 @@ import opengl; -version (Win32) { - extern(Windows): -} -version (linux) { - extern(C): -} +extern(System): GLubyte* gluErrorString ( GLenum errCode); @@ -33,7 +28,7 @@ GLdouble y, GLdouble width, GLdouble height, - GLint[4] viewport); + ref GLint[4] viewport); void gluLookAt ( GLdouble eyex, @@ -50,9 +45,9 @@ GLdouble objx, GLdouble objy, GLdouble objz, - GLdouble[16] modelMatrix, - GLdouble[16] projMatrix, - GLint[4] viewport, + ref GLdouble[16] modelMatrix, + ref GLdouble[16] projMatrix, + ref GLint[4] viewport, GLdouble *winx, GLdouble *winy, GLdouble *winz); @@ -61,8 +56,8 @@ GLdouble winx, GLdouble winy, GLdouble winz, - GLdouble[16] modelMatrix, - GLdouble[16] projMatrix, + ref GLdouble[16] modelMatrix, + ref GLdouble[16] projMatrix, GLint[4] viewport, GLdouble *objx, GLdouble *objy, @@ -162,7 +157,7 @@ void gluQuadricCallback ( GLUquadric *qobj, GLenum which, - void (* fn)()); + void function() fn); GLUtesselator* gluNewTess( ); @@ -179,7 +174,7 @@ void gluTessVertex( GLUtesselator *tess, - GLdouble[3] coords, + ref GLdouble[3] coords, void *data ); void gluTessEndContour( @@ -202,7 +197,7 @@ void gluTessCallback( GLUtesselator *tess, GLenum which, - void ( *fn)()); + void function() fn); void gluGetTessProperty( GLUtesselator *tess, @@ -265,9 +260,9 @@ void gluLoadSamplingMatrices ( GLUnurbs *nobj, - GLfloat[16] modelMatrix, - GLfloat[16] projMatrix, - GLint[4] viewport ); + ref GLfloat[16] modelMatrix, + ref GLfloat[16] projMatrix, + ref GLint[4] viewport ); void gluNurbsProperty ( @@ -285,37 +280,37 @@ gluNurbsCallback ( GLUnurbs *nobj, GLenum which, - void (* fn)() ); + void function() fn ); /**** function prototypes ****/ /* gluQuadricCallback */ -typedef void (* GLUquadricErrorProc) (GLenum); +alias void function(GLenum) GLUquadricErrorProc; /* gluTessCallback */ -typedef void (* GLUtessBeginProc) (GLenum); -typedef void (* GLUtessEdgeFlagProc) (GLboolean); -typedef void (* GLUtessVertexProc) (void *); -typedef void (* GLUtessEndProc) (); -typedef void (* GLUtessErrorProc) (GLenum); -typedef void (* GLUtessCombineProc) (GLdouble[3], - void*[4], - GLfloat[4], - void** ); -typedef void (* GLUtessBeginDataProc) (GLenum, void *); -typedef void (* GLUtessEdgeFlagDataProc) (GLboolean, void *); -typedef void (* GLUtessVertexDataProc) (void *, void *); -typedef void (* GLUtessEndDataProc) (void *); -typedef void (* GLUtessErrorDataProc) (GLenum, void *); -typedef void (* GLUtessCombineDataProc) (GLdouble[3], - void*[4], - GLfloat[4], - void**, - void* ); +alias void function(GLenum) GLUtessBeginProc; +alias void function(GLboolean) GLUtessEdgeFlagProc; +alias void function(void *) GLUtessVertexProc; +alias void function() GLUtessEndProc; +alias void function(GLenum) GLUtessErrorProc; +alias void function(ref GLdouble[3], + ref void*[4], + ref GLfloat[4], + void**) GLUtessCombineProc; +alias void function(GLenum, void *) GLUtessBeginDataProc; +alias void function(GLboolean, void *) GLUtessEdgeFlagDataProc; +alias void function(void *, void *) GLUtessVertexDataProc; +alias void function(void *) GLUtessEndDataProc; +alias void function(GLenum, void *) GLUtessErrorDataProc; +alias void function(ref GLdouble[3], + ref void*[4], + ref GLfloat[4], + void**, + void*) GLUtessCombineDataProc; /* gluNurbsCallback */ -typedef void (* GLUnurbsErrorProc) (GLenum); +alias void function(GLenum) GLUnurbsErrorProc; /**** Generic constants ****/ debian/patches/fixes.patch0000644000000000000000000001443112164046614012763 0ustar # Copyright (C) 2007 Marcel Unbehaun # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. --- a/src/abagames/tf/boot.d +++ b/src/abagames/tf/boot.d @@ -5,7 +5,7 @@ */ module abagames.tf.boot; -private import std.string; +private import std.c.string; private import std.c.stdlib; private import abagames.util.logger; private import abagames.util.sdl.mainloop; --- a/src/abagames/util/logger.d +++ b/src/abagames/util/logger.d @@ -5,7 +5,7 @@ */ module abagames.util.logger; -private import std.stream; +private import std.cstream; private import std.string; /** @@ -53,27 +53,27 @@ public class Logger { public static void info(char[] msg) { - stderr.writeLine("Info: " ~ msg); + derr.writeLine("Info: " ~ msg); } public static void info(int n) { - stderr.writeLine("Info: " ~ std.string.toString(n)); + derr.writeLine("Info: " ~ std.string.toString(n)); } public static void info(float n) { - stderr.writeLine("Info: -" ~ std.string.toString(n)); + derr.writeLine("Info: -" ~ std.string.toString(n)); } public static void error(char[] msg) { - stderr.writeLine("Error: " ~ msg); + derr.writeLine("Error: " ~ msg); } public static void error(Exception e) { - stderr.writeLine("Error: " ~ e.toString()); + derr.writeLine("Error: " ~ e.toString()); } public static void error(Error e) { - stderr.writeLine("Error: " ~ e.toString()); + derr.writeLine("Error: " ~ e.toString()); if (e.next) error(e.next); } --- a/src/abagames/tf/tumikiset.d +++ b/src/abagames/tf/tumikiset.d @@ -44,7 +44,9 @@ static char[][] BULLET_COLOR_STR = ["r", "a", "p"]; - public static this() { + private static void init() { + if (shapeStr.length != 0) return; // already initialized + int i = 0; foreach (char[] s; SHAPE_STR) { shapeStr[s] = i; @@ -76,6 +78,7 @@ // (end when BulletML == e, shape == e)(set a empty barrage when shape == s), // ], private this(char[][] data) { + init(); sizeXm = sizeYm = float.max; sizeXp = sizeYp = float.min; StringIterator si = new StringIterator(data); @@ -87,9 +90,9 @@ if (!si.hasNext) break; char[] v = si.next; - int shape = shapeStr[v]; + int shape = ((v in shapeStr) != null) ? shapeStr[v] : 0; //the data files contain undefined codes v = si.next; - int color = colorStr[v]; + int color = ((v in colorStr) != null) ? colorStr[v] : 0; float x = atof(si.next); float y = atof(si.next); float sizex = atof(si.next); @@ -111,9 +114,9 @@ ti.addBarrage(new Barrage); continue; } - int shape = bulletShapeStr[v]; + int shape = ((v in bulletShapeStr) != null) ? bulletShapeStr[v] : 0; v = si.next; - int color = bulletColorStr[v]; + int color = ((v in bulletColorStr) != null) ? bulletColorStr[v] : 0; float size = atof(si.next); float yReverse = atof(si.next); int prevWait = atoi(si.next); @@ -136,19 +139,17 @@ } // Initialize TumikiSet from the file. - private this(char[] fileName) { + public this(char[] fileName) { Logger.info("Load tumiki set: " ~ fileName); char[][] data = CSVTokenizer.readFile(TUMIKI_DIR_NAME ~ "/" ~ fileName); this(data); } public static TumikiSet getInstance(char[] fileName) { - TumikiSet inst = instances[fileName]; - if (!inst) { - inst = new TumikiSet(fileName); - instances[fileName] = inst; + if ((fileName in instances) == null) { + instances[fileName] = new TumikiSet(fileName); } - return inst; + return instances[fileName]; } public int addTopBullets(int barragePtnIdx, BulletActorPool bullets, EnemyTopBullet[] etb, --- a/src/abagames/tf/enemy.d +++ b/src/abagames/tf/enemy.d @@ -142,11 +142,11 @@ float speed; Vector[] pt; if (!mv.withdraw) { - pt = mv.pattern.point[barragePtnIdx]; - if (!pt) { + if ((barragePtnIdx in mv.pattern.point) == null) { pt = mv.pattern.point[PointsMovePattern.BASIC_PATTERN_IDX]; speed = mv.pattern.speed[PointsMovePattern.BASIC_PATTERN_IDX]; } else { + pt = mv.pattern.point[barragePtnIdx]; speed = mv.pattern.speed[barragePtnIdx]; } if (!mv.reachFirstPointFirst) @@ -272,7 +272,7 @@ if (attackPtnIdx >= af.attackPeriod.length) attackPtnIdx = 0; if (!mv.moveBullet) { - if (mv.pattern.point[barragePtnIdx]) + if ((barragePtnIdx in mv.pattern.point) != null) movePatternChanged(); } } else if (fireCnt < af.breakPeriod[attackPtnIdx]) { @@ -329,7 +329,7 @@ if (ep.shield <= 0) { if (ep.spec.damageToMainBody > 0) { parts[0].shield -= ep.spec.damageToMainBody; - particles.add(5, pos, 0, PI * 2, 0.1, parts[0].spec.size / 4, Particle.TypeName.SMOKE); + particles.add(5, pos, 0, PI * 2, 0.1, parts[0].spec.sizeof / 4, Particle.TypeName.SMOKE); } manager.addScore(ep.spec.tumikiSet.score, p); if (ep.firstShield <= 1) --- a/src/abagames/tf/letterrender.d +++ b/src/abagames/tf/letterrender.d @@ -32,7 +32,7 @@ return s * LETTER_HEIGHT; } - private static void drawLetter(int n, float x, float y, float s, float d, int c) { + public static void drawLetter(int n, float x, float y, float s, float d, int c) { glPushMatrix(); glTranslatef(x, y, 0); glScalef(s, s, s); --- a/src/abagames/tf/ship.d +++ b/src/abagames/tf/ship.d @@ -70,8 +70,8 @@ bool btnPrsd; bool pullIn; - public static this() { - rand = new Rand; + public this() { + if (rand is null) rand = new Rand; } public void init(Pad pad, Field field, ParticlePool particles, ActorPool fragments, --- a/src/abagames/tf/enemyspec.d +++ b/src/abagames/tf/enemyspec.d @@ -89,13 +89,11 @@ } public static EnemySpec getInstance(char[] fileName) { - EnemySpec inst = instances[fileName]; - if (!inst) { + if ((fileName in instances) == null) { Logger.info("Load enemy spec: " ~ fileName); - inst = new EnemySpec(fileName); - instances[fileName] = inst; + instances[fileName] = new EnemySpec(fileName); } - return inst; + return instances[fileName]; } }