debian/0000755000000000000000000000000012164044313007164 5ustar debian/torus-trooper.menu0000644000000000000000000000024712164044313012721 0ustar ?package(torus-trooper):needs="X11" section="Games/Action"\ title="Torus Trooper" command="/usr/games/torus-trooper" \ icon="/usr/share/pixmaps/torus-trooper.xpm" debian/source/0000755000000000000000000000000012164044313010464 5ustar debian/source/format0000644000000000000000000000001412164044313011672 0ustar 3.0 (quilt) debian/docs0000644000000000000000000000003012164044313010030 0ustar readme_e.txt readme.txt debian/torus-trooper.xpm0000644000000000000000000001005612164044313012560 0ustar /* XPM */ static char *dummy[]={ "32 32 120 2", "Qt c None", ".H c #020202", ".# c #030303", ".q c #080808", ".a c #101010", ".Y c #111111", "#V c #161616", ".p c #191919", ".b c #1f1f1f", "#y c #212121", ".r c #242424", ".8 c #272727", ".o c #292929", "#F c #2a2a2a", ".c c #2e2e2e", ".6 c #363636", ".2 c #373737", "#r c #393939", "#c c #3b3b3b", ".n c #3c3c3c", ".Q c #3d3d3d", ".R c #3e3e3e", ".S c #3f3f3f", ".T c #404040", "#i c #414141", "#j c #424242", ".P c #434343", ".5 c #444444", ".d c #454545", ".s c #464646", "#e c #484848", ".4 c #494949", ".3 c #4a4a4a", ".U c #4b4b4b", "#d c #4c4c4c", ".7 c #505050", "#C c #515151", ".m c #585858", ".e c #595959", "#u c #5d5d5d", "#l c #5e5e5e", ".Z c #606060", "#m c #636363", ".O c #646464", "#P c #666666", "#Q c #686868", ".l c #6a6a6a", "#R c #6b6b6b", ".f c #6c6c6c", ".t c #6e6e6e", "#o c #6f6f6f", ".G c #707070", "#b c #727272", ".k c #757575", ".g c #767676", ".j c #777777", ".V c #787878", "#G c #797979", "#W c #7a7a7a", "#n c #7b7b7b", ".i c #7c7c7c", ".h c #7d7d7d", "#1 c #7f7f7f", "#s c #808080", "#O c #828282", "#E c #838383", "#S c #848484", "#x c #878787", "#B c #8a8a8a", ".u c #8b8b8b", ".9 c #8c8c8c", "#0 c #8d8d8d", "#D c #8f8f8f", ".N c #909090", "#f c #939393", ".F c #979797", "#a c #989898", "#U c #9b9b9b", ".I c #9d9d9d", "#t c #9e9e9e", "#p c #9f9f9f", "#N c #a0a0a0", "#h c #a2a2a2", "#X c #a4a4a4", "#A c #a5a5a5", "#k c #a6a6a6", ".v c #a7a7a7", ".1 c #a8a8a8", ".W c #a9a9a9", "#H c #ababab", ".J c #acacac", ".0 c #afafaf", "#K c #b1b1b1", ".B c #b5b5b5", ".M c #b6b6b6", "#Z c #b7b7b7", "## c #b8b8b8", "#Y c #bababa", ".w c #bbbbbb", ".C c #bdbdbd", ".A c #bebebe", "#M c #bfbfbf", ".K c #c0c0c0", "#v c #c1c1c1", "#J c #c5c5c5", ".X c #c7c7c7", ".L c #cacaca", "#I c #cbcbcb", ".z c #cccccc", ".D c #cecece", "#. c #cfcfcf", ".E c #d0d0d0", ".x c #d4d4d4", "#T c #d5d5d5", ".y c #d7d7d7", "#L c #dadada", "#z c #dcdcdc", "#g c #dddddd", "#w c #e1e1e1", "#q c #ffffff", "QtQtQtQtQtQtQtQtQtQtQtQt.#.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.qQtQt", "QtQtQtQtQtQtQtQt.#.r.s.t.u.v.w.x.y.y.z.A.B.B.C.A.D.y.y.E.B.F.G.n", "QtQtQtQtQt.H.c.f.I.J.K.L.M.N.O.P.Q.Q.R.S.T.T.S.S.R.Q.n.U.V.W.X.w", "QtQtQt.Y.Z.0.A.0.1.g.U.2.n.T.s.3.U.U.U.U.U.U.U.U.U.U.U.4.5.Q.6.7", "Qt.8.9#.###a#b.P#c.P.4.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#d#e", "#f#g#h.G.m#i#j.3.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", "#k#l#d.5#e.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".d.4.3.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#m#n#n#n#n#n#o#n#n#n#n#n#o.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#p#q#q#q#q#q#q#q#q#q#q#q#..U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#p.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#p.U.U.U.U.U", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#p.U.U.U.U#d", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#p.U.U.U#d.S", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#p.U.U.3#r#s", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#n#q#p.U.U.U#n#q#t#e.s#u#v.D", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.4.P.4#l#k#w#x#y", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.s.Q.4#o#a#z#A.2QtQt", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U#e.S.n#l#B.1.E.v#jQtQtQtQt", ".U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.4.5.Q.2#C#D.B.K.M#E#FQtQtQtQtQtQt", ".n.T.P.s#e.4.4#e#e#e.s.P#i.R.R#C#G#H#I#J#K.9.U.aQtQtQtQtQtQtQtQt", "#L#M#N#O#P#l.Z#Q#Q#R#S.I.M#T#L.D.B#U.G.R#VQtQtQtQtQtQtQtQtQtQtQt", ".m#W.u#X#Y.K.K#Y#Y#Z#h#0#1#Q#j#y#V.qQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; debian/torus-trooper.install0000644000000000000000000000017212164044313013420 0ustar torus-trooper usr/games/ debian/torus-trooper.xpm usr/share/pixmaps/ debian/torus-trooper.desktop usr/share/applications/ debian/torus-trooper-data.install0000644000000000000000000000016312164044313014327 0ustar images usr/share/games/torus-trooper/ sounds usr/share/games/torus-trooper/ barrage usr/share/games/torus-trooper/ debian/copyright0000644000000000000000000000556012164044313011125 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/tt_e.html Upstream Author: Kenta Cho Copyright: Copyright 2004 Kenta Cho import/SDL* : Copyright © 1997, 1998, 1999, 2000, 2001 Sam Lantinga debian/patches/torus-trooper-pure.patch: Copyright © 2006, HIZ Obtained from: http://www.mb.ccnw.ne.jp/hiz/game/tt/index_en.html Released under the same license as the original game. 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 © 2007, Miriam Ruiz and is licensed under the GPL, see `/usr/share/common-licenses/GPL-3'. debian/torus-trooper.60000644000000000000000000000652612164044313012130 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 "Torus Trooper" "6" "" "" "" .SH "NAME" torus\-trooper \- speeding ship sailing through barrage .SH "DESCRIPTION" Speed! More speed! Torus Trooper is a fast\-paced abstract scrolling shooter game. It features 3D graphics and a style similar to that of games such as Tempest. .SH "OPTIONS" These options are available: .TP \fB\-brightness n\fR Set the brightness of the screen.(n = 0 \- 100, default = 100) .TP \fB\-luminosity n\fR Set the luminous intensity.(n = 0 \- 100, default = 0) .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 mode. .TP \fB\-reverse\fR Reverse a shot key and a charge shot key. .SH "USAGE" How to operate: .TP \fBMovement\fR Arrow / Num / [WASD] / Joystick Hold an up key to increase speed. .TP \fBShot\fR [Z][L\-Ctrl][.] / Trigger 1, 4, 5, 8 Hold a shot key to open automatic fire. .TP \fBCharge shot\fR [X][L\-Alt][L\-Shift][/] / Trigger 2, 3, 6, 7 Hold a charge shot key to charge energy. \- A charge shot is released when you release a key. \- A charge shot penetrates enemies and wipes out bullets. \- A score multiplier is increased according to a number of destroying enemies and bullets. \- A charge shot acts as a regenerative break. .TP \fBPause\fR [P] .P How to play: At the title screen, select a grade(Normal, Hard, Extreme) and a starting level. Press a shot button to start a game. Press an escape key to quit a game. Drive a ship forward and destroy enemies. When time runs out, game is over. Remaining time is displayed at the left up corner. Remaining time varies according to events: .TP \fBShip was destroyed(\-15 sec.)\fR You ship is destroyed when it is hit by a bullet. .TP \fBBonus time(+15 sec.)\fR You can earn bonus time when you reach a certain score. The point you have to get is displayed at the right up corner. .TP \fBDestroy the boss(+30 or 45 sec.)\fR The boss enemies appear when you destroy or overtake a certain number(displayed at the left down corner) of enemies, and you can earn bonus time by destroying them. .TP \fBReplay mode\fR At the title screen, press a charge shot key to see a replay of your last game. Press a left/right key to change a view and an up/down key to change displayed/undisplayed of a status display. .SH "SEE ALSO" You can find more about the game on its homepage: http://www.asahi\-net.or.jp/~cs8k\-cyu/windows/tt_e.html .SH "AUTHOR" This game has been written by Kenta Cho debian/torus-trooper.desktop0000644000000000000000000000026412164044313013425 0ustar [Desktop Entry] Type=Application Name=Torus Trooper GenericName= Comment=Kenta Cho's Torus Trooper Icon=torus-trooper Exec=torus-trooper Terminal=false Categories=Game;ArcadeGame; debian/changelog0000644000000000000000000000670612164044313011047 0ustar torus-trooper (0.22.dfsg1-9) unstable; urgency=low * Ported to D language version 2 (closes: #707272) - Dropped the torus-trooper-pure variant * Added build-depends on libphobos-dev * Keep level display visible in title screen (closes: #602808) - Thanks to Thomas Preud'homme * 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:09 +0200 torus-trooper (0.22.dfsg1-8) unstable; urgency=low * Team upload. * Tweak the build order to avoid circular dependencies (closes: #664799) * Conforms to standards 3.9.3 -- Vincent Fourmond Thu, 29 Mar 2012 21:49:01 +0200 torus-trooper (0.22.dfsg1-7) unstable; urgency=low * Team upload. * Explicitly build with D version 1 (closes: #653092) * 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:40:02 +0100 torus-trooper (0.22.dfsg1-6) unstable; urgency=low * Patched for changes in the D language. (Closes: #574326) -- Peter De Wachter Wed, 17 Mar 2010 23:49:31 +0100 torus-trooper (0.22.dfsg1-5) unstable; urgency=low * Hardcoded the order in which object files are passed to the linker, avoiding the "circular initialization dependency" error. (Closes: #521387) -- Peter De Wachter Sun, 29 Mar 2009 18:44:16 +0200 torus-trooper (0.22.dfsg1-4) unstable; urgency=low [ Sylvain Beucler] * Fix D syntax error in optional torus-trooper-pure.patch [ Peter De Wachter ] * Build a torus-trooper-pure package for the Torus Trooper Pure variant of this game. - Removed README.Debian which explained how to patch and rebuild manually. - fixes.patch: added a Makefile for torus-trooper-pure. - dotfile.patch: use a different dotfile for torus-trooper-pure. - Wrote a manpage. * Changes to keep lintian happy: - Added a description to all patches. - Use fancy © symbols in debian/copyright. * Bumped to Standards Version 3.8.1. - Implemented patch target for debian/rules. - Fixed 'noopt' build option. -- Peter De Wachter Tue, 17 Mar 2009 08:00:55 +0100 torus-trooper (0.22.dfsg1-3) unstable; urgency=low [ Miriam Ruiz ] * Removed Homepage from long description. * Replaced XS-DM-Upload-Allowed by DM-Upload-Allowed in debian/control. [ Barry deFreese ] * Remove deprecated encoding tag from desktop file * Fix icon name in desktop file (Closes: #459275) -- Peter De Wachter Thu, 12 Jun 2008 23:13:29 +0200 torus-trooper (0.22.dfsg1-2) unstable; urgency=low [ Barry deFreese ] * Add watch file * Add Homepage field in control * Remove XS- from VCS fields in control [ Peter De Wachter ] * Save high score when quitting via escape (Closes: #444372) * Make level selection more intuitive (Closes: #444948) * Fixed link command, patch from Arthur Loiret. (Closes: #458279, #458642) * Fixed segfault when SDL init fails. [ 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 torus-trooper (0.22.dfsg1-1) unstable; urgency=low * Initial release (Closes: #439684) -- Miriam Ruiz Sat, 25 Aug 2007 19:58:40 +0000 debian/compat0000644000000000000000000000000212164044313010362 0ustar 9 debian/watch0000644000000000000000000000022712164044313010216 0ustar version=3 opts="uversionmangle=s/_/\./,dversionmangle=s/[+.]dfsg(.?\d+)?$//" \ http://www.asahi-net.or.jp/~cs8k-cyu/windows/tt_e.html tt([\d_]+)\.zip debian/rules0000755000000000000000000000071512164044313010247 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/tt0_22.zip unzip tt0_22.zip rm tt/*.dll rm tt/*.exe rm tt/lib/*.lib rm tt/resource/*.RES tar cvfz ../tt_0.22.dfsg1.orig.tar.gz tt rm -rf tt0_22.zip tt debian/control0000644000000000000000000000272712164044313010577 0ustar Source: torus-trooper Section: games Priority: extra Maintainer: Debian Games Team Uploaders: Miriam Ruiz , Peter De Wachter 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/tt_e.html Vcs-Svn: svn://anonscm.debian.org/pkg-games/packages/trunk/torus-trooper/ Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-games/packages/trunk/torus-trooper/ Package: torus-trooper Architecture: any Depends: torus-trooper-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} Description: speeding ship sailing through barrage Torus Trooper is a fast-paced abstract scrolling shooter game. It features 3D graphics and a style similar to that of games such as Tempest. . Torus Trooper is another gem among many by Kenta Cho. Package: torus-trooper-data Architecture: all Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: torus-trooper Description: speeding ship sailing through barrage - game data Torus Trooper is a fast-paced abstract scrolling shooter game. It features 3D graphics and a style similar to that of games such as Tempest. . This package includes the architecture-independent data for Kenta Cho's game Torus Trooper. debian/patches/0000755000000000000000000000000012164044313010613 5ustar debian/patches/series0000644000000000000000000000034712164044313012034 0ustar imports.patch fixes.patch directories.patch windowed.patch dotfile.patch window-resizing.patch save-score-444372.patch level-select-444948.patch avoid-segfault-when-sdl-fails.patch dlang_v2.patch lowest-level-position-602808.patch debian/patches/avoid-segfault-when-sdl-fails.patch0000644000000000000000000000122612164044313017362 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: torus-trooper-0.22.dfsg1/src/abagames/tt/gamemanager.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/gamemanager.d 2007-12-31 21:02:05.000000000 +0100 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/gamemanager.d 2007-12-31 21:02:39.000000000 +0100 @@ -149,7 +149,7 @@ } public void saveErrorReplay() { - if (state == inGameState) + if (state !is null && state == inGameState) inGameState.saveReplay("error.rpl"); } debian/patches/lowest-level-position-602808.patch0000644000000000000000000000151112164044313016663 0ustar Description: Keep level display visible in title screen In title screen, the position of the text showing the level depends on the value of the level itself. The higher is the level, the lower is the text. When the level is too big, the text starts overlapping with the game name and then disappear at the bottom of the screen. This patch gives a maximum position to the level display position. Author: Thomas Preud'homme Origin: other Bug-Debian: http://bugs.debian.org/602808 Forwarded: no Last-Update: 2012-06-17 --- a/src/abagames/tt/title.d +++ b/src/abagames/tt/title.d @@ -278,6 +278,8 @@ private void calcCursorPos(ref float x, ref float y, int gd, int lv) { x = 460 + gd * 70; y = 90; + if (lv > 180) + lv = 180; if (lv > 1) { y += 30 + lv; x -= lv * 0.33f; debian/patches/dotfile.patch0000644000000000000000000000432512164044313013266 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. --- a/src/abagames/tt/prefmanager.d +++ b/src/abagames/tt/prefmanager.d @@ -6,6 +6,9 @@ module abagames.tt.prefmanager; private import std.stream; +private import std.string; +private import std.file; +private import std.c.stdlib; private import abagames.util.prefmanager; private import abagames.tt.ship; @@ -22,11 +25,23 @@ _prefData = new PrefData; } + public static char[] pref_dir() { + char * home = getenv("HOME"); + if (home is null) + throw new Error("HOME environment variable is not defined"); + char[] dir = std.string.toString(home) ~ "/.torus-trooper"; + try { + mkdir(dir); + } catch (FileException e) { + } + return dir; + } + public void load() { auto File fd = new File; try { int ver; - fd.open(PREF_FILE); + fd.open(pref_dir() ~ "/" ~ PREF_FILE); fd.read(ver); if (ver != VERSION_NUM) throw new Error("Wrong version num"); @@ -41,7 +56,7 @@ public void save() { auto File fd = new File; - fd.create(PREF_FILE); + fd.create(pref_dir() ~ "/" ~ PREF_FILE); fd.write(VERSION_NUM); _prefData.save(fd); fd.close(); --- a/src/abagames/tt/replay.d +++ b/src/abagames/tt/replay.d @@ -7,13 +7,13 @@ private import std.stream; private import abagames.util.sdl.recordablepad; +private import abagames.tt.prefmanager; /** * Manage a replay data. */ public class ReplayData { public: - static const char[] dir = "replay"; static const int VERSION_NUM = 20; PadRecord padRecord; float level; @@ -23,7 +23,7 @@ public void save(char[] fileName) { auto File fd = new File; - fd.create(dir ~ "/" ~ fileName); + fd.create(PrefManager.pref_dir() ~ "/" ~ fileName); fd.write(VERSION_NUM); fd.write(level); fd.write(grade); @@ -34,7 +34,7 @@ public void load(char[] fileName) { auto File fd = new File; - fd.open(dir ~ "/" ~ fileName); + fd.open(PrefManager.pref_dir() ~ "/" ~ fileName); int ver; fd.read(ver); if (ver != VERSION_NUM) debian/patches/windowed.patch0000644000000000000000000000307712164044313013463 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: torus-trooper-0.22.dfsg1/src/abagames/tt/boot.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/boot.d 2007-08-26 18:14:13.000000000 +0000 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/boot.d 2007-08-26 18:15:11.000000000 +0000 @@ -129,6 +129,9 @@ case "-window": Screen.windowMode = true; break; + case "-fullscreen": + Screen.windowMode = false; + break; case "-res": if (i >= args.length - 2) { usage(progName); @@ -169,5 +172,5 @@ private void usage(char[] progName) { Logger.error - ("Usage: " ~ progName ~ " [-brightness [0-100]] [-luminosity [0-100]] [-window] [-res x y] [-nosound]"); + ("Usage: " ~ progName ~ " [-brightness [0-100]] [-luminosity [0-100]] [-window] [-fullscreen] [-res x y] [-nosound]"); } Index: torus-trooper-0.22.dfsg1/src/abagames/util/sdl/screen3d.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-08-26 18:15:51.000000000 +0000 +++ torus-trooper-0.22.dfsg1/src/abagames/util/sdl/screen3d.d 2007-08-26 18:16:05.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; private: debian/patches/level-select-444948.patch0000644000000000000000000000222412164044313014776 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. # Make the level selection UI a bit more user-friendly. Fixes #444948. Index: torus-trooper-0.22.dfsg1/src/abagames/tt/title.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/title.d 2007-10-03 00:11:28.000000000 +0200 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/title.d 2007-10-03 00:12:06.000000000 +0200 @@ -69,6 +69,7 @@ if (dir & (Pad.Dir.RIGHT | Pad.Dir.LEFT)) { if (!dirPressed) { dirPressed = true; + int oldGrade = grade; if (dir & Pad.Dir.RIGHT) { grade++; if (grade >= Ship.GRADE_NUM) @@ -79,7 +80,8 @@ if (grade < 0) grade = Ship.GRADE_NUM - 1; } - if (level > prefManager.prefData.getMaxLevel(grade)) + if (level == prefManager.prefData.getMaxLevel(oldGrade) + || level > prefManager.prefData.getMaxLevel(grade)) level = prefManager.prefData.getMaxLevel(grade); } } debian/patches/directories.patch0000644000000000000000000000411712164044313014153 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: torus-trooper_0.22.dfsg1/src/abagames/tt/barrage.d =================================================================== --- torus-trooper_0.22.dfsg1.orig/src/abagames/tt/barrage.d 2007-08-29 18:58:00.000000000 +0200 +++ torus-trooper_0.22.dfsg1/src/abagames/tt/barrage.d 2007-08-29 19:06:28.000000000 +0200 @@ -93,7 +93,7 @@ public class BarrageManager { private: static BulletMLParserTinyXML *parser[char[]][char[]]; - static const char[] BARRAGE_DIR_NAME = "barrage"; + static const char[] BARRAGE_DIR_NAME = "/usr/share/games/torus-trooper/barrage"; public static void load() { char[][] dirs = listdir(BARRAGE_DIR_NAME); Index: torus-trooper_0.22.dfsg1/src/abagames/util/sdl/sound.d =================================================================== --- torus-trooper_0.22.dfsg1.orig/src/abagames/util/sdl/sound.d 2004-11-10 23:45:22.000000000 +0100 +++ torus-trooper_0.22.dfsg1/src/abagames/util/sdl/sound.d 2007-08-29 19:06:28.000000000 +0200 @@ -67,7 +67,7 @@ public class Music: Sound { public: static int fadeOutSpeed = 1280; - static char[] dir = "sounds/musics"; + static char[] dir = "/usr/share/games/torus-trooper/sounds/musics"; private: Mix_Music* music; @@ -131,7 +131,7 @@ public class Chunk: Sound { public: - static char[] dir = "sounds/chunks"; + static char[] dir = "/usr/share/games/torus-trooper/sounds/chunks"; private: Mix_Chunk* chunk; int chunkChannel; Index: torus-trooper_0.22.dfsg1/src/abagames/util/sdl/texture.d =================================================================== --- torus-trooper_0.22.dfsg1.orig/src/abagames/util/sdl/texture.d 2004-11-10 23:45:22.000000000 +0100 +++ torus-trooper_0.22.dfsg1/src/abagames/util/sdl/texture.d 2007-08-29 19:06:28.000000000 +0200 @@ -15,7 +15,7 @@ */ public class Texture { public: - static char[] imagesDir = "images/"; + static char[] imagesDir = "/usr/share/games/torus-trooper/images/"; private: GLuint num; debian/patches/window-resizing.patch0000644000000000000000000000251612164044313014777 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: torus-trooper-0.22.dfsg1/src/abagames/util/sdl/screen3d.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-09-02 20:25:30.000000000 +0200 +++ torus-trooper-0.22.dfsg1/src/abagames/util/sdl/screen3d.d 2007-09-02 20:26:08.000000000 +0200 @@ -23,7 +23,9 @@ static bool windowMode = true; static float nearPlane = 0.1; static float farPlane = 1000; + private: + static Uint32 videoFlags; protected abstract void init(); protected abstract void close(); @@ -35,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 { @@ -55,6 +56,11 @@ // 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.patch0000644000000000000000000014614612164044313013344 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/tt/barrage.d +++ b/src/abagames/tt/barrage.d @@ -30,11 +30,8 @@ int prevWait, postWait; bool noXReverse = false; - public static this() { - rand = new Rand; - } - public static void setRandSeed(long seed) { + if (rand is null) rand = new Rand; rand.setSeed(seed); } @@ -60,14 +57,14 @@ parserParam ~= new ParserParam(p, r, re, s); } - public void addBml(char[] bmlDirName, char[] bmlFileName, float r, bool re, float s) { + public void addBml(string bmlDirName, string bmlFileName, float r, bool re, float s) { BulletMLParser *p = BarrageManager.getInstance(bmlDirName, bmlFileName); if (!p) throw new Error("File not found: " ~ bmlDirName ~ "/" ~ bmlFileName); addBml(p, r, re, s); } - public void addBml(char[] bmlDirName, char[] bmlFileName, float r, char[] reStr, float s) { + public void addBml(string bmlDirName, string bmlFileName, float r, string reStr, float s) { bool re = true; if (reStr == "f" || reStr == "false") re = false; @@ -92,25 +89,27 @@ */ public class BarrageManager { private: - static BulletMLParserTinyXML *parser[char[]][char[]]; - static const char[] BARRAGE_DIR_NAME = "/usr/share/games/torus-trooper/barrage"; + static BulletMLParserTinyXML *parser[string][string]; + static const string BARRAGE_DIR_NAME = "/usr/share/games/torus-trooper/barrage"; public static void load() { - char[][] dirs = listdir(BARRAGE_DIR_NAME); - foreach (char[] dirName; dirs) { + auto dirs = dirEntries(BARRAGE_DIR_NAME, SpanMode.shallow); + foreach (string fullDirName; dirs) { + string dirName = baseName(fullDirName); parser[dirName] = null; - char[][] files = listdir(BARRAGE_DIR_NAME ~ "/" ~ dirName); - foreach (char[] fileName; files) { - if (getExt(fileName) != "xml") + auto files = dirEntries(fullDirName, SpanMode.shallow); + foreach (string fullFileName; files) { + string fileName = baseName(fullFileName); + if (extension(fileName) != ".xml") continue; parser[dirName][fileName] = getInstance(dirName, fileName); } } } - public static BulletMLParserTinyXML* getInstance(char[] dirName, char[] fileName) { + public static BulletMLParserTinyXML* getInstance(string dirName, string fileName) { if (!parser[dirName][fileName]) { - char[] barrageName = dirName ~ "/" ~ fileName; + string barrageName = dirName ~ "/" ~ fileName; Logger.info("Load BulletML: " ~ barrageName); parser[dirName][fileName] = BulletMLParserTinyXML_new(std.string.toStringz(BARRAGE_DIR_NAME ~ "/" ~ barrageName)); @@ -119,7 +118,7 @@ return parser[dirName][fileName]; } - public static BulletMLParserTinyXML*[] getInstanceList(char[] dirName) { + public static BulletMLParserTinyXML*[] getInstanceList(string dirName) { BulletMLParserTinyXML *pl[]; foreach (BulletMLParserTinyXML *p; parser[dirName]) { pl ~= p; @@ -128,7 +127,7 @@ } public static void unload() { - foreach (BulletMLParserTinyXML *pa[char[]]; parser) { + foreach (BulletMLParserTinyXML *pa[string]; parser) { foreach (BulletMLParserTinyXML *p; pa) { BulletMLParserTinyXML_delete(p); } --- a/src/abagames/tt/boot.d +++ b/src/abagames/tt/boot.d @@ -6,6 +6,7 @@ module abagames.tt.boot; private import std.string; +private import std.conv; private import std.stream; private import std.c.stdlib; private import abagames.util.logger; @@ -50,10 +51,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()); result = EXIT_FAILURE; } @@ -62,12 +63,12 @@ } } else { // Boot as the general executable. - public int main(char[][] args) { + public int main(string[] args) { return boot(args); } } -public int boot(char[][] args) { +public int boot(string[] args) { screen = new Screen; input = new RecordablePad; try { @@ -83,20 +84,20 @@ } try { mainLoop.loop(); - } catch (Object o) { + } catch (Throwable o) { try { gameManager.saveErrorReplay(); - } catch (Object o1) {} + } catch (Throwable o1) {} throw o; } return EXIT_SUCCESS; } -private void parseArgs(char[][] commandArgs) { - char[][] args = readOptionsIniFile(); +private void parseArgs(string[] commandArgs) { + string[] args = readOptionsIniFile(); for (int i = 1; i < commandArgs.length; i++) args ~= commandArgs[i]; - char[] progName = commandArgs[0]; + string progName = commandArgs[0]; for (int i = 0; i < args.length; i++) { switch (args[i]) { case "-brightness": @@ -105,7 +106,7 @@ throw new Exception("Invalid options"); } i++; - float b = cast(float) std.string.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"); @@ -119,7 +120,7 @@ throw new Exception("Invalid options"); } i++; - float l = cast(float) std.string.atoi(args[i]) / 100; + float l = cast(float) to!int(args[i]) / 100; if (l < 0 || l > 1) { usage(progName); throw new Exception("Invalid options"); @@ -138,9 +139,9 @@ throw new Exception("Invalid options"); } i++; - int w = std.string.atoi(args[i]); + int w = to!int(args[i]); i++; - int h = std.string.atoi(args[i]); + int h = to!int(args[i]); Screen.width = w; Screen.height = h; break; @@ -160,17 +161,17 @@ } } -private final const char[] OPTIONS_INI_FILE = "options.ini"; +private const string OPTIONS_INI_FILE = "options.ini"; -private char[][] readOptionsIniFile() { +private string[] readOptionsIniFile() { try { return Tokenizer.readFile(OPTIONS_INI_FILE, " "); - } catch (Object e) { + } catch (Throwable e) { return null; } } -private void usage(char[] progName) { +private void usage(string progName) { Logger.error ("Usage: " ~ progName ~ " [-brightness [0-100]] [-luminosity [0-100]] [-window] [-fullscreen] [-res x y] [-nosound]"); } --- a/src/abagames/tt/camera.d +++ b/src/abagames/tt/camera.d @@ -52,7 +52,7 @@ changeCnt--; if (changeCnt < 0) { type = rand.nextInt(2); - switch (type) { + switch (type) { default: break; case MoveType.FLOAT: changeCnt = 256 + rand.nextInt(150); cameraTrg.x = ship.relPos.x + rand.nextSignedFloat(1); @@ -95,7 +95,7 @@ } cameraTrg += cameraVel; float cox, coy, coz; - switch (type) { + switch (type) { default: break; case MoveType.FLOAT: cox = cameraTrg.x; coy = cameraTrg.y; --- a/src/abagames/tt/floatletter.d +++ b/src/abagames/tt/floatletter.d @@ -25,15 +25,12 @@ float mx, my; float d; float size; - char[] msg; + string msg; int cnt; float alpha; - public static this() { - rand = new Rand; - } - public static void setRandSeed(long seed) { + if (rand is null) rand = new Rand; rand.setSeed(seed); } @@ -42,7 +39,7 @@ pos = new Vector3; } - public void set(char[] m, Vector p, float s, int c = 120) { + public void set(string m, Vector p, float s, int c = 120) { pos.x = p.x; pos.y = p.y; pos.z = 1; --- a/src/abagames/tt/gamemanager.d +++ b/src/abagames/tt/gamemanager.d @@ -156,13 +156,13 @@ private void saveLastReplay() { try { inGameState.saveReplay("last.rpl"); - } catch (Object o) {} + } catch (Throwable o) {} } private void loadLastReplay() { try { inGameState.loadReplay("last.rpl"); - } catch (Object o) { + } catch (Throwable o) { inGameState.resetReplay(); } } @@ -269,13 +269,13 @@ static const int DEFAULT_TIME = 120000; static const int MAX_TIME = 120000; static const int SHIP_DESTROYED_PENALTY_TIME = -15000; - static const char[] SHIP_DESTROYED_PENALTY_TIME_MSG = "-15 SEC."; + static const string SHIP_DESTROYED_PENALTY_TIME_MSG = "-15 SEC."; static const int EXTEND_TIME = 15000; - static const char[] EXTEND_TIME_MSG = "+15 SEC."; + static const string EXTEND_TIME_MSG = "+15 SEC."; static const int NEXT_ZONE_ADDITION_TIME = 30000; - static const char[] NEXT_ZONE_ADDITION_TIME_MSG = "+30 SEC."; + static const string NEXT_ZONE_ADDITION_TIME_MSG = "+30 SEC."; static const int NEXT_LEVEL_ADDITION_TIME = 45000; - static const char[] NEXT_LEVEL_ADDITION_TIME_MSG = "+45 SEC."; + static const string NEXT_LEVEL_ADDITION_TIME_MSG = "+45 SEC."; static const int BEEP_START_TIME = 15000; Pad pad; PrefManager prefManager; @@ -285,7 +285,7 @@ int time; int nextBeepTime; int startBgmCnt; - char[] timeChangedMsg; + string timeChangedMsg; int timeChangedShowCnt; int gameOverCnt; bool btnPressed; @@ -325,7 +325,7 @@ Particle.setRandSeed(_seed); Shot.setRandSeed(_seed); SoundManager.setRandSeed(_seed); - ship.start(_grade, _seed); + ship.start(_grade, cast(int)_seed); stageManager.start(_level, _grade, _seed); initGameState(); SoundManager.playBgm(); @@ -498,7 +498,7 @@ SoundManager.playSe("extend.wav"); } - private void changeTime(int ct, char[] msg) { + private void changeTime(int ct, string msg) { time += ct; if (time > MAX_TIME) time = MAX_TIME; @@ -509,11 +509,11 @@ timeChangedMsg = msg; } - public void saveReplay(char[] fileName) { + public void saveReplay(string fileName) { _replayData.save(fileName); } - public void loadReplay(char[] fileName) { + public void loadReplay(string fileName) { _replayData = new ReplayData; _replayData.load(fileName); } @@ -597,7 +597,7 @@ Particle.setRandSeed(_seed); Shot.setRandSeed(_seed); SoundManager.setRandSeed(_seed); - ship.start(_grade, _seed); + ship.start(_grade, cast(int)_seed); stageManager.start(_level, _grade, _seed); inGameState.initGameState(); ship.setScreenShake(0, 0); --- a/src/abagames/tt/letter.d +++ b/src/abagames/tt/letter.d @@ -94,7 +94,7 @@ return idx; } - public static void drawString(char[] str, float lx, float y, float s, + public static void drawString(string str, float lx, float y, float s, int d = Direction.TO_RIGHT, int cl = 0, bool rev = false, float od = 0) { lx += LETTER_WIDTH * s / 2; @@ -102,7 +102,7 @@ float x = lx; int idx; float ld; - switch (d) { + switch (d) { default: break; case Direction.TO_RIGHT: ld = 0; break; @@ -126,7 +126,7 @@ drawLetter(idx, x, y, s, ld, cl); } if (od == 0) { - switch(d) { + switch(d) { default: break; case Direction.TO_RIGHT: x += s * LETTER_WIDTH; break; @@ -154,7 +154,7 @@ int n = num; float x = lx; float ld; - switch (d) { + switch (d) { default: break; case Direction.TO_RIGHT: ld = 0; break; @@ -171,7 +171,7 @@ int digit = dg; 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/tt/particle.d +++ b/src/abagames/tt/particle.d @@ -42,11 +42,8 @@ float d1, d2, md1, md2; float width, height; - public static this() { - rand = new Rand; - } - public static void setRandSeed(long seed) { + if (rand is null) rand = new Rand; rand.setSeed(seed); } @@ -166,7 +163,7 @@ } public override void draw() { - switch (type) { + switch (type) { default: break; case PType.SPARK: case PType.JET: drawSpark(); --- a/src/abagames/tt/prefmanager.d +++ b/src/abagames/tt/prefmanager.d @@ -7,6 +7,7 @@ private import std.stream; private import std.string; +private import std.conv; private import std.file; private import std.c.stdlib; private import abagames.util.prefmanager; @@ -18,18 +19,18 @@ public class PrefManager: abagames.util.prefmanager.PrefManager { private: static const int VERSION_NUM = 10; - static const char[] PREF_FILE = "tt.prf"; + static const string PREF_FILE = "tt.prf"; PrefData _prefData; public this() { _prefData = new PrefData; } - public static char[] pref_dir() { - char * home = getenv("HOME"); + public static string pref_dir() { + const(char)* home = getenv("HOME"); if (home is null) throw new Error("HOME environment variable is not defined"); - char[] dir = std.string.toString(home) ~ "/.torus-trooper"; + string dir = to!string(home) ~ "/.torus-trooper"; try { mkdir(dir); } catch (FileException e) { @@ -38,7 +39,7 @@ } public void load() { - auto File fd = new File; + scope File fd = new File; try { int ver; fd.open(pref_dir() ~ "/" ~ PREF_FILE); @@ -46,7 +47,7 @@ if (ver != VERSION_NUM) throw new Error("Wrong version num"); _prefData.load(fd); - } catch (Object e) { + } catch (Throwable e) { _prefData.init(); } finally { if (fd.isOpen()) @@ -55,7 +56,7 @@ } public void save() { - auto File fd = new File; + scope File fd = new File; fd.create(pref_dir() ~ "/" ~ PREF_FILE); fd.write(VERSION_NUM); _prefData.save(fd); @@ -74,7 +75,7 @@ public this() { gradeData = new GradeData[Ship.GRADE_NUM]; - foreach (inout GradeData gd; gradeData) + foreach (ref GradeData gd; gradeData) gd = new GradeData; } --- a/src/abagames/tt/replay.d +++ b/src/abagames/tt/replay.d @@ -21,8 +21,8 @@ long seed; private: - public void save(char[] fileName) { - auto File fd = new File; + public void save(string fileName) { + scope File fd = new File; fd.create(PrefManager.pref_dir() ~ "/" ~ fileName); fd.write(VERSION_NUM); fd.write(level); @@ -32,8 +32,8 @@ fd.close(); } - public void load(char[] fileName) { - auto File fd = new File; + public void load(string fileName) { + scope File fd = new File; fd.open(PrefManager.pref_dir() ~ "/" ~ fileName); int ver; fd.read(ver); --- a/src/abagames/tt/screen.d +++ b/src/abagames/tt/screen.d @@ -16,7 +16,7 @@ */ public class Screen: Screen3D { public: - static const char[] CAPTION = "Torus Trooper"; + static const string CAPTION = "Torus Trooper"; static float luminous = 0; private: LuminousScreen luminousScreen; @@ -65,7 +65,7 @@ luminousScreen.draw(); } - public void resized(int width, int height) { + public override void resized(int width, int height) { if (luminousScreen) luminousScreen.resized(width, height); super.resized(width, height); --- a/src/abagames/tt/shape.d +++ b/src/abagames/tt/shape.d @@ -66,7 +66,7 @@ Vector rocketPos, fragmentPos; int color; - static this() { + public static this() { rand = new Rand; } @@ -83,7 +83,7 @@ } public void create(int type, bool damaged = false) { - switch (type) { + switch (type) { default: break; case Type.SMALL: createSmallType(damaged); break; @@ -121,10 +121,10 @@ sw *= 1.5f; float sd1 = rand.nextFloat(1) * PI / 3 + PI / 4; float sd2 = rand.nextFloat(1) * PI / 10; - int cl = rand.nextInt(Structure.COLOR_RGB.length - 2) + 2; + int cl = rand.nextInt(cast(int)(Structure.COLOR_RGB.length - 2)) + 2; color = cl; int shp = rand.nextInt(Structure.Shape.ROCKET); - switch (shaftNum) { + switch (shaftNum) { default: break; case 1: structure ~= createShaft(0, 0, so, sd1, sl, 2, sw, sd1 / 2, sd2, cl, shp, 5, 1, damaged); _collision.x = so / 2 + sw; @@ -157,10 +157,10 @@ sw *= 1.6f; float sd1 = rand.nextFloat(1) * PI / 3 + PI / 4; float sd2 = rand.nextFloat(1) * PI / 10; - int cl = rand.nextInt(Structure.COLOR_RGB.length - 2) + 2; + int cl = rand.nextInt(cast(int)(Structure.COLOR_RGB.length - 2)) + 2; color = cl; int shp = rand.nextInt(Structure.Shape.ROCKET); - switch (shaftNum) { + switch (shaftNum) { default: break; case 3: int cshp = rand.nextInt(Structure.Shape.ROCKET); structure ~= createShaft(0, 0, so * 0.5, sd1, sl, 2, sw, sd1, sd2, cl, cshp, 8, 1, damaged); @@ -202,10 +202,10 @@ sw *= 1.6f; float sd1 = rand.nextFloat(1) * PI / 3 + PI / 4; float sd2 = rand.nextFloat(1) * PI / 10; - int cl = rand.nextInt(Structure.COLOR_RGB.length - 2) + 2; + int cl = rand.nextInt(cast(int)(Structure.COLOR_RGB.length - 2)) + 2; color = cl; int shp = rand.nextInt(Structure.Shape.ROCKET); - switch (shaftNum) { + switch (shaftNum) { default: break; case 5: int cshp = rand.nextInt(Structure.Shape.ROCKET); structure ~= createShaft(0, 0, so * 0.5, sd1, sl, 2, sw, sd1, sd2, cl, cshp, 8, 1, damaged); @@ -380,7 +380,7 @@ if (color == 0) alp = 1; Screen.setColor(COLOR_RGB[color][0], COLOR_RGB[color][1], COLOR_RGB[color][2]); - switch (shape) { + switch (shape) { default: break; case Shape.SQUARE: for (int i = 0; i < divNum; i++) { float x11 = -0.5 + (1.0 / divNum) * i; @@ -558,7 +558,7 @@ public void create(int type) { displayList = new DisplayList(1); displayList.beginNewList(); - switch (type) { + switch (type) { default: break; case 0: createTriangleShape(false); break; @@ -586,13 +586,13 @@ } private void createTriangleShape(bool wireShape) { - auto Vector3 cp = new Vector3; - auto Vector3 p1 = new Vector3; - auto Vector3 p2 = new Vector3; - auto Vector3 p3 = new Vector3; - auto Vector3 np1 = new Vector3; - auto Vector3 np2 = new Vector3; - auto Vector3 np3 = new Vector3; + scope Vector3 cp = new Vector3; + scope Vector3 p1 = new Vector3; + scope Vector3 p2 = new Vector3; + scope Vector3 p3 = new Vector3; + scope Vector3 np1 = new Vector3; + scope Vector3 np2 = new Vector3; + scope Vector3 np3 = new Vector3; for (int i = 0; i < 3; i++) { float d = PI * 2 / 3 * i; p1.x = p1.y = 0; @@ -633,9 +633,9 @@ } private void createSquareShape(bool wireShape) { - auto Vector3 cp = new Vector3; - auto Vector3[] p = new Vector3[4]; - auto Vector3[] np = new Vector3[4]; + scope Vector3 cp = new Vector3; + scope Vector3[] p = new Vector3[4]; + scope Vector3[] np = new Vector3[4]; static const float[][][] POINT_DAT = [ [[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1], ], [[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], ], @@ -644,9 +644,9 @@ [[1, -1, -1], [1, -1, 1], [1, 1, 1], [1, 1, -1], ], [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1], ], ]; - foreach (inout Vector3 ip; p) + foreach (ref Vector3 ip; p) ip = new Vector3; - foreach (inout Vector3 inp; np) + foreach (ref Vector3 inp; np) inp = new Vector3; for (int i = 0; i < 6; i++) { cp.x = cp.y = cp.z = 0; @@ -678,9 +678,9 @@ } private void createBarShape(bool wireShape) { - auto Vector3 cp = new Vector3; - auto Vector3[] p = new Vector3[4]; - auto Vector3[] np = new Vector3[4]; + scope Vector3 cp = new Vector3; + scope Vector3[] p = new Vector3[4]; + scope Vector3[] np = new Vector3[4]; static const float[][][] POINT_DAT = [ [[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1], ], //[[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], ], @@ -689,9 +689,9 @@ [[1, -1, -1], [1, -1, 1], [1, 1, 1], [1, 1, -1], ], [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1], ], ]; - foreach (inout Vector3 ip; p) + foreach (ref Vector3 ip; p) ip = new Vector3; - foreach (inout Vector3 inp; np) + foreach (ref Vector3 inp; np) inp = new Vector3; for (int i = 0; i < 5; i++) { cp.x = cp.y = cp.z = 0; --- a/src/abagames/tt/ship.d +++ b/src/abagames/tt/ship.d @@ -36,8 +36,8 @@ NORMAL, HARD, EXTREME, }; static const int GRADE_NUM = 3; - static const char[][] GRADE_LETTER = ["N", "H", "E"]; - static const char[][] GRADE_STR = ["NORMAL", "HARD", "EXTREME"]; + static const string[] GRADE_LETTER = ["N", "H", "E"]; + static const string[] GRADE_STR = ["NORMAL", "HARD", "EXTREME"]; static bool replayMode, cameraMode, drawFrontMode; bool isGameOver; private: --- a/src/abagames/tt/shot.d +++ b/src/abagames/tt/shot.d @@ -7,6 +7,7 @@ private import std.math; private import std.string; +private import std.conv; private import opengl; private import abagames.util.actor; private import abagames.util.vector; @@ -179,7 +180,7 @@ else if (sc >= 2000) size = 0.7; size *= (1 + multiplier * 0.01f); - fl.set("X" ~ std.string.toString(multiplier), pos, size * pos.y, + fl.set("X" ~ to!string(multiplier), pos, size * pos.y, cast(int) (30 + multiplier * 0.3f)); } if (chargeShot) { --- a/src/abagames/tt/soundmanager.d +++ b/src/abagames/tt/soundmanager.d @@ -16,7 +16,7 @@ */ public class SoundManager: abagames.util.sdl.sound.SoundManager { private static: - char[][] seFileName = + string[] seFileName = ["shot.wav", "charge.wav", "charge_shot.wav", "hit.wav", "small_dest.wav", "middle_dest.wav", "boss_dest.wav", "myship_dest.wav", "extend.wav", "timeup_beep.wav"]; @@ -26,11 +26,13 @@ 5, 6, 7]; Rand rand; Music[] bgm; - Chunk[char[]] se; - int prevBgmIdx; + Chunk[string] se; + ptrdiff_t prevBgmIdx; int nextIdxMv; bool seDisabled = false; + private TypeInfo hack() { return typeid(se); } //workaround for compiler/linker bug in gdc-4.6 0.29.1-4.6.4-3 + public static void loadSounds() { bgm = loadMusics(); se = loadChunks(); @@ -44,23 +46,23 @@ private static Music[] loadMusics() { Music[] musics; - char[][] files = listdir(Music.dir); - foreach (char[] fileName; files) { - char[] ext = getExt(fileName); - if (ext != "ogg" && ext != "wav") + auto files = dirEntries(Music.dir, SpanMode.shallow); + foreach (string fileName; files) { + string ext = extension(fileName); + if (ext != ".ogg" && ext != ".wav") continue; Music music = new Music(); - music.load(fileName); + music.load(baseName(fileName)); musics ~= music; Logger.info("Load bgm: " ~ fileName); } return musics; } - private static Chunk[char[]] loadChunks() { - Chunk[char[]] chunks; + private static Chunk[string] loadChunks() { + Chunk[string] chunks; int i = 0; - foreach (char[] fileName; seFileName) { + foreach (string fileName; seFileName) { Chunk chunk = new Chunk(); chunk.load(fileName, seChannel[i]); chunks[fileName] = chunk; @@ -71,7 +73,7 @@ } public static void playBgm() { - int bgmIdx = rand.nextInt(bgm.length); + ptrdiff_t bgmIdx = cast(ptrdiff_t) rand.nextInt(cast(int)bgm.length); nextIdxMv = rand.nextInt(2) * 2 - 1; if (bgmIdx == prevBgmIdx) { bgmIdx++; @@ -83,7 +85,7 @@ } public static void nextBgm() { - int bgmIdx = prevBgmIdx + nextIdxMv; + ptrdiff_t bgmIdx = prevBgmIdx + nextIdxMv; if (bgmIdx < 0) bgmIdx = bgm.length - 1; else if (bgmIdx >= bgm.length) @@ -100,7 +102,7 @@ Music.haltMusic(); } - public static void playSe(char[] name) { + public static void playSe(string name) { if (seDisabled) return; se[name].play(); --- a/src/abagames/tt/stagemanager.d +++ b/src/abagames/tt/stagemanager.d @@ -69,8 +69,8 @@ _middleBossZone = false; Slice.darkLine = true; Slice.darkLineRatio = 1; - tunnelColorPolyIdx = TUNNEL_COLOR_PATTERN_POLY.length + cast(int) level - 2; - tunnelColorLineIdx = TUNNEL_COLOR_PATTERN_LINE.length + cast(int) level - 2; + tunnelColorPolyIdx = cast(int)TUNNEL_COLOR_PATTERN_POLY.length + cast(int) level - 2; + tunnelColorLineIdx = cast(int)TUNNEL_COLOR_PATTERN_LINE.length + cast(int) level - 2; createNextZone(); } @@ -159,13 +159,13 @@ } nextSmallAppDist -= ship.speed; if (nextSmallAppDist <= 0) { - addEnemy(smallShipSpec[rand.nextInt(smallShipSpec.length)], + addEnemy(smallShipSpec[rand.nextInt(cast(int)smallShipSpec.length)], Ship.IN_SIGHT_DEPTH_DEFAULT * (4 + rand.nextFloat(0.5)), rand); setNextSmallAppDist(); } nextMiddleAppDist -= ship.speed; if (nextMiddleAppDist <= 0) { - addEnemy(middleShipSpec[rand.nextInt(middleShipSpec.length)], + addEnemy(middleShipSpec[rand.nextInt(cast(int)middleShipSpec.length)], Ship.IN_SIGHT_DEPTH_DEFAULT * (4 + rand.nextFloat(0.5)), rand); setNextMiddleAppDist(); } @@ -176,16 +176,16 @@ } else { Slice.darkLineRatio -= 1.0f / TUNNEL_COLOR_CHANGE_INTERVAL; float cRatio = cast(float) tunnelColorChangeCnt / TUNNEL_COLOR_CHANGE_INTERVAL; - int cpIdxPrev = (tunnelColorPolyIdx - 1) % TUNNEL_COLOR_PATTERN_POLY.length; - int cpIdxNow = tunnelColorPolyIdx % TUNNEL_COLOR_PATTERN_POLY.length; + ptrdiff_t cpIdxPrev = (tunnelColorPolyIdx - 1) % TUNNEL_COLOR_PATTERN_POLY.length; + ptrdiff_t cpIdxNow = tunnelColorPolyIdx % TUNNEL_COLOR_PATTERN_POLY.length; Slice.polyR = TUNNEL_COLOR_PATTERN_POLY[cpIdxPrev][0] * cRatio + TUNNEL_COLOR_PATTERN_POLY[cpIdxNow][0] * (1 - cRatio); Slice.polyG = TUNNEL_COLOR_PATTERN_POLY[cpIdxPrev][1] * cRatio + TUNNEL_COLOR_PATTERN_POLY[cpIdxNow][1] * (1 - cRatio); Slice.polyB = TUNNEL_COLOR_PATTERN_POLY[cpIdxPrev][2] * cRatio + TUNNEL_COLOR_PATTERN_POLY[cpIdxNow][2] * (1 - cRatio); - int clIdxPrev = (tunnelColorLineIdx - 1) % TUNNEL_COLOR_PATTERN_LINE.length; - int clIdxNow = tunnelColorLineIdx % TUNNEL_COLOR_PATTERN_LINE.length; + ptrdiff_t clIdxPrev = (tunnelColorLineIdx - 1) % TUNNEL_COLOR_PATTERN_LINE.length; + ptrdiff_t clIdxNow = tunnelColorLineIdx % TUNNEL_COLOR_PATTERN_LINE.length; Slice.lineR = TUNNEL_COLOR_PATTERN_LINE[clIdxPrev][0] * cRatio + TUNNEL_COLOR_PATTERN_LINE[clIdxNow][0] * (1 - cRatio); Slice.lineG = TUNNEL_COLOR_PATTERN_LINE[clIdxPrev][1] * cRatio + @@ -403,7 +403,7 @@ private Barrage createBarrage(Rand rand, float level, int preWait, int postWait, - float size = 1, char[] baseDir = null, + float size = 1, string baseDir = null, int shapeIdx = 0, bool longRange = false) { if (level < 0) @@ -437,19 +437,19 @@ int psn; if (baseDir) { ps = BarrageManager.getInstanceList(baseDir); - int pi = rand.nextInt(ps.length); + int pi = rand.nextInt(cast(int)ps.length); br.addBml(ps[pi], rank, true, speedRank); } else { br.addBml("basic", "straight.xml", rank, true, speedRank); } ps = BarrageManager.getInstanceList("morph"); - psn = ps.length; + psn = cast(int)ps.length; for (int i = 0; i < morphCnt; i++) { - int pi = rand.nextInt(ps.length); + int pi = rand.nextInt(cast(int)ps.length); while (!ps[pi]) { pi--; if (pi < 0) - pi = ps.length - 1; + pi = cast(int)ps.length - 1; } br.addBml(ps[pi], morphRank, true, speedRank); delete ps[pi]; @@ -458,11 +458,11 @@ return br; } - public void setSpeed(inout float sp) { + public void setSpeed(ref float sp) { changeSpeed(sp, baseSpeed); } - public void setSpeed(inout float sp, float shipSp) { + public void setSpeed(ref float sp, float shipSp) { float as = shipSp * shipSpeedRatio; if (as > baseSpeed) changeSpeed(sp, as); @@ -470,7 +470,7 @@ changeSpeed(sp, baseSpeed); } - private void changeSpeed(inout float sp, float aim) { + private void changeSpeed(ref float sp, float aim) { sp += (aim - sp) * SPEED_CHANGE_RATIO; } @@ -500,7 +500,7 @@ } } - public void tryToMove(inout float bank, float deg, float aimDeg) { + public void tryToMove(ref float bank, float deg, float aimDeg) { float bk = aimDeg - deg; if (bk > PI) bk -= PI * 2; @@ -513,7 +513,7 @@ bank += (bk - bank) * 0.1; } - public void handleLimitY(inout float y, inout float limitY) { + public void handleLimitY(ref float y, ref float limitY) { if (y > limitY) y += (limitY - y) * 0.05f; else @@ -525,8 +525,8 @@ return rand.nextSignedFloat(baseBank); } - public void getBitOffset(Vector ofs, inout float deg, int idx, int cnt) { - switch (bitType) { + public void getBitOffset(Vector ofs, ref float deg, int idx, int cnt) { + switch (bitType) { default: break; case BitType.ROUND: float od = PI * 2 / bitNum; float d = od * idx + cnt * bitMd; --- a/src/abagames/tt/title.d +++ b/src/abagames/tt/title.d @@ -275,7 +275,7 @@ drawCursorRing(cx, cy, 18 + sin(cnt * 0.1f) * 3); } - private void calcCursorPos(inout float x, inout float y, int gd, int lv) { + private void calcCursorPos(ref float x, ref float y, int gd, int lv) { x = 460 + gd * 70; y = 90; if (lv > 1) { --- a/src/abagames/tt/tunnel.d +++ b/src/abagames/tt/tunnel.d @@ -19,13 +19,13 @@ */ public class Tunnel { public: - static final int DEPTH_NUM = 72; - static final int SHIP_IDX_OFS = 5; - static final float RAD_RATIO = 1.05; + static const int DEPTH_NUM = 72; + static const int SHIP_IDX_OFS = 5; + static const float RAD_RATIO = 1.05; private: // Interval between slices gets longer as the distance from the eye position increases. - static final float DEPTH_CHANGE_RATIO = 1.15; - static final float DEPTH_RATIO_MAX = 80; + static const float DEPTH_CHANGE_RATIO = 1.15; + static const float DEPTH_RATIO_MAX = 80; Slice[] slice; float shipDeg, shipOfs, shipY; int shipIdx; @@ -39,10 +39,10 @@ public this() { slice = new Slice[DEPTH_NUM]; - foreach (inout Slice sl; slice) + foreach (ref Slice sl; slice) sl = new Slice; sliceBackward = new Slice[DEPTH_NUM]; - foreach (inout Slice sl; sliceBackward) + foreach (ref Slice sl; sliceBackward) sl = new Slice; shipPos = new Vector3; tpos = new Vector3; @@ -282,7 +282,7 @@ } private void calcIndex(in float z, out int idx, out float ofs) { - idx = slice.length + 99999; + idx = cast(int)slice.length + 99999; for (int i = 1; i < slice.length; i++) { if (z < slice[i].depth) { idx = i - 1; @@ -294,7 +294,7 @@ idx = 0; ofs = 0; } else if (idx >= slice.length - 1) { - idx = slice.length - 2; + idx = cast(int)slice.length - 2; ofs = 0.99; } if (ofs !>= 0) @@ -304,7 +304,7 @@ } private void calcIndexBackward(in float z, out int idx, out float ofs) { - idx = sliceBackward.length + 99999; + idx = cast(int)sliceBackward.length + 99999; for (int i = 1; i < sliceBackward.length; i++) { if (z > sliceBackward[i].depth) { idx = i - 1; @@ -316,7 +316,7 @@ idx = 0; ofs = 0; } else if (idx >= sliceBackward.length - 1) { - idx = sliceBackward.length - 2; + idx = cast(int)sliceBackward.length - 2; ofs = 0.99; } if (ofs !>= 0) @@ -359,7 +359,7 @@ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); float lineBn = 0.4, polyBn = 0, lightBn = 0.5 - Slice.darkLineRatio * 0.2f; slice[slice.length - 1].setPointPos(); - for (int i = slice.length - 1; i >= 1; i--) { + for (int i = cast(int)slice.length - 1; i >= 1; i--) { slice[i - 1].setPointPos(); slice[i].draw(slice[i - 1], lineBn, polyBn, lightBn, this); lineBn *= 1.02; @@ -387,7 +387,7 @@ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); float lineBn = 0.4, polyBn = 0, lightBn = 0.5 - Slice.darkLineRatio * 0.2f; sliceBackward[sliceBackward.length - 1].setPointPos(); - for (int i = sliceBackward.length - 1; i >= 1; i--) { + for (int i = cast(int)sliceBackward.length - 1; i >= 1; i--) { sliceBackward[i - 1].setPointPos(); sliceBackward[i].draw(sliceBackward[i - 1], lineBn, polyBn, lightBn, this); lineBn *= 1.02; @@ -417,7 +417,7 @@ */ public class Slice { public: - static final float DEPTH = 5; + static const float DEPTH = 5; static float lineR, lineG, lineB; static float polyR, polyG, polyB; static bool darkLine; @@ -437,7 +437,7 @@ _state = new SliceState; _centerPos = new Vector3; pointPos = new Vector3[SliceState.MAX_POINT_NUM]; - foreach (inout Vector3 pp; pointPos) + foreach (ref Vector3 pp; pointPos) pp = new Vector3; radOfs = new Vector3; polyPoint = new Vector3; @@ -691,7 +691,7 @@ TorusPart tp = getTorusPart(idx); int prvTpIdx = tpIdx - 1; if (prvTpIdx < 0) - prvTpIdx = torusPart.length - 1; + prvTpIdx = cast(int)torusPart.length - 1; SliceState ss = tp.createBlendedSliceState(torusPart[prvTpIdx].sliceState, idx); return ss; } @@ -750,7 +750,7 @@ _sliceState.changeToStraight(); } } else if (prev.courseWidth == prev.pointNum || rand.nextInt(2) == 0) { - switch (rand.nextInt(3)) { + switch (rand.nextInt(3)) { default: break; case 0: _sliceState.changeRad(rand); break; @@ -806,9 +806,9 @@ public class SliceState { public: - static final int MAX_POINT_NUM = 36; - static final int DEFAULT_POINT_NUM = 24; - static final float DEFAULT_RAD = 21; + static const int MAX_POINT_NUM = 36; + static const int DEFAULT_POINT_NUM = 24; + static const float DEFAULT_RAD = 21; private: float _md1, _md2; float _rad; @@ -940,7 +940,7 @@ cnt = 0; this.type = type; float r = ss.rad; - switch (type) { + switch (type) { default: break; case 0: createNormalRing(r); break; @@ -970,20 +970,20 @@ float d = 0, md = 0.2; for (int i = 0; i < num; i++) { glBegin(GL_LINE_LOOP); - auto Vector3 p1 = new Vector3(sin(d) * r * rr1, cos(d) * r * rr1, 0); - auto Vector3 p2 = new Vector3(sin(d) * r * rr2, cos(d) * r * rr2, 0); - auto Vector3 p3 = new Vector3(sin(d + md) * r * rr2, cos(d + md) * r * rr2, 0); - auto Vector3 p4 = new Vector3(sin(d + md) * r * rr1, cos(d + md) * r * rr1, 0); - auto Vector3 cp = new Vector3; + scope Vector3 p1 = new Vector3(sin(d) * r * rr1, cos(d) * r * rr1, 0); + scope Vector3 p2 = new Vector3(sin(d) * r * rr2, cos(d) * r * rr2, 0); + scope Vector3 p3 = new Vector3(sin(d + md) * r * rr2, cos(d + md) * r * rr2, 0); + scope Vector3 p4 = new Vector3(sin(d + md) * r * rr1, cos(d + md) * r * rr1, 0); + scope Vector3 cp = new Vector3; cp += p1; cp += p2; cp += p3; cp += p4; cp /= 4; - auto Vector3 np1 = new Vector3; - auto Vector3 np2 = new Vector3; - auto Vector3 np3 = new Vector3; - auto Vector3 np4 = new Vector3; + scope Vector3 np1 = new Vector3; + scope Vector3 np2 = new Vector3; + scope Vector3 np3 = new Vector3; + scope Vector3 np4 = new Vector3; np1.blend(p1, cp, 0.7); np2.blend(p2, cp, 0.7); np3.blend(p3, cp, 0.7); --- a/src/abagames/util/actor.d +++ b/src/abagames/util/actor.d @@ -32,7 +32,7 @@ public: T[] actor; protected: - int actorIdx = 0; + ptrdiff_t actorIdx = 0; private: public this() {} @@ -43,7 +43,7 @@ protected void createActors(int n, Object[] args = null) { actor = new T[n]; - foreach (inout T a; actor) { + foreach (ref T a; actor) { a = new T; a.exists = false; a.init(args); --- a/src/abagames/util/iterator.d +++ b/src/abagames/util/iterator.d @@ -35,4 +35,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,7 +19,7 @@ public class Logger { - public static void info(char[] msg, bool nline = true) { + public static void info(string msg, bool nline = true) { // Win32 exe crashes if it writes something to stderr. /*if (nline) stderr.writeLine(msg); @@ -28,24 +29,20 @@ public static void info(double n, bool nline = true) { /*if (nline) - stderr.writeLine(std.string.toString(n)); + stderr.writeLine(to!string(n)); else - stderr.writeString(std.string.toString(n) ~ " ");*/ + stderr.writeString(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()); } } @@ -54,7 +51,7 @@ public class Logger { - public static void info(char[] msg, bool nline = true) { + public static void info(string msg, bool nline = true) { if (nline) derr.writeLine(msg); else @@ -63,20 +60,16 @@ public static void info(double n, bool nline = true) { if (nline) - derr.writeLine(std.string.toString(n)); + derr.writeLine(to!string(n)); else - derr.writeString(std.string.toString(n) ~ " "); + derr.writeString(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 uint nextInt32() { @@ -55,7 +55,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, @@ -122,7 +122,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[]. */ @@ -140,11 +140,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++; @@ -152,7 +152,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++; @@ -167,9 +167,9 @@ { 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.ptr; --- a/src/abagames/util/sdl/mainloop.d +++ b/src/abagames/util/sdl/mainloop.d @@ -89,7 +89,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; @@ -32,7 +33,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.vector; @@ -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); @@ -98,10 +99,10 @@ if (error == GL_NO_ERROR) return; closeSDL(); - throw new Exception("OpenGL error(" ~ std.string.toString(error) ~ ")"); + throw new Exception("OpenGL error(" ~ to!string(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); } } @@ -18,7 +18,7 @@ * SDL general exception. */ public class SDLException: 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 = true; 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 = true; 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); } @@ -56,8 +57,8 @@ * Music / Chunk. */ public interface Sound { - public void load(char[] name); - public void load(char[] name, int ch); + public void load(string name); + public void load(string name, int ch); public void free(); public void play(); public void fade(); @@ -67,23 +68,23 @@ public class Music: Sound { public: static int fadeOutSpeed = 1280; - static char[] dir = "/usr/share/games/torus-trooper/sounds/musics"; + static string dir = "/usr/share/games/torus-trooper/sounds/musics"; private: Mix_Music* music; - public void load(char[] name) { + public void load(string name) { if (SoundManager.noSound) return; - char[] fileName = dir ~ "/" ~ name; + string fileName = dir ~ "/" ~ name; music = Mix_LoadMUS(std.string.toStringz(fileName)); if (!music) { SoundManager.noSound = true; throw new SDLException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } } - public void load(char[] name, int ch) { + public void load(string name, int ch) { load(name); } @@ -131,24 +132,24 @@ public class Chunk: Sound { public: - static char[] dir = "/usr/share/games/torus-trooper/sounds/chunks"; + static string dir = "/usr/share/games/torus-trooper/sounds/chunks"; private: Mix_Chunk* chunk; int chunkChannel; - public void load(char[] name) { + public void load(string name) { load(name, 0); } - public void load(char[] name, int ch) { + public void load(string name, int ch) { if (SoundManager.noSound) return; - char[] fileName = dir ~ "/" ~ name; + string fileName = dir ~ "/" ~ name; chunk = Mix_LoadWAV(std.string.toStringz(fileName)); if (!chunk) { SoundManager.noSound = true; throw new SDLException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } chunkChannel = ch; } --- a/src/abagames/util/sdl/texture.d +++ b/src/abagames/util/sdl/texture.d @@ -15,12 +15,12 @@ */ public class Texture { public: - static char[] imagesDir = "/usr/share/games/torus-trooper/images/"; + static string imagesDir = "/usr/share/games/torus-trooper/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/util/tokenizer.d +++ b/src/abagames/util/tokenizer.d @@ -7,6 +7,7 @@ private import std.stream; private import std.string; +private import std.conv; /** * Tokenizer. @@ -14,17 +15,17 @@ public class Tokenizer { private: - public static char[][] readFile(char[] fileName, char[] separator) { - char[][] result; - auto File fd = new File; + public static string[] readFile(string fileName, string separator) { + 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, separator); - foreach (char[] s; spl) { - char[] r = strip(s); + string[] spl = split(line, separator); + foreach (string s; spl) { + string r = strip(s); if (r.length > 0) result ~= r; } @@ -40,7 +41,7 @@ public class CSVTokenizer { private: - public static char[][] readFile(char[] fileName) { + public static string[] readFile(string fileName) { return Tokenizer.readFile(fileName, ","); } } --- a/src/abagames/util/vector.d +++ b/src/abagames/util/vector.d @@ -7,6 +7,7 @@ private import std.math; private import std.string; +private import std.conv; /** * Vector. @@ -197,8 +198,8 @@ return false; }*/ - public char[] toString() { - return "(" ~ std.string.toString(x) ~ ", " ~ std.string.toString(y) ~ ")"; + public override string toString() { + return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; } } --- a/src/abagames/tt/enemy.d +++ b/src/abagames/tt/enemy.d @@ -57,11 +57,8 @@ bool passed; EnemyPool passedEnemies; - public static this() { - rand = new Rand; - } - public static void setRandSeed(long seed) { + if (rand is null) rand = new Rand; rand.setSeed(seed); } --- a/src/abagames/util/bulletml/bullet.d +++ b/src/abagames/util/bulletml/bullet.d @@ -28,11 +28,8 @@ BulletMLRunner* runner; float _rank; - public static this() { - rand = new Rand; - } - public static void setRandSeed(long s) { + if (rand is null) rand = new Rand; rand.setSeed(s); } --- a/src/abagames/tt/bulletactorpool.d +++ b/src/abagames/tt/bulletactorpool.d @@ -112,7 +112,7 @@ cnt++; } - public void draw() { + public override void draw() { foreach (BulletActor ba; actor) if (ba.exists) ba.draw(); debian/patches/save-score-444372.patch0000644000000000000000000000205212164044313014447 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. # Save score when quitting using escape. Fixes #444372. Index: torus-trooper-0.22.dfsg1/src/abagames/tt/gamemanager.d =================================================================== --- torus-trooper-0.22.dfsg1.orig/src/abagames/tt/gamemanager.d 2007-10-02 23:05:33.000000000 +0200 +++ torus-trooper-0.22.dfsg1/src/abagames/tt/gamemanager.d 2007-10-02 23:07:56.000000000 +0200 @@ -172,6 +172,7 @@ if (!escPressed) { escPressed = true; if (state == inGameState) { + inGameState.endGame(); startTitle(); } else { mainLoop.breakLoop(); @@ -524,6 +525,13 @@ public ReplayData replayData() { return _replayData; } + + public void endGame() { + if (!ship.isGameOver) { + ship.isGameOver = true; + prefManager.prefData.recordResult(cast(int) stageManager.level, score); + } + } } public class TitleState: GameState { debian/patches/imports.patch0000644000000000000000000013763412164044313013347 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,20 +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_Version.d +++ /dev/null @@ -1,75 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - 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 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@devolution.com -*/ - -/* This header defines the current SDL version */ - -import SDL_types; - -extern(C): - -/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL -*/ -const uint SDL_MAJOR_VERSION = 1; -const uint SDL_MINOR_VERSION = 2; -const uint SDL_PATCHLEVEL = 6; - -struct SDL_version { - Uint8 major; - Uint8 minor; - Uint8 patch; -} - -/* This macro can be used to fill a version structure with the compile-time - * version of the SDL library. - */ -void SDL_VERSION(SDL_version* X) -{ - X.major = SDL_MAJOR_VERSION; - X.minor = SDL_MINOR_VERSION; - X.patch = SDL_PATCHLEVEL; -} - -/* This macro turns the version numbers into a numeric value: - (1,2,3) -> (1203) - This assumes that there will never be more than 100 patchlevels -*/ -uint SDL_VERSIONNUM(Uint8 X, Uint8 Y, Uint8 Z) -{ - return X * 1000 + Y * 100 + Z; -} - -/* This is the version number macro for the current SDL version */ -const uint SDL_COMPILEDVERSION = SDL_MAJOR_VERSION * 1000 + - SDL_MINOR_VERSION * 100 + - 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) -{ - return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); -} - -/* This function gets the version of the dynamically linked SDL library. - it should NOT be used to fill a version structure, instead you should - use the SDL_Version() macro. - */ -SDL_version * SDL_Linked_Version(); --- 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) { --- 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 = cast(uint) -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_keyboard.d +++ b/import/SDL_keyboard.d @@ -26,7 +26,7 @@ // !!! A hack! struct SDL_keysym is defined in this module, // !!! so we need to resolve the nameclash... // !!! Definitely won't work on *NIX but for now will do. -import SDL_Keysym; +import SDL_keysym_; extern(C): --- 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/11/10 13:45:22 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_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_syswm.d +++ b/import/SDL_syswm.d @@ -22,7 +22,7 @@ /* Include file for SDL custom system window manager hooks */ -import SDL_Version; +import SDL_version_; extern(C): --- 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_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 ****/ --- /dev/null +++ b/import/SDL_keysym_.d @@ -0,0 +1,308 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +/* What we really want is a mapping of every raw key on the keyboard. + To support international keyboards, we use the range 0xA1 - 0xFF + as international virtual keycodes. We'll follow in the footsteps of X11... + The names of the keys + */ + +alias int SDLKey; +enum { + /* The keyboard syms have been cleverly chosen to map to ASCII */ + SDLK_UNKNOWN = 0, + SDLK_FIRST = 0, + SDLK_BACKSPACE = 8, + SDLK_TAB = 9, + SDLK_CLEAR = 12, + SDLK_RETURN = 13, + SDLK_PAUSE = 19, + SDLK_ESCAPE = 27, + SDLK_SPACE = 32, + SDLK_EXCLAIM = 33, + SDLK_QUOTEDBL = 34, + SDLK_HASH = 35, + SDLK_DOLLAR = 36, + SDLK_AMPERSAND = 38, + SDLK_QUOTE = 39, + SDLK_LEFTPAREN = 40, + SDLK_RIGHTPAREN = 41, + SDLK_ASTERISK = 42, + SDLK_PLUS = 43, + SDLK_COMMA = 44, + SDLK_MINUS = 45, + SDLK_PERIOD = 46, + SDLK_SLASH = 47, + SDLK_0 = 48, + SDLK_1 = 49, + SDLK_2 = 50, + SDLK_3 = 51, + SDLK_4 = 52, + SDLK_5 = 53, + SDLK_6 = 54, + SDLK_7 = 55, + SDLK_8 = 56, + SDLK_9 = 57, + SDLK_COLON = 58, + SDLK_SEMICOLON = 59, + SDLK_LESS = 60, + SDLK_EQUALS = 61, + SDLK_GREATER = 62, + SDLK_QUESTION = 63, + SDLK_AT = 64, + /* + Skip uppercase letters + */ + SDLK_LEFTBRACKET = 91, + SDLK_BACKSLASH = 92, + SDLK_RIGHTBRACKET = 93, + SDLK_CARET = 94, + SDLK_UNDERSCORE = 95, + SDLK_BACKQUOTE = 96, + SDLK_a = 97, + SDLK_b = 98, + SDLK_c = 99, + SDLK_d = 100, + SDLK_e = 101, + SDLK_f = 102, + SDLK_g = 103, + SDLK_h = 104, + SDLK_i = 105, + SDLK_j = 106, + SDLK_k = 107, + SDLK_l = 108, + SDLK_m = 109, + SDLK_n = 110, + SDLK_o = 111, + SDLK_p = 112, + SDLK_q = 113, + SDLK_r = 114, + SDLK_s = 115, + SDLK_t = 116, + SDLK_u = 117, + SDLK_v = 118, + SDLK_w = 119, + SDLK_x = 120, + SDLK_y = 121, + SDLK_z = 122, + SDLK_DELETE = 127, + /* End of ASCII mapped keysyms */ + + /* International keyboard syms */ + SDLK_WORLD_0 = 160, /* 0xA0 */ + SDLK_WORLD_1 = 161, + SDLK_WORLD_2 = 162, + SDLK_WORLD_3 = 163, + SDLK_WORLD_4 = 164, + SDLK_WORLD_5 = 165, + SDLK_WORLD_6 = 166, + SDLK_WORLD_7 = 167, + SDLK_WORLD_8 = 168, + SDLK_WORLD_9 = 169, + SDLK_WORLD_10 = 170, + SDLK_WORLD_11 = 171, + SDLK_WORLD_12 = 172, + SDLK_WORLD_13 = 173, + SDLK_WORLD_14 = 174, + SDLK_WORLD_15 = 175, + SDLK_WORLD_16 = 176, + SDLK_WORLD_17 = 177, + SDLK_WORLD_18 = 178, + SDLK_WORLD_19 = 179, + SDLK_WORLD_20 = 180, + SDLK_WORLD_21 = 181, + SDLK_WORLD_22 = 182, + SDLK_WORLD_23 = 183, + SDLK_WORLD_24 = 184, + SDLK_WORLD_25 = 185, + SDLK_WORLD_26 = 186, + SDLK_WORLD_27 = 187, + SDLK_WORLD_28 = 188, + SDLK_WORLD_29 = 189, + SDLK_WORLD_30 = 190, + SDLK_WORLD_31 = 191, + SDLK_WORLD_32 = 192, + SDLK_WORLD_33 = 193, + SDLK_WORLD_34 = 194, + SDLK_WORLD_35 = 195, + SDLK_WORLD_36 = 196, + SDLK_WORLD_37 = 197, + SDLK_WORLD_38 = 198, + SDLK_WORLD_39 = 199, + SDLK_WORLD_40 = 200, + SDLK_WORLD_41 = 201, + SDLK_WORLD_42 = 202, + SDLK_WORLD_43 = 203, + SDLK_WORLD_44 = 204, + SDLK_WORLD_45 = 205, + SDLK_WORLD_46 = 206, + SDLK_WORLD_47 = 207, + SDLK_WORLD_48 = 208, + SDLK_WORLD_49 = 209, + SDLK_WORLD_50 = 210, + SDLK_WORLD_51 = 211, + SDLK_WORLD_52 = 212, + SDLK_WORLD_53 = 213, + SDLK_WORLD_54 = 214, + SDLK_WORLD_55 = 215, + SDLK_WORLD_56 = 216, + SDLK_WORLD_57 = 217, + SDLK_WORLD_58 = 218, + SDLK_WORLD_59 = 219, + SDLK_WORLD_60 = 220, + SDLK_WORLD_61 = 221, + SDLK_WORLD_62 = 222, + SDLK_WORLD_63 = 223, + SDLK_WORLD_64 = 224, + SDLK_WORLD_65 = 225, + SDLK_WORLD_66 = 226, + SDLK_WORLD_67 = 227, + SDLK_WORLD_68 = 228, + SDLK_WORLD_69 = 229, + SDLK_WORLD_70 = 230, + SDLK_WORLD_71 = 231, + SDLK_WORLD_72 = 232, + SDLK_WORLD_73 = 233, + SDLK_WORLD_74 = 234, + SDLK_WORLD_75 = 235, + SDLK_WORLD_76 = 236, + SDLK_WORLD_77 = 237, + SDLK_WORLD_78 = 238, + SDLK_WORLD_79 = 239, + SDLK_WORLD_80 = 240, + SDLK_WORLD_81 = 241, + SDLK_WORLD_82 = 242, + SDLK_WORLD_83 = 243, + SDLK_WORLD_84 = 244, + SDLK_WORLD_85 = 245, + SDLK_WORLD_86 = 246, + SDLK_WORLD_87 = 247, + SDLK_WORLD_88 = 248, + SDLK_WORLD_89 = 249, + SDLK_WORLD_90 = 250, + SDLK_WORLD_91 = 251, + SDLK_WORLD_92 = 252, + SDLK_WORLD_93 = 253, + SDLK_WORLD_94 = 254, + SDLK_WORLD_95 = 255, /* 0xFF */ + + /* Numeric keypad */ + SDLK_KP0 = 256, + SDLK_KP1 = 257, + SDLK_KP2 = 258, + SDLK_KP3 = 259, + SDLK_KP4 = 260, + SDLK_KP5 = 261, + SDLK_KP6 = 262, + SDLK_KP7 = 263, + SDLK_KP8 = 264, + SDLK_KP9 = 265, + SDLK_KP_PERIOD = 266, + SDLK_KP_DIVIDE = 267, + SDLK_KP_MULTIPLY = 268, + SDLK_KP_MINUS = 269, + SDLK_KP_PLUS = 270, + SDLK_KP_ENTER = 271, + SDLK_KP_EQUALS = 272, + + /* Arrows + Home/End pad */ + SDLK_UP = 273, + SDLK_DOWN = 274, + SDLK_RIGHT = 275, + SDLK_LEFT = 276, + SDLK_INSERT = 277, + SDLK_HOME = 278, + SDLK_END = 279, + SDLK_PAGEUP = 280, + SDLK_PAGEDOWN = 281, + + /* Function keys */ + SDLK_F1 = 282, + SDLK_F2 = 283, + SDLK_F3 = 284, + SDLK_F4 = 285, + SDLK_F5 = 286, + SDLK_F6 = 287, + SDLK_F7 = 288, + SDLK_F8 = 289, + SDLK_F9 = 290, + SDLK_F10 = 291, + SDLK_F11 = 292, + SDLK_F12 = 293, + SDLK_F13 = 294, + SDLK_F14 = 295, + SDLK_F15 = 296, + + /* Key state modifier keys */ + SDLK_NUMLOCK = 300, + SDLK_CAPSLOCK = 301, + SDLK_SCROLLOCK = 302, + SDLK_RSHIFT = 303, + SDLK_LSHIFT = 304, + SDLK_RCTRL = 305, + SDLK_LCTRL = 306, + SDLK_RALT = 307, + SDLK_LALT = 308, + SDLK_RMETA = 309, + SDLK_LMETA = 310, + SDLK_LSUPER = 311, /* Left "Windows" key */ + SDLK_RSUPER = 312, /* Right "Windows" key */ + SDLK_MODE = 313, /* "Alt Gr" key */ + SDLK_COMPOSE = 314, /* Multi-key compose key */ + + /* Miscellaneous function keys */ + SDLK_HELP = 315, + SDLK_PRINT = 316, + SDLK_SYSREQ = 317, + SDLK_BREAK = 318, + SDLK_MENU = 319, + SDLK_POWER = 320, /* Power Macintosh power key */ + SDLK_EURO = 321, /* Some european keyboards */ + SDLK_UNDO = 322, /* Atari keyboard has Undo */ + + /* Add any other keys here */ + + SDLK_LAST +} + +/* Enumeration of valid key mods (possibly OR'd together) */ +alias int SDLMod; +enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000 +} + +const uint KMOD_CTRL = (KMOD_LCTRL|KMOD_RCTRL); +const uint KMOD_SHIFT = (KMOD_LSHIFT|KMOD_RSHIFT); +const uint KMOD_ALT = (KMOD_LALT|KMOD_RALT); +const uint KMOD_META = (KMOD_LMETA|KMOD_RMETA); --- /dev/null +++ b/import/SDL_version_.d @@ -0,0 +1,75 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +/* This header defines the current SDL version */ + +import SDL_types; + +extern(C): + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +const uint SDL_MAJOR_VERSION = 1; +const uint SDL_MINOR_VERSION = 2; +const uint SDL_PATCHLEVEL = 6; + +struct SDL_version { + Uint8 major; + Uint8 minor; + Uint8 patch; +} + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL library. + */ +void SDL_VERSION(SDL_version* X) +{ + X.major = SDL_MAJOR_VERSION; + X.minor = SDL_MINOR_VERSION; + X.patch = SDL_PATCHLEVEL; +} + +/* This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels +*/ +uint SDL_VERSIONNUM(Uint8 X, Uint8 Y, Uint8 Z) +{ + return X * 1000 + Y * 100 + Z; +} + +/* This is the version number macro for the current SDL version */ +const uint SDL_COMPILEDVERSION = SDL_MAJOR_VERSION * 1000 + + SDL_MINOR_VERSION * 100 + + SDL_PATCHLEVEL; + +/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ +bool SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) +{ + return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); +} + +/* This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. + */ +SDL_version * SDL_Linked_Version(); --- a/import/SDL_Keysym.d +++ /dev/null @@ -1,308 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - 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 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@devolution.com -*/ - -/* What we really want is a mapping of every raw key on the keyboard. - To support international keyboards, we use the range 0xA1 - 0xFF - as international virtual keycodes. We'll follow in the footsteps of X11... - The names of the keys - */ - -alias int SDLKey; -enum { - /* The keyboard syms have been cleverly chosen to map to ASCII */ - SDLK_UNKNOWN = 0, - SDLK_FIRST = 0, - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_SPACE = 32, - SDLK_EXCLAIM = 33, - SDLK_QUOTEDBL = 34, - SDLK_HASH = 35, - SDLK_DOLLAR = 36, - SDLK_AMPERSAND = 38, - SDLK_QUOTE = 39, - SDLK_LEFTPAREN = 40, - SDLK_RIGHTPAREN = 41, - SDLK_ASTERISK = 42, - SDLK_PLUS = 43, - SDLK_COMMA = 44, - SDLK_MINUS = 45, - SDLK_PERIOD = 46, - SDLK_SLASH = 47, - SDLK_0 = 48, - SDLK_1 = 49, - SDLK_2 = 50, - SDLK_3 = 51, - SDLK_4 = 52, - SDLK_5 = 53, - SDLK_6 = 54, - SDLK_7 = 55, - SDLK_8 = 56, - SDLK_9 = 57, - SDLK_COLON = 58, - SDLK_SEMICOLON = 59, - SDLK_LESS = 60, - SDLK_EQUALS = 61, - SDLK_GREATER = 62, - SDLK_QUESTION = 63, - SDLK_AT = 64, - /* - Skip uppercase letters - */ - SDLK_LEFTBRACKET = 91, - SDLK_BACKSLASH = 92, - SDLK_RIGHTBRACKET = 93, - SDLK_CARET = 94, - SDLK_UNDERSCORE = 95, - SDLK_BACKQUOTE = 96, - SDLK_a = 97, - SDLK_b = 98, - SDLK_c = 99, - SDLK_d = 100, - SDLK_e = 101, - SDLK_f = 102, - SDLK_g = 103, - SDLK_h = 104, - SDLK_i = 105, - SDLK_j = 106, - SDLK_k = 107, - SDLK_l = 108, - SDLK_m = 109, - SDLK_n = 110, - SDLK_o = 111, - SDLK_p = 112, - SDLK_q = 113, - SDLK_r = 114, - SDLK_s = 115, - SDLK_t = 116, - SDLK_u = 117, - SDLK_v = 118, - SDLK_w = 119, - SDLK_x = 120, - SDLK_y = 121, - SDLK_z = 122, - SDLK_DELETE = 127, - /* End of ASCII mapped keysyms */ - - /* International keyboard syms */ - SDLK_WORLD_0 = 160, /* 0xA0 */ - SDLK_WORLD_1 = 161, - SDLK_WORLD_2 = 162, - SDLK_WORLD_3 = 163, - SDLK_WORLD_4 = 164, - SDLK_WORLD_5 = 165, - SDLK_WORLD_6 = 166, - SDLK_WORLD_7 = 167, - SDLK_WORLD_8 = 168, - SDLK_WORLD_9 = 169, - SDLK_WORLD_10 = 170, - SDLK_WORLD_11 = 171, - SDLK_WORLD_12 = 172, - SDLK_WORLD_13 = 173, - SDLK_WORLD_14 = 174, - SDLK_WORLD_15 = 175, - SDLK_WORLD_16 = 176, - SDLK_WORLD_17 = 177, - SDLK_WORLD_18 = 178, - SDLK_WORLD_19 = 179, - SDLK_WORLD_20 = 180, - SDLK_WORLD_21 = 181, - SDLK_WORLD_22 = 182, - SDLK_WORLD_23 = 183, - SDLK_WORLD_24 = 184, - SDLK_WORLD_25 = 185, - SDLK_WORLD_26 = 186, - SDLK_WORLD_27 = 187, - SDLK_WORLD_28 = 188, - SDLK_WORLD_29 = 189, - SDLK_WORLD_30 = 190, - SDLK_WORLD_31 = 191, - SDLK_WORLD_32 = 192, - SDLK_WORLD_33 = 193, - SDLK_WORLD_34 = 194, - SDLK_WORLD_35 = 195, - SDLK_WORLD_36 = 196, - SDLK_WORLD_37 = 197, - SDLK_WORLD_38 = 198, - SDLK_WORLD_39 = 199, - SDLK_WORLD_40 = 200, - SDLK_WORLD_41 = 201, - SDLK_WORLD_42 = 202, - SDLK_WORLD_43 = 203, - SDLK_WORLD_44 = 204, - SDLK_WORLD_45 = 205, - SDLK_WORLD_46 = 206, - SDLK_WORLD_47 = 207, - SDLK_WORLD_48 = 208, - SDLK_WORLD_49 = 209, - SDLK_WORLD_50 = 210, - SDLK_WORLD_51 = 211, - SDLK_WORLD_52 = 212, - SDLK_WORLD_53 = 213, - SDLK_WORLD_54 = 214, - SDLK_WORLD_55 = 215, - SDLK_WORLD_56 = 216, - SDLK_WORLD_57 = 217, - SDLK_WORLD_58 = 218, - SDLK_WORLD_59 = 219, - SDLK_WORLD_60 = 220, - SDLK_WORLD_61 = 221, - SDLK_WORLD_62 = 222, - SDLK_WORLD_63 = 223, - SDLK_WORLD_64 = 224, - SDLK_WORLD_65 = 225, - SDLK_WORLD_66 = 226, - SDLK_WORLD_67 = 227, - SDLK_WORLD_68 = 228, - SDLK_WORLD_69 = 229, - SDLK_WORLD_70 = 230, - SDLK_WORLD_71 = 231, - SDLK_WORLD_72 = 232, - SDLK_WORLD_73 = 233, - SDLK_WORLD_74 = 234, - SDLK_WORLD_75 = 235, - SDLK_WORLD_76 = 236, - SDLK_WORLD_77 = 237, - SDLK_WORLD_78 = 238, - SDLK_WORLD_79 = 239, - SDLK_WORLD_80 = 240, - SDLK_WORLD_81 = 241, - SDLK_WORLD_82 = 242, - SDLK_WORLD_83 = 243, - SDLK_WORLD_84 = 244, - SDLK_WORLD_85 = 245, - SDLK_WORLD_86 = 246, - SDLK_WORLD_87 = 247, - SDLK_WORLD_88 = 248, - SDLK_WORLD_89 = 249, - SDLK_WORLD_90 = 250, - SDLK_WORLD_91 = 251, - SDLK_WORLD_92 = 252, - SDLK_WORLD_93 = 253, - SDLK_WORLD_94 = 254, - SDLK_WORLD_95 = 255, /* 0xFF */ - - /* Numeric keypad */ - SDLK_KP0 = 256, - SDLK_KP1 = 257, - SDLK_KP2 = 258, - SDLK_KP3 = 259, - SDLK_KP4 = 260, - SDLK_KP5 = 261, - SDLK_KP6 = 262, - SDLK_KP7 = 263, - SDLK_KP8 = 264, - SDLK_KP9 = 265, - SDLK_KP_PERIOD = 266, - SDLK_KP_DIVIDE = 267, - SDLK_KP_MULTIPLY = 268, - SDLK_KP_MINUS = 269, - SDLK_KP_PLUS = 270, - SDLK_KP_ENTER = 271, - SDLK_KP_EQUALS = 272, - - /* Arrows + Home/End pad */ - SDLK_UP = 273, - SDLK_DOWN = 274, - SDLK_RIGHT = 275, - SDLK_LEFT = 276, - SDLK_INSERT = 277, - SDLK_HOME = 278, - SDLK_END = 279, - SDLK_PAGEUP = 280, - SDLK_PAGEDOWN = 281, - - /* Function keys */ - SDLK_F1 = 282, - SDLK_F2 = 283, - SDLK_F3 = 284, - SDLK_F4 = 285, - SDLK_F5 = 286, - SDLK_F6 = 287, - SDLK_F7 = 288, - SDLK_F8 = 289, - SDLK_F9 = 290, - SDLK_F10 = 291, - SDLK_F11 = 292, - SDLK_F12 = 293, - SDLK_F13 = 294, - SDLK_F14 = 295, - SDLK_F15 = 296, - - /* Key state modifier keys */ - SDLK_NUMLOCK = 300, - SDLK_CAPSLOCK = 301, - SDLK_SCROLLOCK = 302, - SDLK_RSHIFT = 303, - SDLK_LSHIFT = 304, - SDLK_RCTRL = 305, - SDLK_LCTRL = 306, - SDLK_RALT = 307, - SDLK_LALT = 308, - SDLK_RMETA = 309, - SDLK_LMETA = 310, - SDLK_LSUPER = 311, /* Left "Windows" key */ - SDLK_RSUPER = 312, /* Right "Windows" key */ - SDLK_MODE = 313, /* "Alt Gr" key */ - SDLK_COMPOSE = 314, /* Multi-key compose key */ - - /* Miscellaneous function keys */ - SDLK_HELP = 315, - SDLK_PRINT = 316, - SDLK_SYSREQ = 317, - SDLK_BREAK = 318, - SDLK_MENU = 319, - SDLK_POWER = 320, /* Power Macintosh power key */ - SDLK_EURO = 321, /* Some european keyboards */ - SDLK_UNDO = 322, /* Atari keyboard has Undo */ - - /* Add any other keys here */ - - SDLK_LAST -} - -/* Enumeration of valid key mods (possibly OR'd together) */ -alias int SDLMod; -enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT= 0x0001, - KMOD_RSHIFT= 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LMETA = 0x0400, - KMOD_RMETA = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} - -const uint KMOD_CTRL = (KMOD_LCTRL|KMOD_RCTRL); -const uint KMOD_SHIFT = (KMOD_LSHIFT|KMOD_RSHIFT); -const uint KMOD_ALT = (KMOD_LALT|KMOD_RALT); -const uint KMOD_META = (KMOD_LMETA|KMOD_RMETA); debian/patches/fixes.patch0000644000000000000000000001136712164044313012762 0ustar # Copyright (C) 2007 Marcel Unbehaun # 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 -name '*.d' | sort) +EXE=torus-trooper + +all: $(EXE) + +$(EXE): $(DSRC) + $(GDC) -o $@ $^ -Iimport -Isrc -Wno-deprecated $(DFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -lSDL -lGL -lGLU -lSDL_mixer -lbulletml + +clean: + rm -f $(EXE) --- 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; /** @@ -56,28 +56,28 @@ public static void info(char[] msg, bool nline = true) { if (nline) - stderr.writeLine(msg); + derr.writeLine(msg); else - stderr.writeString(msg); + derr.writeString(msg); } public static void info(double n, bool nline = true) { if (nline) - stderr.writeLine(std.string.toString(n)); + derr.writeLine(std.string.toString(n)); else - stderr.writeString(std.string.toString(n) ~ " "); + derr.writeString(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/util/sdl/luminous.d +++ b/src/abagames/util/sdl/luminous.d @@ -9,6 +9,7 @@ private import std.string; private import opengl; private import abagames.util.actor; +import std.c.string; /** * Luminous effect texture. @@ -30,7 +31,7 @@ } private void makeLuminousTexture() { - uint *data = td; + uint *data = td.ptr; int i; memset(data, 0, luminousTextureWidth * luminousTextureHeight * 4 * uint.sizeof); glGenTextures(1, &luminousTexture); --- a/src/abagames/tt/barrage.d +++ b/src/abagames/tt/barrage.d @@ -98,6 +98,7 @@ public static void load() { char[][] dirs = listdir(BARRAGE_DIR_NAME); foreach (char[] dirName; dirs) { + parser[dirName] = null; char[][] files = listdir(BARRAGE_DIR_NAME ~ "/" ~ dirName); foreach (char[] fileName; files) { if (getExt(fileName) != "xml") --- a/src/abagames/tt/camera.d +++ b/src/abagames/tt/camera.d @@ -155,10 +155,10 @@ moveCnt--; if (moveCnt < 0) { moveCnt = 15 + rand.nextInt(15); - float lox = fabs(_lookAtPos.x - _cameraPos.x); - if (lox > PI) - lox = PI * 2 - lox; - float ofs = lox * 3 + fabs(_lookAtPos.y - _cameraPos.y); + float newlox = fabs(_lookAtPos.x - _cameraPos.x); + if (newlox > PI) + newlox = PI * 2 - newlox; + float ofs = newlox * 3 + fabs(_lookAtPos.y - _cameraPos.y); zoomTrg = 3.0f / ofs; if (zoomTrg < zoomMin) zoomTrg = zoomMin; --- a/src/abagames/tt/shape.d +++ b/src/abagames/tt/shape.d @@ -248,21 +248,23 @@ float wingD1, float wingD2, int color, int shp, int divNum, int rev, bool damaged = false) { Structure[] sts; - Structure st = new Structure; - st.pos.x = ox; - st.pos.y = oy; - st.d1 = st.d2 = 0; - st.width = rocketLength * 0.15; - st.height = rocketLength; - st.shape = Structure.Shape.ROCKET; - st.shapeXReverse = 1; - if (!damaged) - st.color = 1; - else - st.color = 0; - if (rev == -1) - st.pos.x *= -1; - sts ~= st; + { + Structure st = new Structure; + st.pos.x = ox; + st.pos.y = oy; + st.d1 = st.d2 = 0; + st.width = rocketLength * 0.15; + st.height = rocketLength; + st.shape = Structure.Shape.ROCKET; + st.shapeXReverse = 1; + if (!damaged) + st.color = 1; + else + st.color = 0; + if (rev == -1) + st.pos.x *= -1; + sts ~= st; + } float wofs = offset; float whgt = rocketLength * (rand.nextFloat(0.5) + 1.5); for (int i = 0; i < wingNum; i++) { --- a/src/abagames/util/rand.d +++ b/src/abagames/util/rand.d @@ -165,14 +165,14 @@ void next_state() { - uint *p=state; + uint *p=state.ptr; /* if init_genrand() has not been called, */ /* a default initial seed is used */ if (initf==0) init_genrand(5489UL); left = N; - next = state; + next = state.ptr; for (int j=N-M+1; --j; p++) *p = p[M] ^ TWIST(p[0], p[1]); debian/torus-trooper.manpages0000644000000000000000000000002712164044313013544 0ustar debian/torus-trooper.6