From: sparky4 Date: Sun, 23 Apr 2017 21:06:22 +0000 (-0500) Subject: 16_ca needs huge amounts of work and I should remember what needs to be done soon... X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=256be2f6f35912701d3e3770e49e388f462a6acc 16_ca needs huge amounts of work and I should remember what needs to be done soon[going to port rest of code to borland c some time so we can use the core components of id engine here ][going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] added 1st scroll back [i work on CA] --- diff --git a/BCWOLF.LOG b/BCWOLF.LOG deleted file mode 100755 index f1a3abc0..00000000 --- a/BCWOLF.LOG +++ /dev/null @@ -1,25 +0,0 @@ -VL_MungePic==================================== -4EC3:FFAE (memptr *)&temp -4EC3:FFAE (memptr)temp -460A:4628 &temp -4628:3DC2 temp -=============================================== - SDL_SetDS(): OK -CAL_SetupGrFile: - chunkcomplen size is 350 -CalcHeight() -heightnumerator -211968 15360 828 0 -a 6234 -b 12 -d 8734 -d 8 -ax 4 -al 5 - nx 0 -pee 2408 -gxt gyt nx gx gy -0 0 22528 0 0 -0 0 0 0 22528 -ch 14 -compiled on Apr 19 2017 12:39:47 diff --git a/__seguse.txt b/__seguse.txt index 720dc06a..d9d49f56 100755 --- a/__seguse.txt +++ b/__seguse.txt @@ -1,6 +1,6 @@ -------------------------------------------------------------------------------- - ./qkeen.sh start -------------------------------------------------------------------------------- +------------------------------------------------------------------------------- + ./qkeen.sh start +------------------------------------------------------------------------------- 16/keen/id_ca.c:byte _seg *tinf; 16/keen/id_ca.c:unsigned _seg *mapsegs[3]; 16/keen/id_ca.c:maptype _seg *mapheaderseg[NUMMAPS]; @@ -66,11 +66,11 @@ 16/keen/id_vw.h:extern pictabletype _seg *pictable; 16/keen/id_vw.h:extern pictabletype _seg *picmtable; 16/keen/id_vw.h:extern spritetabletype _seg *spritetable; -=============== ./qkeen.sh end =============== -------------------------------------------------------------------------------- - ./qwolf.sh start -------------------------------------------------------------------------------- -==== 16/wf3d8086 ==== +=============== ./qkeen.sh end =============== +------------------------------------------------------------------------------- + ./qwolf.sh start +------------------------------------------------------------------------------- +==== 16/wf3d8086 ==== 16/wf3d8086/contigsc.c:byte _seg *endscalermemory; 16/wf3d8086/contigsc.c: endscalermemory = (void _seg *)(seg+ofs/16); 16/wf3d8086/contigsc.c: t_compshape _seg *shape; @@ -103,6 +103,13 @@ 16/wf3d8086/id_vh.c: src = (byte _seg *)grsegs[STARTTILE8]; 16/wf3d8086/id_vh.c: src = (byte _seg *)grsegs[STARTTILE16]; 16/wf3d8086/id_vh.c: src = (byte _seg *)grsegs[STARTTILE16+i]; +16/wf3d8086/oldscale.c:t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; +16/wf3d8086/oldscale.c:t_compscale _seg *work; +16/wf3d8086/oldscale.c: _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize); +16/wf3d8086/oldscale.c: t_compshape _seg *shape; +16/wf3d8086/oldscale.c: t_compscale _seg *comptable; +16/wf3d8086/oldscale.c: t_compshape _seg *shape; +16/wf3d8086/oldscale.c: t_compscale _seg *comptable; 16/wf3d8086/wl_debug.c: spritetype _seg *block; 16/wf3d8086/wl_debug.c:extern word _seg *DigiList; 16/wf3d8086/wl_menu.c: fontstruct _seg *font; @@ -130,71 +137,78 @@ 16/wf3d8086/id_vh.h:extern pictabletype _seg *picmtable; 16/wf3d8086/id_vh.h:extern spritetabletype _seg *spritetable; 16/wf3d8086/wl_def.h:extern t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; -==== 16/wolf3d/WOLFSRC ==== -16/wolf3d/WOLFSRC/CONTIGSC.C:byte _seg *endscalermemory; -16/wolf3d/WOLFSRC/CONTIGSC.C: endscalermemory = (void _seg *)(seg+ofs/16); -16/wolf3d/WOLFSRC/CONTIGSC.C: t_compshape _seg *shape; -16/wolf3d/WOLFSRC/CONTIGSC.C: t_compshape _seg *shape; -16/wolf3d/WOLFSRC/ID_CA.C:byte _seg *tinf; -16/wolf3d/WOLFSRC/ID_CA.C:unsigned _seg *mapsegs[MAPPLANES]; -16/wolf3d/WOLFSRC/ID_CA.C:maptype _seg *mapheaderseg[NUMMAPS]; -16/wolf3d/WOLFSRC/ID_CA.C:byte _seg *audiosegs[NUMSNDCHUNKS]; -16/wolf3d/WOLFSRC/ID_CA.C:void _seg *grsegs[NUMCHUNKS]; -16/wolf3d/WOLFSRC/ID_CA.C:long _seg *grstarts; // array of offsets in egagraph, -1 for sparse -16/wolf3d/WOLFSRC/ID_CA.C:long _seg *audiostarts; // array of offsets in audio / audiot -16/wolf3d/WOLFSRC/ID_CA.C: grstarts = (long _seg *)FP_SEG(&EGAhead); -16/wolf3d/WOLFSRC/ID_CA.C: tinf = (byte _seg *)FP_SEG(&maphead); -16/wolf3d/WOLFSRC/ID_CA.C: pos = ((mapfiletype _seg *)tinf)->headeroffsets[i]; -16/wolf3d/WOLFSRC/ID_CA.C: audiostarts = (long _seg *)FP_SEG(&audiohead); -16/wolf3d/WOLFSRC/ID_CA.C: ((mapfiletype _seg *)tinf)->RLEWtag); -16/wolf3d/WOLFSRC/ID_CA.C: ((mapfiletype _seg *)tinf)->RLEWtag); -16/wolf3d/WOLFSRC/ID_CA.C: source = (byte _seg *)bufferseg+(pos-bufferstart); -16/wolf3d/WOLFSRC/ID_IN.C: byte _seg *DemoBuffer; -16/wolf3d/WOLFSRC/ID_PM.C: _seg *PMSegPages; -16/wolf3d/WOLFSRC/ID_PM.C: void _seg *buf; -16/wolf3d/WOLFSRC/ID_PM.C: MM_FreePtr(&(void _seg *)PMSegPages); -16/wolf3d/WOLFSRC/ID_SD.C: word *SoundTable; // Really * _seg *SoundTable, but that don't work -16/wolf3d/WOLFSRC/ID_SD.C: word _seg *DigiList; -16/wolf3d/WOLFSRC/ID_VH.C:pictabletype _seg *pictable; -16/wolf3d/WOLFSRC/ID_VH.C: byte _seg *temp, far *dest, far *srcline; -16/wolf3d/WOLFSRC/ID_VH.C: , fontstruct _seg *font) -16/wolf3d/WOLFSRC/ID_VH.C: VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONT+fontnumber]); -16/wolf3d/WOLFSRC/ID_VH.C: VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONTM+fontnumber]); -16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE8]; -16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE16]; -16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE16+i]; -16/wolf3d/WOLFSRC/WL_DEBUG.C: spritetype _seg *block; -16/wolf3d/WOLFSRC/WL_DEBUG.C:extern word _seg *DigiList; -16/wolf3d/WOLFSRC/WL_MENU.C: fontstruct _seg *font; -16/wolf3d/WOLFSRC/WL_SCALE.C:t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; -16/wolf3d/WOLFSRC/WL_SCALE.C:t_compscale _seg *work; -16/wolf3d/WOLFSRC/WL_SCALE.C: _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize); -16/wolf3d/WOLFSRC/WL_SCALE.C: t_compshape _seg *shape; -16/wolf3d/WOLFSRC/WL_SCALE.C: t_compscale _seg *comptable; -16/wolf3d/WOLFSRC/WL_SCALE.C: t_compshape _seg *shape; -16/wolf3d/WOLFSRC/WL_SCALE.C: t_compscale _seg *comptable; -16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)grsegs[artnum]; -16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)layout; -16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)grsegs[artnum]; -16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)layout; -16/wolf3d/WOLFSRC/ID_CA.H:extern byte _seg *tinf; -16/wolf3d/WOLFSRC/ID_CA.H:extern unsigned _seg *mapsegs[MAPPLANES]; -16/wolf3d/WOLFSRC/ID_CA.H:extern maptype _seg *mapheaderseg[NUMMAPS]; -16/wolf3d/WOLFSRC/ID_CA.H:extern byte _seg *audiosegs[NUMSNDCHUNKS]; -16/wolf3d/WOLFSRC/ID_CA.H:extern void _seg *grsegs[NUMCHUNKS]; -16/wolf3d/WOLFSRC/ID_CA.H:extern long _seg *grstarts; // array of offsets in egagraph, -1 for sparse -16/wolf3d/WOLFSRC/ID_CA.H:extern long _seg *audiostarts; // array of offsets in audio / audiot -16/wolf3d/WOLFSRC/ID_IN.H:extern byte _seg *DemoBuffer; -16/wolf3d/WOLFSRC/ID_MM.H:typedef void _seg * memptr; -16/wolf3d/WOLFSRC/ID_VH.H:extern pictabletype _seg *pictable; -16/wolf3d/WOLFSRC/ID_VH.H:extern pictabletype _seg *picmtable; -16/wolf3d/WOLFSRC/ID_VH.H:extern spritetabletype _seg *spritetable; -16/wolf3d/WOLFSRC/WL_DEF.H:extern t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; -=============== ./qwolf.sh end =============== -------------------------------------------------------------------------------- - ./qcata.sh start -------------------------------------------------------------------------------- -==== 16/Catacomb3D ==== +==== 16/wolf3d/WOLFSRC ==== +16/wolf3d/WOLFSRC/CONTIGSC.C:byte _seg *endscalermemory; +16/wolf3d/WOLFSRC/CONTIGSC.C: endscalermemory = (void _seg *)(seg+ofs/16); +16/wolf3d/WOLFSRC/CONTIGSC.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/CONTIGSC.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/ID_CA.C:byte _seg *tinf; +16/wolf3d/WOLFSRC/ID_CA.C:unsigned _seg *mapsegs[MAPPLANES]; +16/wolf3d/WOLFSRC/ID_CA.C:maptype _seg *mapheaderseg[NUMMAPS]; +16/wolf3d/WOLFSRC/ID_CA.C:byte _seg *audiosegs[NUMSNDCHUNKS]; +16/wolf3d/WOLFSRC/ID_CA.C:void _seg *grsegs[NUMCHUNKS]; +16/wolf3d/WOLFSRC/ID_CA.C:long _seg *grstarts; // array of offsets in egagraph, -1 for sparse +16/wolf3d/WOLFSRC/ID_CA.C:long _seg *audiostarts; // array of offsets in audio / audiot +16/wolf3d/WOLFSRC/ID_CA.C: grstarts = (long _seg *)FP_SEG(&EGAhead); +16/wolf3d/WOLFSRC/ID_CA.C: tinf = (byte _seg *)FP_SEG(&maphead); +16/wolf3d/WOLFSRC/ID_CA.C: pos = ((mapfiletype _seg *)tinf)->headeroffsets[i]; +16/wolf3d/WOLFSRC/ID_CA.C: audiostarts = (long _seg *)FP_SEG(&audiohead); +16/wolf3d/WOLFSRC/ID_CA.C: ((mapfiletype _seg *)tinf)->RLEWtag); +16/wolf3d/WOLFSRC/ID_CA.C: ((mapfiletype _seg *)tinf)->RLEWtag); +16/wolf3d/WOLFSRC/ID_CA.C: source = (byte _seg *)bufferseg+(pos-bufferstart); +16/wolf3d/WOLFSRC/ID_IN.C: byte _seg *DemoBuffer; +16/wolf3d/WOLFSRC/ID_PM.C: _seg *PMSegPages; +16/wolf3d/WOLFSRC/ID_PM.C: void _seg *buf; +16/wolf3d/WOLFSRC/ID_PM.C: MM_FreePtr(&(void _seg *)PMSegPages); +16/wolf3d/WOLFSRC/ID_SD.C: word *SoundTable; // Really * _seg *SoundTable, but that don't work +16/wolf3d/WOLFSRC/ID_SD.C: word _seg *DigiList; +16/wolf3d/WOLFSRC/ID_VH.C:pictabletype _seg *pictable; +16/wolf3d/WOLFSRC/ID_VH.C: byte _seg *temp, far *dest, far *srcline; +16/wolf3d/WOLFSRC/ID_VH.C: , fontstruct _seg *font) +16/wolf3d/WOLFSRC/ID_VH.C: VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONT+fontnumber]); +16/wolf3d/WOLFSRC/ID_VH.C: VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONTM+fontnumber]); +16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE8]; +16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE16]; +16/wolf3d/WOLFSRC/ID_VH.C: src = (byte _seg *)grsegs[STARTTILE16+i]; +16/wolf3d/WOLFSRC/OLDSCALE.C:t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; +16/wolf3d/WOLFSRC/OLDSCALE.C:t_compscale _seg *work; +16/wolf3d/WOLFSRC/OLDSCALE.C: _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize); +16/wolf3d/WOLFSRC/OLDSCALE.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/OLDSCALE.C: t_compscale _seg *comptable; +16/wolf3d/WOLFSRC/OLDSCALE.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/OLDSCALE.C: t_compscale _seg *comptable; +16/wolf3d/WOLFSRC/WL_DEBUG.C: spritetype _seg *block; +16/wolf3d/WOLFSRC/WL_DEBUG.C:extern word _seg *DigiList; +16/wolf3d/WOLFSRC/WL_MENU.C: fontstruct _seg *font; +16/wolf3d/WOLFSRC/WL_SCALE.C:t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; +16/wolf3d/WOLFSRC/WL_SCALE.C:t_compscale _seg *work; +16/wolf3d/WOLFSRC/WL_SCALE.C: _fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize); +16/wolf3d/WOLFSRC/WL_SCALE.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/WL_SCALE.C: t_compscale _seg *comptable; +16/wolf3d/WOLFSRC/WL_SCALE.C: t_compshape _seg *shape; +16/wolf3d/WOLFSRC/WL_SCALE.C: t_compscale _seg *comptable; +16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)grsegs[artnum]; +16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)layout; +16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)grsegs[artnum]; +16/wolf3d/WOLFSRC/WL_TEXT.C: text = (char _seg *)layout; +16/wolf3d/WOLFSRC/ID_CA.H:extern byte _seg *tinf; +16/wolf3d/WOLFSRC/ID_CA.H:extern unsigned _seg *mapsegs[MAPPLANES]; +16/wolf3d/WOLFSRC/ID_CA.H:extern maptype _seg *mapheaderseg[NUMMAPS]; +16/wolf3d/WOLFSRC/ID_CA.H:extern byte _seg *audiosegs[NUMSNDCHUNKS]; +16/wolf3d/WOLFSRC/ID_CA.H:extern void _seg *grsegs[NUMCHUNKS]; +16/wolf3d/WOLFSRC/ID_CA.H:extern long _seg *grstarts; // array of offsets in egagraph, -1 for sparse +16/wolf3d/WOLFSRC/ID_CA.H:extern long _seg *audiostarts; // array of offsets in audio / audiot +16/wolf3d/WOLFSRC/ID_IN.H:extern byte _seg *DemoBuffer; +16/wolf3d/WOLFSRC/ID_MM.H:typedef void _seg * memptr; +16/wolf3d/WOLFSRC/ID_VH.H:extern pictabletype _seg *pictable; +16/wolf3d/WOLFSRC/ID_VH.H:extern pictabletype _seg *picmtable; +16/wolf3d/WOLFSRC/ID_VH.H:extern spritetabletype _seg *spritetable; +16/wolf3d/WOLFSRC/WL_DEF.H:extern t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1]; +=============== ./qwolf.sh end =============== +------------------------------------------------------------------------------- + ./qcata.sh start +------------------------------------------------------------------------------- +==== 16/Catacomb3D ==== 16/Catacomb3D/C3_DEBUG.C: spritetype _seg *block; 16/Catacomb3D/C3_GAME.C: text = (char _seg *)grsegs[LEVEL1TEXT+mapon]; 16/Catacomb3D/C3_GAME.C: src = (byte _seg *)grsegs[STARTTILE8]; @@ -263,7 +277,7 @@ 16/Catacomb3D/ID_VW.H:extern pictabletype _seg *pictable; 16/Catacomb3D/ID_VW.H:extern pictabletype _seg *picmtable; 16/Catacomb3D/ID_VW.H:extern spritetabletype _seg *spritetable; -==== 16/CatacombApocalypse ==== +==== 16/CatacombApocalypse ==== 16/CatacombApocalypse/C6_GAME.C: text = (char _seg *)grsegs[LEVEL1TEXT+mapon]; 16/CatacombApocalypse/C6_GAME.C: src = (byte _seg *)grsegs[STARTTILE8]; 16/CatacombApocalypse/C6_GAME.C: src = (byte _seg *)grsegs[STARTTILE16]; @@ -335,4 +349,4 @@ 16/CatacombApocalypse/ID_VW.H:extern pictabletype _seg *picmtable; 16/CatacombApocalypse/ID_VW.H:extern spritetabletype _seg *spritetable; 16/CatacombApocalypse/ID_VW.H:void VWL_MeasureString (char far *string, word *width, word *height, fontstruct _seg *font); -=============== ./qcata.sh end =============== +=============== ./qcata.sh end =============== diff --git a/makefile b/makefile index 575e318f..5c21b2ad 100755 --- a/makefile +++ b/makefile @@ -119,7 +119,7 @@ UPXQ=-qqq # # compile flags # -S_FLAGS=-sg -st -of+ -zu -zdp -zff -zgf -k32768#24576 +S_FLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768#24576 Z_FLAGS=-zk0 -zc -zm#### -zp4 -ei O_FLAGS=-opnr -oe=24 -oil+ -outback -ohm T_FLAGS=-bt=dos -wx -m$(MEMORYMODE) -0 -fpi87 -d1 -fo=.$(OBJ)## -e=65536 diff --git a/src/16.c b/src/16.c index eb64dde7..7f22e1b6 100755 --- a/src/16.c +++ b/src/16.c @@ -54,6 +54,6 @@ main(int argc, char *argv[]) //++++ DemoLoop();//to be defined in 16_tail -//++++ Quit(gvar, "Demo loop exited???"); +//++++ Quit("Demo loop exited???"); } diff --git a/src/exmmtest.c b/src/exmmtest.c index ea73aa99..8742c046 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -57,7 +57,7 @@ #define BBUFNAME gvar.mm.bufferseg//bigbuffer //#define INITBBUF static memptr BBUFNAME; -#define BBUFPTR MEMPTRCONV BBUFNAME +#define BBUFPTR MEMPTR BBUFNAME #ifdef __BORLANDC__ #define BBUF (memptr *)BBUFPTR diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 008e4e84..8dd2da0a 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1,23 +1,19 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify + * 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 3 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Project 16 is distributed in the hope that it will be useful, + * 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, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // ID_CA.C @@ -40,7 +36,7 @@ loaded into the data segment #pragma warn -pro #pragma warn -use -#define THREEBYTEGRSTARTS +//#define THREEBYTEGRSTARTS //https://github.com/open-watcom/open-watcom-v2/issues/279#issuecomment-244587566 for _seg //http://www.shikadi.net/moddingwiki/GameMaps_Format for info on the code /* @@ -125,9 +121,9 @@ huffnode audiohuffman[255]; int grhandle; // handle to EGAGRAPH int maphandle; // handle to MAPTEMP / GAMEMAPS int audiohandle; // handle to AUDIOT / AUDIO -*/ -long chunkcomplen,chunkexplen; -/* + +long c hunkcomplen,c hunkexplen; + SDMode oldsoundmode; @@ -142,14 +138,14 @@ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, #ifdef THREEBYTEGRSTARTS #define FILEPOSSIZE 3 //#define GRFILEPOS(c) (*(long far *)(((byte far *)grstarts)+(c)*3)&0xffffff) -CASVT GRFILEPOS(int c, global_game_variables_t *gvar) +long GRFILEPOS(int c, global_game_variables_t *gvar) { - CASVT value; + long value; int offset; offset = c*3; - value = *(CASVT far *)(((byte far *)gvar->ca.grstarts)+offset); + value = *(long far *)(((byte far *)gvar->ca.grstarts)+offset); value &= 0x00ffffffl; @@ -160,11 +156,7 @@ CASVT GRFILEPOS(int c, global_game_variables_t *gvar) }; #else #define FILEPOSSIZE 4 -//#define GRFILEPOS(c) (gvar->ca.grstarts[c]) -CASVT GRFILEPOS(int c, global_game_variables_t *gvar) -{ - return gvar->ca.grstarts[c]; -} +#define GRFILEPOS(c) (gvar->ca.grstarts[c]) #endif /* @@ -216,9 +208,9 @@ void CA_CloseDebug(global_game_variables_t *gvar) void CAL_GetGrChunkLength (int chunk,global_game_variables_t *gvar) { - lseek(gvar->ca.file.grhandle,GRFILEPOS(chunk,gvar),SEEK_SET); + lseek(gvar->ca.file.grhandle,GRFILEPOS(chunk),SEEK_SET); read(gvar->ca.file.grhandle,&gvar->ca.chunkexplen,sizeof(gvar->ca.chunkexplen)); - gvar->ca.chunkcomplen = GRFILEPOS(chunk+1,gvar)-GRFILEPOS(chunk,gvar)-4; + gvar->ca.chunkcomplen = GRFILEPOS(chunk+1)-GRFILEPOS(chunk)-4; } @@ -1077,7 +1069,7 @@ void CAL_SetupGrFile (global_game_variables_t *gvar) // // load the data offsets from ???head.ext // - MM_GetPtr (MEMPTRCONV gvar->ca.grstarts,(NUMCHUNKS+1)*FILEPOSSIZE, gvar); + MM_GetPtr (MEMPTR gvar->ca.grstarts,(NUMCHUNKS+1)*FILEPOSSIZE, gvar); strcpy(fname,GHEADNAME); strcat(fname,EXTENSION); @@ -1108,19 +1100,16 @@ void CAL_SetupGrFile (global_game_variables_t *gvar) // load the pic and sprite headers into the arrays in the data segment // #if NUMPICS>0 - MM_GetPtr(MEMPTRCONV gvar->video.pictable,NUMPICS*sizeof(pictabletype),gvar); + MM_GetPtr(MEMPTR gvar->video.pictable,NUMPICS*sizeof(pictabletype),gvar); CAL_GetGrChunkLength(STRUCTPIC,gvar); // position file pointer - printf("CAL_SetupGrFile:\n"); - printf(" gvar->ca.chunkcomplen size is %lu\n", gvar->ca.chunkcomplen); - MM_GetPtr(&compseg,gvar->ca.chunkcomplen,gvar); - IN_Ack(gvar); + MM_GetPtr(&compseg,gvar->ca.chunkcomplen, gvar); CA_FarRead (gvar->ca.file.grhandle,compseg,gvar->ca.chunkcomplen,gvar); CAL_HuffExpand (compseg, (byte far *)gvar->video.pictable,NUMPICS*sizeof(pictabletype),gvar->ca.grhuffman); MM_FreePtr(&compseg,gvar); #endif #if NUMPICM>0 - MM_GetPtr(MEMPTRCONV picmtable,NUMPICM*sizeof(pictabletype)); + MM_GetPtr(MEMPTR picmtable,NUMPICM*sizeof(pictabletype)); CAL_GetGrChunkLength(STRUCTPICM); // position file pointer MM_GetPtr(&compseg,gvar->ca.chunkcomplen); CA_FarRead (gvar->ca.file.grhandle,compseg,gvar->ca.chunkcomplen); @@ -1129,7 +1118,7 @@ void CAL_SetupGrFile (global_game_variables_t *gvar) #endif #if NUMSPRITES>0 - MM_GetPtr(MEMPTRCONV spritetable,NUMSPRITES*sizeof(spritetabletype)); + MM_GetPtr(MEMPTR spritetable,NUMSPRITES*sizeof(spritetabletype)); CAL_GetGrChunkLength(STRUCTSPRITE); // position file pointer MM_GetPtr(&compseg,gvar->ca.chunkcomplen); CA_FarRead (gvar->ca.file.grhandle,compseg,gvar->ca.chunkcomplen); @@ -1165,7 +1154,7 @@ void CAL_SetupMapFile (global_game_variables_t *gvar) O_RDONLY | O_BINARY, S_IREAD)) == -1) Quit (gvar, "Can't open maphead.mph"); length = filelength(handle); - MM_GetPtr (MEMPTRCONV gvar->ca.tinf,length,gvar); + MM_GetPtr (MEMPTR gvar->ca.tinf,length,gvar); CA_FarRead(handle, gvar->ca.tinf, length,gvar); close(handle); //#else @@ -1216,7 +1205,7 @@ void CAL_SetupMapFile (global_game_variables_t *gvar) O_RDONLY | O_BINARY, S_IREAD)) == -1) Quit (gvar, "Can't open AUDIOHED.16""!"); length = filelength(handle); - MM_GetPtr (MEMPTRCONV audiostarts,length); + MM_GetPtr (MEMPTR audiostarts,length); CA_FarRead(handle, (byte far *)audiostarts, length); close(handle); #else @@ -1340,7 +1329,7 @@ void CA_CacheAudioChunk (int chunk) if (audiosegs[chunk]) { - MM_SetPurge (MEMPTRCONV audiosegs[chunk],0); + MM_SetPurge (MEMPTR audiosegs[chunk],0); return; // allready in memory } @@ -1362,7 +1351,7 @@ void CA_CacheAudioChunk (int chunk) #ifndef AUDIOHEADERLINKED - MM_GetPtr (MEMPTRCONV audiosegs[chunk],compressed); + MM_GetPtr (MEMPTR audiosegs[chunk],compressed); if (mmerror) return; @@ -1387,7 +1376,7 @@ void CA_CacheAudioChunk (int chunk) expanded = *(long far *)source; source += 4; // skip over length - MM_GetPtr (MEMPTRCONV audiosegs[chunk],expanded); + MM_GetPtr (MEMPTR audiosegs[chunk],expanded); if (mmerror) goto done; CAL_HuffExpand (source,audiosegs[chunk],expanded,audiohuffman); @@ -1428,7 +1417,7 @@ void CA_LoadAllSounds (void) for (i=0;ica.file.grhandle,pos,SEEK_SET); @@ -1876,7 +1865,7 @@ void CA_CacheGrChunk (int chunk) // load the chunk into a buffer, either the miscbuffer if it fits, or allocate // a larger buffer // - pos = GRFILEPOS(chunk,gvar); + pos = GRFILEPOS(chunk); if (pos<0) // $FFFFFFFF start is a sparse tile return; @@ -1884,7 +1873,7 @@ void CA_CacheGrChunk (int chunk) while (GRFILEPOS(next) == -1) // skip past any sparse tiles next++; - compressed = GRFILEPOS(next,gvar)-pos; + compressed = GRFILEPOS(next)-pos; lseek(gvar->ca.file.grhandle,pos,SEEK_SET); @@ -1956,12 +1945,12 @@ void CA_CacheMap (global_game_variables_t *gvar) // if (pos<0) // $FFFFFFFF start is a sparse map // printf("CA_CacheMap: Tried to load a non existent map!"); -// MM_GetPtr(MEMPTRCONV gvar->ca.camapheaderseg[mapnum],sizeof(maptype)); +// MM_GetPtr(MEMPTR gvar->ca.camapheaderseg[mapnum],sizeof(maptype)); // lseek(maphandle,pos,SEEK_SET); // CA_FarRead (maphandle,(memptr)mapheaderseg[mapnum],sizeof(maptype)); // } // else -// MM_SetPurge (MEMPTRCONV mapheaderseg[mapnum], 0, &(gvar->mm)); +// MM_SetPurge (MEMPTR mapheaderseg[mapnum], 0, &(gvar->mm)); // // load the planes in @@ -1979,7 +1968,7 @@ void CA_CacheMap (global_game_variables_t *gvar) if (!compressed) continue; // the plane is not used in this game - dest = MEMPTRCONV mapsegs[plane]; + dest = MEMPTR mapsegs[plane]; MM_GetPtr(dest,size); lseek(maphandle,pos,SEEK_SET); @@ -2363,7 +2352,7 @@ void CAL_CacheMarks (char *title, global_game_variables_t *gvar) if (dialog && updatecachebox) updatecachebox (); - pos = GRFILEPOS(i,gvar); + pos = GRFILEPOS(i); if (pos<0) continue; @@ -2371,7 +2360,7 @@ void CAL_CacheMarks (char *title, global_game_variables_t *gvar) while (GRFILEPOS(next) == -1) // skip past any sparse tiles next++; - compressed = GRFILEPOS(next,gvar)-pos; + compressed = GRFILEPOS(next)-pos; endpos = pos+compressed; if (compressed<=BUFFERSIZE) @@ -2394,10 +2383,10 @@ void CAL_CacheMarks (char *title, global_game_variables_t *gvar) if (next == NUMCHUNKS) continue; - nextpos = GRFILEPOS(next,gvar); - while (GRFILEPOS(++next,gvar) == -1) // skip past any sparse tiles + nextpos = GRFILEPOS(next); + while (GRFILEPOS(++next) == -1) // skip past any sparse tiles ; - nextendpos = GRFILEPOS(next,gvar); + nextendpos = GRFILEPOS(next); if (nextpos - endpos <= MAXEMPTYREAD && nextendpos-pos <= BUFFERSIZE) endpos = nextendpos; diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index b69e96d4..db9cba58 100755 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -1,23 +1,19 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify + * 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 3 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Project 16 is distributed in the hope that it will be useful, + * 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, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // ID_CA.H diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h index 31666821..295b7146 100755 --- a/src/lib/16_dbg.h +++ b/src/lib/16_dbg.h @@ -12,7 +12,7 @@ //#define __DEBUG_2__ //#define __DEBUG_CA__ //#define __DEBUG_PM__ -#define __DEBUG_MM__ +//#define __DEBUG_MM__ //#define __DEBUG_RF__ #define __DEBUG_SPRI__ diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index f2392b6a..d43432fe 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1,23 +1,19 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify + * 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 3 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Project 16 is distributed in the hope that it will be useful, + * 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, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // NEWMM.C @@ -58,38 +54,6 @@ Open Watcom port by sparky4 #pragma warn -pro #pragma warn -use - -/* -============================================================================= - - LOCAL INFO - -============================================================================= -*/ - -//#define LOCKBIT 0x80 // if set in attributes, block cannot be moved -//#define PURGEBITS 3 // 0-3 level, 0= unpurgable, 3= purge first -//#define PURGEMASK 0xfffc -//#define BASEATTRIBUTES 0 // unlocked, non purgable - -//#define MAXUMBS 10 - -/*typedef struct mmblockstruct -{ - unsigned start,length; - unsigned attributes; - memptr *useptr; // pointer to the segment start - struct mmblockstruct far *next; -} mmblocktype;*/ - - -//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!") ;mmfree=mmfree->next;} -// - -//#define GETNEWBLOCK {if(!gvar->mm.mmfree)MML_ClearBlock(gvar);gvar->mm.mmnew=gvar->mm.mmfree;gvar->mm.mmfree=gvar->mm.mmfree->next;} - -//#define FREEBLOCK(x) {*x->useptr=NULL;x->next=gvar->mm.mmfree;gvar->mm.mmfree=x;} - /* ============================================================================= @@ -98,12 +62,9 @@ Open Watcom port by sparky4 ============================================================================= */ -/*mminfotype mminfo; -memptr bufferseg; -boolean mmerror;*/ - void (* beforesort) (void); void (* aftersort) (void); +void (* XMSaddr) (void); // far pointer to XMS driver /* ============================================================================= @@ -112,38 +73,6 @@ void (* aftersort) (void); ============================================================================= */ - -/*boolean mmstarted; - -void far *farheap; -void *nearheap; - -mmblocktype far mmblocks[MAXBLOCKS] - ,far *mmhead,far *mmfree,far *mmrover,far *mmnew; - -boolean bombonerror;*/ - -//unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; - -void (* XMSaddr) (void); // far pointer to XMS driver - -/*unsigned numUMBs,UMBbase[MAXUMBS];*/ - -//========================================================================== - -// -// local prototypes -// - -boolean MML_CheckForEMS (void); -void MML_ShutdownEMS (void); -void MM_MapEMS (void); -boolean MML_CheckForXMS (void); -void MML_ShutdownXMS (void); -//void MML_UseSpace (unsigned segstart, unsigned seglength); -//void MML_ClearBlock (void); - -//========================================================================== #ifndef __16_PM__ #if 0 static char *ParmStringsexmm[] = {"noems","noxms",""}; @@ -621,7 +550,7 @@ getmemory: } #endif // printf("base=%u ", base); printf("size=%u\n", size); - MML_UseSpace (base,size, gvar); + MML_UseSpace(base,size, gvar); gvar->mmi.XMSmem += size*16; gvar->mm.UMBbase[gvar->mm.numUMBs] = base; gvar->mm.numUMBs++; @@ -680,7 +609,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar) { scan->blob=segm; - //MML_UseSpace (segstart, seglength, gvar); + //MML_UseSpace(segstart, seglength, gvar); printf("MML_UseSpace: Segment spans two blocks!\n"); //} @@ -695,7 +624,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar) } //++++todo: linked list of segment! */ -void MML_UseSpace (word segstart, word seglength, global_game_variables_t *gvar) +void MML_UseSpace(word segstart, dword seglength, global_game_variables_t *gvar) { mmblocktype far *scan,far *last; word oldend; @@ -727,9 +656,8 @@ void MML_UseSpace (word segstart, word seglength, global_game_variables_t *gvar) // take the given range out of the block // oldend = scan->start + scan->length; - extra = oldend - (segstart+seglength); + extra = oldend - (segstart+((unsigned)seglength)); if (extra < 0) -#ifdef __DEBUG_MM__ { printf("========================================\n"); printf("start=%x ", scan->start); @@ -743,9 +671,6 @@ void MML_UseSpace (word segstart, word seglength, global_game_variables_t *gvar) printf("========================================\n"); //return; } -#else - Quit ("MML_UseSpace: Segment spans two blocks!"); -#endif if (segstart == scan->start) { @@ -782,7 +707,7 @@ void MML_UseSpace (word segstart, word seglength, global_game_variables_t *gvar) ==================== */ -void MML_ClearBlock (global_game_variables_t *gvar) +void MML_ClearBlock(global_game_variables_t *gvar) { mmblocktype far *scan;//,far *last; @@ -798,7 +723,7 @@ void MML_ClearBlock (global_game_variables_t *gvar) scan = scan->next; } - Quit (gvar, "MM_ClearBlock: No purgable blocks!\n"); + printf("MM_ClearBlock: No purgable blocks!\n"); } @@ -815,15 +740,16 @@ void MML_ClearBlock (global_game_variables_t *gvar) =================== */ -void MM_Startup (global_game_variables_t *gvar) +void MM_Startup(global_game_variables_t *gvar) { int i; - dword length; + //dword length,seglength; + dword length; word seglength; void far *start; - word segstart,seglength;//,endfree; + word segstart;//,endfree; if(gvar->mm.mmstarted) - MM_Shutdown (gvar); + MM_Shutdown(gvar); gvar->mm.mmstarted = true; gvar->mm.bombonerror = true; @@ -833,7 +759,7 @@ void MM_Startup (global_game_variables_t *gvar) // gvar->mm.mmhead = NULL; gvar->mm.mmfree = &(gvar->mm.mmblocks[0]); - for (i=0;imm.mmblocks[i].next = &(gvar->mm.mmblocks[i+1]); gvar->mm.mmblocks[i].next = NULL; @@ -848,7 +774,6 @@ void MM_Startup (global_game_variables_t *gvar) gvar->mm.mmnew->next = NULL; gvar->mm.mmrover = gvar->mm.mmhead; - // // get all available near conventional memory segments // @@ -868,7 +793,7 @@ void MM_Startup (global_game_variables_t *gvar) length -= SAVENEARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; - MML_UseSpace (segstart,seglength, gvar); + MML_UseSpace(segstart,seglength, gvar); gvar->mmi.nearheap = length; //0000printf("near: start=%Fp segstart=%x seglen=%lu len=%lu\n", start, segstart, (dword)seglength, length); @@ -889,7 +814,7 @@ void MM_Startup (global_game_variables_t *gvar) length -= SAVEFARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; - MML_UseSpace (segstart,seglength, gvar); + MML_UseSpace(segstart,seglength, gvar); gvar->mmi.farheap = length; //0000printf("far: start=%Fp segstart=%x seglen=%lu len=%lu\n", start, segstart, (dword)seglength, length); @@ -912,7 +837,7 @@ void MM_Startup (global_game_variables_t *gvar) { MML_SetupEMS(gvar); // allocate space //16_PM: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT! - MML_UseSpace (gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar); + MML_UseSpace(gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar); //if(gvar->pm.emm.EMSVer<0x40) MM_MapEMS(gvar); // map in used pages //else @@ -944,7 +869,7 @@ xmsskip: // gvar->mm.mmrover = gvar->mm.mmhead; // start looking for space after low block - MM_GetPtr (&(gvar->mm.bufferseg),BUFFERSIZE, gvar); + MM_GetPtr(&(gvar->mm.bufferseg),BUFFERSIZE, gvar); } //========================================================================== @@ -959,7 +884,7 @@ xmsskip: ==================== */ -void MM_Shutdown (global_game_variables_t *gvar) +void MM_Shutdown(global_game_variables_t *gvar) { if(!(gvar->mm.mmstarted)) return; @@ -997,10 +922,10 @@ void MM_Shutdown (global_game_variables_t *gvar) ==================== */ -void MM_GetPtr (memptr *baseptr,dword size, global_game_variables_t *gvar) +void MM_GetPtr (memptr *baseptr, dword size, global_game_variables_t *gvar) { mmblocktype far *scan,far *lastscan,far *endscan - ,far *purge,far *next; + ,far *purge,far *next; int search; unsigned needed,startseg; @@ -1009,19 +934,18 @@ void MM_GetPtr (memptr *baseptr,dword size, global_game_variables_t *gvar) GETNEWBLOCK; // fill in start and next after a spot is found gvar->mm.mmnew->length = needed; gvar->mm.mmnew->useptr = baseptr; - gvar->mm.mmnew->attributes = BASEATTRIBUTES; //if(gvar->mm.mmnew->useptr==NULL){ #ifdef __DEBUG_MM__ - printf("MM_GetPtr\n"); if(dbg_debugmm>0){ + printf("MM_GetPtr\n"); //%04x printf(" baseptr=%Fp ", baseptr); printf("useptr=%Fp\n", gvar->mm.mmnew->useptr); printf(" *baseptr=%Fp ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr)); printf(" &baseptr=%Fp ", &baseptr); printf("&useptr=%Fp\n", &(gvar->mm.mmnew->useptr)); } - printf(" size is %lu\n", size); #endif //Quit(gvar, "gvar->mm.mmnew->useptr==NULL"); } + gvar->mm.mmnew->attributes = BASEATTRIBUTES; //tryagain: for (search = 0; search<3; search++) diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 587e8800..f890a3bb 100755 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -1,23 +1,19 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify + * 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 3 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Project 16 is distributed in the hope that it will be useful, + * 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, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // ID_MM.H @@ -33,7 +29,7 @@ #ifdef __DEBUG__ // 1 == Debug/Dev ; 0 == Production/final #define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes\n" #else -#define OUT_OF_MEM_MSG "\n" +#define OUT_OF_MEM_MSG "\npee\n" #endif //#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!") ;mmfree=mmfree->next;} @@ -182,13 +178,13 @@ typedef struct boolean MML_CheckForEMS(void); //byte MML_SetupEMS(mminfo_t *mm); //void MML_ShutdownEMS(mminfo_t *mm); -//byte MM_MapEMS(global_game_variables_t *gvar); +byte MM_MapEMS(global_game_variables_t *gvar); //byte MM_MapXEMS(global_game_variables_t *gvar); boolean MML_CheckForXMS(void); //void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi); //void MML_ShutdownXMS(mminfo_t *mm); -void MML_UseSpace (word segstart, word seglength, global_game_variables_t *gvar); -void MML_ClearBlock (global_game_variables_t *gvar); +void MML_UseSpace(word segstart, dword seglength, global_game_variables_t *gvar); +void MML_ClearBlock(global_game_variables_t *gvar); void MM_Startup(global_game_variables_t *gvar); void MM_Shutdown(global_game_variables_t *gvar); diff --git a/src/lib/16_sd.c b/src/lib/16_sd.c index 610f7ed0..b82ff3e8 100755 --- a/src/lib/16_sd.c +++ b/src/lib/16_sd.c @@ -226,7 +226,7 @@ void SD_Initimf(global_game_variables_t *gvar) void SD_imf_free_music(global_game_variables_t *gvar) { // if (gvar->ca.sd.imf_music) free(gvar->ca.sd.imf_music); - MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar); //TODO make behave like id engine + MM_FreePtr(MEMPTR gvar->ca.audiosegs[0], gvar); //TODO make behave like id engine gvar->ca.sd.imf_music = gvar->ca.sd.imf_play_ptr = gvar->ca.sd.imf_music_end = NULL; gvar->ca.sd.imf_delay_countdown = 0; } @@ -256,7 +256,7 @@ int SD_imf_load_music(const char *path, global_game_variables_t *gvar) } len -= len & 3; - MM_GetPtr(MEMPTRCONV gvar->ca.audiosegs[0],len, gvar); + MM_GetPtr(MEMPTR gvar->ca.audiosegs[0],len, gvar); gvar->ca.sd.imf_music = (struct imf_entry *)gvar->ca.audiosegs[0]; if (gvar->ca.sd.imf_music == NULL) { close(fd); diff --git a/src/lib/16_t.h b/src/lib/16_t.h index 764bf51e..ce881ae8 100755 --- a/src/lib/16_t.h +++ b/src/lib/16_t.h @@ -65,28 +65,9 @@ MK_FP(segment value, 0)*/ typedef void _seg * memptr; -#define MEMPTRCONV (memptr *)& +#define MEMPTR (memptr *)&//old is &(memptr) -//bcc -#ifdef __BORLANDC__ -#define MEMPTRANDPERCONV & -//#define BYTEFARPTRCONV (unsigned char far *) -//#define SMDPTRANDPERCONV & -//#define SDFPTRANDPERCONV & -//#define OBTPTRANDPERCONV & -//#define SDTPTRANDPERCONV & -#endif -// - -//wcc #ifdef __WATCOMC__ //functions found in borland c but not watcom c -#define MEMPTRANDPERCONV -//#define BYTEFARPTRCONV -//#define SMDPTRANDPERCONV (void *)& -//#define SDFPTRANDPERCONV (struct diskfree_t *)& -//#define OBTPTRANDPERCONV (void const *)& -//#define SDTPTRANDPERCONV (struct dostime_t *)& - #define _argv __argv #define _argc __argc #define geninterrupt(n) int86(n,&CPURegs,&CPURegs); diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 5f1683d6..93022c26 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -41,8 +41,7 @@ #include #endif -extern struct glob_game_vars *ggvv; - +//gvar.video.ofs.bufferofs,gvar.video.ofs.displayofs, #define FIZZLEFADEFUNCTION \ if(gvar.in.inst->Keyboard[sc_F]){ FizzleFade(\ atoi(gvar.video.page[0].data),atoi(gvar.video.page[1].data),\ diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 3fa1feb3..f45195d6 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -468,11 +468,14 @@ typedef struct //from 16_mm //========================================================================== -#define MAXBLOCKS 800//kd=1300 wolf3d=700 cata=600 +#define MAXBLOCKS 1024//kd=1300 wolf3d=700 cata=600 +//----#define MAXUMBS 12 typedef struct mmblockstruct { - unsigned start,length; + word start,length; + //word start; dword length; +//++++ word blob; //for data larger than 64k unsigned attributes; memptr *useptr; // pointer to the segment start struct mmblockstruct far *next; @@ -657,10 +660,9 @@ typedef struct #define NUMMAPS 4//39 #define NUMSNDCHUNKS 4//3 -//#define NUMPICS 4//132//wolf3d wl6 +//#define NUMPICS 132//wolf3d wl6 #define STRUCTPIC 0 -#define CASVT dword //*start var type #define DATADIR "data/" @@ -716,8 +718,8 @@ typedef struct //TODO: USE THIS!!!! byte far grneeded[NUMCHUNKS]; word _seg *audiosegs[NUMSNDCHUNKS];//long - CASVT _seg *grstarts; // array of offsets in egagraph, -1 for sparse//long - CASVT _seg *audiostarts; // array of offsets in audio / audiot//long + word _seg *grstarts; // array of offsets in egagraph, -1 for sparse//long + word _seg *audiostarts; // array of offsets in audio / audiot//long #ifdef GRHEADERLINKED huffnode *grhuffman; @@ -731,7 +733,7 @@ typedef struct //TODO: USE THIS!!!! huffnode audiohuffman[255]; #endif - CASVT chunkcomplen,chunkexplen;//long + long chunkcomplen,chunkexplen; sd_t sd; //TODO: extend! and learn from keen/wolf/catacomb's code wwww diff --git a/src/lib/vgmsnd/vgmSnd.c b/src/lib/vgmsnd/vgmSnd.c index 2cfd8690..30d3a383 100755 --- a/src/lib/vgmsnd/vgmSnd.c +++ b/src/lib/vgmsnd/vgmSnd.c @@ -172,7 +172,7 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile, global_game_variables vgmFile->dataLen = vgmBaseHdr.lngEOFOffset + 0x04; //vgmFile->data = (UINT8*)malloc(vgmFile->dataLen); - MM_GetPtr(MEMPTRCONV gvar->ca.audiosegs[0], vgmFile->dataLen, gvar); + MM_GetPtr(MEMPTR gvar->ca.audiosegs[0], vgmFile->dataLen, gvar); vgmFile->data = (UINT8*)gvar->ca.audiosegs[0]; if (vgmFile->data == NULL) { @@ -217,7 +217,7 @@ UINT8 OpenVGMFile(const char* FileName, VGM_FILE* vgmFile, global_game_variables void FreeVGMFile(VGM_FILE* vgmFile, global_game_variables_t *gvar) { //if(vgmFile->data){ free(vgmFile->data); vgmFile->data = NULL; } - MM_FreePtr(MEMPTRCONV gvar->ca.audiosegs[0], gvar); + MM_FreePtr(MEMPTR gvar->ca.audiosegs[0], gvar); if(vgmFile->data) free(vgmFile->data); vgmFile->dataLen = 0; diff --git a/src/xcroll.c b/src/xcroll.c index d06850cb..ed02457e 100755 --- a/src/xcroll.c +++ b/src/xcroll.c @@ -121,7 +121,9 @@ void main(int argc, char *argv[]) modexFadeOn(4, &gvar.video.palette); #endif - IN_StartAck (&gvar); MM_ShowMemory(&gvar); while (!IN_CheckAck (&gvar)){} + IN_StartAck (&gvar); + MM_ShowMemory(&gvar); + while (!IN_CheckAck (&gvar)){} #ifdef FADE modexPalBlack(); //so player will not see loadings~ #endif