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:
//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;
\r
/* handle errors */\r
if(!ptr) {\r
- printf("Could not allocate palette.\n");\r
- exit(-1);\r
+ printf("Could not allocate palette.\n");\r
}\r
\r
return ptr;\r
file = fopen(filename, "rb");\r
if(!file) {\r
printf("Could not open palette file: %s\n", filename);\r
- exit(-2);\r
}\r
\r
/* read the file */\r
file = fopen(filename, "wb");\r
if(!file) {\r
printf("Could not open %s for writing\n", filename);\r
- exit(-2);\r
}\r
\r
/* write the data to the file */\r
outp(AC_INDEX, (moo[0].page->dx & 0x03) << 1);\r
}\r
\r
-/*map_t\r
-allocMap(int w, int h) {\r
- map_t result;\r
-\r
- result.width =w;\r
- result.height=h;\r
- result.data = malloc(sizeof(byte) * w * h);\r
- //result.data = (byte *)alloc_emem(((int)sizeof(byte) * w * h)/1024);\r
- if(isEMS() || checkEMS())\r
- {\r
- XMOVE mm;\r
- //emmhandle = mallocEMS(coretotalEMS());//alloc_emem((int)sizeof(map))\r
- mm.length=sizeof(result);\r
- mm.sourceH=0;\r
- mm.sourceOff=ptr2long(&result);\r
- mm.destH=emmhandle;\r
- mm.destOff=0;\r
- ist = move_emem(&mm);\r
- if(!ist){ dealloc_emem(emmhandle); exit(5); }\r
- printf("%d\n", coretotalEMS());\r
- }\r
-\r
- return result;\r
-}*/\r
-\r
void\r
initMap(map_t *map) {\r
// just a place holder to fill out an alternating pattern\r
- int x, y;//, xx, yy;\r
- int i;//, q;\r
+ int x, y;\r
+ int i;\r
int tile = 1;\r
- //if(!isEMS() || !checkEMS())\r
-// map->tiles = malloc(sizeof(tiles_t));\r
- //else\r
- // map->tiles = (tiles_t *)alloc_emem(sizeof(tiles_t));\r
-\r
- //create the tile set\r
- //if(!isEMS() || !checkEMS())\r
-// map->tiles->data = malloc(sizeof(bitmap_t));\r
- //else\r
- // map->tiles->data = (bitmap_t *)alloc_emem(sizeof(bitmap_t));\r
-// map->tiles->data->width = (TILEWH);\r
-// map->tiles->data->height= TILEWH;\r
- //if(!isEMS() || !checkEMS())\r
-// map->tiles->data->data = malloc((TILEWH*2)*TILEWH);\r
- //else\r
- // map->tiles->data->data = (byte *)alloc_emem((TILEWH*2)*TILEWH);\r
-// map->tiles->tileHeight = TILEWH;\r
-// map->tiles->tileWidth =TILEWH;\r
-// map->tiles->rows = 1;\r
-// map->tiles->cols = 1;//2;\r
-\r
-/* q=0;\r
- //for(y=0; y<map->height; y++) {\r
- //for(x=0; x<map->width; x++) {\r
- i=0;\r
- for(yy=0; yy<TILEWH; yy++) {\r
- for(xx=0; xx<(TILEWH); xx++) {\r
- //if(x<TILEWH){\r
- map->tiles->data->data[i+1] = map->data[q];//28;//0x24;\r
-// printf("[%d]", map->tiles->data->data[i]);\r
- //}else{\r
- //map->tiles->data->data[i] = map->data[q];//0;//0x34;\r
- //printf("]%d[==[%d]", i, map->tiles->data->data[i]);\r
- //}\r
- i++;\r
- }\r
-// printf("\n");\r
- }\r
-// printf("[%d]", map->data[q]);\r
- q++;*/\r
-// }\r
- //printf("\n\n");\r
-// }\r
\r
i=0;\r
for(y=0; y<map->height; y++) {\r
\r
void main(int argc, char near *argv[])\r
{\r
+ static global_game_variables_t gvar;\r
word i;\r
// static FMInstrument testInst =\r
//{\r
//FMSetVoice(0, &testInst);\r
if(!init_adlib())\r
{\r
- printf("Cannot init library\n");\r
- exit(-5);\r
+ Quit(gvar, "Cannot init library");\r
}\r
\r
if (adlib_fm_voices > 9)\r