// // P_SetupLevel // void P_SetupLevel ( int episode, int map, int playermask, skill_t skill) { int i; char lumpname[9]; int lumpnum; totalkills = totalitems = totalsecret = wminfo.maxfrags = 0; wminfo.partime = 180; for (i=0 ; i<MAXPLAYERS ; i++) { players[i].killcount = players[i].secretcount = players[i].itemcount = 0; } // Initial height of PointOfView // will be set by player think. players[consoleplayer].viewz = 1; // Make sure all sounds are stopped before Z_FreeTags. S_Start (); #if 0 // UNUSED if (debugfile) { Z_FreeTags (PU_LEVEL, MAXINT); Z_FileDumpHeap (debugfile); } else #endif Z_FreeTags (PU_LEVEL, PU_PURGELEVEL-1); // UNUSED W_Profile (); P_InitThinkers (); // if working with a devlopment map, reload it W_Reload (); // find map name if ( gamemode == commercial) { if (map<10) sprintf (lumpname,"map0%i", map); else sprintf (lumpname,"map%i", map); } else { lumpname[0] = 'E'; lumpname[1] = '0' + episode; lumpname[2] = 'M'; lumpname[3] = '0' + map; lumpname[4] = 0; } lumpnum = W_GetNumForName (lumpname); leveltime = 0; // note: most of this ordering is important P_LoadBlockMap (lumpnum+ML_BLOCKMAP); P_LoadVertexes (lumpnum+ML_VERTEXES); P_LoadSectors (lumpnum+ML_SECTORS); P_LoadSideDefs (lumpnum+ML_SIDEDEFS); P_LoadLineDefs (lumpnum+ML_LINEDEFS); P_LoadSubsectors (lumpnum+ML_SSECTORS); P_LoadNodes (lumpnum+ML_NODES); P_LoadSegs (lumpnum+ML_SEGS); rejectmatrix = W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL); P_GroupLines (); bodyqueslot = 0; deathmatch_p = deathmatchstarts; P_LoadThings (lumpnum+ML_THINGS); // if deathmatch, randomly spawn the active players if (deathmatch) { for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) { players[i].mo = NULL; G_DeathMatchSpawnPlayer (i); } } // clear special respawning que iquehead = iquetail = 0; // set up world state P_SpawnSpecials (); // build subsector connect matrix // UNUSED P_ConnectSubsectors (); // preload graphics if (precache) R_PrecacheLevel (); //printf ("free memory: 0x%x\n", Z_FreeMemory()); }
void D_DoomMain(void) { GameMission_t gamemission; int p; I_AtExit(D_HexenQuitMessage, false); startepisode = 1; autostart = false; startskill = sk_medium; startmap = 1; gamemode = commercial; I_PrintBanner(PACKAGE_STRING); // Initialize subsystems ST_Message("V_Init: allocate screens.\n"); V_Init(); // Load defaults before initing other systems ST_Message("M_LoadDefaults: Load system defaults.\n"); D_BindVariables(); #ifdef _WIN32 //! // @platform windows // @vanilla // // Save configuration data and savegames in c:\hexndata, // allowing play from CD. // cdrom = M_ParmExists("-cdrom"); #endif if (cdrom) { M_SetConfigDir("c:\\hexndata\\"); } else { M_SetConfigDir(NULL); } D_SetDefaultSavePath(); M_SetConfigFilenames("hexen.cfg", PROGRAM_PREFIX "hexen.cfg"); M_LoadDefaults(); I_AtExit(M_SaveDefaults, false); // Now that the savedir is loaded from .CFG, make sure it exists CreateSavePath(); ST_Message("Z_Init: Init zone memory allocation daemon.\n"); Z_Init(); // haleyjd: removed WATCOMC ST_Message("W_Init: Init WADfiles.\n"); iwadfile = D_FindIWAD(IWAD_MASK_HEXEN, &gamemission); if (iwadfile == NULL) { I_Error("Game mode indeterminate. No IWAD was found. Try specifying\n" "one with the '-iwad' command line parameter."); } D_AddFile(iwadfile); W_CheckCorrectIWAD(hexen); D_IdentifyVersion(); D_SetGameDescription(); AdjustForMacIWAD(); HandleArgs(); I_PrintStartupBanner(gamedescription); ST_Message("MN_Init: Init menu system.\n"); MN_Init(); ST_Message("CT_Init: Init chat mode data.\n"); CT_Init(); InitMapMusicInfo(); // Init music fields in mapinfo ST_Message("S_InitScript\n"); S_InitScript(); ST_Message("SN_InitSequenceScript: Registering sound sequences.\n"); SN_InitSequenceScript(); ST_Message("I_Init: Setting up machine state.\n"); I_CheckIsScreensaver(); I_InitTimer(); I_InitJoystick(); I_InitSound(false); I_InitMusic(); #ifdef FEATURE_MULTIPLAYER ST_Message("NET_Init: Init networking subsystem.\n"); NET_Init(); #endif D_ConnectNetGame(); S_Init(); S_Start(); ST_Message("ST_Init: Init startup screen.\n"); ST_Init(); // Show version message now, so it's visible during R_Init() ST_Message("R_Init: Init Hexen refresh daemon"); R_Init(); ST_Message("\n"); //if (M_CheckParm("-net")) // ST_NetProgress(); // Console player found ST_Message("P_Init: Init Playloop state.\n"); P_Init(); // Check for command line warping. Follows P_Init() because the // MAPINFO.TXT script must be already processed. WarpCheck(); ST_Message("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame(); ST_Message("SB_Init: Loading patches.\n"); SB_Init(); ST_Done(); if (autostart) { ST_Message("Warp to Map %d (\"%s\":%d), Skill %d\n", WarpMap, P_GetMapName(startmap), startmap, startskill + 1); } CheckRecordFrom(); p = M_CheckParm("-record"); if (p && p < myargc - 1) { G_RecordDemo(startskill, 1, startepisode, startmap, myargv[p + 1]); H2_GameLoop(); // Never returns } p = M_CheckParmWithArgs("-playdemo", 1); if (p) { singledemo = true; // Quit after one demo G_DeferedPlayDemo(demolumpname); H2_GameLoop(); // Never returns } p = M_CheckParmWithArgs("-timedemo", 1); if (p) { G_TimeDemo(demolumpname); H2_GameLoop(); // Never returns } //! // @arg <s> // @vanilla // // Load the game in savegame slot s. // p = M_CheckParmWithArgs("-loadgame", 1); if (p) { G_LoadGame(atoi(myargv[p + 1])); } if (gameaction != ga_loadgame) { UpdateState |= I_FULLSCRN; BorderNeedRefresh = true; if (autostart || netgame) { G_StartNewInit(); G_InitNew(startskill, startepisode, startmap); } else { H2_StartTitle(); } } H2_GameLoop(); // Never returns }
//--------------------------------------------------------------------------- void WRITE_TAG(void) { S_Start(); S_PutcGetc(0xC0, 3); SDIN=0; }
//--------------------------------------------------------------------------- void Send_HTRC110_Cmd(u8 RcCmd) { S_Start(); //启动信号 S_PutcGetc(RcCmd, 8); }
//--------------------------------------------------------------------------- void READ_TAG(void) { S_Start(); S_PutcGetc(0xE0, 3); SDIN=0; }