bool C4MainMenu::ActivateDisplay(int32_t iPlayer, int32_t selection) { // Menu symbol/init InitRefSym(GfxR->fctMenu.GetPhase(8), LoadResStr("IDS_MENU_DISPLAY"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Crew player names AddRefSym(LoadResStr("IDS_MNU_PLAYERNAMES"), GfxR->fctOptions.GetPhase(7 + Config.Graphics.ShowCrewNames), "Display:PlayerNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_PLAYERNAMES_DESC")); // Crew clonk names AddRefSym(LoadResStr("IDS_MNU_CLONKNAMES"), GfxR->fctOptions.GetPhase(9 + Config.Graphics.ShowCrewCNames), "Display:ClonkNames", C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CLONKNAMES_DESC")); // Upper Board if (!Application.isEditor) { AddRefSym(LoadResStr("IDS_MNU_UPPERBOARD"),GfxR->fctOptions.GetPhase(3 + Config.Graphics.UpperBoard),"Display:UpperBoard",C4MN_Item_NoCount); } // FPS if (!Application.isEditor) AddRefSym(LoadResStr("IDS_MNU_FPS"), GfxR->fctOptions.GetPhase(5 + Config.General.FPS), "Display:FPS", C4MN_Item_NoCount); // Clock if (!Application.isEditor) AddRefSym(LoadResStr("IDS_MNU_CLOCK"), GfxR->fctOptions.GetPhase(15 + Config.Graphics.ShowClock), "Display:Clock", C4MN_Item_NoCount); // Restore selection SetSelection(selection, false, true); // Go back to options menu on close SetCloseCommand("ActivateMenu:Options"); // Done return true; }
bool C4MainMenu::ActivateHostility(int32_t iPlayer) { // Init menu C4FacetSurface fctSymbol; fctSymbol.Create(C4SymbolSize, C4SymbolSize); GfxR->fctMenu.GetPhase(7).Draw(fctSymbol); Init(fctSymbol, LoadResStr("IDS_MENU_CPATTACK"), iPlayer, C4MN_Extra_None, 0, C4MN_Hostility); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); Refill(); // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); return true; }
bool C4MainMenu::ActivateGoals(int32_t iPlayer, bool fDoActivate) { C4FacetSurface fctSymbol; C4Facet fctGF; // goal fulfilled facet if (fDoActivate) { // Menu symbol/init InitRefSym(GfxR->fctMenu.GetPhase(4),LoadResStr("IDS_MENU_CPGOALS"),iPlayer); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(false); fctGF.Set(NULL, C4SymbolSize-::GraphicsResource.fctCaptain.Wdt-2, 2, ::GraphicsResource.fctCaptain.Wdt, ::GraphicsResource.fctCaptain.Hgt); } // determine if the goals are fulfilled - do the calls even if the menu is not to be opened to ensure synchronization C4IDList GoalList, FulfilledGoalList; C4RoundResults::EvaluateGoals(GoalList, FulfilledGoalList, iPlayer); // Add Items if (fDoActivate) { int32_t iNumGoals = GoalList.GetNumberOfIDs(), cnt; C4ID idGoal; C4Def *pDef; for (int32_t i=0; i<iNumGoals; ++i) if ((idGoal = GoalList.GetID(i, &cnt))) if ((pDef = C4Id2Def(idGoal))) { fctSymbol.Create(C4SymbolSize,C4SymbolSize); // 2do: If an object instance is known, draw the object instead? // this would allow us to do dynamic pictures and overlays; e.g. draw the actual, required settlement score // for settlement score goals // Same for pDef->GetName(), pDef->GetDesc() pDef->Draw(fctSymbol); if (FulfilledGoalList.GetIDCount(idGoal)) { fctGF.Surface=fctSymbol.Surface; ::GraphicsResource.fctCaptain.Draw(fctGF); } StdStrBuf Command; Command.Format("Player:Goal:%s", idGoal.ToString()); Add(pDef->GetName(),fctSymbol,Command.getData(),C4MN_Item_NoCount,NULL,""); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); } // Done return true; }
bool C4MainMenu::ActivateOptions(int32_t iPlayer, int32_t selection) { // Menu symbol/init InitRefSym(GfxR->fctOptions.GetPhase(0), LoadResStr("IDS_MNU_OPTIONS"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Sound AddRefSym(LoadResStr("IDS_DLG_SOUND"), GfxR->fctOptions.GetPhase(17 + Config.Sound.RXSound),"Options:Sound",C4MN_Item_NoCount); // Music AddRefSym(LoadResStr("IDS_MNU_MUSIC"), GfxR->fctOptions.GetPhase(1 + Config.Sound.RXMusic),"Options:Music",C4MN_Item_NoCount); // Music AddRefSym(LoadResStr("IDS_MENU_DISPLAY"), GfxR->fctMenu.GetPhase(8), "ActivateMenu:Display"); // Restore selection SetSelection(selection, false, true); // Go back to main menu on close SetCloseCommand("ActivateMenu:Main"); // Done return true; }
bool C4MainMenu::ActivateHost(int32_t iPlayer) { // Menu symbol/init InitRefSym(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Disconnect), LoadResStr("IDS_MENU_DISCONNECTCLIENT"), iPlayer, C4MN_Extra_None, 0, 0, C4MN_Style_Context); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // Clients for (C4Network2Client *pClient=::Network.Clients.GetNextClient(NULL); pClient; pClient=::Network.Clients.GetNextClient(pClient)) { bool fHost = (pClient->getID() == 0); StdStrBuf strText, strCommand; strText.Format("%s (%s)", pClient->getName(), pClient->getCore().getNick()); strCommand.Format("Host:Kick:%d", pClient->getID()); C4GUI::Icons iIcon = fHost ? C4GUI::Ico_Host : (pClient->isActivated() ? C4GUI::Ico_Client : C4GUI::Ico_ObserverClient); AddRefSym(strText.getData(), C4GUI::Icon::GetIconFacet(iIcon), strCommand.getData()); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); return true; }
bool C4MainMenu::ActivateRules(int32_t iPlayer) { // Menu symbol/init char Command[256]; C4FacetSurface fctSymbol; InitRefSym(GfxR->fctMenu.GetPhase(5),LoadResStr("IDS_MENU_CPRULES"),iPlayer); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(false); // Items int32_t cnt; C4ID idGoal; C4Def *pDef; for (cnt=0; (idGoal=::Objects.GetListID(C4D_Rule,cnt)); cnt++) if ((pDef=C4Id2Def(idGoal))) { fctSymbol.Create(C4SymbolSize,C4SymbolSize); pDef->Draw(fctSymbol); sprintf(Command, "Player:Rule:%s", idGoal.ToString()); Add(pDef->GetName(),fctSymbol,Command,C4MN_Item_NoCount,NULL,""); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); // Done return true; }
bool C4MainMenu::ActivateSavegame(int32_t iPlayer) { // Check if saving is possible if (!Game.CanQuickSave()) return false; // Menu symbol/init char DirPath[_MAX_PATH+1]; char ScenName[_MAX_PATH+1]; *ScenName=0; InitRefSym(GfxR->fctMenu.GetPhase(0), LoadResStr("IDS_MENU_CPSAVEGAME"), iPlayer); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(true); // target file name mask // get folder & filename to store in // some magic is needed to ensure savegames are stored properly into their folders SCopy(GetFilename(Game.ScenarioFilename), DirPath); if (DirPath[strlen(DirPath) - 1] == '\\') DirPath[strlen(DirPath) - 1] = 0; RemoveExtension(DirPath); if (LooksLikeInteger(DirPath)) { // ScenTitle.ocf\%d.ocs-names (old-style savegames) // get owning folder if (Game.pParentGroup) { // owning folder determines filename SCopy(GetFilenameOnly(Game.pParentGroup->GetName()), ScenName); } else { // no owning folder known: too bad // make a vague guess based on the scenario title SCopy(GetFilenameOnly(Game.ScenarioFilename), ScenName); } } else { // DirPath is a valid filename for now... SCopy(DirPath, ScenName); // but remove trailing numbers to adjust new-style savegames char *pScenNameEnd = ScenName+SLen(ScenName); while (Inside<char>(*--pScenNameEnd, '0', '9')) if (pScenNameEnd == ScenName) { // should not happen: digit-only-filenames should have been caught earlier SCopy("dbg_error!", ScenName); pScenNameEnd = ScenName+SLen(ScenName)-1; } pScenNameEnd[1]=0; } // New Style 2007: // * scenarios are saved into ScenName.ocf/ScenName123.ocs to keep umlauts out of filenames // * language titles are stored in folders as title component StdStrBuf strFilename, strTitle; strFilename.Format("%s.ocf%c%s%%d.ocs", ScenName, DirectorySeparator, ScenName); strTitle = Game.ScenarioTitle; // Create menu items StdStrBuf strFilenameIndexed, strCommand, strCaption, strSavePath; for (int32_t i = 1; i <= 10; i++) { // Index filename strFilenameIndexed.Format(strFilename.getData(), i); // Compose commmand strCommand.Format("Save:Game:%s:%s", strFilenameIndexed.getData(), strTitle.getData()); // Notice: the language title might contain ':' and thus confuse the segment list - but C4Menu::MenuCommand will try to handle this... // Check free slot strSavePath.Format("%s%c%s", Config.AtUserDataPath(C4CFN_Savegames), DirectorySeparator, strFilenameIndexed.getData()); bool fFree = !C4Group_IsGroup(strSavePath.getData()); // Item caption strCaption = LoadResStr("IDS_MENU_CPSAVEGAME"); // add menu item AddRefSym(strCaption.getData(), GfxR->fctMenu.GetPhase(i - 1, fFree ? 2 : 1), strCommand.getData(), C4MN_Item_NoCount, NULL, LoadResStr("IDS_MENU_CPSAVEGAMEINFO")); } // Go back to options menu on close SetCloseCommand("ActivateMenu:Main"); return true; }
void LogEntry1Data::ResumeSyncSend(void) { if (!SyncSendPaused) { return; } SyncSendPaused = FALSE; if (SyncNumber == CERROR) { return; } // We just unpaused and we're assigned a record number... tell everybody // else all about ourselves. GAINEXCLUSIVEACCESS(); char Buffer[256]; CopyStringToBuffer(Buffer, Name); SetName(Buffer); CopyStringToBuffer(Buffer, Initials); SetInitials(Buffer); CopyStringToBuffer(Buffer, Password); SetPassword(Buffer); CopyStringToBuffer(Buffer, Surname); SetSurname(Buffer); CopyStringToBuffer(Buffer, Title); SetTitle(Buffer); CopyStringToBuffer(Buffer, RealName); SetRealName(Buffer); CopyStringToBuffer(Buffer, PhoneNumber); SetPhoneNumber(Buffer); CopyStringToBuffer(Buffer, ForwardAddr); SetForwardAddr(Buffer); CopyStringToBuffer(Buffer, ForwardAddrNode); SetForwardAddrNode(Buffer); CopyStringToBuffer(Buffer, ForwardAddrRegion); SetForwardAddrRegion(Buffer); CopyStringToBuffer(Buffer, PromptFormat); SetPromptFormat(Buffer); CopyStringToBuffer(Buffer, DateStamp); SetDateStamp(Buffer); CopyStringToBuffer(Buffer, VerboseDateStamp); SetVerboseDateStamp(Buffer); CopyStringToBuffer(Buffer, Signature); SetSignature(Buffer); CopyStringToBuffer(Buffer, NetPrefix); SetNetPrefix(Buffer); CopyStringToBuffer(Buffer, MailAddr1); SetMailAddr1(Buffer); CopyStringToBuffer(Buffer, MailAddr2); SetMailAddr2(Buffer); CopyStringToBuffer(Buffer, MailAddr3); SetMailAddr3(Buffer); CopyStringToBuffer(Buffer, Alias); SetAlias(Buffer); CopyStringToBuffer(Buffer, LocID); SetLocID(Buffer); CopyStringToBuffer(Buffer, MorePrompt); SetMorePrompt(Buffer); CopyStringToBuffer(Buffer, Occupation); SetOccupation(Buffer); CopyStringToBuffer(Buffer, WhereHear); SetWhereHear(Buffer); CopyStringToBuffer(Buffer, LastRoom); SetLastRoom(Buffer); CopyStringToBuffer(Buffer, LastHall); SetLastHall(Buffer); CopyStringToBuffer(Buffer, DefaultRoom); SetDefaultRoom(Buffer); CopyStringToBuffer(Buffer, DefaultHall); SetDefaultHall(Buffer); CopyStringToBuffer(Buffer, TermType); SetTermType(Buffer); RELEASEEXCLUSIVEACCESS(); SetBirthDate(BirthDate); SetFirstOn(FirstOn); SetSex(Sex); SetNulls(Nulls); SetWidth(Width); SetLinesPerScreen(LinesPerScreen); SetAttribute(ATTR_NORMAL, attributes[ATTR_NORMAL]); SetAttribute(ATTR_BLINK, attributes[ATTR_BLINK]); SetAttribute(ATTR_REVERSE, attributes[ATTR_REVERSE]); SetAttribute(ATTR_BOLD, attributes[ATTR_BOLD]); SetAttribute(ATTR_UNDERLINE, attributes[ATTR_UNDERLINE]); SetNumUserShow(NumUserShow); SetDefaultProtocol(DefaultProtocol); SetCallTime(CallTime); SetCallNumber(CallNumber); SetTotalTime(TotalTime); SetCredits(Credits); SetLogins(Logins); SetPosted(Posted); SetRead(Read); SetPasswordChangeTime(PasswordChangeTime); SetCallsToday(CallsToday); SetCallLimit(CallLimit); SetLastMessage(LastMessage); SetDL_Bytes(DL_Bytes); SetUL_Bytes(UL_Bytes); SetDL_Num(DL_Num); SetUL_Num(UL_Num); SetPoopcount(Poopcount); SetDungeoned(IsDungeoned()); SetForwardToNode(IsForwardToNode()); SetAutoNextHall(IsAutoNextHall()); SetEnterBorders(IsEnterBorders()); SetVerified(IsVerified()); SetSurnameLocked(IsSurnameLocked()); SetDefaultHallLocked(IsDefaultHallLocked()); SetPsycho(IsPsycho()); SetViewTitleSurname(IsViewTitleSurname()); SetViewSubjects(IsViewSubjects()); SetViewSignatures(IsViewSignatures()); SetOldIBMGraph(IsOldIBMGraph()); SetOldIBMANSI(IsOldIBMANSI()); SetOldIBMColor(IsOldIBMColor()); SetTwirly(IsTwirly()); SetAutoVerbose(IsAutoVerbose()); SetPauseBetweenMessages(IsPauseBetweenMessages()); SetMinibin(IsMinibin()); SetClearScreenBetweenMessages(IsClearScreenBetweenMessages()); SetViewRoomInfoLines(IsViewRoomInfoLines()); SetViewHallDescription(IsViewHallDescription()); SetVerboseContinue(IsVerboseContinue()); SetViewCensoredMessages(IsViewCensoredMessages()); SetViewBorders(IsViewBorders()); SetOut300(IsOut300()); SetUserSignatureLocked(IsUserSignatureLocked()); SetHideMessageExclusions(IsHideMessageExclusions()); SetDownload(IsDownload()); SetUpload(IsUpload()); SetChat(IsChat()); SetPrintFile(IsPrintFile()); SetSpellCheckMode(GetSpellCheckMode()); SetMakeRoom(IsMakeRoom()); SetVerboseLogOut(IsVerboseLogOut()); SetConfirmSave(IsConfirmSave()); SetConfirmAbort(IsConfirmAbort()); SetConfirmNoEO(IsConfirmNoEO()); SetUsePersonalHall(IsUsePersonalHall()); SetYouAreHere(IsYouAreHere()); SetIBMRoom(IsIBMRoom()); SetWideRoom(IsWideRoom()); SetMusic(IsMusic()); SetCheckApostropheS(IsCheckApostropheS()); SetCheckAllCaps(IsCheckAllCaps()); SetCheckDigits(IsCheckDigits()); SetExcludeEncryptedMessages(IsExcludeEncryptedMessages()); SetViewCommas(IsViewCommas()); SetPUnPauses(IsPUnPauses()); SetRoman(IsRoman()); SetSuperSysop(IsSuperSysop()); SetInuse(IsInuse()); SetUpperOnly(IsUpperOnly()); SetLinefeeds(IsLinefeeds()); SetExpert(IsExpert()); SetAide(IsAide()); SetTabs(IsTabs()); SetOldToo(IsOldToo()); SetProblem(IsProblem()); SetUnlisted(IsUnlisted()); SetPermanent(IsPermanent()); SetSysop(IsSysop()); SetNode(IsNode()); SetNetUser(IsNetUser()); SetAccounting(IsAccounting()); SetMail(IsMail()); SetViewRoomDesc(IsViewRoomDesc()); }