X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_tail.c;h=557c4968930439d4c1efb3d89e8a87a70589d1d4;hb=05646f1436736a76ebeec2796f3244c70ed7a92f;hp=a602a62b9d380e1b3fc89faa8647f10ac7e325e4;hpb=16cb74317c1591986b9d856beb4c70ce875db179;p=16.git diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index a602a62b..557c4968 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -79,10 +79,13 @@ void Startup16(global_game_variables_t *gvar) #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) #endif - IN_Startup(gvar); + IN_Startup(); #endif +#ifdef __16_PM__ PM_Startup(gvar); + PM_CheckMainMem(gvar); PM_UnlockMainMem(gvar); +#endif CA_Startup(gvar); } @@ -100,16 +103,20 @@ void Startup16(global_game_variables_t *gvar) void Shutdown16(global_game_variables_t *gvar) { +#ifdef __16_PM__ PM_Shutdown(gvar); +#endif #ifdef __WATCOMC__ #ifdef __DEBUG_InputMgr__ if(!dbg_nointest) #endif - IN_Shutdown(gvar); + IN_Shutdown(); #endif CA_Shutdown(gvar); MM_Shutdown(gvar); +#ifdef __WATCOMC__ VGAmodeX(0, 1, gvar); +#endif } @@ -311,7 +318,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) void ClearMemory (global_game_variables_t *gvar) { +#ifdef __16_PM__ PM_UnlockMainMem(gvar); +#endif //snd MM_SortMem (gvar); } @@ -372,56 +381,6 @@ void Quit (global_game_variables_t *gvar, char *error) } //=========================================================================== -//from http://stackoverflow.com/questions/2736753/how-to-remove-extension-from-file-name - -// remove_ext: removes the "extension" from a file spec. -// mystr is the string to process. -// dot is the extension separator. -// sep is the path separator (0 means to ignore). -// Returns an allocated string identical to the original but -// with the extension removed. It must be freed when you're -// finished with it. -// If you pass in NULL or the new string can't be allocated, -// it returns NULL. - -char *remove_ext (char* mystr, char dot, char sep) { - char *retstr, *lastdot, *lastsep; - - // Error checks and allocate string. - - if (mystr == NULL) - return NULL; - if ((retstr = malloc (strlen (mystr) + 1)) == NULL) - return NULL; - - // Make a copy and find the relevant characters. - - strcpy (retstr, mystr); - lastdot = strrchr (retstr, dot); - lastsep = (sep == 0) ? NULL : strrchr (retstr, sep); - - // If it has an extension separator. - - if (lastdot != NULL) { - // and it's before the extenstion separator. - - if (lastsep != NULL) { - if (lastsep < lastdot) { - // then remove it. - - *lastdot = '\0'; - } - } else { - // Has extension separator with no path separator. - - *lastdot = '\0'; - } - } - - // Return the modified string. - - return retstr; -} #ifndef __WATCOMC__ char global_temp_status_text[512]; @@ -470,6 +429,19 @@ void turboXT(byte bakapee) } #endif +const char *word_to_binary(word x) +{ + static char b[17]; + int z; + + b[0] = '\0'; + for (z = 16; z > 0; z >>= 1) + { + strcat(b, ((x & z) == z) ? "1" : "0"); + } + return b; +} + const char *nibble_to_binary(nibble x) { static char b[9];