summaryrefslogtreecommitdiff
path: root/apps/plugins
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/plugins
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/plugins')
-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)
85 85
86 p = buf; 86 p = buf;
87 87
88 while (--n > 0) 88 while (n-- > 0)
89 { 89 {
90 unsigned char c = *fp->inp++; 90 unsigned char c = *fp->inp++;
91 fp->size--; 91 fp->size--;
@@ -111,7 +111,7 @@ int dehfeof(DEHFILE *fp)
111 return (size <= 0 || offset < 0 || offset >= size) ? 1 : 0; 111 return (size <= 0 || offset < 0 || offset >= size) ? 1 : 0;
112 } 112 }
113 113
114 return (fp->size == 0 || *fp->inp == '\0') ? 1 : 0; 114 return (fp->size <= 0 || *fp->inp == '\0') ? 1 : 0;
115} 115}
116 116
117int dehfgetc(DEHFILE *fp) 117int dehfgetc(DEHFILE *fp)
@@ -1509,6 +1509,7 @@ void ProcessDehFile(const char *filename, const char *outfilename, int lumpnum)
1509 int size = W_LumpLength(lumpnum); 1509 int size = W_LumpLength(lumpnum);
1510 infile.size = (size < 0) ? 0 : (ssize_t)size; 1510 infile.size = (size < 0) ? 0 : (ssize_t)size;
1511 infile.inp = W_CacheLumpNum(lumpnum); 1511 infile.inp = W_CacheLumpNum(lumpnum);
1512 infile.fd=-1;
1512 filename = "(WAD)"; 1513 filename = "(WAD)";
1513 } 1514 }
1514 1515
@@ -1983,7 +1984,7 @@ void deh_procPointer(DEHFILE *fpin, int fpout, char *line) // done
1983 // NOTE: different format from normal 1984 // NOTE: different format from normal
1984 1985
1985 // killough 8/98: allow hex numbers in input, fix error case: 1986 // killough 8/98: allow hex numbers in input, fix error case:
1986 if (sscanf(inbuffer,"%*s %*i (%s %i)",key, &indexnum) != 2) 1987 if (sscanf(inbuffer,"%*s %*d (%s %d)",key, &indexnum) != 2)
1987 { 1988 {
1988 if (fpout) fdprintf(fpout,"Bad data pair in '%s'\n",inbuffer); 1989 if (fpout) fdprintf(fpout,"Bad data pair in '%s'\n",inbuffer);
1989 return; 1990 return;
@@ -2122,7 +2123,7 @@ void deh_procAmmo(DEHFILE *fpin, int fpout, char *line)
2122 strncpy(inbuffer,line,DEH_BUFFERMAX); 2123 strncpy(inbuffer,line,DEH_BUFFERMAX);
2123 2124
2124 // killough 8/98: allow hex numbers in input: 2125 // killough 8/98: allow hex numbers in input:
2125 sscanf(inbuffer,"%s %i",key, &indexnum); 2126 sscanf(inbuffer,"%s %d",key, &indexnum);
2126 if (fpout) fdprintf(fpout,"Processing Ammo at index %d: %s\n", 2127 if (fpout) fdprintf(fpout,"Processing Ammo at index %d: %s\n",
2127 indexnum, key); 2128 indexnum, key);
2128 if (indexnum < 0 || indexnum >= NUMAMMO) 2129 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
82boolean nomonsters; // working -nomonsters 82boolean nomonsters; // working -nomonsters
83boolean respawnparm; // working -respawn 83boolean respawnparm; // working -respawn
84boolean fastparm; // working -fast 84boolean fastparm; // working -fast
85boolean dehout=false; 85boolean dehout=true;
86 86
87boolean singletics = false; // debug flag to cancel adaptiveness 87boolean singletics = false; // debug flag to cancel adaptiveness
88 88
@@ -731,7 +731,7 @@ void D_DoomMainSetup(void)
731 W_Init(); 731 W_Init();
732 732
733 if ((p = W_CheckNumForName("DEHACKED")) != -1) // cph - add dehacked-in-a-wad support 733 if ((p = W_CheckNumForName("DEHACKED")) != -1) // cph - add dehacked-in-a-wad support
734 ProcessDehFile(NULL, dehout ? NULL : "/dehlog.txt", p); 734 ProcessDehFile(NULL, dehout ? "/dehlog.txt" : NULL, p);
735 735
736 V_InitColorTranslation(); //jff 4/24/98 load color translation lumps 736 V_InitColorTranslation(); //jff 4/24/98 load color translation lumps
737 737
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;
103 103
104bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates 104bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
105 105
106#ifndef SIMULATOR
106// Here is a hacked up printf command to get the output from the game. 107// Here is a hacked up printf command to get the output from the game.
107int printf(const char *fmt, ...) 108int printf(const char *fmt, ...)
108{ 109{
@@ -129,6 +130,7 @@ int printf(const char *fmt, ...)
129 } 130 }
130 return 1; 131 return 1;
131} 132}
133#endif
132 134
133char *my_strtok( char * s, const char * delim ) 135char *my_strtok( char * s, const char * delim )
134{ 136{