47 const char *szCountdownMsg;
75 void ScenDesc::Update()
100 fDescFinished =
true;
114 if (fDescFinished)
return;
130 :
C4GUI::FullscreenDialog(!
Game.ScenarioTitle ?
133 Game.ScenarioTitle.getData()),
134 pPlayerList(nullptr), pResList(nullptr), pChatBox(nullptr), pRightTabLbl(nullptr), pRightTab(nullptr),
135 pEdt(nullptr), btnRun(nullptr), btnPlayers(nullptr), btnResources(nullptr), btnTeams(nullptr), btnChat(nullptr)
143 int32_t iDefBtnHeight = 32;
144 int32_t iIndentX1, iIndentX2, iIndentX3;
145 int32_t iIndentY1, iIndentY2, iIndentY3, iIndentY4;
146 int32_t iClientListWdt;
194 checkReady =
nullptr;
226 int32_t iBtnNum = 4+fHasTeams+fHasChat;
269 btnRun->SetToolTip(
LoadResStr(
"IDS_DLGTIP_GAMEGO"));
280 eCountdownState = CDS_None;
281 iBackBufferIndex = -1;
290 delete pKeyHistoryUp;
291 delete pKeyHistoryDown;
306 void MainDlg::SetCountdownState(CountdownState eToState, int32_t iTimer)
309 if (eToState == eCountdownState)
return;
311 if (eCountdownState == CDS_Countdown)
317 if (eToState == CDS_Start)
322 else if (eToState == CDS_Countdown)
326 if (eToState == CDS_Countdown || eToState == CDS_LongCountdown)
330 if (!eCountdownState)
333 if (btnRun) btnRun->SetText(
LoadResStr(
"IDS_DLG_CANCEL"));
340 if (btnRun) btnRun->SetText(
LoadResStr(
"IDS_DLG_GAMEGO"));
345 eCountdownState = eToState;
355 CountdownState eNewState;
357 eNewState = CDS_None;
362 eNewState = CDS_Start;
364 eNewState = CDS_Countdown;
366 eNewState = CDS_LongCountdown;
368 bool fWasCountdown = !!eCountdownState;
369 SetCountdownState(eNewState, iTimer);
383 return eCountdownState >= CDS_Countdown;
393 if (eCountdownState) SetCountdownState(
fOK ? CDS_Start : CDS_None, 0);
439 iCountdownTime = ValidatedCountdownTime(iCountdownTime);
452 const char *szInputText = pEdt->
GetText();
454 if (!szInputText || !*szInputText)
469 iBackBufferIndex = -1;
497 #define GETPKT(type, name) \
498 assert(pPacket); const type &name = \
499 static_cast<const type &>(*pPacket);
523 const char *szMsgBuf = szMessage;
539 if (pOfClient && pPlayerList)
569 void MainDlg::UpdatePlayerList()
572 if (pPlayerList) pPlayerList->
Update();
666 if (!pRightTabLbl || !pRightTab || !pRightTab->
GetActiveSheet() || !pPlayerList)
return;
677 if (btnResources) btnResources->SetHighlight(pRightTab->
GetActiveSheetIndex() == SheetIdx_Res);
679 if (btnOptions) btnOptions->SetHighlight(pRightTab->
GetActiveSheetIndex() == SheetIdx_Options);
680 if (btnScenario) btnScenario->SetHighlight(pRightTab->
GetActiveSheetIndex() == SheetIdx_Scenario);
695 if (!szPrevInput || !*szPrevInput)
696 iBackBufferIndex = -1;
711 int32_t MainDlg::ValidatedCountdownTime(int32_t iTimeout)
714 if (iTimeout < 0) iTimeout = 5;
729 if (pLobby) pLobby->
OnError(szErrorMsg);
730 else Log(szErrorMsg);
768 iStartTimer = std::max<int32_t>(iStartTimer - 1, 0);
771 (iStartTimer <= 600 && !(iStartTimer % 10)) ||
780 else if (iStartTimer)
#define C4CFN_ScenarioDesc
#define GETPKT(type, name)
C4Application Application
C4GraphicsResource GraphicsResource
#define C4GUI_MessageFontAlpha
#define C4GUI_CaptionFontClr
#define C4GUI_ErrorFontClr
#define C4GUI_LogFontClr2
#define C4GUI_MessageFontClr
const char * LoadResStr(const char *id)
bool LogSilent(const char *szMessage, bool fConsole)
bool Log(const char *szMessage)
C4NetIOPacket MkC4NetIOPacket(char cStatus, const class C4PacketBase &Pkt, const C4NetIO::addr_t &addr=C4NetIO::addr_t())
@ PID_SetScenarioParameter
void StopSoundEffect(const char *szSndName, C4Object *pObj)
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
StdStrBuf FormatString(const char *szFmt,...)
bool ItemExists(const char *szItemName)
void NotifyUserIfInactive()
static C4ChatDlg * ShowChat()
static bool IsChatActive()
int32_t getLocalID() const
C4PlayerInfo * GetPlayerInfo(int32_t iIndex) const
const char * GetData() const
char LanguageEx[CFG_MaxString+1]
const char * AtRelativePath(const char *filename)
int32_t HideMsgPlrNoTakeOver
void SetOnChecked(BaseCallbackHandler *pCB)
bool GetFromLeft(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
bool GetCentered(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
int32_t GetHeight() const
int32_t GetInnerWidth() const
bool GetFromRight(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
void ExpandTop(int32_t iByHgt)
bool GetFromTop(int32_t iHgt, int32_t iWdt, C4Rect &rcOut)
void GetAll(C4Rect &rcOut)
bool GetFromBottom(int32_t iHgt, int32_t iWdt, C4Rect &rcOut)
void AddElement(Element *pChild)
void SetFocus(Control *pCtrl, bool fByMouse)
bool IsFocused(Control *pCtrl) override
static int32_t GetDefaultEditHeight()
bool InsertText(const char *szText, bool fUser)
C4Rect GetToprightCornerRect(int32_t iWidth=16, int32_t iHeight=16, int32_t iHIndent=4, int32_t iVIndent=4, int32_t iIndexX=0)
virtual Screen * GetScreen()
C4Rect GetContainedClientRect()
void SetBounds(const C4Rect &rcNewBound)
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
const char * GetToolTip()
void SetContextHandler(ContextHandler *pNewHd)
void SetText(const char *szToText, bool fAllowHotkey=true)
void SetClickFocusControl(Control *pToCtrl)
bool ShowMessageModal(const char *szMessage, const char *szCaption, DWORD dwButtons, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)
Sheet * AddSheet(const char *szTitle, int32_t icoTitle=Ico_None)
void SelectSheet(int32_t iIndex, bool fByUser)
int32_t GetActiveSheetIndex()
Sheet * GetSheet(int32_t iIndex)
void SetDecoration(bool fDrawBG, bool fDrawFrame, ScrollBarFacets *pToGfx, bool fAutoScroll)
void ClearText(bool fDoUpdate)
void AddTextLine(const char *szText, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont=nullptr)
C4Rect & GetClientRect() override
static int32_t GetDefaultHeight(CStdFont *pUseFont=nullptr)
void DoInput(C4PacketType eCtrlType, C4ControlPacket *pPkt, C4ControlDeliveryType eDelivery)
C4PlayerInfoList & PlayerInfos
C4PlayerInfoList & RestorePlayerInfos
C4GameParameters & Parameters
StdCopyStrBuf ScenarioTitle
StdStrBuf GetCountdownMsg(bool fInitialMsg=false) const
void CompileFunc(StdCompiler *pComp) override
int32_t GetCountdown() const
void CompileFunc(StdCompiler *pComp) override
void OnSec1Timer() override
Countdown(int32_t iStartTimer)
void OnTabOptions(C4GUI::Control *btn)
bool KeyHistoryUpDown(bool fUp)
void Start(int32_t iCountdownTime)
void OnClientPart(C4Client *pPartClient)
void OnBtnChat(C4GUI::Control *btn)
void OnCtxTabOptions(C4GUI::Element *pListItem)
void OnTabRes(C4GUI::Control *btn)
void OnTabPlayers(C4GUI::Control *btn)
void OnClientJoin(C4Client *pNewClient)
void OnCtxTabRes(C4GUI::Element *pListItem)
void OnReadyCheck(C4GUI::Element *pCheckBox)
void OnSec1Timer() override
void OnTabTeams(C4GUI::Control *btn)
void OnClientSound(C4Client *pOfClient)
void OnTabScenario(C4GUI::Control *btn)
bool OnMessage(C4Client *pOfClient, const char *szMessage)
void OnCtxTabTeams(C4GUI::Element *pListItem)
C4GUI::ContextMenu * OnRightTabContext(C4GUI::Element *pLabel, int32_t iX, int32_t iY)
void OnError(const char *szErrMsg)
void OnClientAddPlayer(const char *szFilename, int32_t idClient)
void HandlePacket(char cStatus, const C4PacketBase *pBasePkt, C4Network2Client *pClient)
void OnClientConnect(C4Client *pClient, C4Network2IOConnection *pConn)
void OnClosed(bool fOK) override
C4GUI::Edit::InputResult OnChatInput(C4GUI::Edit *edt, bool fPasting, bool fPastingMore)
void OnExitBtn(C4GUI::Control *btn)
void OnRunBtn(C4GUI::Control *btn)
void OnCountdownPacket(const C4PacketCountdown &Pkt)
void OnLog(const char *szLogMsg, DWORD dwClr=C4GUI_LogFontClr)
void OnCtxTabPlayers(C4GUI::Element *pListItem)
ScenDesc(const C4Rect &rcBounds, bool fActive)
C4ScenarioParameters ScenarioParameters
C4Network2Res::Ref getNetRes() const
bool Open(const char *group_name, bool do_create=false)
static bool LoadComponentHost(C4ComponentHost *host, C4Group &hGroup, const char *szFilename, const char *szLanguage)
bool BroadcastMsgToClients(const C4NetIOPacket &rPkt)
C4Network2Players Players
void AbortLobbyCountdown()
class C4GameLobby::MainDlg * GetLobby() const
C4Network2ClientList Clients
void StartLobbyCountdown(int32_t iCountdownTime)
DWORD GetClientChatColor(int idForClient, bool fLobby) const
bool JoinLocalPlayer(const char *szLocalPlayerFilename, bool initial=false)
const char * getFile() const
int32_t getPresentPercent() const
int32_t GetAssociatedSavegamePlayerID() const
void SetClientSoundIcon(int32_t iForClientID)
void SetMode(Mode eNewMode)
C4ClientPlayerInfos * GetIndexedInfo(int32_t iIndex) const
C4PlayerInfo * FindUnassociatedRestoreInfo(const C4PlayerInfoList &rRestoreInfoList)
int32_t GetPlayerCount() const
void SetValue(const char *id, int32_t value, bool only_if_larger)
bool IsMultiTeams() const
void Value(const T &rStruct)
void Remove(StdSchedulerProc *pProc)
void Add(StdSchedulerProc *pProc)
void Ref(const char *pnData)
const char * getData() const
void GUISound(const char *szSound)
const int32_t AlmostStartCountdownTime
void LobbyError(const char *szErrorMsg)