Merge remote-tracking branch 'origin/master' into sdl2-branch

This commit is contained in:
Simon Howard 2017-01-14 21:55:08 +00:00
commit 166e2bca93
9 changed files with 293 additions and 74 deletions

View file

@ -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

View file

@ -117,9 +117,9 @@ From the command line it is possible to combine these files into a
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

View file

@ -17,7 +17,7 @@ TOPLEVEL_DOCS=$(patsubst %,../../%,$(DOC_FILES))
$(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)

View file

@ -1616,17 +1616,7 @@ void D_DoomMain (void)
// 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))

View file

@ -121,6 +121,7 @@ static int WarpMap;
static int demosequence;
static int pagetic;
static char *pagename;
static char *SavePathConfig;
// CODE --------------------------------------------------------------------
@ -166,7 +167,7 @@ void D_BindVariables(void)
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,14 +186,30 @@ static void D_SetDefaultSavePath(void)
{
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;
}
}
@ -376,14 +393,14 @@ void D_DoomMain(void)
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");

View file

@ -2184,11 +2184,41 @@ char *M_GetSaveGameDir(char *iwadname)
{
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("");
}

View file

@ -340,7 +340,7 @@ static void UpdateSkillButton(void)
{
skillbutton->values = hexen_fighter_skills;
}
else if (character_class == 2)
else if (character_class == 1)
{
skillbutton->values = hexen_cleric_skills;
}

View file

@ -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

View file

@ -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 @@ char mapdir[1024]; // directory of development maps
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 @@ void D_DoomLoop (void)
if (!showintro)
{
I_SetWindowTitle(gamedescription);
I_InitGraphics();
}
@ -922,7 +925,27 @@ void D_SetGameDescription(void)
}
// 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)
{
@ -1082,6 +1105,85 @@ static void D_Endoom(void)
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_IntroBackground(void)
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 @@ static void D_InitIntroSequence(void)
// 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 @@ static void D_DrawIntroSequence(void)
{
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 @@ void D_DoomMain (void)
D_BindVariables();
M_LoadDefaults();
if (!graphical_startup)
{
showintro = false;
}
// Save configuration at exit.
I_AtExit(M_SaveDefaults, false);
@ -1659,7 +1826,9 @@ void D_DoomMain (void)
D_IdentifyVersion();
InitGameVersion();
InitTitleString();
D_SetGameDescription();
I_SetWindowTitle(gamedescription);
savegamedir = M_GetSaveGameDir("strife1.wad");
// fraggle 20130405: I_InitTimer is needed here for the netgame
@ -1987,5 +2156,10 @@ void D_DoomMain (void)
D_StartTitle (); // start up intro loop
}
if (using_text_startup)
{
TXT_Shutdown();
}
D_DoomLoop (); // never returns
}