summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2012-01-08 15:52:12 +0000
committerwiz <wiz@pkgsrc.org>2012-01-08 15:52:12 +0000
commitd0d4c5ccc0089fb4f882fb8e74e169aefce48486 (patch)
treec32f594f80aedb5a5e5f202ff5eb73a09d12aa5b
parent21eee97e523ee56050328529fb28ef716a2a8b86 (diff)
downloadpkgsrc-d0d4c5ccc0089fb4f882fb8e74e169aefce48486.tar.gz
Initial import of xu4-1.0beta3:
XU4 is a remake of the computer game Ultima IV. The goal is to make it easy and convenient to play this classic on modern operating systems. XU4 is primarily inspired by the much more ambitious project Exult. XU4 isn't a new game based on the Ultima IV story -- it is a faithful recreation of the old game, right up to the crappy graphics. If you are looking for a game with modern gameplay and graphics, this is not it -- yet. New features that improve the gameplay and keep with the spirit of the original game will be added. XU4 also tries to maintain strict compatibility with the original for its savegame files. You can use a game saved in XU4 with the original and vice versa, at least in theory.
-rw-r--r--games/xu4/DESCR14
-rw-r--r--games/xu4/MESSAGE8
-rw-r--r--games/xu4/Makefile38
-rw-r--r--games/xu4/PLIST78
-rw-r--r--games/xu4/distinfo28
-rw-r--r--games/xu4/patches/patch-src_Makefile72
-rw-r--r--games/xu4/patches/patch-src_armor.cpp14
-rw-r--r--games/xu4/patches/patch-src_codex.cpp14
-rw-r--r--games/xu4/patches/patch-src_conversation.cpp14
-rw-r--r--games/xu4/patches/patch-src_creature.cpp14
-rw-r--r--games/xu4/patches/patch-src_dialogueloader.cpp14
-rw-r--r--games/xu4/patches/patch-src_dialogueloader__tlk.cpp14
-rw-r--r--games/xu4/patches/patch-src_direction.cpp14
-rw-r--r--games/xu4/patches/patch-src_imageloader.cpp14
-rw-r--r--games/xu4/patches/patch-src_imageloader__png.cpp15
-rw-r--r--games/xu4/patches/patch-src_imagemgr.h15
-rw-r--r--games/xu4/patches/patch-src_intro.cpp14
-rw-r--r--games/xu4/patches/patch-src_item.cpp146
-rw-r--r--games/xu4/patches/patch-src_lzw_u6decode.cpp14
-rw-r--r--games/xu4/patches/patch-src_person.cpp14
-rw-r--r--games/xu4/patches/patch-src_savegame.cpp14
-rw-r--r--games/xu4/patches/patch-src_screen.cpp14
-rw-r--r--games/xu4/patches/patch-src_settings.cpp14
-rw-r--r--games/xu4/patches/patch-src_spell.cpp14
-rw-r--r--games/xu4/patches/patch-src_stats.cpp14
-rw-r--r--games/xu4/patches/patch-src_textview.cpp14
-rw-r--r--games/xu4/patches/patch-src_u4file.cpp14
-rw-r--r--games/xu4/patches/patch-src_weapon.cpp14
28 files changed, 680 insertions, 0 deletions
diff --git a/games/xu4/DESCR b/games/xu4/DESCR
new file mode 100644
index 00000000000..72ed3a8a5f6
--- /dev/null
+++ b/games/xu4/DESCR
@@ -0,0 +1,14 @@
+XU4 is a remake of the computer game Ultima IV. The goal is to make
+it easy and convenient to play this classic on modern operating
+systems. XU4 is primarily inspired by the much more ambitious project
+Exult.
+
+XU4 isn't a new game based on the Ultima IV story -- it is a faithful
+recreation of the old game, right up to the crappy graphics. If you
+are looking for a game with modern gameplay and graphics, this is not
+it -- yet. New features that improve the gameplay and keep with the
+spirit of the original game will be added.
+
+XU4 also tries to maintain strict compatibility with the original for
+its savegame files. You can use a game saved in XU4 with the original
+and vice versa, at least in theory.
diff --git a/games/xu4/MESSAGE b/games/xu4/MESSAGE
new file mode 100644
index 00000000000..b2b27e8561d
--- /dev/null
+++ b/games/xu4/MESSAGE
@@ -0,0 +1,8 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+xu4 needs the original Ultima IV data files.
+The package ultima4-data provides them, but is not a dependency
+due to licensing reasons.
+
+===========================================================================
diff --git a/games/xu4/Makefile b/games/xu4/Makefile
new file mode 100644
index 00000000000..29ccaca1485
--- /dev/null
+++ b/games/xu4/Makefile
@@ -0,0 +1,38 @@
+# $NetBSD: Makefile,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+#
+
+DISTNAME= xu4-1.0beta3
+CATEGORIES= games
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=xu4/}
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://xu4.sourceforge.net/
+COMMENT= Remake of Ultima IV
+LICENSE= gnu-gpl-v2
+
+DEPENDS+= timidity-[0-9]*:../../audio/timidity
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+WRKSRC= ${WRKDIR}/u4
+CONFIGURE_DIRS= src
+USE_LANGUAGES= c c++
+USE_TOOLS+= gmake
+
+INSTALLATION_DIRS= share/doc/xu4
+
+SUBST_CLASSES+= prefix
+SUBST_SED.prefix= -e "s,/usr/local,${PREFIX},"
+SUBST_FILES.prefix= src/u4file.cpp README
+SUBST_STAGE.prefix= pre-build
+SUBST_MESSAGE.prefix= Fixing path to installed files.
+
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/xu4
+
+.include "../../audio/SDL_mixer/buildlink3.mk"
+.include "../../devel/SDL/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../textproc/libxml2/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/games/xu4/PLIST b/games/xu4/PLIST
new file mode 100644
index 00000000000..77d1c6e7173
--- /dev/null
+++ b/games/xu4/PLIST
@@ -0,0 +1,78 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+bin/u4
+lib/u4/armors.xml
+lib/u4/config.xml
+lib/u4/creatures.xml
+lib/u4/dtd/armors.dtd
+lib/u4/dtd/color.dtd
+lib/u4/dtd/common.dtd
+lib/u4/dtd/config.dtd
+lib/u4/dtd/constraint.dtd
+lib/u4/dtd/creatures.dtd
+lib/u4/dtd/egaPalette.dtd
+lib/u4/dtd/graphics.dtd
+lib/u4/dtd/maps.dtd
+lib/u4/dtd/tileRules.dtd
+lib/u4/dtd/tilemap.dtd
+lib/u4/dtd/tileset.dtd
+lib/u4/dtd/tilesets.dtd
+lib/u4/dtd/weapons.dtd
+lib/u4/dumpsavegame
+lib/u4/egaPalette.xml
+lib/u4/graphics.xml
+lib/u4/graphics/ega/dung0ma.png
+lib/u4/graphics/ega/dung0ma_door.png
+lib/u4/graphics/ega/dung1ma_door.png
+lib/u4/graphics/ega/dung2ma_door.png
+lib/u4/graphics/ega/dung3ma_door.png
+lib/u4/graphics/ega/dungeonhall.png
+lib/u4/graphics/ega/dungeonhall_door.png
+lib/u4/graphics/ega/gem.png
+lib/u4/graphics/ega/ladderdown0.png
+lib/u4/graphics/ega/ladderdown1.png
+lib/u4/graphics/ega/ladderdown2.png
+lib/u4/graphics/ega/ladderdown3.png
+lib/u4/graphics/ega/ladderup0.png
+lib/u4/graphics/ega/ladderup1.png
+lib/u4/graphics/ega/ladderup2.png
+lib/u4/graphics/ega/ladderup3.png
+lib/u4/graphics/ega/ladderupdown0.png
+lib/u4/graphics/ega/ladderupdown1.png
+lib/u4/graphics/ega/ladderupdown2.png
+lib/u4/graphics/ega/ladderupdown3.png
+lib/u4/graphics/vga/dungeonhall.png
+lib/u4/graphics/vga/dungeonhall_door.png
+lib/u4/graphics/vga/gem.png
+lib/u4/graphics/vga/tile_guard.png
+lib/u4/maps.xml
+lib/u4/music.xml
+lib/u4/music/Castles.mid
+lib/u4/music/Combat.mid
+lib/u4/music/Dungeon.mid
+lib/u4/music/Fanfare_Of_Lord_British.mid
+lib/u4/music/Rule_Britannia.mid
+lib/u4/music/Shopping.mid
+lib/u4/music/Shrines.mid
+lib/u4/music/Towns.mid
+lib/u4/music/Wanderer.mid
+lib/u4/sound.xml
+lib/u4/sound/blocked.wav
+lib/u4/sound/flee.wav
+lib/u4/sound/magic.ogg
+lib/u4/sound/moongate.ogg
+lib/u4/sound/walk.wav
+lib/u4/tileRules.xml
+lib/u4/tilemap-base.xml
+lib/u4/tilemap-dungeon.xml
+lib/u4/tileset-base.xml
+lib/u4/tileset-dungeon.xml
+lib/u4/tilesets.xml
+lib/u4/tlkconv
+lib/u4/u4dec
+lib/u4/u4enc
+lib/u4/vendorScript.xml
+lib/u4/weapons.xml
+share/applications/u4.desktop
+share/doc/xu4/README
+share/pixmaps/u4.bmp
+share/pixmaps/u4.png
diff --git a/games/xu4/distinfo b/games/xu4/distinfo
new file mode 100644
index 00000000000..f90445cea50
--- /dev/null
+++ b/games/xu4/distinfo
@@ -0,0 +1,28 @@
+$NetBSD: distinfo,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+SHA1 (xu4-1.0beta3.tar.gz) = baf1bbdc18088096ae11ea31aa497532b7e7124c
+RMD160 (xu4-1.0beta3.tar.gz) = f758fea4bc3034b19122651cfb725a88e0684960
+Size (xu4-1.0beta3.tar.gz) = 418477 bytes
+SHA1 (patch-src_Makefile) = ac80c253affd3b150a377cd0072db9557c26407b
+SHA1 (patch-src_armor.cpp) = 1cc4ad07efaa70c5764b910d055939e22b4287d5
+SHA1 (patch-src_codex.cpp) = 706aa3a6854b72ae6ada927cc1bd1c71f7c4959e
+SHA1 (patch-src_conversation.cpp) = 15ea5eed4abe11e7afb58359b6cd732b1e84b458
+SHA1 (patch-src_creature.cpp) = 9479f075c95b481bae073011c72672b383a5f7e4
+SHA1 (patch-src_dialogueloader.cpp) = 10b46af20241f6571a7656b577f42dfca39f74cc
+SHA1 (patch-src_dialogueloader__tlk.cpp) = e4f69fc103836a15800b9f76ae742555a686ad34
+SHA1 (patch-src_direction.cpp) = 412950b32b43dbfd7081733c94b4365ee85a3fdd
+SHA1 (patch-src_imageloader.cpp) = 88ed63cb53b5de9d14d940e045752f01a3a5f4b6
+SHA1 (patch-src_imageloader__png.cpp) = e790fac8468d74ff605868c29d8cc8759cb16871
+SHA1 (patch-src_imagemgr.h) = 36b1bd2d750e17b9c403cded9d8787aa6a8a61cd
+SHA1 (patch-src_intro.cpp) = 5330d1bedb8e79750468d9463a016b041b7aa496
+SHA1 (patch-src_item.cpp) = 667498d2c8fcf4c2c35da0d9189d68c9b6a9baf5
+SHA1 (patch-src_lzw_u6decode.cpp) = 1dbf1cb0f24ad9d083f4a7fe666f1503c9647ab6
+SHA1 (patch-src_person.cpp) = b93703514429257ae4665ab7242c5dc1ead18c3c
+SHA1 (patch-src_savegame.cpp) = 6a0b43d29bd26fd2265953588ae82c950d14e6ba
+SHA1 (patch-src_screen.cpp) = bffaf51b9ac63112733d89c0b5e30370a695d45d
+SHA1 (patch-src_settings.cpp) = 6eacdf00c5d85cb848b089933ce9a70817714453
+SHA1 (patch-src_spell.cpp) = 4412c24a2265f41f30b6fdbc4a21ac0a1df8e329
+SHA1 (patch-src_stats.cpp) = da37132d4c710e5dda29b222d27aed84fcd250d1
+SHA1 (patch-src_textview.cpp) = 18da8c99836c4a277c1f674b03f7c77da58f020e
+SHA1 (patch-src_u4file.cpp) = 70d8d1650d0888d56c2d9f720b1d4b715b8502dd
+SHA1 (patch-src_weapon.cpp) = d87690c8ed0b63be171437b2331955284859be97
diff --git a/games/xu4/patches/patch-src_Makefile b/games/xu4/patches/patch-src_Makefile
new file mode 100644
index 00000000000..124b6eb4c06
--- /dev/null
+++ b/games/xu4/patches/patch-src_Makefile
@@ -0,0 +1,72 @@
+$NetBSD: patch-src_Makefile,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add DESTDIR support.
+Remove unportable BACKTRACE default setting.
+Pre-create directories instead of using unportable install -D.
+
+--- src/Makefile.orig 2005-01-14 09:15:17.000000000 +0000
++++ src/Makefile
+@@ -3,5 +3,5 @@
+ #
+
+-prefix=/usr/local
++prefix=${PREFIX}
+ bindir=$(prefix)/bin
+ libdir=$(prefix)/lib
+@@ -12,5 +12,5 @@ UILIBS=$(shell sdl-config --libs) -lSDL_
+ UIFLAGS=$(shell sdl-config --cflags)
+
+-FEATURES=-DHAVE_BACKTRACE=1 -DHAVE_VARIADIC_MACROS=1
++FEATURES=-DHAVE_VARIADIC_MACROS=1
+ DEBUGCXXFLAGS=-ggdb1 -rdynamic
+ CXXFLAGS=$(FEATURES) -Wall -I. $(UIFLAGS) $(shell xml2-config --cflags) -DICON_FILE=\"$(datadir)/pixmaps/u4.bmp\" -DVERSION=\"$(VERSION)\" $(DEBUGCXXFLAGS)
+@@ -26,25 +26,28 @@ include Makefile.common
+
+ install::
+- $(INSTALL) -D $(MAIN) $(bindir)/$(MAIN)
+- $(INSTALL) -D ../icons/u4.bmp $(datadir)/pixmaps/u4.bmp
+- $(INSTALL) -D ../icons/u4.png $(datadir)/pixmaps/u4.png
+- mkdir -p $(libdir)/u4/music
+- $(INSTALL) ../mid/*.mid $(libdir)/u4/music
+- mkdir -p $(libdir)/u4/sound
+- $(INSTALL) ../sound/*.ogg $(libdir)/u4/sound
+- $(INSTALL) ../sound/*.wav $(libdir)/u4/sound
+- $(INSTALL) -D dumpsavegame $(libdir)/u4/dumpsavegame
+- $(INSTALL) -D u4enc $(libdir)/u4/u4enc
+- $(INSTALL) -D u4dec $(libdir)/u4/u4dec
+- $(INSTALL) -D tlkconv $(libdir)/u4/tlkconv
+- $(INSTALL) ../conf/*.xml $(libdir)/u4
+- mkdir -p $(libdir)/u4/dtd
+- $(INSTALL) ../conf/dtd/*.dtd $(libdir)/u4/dtd
+- mkdir -p $(libdir)/u4/graphics
+- mkdir -p $(libdir)/u4/graphics/ega
+- mkdir -p $(libdir)/u4/graphics/vga
+- $(INSTALL) ../graphics/ega/*.png $(libdir)/u4/graphics/ega
+- $(INSTALL) ../graphics/vga/*.png $(libdir)/u4/graphics/vga
+- $(INSTALL) -D ../u4.desktop $(datadir)/applications/u4.desktop
++ mkdir -p $(DESTDIR)$(bindir)
++ $(INSTALL) $(MAIN) $(DESTDIR)$(bindir)/$(MAIN)
++ mkdir -p $(DESTDIR)$(datadir)/pixmaps
++ $(INSTALL) ../icons/u4.bmp $(DESTDIR)$(datadir)/pixmaps/u4.bmp
++ $(INSTALL) ../icons/u4.png $(DESTDIR)$(datadir)/pixmaps/u4.png
++ mkdir -p $(DESTDIR)$(libdir)/u4/music
++ $(INSTALL) ../mid/*.mid $(DESTDIR)$(libdir)/u4/music
++ mkdir -p $(DESTDIR)$(libdir)/u4/sound
++ $(INSTALL) ../sound/*.ogg $(DESTDIR)$(libdir)/u4/sound
++ $(INSTALL) ../sound/*.wav $(DESTDIR)$(libdir)/u4/sound
++ $(INSTALL) dumpsavegame $(DESTDIR)$(libdir)/u4/dumpsavegame
++ $(INSTALL) u4enc $(DESTDIR)$(libdir)/u4/u4enc
++ $(INSTALL) u4dec $(DESTDIR)$(libdir)/u4/u4dec
++ $(INSTALL) tlkconv $(DESTDIR)$(libdir)/u4/tlkconv
++ $(INSTALL) ../conf/*.xml $(DESTDIR)$(libdir)/u4
++ mkdir -p $(DESTDIR)$(libdir)/u4/dtd
++ $(INSTALL) ../conf/dtd/*.dtd $(DESTDIR)$(libdir)/u4/dtd
++ mkdir -p $(DESTDIR)$(libdir)/u4/graphics
++ mkdir -p $(DESTDIR)$(libdir)/u4/graphics/ega
++ mkdir -p $(DESTDIR)$(libdir)/u4/graphics/vga
++ $(INSTALL) ../graphics/ega/*.png $(DESTDIR)$(libdir)/u4/graphics/ega
++ $(INSTALL) ../graphics/vga/*.png $(DESTDIR)$(libdir)/u4/graphics/vga
++ mkdir -p $(DESTDIR)$(datadir)/applications
++ $(INSTALL) ../u4.desktop $(DESTDIR)$(datadir)/applications/u4.desktop
+
+ # use GCC's automatic dependency generation
diff --git a/games/xu4/patches/patch-src_armor.cpp b/games/xu4/patches/patch-src_armor.cpp
new file mode 100644
index 00000000000..72889ed0abe
--- /dev/null
+++ b/games/xu4/patches/patch-src_armor.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_armor.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/armor.cpp.orig 2004-05-26 03:32:52.000000000 +0000
++++ src/armor.cpp
+@@ -12,6 +12,7 @@
+ #include "error.h"
+ #include "names.h"
+ #include "tile.h"
++#include <string.h>
+
+ using std::vector;
+ using std::string;
diff --git a/games/xu4/patches/patch-src_codex.cpp b/games/xu4/patches/patch-src_codex.cpp
new file mode 100644
index 00000000000..0a929241e22
--- /dev/null
+++ b/games/xu4/patches/patch-src_codex.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_codex.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/codex.cpp.orig 2005-09-06 06:21:15.000000000 +0000
++++ src/codex.cpp
+@@ -21,6 +21,7 @@
+ #include "u4.h"
+ #include "u4file.h"
+ #include "utils.h"
++#include <string.h>
+
+ using namespace std;
+
diff --git a/games/xu4/patches/patch-src_conversation.cpp b/games/xu4/patches/patch-src_conversation.cpp
new file mode 100644
index 00000000000..bb4b49a8988
--- /dev/null
+++ b/games/xu4/patches/patch-src_conversation.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_conversation.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/conversation.cpp.orig 2005-09-21 06:39:59.000000000 +0000
++++ src/conversation.cpp
+@@ -8,6 +8,7 @@
+ #include "debug.h"
+ #include "person.h"
+ #include "script.h"
++#include <string.h>
+
+ /* Static variable initialization */
+ const unsigned int Conversation::BUFFERLEN = 16;
diff --git a/games/xu4/patches/patch-src_creature.cpp b/games/xu4/patches/patch-src_creature.cpp
new file mode 100644
index 00000000000..a11e0d28b08
--- /dev/null
+++ b/games/xu4/patches/patch-src_creature.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_creature.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/creature.cpp.orig 2005-10-03 06:01:03.000000000 +0000
++++ src/creature.cpp
+@@ -21,6 +21,7 @@
+ #include "spell.h" /* FIXME: remove dependence on this */
+ #include "tileset.h"
+ #include "utils.h"
++#include <string.h>
+
+ CreatureMgr *CreatureMgr::instance = NULL;
+
diff --git a/games/xu4/patches/patch-src_dialogueloader.cpp b/games/xu4/patches/patch-src_dialogueloader.cpp
new file mode 100644
index 00000000000..9160af8bc31
--- /dev/null
+++ b/games/xu4/patches/patch-src_dialogueloader.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_dialogueloader.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/dialogueloader.cpp.orig 2005-01-21 08:02:52.000000000 +0000
++++ src/dialogueloader.cpp
+@@ -7,6 +7,7 @@
+ #include "debug.h"
+ #include "conversation.h"
+ #include "dialogueloader.h"
++#include <stdlib.h>
+
+ std::map<std::string, DialogueLoader *> *DialogueLoader::loaderMap = NULL;
+
diff --git a/games/xu4/patches/patch-src_dialogueloader__tlk.cpp b/games/xu4/patches/patch-src_dialogueloader__tlk.cpp
new file mode 100644
index 00000000000..b411ec72cac
--- /dev/null
+++ b/games/xu4/patches/patch-src_dialogueloader__tlk.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_dialogueloader__tlk.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/dialogueloader_tlk.cpp.orig 2005-01-21 08:02:52.000000000 +0000
++++ src/dialogueloader_tlk.cpp
+@@ -7,6 +7,7 @@
+ #include "conversation.h"
+ #include "dialogueloader_tlk.h"
+ #include "u4file.h"
++#include <string.h>
+
+ DialogueLoader* U4TlkDialogueLoader::instance = DialogueLoader::registerLoader(new U4TlkDialogueLoader, "application/x-u4tlk");
+
diff --git a/games/xu4/patches/patch-src_direction.cpp b/games/xu4/patches/patch-src_direction.cpp
new file mode 100644
index 00000000000..2f55eb89649
--- /dev/null
+++ b/games/xu4/patches/patch-src_direction.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_direction.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/direction.cpp.orig 2004-05-22 21:03:25.000000000 +0000
++++ src/direction.cpp
+@@ -9,6 +9,7 @@
+ #include "debug.h"
+ #include "event.h"
+ #include "utils.h"
++#include <stdlib.h>
+
+ /**
+ * Returns the opposite direction.
diff --git a/games/xu4/patches/patch-src_imageloader.cpp b/games/xu4/patches/patch-src_imageloader.cpp
new file mode 100644
index 00000000000..443306821e3
--- /dev/null
+++ b/games/xu4/patches/patch-src_imageloader.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_imageloader.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/imageloader.cpp.orig 2004-08-19 08:03:52.000000000 +0000
++++ src/imageloader.cpp
+@@ -7,6 +7,7 @@
+ #include "debug.h"
+ #include "image.h"
+ #include "imageloader.h"
++#include <stdlib.h>
+
+ std::map<std::string, ImageLoader *> *ImageLoader::loaderMap = NULL;
+
diff --git a/games/xu4/patches/patch-src_imageloader__png.cpp b/games/xu4/patches/patch-src_imageloader__png.cpp
new file mode 100644
index 00000000000..203f8ac5620
--- /dev/null
+++ b/games/xu4/patches/patch-src_imageloader__png.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_imageloader__png.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Fix build with png-1.5.
+
+--- src/imageloader_png.cpp.orig 2004-09-26 19:24:31.000000000 +0000
++++ src/imageloader_png.cpp
+@@ -19,7 +19,7 @@ static void png_read_xu4(png_structp png
+ png_size_t check;
+ U4FILE *file;
+
+- file = (U4FILE *) png_ptr->io_ptr;
++ file = (U4FILE *) png_get_io_ptr(png_ptr);
+ check = file->read(data, (png_size_t)1, length);
+
+ if (check != length)
diff --git a/games/xu4/patches/patch-src_imagemgr.h b/games/xu4/patches/patch-src_imagemgr.h
new file mode 100644
index 00000000000..244e1b06762
--- /dev/null
+++ b/games/xu4/patches/patch-src_imagemgr.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_imagemgr.h,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Fix build with gcc-4.5.
+
+--- src/imagemgr.h.orig 2004-12-05 03:01:27.000000000 +0000
++++ src/imagemgr.h
+@@ -102,7 +102,7 @@ public:
+ static void destroy();
+
+ ImageInfo *get(const std::string &name);
+- SubImage *ImageMgr::getSubImage(const std::string &name);
++ SubImage *getSubImage(const std::string &name);
+ void freeIntroBackgrounds();
+ const std::vector<std::string> &getSetNames();
+
diff --git a/games/xu4/patches/patch-src_intro.cpp b/games/xu4/patches/patch-src_intro.cpp
new file mode 100644
index 00000000000..4f8159d3ee0
--- /dev/null
+++ b/games/xu4/patches/patch-src_intro.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_intro.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/intro.cpp.orig 2005-10-03 05:57:31.000000000 +0000
++++ src/intro.cpp
+@@ -24,6 +24,7 @@
+ #include "tilemap.h"
+ #include "u4file.h"
+ #include "utils.h"
++#include <string.h>
+
+ using namespace std;
+
diff --git a/games/xu4/patches/patch-src_item.cpp b/games/xu4/patches/patch-src_item.cpp
new file mode 100644
index 00000000000..1cff8f7450b
--- /dev/null
+++ b/games/xu4/patches/patch-src_item.cpp
@@ -0,0 +1,146 @@
+$NetBSD: patch-src_item.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Fix build on 64-bit with gcc-4.5.
+
+--- src/item.cpp.orig 2005-10-03 05:57:31.000000000 +0000
++++ src/item.cpp
+@@ -135,13 +135,13 @@ static const ItemLocation items[] = {
+ #define N_ITEMS (sizeof(items) / sizeof(items[0]))
+
+ bool isRuneInInventory(void *virt) {
+- return c->saveGame->runes & (int)virt;
++ return c->saveGame->runes & (int64_t)virt;
+ }
+
+ void putRuneInInventory(void *virt) {
+ c->party->member(0)->awardXp(100);
+ c->party->adjustKarma(KA_FOUND_ITEM);
+- c->saveGame->runes |= (int)virt;
++ c->saveGame->runes |= (int64_t)virt;
+ c->saveGame->lastreagent = c->saveGame->moves & 0xF0;
+ }
+
+@@ -150,18 +150,18 @@ bool isStoneInInventory(void *virt) {
+ if (virt == NULL)
+ return (c->saveGame->stones > 0);
+ /* specific test: does the party have a specific stone? */
+- else return c->saveGame->stones & (int)virt;
++ else return c->saveGame->stones & (int64_t)virt;
+ }
+
+ void putStoneInInventory(void *virt) {
+ c->party->member(0)->awardXp(200);
+ c->party->adjustKarma(KA_FOUND_ITEM);
+- c->saveGame->stones |= (int)virt;
++ c->saveGame->stones |= (int64_t)virt;
+ c->saveGame->lastreagent = c->saveGame->moves & 0xF0;
+ }
+
+ bool isItemInInventory(void *item) {
+- return c->saveGame->items & (int)item;
++ return c->saveGame->items & (int64_t)item;
+ }
+
+ bool isSkullInInventory(void *) {
+@@ -171,7 +171,7 @@ bool isSkullInInventory(void *) {
+ void putItemInInventory(void *item) {
+ c->party->member(0)->awardXp(400);
+ c->party->adjustKarma(KA_FOUND_ITEM);
+- c->saveGame->items |= (int)item;
++ c->saveGame->items |= (int64_t)item;
+ c->saveGame->lastreagent = c->saveGame->moves & 0xF0;
+ }
+
+@@ -183,17 +183,17 @@ void useBBC(void *item) {
+ /* on top of the Abyss entrance */
+ if (c->location->coords == abyssEntrance) {
+ /* must use bell first */
+- if ((int)item == ITEM_BELL) {
++ if ((int64_t)item == ITEM_BELL) {
+ screenMessage("\nThe Bell rings on and on!\n");
+ c->saveGame->items |= ITEM_BELL_USED;
+ }
+ /* then the book */
+- else if (((int)item == ITEM_BOOK) && (c->saveGame->items & ITEM_BELL_USED)) {
++ else if (((int64_t)item == ITEM_BOOK) && (c->saveGame->items & ITEM_BELL_USED)) {
+ screenMessage("\nThe words resonate with the ringing!\n");
+ c->saveGame->items |= ITEM_BOOK_USED;
+ }
+ /* then the candle */
+- else if (((int)item == ITEM_CANDLE) && (c->saveGame->items & ITEM_BOOK_USED)) {
++ else if (((int64_t)item == ITEM_CANDLE) && (c->saveGame->items & ITEM_BOOK_USED)) {
+ screenMessage("\nAs you light the Candle the Earth Trembles!\n");
+ c->saveGame->items |= ITEM_CANDLE_USED;
+ }
+@@ -255,7 +255,7 @@ void useSkull(void *item) {
+ */
+ void useStone(void *item) {
+ MapCoords coords;
+- unsigned char stone = (unsigned char)((int)item);
++ unsigned char stone = (unsigned char)((int64_t)item);
+
+ unsigned char truth = STONE_WHITE | STONE_PURPLE | STONE_GREEN | STONE_BLUE;
+ unsigned char love = STONE_WHITE | STONE_YELLOW | STONE_GREEN | STONE_ORANGE;
+@@ -393,9 +393,9 @@ bool isMysticInInventory(void *mystic) {
+ This would be a good candidate for an xu4 "extended" savegame
+ format.
+ */
+- if (((int)mystic) == WEAP_MYSTICSWORD)
++ if (((int64_t)mystic) == WEAP_MYSTICSWORD)
+ return c->saveGame->weapons[WEAP_MYSTICSWORD] > 0;
+- else if (((int)mystic) == ARMR_MYSTICROBES)
++ else if (((int64_t)mystic) == ARMR_MYSTICROBES)
+ return c->saveGame->armor[ARMR_MYSTICROBES] > 0;
+ else
+ ASSERT(0, "Invalid mystic item was tested in isMysticInInventory()");
+@@ -405,9 +405,9 @@ bool isMysticInInventory(void *mystic) {
+ void putMysticInInventory(void *mystic) {
+ c->party->member(0)->awardXp(400);
+ c->party->adjustKarma(KA_FOUND_ITEM);
+- if (((int)mystic) == WEAP_MYSTICSWORD)
++ if (((int64_t)mystic) == WEAP_MYSTICSWORD)
+ c->saveGame->weapons[WEAP_MYSTICSWORD] += 8;
+- else if (((int)mystic) == ARMR_MYSTICROBES)
++ else if (((int64_t)mystic) == ARMR_MYSTICROBES)
+ c->saveGame->armor[ARMR_MYSTICROBES] += 8;
+ else
+ ASSERT(0, "Invalid mystic item was added in putMysticInInventory()");
+@@ -415,12 +415,12 @@ void putMysticInInventory(void *mystic)
+ }
+
+ bool isWeaponInInventory(void *weapon) {
+- if (c->saveGame->weapons[(int)weapon])
++ if (c->saveGame->weapons[(int64_t)weapon])
+ return true;
+ else {
+ int i;
+ for (i = 0; i < c->party->size(); i++) {
+- if (c->party->member(i)->getWeapon() == (int)weapon)
++ if (c->party->member(i)->getWeapon() == (int64_t)weapon)
+ return true;
+ }
+ }
+@@ -428,7 +428,7 @@ bool isWeaponInInventory(void *weapon) {
+ }
+
+ void putWeaponInInventory(void *weapon) {
+- c->saveGame->weapons[(int)weapon]++;
++ c->saveGame->weapons[(int64_t)weapon]++;
+ }
+
+ void useTelescope(void *notused) {
+@@ -447,11 +447,11 @@ bool isReagentInInventory(void *reag) {
+
+ void putReagentInInventory(void *reag) {
+ c->party->adjustKarma(KA_FOUND_ITEM);
+- c->saveGame->reagents[(int)reag] += xu4_random(8) + 2;
++ c->saveGame->reagents[(int64_t)reag] += xu4_random(8) + 2;
+ c->saveGame->lastreagent = c->saveGame->moves & 0xF0;
+
+- if (c->saveGame->reagents[(int)reag] > 99) {
+- c->saveGame->reagents[(int)reag] = 99;
++ if (c->saveGame->reagents[(int64_t)reag] > 99) {
++ c->saveGame->reagents[(int64_t)reag] = 99;
+ screenMessage("Dropped some!\n");
+ }
+ }
diff --git a/games/xu4/patches/patch-src_lzw_u6decode.cpp b/games/xu4/patches/patch-src_lzw_u6decode.cpp
new file mode 100644
index 00000000000..c0b147a4af9
--- /dev/null
+++ b/games/xu4/patches/patch-src_lzw_u6decode.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_lzw_u6decode.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/lzw/u6decode.cpp.orig 2005-10-03 06:30:09.000000000 +0000
++++ src/lzw/u6decode.cpp
+@@ -28,6 +28,7 @@
+ */
+
+ #include <stdio.h>
++#include <stdlib.h>
+
+ #include "u6decode.h"
+ #include "u6stack.h"
diff --git a/games/xu4/patches/patch-src_person.cpp b/games/xu4/patches/patch-src_person.cpp
new file mode 100644
index 00000000000..e91c952f5ed
--- /dev/null
+++ b/games/xu4/patches/patch-src_person.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_person.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/person.cpp.orig 2005-09-21 06:42:01.000000000 +0000
++++ src/person.cpp
+@@ -28,6 +28,7 @@
+ #include "u4file.h"
+ #include "utils.h"
+ #include "script.h"
++#include <string.h>
+
+ using std::string;
+ using std::vector;
diff --git a/games/xu4/patches/patch-src_savegame.cpp b/games/xu4/patches/patch-src_savegame.cpp
new file mode 100644
index 00000000000..6800421a929
--- /dev/null
+++ b/games/xu4/patches/patch-src_savegame.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_savegame.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/savegame.cpp.orig 2005-01-14 08:24:55.000000000 +0000
++++ src/savegame.cpp
+@@ -5,6 +5,7 @@
+ #include "vc6.h" // Fixes things if you're using VC6, does nothing if otherwise
+
+ #include "savegame.h"
++#include <string.h>
+
+ #include "io.h"
+ #include "object.h"
diff --git a/games/xu4/patches/patch-src_screen.cpp b/games/xu4/patches/patch-src_screen.cpp
new file mode 100644
index 00000000000..f315de8911d
--- /dev/null
+++ b/games/xu4/patches/patch-src_screen.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_screen.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/screen.cpp.orig 2005-10-03 05:57:31.000000000 +0000
++++ src/screen.cpp
+@@ -8,6 +8,7 @@
+ #include <cstdarg>
+ #include <cfloat>
+ #include "u4.h"
++#include <string.h>
+
+ #include "screen.h"
+
diff --git a/games/xu4/patches/patch-src_settings.cpp b/games/xu4/patches/patch-src_settings.cpp
new file mode 100644
index 00000000000..980bf85fc71
--- /dev/null
+++ b/games/xu4/patches/patch-src_settings.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_settings.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/settings.cpp.orig 2005-08-22 05:53:38.000000000 +0000
++++ src/settings.cpp
+@@ -11,6 +11,7 @@
+ #include "event.h"
+ #include "filesystem.h"
+ #include "utils.h"
++#include <string.h>
+
+ #if defined(_WIN32) || defined(__CYGWIN__)
+ #include <windows.h>
diff --git a/games/xu4/patches/patch-src_spell.cpp b/games/xu4/patches/patch-src_spell.cpp
new file mode 100644
index 00000000000..228a79aba51
--- /dev/null
+++ b/games/xu4/patches/patch-src_spell.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_spell.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/spell.cpp.orig 2005-10-03 05:57:31.000000000 +0000
++++ src/spell.cpp
+@@ -5,6 +5,7 @@
+ #include "vc6.h" // Fixes things if you're using VC6, does nothing if otherwise
+
+ #include "u4.h"
++#include <string.h>
+
+ #include "spell.h"
+
diff --git a/games/xu4/patches/patch-src_stats.cpp b/games/xu4/patches/patch-src_stats.cpp
new file mode 100644
index 00000000000..624a37c20ad
--- /dev/null
+++ b/games/xu4/patches/patch-src_stats.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_stats.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/stats.cpp.orig 2005-08-24 05:55:35.000000000 +0000
++++ src/stats.cpp
+@@ -18,6 +18,7 @@
+ #include "spell.h"
+ #include "tile.h"
+ #include "weapon.h"
++#include <string.h>
+
+ extern bool verbose;
+
diff --git a/games/xu4/patches/patch-src_textview.cpp b/games/xu4/patches/patch-src_textview.cpp
new file mode 100644
index 00000000000..303d07f5990
--- /dev/null
+++ b/games/xu4/patches/patch-src_textview.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_textview.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/textview.cpp.orig 2005-08-17 06:32:15.000000000 +0000
++++ src/textview.cpp
+@@ -5,6 +5,7 @@
+ #include "vc6.h" // Fixes things if you're using VC6, does nothing if otherwise
+
+ #include <stdarg.h>
++#include <string.h>
+
+ #include "debug.h"
+ #include "event.h"
diff --git a/games/xu4/patches/patch-src_u4file.cpp b/games/xu4/patches/patch-src_u4file.cpp
new file mode 100644
index 00000000000..79ec0ffd945
--- /dev/null
+++ b/games/xu4/patches/patch-src_u4file.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_u4file.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/u4file.cpp.orig 2004-11-29 05:38:26.000000000 +0000
++++ src/u4file.cpp
+@@ -3,6 +3,7 @@
+ */
+
+ #include <cctype>
++#include <stdlib.h>
+
+ #include "u4file.h"
+ #include "unzip.h"
diff --git a/games/xu4/patches/patch-src_weapon.cpp b/games/xu4/patches/patch-src_weapon.cpp
new file mode 100644
index 00000000000..91dbb4d7098
--- /dev/null
+++ b/games/xu4/patches/patch-src_weapon.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_weapon.cpp,v 1.1.1.1 2012/01/08 15:52:12 wiz Exp $
+
+Add missing header.
+
+--- src/weapon.cpp.orig 2005-10-03 05:42:21.000000000 +0000
++++ src/weapon.cpp
+@@ -5,6 +5,7 @@
+ #include "vc6.h" // Fixes things if you're using VC6, does nothing if otherwise
+
+ #include <string>
++#include <string.h>
+
+ #include "weapon.h"
+