From 0d61e6c7f0e9fbb2838962ef7452c2f6c8a5455b Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 4 Apr 2017 11:44:46 -0500 Subject: [PATCH] p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I should remember what needs to be done soon][OpenVGMFile needs to be ported to 16_snd.c]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] --- makefile | 2 +- src/lib/16_mm.c | 19 ++++++++++++---- src/lib/16_rf.c | 52 ++++++++++++++++++++++++-------------------- src/lib/16_rf.h | 1 + video.ofs.bufferofs | 0 video.ofs.displayofs | 0 6 files changed, 45 insertions(+), 29 deletions(-) delete mode 100755 video.ofs.bufferofs delete mode 100755 video.ofs.displayofs diff --git a/makefile b/makefile index 589d5ff0..2a083bc1 100755 --- a/makefile +++ b/makefile @@ -117,7 +117,7 @@ UPXQ=-qqq S_FLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k24576#32768 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 +T_FLAGS=-bt=dos -wx -m$(MEMORYMODE) -0 -fpi87 -d1 -fo=.$(OBJ)## -e=65536 DBUGFLAGS=-fm=$^&.meh -fd=$^& CPPFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 8fa8de5b..ab517893 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1257,6 +1257,8 @@ void MM_SortMem(global_game_variables_t *gvar) ===================== */ +//#define MMSMSORTNEWTYPE + void MM_ShowMemory(global_game_variables_t *gvar) { mmblocktype far *scan; @@ -1301,8 +1303,11 @@ void MM_ShowMemory(global_game_variables_t *gvar) write(gvar->handle.debughandle,scratch,strlen(scratch)); Quit (gvar, "MM_ShowMemory: Memory block order currupted!"); } +#ifndef MMSMSORTNEWTYPE end = scan->length-1; - //end = scan->start+(scan->length)-1; +#else + end = scan->start+(scan->length)-1; +#endif y = scan->start/320; x = scan->start%320; VW_Hlin(x,x+end,y,color, &gvar->video.ofs); @@ -1313,8 +1318,11 @@ void MM_ShowMemory(global_game_variables_t *gvar) strcat(scratch0, "+"); } //++==++==optional strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_"); +#ifdef MMSMSORTNEWTYPE if (scan->next && scan->next->start > end+1) - //if (scan->next && scan->next->start >= end+1) +#else + if (scan->next && scan->next->start >= end+1) +#endif { VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0, &gvar->video.ofs); // black = free strcat(scratch0, AARESET); @@ -1329,7 +1337,9 @@ void MM_ShowMemory(global_game_variables_t *gvar) //printf("w=%u start=%04x next=%04x end=%lu\n", w/80, scan->start, (scan->next->start), end+1); //printf("==================\n"); strcat(scratch0, "\n"); - }/*else {//if(scan->next->start <= scan->start){ + } +#if 0 + else {//if(scan->next->start <= scan->start){ scan->next->start=scan->start+0x1000; strcat(scratch0, AARESET); strcat(scratch0, "\n"); @@ -1343,7 +1353,8 @@ void MM_ShowMemory(global_game_variables_t *gvar) printf("w=%x start=%x next=%x end=%u\n", w, scan->start, (scan->next->start), end+1); printf("================\n"); getch(); - }*/ + } +#endif strcat(scratch0, AARESET); //strcat(scratch0,"\n"); strcat(scratch,"Seg:"); diff --git a/src/lib/16_rf.c b/src/lib/16_rf.c index 46400385..8e17be22 100755 --- a/src/lib/16_rf.c +++ b/src/lib/16_rf.c @@ -35,6 +35,9 @@ updated #include "src/lib/16_rf.h" #pragma hdrstop +struct glob_game_vars *gvar; +static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ + /* ============================================================================= @@ -366,7 +369,7 @@ void RF_FixOfs (void) displayofs = screenstart[screenpage]; bufferofs = screenstart[otherpage]; masterofs = screenstart[2]; - VW_SetScreen (displayofs,0); + VL_SetScreen (displayofs,0); } else { @@ -403,7 +406,7 @@ void RF_NewMap (void) // make a lookup table for the maps left edge // if (mapheight > MAXMAPHEIGHT) - Quit ("RF_NewMap: Map too tall!"); + Quit (gvar, "RF_NewMap: Map too tall!"); spot = 0; for (i=0;i=MAXANIMTYPES) - Quit ("RF_MarkTileGraphics: Too many unique animated tiles!"); + Quit (gvar, "RF_MarkTileGraphics: Too many unique animated tiles!"); allanims[i].current = tile; allanims[i].count = tinf[SPEED+tile]; @@ -516,7 +519,7 @@ void RF_MarkTileGraphics (void) CA_MarkGrChunk(STARTTILE16+next); next += (signed char)(tinf[ANIM+next]); if (++anims > 20) - Quit ("MarkTileGraphics: Unending animation!"); + Quit (gvar, "MarkTileGraphics: Unending animation!"); } } @@ -552,7 +555,7 @@ nextback: // new chain of animating tiles if (i>=MAXANIMTYPES) - Quit ("RF_MarkTileGraphics: Too many unique animated tiles!"); + Quit (gvar, "RF_MarkTileGraphics: Too many unique animated tiles!"); allanims[i].current = tilehigh; allanims[i].count = tinf[MSPEED+tile]; @@ -566,7 +569,7 @@ nextback: CA_MarkGrChunk(STARTTILE16M+next); next += (signed char)(tinf[MANIM+next]); if (++anims > 20) - Quit ("MarkTileGraphics: Unending animation!"); + Quit (gvar, "MarkTileGraphics: Unending animation!"); } } @@ -633,7 +636,7 @@ void RFL_CheckForAnimTile (unsigned x, unsigned y) if (tinf[ANIM+tile] && tinf[SPEED+tile]) { if (!animfreeptr) - Quit ("RF_CheckForAnimTile: No free spots in tilearray!"); + Quit (gvar, "RF_CheckForAnimTile: No free spots in tilearray!"); anim = animfreeptr; animfreeptr = animfreeptr->nexttile; next = animhead; // stick it at the start of the list @@ -658,7 +661,7 @@ void RFL_CheckForAnimTile (unsigned x, unsigned y) if (tinf[MANIM+tile] && tinf[MSPEED+tile]) { if (!animfreeptr) - Quit ("RF_CheckForAnimTile: No free spots in tilearray!"); + Quit (gvar, "RF_CheckForAnimTile: No free spots in tilearray!"); anim = animfreeptr; animfreeptr = animfreeptr->nexttile; next = animhead; // stick it at the start of the list @@ -841,7 +844,7 @@ void RFL_AnimateTiles (void) y = current->y-originytile; if (x>=PORTTILESWIDE || y>=PORTTILESHIGH) - Quit ("RFL_AnimateTiles: Out of bounds!"); + Quit (gvar, "RFL_AnimateTiles: Out of bounds!"); updateofs = uwidthtable[y] + x; RFL_NewTile(updateofs); // puts "1"s in both pages @@ -960,13 +963,13 @@ void RF_SetScrollBlock (int x, int y, boolean horizontal) { hscrolledge[hscrollblocks] = y; if (hscrollblocks++ == MAXSCROLLEDGES) - Quit ("RF_SetScrollBlock: Too many horizontal scroll blocks"); + Quit (gvar, "RF_SetScrollBlock: Too many horizontal scroll blocks"); } else { vscrolledge[vscrollblocks] = x; if (vscrollblocks++ == MAXSCROLLEDGES) - Quit ("RF_SetScrollBlock: Too many vertical scroll blocks"); + Quit (gvar, "RF_SetScrollBlock: Too many vertical scroll blocks"); } } @@ -1112,7 +1115,7 @@ void RFL_NewRow (int dir) count = PORTTILESHIGH; break; default: - Quit ("RFL_NewRow: Bad dir!"); + Quit (gvar, "RFL_NewRow: Bad dir!"); } while (count--) @@ -1154,7 +1157,7 @@ void RF_ForceRefresh (void) = ===================== */ - +/*++++ void RF_MapToMap (unsigned srcx, unsigned srcy, unsigned destx, unsigned desty, unsigned width, unsigned height) @@ -1219,7 +1222,7 @@ void RF_MapToMap (unsigned srcx, unsigned srcy, } } } - +*/ //=========================================================================== @@ -1233,7 +1236,7 @@ void RF_MapToMap (unsigned srcx, unsigned srcy, = ===================== */ - +/*++++ void RF_MemToMap (unsigned far *source, unsigned plane, unsigned destx, unsigned desty, unsigned width, unsigned height) @@ -1276,7 +1279,7 @@ void RF_MemToMap (unsigned far *source, unsigned plane, RFL_CheckForAnimTile (destx+x,desty+y); } } -} +}*/ //=========================================================================== @@ -1426,6 +1429,7 @@ void RF_RedrawBlock (int x, int y, int width, int height) void RF_CalcTics (void) { long newtime,oldtimecount; + word TimeCount = *clockw; // // calculate tics since last refresh for adaptive timing @@ -1676,11 +1680,11 @@ void RF_Scroll (int x, int y) oldscreen = screenstart[i] - screenmove; newscreen = oldscreen + screencopy; screenstart[i] = newscreen + screenmove; - VW_ScreenToScreen (oldscreen,newscreen, +//++++ VW_ScreenToScreen (oldscreen,newscreen, PORTTILESWIDE*2,PORTTILESHIGH*16); if (i==screenpage) - VW_SetScreen(newscreen+oldpanadjust,oldpanx & xpanmask); + VL_SetScreen(newscreen+oldpanadjust,oldpanx & xpanmask); } } bufferofs = screenstart[otherpage]; @@ -1826,7 +1830,7 @@ void RF_PlaceSprite (void **user,unsigned globalx,unsigned globaly, // this is a brand new sprite, so allocate a block from the array if (!spritefreeptr) - Quit ("RF_PlaceSprite: No free spots in spritearray!"); + Quit (gvar, "RF_PlaceSprite: No free spots in spritearray!"); sprite = spritefreeptr; spritefreeptr = spritefreeptr->nextsprite; @@ -2013,7 +2017,7 @@ void RFL_EraseBlocks (void) // erase the block by copying from the master screen // pos = ylookup[block->screeny]+block->screenx; - VW_ScreenToScreen (masterofs+pos,bufferofs+pos, +//++++ VW_ScreenToScreen (masterofs+pos,bufferofs+pos, block->width,block->height); // @@ -2161,7 +2165,7 @@ redraw: switch (sprite->draw) { case spritedraw: - VW_MaskBlock(grsegs[sprite->grseg], sourceofs, +//++++ VW_MaskBlock(grsegs[sprite->grseg], sourceofs, dest,sprite->width,height,sprite->planesize); break; @@ -2235,7 +2239,7 @@ void RF_Refresh (void) // // display the changed screen // - VW_SetScreen(bufferofs+panadjust,panx & xpanmask); + VL_SetScreen(bufferofs+panadjust,panx & xpanmask); // // prepare for next refresh @@ -2499,7 +2503,7 @@ void RF_PlaceSprite (void **user,unsigned globalx,unsigned globaly, // this is a brand new sprite, so allocate a block from the array if (!spritefreeptr) - Quit ("RF_PlaceSprite: No free spots in spritearray!"); + Quit (gvar, "RF_PlaceSprite: No free spots in spritearray!"); sprite = spritefreeptr; spritefreeptr = spritefreeptr->nextsprite; @@ -2676,7 +2680,7 @@ void RFL_EraseBlocks (void) pos = ylookup[block->screeny]+block->screenx; block->width = (block->width + (pos&1) + 1)& ~1; pos &= ~1; // make sure a word copy gets used - VW_ScreenToScreen (masterofs+pos,bufferofs+pos, +//++++ VW_ScreenToScreen (masterofs+pos,bufferofs+pos, block->width,block->height); // diff --git a/src/lib/16_rf.h b/src/lib/16_rf.h index 7dff0b1f..e70fb104 100755 --- a/src/lib/16_rf.h +++ b/src/lib/16_rf.h @@ -70,6 +70,7 @@ #define NUMTILE16M 1206 #define SPEED 502 #define ANIM (SPEED+NUMTILE16) +#define DEMOTICS 3 #define NORTHWALL (ANIM+NUMTILE16) #define EASTWALL (NORTHWALL+NUMTILE16M) diff --git a/video.ofs.bufferofs b/video.ofs.bufferofs deleted file mode 100755 index e69de29b..00000000 diff --git a/video.ofs.displayofs b/video.ofs.displayofs deleted file mode 100755 index e69de29b..00000000 -- 2.39.5