/* * Com_Quit * * Both client and server can use this, and it will * do the apropriate things. */ void Com_Quit( void ) { if( dynvars_initialized ) { dynvar_t *quit = Dynvar_Lookup( "quit" ); if( quit ) { // wsw : aiwa : added "quit" event for pluggable clean-up (e.g. IRC shutdown) Dynvar_CallListeners( quit, NULL ); } Dynvar_Destroy( quit ); } SV_Shutdown( "Server quit\n" ); CL_Shutdown(); MM_Shutdown(); if( log_file ) { FS_FCloseFile( log_file ); log_file = 0; } Sys_Quit(); }
//------------------------------------------------------------------------- // ShowSystem() //------------------------------------------------------------------------- void ShowSystem() { char avail[2][8]={"None","Present"}; MM_Startup (); CA_Startup (); IN_Startup (); PM_Startup (); SD_Startup (); fprint(show_text1); fprint(show_text2); fprint(show_text3); fprint(show_text5); printf(" Mouse: %s\n",avail[MousePresent]); printf(" Joystick: %s\n",avail[JoysPresent[0]||JoysPresent[1]]); printf(" AdLib: %s\n",avail[AdLibPresent&&!SoundBlasterPresent]); printf("Sound Blaster: %s\n",avail[SoundBlasterPresent]); printf(" Sound Source: %s\n\n",avail[SoundSourcePresent]); fprint(show_text2); SD_Shutdown (); PM_Shutdown (); IN_Shutdown (); CA_Shutdown (); MM_Shutdown (); }
void ShutdownId (void) { US_Shutdown (); SD_Shutdown (); IN_Shutdown (); RF_Shutdown (); VW_Shutdown (); CA_Shutdown (); MM_Shutdown (); }
void ShutdownId (void) { US_Shutdown (); #ifndef PROFILE SD_Shutdown (); IN_Shutdown (); #endif VW_Shutdown (); CA_Shutdown (); MM_Shutdown (); }
/* * Shutdown all of the 'ID Engine' components */ void CK_ShutdownID(void) { //TODO: Some managers don't have shutdown implemented yet VL_DestroySurface(ck_statusSurface); US_Shutdown(); SD_Shutdown(); //IN RF_Shutdown(); //VH VL_Shutdown(); CA_Shutdown(); MM_Shutdown(); SDL_Quit(); }
//------------------------------------------------------------------------- // BadChecksum() //------------------------------------------------------------------------- void BadChecksum() { char *chunkptr; CA_CacheGrChunk(BADCHECKSUMTEXT); chunkptr = grsegs[BADCHECKSUMTEXT]; *(_fstrstr(chunkptr,"^XX")) = 0; CA_Shutdown(); MM_Shutdown(); fprint(chunkptr); exit(0); }
/* * Com_Error * * Both client and server can use this, and it will * do the apropriate things. */ void Com_Error( com_error_code_t code, const char *format, ... ) { va_list argptr; char *msg = com_errormsg; const size_t sizeof_msg = sizeof( com_errormsg ); static qboolean recursive = qfalse; if( recursive ) { Com_Printf( "recursive error after: %s", msg ); // wsw : jal : log it Sys_Error( "recursive error after: %s", msg ); } recursive = qtrue; va_start( argptr, format ); Q_vsnprintfz( msg, sizeof_msg, format, argptr ); va_end( argptr ); if( code == ERR_DROP ) { Com_Printf( "********************\nERROR: %s\n********************\n", msg ); SV_ShutdownGame( va( "Server crashed: %s\n", msg ), qfalse ); CL_Disconnect( msg ); recursive = qfalse; longjmp( abortframe, -1 ); } else { Com_Printf( "********************\nERROR: %s\n********************\n", msg ); SV_Shutdown( va( "Server fatal crashed: %s\n", msg ) ); CL_Shutdown(); MM_Shutdown(); } if( log_file ) { FS_FCloseFile( log_file ); log_file = 0; } Sys_Error( "%s", msg ); }
void MM_Startup (void) { id0_int_t i; id0_unsigned_long_t length; //void id0_far *start; id0_unsigned_t segstart,seglength,endfree; if (mmstarted) MM_Shutdown (); mmstarted = true; bombonerror = true; // // set up the linked list (everything in the free list) // mmhead = NULL; mmfree = &mmblocks[0]; for (i=0; i<MAXBLOCKS-1; i++) mmblocks[i].next = &mmblocks[i+1]; mmblocks[i].next = NULL; // // get all available near conventional memory segments // length = EMULATED_NEAR_PARAGRAPHS*16 - SAVENEARHEAP; seglength = length / 16; // now in paragraphs segstart = EMULATED_NEAR_SEG; mminfo.nearheap = length; #if 0 length=coreleft(); start = (void id0_far *)(nearheap = malloc(length)); length -= 16-(FP_OFF(start)&15); length -= SAVENEARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; mminfo.nearheap = length; #endif // locked block of unusable low memory // from 0 to start of near heap // Formerly known as GETNEWBLOCK if( !(mmnew=mmfree) ) { Quit("MM_GETNEWBLOCK: No free blocks!"); } mmfree=mmfree->next; // fill in start and next after a spot is found mmhead = mmnew; // this will always be the first node mmnew->start = 0; mmnew->length = segstart; mmnew->attributes = LOCKBIT; endfree = segstart+seglength; mmrover = mmhead; // // get all available far conventional memory segments // length = EMULATED_FAR_PARAGRAPHS*16 - SAVEFARHEAP; seglength = length / 16; // now in paragraphs segstart = EMULATED_FAR_SEG; mminfo.farheap = length; mminfo.mainmem = mminfo.nearheap + mminfo.farheap; #if 0 length=farcoreleft(); start = farheap = farmalloc(length); length -= 16-(FP_OFF(start)&15); length -= SAVEFARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; mminfo.farheap = length; mminfo.mainmem = mminfo.nearheap + mminfo.farheap; #endif // locked block of unusable near heap memory (usually just the stack) // from end of near heap to start of far heap // Formerly known as GETNEWBLOCK if( !(mmnew=mmfree) ) { Quit("MM_GETNEWBLOCK: No free blocks!"); } mmfree=mmfree->next; // fill in start and next after a spot is found mmnew->start = endfree; mmnew->length = segstart-endfree; mmnew->attributes = LOCKBIT; mmrover->next = mmnew; endfree = segstart+seglength; mmrover = mmnew; // // detect EMS and allocate 64K at page frame // mminfo.EMSmem = 0x10000; // Looks unused #if 0 if (MML_CheckForEMS()) { MM_MapEMS(); // map in used pages mminfo.EMSmem = 0x10000l; } else { mminfo.EMSmem = 0; } #endif // // detect XMS and get upper memory blocks // mminfo.XMSmem = 0; // Unused #if 0 if (MML_CheckForXMS()) { } else { mminfo.XMSmem = 0; } #endif // // cap off the list // // locked block of high memory (video, rom, etc) // from end of far heap or EMS/XMS to 0xffff // Formerly known as GETNEWBLOCK if( !(mmnew=mmfree) ) { Quit("MM_GETNEWBLOCK: No free blocks!"); } mmfree=mmfree->next; // fill in start and next after a spot is found mmnew->start = endfree; mmnew->length = 0xffff-endfree; mmnew->attributes = LOCKBIT; mmnew->next = NULL; mmrover->next = mmnew; // // allocate the misc buffer // mmrover = mmhead; // start looking for space after low block MM_GetPtr (&bufferseg,BUFFERSIZE); }
//------------------------------------------------------------------------ // InitGame() //------------------------------------------------------------------------ void InitGame (void) { Sint16 i,x,y; Uint16 *blockstart; //long mmsize; MM_Startup (); // so the signon screen can be freed #if IN_DEVELOPMENT || GEORGE_CHEAT || SHOW_CHECKSUM if (MS_CheckParm("checksum")) { ShowChecksums(); MM_Shutdown(); exit(0); } #endif CA_Startup (); // Any problems with this version of the game? // #if IN_DEVELOPMENT || TECH_SUPPORT_VERSION if (!MS_CheckParm("nochex")) #endif #if !SKIP_CHECKSUMS CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM); #if GAME_VERSION != SHAREWARE_VERSION if (ChecksumFile("FILE_ID.DIZ",0) != DIZFILE_CHECKSUM) gamestate.flags |= GS_BAD_DIZ_FILE; #endif #endif VL_SetVGAPlaneMode (); VL_SetPalette (0,256,vgapal); VW_Startup (); IN_Startup (); PM_Startup (); SD_Startup (); US_Startup (); if (CheckForSpecialCode(POWERBALLTEXT)) #if IN_DEVELOPMENT DebugOk = true; #else PowerBall = true; #endif if (CheckForSpecialCode(TICSTEXT)) gamestate.flags |= GS_TICS_FOR_SCORE; if (CheckForSpecialCode(MUSICTEXT)) gamestate.flags |= GS_MUSIC_TEST; if (CheckForSpecialCode(RADARTEXT)) gamestate.flags |= GS_SHOW_OVERHEAD; #if IN_DEVELOPMENT // // Clear Monocrome // _fmemset(MK_FP(0xb000,0x0000),0,4000); #endif // // build some tables // InitDigiMap (); for (i=0;i<MAPSIZE;i++) { nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i; farmapylookup[i] = i*64; } for (i=0;i<PORTTILESHIGH;i++) uwidthtable[i] = UPDATEWIDE*i; blockstart = &blockstarts[0]; for (y=0;y<UPDATEHIGH;y++) for (x=0;x<UPDATEWIDE;x++) *blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH; updateptr = &update[0]; bufferofs = 0; displayofs = 0; ReadConfig (); // // draw intro screen stuff // // if (!(gamestate.flags & GS_QUICKRUN)) // IntroScreen (); // // load in and lock down some basic chunks // LoadFonts(); LoadLatchMem (); BuildTables (); // trig tables SetupWalls (); NewViewSize (); // // initialize variables // InitRedShifts (); }