From a64aec204b31884506af334bca9984c1183b442a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 1 Sep 2006 20:07:25 +0000 Subject: Better spechits emulation. Remove support for emulating the higher-memory spechits overruns, as they will overwrite pointers with garbage and crash the game. Change the spechits base address to one from doom2.exe, which seems to work better in more cases. Add -spechit command-line parameter to allow the base address to be explicitly specified if necessary. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 592 --- src/p_map.c | 60 ++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6c7243b2..cc75aa58 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: p_map.c 261 2006-01-07 19:16:39Z fraggle $ +// $Id: p_map.c 592 2006-09-01 20:07:25Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard, Andrey Budko @@ -46,7 +46,7 @@ //----------------------------------------------------------------------------- static const char -rcsid[] = "$Id: p_map.c 261 2006-01-07 19:16:39Z fraggle $"; +rcsid[] = "$Id: p_map.c 592 2006-09-01 20:07:25Z fraggle $"; #include @@ -57,6 +57,7 @@ rcsid[] = "$Id: p_map.c 261 2006-01-07 19:16:39Z fraggle $"; #include "i_system.h" #include "doomdef.h" +#include "m_argv.h" #include "p_local.h" #include "s_sound.h" @@ -276,7 +277,7 @@ boolean PIT_CheckLine (line_t* ld) if (ld->special) { // fraggle: spechits overrun emulation code from prboom-plus - if (numspechit >= MAXSPECIALCROSS_ORIGINAL) + if (numspechit > MAXSPECIALCROSS_ORIGINAL) { SpechitOverrun(ld); } @@ -1390,7 +1391,40 @@ P_ChangeSector static void SpechitOverrun(line_t *ld) { - int addr = 0x01C09C98 + (ld - lines) * 0x3E; + static unsigned int baseaddr = 0; + unsigned int addr; + + if (baseaddr == 0) + { + int p; + + // This is the first time we have had an overrun. Work out + // what base address we are going to use. + // Allow a spechit value to be specified on the command line. + + p = M_CheckParm("-spechit"); + + if (p > 0) + { + baseaddr = atoi(myargv[p+1]); + } + else + { + // This is from a post by myk on the Doomworld forums, + // outputted from entryway's spechit_magic generator for + // s205n546.lmp. The _exact_ value of this isn't too + // important; as long as it is in the right general + // range, it will usually work. Otherwise, we can use + // the generator (hacked doom2.exe) and provide it + // with -spechit. + + baseaddr = 0x84f968e8; + } + } + + // Calculate address used in doom2.exe + + addr = baseaddr + (ld - lines) * 0x3E; switch(numspechit) { @@ -1406,24 +1440,6 @@ static void SpechitOverrun(line_t *ld) case 14: nofit = addr; break; - case 15: - bombsource = (mobj_t*)addr; - break; - case 16: - bombdamage = addr; - break; - case 17: - bombspot = (mobj_t*)addr; - break; - case 18: - usething = (mobj_t*)addr; - break; - case 19: - attackrange = addr; - break; - case 20: - la_damage = addr; - break; default: fprintf(stderr, "SpechitOverrun: Warning: unable to emulate" "an overrun where numspechit=%i\n", -- cgit v1.2.3