From 53acdb7d0d8aebdc481eb91bd9369f3b49f8218d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 1 Feb 2017 08:48:48 -0600 Subject: [PATCH] wwww --- src/lib/16_hc.c | 2 +- src/lib/16_mm.c | 6 ++-- src/lib/16_vl.c | 5 +--- src/lib/16_vrs.c | 3 +- src/lib/scroll16.c | 72 ++-------------------------------------------- src/sountest.c | 4 +-- 6 files changed, 9 insertions(+), 83 deletions(-) diff --git a/src/lib/16_hc.c b/src/lib/16_hc.c index 0f77772c..d2ecddac 100755 --- a/src/lib/16_hc.c +++ b/src/lib/16_hc.c @@ -301,7 +301,7 @@ size_t _basedcoreleft(void) if( segu == _NULLSEG ) { printf( "Unable to allocate based heap\n" ); return 0; - //exit( 1 ); + } else diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index f894464e..b338e591 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -943,7 +943,7 @@ void MM_GetPtr (memptr *baseptr, dword size, global_game_variables_t *gvar) printf(" *baseptr=%Fp ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr)); printf(" &baseptr=%Fp ", &baseptr); printf("&useptr=%Fp\n", &(gvar->mm.mmnew->useptr)); #endif - //exit(-5); } + //Quit(gvar, "gvar->mm.mmnew->useptr==NULL"); } gvar->mm.mmnew->attributes = BASEATTRIBUTES; //tryagain: @@ -1022,9 +1022,7 @@ void MM_GetPtr (memptr *baseptr, dword size, global_game_variables_t *gvar) //heapdump(); #endif printf(OUT_OF_MEM_MSG,(size-gvar->mmi.nearheap)); - printf("for stability reasons the program will shut down! wwww\n"); - MM_Shutdown(gvar); - exit(-1); + Quit(gvar, "for stability reasons the program will shut down! wwww\n"); } else gvar->mm.mmerror = true; diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 782bd3d6..fbf51fa6 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -649,8 +649,7 @@ modexNewPal() { /* handle errors */ if(!ptr) { - printf("Could not allocate palette.\n"); - exit(-1); + printf("Could not allocate palette.\n"); } return ptr; @@ -674,7 +673,6 @@ modexLoadPalFile(byte *filename, byte **palette) { file = fopen(filename, "rb"); if(!file) { printf("Could not open palette file: %s\n", filename); - exit(-2); } /* read the file */ @@ -713,7 +711,6 @@ modexSavePalFile(char *filename, byte *pal) { file = fopen(filename, "wb"); if(!file) { printf("Could not open %s for writing\n", filename); - exit(-2); } /* write the data to the file */ diff --git a/src/lib/16_vrs.c b/src/lib/16_vrs.c index 75908ace..0b3fc8f5 100755 --- a/src/lib/16_vrs.c +++ b/src/lib/16_vrs.c @@ -102,8 +102,7 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container close(fd); if(!success) { - fprintf(stderr, "Unable to load file"); - exit(3); + Quit (gvar, "Unable to load file"); } vrs_cont->data_size = size - sizeof(struct vrs_header); vrs_cont->buffer = buffer; diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 5937b228..5a9659c6 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -324,80 +324,12 @@ void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) outp(AC_INDEX, (moo[0].page->dx & 0x03) << 1); } -/*map_t -allocMap(int w, int h) { - map_t result; - - result.width =w; - result.height=h; - result.data = malloc(sizeof(byte) * w * h); - //result.data = (byte *)alloc_emem(((int)sizeof(byte) * w * h)/1024); - if(isEMS() || checkEMS()) - { - XMOVE mm; - //emmhandle = mallocEMS(coretotalEMS());//alloc_emem((int)sizeof(map)) - mm.length=sizeof(result); - mm.sourceH=0; - mm.sourceOff=ptr2long(&result); - mm.destH=emmhandle; - mm.destOff=0; - ist = move_emem(&mm); - if(!ist){ dealloc_emem(emmhandle); exit(5); } - printf("%d\n", coretotalEMS()); - } - - return result; -}*/ - void initMap(map_t *map) { // just a place holder to fill out an alternating pattern - int x, y;//, xx, yy; - int i;//, q; + int x, y; + int i; int tile = 1; - //if(!isEMS() || !checkEMS()) -// map->tiles = malloc(sizeof(tiles_t)); - //else - // map->tiles = (tiles_t *)alloc_emem(sizeof(tiles_t)); - - //create the tile set - //if(!isEMS() || !checkEMS()) -// map->tiles->data = malloc(sizeof(bitmap_t)); - //else - // map->tiles->data = (bitmap_t *)alloc_emem(sizeof(bitmap_t)); -// map->tiles->data->width = (TILEWH); -// map->tiles->data->height= TILEWH; - //if(!isEMS() || !checkEMS()) -// map->tiles->data->data = malloc((TILEWH*2)*TILEWH); - //else - // map->tiles->data->data = (byte *)alloc_emem((TILEWH*2)*TILEWH); -// map->tiles->tileHeight = TILEWH; -// map->tiles->tileWidth =TILEWH; -// map->tiles->rows = 1; -// map->tiles->cols = 1;//2; - -/* q=0; - //for(y=0; yheight; y++) { - //for(x=0; xwidth; x++) { - i=0; - for(yy=0; yytiles->data->data[i+1] = map->data[q];//28;//0x24; -// printf("[%d]", map->tiles->data->data[i]); - //}else{ - //map->tiles->data->data[i] = map->data[q];//0;//0x34; - //printf("]%d[==[%d]", i, map->tiles->data->data[i]); - //} - i++; - } -// printf("\n"); - } -// printf("[%d]", map->data[q]); - q++;*/ -// } - //printf("\n\n"); -// } i=0; for(y=0; yheight; y++) { diff --git a/src/sountest.c b/src/sountest.c index ac8908c3..c8353ef0 100755 --- a/src/sountest.c +++ b/src/sountest.c @@ -51,6 +51,7 @@ static unsigned int musical_scale[18] = { void main(int argc, char near *argv[]) { + static global_game_variables_t gvar; word i; // static FMInstrument testInst = //{ @@ -67,8 +68,7 @@ void main(int argc, char near *argv[]) //FMSetVoice(0, &testInst); if(!init_adlib()) { - printf("Cannot init library\n"); - exit(-5); + Quit(gvar, "Cannot init library"); } if (adlib_fm_voices > 9) -- 2.39.2