summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2011-09-11 23:40:44 +0000
committerSimon Howard2011-09-11 23:40:44 +0000
commitefd15d965dee947a04727bb62f4e2092cf28732f (patch)
tree730d99c1e88d5e3145e552ad69dec52d30026d01 /src
parent4d17ab361e90a75dc6deefd37e6eb2ba0610b386 (diff)
parent11024d8214580d63ca7a9e70a121f5ff542a2fce (diff)
downloadchocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.tar.gz
chocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.tar.bz2
chocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.zip
Merge from raven-branch.
Subversion-branch: /branches/strife-branch Subversion-revision: 2367
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am22
-rw-r--r--src/d_iwad.c46
-rw-r--r--src/d_iwad.h1
-rw-r--r--src/d_mode.h1
-rw-r--r--src/deh_io.c2
-rw-r--r--src/doom-screensaver.desktop.in12
-rw-r--r--src/doom.desktop.in7
-rw-r--r--src/doom/d_main.c97
-rw-r--r--src/doom/d_net.c3
-rw-r--r--src/doom/doom.desktop.in7
-rw-r--r--src/doom/doomstat.c2
-rw-r--r--src/doom/g_game.c7
-rw-r--r--src/doom/m_menu.c1
-rw-r--r--src/doom/p_map.c59
-rw-r--r--src/doom/p_setup.c27
-rw-r--r--src/doom/st_stuff.c9
-rw-r--r--src/heretic/d_main.c30
-rw-r--r--src/heretic/doomdef.h4
-rw-r--r--src/heretic/g_game.c46
-rw-r--r--src/heretic/mn_menu.c31
-rw-r--r--src/hexen/h2_main.c13
-rw-r--r--src/i_endoom.c2
-rw-r--r--src/i_oplmusic.c9
-rw-r--r--src/i_scale.c16
-rw-r--r--src/i_system.c151
-rw-r--r--src/i_system.h2
-rw-r--r--src/i_video.c2
-rw-r--r--src/m_config.c37
-rw-r--r--src/m_config.h1
-rw-r--r--src/m_misc.c25
-rw-r--r--src/net_server.c1
-rw-r--r--src/setup/Makefile.am6
-rw-r--r--src/setup/display.c222
-rw-r--r--src/setup/joystick.c3
-rw-r--r--src/setup/setup-manifest.xml.in25
-rw-r--r--src/setup/setup.desktop.in7
-rw-r--r--src/setup/sound.c2
-rw-r--r--src/setup/txt_joybinput.c21
-rw-r--r--src/setup/txt_joybinput.h1
-rw-r--r--src/setup/txt_keyinput.c21
-rw-r--r--src/setup/txt_keyinput.h1
-rw-r--r--src/setup/txt_mouseinput.c20
-rw-r--r--src/setup/txt_mouseinput.h1
43 files changed, 726 insertions, 277 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0b747f89..99ace5cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -194,24 +194,36 @@ endif
@PROGRAM_PREFIX@setup_LDADD = setup/libsetup.a \
$(top_builddir)/wince/libc_wince.a \
$(top_builddir)/textscreen/libtextscreen.a \
- @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@
+ @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
EXTRA_DIST = \
icon.c \
doom-screensaver.desktop.in
+appdir = $(prefix)/share/applications
+app_DATA = @PROGRAM_PREFIX@doom.desktop
+
+@PROGRAM_PREFIX@doom.desktop : doom.desktop
+ cp $< $@
+
+screensaverdir = $(prefix)/share/applications/screensavers
+screensaver_DATA = @PROGRAM_PREFIX@doom-screensaver.desktop
+
+@PROGRAM_PREFIX@doom-screensaver.desktop: doom-screensaver.desktop
+ cp $< $@
+
.rc.o:
- $(WINDRES) $^ -o $@
+ $(WINDRES) $< -o $@
%.o : %.rc
- $(WINDRES) $^ -o $@
+ $(WINDRES) $< -o $@
if HAVE_PYTHON
icon.c : $(top_builddir)/data/doom8.ico
- $(top_builddir)/data/convert-icon $^ $@
+ $(top_builddir)/data/convert-icon $< $@
endif
midiread : midifile.c
- $(CC) -DTEST $(CFLAGS) @LDFLAGS@ $^ -o $@
+ $(CC) -DTEST $(CFLAGS) @LDFLAGS@ $< -o $@
diff --git a/src/d_iwad.c b/src/d_iwad.c
index a6187c10..d0bfe692 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -424,27 +424,29 @@ static GameMission_t IdentifyIWADByName(char *name, int mask)
{
size_t i;
GameMission_t mission;
+ char *p;
+
+ p = strrchr(name, DIR_SEPARATOR);
+
+ if (p != NULL)
+ {
+ name = p + 1;
+ }
mission = none;
for (i=0; i<arrlen(iwads); ++i)
{
- char *iwadname;
+ // Check if the filename is this IWAD name.
// Only use supported missions:
if (((1 << iwads[i].mission) & mask) == 0)
continue;
- iwadname = DEH_String(iwads[i].name);
-
- if (strlen(name) < strlen(iwadname))
- continue;
-
// Check if it ends in this IWAD name.
- if (!strcasecmp(name + strlen(name) - strlen(iwadname),
- iwadname))
+ if (!strcasecmp(name, iwads[i].name))
{
mission = iwads[i].mission;
break;
@@ -729,3 +731,31 @@ iwad_t **D_FindAllIWADs(int mask)
return result;
}
+//
+// Get the IWAD name used for savegames.
+//
+
+char *D_SaveGameIWADName(GameMission_t gamemission)
+{
+ size_t i;
+
+ // Determine the IWAD name to use for savegames.
+ // This determines the directory the savegame files get put into.
+ //
+ // Note that we match on gamemission rather than on IWAD name.
+ // This ensures that doom1.wad and doom.wad saves are stored
+ // in the same place.
+
+ for (i=0; i<arrlen(iwads); ++i)
+ {
+ if (gamemission == iwads[i].mission)
+ {
+ return iwads[i].name;
+ }
+ }
+
+ // Default fallback:
+
+ return "unknown.wad";
+}
+
diff --git a/src/d_iwad.h b/src/d_iwad.h
index d92dbeff..a7cdf932 100644
--- a/src/d_iwad.h
+++ b/src/d_iwad.h
@@ -49,6 +49,7 @@ char *D_FindWADByName(char *filename);
char *D_TryFindWADByName(char *filename);
char *D_FindIWAD(int mask, GameMission_t *mission);
iwad_t **D_FindAllIWADs(int mask);
+char *D_SaveGameIWADName(GameMission_t gamemission);
#endif
diff --git a/src/d_mode.h b/src/d_mode.h
index 20cb89e2..c0d302dc 100644
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -66,6 +66,7 @@ typedef enum
exe_hacx, // Hacx
exe_ultimate, // Ultimate Doom (retail)
exe_final, // Final Doom
+ exe_final2, // Final Doom (alternate exe)
exe_chex, // Chex Quest executable (based on Final Doom)
exe_heretic_1_3, // Heretic 1.3
diff --git a/src/deh_io.c b/src/deh_io.c
index 92c81632..83609068 100644
--- a/src/deh_io.c
+++ b/src/deh_io.c
@@ -181,7 +181,7 @@ int DEH_GetCharLump(deh_context_t *context)
int DEH_GetChar(deh_context_t *context)
{
- int result;
+ int result = 0;
// Read characters, but ignore carriage returns
// Essentially this is a DOS->Unix conversion
diff --git a/src/doom-screensaver.desktop.in b/src/doom-screensaver.desktop.in
index cee79c2d..315f964c 100644
--- a/src/doom-screensaver.desktop.in
+++ b/src/doom-screensaver.desktop.in
@@ -1,12 +1,12 @@
[Desktop Entry]
-Encoding=UTF-8
-Name=Doom
-Comment=DOOM by Id Software.
-TryExec=@PACKAGE_TARNAME@
-Exec=@PACKAGE_TARNAME@
+Name=@PACKAGE_NAME@
+Comment=@PACKAGE_SHORTDESC@
+TryExec=@PROGRAM_PREFIX@doom
+Exec=@PROGRAM_PREFIX@doom
StartupNotify=false
Terminal=false
Type=Application
-Categories=Screensaver
+OnlyShowIn=GNOME;
+Categories=Screensaver;
diff --git a/src/doom.desktop.in b/src/doom.desktop.in
new file mode 100644
index 00000000..44b76e62
--- /dev/null
+++ b/src/doom.desktop.in
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=@PACKAGE_NAME@
+Exec=@PROGRAM_PREFIX@doom
+Icon=@PROGRAM_PREFIX@doom
+Type=Application
+Comment=@PACKAGE_SHORTDESC@
+Categories=Game;ActionGame;
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 991907fa..0e5324b4 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -532,6 +532,9 @@ void D_DoAdvanceDemo (void)
// include a DEMO4 lump, so the game bombs out with an error
// when it reaches this point in the demo sequence.
+ // However! There is an alternate version of Final Doom that
+ // includes a fixed executable.
+
if (gameversion == exe_ultimate || gameversion == exe_final)
demosequence = (demosequence+1)%7;
else
@@ -783,40 +786,6 @@ void D_SetGameDescription(void)
}
}
-static void SetSaveGameDir(char *iwad_filename)
-{
- char *sep;
- char *basefile;
-
- // Extract the base filename
-
- sep = strrchr(iwad_filename, DIR_SEPARATOR);
-
- if (sep == NULL)
- {
- basefile = iwad_filename;
- }
- else
- {
- basefile = sep + 1;
- }
-
- // ~/.chocolate-doom/savegames/
-
- savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0);
- sprintf(savegamedir, "%ssavegames%c", configdir,
- DIR_SEPARATOR);
-
- M_MakeDirectory(savegamedir);
-
- // eg. ~/.chocolate-doom/savegames/doom2.wad/
-
- sprintf(savegamedir + strlen(savegamedir), "%s%c",
- basefile, DIR_SEPARATOR);
-
- M_MakeDirectory(savegamedir);
-}
-
// Check if the IWAD file is the Chex Quest IWAD.
// Returns true if this is chex.wad.
@@ -914,6 +883,7 @@ static struct
{"Hacx", "hacx", exe_hacx},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
+ {"Final Doom (alt)", "final2", exe_final2},
{"Chex Quest", "chex", exe_chex},
{ NULL, NULL, 0},
};
@@ -930,7 +900,7 @@ static void InitGameVersion(void)
// @category compat
//
// Emulate a specific version of Doom. Valid values are "1.9",
- // "ultimate" and "final".
+ // "ultimate", "final", "final2", "hacx" and "chex".
//
p = M_CheckParmWithArgs("-gameversion", 1);
@@ -994,8 +964,10 @@ static void InitGameVersion(void)
else
{
// Final Doom: tnt or plutonia
+ // Default to the "alt" version of the executable that
+ // fixes the demo loop behavior.
- gameversion = exe_final;
+ gameversion = exe_final2;
}
}
}
@@ -1034,11 +1006,37 @@ void PrintGameVersion(void)
static void LoadChexDeh(void)
{
- char *chex_deh;
+ char *chex_deh = NULL;
+ char *sep;
if (gameversion == exe_chex)
{
- chex_deh = D_FindWADByName("chex.deh");
+ // Look for chex.deh in the same directory as the IWAD file.
+
+ sep = strrchr(iwadfile, DIR_SEPARATOR);
+
+ if (sep != NULL)
+ {
+ chex_deh = malloc(strlen(iwadfile) + 9);
+ strcpy(chex_deh, iwadfile);
+ chex_deh[sep - iwadfile + 1] = '\0';
+ strcat(chex_deh, "chex.deh");
+ }
+ else
+ {
+ chex_deh = strdup("chex.deh");
+ }
+
+ // If the dehacked patch isn't found, try searching the WAD
+ // search path instead. We might find it...
+
+ if (!M_FileExists(chex_deh))
+ {
+ free(chex_deh);
+ chex_deh = D_FindWADByName("chex.deh");
+ }
+
+ // Still not found?
if (chex_deh == NULL)
{
@@ -1089,6 +1087,27 @@ static void LoadHacxDeh(void)
}
}
+// Figure out what IWAD name to use for savegames.
+
+static char *SaveGameIWADName(void)
+{
+ // Chex quest hack
+
+ if (gameversion == exe_chex)
+ {
+ return "chex.wad";
+ }
+
+ // Hacx hack
+
+ if (gameversion == exe_hacx)
+ {
+ return "hacx.wad";
+ }
+
+ return D_SaveGameIWADName(gamemission);
+}
+
//
// D_DoomMain
//
@@ -1407,7 +1426,7 @@ void D_DoomMain (void)
LoadChexDeh();
LoadHacxDeh();
D_SetGameDescription();
- SetSaveGameDir(iwadfile);
+ savegamedir = M_GetSaveGameDir(SaveGameIWADName());
// Check for -file in shareware
if (modifiedgame)
diff --git a/src/doom/d_net.c b/src/doom/d_net.c
index dd1ec563..f3155a9b 100644
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -474,7 +474,8 @@ boolean D_InitNetGame(net_connect_data_t *connect_data,
// Start a multiplayer server, listening for connections.
//
- if (M_CheckParm("-server") > 0)
+ if (M_CheckParm("-server") > 0
+ || M_CheckParm("-privateserver") > 0)
{
NET_SV_Init();
NET_SV_AddModule(&net_loop_server_module);
diff --git a/src/doom/doom.desktop.in b/src/doom/doom.desktop.in
new file mode 100644
index 00000000..44b76e62
--- /dev/null
+++ b/src/doom/doom.desktop.in
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=@PACKAGE_NAME@
+Exec=@PROGRAM_PREFIX@doom
+Icon=@PROGRAM_PREFIX@doom
+Type=Application
+Comment=@PACKAGE_SHORTDESC@
+Categories=Game;ActionGame;
diff --git a/src/doom/doomstat.c b/src/doom/doomstat.c
index b591358f..2bbb45e7 100644
--- a/src/doom/doomstat.c
+++ b/src/doom/doomstat.c
@@ -32,7 +32,7 @@
// Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
-GameVersion_t gameversion = exe_final;
+GameVersion_t gameversion = exe_final2;
char *gamedescription;
// Set if homebrew PWAD stuff has been added.
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 5662d3f2..598f1c5e 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -361,6 +361,13 @@ int G_CmdChecksum (ticcmd_t* cmd)
static boolean WeaponSelectable(weapontype_t weapon)
{
+ // Can't select the super shotgun in Doom 1.
+
+ if (weapon == wp_supershotgun && gamemission == doom)
+ {
+ return false;
+ }
+
// Can't select a weapon if we don't own it.
if (!players[consoleplayer].weaponowned[weapon])
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index 478e7f66..4a365cfb 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -798,6 +798,7 @@ void M_DrawReadThis1(void)
break;
case exe_final:
+ case exe_final2:
// Final Doom always displays "HELP".
diff --git a/src/doom/p_map.c b/src/doom/p_map.c
index 78102bdf..7e92e23a 100644
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -885,24 +885,16 @@ PTR_AimTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- // Return false if there is no back sector. This should never
- // be the case if the line is two-sided; however, some WADs
- // (eg. ottawau.wad) use this as an "impassible glass" trick
- // and rely on Vanilla Doom's (unintentional) support for this.
-
- if (li->backsector == NULL)
- {
- return false;
- }
-
- if (li->frontsector->floorheight != li->backsector->floorheight)
+ if (li->backsector == NULL
+ || li->frontsector->floorheight != li->backsector->floorheight)
{
slope = FixedDiv (openbottom - shootz , dist);
if (slope > bottomslope)
bottomslope = slope;
}
- if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
+ if (li->backsector == NULL
+ || li->frontsector->ceilingheight != li->backsector->ceilingheight)
{
slope = FixedDiv (opentop - shootz , dist);
if (slope < topslope)
@@ -983,26 +975,35 @@ boolean PTR_ShootTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- // Check if backsector is NULL. See comment in PTR_AimTraverse.
+ // e6y: emulation of missed back side on two-sided lines.
+ // backsector can be NULL when emulating missing back side.
- if (li->backsector == NULL)
+ if (li->backsector == NULL)
{
- goto hitline;
- }
+ slope = FixedDiv (openbottom - shootz , dist);
+ if (slope > aimslope)
+ goto hitline;
- if (li->frontsector->floorheight != li->backsector->floorheight)
- {
- slope = FixedDiv (openbottom - shootz , dist);
- if (slope > aimslope)
- goto hitline;
- }
-
- if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
- {
- slope = FixedDiv (opentop - shootz , dist);
- if (slope < aimslope)
- goto hitline;
- }
+ slope = FixedDiv (opentop - shootz , dist);
+ if (slope < aimslope)
+ goto hitline;
+ }
+ else
+ {
+ if (li->frontsector->floorheight != li->backsector->floorheight)
+ {
+ slope = FixedDiv (openbottom - shootz , dist);
+ if (slope > aimslope)
+ goto hitline;
+ }
+
+ if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
+ {
+ slope = FixedDiv (opentop - shootz , dist);
+ if (slope < aimslope)
+ goto hitline;
+ }
+ }
// shot continues
return true;
diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c
index 3fc95cab..58d5f462 100644
--- a/src/doom/p_setup.c
+++ b/src/doom/p_setup.c
@@ -155,7 +155,24 @@ void P_LoadVertexes (int lump)
W_ReleaseLumpNum(lump);
}
+//
+// GetSectorAtNullAddress
+//
+sector_t* GetSectorAtNullAddress(void)
+{
+ static boolean null_sector_is_initialized = false;
+ static sector_t null_sector;
+
+ if (!null_sector_is_initialized)
+ {
+ memset(&null_sector, 0, sizeof(null_sector));
+ I_GetMemoryValue(0, &null_sector.floorheight, 4);
+ I_GetMemoryValue(4, &null_sector.ceilingheight, 4);
+ null_sector_is_initialized = true;
+ }
+ return &null_sector;
+}
//
// P_LoadSegs
@@ -204,10 +221,12 @@ void P_LoadSegs (int lump)
if (sidenum < 0 || sidenum >= numsides)
{
- sidenum = 0;
+ li->backsector = GetSectorAtNullAddress();
+ }
+ else
+ {
+ li->backsector = sides[sidenum].sector;
}
-
- li->backsector = sides[sidenum].sector;
}
else
{
@@ -681,7 +700,7 @@ static void PadRejectArray(byte *array, unsigned int len)
if (len > sizeof(rejectpad))
{
fprintf(stderr, "PadRejectArray: REJECT lump too short to pad! (%i > %i)\n",
- len, sizeof(rejectpad));
+ len, (int) sizeof(rejectpad));
// Pad remaining space with 0 (or 0xff, if specified on command line).
diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index 7e5e225c..8595ff50 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -525,8 +525,13 @@ ST_Responder (event_t* ev)
plyr->message = DEH_String(STSTR_MUS);
cht_GetParam(&cheat_mus, buf);
-
- if (gamemode == commercial)
+
+ // Note: The original v1.9 had a bug that tried to play back
+ // the Doom II music regardless of gamemode. This was fixed
+ // in the Ultimate Doom executable so that it would work for
+ // the Doom 1 music as well.
+
+ if (gamemode == commercial || gameversion < exe_ultimate)
{
musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 5c2d5cf2..97eb37ed 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -421,25 +421,19 @@ void D_StartTitle(void)
void D_CheckRecordFrom(void)
{
int p;
- char file[256];
+ char *filename;
p = M_CheckParm("-recordfrom");
if (!p || p > myargc - 2)
return;
- if (cdrom)
- {
- sprintf(file, SAVEGAMENAMECD "%c.hsg", myargv[p + 1][0]);
- }
- else
- {
- sprintf(file, SAVEGAMENAME "%c.hsg", myargv[p + 1][0]);
- }
- G_LoadGame(file);
+ filename = SV_Filename(myargv[p + 1][0] - '0');
+ G_LoadGame(filename);
G_DoLoadGame(); // load the gameskill etc info from savegame
G_RecordDemo(gameskill, 1, gameepisode, gamemap, myargv[p + 2]);
D_DoomLoop(); // never returns
+ free(filename);
}
/*
@@ -940,6 +934,8 @@ void D_DoomMain(void)
gamedescription = "Heretic (registered)";
}
+ savegamedir = M_GetSaveGameDir("heretic.wad");
+
I_PrintStartupBanner(gamedescription);
// haleyjd: removed WATCOMC
@@ -1033,15 +1029,11 @@ void D_DoomMain(void)
p = M_CheckParm("-loadgame");
if (p && p < myargc - 1)
{
- if (cdrom)
- {
- sprintf(file, SAVEGAMENAMECD "%c.hsg", myargv[p + 1][0]);
- }
- else
- {
- sprintf(file, SAVEGAMENAME "%c.hsg", myargv[p + 1][0]);
- }
- G_LoadGame(file);
+ char *filename;
+
+ filename = SV_Filename(myargv[p + 1][0] - '0');
+ G_LoadGame(filename);
+ free(filename);
}
// Check valid episode and map
diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h
index aa1d0c0d..b2508335 100644
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -66,7 +66,6 @@
#include "d_ticcmd.h"
#define SAVEGAMENAME "hticsav"
-#define SAVEGAMENAMECD "c:\\heretic.cd\\hticsav"
/*
===============================================================================
@@ -740,6 +739,7 @@ void G_SaveGame(int slot, char *description);
// called by M_Responder
// Support routines for saving games
+char *SV_Filename(int slot);
void SV_Open(char *fileName);
void SV_Close(char *fileName);
void SV_Write(void *buffer, int size);
@@ -747,6 +747,8 @@ void SV_WriteByte(byte val);
void SV_WriteWord(unsigned short val);
void SV_WriteLong(unsigned int val);
+extern char *savegamedir;
+
void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
char *name);
// only called by startup code
diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index b37f95e0..9b3e3799 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -25,6 +25,7 @@
// G_game.c
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "doomdef.h"
#include "doomkeys.h"
@@ -133,6 +134,7 @@ boolean precache = true; // if true, load all graphics at start
short consistancy[MAXPLAYERS][BACKUPTICS];
+char *savegamedir;
byte *savebuffer, *save_p;
@@ -1294,11 +1296,11 @@ void G_DoWorldDone(void)
//
//---------------------------------------------------------------------------
-char savename[256];
+static char *savename = NULL;
void G_LoadGame(char *name)
{
- strcpy(savename, name);
+ savename = strdup(name);
gameaction = ga_loadgame;
}
@@ -1322,6 +1324,9 @@ void G_DoLoadGame(void)
gameaction = ga_nothing;
length = M_ReadFile(savename, &savebuffer);
+ free(savename);
+ savename = NULL;
+
save_p = savebuffer + SAVESTRINGSIZE;
// Skip the description field
memset(vcheck, 0, sizeof(vcheck));
@@ -1684,21 +1689,15 @@ void G_SaveGame(int slot, char *description)
void G_DoSaveGame(void)
{
int i;
- char name[100];
+ char *filename;
char verString[VERSIONSIZE];
char *description;
- if (cdrom)
- {
- sprintf(name, SAVEGAMENAMECD "%d.hsg", savegameslot);
- }
- else
- {
- sprintf(name, SAVEGAMENAME "%d.hsg", savegameslot);
- }
+ filename = SV_Filename(savegameslot);
+
description = savedescription;
- SV_Open(name);
+ SV_Open(filename);
SV_Write(description, SAVESTRINGSIZE);
memset(verString, 0, sizeof(verString));
DEH_snprintf(verString, VERSIONSIZE, "version %i", HERETIC_VERSION);
@@ -1717,11 +1716,32 @@ void G_DoSaveGame(void)
P_ArchiveWorld();
P_ArchiveThinkers();
P_ArchiveSpecials();
- SV_Close(name);
+ SV_Close(filename);
gameaction = ga_nothing;
savedescription[0] = 0;
P_SetMessage(&players[consoleplayer], DEH_String(TXT_GAMESAVED), true);
+
+ free(filename);
+}
+
+//==========================================================================
+//
+// SV_Filename
+//
+// Generate the filename to use for a particular savegame slot.
+// Returns a malloc()'d buffer that must be freed by the caller.
+//
+//==========================================================================
+
+char *SV_Filename(int slot)
+{
+ char *filename;
+
+ filename = malloc(strlen(savegamedir) + strlen(SAVEGAMENAME) + 8);
+ sprintf(filename, "%s" SAVEGAMENAME "%d.hsg", savegamedir, slot);
+
+ return filename;
}
//==========================================================================
diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c
index 955e0124..930df426 100644
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -645,19 +645,14 @@ void MN_LoadSlotText(void)
FILE *fp;
int count;
int i;
- char name[256];
+ char *filename;
for (i = 0; i < 6; i++)
{
- if (cdrom)
- {
- sprintf(name, SAVEGAMENAMECD "%d.hsg", i);
- }
- else
- {
- sprintf(name, SAVEGAMENAME "%d.hsg", i);
- }
- fp = fopen(name, "rb+");
+ filename = SV_Filename(i);
+ fp = fopen(filename, "rb+");
+ free(filename);
+
if (!fp)
{
SlotText[i][0] = 0; // empty the string
@@ -826,21 +821,17 @@ static boolean SCMessages(int option)
static boolean SCLoadGame(int option)
{
- char name[256];
+ char *filename;
if (!SlotStatus[option])
{ // slot's empty...don't try and load
return false;
}
- if (cdrom)
- {
- sprintf(name, SAVEGAMENAMECD "%d.hsg", option);
- }
- else
- {
- sprintf(name, SAVEGAMENAME "%d.hsg", option);
- }
- G_LoadGame(name);
+
+ filename = SV_Filename(option);
+ G_LoadGame(filename);
+ free(filename);
+
MN_DeactivateMenu();
BorderNeedRefresh = true;
if (quickload == -1)
diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 4f9fe312..c78d662a 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -184,8 +184,17 @@ void D_BindVariables(void)
static void D_SetDefaultSavePath(void)
{
- SavePath = malloc(strlen(configdir) + 10);
- sprintf(SavePath, "%shexndata%c", configdir, DIR_SEPARATOR);
+ 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);
+ sprintf(SavePath, "hexndata%c", DIR_SEPARATOR);
+ }
}
//
diff --git a/src/i_endoom.c b/src/i_endoom.c
index 021a3604..09c2d2d2 100644
--- a/src/i_endoom.c
+++ b/src/i_endoom.c
@@ -67,7 +67,7 @@ void I_Endoom(byte *endoom_data)
{
TXT_UpdateScreen();
- if (TXT_GetChar() >= 0)
+ if (TXT_GetChar() > 0)
{
break;
}
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index e7a42e83..dd35ce5e 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -1079,7 +1079,7 @@ static void ScheduleTrack(opl_track_data_t *track);
// Restart a song from the beginning.
-static void RestartSong(void)
+static void RestartSong(void *unused)
{
unsigned int i;
@@ -1117,10 +1117,15 @@ static void TrackTimerCallback(void *arg)
--running_tracks;
// When all tracks have finished, restart the song.
+ // Don't restart the song immediately, but wait for 5ms
+ // before triggering a restart. Otherwise it is possible
+ // to construct an empty MIDI file that causes the game
+ // to lock up in an infinite loop. (5ms should be short
+ // enough not to be noticeable by the listener).
if (running_tracks <= 0 && song_looping)
{
- RestartSong();
+ OPL_SetCallback(5, RestartSong, NULL);
}
return;
diff --git a/src/i_scale.c b/src/i_scale.c
index 2c0b718c..6d03d708 100644
--- a/src/i_scale.c
+++ b/src/i_scale.c
@@ -33,6 +33,7 @@
#include "doomtype.h"
#include "i_video.h"
+#include "m_argv.h"
#include "z_zone.h"
#if defined(_MSC_VER) && !defined(__cplusplus)
@@ -967,6 +968,21 @@ static boolean I_Stretch5x(int x1, int y1, int x2, int y2)
screenp += dest_pitch; bufp += SCREENWIDTH;
}
+ // test hack for Porsche Monty... scan line simulation:
+ // See here: http://www.doomworld.com/vb/post/962612
+
+ if (M_CheckParm("-scanline") > 0)
+ {
+ screenp = (byte *) dest_buffer + 2 * dest_pitch;
+
+ for (y=0; y<1198; y += 3)
+ {
+ memset(screenp, 0, 1600);
+
+ screenp += dest_pitch * 3;
+ }
+ }
+
return true;
}
diff --git a/src/i_system.c b/src/i_system.c
index 0a856ca9..38266c4f 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -38,6 +38,8 @@
#include <unistd.h>
#endif
+#include "SDL.h"
+
#include "config.h"
#include "deh_str.h"
@@ -55,6 +57,10 @@
#include "w_wad.h"
#include "z_zone.h"
+#ifdef __MACOSX__
+#include <CoreFoundation/CFUserNotification.h>
+#endif
+
#define DEFAULT_RAM 16 /* MiB */
#define MIN_RAM 4 /* MiB */
@@ -282,7 +288,6 @@ void I_BindVariables(void)
}
*/
-
//
// I_Quit
//
@@ -366,8 +371,152 @@ void I_Error (char *error, ...)
}
#endif
+#ifdef __MACOSX__
+ if (!I_ConsoleStdout())
+ {
+ CFStringRef message;
+ char msgbuf[512];
+ int i;
+
+ va_start(argptr, error);
+ memset(msgbuf, 0, sizeof(msgbuf));
+ vsnprintf(msgbuf, sizeof(msgbuf) - 1, error, argptr);
+ va_end(argptr);
+
+ // The CoreFoundation message box wraps text lines, so replace
+ // newline characters with spaces so that multiline messages
+ // are continuous.
+
+ for (i = 0; msgbuf[i] != '\0'; ++i)
+ {
+ if (msgbuf[i] == '\n')
+ {
+ msgbuf[i] = ' ';
+ }
+ }
+
+ message = CFStringCreateWithCString(NULL, msgbuf,
+ kCFStringEncodingUTF8);
+
+ CFUserNotificationDisplayNotice(0,
+ kCFUserNotificationCautionAlertLevel,
+ NULL,
+ NULL,
+ NULL,
+ CFSTR(PACKAGE_STRING),
+ message,
+ NULL);
+ }
+#endif
+
// abort();
exit(-1);
}
+//
+// Read Access Violation emulation.
+//
+// From PrBoom+, by entryway.
+//
+
+// C:\>debug
+// -d 0:0
+//
+// DOS 6.22:
+// 0000:0000 (57 92 19 00) F4 06 70 00-(16 00)
+// DOS 7.1:
+// 0000:0000 (9E 0F C9 00) 65 04 70 00-(16 00)
+// Win98:
+// 0000:0000 (9E 0F C9 00) 65 04 70 00-(16 00)
+// DOSBox under XP:
+// 0000:0000 (00 00 00 F1) ?? ?? ?? 00-(07 00)
+
+#define DOS_MEM_DUMP_SIZE 10
+
+static const unsigned char mem_dump_dos622[DOS_MEM_DUMP_SIZE] = {
+ 0x57, 0x92, 0x19, 0x00, 0xF4, 0x06, 0x70, 0x00, 0x16, 0x00};
+static const unsigned char mem_dump_win98[DOS_MEM_DUMP_SIZE] = {
+ 0x9E, 0x0F, 0xC9, 0x00, 0x65, 0x04, 0x70, 0x00, 0x16, 0x00};
+static const unsigned char mem_dump_dosbox[DOS_MEM_DUMP_SIZE] = {
+ 0x00, 0x00, 0x00, 0xF1, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00};
+static unsigned char mem_dump_custom[DOS_MEM_DUMP_SIZE];
+
+static const unsigned char *dos_mem_dump = mem_dump_dos622;
+
+boolean I_GetMemoryValue(unsigned int offset, void *value, int size)
+{
+ static boolean firsttime = true;
+
+ if (firsttime)
+ {
+ int p, i, val;
+
+ firsttime = false;
+ i = 0;
+
+ //!
+ // @category compat
+ // @arg <version>
+ //
+ // Specify DOS version to emulate for NULL pointer dereference
+ // emulation. Supported versions are: dos622, dos71, dosbox.
+ // The default is to emulate DOS 7.1 (Windows 98).
+ //
+
+ p = M_CheckParmWithArgs("-setmem", 1);
+
+ if (p > 0)
+ {
+ if (!strcasecmp(myargv[p + 1], "dos622"))
+ {
+ dos_mem_dump = mem_dump_dos622;
+ }
+ if (!strcasecmp(myargv[p + 1], "dos71"))
+ {
+ dos_mem_dump = mem_dump_win98;
+ }
+ else if (!strcasecmp(myargv[p + 1], "dosbox"))
+ {
+ dos_mem_dump = mem_dump_dosbox;
+ }
+ else
+ {
+ for (i = 0; i < DOS_MEM_DUMP_SIZE; ++i)
+ {
+ ++p;
+
+ if (p >= myargc || myargv[p][0] == '-')
+ {
+ break;
+ }
+
+ M_StrToInt(myargv[p], &val);
+ mem_dump_custom[i++] = (unsigned char) val;
+ }
+
+ dos_mem_dump = mem_dump_custom;
+ }
+ }
+ }
+
+ switch (size)
+ {
+ case 1:
+ *((unsigned char *) value) = dos_mem_dump[offset];
+ return true;
+ case 2:
+ *((unsigned short *) value) = dos_mem_dump[offset]
+ | (dos_mem_dump[offset + 1] << 8);
+ return true;
+ case 4:
+ *((unsigned int *) value) = dos_mem_dump[offset]
+ | (dos_mem_dump[offset + 1] << 8)
+ | (dos_mem_dump[offset + 2] << 16)
+ | (dos_mem_dump[offset + 3] << 24);
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/src/i_system.h b/src/i_system.h
index 0697f7db..5a99b213 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -71,6 +71,8 @@ void I_Tactile (int on, int off, int total);
void I_Error (char *error, ...);
+boolean I_GetMemoryValue(unsigned int offset, void *value, int size);
+
// Schedule a function to be called when the program exits.
// If run_if_error is true, the function is called if the exit
// is due to an error (I_Error)
diff --git a/src/i_video.c b/src/i_video.c
index 6bf2f179..925bf3dc 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -656,7 +656,7 @@ static int GetTypedChar(SDL_Event *event)
{
// Unicode value, from key layout.
- return event->key.keysym.unicode;
+ return tolower(event->key.keysym.unicode);
}
}
diff --git a/src/m_config.c b/src/m_config.c
index b934d9d4..762e6eaf 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1703,3 +1703,40 @@ void M_SetConfigDir(char *dir)
M_MakeDirectory(configdir);
}
+//
+// Calculate the path to the directory to use to store save games.
+// Creates the directory as necessary.
+//
+
+char *M_GetSaveGameDir(char *iwadname)
+{
+ char *savegamedir;
+
+ // If not "doing" a configuration directory (Windows), don't "do"
+ // a savegame directory, either.
+
+ if (!strcmp(configdir, ""))
+ {
+ savegamedir = strdup("");
+ }
+ else
+ {
+ // ~/.chocolate-doom/savegames/
+
+ savegamedir = malloc(strlen(configdir) + 30);
+ sprintf(savegamedir, "%ssavegames%c", configdir,
+ DIR_SEPARATOR);
+
+ M_MakeDirectory(savegamedir);
+
+ // eg. ~/.chocolate-doom/savegames/doom2.wad/
+
+ sprintf(savegamedir + strlen(savegamedir), "%s%c",
+ iwadname, DIR_SEPARATOR);
+
+ M_MakeDirectory(savegamedir);
+ }
+
+ return savegamedir;
+}
+
diff --git a/src/m_config.h b/src/m_config.h
index ff772bea..999b50ae 100644
--- a/src/m_config.h
+++ b/src/m_config.h
@@ -34,6 +34,7 @@ void M_SaveDefaultsAlternate(char *main, char *extra);
void M_SetConfigDir(char *dir);
void M_BindVariable(char *name, void *variable);
void M_SetConfigFilenames(char *main_config, char *extra_config);
+char *M_GetSaveGameDir(char *iwadname);
extern char *configdir;
diff --git a/src/m_misc.c b/src/m_misc.c
index ed41b5f1..e14436a3 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -209,8 +209,9 @@ boolean M_StrToInt(const char *str, int *result)
void M_ExtractFileBase(char *path, char *dest)
{
- char* src;
- int length;
+ char *src;
+ char *filename;
+ int length;
src = path + strlen(path) - 1;
@@ -220,20 +221,26 @@ void M_ExtractFileBase(char *path, char *dest)
src--;
}
- // copy up to eight characters
- memset(dest, 0, 8);
+ filename = src;
+
+ // Copy up to eight characters
+ // Note: Vanilla Doom exits with an error if a filename is specified
+ // with a base of more than eight characters. To remove the 8.3
+ // filename limit, instead we simply truncate the name.
+
length = 0;
+ memset(dest, 0, 8);
while (*src != '\0' && *src != '.')
{
- ++length;
-
- if (length > 8)
+ if (length >= 8)
{
- I_Error ("Filename base of %s >8 chars", path);
+ printf("Warning: Truncated '%s' lump name to '%.8s'.\n",
+ filename, dest);
+ break;
}
- *dest++ = toupper((int)*src++);
+ dest[length++] = toupper((int)*src++);
}
}
diff --git a/src/net_server.c b/src/net_server.c
index ae46be4a..157f5069 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1563,6 +1563,7 @@ void NET_SV_RegisterWithMaster(void)
{
//!
// When running a server, don't register with the global master server.
+ // Implies -server.
//
// @category net
//
diff --git a/src/setup/Makefile.am b/src/setup/Makefile.am
index 25ab38e3..7fe051ee 100644
--- a/src/setup/Makefile.am
+++ b/src/setup/Makefile.am
@@ -27,6 +27,12 @@ libsetup_a_SOURCES = $(SOURCE_FILES)
EXTRA_DIST= \
setup_icon.c
+appdir = $(prefix)/share/applications
+app_DATA = @PROGRAM_PREFIX@setup.desktop
+
+@PROGRAM_PREFIX@setup.desktop : setup.desktop
+ cp $^ $@
+
if HAVE_PYTHON
setup_icon.c : $(top_builddir)/data/setup8.ico
diff --git a/src/setup/display.c b/src/setup/display.c
index df264749..d9b34ccc 100644
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -527,25 +527,34 @@ static void UpdateBPP(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(modes_table))
GenerateModesTable(NULL, modes_table);
}
-#if defined(_WIN32) && !defined(_WIN32_WCE)
+static void UpdateModeSeparator(TXT_UNCAST_ARG(widget),
+ TXT_UNCAST_ARG(separator))
+{
+ TXT_CAST_ARG(txt_separator_t, separator);
+
+ if (fullscreen)
+ {
+ TXT_SetSeparatorLabel(separator, "Screen mode");
+ }
+ else
+ {
+ TXT_SetSeparatorLabel(separator, "Window size");
+ }
+}
-static int win32_video_driver = 0;
+#if defined(_WIN32) && !defined(_WIN32_WCE)
-static char *win32_video_drivers[] =
-{
- "DirectX",
- "Windows GDI",
-};
+static int use_directx = 1;
static void SetWin32VideoDriver(void)
{
if (!strcmp(video_driver, "windib"))
{
- win32_video_driver = 1;
+ use_directx = 0;
}
else
{
- win32_video_driver = 0;
+ use_directx = 1;
}
}
@@ -553,13 +562,15 @@ static void UpdateVideoDriver(TXT_UNCAST_ARG(widget),
TXT_UNCAST_ARG(modes_table))
{
TXT_CAST_ARG(txt_table_t, modes_table);
- char *drivers[] =
- {
- "",
- "windib",
- };
- video_driver = drivers[win32_video_driver != 0];
+ if (use_directx)
+ {
+ video_driver = "";
+ }
+ else
+ {
+ video_driver = "windib";
+ }
// When the video driver is changed, we need to restart the textscreen
// library.
@@ -579,16 +590,72 @@ static void UpdateVideoDriver(TXT_UNCAST_ARG(widget),
#endif
+static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
+ TXT_UNCAST_ARG(modes_table))
+{
+ TXT_CAST_ARG(txt_table_t, modes_table);
+ txt_window_t *window;
+ txt_checkbox_t *ar_checkbox;
+
+ window = TXT_NewWindow("Advanced display options");
+
+ TXT_SetColumnWidths(window, 35);
+
+ TXT_AddWidgets(window,
+ ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
+ &aspect_ratio_correct),
+ NULL);
+
+ if (gamemission == heretic || gamemission == hexen)
+ {
+ TXT_AddWidget(window,
+ TXT_NewCheckBox("Graphical startup", &graphical_startup));
+ }
+
+ if (gamemission == doom || gamemission == heretic || gamemission == strife)
+ {
+ TXT_AddWidget(window,
+ TXT_NewCheckBox("Show ENDOOM screen on exit",
+ &show_endoom));
+ }
+
+ TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
+
+ // On Windows, there is an extra control to change between
+ // the Windows GDI and DirectX video drivers.
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+ {
+ txt_radiobutton_t *dx_button, *gdi_button;
+
+ TXT_AddWidgets(window,
+ TXT_NewSeparator("Windows video driver"),
+ dx_button = TXT_NewRadioButton("DirectX",
+ &use_directx, 1),
+ gdi_button = TXT_NewRadioButton("Windows GDI",
+ &use_directx, 0),
+ NULL);
+
+ TXT_SignalConnect(dx_button, "selected",
+ UpdateVideoDriver, modes_table);
+ TXT_SignalConnect(gdi_button, "selected",
+ UpdateVideoDriver, modes_table);
+ SetWin32VideoDriver();
+ }
+#endif
+}
void ConfigDisplay(void)
{
txt_window_t *window;
txt_table_t *modes_table;
+ txt_separator_t *modes_separator;
txt_table_t *bpp_table;
+ txt_window_action_t *advanced_button;
txt_checkbox_t *fs_checkbox;
- txt_checkbox_t *ar_checkbox;
- txt_dropdown_list_t *bpp_selector;
+ int i;
int num_columns;
+ int num_rows;
int window_y;
// What color depths are supported? Generate supported_bpps array
@@ -606,14 +673,8 @@ void ConfigDisplay(void)
}
// Open the window
-
- window = TXT_NewWindow("Display Configuration");
- TXT_AddWidgets(window,
- fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen),
- ar_checkbox = TXT_NewCheckBox("Correct aspect ratio",
- &aspect_ratio_correct),
- NULL);
+ window = TXT_NewWindow("Display Configuration");
// Some machines can have lots of video modes. This tries to
// keep a limit of six lines by increasing the number of
@@ -621,94 +682,101 @@ void ConfigDisplay(void)
BuildFullscreenModesList();
- window_y = 5;
-
- if (num_screen_modes_fullscreen <= 18)
+ if (num_screen_modes_fullscreen <= 24)
{
num_columns = 3;
}
- else if (num_screen_modes_fullscreen <= 24)
+ else if (num_screen_modes_fullscreen <= 40)
{
num_columns = 4;
}
else
{
num_columns = 5;
- window_y -= 3;
}
modes_table = TXT_NewTable(num_columns);
- // The window is set at a fixed vertical position. This keeps
- // the top of the window stationary when switching between
- // fullscreen and windowed mode (which causes the window's
- // height to change).
+ // Build window:
- TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
- TXT_SCREEN_W / 2, window_y);
+ TXT_AddWidget(window,
+ fs_checkbox = TXT_NewCheckBox("Full screen", &fullscreen));
- // On Windows, there is an extra control to change between
- // the Windows GDI and DirectX video drivers.
-
-#if defined(_WIN32) && !defined(_WIN32_WCE)
+ if (num_supported_bpps > 1)
{
- txt_table_t *driver_table;
- txt_dropdown_list_t *driver_list;
-
- driver_table = TXT_NewTable(2);
-
- TXT_SetColumnWidths(driver_table, 20, 0);
-
- TXT_AddWidgets(driver_table,
- TXT_NewLabel("Video driver"),
- driver_list = TXT_NewDropdownList(&win32_video_driver,
- win32_video_drivers,
- 2),
+ TXT_AddWidgets(window,
+ TXT_NewSeparator("Color depth"),
+ bpp_table = TXT_NewTable(4),
NULL);
- TXT_SignalConnect(driver_list, "changed",
- UpdateVideoDriver, modes_table);
- SetWin32VideoDriver();
+ for (i = 0; i < num_supported_bpps; ++i)
+ {
+ txt_radiobutton_t *button;
- TXT_AddWidget(window, driver_table);
- }
-#endif
+ button = TXT_NewRadioButton(supported_bpps[i],
+ &selected_bpp, i);
- // Screen modes list
+ TXT_AddWidget(bpp_table, button);
+ TXT_SignalConnect(button, "selected", UpdateBPP, modes_table);
+ }
+ }
TXT_AddWidgets(window,
- TXT_NewSeparator("Screen mode"),
- bpp_table = TXT_NewTable(2),
+ modes_separator = TXT_NewSeparator(""),
modes_table,
- TXT_NewSeparator("Misc."),
NULL);
- if (gamemission == heretic || gamemission == hexen)
+ TXT_SignalConnect(fs_checkbox, "changed",
+ GenerateModesTable, modes_table);
+ TXT_SignalConnect(fs_checkbox, "changed",
+ UpdateModeSeparator, modes_separator);
+
+ // How many rows high will the configuration window be?
+ // Need to take into account number of fullscreen modes, and also
+ // number of supported pixel depths.
+ // The windowed modes list is four rows, so take the maximum of
+ // windowed and fullscreen.
+
+ num_rows = (num_screen_modes_fullscreen + num_columns - 1) / num_columns;
+
+ if (num_rows < 4)
{
- TXT_AddWidget(window,
- TXT_NewCheckBox("Graphical startup", &graphical_startup));
+ num_rows = 4;
}
- if (gamemission == doom || gamemission == heretic
- || gamemission == strife)
+ if (num_supported_bpps > 1)
{
- TXT_AddWidget(window,
- TXT_NewCheckBox("Show ENDOOM screen", &show_endoom));
+ num_rows += 2;
}
- TXT_AddWidgets(bpp_table,
- TXT_NewLabel("Color depth: "),
- bpp_selector = TXT_NewDropdownList(&selected_bpp,
- supported_bpps,
- num_supported_bpps),
- NULL);
+ if (num_rows < 14)
+ {
+ window_y = 8 - ((num_rows + 1) / 2);
+ }
+ else
+ {
+ window_y = 1;
+ }
+ // The window is set at a fixed vertical position. This keeps
+ // the top of the window stationary when switching between
+ // fullscreen and windowed mode (which causes the window's
+ // height to change).
- TXT_SignalConnect(bpp_selector, "changed", UpdateBPP, modes_table);
- TXT_SignalConnect(fs_checkbox, "changed", GenerateModesTable, modes_table);
- TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
+ TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
+ TXT_SCREEN_W / 2, window_y);
GenerateModesTable(NULL, modes_table);
+ UpdateModeSeparator(NULL, modes_separator);
+
+ // Button to open "advanced" window.
+ // Need to pass a pointer to the modes table, as some of the options
+ // in there trigger a rebuild of it.
+
+ advanced_button = TXT_NewWindowAction('a', "Advanced");
+ TXT_SetWindowAction(window, TXT_HORIZ_CENTER, advanced_button);
+ TXT_SignalConnect(advanced_button, "pressed",
+ AdvancedDisplayConfig, modes_table);
}
void BindDisplayVariables(void)
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 9c6b5851..48074121 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -27,6 +27,7 @@
#include "m_controls.h"
#include "textscreen.h"
+#include "execute.h"
#include "joystick.h"
#include "mode.h"
#include "txt_joybinput.h"
@@ -436,6 +437,8 @@ void ConfigJoystick(void)
TXT_SignalConnect(joystick_button, "pressed", CalibrateJoystick, NULL);
TXT_SignalConnect(window, "closed", JoystickWindowClosed, NULL);
+ TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction());
+
SetJoystickButtonLabel();
}
diff --git a/src/setup/setup-manifest.xml.in b/src/setup/setup-manifest.xml.in
index bac9a05e..ff879263 100644
--- a/src/setup/setup-manifest.xml.in
+++ b/src/setup/setup-manifest.xml.in
@@ -1,16 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!-- Magic manifest file that should make Windows Vista/7 not
+ attempt to gain elevated privileges for chocolate-setup.
+
+ Based on:
+
+ http://www.cygwin.com/ml/cygwin/2006-12/msg00580.html
+ -->
+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- The "name" field in this tag should be the same as the executable's
name -->
- <assemblyIdentity version="@PACKAGE_VERSION@.0" processorArchitecture="*"
- name="@PROGRAM_PREFIX@setup" type="win32"/>
+ <assemblyIdentity version="0.0.0.0" processorArchitecture="X86"
+ name="@PROGRAM_PREFIX@setup.exe" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
- <!-- Hi Vista! We don't require elevated privileges. Thanks! -->
- <requestedExecutionLevel level="asInvoker"/>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
+
+ <!-- Stop the Program Compatibility Assistant appearing: -->
+
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!-- Vista -->
+ </application>
+ </compatibility>
</assembly>
diff --git a/src/setup/setup.desktop.in b/src/setup/setup.desktop.in
new file mode 100644
index 00000000..79fb38be
--- /dev/null
+++ b/src/setup/setup.desktop.in
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=@PACKAGE_NAME@ Setup
+Exec=@PROGRAM_PREFIX@setup
+Icon=@PROGRAM_PREFIX@setup
+Type=Application
+Comment=Setup tool for @PACKAGE_NAME@
+Categories=Settings;ConsoleOnly;
diff --git a/src/setup/sound.c b/src/setup/sound.c
index 4564aeb4..522c4f9f 100644
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -68,7 +68,7 @@ static char *musicmode_strings[] =
int snd_sfxdevice = SNDDEVICE_SB;
int snd_musicdevice = SNDDEVICE_GENMIDI;
-int snd_samplerate = 22050;
+int snd_samplerate = 44100;
int opl_io_port = 0x388;
static int numChannels = 8;
diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c
index cde3d2c2..9ad26a45 100644
--- a/src/setup/txt_joybinput.c
+++ b/src/setup/txt_joybinput.c
@@ -48,7 +48,12 @@ static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_input))
if (event->type == SDL_JOYBUTTONDOWN)
{
*joystick_input->variable = event->jbutton.button;
- TXT_EmitSignal(joystick_input, "set");
+
+ if (joystick_input->check_conflicts)
+ {
+ TXT_EmitSignal(joystick_input, "set");
+ }
+
TXT_CloseWindow(joystick_input->prompt_window);
return 1;
}
@@ -89,6 +94,10 @@ static void OpenPromptWindow(txt_joystick_input_t *joystick_input)
txt_label_t *label;
SDL_Joystick *joystick;
+ // Silently update when the shift button is held down.
+
+ joystick_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{
return;
@@ -153,15 +162,7 @@ static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input), int selected
GetJoystickButtonDescription(*joystick_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(joystick_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_joybinput.h b/src/setup/txt_joybinput.h
index b2920b88..69ec4a1f 100644
--- a/src/setup/txt_joybinput.h
+++ b/src/setup/txt_joybinput.h
@@ -37,6 +37,7 @@ struct txt_joystick_input_s
txt_widget_t widget;
int *variable;
txt_window_t *prompt_window;
+ int check_conflicts;
};
txt_joystick_input_t *TXT_NewJoystickInput(int *variable);
diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c
index 08eb9d8c..6f1ee4dd 100644
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -42,7 +42,12 @@ static int KeyPressCallback(txt_window_t *window, int key,
// Got the key press. Save to the variable and close the window.
*key_input->variable = key;
- TXT_EmitSignal(key_input, "set");
+
+ if (key_input->check_conflicts)
+ {
+ TXT_EmitSignal(key_input, "set");
+ }
+
TXT_CloseWindow(window);
// Re-enable key mappings now that we have the key
@@ -67,6 +72,10 @@ static void OpenPromptWindow(txt_key_input_t *key_input)
txt_window_t *window;
txt_label_t *label;
+ // Silently update when the shift button is held down.
+
+ key_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
window = TXT_NewWindow(NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
@@ -118,15 +127,7 @@ static void TXT_KeyInputDrawer(TXT_UNCAST_ARG(key_input), int selected)
TXT_GetKeyDescription(*key_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(key_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_keyinput.h b/src/setup/txt_keyinput.h
index 4952a970..5df0b2e3 100644
--- a/src/setup/txt_keyinput.h
+++ b/src/setup/txt_keyinput.h
@@ -35,6 +35,7 @@ struct txt_key_input_s
{
txt_widget_t widget;
int *variable;
+ int check_conflicts;
};
txt_key_input_t *TXT_NewKeyInput(int *variable);
diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c
index 4f454c8c..c3e17299 100644
--- a/src/setup/txt_mouseinput.c
+++ b/src/setup/txt_mouseinput.c
@@ -42,7 +42,12 @@ static int MousePressCallback(txt_window_t *window,
// Got the mouse press. Save to the variable and close the window.
*mouse_input->variable = b - TXT_MOUSE_BASE;
- TXT_EmitSignal(mouse_input, "set");
+
+ if (mouse_input->check_conflicts)
+ {
+ TXT_EmitSignal(mouse_input, "set");
+ }
+
TXT_CloseWindow(window);
return 1;
@@ -53,6 +58,9 @@ static void OpenPromptWindow(txt_mouse_input_t *mouse_input)
txt_window_t *window;
txt_label_t *label;
+ // Silently update when the shift key is held down.
+ mouse_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
window = TXT_NewWindow(NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
@@ -111,15 +119,7 @@ static void TXT_MouseInputDrawer(TXT_UNCAST_ARG(mouse_input), int selected)
GetMouseButtonDescription(*mouse_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(mouse_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_mouseinput.h b/src/setup/txt_mouseinput.h
index 57c258eb..ef3ec2aa 100644
--- a/src/setup/txt_mouseinput.h
+++ b/src/setup/txt_mouseinput.h
@@ -35,6 +35,7 @@ struct txt_mouse_input_s
{
txt_widget_t widget;
int *variable;
+ int check_conflicts;
};
txt_mouse_input_t *TXT_NewMouseInput(int *variable);