// turn credits on void Credits_On(INDEX iType) { if (_bCreditsOn) { Credits_Off(); } _astrCredits.PopAll(); if (iType==1) { _fSpeed = 1.0f; LoadOneFile(CTFILENAME("Data\\Intro.txt")); } else if (iType==2) { _fSpeed = 2.0f; LoadOneFile(CTFILENAME("Data\\Credits.txt")); LoadOneFile(CTFILENAME("Data\\Credits_End.txt")); } else { _fSpeed = 2.0f; #if _SE_DEMO || TECHTESTONLY LoadOneFile(CTFILENAME("Data\\Credits_Demo.txt")); #else LoadOneFile(CTFILENAME("Data\\Credits.txt")); #endif } // if some file was loaded if (_bCreditsOn) { // remember start time if (iType==1 || iType==2) { _bUseRealTime = FALSE; _tmStart = _pTimer->GetLerpedCurrentTick(); } else { _bUseRealTime = TRUE; _tvStart = _pTimer->GetHighPrecisionTimer(); } } }
// game options var settings void StartVarGameOptions(void) { CVarMenu &gmCurrent = _pGUIM->gmVarMenu; gmCurrent.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); gmCurrent.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); ChangeToMenu(&gmCurrent); }
// rendering options var settings void StartRenderingOptionsMenu(void) { CVarMenu &gmCurrent = _pGUIM->gmVarMenu; gmCurrent.gm_mgTitle.mg_strText = TRANS("RENDERING OPTIONS"); gmCurrent.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg"); gmCurrent.gm_pgmParentMenu = &_pGUIM->gmVideoOptionsMenu; ChangeToMenu(&gmCurrent); }
void StartSinglePlayerGameOptions(void) { CVarMenu &gmCurrent = _pGUIM->gmVarMenu; gmCurrent.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); gmCurrent.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg"); gmCurrent.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; ChangeToMenu(&gmCurrent); }
void InitStreams(void) { // obtain information about system // !!! FIXME: Move this into an abstraction of some sort... #ifdef PLATFORM_WIN32 SYSTEM_INFO siSystemInfo; GetSystemInfo( &siSystemInfo); // and remember page size _ulPageSize = siSystemInfo.dwPageSize*16; // cca. 64kB on WinNT/Win95 #else _ulPageSize = PAGESIZE; #endif // keep a copy of path for setting purposes _fnmApp = _fnmApplicationPath; // if no mod defined yet if (_fnmMod=="") { // check for 'default mod' file LoadStringVar(CTString("DefaultMod.txt"), _fnmMod); } CPrintF(TRANSV("Current mod: %s\n"), (_fnmMod=="") ? TRANS("<none>") : (const char *) (CTString&)_fnmMod); // if there is a mod active if (_fnmMod!="") { // load mod's include/exclude lists CPrintF(TRANSV("Loading mod include/exclude lists...\n")); BOOL bOK = FALSE; bOK |= LoadFileList(_afnmBaseWriteInc , CTString("BaseWriteInclude.lst")); bOK |= LoadFileList(_afnmBaseWriteExc , CTString("BaseWriteExclude.lst")); bOK |= LoadFileList(_afnmBaseBrowseInc, CTString("BaseBrowseInclude.lst")); bOK |= LoadFileList(_afnmBaseBrowseExc, CTString("BaseBrowseExclude.lst")); // if none found if (!bOK) { // the mod is not valid _fnmMod = CTString(""); CPrintF(TRANSV("Error: MOD not found!\n")); // if mod is ok } else { // remember mod name (the parameter that is passed on cmdline) _strModName = _fnmMod; _strModName.DeleteChar(_strModName.Length()-1); _strModName = CTFileName(_strModName).FileName(); } } // find eventual extension for the mod's dlls _strModExt = ""; LoadStringVar(CTString("ModExt.txt"), _strModExt); CPrintF(TRANSV("Loading group files...\n")); CDynamicArray<CTString> *files = NULL; // for each group file in base directory files = _pFileSystem->FindFiles(_fnmApplicationPath, "*.gro"); int max = files->Count(); int i; // for each .gro file in the directory for (i = 0; i < max; i++) { // add it to active set UNZIPAddArchive( _fnmApplicationPath+((*files)[i]) ); } delete files; // if there is a mod active if (_fnmMod!="") { // for each group file in mod directory files = _pFileSystem->FindFiles(_fnmApplicationPath+_fnmMod, "*.gro"); max = files->Count(); for (i = 0; i < max; i++) { UNZIPAddArchive( _fnmApplicationPath + _fnmMod + ((*files)[i]) ); } delete files; } // if there is a CD path if (_fnmCDPath!="") { // for each group file on the CD files = _pFileSystem->FindFiles(_fnmCDPath, "*.gro"); max = files->Count(); for (i = 0; i < max; i++) { UNZIPAddArchive( _fnmCDPath + ((*files)[i]) ); } delete files; // if there is a mod active if (_fnmMod!="") { // for each group file in mod directory files = _pFileSystem->FindFiles(_fnmCDPath+_fnmMod, "*.gro"); max = files->Count(); for (i = 0; i < max; i++) { UNZIPAddArchive( _fnmCDPath + _fnmMod + ((*files)[i]) ); } delete files; } } // try to try { // read the zip directories UNZIPReadDirectoriesReverse_t(); // if failed } catch( char *strError) { // report warning CPrintF( TRANS("There were group file errors:\n%s"), strError); } CPrintF("\n"); const char *dirsep = CFileSystem::GetDirSeparator(); LoadFileList(_afnmNoCRC, CTFILENAME("Data") + CTString(dirsep) + CTString("NoCRC.lst")); _pShell->SetINDEX(CTString("sys")+"_iCPU"+"Misc", 1); }
static void LoadingHook_t(CProgressHookInfo *pphi) { // if user presses escape ULONG ulCheckFlags = 0x8000; if (pphi->phi_fCompleted>0) { ulCheckFlags |= 0x0001; } if (_bUserBreakEnabled && (GetAsyncKeyState(VK_ESCAPE)&ulCheckFlags)) { // break loading throw TRANS("User break!"); } #if USECUSTOMTEXT // if no custom loading text if (_strCustomText=="") { // load it try { _strCustomText.Load_t(CTFILENAME("Data\\LoadingText.txt")); } catch (char *strError) { _strCustomText = strError; } } #endif // measure time since last call static CTimerValue tvLast(0I64); CTimerValue tvNow = _pTimer->GetHighPrecisionTimer(); // if not first or final update, and not enough time passed if (pphi->phi_fCompleted!=0 && pphi->phi_fCompleted!=1 && (tvNow-tvLast).GetSeconds() < REFRESHTIME) { // do nothing return; } tvLast = tvNow; // skip if cannot lock drawport CDrawPort *pdp = _pdpLoadingHook; ASSERT(pdp!=NULL); CDrawPort dpHook(pdp, TRUE); if( !dpHook.Lock()) return; // clear screen dpHook.Fill(C_BLACK|255); // get session properties currently loading CSessionProperties *psp = (CSessionProperties *)_pNetwork->GetSessionProperties(); ULONG ulLevelMask = psp->sp_ulLevelsMask; if (psp->sp_bCooperative) { INDEX iLevel = -1; INDEX iLevelNext = -1; CTString strLevelName = _pNetwork->ga_fnmWorld.FileName(); CTString strNextLevelName = _pNetwork->ga_fnmNextLevel.FileName(); // second encounter INDEX u, v; u = v = -1; strLevelName.ScanF("%01d_%01d_", &u, &v); iLevel = u*10+v; RemapLevelNames(iLevel); u = v = -1; strNextLevelName.ScanF("%01d_%01d_", &u, &v); iLevelNext = u*10+v; RemapLevelNames(iLevelNext); // first encounter if(iLevel == -1) { strLevelName.ScanF("%02d_", &iLevel); strNextLevelName.ScanF("%02d_", &iLevelNext); if(iLevel != -1) { map_bIsFirstEncounter = TRUE; } } else { map_bIsFirstEncounter = FALSE; } if (iLevel>0) { ulLevelMask|=1<<(iLevel-1); } if (iLevelNext>0) { ulLevelMask|=1<<(iLevelNext-1); } } if (ulLevelMask!=0 && !_pNetwork->IsPlayingDemo()) { // map hook extern void RenderMap( CDrawPort *pdp, ULONG ulLevelMask, CProgressHookInfo *pphi); RenderMap(&dpHook, ulLevelMask, pphi); // finish rendering dpHook.Unlock(); dpHook.dp_Raster->ra_pvpViewPort->SwapBuffers(); // keep current time tvLast = _pTimer->GetHighPrecisionTimer(); return; } // get sizes PIX pixSizeI = dpHook.GetWidth(); PIX pixSizeJ = dpHook.GetHeight(); CFontData *pfd = _pfdConsoleFont; PIX pixCharSizeI = pfd->fd_pixCharWidth + pfd->fd_pixCharSpacing; PIX pixCharSizeJ = pfd->fd_pixCharHeight + pfd->fd_pixLineSpacing; PIX pixBarSizeJ = 17;//*pixSizeJ/480; COLOR colBcg = LerpColor(C_BLACK, SE_COL_BLUE_LIGHT, 0.30f)|0xff; COLOR colBar = LerpColor(C_BLACK, SE_COL_BLUE_LIGHT, 0.45f)|0xff; COLOR colLines = colBar; //C_vdGREEN|0xff; COLOR colText = LerpColor(C_BLACK, SE_COL_BLUE_LIGHT, 0.95f)|0xff; COLOR colEsc = C_WHITE|0xFF; dpHook.Fill(0, pixSizeJ-pixBarSizeJ, pixSizeI, pixBarSizeJ, colBcg); dpHook.Fill(0, pixSizeJ-pixBarSizeJ, pixSizeI*pphi->phi_fCompleted, pixBarSizeJ, colBar); dpHook.DrawBorder(0, pixSizeJ-pixBarSizeJ, pixSizeI, pixBarSizeJ, colLines); dpHook.SetFont( _pfdConsoleFont); dpHook.SetTextScaling( 1.0f); dpHook.SetTextAspect( 1.0f); // print status text setlocale(LC_ALL, ""); CTString strDesc(0, "%s", pphi->phi_strDescription); strupr((char*)(const char*)strDesc); setlocale(LC_ALL, "C"); CTString strPerc(0, "%3.0f%%", pphi->phi_fCompleted*100); //dpHook.PutText(strDesc, pixCharSizeI/2, pixSizeJ-pixBarSizeJ-2-pixCharSizeJ, C_GREEN|255); //dpHook.PutTextCXY(strPerc, pixSizeI/2, pixSizeJ-pixBarSizeJ/2+1, C_GREEN|255); dpHook.PutText(strDesc, pixCharSizeI/2, pixSizeJ-pixBarSizeJ+pixCharSizeJ/2, colText); dpHook.PutTextR(strPerc, pixSizeI-pixCharSizeI/2, pixSizeJ-pixBarSizeJ+pixCharSizeJ/2, colText); if (_bUserBreakEnabled && !_pGame->gm_bFirstLoading) { dpHook.PutTextC( TRANS( "PRESS ESC TO ABORT"), pixSizeI/2, pixSizeJ-pixBarSizeJ-2-pixCharSizeJ, colEsc); } /* //LCDPrepare(1.0f); //LCDSetDrawport(&dpHook); // fill the box with background dirt and grid //LCDRenderClouds1(); //LCDRenderGrid(); // draw progress bar PIX pixBarCentI = pixBoxSizeI*1/2; PIX pixBarCentJ = pixBoxSizeJ*3/4; PIX pixBarSizeI = pixBoxSizeI*7/8; PIX pixBarSizeJ = pixBoxSizeJ*3/8; PIX pixBarMinI = pixBarCentI-pixBarSizeI/2; PIX pixBarMaxI = pixBarCentI+pixBarSizeI/2; PIX pixBarMinJ = pixBarCentJ-pixBarSizeJ/2; PIX pixBarMaxJ = pixBarCentJ+pixBarSizeJ/2; dpBox.Fill(pixBarMinI, pixBarMinJ, pixBarMaxI-pixBarMinI, pixBarMaxJ-pixBarMinJ, C_BLACK|255); dpBox.Fill(pixBarMinI, pixBarMinJ, (pixBarMaxI-pixBarMinI)*pphi->phi_fCompleted, pixBarMaxJ-pixBarMinJ, C_GREEN|255); // put more dirt LCDRenderClouds2Light(); // draw borders COLOR colBorders = LerpColor(C_GREEN, C_BLACK, 200); LCDDrawBox(0,-1, PIXaabbox2D( PIX2D(pixBarMinI, pixBarMinJ), PIX2D(pixBarMaxI, pixBarMaxJ)), colBorders|255); LCDDrawBox(0,-1, PIXaabbox2D( PIX2D(0,0), PIX2D(dpBox.GetWidth(), dpBox.GetHeight())), colBorders|255); // print status text dpBox.SetFont( _pfdDisplayFont); dpBox.SetTextScaling( 1.0f); dpBox.SetTextAspect( 1.0f); // print status text CTString strRes; strRes.PrintF( "%s", pphi->phi_strDescription); //strupr((char*)(const char*)strRes); dpBox.PutTextC( strRes, 160, 17, C_GREEN|255); strRes.PrintF( "%3.0f%%", pphi->phi_fCompleted*100); dpBox.PutTextCXY( strRes, pixBarCentI, pixBarCentJ, C_GREEN|255); dpBox.Unlock(); if( Flesh.gm_bFirstLoading) { #if USECUSTOMTEXT FLOAT fScaling = (FLOAT)slSizeI/640.0f; dpHook.Lock(); dpHook.SetFont( _pfdDisplayFont); dpHook.SetTextScaling( fScaling); dpHook.SetTextAspect( 1.0f); //dpHook.Fill( 0, 0, slSizeI, pixCenterJ, C_vdGREEN|255, C_vdGREEN|255, C_vdGREEN|0, C_vdGREEN|0); dpHook.PutTextC( TRANS( "SERIOUS SAM - TEST VERSION"), pixCenterI, 5*fScaling, C_WHITE|255); dpHook.PutTextC( TRANS( "THIS IS NOT A DEMO VERSION, THIS IS A COMPATIBILITY TEST!"), pixCenterI, 25*fScaling, C_WHITE|255); dpHook.PutTextC( TRANS( "Serious Sam (c) 2000 Croteam LLC, All Rights Reserved.\n"), pixCenterI, 45*fScaling, C_WHITE|255); dpHook.PutText( _strCustomText, 1*fScaling, 85*fScaling, C_GREEN|255); dpHook.Unlock(); #endif } else if (_bUserBreakEnabled) { FLOAT fScaling = (FLOAT)slSizeI/640.0f; dpHook.Lock(); dpHook.SetFont( _pfdDisplayFont); dpHook.SetTextScaling( fScaling); dpHook.SetTextAspect( 1.0f); //dpHook.Fill( 0, 0, slSizeI, pixCenterJ, C_vdGREEN|255, C_vdGREEN|255, C_vdGREEN|0, C_vdGREEN|0); dpHook.PutTextC( TRANS( "PRESS ESC TO ABORT"), pixCenterI, pixCenterJ+pixBoxSizeJ+5*fScaling, C_WHITE|255); } */ dpHook.Unlock(); // finish rendering dpHook.dp_Raster->ra_pvpViewPort->SwapBuffers(); // keep current time tvLast = _pTimer->GetHighPrecisionTimer(); }
BOOL Init(int argc, char* argv[]) { _bDedicatedServer = TRUE; if (argc!=1+1 && argc!=2+1) { // NOTE: this cannot be translated - translations are not loaded yet printf("Usage: DedicatedServer <configname> [<modname>]\n" "This starts a server reading configs from directory 'Scripts\\Dedicated\\<configname>\\'\n"); getch(); exit(0); } SetConsoleTitleA(argv[1]); ded_strConfig = CTString("Scripts\\Dedicated\\")+argv[1]+"\\"; if (argc==2+1) { _fnmMod = CTString("Mods\\")+argv[2]+"\\"; } _strLogFile = CTString("Dedicated_")+argv[1]; // initialize engine SE_InitEngine(sam_strGameName); // ParseCommandLine(strCmdLine); // load all translation tables InitTranslation(); CTFileName fnmTransTable; try { fnmTransTable = CTFILENAME("Data\\Translations\\Engine.txt"); AddTranslationTable_t(fnmTransTable); fnmTransTable = CTFILENAME("Data\\Translations\\Game.txt"); AddTranslationTable_t(fnmTransTable); fnmTransTable = CTFILENAME("Data\\Translations\\Entities.txt"); AddTranslationTable_t(fnmTransTable); fnmTransTable = CTFILENAME("Data\\Translations\\SeriousSam.txt"); AddTranslationTable_t(fnmTransTable); fnmTransTable = CTFILENAME("Data\\Translations\\Levels.txt"); AddTranslationTable_t(fnmTransTable); FinishTranslationTable(); } catch (char *strError) { FatalError("%s %s", CTString(fnmTransTable), strError); } // always disable all warnings when in serious sam _pShell->Execute( "con_bNoWarnings=1;"); // declare shell symbols _pShell->DeclareSymbol("persistent user INDEX ded_iMaxFPS;", &ded_iMaxFPS); _pShell->DeclareSymbol("user void Quit(void);", &QuitGame); _pShell->DeclareSymbol("user CTString ded_strLevel;", &ded_strLevel); _pShell->DeclareSymbol("user FLOAT ded_tmTimeout;", &ded_tmTimeout); _pShell->DeclareSymbol("user INDEX ded_bRestartWhenEmpty;", &ded_bRestartWhenEmpty); _pShell->DeclareSymbol("user void Restart(void);", &RestartGame); _pShell->DeclareSymbol("user void NextMap(void);", &NextMap); _pShell->DeclareSymbol("persistent user CTString sam_strIntroLevel;", &sam_strIntroLevel); _pShell->DeclareSymbol("persistent user CTString sam_strGameName;", &sam_strGameName); _pShell->DeclareSymbol("user CTString sam_strFirstLevel;", &sam_strFirstLevel); // init game - this will load persistent symbols InitializeGame(); _pNetwork->md_strGameID = sam_strGameName; LoadStringVar(CTString("Data\\Var\\Sam_Version.var"), _strSamVersion); CPrintF(TRANS("Serious Sam version: %s\n"), _strSamVersion); SetConsoleCtrlHandler(HandlerRoutine, TRUE); // if there is a mod if (_fnmMod!="") { // execute the mod startup script _pShell->Execute(CTString("include \"Scripts\\Mod_startup.ini\";")); } return TRUE; }
void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer) { CPlayerCharacter &pc = _pGame->gm_apcPlayers[iPlayer]; for (INDEX iPl = 0; iPl<8; iPl++) { gm_mgNumber[iPl].mg_bHighlighted = FALSE; } gm_mgNumber[iPlayer].mg_bHighlighted = TRUE; iPlayer = Clamp(iPlayer, INDEX(0), INDEX(7)); if (_iLocalPlayer >= 0 && _iLocalPlayer<4) { _pGame->gm_aiMenuLocalPlayers[_iLocalPlayer] = iPlayer; } else { _pGame->gm_iSinglePlayer = iPlayer; } gm_mgNameField.mg_pstrToChange = &pc.pc_strName; gm_mgNameField.SetText(*gm_mgNameField.mg_pstrToChange); gm_mgTeam.mg_pstrToChange = &pc.pc_strTeam; gm_mgTeam.SetText(*gm_mgTeam.mg_pstrToChange); CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance; gm_mgCrosshair.mg_iSelected = pps->ps_iCrossHairType + 1; gm_mgCrosshair.ApplyCurrentSelection(); gm_mgWeaponSelect.mg_iSelected = pps->ps_iWeaponAutoSelect; gm_mgWeaponSelect.ApplyCurrentSelection(); gm_mgWeaponHide.mg_iSelected = (pps->ps_ulFlags&PSF_HIDEWEAPON) ? 1 : 0; gm_mgWeaponHide.ApplyCurrentSelection(); gm_mg3rdPerson.mg_iSelected = (pps->ps_ulFlags&PSF_PREFER3RDPERSON) ? 1 : 0; gm_mg3rdPerson.ApplyCurrentSelection(); gm_mgQuotes.mg_iSelected = (pps->ps_ulFlags&PSF_NOQUOTES) ? 0 : 1; gm_mgQuotes.ApplyCurrentSelection(); gm_mgAutoSave.mg_iSelected = (pps->ps_ulFlags&PSF_AUTOSAVE) ? 1 : 0; gm_mgAutoSave.ApplyCurrentSelection(); gm_mgCompDoubleClick.mg_iSelected = (pps->ps_ulFlags&PSF_COMPSINGLECLICK) ? 0 : 1; gm_mgCompDoubleClick.ApplyCurrentSelection(); gm_mgViewBobbing.mg_iSelected = (pps->ps_ulFlags&PSF_NOBOBBING) ? 0 : 1; gm_mgViewBobbing.ApplyCurrentSelection(); gm_mgSharpTurning.mg_iSelected = (pps->ps_ulFlags&PSF_SHARPTURNING) ? 1 : 0; gm_mgSharpTurning.ApplyCurrentSelection(); // get function that will set player appearance CShellSymbol *pss = _pShell->GetSymbol("SetPlayerAppearance", /*bDeclaredOnly=*/ TRUE); // if none if (pss == NULL) { // no model gm_mgModel.mg_moModel.SetData(NULL); // if there is some } else { // set the model BOOL(*pFunc)(CModelObject *, CPlayerCharacter *, CTString &, BOOL) = (BOOL(*)(CModelObject *, CPlayerCharacter *, CTString &, BOOL))pss->ss_pvValue; CTString strName; BOOL bSet; if (_gmRunningGameMode != GM_SINGLE_PLAYER && !_bPlayerMenuFromSinglePlayer) { bSet = pFunc(&gm_mgModel.mg_moModel, &pc, strName, TRUE); gm_mgModel.mg_strTip = TRANS("change model for this player"); gm_mgModel.mg_bEnabled = TRUE; } else { // cannot change player appearance in single player mode bSet = pFunc(&gm_mgModel.mg_moModel, NULL, strName, TRUE); gm_mgModel.mg_strTip = TRANS("cannot change model for single-player game"); gm_mgModel.mg_bEnabled = FALSE; } // ignore gender flags, if any strName.RemovePrefix("#female#"); strName.RemovePrefix("#male#"); gm_mgModel.mg_plModel = CPlacement3D(FLOAT3D(0.1f, -1.0f, -3.5f), ANGLE3D(150, 0, 0)); gm_mgModel.mg_strText = strName; CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance; _strLastPlayerAppearance = pps->GetModelFilename(); try { gm_mgModel.mg_moFloor.SetData_t(CTFILENAME("Models\\Computer\\Floor.mdl")); gm_mgModel.mg_moFloor.mo_toTexture.SetData_t(CTFILENAME("Models\\Computer\\Floor.tex")); } catch (char *strError) { (void)strError; } } }