summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2010-02-02 19:02:16 +0000
committerSimon Howard2010-02-02 19:02:16 +0000
commit8a77b34e936a3fd752db3bc1113e3d7bd0555440 (patch)
tree43c63e2135c70de079298a7b5c8d1dd2c2518df7 /src
parent8f6edc1f7402215c5e38d1f03939ce6b5ff5e3ae (diff)
downloadchocolate-doom-8a77b34e936a3fd752db3bc1113e3d7bd0555440.tar.gz
chocolate-doom-8a77b34e936a3fd752db3bc1113e3d7bd0555440.tar.bz2
chocolate-doom-8a77b34e936a3fd752db3bc1113e3d7bd0555440.zip
Move parts of dehacked code into top-level common code, to allow future
HHE and SEH support. Subversion-branch: /branches/raven-branch Subversion-revision: 1841
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am18
-rw-r--r--src/deh_defs.h (renamed from src/doom/deh_defs.h)0
-rw-r--r--src/deh_io.c (renamed from src/doom/deh_io.c)0
-rw-r--r--src/deh_io.h (renamed from src/doom/deh_io.h)0
-rw-r--r--src/deh_main.c (renamed from src/doom/deh_main.c)63
-rw-r--r--src/deh_main.h (renamed from src/doom/deh_main.h)0
-rw-r--r--src/deh_mapping.c (renamed from src/doom/deh_mapping.c)0
-rw-r--r--src/deh_mapping.h (renamed from src/doom/deh_mapping.h)0
-rw-r--r--src/deh_text.c (renamed from src/doom/deh_text.c)0
-rw-r--r--src/doom/Makefile.am6
-rw-r--r--src/doom/deh_doom.c74
11 files changed, 100 insertions, 61 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b84f0b29..fc7e8852 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,6 +50,7 @@ d_event.c d_event.h \
d_iwad.c d_iwad.h \
d_mode.c d_mode.h \
d_ticcmd.h \
+deh_str.c deh_str.h \
i_cdmus.c i_cdmus.h \
i_endoom.c i_endoom.h \
i_joystick.c i_joystick.h \
@@ -79,8 +80,12 @@ z_zone.c z_zone.h
# source files needed for FEATURE_DEHACKED
-FEATURE_DEHACKED_SOURCE_FILES= \
-deh_str.c deh_str.h
+FEATURE_DEHACKED_SOURCE_FILES = \
+deh_defs.h \
+deh_io.c deh_io.h \
+deh_main.c deh_main.h \
+deh_mapping.c deh_mapping.h \
+deh_text.c
# source files needed for FEATURE_MULTIPLAYER
@@ -111,12 +116,15 @@ i_sdlsound.c \
i_sdlmusic.c \
mus2mid.c mus2mid.h
+# Some games support dehacked patches, some don't:
+
SOURCE_FILES = $(COMMON_SOURCE_FILES) \
$(GAME_SOURCE_FILES) \
- $(FEATURE_DEHACKED_SOURCE_FILES) \
$(FEATURE_WAD_MERGE_SOURCE_FILES) \
$(FEATURE_SOUND_SOURCE_FILES)
+SOURCE_FILES_WITH_DEH = $(SOURCE_FILES) \
+ $(FEATURE_DEHACKED_SOURCE_FILES)
EXTRA_LIBS = \
$(top_builddir)/wince/libc_wince.a \
@@ -128,9 +136,9 @@ EXTRA_LIBS = \
@SDLNET_LIBS@
if HAVE_WINDRES
-@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES) resource.rc
+@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES_WITH_DEH) resource.rc
else
-@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES)
+@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES_WITH_DEH)
endif
@PROGRAM_PREFIX@doom_LDADD = doom/libdoom.a $(EXTRA_LIBS)
diff --git a/src/doom/deh_defs.h b/src/deh_defs.h
index e7b76182..e7b76182 100644
--- a/src/doom/deh_defs.h
+++ b/src/deh_defs.h
diff --git a/src/doom/deh_io.c b/src/deh_io.c
index 3386a6fa..3386a6fa 100644
--- a/src/doom/deh_io.c
+++ b/src/deh_io.c
diff --git a/src/doom/deh_io.h b/src/deh_io.h
index 061a5a0e..061a5a0e 100644
--- a/src/doom/deh_io.h
+++ b/src/deh_io.h
diff --git a/src/doom/deh_main.c b/src/deh_main.c
index 63cae460..3f0a6f29 100644
--- a/src/doom/deh_main.c
+++ b/src/deh_main.c
@@ -36,30 +36,8 @@
#include "deh_defs.h"
#include "deh_io.h"
-static char *deh_signatures[] =
-{
- "Patch File for DeHackEd v2.3",
- "Patch File for DeHackEd v3.0",
-};
-
-// deh_ammo.c:
-extern deh_section_t deh_section_ammo;
-// deh_cheat.c:
-extern deh_section_t deh_section_cheat;
-// deh_frame.c:
-extern deh_section_t deh_section_frame;
-// deh_misc.c:
-extern deh_section_t deh_section_misc;
-// deh_ptr.c:
-extern deh_section_t deh_section_pointer;
-// deh_sound.c
-extern deh_section_t deh_section_sound;
-// deh_text.c:
-extern deh_section_t deh_section_text;
-// deh_thing.c:
-extern deh_section_t deh_section_thing;
-// deh_weapon.c:
-extern deh_section_t deh_section_weapon;
+extern deh_section_t *deh_section_types[];
+extern char *deh_signatures[];
// If true, we can do long string replacements.
@@ -73,23 +51,6 @@ boolean deh_allow_long_cheats = false;
boolean deh_apply_cheats = true;
-//
-// List of section types:
-//
-
-static deh_section_t *section_types[] =
-{
- &deh_section_ammo,
- &deh_section_cheat,
- &deh_section_frame,
- &deh_section_misc,
- &deh_section_pointer,
- &deh_section_sound,
- &deh_section_text,
- &deh_section_thing,
- &deh_section_weapon,
-};
-
void DEH_Checksum(md5_digest_t digest)
{
md5_context_t md5_context;
@@ -97,11 +58,11 @@ void DEH_Checksum(md5_digest_t digest)
MD5_Init(&md5_context);
- for (i=0; i<arrlen(section_types); ++i)
+ for (i=0; deh_section_types[i] != NULL; ++i)
{
- if (section_types[i]->md5_hash != NULL)
+ if (deh_section_types[i]->md5_hash != NULL)
{
- section_types[i]->md5_hash(&md5_context);
+ deh_section_types[i]->md5_hash(&md5_context);
}
}
@@ -114,11 +75,11 @@ static void InitializeSections(void)
{
unsigned int i;
- for (i=0; i<arrlen(section_types); ++i)
+ for (i=0; deh_section_types[i] != NULL; ++i)
{
- if (section_types[i]->init != NULL)
+ if (deh_section_types[i]->init != NULL)
{
- section_types[i]->init();
+ deh_section_types[i]->init();
}
}
}
@@ -129,11 +90,11 @@ static deh_section_t *GetSectionByName(char *name)
{
unsigned int i;
- for (i=0; i<arrlen(section_types); ++i)
+ for (i=0; deh_section_types[i] != NULL; ++i)
{
- if (!strcasecmp(section_types[i]->name, name))
+ if (!strcasecmp(deh_section_types[i]->name, name))
{
- return section_types[i];
+ return deh_section_types[i];
}
}
@@ -229,7 +190,7 @@ static boolean CheckSignatures(deh_context_t *context)
// Check all signatures to see if one matches
- for (i=0; i<arrlen(deh_signatures); ++i)
+ for (i=0; deh_signatures[i] != NULL; ++i)
{
if (!strcmp(deh_signatures[i], line))
{
diff --git a/src/doom/deh_main.h b/src/deh_main.h
index f9cb44ca..f9cb44ca 100644
--- a/src/doom/deh_main.h
+++ b/src/deh_main.h
diff --git a/src/doom/deh_mapping.c b/src/deh_mapping.c
index b215b128..b215b128 100644
--- a/src/doom/deh_mapping.c
+++ b/src/deh_mapping.c
diff --git a/src/doom/deh_mapping.h b/src/deh_mapping.h
index 4862dec9..4862dec9 100644
--- a/src/doom/deh_mapping.h
+++ b/src/deh_mapping.h
diff --git a/src/doom/deh_text.c b/src/deh_text.c
index 31e23db2..31e23db2 100644
--- a/src/doom/deh_text.c
+++ b/src/deh_text.c
diff --git a/src/doom/Makefile.am b/src/doom/Makefile.am
index 7b7073b6..596e42eb 100644
--- a/src/doom/Makefile.am
+++ b/src/doom/Makefile.am
@@ -63,15 +63,11 @@ wi_stuff.c wi_stuff.h
FEATURE_DEHACKED_SOURCE_FILES = \
deh_ammo.c \
deh_cheat.c \
-deh_defs.h \
+deh_doom.c \
deh_frame.c \
-deh_io.c deh_io.h \
-deh_main.c deh_main.h \
-deh_mapping.c deh_mapping.h \
deh_misc.c deh_misc.h \
deh_ptr.c \
deh_sound.c \
-deh_text.c \
deh_thing.c \
deh_weapon.c
diff --git a/src/doom/deh_doom.c b/src/doom/deh_doom.c
new file mode 100644
index 00000000..7549e09e
--- /dev/null
+++ b/src/doom/deh_doom.c
@@ -0,0 +1,74 @@
+// Emacs style mode select -*- C++ -*-
+//-----------------------------------------------------------------------------
+//
+// Copyright(C) 2005 Simon Howard
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+//
+//-----------------------------------------------------------------------------
+//
+// Top-level dehacked definitions for Doom dehacked.
+//
+//-----------------------------------------------------------------------------
+
+#include <stdlib.h>
+#include "deh_defs.h"
+#include "deh_main.h"
+
+char *deh_signatures[] =
+{
+ "Patch File for DeHackEd v2.3",
+ "Patch File for DeHackEd v3.0",
+ NULL
+};
+
+// deh_ammo.c:
+extern deh_section_t deh_section_ammo;
+// deh_cheat.c:
+extern deh_section_t deh_section_cheat;
+// deh_frame.c:
+extern deh_section_t deh_section_frame;
+// deh_misc.c:
+extern deh_section_t deh_section_misc;
+// deh_ptr.c:
+extern deh_section_t deh_section_pointer;
+// deh_sound.c
+extern deh_section_t deh_section_sound;
+// deh_text.c:
+extern deh_section_t deh_section_text;
+// deh_thing.c:
+extern deh_section_t deh_section_thing;
+// deh_weapon.c:
+extern deh_section_t deh_section_weapon;
+
+//
+// List of section types:
+//
+
+deh_section_t *deh_section_types[] =
+{
+ &deh_section_ammo,
+ &deh_section_cheat,
+ &deh_section_frame,
+ &deh_section_misc,
+ &deh_section_pointer,
+ &deh_section_sound,
+ &deh_section_text,
+ &deh_section_thing,
+ &deh_section_weapon,
+ NULL
+};
+