From: sparky4 Date: Wed, 5 Apr 2017 15:21:38 +0000 (-0500) Subject: p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=f142a92a2ff911c135f5189349eb4a68818ac164;p=16.git 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] MM_ShowMemory is uggy on real machines. i need to debug it and fix added a struct printer[gvar.mm is FUCKING HUGE 14402 bytes FAT\!][fixed issue with crashings on test programs][fuckings the file name shit] --- diff --git a/src/miditest.c b/16/src/miditest.c similarity index 100% rename from src/miditest.c rename to 16/src/miditest.c diff --git a/makefile b/makefile index 13cc2191..cb9839b1 100755 --- a/makefile +++ b/makefile @@ -223,7 +223,8 @@ SPRIUTILEXEC = & EXEC = & 16.exe & bakapi.exe & - $(TESTEXEC) + $(TESTEXEC) & + $(UTILEXEC) #!ifdef __LINUX__ #EXEC += $(SPRIUTILEXEC) diff --git a/src/0.c b/src/0.c index 051bb332..fff125c4 100755 --- a/src/0.c +++ b/src/0.c @@ -46,21 +46,26 @@ int main(int argc,char **argv) unsigned int bufsz; int fd; //nibble i; - char *bakapee1,*bakapee2; + //char *bakapee1,*bakapee2; + char bakapee1[64] = FILENAME_1; + char bakapee2[64] = FILENAME_2; boolean anim=1,noanim=0,zerostoppause=1; - bakapee1=malloc(64); - bakapee2=malloc(64); +// bakapee1=mALLoc(64); +// bakapee2=mALLoc(64); - if (argc < 2) { + if (argc >= 2) { +/* if (argc < 2) { //fprintf(stderr,"drawvrl \n palette file optional\n"); bakapee1 = FILENAME_1;//"data/aconita.vrl"; bakapee2 = FILENAME_2;//"data/aconita.pal"; }else{ if(argv[1]) bakapee1 = argv[1]; - if(argv[2]) bakapee2 = argv[2]; + if(argv[2]) bakapee2 = argv[2];*/ + if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1]; + if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; } } fd = open(bakapee1,O_RDONLY|O_BINARY); @@ -92,7 +97,7 @@ int main(int argc,char **argv) return 1; } VGAmodeX(1, 1, &gvar); - modexPalUpdate0(gvar.video.palette); + VL_modexPalScramble(gvar.video.palette); /* load color palette */ VL_LoadPalFile(bakapee2, &gvar.video.palette); @@ -307,8 +312,7 @@ if(!noanim) { buffer = NULL; free(buffer); bufsz = 0; - free(bakapee1); - free(bakapee2); +// free(bakapee1); free(bakapee2); printf("\nProject 16 0.exe. This is just a test file!\n"); printf("version %s\n", VERSION); //SCROLLEXITMESG; diff --git a/src/exmmtest.c b/src/exmmtest.c index 3e995431..fe5f0ad2 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -29,7 +29,6 @@ #include "src/lib/16_ca.h" #include "src/lib/16_mm.h" #include "src/lib/16_hc.h" -//#include "src/lib/16_vl.h" #include "src/lib/16_dbg.h" #pragma hdrstop @@ -50,12 +49,12 @@ #define KEYP IN_Shutdown(&gvar); printf("\n\npress any key to continue!\n"); getch(); IN_Startup(&gvar); -#define BBUFNAME bigbuffer//gvar.ca.tinf[0] -#define INITBBUF static memptr BBUFNAME; +#define BBUFNAME gvar.mm.bufferseg//bigbuffer +//#define INITBBUF static memptr BBUFNAME; #define BBUFPTR MEMPTR BBUFNAME #ifdef __BORLANDC__ -#define BBUF (memptr *)BBUFPTR// +#define BBUF (memptr *)BBUFPTR #define BBUFSTRING (memptr *)BBUFNAME #endif #ifdef __WATCOMC__ @@ -110,92 +109,97 @@ void segatesuto() } #endif +#ifdef __16_PM__ +#ifdef __DEBUG_PM__ + dbg_debugpm=1; //debug pm +#endif +#endif +#ifdef __DEBUG_CA__ + dbg_debugca=1; +#endif +#ifdef __DEBUG_MM__ + dbg_debugmm=1; +#endif + +//===========================================================================// + +//=======================================// +// main +//=======================================// void main(int argc, char *argv[]) { byte w; -#ifndef NOVID + #ifndef NOVID boolean done; ScanCode scan; -#endif + #endif static global_game_variables_t gvar; -#ifdef INITBBUF + #ifdef INITBBUF INITBBUF -#endif + #endif +#if 0 //#ifdef __WATCOMC__ -// __segment sega; -//#endif - char *bakapee1,*bakapee2; + __segment sega; +#endif + char bakapee1[64] = "data/koishi~.pcx"; + char bakapee2[64] = "data/test.map"; word baka; -#ifdef __BORLANDC__ - argc=argc; -#endif - //file name // - bakapee1 = malloc(24); - bakapee2 = malloc(24); - //file name // + #ifdef __BORLANDC__ + argc=argc; + #endif -#ifdef __16_PM__ -#ifdef __DEBUG_PM__ - dbg_debugpm=1; //debug pm -#endif -#endif + #ifdef PRINTBBDUMP + //0000PRINTBB; KEYP + #endif -#ifdef __DEBUG_CA__ - dbg_debugca=1; -#endif -#ifdef PRINTBBDUMP -//0000PRINTBB; KEYP -#endif - if(argv[1]){ bakapee1 = argv[1]; - if(argv[2]) bakapee2 = argv[2]; } + if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1]; + if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; } +#if 0 else{ //{ printf("filename!: "); scanf("%[^\n]", &bakapee); } - bakapee1 = "data/koishi~.pcx"; - bakapee2 = "data/test.map"; + strcpy(bakapee1, "data/koishi~.pcx"); //bakapee1 = "data/koishi~.pcx"; + strcpy(bakapee2, "data/test.map"); //bakapee2 = "data/test.map"; } -#ifndef NOVID - Startup16(&gvar); +#endif + printf("bakapee1[%s]\n", bakapee1); + printf("bakapee2[%s]\n", bakapee2); + KEYP + #ifndef NOVID + Startup16(&gvar); // save the palette -#ifdef __WATCOMC__ + #ifdef __WATCOMC__ modexPalSave(&gvar.video.dpal); modexFadeOff(4, &gvar.video.dpal); //modexPalBlack(); -#endif -#else //NOVID + #endif + #else //NOVID //printf("main()=%Fp start MM\n", *argv[0]); - MM_Startup(&gvar); //printf("ok\n"); -#ifdef __16_PM__ -#ifdef __DEBUG_PM__ - if(dbg_debugpm>0) - { -#endif - PM_Startup(&gvar); PM_CheckMainMem(&gvar); PM_UnlockMainMem(&gvar); -//0000 printf("PM Started\n"); KEYP -#ifdef __DEBUG_PM__ - } -#endif -#endif + MM_Startup(&gvar); + #ifdef __16_PM__ + #ifdef __DEBUG_PM__ + if(dbg_debugpm>0) + { + #endif //__DEBUG_PM__ + PM_Startup(&gvar); PM_CheckMainMem(&gvar); PM_UnlockMainMem(&gvar); + //0000printf("PM Started\n"); KEYP + #ifdef __DEBUG_PM__ + } + #endif //__DEBUG_PM__ + #endif //__16_PM__ + #endif //elsed NOVID -#endif //NOVID -#ifdef __DEBUG_MM__ - dbg_debugmm=0; -#endif CA_Startup(&gvar); -// printf(" done!\n"); -#ifdef PRINTBBDUMP -//0000 + #ifdef PRINTBBDUMP + //0000 PRINTBB; KEYP -#endif -#ifdef __DEBUG_MM__ - dbg_debugmm=1; -#endif + #endif w=0; -#ifdef FILEREADLOAD -#ifdef FILEREAD + #ifdef FILEREADLOAD + #ifdef FILEREAD for(;w<2;w++) { // printf("size of big buffer~=%u\n", _bmsize(segu, BBUF)); @@ -205,24 +209,24 @@ PRINTBB; KEYP if(CA_ReadFile(bakapee2, BBUFPTR, &gvar)) baka=1; else baka=0; printf("====================================read end===================================\n"); } -#endif + #endif //FILEREAD if(w==0) { printf("======================================load=====================================\n"); if(CA_LoadFile(bakapee1, BBUFPTR, &gvar)) baka=1; else baka=0; printf("====================================load end===================================\n"); } -//#ifdef __WATCOMC__ -// printf("\nsize of big buffer~=%u\n", _bmsize(sega, BBUF)); -//#endif -#ifdef BUFFDUMP + //#ifdef __WATCOMC__ + // printf("\nsize of big buffer~=%u\n", _bmsize(sega, BBUF)); + //#endif + #ifdef BUFFDUMP printf("contents of the buffer\n[\n%s\n]\n", BBUFSTRING); -#endif// #else -#ifdef PRINTBBDUMP + #endif// #else + #ifdef PRINTBBDUMP PRINTBB; -#endif + #endif -//endif // BUFFDUMP + //endif // BUFFDUMP //printf("dark purple = purgable\n"); //printf("medium blue = non purgable\n"); @@ -231,16 +235,13 @@ PRINTBB; KEYP // DebugMemory_(&gvar, 1); if(baka) printf("\nyay!\n"); else printf("\npoo!\n"); -#ifdef BUFFDUMPPAUSE + #ifdef BUFFDUMPPAUSE KEYP -#endif -#ifdef FILEREAD + #endif + #ifdef FILEREAD } -#endif -#ifndef BUFFDUMPPAUSE - KEYP -#endif -#endif //filereadload + #endif + #endif //filereadload #ifdef __WATCOMC__ #ifndef NOVID @@ -287,41 +288,40 @@ PRINTBB; KEYP //printf("bakapee1=%s\n", bakapee1); //printf("bakapee2=%s\n", bakapee2); MM_FreePtr(BBUFPTR, &gvar); -#ifndef NOVID + #ifndef NOVID Shutdown16(&gvar); -#else -#ifdef __16_PM__ -#ifdef __DEBUG_PM__ - if(dbg_debugpm>0) -#endif - PM_Shutdown(&gvar); -#endif + #else //novid + #ifdef __16_PM__ + #ifdef __DEBUG_PM__ + if(dbg_debugpm>0) + #endif //__DEBUG_PM__ + PM_Shutdown(&gvar); + #endif //__16_PM__ CA_Shutdown(&gvar); MM_Shutdown(&gvar); -#endif //NOVID + #endif //NOVID IN_Shutdown(&gvar); - free(bakapee1); free(bakapee2); printf("========================================\n"); - printf("near= %Fp ", gvar.mm.nearheap); - printf("far= %Fp", gvar.mm.farheap); + printf("near= %Fp ", gvar.mm.nearheap); + printf("far= %Fp", gvar.mm.farheap); printf("\n"); - printf("&near= %Fp ", &(gvar.mm.nearheap)); - printf("&far= %Fp", &(gvar.mm.farheap)); + printf("&near= %Fp ", &(gvar.mm.nearheap)); + printf("&far= %Fp", &(gvar.mm.farheap)); printf("\n"); -#ifdef EXMMVERBOSE - printf("bigb= %Fp ", BBUF); - //printf("bigbr= %04x", BBUF); + #ifdef EXMMVERBOSE + printf("bigb= %Fp ", BBUF); + //printf("bigbr= %04x", BBUF); //printf("\n"); - printf("&bigb=%Fp ", BBUFPTR); - //printf("&bigb=%04x", BBUFPTR); + printf("&bigb=%Fp ", BBUFPTR); + //printf("&bigb=%04x", BBUFPTR); printf("\n"); -#endif + #endif printf("========================================\n"); -#ifdef EXMMVERBOSE__ + #ifdef EXMMVERBOSE__ printf("coreleft(): %u\n", _memavl()); printf("farcoreleft(): %lu\n", (dword)HC_farcoreleft()); -#endif + #endif #ifdef __WATCOMC__ //this is far printf("Total free: %lu\n", (dword)(HC_GetFreeSize())); //super buggy printf("HC_coreleft(): %u\n", HC_coreleft()); @@ -345,6 +345,10 @@ PRINTBB; KEYP #endif printf(".exe. This is just a test file!\n"); printf("version %s\n", VERSION); + +//end of program + + #if defined(__DEBUG__) && ( defined(__DEBUG_PM__) || defined(__DEBUG_MM__) ) #ifdef __DEBUG_MM__ printf("debugmm: %u\t", dbg_debugmm); diff --git a/src/lib/16_t.h b/src/lib/16_t.h index e91328d4..ce881ae8 100755 --- a/src/lib/16_t.h +++ b/src/lib/16_t.h @@ -77,12 +77,12 @@ typedef void _seg * memptr; #define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value)) #define poke(segm,ofs,value) (peek((segm),(ofs)) = (word)(value)) -#define inportb(port) inp(port) -#define inport(port) inpw(port) -#define outportb(port, val) outp(port, val) -#define outport(port, val) outpw(port, val) +#define inportb(port) inp(port) +#define inport(port) inpw(port) +#define outportb(port, val) outp(port, val) +#define outport(port, val) outpw(port, val) -//#define asm __asm +#define asm __asm #define getvect _dos_getvect #define setvect _dos_setvect diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 2078def2..22149c06 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -771,7 +771,8 @@ modexPalUpdate(byte *p) } void -modexPalUpdate0(byte *p) +//modexPalUpdate0(byte *p) +VL_modexPalScramble(byte *p) { int i; //modexWaitBorder(); diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index af357b08..ba1d377c 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -204,7 +204,7 @@ void modexPalWhite(); /* utility functions */ void modexPalUpdate(byte *p); -void modexPalUpdate0(byte *p); +void VL_modexPalScramble(byte *p); word modexPalOverscan(word col); void VL_Plot (int x, int y, int color, ofs_t *ofs); void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs); diff --git a/src/palettec.c b/src/palettec.c index 8f1ed3e7..2935ad26 100755 --- a/src/palettec.c +++ b/src/palettec.c @@ -22,15 +22,13 @@ #include "src/lib/16_vl.h" -void -main(int argc, char *argv[]) +void main(int argc, char *argv[]) { static global_game_variables_t gvar; - char *bakapee; + char bakapee[64] = "data\default.pal"; + + if(argv[1]) strcpy(bakapee, argv[1]); - bakapee = malloc(64); - if(argv[1]) bakapee = argv[1]; - else bakapee = "data/default.pal"; VGAmodeX(1, 1, &gvar); @@ -39,6 +37,4 @@ main(int argc, char *argv[]) modexSavePalFile(bakapee, &(gvar.video.palette)); VGAmodeX(0, 1, &gvar); - free(bakapee); - } diff --git a/src/palettel.c b/src/palettel.c index 1a487bab..9249e540 100755 --- a/src/palettel.c +++ b/src/palettel.c @@ -23,17 +23,18 @@ #include "src/lib/16_vl.h" #include "src/lib/bakapee.h" -char *bakapee; word i; -void -main(int argc, char *argv[]) +void main(int argc, char *argv[]) { static global_game_variables_t gvar; - bakapee = malloc(64); - if(argv[1]) bakapee = argv[1]; - else bakapee = "data/default.pal"; + char bakapee[64] = "data\default.pal"; + + if(argv[1]) strcpy(bakapee, argv[1]); + + modexPalSave(&(gvar.video.palette)); + VL_modexPalScramble(&(gvar.video.palette)); VGAmodeX(1, 1, &gvar); gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); modexPalBlack(); @@ -42,12 +43,11 @@ main(int argc, char *argv[]) modexPalUpdate(&(gvar.video.palette)); modexFadeOn(1, &(gvar.video.palette)); modexpdump(&gvar.video.page[0]); - getch(); +// getch(); VGAmodeX(0, 0, &gvar); modexPalUpdate(&(gvar.video.palette)); /*for(i=0;i<768;i++) { printf("%02X ", pal[i]); }*/ - free(bakapee); } diff --git a/src/xcroll.c b/src/xcroll.c index fcc7778d..0f4bf060 100755 --- a/src/xcroll.c +++ b/src/xcroll.c @@ -51,26 +51,31 @@ memptr pal; void main(int argc, char *argv[]) { static global_game_variables_t gvar; - char *bakapee1,*bakapee1p; struct glob_game_vars *ggvv; // sword bakapee; // if(argv[1]) bakapee = atoi(argv[1]); // else bakapee = 1; + //char *bakapee1,*bakapee1p; + char bakapee1[64] = FILENAME_1; + char bakapee1p[64] = FILENAME_1P; Startup16(&gvar); - bakapee1=malloc(64); - bakapee1p=malloc(64); +// bakapee1=mALLoc(64); +// bakapee1p=mALLoc(64); ggvv=&gvar; - if (argc < 2) { + if (argc >= 2) { +/* if (argc < 2) { //fprintf(stderr,"drawvrl \n palette file optional\n"); bakapee1 = FILENAME_1; bakapee1p = FILENAME_1P; }else{ if(argv[1]) bakapee1 = argv[1]; - if(argv[2]) bakapee1p = argv[2]; + if(argv[2]) bakapee1p = argv[2];*/ + if(argv[1]){ strcpy(bakapee1, argv[1]); + if(argv[2]) strcpy(bakapee1p, argv[2]); } } // OK, this one takes hellova time and needs to be done in farmalloc or MM_... @@ -133,7 +138,7 @@ void main(int argc, char *argv[]) #ifdef FADE modexFadeOff(4, &gvar.video.palette); #endif - Quit(&gvar, "Wrong ID for sprite"); + Quit (&gvar, "Wrong ID for sprite"); #ifdef FADE modexFadeOn(4, &gvar.video.dpal); #endif @@ -180,8 +185,8 @@ void main(int argc, char *argv[]) if(gvar.player[0].enti.q == (TILEWH/(gvar.player[0].enti.speed))+1 && gvar.player[0].info.dir != 2 && (gvar.player[0].enti.triggerx == 5 && gvar.player[0].enti.triggery == 5)){ gvar.player[0].enti.hp--; } //debugging binds! - if(gvar.in.inst->Keyboard[24]){ modexPalUpdate0(&gvar.video.palette); /*paloffset=0;*/ modexpdump(gvar.mv[0].page); IN_UserInput(1, &gvar); } //o - if(gvar.in.inst->Keyboard[22]){ modexPalUpdate0(&gvar.video.palette); } //u + if(gvar.in.inst->Keyboard[24]){ VL_modexPalScramble(&gvar.video.palette); /*paloffset=0;*/ modexpdump(gvar.mv[0].page); IN_UserInput(1, &gvar); } //o + if(gvar.in.inst->Keyboard[22]){ VL_modexPalScramble(&gvar.video.palette); } //u TAIL_FUNCTIONKEYFUNCTIONS TAIL_FUNCTIONKEYDRAWJUNK @@ -190,14 +195,18 @@ void main(int argc, char *argv[]) { if(gvar.in.inst->Keyboard[sc_J]) { - bakapee1=FILENAME_1; - bakapee1p=FILENAME_1P; +// bakapee1=FILENAME_1; +// bakapee1p=FILENAME_1P; + strcpy(bakapee1, FILENAME_1); + strcpy(bakapee1p, FILENAME_1P); gvar.player[0].enti.overdraww=0; } if(gvar.in.inst->Keyboard[sc_K]) { - bakapee1=FILENAME_2; - bakapee1p=FILENAME_2P; +// bakapee1=FILENAME_2; +// bakapee1p=FILENAME_2P; + strcpy(bakapee1, FILENAME_2); + strcpy(bakapee1p, FILENAME_2P); gvar.player[0].enti.overdraww=2; } //read_vrs(&gvar, bakapee1, gvar.player[0].enti.spri->spritesheet); @@ -209,7 +218,7 @@ void main(int argc, char *argv[]) #endif if(gvar.in.inst->Keyboard[sc_R]){ modexPalOverscan(rand()%56); } //r - if((gvar.player[0].enti.q==1) && !(gvar.player[0].enti.x%TILEWH==0 && gvar.player[0].enti.y%TILEWH==0)) Quit(&gvar, "PLAYER OFF THE RAILS!");//break; //incase things go out of sync! + if((gvar.player[0].enti.q==1) && !(gvar.player[0].enti.x%TILEWH==0 && gvar.player[0].enti.y%TILEWH==0)) Quit (&gvar, "PLAYER OFF THE RAILS!");//break; //incase things go out of sync! } /* fade back to text mode */