ref: 166e2bca936409c8ec78867bc0fc04eeba418e6e
parent: df05cd8e0e71b4e48e88f12c779484e1abac45c1
parent: eaf851e095ca15c11b26d2aa7c2589617939d2db
author: Simon Howard <[email protected]>
date: Sat Jan 14 16:55:08 EST 2017
Merge remote-tracking branch 'origin/master' into sdl2-branch
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,9 @@
+## HEAD
+
+### General
+ * A new parameter -savedir allows users to specify a directory from
+ which to load and save games. (thanks CapnClever)
+
## 2.3.0 (2016-12-29)
### General
--- a/man/INSTALL.template
+++ b/man/INSTALL.template
@@ -117,9 +117,9 @@
single large file, using a command similar to the following:
#if _WIN32
- copy doom_se.1+doom_se.2+doom_se.3+doom_se.4+doom_se.5 doom_se.lha
+ copy doom_se.1+doom_se.2+doom_se.3+doom_se.4+doom_se.5 doom_se.lzh
#else
- cat doom_se.1 doom_se.2 doom_se.3 doom_se.4 doom_se.5 > doom_se.lha
+ cat doom_se.1 doom_se.2 doom_se.3 doom_se.4 doom_se.5 > doom_se.lzh
#endif
The resulting file is an LHA archive file, and it can be extracted
--- a/pkg/osx/GNUmakefile
+++ b/pkg/osx/GNUmakefile
@@ -17,7 +17,7 @@
$(DMG) : tmp.dmg
rm -f $@
./dmgfix "$(realpath tmp.dmg)" "$(PACKAGE_STRING)" "$(PACKAGE_NAME).app"
- hdiutil convert -format UDZO -o $@ tmp.dmg
+ hdiutil convert -format UDBZ -o $@ tmp.dmg
rm -f tmp.dmg
tmp.dmg : $(STAGING_DIR)
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -1616,17 +1616,7 @@
// we've finished loading Dehacked patches.
D_SetGameDescription();
-#ifdef _WIN32
- // In -cdrom mode, we write savegames to c:\doomdata as well as configs.
- if (M_ParmExists("-cdrom"))
- {
- savegamedir = configdir;
- }
- else
-#endif
- {
- savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission));
- }
+ savegamedir = M_GetSaveGameDir(D_SaveGameIWADName(gamemission));
// Check for -file in shareware
if (modifiedgame && (gamevariant != freedoom))
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -121,6 +121,7 @@
static int demosequence;
static int pagetic;
static char *pagename;
+static char *SavePathConfig;
// CODE --------------------------------------------------------------------
@@ -166,7 +167,7 @@
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
- M_BindStringVariable("savedir", &SavePath);
+ M_BindStringVariable("savedir", &SavePathConfig);
// Multiplayer chat macros
@@ -185,15 +186,31 @@
{
SavePath = M_GetSaveGameDir("hexen.wad");
- // If we are not using a savegame path (probably because we are on
- // Windows and not using a config dir), behave like Vanilla Hexen
- // and use hexndata/:
-
if (!strcmp(SavePath, ""))
{
- SavePath = malloc(10);
- M_snprintf(SavePath, 10, "hexndata%c", DIR_SEPARATOR);
+ // only get hexen.cfg path if one is not already found
+
+ if (!strcmp(SavePathConfig, ""))
+ {
+ // If we are not using a savegame path (probably because we are on
+ // Windows and not using a config dir), behave like Vanilla Hexen
+ // and use hexndata/:
+
+ SavePath = malloc(10);
+ M_snprintf(SavePath, 10, "hexndata%c", DIR_SEPARATOR);
+ }
+ else
+ {
+ SavePath = M_StringDuplicate(SavePathConfig);
+ }
}
+
+ // only set hexen.cfg path if using default handling
+
+ if (!M_ParmExists("-savedir") && !M_ParmExists("-cdrom"))
+ {
+ SavePathConfig = SavePath;
+ }
}
// The Mac version of the Hexen IWAD is different to the "normal" DOS
@@ -376,14 +393,14 @@
M_SetConfigDir(NULL);
}
- D_SetDefaultSavePath();
M_SetConfigFilenames("hexen.cfg", PROGRAM_PREFIX "hexen.cfg");
M_LoadDefaults();
+ D_SetDefaultSavePath();
+
I_AtExit(M_SaveDefaults, false);
-
- // Now that the savedir is loaded from .CFG, make sure it exists
+ // Now that the savedir is loaded, make sure it exists
CreateSavePath();
ST_Message("Z_Init: Init zone memory allocation daemon.\n");
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -2184,11 +2184,41 @@
{
char *savegamedir;
char *topdir;
+ int p;
+ //!
+ // @arg <directory>
+ //
+ // Specify a path from which to load and save games. If the directory
+ // does not exist then it will automatically be created.
+ //
+
+ p = M_CheckParmWithArgs("-savedir", 1);
+ if (p)
+ {
+ savegamedir = myargv[p + 1];
+ if (!M_FileExists(savegamedir))
+ {
+ M_MakeDirectory(savegamedir);
+ }
+
+ // add separator at end just in case
+ savegamedir = M_StringJoin(savegamedir, DIR_SEPARATOR_S, NULL);
+
+ printf("Save directory changed to %s.\n", savegamedir);
+ }
+#ifdef _WIN32
+ // In -cdrom mode, we write savegames to a specific directory
+ // in addition to configs.
+
+ else if (M_ParmExists("-cdrom"))
+ {
+ savegamedir = configdir;
+ }
+#endif
// If not "doing" a configuration directory (Windows), don't "do"
// a savegame directory, either.
-
- if (!strcmp(configdir, ""))
+ else if (!strcmp(configdir, ""))
{
savegamedir = M_StringDuplicate("");
}
--- a/src/setup/multiplayer.c
+++ b/src/setup/multiplayer.c
@@ -340,7 +340,7 @@
{
skillbutton->values = hexen_fighter_skills;
}
- else if (character_class == 2)
+ else if (character_class == 1)
{
skillbutton->values = hexen_cleric_skills;
}
--- a/src/strife/Makefile.am
+++ b/src/strife/Makefile.am
@@ -1,4 +1,6 @@
-AM_CFLAGS = -I$(top_srcdir)/src @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
+AM_CFLAGS=-I$(top_srcdir)/src \
+ -I$(top_srcdir)/textscreen \
+ @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
noinst_LIBRARIES=libstrife.a
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -34,6 +34,9 @@
#include "doomfeatures.h"
#include "sounds.h"
+#include "txt_main.h"
+#include "txt_io.h"
+
#include "d_iwad.h"
#include "z_zone.h"
@@ -145,6 +148,7 @@
int show_endoom = 1;
int show_diskicon = 1;
int graphical_startup = 1;
+static boolean using_text_startup;
// If true, startup has completed and the main game loop has started.
@@ -510,7 +514,6 @@
if (!showintro)
{
- I_SetWindowTitle(gamedescription);
I_InitGraphics();
}
@@ -922,8 +925,28 @@
}
// print title for every printed line
-char title[128];
+static char title[128] = "";
+static void InitTitleString(void)
+{
+ switch (gameversion)
+ {
+ case exe_strife_1_2:
+ DEH_snprintf(title, sizeof(title), " "
+ "STRIFE: Quest for the Sigil v1.2"
+ " "
+ );
+ break;
+ case exe_strife_1_31:
+ default:
+ DEH_snprintf(title, sizeof(title), " "
+ "STRIFE: Quest for the Sigil v1.31"
+ " "
+ );
+ break;
+ }
+}
+
static boolean D_AddFile(char *filename)
{
wad_file_t *handle;
@@ -1082,6 +1105,85 @@
I_Endoom(endoom);
}
+//
+// D_GetCursorColumn
+//
+static int D_GetCursorColumn(void)
+{
+ int x, y;
+ TXT_GetXY(&x, &y);
+ return x;
+}
+
+//
+// D_GetCursorRow
+//
+static int D_GetCursorRow(void)
+{
+ int x, y;
+ TXT_GetXY(&x, &y);
+ return y;
+}
+
+//
+// D_SetCursorPosition
+//
+static void D_SetCursorPosition(int column, int row)
+{
+ TXT_GotoXY(column, row);
+}
+
+//
+// D_SetChar
+//
+static void D_SetChar(char c)
+{
+ int x, y;
+ // Backup position
+ TXT_GetXY(&x, &y);
+ TXT_PutChar(c);
+ // Restore position
+ TXT_GotoXY(x, y);
+}
+
+//
+// D_DrawText
+//
+static void D_DrawText(char *string, int bc, int fc)
+{
+ int column;
+ int row;
+ int i;
+
+ if (!using_text_startup)
+ {
+ return;
+ }
+
+ // Set text color
+ TXT_BGColor(bc, 0);
+ TXT_FGColor(fc);
+
+ // Get column position
+ column = D_GetCursorColumn();
+
+ // Get row position
+ row = D_GetCursorRow();
+
+ for (i = 0; i < strlen(string); i++)
+ {
+ // Set character
+ D_SetChar(string[i]);
+
+ // Check cursor position
+ if (++column >= 80)
+ column = 0;
+
+ // Set postition
+ D_SetCursorPosition(column, row);
+ }
+}
+
//=============================================================================
//
// haleyjd: Chocolate Strife Specifics
@@ -1169,11 +1271,20 @@
static void D_InitIntroSequence(void)
{
+ byte *textScreen;
+ char string[80];
+
+ if (devparm || !graphical_startup || testcontrols)
+ {
+ using_text_startup = false;
+ showintro = false;
+ return;
+ }
+
if(showintro)
{
// In vanilla Strife, Mode 13h was initialized directly in D_DoomMain.
// We have to be a little more courteous of the low-level code here.
- I_SetWindowTitle(gamedescription);
I_SetGrabMouseCallback(D_StartupGrabCallback);
I_InitGraphics();
V_RestoreBuffer(); // make the V_ routines work
@@ -1190,22 +1301,62 @@
// Draw the background
D_IntroBackground();
+
+ using_text_startup = false;
}
- /*
- // STRIFE-FIXME: This was actually displayed on a special textmode
- // screen with ANSI color codes... would require use of textlib to
- // emulate properly...
else
{
- puts(DEH_String("Conversation ON"));
- puts(DEH_String("Rogue Entertainment"));
- puts(DEH_String("and"));
- puts(DEH_String("Velocity Games"));
- puts(DEH_String("present"));
- puts(DEH_String("S T R I F E"));
- puts(DEH_String("Loading..."));
+ if (!TXT_Init())
+ {
+ using_text_startup = false;
+ return;
+ }
+
+ I_InitWindowTitle();
+ I_InitWindowIcon();
+
+ // Clear screen
+ textScreen = TXT_GetScreenData();
+ memset(textScreen, 0, 4000);
+
+ using_text_startup = true;
+
+ // Print title
+
+ D_SetCursorPosition(0, 0);
+ D_DrawText(title, TXT_COLOR_GREEN, TXT_COLOR_BLACK);
+
+ DEH_snprintf(string, sizeof(string), "Rogue Entertainment");
+ D_SetCursorPosition(40 - strlen(string) / 2, 5);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string), "and");
+ D_SetCursorPosition(40 - strlen(string) / 2, 7);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string), "Velocity Games");
+ D_SetCursorPosition(40 - strlen(string) / 2, 9);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string), "present");
+ D_SetCursorPosition(40 - strlen(string) / 2, 11);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string), "S T R I F E");
+ D_SetCursorPosition(40 - strlen(string) / 2, 14);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string), "Loading...");
+ D_SetCursorPosition(40 - strlen(string) / 2, 17);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ DEH_snprintf(string, sizeof(string),
+ "[ ]");
+ D_SetCursorPosition(14, 18);
+ D_DrawText(string, TXT_COLOR_BLUE, TXT_COLOR_GREEN);
+
+ TXT_UpdateScreen();
}
- */
}
//
@@ -1218,41 +1369,62 @@
{
int laserpos;
int robotpos;
+ int i;
- if(!showintro)
- return;
+ if (showintro)
+ {
+ D_IntroBackground(); // haleyjd: refresh the background
- D_IntroBackground(); // haleyjd: refresh the background
+ // Laser position
+ laserpos = (200 * introprogress / MAXINTROPROGRESS) + 60;
- // Laser position
- laserpos = (200 * introprogress / MAXINTROPROGRESS) + 60;
+ // BUG: (?) Due to this clip, the laser never even comes close to
+ // touching the peasant; confirmed with vanilla. This MAY have been
+ // intentional, for effect, however, since no death frames are shown
+ // either... kind of a black-out death.
+ if (laserpos > 200)
+ laserpos = 200;
- // BUG: (?) Due to this clip, the laser never even comes close to
- // touching the peasant; confirmed with vanilla. This MAY have been
- // intentional, for effect, however, since no death frames are shown
- // either... kind of a black-out death.
- if(laserpos > 200)
- laserpos = 200;
+ // Draw the laser
+ // Blitted 16 bytes for 16 rows starting at 705280 + laserpos
+ // (705280 - 0xA0000) / 320 == 156
+ V_DrawBlock(laserpos, 156, 16, 16, rawgfx_startlz[laserpos % 2]);
- // Draw the laser
- // Blitted 16 bytes for 16 rows starting at 705280 + laserpos
- // (705280 - 0xA0000) / 320 == 156
- V_DrawBlock(laserpos, 156, 16, 16, rawgfx_startlz[laserpos % 2]);
+ // Robot position
+ robotpos = laserpos % 5 - 2;
- // Robot position
- robotpos = laserpos % 5 - 2;
+ // Draw the robot
+ // Blitted 48 bytes for 48 rows starting at 699534 + (320*robotpos)
+ // 699534 - 0xA0000 == 44174, which % 320 == 14, / 320 == 138
+ V_DrawBlock(14, 138 + robotpos, 48, 48, rawgfx_startbot);
- // Draw the robot
- // Blitted 48 bytes for 48 rows starting at 699534 + (320*robotpos)
- // 699534 - 0xA0000 == 44174, which % 320 == 14, / 320 == 138
- V_DrawBlock(14, 138 + robotpos, 48, 48, rawgfx_startbot);
+ // Draw the peasant
+ // Blitted 32 bytes for 64 rows starting at 699142
+ // 699142 - 0xA0000 == 43782, which % 320 == 262, / 320 == 136
+ V_DrawBlock(262, 136, 32, 64, rawgfx_startp[laserpos % 4]);
- // Draw the peasant
- // Blitted 32 bytes for 64 rows starting at 699142
- // 699142 - 0xA0000 == 43782, which % 320 == 262, / 320 == 136
- V_DrawBlock(262, 136, 32, 64, rawgfx_startp[laserpos % 4]);
+ I_FinishUpdate();
+ }
+ else if (using_text_startup)
+ {
+ // Laser position
+ laserpos = 50 * introprogress / MAXINTROPROGRESS;
- I_FinishUpdate();
+ if (laserpos > 50)
+ {
+ laserpos = 50;
+ }
+
+ for (i = 0; i < laserpos; i++)
+ {
+ D_SetCursorPosition(15 + i, 18);
+ D_DrawText("#", TXT_COLOR_GREEN, TXT_COLOR_BLUE);
+ }
+
+ I_Sleep(10);
+
+ TXT_UpdateScreen();
+ }
}
//
@@ -1541,11 +1713,6 @@
D_BindVariables();
M_LoadDefaults();
- if (!graphical_startup)
- {
- showintro = false;
- }
-
// Save configuration at exit.
I_AtExit(M_SaveDefaults, false);
@@ -1659,7 +1826,9 @@
D_IdentifyVersion();
InitGameVersion();
+ InitTitleString();
D_SetGameDescription();
+ I_SetWindowTitle(gamedescription);
savegamedir = M_GetSaveGameDir("strife1.wad");
// fraggle 20130405: I_InitTimer is needed here for the netgame
@@ -1985,6 +2154,11 @@
G_InitNew (startskill, startmap);
else
D_StartTitle (); // start up intro loop
+ }
+
+ if (using_text_startup)
+ {
+ TXT_Shutdown();
}
D_DoomLoop (); // never returns