foxygit / doom Log in
commit 677729c658b39f075e563fbc9f5a898641f7de54
Merge: 8a77b34e b4f2d75b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Feb 5 23:08:12 2010 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri Feb 5 23:08:12 2010 +0000

    Merge from trunk.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1845

 .gitignore                                      |    3 +
 INSTALL                                         |    2 +-
 Makefile.am                                     |    9 +-
 NEWS                                            |   98 ++-
 TODO                                            |   21 +-
 autogen.sh                                      |    2 +-
 configure.in                                    |   32 +-
 data/README                                     |    7 +
 data/doom.ico                                   |  Bin 2238 -> 36726 bytes
 data/doom8.ico                                  |  Bin 0 -> 2238 bytes
 data/setup.ico                                  |  Bin 2238 -> 36726 bytes
 data/setup8.ico                                 |  Bin 0 -> 2238 bytes
 man/Makefile.am                                 |    9 +-
 pcsound/.gitignore                              |    2 +
 pkg/.gitignore                                  |    3 +
 pkg/Makefile.am                                 |   34 +-
 pkg/config.make.in                              |   29 +
 pkg/osx/.gitignore                              |    7 +
 pkg/osx/AppController.h                         |   53 ++
 pkg/osx/AppController.m                         |  124 +++
 pkg/osx/Execute.h                               |   31 +
 pkg/osx/Execute.m                               |  208 +++++
 pkg/osx/GNUmakefile                             |  101 +++
 pkg/osx/IWADController.h                        |   54 ++
 pkg/osx/IWADController.m                        |  347 ++++++++
 pkg/osx/IWADLocation.h                          |   44 +
 pkg/osx/IWADLocation.m                          |   74 ++
 pkg/osx/Info-gnustep.plist.in                   |   36 +
 pkg/osx/Info.plist.in                           |   60 ++
 pkg/osx/LauncherManager.h                       |   52 ++
 pkg/osx/LauncherManager.m                       |  338 ++++++++
 pkg/osx/PkgInfo                                 |    1 +
 pkg/osx/Resources/128x128.png                   |  Bin 0 -> 23029 bytes
 pkg/osx/Resources/app.icns                      |  Bin 0 -> 51625 bytes
 pkg/osx/Resources/app.png                       |  Bin 0 -> 4597 bytes
 pkg/osx/Resources/launcher.nib/classes.nib      |   47 ++
 pkg/osx/Resources/launcher.nib/info.nib         |   23 +
 pkg/osx/Resources/launcher.nib/keyedobjects.nib |  Bin 0 -> 19616 bytes
 pkg/osx/Resources/wadfile.icns                  |  Bin 0 -> 44092 bytes
 pkg/osx/Resources/wadfile.png                   |  Bin 0 -> 2249 bytes
 pkg/osx/cp-with-libs                            |  100 +++
 pkg/osx/main.m                                  |   32 +
 pkg/win32/GNUmakefile                           |   34 +
 pkg/win32/GNUmakefile.am                        |   37 -
 pkg/wince/{GNUmakefile.am => GNUmakefile}       |   15 +-
 rpm.spec.in                                     |   59 ++
 src/.gitignore                                  |    2 +
 src/Makefile.am                                 |    2 +-
 src/d_iwad.c                                    |   91 +-
 src/doom/.gitignore                             |    2 +
 src/doom/g_game.c                               |   14 +-
 src/doom/hu_stuff.c                             |   30 +-
 src/doom/p_map.c                                |   21 +-
 src/doom/p_setup.c                              |   27 +-
 src/doom/p_sight.c                              |   10 +-
 src/doom/st_stuff.c                             |   18 +-
 src/i_video.c                                   |    1 +
 src/mus2mid.c                                   | 1019 ++++++++++++-----------
 src/resource.rc.in                              |    2 +-
 src/setup/.gitignore                            |    7 +-
 src/setup/Makefile.am                           |    7 +
 src/setup/execute.c                             |   33 +-
 textscreen/.gitignore                           |    2 +
 textscreen/examples/.gitignore                  |    2 +
 textscreen/txt_sdl.c                            |    8 +-
 wince/.gitignore                                |    5 +
 wince/Makefile.am                               |    1 +
 67 files changed, 2792 insertions(+), 640 deletions(-)

diff --cc Makefile.am
index 15ad2252,a980acde..e331d204
--- a/Makefile.am
+++ b/Makefile.am
@@@ -3,38 -3,33 +3,41 @@@ AUX_DIST_GEN
          $(ac_aux_dir)/missing

  MSVC_FILES=                             \
 -        msvc/README                     \
 +        msvc/chocolate.sln              \
          msvc/config.h                   \
 +        msvc/doom.vcproj                \
 +        msvc/heretic.vcproj             \
 +        msvc/hexen.vcproj               \
          msvc/inttypes.h                 \
 +        msvc/libpcsound.vcproj          \
 +        msvc/libtextscreen.vcproj       \
 +        msvc/README                     \
 +        msvc/server.vcproj              \
 +        msvc/setup.vcproj               \
          msvc/stdint.h                   \
 -        msvc/win32.rc                   \
 -        msvc/ChocolateDoom.sln          \
 -        msvc/ChocolateDoom.vcproj
 +        msvc/win32.rc

  CODEBLOCKS_FILES=                              \
 -	codeblocks/config.h                    \
 -	codeblocks/game.cbp                    \
 -	codeblocks/game-res.rc                 \
 -	codeblocks/libpcsound.cbp              \
 -	codeblocks/main.workspace              \
 -	codeblocks/README                      \
 -	codeblocks/server.cbp                  \
 -	codeblocks/setup.cbp                   \
 -	codeblocks/setup-res.rc                \
 -	codeblocks/textscreen.cbp
 +        codeblocks/chocolate.workspace         \
 +        codeblocks/config.h                    \
 +        codeblocks/doom.cbp                    \
 +        codeblocks/game-res.rc                 \
 +        codeblocks/heretic.cbp                 \
 +        codeblocks/hexen.cbp                   \
 +        codeblocks/libpcsound.cbp              \
 +        codeblocks/libtextscreen.cbp           \
 +        codeblocks/README                      \
 +        codeblocks/server.cbp                  \
 +        codeblocks/setup.cbp                   \
 +        codeblocks/setup-res.rc

  DATA_FILES=                   \
+         data/README           \
          data/doom.ico         \
+         data/doom8.ico        \
          data/doom.png         \
          data/setup.ico        \
+         data/setup8.ico       \
          data/setup.png        \
          data/convert-icon

diff --cc configure.in
index 0f4b48a0,9d09739b..e3287d00
--- a/configure.in
+++ b/configure.in
@@@ -125,22 -127,20 +137,24 @@@ AC_DEFUN([AC_DATAROOTDIR_CHECKED]

  AC_OUTPUT([
  Makefile
- wince/Makefile
- textscreen/Makefile
- textscreen/examples/Makefile
 -rpm.spec
  man/Makefile
+ pcsound/Makefile
+ pkg/Makefile
+ pkg/config.make
 -pkg/osx/Info.plist
+ pkg/osx/Info-gnustep.plist
 -setup/Makefile
 -setup/setup-res.rc
++pkg/osx/Info.plist
++rpm.spec
  src/Makefile
+ src/doom-screensaver.desktop
 +src/doom/Makefile
 +src/heretic/Makefile
 +src/hexen/Makefile
- src/setup/Makefile
- pcsound/Makefile
- pkg/Makefile
- pkg/wince/GNUmakefile
- pkg/win32/GNUmakefile
  src/resource.rc
 +src/setup-res.rc
++src/setup/Makefile
 +src/setup/setup-manifest.xml
- src/doom-screensaver.desktop
+ textscreen/Makefile
+ textscreen/examples/Makefile
+ wince/Makefile
  ])

diff --cc pkg/Makefile.am
index 66cb9ba0,9775fa77..63da8f53
--- a/pkg/Makefile.am
+++ b/pkg/Makefile.am
@@@ -1,3 -1,32 +1,35 @@@

- DIST_SUBDIRS=wince win32
+ OSX_FILES=                                                              \
+ osx/Resources/128x128.png                                               \
+ osx/Resources/app.icns                                                  \
+ osx/Resources/app.png                                                   \
+ osx/Resources/wadfile.icns                                              \
+ osx/Resources/wadfile.png                                               \
+ osx/Resources/launcher.nib/classes.nib                                  \
+ osx/Resources/launcher.nib/info.nib                                     \
+ osx/Resources/launcher.nib/keyedobjects.nib                             \
+ osx/GNUmakefile                                                         \
+ osx/Info.plist.in       osx/Info-gnustep.plist.in                       \
+ osx/PkgInfo                                                             \
+ osx/cp-with-libs                                                        \
+ osx/main.m                                                              \
+ osx/AppController.m     osx/AppController.h                             \
+ osx/Execute.m           osx/Execute.h                                   \
+ osx/IWADController.m    osx/IWADController.h                            \
+ osx/IWADLocation.m      osx/IWADLocation.h                              \
+ osx/LauncherManager.m   osx/LauncherManager.h
+
+ WINCE_FILES=                                                            \
+ wince/GNUmakefile                                                       \
 -wince/wince-cab.cfg                                                     \
++wince/common.py                                                         \
++wince/doom-cab.cfg                                                      \
++wince/heretic-cab.cfg                                                   \
++wince/hexen-cab.cfg                                                     \
+ wince/wince-cabgen
+
+ WIN32_FILES=                                                            \
+ win32/GNUmakefile                                                       \
+ win32/README
+
+ EXTRA_DIST=$(OSX_FILES) $(WINCE_FILES) $(WIN32_FILES)

diff --cc pkg/config.make.in
index 00000000,d8d72c60..b8a1dbe5
mode 000000,100644..100644
--- a/pkg/config.make.in
+++ b/pkg/config.make.in
@@@ -1,0 -1,28 +1,29 @@@
+ # Shared file included by the makefiles used to build packages.
+ # This contains various information needed by the makefiles,
+ # and is autogenerated by configure to include various
+ # necessary details.
+
+ # Tools needed:
+
+ CC = @CC@
+ STRIP = @STRIP@
+
+ # Package name and version number:
+
++PROGRAM_PREFIX = @PROGRAM_PREFIX@
+ PACKAGE = @PACKAGE@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+
+ # Documentation files to distribute with packages.
+
+ DOC_FILES = README       \
+             COPYING      \
+             ChangeLog    \
+             NEWS         \
+             BUGS         \
+             CMDLINE      \
+             TODO
+
diff --cc pkg/win32/GNUmakefile
index 00000000,626f1845..147e2890
mode 000000,100644..100644
--- a/pkg/win32/GNUmakefile
+++ b/pkg/win32/GNUmakefile
@@@ -1,0 -1,32 +1,34 @@@
+
+ include ../config.make
+
+ TOPLEVEL=../..
+
 -EXE_FILES=$(TOPLEVEL)/src/$(PACKAGE_TARNAME).exe       \
 -          $(TOPLEVEL)/src/chocolate-server.exe         \
 -          $(TOPLEVEL)/setup/chocolate-setup.exe
++EXE_FILES=$(TOPLEVEL)/src/$(PROGRAM_PREFIX)doom.exe     \
++          $(TOPLEVEL)/src/$(PROGRAM_PREFIX)heretic.exe  \
++          $(TOPLEVEL)/src/$(PROGRAM_PREFIX)hexen.exe    \
++          $(TOPLEVEL)/src/$(PROGRAM_PREFIX)server.exe   \
++          $(TOPLEVEL)/src/$(PROGRAM_PREFIX)setup.exe
+
+ DLL_FILES=$(TOPLEVEL)/src/SDL.dll                      \
+           $(TOPLEVEL)/src/SDL_mixer.dll                \
+           $(TOPLEVEL)/src/SDL_net.dll
+
+ ZIP=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-win32.zip
+
+ $(ZIP) : staging
+ 	zip -j -r $@ staging/
+
+ staging: $(EXE_FILES) $(DLL_FILES) $(patsubst %,../../%,$(DOC_FILES))
+ 	rm -rf staging
+ 	mkdir staging
+ 	cp $(EXE_FILES) $(DLL_FILES) staging/
+ 	$(STRIP) staging/*.exe
+ 	for f in $(DOC_FILES); do                    \
+ 		cp $(TOPLEVEL)/$$f staging/$$f.txt;  \
+ 		unix2dos staging/$$f.txt;            \
+ 	done
+
+ clean:
+ 	rm -f $(ZIP)
+ 	rm -rf staging
+
diff --cc pkg/wince/GNUmakefile
index a203e63c,b6acc3b8..82b1f1e3
--- a/pkg/wince/GNUmakefile
+++ b/pkg/wince/GNUmakefile
@@@ -1,30 -1,15 +1,35 @@@

+ include ../config.make
+
 -DEPS=$(shell ./wince-cabgen -d $(CONFIG_FILE))
 -EXECUTABLES=$(filter %.exe, $(DEPS))
 -CONFIG_FILE=wince-cab.cfg
 -OUTPUT_FILE=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).cab
++all: $(DOOM_CAB) $(HERETIC_CAB) $(HEXEN_CAB)
+
 -$(OUTPUT_FILE) : $(CONFIG_FILE) $(DEPS)
 -	$(STRIP) $(EXECUTABLES)
++clean:
++	rm -f $(DOOM_CAB) $(HERETIC_CAB) $(HEXEN_CAB)
++
 +# Doom:
 +
- DOOM_CAB=chocolate-doom-@PACKAGE_VERSION@.cab
++DOOM_CAB=$(PROGRAM_PREFIX)doom-$(PACKAGE_VERSION).cab
 +DOOM_CFG=doom-cab.cfg
 +DOOM_DEPS=$(shell ./wince-cabgen -d $(DOOM_CFG))
 +
 +$(DOOM_CAB) : $(DOOM_CFG) $(DOOM_DEPS)
  	./wince-cabgen $< $@

 -clean:
 -	rm -f $(OUTPUT_FILE)
 +# Heretic:
 +
- HERETIC_CAB=chocolate-heretic-@PACKAGE_VERSION@.cab
++HERETIC_CAB=$(PROGRAM_PREFIX)heretic-$(PACKAGE_VERSION).cab
 +HERETIC_CFG=heretic-cab.cfg
 +HERETIC_DEPS=$(shell ./wince-cabgen -d $(HERETIC_CFG))
 +
 +$(HERETIC_CAB) : $(HERETIC_CFG) $(HERETIC_DEPS)
 +	./wince-cabgen $< $@
 +
 +# Hexen:
 +
- HEXEN_CAB=chocolate-hexen-@PACKAGE_VERSION@.cab
++HEXEN_CAB=$(PROGRAM_PREFIX)hexen-$(PACKAGE_VERSION).cab
 +HEXEN_CFG=hexen-cab.cfg
 +HEXEN_DEPS=$(shell ./wince-cabgen -d $(HEXEN_CFG))
 +
 +$(HEXEN_CAB) : $(HEXEN_CFG) $(HEXEN_DEPS)
 +	./wince-cabgen $< $@

- noinst_DATA = $(DOOM_CAB) $(HERETIC_CAB) $(HEXEN_CAB)
-
diff --cc src/Makefile.am
index fc7e8852,378ad053..9e550e15
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@@ -190,8 -188,8 +190,8 @@@ EXTRA_DIST =

  if HAVE_PYTHON

- icon.c : $(top_builddir)/data/doom.ico
 -icon.c : ../data/doom8.ico
 -	../data/convert-icon $^ $@
++icon.c : $(top_builddir)/data/doom8.ico
 +	$(top_builddir)/data/convert-icon $^ $@

  endif

diff --cc src/d_iwad.c
index ba9f9ae1,ea0d29d0..ab1dd823
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@@ -330,39 -315,101 +330,82 @@@ static void CheckDOSDefaults(void

  #endif

 -static struct
 -{
 -    char *name;
 -    GameMission_t mission;
 -} iwads[] = {
 -    {"doom2.wad",    doom2},
 -    {"plutonia.wad", pack_plut},
 -    {"tnt.wad",      pack_tnt},
 -    {"doom.wad",     doom},
 -    {"doom1.wad",    doom},
 -    {"chex.wad",     doom},
 -};
 -
 -// Hack for chex quest mode
 -
 -static void CheckChex(char *iwad_name)
 -{
 -    if (!strcmp(iwad_name, "chex.wad"))
 -    {
 -        gameversion = exe_chex;
 -    }
 -}
 -
+ // Returns true if the specified path is a path to a file
+ // of the specified name.
+
+ static boolean DirIsFile(char *path, char *filename)
+ {
+     size_t path_len;
+     size_t filename_len;
+
+     path_len = strlen(path);
+     filename_len = strlen(filename);
+
+     return path_len >= filename_len + 1
+         && path[path_len - filename_len - 1] == DIR_SEPARATOR
+         && !strcasecmp(&path[path_len - filename_len], filename);
+ }
+
+ // Check if the specified directory contains the specified IWAD
+ // file, returning the full path to the IWAD if found, or NULL
+ // if not found.
+
+ static char *CheckDirectoryHasIWAD(char *dir, char *iwadname)
+ {
+     char *filename;
+
+     // As a special case, the "directory" may refer directly to an
+     // IWAD file if the path comes from DOOMWADDIR or DOOMWADPATH.
+
+     if (DirIsFile(dir, iwadname) && M_FileExists(dir))
+     {
+         return strdup(dir);
+     }
+
+     // Construct the full path to the IWAD if it is located in
+     // this directory, and check if it exists.
+
+     filename = malloc(strlen(dir) + strlen(iwadname) + 3);
+
+     if (!strcmp(dir, "."))
+     {
+         strcpy(filename, iwadname);
+     }
+     else
+     {
+         sprintf(filename, "%s%c%s", dir, DIR_SEPARATOR, iwadname);
+     }
+
+     if (M_FileExists(filename))
+     {
+         return filename;
+     }
+
+     free(filename);
+
+     return NULL;
+ }
+
  // Search a directory to try to find an IWAD
  // Returns the location of the IWAD if found, otherwise NULL.

 -static char *SearchDirectoryForIWAD(char *dir)
 +static char *SearchDirectoryForIWAD(char *dir, int mask, GameMission_t *mission)
  {
+     char *filename;
      size_t i;

      for (i=0; i<arrlen(iwads); ++i)
      {
-         char *filename;
-         char *iwadname;
-
 +        if (((1 << iwads[i].mission) & mask) == 0)
 +        {
 +            continue;
 +        }
 +
-         iwadname = DEH_String(iwads[i].name);
-
-         filename = malloc(strlen(dir) + strlen(iwadname) + 3);
+         filename = CheckDirectoryHasIWAD(dir, DEH_String(iwads[i].name));

-         if (!strcmp(dir, "."))
-         {
-             strcpy(filename, iwadname);
-         }
-         else
-         {
-             sprintf(filename, "%s%c%s", dir, DIR_SEPARATOR, iwadname);
-         }
-
-         if (M_FileExists(filename))
+         if (filename != NULL)
          {
 -            CheckChex(iwads[i].name);
 -            gamemission = iwads[i].mission;
 +            *mission = iwads[i].mission;

              return filename;
          }
diff --cc src/doom/.gitignore
index d7e732ad,00000000..973a0073
mode 100644,000000..100644
--- a/src/doom/.gitignore
+++ b/src/doom/.gitignore
@@@ -1,7 -1,0 +1,9 @@@
 +Makefile
 +Makefile.in
 +.deps
 +*.rc
 +chocolate-doom
 +chocolate-server
 +*.exe
++tags
++TAGS
diff --cc src/setup/Makefile.am
index 07d7c936,00000000..25ab38e3
mode 100644,000000..100644
--- a/src/setup/Makefile.am
+++ b/src/setup/Makefile.am
@@@ -1,29 -1,0 +1,36 @@@
 +
 +gamesdir = $(prefix)/games
 +
 +AM_CFLAGS = @SDL_CFLAGS@                                           \
 +            @SDLMIXER_CFLAGS@                                      \
 +            -I$(top_builddir)/textscreen -I..
 +
 +noinst_LIBRARIES = libsetup.a
 +
 +SOURCE_FILES =                                  \
 +    compatibility.c   compatibility.h           \
 +    display.c         display.h                 \
 +    joystick.c        joystick.h                \
 +    keyboard.c        keyboard.h                \
 +    mainmenu.c                                  \
 +    mode.c            mode.h                    \
 +    mouse.c           mouse.h                   \
 +    multiplayer.c     multiplayer.h             \
 +    sound.c           sound.h                   \
 +    execute.c         execute.h                 \
 +    txt_joybinput.c   txt_joybinput.h           \
 +    txt_keyinput.c    txt_keyinput.h            \
 +    txt_mouseinput.c  txt_mouseinput.h
 +
 +libsetup_a_SOURCES = $(SOURCE_FILES)
 +
 +EXTRA_DIST=                                     \
 +    setup_icon.c
 +
++if HAVE_PYTHON
++
++setup_icon.c : $(top_builddir)/data/setup8.ico
++	$(top_builddir)/data/convert-icon $^ $@
++
++endif
++