summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-06-03 22:03:36 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-06-03 22:03:36 +0000
commitaec5814d436f6307dc3e6a1a09aa1ffec5709c27 (patch)
tree9d553317483ec7ef53dca7db931bd9f99ca7a5b8 /apps
parent7428b79de328dca03274ccfe08d59636eb6f8d51 (diff)
downloadrockbox-aec5814d436f6307dc3e6a1a09aa1ffec5709c27.tar.gz
rockbox-aec5814d436f6307dc3e6a1a09aa1ffec5709c27.zip
Some fixes to doom dehacked loading - make embedded dehacked files actually load, fix end of file detection in the string loader, fix ammo changes, fix bex code pointers. Also added the * flag to sscanf - still only tested against rockdoom sscanf calls.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/doom/d_deh.c9
-rw-r--r--apps/plugins/doom/d_main.c4
-rw-r--r--apps/plugins/doom/rockdoom.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/apps/plugins/doom/d_deh.c b/apps/plugins/doom/d_deh.c
index c1e136f467..d3f7496885 100644
--- a/apps/plugins/doom/d_deh.c
+++ b/apps/plugins/doom/d_deh.c
@@ -85,7 +85,7 @@ char *dehfgets(char *buf, size_t n, DEHFILE *fp)
p = buf;
- while (--n > 0)
+ while (n-- > 0)
{
unsigned char c = *fp->inp++;
fp->size--;
@@ -111,7 +111,7 @@ int dehfeof(DEHFILE *fp)
return (size <= 0 || offset < 0 || offset >= size) ? 1 : 0;
}
- return (fp->size == 0 || *fp->inp == '\0') ? 1 : 0;
+ return (fp->size <= 0 || *fp->inp == '\0') ? 1 : 0;
}
int dehfgetc(DEHFILE *fp)
@@ -1509,6 +1509,7 @@ void ProcessDehFile(const char *filename, const char *outfilename, int lumpnum)
int size = W_LumpLength(lumpnum);
infile.size = (size < 0) ? 0 : (ssize_t)size;
infile.inp = W_CacheLumpNum(lumpnum);
+ infile.fd=-1;
filename = "(WAD)";
}
@@ -1983,7 +1984,7 @@ void deh_procPointer(DEHFILE *fpin, int fpout, char *line) // done
// NOTE: different format from normal
// killough 8/98: allow hex numbers in input, fix error case:
- if (sscanf(inbuffer,"%*s %*i (%s %i)",key, &indexnum) != 2)
+ if (sscanf(inbuffer,"%*s %*d (%s %d)",key, &indexnum) != 2)
{
if (fpout) fdprintf(fpout,"Bad data pair in '%s'\n",inbuffer);
return;
@@ -2122,7 +2123,7 @@ void deh_procAmmo(DEHFILE *fpin, int fpout, char *line)
strncpy(inbuffer,line,DEH_BUFFERMAX);
// killough 8/98: allow hex numbers in input:
- sscanf(inbuffer,"%s %i",key, &indexnum);
+ sscanf(inbuffer,"%s %d",key, &indexnum);
if (fpout) fdprintf(fpout,"Processing Ammo at index %d: %s\n",
indexnum, key);
if (indexnum < 0 || indexnum >= NUMAMMO)
diff --git a/apps/plugins/doom/d_main.c b/apps/plugins/doom/d_main.c
index 3dc64875fd..32e3809dee 100644
--- a/apps/plugins/doom/d_main.c
+++ b/apps/plugins/doom/d_main.c
@@ -82,7 +82,7 @@ boolean clfastparm; // checkparm of -fast
boolean nomonsters; // working -nomonsters
boolean respawnparm; // working -respawn
boolean fastparm; // working -fast
-boolean dehout=false;
+boolean dehout=true;
boolean singletics = false; // debug flag to cancel adaptiveness
@@ -731,7 +731,7 @@ void D_DoomMainSetup(void)
W_Init();
if ((p = W_CheckNumForName("DEHACKED")) != -1) // cph - add dehacked-in-a-wad support
- ProcessDehFile(NULL, dehout ? NULL : "/dehlog.txt", p);
+ ProcessDehFile(NULL, dehout ? "/dehlog.txt" : NULL, p);
V_InitColorTranslation(); //jff 4/24/98 load color translation lumps
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 82daadb24e..90c446b9eb 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -103,6 +103,7 @@ struct plugin_api* rb;
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
+#ifndef SIMULATOR
// Here is a hacked up printf command to get the output from the game.
int printf(const char *fmt, ...)
{
@@ -129,6 +130,7 @@ int printf(const char *fmt, ...)
}
return 1;
}
+#endif
char *my_strtok( char * s, const char * delim )
{