aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-01-13 05:04:12 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-01-14 08:50:32 +0700
commit89948092b63ee2cde71047de886de7565c9524f1 (patch)
tree6fe00dfec795016bcc9bbc8abf962253f8a41cf8 /games
parente02ac6c1e75a7f39f923233689ba4b391e757355 (diff)
games/xu4: Updated for version 1.2.1.
Signed-off-by: B. Watson <urchlay@slackware.uk> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games')
-rw-r--r--games/xu4/README16
-rw-r--r--games/xu4/README-SBo.txt50
-rw-r--r--games/xu4/disable_alt_x.diff24
-rw-r--r--games/xu4/gcc7.patch90
-rw-r--r--games/xu4/icons/16.pngbin1513 -> 1232 bytes
-rw-r--r--games/xu4/icons/22.pngbin0 -> 1474 bytes
-rw-r--r--games/xu4/icons/32.pngbin2649 -> 2565 bytes
-rw-r--r--games/xu4/icons/48.pngbin4643 -> 0 bytes
-rw-r--r--games/xu4/icons/64.pngbin6928 -> 0 bytes
-rw-r--r--games/xu4/profile_path.diff47
-rw-r--r--games/xu4/really_1.2.1.diff681
-rw-r--r--games/xu4/xu4.6 (renamed from games/xu4/u4.6)30
-rw-r--r--games/xu4/xu4.SlackBuild138
-rw-r--r--games/xu4/xu4.desktop (renamed from games/xu4/u4.desktop)4
-rw-r--r--games/xu4/xu4.info14
15 files changed, 829 insertions, 265 deletions
diff --git a/games/xu4/README b/games/xu4/README
index 9d3b15967e490..9fe84a50f7175 100644
--- a/games/xu4/README
+++ b/games/xu4/README
@@ -10,11 +10,12 @@ 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.
-Note for users upgrading from Slackware 14.1 to 14.2: if the game won't
-start after the upgrade, see README-SBo.txt for the solution.
+The package includes the Ultima 4 graphics upgrade. To use it, press
+Escape while the game is running to get to the Game Modules menu, then
+select U4 Upgrade, and click "Play".
This package can be built with optional extras. See README-SBo.txt
-for details.
+for details, and also for Slackware-specific notes.
Copyright notice: The file ultima4.zip is included in this package. This
file and its contents have a proprietary license and MAY NOT be
@@ -24,7 +25,8 @@ SlackBuild, since they include ultima4.zip).
If you have trouble downloading ultima4.zip from the URL listed
in the .info file, you can instead download UltimaIV.zip from
-http://www.ultimaforever.com/ (registration required, JavaScript browser
-required, no direct download URL). It's a different packaging of the
-same content; the script is smart enough to build a package from either
-release of Ultima 4.
+http://www.ultimaforever.com/ (registration required, JavaScript
+browser required, no direct download URL). It's a different packaging
+of the same content; the script is smart enough to build a package
+from either release of Ultima 4. You might also be able to download it
+from GoG.com, but the SlackBuild author hasn't tested this.
diff --git a/games/xu4/README-SBo.txt b/games/xu4/README-SBo.txt
index 0554d13278e47..b131265ca65fd 100644
--- a/games/xu4/README-SBo.txt
+++ b/games/xu4/README-SBo.txt
@@ -1,4 +1,16 @@
-Notes and optional stuff: Music, enhanced graphics, and PDF manuals.
+Notes and optional stuff.
+
+XU4 Upgrade Note
+----------------
+If you upgraded from xu4-20130612_svn to 1.2.1 or later, your old
+settings from ~/.xu4 will no longer be read. You can try:
+
+mkdir -p ~/.config/xu4
+cp -a ~/.xu4/* ~/.config/xu4
+
+...but there's no guarantee the new engine will read the old config or
+savegames (not tested, YMMV).
+
Slackware Upgrade Note
----------------------
@@ -6,36 +18,13 @@ If you upgraded from 14.1 to 14.2, your old ~/.xu4/xu4rc needs to be
edited, to disable XML validation (otherwise the game won't start).
Edit the file manually, or use this:
-sed -i '/validateXml/s,1,0,' ~/.xu4/xu4rc
-
-Music
------
-To hear the in-game music, you'll need a set of MIDI patches, either the
-eawpats or freepats package from slackbuilds.org (make sure you set up
-timidity.cfg correctly). These can be installed after the fact (no need
-to rebuild xu4 after installing them). The timidity package itself isn't
-required (xu4 uses SDL_mixer to play back the music).
+sed -i '/validateXml/s,1,0,' ~/.config/xu4/xu4rc
-Enhanced Graphics
------------------
-By default, the script will build a package that uses the graphics from
-the original PC/DOS version of the game. If you'd like to use the
-upgraded graphics from the Ultima IV Upgrade Project, download the file
-u4upgrad.zip and place it in the same directory as the SlackBuild script,
-before running it. The upgrade can be downloaded here:
-
-URL: http://www.moongates.com/u4/upgrade/files/u4upgrad.zip
-md5sum: 4ce9c9cd9dab111275e0ebfde7a482c4
-Homepage: http://www.moongates.com/u4/upgrade/Upgrade.htm
-
-The graphics upgrade isn't listed in the .info file because it isn't
-required to play the game, and also because some users will prefer the
-original CGA-style graphics.
PDF Manuals
-----------
Some of the documentation in this package is in Microsoft Word format. To
-read it, you can use KWord... or just live with the text-only versions
+read it, you can use calligra... or just live with the text-only versions
(also included in this package). These are the manuals for the original
game, and unlike most modern games, you really do need to read them to
have any chance of completing Ultima IV. The text files and Word docs
@@ -53,3 +42,12 @@ md5sum: c6be37b7028d6f7b56843a73517a5c31
The PDF docs aren't listed in the .info file because they're fairly large,
and not needed just to play the game.
+
+
+Running without PulseAudio
+--------------------------
+Some of us still prefer not to use PulseAudio. For xu4, there's no
+option for ALSA or SDL audio. To get sound without PulseAudio, install
+apulse, then run xu4 as "apulse xu4" from a terminal. If you like,
+you can edit the .desktop file to make it launch this way from the
+GUI, too.
diff --git a/games/xu4/disable_alt_x.diff b/games/xu4/disable_alt_x.diff
deleted file mode 100644
index 62f18c3f76003..0000000000000
--- a/games/xu4/disable_alt_x.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -Naur xu4-20130612_svn/src/event_sdl.cpp xu4-20130612_svn.patched/src/event_sdl.cpp
---- xu4-20130612_svn/src/event_sdl.cpp 2013-06-12 19:34:25.000000000 -0400
-+++ xu4-20130612_svn.patched/src/event_sdl.cpp 2021-10-12 03:38:36.048487922 -0400
-@@ -43,7 +43,7 @@
- case U4_META + 'q': /* Cmd+q */
- case U4_META + 'x': /* Cmd+x */
- #endif
-- case U4_ALT + 'x': /* Alt+x */
-+ // case U4_ALT + 'x': /* Alt+x */
- #if defined(WIN32)
- case U4_ALT + U4_FKEY + 3:
- #endif
-diff -Naur xu4-20130612_svn/src/game.cpp xu4-20130612_svn.patched/src/game.cpp
---- xu4-20130612_svn/src/game.cpp 2013-06-12 19:34:24.000000000 -0400
-+++ xu4-20130612_svn.patched/src/game.cpp 2021-10-12 03:33:55.794513398 -0400
-@@ -1205,7 +1205,7 @@
- screenMessage("Quit & Save...\n%d moves\n", c->saveGame->moves);
- if (c->location->context & CTX_CAN_SAVE_GAME) {
- gameSave();
-- screenMessage("Press Alt-x to quit\n");
-+ screenMessage("Close window to quit\n");
- }
- else screenMessage("%cNot here!%c\n", FG_GREY, FG_WHITE);
-
diff --git a/games/xu4/gcc7.patch b/games/xu4/gcc7.patch
deleted file mode 100644
index 29f2cceee4394..0000000000000
--- a/games/xu4/gcc7.patch
+++ /dev/null
@@ -1,90 +0,0 @@
---- xu4-20130612_svn/src/image_sdl.cpp.orig 2017-07-07 05:16:49.443617174 +0700
-+++ xu4-20130612_svn/src/image_sdl.cpp 2017-07-07 05:25:40.763657058 +0700
-@@ -349,7 +349,7 @@
- unsigned int y_finish = std::min(int(bottom), oy + span + 1);
- for (y = y_start; y < y_finish; ++y) {
-
-- int divisor = 1 + span * 2 - abs(ox - x) - abs(oy - y);
-+ int divisor = 1 + span * 2 - std::abs((long int) (ox - x)) - std::abs((long int) (oy - y));
-
- unsigned int r, g, b, a;
- getPixel(x, y, r, g, b, a);
---- xu4-20130612_svn/src/map.cpp.orig 2017-07-07 05:26:04.108658810 +0700
-+++ xu4-20130612_svn/src/map.cpp 2017-07-07 05:28:17.857668850 +0700
-@@ -123,14 +123,14 @@
- if (map && map->border_behavior == Map::BORDER_WRAP) {
- MapCoords me = *this;
-
-- if (abs(me.x - c.x) > abs(me.x + map->width - c.x))
-+ if (std::abs((long int) (me.x - c.x)) > std::abs((long int) (me.x + map->width - c.x)))
- me.x += map->width;
-- else if (abs(me.x - c.x) > abs(me.x - map->width - c.x))
-+ else if (std::abs((long int) (me.x - c.x)) > std::abs((long int) (me.x - map->width - c.x)))
- me.x -= map->width;
-
-- if (abs(me.y - c.y) > abs(me.y + map->width - c.y))
-+ if (std::abs((long int) (me.y - c.y)) > std::abs((long int) (me.y + map->width - c.y)))
- me.y += map->height;
-- else if (abs(me.y - c.y) > abs(me.y - map->width - c.y))
-+ else if (std::abs((long int) (me.y - c.y)) > std::abs((long int) (me.y - map->width - c.y)))
- me.y -= map->height;
-
- dx = me.x - c.x;
---- xu4-20130612_svn/src/person.cpp.orig 2017-07-07 05:28:34.604670107 +0700
-+++ xu4-20130612_svn/src/person.cpp 2017-07-07 05:29:29.432674223 +0700
-@@ -221,7 +221,7 @@
- eventHandler->pushController(&getPlayerCtrl);
- int player = getPlayerCtrl.waitFor();
- if (player != -1) {
-- string player_str = to_string(player+1);
-+ string player_str = to_string((long int) player+1);
- script->setVar(script->getInputName(), player_str);
- }
- else script->unsetVar(script->getInputName());
---- xu4-20130612_svn/src/script.cpp.orig 2017-07-07 05:29:46.242675485 +0700
-+++ xu4-20130612_svn/src/script.cpp 2017-07-07 05:31:00.015681023 +0700
-@@ -44,7 +44,7 @@
-
- Script::Variable::Variable(const int &v) : set(true) {
- i_val = v;
-- s_val = to_string(v);
-+ s_val = to_string((long int) v);
- }
-
- int& Script::Variable::getInt() { return i_val; }
-@@ -503,7 +503,7 @@
- }
- // Get the current iterator for our loop
- else if (item == "iterator")
-- prop = to_string(this->iterator);
-+ prop = to_string((long int) this->iterator);
- else if ((pos = item.find("show_inventory:")) < item.length()) {
- pos = item.find(":");
- string itemScript = item.substr(pos+1);
-@@ -611,7 +611,7 @@
- if (content.empty())
- errorWarning("Error: empty math() function");
-
-- prop = to_string(mathValue(content));
-+ prop = to_string((long int) mathValue(content));
- }
-
- /**
-@@ -643,7 +643,7 @@
-
- /* generate a random number */
- else if (funcName == "random")
-- prop = to_string(xu4_random((int)strtol(content.c_str(), NULL, 10)));
-+ prop = to_string((long int) xu4_random((int)strtol(content.c_str(), NULL, 10)));
-
- /* replaced with "true" if content is empty, or "false" if not */
- else if (funcName == "isempty") {
-@@ -1391,7 +1391,7 @@
- string children_results;
-
- mathParseChildren(current, &children_results);
-- *result = to_string(mathValue(children_results));
-+ *result = to_string((long int) mathValue(children_results));
- }
- }
- }
diff --git a/games/xu4/icons/16.png b/games/xu4/icons/16.png
index d96bf37a3f0ed..eaf66390608a4 100644
--- a/games/xu4/icons/16.png
+++ b/games/xu4/icons/16.png
Binary files differ
diff --git a/games/xu4/icons/22.png b/games/xu4/icons/22.png
new file mode 100644
index 0000000000000..26b94812f78fd
--- /dev/null
+++ b/games/xu4/icons/22.png
Binary files differ
diff --git a/games/xu4/icons/32.png b/games/xu4/icons/32.png
index bc594186b6d3e..460a88a8d3ee6 100644
--- a/games/xu4/icons/32.png
+++ b/games/xu4/icons/32.png
Binary files differ
diff --git a/games/xu4/icons/48.png b/games/xu4/icons/48.png
deleted file mode 100644
index 43b3509bbe002..0000000000000
--- a/games/xu4/icons/48.png
+++ /dev/null
Binary files differ
diff --git a/games/xu4/icons/64.png b/games/xu4/icons/64.png
deleted file mode 100644
index 8f5f6b38b6912..0000000000000
--- a/games/xu4/icons/64.png
+++ /dev/null
Binary files differ
diff --git a/games/xu4/profile_path.diff b/games/xu4/profile_path.diff
index b436ac55d98f1..0c5f2060628ac 100644
--- a/games/xu4/profile_path.diff
+++ b/games/xu4/profile_path.diff
@@ -1,29 +1,34 @@
-diff -Naur xu4-20111026_svn/src/settings.cpp xu4-20111026_svn.patched//src/settings.cpp
---- xu4-20111026_svn/src/settings.cpp 2011-06-23 13:36:06.000000000 -0400
-+++ xu4-20111026_svn.patched//src/settings.cpp 2011-10-27 17:27:02.000000000 -0400
-@@ -81,12 +81,6 @@
+diff -Naur xu4-1.2.1/src/settings.cpp xu4-1.2.1.patched/src/settings.cpp
+--- xu4-1.2.1/src/settings.cpp 2022-12-06 13:21:00.000000000 -0500
++++ xu4-1.2.1.patched/src/settings.cpp 2023-01-13 03:37:36.452626171 -0500
+@@ -55,15 +55,6 @@
* Initialize the settings.
*/
- void Settings::init(const bool useProfile, const string profileName) {
-- if (useProfile) {
-- userPath = "./profiles/";
-- userPath += profileName.c_str();
-- userPath += "/";
-- } else {
+ void Settings::init(const char* profileName) {
+- if (profileName && profileName[0]) {
+- userPath = "./profiles/";
+- userPath += profileName;
+- userPath += "/";
-
- #if defined(MACOSX)
- FSRef folder;
- OSErr err = FSFindFolder(kUserDomain, kApplicationSupportFolderType, kCreateFolder, &folder);
-@@ -150,7 +144,12 @@
+- profile = profileName;
+- if (profile.length() > 20)
+- errorFatal("Profile name must be no more than 20 characters.");
+- } else {
+ profile.clear();
+
+ #if defined(ANDROID)
+@@ -123,6 +114,14 @@
userPath = "./";
#endif
-+ if (useProfile) {
-+ userPath += "profiles/";
-+ userPath += profileName.c_str();
-+ userPath += "/";
- }
++ if (profileName && profileName[0]) {
++ userPath += "profiles/";
++ userPath += profileName;
++ userPath += "/";
+
- FileSystem::createDirectory(userPath);
++ profile = profileName;
++ if (profile.length() > 20)
++ errorFatal("Profile name must be no more than 20 characters.");
+ }
- filename = userPath + SETTINGS_BASE_FILENAME;
+ #ifndef ANDROID
diff --git a/games/xu4/really_1.2.1.diff b/games/xu4/really_1.2.1.diff
new file mode 100644
index 0000000000000..b2d87978bea42
--- /dev/null
+++ b/games/xu4/really_1.2.1.diff
@@ -0,0 +1,681 @@
+diff -Naur xu4-1.2.1/src/intro.cpp u4-1.2.1/src/intro.cpp
+--- xu4-1.2.1/src/intro.cpp 2022-12-28 11:16:16.000000000 -0500
++++ u4-1.2.1/src/intro.cpp 2022-12-12 17:42:19.000000000 -0500
+@@ -48,8 +48,6 @@
+ #define GYP_SEGUE1 13
+ #define GYP_SEGUE2 14
+
+-#define INTRO_CON IntroController* ic = xu4.intro
+-
+ #ifndef GPU_RENDER
+ class IntroObjectState {
+ public:
+@@ -59,6 +57,9 @@
+ };
+ #endif
+
++/* temporary place-holder for settings changes */
++SettingsData settingsChanged;
++
+ const int IntroBinData::INTRO_TEXT_OFFSET = 17445 - 1; // (start at zero)
+ const int IntroBinData::INTRO_MAP_OFFSET = 30339;
+ const int IntroBinData::INTRO_FIXUPDATA_OFFSET = 29806;
+@@ -167,93 +168,20 @@
+ return true;
+ }
+
+-//----------------------------------------------------------------------------
+-
+-struct SettingsMenus {
+- static void menusNotice(int, void*, void*);
+-
+- SettingsMenus();
+-
+- void showMenu(Menu *menu);
+- void drawMenu();
+- void dispatchMenu(const MenuEvent* event);
+- void saveSettings();
+- void updateConfMenu(int);
+- void updateVideoMenu(int);
+- void updateSoundMenu(int);
+-
+- enum MenuConstants {
+- MI_CONF_VIDEO,
+- MI_CONF_SOUND,
+- MI_CONF_INPUT,
+- MI_CONF_SPEED,
+- MI_CONF_GAMEPLAY,
+- MI_CONF_INTERFACE,
+- MI_CONF_01,
+- MI_VIDEO_CONF_GFX,
+- MI_VIDEO_02,
+- MI_VIDEO_03,
+- MI_VIDEO_04,
+- MI_VIDEO_05,
+- MI_VIDEO_06,
+- MI_VIDEO_07,
+- MI_VIDEO_08,
+- MI_GFX_TILE_TRANSPARENCY,
+- MI_GFX_TILE_TRANSPARENCY_SHADOW_SIZE,
+- MI_GFX_TILE_TRANSPARENCY_SHADOW_OPACITY,
+- MI_GFX_RETURN,
+- MI_SOUND_01,
+- MI_SOUND_02,
+- MI_SOUND_03,
+- MI_INPUT_01,
+- MI_INPUT_02,
+- MI_INPUT_03,
+- MI_SPEED_01,
+- MI_SPEED_02,
+- MI_SPEED_03,
+- MI_SPEED_04,
+- MI_SPEED_05,
+- MI_SPEED_06,
+- MI_SPEED_07,
+- MI_GAMEPLAY_01,
+- MI_GAMEPLAY_02,
+- MI_GAMEPLAY_03,
+- MI_GAMEPLAY_04,
+- MI_GAMEPLAY_05,
+- MI_GAMEPLAY_06,
+- MI_INTERFACE_01,
+- MI_INTERFACE_02,
+- MI_INTERFACE_03,
+- MI_INTERFACE_04,
+- MI_INTERFACE_05,
+- MI_INTERFACE_06,
+- USE_SETTINGS = 0xFE,
+- CANCEL = 0xFF
+- };
+-
+- Menu mainMenu;
+- Menu confMenu;
+- Menu videoMenu;
+- Menu gfxMenu;
+- Menu soundMenu;
+- Menu inputMenu;
+- Menu speedMenu;
+- Menu gameplayMenu;
+- Menu interfaceMenu;
+-
+- Menu* active;
+- TextView extendedMenuArea;
+- int listenerId;
+-
+- /* temporary place-holder for settings changes */
+- SettingsData settingsChanged;
+-};
+-
+-SettingsMenus::SettingsMenus() :
+- extendedMenuArea(2 * CHAR_WIDTH, 10 * CHAR_HEIGHT, 36, 13)
++IntroController::IntroController() :
++ Controller(1),
++ backgroundArea(),
++ menuArea(1 * CHAR_WIDTH, 13 * CHAR_HEIGHT, 38, 11),
++ extendedMenuArea(2 * CHAR_WIDTH, 10 * CHAR_HEIGHT, 36, 13),
++ questionArea(INTRO_TEXT_X * CHAR_WIDTH, INTRO_TEXT_Y * CHAR_HEIGHT, INTRO_TEXT_WIDTH, INTRO_TEXT_HEIGHT),
++ mapArea(BORDER_WIDTH, (TILE_HEIGHT * 6) + BORDER_HEIGHT, INTRO_MAP_WIDTH, INTRO_MAP_HEIGHT),
++ binData(NULL),
++ titles(), // element list
++ title(titles.begin()), // element iterator
++ bSkipTitles(false),
++ egaGraphics(true)
+ {
+- active = &confMenu;
+-
++ // initialize menus
+ confMenu.setTitle("XU4 Configuration:", 0, 0);
+ confMenu.add(MI_CONF_VIDEO, "\010 Video Options", 2, 2,/*'v'*/ 2);
+ confMenu.add(MI_CONF_SOUND, "\010 Sound Options", 2, 3,/*'s'*/ 2);
+@@ -267,8 +195,8 @@
+ confMenu.setClosesMenu(CANCEL);
+
+ /* set the default visibility of the two enhancement menus */
+- confMenu.itemOfId(MI_CONF_GAMEPLAY)->setVisible(xu4.settings->enhancements);
+- confMenu.itemOfId(MI_CONF_INTERFACE)->setVisible(xu4.settings->enhancements);
++ confMenu.getItemById(MI_CONF_GAMEPLAY)->setVisible(xu4.settings->enhancements);
++ confMenu.getItemById(MI_CONF_INTERFACE)->setVisible(xu4.settings->enhancements);
+
+ videoMenu.setTitle("Video Options:", 0, 0);
+ videoMenu.add(MI_VIDEO_CONF_GFX, "\010 Game Graphics Options", 2, 2,/*'g'*/ 2);
+@@ -306,7 +234,7 @@
+ inputMenu.setTitle("Keyboard Options:", 0, 0);
+ inputMenu.add(MI_INPUT_01, new IntMenuItem("Repeat Delay %4d msec", 2, 2,/*'d'*/ 7, &settingsChanged.keydelay, 100, MAX_KEY_DELAY, 100));
+ inputMenu.add(MI_INPUT_02, new IntMenuItem("Repeat Interval %4d msec", 2, 3,/*'i'*/ 7, &settingsChanged.keyinterval, 10, MAX_KEY_INTERVAL, 10));
+- /* "Mouse Options:" is drawn in dispatchMenu() */
++ /* "Mouse Options:" is drawn in the updateInputMenu() function */
+ inputMenu.add(MI_INPUT_03, new BoolMenuItem("Mouse %s", 2, 7,/*'m'*/ 0, &settingsChanged.mouseOptions.enabled));
+ inputMenu.add(USE_SETTINGS, "\010 Use These Settings", 2, 11,/*'u'*/ 2);
+ inputMenu.add(CANCEL, "\010 Cancel", 2, 12,/*'c'*/ 2);
+@@ -357,198 +285,7 @@
+ interfaceMenu.setClosesMenu(CANCEL);
+ }
+
+-/*
+- * Set the active menu.
+- */
+-void SettingsMenus::showMenu(Menu *menu)
+-{
+- active = menu;
+- menu->reset();
+-}
+-
+-void SettingsMenus::drawMenu()
+-{
+- // draw the extended background for all option screens
+- // beasties are always visible on the menus
+- INTRO_CON;
+- ic->backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
+- ic->backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
+- ic->drawBeasties();
+-
+- active->show(&extendedMenuArea);
+-
+- // after drawing the menu, extra menu text can be added here
+- if (active == &inputMenu)
+- extendedMenuArea.textAt(0, 5, "Mouse Options:");
+- else if (active == &interfaceMenu)
+- extendedMenuArea.textAt(2, 3, " (Open, Jimmy, etc.)");
+-
+- screenUploadToGPU();
+-}
+-
+-/*
+- * Update the screen when an observed menu is reset or has an item
+- * activated.
+- */
+-void SettingsMenus::menusNotice(int sender, void* eventData, void* user) {
+- ((SettingsMenus*) user)->dispatchMenu((MenuEvent*) eventData);
+-}
+-
+-void SettingsMenus::saveSettings() {
+- xu4.settings->setData(settingsChanged);
+- xu4.settings->write();
+-}
+-
+-void SettingsMenus::dispatchMenu(const MenuEvent* event)
+-{
+- const Menu* menu = event->menu;
+-
+- //printf("KR menu %d\n", event->type);
+-
+- if (event->type == MenuEvent::ACTIVATE ||
+- event->type == MenuEvent::INCREMENT ||
+- event->type == MenuEvent::DECREMENT)
+- {
+- int itemId = event->item->getId();
+-
+- if (menu == &confMenu) {
+- updateConfMenu(itemId);
+- }
+- else if (menu == &videoMenu) {
+- updateVideoMenu(itemId);
+- }
+- else if (menu == &gfxMenu) {
+- if(itemId == MI_GFX_RETURN)
+- showMenu(&videoMenu);
+- }
+- else if (menu == &soundMenu) {
+- updateSoundMenu(itemId);
+- }
+- else if (menu == &inputMenu) {
+- if (itemId == USE_SETTINGS) {
+- saveSettings();
+- screenShowMouseCursor(xu4.settings->mouseOptions.enabled);
+- }
+- }
+- else if (menu == &speedMenu) {
+- if (itemId == USE_SETTINGS) {
+- saveSettings();
+-
+- // re-initialize events
+- xu4.eventHandler->setTimerInterval(1000 / xu4.settings->gameCyclesPerSecond);
+- }
+- }
+- else if (menu == &gameplayMenu ||
+- menu == &interfaceMenu) {
+- if (itemId == USE_SETTINGS)
+- saveSettings();
+- }
+-
+- if (itemId == CANCEL)
+- settingsChanged = *xu4.settings; // discard settings
+- }
+-
+- drawMenu();
+-}
+-
+-void SettingsMenus::updateConfMenu(int itemId) {
+- // show or hide game enhancement options if enhancements are enabled/disabled
+- confMenu.itemOfId(MI_CONF_GAMEPLAY)->setVisible(settingsChanged.enhancements);
+- confMenu.itemOfId(MI_CONF_INTERFACE)->setVisible(settingsChanged.enhancements);
+-
+- saveSettings();
+-
+- switch(itemId) {
+- case MI_CONF_VIDEO:
+- showMenu(&videoMenu);
+- break;
+- case MI_VIDEO_CONF_GFX:
+- showMenu(&gfxMenu);
+- break;
+- case MI_CONF_SOUND:
+- showMenu(&soundMenu);
+- break;
+- case MI_CONF_INPUT:
+- showMenu(&inputMenu);
+- break;
+- case MI_CONF_SPEED:
+- showMenu(&speedMenu);
+- break;
+- case MI_CONF_GAMEPLAY:
+- showMenu(&gameplayMenu);
+- break;
+- case MI_CONF_INTERFACE:
+- showMenu(&interfaceMenu);
+- break;
+- }
+-}
+-
+-void SettingsMenus::updateVideoMenu(int itemId) {
+- switch(itemId) {
+- case USE_SETTINGS:
+- /* save settings (if necessary) */
+- if (*xu4.settings != settingsChanged) {
+- saveSettings();
+-
+- /* FIXME: resize images, etc. */
+- INTRO_CON;
+- ic->deleteIntro(); // delete intro stuff
+- screenReInit();
+- ic->init(); // re-fix the backgrounds and scale images, etc.
+-
+- // go back to menu mode
+- ic->mode = IntroController::INTRO_MENU;
+- }
+- break;
+- case MI_VIDEO_CONF_GFX:
+- showMenu(&gfxMenu);
+- break;
+- }
+-}
+-
+-void SettingsMenus::updateSoundMenu(int itemId) {
+- switch(itemId) {
+- case MI_SOUND_01:
+- musicSetVolume(settingsChanged.musicVol);
+- break;
+- case MI_SOUND_02:
+- soundSetVolume(settingsChanged.soundVol);
+- soundPlay(SOUND_FLEE);
+- break;
+- case USE_SETTINGS:
+- saveSettings();
+- {
+- INTRO_CON;
+- musicPlay(ic->introMusic);
+- }
+- break;
+- case CANCEL:
+- musicSetVolume(xu4.settings->musicVol);
+- soundSetVolume(xu4.settings->soundVol);
+- break;
+- }
+-}
+-
+-//----------------------------------------------------------------------------
+-
+-IntroController::IntroController() :
+- Controller(1),
+- backgroundArea(),
+- menuArea(1 * CHAR_WIDTH, 13 * CHAR_HEIGHT, 38, 11),
+- questionArea(INTRO_TEXT_X * CHAR_WIDTH, INTRO_TEXT_Y * CHAR_HEIGHT, INTRO_TEXT_WIDTH, INTRO_TEXT_HEIGHT),
+- mapArea(BORDER_WIDTH, (TILE_HEIGHT * 6) + BORDER_HEIGHT, INTRO_MAP_WIDTH, INTRO_MAP_HEIGHT),
+- menus(NULL),
+- binData(NULL),
+- titles(), // element list
+- title(titles.begin()), // element iterator
+- bSkipTitles(false),
+- egaGraphics(true)
+-{
+-}
+-
+ IntroController::~IntroController() {
+- delete menus;
+-
+ for (unsigned i=0; i < titles.size(); i++) {
+ delete titles[i].srcImage;
+ delete titles[i].destImage;
+@@ -558,10 +295,12 @@
+ bool IntroController::present() {
+ init();
+ preloadMap();
++ listenerId = gs_listen(1<<SENDER_MENU, introNotice, this);
+ return true;
+ }
+
+ void IntroController::conclude() {
++ gs_unplug(listenerId);
+ deleteIntro();
+ }
+
+@@ -637,8 +376,7 @@
+
+ backgroundArea.reinit();
+ menuArea.reinit();
+- if (menus)
+- menus->extendedMenuArea.reinit();
++ extendedMenuArea.reinit();
+ questionArea.reinit();
+ mapArea.reinit();
+
+@@ -714,17 +452,10 @@
+ MAP_ENABLE;
+ break;
+ case 'c': {
+- if (! menus)
+- menus = new SettingsMenus;
+-
+ // Make a copy of our settings so we can change them
+- menus->settingsChanged = *xu4.settings;
++ settingsChanged = *xu4.settings;
+ screenHideCursor();
+- menus->listenerId = gs_listen(1<<SENDER_MENU, menus->menusNotice,
+- menus);
+- menus->showMenu(&menus->confMenu);
+- runMenu(&menus->confMenu, &menus->extendedMenuArea, true);
+- gs_unplug(menus->listenerId);
++ runMenu(&confMenu, &extendedMenuArea, true);
+ screenShowCursor();
+ updateScreen();
+ break;
+@@ -1489,6 +1220,289 @@
+ }
+
+ /**
++ * Update the screen when an observed menu is reset or has an item
++ * activated.
++ * TODO, reduce duped code.
++ */
++void IntroController::introNotice(int sender, void* eventData, void* user) {
++ MenuEvent* event = (MenuEvent*) eventData;
++ ((IntroController*) user)->dispatchMenu(event->menu, *event);
++}
++
++void IntroController::dispatchMenu(const Menu *menu, MenuEvent &event) {
++ if (menu == &confMenu)
++ updateConfMenu(event);
++ else if (menu == &videoMenu)
++ updateVideoMenu(event);
++ else if (menu == &gfxMenu)
++ updateGfxMenu(event);
++ else if (menu == &soundMenu)
++ updateSoundMenu(event);
++ else if (menu == &inputMenu)
++ updateInputMenu(event);
++ else if (menu == &speedMenu)
++ updateSpeedMenu(event);
++ else if (menu == &gameplayMenu)
++ updateGameplayMenu(event);
++ else if (menu == &interfaceMenu)
++ updateInterfaceMenu(event);
++
++ // beasties are always visible on the menus
++ drawBeasties();
++}
++
++void IntroController::updateConfMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ // show or hide game enhancement options if enhancements are enabled/disabled
++ confMenu.getItemById(MI_CONF_GAMEPLAY)->setVisible(settingsChanged.enhancements);
++ confMenu.getItemById(MI_CONF_INTERFACE)->setVisible(settingsChanged.enhancements);
++
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++
++ switch(event.item->getId()) {
++ case MI_CONF_VIDEO:
++ runMenu(&videoMenu, &extendedMenuArea, true);
++ break;
++ case MI_VIDEO_CONF_GFX:
++ runMenu(&gfxMenu, &extendedMenuArea, true);
++ break;
++ case MI_CONF_SOUND:
++ runMenu(&soundMenu, &extendedMenuArea, true);
++ break;
++ case MI_CONF_INPUT:
++ runMenu(&inputMenu, &extendedMenuArea, true);
++ break;
++ case MI_CONF_SPEED:
++ runMenu(&speedMenu, &extendedMenuArea, true);
++ break;
++ case MI_CONF_GAMEPLAY:
++ runMenu(&gameplayMenu, &extendedMenuArea, true);
++ break;
++ case MI_CONF_INTERFACE:
++ runMenu(&interfaceMenu, &extendedMenuArea, true);
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateVideoMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case USE_SETTINGS:
++ /* save settings (if necessary) */
++ if (*xu4.settings != settingsChanged) {
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++
++ /* FIXME: resize images, etc. */
++ deleteIntro(); // delete intro stuff
++ screenReInit();
++ init(); // re-fix the backgrounds and scale images, etc.
++
++ // go back to menu mode
++ mode = INTRO_MENU;
++ }
++ break;
++ case MI_VIDEO_CONF_GFX:
++ runMenu(&gfxMenu, &extendedMenuArea, true);
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateGfxMenu(MenuEvent &event)
++{
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++
++ switch(event.item->getId()) {
++ case MI_GFX_RETURN:
++ runMenu(&videoMenu, &extendedMenuArea, true);
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateSoundMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case MI_SOUND_01:
++ musicSetVolume(settingsChanged.musicVol);
++ break;
++ case MI_SOUND_02:
++ soundSetVolume(settingsChanged.soundVol);
++ soundPlay(SOUND_FLEE);
++ break;
++ case USE_SETTINGS:
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++ musicPlay(introMusic);
++ break;
++ case CANCEL:
++ musicSetVolume(xu4.settings->musicVol);
++ soundSetVolume(xu4.settings->soundVol);
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateInputMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case USE_SETTINGS:
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++
++ // re-initialize keyboard
++ EventHandler::setKeyRepeat(settingsChanged.keydelay, settingsChanged.keyinterval);
++#ifndef IOS
++ screenShowMouseCursor(xu4.settings->mouseOptions.enabled);
++#endif
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++
++ // after drawing the menu, extra menu text can be added here
++ extendedMenuArea.textAt(0, 5, "Mouse Options:");
++}
++
++void IntroController::updateSpeedMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case USE_SETTINGS:
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++
++ // re-initialize events
++ xu4.eventHandler->setTimerInterval(1000 /
++ xu4.settings->gameCyclesPerSecond);
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateGameplayMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case USE_SETTINGS:
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++}
++
++void IntroController::updateInterfaceMenu(MenuEvent &event) {
++ if (event.type == MenuEvent::ACTIVATE ||
++ event.type == MenuEvent::INCREMENT ||
++ event.type == MenuEvent::DECREMENT) {
++
++ switch(event.item->getId()) {
++ case USE_SETTINGS:
++ // save settings
++ xu4.settings->setData(settingsChanged);
++ xu4.settings->write();
++ break;
++ case CANCEL:
++ // discard settings
++ settingsChanged = *xu4.settings;
++ break;
++ default: break;
++ }
++ }
++
++ // draw the extended background for all option screens
++ backgroundArea.draw(BKGD_OPTIONS_TOP, 0, 0);
++ backgroundArea.draw(BKGD_OPTIONS_BTM, 0, 120);
++
++ // after drawing the menu, extra menu text can be added here
++ extendedMenuArea.textAt(2, 3, " (Open, Jimmy, etc.)");
++}
++
++/**
+ * Initializes the question tree. The tree starts off with the first
+ * eight entries set to the numbers 0-7 in a random order.
+ */
diff --git a/games/xu4/u4.6 b/games/xu4/xu4.6
index 5ccf1d4bd6c63..b406722ab11af 100644
--- a/games/xu4/u4.6
+++ b/games/xu4/xu4.6
@@ -1,10 +1,10 @@
-.TH u4 6 "12 Oct 2021" "Version 1.1+svn" "XU4 Manual"
+.TH xu4 6 "January 13 2023" "Version 1.2.1" "SlackBuilds.org"
.SH NAME
-\fBu4\fR \- A modern reimplementation of the classic Ultima IV role\-playing game.
+\fBxu4\fR \- A modern reimplementation of the classic Ultima IV role\-playing game.
.SH SYNOPSIS
-.B u4
+.B xu4
.RI [ options ]
.SH DESCRIPTION
@@ -14,12 +14,12 @@ it easy and convenient to play this classic on modern operating
systems.
.PP
This man page only describes the command\-line options and keyboard commands
-supported by \fBu4\fR.
+supported by \fBxu4\fR.
For full documentation, see the files in \fI/usr/doc/xu4\-@VERSION@/\fR. The
README is a good place to start. Also the "History of Britannia" and the "Book
of Mystic Wisdom" are found there (you should read them before playing).
.SH OPTIONS
-\fBu4\fR accepts the following options:
+\fBxu4\fR accepts the following options:
.TP
.B "\-f, \-\-fullscreen"
Run in fullscreen mode.
@@ -29,13 +29,15 @@ Apply a filter on the scaled images. The <filt>
parameter must be set to one of the following
case\-sensitive options:
.I point
-.I 2xBi
-.I 2xSaI
-.I Scale2x
+.I HQX
+.I xBR-lv2
.TP
.B "\-i, \-skipintro"
Skip the intro, and go directly into the game.
-This option requires the existance of a valid saved game.
+This option requires the existence of a valid saved game.
+.TP
+.B "\-m, \-module <file>"
+Specify game module (default is Ultima-IV).
.TP
.B "\-p <profname>, \-profile <profname>"
Activate a specific save game profile. Using this
@@ -46,13 +48,13 @@ have e.g. different screen resolutions.
Use quotation marks around profile names that
include spaces.
All profiles are stored in the
-.I ~/.xu4/profiles
+.I ~/.config/xu4/profiles
sub\-directory.
The active profile name is shown on the
introduction map view off the main menu.
.TP
.B "\-q, \-quiet"
-Quiet mode \- no music.
+Disable audio.
.TP
.B \-scale <n>
Scale the original graphics by a factor of <n>.
@@ -62,7 +64,7 @@ Factor <n> must be 1, 2, 3, 4, or 5.
Verbose output; prints out information useful for
trouble\-shooting.
.SH KEYBOARD CONTROLS
-XU4 is played entirely with the keyboard. To make choices from menus,
+XU4 is played mainly with the keyboard (though mouse input is supported). To make choices from menus,
press the first letter of the menu choice (e.g. \fBJ\fR for "Journey Onward"
at the main menu). The Config menu also supports navigation with the arrow
keys and Enter.
@@ -177,13 +179,13 @@ ARROW KEYS
Control movement. North/South/East/West
.SH FILES
.TP
-.B ~/.xu4/
+.B ~/.config/xu4/
Configuration and saved games are stored here, when \fB\-p\fR is not in use. The config file is
\fBxu4rc\fR. It is human\-readable and editable, but normally is
created and updated by the in\-game configuration menu. The savegames
are in a binary format.
.TP
-.B ~/.xu4/profiles/<profname>/
+.B ~/.config/xu4/profiles/<profname>/
When using the \fB\-p <profname>\fR option, config and savegame data are
stored here instead.
.SH AUTHORS
diff --git a/games/xu4/xu4.SlackBuild b/games/xu4/xu4.SlackBuild
index 803e92f0518a5..97519e845b14d 100644
--- a/games/xu4/xu4.SlackBuild
+++ b/games/xu4/xu4.SlackBuild
@@ -6,6 +6,17 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+# 20230112 bkw: update for v1.2.1, after ~9 years there's a release!
+# - no more disable_alt_x.diff, it works properly now.
+# - always include the upgrade (u4upgrad.zip), since upstream does.
+# - new dependencies boron and faun.
+# - update man page and rename it u4 => xu4.
+# - rework profile_path.diff.
+# - update README and README-SBo.txt (remove obsolete info, add section
+# on running without pulse).
+# - TODO: test with the GoG release (someone has to create a GoG account,
+# even though it's free-of-charge, and I'm not able to).
+
# 20211012 bkw: BUILD=3,
# - new-style icon.
# - binary in /usr/games.
@@ -13,14 +24,11 @@
# - disable Alt-x keystroke (it crashes the game).
# - "Press Alt-x to quit" => "Close window to quit".
-# TODO: make Alt-x stop crashing the game. It seems to work correctly
-# only at the main menu, not while playing. Disabled it for now.
-
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=xu4
-VERSION=${VERSION:-20130612_svn}
-BUILD=${BUILD:-3}
+VERSION=${VERSION:-1.2.1}
+BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -41,6 +49,7 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
+# LIBDIRSUFFIX isn't actually used for 1.2.1
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
@@ -61,45 +70,37 @@ rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
-tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
-# There actually are some executables in the lib dir. If there hadn't
-# been, I would have left it as /usr/lib even on 64-bit, or better yet
-# change to /usr/share. As it is, it has to be /usr/lib64 on 64-bit.
-LIBDIR=/usr/lib$LIBDIRSUFFIX
-PKGLIBDIR=$PKG/$LIBDIR
+# If we didn't supply this file, 'make install' would try to download it.
+cat $CWD/u4upgrad.zip > u4upgrad.zip
+
+# The xu4 source on the homepage (sourceforge) is missing a commit
+# that's in the 1.2.1 tag on github, which makes it fail to compile.
+# I could use the github source, but it doesn't include src/glv.
+# Easier to just apply the github commit to the sf tarball.
+patch -p1 < $CWD/really_1.2.1.diff
# Fix path to "profiles/" dir used by -p option. Patch makes it use
-# ~/.xu4/profiles/ rather than ./profiles off the current dir.
+# ~/.config/xu4/profiles/ rather than ./profiles off the current dir.
patch -p1 < $CWD/profile_path.diff
-# Fix hard-coded libdir. Ugh.
-sed -i -e "s,/usr/lib,$LIBDIR," src/u4file.cpp
-
-# Stop u4 from writing border.png in the current dir (it never *reads* it!)
-sed -i -e '/border\.png/s,^,//,' src/imagemgr.cpp
-
-# The libxml2 in Slack 14.2 is pickier than the one in 14.1, and fails to
-# validate the game's XML files. So:
-sed -i '/#define *DEFAULT_VALIDATE_XML/s,1,0,' src/settings.h
-
-# Patch for GCC 7
-patch -p1 < $CWD/gcc7.patch
-
-# 20211012 bkw: work around a bug. Disable Alt-X as it crashes the
-# game. Tell the user to close the window to quit, instead.
-patch -p1 < $CWD/disable_alt_x.diff
+# Use our flags, plus install to /usr/games (not /usr/bin).
+sed -i -e "s,-O3,$SLKCFLAGS," src/Makefile
+sed -i -e "/DESTDIR/s,/bin,/games,g" Makefile
-# The -DNPERF stops u4 from creating a debug/ in the current dir.
-make -C src DEBUGCXXFLAGS="-DNPERF $SLKCFLAGS" prefix=/usr libdir=$PKGLIBDIR
-make -C src install prefix=$PKG/usr bindir=$PKG/usr/games libdir=$PKGLIBDIR
-
-find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
- | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+# The configure script isn't autoconf (doesn't support the standard
+# options) and the Makefile uses DESTDIR to mean PREFIX, more-or-less.
+# We don't have to strip the binary (make install does it for us).
+# Since we're not building from a git tree, we have to explicitly
+# set VERSION (it only shows up in --help and the 'About' in the game).
+./configure --prefix /usr
+make DESTDIR=/usr VERSION=$VERSION
+make install DESTDIR=$PKG/usr VERSION=$VERSION
# If we have the official release rather than the "dragon" one, repackage
# it with the same layout as the dragon release. Note that the official
@@ -111,54 +112,45 @@ fi
# The game data. This is the zip file, not the self-extracting exe (the
# exe lacks the documentation, for one thing).
-cat $CWD/ultima4.zip > $PKGLIBDIR/u4/ultima4.zip
+cat $CWD/ultima4.zip > $PKG/usr/share/xu4/ultima4.zip
# Replace stock .desktop file with one that validates.
-cat $CWD/u4.desktop > $PKG/usr/share/applications/u4.desktop
-
-# These files should be (but aren't) installed by "make install". Without
-# them, we get no music!
-install -m0644 mid/*.it $PKGLIBDIR/u4/music/
+cat $CWD/xu4.desktop > $PKG/usr/share/applications/xu4.desktop
-# Remove execute permission from data files. Grr.
-chmod 644 $PKG/usr/share/pixmaps/* $PKG/usr/share/applications/*
-find $PKGLIBDIR \
- -type f -a \
- \( -name \*.mid -o -name \*.vga -o -name \*.png -o \
- -name \*.xml -o -name \*.dtd -o -name \*.ogg \) \
- -print0 | xargs -0 chmod 644
+# New-style icons, made by downsizing icons/u4.png, except 128x128 was
+# extracted from icons/xu4.icns in the source. I didn't downsize the
+# Mac icon because it has a checkerboard background that looks good
+# at 128x128, but horrid when downscaled.
+# 48x48 was already installed, above.
+HICOLOR=$PKG/usr/share/icons/hicolor/
+mkdir -p $HICOLOR/64x64/apps
+cat icons/u4.png > $HICOLOR/64x64/apps/$PRGNAM.png
-# 20211012 bkw: new-style icon...
for i in $CWD/icons/*.png; do
px=$( basename $i | cut -d. -f1 )
size=${px}x${px}
- dir=$PKG/usr/share/icons/hicolor/$size/apps
+ dir=$HICOLOR/$size/apps
mkdir -p $dir
cat $i > $dir/u4.png
done
-rm -f $PKG/usr/share/pixmaps/u4.png
-ln -s ../icons/hicolor/64x64/apps/u4.png $PKG/usr/share/pixmaps/u4.png
-
-# Docs. N.B. we don't need border.png.
-mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/developers
-cp -a *.html AUTHORS COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
-cp -a doc/* $PKG/usr/doc/$PRGNAM-$VERSION/developers
-cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
-
-# Include the upgrade (and extract its docs) if we have it.
-if [ -e $CWD/u4upgrad.zip ]; then
- cat $CWD/u4upgrad.zip > $PKGLIBDIR/u4/u4upgrad.zip
- cd $PKG/usr/doc/$PRGNAM-$VERSION
- unzip $CWD/u4upgrad.zip Readme.txt
- mv Readme.txt Readme-Upgrade.txt
- cd -
-fi
+mkdir -p $PKG/usr/share/pixmaps
+ln -s ../icons/hicolor/48x48/apps/xu4.png $PKG/usr/share/pixmaps/xu4.png
+
+# Docs.
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC/developers
+cp -a AUTHORS COPYING ChangeLog README* $PKGDOC
+cp -a doc/* $PKGDOC/developers
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+# Include the upgrade's docs.
+unzip -p $CWD/u4upgrad.zip Readme.txt > $PKGDOC/Readme-Upgrade.txt
# Include the PDF docs, if we have them.
if [ -e $CWD/ultima4_scanned_docs.zip ]; then
- mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/pdf
- cd $PKG/usr/doc/$PRGNAM-$VERSION/pdf
+ mkdir -p $PKGDOC/pdf
+ cd $PKGDOC/pdf
unzip $CWD/ultima4_scanned_docs.zip '*.pdf'
mv ultima4_scanned_docs/Ultima_IV_-_Cluebook_-_PC.pdf Hints.pdf
mv ultima4_scanned_docs/Ultima_IV_-_Manual_-_PC.pdf History.pdf
@@ -168,7 +160,7 @@ if [ -e $CWD/ultima4_scanned_docs.zip ]; then
fi
# Include the original Ultima IV docs.
-cd $PKG/usr/doc/$PRGNAM-$VERSION
+cd $PKGDOC
unzip $CWD/ultima4.zip '*.txt' '*.doc' '*.bmp' '*.jpg' || true
# These docs only apply to running the original game on DOS or Windows. Bye.
@@ -186,14 +178,10 @@ chmod 644 *.txt ms_word_docs/*.doc
sed -i 's/\r//' *.txt
cd -
-# I hate packages called "xfoo" whose binaries are called "foo".
-ln -s u4 $PKG/usr/games/$PRGNAM
-
# I also hate binaries that take options but have no man pages, so here's
-# the one I made. Enjoy.
+# the one I made. Enjoy. I wish I'd used rst or pod for it...
mkdir -p $PKG/usr/man/man6
-sed "s/@VERSION@/$VERSION/" $CWD/u4.6 | gzip -9c - > $PKG/usr/man/man6/u4.6.gz
-ln -s u4.6.gz $PKG/usr/man/man6/$PRGNAM.6.gz
+sed "s/@VERSION@/$VERSION/" $CWD/xu4.6 | gzip -9c - > $PKG/usr/man/man6/xu4.6.gz
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/games/xu4/u4.desktop b/games/xu4/xu4.desktop
index cbe56344861b3..ce36a0b610e05 100644
--- a/games/xu4/u4.desktop
+++ b/games/xu4/xu4.desktop
@@ -1,8 +1,8 @@
[Desktop Entry]
Name=Ultima 4
Comment=Ultima 4 (xu4)
-Exec=/usr/games/u4
-Icon=u4
+Exec=xu4
+Icon=xu4
Terminal=false
Type=Application
Categories=Game;RolePlaying;
diff --git a/games/xu4/xu4.info b/games/xu4/xu4.info
index 54577513369b3..8881cb6d0e863 100644
--- a/games/xu4/xu4.info
+++ b/games/xu4/xu4.info
@@ -1,12 +1,14 @@
PRGNAM="xu4"
-VERSION="20130612_svn"
-HOMEPAGE="http://xu4.sourceforge.net/"
-DOWNLOAD="https://slackware.uk/~urchlay/src/xu4-20130612_svn.tar.xz \
- https://web.archive.org/web/20091209235819/http://www.thatfleminggent.com/ultima/ultima4.zip"
+VERSION="1.2.1"
+HOMEPAGE="https://xu4.sourceforge.net/"
+DOWNLOAD="https://downloads.sourceforge.net/project/xu4/xu4/1.2/xu4-1.2.1.tar.gz \
+ https://web.archive.org/web/20091209235819/http://www.thatfleminggent.com/ultima/ultima4.zip \
+ https://downloads.sourceforge.net/project/xu4/Ultima%204%20VGA%20Upgrade/1.3/u4upgrad.zip"
MD5SUM="a0c013bf91458b2b4c5ad8c729990d62 \
- f2006a5dbf175571912ef2594b6eb900"
+ f2006a5dbf175571912ef2594b6eb900 \
+ 4ce9c9cd9dab111275e0ebfde7a482c4"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
-REQUIRES=""
+REQUIRES="boron faun"
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"