diff --git a/Sources/Engine/Engine.vcxproj b/Sources/Engine/Engine.vcxproj
index 85f3508..b893744 100644
--- a/Sources/Engine/Engine.vcxproj
+++ b/Sources/Engine/Engine.vcxproj
@@ -734,6 +734,7 @@ copy Release\$(TargetName).lib $(SolutionDir)..\Bin\ >nul
+
diff --git a/Sources/Engine/Engine.vcxproj.filters b/Sources/Engine/Engine.vcxproj.filters
index a84e7db..870a661 100644
--- a/Sources/Engine/Engine.vcxproj.filters
+++ b/Sources/Engine/Engine.vcxproj.filters
@@ -1365,6 +1365,9 @@
Header Files\GameAgent Headers
+
+ Header Files\GameAgent Headers
+
diff --git a/Sources/Engine/GameAgent/GameAgent.cpp b/Sources/Engine/GameAgent/GameAgent.cpp
index b104756..5036f57 100644
--- a/Sources/Engine/GameAgent/GameAgent.cpp
+++ b/Sources/Engine/GameAgent/GameAgent.cpp
@@ -128,11 +128,11 @@ TIME _tmLastHeartbeat = 0;
CDynamicStackArray ga_asrRequests;
//extern CTString ga_strServer = "master1.croteam.org";
-CTString ga_strServer = "master1.42amsterdam.net";
+extern CTString ga_strServer = "master1.42amsterdam.net";
//extern CTString ga_strMSLegacy = "master1.croteam.org";
-CTString ga_strMSLegacy = "42amsterdam.net";
+extern CTString ga_strMSLegacy = "42amsterdam.net";
-BOOL ga_bMSLegacy = TRUE;
+extern BOOL ga_bMSLegacy = TRUE;
//BOOL ga_bMSLegacy = FALSE;
void _uninitWinsock();
diff --git a/Sources/Engine/GameAgent/MSLegacy.h b/Sources/Engine/GameAgent/MSLegacy.h
index 4defdfb..7691d82 100644
--- a/Sources/Engine/GameAgent/MSLegacy.h
+++ b/Sources/Engine/GameAgent/MSLegacy.h
@@ -73,7 +73,8 @@ LICENSE
http://www.gnu.org/licenses/gpl.txt
*/
-
+#ifndef SE_INCL_MSLEGACY_H
+#define SE_INCL_MSLEGACY_H
#ifdef PRAGMA_ONCE
#pragma once
#endif
@@ -182,4 +183,4 @@ u_int resolv(char *host) {
/* end functions */
-
+#endif // include once check
diff --git a/Sources/Engine/Network/Network.cpp b/Sources/Engine/Network/Network.cpp
index 724960d..94942af 100644
--- a/Sources/Engine/Network/Network.cpp
+++ b/Sources/Engine/Network/Network.cpp
@@ -886,9 +886,9 @@ void CNetworkLibrary::Init(const CTString &strGameID)
_pShell->DeclareSymbol("persistent user INDEX wed_bUseGenericTextureReplacement;", &wed_bUseGenericTextureReplacement);
- _pShell->DeclareSymbol("user CTString ga_strServer;", &ga_strServer);
- _pShell->DeclareSymbol("user CTString ga_strMSLegacy;", &ga_strMSLegacy);
- _pShell->DeclareSymbol("user INDEX ga_bMSLegacy;", &ga_bMSLegacy);
+ _pShell->DeclareSymbol("persistent user CTString ga_strServer;", &ga_strServer);
+ _pShell->DeclareSymbol("persistent user CTString ga_strMSLegacy;", &ga_strMSLegacy);
+ _pShell->DeclareSymbol("persistent user INDEX ga_bMSLegacy;", &ga_bMSLegacy);
_pShell->DeclareSymbol("INDEX pwoCurrentWorld;", &_pwoCurrentWorld);
}
diff --git a/Sources/GameGUIMP/GameGUI.rc b/Sources/GameGUIMP/GameGUI.rc
index 1a54c62..8e201fd 100644
--- a/Sources/GameGUIMP/GameGUI.rc
+++ b/Sources/GameGUIMP/GameGUI.rc
@@ -273,7 +273,7 @@ BEGIN
EDITTEXT IDC_CONSOLE_OUTPUT,7,7,429,169,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY |
WS_VSCROLL | WS_HSCROLL
- LTEXT "Available symols:",IDC_STATIC,7,181,69,8
+ LTEXT "Available symbols:",IDC_STATIC,7,181,69,8
COMBOBOX IDC_CONSOLE_SYMBOLS,76,179,360,108,CBS_DROPDOWNLIST |
CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
diff --git a/Sources/SeriousSam/ArrowDir.h b/Sources/SeriousSam/ArrowDir.h
new file mode 100644
index 0000000..83e6390
--- /dev/null
+++ b/Sources/SeriousSam/ArrowDir.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_ARROWDIR_H
+#define SE_INCL_ARROWDIR_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+enum ArrowDir {
+ AD_NONE,
+ AD_UP,
+ AD_DOWN,
+ AD_LEFT,
+ AD_RIGHT,
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/CmdLine.cpp b/Sources/SeriousSam/CmdLine.cpp
index e83f14c..0c83373 100644
--- a/Sources/SeriousSam/CmdLine.cpp
+++ b/Sources/SeriousSam/CmdLine.cpp
@@ -113,12 +113,6 @@ void ParseCommandLine(CTString strCmd)
cmd_bQuickJoin = TRUE;
} else if (strWord=="+game") {
CTString strMod = GetNextParam();
-#if _SE_DEMO
- if (strMod!="SeriousSam" && strMod!="Warped") {
- FatalError(TRANS("This MOD is not allowed in demo version!"));
- return;
- }
-#endif
if (strMod!="SeriousSam") { // (we ignore default mod - always use base dir in that case)
_fnmMod = "Mods\\"+strMod+"\\";
}
diff --git a/Sources/SeriousSam/FileInfo.h b/Sources/SeriousSam/FileInfo.h
new file mode 100644
index 0000000..30b70e0
--- /dev/null
+++ b/Sources/SeriousSam/FileInfo.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_FILEINFO_H
+#define SE_INCL_FILEINFO_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+class CFileInfo {
+public:
+ CListNode fi_lnNode;
+ CTFileName fi_fnFile;
+ CTString fi_strName;
+};
+
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGArrow.cpp b/Sources/SeriousSam/GUI/Components/MGArrow.cpp
new file mode 100644
index 0000000..84f0956
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGArrow.cpp
@@ -0,0 +1,54 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGArrow.h"
+
+
+void CMGArrow::Render(CDrawPort *pdp)
+{
+ SetFontMedium(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ COLOR col = GetCurrentColor();
+
+ CTString str;
+ if (mg_adDirection == AD_NONE) {
+ str = "???";
+ } else if (mg_adDirection == AD_UP) {
+ str = TRANS("Page Up");
+ } else if (mg_adDirection == AD_DOWN) {
+ str = TRANS("Page Down");
+ } else {
+ ASSERT(FALSE);
+ }
+
+ PIX pixI = box.Min()(1);
+ PIX pixJ = box.Min()(2);
+ pdp->PutText(str, pixI, pixJ, col);
+}
+
+void CMGArrow::OnActivate(void)
+{
+ if (mg_adDirection == AD_UP) {
+ pgmCurrentMenu->ScrollList(-3);
+ }
+ else if (mg_adDirection == AD_DOWN) {
+ pgmCurrentMenu->ScrollList(+3);
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGArrow.h b/Sources/SeriousSam/GUI/Components/MGArrow.h
new file mode 100644
index 0000000..e5408e6
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGArrow.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_ARROW_H
+#define SE_INCL_MENU_GADGET_ARROW_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "ArrowDir.h"
+#include "MGButton.h"
+
+
+class CMGArrow : public CMGButton {
+public:
+ enum ArrowDir mg_adDirection;
+ void Render(CDrawPort *pdp);
+ void OnActivate(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGButton.cpp b/Sources/SeriousSam/GUI/Components/MGButton.cpp
new file mode 100644
index 0000000..ad1ccca
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGButton.cpp
@@ -0,0 +1,182 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "LevelInfo.h"
+#include "VarList.h"
+#include "MGButton.h"
+
+extern CSoundData *_psdPress;
+
+extern CMenuGadget *_pmgLastActivatedGadget;
+
+
+CMGButton::CMGButton(void)
+{
+ mg_pActivatedFunction = NULL;
+ mg_iIndex = 0;
+ mg_iCenterI = 0;
+ mg_iTextMode = 1;
+ mg_bfsFontSize = BFS_MEDIUM;
+ mg_iCursorPos = -1;
+ mg_bRectangle = FALSE;
+ mg_bMental = FALSE;
+ mg_bEditing = FALSE;
+ mg_bHighlighted = FALSE;
+}
+
+
+void CMGButton::SetText(CTString strNew)
+{
+ mg_strText = strNew;
+}
+
+
+void CMGButton::OnActivate(void)
+{
+ if (mg_pActivatedFunction != NULL && mg_bEnabled)
+ {
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ _pmgLastActivatedGadget = this;
+ (*mg_pActivatedFunction)();
+ }
+}
+
+
+void CMGButton::Render(CDrawPort *pdp)
+{
+ if (mg_bfsFontSize == BFS_LARGE) {
+ SetFontBig(pdp);
+ } else if (mg_bfsFontSize == BFS_MEDIUM) {
+ SetFontMedium(pdp);
+ } else {
+ ASSERT(mg_bfsFontSize == BFS_SMALL);
+ SetFontSmall(pdp);
+ }
+ pdp->SetTextMode(mg_iTextMode);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ COLOR col = GetCurrentColor();
+ if (mg_bEditing) {
+ col = LCDGetColor(C_GREEN | 0xFF, "editing");
+ }
+
+ COLOR colRectangle = col;
+ if (mg_bHighlighted) {
+ col = LCDGetColor(C_WHITE | 0xFF, "hilited");
+ if (!mg_bFocused) {
+ colRectangle = LCDGetColor(C_WHITE | 0xFF, "hilited rectangle");
+ }
+ }
+ if (mg_bMental) {
+ FLOAT tmIn = 0.2f;
+ FLOAT tmOut = 1.0f;
+ FLOAT tmFade = 0.1f;
+ FLOAT tmExist = tmFade + tmIn + tmFade;
+ FLOAT tmTotal = tmFade + tmIn + tmFade + tmOut;
+
+ FLOAT tmTime = _pTimer->GetHighPrecisionTimer().GetSeconds();
+ FLOAT fFactor = 1;
+ if (tmTime>0.1f) {
+ tmTime = fmod(tmTime, tmTotal);
+ fFactor = CalculateRatio(tmTime, 0, tmExist, tmFade / tmExist, tmFade / tmExist);
+ }
+ col = (col&~0xFF) | INDEX(0xFF * fFactor);
+ }
+
+ if (mg_bRectangle) {
+ // put border
+ const PIX pixLeft = box.Min()(1);
+ const PIX pixUp = box.Min()(2) - 3;
+ const PIX pixWidth = box.Size()(1) + 1;
+ const PIX pixHeight = box.Size()(2);
+ pdp->DrawBorder(pixLeft, pixUp, pixWidth, pixHeight, colRectangle);
+ }
+
+ if (mg_bEditing) {
+ // put border
+ PIX pixLeft = box.Min()(1);
+ PIX pixUp = box.Min()(2) - 3;
+ PIX pixWidth = box.Size()(1) + 1;
+ PIX pixHeight = box.Size()(2);
+ if (mg_strLabel != "") {
+ pixLeft = box.Min()(1) + box.Size()(1)*0.55f;
+ pixWidth = box.Size()(1)*0.45f + 1;
+ }
+ pdp->Fill(pixLeft, pixUp, pixWidth, pixHeight, LCDGetColor(C_dGREEN | 0x40, "edit fill"));
+ }
+
+
+ INDEX iCursor = mg_iCursorPos;
+
+ // print text
+ if (mg_strLabel != "") {
+ PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+
+ pdp->PutTextR(mg_strLabel, pixIL, pixJ, col);
+ pdp->PutText(mg_strText, pixIR, pixJ, col);
+ } else {
+ CTString str = mg_strText;
+ if (pdp->dp_FontData->fd_bFixedWidth) {
+ str = str.Undecorated();
+ INDEX iLen = str.Length();
+ INDEX iMaxLen = ClampDn(box.Size()(1) / (pdp->dp_pixTextCharSpacing + pdp->dp_FontData->fd_pixCharWidth), 1L);
+ if (iCursor >= iMaxLen) {
+ str.TrimRight(iCursor);
+ str.TrimLeft(iMaxLen);
+ iCursor = iMaxLen;
+ } else {
+ str.TrimRight(iMaxLen);
+ }
+ }
+ if (mg_iCenterI == -1) pdp->PutText(str, box.Min()(1), box.Min()(2), col);
+ else if (mg_iCenterI == +1) pdp->PutTextR(str, box.Max()(1), box.Min()(2), col);
+ else pdp->PutTextC(str, box.Center()(1), box.Min()(2), col);
+ }
+
+ // put cursor if editing
+ if (mg_bEditing && (((ULONG)(_pTimer->GetRealTimeTick() * 2)) & 1)) {
+ PIX pixX = box.Min()(1) + GetCharOffset(pdp, iCursor);
+ if (mg_strLabel != "") {
+ pixX += box.Size()(1)*0.55f;
+ }
+
+ PIX pixY = box.Min()(2);
+ if (!pdp->dp_FontData->fd_bFixedWidth) {
+ pixY -= pdp->dp_fTextScaling * 2;
+ }
+ pdp->PutText("|", pixX, pixY, LCDGetColor(C_WHITE | 0xFF, "editing cursor"));
+ }
+}
+
+
+PIX CMGButton::GetCharOffset(CDrawPort *pdp, INDEX iCharNo)
+{
+ if (pdp->dp_FontData->fd_bFixedWidth) {
+ return (pdp->dp_FontData->fd_pixCharWidth + pdp->dp_pixTextCharSpacing)*(iCharNo - 0.5f);
+ }
+ CTString strCut(mg_strText);
+ strCut.TrimLeft(strlen(mg_strText) - iCharNo);
+ PIX pixFullWidth = pdp->GetTextWidth(mg_strText);
+ PIX pixCutWidth = pdp->GetTextWidth(strCut);
+ // !!!! not implemented for different centering
+ return pixFullWidth - pixCutWidth;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGButton.h b/Sources/SeriousSam/GUI/Components/MGButton.h
new file mode 100644
index 0000000..8d83f65
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGButton.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_BUTTON_H
+#define SE_INCL_MENU_GADGET_BUTTON_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuGadget.h"
+
+
+class CMGButton : public CMenuGadget {
+public:
+ CTString mg_strLabel; // for those that have labels separately from main text
+ CTString mg_strText;
+ INDEX mg_iCenterI;
+ enum ButtonFontSize mg_bfsFontSize;
+ BOOL mg_bEditing;
+ BOOL mg_bHighlighted;
+ BOOL mg_bRectangle;
+ BOOL mg_bMental;
+ INDEX mg_iTextMode;
+ INDEX mg_iCursorPos;
+ INDEX mg_iIndex;
+
+ void(*mg_pActivatedFunction)(void);
+
+ CMGButton(void);
+ void SetText(CTString strNew);
+ void OnActivate(void);
+ void Render(CDrawPort *pdp);
+ PIX GetCharOffset(CDrawPort *pdp, INDEX iCharNo);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp b/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp
new file mode 100644
index 0000000..931c584
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp
@@ -0,0 +1,53 @@
+/* C/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGChangePlayer.h"
+#include "GUI/Menus/MenuManager.h"
+
+extern CSoundData *_psdPress;
+
+
+void CMGChangePlayer::OnActivate(void)
+{
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ _iLocalPlayer = mg_iLocalPlayer;
+
+ if (_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] < 0)
+ _pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] = 0;
+
+ _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer];
+ _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSelectPlayersMenu;
+
+ extern BOOL _bPlayerMenuFromSinglePlayer;
+ _bPlayerMenuFromSinglePlayer = FALSE;
+ ChangeToMenu(&_pGUIM->gmPlayerProfile);
+}
+
+void CMGChangePlayer::SetPlayerText(void)
+{
+ INDEX iPlayer = _pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer];
+ CPlayerCharacter &pc = _pGame->gm_apcPlayers[iPlayer];
+
+ if (iPlayer<0 || iPlayer>7) {
+ mg_strText = "????";
+ } else {
+ mg_strText.PrintF(TRANS("Player %d: %s\n"), mg_iLocalPlayer + 1, pc.GetNameForPrinting());
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGChangePlayer.h b/Sources/SeriousSam/GUI/Components/MGChangePlayer.h
new file mode 100644
index 0000000..f571237
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGChangePlayer.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_CHANGEPLAYER_H
+#define SE_INCL_MENU_GADGET_CHANGEPLAYER_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGChangePlayer : public CMGButton {
+public:
+ INDEX mg_iLocalPlayer;
+
+ void SetPlayerText(void);
+ void OnActivate(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGEdit.cpp b/Sources/SeriousSam/GUI/Components/MGEdit.cpp
new file mode 100644
index 0000000..8375668
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGEdit.cpp
@@ -0,0 +1,174 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGEdit.h"
+
+extern CSoundData *_psdPress;
+
+extern BOOL _bEditingString;
+
+
+CMGEdit::CMGEdit(void)
+{
+ mg_pstrToChange = NULL;
+ mg_ctMaxStringLen = 70;
+ Clear();
+}
+
+void CMGEdit::Clear(void)
+{
+ mg_iCursorPos = 0;
+ mg_bEditing = FALSE;
+ _bEditingString = FALSE;
+}
+
+void CMGEdit::OnActivate(void)
+{
+ if (!mg_bEnabled) {
+ return;
+ }
+ ASSERT(mg_pstrToChange != NULL);
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ SetText(mg_strText);
+ mg_iCursorPos = strlen(mg_strText);
+ mg_bEditing = TRUE;
+ _bEditingString = TRUE;
+}
+
+
+// focus lost
+void CMGEdit::OnKillFocus(void)
+{
+ // go out of editing mode
+ if (mg_bEditing) {
+ OnKeyDown(VK_RETURN);
+ Clear();
+ }
+ // proceed
+ CMenuGadget::OnKillFocus();
+}
+
+// helper function for deleting char(s) from string
+static void Key_BackDel(CTString &str, INDEX &iPos, BOOL bShift, BOOL bRight)
+{
+ // do nothing if string is empty
+ INDEX ctChars = strlen(str);
+ if (ctChars == 0) return;
+ if (bRight && iPos0) { // BACKSPACE key
+ if (bShift) {
+ // delete to start of line
+ str.TrimLeft(ctChars - iPos);
+ iPos = 0;
+ } else {
+ // delete only one char
+ str.DeleteChar(iPos - 1);
+ iPos--;
+ }
+ }
+}
+
+// key/mouse button pressed
+BOOL CMGEdit::OnKeyDown(int iVKey)
+{
+ // if not in edit mode
+ if (!mg_bEditing) {
+ // behave like normal gadget
+ return CMenuGadget::OnKeyDown(iVKey);
+ }
+
+ // finish editing?
+ BOOL bShift = GetKeyState(VK_SHIFT) & 0x8000;
+ switch (iVKey) {
+ case VK_UP: case VK_DOWN:
+ case VK_RETURN: case VK_LBUTTON: *mg_pstrToChange = mg_strText; Clear(); OnStringChanged(); break;
+ case VK_ESCAPE: case VK_RBUTTON: mg_strText = *mg_pstrToChange; Clear(); OnStringCanceled(); break;
+ case VK_LEFT: if (mg_iCursorPos > 0) mg_iCursorPos--; break;
+ case VK_RIGHT: if (mg_iCursorPos < strlen(mg_strText)) mg_iCursorPos++; break;
+ case VK_HOME: mg_iCursorPos = 0; break;
+ case VK_END: mg_iCursorPos = strlen(mg_strText); break;
+ case VK_BACK: Key_BackDel(mg_strText, mg_iCursorPos, bShift, FALSE); break;
+ case VK_DELETE: Key_BackDel(mg_strText, mg_iCursorPos, bShift, TRUE); break;
+ default: break; // ignore all other special keys
+ }
+
+ // key is handled
+ return TRUE;
+}
+
+// char typed
+BOOL CMGEdit::OnChar(MSG msg)
+{
+ // if not in edit mode
+ if (!mg_bEditing) {
+ // behave like normal gadget
+ return CMenuGadget::OnChar(msg);
+ }
+ // only chars are allowed
+ const INDEX ctFullLen = mg_strText.Length();
+ const INDEX ctNakedLen = mg_strText.LengthNaked();
+ mg_iCursorPos = Clamp(mg_iCursorPos, 0L, ctFullLen);
+ int iVKey = msg.wParam;
+ if (isprint(iVKey) && ctNakedLen <= mg_ctMaxStringLen) {
+ mg_strText.InsertChar(mg_iCursorPos, (char)iVKey);
+ mg_iCursorPos++;
+ }
+ // key is handled
+ return TRUE;
+}
+
+void CMGEdit::Render(CDrawPort *pdp)
+{
+ if (mg_bEditing) {
+ mg_iTextMode = -1;
+ } else if (mg_bFocused) {
+ mg_iTextMode = 0;
+ } else {
+ mg_iTextMode = 1;
+ }
+
+ if (mg_strText == "" && !mg_bEditing) {
+ if (mg_bfsFontSize == BFS_SMALL) {
+ mg_strText = "*";
+ } else {
+ mg_strText = TRANS("");
+ }
+ CMGButton::Render(pdp);
+ mg_strText = "";
+ } else {
+ CMGButton::Render(pdp);
+ }
+}
+
+void CMGEdit::OnStringChanged(void)
+{
+}
+
+void CMGEdit::OnStringCanceled(void)
+{
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGEdit.h b/Sources/SeriousSam/GUI/Components/MGEdit.h
new file mode 100644
index 0000000..f995736
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGEdit.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_EDIT_H
+#define SE_INCL_MENU_GADGET_EDIT_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGEdit : public CMGButton {
+public:
+ INDEX mg_ctMaxStringLen;
+ CTString *mg_pstrToChange;
+
+ CMGEdit(void);
+
+ // return TRUE if handled
+ BOOL OnKeyDown(int iVKey);
+ BOOL OnChar(MSG msg);
+ void Clear(void);
+ void OnActivate(void);
+ void OnKillFocus(void);
+ void Render(CDrawPort *pdp);
+ virtual void OnStringChanged(void);
+ virtual void OnStringCanceled(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGFileButton.cpp b/Sources/SeriousSam/GUI/Components/MGFileButton.cpp
new file mode 100644
index 0000000..cbf9d84
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGFileButton.cpp
@@ -0,0 +1,243 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGFileButton.h"
+#include "GUI/Menus/MenuManager.h"
+
+extern CSoundData *_psdPress;
+
+
+CMGFileButton::CMGFileButton(void)
+{
+ mg_iState = FBS_NORMAL;
+}
+
+// refresh current text from description
+void CMGFileButton::RefreshText(void)
+{
+ mg_strText = mg_strDes;
+ mg_strText.OnlyFirstLine();
+ mg_strInfo = mg_strDes;
+ mg_strInfo.RemovePrefix(mg_strText);
+ mg_strInfo.DeleteChar(0);
+}
+
+void CMGFileButton::SaveDescription(void)
+{
+ CTFileName fnFileNameDescription = mg_fnm.NoExt() + ".des";
+ try {
+ mg_strDes.Save_t(fnFileNameDescription);
+ } catch (char *strError) {
+ CPrintF("%s\n", strError);
+ }
+}
+
+CMGFileButton *_pmgFileToSave = NULL;
+void OnFileSaveOK(void)
+{
+ if (_pmgFileToSave != NULL) {
+ _pmgFileToSave->SaveYes();
+ }
+}
+
+void CMGFileButton::DoSave(void)
+{
+ if (FileExistsForWriting(mg_fnm)) {
+ _pmgFileToSave = this;
+ extern void SaveConfirm(void);
+ SaveConfirm();
+ } else {
+ SaveYes();
+ }
+}
+
+void CMGFileButton::SaveYes(void)
+{
+ ASSERT(_pGUIM->gmLoadSaveMenu.gm_bSave);
+ // call saving function
+ BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
+ // if saved
+ if (bSucceeded) {
+ // save the description too
+ SaveDescription();
+ }
+}
+
+void CMGFileButton::DoLoad(void)
+{
+ ASSERT(!_pGUIM->gmLoadSaveMenu.gm_bSave);
+ // if no file
+ if (!FileExists(mg_fnm)) {
+ // do nothing
+ return;
+ }
+ if (_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu != NULL) {
+ _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu;
+ }
+ // call loading function
+ BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
+ ASSERT(bSucceeded);
+}
+
+static CTString _strTmpDescription;
+static CTString _strOrgDescription;
+
+void CMGFileButton::StartEdit(void)
+{
+ CMGEdit::OnActivate();
+}
+
+void CMGFileButton::OnActivate(void)
+{
+ if (mg_fnm == "") {
+ return;
+ }
+
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+
+ // if loading
+ if (!_pGUIM->gmLoadSaveMenu.gm_bSave) {
+ // load now
+ DoLoad();
+ // if saving
+ } else {
+ // switch to editing mode
+ BOOL bWasEmpty = mg_strText == EMPTYSLOTSTRING;
+ mg_strDes = _pGUIM->gmLoadSaveMenu.gm_strSaveDes;
+ RefreshText();
+ _strOrgDescription = _strTmpDescription = mg_strText;
+
+ if (bWasEmpty) {
+ _strOrgDescription = EMPTYSLOTSTRING;
+ }
+
+ mg_pstrToChange = &_strTmpDescription;
+ StartEdit();
+ mg_iState = FBS_SAVENAME;
+ }
+}
+
+BOOL CMGFileButton::OnKeyDown(int iVKey)
+{
+ if (mg_iState == FBS_NORMAL) {
+ if (_pGUIM->gmLoadSaveMenu.gm_bSave || _pGUIM->gmLoadSaveMenu.gm_bManage) {
+ if (iVKey == VK_F2) {
+ if (FileExistsForWriting(mg_fnm)) {
+ // switch to renaming mode
+ _strOrgDescription = mg_strText;
+ _strTmpDescription = mg_strText;
+ mg_pstrToChange = &_strTmpDescription;
+ StartEdit();
+ mg_iState = FBS_RENAME;
+ }
+ return TRUE;
+
+ } else if (iVKey == VK_DELETE) {
+ if (FileExistsForWriting(mg_fnm)) {
+ // delete the file, its description and thumbnail
+ RemoveFile(mg_fnm);
+ RemoveFile(mg_fnm.NoExt() + ".des");
+ RemoveFile(mg_fnm.NoExt() + "Tbn.tex");
+ // refresh menu
+ _pGUIM->gmLoadSaveMenu.EndMenu();
+ _pGUIM->gmLoadSaveMenu.StartMenu();
+ OnSetFocus();
+ }
+ return TRUE;
+ }
+ }
+ return CMenuGadget::OnKeyDown(iVKey);
+ } else {
+ // go out of editing mode
+ if (mg_bEditing) {
+ if (iVKey == VK_UP || iVKey == VK_DOWN) {
+ CMGEdit::OnKeyDown(VK_ESCAPE);
+ }
+ }
+ return CMGEdit::OnKeyDown(iVKey);
+ }
+}
+
+void CMGFileButton::OnSetFocus(void)
+{
+ mg_iState = FBS_NORMAL;
+
+ if (_pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) {
+ SetThumbnail(mg_fnm);
+ } else {
+ ClearThumbnail();
+ }
+
+ pgmCurrentMenu->KillAllFocuses();
+ CMGButton::OnSetFocus();
+}
+
+void CMGFileButton::OnKillFocus(void)
+{
+ // go out of editing mode
+ if (mg_bEditing) {
+ OnKeyDown(VK_ESCAPE);
+ }
+
+ CMGEdit::OnKillFocus();
+}
+
+// override from edit gadget
+void CMGFileButton::OnStringChanged(void)
+{
+ // if saving
+ if (mg_iState == FBS_SAVENAME) {
+ // do the save
+ mg_strDes = _strTmpDescription + "\n" + mg_strInfo;
+ DoSave();
+ // if renaming
+ } else if (mg_iState == FBS_RENAME) {
+ // do the rename
+ mg_strDes = _strTmpDescription + "\n" + mg_strInfo;
+ SaveDescription();
+ // refresh menu
+ _pGUIM->gmLoadSaveMenu.EndMenu();
+ _pGUIM->gmLoadSaveMenu.StartMenu();
+ OnSetFocus();
+ }
+}
+void CMGFileButton::OnStringCanceled(void)
+{
+ mg_strText = _strOrgDescription;
+}
+
+void CMGFileButton::Render(CDrawPort *pdp)
+{
+ // render original gadget first
+ CMGEdit::Render(pdp);
+
+ // if currently selected
+ if (mg_bFocused && mg_bEnabled) {
+ // add info at the bottom if screen
+ SetFontMedium(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, BoxSaveLoad(15.0));
+ PIX pixI = box.Min()(1);
+ PIX pixJ = box.Min()(2);
+
+ COLOR col = LCDGetColor(C_mlGREEN | 255, "file info");
+ pdp->PutText(mg_strInfo, pixI, pixJ, col);
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGFileButton.h b/Sources/SeriousSam/GUI/Components/MGFileButton.h
new file mode 100644
index 0000000..a5d10dd
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGFileButton.h
@@ -0,0 +1,57 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_FILEBUTTON_H
+#define SE_INCL_MENU_GADGET_FILEBUTTON_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGEdit.h"
+
+// file button states
+#define FBS_NORMAL 0 // normal active state
+#define FBS_SAVENAME 1 // typing in the save name
+#define FBS_RENAME 2 // renaming existing file
+class CMGFileButton : public CMGEdit {
+public:
+ CMGFileButton(void);
+ CTFileName mg_fnm;
+ CTString mg_strDes; // entire description goes here
+ CTString mg_strInfo; // info part of text to print above the gadget tip
+ INDEX mg_iState;
+
+ // refresh current text from description
+ void RefreshText(void);
+ // save description to disk
+ void SaveDescription(void);
+ void SaveYes(void);
+ void DoSave(void);
+ void DoLoad(void);
+ void StartEdit(void);
+
+ // return TRUE if handled
+ BOOL OnKeyDown(int iVKey);
+ void OnActivate(void);
+ void OnSetFocus(void);
+ void OnKillFocus(void);
+
+ // overrides from edit gadget
+ void OnStringChanged(void);
+ void OnStringCanceled(void);
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGHighScore.cpp b/Sources/SeriousSam/GUI/Components/MGHighScore.cpp
new file mode 100644
index 0000000..c6272dc
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGHighScore.cpp
@@ -0,0 +1,102 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGHighScore.h"
+
+#define HSCOLUMNS 6
+CTString strHighScores[HIGHSCORE_COUNT + 1][HSCOLUMNS];
+FLOAT afI[HSCOLUMNS] = {
+ 0.12f, 0.15f, 0.6f, 0.7f, 0.78f, 0.9f
+};
+
+
+void CMGHighScore::Render(CDrawPort *pdp)
+{
+ SetFontMedium(pdp);
+
+ COLOR colHeader = LCDGetColor(C_GREEN | 255, "hiscore header");
+ COLOR colData = LCDGetColor(C_mdGREEN | 255, "hiscore data");
+ COLOR colLastSet = LCDGetColor(C_mlGREEN | 255, "hiscore last set");
+ INDEX iLastSet = _pGame->gm_iLastSetHighScore;
+
+ CTString strText;
+
+ strHighScores[0][0] = TRANS("No.");
+ strHighScores[0][1] = TRANS("Player Name");
+ strHighScores[0][2] = TRANS("Difficulty");
+ strHighScores[0][3] = TRANS("Time");
+ strHighScores[0][4] = TRANS("Kills");
+ strHighScores[0][5] = TRANS("Score");
+
+ {for (INDEX i = 0; igm_ahseHighScores[i].hse_gdDifficulty) {
+ default:
+ ASSERT(FALSE);
+ case (CSessionProperties::GameDifficulty) - 100:
+ strHighScores[i + 1][1] = "---";
+ continue;
+ break;
+ case CSessionProperties::GD_TOURIST:
+ strHighScores[i + 1][2] = TRANS("Tourist");
+ break;
+ case CSessionProperties::GD_EASY:
+ strHighScores[i + 1][2] = TRANS("Easy");
+ break;
+ case CSessionProperties::GD_NORMAL:
+ strHighScores[i + 1][2] = TRANS("Normal");
+ break;
+ case CSessionProperties::GD_HARD:
+ strHighScores[i + 1][2] = TRANS("Hard");
+ break;
+ case CSessionProperties::GD_EXTREME:
+ strHighScores[i + 1][2] = TRANS("Serious");
+ break;
+ case CSessionProperties::GD_EXTREME + 1:
+ strHighScores[i + 1][2] = TRANS("Mental");
+ break;
+ }
+ strHighScores[i + 1][0].PrintF("%d", i + 1);
+ strHighScores[i + 1][1] = _pGame->gm_ahseHighScores[i].hse_strPlayer;
+ strHighScores[i + 1][3] = TimeToString(_pGame->gm_ahseHighScores[i].hse_tmTime);
+ strHighScores[i + 1][4].PrintF("%03d", _pGame->gm_ahseHighScores[i].hse_ctKills);
+ strHighScores[i + 1][5].PrintF("%9d", _pGame->gm_ahseHighScores[i].hse_ctScore);
+ }}
+
+ PIX pixJ = pdp->GetHeight()*0.25f;
+ {for (INDEX iRow = 0; iRowGetWidth()*afI[iColumn];
+ if (iColumn == 1) {
+ pdp->PutText(strHighScores[iRow][iColumn], pixI, pixJ, col);
+ }
+ else {
+ pdp->PutTextR(strHighScores[iRow][iColumn], pixI, pixJ, col);
+ }
+ }}
+ if (iRow == 0) {
+ pixJ += pdp->GetHeight()*0.06f;
+ } else {
+ pixJ += pdp->GetHeight()*0.04f;
+ }
+ }}
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGHighScore.h b/Sources/SeriousSam/GUI/Components/MGHighScore.h
new file mode 100644
index 0000000..469acd0
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGHighScore.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_HIGHSCORE_H
+#define SE_INCL_MENU_GADGET_HIGHSCORE_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuGadget.h"
+
+
+class CMGHighScore : public CMenuGadget {
+public:
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGKeyDefinition.cpp b/Sources/SeriousSam/GUI/Components/MGKeyDefinition.cpp
new file mode 100644
index 0000000..4cc9e3f
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGKeyDefinition.cpp
@@ -0,0 +1,223 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGKeyDefinition.h"
+
+extern CSoundData *_psdSelect;
+extern CSoundData *_psdPress;
+
+extern BOOL _bDefiningKey;
+
+
+CMGKeyDefinition::CMGKeyDefinition(void)
+{
+ mg_iState = DOING_NOTHING;
+}
+
+void CMGKeyDefinition::OnActivate(void)
+{
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ SetBindingNames(/*bDefining=*/TRUE);
+ mg_iState = RELEASE_RETURN_WAITING;
+}
+
+BOOL CMGKeyDefinition::OnKeyDown(int iVKey)
+{
+ // if waiting for a key definition
+ if (mg_iState == PRESS_KEY_WAITING) {
+ // do nothing
+ return TRUE;
+ }
+
+ // if backspace pressed
+ if (iVKey == VK_BACK) {
+ // clear both keys
+ DefineKey(KID_NONE);
+ // message is processed
+ return TRUE;
+ }
+
+ return CMenuGadget::OnKeyDown(iVKey);
+}
+
+// set names for both key bindings
+void CMGKeyDefinition::SetBindingNames(BOOL bDefining)
+{
+ // find the button
+ INDEX ict = 0;
+ INDEX iDik = 0;
+ FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) {
+ if (ict == mg_iControlNumber) {
+ CButtonAction &ba = *itba;
+ // get the current bindings and names
+ INDEX iKey1 = ba.ba_iFirstKey;
+ INDEX iKey2 = ba.ba_iSecondKey;
+ BOOL bKey1Bound = iKey1 != KID_NONE;
+ BOOL bKey2Bound = iKey2 != KID_NONE;
+ CTString strKey1 = _pInput->GetButtonTransName(iKey1);
+ CTString strKey2 = _pInput->GetButtonTransName(iKey2);
+
+ // if defining
+ if (bDefining) {
+ // if only first key is defined
+ if (bKey1Bound && !bKey2Bound) {
+ // put question mark for second key
+ mg_strBinding = strKey1 + TRANS(" or ") + "?";
+ // otherwise
+ } else {
+ // put question mark only
+ mg_strBinding = "?";
+ }
+ // if not defining
+ }
+ else {
+ // if second key is defined
+ if (bKey2Bound) {
+ // add both
+ mg_strBinding = strKey1 + TRANS(" or ") + strKey2;
+ // if second key is undefined
+ } else {
+ // display only first one
+ mg_strBinding = strKey1;
+ }
+ }
+ return;
+ }
+ ict++;
+ }
+
+ // if not found, put errorneous string
+ mg_strBinding = "???";
+}
+
+void CMGKeyDefinition::Appear(void)
+{
+ SetBindingNames(/*bDefining=*/FALSE);
+ CMenuGadget::Appear();
+}
+
+void CMGKeyDefinition::Disappear(void)
+{
+ CMenuGadget::Disappear();
+}
+
+void CMGKeyDefinition::DefineKey(INDEX iDik)
+{
+ // for each button in controls
+ INDEX ict = 0;
+ FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) {
+ CButtonAction &ba = *itba;
+ // if it is this one
+ if (ict == mg_iControlNumber) {
+ // if should clear
+ if (iDik == KID_NONE) {
+ // unbind both
+ ba.ba_iFirstKey = KID_NONE;
+ ba.ba_iSecondKey = KID_NONE;
+ }
+ // if first key is unbound, or both keys are bound
+ if (ba.ba_iFirstKey == KID_NONE || ba.ba_iSecondKey != KID_NONE) {
+ // bind first key
+ ba.ba_iFirstKey = iDik;
+ // clear second key
+ ba.ba_iSecondKey = KID_NONE;
+ // if only first key bound
+ } else {
+ // bind second key
+ ba.ba_iSecondKey = iDik;
+ }
+ // if it is not this one
+ } else {
+ // clear bindings that contain this key
+ if (ba.ba_iFirstKey == iDik) {
+ ba.ba_iFirstKey = KID_NONE;
+ }
+ if (ba.ba_iSecondKey == iDik) {
+ ba.ba_iSecondKey = KID_NONE;
+ }
+ }
+ ict++;
+ }
+
+ SetBindingNames(/*bDefining=*/FALSE);
+}
+
+void CMGKeyDefinition::Think(void)
+{
+ if (mg_iState == RELEASE_RETURN_WAITING)
+ {
+ _bDefiningKey = TRUE;
+ extern BOOL _bMouseUsedLast;
+ _bMouseUsedLast = FALSE;
+ _pInput->SetJoyPolling(TRUE);
+ _pInput->GetInput(FALSE);
+ if (_pInput->IsInputEnabled() &&
+ !_pInput->GetButtonState(KID_ENTER) &&
+ !_pInput->GetButtonState(KID_MOUSE1))
+ {
+ mg_iState = PRESS_KEY_WAITING;
+ }
+ }
+ else if (mg_iState == PRESS_KEY_WAITING)
+ {
+ _pInput->SetJoyPolling(TRUE);
+ _pInput->GetInput(FALSE);
+ for (INDEX iDik = 0; iDikGetButtonState(iDik))
+ {
+ // skip keys that cannot be defined
+ if (iDik == KID_TILDE) {
+ continue;
+ }
+ // if escape not pressed
+ if (iDik != KID_ESCAPE) {
+ // define the new key
+ DefineKey(iDik);
+ // if escape pressed
+ } else {
+ // undefine the key
+ DefineKey(KID_NONE);
+ }
+
+ // end defining loop
+ mg_iState = DOING_NOTHING;
+ _bDefiningKey = FALSE;
+ // refresh all buttons
+ pgmCurrentMenu->FillListItems();
+ break;
+ }
+ }
+ }
+}
+
+void CMGKeyDefinition::Render(CDrawPort *pdp)
+{
+ SetFontMedium(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+
+ COLOR col = GetCurrentColor();
+ pdp->PutTextR(mg_strLabel, pixIL, pixJ, col);
+ pdp->PutText(mg_strBinding, pixIR, pixJ, col);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGKeyDefinition.h b/Sources/SeriousSam/GUI/Components/MGKeyDefinition.h
new file mode 100644
index 0000000..9291e65
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGKeyDefinition.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_KEYDEFINITION_H
+#define SE_INCL_MENU_GADGET_KEYDEFINITION_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuGadget.h"
+
+
+class CMGKeyDefinition : public CMenuGadget {
+public:
+ INDEX mg_iState;
+ INDEX mg_iControlNumber;
+
+ CTString mg_strLabel;
+ CTString mg_strBinding;
+
+ CMGKeyDefinition(void);
+ void Appear(void);
+ void Disappear(void);
+ void OnActivate(void);
+ // return TRUE if handled
+ BOOL OnKeyDown(int iVKey);
+ void Think(void);
+ // set names for both key bindings
+ void SetBindingNames(BOOL bDefining);
+ void DefineKey(INDEX iDik);
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGLevelButton.cpp b/Sources/SeriousSam/GUI/Components/MGLevelButton.cpp
new file mode 100644
index 0000000..1077e28
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGLevelButton.cpp
@@ -0,0 +1,38 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGLevelButton.h"
+
+extern CSoundData *_psdPress;
+
+
+void CMGLevelButton::OnActivate(void)
+{
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ _pGame->gam_strCustomLevel = mg_fnmLevel;
+ extern void(*_pAfterLevelChosen)(void);
+ _pAfterLevelChosen();
+}
+
+void CMGLevelButton::OnSetFocus(void)
+{
+ SetThumbnail(mg_fnmLevel);
+ CMGButton::OnSetFocus();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGLevelButton.h b/Sources/SeriousSam/GUI/Components/MGLevelButton.h
new file mode 100644
index 0000000..a0f5e80
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGLevelButton.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_LEVELBUTTON_H
+#define SE_INCL_MENU_GADGET_LEVELBUTTON_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGLevelButton : public CMGButton {
+public:
+ CTFileName mg_fnmLevel;
+
+ void OnActivate(void);
+ void OnSetFocus(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGModel.cpp b/Sources/SeriousSam/GUI/Components/MGModel.cpp
new file mode 100644
index 0000000..ee3583b
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGModel.cpp
@@ -0,0 +1,126 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGModel.h"
+
+extern INDEX sam_bWideScreen;
+
+
+CMGModel::CMGModel(void)
+{
+ mg_fFloorY = 0;
+}
+
+void CMGModel::Render(CDrawPort *pdp)
+{
+ // if no model
+ if (mg_moModel.GetData() == NULL) {
+ // just render text
+ mg_strText = TRANS("No model");
+ CMGButton::Render(pdp);
+ return;
+ }
+
+ // get position on screen
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ CDrawPort dpModel(pdp, box);
+ dpModel.Lock();
+ dpModel.FillZBuffer(1.0f);
+
+ LCDSetDrawport(&dpModel);
+ // clear menu here
+ dpModel.Fill(C_BLACK | 255);
+ LCDRenderClouds1();
+ LCDRenderClouds2();
+
+ // prepare projection
+ CRenderModel rmRenderModel;
+ CPerspectiveProjection3D pr;
+ pr.FOVL() = sam_bWideScreen ? AngleDeg(45.0f) : AngleDeg(30.0f);
+ pr.ScreenBBoxL() = FLOATaabbox2D(
+ FLOAT2D(0.0f, 0.0f),
+ FLOAT2D((float)dpModel.GetWidth(), (float)dpModel.GetHeight())
+ );
+ pr.AspectRatioL() = 1.0f;
+ pr.FrontClipDistanceL() = 0.3f;
+ pr.ViewerPlacementL() = CPlacement3D(FLOAT3D(0, 0, 0), ANGLE3D(0, 0, 0));
+
+ // initialize remdering
+ CAnyProjection3D apr;
+ apr = pr;
+ BeginModelRenderingView(apr, &dpModel);
+ rmRenderModel.rm_vLightDirection = FLOAT3D(0.2f, -0.2f, -0.2f);
+
+ // if model needs floor
+ if (mg_moFloor.GetData() != NULL) {
+ // set floor's position
+ CPlacement3D pl = mg_plModel;
+ pl.pl_OrientationAngle = ANGLE3D(0, 0, 0);
+ pl.pl_PositionVector = mg_plModel.pl_PositionVector;
+ pl.pl_PositionVector(2) += mg_fFloorY;
+ rmRenderModel.SetObjectPlacement(pl);
+
+ // render the floor
+ rmRenderModel.rm_colLight = C_WHITE;
+ rmRenderModel.rm_colAmbient = C_WHITE;
+ mg_moFloor.SetupModelRendering(rmRenderModel);
+ mg_moFloor.RenderModel(rmRenderModel);
+ }
+
+ // set model's position
+ CPlacement3D pl;
+ pl.pl_OrientationAngle = mg_plModel.pl_OrientationAngle;
+ pl.pl_PositionVector = mg_plModel.pl_PositionVector;
+ extern FLOAT sam_fPlayerOffset;
+ pl.pl_PositionVector(3) += sam_fPlayerOffset;
+ rmRenderModel.SetObjectPlacement(pl);
+
+ // render the model
+ rmRenderModel.rm_colLight = LerpColor(C_BLACK, C_WHITE, 0.4f) | CT_OPAQUE;
+ rmRenderModel.rm_colAmbient = LerpColor(C_BLACK, C_WHITE, 0.2f) | CT_OPAQUE;
+ mg_moModel.SetupModelRendering(rmRenderModel);
+ FLOATplane3D plFloorPlane = FLOATplane3D(FLOAT3D(0.0f, 1.0f, 0.0f),
+ mg_plModel.pl_PositionVector(2) + mg_fFloorY);
+ FLOAT3D vShadowLightDir = FLOAT3D(-0.2f, -0.4f, -0.6f);
+ CPlacement3D plLightPlacement = CPlacement3D(
+ mg_plModel.pl_PositionVector +
+ vShadowLightDir*mg_plModel.pl_PositionVector(3) * 5,
+ ANGLE3D(0, 0, 0));
+ mg_moModel.RenderShadow(rmRenderModel, plLightPlacement, 200.0f, 200.0f, 1.0f, plFloorPlane);
+ mg_moModel.RenderModel(rmRenderModel);
+ EndModelRenderingView();
+
+ LCDScreenBox(LCDGetColor(C_GREEN, "model box") | GetCurrentColor());
+
+ dpModel.Unlock();
+
+ pdp->Unlock();
+ pdp->Lock();
+ LCDSetDrawport(pdp);
+
+ // print the model name
+ {
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, BoxPlayerModelName());
+ COLOR col = GetCurrentColor();
+
+ PIX pixI = box.Min()(1);
+ PIX pixJ = box.Max()(2);
+ pdp->PutText(mg_strText, pixI, pixJ, col);
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGModel.h b/Sources/SeriousSam/GUI/Components/MGModel.h
new file mode 100644
index 0000000..9cdbc7d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGModel.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_MODEL_H
+#define SE_INCL_MENU_GADGET_MODEL_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGModel : public CMGButton {
+public:
+ CModelObject mg_moModel;
+ CModelObject mg_moFloor;
+ CPlacement3D mg_plModel;
+ BOOL mg_fFloorY;
+
+ CMGModel(void);
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGServerList.cpp b/Sources/SeriousSam/GUI/Components/MGServerList.cpp
new file mode 100644
index 0000000..51a4c40
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGServerList.cpp
@@ -0,0 +1,454 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGServerList.h"
+#include "MGEdit.h"
+
+extern CSoundData *_psdSelect;
+extern CSoundData *_psdPress;
+
+
+FLOATaabbox2D GetBoxPartHoriz(const FLOATaabbox2D &box, FLOAT fMin, FLOAT fMax)
+{
+ FLOAT fBoxMin = box.Min()(1);
+ FLOAT fBoxSize = box.Size()(1);
+
+ return FLOATaabbox2D(
+ FLOAT2D(fBoxMin + fBoxSize*fMin, box.Min()(2)),
+ FLOAT2D(fBoxMin + fBoxSize*fMax, box.Max()(2)));
+}
+
+void PrintInBox(CDrawPort *pdp, PIX pixI, PIX pixJ, PIX pixSizeI, CTString str, COLOR col)
+{
+ str = str.Undecorated();
+ PIX pixCharSize = pdp->dp_pixTextCharSpacing + pdp->dp_FontData->fd_pixCharWidth;
+ str.TrimRight(pixSizeI / pixCharSize);
+
+ // print text
+ pdp->PutText(str, pixI, pixJ, col);
+}
+
+CMGServerList::CMGServerList()
+{
+ mg_iSelected = 0;
+ mg_iFirstOnScreen = 0;
+ mg_ctOnScreen = 10;
+ mg_pixMinI = 0;
+ mg_pixMaxI = 0;
+ mg_pixListMinJ = 0;
+ mg_pixListStepJ = 0;
+ mg_pixDragJ = -1;
+ mg_iDragLine = -1;
+ mg_pixMouseDrag = -1;
+ // by default, sort by ping, best on top
+ mg_iSort = 2;
+ mg_bSortDown = FALSE;
+}
+void CMGServerList::AdjustFirstOnScreen(void)
+{
+ INDEX ctSessions = _lhServers.Count();
+ mg_iSelected = Clamp(mg_iSelected, 0L, ClampDn(ctSessions - 1L, 0L));
+ mg_iFirstOnScreen = Clamp(mg_iFirstOnScreen, 0L, ClampDn(ctSessions - mg_ctOnScreen, 0L));
+
+ if (mg_iSelected= mg_iFirstOnScreen + mg_ctOnScreen) {
+ mg_iFirstOnScreen = ClampDn(mg_iSelected - mg_ctOnScreen + 1L, 0L);
+ }
+}
+
+BOOL _iSort = 0;
+BOOL _bSortDown = FALSE;
+
+int CompareSessions(const void *pv0, const void *pv1)
+{
+ const CNetworkSession &ns0 = **(const CNetworkSession **)pv0;
+ const CNetworkSession &ns1 = **(const CNetworkSession **)pv1;
+
+ int iResult = 0;
+ switch (_iSort) {
+ case 0: iResult = stricmp(ns0.ns_strSession, ns1.ns_strSession); break;
+ case 1: iResult = stricmp(ns0.ns_strWorld, ns1.ns_strWorld); break;
+ case 2: iResult = Sgn(ns0.ns_tmPing - ns1.ns_tmPing); break;
+ case 3: iResult = Sgn(ns0.ns_ctPlayers - ns1.ns_ctPlayers); break;
+ case 4: iResult = stricmp(ns0.ns_strGameType, ns1.ns_strGameType); break;
+ case 5: iResult = stricmp(ns0.ns_strMod, ns1.ns_strMod); break;
+ case 6: iResult = stricmp(ns0.ns_strVer, ns1.ns_strVer); break;
+ }
+
+ if (iResult == 0) { // make sure we always have unique order when resorting
+ return stricmp(ns0.ns_strAddress, ns1.ns_strAddress);;
+ }
+
+ return _bSortDown ? -iResult : iResult;
+}
+
+extern CMGButton mgServerColumn[7];
+extern CMGEdit mgServerFilter[7];
+
+void SortAndFilterServers(void)
+{
+ {FORDELETELIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
+ delete &*itns;
+ }}
+
+ {FOREACHINLIST(CNetworkSession, ns_lnNode, _pNetwork->ga_lhEnumeratedSessions, itns) {
+ CNetworkSession &ns = *itns;
+ extern CTString _strServerFilter[7];
+ if (_strServerFilter[0] != "" && !ns.ns_strSession.Matches("*" + _strServerFilter[0] + "*")) continue;
+ if (_strServerFilter[1] != "" && !ns.ns_strWorld.Matches("*" + _strServerFilter[1] + "*")) continue;
+ if (_strServerFilter[2] != "") {
+ char strCompare[3] = { 0, 0, 0 };
+ int iPing = 0;
+ _strServerFilter[2].ScanF("%2[<>=]%d", strCompare, &iPing);
+ if (strcmp(strCompare, "<") == 0 && !(int(ns.ns_tmPing * 1000)< iPing)) continue;
+ if (strcmp(strCompare, "<=") == 0 && !(int(ns.ns_tmPing * 1000) <= iPing)) continue;
+ if (strcmp(strCompare, ">") == 0 && !(int(ns.ns_tmPing * 1000)> iPing)) continue;
+ if (strcmp(strCompare, ">=") == 0 && !(int(ns.ns_tmPing * 1000) >= iPing)) continue;
+ if (strcmp(strCompare, "=") == 0 && !(int(ns.ns_tmPing * 1000) == iPing)) continue;
+ }
+ if (_strServerFilter[3] != "") {
+ char strCompare[3] = { 0, 0, 0 };
+ int iPlayers = 0;
+ _strServerFilter[3].ScanF("%2[<>=]%d", strCompare, &iPlayers);
+ if (strcmp(strCompare, "<") == 0 && !(ns.ns_ctPlayers< iPlayers)) continue;
+ if (strcmp(strCompare, "<=") == 0 && !(ns.ns_ctPlayers <= iPlayers)) continue;
+ if (strcmp(strCompare, ">") == 0 && !(ns.ns_ctPlayers> iPlayers)) continue;
+ if (strcmp(strCompare, ">=") == 0 && !(ns.ns_ctPlayers >= iPlayers)) continue;
+ if (strcmp(strCompare, "=") == 0 && !(ns.ns_ctPlayers == iPlayers)) continue;
+ }
+ if (_strServerFilter[4] != "" && !ns.ns_strGameType.Matches("*" + _strServerFilter[4] + "*")) continue;
+ if (_strServerFilter[5] != "" && !ns.ns_strMod.Matches("*" + _strServerFilter[5] + "*")) continue;
+ if (_strServerFilter[6] != "" && !ns.ns_strVer.Matches("*" + _strServerFilter[6] + "*")) continue;
+
+ CNetworkSession *pnsNew = new CNetworkSession;
+ pnsNew->Copy(*itns);
+ _lhServers.AddTail(pnsNew->ns_lnNode);
+ }
+}
+
+ _lhServers.Sort(CompareSessions, offsetof(CNetworkSession, ns_lnNode));
+}
+
+void CMGServerList::Render(CDrawPort *pdp)
+{
+ _iSort = mg_iSort;
+ _bSortDown = mg_bSortDown;
+ SortAndFilterServers();
+
+ SetFontSmall(pdp);
+ BOOL bFocusedBefore = mg_bFocused;
+ mg_bFocused = FALSE;
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ COLOR col = GetCurrentColor();
+
+ PIX pixDPSizeI = pdp->GetWidth();
+ PIX pixDPSizeJ = pdp->GetHeight();
+ PIX pixCharSizeI = pdp->dp_pixTextCharSpacing + pdp->dp_FontData->fd_pixCharWidth;
+ PIX pixCharSizeJ = pdp->dp_pixTextLineSpacing + pdp->dp_FontData->fd_pixCharHeight + 1;
+ PIX pixLineSize = 1;
+ PIX pixSliderSizeI = 10;
+ PIX pixOuterMargin = 20;
+
+ INDEX ctSessions = _lhServers.Count();
+ INDEX iSession = 0;
+
+ INDEX ctColumns[7];
+ {for (INDEX i = 0; iDrawLine(apixSeparatorI[i], pixTopJ, apixSeparatorI[i], pixBottomJ, col | CT_OPAQUE);
+ }
+ pdp->DrawLine(apixSeparatorI[0], pixTopJ, apixSeparatorI[8], pixTopJ, col | CT_OPAQUE);
+ pdp->DrawLine(apixSeparatorI[0], pixListTopJ - pixLineSize, apixSeparatorI[8], pixListTopJ - pixLineSize, col | CT_OPAQUE);
+ pdp->DrawLine(apixSeparatorI[0], pixBottomJ, apixSeparatorI[8], pixBottomJ, col | CT_OPAQUE);
+
+ PIXaabbox2D boxHandle = GetScrollBarHandleBox();
+ pdp->Fill(boxHandle.Min()(1) + 2, boxHandle.Min()(2) + 2, boxHandle.Size()(1) - 3, boxHandle.Size()(2) - 3, col | CT_OPAQUE);
+
+ PIX pixJ = pixTopJ + pixLineSize * 2 + 1;
+
+ mg_ctOnScreen = ctSessionsOnScreen;
+ AdjustFirstOnScreen();
+
+ if (_lhServers.Count() == 0) {
+ if (_pNetwork->ga_strEnumerationStatus != "") {
+ mg_bFocused = TRUE;
+ COLOR colItem = GetCurrentColor();
+ PrintInBox(pdp, apixSeparatorI[0] + pixCharSizeI, pixListTopJ + pixCharSizeJ + pixLineSize + 1, apixSeparatorI[1] - apixSeparatorI[0],
+ TRANS("searching..."), colItem);
+ }
+ } else {
+ FOREACHINLIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
+ CNetworkSession &ns = *itns;
+
+ if (iSession= mg_iFirstOnScreen + ctSessionsOnScreen) {
+ iSession++;
+ continue;
+ }
+
+ PIX pixJ = pixListTopJ + (iSession - mg_iFirstOnScreen)*pixCharSizeJ + pixLineSize + 1;
+
+ mg_bFocused = bFocusedBefore&&iSession == mg_iSelected;
+ COLOR colItem = GetCurrentColor();
+
+ if (ns.ns_strVer != _SE_VER_STRING) {
+ colItem = MulColors(colItem, 0xA0A0A0FF);
+ }
+
+ CTString strPing(0, "%4d", INDEX(ns.ns_tmPing * 1000));
+ CTString strPlayersCt(0, "%2d/%2d", ns.ns_ctPlayers, ns.ns_ctMaxPlayers);
+ CTString strMod = ns.ns_strMod;
+ if (strMod == "") {
+ strMod = "SeriousSam";
+ }
+ PrintInBox(pdp, apixSeparatorI[0] + pixCharSizeI / 2, pixJ, apixSeparatorI[1] - apixSeparatorI[0] - pixCharSizeI, ns.ns_strSession, colItem);
+ PrintInBox(pdp, apixSeparatorI[1] + pixCharSizeI / 2, pixJ, apixSeparatorI[2] - apixSeparatorI[1] - pixCharSizeI, TranslateConst(ns.ns_strWorld), colItem);
+ PrintInBox(pdp, apixSeparatorI[2] + pixCharSizeI / 2, pixJ, apixSeparatorI[3] - apixSeparatorI[2] - pixCharSizeI, strPing, colItem);
+ PrintInBox(pdp, apixSeparatorI[3] + pixCharSizeI / 2, pixJ, apixSeparatorI[4] - apixSeparatorI[3] - pixCharSizeI, strPlayersCt, colItem);
+ PrintInBox(pdp, apixSeparatorI[4] + pixCharSizeI / 2, pixJ, apixSeparatorI[5] - apixSeparatorI[4] - pixCharSizeI, TranslateConst(ns.ns_strGameType), colItem);
+ PrintInBox(pdp, apixSeparatorI[5] + pixCharSizeI / 2, pixJ, apixSeparatorI[6] - apixSeparatorI[5] - pixCharSizeI, TranslateConst(strMod), colItem);
+ PrintInBox(pdp, apixSeparatorI[6] + pixCharSizeI / 2, pixJ, apixSeparatorI[7] - apixSeparatorI[6] - pixCharSizeI, ns.ns_strVer, colItem);
+
+ iSession++;
+ }
+ }
+
+ mg_bFocused = bFocusedBefore;
+}
+
+static INDEX SliderPixToIndex(PIX pixOffset, INDEX iVisible, INDEX iTotal, PIXaabbox2D boxFull)
+{
+ FLOAT fSize = ClampUp(FLOAT(iVisible) / iTotal, 1.0f);
+ PIX pixFull = boxFull.Size()(2);
+ PIX pixSize = PIX(pixFull*fSize);
+ if (pixSize >= boxFull.Size()(2)) {
+ return 0;
+ }
+ return (iTotal*pixOffset) / pixFull;
+}
+
+static PIXaabbox2D GetSliderBox(INDEX iFirst, INDEX iVisible, INDEX iTotal,
+ PIXaabbox2D boxFull)
+{
+ if (iTotal <= 0) {
+ return boxFull;
+ }
+ FLOAT fSize = ClampUp(FLOAT(iVisible) / iTotal, 1.0f);
+ PIX pixFull = boxFull.Size()(2);
+ PIX pixSize = PIX(pixFull*fSize);
+ pixSize = ClampDn(pixSize, boxFull.Size()(1));
+ PIX pixTop = pixFull*(FLOAT(iFirst) / iTotal) + boxFull.Min()(2);
+ PIX pixI0 = boxFull.Min()(1);
+ PIX pixI1 = boxFull.Max()(1);
+ return PIXaabbox2D(PIX2D(pixI0, pixTop), PIX2D(pixI1, pixTop + pixSize));
+}
+
+PIXaabbox2D CMGServerList::GetScrollBarFullBox(void)
+{
+ return PIXaabbox2D(PIX2D(mg_pixSBMinI, mg_pixSBMinJ), PIX2D(mg_pixSBMaxI, mg_pixSBMaxJ));
+}
+
+PIXaabbox2D CMGServerList::GetScrollBarHandleBox(void)
+{
+ return GetSliderBox(mg_iFirstOnScreen, mg_ctOnScreen, _lhServers.Count(), GetScrollBarFullBox());
+}
+
+void CMGServerList::OnMouseOver(PIX pixI, PIX pixJ)
+{
+ mg_pixMouseI = pixI;
+ mg_pixMouseJ = pixJ;
+
+ if (!(GetKeyState(VK_LBUTTON) & 0x8000)) {
+ mg_pixDragJ = -1;
+ }
+
+ BOOL bInSlider = (pixI >= mg_pixSBMinI && pixI <= mg_pixSBMaxI && pixJ >= mg_pixSBMinJ && pixJ <= mg_pixSBMaxJ);
+ if (mg_pixDragJ >= 0 && bInSlider) {
+ PIX pixDelta = pixJ - mg_pixDragJ;
+ INDEX ctSessions = _lhServers.Count();
+ INDEX iWantedLine = mg_iDragLine +
+ SliderPixToIndex(pixDelta, mg_ctOnScreen, ctSessions, GetScrollBarFullBox());
+ mg_iFirstOnScreen = Clamp(iWantedLine, 0L, ClampDn(ctSessions - mg_ctOnScreen, 0L));
+ mg_iSelected = Clamp(mg_iSelected, mg_iFirstOnScreen, mg_iFirstOnScreen + mg_ctOnScreen - 1L);
+ // AdjustFirstOnScreen();
+ return;
+ }
+
+ // if some server is selected
+ if (pixI >= mg_pixMinI && pixI <= mg_pixMaxI) {
+ INDEX iOnScreen = (pixJ - mg_pixListMinJ) / mg_pixListStepJ;
+ if (iOnScreen >= 0 && iOnScreen=mg_pixHeaderMinJ && mg_pixMouseJ<=mg_pixHeaderMidJ
+ && mg_pixMouseI>=mg_pixHeaderI[0] && mg_pixMouseI<=mg_pixHeaderI[7]) {
+ INDEX iNewSort = mg_iSort;
+ if (mg_pixMouseI<=mg_pixHeaderI[1]) {
+ iNewSort = 0;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[2]) {
+ iNewSort = 1;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[3]) {
+ iNewSort = 2;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[4]) {
+ iNewSort = 3;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[5]) {
+ iNewSort = 4;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[6]) {
+ iNewSort = 5;
+ } else if (mg_pixMouseI<=mg_pixHeaderI[7]) {
+ iNewSort = 6;
+ }
+ if (iNewSort==mg_iSort) {
+ mg_bSortDown = !mg_bSortDown;
+ } else {
+ mg_bSortDown = FALSE;
+ }
+ mg_iSort = iNewSort;
+ break;
+ } else */if (mg_pixMouseDrag >= 0) {
+ mg_pixDragJ = mg_pixMouseDrag;
+ mg_iDragLine = mg_iFirstOnScreen;
+ break;
+ }
+ case VK_RETURN:
+ PlayMenuSound(_psdPress);
+ IFeel_PlayEffect("Menu_press");
+ {INDEX i = 0;
+ FOREACHINLIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
+ if (i == mg_iSelected) {
+
+ char strAddress[256];
+ int iPort;
+ itns->ns_strAddress.ScanF("%200[^:]:%d", &strAddress, &iPort);
+ _pGame->gam_strJoinAddress = strAddress;
+ _pShell->SetINDEX("net_iPort", iPort);
+ extern void StartSelectPlayersMenuFromServers(void);
+ StartSelectPlayersMenuFromServers();
+ return TRUE;
+ }
+ i++;
+ }}
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void CMGServerList::OnSetFocus(void)
+{
+ mg_bFocused = TRUE;
+}
+
+void CMGServerList::OnKillFocus(void)
+{
+ mg_bFocused = FALSE;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGServerList.h b/Sources/SeriousSam/GUI/Components/MGServerList.h
new file mode 100644
index 0000000..8932bb2
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGServerList.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_SERVERLIST_H
+#define SE_INCL_MENU_GADGET_SERVERLIST_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGServerList : public CMGButton {
+public:
+ INDEX mg_iSelected;
+ INDEX mg_iFirstOnScreen;
+ INDEX mg_ctOnScreen;
+ // server list dimensions
+ PIX mg_pixMinI;
+ PIX mg_pixMaxI;
+ PIX mg_pixListMinJ;
+ PIX mg_pixListStepJ;
+ // header dimensions
+ PIX mg_pixHeaderMinJ;
+ PIX mg_pixHeaderMidJ;
+ PIX mg_pixHeaderMaxJ;
+ PIX mg_pixHeaderI[8];
+ // scrollbar dimensions
+ PIX mg_pixSBMinI;
+ PIX mg_pixSBMaxI;
+ PIX mg_pixSBMinJ;
+ PIX mg_pixSBMaxJ;
+ // scrollbar dragging params
+ PIX mg_pixDragJ;
+ PIX mg_iDragLine;
+ PIX mg_pixMouseDrag;
+ // current mouse pos
+ PIX mg_pixMouseI;
+ PIX mg_pixMouseJ;
+
+ INDEX mg_iSort; // column to sort by
+ BOOL mg_bSortDown; // sort in reverse order
+
+ CMGServerList();
+ BOOL OnKeyDown(int iVKey);
+ PIXaabbox2D GetScrollBarFullBox(void);
+ PIXaabbox2D GetScrollBarHandleBox(void);
+ void OnSetFocus(void);
+ void OnKillFocus(void);
+ void Render(CDrawPort *pdp);
+ void AdjustFirstOnScreen(void);
+ void OnMouseOver(PIX pixI, PIX pixJ);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGSlider.cpp b/Sources/SeriousSam/GUI/Components/MGSlider.cpp
new file mode 100644
index 0000000..01a360a
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGSlider.cpp
@@ -0,0 +1,126 @@
+/* /* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGSlider.h"
+
+extern PIX _pixCursorPosI;
+extern PIX _pixCursorPosJ;
+extern INDEX sam_bWideScreen;
+
+
+CMGSlider::CMGSlider()
+{
+ mg_iMinPos = 0;
+ mg_iMaxPos = 16;
+ mg_iCurPos = 8;
+ mg_pOnSliderChange = NULL;
+ mg_fFactor = 1.0f;
+}
+
+void CMGSlider::ApplyCurrentPosition(void)
+{
+ mg_iCurPos = Clamp(mg_iCurPos, mg_iMinPos, mg_iMaxPos);
+ FLOAT fStretch = FLOAT(mg_iCurPos) / (mg_iMaxPos - mg_iMinPos);
+ mg_fFactor = fStretch;
+
+ if (mg_pOnSliderChange != NULL) {
+ mg_pOnSliderChange(mg_iCurPos);
+ }
+}
+
+void CMGSlider::ApplyGivenPosition(INDEX iMin, INDEX iMax, INDEX iCur)
+{
+ mg_iMinPos = iMin;
+ mg_iMaxPos = iMax;
+ mg_iCurPos = iCur;
+ ApplyCurrentPosition();
+}
+
+
+BOOL CMGSlider::OnKeyDown(int iVKey)
+{
+ // if scrolling left
+ if ((iVKey == VK_BACK || iVKey == VK_LEFT) && mg_iCurPos>mg_iMinPos) {
+ mg_iCurPos--;
+ ApplyCurrentPosition();
+ return TRUE;
+ // if scrolling right
+ } else if ((iVKey == VK_RETURN || iVKey == VK_RIGHT) && mg_iCurPos= PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
+ // set new position exactly where mouse pointer is
+ FLOAT fRatio = FLOAT(_pixCursorPosI - boxSlider.Min()(1)) / boxSlider.Size()(1);
+ fRatio = (fRatio - 0.01f) / (0.99f - 0.01f);
+ fRatio = Clamp(fRatio, 0.0f, 1.0f);
+ mg_iCurPos = fRatio*(mg_iMaxPos - mg_iMinPos) + mg_iMinPos;
+ ApplyCurrentPosition();
+ return TRUE;
+ }
+ }
+ return CMenuGadget::OnKeyDown(iVKey);
+}
+
+PIXaabbox2D CMGSlider::GetSliderBox(void)
+{
+ extern CDrawPort *pdp;
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+ PIX pixJSize = box.Size()(2)*0.95f;
+ PIX pixISizeR = box.Size()(1)*0.45f;
+ if (sam_bWideScreen) pixJSize++;
+ return PIXaabbox2D(PIX2D(pixIR + 1, pixJ + 1), PIX2D(pixIR + pixISizeR - 2, pixJ + pixJSize - 2));
+}
+
+void CMGSlider::Render(CDrawPort *pdp)
+{
+ SetFontMedium(pdp);
+
+ // get geometry
+ COLOR col = GetCurrentColor();
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+ PIX pixJSize = box.Size()(2)*0.95f;
+ PIX pixISizeR = box.Size()(1)*0.45f;
+ if (sam_bWideScreen) pixJSize++;
+
+ // print text left of slider
+ pdp->PutTextR(mg_strText, pixIL, pixJ, col);
+
+ // draw box around slider
+ LCDDrawBox(0, -1, PIXaabbox2D(PIX2D(pixIR + 1, pixJ), PIX2D(pixIR + pixISizeR - 2, pixJ + pixJSize - 2)),
+ LCDGetColor(C_GREEN | 255, "slider box"));
+
+ // draw filled part of slider
+ pdp->Fill(pixIR + 2, pixJ + 1, (pixISizeR - 5)*mg_fFactor, (pixJSize - 4), col);
+
+ // print percentage text
+ CTString strPercentage;
+ strPercentage.PrintF("%d%%", (int)floor(mg_fFactor * 100 + 0.5f));
+ pdp->PutTextC(strPercentage, pixIR + pixISizeR / 2, pixJ + 1, col);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGSlider.h b/Sources/SeriousSam/GUI/Components/MGSlider.h
new file mode 100644
index 0000000..eb582d4
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGSlider.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_SLIDER_H
+#define SE_INCL_MENU_GADGET_SLIDER_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGSlider : public CMGButton {
+public:
+ FLOAT mg_fFactor;
+ INDEX mg_iMinPos;
+ INDEX mg_iMaxPos;
+ INDEX mg_iCurPos;
+
+ CMGSlider();
+ void ApplyCurrentPosition(void);
+ void ApplyGivenPosition(INDEX iMin, INDEX iMax, INDEX iCur);
+ // return TRUE if handled
+ virtual BOOL OnKeyDown(int iVKey);
+ void(*mg_pOnSliderChange)(INDEX iCurPos);
+ PIXaabbox2D GetSliderBox(void);
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGTitle.cpp b/Sources/SeriousSam/GUI/Components/MGTitle.cpp
new file mode 100644
index 0000000..76e0c01
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGTitle.cpp
@@ -0,0 +1,32 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGTitle.h"
+
+
+void CMGTitle::Render(CDrawPort *pdp)
+{
+ SetFontTitle(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixI = box.Center()(1);
+ PIX pixJ = box.Min()(2);
+
+ pdp->PutTextC(mg_strText, pixI, pixJ, LCDGetColor(C_WHITE | CT_OPAQUE, "title"));
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGTitle.h b/Sources/SeriousSam/GUI/Components/MGTitle.h
new file mode 100644
index 0000000..7bb2658
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGTitle.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_TITLE_H
+#define SE_INCL_MENU_GADGET_TITLE_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuGadget.h"
+
+
+class CMGTitle : public CMenuGadget {
+public:
+ CTString mg_strText;
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGTrigger.cpp b/Sources/SeriousSam/GUI/Components/MGTrigger.cpp
new file mode 100644
index 0000000..8cd9a11
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGTrigger.cpp
@@ -0,0 +1,122 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "MGTrigger.h"
+
+
+INDEX GetNewLoopValue(int iVKey, INDEX iCurrent, INDEX ctMembers)
+{
+ INDEX iPrev = (iCurrent + ctMembers - 1) % ctMembers;
+ INDEX iNext = (iCurrent + 1) % ctMembers;
+ // return and right arrow set new text
+ if (iVKey == VK_RETURN || iVKey == VK_LBUTTON || iVKey == VK_RIGHT)
+ {
+ return iNext;
+ // left arrow and backspace sets prev text
+ } else if ((iVKey == VK_BACK || iVKey == VK_RBUTTON) || (iVKey == VK_LEFT)) {
+ return iPrev;
+ }
+ return iCurrent;
+}
+
+CMGTrigger::CMGTrigger(void)
+{
+ mg_pPreTriggerChange = NULL;
+ mg_pOnTriggerChange = NULL;
+ mg_iCenterI = 0;
+ mg_bVisual = FALSE;
+}
+
+void CMGTrigger::ApplyCurrentSelection(void)
+{
+ mg_iSelected = Clamp(mg_iSelected, 0L, mg_ctTexts - 1L);
+ mg_strValue = mg_astrTexts[mg_iSelected];
+}
+
+void CMGTrigger::OnSetNextInList(int iVKey)
+{
+ if (mg_pPreTriggerChange != NULL) {
+ mg_pPreTriggerChange(mg_iSelected);
+ }
+
+ mg_iSelected = GetNewLoopValue(iVKey, mg_iSelected, mg_ctTexts);
+ mg_strValue = mg_astrTexts[mg_iSelected];
+
+ if (mg_pOnTriggerChange != NULL) {
+ (*mg_pOnTriggerChange)(mg_iSelected);
+ }
+}
+
+BOOL CMGTrigger::OnKeyDown(int iVKey)
+{
+ if ((iVKey == VK_RETURN || iVKey == VK_LBUTTON) ||
+ (iVKey == VK_LEFT) ||
+ (iVKey == VK_BACK || iVKey == VK_RBUTTON) ||
+ (iVKey == VK_RIGHT))
+ {
+ // key is handled
+ if (mg_bEnabled) OnSetNextInList(iVKey);
+ return TRUE;
+ }
+ // key is not handled
+ return FALSE;
+}
+
+void CMGTrigger::Render(CDrawPort *pdp)
+{
+ SetFontMedium(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+
+ COLOR col = GetCurrentColor();
+ if (!mg_bVisual || mg_strValue == "") {
+ CTString strValue = mg_strValue;
+ if (mg_bVisual) {
+ strValue = TRANS("none");
+ }
+
+ if (mg_iCenterI == -1) {
+ pdp->PutText(mg_strLabel, box.Min()(1), pixJ, col);
+ pdp->PutTextR(strValue, box.Max()(1), pixJ, col);
+ } else {
+ pdp->PutTextR(mg_strLabel, pixIL, pixJ, col);
+ pdp->PutText(strValue, pixIR, pixJ, col);
+ }
+ } else {
+ CTString strLabel = mg_strLabel + ": ";
+ pdp->PutText(strLabel, box.Min()(1), pixJ, col);
+ CTextureObject to;
+ try {
+ to.SetData_t(mg_strValue);
+ CTextureData *ptd = (CTextureData *)to.GetData();
+ PIX pixSize = box.Size()(2);
+ PIX pixCX = box.Max()(1) - pixSize / 2;
+ PIX pixCY = box.Center()(2);
+ pdp->PutTexture(&to, PIXaabbox2D(
+ PIX2D(pixCX - pixSize / 2, pixCY - pixSize / 2),
+ PIX2D(pixCX - pixSize / 2 + pixSize, pixCY - pixSize / 2 + pixSize)), C_WHITE | 255);
+ } catch (char *strError) {
+ CPrintF("%s\n", strError);
+ }
+ to.SetData(NULL);
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGTrigger.h b/Sources/SeriousSam/GUI/Components/MGTrigger.h
new file mode 100644
index 0000000..1a5e8f4
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGTrigger.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_TRIGGER_H
+#define SE_INCL_MENU_GADGET_TRIGGER_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuGadget.h"
+
+
+class CMGTrigger : public CMenuGadget {
+public:
+ CTString mg_strLabel;
+ CTString mg_strValue;
+ CTString *mg_astrTexts;
+ INDEX mg_ctTexts;
+ INDEX mg_iSelected;
+ INDEX mg_iCenterI;
+ BOOL mg_bVisual;
+
+ CMGTrigger(void);
+
+ void ApplyCurrentSelection(void);
+ void OnSetNextInList(int iVKey);
+ void(*mg_pPreTriggerChange)(INDEX iCurrentlySelected);
+ void(*mg_pOnTriggerChange)(INDEX iCurrentlySelected);
+
+ // return TRUE if handled
+ BOOL OnKeyDown(int iVKey);
+ void Render(CDrawPort *pdp);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGVarButton.cpp b/Sources/SeriousSam/GUI/Components/MGVarButton.cpp
new file mode 100644
index 0000000..da00dc9
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGVarButton.cpp
@@ -0,0 +1,181 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "VarList.h"
+#include "MGVarButton.h"
+
+extern PIX _pixCursorPosI;
+extern PIX _pixCursorPosJ;
+
+
+BOOL CMGVarButton::IsSeparator(void)
+{
+ if (mg_pvsVar == NULL) return FALSE;
+ return mg_pvsVar->vs_bSeparator;
+}
+
+BOOL CMGVarButton::IsEnabled(void)
+{
+ return(_gmRunningGameMode == GM_NONE
+ || mg_pvsVar == NULL
+ || mg_pvsVar->vs_bCanChangeInGame);
+}
+
+// return slider position on scren
+PIXaabbox2D CMGVarButton::GetSliderBox(void)
+{
+ extern CDrawPort *pdp;
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixJ = box.Min()(2);
+ PIX pixISize = box.Size()(1)*0.13f;
+ PIX pixJSize = box.Size()(2);
+ return PIXaabbox2D(PIX2D(pixIR, pixJ + 1), PIX2D(pixIR + pixISize - 4, pixJ + pixJSize - 6));
+}
+
+extern BOOL _bVarChanged;
+BOOL CMGVarButton::OnKeyDown(int iVKey)
+{
+ if (mg_pvsVar == NULL || mg_pvsVar->vs_bSeparator || !mg_pvsVar->Validate() || !mg_bEnabled) {
+ return CMenuGadget::OnKeyDown(iVKey);
+ }
+
+ // handle slider
+ if (mg_pvsVar->vs_iSlider && !mg_pvsVar->vs_bCustom) {
+ // ignore RMB
+ if (iVKey == VK_RBUTTON) return TRUE;
+ // handle LMB
+ if (iVKey == VK_LBUTTON) {
+ // get position of slider box on screen
+ PIXaabbox2D boxSlider = GetSliderBox();
+ // if mouse is within
+ if (boxSlider >= PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
+ // set new position exactly where mouse pointer is
+ mg_pvsVar->vs_iValue = (FLOAT)(_pixCursorPosI - boxSlider.Min()(1)) / boxSlider.Size()(1) * (mg_pvsVar->vs_ctValues);
+ _bVarChanged = TRUE;
+ }
+ // handled
+ return TRUE;
+ }
+ }
+
+ if (iVKey == VK_RETURN) {
+ FlushVarSettings(TRUE);
+ void MenuGoToParent(void);
+ MenuGoToParent();
+ return TRUE;
+ }
+
+ if (iVKey == VK_LBUTTON || iVKey == VK_RIGHT) {
+ if (mg_pvsVar != NULL) {
+ INDEX iOldValue = mg_pvsVar->vs_iValue;
+ mg_pvsVar->vs_iValue++;
+ if (mg_pvsVar->vs_iValue >= mg_pvsVar->vs_ctValues) {
+ // wrap non-sliders, clamp sliders
+ if (mg_pvsVar->vs_iSlider) mg_pvsVar->vs_iValue = mg_pvsVar->vs_ctValues - 1L;
+ else mg_pvsVar->vs_iValue = 0;
+ }
+ if (iOldValue != mg_pvsVar->vs_iValue) {
+ _bVarChanged = TRUE;
+ mg_pvsVar->vs_bCustom = FALSE;
+ mg_pvsVar->Validate();
+ }
+ }
+ return TRUE;
+ }
+
+ if (iVKey == VK_LEFT || iVKey == VK_RBUTTON) {
+ if (mg_pvsVar != NULL) {
+ INDEX iOldValue = mg_pvsVar->vs_iValue;
+ mg_pvsVar->vs_iValue--;
+ if (mg_pvsVar->vs_iValue<0) {
+ // wrap non-sliders, clamp sliders
+ if (mg_pvsVar->vs_iSlider) mg_pvsVar->vs_iValue = 0;
+ else mg_pvsVar->vs_iValue = mg_pvsVar->vs_ctValues - 1L;
+ }
+ if (iOldValue != mg_pvsVar->vs_iValue) {
+ _bVarChanged = TRUE;
+ mg_pvsVar->vs_bCustom = FALSE;
+ mg_pvsVar->Validate();
+ }
+ }
+ return TRUE;
+ }
+
+ // not handled
+ return CMenuGadget::OnKeyDown(iVKey);
+}
+
+void CMGVarButton::Render(CDrawPort *pdp)
+{
+ if (mg_pvsVar == NULL) {
+ return;
+ }
+
+ SetFontMedium(pdp);
+
+ PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
+ PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
+ PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
+ PIX pixIC = box.Center()(1);
+ PIX pixJ = box.Min()(2);
+
+ if (mg_pvsVar->vs_bSeparator)
+ {
+ mg_bEnabled = FALSE;
+ COLOR col = LCDGetColor(C_WHITE | 255, "separator");
+ CTString strText = mg_pvsVar->vs_strName;
+ pdp->PutTextC(strText, pixIC, pixJ, col);
+ } else if (mg_pvsVar->Validate()) {
+ // check whether the variable is disabled
+ if (mg_pvsVar->vs_strFilter != "") mg_bEnabled = _pShell->GetINDEX(mg_pvsVar->vs_strFilter);
+ COLOR col = GetCurrentColor();
+ pdp->PutTextR(mg_pvsVar->vs_strName, pixIL, pixJ, col);
+ // custom is by default
+ CTString strText = TRANS("Custom");
+ if (!mg_pvsVar->vs_bCustom)
+ { // not custom!
+ strText = mg_pvsVar->vs_astrTexts[mg_pvsVar->vs_iValue];
+ // need slider?
+ if (mg_pvsVar->vs_iSlider>0) {
+ // draw box around slider
+ PIX pixISize = box.Size()(1)*0.13f;
+ PIX pixJSize = box.Size()(2);
+ LCDDrawBox(0, -1, PIXaabbox2D(PIX2D(pixIR, pixJ + 1), PIX2D(pixIR + pixISize - 4, pixJ + pixJSize - 6)),
+ LCDGetColor(C_GREEN | 255, "slider box"));
+
+ // draw filled part of slider
+ if (mg_pvsVar->vs_iSlider == 1) {
+ // fill slider
+ FLOAT fFactor = (FLOAT)(mg_pvsVar->vs_iValue + 1) / mg_pvsVar->vs_ctValues;
+ pdp->Fill(pixIR + 1, pixJ + 2, (pixISize - 6)*fFactor, pixJSize - 9, col);
+ } else {
+ // ratio slider
+ ASSERT(mg_pvsVar->vs_iSlider == 2);
+ FLOAT fUnitWidth = (FLOAT)(pixISize - 5) / mg_pvsVar->vs_ctValues;
+ pdp->Fill(pixIR + 1 + (mg_pvsVar->vs_iValue*fUnitWidth), pixJ + 2, fUnitWidth, pixJSize - 9, col);
+ }
+ // move text printout to the right of slider
+ pixIR += box.Size()(1)*0.15f;
+ }
+ }
+ // write right text
+ pdp->PutText(strText, pixIR, pixJ, col);
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MGVarButton.h b/Sources/SeriousSam/GUI/Components/MGVarButton.h
new file mode 100644
index 0000000..ec22f83
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MGVarButton.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_VARBUTTON_H
+#define SE_INCL_MENU_GADGET_VARBUTTON_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MGButton.h"
+
+
+class CMGVarButton : public CMGButton {
+public:
+ class CVarSetting *mg_pvsVar;
+ PIXaabbox2D GetSliderBox(void);
+ BOOL OnKeyDown(int iVKey);
+ void Render(CDrawPort *pdp);
+ BOOL IsSeparator(void);
+ BOOL IsEnabled(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Components/MenuGadget.cpp b/Sources/SeriousSam/GUI/Components/MenuGadget.cpp
new file mode 100644
index 0000000..22ea7fe
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MenuGadget.cpp
@@ -0,0 +1,137 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include "LevelInfo.h"
+#include "VarList.h"
+#include "MenuGadget.h"
+
+extern CSoundData *_psdSelect;
+
+extern BOOL _bDefiningKey = FALSE;
+extern BOOL _bEditingString = FALSE;
+extern CMenuGadget *_pmgLastActivatedGadget = NULL;
+
+
+CMenuGadget::CMenuGadget(void)
+{
+ mg_pmgLeft = NULL;
+ mg_pmgRight = NULL;
+ mg_pmgUp = NULL;
+ mg_pmgDown = NULL;
+
+ mg_bVisible = TRUE;
+ mg_bEnabled = TRUE;
+ mg_bLabel = FALSE;
+ mg_bFocused = FALSE;
+ mg_iInList = -1; // not in list
+}
+
+void CMenuGadget::OnActivate(void)
+{
+ NOTHING;
+}
+
+// return TRUE if handled
+BOOL CMenuGadget::OnKeyDown(int iVKey)
+{
+ // if return pressed
+ if (iVKey == VK_RETURN || iVKey == VK_LBUTTON) {
+ // activate
+ OnActivate();
+ // key is handled
+ return TRUE;
+ }
+ // key is not handled
+ return FALSE;
+}
+
+
+BOOL CMenuGadget::OnChar(MSG msg)
+{
+ // key is not handled
+ return FALSE;
+}
+
+
+void CMenuGadget::OnSetFocus(void)
+{
+ mg_bFocused = TRUE;
+ if (!IsSeparator())
+ {
+ PlayMenuSound(_psdSelect);
+ IFeel_PlayEffect("Menu_select");
+ }
+}
+
+void CMenuGadget::OnKillFocus(void)
+{
+ mg_bFocused = FALSE;
+}
+
+void CMenuGadget::Appear(void)
+{
+ mg_bVisible = TRUE;
+}
+
+void CMenuGadget::Disappear(void)
+{
+ mg_bVisible = FALSE;
+ mg_bFocused = FALSE;
+}
+
+void CMenuGadget::Think(void)
+{
+}
+
+void CMenuGadget::OnMouseOver(PIX pixI, PIX pixJ)
+{
+}
+
+// get current color for the gadget
+COLOR CMenuGadget::GetCurrentColor(void)
+{
+ // use normal colors
+ COLOR colUnselected = LCDGetColor(C_GREEN, "unselected");
+ COLOR colSelected = LCDGetColor(C_WHITE, "selected");
+ // if disabled
+ if (!mg_bEnabled) {
+ // use a bit darker colors
+ colUnselected = LCDGetColor(C_dGREEN, "disabled unselected");
+ colSelected = LCDGetColor(C_GRAY, "disabled selected");
+ // if label
+ if (mg_bLabel) {
+ // use white
+ colUnselected = colSelected = LCDGetColor(C_WHITE, "label");
+ }
+ }
+ // use unselected color
+ COLOR colRet = colUnselected;
+ // if selected
+ if (mg_bFocused) {
+ // oscilate towards selected color
+ FLOAT tmNow = _pTimer->GetHighPrecisionTimer().GetSeconds();
+ colRet = LerpColor((colUnselected >> 1) & 0x7F7F7F7F, colSelected, sin(tmNow*10.0f)*0.5f + 0.5f);
+ }
+
+ return colRet | CT_OPAQUE;
+}
+
+void CMenuGadget::Render(CDrawPort *pdp)
+{
+}
diff --git a/Sources/SeriousSam/GUI/Components/MenuGadget.h b/Sources/SeriousSam/GUI/Components/MenuGadget.h
new file mode 100644
index 0000000..04b30a3
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Components/MenuGadget.h
@@ -0,0 +1,70 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_GADGET_H
+#define SE_INCL_MENU_GADGET_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MenuPrinting.h"
+
+#define DOING_NOTHING 0
+#define PRESS_KEY_WAITING 1
+#define RELEASE_RETURN_WAITING 2
+
+#define EMPTYSLOTSTRING TRANS("")
+
+
+class CMenuGadget {
+public:
+ CListNode mg_lnNode;
+ FLOATaabbox2D mg_boxOnScreen;
+ BOOL mg_bVisible;
+ BOOL mg_bEnabled;
+ BOOL mg_bLabel;
+ BOOL mg_bFocused;
+ INDEX mg_iInList; // for scrollable gadget lists
+
+ CTString mg_strTip;
+ CMenuGadget *mg_pmgLeft;
+ CMenuGadget *mg_pmgRight;
+ CMenuGadget *mg_pmgUp;
+ CMenuGadget *mg_pmgDown;
+
+ CMenuGadget(void);
+ // return TRUE if handled
+ virtual BOOL OnKeyDown(int iVKey);
+ virtual BOOL OnChar(MSG msg);
+ virtual void OnActivate(void);
+ virtual void OnSetFocus(void);
+ virtual void OnKillFocus(void);
+ virtual void Appear(void);
+ virtual void Disappear(void);
+ virtual void Think(void);
+ virtual void OnMouseOver(PIX pixI, PIX pixJ);
+
+ virtual COLOR GetCurrentColor(void);
+ virtual void Render(CDrawPort *pdp);
+ virtual BOOL IsSeparator(void) { return FALSE; };
+};
+
+enum ButtonFontSize {
+ BFS_SMALL = 0,
+ BFS_MEDIUM = 1,
+ BFS_LARGE = 2,
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/GameMenu.cpp b/Sources/SeriousSam/GUI/Menus/GameMenu.cpp
new file mode 100644
index 0000000..5c776db
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/GameMenu.cpp
@@ -0,0 +1,351 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "GameMenu.h"
+
+
+CGameMenu::CGameMenu(void)
+{
+ gm_pgmParentMenu = NULL;
+ gm_pmgSelectedByDefault = NULL;
+ gm_pmgArrowUp = NULL;
+ gm_pmgArrowDn = NULL;
+ gm_pmgListTop = NULL;
+ gm_pmgListBottom = NULL;
+ gm_iListOffset = 0;
+ gm_ctListVisible = 0;
+ gm_ctListTotal = 0;
+ gm_bPopup = FALSE;
+}
+
+void CGameMenu::Initialize_t(void)
+{
+}
+
+void CGameMenu::Destroy(void)
+{
+}
+
+void CGameMenu::FillListItems(void)
+{
+ ASSERT(FALSE); // must be implemented to scroll up/down
+}
+
+void CGameMenu::KillAllFocuses(void)
+{
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, gm_lhGadgets, itmg) {
+ itmg->mg_bFocused = FALSE;
+ }
+}
+
+void CGameMenu::Think(void)
+{
+}
+
+// +-1 -> hit top/bottom when pressing up/down on keyboard
+// +-2 -> pressed pageup/pagedown on keyboard
+// +-3 -> pressed arrow up/down button in menu
+// +-4 -> scrolling with mouse wheel
+void CGameMenu::ScrollList(INDEX iDir)
+{
+ // if not valid for scrolling
+ if (gm_ctListTotal <= 0
+ || gm_pmgArrowUp == NULL || gm_pmgArrowDn == NULL
+ || gm_pmgListTop == NULL || gm_pmgListBottom == NULL) {
+ // do nothing
+ return;
+ }
+
+ INDEX iOldTopKey = gm_iListOffset;
+ // change offset
+ switch (iDir) {
+ case -1:
+ gm_iListOffset -= 1;
+ break;
+ case -4:
+ gm_iListOffset -= 3;
+ break;
+ case -2:
+ case -3:
+ gm_iListOffset -= gm_ctListVisible;
+ break;
+ case +1:
+ gm_iListOffset += 1;
+ break;
+ case +4:
+ gm_iListOffset += 3;
+ break;
+ case +2:
+ case +3:
+ gm_iListOffset += gm_ctListVisible;
+ break;
+ default:
+ ASSERT(FALSE);
+ return;
+ }
+ if (gm_ctListTotal <= gm_ctListVisible) {
+ gm_iListOffset = 0;
+ }
+ else {
+ gm_iListOffset = Clamp(gm_iListOffset, INDEX(0), INDEX(gm_ctListTotal - gm_ctListVisible));
+ }
+
+ // set new names
+ FillListItems();
+
+ // if scroling with wheel
+ if (iDir == +4 || iDir == -4) {
+ // no focus changing
+ return;
+ }
+
+ // delete all focuses
+ FOREACHINLIST(CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ itmg->OnKillFocus();
+ }
+
+ // set new focus
+ const INDEX iFirst = 0;
+ const INDEX iLast = gm_ctListVisible - 1;
+ switch (iDir) {
+ case +1:
+ gm_pmgListBottom->OnSetFocus();
+ break;
+ case +2:
+ if (gm_iListOffset != iOldTopKey) {
+ gm_pmgListTop->OnSetFocus();
+ }
+ else {
+ gm_pmgListBottom->OnSetFocus();
+ }
+ break;
+ case +3:
+ gm_pmgArrowDn->OnSetFocus();
+ break;
+ case -1:
+ gm_pmgListTop->OnSetFocus();
+ break;
+ case -2:
+ gm_pmgListTop->OnSetFocus();
+ break;
+ case -3:
+ gm_pmgArrowUp->OnSetFocus();
+ break;
+ }
+}
+
+BOOL CGameMenu::OnChar(MSG msg)
+{
+ // find curently active gadget
+ CMenuGadget *pmgActive = NULL;
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ // if focused
+ if (itmg->mg_bFocused) {
+ // remember as active
+ pmgActive = &itmg.Current();
+ }
+ }
+
+ // if none focused
+ if (pmgActive == NULL) {
+ // do nothing
+ return FALSE;
+ }
+
+ // if active gadget handles it
+ if (pmgActive->OnChar(msg)) {
+ // key is handled
+ return TRUE;
+ }
+
+ // key is not handled
+ return FALSE;
+}
+
+// return TRUE if handled
+BOOL CGameMenu::OnKeyDown(int iVKey)
+{
+ // find curently active gadget
+ CMenuGadget *pmgActive = NULL;
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ // if focused
+ if (itmg->mg_bFocused) {
+ // remember as active
+ pmgActive = &itmg.Current();
+ }
+ }
+
+ // if none focused
+ if (pmgActive == NULL) {
+ // do nothing
+ return FALSE;
+ }
+
+ // if active gadget handles it
+ if (pmgActive->OnKeyDown(iVKey)) {
+ // key is handled
+ return TRUE;
+ }
+
+ // process normal in menu movement
+ switch (iVKey) {
+ case VK_PRIOR:
+ ScrollList(-2);
+ return TRUE;
+ case VK_NEXT:
+ ScrollList(+2);
+ return TRUE;
+
+ case 11:
+ ScrollList(-4);
+ return TRUE;
+ case 10:
+ ScrollList(+4);
+ return TRUE;
+
+ case VK_UP:
+ // if this is top button in list
+ if (pmgActive == gm_pmgListTop) {
+ // scroll list up
+ ScrollList(-1);
+ // key is handled
+ return TRUE;
+ }
+ // if we can go up
+ if (pmgActive->mg_pmgUp != NULL && pmgActive->mg_pmgUp->mg_bVisible) {
+ // call lose focus to still active gadget and
+ pmgActive->OnKillFocus();
+ // set focus to new one
+ pmgActive = pmgActive->mg_pmgUp;
+ pmgActive->OnSetFocus();
+ // key is handled
+ return TRUE;
+ }
+ break;
+ case VK_DOWN:
+ // if this is bottom button in list
+ if (pmgActive == gm_pmgListBottom) {
+ // scroll list down
+ ScrollList(+1);
+ // key is handled
+ return TRUE;
+ }
+ // if we can go down
+ if (pmgActive->mg_pmgDown != NULL && pmgActive->mg_pmgDown->mg_bVisible) {
+ // call lose focus to still active gadget and
+ pmgActive->OnKillFocus();
+ // set focus to new one
+ pmgActive = pmgActive->mg_pmgDown;
+ pmgActive->OnSetFocus();
+ // key is handled
+ return TRUE;
+ }
+ break;
+ case VK_LEFT:
+ // if we can go left
+ if (pmgActive->mg_pmgLeft != NULL) {
+ // call lose focus to still active gadget and
+ pmgActive->OnKillFocus();
+ // set focus to new one
+ if (!pmgActive->mg_pmgLeft->mg_bVisible && gm_pmgSelectedByDefault != NULL) {
+ pmgActive = gm_pmgSelectedByDefault;
+ }
+ else {
+ pmgActive = pmgActive->mg_pmgLeft;
+ }
+ pmgActive->OnSetFocus();
+ // key is handled
+ return TRUE;
+ }
+ break;
+ case VK_RIGHT:
+ // if we can go right
+ if (pmgActive->mg_pmgRight != NULL) {
+ // call lose focus to still active gadget and
+ pmgActive->OnKillFocus();
+ // set focus to new one
+ if (!pmgActive->mg_pmgRight->mg_bVisible && gm_pmgSelectedByDefault != NULL) {
+ pmgActive = gm_pmgSelectedByDefault;
+ }
+ else {
+ pmgActive = pmgActive->mg_pmgRight;
+ }
+ pmgActive->OnSetFocus();
+ // key is handled
+ return TRUE;
+ }
+ break;
+ }
+
+ // key is not handled
+ return FALSE;
+}
+
+void CGameMenu::StartMenu(void)
+{
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, gm_lhGadgets, itmg)
+ {
+ itmg->mg_bFocused = FALSE;
+ // call appear
+ itmg->Appear();
+ }
+
+ // if there is a list
+ if (gm_pmgListTop != NULL) {
+ // scroll it so that the wanted tem is centered
+ gm_iListOffset = gm_iListWantedItem - gm_ctListVisible / 2;
+ // clamp the scrolling
+ gm_iListOffset = Clamp(gm_iListOffset, 0L, Max(0L, gm_ctListTotal - gm_ctListVisible));
+
+ // fill the list
+ FillListItems();
+
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, gm_lhGadgets, itmg) {
+ // if in list, but disabled
+ if (itmg->mg_iInList == -2) {
+ // hide it
+ itmg->mg_bVisible = FALSE;
+ // if in list
+ } else if (itmg->mg_iInList >= 0) {
+ // show it
+ itmg->mg_bVisible = TRUE;
+ }
+ // if wanted
+ if (itmg->mg_iInList == gm_iListWantedItem) {
+ // focus it
+ itmg->OnSetFocus();
+ gm_pmgSelectedByDefault = itmg;
+ }
+ }
+ }
+}
+
+void CGameMenu::EndMenu(void)
+{
+ // for each menu gadget in menu
+ FOREACHINLIST(CMenuGadget, mg_lnNode, gm_lhGadgets, itmg)
+ {
+ // call disappear
+ itmg->Disappear();
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/GameMenu.h b/Sources/SeriousSam/GUI/Menus/GameMenu.h
new file mode 100644
index 0000000..9f53a38
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/GameMenu.h
@@ -0,0 +1,52 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_H
+#define SE_INCL_GAME_MENU_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+class CGameMenu {
+public:
+ CListHead gm_lhGadgets;
+ CGameMenu *gm_pgmParentMenu;
+ BOOL gm_bPopup;
+ const char *gm_strName; // menu name (for mod interface only)
+ class CMenuGadget *gm_pmgSelectedByDefault;
+ class CMenuGadget *gm_pmgArrowUp;
+ class CMenuGadget *gm_pmgArrowDn;
+ class CMenuGadget *gm_pmgListTop;
+ class CMenuGadget *gm_pmgListBottom;
+ INDEX gm_iListOffset;
+ INDEX gm_iListWantedItem; // item you want to focus initially
+ INDEX gm_ctListVisible;
+ INDEX gm_ctListTotal;
+ CGameMenu(void);
+ void ScrollList(INDEX iDir);
+ void KillAllFocuses(void);
+ virtual void Initialize_t(void);
+ virtual void Destroy(void);
+ virtual void StartMenu(void);
+ virtual void FillListItems(void);
+ virtual void EndMenu(void);
+ // return TRUE if handled
+ virtual BOOL OnKeyDown(int iVKey);
+ virtual BOOL OnChar(MSG msg);
+ virtual void Think(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MAudioOptions.cpp b/Sources/SeriousSam/GUI/Menus/MAudioOptions.cpp
new file mode 100644
index 0000000..adf9c34
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MAudioOptions.cpp
@@ -0,0 +1,78 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MAudioOptions.h"
+
+extern void RefreshSoundFormat(void);
+
+
+void CAudioOptionsMenu::Initialize_t(void)
+{
+ // intialize Audio options menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("AUDIO");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ TRIGGER_MG(gm_mgAudioAutoTrigger, 0,
+ gm_mgApply, gm_mgFrequencyTrigger, TRANS("AUTO-ADJUST"), astrNoYes);
+ gm_mgAudioAutoTrigger.mg_strTip = TRANS("adjust quality to fit your system");
+
+ TRIGGER_MG(gm_mgFrequencyTrigger, 1,
+ gm_mgAudioAutoTrigger, gm_mgAudioAPITrigger, TRANS("FREQUENCY"), astrFrequencyRadioTexts);
+ gm_mgFrequencyTrigger.mg_strTip = TRANS("select sound quality or turn sound off");
+ gm_mgFrequencyTrigger.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgAudioAPITrigger, 2,
+ gm_mgFrequencyTrigger, gm_mgWaveVolume, TRANS("SOUND SYSTEM"), astrSoundAPIRadioTexts);
+ gm_mgAudioAPITrigger.mg_strTip = TRANS("choose sound system (API) to use");
+ gm_mgAudioAPITrigger.mg_pOnTriggerChange = NULL;
+
+ gm_mgWaveVolume.mg_boxOnScreen = BoxMediumRow(3);
+ gm_mgWaveVolume.mg_strText = TRANS("SOUND EFFECTS VOLUME");
+ gm_mgWaveVolume.mg_strTip = TRANS("adjust volume of in-game sound effects");
+ gm_mgWaveVolume.mg_pmgUp = &gm_mgAudioAPITrigger;
+ gm_mgWaveVolume.mg_pmgDown = &gm_mgMPEGVolume;
+ gm_mgWaveVolume.mg_pOnSliderChange = NULL;
+ gm_mgWaveVolume.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgWaveVolume.mg_lnNode);
+
+ gm_mgMPEGVolume.mg_boxOnScreen = BoxMediumRow(4);
+ gm_mgMPEGVolume.mg_strText = TRANS("MUSIC VOLUME");
+ gm_mgMPEGVolume.mg_strTip = TRANS("adjust volume of in-game music");
+ gm_mgMPEGVolume.mg_pmgUp = &gm_mgWaveVolume;
+ gm_mgMPEGVolume.mg_pmgDown = &gm_mgApply;
+ gm_mgMPEGVolume.mg_pOnSliderChange = NULL;
+ gm_mgMPEGVolume.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgMPEGVolume.mg_lnNode);
+
+ gm_mgApply.mg_bfsFontSize = BFS_LARGE;
+ gm_mgApply.mg_boxOnScreen = BoxBigRow(4);
+ gm_mgApply.mg_strText = TRANS("APPLY");
+ gm_mgApply.mg_strTip = TRANS("activate selected options");
+ gm_lhGadgets.AddTail(gm_mgApply.mg_lnNode);
+ gm_mgApply.mg_pmgUp = &gm_mgMPEGVolume;
+ gm_mgApply.mg_pmgDown = &gm_mgAudioAutoTrigger;
+ gm_mgApply.mg_pActivatedFunction = NULL;
+}
+
+void CAudioOptionsMenu::StartMenu(void)
+{
+ RefreshSoundFormat();
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MAudioOptions.h b/Sources/SeriousSam/GUI/Menus/MAudioOptions.h
new file mode 100644
index 0000000..26d3c13
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MAudioOptions.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_AUDIOOPTIONS_H
+#define SE_INCL_GAME_MENU_AUDIOOPTIONS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGSlider.h"
+#include "GUI/Components/MGTrigger.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CAudioOptionsMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGTrigger gm_mgAudioAutoTrigger;
+ CMGTrigger gm_mgAudioAPITrigger;
+ CMGTrigger gm_mgFrequencyTrigger;
+ CMGSlider gm_mgWaveVolume;
+ CMGSlider gm_mgMPEGVolume;
+ CMGButton gm_mgApply;
+
+ void StartMenu(void);
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MConfirm.cpp b/Sources/SeriousSam/GUI/Menus/MConfirm.cpp
new file mode 100644
index 0000000..9900950
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MConfirm.cpp
@@ -0,0 +1,83 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MConfirm.h"
+
+void CConfirmMenu::Initialize_t(void)
+{
+ gm_bPopup = TRUE;
+
+ gm_mgConfirmLabel.mg_strText = "";
+ gm_lhGadgets.AddTail(gm_mgConfirmLabel.mg_lnNode);
+ gm_mgConfirmLabel.mg_boxOnScreen = BoxPopupLabel();
+ gm_mgConfirmLabel.mg_iCenterI = 0;
+ gm_mgConfirmLabel.mg_bfsFontSize = BFS_LARGE;
+
+ gm_mgConfirmYes.mg_strText = TRANS("YES");
+ gm_lhGadgets.AddTail(gm_mgConfirmYes.mg_lnNode);
+ gm_mgConfirmYes.mg_boxOnScreen = BoxPopupYesLarge();
+ gm_mgConfirmYes.mg_pActivatedFunction = NULL;
+ gm_mgConfirmYes.mg_pmgLeft =
+ gm_mgConfirmYes.mg_pmgRight = &gm_mgConfirmNo;
+ gm_mgConfirmYes.mg_iCenterI = 1;
+ gm_mgConfirmYes.mg_bfsFontSize = BFS_LARGE;
+
+ gm_mgConfirmNo.mg_strText = TRANS("NO");
+ gm_lhGadgets.AddTail(gm_mgConfirmNo.mg_lnNode);
+ gm_mgConfirmNo.mg_boxOnScreen = BoxPopupNoLarge();
+ gm_mgConfirmNo.mg_pActivatedFunction = NULL;
+ gm_mgConfirmNo.mg_pmgLeft =
+ gm_mgConfirmNo.mg_pmgRight = &gm_mgConfirmYes;
+ gm_mgConfirmNo.mg_iCenterI = -1;
+ gm_mgConfirmNo.mg_bfsFontSize = BFS_LARGE;
+
+ _pConfimedYes = NULL;
+ _pConfimedNo = NULL;
+}
+
+void CConfirmMenu::BeLarge(void)
+{
+ gm_mgConfirmLabel.mg_bfsFontSize = BFS_LARGE;
+ gm_mgConfirmYes.mg_bfsFontSize = BFS_LARGE;
+ gm_mgConfirmNo.mg_bfsFontSize = BFS_LARGE;
+
+ gm_mgConfirmLabel.mg_iCenterI = 0;
+ gm_mgConfirmYes.mg_boxOnScreen = BoxPopupYesLarge();
+ gm_mgConfirmNo.mg_boxOnScreen = BoxPopupNoLarge();
+}
+
+void CConfirmMenu::BeSmall(void)
+{
+ gm_mgConfirmLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgConfirmYes.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgConfirmNo.mg_bfsFontSize = BFS_MEDIUM;
+
+ gm_mgConfirmLabel.mg_iCenterI = -1;
+ gm_mgConfirmYes.mg_boxOnScreen = BoxPopupYesSmall();
+ gm_mgConfirmNo.mg_boxOnScreen = BoxPopupNoSmall();
+}
+
+// return TRUE if handled
+BOOL CConfirmMenu::OnKeyDown(int iVKey)
+{
+ if ((iVKey == VK_ESCAPE || iVKey == VK_RBUTTON) && gm_mgConfirmNo.mg_pActivatedFunction != NULL) {
+ gm_mgConfirmNo.OnActivate();
+ return TRUE;
+ }
+ return CGameMenu::OnKeyDown(iVKey);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MConfirm.h b/Sources/SeriousSam/GUI/Menus/MConfirm.h
new file mode 100644
index 0000000..a614cba
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MConfirm.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_CONFIRM_H
+#define SE_INCL_GAME_MENU_CONFIRM_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+
+
+class CConfirmMenu : public CGameMenu {
+public:
+ CMGButton gm_mgConfirmLabel;
+ CMGButton gm_mgConfirmYes;
+ CMGButton gm_mgConfirmNo;
+
+ void(*_pConfimedYes)(void) = NULL;
+ void(*_pConfimedNo)(void) = NULL;
+
+ void Initialize_t(void);
+ // return TRUE if handled
+ BOOL OnKeyDown(int iVKey);
+
+ void BeLarge(void);
+ void BeSmall(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MControls.cpp b/Sources/SeriousSam/GUI/Menus/MControls.cpp
new file mode 100644
index 0000000..747c78f
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MControls.cpp
@@ -0,0 +1,159 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MControls.h"
+
+extern CTFileName _fnmControlsToCustomize;
+
+
+void CControlsMenu::Initialize_t(void)
+{
+ // intialize player and controls menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("CONTROLS");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgNameLabel.mg_strText = "";
+ gm_mgNameLabel.mg_boxOnScreen = BoxMediumRow(0.0);
+ gm_mgNameLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNameLabel.mg_iCenterI = -1;
+ gm_mgNameLabel.mg_bEnabled = FALSE;
+ gm_mgNameLabel.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgNameLabel.mg_lnNode);
+
+ gm_mgButtons.mg_strText = TRANS("CUSTOMIZE BUTTONS");
+ gm_mgButtons.mg_boxOnScreen = BoxMediumRow(2.0);
+ gm_mgButtons.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgButtons.mg_iCenterI = 0;
+ gm_lhGadgets.AddTail(gm_mgButtons.mg_lnNode);
+ gm_mgButtons.mg_pmgUp = &gm_mgPredefined;
+ gm_mgButtons.mg_pmgDown = &gm_mgAdvanced;
+ gm_mgButtons.mg_pActivatedFunction = NULL;
+ gm_mgButtons.mg_strTip = TRANS("customize buttons in current controls");
+
+ gm_mgAdvanced.mg_strText = TRANS("ADVANCED JOYSTICK SETUP");
+ gm_mgAdvanced.mg_iCenterI = 0;
+ gm_mgAdvanced.mg_boxOnScreen = BoxMediumRow(3);
+ gm_mgAdvanced.mg_bfsFontSize = BFS_MEDIUM;
+ gm_lhGadgets.AddTail(gm_mgAdvanced.mg_lnNode);
+ gm_mgAdvanced.mg_pmgUp = &gm_mgButtons;
+ gm_mgAdvanced.mg_pmgDown = &gm_mgSensitivity;
+ gm_mgAdvanced.mg_pActivatedFunction = NULL;
+ gm_mgAdvanced.mg_strTip = TRANS("adjust advanced settings for joystick axis");
+
+ gm_mgSensitivity.mg_boxOnScreen = BoxMediumRow(4.5);
+ gm_mgSensitivity.mg_strText = TRANS("SENSITIVITY");
+ gm_mgSensitivity.mg_pmgUp = &gm_mgAdvanced;
+ gm_mgSensitivity.mg_pmgDown = &gm_mgInvertTrigger;
+ gm_mgSensitivity.mg_strTip = TRANS("sensitivity for all axis in this control set");
+ gm_lhGadgets.AddTail(gm_mgSensitivity.mg_lnNode);
+
+ TRIGGER_MG(gm_mgInvertTrigger, 5.5, gm_mgSensitivity, gm_mgSmoothTrigger,
+ TRANS("INVERT LOOK"), astrNoYes);
+ gm_mgInvertTrigger.mg_strTip = TRANS("invert up/down looking");
+ TRIGGER_MG(gm_mgSmoothTrigger, 6.5, gm_mgInvertTrigger, gm_mgAccelTrigger,
+ TRANS("SMOOTH AXIS"), astrNoYes);
+ gm_mgSmoothTrigger.mg_strTip = TRANS("smooth mouse/joystick movements");
+ TRIGGER_MG(gm_mgAccelTrigger, 7.5, gm_mgSmoothTrigger, gm_mgIFeelTrigger,
+ TRANS("MOUSE ACCELERATION"), astrNoYes);
+ gm_mgAccelTrigger.mg_strTip = TRANS("allow mouse acceleration");
+ TRIGGER_MG(gm_mgIFeelTrigger, 8.5, gm_mgAccelTrigger, gm_mgPredefined,
+ TRANS("ENABLE IFEEL"), astrNoYes);
+ gm_mgIFeelTrigger.mg_strTip = TRANS("enable support for iFeel tactile feedback mouse");
+
+ gm_mgPredefined.mg_strText = TRANS("LOAD PREDEFINED SETTINGS");
+ gm_mgPredefined.mg_iCenterI = 0;
+ gm_mgPredefined.mg_boxOnScreen = BoxMediumRow(10);
+ gm_mgPredefined.mg_bfsFontSize = BFS_MEDIUM;
+ gm_lhGadgets.AddTail(gm_mgPredefined.mg_lnNode);
+ gm_mgPredefined.mg_pmgUp = &gm_mgIFeelTrigger;
+ gm_mgPredefined.mg_pmgDown = &gm_mgButtons;
+ gm_mgPredefined.mg_pActivatedFunction = NULL;
+ gm_mgPredefined.mg_strTip = TRANS("load one of several predefined control settings");
+}
+
+void CControlsMenu::StartMenu(void)
+{
+ gm_pmgSelectedByDefault = &gm_mgButtons;
+ INDEX iPlayer = _pGame->gm_iSinglePlayer;
+ if (_iLocalPlayer >= 0 && _iLocalPlayer<4) {
+ iPlayer = _pGame->gm_aiMenuLocalPlayers[_iLocalPlayer];
+ }
+ _fnmControlsToCustomize.PrintF("Controls\\Controls%d.ctl", iPlayer);
+
+ ControlsMenuOn();
+
+ gm_mgNameLabel.mg_strText.PrintF(TRANS("CONTROLS FOR: %s"), _pGame->gm_apcPlayers[iPlayer].GetNameForPrinting());
+
+ ObtainActionSettings();
+ CGameMenu::StartMenu();
+}
+
+void CControlsMenu::EndMenu(void)
+{
+ ApplyActionSettings();
+
+ ControlsMenuOff();
+
+ CGameMenu::EndMenu();
+}
+
+void CControlsMenu::ObtainActionSettings(void)
+{
+ CControls &ctrls = _pGame->gm_ctrlControlsExtra;
+
+ gm_mgSensitivity.mg_iMinPos = 0;
+ gm_mgSensitivity.mg_iMaxPos = 50;
+ gm_mgSensitivity.mg_iCurPos = ctrls.ctrl_fSensitivity / 2;
+ gm_mgSensitivity.ApplyCurrentPosition();
+
+ gm_mgInvertTrigger.mg_iSelected = ctrls.ctrl_bInvertLook ? 1 : 0;
+ gm_mgSmoothTrigger.mg_iSelected = ctrls.ctrl_bSmoothAxes ? 1 : 0;
+ gm_mgAccelTrigger.mg_iSelected = _pShell->GetINDEX("inp_bAllowMouseAcceleration") ? 1 : 0;
+ gm_mgIFeelTrigger.mg_bEnabled = _pShell->GetINDEX("sys_bIFeelEnabled") ? 1 : 0;
+ gm_mgIFeelTrigger.mg_iSelected = _pShell->GetFLOAT("inp_fIFeelGain")>0 ? 1 : 0;
+
+ gm_mgInvertTrigger.ApplyCurrentSelection();
+ gm_mgSmoothTrigger.ApplyCurrentSelection();
+ gm_mgAccelTrigger.ApplyCurrentSelection();
+ gm_mgIFeelTrigger.ApplyCurrentSelection();
+}
+
+void CControlsMenu::ApplyActionSettings(void)
+{
+ CControls &ctrls = _pGame->gm_ctrlControlsExtra;
+
+ FLOAT fSensitivity =
+ FLOAT(gm_mgSensitivity.mg_iCurPos - gm_mgSensitivity.mg_iMinPos) /
+ FLOAT(gm_mgSensitivity.mg_iMaxPos - gm_mgSensitivity.mg_iMinPos)*100.0f;
+
+ BOOL bInvert = gm_mgInvertTrigger.mg_iSelected != 0;
+ BOOL bSmooth = gm_mgSmoothTrigger.mg_iSelected != 0;
+ BOOL bAccel = gm_mgAccelTrigger.mg_iSelected != 0;
+ BOOL bIFeel = gm_mgIFeelTrigger.mg_iSelected != 0;
+
+ if (INDEX(ctrls.ctrl_fSensitivity) != INDEX(fSensitivity)) {
+ ctrls.ctrl_fSensitivity = fSensitivity;
+ }
+ ctrls.ctrl_bInvertLook = bInvert;
+ ctrls.ctrl_bSmoothAxes = bSmooth;
+ _pShell->SetINDEX("inp_bAllowMouseAcceleration", bAccel);
+ _pShell->SetFLOAT("inp_fIFeelGain", bIFeel ? 1.0f : 0.0f);
+ ctrls.CalculateInfluencesForAllAxis();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MControls.h b/Sources/SeriousSam/GUI/Menus/MControls.h
new file mode 100644
index 0000000..99b5794
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MControls.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_CONTROLS_H
+#define SE_INCL_GAME_MENU_CONTROLS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGSlider.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CControlsMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgNameLabel;
+ CMGButton gm_mgButtons;
+ CMGSlider gm_mgSensitivity;
+ CMGTrigger gm_mgInvertTrigger;
+ CMGTrigger gm_mgSmoothTrigger;
+ CMGTrigger gm_mgAccelTrigger;
+ CMGTrigger gm_mgIFeelTrigger;
+ CMGButton gm_mgPredefined;
+ CMGButton gm_mgAdvanced;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+ void ObtainActionSettings(void);
+ void ApplyActionSettings(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MCredits.h b/Sources/SeriousSam/GUI/Menus/MCredits.h
new file mode 100644
index 0000000..f76ee91
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MCredits.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_CREDITS_H
+#define SE_INCL_GAME_MENU_CREDITS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+
+
+class CCreditsMenu : public CGameMenu {
+public:
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.cpp b/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.cpp
new file mode 100644
index 0000000..4a3b54e
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.cpp
@@ -0,0 +1,156 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MCustomizeAxis.h"
+
+
+void CCustomizeAxisMenu::Initialize_t(void)
+{
+ // intialize axis menu
+ gm_mgTitle.mg_strText = TRANS("CUSTOMIZE AXIS");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ TRIGGER_MG(gm_mgActionTrigger, 0, gm_mgSmoothTrigger, gm_mgMountedTrigger, TRANS("ACTION"), astrNoYes);
+ gm_mgActionTrigger.mg_strTip = TRANS("choose action to customize");
+
+ TRIGGER_MG(gm_mgMountedTrigger, 2, gm_mgActionTrigger, gm_mgSensitivity, TRANS("MOUNTED TO"), astrNoYes);
+ gm_mgMountedTrigger.mg_strTip = TRANS("choose controller axis that will perform the action");
+
+ gm_mgActionTrigger.mg_astrTexts = new CTString[AXIS_ACTIONS_CT];
+ gm_mgActionTrigger.mg_ctTexts = AXIS_ACTIONS_CT;
+
+ gm_mgActionTrigger.mg_pPreTriggerChange = NULL;
+ gm_mgActionTrigger.mg_pOnTriggerChange = NULL;
+
+ // for all available axis type controlers
+ for (INDEX iControler = 0; iControlergm_astrAxisNames[iControler]), 0);
+ }
+ gm_mgActionTrigger.mg_iSelected = 3;
+
+ INDEX ctAxis = _pInput->GetAvailableAxisCount();
+ gm_mgMountedTrigger.mg_astrTexts = new CTString[ctAxis];
+ gm_mgMountedTrigger.mg_ctTexts = ctAxis;
+ // for all axis actions that can be mounted
+ for (INDEX iAxis = 0; iAxisGetAxisTransName(iAxis);
+ }
+
+ gm_mgSensitivity.mg_boxOnScreen = BoxMediumRow(3);
+ gm_mgSensitivity.mg_strText = TRANS("SENSITIVITY");
+ gm_mgSensitivity.mg_pmgUp = &gm_mgMountedTrigger;
+ gm_mgSensitivity.mg_pmgDown = &gm_mgDeadzone;
+ gm_lhGadgets.AddTail(gm_mgSensitivity.mg_lnNode);
+ gm_mgSensitivity.mg_strTip = TRANS("set sensitivity for this axis");
+
+ gm_mgDeadzone.mg_boxOnScreen = BoxMediumRow(4);
+ gm_mgDeadzone.mg_strText = TRANS("DEAD ZONE");
+ gm_mgDeadzone.mg_pmgUp = &gm_mgSensitivity;
+ gm_mgDeadzone.mg_pmgDown = &gm_mgInvertTrigger;
+ gm_lhGadgets.AddTail(gm_mgDeadzone.mg_lnNode);
+ gm_mgDeadzone.mg_strTip = TRANS("set dead zone for this axis");
+
+ TRIGGER_MG(gm_mgInvertTrigger, 5, gm_mgDeadzone, gm_mgRelativeTrigger, TRANS("INVERTED"), astrNoYes);
+ gm_mgInvertTrigger.mg_strTip = TRANS("choose whether to invert this axis or not");
+ TRIGGER_MG(gm_mgRelativeTrigger, 6, gm_mgInvertTrigger, gm_mgSmoothTrigger, TRANS("RELATIVE"), astrNoYes);
+ gm_mgRelativeTrigger.mg_strTip = TRANS("select relative or absolute axis reading");
+ TRIGGER_MG(gm_mgSmoothTrigger, 7, gm_mgRelativeTrigger, gm_mgActionTrigger, TRANS("SMOOTH"), astrNoYes);
+ gm_mgSmoothTrigger.mg_strTip = TRANS("turn this on to filter readings on this axis");
+}
+
+CCustomizeAxisMenu::~CCustomizeAxisMenu(void)
+{
+ delete[] gm_mgActionTrigger.mg_astrTexts;
+ delete[] gm_mgMountedTrigger.mg_astrTexts;
+}
+
+void CCustomizeAxisMenu::ObtainActionSettings(void)
+{
+ ControlsMenuOn();
+ CControls &ctrls = _pGame->gm_ctrlControlsExtra;
+ INDEX iSelectedAction = gm_mgActionTrigger.mg_iSelected;
+ INDEX iMountedAxis = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_iAxisAction;
+
+ gm_mgMountedTrigger.mg_iSelected = iMountedAxis;
+
+ gm_mgSensitivity.mg_iMinPos = 0;
+ gm_mgSensitivity.mg_iMaxPos = 50;
+ gm_mgSensitivity.mg_iCurPos = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fSensitivity / 2;
+ gm_mgSensitivity.ApplyCurrentPosition();
+
+ gm_mgDeadzone.mg_iMinPos = 0;
+ gm_mgDeadzone.mg_iMaxPos = 50;
+ gm_mgDeadzone.mg_iCurPos = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fDeadZone / 2;
+ gm_mgDeadzone.ApplyCurrentPosition();
+
+ gm_mgInvertTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bInvert ? 1 : 0;
+ gm_mgRelativeTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bRelativeControler ? 1 : 0;
+ gm_mgSmoothTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bSmooth ? 1 : 0;
+
+ gm_mgActionTrigger.ApplyCurrentSelection();
+ gm_mgMountedTrigger.ApplyCurrentSelection();
+ gm_mgInvertTrigger.ApplyCurrentSelection();
+ gm_mgRelativeTrigger.ApplyCurrentSelection();
+ gm_mgSmoothTrigger.ApplyCurrentSelection();
+}
+
+void CCustomizeAxisMenu::ApplyActionSettings(void)
+{
+ CControls &ctrls = _pGame->gm_ctrlControlsExtra;
+ INDEX iSelectedAction = gm_mgActionTrigger.mg_iSelected;
+ INDEX iMountedAxis = gm_mgMountedTrigger.mg_iSelected;
+ FLOAT fSensitivity =
+ FLOAT(gm_mgSensitivity.mg_iCurPos - gm_mgSensitivity.mg_iMinPos) /
+ FLOAT(gm_mgSensitivity.mg_iMaxPos - gm_mgSensitivity.mg_iMinPos)*100.0f;
+ FLOAT fDeadZone =
+ FLOAT(gm_mgDeadzone.mg_iCurPos - gm_mgDeadzone.mg_iMinPos) /
+ FLOAT(gm_mgDeadzone.mg_iMaxPos - gm_mgDeadzone.mg_iMinPos)*100.0f;
+
+ BOOL bInvert = gm_mgInvertTrigger.mg_iSelected != 0;
+ BOOL bRelative = gm_mgRelativeTrigger.mg_iSelected != 0;
+ BOOL bSmooth = gm_mgSmoothTrigger.mg_iSelected != 0;
+
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_iAxisAction = iMountedAxis;
+ if (INDEX(ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fSensitivity) != INDEX(fSensitivity)) {
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fSensitivity = fSensitivity;
+ }
+ if (INDEX(ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fDeadZone) != INDEX(fDeadZone)) {
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_fDeadZone = fDeadZone;
+ }
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bInvert = bInvert;
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bRelativeControler = bRelative;
+ ctrls.ctrl_aaAxisActions[iSelectedAction].aa_bSmooth = bSmooth;
+ ctrls.CalculateInfluencesForAllAxis();
+
+ ControlsMenuOff();
+}
+
+void CCustomizeAxisMenu::StartMenu(void)
+{
+ ObtainActionSettings();
+
+ CGameMenu::StartMenu();
+}
+
+void CCustomizeAxisMenu::EndMenu(void)
+{
+ ApplyActionSettings();
+ CGameMenu::EndMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.h b/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.h
new file mode 100644
index 0000000..721bff0
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MCustomizeAxis.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_CUSTOMIZEAXIS_H
+#define SE_INCL_GAME_MENU_CUSTOMIZEAXIS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGSlider.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CCustomizeAxisMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGTrigger gm_mgActionTrigger;
+ CMGTrigger gm_mgMountedTrigger;
+ CMGSlider gm_mgSensitivity;
+ CMGSlider gm_mgDeadzone;
+ CMGTrigger gm_mgInvertTrigger;
+ CMGTrigger gm_mgRelativeTrigger;
+ CMGTrigger gm_mgSmoothTrigger;
+
+ ~CCustomizeAxisMenu(void);
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+ void ObtainActionSettings(void);
+ void ApplyActionSettings(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.cpp b/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.cpp
new file mode 100644
index 0000000..4a7a000
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.cpp
@@ -0,0 +1,112 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MCustomizeKeyboard.h"
+
+
+void CCustomizeKeyboardMenu::FillListItems(void)
+{
+ // disable all items first
+ for (INDEX i = 0; igm_ctrlControlsExtra.ctrl_lhButtonActions.Count();
+ FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct)
+ {
+ INDEX iInMenu = iLabel - gm_iListOffset;
+ if ((iLabel >= gm_iListOffset) &&
+ (iLabel<(gm_iListOffset + gm_ctListVisible)))
+ {
+ bHasFirst |= (iLabel == 0);
+ bHasLast |= (iLabel == ctLabels - 1);
+ gm_mgKey[iInMenu].mg_strLabel = TranslateConst(itAct->ba_strName, 0);
+ gm_mgKey[iInMenu].mg_iControlNumber = iLabel;
+ gm_mgKey[iInMenu].SetBindingNames(FALSE);
+ gm_mgKey[iInMenu].mg_strTip = TRANS("Enter - change binding, Backspace - unbind");
+ gm_mgKey[iInMenu].mg_bEnabled = TRUE;
+ gm_mgKey[iInMenu].mg_iInList = iLabel;
+ }
+ iLabel++;
+ }
+
+ // enable/disable up/down arrows
+ gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
+ gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
+}
+
+void CCustomizeKeyboardMenu::Initialize_t(void)
+{
+ // intialize Audio options menu
+ gm_mgTitle.mg_strText = TRANS("CUSTOMIZE BUTTONS");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+#define KL_START 3.0f
+#define KL_STEEP -1.45f
+ for (INDEX iLabel = 0; iLabelgm_ctrlControlsExtra.ctrl_lhButtonActions.Count();
+ gm_iListWantedItem = 0;
+ CGameMenu::StartMenu();
+}
+
+void CCustomizeKeyboardMenu::EndMenu(void)
+{
+ ControlsMenuOff();
+ CGameMenu::EndMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.h b/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.h
new file mode 100644
index 0000000..877b40d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MCustomizeKeyboard.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_CUSTOMIZEKEYBOARD_H
+#define SE_INCL_GAME_MENU_CUSTOMIZEKEYBOARD_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGArrow.h"
+#include "GUI/Components/MGKeyDefinition.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CCustomizeKeyboardMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGKeyDefinition gm_mgKey[KEYS_ON_SCREEN];
+ CMGArrow gm_mgArrowUp;
+ CMGArrow gm_mgArrowDn;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+ void FillListItems(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MDisabled.cpp b/Sources/SeriousSam/GUI/Menus/MDisabled.cpp
new file mode 100644
index 0000000..e97d0b1
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MDisabled.cpp
@@ -0,0 +1,31 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MDisabled.h"
+
+
+void CDisabledMenu::Initialize_t(void)
+{
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgButton.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgButton.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_lhGadgets.AddTail(gm_mgButton.mg_lnNode);
+ gm_mgButton.mg_pActivatedFunction = NULL;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MDisabled.h b/Sources/SeriousSam/GUI/Menus/MDisabled.h
new file mode 100644
index 0000000..ef705c2
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MDisabled.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_DISABLED_H
+#define SE_INCL_GAME_MENU_DISABLED_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CDisabledMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgButton;
+
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MHighScore.cpp b/Sources/SeriousSam/GUI/Menus/MHighScore.cpp
new file mode 100644
index 0000000..4a14a2f
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MHighScore.cpp
@@ -0,0 +1,36 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MHighScore.h"
+
+
+void CHighScoreMenu::Initialize_t(void)
+{
+ gm_mgHScore.mg_boxOnScreen = FLOATaabbox2D(FLOAT2D(0, 0), FLOAT2D(1, 0.5));
+ gm_lhGadgets.AddTail(gm_mgHScore.mg_lnNode);
+
+ gm_mgTitle.mg_strText = TRANS("HIGH SCORE TABLE");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+}
+
+void CHighScoreMenu::StartMenu(void)
+{
+ gm_pgmParentMenu = pgmCurrentMenu;
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MHighScore.h b/Sources/SeriousSam/GUI/Menus/MHighScore.h
new file mode 100644
index 0000000..71408d4
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MHighScore.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_HIGHSCORE_H
+#define SE_INCL_GAME_MENU_HIGHSCORE_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGHighScore.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CHighScoreMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGHighScore gm_mgHScore;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MInGame.cpp b/Sources/SeriousSam/GUI/Menus/MInGame.cpp
new file mode 100644
index 0000000..7b7bf9c
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MInGame.cpp
@@ -0,0 +1,174 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MInGame.h"
+
+
+void CInGameMenu::Initialize_t(void)
+{
+ // intialize main menu
+ gm_mgTitle.mg_strText = TRANS("GAME");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgLabel1.mg_strText = "";
+ gm_mgLabel1.mg_boxOnScreen = BoxMediumRow(-2.0);
+ gm_mgLabel1.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgLabel1.mg_iCenterI = -1;
+ gm_mgLabel1.mg_bEnabled = FALSE;
+ gm_mgLabel1.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgLabel1.mg_lnNode);
+
+ gm_mgLabel2.mg_strText = "";
+ gm_mgLabel2.mg_boxOnScreen = BoxMediumRow(-1.0);
+ gm_mgLabel2.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgLabel2.mg_iCenterI = -1;
+ gm_mgLabel2.mg_bEnabled = FALSE;
+ gm_mgLabel2.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgLabel2.mg_lnNode);
+
+ gm_mgQuickLoad.mg_strText = TRANS("QUICK LOAD");
+ gm_mgQuickLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuickLoad.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_mgQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
+ gm_lhGadgets.AddTail(gm_mgQuickLoad.mg_lnNode);
+ gm_mgQuickLoad.mg_pmgUp = &gm_mgQuit;
+ gm_mgQuickLoad.mg_pmgDown = &gm_mgQuickSave;
+ gm_mgQuickLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgQuickSave.mg_strText = TRANS("QUICK SAVE");
+ gm_mgQuickSave.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuickSave.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgQuickSave.mg_strTip = TRANS("quick-save current game (F6)");
+ gm_lhGadgets.AddTail(gm_mgQuickSave.mg_lnNode);
+ gm_mgQuickSave.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgQuickSave.mg_pmgDown = &gm_mgLoad;
+ gm_mgQuickSave.mg_pActivatedFunction = NULL;
+
+ gm_mgLoad.mg_strText = TRANS("LOAD");
+ gm_mgLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgLoad.mg_strTip = TRANS("load a saved game");
+ gm_lhGadgets.AddTail(gm_mgLoad.mg_lnNode);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickSave;
+ gm_mgLoad.mg_pmgDown = &gm_mgSave;
+ gm_mgLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgSave.mg_strText = TRANS("SAVE");
+ gm_mgSave.mg_bfsFontSize = BFS_LARGE;
+ gm_mgSave.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgSave.mg_strTip = TRANS("save current game (each player has own slots!)");
+ gm_lhGadgets.AddTail(gm_mgSave.mg_lnNode);
+ gm_mgSave.mg_pmgUp = &gm_mgLoad;
+ gm_mgSave.mg_pmgDown = &gm_mgDemoRec;
+ gm_mgSave.mg_pActivatedFunction = NULL;
+
+ gm_mgDemoRec.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgDemoRec.mg_bfsFontSize = BFS_LARGE;
+ gm_mgDemoRec.mg_pmgUp = &gm_mgSave;
+ gm_mgDemoRec.mg_pmgDown = &gm_mgHighScore;
+ gm_mgDemoRec.mg_strText = "Text not set";
+ gm_lhGadgets.AddTail(gm_mgDemoRec.mg_lnNode);
+ gm_mgDemoRec.mg_pActivatedFunction = NULL;
+
+ gm_mgHighScore.mg_strText = TRANS("HIGH SCORES");
+ gm_mgHighScore.mg_bfsFontSize = BFS_LARGE;
+ gm_mgHighScore.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgHighScore.mg_strTip = TRANS("view list of top ten best scores");
+ gm_lhGadgets.AddTail(gm_mgHighScore.mg_lnNode);
+ gm_mgHighScore.mg_pmgUp = &gm_mgDemoRec;
+ gm_mgHighScore.mg_pmgDown = &gm_mgOptions;
+ gm_mgHighScore.mg_pActivatedFunction = NULL;
+
+ gm_mgOptions.mg_strText = TRANS("OPTIONS");
+ gm_mgOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgOptions.mg_boxOnScreen = BoxBigRow(6.0f);
+ gm_mgOptions.mg_strTip = TRANS("adjust video, audio and input options");
+ gm_lhGadgets.AddTail(gm_mgOptions.mg_lnNode);
+ gm_mgOptions.mg_pmgUp = &gm_mgHighScore;
+ gm_mgOptions.mg_pmgDown = &gm_mgStop;
+ gm_mgOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgStop.mg_strText = TRANS("STOP GAME");
+ gm_mgStop.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStop.mg_boxOnScreen = BoxBigRow(7.0f);
+ gm_mgStop.mg_strTip = TRANS("stop currently running game");
+ gm_lhGadgets.AddTail(gm_mgStop.mg_lnNode);
+ gm_mgStop.mg_pmgUp = &gm_mgOptions;
+ gm_mgStop.mg_pmgDown = &gm_mgQuit;
+ gm_mgStop.mg_pActivatedFunction = NULL;
+
+ gm_mgQuit.mg_strText = TRANS("QUIT");
+ gm_mgQuit.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuit.mg_boxOnScreen = BoxBigRow(8.0f);
+ gm_mgQuit.mg_strTip = TRANS("exit game immediately");
+ gm_lhGadgets.AddTail(gm_mgQuit.mg_lnNode);
+ gm_mgQuit.mg_pmgUp = &gm_mgStop;
+ gm_mgQuit.mg_pmgDown = &gm_mgQuickLoad;
+ gm_mgQuit.mg_pActivatedFunction = NULL;
+}
+
+void CInGameMenu::StartMenu(void)
+{
+ gm_mgQuickLoad.mg_bEnabled = _pNetwork->IsServer();
+ gm_mgQuickSave.mg_bEnabled = _pNetwork->IsServer();
+ gm_mgLoad.mg_bEnabled = _pNetwork->IsServer();
+ gm_mgSave.mg_bEnabled = _pNetwork->IsServer();
+ gm_mgDemoRec.mg_bEnabled = TRUE;//_pNetwork->IsServer();
+ extern void SetDemoStartStopRecText();
+ SetDemoStartStopRecText();
+
+
+ if (_gmRunningGameMode == GM_SINGLE_PLAYER) {
+ CPlayerCharacter &pc = _pGame->gm_apcPlayers[_pGame->gm_iSinglePlayer];
+ gm_mgLabel1.mg_strText.PrintF(TRANS("Player: %s"), pc.GetNameForPrinting());
+ gm_mgLabel2.mg_strText = "";
+
+ } else {
+ if (_pNetwork->IsServer()) {
+
+ CTString strHost, strAddress;
+ CTString strHostName;
+ _pNetwork->GetHostName(strHost, strAddress);
+ if (strHost == "") {
+ strHostName = TRANS("");
+ }
+ else {
+ strHostName = strHost + " (" + strAddress + ")";
+ }
+
+ gm_mgLabel1.mg_strText = TRANS("Address: ") + strHostName;
+ gm_mgLabel2.mg_strText = "";
+
+ } else {
+
+ CTString strConfig;
+ strConfig = TRANS("");
+ extern CTString sam_strNetworkSettings;
+ if (sam_strNetworkSettings != "") {
+ LoadStringVar(CTFileName(sam_strNetworkSettings).NoExt() + ".des", strConfig);
+ strConfig.OnlyFirstLine();
+ }
+
+ gm_mgLabel1.mg_strText = TRANS("Connected to: ") + _pGame->gam_strJoinAddress;
+ gm_mgLabel2.mg_strText = TRANS("Connection: ") + strConfig;
+ }
+ }
+
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MInGame.h b/Sources/SeriousSam/GUI/Menus/MInGame.h
new file mode 100644
index 0000000..a047ea6
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MInGame.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_INGAME_H
+#define SE_INCL_GAME_MENU_INGAME_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CInGameMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgLabel1;
+ CMGButton gm_mgLabel2;
+ CMGButton gm_mgQuickLoad;
+ CMGButton gm_mgQuickSave;
+ CMGButton gm_mgLoad;
+ CMGButton gm_mgSave;
+ CMGButton gm_mgDemoRec;
+ CMGButton gm_mgHighScore;
+ CMGButton gm_mgOptions;
+ CMGButton gm_mgStop;
+ CMGButton gm_mgQuit;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MLevels.cpp b/Sources/SeriousSam/GUI/Menus/MLevels.cpp
new file mode 100644
index 0000000..17fdac1
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MLevels.cpp
@@ -0,0 +1,112 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "LevelInfo.h"
+#include "MLevels.h"
+
+
+void CLevelsMenu::Initialize_t(void)
+{
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("CHOOSE LEVEL");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ for (INDEX iLabel = 0; iLabel");
+ gm_mgManualLevel[i].mg_iInList = -2;
+ }
+
+ BOOL bHasFirst = FALSE;
+ BOOL bHasLast = FALSE;
+ INDEX ctLabels = _lhFilteredLevels.Count();
+ INDEX iLabel = 0;
+ FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itli) {
+ CLevelInfo &li = *itli;
+ INDEX iInMenu = iLabel - gm_iListOffset;
+ if ((iLabel >= gm_iListOffset) &&
+ (iLabel<(gm_iListOffset + LEVELS_ON_SCREEN)))
+ {
+ bHasFirst |= (iLabel == 0);
+ bHasLast |= (iLabel == ctLabels - 1);
+ gm_mgManualLevel[iInMenu].mg_strText = li.li_strName;
+ gm_mgManualLevel[iInMenu].mg_fnmLevel = li.li_fnLevel;
+ gm_mgManualLevel[iInMenu].mg_bEnabled = TRUE;
+ gm_mgManualLevel[iInMenu].mg_iInList = iLabel;
+ }
+ iLabel++;
+ }
+
+ // enable/disable up/down arrows
+ gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
+ gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
+}
+
+void CLevelsMenu::StartMenu(void)
+{
+ // set default parameters for the list
+ gm_iListOffset = 0;
+ gm_ctListTotal = _lhFilteredLevels.Count();
+ gm_iListWantedItem = 0;
+ // for each level
+ INDEX i = 0;
+ FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itlid) {
+ CLevelInfo &lid = *itlid;
+ // if it is the chosen one
+ if (lid.li_fnLevel == _pGame->gam_strCustomLevel) {
+ // demand focus on it
+ gm_iListWantedItem = i;
+ break;
+ }
+ i++;
+ }
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MLevels.h b/Sources/SeriousSam/GUI/Menus/MLevels.h
new file mode 100644
index 0000000..d6b4957
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MLevels.h
@@ -0,0 +1,40 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_LEVELS_H
+#define SE_INCL_GAME_MENU_LEVELS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGArrow.h"
+#include "GUI/Components/MGLevelButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CLevelsMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGLevelButton gm_mgManualLevel[LEVELS_ON_SCREEN];
+ CMGArrow gm_mgArrowUp;
+ CMGArrow gm_mgArrowDn;
+
+ void Initialize_t(void);
+ void FillListItems(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MLoadSave.cpp b/Sources/SeriousSam/GUI/Menus/MLoadSave.cpp
new file mode 100644
index 0000000..db9ecbe
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MLoadSave.cpp
@@ -0,0 +1,236 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MLoadSave.h"
+
+
+void CLoadSaveMenu::Initialize_t(void)
+{
+ gm_pgmNextMenu = NULL;
+
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgNotes.mg_boxOnScreen = BoxMediumRow(10.0);
+ gm_mgNotes.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNotes.mg_iCenterI = -1;
+ gm_mgNotes.mg_bEnabled = FALSE;
+ gm_mgNotes.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgNotes.mg_lnNode);
+
+ for (INDEX iLabel = 0; iLabel afnmDir;
+ MakeDirList(afnmDir, gm_fnmDirectory, "", 0);
+ gm_iLastFile = -1;
+
+ // for each file in the directory
+ for (INDEX i = 0; ifi_fnFile = fnm;
+ pfi->fi_strName = strName;
+ // add it to list
+ gm_lhFileInfos.AddTail(pfi->fi_lnNode);
+ }
+ }
+
+ // sort if needed
+ switch (gm_iSortType) {
+ default: ASSERT(FALSE);
+ case LSSORT_NONE: break;
+ case LSSORT_NAMEUP:
+ gm_lhFileInfos.Sort(qsort_CompareFileInfos_NameUp, offsetof(CFileInfo, fi_lnNode));
+ break;
+ case LSSORT_NAMEDN:
+ gm_lhFileInfos.Sort(qsort_CompareFileInfos_NameDn, offsetof(CFileInfo, fi_lnNode));
+ break;
+ case LSSORT_FILEUP:
+ gm_lhFileInfos.Sort(qsort_CompareFileInfos_FileUp, offsetof(CFileInfo, fi_lnNode));
+ break;
+ case LSSORT_FILEDN:
+ gm_lhFileInfos.Sort(qsort_CompareFileInfos_FileDn, offsetof(CFileInfo, fi_lnNode));
+ break;
+ }
+
+ // if saving
+ if (gm_bSave) {
+ // add one info as empty slot
+ CFileInfo *pfi = new CFileInfo;
+ CTString strNumber;
+ strNumber.PrintF("%04d", gm_iLastFile + 1);
+ pfi->fi_fnFile = gm_fnmDirectory + gm_fnmBaseName + strNumber + gm_fnmExt;
+ pfi->fi_strName = EMPTYSLOTSTRING;
+ // add it to beginning
+ gm_lhFileInfos.AddHead(pfi->fi_lnNode);
+ }
+
+ // set default parameters for the list
+ gm_iListOffset = 0;
+ gm_ctListTotal = gm_lhFileInfos.Count();
+
+ // find which one should be selected
+ gm_iListWantedItem = 0;
+ if (gm_fnmSelected != "") {
+ INDEX i = 0;
+ FOREACHINLIST(CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
+ CFileInfo &fi = *itfi;
+ if (fi.fi_fnFile == gm_fnmSelected) {
+ gm_iListWantedItem = i;
+ break;
+ }
+ i++;
+ }
+ }
+
+ CGameMenu::StartMenu();
+}
+
+void CLoadSaveMenu::EndMenu(void)
+{
+ // delete all file infos
+ FORDELETELIST(CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
+ delete &itfi.Current();
+ }
+ gm_pgmNextMenu = NULL;
+ CGameMenu::EndMenu();
+}
+
+void CLoadSaveMenu::FillListItems(void)
+{
+ // disable all items first
+ for (INDEX i = 0; i");
+ gm_amgButton[i].mg_strTip = "";
+ gm_amgButton[i].mg_iInList = -2;
+ }
+
+ BOOL bHasFirst = FALSE;
+ BOOL bHasLast = FALSE;
+ INDEX ctLabels = gm_lhFileInfos.Count();
+ INDEX iLabel = 0;
+ FOREACHINLIST(CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
+ CFileInfo &fi = *itfi;
+ INDEX iInMenu = iLabel - gm_iListOffset;
+ if ((iLabel >= gm_iListOffset) &&
+ (iLabel<(gm_iListOffset + SAVELOAD_BUTTONS_CT)))
+ {
+ bHasFirst |= (iLabel == 0);
+ bHasLast |= (iLabel == ctLabels - 1);
+ gm_amgButton[iInMenu].mg_iInList = iLabel;
+ gm_amgButton[iInMenu].mg_strDes = fi.fi_strName;
+ gm_amgButton[iInMenu].mg_fnm = fi.fi_fnFile;
+ gm_amgButton[iInMenu].mg_bEnabled = TRUE;
+ gm_amgButton[iInMenu].RefreshText();
+ if (gm_bSave) {
+ if (!FileExistsForWriting(gm_amgButton[iInMenu].mg_fnm)) {
+ gm_amgButton[iInMenu].mg_strTip = TRANS("Enter - save in new slot");
+ }
+ else {
+ gm_amgButton[iInMenu].mg_strTip = TRANS("Enter - save here, F2 - rename, Del - delete");
+ }
+ }
+ else if (gm_bManage) {
+ gm_amgButton[iInMenu].mg_strTip = TRANS("Enter - load this, F2 - rename, Del - delete");
+ }
+ else {
+ gm_amgButton[iInMenu].mg_strTip = TRANS("Enter - load this");
+ }
+ }
+ iLabel++;
+ }
+
+ // enable/disable up/down arrows
+ gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
+ gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
+}
+
+// called to get info of a file from directory, or to skip it
+BOOL CLoadSaveMenu::ParseFile(const CTFileName &fnm, CTString &strName)
+{
+ if (fnm.FileExt() != gm_fnmExt) {
+ return FALSE;
+ }
+
+ CTFileName fnSaveGameDescription = fnm.NoExt() + ".des";
+ try {
+ strName.Load_t(fnSaveGameDescription);
+ } catch (char *strError) {
+ (void)strError;
+ strName = fnm.FileName();
+
+ if (fnm.FileExt() == ".ctl") {
+ INDEX iCtl = -1;
+ strName.ScanF("Controls%d", &iCtl);
+ if (iCtl >= 0 && iCtl <= 7) {
+ strName.PrintF(TRANS("From player: %s"), _pGame->gm_apcPlayers[iCtl].GetNameForPrinting());
+ }
+ }
+ }
+
+ INDEX iFile = -1;
+ fnm.FileName().ScanF((const char*)(gm_fnmBaseName + "%d"), &iFile);
+
+ gm_iLastFile = Max(gm_iLastFile, iFile);
+
+ return TRUE;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MLoadSave.h b/Sources/SeriousSam/GUI/Menus/MLoadSave.h
new file mode 100644
index 0000000..243c1fe
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MLoadSave.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_LOADSAVE_H
+#define SE_INCL_GAME_MENU_LOADSAVE_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGArrow.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGFileButton.h"
+#include "GUI/Components/MGTitle.h"
+
+#define SAVELOAD_BUTTONS_CT 14
+
+enum ELSSortType
+{
+ LSSORT_NONE,
+ LSSORT_NAMEUP,
+ LSSORT_NAMEDN,
+ LSSORT_FILEUP,
+ LSSORT_FILEDN,
+};
+
+
+class CLoadSaveMenu : public CGameMenu {
+public:
+ // settings adjusted before starting the menu
+ CGameMenu *gm_pgmNextMenu; // menu to go to after selecting a file (if null, use parent menu)
+ CTFileName gm_fnmSelected; // file that is selected initially
+ CTFileName gm_fnmDirectory; // directory that should be read
+ CTFileName gm_fnmBaseName; // base file name for saving (numbers are auto-added)
+ CTFileName gm_fnmExt; // accepted file extension
+ BOOL gm_bSave; // set when chosing file for saving
+ BOOL gm_bManage; // set if managing (rename/delet is enabled)
+ CTString gm_strSaveDes; // default description (if saving)
+ BOOL gm_bAllowThumbnails; // set when chosing file for saving
+ BOOL gm_bNoEscape; // forbid exiting with escape/rmb
+
+ INDEX gm_iSortType; // sort type
+
+ // function to activate when file is chosen
+ // return true if saving succeeded - description is saved automatically
+ // always return true for loading
+ BOOL(*gm_pAfterFileChosen)(const CTFileName &fnm);
+
+ // internal properties
+ CListHead gm_lhFileInfos; // all file infos to list
+ INDEX gm_iLastFile; // index of last saved file in numbered format
+
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgNotes;
+ CMGFileButton gm_amgButton[SAVELOAD_BUTTONS_CT];
+ CMGArrow gm_mgArrowUp;
+ CMGArrow gm_mgArrowDn;
+
+ // called to get info of a file from directory, or to skip it
+ BOOL ParseFile(const CTFileName &fnm, CTString &strName);
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+ void FillListItems(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MMain.cpp b/Sources/SeriousSam/GUI/Menus/MMain.cpp
new file mode 100644
index 0000000..c7151be
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MMain.cpp
@@ -0,0 +1,130 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MMain.h"
+
+
+void CMainMenu::Initialize_t(void)
+{
+ // intialize main menu
+ /*
+ gm_mgTitle.mg_strText = "SERIOUS SAM - BETA"; // nothing to see here, kazuya
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail( gm_mgTitle.mg_lnNode);
+ */
+
+ extern CTString sam_strVersion;
+ gm_mgVersionLabel.mg_strText = sam_strVersion;
+ gm_mgVersionLabel.mg_boxOnScreen = BoxVersion();
+ gm_mgVersionLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgVersionLabel.mg_iCenterI = +1;
+ gm_mgVersionLabel.mg_bEnabled = FALSE;
+ gm_mgVersionLabel.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgVersionLabel.mg_lnNode);
+
+ extern CTString sam_strModName;
+ gm_mgModLabel.mg_strText = sam_strModName;
+ gm_mgModLabel.mg_boxOnScreen = BoxMediumRow(-2.0f);
+ gm_mgModLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgModLabel.mg_iCenterI = 0;
+ gm_mgModLabel.mg_bEnabled = FALSE;
+ gm_mgModLabel.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgModLabel.mg_lnNode);
+
+ gm_mgSingle.mg_strText = TRANS("SINGLE PLAYER");
+ gm_mgSingle.mg_bfsFontSize = BFS_LARGE;
+ gm_mgSingle.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_mgSingle.mg_strTip = TRANS("single player game menus");
+ gm_lhGadgets.AddTail(gm_mgSingle.mg_lnNode);
+ gm_mgSingle.mg_pmgUp = &gm_mgQuit;
+ gm_mgSingle.mg_pmgDown = &gm_mgNetwork;
+ gm_mgSingle.mg_pActivatedFunction = NULL;
+
+ gm_mgNetwork.mg_strText = TRANS("NETWORK");
+ gm_mgNetwork.mg_bfsFontSize = BFS_LARGE;
+ gm_mgNetwork.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgNetwork.mg_strTip = TRANS("LAN/iNet multiplayer menus");
+ gm_lhGadgets.AddTail(gm_mgNetwork.mg_lnNode);
+ gm_mgNetwork.mg_pmgUp = &gm_mgSingle;
+ gm_mgNetwork.mg_pmgDown = &gm_mgSplitScreen;
+ gm_mgNetwork.mg_pActivatedFunction = NULL;
+
+ gm_mgSplitScreen.mg_strText = TRANS("SPLIT SCREEN");
+ gm_mgSplitScreen.mg_bfsFontSize = BFS_LARGE;
+ gm_mgSplitScreen.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgSplitScreen.mg_strTip = TRANS("play with multiple players on one computer");
+ gm_lhGadgets.AddTail(gm_mgSplitScreen.mg_lnNode);
+ gm_mgSplitScreen.mg_pmgUp = &gm_mgNetwork;
+ gm_mgSplitScreen.mg_pmgDown = &gm_mgDemo;
+ gm_mgSplitScreen.mg_pActivatedFunction = NULL;
+
+ gm_mgDemo.mg_strText = TRANS("DEMO");
+ gm_mgDemo.mg_bfsFontSize = BFS_LARGE;
+ gm_mgDemo.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgDemo.mg_strTip = TRANS("play a game demo");
+ gm_lhGadgets.AddTail(gm_mgDemo.mg_lnNode);
+ gm_mgDemo.mg_pmgUp = &gm_mgSplitScreen;
+ gm_mgDemo.mg_pmgDown = &gm_mgMods;
+ gm_mgDemo.mg_pActivatedFunction = NULL;
+
+ gm_mgMods.mg_strText = TRANS("MODS");
+ gm_mgMods.mg_bfsFontSize = BFS_LARGE;
+ gm_mgMods.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgMods.mg_strTip = TRANS("run one of installed game modifications");
+ gm_lhGadgets.AddTail(gm_mgMods.mg_lnNode);
+ gm_mgMods.mg_pmgUp = &gm_mgDemo;
+ gm_mgMods.mg_pmgDown = &gm_mgHighScore;
+ gm_mgMods.mg_pActivatedFunction = NULL;
+
+ gm_mgHighScore.mg_strText = TRANS("HIGH SCORES");
+ gm_mgHighScore.mg_bfsFontSize = BFS_LARGE;
+ gm_mgHighScore.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgHighScore.mg_strTip = TRANS("view list of top ten best scores");
+ gm_lhGadgets.AddTail(gm_mgHighScore.mg_lnNode);
+ gm_mgHighScore.mg_pmgUp = &gm_mgMods;
+ gm_mgHighScore.mg_pmgDown = &gm_mgOptions;
+ gm_mgHighScore.mg_pActivatedFunction = NULL;
+
+ gm_mgOptions.mg_strText = TRANS("OPTIONS");
+ gm_mgOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgOptions.mg_boxOnScreen = BoxBigRow(6.0f);
+ gm_mgOptions.mg_strTip = TRANS("adjust video, audio and input options");
+ gm_lhGadgets.AddTail(gm_mgOptions.mg_lnNode);
+ gm_mgOptions.mg_pmgUp = &gm_mgHighScore;
+ gm_mgOptions.mg_pmgDown = &gm_mgQuit;
+ gm_mgOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgQuit.mg_strText = TRANS("QUIT");
+ gm_mgQuit.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuit.mg_boxOnScreen = BoxBigRow(7.0f);
+ gm_mgQuit.mg_strTip = TRANS("exit game immediately");
+ gm_lhGadgets.AddTail(gm_mgQuit.mg_lnNode);
+ gm_mgQuit.mg_pmgUp = &gm_mgOptions;
+ gm_mgQuit.mg_pmgDown = &gm_mgSingle;
+ gm_mgQuit.mg_pActivatedFunction = NULL;
+}
+
+void CMainMenu::StartMenu(void)
+{
+ gm_mgSingle.mg_bEnabled = IsMenuEnabled("Single Player");
+ gm_mgNetwork.mg_bEnabled = IsMenuEnabled("Network");
+ gm_mgSplitScreen.mg_bEnabled = IsMenuEnabled("Split Screen");
+ gm_mgHighScore.mg_bEnabled = IsMenuEnabled("High Score");
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MMain.h b/Sources/SeriousSam/GUI/Menus/MMain.h
new file mode 100644
index 0000000..3816c8a
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MMain.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_MAIN_H
+#define SE_INCL_GAME_MENU_MAIN_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+
+
+class CMainMenu : public CGameMenu {
+public:
+ CMGButton gm_mgVersionLabel;
+ CMGButton gm_mgModLabel;
+ CMGButton gm_mgSingle;
+ CMGButton gm_mgNetwork;
+ CMGButton gm_mgSplitScreen;
+ CMGButton gm_mgDemo;
+ CMGButton gm_mgMods;
+ CMGButton gm_mgHighScore;
+ CMGButton gm_mgOptions;
+ CMGButton gm_mgQuit;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetwork.cpp b/Sources/SeriousSam/GUI/Menus/MNetwork.cpp
new file mode 100644
index 0000000..09d7992
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetwork.cpp
@@ -0,0 +1,69 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MNetwork.h"
+
+
+void CNetworkMenu::Initialize_t(void)
+{
+ // intialize network menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("NETWORK");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgJoin.mg_bfsFontSize = BFS_LARGE;
+ gm_mgJoin.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgJoin.mg_pmgUp = &gm_mgLoad;
+ gm_mgJoin.mg_pmgDown = &gm_mgStart;
+ gm_mgJoin.mg_strText = TRANS("JOIN GAME");
+ gm_mgJoin.mg_strTip = TRANS("join a network game");
+ gm_lhGadgets.AddTail(gm_mgJoin.mg_lnNode);
+ gm_mgJoin.mg_pActivatedFunction = NULL;
+
+ gm_mgStart.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStart.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgStart.mg_pmgUp = &gm_mgJoin;
+ gm_mgStart.mg_pmgDown = &gm_mgQuickLoad;
+ gm_mgStart.mg_strText = TRANS("START SERVER");
+ gm_mgStart.mg_strTip = TRANS("start a network game server");
+ gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
+ gm_mgStart.mg_pActivatedFunction = NULL;
+
+ gm_mgQuickLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuickLoad.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgQuickLoad.mg_pmgUp = &gm_mgStart;
+ gm_mgQuickLoad.mg_pmgDown = &gm_mgLoad;
+ gm_mgQuickLoad.mg_strText = TRANS("QUICK LOAD");
+ gm_mgQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
+ gm_lhGadgets.AddTail(gm_mgQuickLoad.mg_lnNode);
+ gm_mgQuickLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgLoad.mg_pmgDown = &gm_mgJoin;
+ gm_mgLoad.mg_strText = TRANS("LOAD");
+ gm_mgLoad.mg_strTip = TRANS("start server and load a network game (server only)");
+ gm_lhGadgets.AddTail(gm_mgLoad.mg_lnNode);
+ gm_mgLoad.mg_pActivatedFunction = NULL;
+}
+
+void CNetworkMenu::StartMenu(void)
+{
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetwork.h b/Sources/SeriousSam/GUI/Menus/MNetwork.h
new file mode 100644
index 0000000..25e9836
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetwork.h
@@ -0,0 +1,39 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_NETWORK_H
+#define SE_INCL_GAME_MENU_NETWORK_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CNetworkMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgJoin;
+ CMGButton gm_mgStart;
+ CMGButton gm_mgQuickLoad;
+ CMGButton gm_mgLoad;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkJoin.cpp b/Sources/SeriousSam/GUI/Menus/MNetworkJoin.cpp
new file mode 100644
index 0000000..fc53a54
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkJoin.cpp
@@ -0,0 +1,56 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MNetworkJoin.h"
+
+
+void CNetworkJoinMenu::Initialize_t(void)
+{
+ // title
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("JOIN GAME");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgLAN.mg_bfsFontSize = BFS_LARGE;
+ gm_mgLAN.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgLAN.mg_pmgUp = &gm_mgOpen;
+ gm_mgLAN.mg_pmgDown = &gm_mgNET;
+ gm_mgLAN.mg_strText = TRANS("SEARCH LAN");
+ gm_mgLAN.mg_strTip = TRANS("search local network for servers");
+ gm_lhGadgets.AddTail(gm_mgLAN.mg_lnNode);
+ gm_mgLAN.mg_pActivatedFunction = NULL;
+
+ gm_mgNET.mg_bfsFontSize = BFS_LARGE;
+ gm_mgNET.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgNET.mg_pmgUp = &gm_mgLAN;
+ gm_mgNET.mg_pmgDown = &gm_mgOpen;
+ gm_mgNET.mg_strText = TRANS("SEARCH INTERNET");
+ gm_mgNET.mg_strTip = TRANS("search internet for servers");
+ gm_lhGadgets.AddTail(gm_mgNET.mg_lnNode);
+ gm_mgNET.mg_pActivatedFunction = NULL;
+
+ gm_mgOpen.mg_bfsFontSize = BFS_LARGE;
+ gm_mgOpen.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgOpen.mg_pmgUp = &gm_mgNET;
+ gm_mgOpen.mg_pmgDown = &gm_mgLAN;
+ gm_mgOpen.mg_strText = TRANS("SPECIFY SERVER");
+ gm_mgOpen.mg_strTip = TRANS("type in server address to connect to");
+ gm_lhGadgets.AddTail(gm_mgOpen.mg_lnNode);
+ gm_mgOpen.mg_pActivatedFunction = NULL;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkJoin.h b/Sources/SeriousSam/GUI/Menus/MNetworkJoin.h
new file mode 100644
index 0000000..fa0388a
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkJoin.h
@@ -0,0 +1,37 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_NETWORKJOIN_H
+#define SE_INCL_GAME_MENU_NETWORKJOIN_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CNetworkJoinMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgLAN;
+ CMGButton gm_mgNET;
+ CMGButton gm_mgOpen;
+
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkOpen.cpp b/Sources/SeriousSam/GUI/Menus/MNetworkOpen.cpp
new file mode 100644
index 0000000..3a9b0b9
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkOpen.cpp
@@ -0,0 +1,79 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MNetworkOpen.h"
+
+
+void CNetworkOpenMenu::Initialize_t(void)
+{
+ // intialize network join menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("JOIN");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgAddressLabel.mg_strText = TRANS("Address:");
+ gm_mgAddressLabel.mg_boxOnScreen = BoxMediumLeft(1);
+ gm_mgAddressLabel.mg_iCenterI = -1;
+ gm_lhGadgets.AddTail(gm_mgAddressLabel.mg_lnNode);
+
+ gm_mgAddress.mg_strText = _pGame->gam_strJoinAddress;
+ gm_mgAddress.mg_ctMaxStringLen = 20;
+ gm_mgAddress.mg_pstrToChange = &_pGame->gam_strJoinAddress;
+ gm_mgAddress.mg_boxOnScreen = BoxMediumMiddle(1);
+ gm_mgAddress.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgAddress.mg_iCenterI = -1;
+ gm_mgAddress.mg_pmgUp = &gm_mgJoin;
+ gm_mgAddress.mg_pmgDown = &gm_mgPort;
+ gm_mgAddress.mg_strTip = TRANS("specify server address");
+ gm_lhGadgets.AddTail(gm_mgAddress.mg_lnNode);
+
+ gm_mgPortLabel.mg_strText = TRANS("Port:");
+ gm_mgPortLabel.mg_boxOnScreen = BoxMediumLeft(2);
+ gm_mgPortLabel.mg_iCenterI = -1;
+ gm_lhGadgets.AddTail(gm_mgPortLabel.mg_lnNode);
+
+ gm_mgPort.mg_strText = "";
+ gm_mgPort.mg_ctMaxStringLen = 10;
+ gm_mgPort.mg_pstrToChange = &gm_strPort;
+ gm_mgPort.mg_boxOnScreen = BoxMediumMiddle(2);
+ gm_mgPort.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgPort.mg_iCenterI = -1;
+ gm_mgPort.mg_pmgUp = &gm_mgAddress;
+ gm_mgPort.mg_pmgDown = &gm_mgJoin;
+ gm_mgPort.mg_strTip = TRANS("specify server address");
+ gm_lhGadgets.AddTail(gm_mgPort.mg_lnNode);
+
+ gm_mgJoin.mg_boxOnScreen = BoxMediumMiddle(3);
+ gm_mgJoin.mg_pmgUp = &gm_mgPort;
+ gm_mgJoin.mg_pmgDown = &gm_mgAddress;
+ gm_mgJoin.mg_strText = TRANS("Join");
+ gm_lhGadgets.AddTail(gm_mgJoin.mg_lnNode);
+ gm_mgJoin.mg_pActivatedFunction = NULL;
+}
+
+void CNetworkOpenMenu::StartMenu(void)
+{
+ gm_strPort = _pShell->GetValue("net_iPort");
+ gm_mgPort.mg_strText = gm_strPort;
+}
+
+void CNetworkOpenMenu::EndMenu(void)
+{
+ _pShell->SetValue("net_iPort", gm_strPort);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkOpen.h b/Sources/SeriousSam/GUI/Menus/MNetworkOpen.h
new file mode 100644
index 0000000..e5d57b0
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkOpen.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_NETWORKOPEN_H
+#define SE_INCL_GAME_MENU_NETWORKOPEN_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGEdit.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CNetworkOpenMenu : public CGameMenu {
+public:
+ CTString gm_strPort;
+
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgAddressLabel;
+ CMGEdit gm_mgAddress;
+ CMGButton gm_mgPortLabel;
+ CMGEdit gm_mgPort;
+ CMGButton gm_mgJoin;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkStart.cpp b/Sources/SeriousSam/GUI/Menus/MNetworkStart.cpp
new file mode 100644
index 0000000..415dae7
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkStart.cpp
@@ -0,0 +1,147 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "LevelInfo.h"
+#include "MenuStuff.h"
+#include "MNetworkStart.h"
+
+extern void UpdateNetworkLevel(INDEX iDummy);
+
+
+void CNetworkStartMenu::Initialize_t(void)
+{
+ // title
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("START SERVER");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ // session name edit box
+ gm_mgSessionName.mg_strText = _pGame->gam_strSessionName;
+ gm_mgSessionName.mg_strLabel = TRANS("Session name:");
+ gm_mgSessionName.mg_ctMaxStringLen = 25;
+ gm_mgSessionName.mg_pstrToChange = &_pGame->gam_strSessionName;
+ gm_mgSessionName.mg_boxOnScreen = BoxMediumRow(1);
+ gm_mgSessionName.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgSessionName.mg_iCenterI = -1;
+ gm_mgSessionName.mg_pmgUp = &gm_mgStart;
+ gm_mgSessionName.mg_pmgDown = &gm_mgGameType;
+ gm_mgSessionName.mg_strTip = TRANS("name the session to start");
+ gm_lhGadgets.AddTail(gm_mgSessionName.mg_lnNode);
+
+ // game type trigger
+ TRIGGER_MG(gm_mgGameType, 2,
+ gm_mgSessionName, gm_mgDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
+ gm_mgGameType.mg_ctTexts = ctGameTypeRadioTexts;
+ gm_mgGameType.mg_strTip = TRANS("choose type of multiplayer game");
+ gm_mgGameType.mg_pOnTriggerChange = &UpdateNetworkLevel;
+
+ // difficulty trigger
+ TRIGGER_MG(gm_mgDifficulty, 3,
+ gm_mgGameType, gm_mgLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
+ gm_mgDifficulty.mg_strTip = TRANS("choose difficulty level");
+
+ // level name
+ gm_mgLevel.mg_strText = "";
+ gm_mgLevel.mg_strLabel = TRANS("Level:");
+ gm_mgLevel.mg_boxOnScreen = BoxMediumRow(4);
+ gm_mgLevel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgLevel.mg_iCenterI = -1;
+ gm_mgLevel.mg_pmgUp = &gm_mgDifficulty;
+ gm_mgLevel.mg_pmgDown = &gm_mgMaxPlayers;
+ gm_mgLevel.mg_strTip = TRANS("choose the level to start");
+ gm_mgLevel.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgLevel.mg_lnNode);
+
+ // max players trigger
+ TRIGGER_MG(gm_mgMaxPlayers, 5,
+ gm_mgLevel, gm_mgWaitAllPlayers, TRANS("Max players:"), astrMaxPlayersRadioTexts);
+ gm_mgMaxPlayers.mg_strTip = TRANS("choose maximum allowed number of players");
+
+ // wait all players trigger
+ TRIGGER_MG(gm_mgWaitAllPlayers, 6,
+ gm_mgMaxPlayers, gm_mgVisible, TRANS("Wait for all players:"), astrNoYes);
+ gm_mgWaitAllPlayers.mg_strTip = TRANS("if on, game won't start until all players have joined");
+
+ // server visible trigger
+ TRIGGER_MG(gm_mgVisible, 7,
+ gm_mgMaxPlayers, gm_mgGameOptions, TRANS("Server visible:"), astrNoYes);
+ gm_mgVisible.mg_strTip = TRANS("invisible servers are not listed, cleints have to join manually");
+
+ // options button
+ gm_mgGameOptions.mg_strText = TRANS("Game options");
+ gm_mgGameOptions.mg_boxOnScreen = BoxMediumRow(8);
+ gm_mgGameOptions.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgGameOptions.mg_iCenterI = 0;
+ gm_mgGameOptions.mg_pmgUp = &gm_mgVisible;
+ gm_mgGameOptions.mg_pmgDown = &gm_mgStart;
+ gm_mgGameOptions.mg_strTip = TRANS("adjust game rules");
+ gm_mgGameOptions.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgGameOptions.mg_lnNode);
+
+ // start button
+ gm_mgStart.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStart.mg_boxOnScreen = BoxBigRow(7);
+ gm_mgStart.mg_pmgUp = &gm_mgGameOptions;
+ gm_mgStart.mg_pmgDown = &gm_mgSessionName;
+ gm_mgStart.mg_strText = TRANS("START");
+ gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
+ gm_mgStart.mg_pActivatedFunction = NULL;
+}
+
+void CNetworkStartMenu::StartMenu(void)
+{
+ extern INDEX sam_bMentalActivated;
+ gm_mgDifficulty.mg_ctTexts = sam_bMentalActivated ? 6 : 5;
+
+ gm_mgGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts - 1L);
+ gm_mgGameType.ApplyCurrentSelection();
+ gm_mgDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty") + 1;
+ gm_mgDifficulty.ApplyCurrentSelection();
+
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+
+ INDEX ctMaxPlayers = _pShell->GetINDEX("gam_ctMaxPlayers");
+ if (ctMaxPlayers<2 || ctMaxPlayers>16) {
+ ctMaxPlayers = 2;
+ _pShell->SetINDEX("gam_ctMaxPlayers", ctMaxPlayers);
+ }
+
+ gm_mgMaxPlayers.mg_iSelected = ctMaxPlayers - 2;
+ gm_mgMaxPlayers.ApplyCurrentSelection();
+
+ gm_mgWaitAllPlayers.mg_iSelected = Clamp(_pShell->GetINDEX("gam_bWaitAllPlayers"), 0L, 1L);
+ gm_mgWaitAllPlayers.ApplyCurrentSelection();
+
+ gm_mgVisible.mg_iSelected = _pShell->GetINDEX("ser_bEnumeration");
+ gm_mgVisible.ApplyCurrentSelection();
+
+ UpdateNetworkLevel(0);
+
+ CGameMenu::StartMenu();
+}
+
+void CNetworkStartMenu::EndMenu(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", gm_mgDifficulty.mg_iSelected - 1);
+ _pShell->SetINDEX("gam_iStartMode", gm_mgGameType.mg_iSelected);
+ _pShell->SetINDEX("gam_bWaitAllPlayers", gm_mgWaitAllPlayers.mg_iSelected);
+ _pShell->SetINDEX("gam_ctMaxPlayers", gm_mgMaxPlayers.mg_iSelected + 2);
+ _pShell->SetINDEX("ser_bEnumeration", gm_mgVisible.mg_iSelected);
+
+ CGameMenu::EndMenu();
+}
diff --git a/Sources/SeriousSam/GUI/Menus/MNetworkStart.h b/Sources/SeriousSam/GUI/Menus/MNetworkStart.h
new file mode 100644
index 0000000..b599a61
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MNetworkStart.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_NETWORKSTART_H
+#define SE_INCL_GAME_MENU_NETWORKSTART_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGEdit.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CNetworkStartMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGEdit gm_mgSessionName;
+ CMGTrigger gm_mgGameType;
+ CMGTrigger gm_mgDifficulty;
+ CMGButton gm_mgLevel;
+ CMGTrigger gm_mgMaxPlayers;
+ CMGTrigger gm_mgWaitAllPlayers;
+ CMGTrigger gm_mgVisible;
+ CMGButton gm_mgGameOptions;
+ CMGButton gm_mgStart;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MOptions.cpp b/Sources/SeriousSam/GUI/Menus/MOptions.cpp
new file mode 100644
index 0000000..0462887
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MOptions.cpp
@@ -0,0 +1,82 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MOptions.h"
+
+
+void COptionsMenu::Initialize_t(void)
+{
+ // intialize options menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("OPTIONS");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgVideoOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgVideoOptions.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_mgVideoOptions.mg_pmgUp = &gm_mgAddonOptions;
+ gm_mgVideoOptions.mg_pmgDown = &gm_mgAudioOptions;
+ gm_mgVideoOptions.mg_strText = TRANS("VIDEO OPTIONS");
+ gm_mgVideoOptions.mg_strTip = TRANS("set video mode and driver");
+ gm_lhGadgets.AddTail(gm_mgVideoOptions.mg_lnNode);
+ gm_mgVideoOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgAudioOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgAudioOptions.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgAudioOptions.mg_pmgUp = &gm_mgVideoOptions;
+ gm_mgAudioOptions.mg_pmgDown = &gm_mgPlayerProfileOptions;
+ gm_mgAudioOptions.mg_strText = TRANS("AUDIO OPTIONS");
+ gm_mgAudioOptions.mg_strTip = TRANS("set audio quality and volume");
+ gm_lhGadgets.AddTail(gm_mgAudioOptions.mg_lnNode);
+ gm_mgAudioOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgPlayerProfileOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgPlayerProfileOptions.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgPlayerProfileOptions.mg_pmgUp = &gm_mgAudioOptions;
+ gm_mgPlayerProfileOptions.mg_pmgDown = &gm_mgNetworkOptions;
+ gm_mgPlayerProfileOptions.mg_strText = TRANS("PLAYERS AND CONTROLS");
+ gm_mgPlayerProfileOptions.mg_strTip = TRANS("change currently active player or adjust controls");
+ gm_lhGadgets.AddTail(gm_mgPlayerProfileOptions.mg_lnNode);
+ gm_mgPlayerProfileOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgNetworkOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgNetworkOptions.mg_boxOnScreen = BoxBigRow(3);
+ gm_mgNetworkOptions.mg_pmgUp = &gm_mgPlayerProfileOptions;
+ gm_mgNetworkOptions.mg_pmgDown = &gm_mgCustomOptions;
+ gm_mgNetworkOptions.mg_strText = TRANS("NETWORK CONNECTION");
+ gm_mgNetworkOptions.mg_strTip = TRANS("choose your connection parameters");
+ gm_lhGadgets.AddTail(gm_mgNetworkOptions.mg_lnNode);
+ gm_mgNetworkOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgCustomOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgCustomOptions.mg_boxOnScreen = BoxBigRow(4);
+ gm_mgCustomOptions.mg_pmgUp = &gm_mgNetworkOptions;
+ gm_mgCustomOptions.mg_pmgDown = &gm_mgAddonOptions;
+ gm_mgCustomOptions.mg_strText = TRANS("ADVANCED OPTIONS");
+ gm_mgCustomOptions.mg_strTip = TRANS("for advanced users only");
+ gm_lhGadgets.AddTail(gm_mgCustomOptions.mg_lnNode);
+ gm_mgCustomOptions.mg_pActivatedFunction = NULL;
+
+ gm_mgAddonOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgAddonOptions.mg_boxOnScreen = BoxBigRow(5);
+ gm_mgAddonOptions.mg_pmgUp = &gm_mgCustomOptions;
+ gm_mgAddonOptions.mg_pmgDown = &gm_mgVideoOptions;
+ gm_mgAddonOptions.mg_strText = TRANS("EXECUTE ADDON");
+ gm_mgAddonOptions.mg_strTip = TRANS("choose from list of addons to execute");
+ gm_lhGadgets.AddTail(gm_mgAddonOptions.mg_lnNode);
+ gm_mgAddonOptions.mg_pActivatedFunction = NULL;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MOptions.h b/Sources/SeriousSam/GUI/Menus/MOptions.h
new file mode 100644
index 0000000..e461237
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MOptions.h
@@ -0,0 +1,40 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_OPTIONS_H
+#define SE_INCL_GAME_MENU_OPTIONS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class COptionsMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgVideoOptions;
+ CMGButton gm_mgAudioOptions;
+ CMGButton gm_mgPlayerProfileOptions;
+ CMGButton gm_mgNetworkOptions;
+ CMGButton gm_mgCustomOptions;
+ CMGButton gm_mgAddonOptions;
+
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp
new file mode 100644
index 0000000..42332e6
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp
@@ -0,0 +1,307 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MPlayerProfile.h"
+#include "GUI/Menus/MenuManager.h"
+
+#define ADD_SELECT_PLAYER_MG( index, mg, mgprev, mgnext, me)\
+ mg.mg_iIndex = index; \
+ mg.mg_bfsFontSize = BFS_MEDIUM; \
+ mg.mg_boxOnScreen = BoxNoUp(index); \
+ mg.mg_bRectangle = TRUE; \
+ mg.mg_pmgLeft = &mgprev; \
+ mg.mg_pmgRight = &mgnext; \
+ mg.mg_pmgUp = &gm_mgCustomizeControls; \
+ mg.mg_pmgDown = &gm_mgNameField; \
+ mg.mg_pActivatedFunction = &PPOnPlayerSelect; \
+ mg.mg_strText = #index; \
+ mg.mg_strTip = TRANS("select new currently active player"); \
+ gm_lhGadgets.AddTail(mg.mg_lnNode);
+
+extern BOOL _bPlayerMenuFromSinglePlayer;
+extern CTString _strLastPlayerAppearance;
+extern void PPOnPlayerSelect(void);
+
+
+void CPlayerProfileMenu::Initialize_t(void)
+{
+ // intialize player and controls menu
+ _bPlayerMenuFromSinglePlayer = FALSE;
+ gm_mgProfileTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgProfileTitle.mg_strText = TRANS("PLAYER PROFILE");
+ gm_lhGadgets.AddTail(gm_mgProfileTitle.mg_lnNode);
+
+ gm_mgNoLabel.mg_strText = TRANS("PROFILE:");
+ gm_mgNoLabel.mg_boxOnScreen = BoxMediumLeft(0.0f);
+ gm_mgNoLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNoLabel.mg_iCenterI = -1;
+ gm_lhGadgets.AddTail(gm_mgNoLabel.mg_lnNode);
+
+ ADD_SELECT_PLAYER_MG(0, gm_mgNumber[0], gm_mgNumber[7], gm_mgNumber[1], gm_mgNumber[0]);
+ ADD_SELECT_PLAYER_MG(1, gm_mgNumber[1], gm_mgNumber[0], gm_mgNumber[2], gm_mgNumber[1]);
+ ADD_SELECT_PLAYER_MG(2, gm_mgNumber[2], gm_mgNumber[1], gm_mgNumber[3], gm_mgNumber[2]);
+ ADD_SELECT_PLAYER_MG(3, gm_mgNumber[3], gm_mgNumber[2], gm_mgNumber[4], gm_mgNumber[3]);
+ ADD_SELECT_PLAYER_MG(4, gm_mgNumber[4], gm_mgNumber[3], gm_mgNumber[5], gm_mgNumber[4]);
+ ADD_SELECT_PLAYER_MG(5, gm_mgNumber[5], gm_mgNumber[4], gm_mgNumber[6], gm_mgNumber[5]);
+ ADD_SELECT_PLAYER_MG(6, gm_mgNumber[6], gm_mgNumber[5], gm_mgNumber[7], gm_mgNumber[6]);
+ ADD_SELECT_PLAYER_MG(7, gm_mgNumber[7], gm_mgNumber[6], gm_mgNumber[0], gm_mgNumber[7]);
+ gm_mgNumber[7].mg_pmgRight = &gm_mgModel;
+
+ gm_mgNameLabel.mg_strText = TRANS("NAME:");
+ gm_mgNameLabel.mg_boxOnScreen = BoxMediumLeft(1.25f);
+ gm_mgNameLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNameLabel.mg_iCenterI = -1;
+ gm_lhGadgets.AddTail(gm_mgNameLabel.mg_lnNode);
+
+ // setup of player name button is done on start menu
+ gm_mgNameField.mg_strText = "??>";
+ gm_mgNameField.mg_ctMaxStringLen = 25;
+ gm_mgNameField.mg_boxOnScreen = BoxPlayerEdit(1.25);
+ gm_mgNameField.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNameField.mg_iCenterI = -1;
+ gm_mgNameField.mg_pmgUp = &gm_mgNumber[0];
+ gm_mgNameField.mg_pmgDown = &gm_mgTeam;
+ gm_mgNameField.mg_pmgRight = &gm_mgModel;
+ gm_mgNameField.mg_strTip = TRANS("rename currently active player");
+ gm_lhGadgets.AddTail(gm_mgNameField.mg_lnNode);
+
+ gm_mgTeamLabel.mg_strText = TRANS("TEAM:");
+ gm_mgTeamLabel.mg_boxOnScreen = BoxMediumLeft(2.25f);
+ gm_mgTeamLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgTeamLabel.mg_iCenterI = -1;
+ gm_lhGadgets.AddTail(gm_mgTeamLabel.mg_lnNode);
+
+ // setup of player name button is done on start menu
+ gm_mgTeam.mg_strText = "??>";
+ gm_mgTeam.mg_ctMaxStringLen = 25;
+ gm_mgTeam.mg_boxOnScreen = BoxPlayerEdit(2.25f);
+ gm_mgTeam.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgTeam.mg_iCenterI = -1;
+ gm_mgTeam.mg_pmgUp = gm_mgNameField.mg_pmgUp = &gm_mgNumber[0];
+
+ gm_mgTeam.mg_pmgDown = &gm_mgCrosshair;
+ gm_mgTeam.mg_pmgRight = &gm_mgModel;
+ //gm_mgTeam.mg_strTip = TRANS("teamplay is disabled in this version");
+ gm_mgTeam.mg_strTip = TRANS("enter team name, if playing in team");
+ gm_lhGadgets.AddTail(gm_mgTeam.mg_lnNode);
+
+ TRIGGER_MG(gm_mgCrosshair, 4.0, gm_mgTeam, gm_mgWeaponSelect, TRANS("CROSSHAIR"), astrCrosshair);
+ gm_mgCrosshair.mg_bVisual = TRUE;
+ gm_mgCrosshair.mg_boxOnScreen = BoxPlayerSwitch(5.0f);
+ gm_mgCrosshair.mg_iCenterI = -1;
+ gm_mgCrosshair.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgWeaponSelect, 4.0, gm_mgCrosshair, gm_mgWeaponHide, TRANS("AUTO SELECT WEAPON"), astrWeapon);
+ gm_mgWeaponSelect.mg_boxOnScreen = BoxPlayerSwitch(6.0f);
+ gm_mgWeaponSelect.mg_iCenterI = -1;
+ gm_mgWeaponSelect.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgWeaponHide, 4.0, gm_mgWeaponSelect, gm_mg3rdPerson, TRANS("HIDE WEAPON MODEL"), astrNoYes);
+ gm_mgWeaponHide.mg_boxOnScreen = BoxPlayerSwitch(7.0f);
+ gm_mgWeaponHide.mg_iCenterI = -1;
+ gm_mgWeaponHide.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mg3rdPerson, 4.0, gm_mgWeaponHide, gm_mgQuotes, TRANS("PREFER 3RD PERSON VIEW"), astrNoYes);
+ gm_mg3rdPerson.mg_boxOnScreen = BoxPlayerSwitch(8.0f);
+ gm_mg3rdPerson.mg_iCenterI = -1;
+ gm_mg3rdPerson.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgQuotes, 4.0, gm_mg3rdPerson, gm_mgAutoSave, TRANS("VOICE QUOTES"), astrNoYes);
+ gm_mgQuotes.mg_boxOnScreen = BoxPlayerSwitch(9.0f);
+ gm_mgQuotes.mg_iCenterI = -1;
+ gm_mgQuotes.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgAutoSave, 4.0, gm_mgQuotes, gm_mgCompDoubleClick, TRANS("AUTO SAVE"), astrNoYes);
+ gm_mgAutoSave.mg_boxOnScreen = BoxPlayerSwitch(10.0f);
+ gm_mgAutoSave.mg_iCenterI = -1;
+ gm_mgAutoSave.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgCompDoubleClick, 4.0, gm_mgAutoSave, gm_mgSharpTurning, TRANS("INVOKE COMPUTER"), astrComputerInvoke);
+ gm_mgCompDoubleClick.mg_boxOnScreen = BoxPlayerSwitch(11.0f);
+ gm_mgCompDoubleClick.mg_iCenterI = -1;
+ gm_mgCompDoubleClick.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgSharpTurning, 4.0, gm_mgCompDoubleClick, gm_mgViewBobbing, TRANS("SHARP TURNING"), astrNoYes);
+ gm_mgSharpTurning.mg_boxOnScreen = BoxPlayerSwitch(12.0f);
+ gm_mgSharpTurning.mg_iCenterI = -1;
+ gm_mgSharpTurning.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgViewBobbing, 4.0, gm_mgSharpTurning, gm_mgCustomizeControls, TRANS("VIEW BOBBING"), astrNoYes);
+ gm_mgViewBobbing.mg_boxOnScreen = BoxPlayerSwitch(13.0f);
+ gm_mgViewBobbing.mg_iCenterI = -1;
+ gm_mgViewBobbing.mg_pOnTriggerChange = NULL;
+
+ gm_mgCustomizeControls.mg_strText = TRANS("CUSTOMIZE CONTROLS");
+ gm_mgCustomizeControls.mg_boxOnScreen = BoxMediumLeft(14.5f);
+ gm_mgCustomizeControls.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgCustomizeControls.mg_iCenterI = -1;
+ gm_mgCustomizeControls.mg_pmgUp = &gm_mgViewBobbing;
+ gm_mgCustomizeControls.mg_pActivatedFunction = NULL;
+ gm_mgCustomizeControls.mg_pmgDown = &gm_mgNumber[0];
+ gm_mgCustomizeControls.mg_pmgRight = &gm_mgModel;
+ gm_mgCustomizeControls.mg_strTip = TRANS("customize controls for this player");
+ gm_lhGadgets.AddTail(gm_mgCustomizeControls.mg_lnNode);
+
+ gm_mgModel.mg_boxOnScreen = BoxPlayerModel();
+ gm_mgModel.mg_pmgLeft = &gm_mgNameField;
+ gm_mgModel.mg_pActivatedFunction = NULL;
+ gm_mgModel.mg_pmgDown = &gm_mgNameField;
+ gm_mgModel.mg_pmgLeft = &gm_mgNameField;
+ gm_mgModel.mg_strTip = TRANS("change model for this player");
+ gm_lhGadgets.AddTail(gm_mgModel.mg_lnNode);
+}
+
+INDEX CPlayerProfileMenu::ComboFromPlayer(INDEX iPlayer)
+{
+ return iPlayer;
+}
+
+INDEX CPlayerProfileMenu::PlayerFromCombo(INDEX iCombo)
+{
+ return iCombo;
+}
+
+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;
+ }
+ }
+}
+
+void CPlayerProfileMenu::StartMenu(void)
+{
+ _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &gm_mgNameField;
+
+ if (_gmRunningGameMode == GM_NONE || _gmRunningGameMode == GM_DEMO) {
+ for (INDEX i = 0; i<8; i++) {
+ gm_mgNumber[i].mg_bEnabled = TRUE;
+ }
+ } else {
+ for (INDEX i = 0; i<8; i++) {
+ gm_mgNumber[i].mg_bEnabled = FALSE;
+ }
+ INDEX iFirstEnabled = 0;
+ {for (INDEX ilp = 0; ilp<4; ilp++) {
+ CLocalPlayer &lp = _pGame->gm_lpLocalPlayers[ilp];
+ if (lp.lp_bActive) {
+ gm_mgNumber[lp.lp_iPlayer].mg_bEnabled = TRUE;
+ if (iFirstEnabled == 0) {
+ iFirstEnabled = lp.lp_iPlayer;
+ }
+ }
+ }}
+ // backup to first player in case current player is disabled
+ if (!gm_mgNumber[*gm_piCurrentPlayer].mg_bEnabled) *gm_piCurrentPlayer = iFirstEnabled;
+ }
+ // done
+ SelectPlayer(*gm_piCurrentPlayer);
+ CGameMenu::StartMenu();
+}
+
+void CPlayerProfileMenu::EndMenu(void)
+{
+ _pGame->SavePlayersAndControls();
+ CGameMenu::EndMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MPlayerProfile.h b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.h
new file mode 100644
index 0000000..92343e6
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.h
@@ -0,0 +1,62 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_PLAYERPROFILE_H
+#define SE_INCL_GAME_MENU_PLAYERPROFILE_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGEdit.h"
+#include "GUI/Components/MGModel.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CPlayerProfileMenu : public CGameMenu {
+public:
+ INDEX *gm_piCurrentPlayer;
+
+ CMGTitle gm_mgProfileTitle;
+ CMGButton gm_mgNoLabel;
+ CMGButton gm_mgNumber[8];
+ CMGButton gm_mgNameLabel;
+ CMGEdit gm_mgNameField;
+ CMGButton gm_mgTeamLabel;
+ CMGEdit gm_mgTeam;
+ CMGButton gm_mgCustomizeControls;
+ CMGTrigger gm_mgCrosshair;
+ CMGTrigger gm_mgWeaponSelect;
+ CMGTrigger gm_mgWeaponHide;
+ CMGTrigger gm_mg3rdPerson;
+ CMGTrigger gm_mgQuotes;
+ CMGTrigger gm_mgAutoSave;
+ CMGTrigger gm_mgCompDoubleClick;
+ CMGTrigger gm_mgViewBobbing;
+ CMGTrigger gm_mgSharpTurning;
+ CMGModel gm_mgModel;
+
+ void Initialize_t(void);
+ INDEX ComboFromPlayer(INDEX iPlayer);
+ INDEX PlayerFromCombo(INDEX iCombo);
+ void SelectPlayer(INDEX iPlayer);
+ void ApplyComboPlayer(INDEX iPlayer);
+ void StartMenu(void);
+ void EndMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MRenderingOptions.h b/Sources/SeriousSam/GUI/Menus/MRenderingOptions.h
new file mode 100644
index 0000000..4a1c6bd
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MRenderingOptions.h
@@ -0,0 +1,31 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_RENDERINGOPTIONS_H
+#define SE_INCL_GAME_MENU_RENDERINGOPTIONS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+
+
+class CRenderingOptionsMenu : public CGameMenu {
+public:
+ void StartMenu(void);
+ void EndMenu(void);
+ void Initialize_t(void);
+};
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSelectPlayers.cpp b/Sources/SeriousSam/GUI/Menus/MSelectPlayers.cpp
new file mode 100644
index 0000000..48da973
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSelectPlayers.cpp
@@ -0,0 +1,118 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MSelectPlayers.h"
+
+#define ADD_GADGET( gd, box, up, dn, lf, rt, txt) \
+ gd.mg_boxOnScreen = box; \
+ gd.mg_pmgUp = up; \
+ gd.mg_pmgDown = dn; \
+ gd.mg_pmgLeft = lf; \
+ gd.mg_pmgRight = rt; \
+ gd.mg_strText = txt; \
+ gm_lhGadgets.AddTail(gd.mg_lnNode);
+
+extern CTString astrNoYes[2];
+extern CTString astrSplitScreenRadioTexts[4];
+extern void SelectPlayersFillMenu(void);
+extern void SelectPlayersApplyMenu(void);
+
+void CSelectPlayersMenu::Initialize_t(void)
+{
+ // intialize split screen menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("SELECT PLAYERS");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ TRIGGER_MG(gm_mgDedicated, 0, gm_mgStart, gm_mgObserver, TRANS("Dedicated:"), astrNoYes);
+ gm_mgDedicated.mg_strTip = TRANS("select to start dedicated server");
+ gm_mgDedicated.mg_pOnTriggerChange = NULL;
+
+ TRIGGER_MG(gm_mgObserver, 1, gm_mgDedicated, gm_mgSplitScreenCfg, TRANS("Observer:"), astrNoYes);
+ gm_mgObserver.mg_strTip = TRANS("select to join in for observing, not for playing");
+ gm_mgObserver.mg_pOnTriggerChange = NULL;
+
+ // split screen config trigger
+ TRIGGER_MG(gm_mgSplitScreenCfg, 2, gm_mgObserver, gm_mgPlayer0Change, TRANS("Number of players:"), astrSplitScreenRadioTexts);
+ gm_mgSplitScreenCfg.mg_strTip = TRANS("choose more than one player to play in split screen");
+ gm_mgSplitScreenCfg.mg_pOnTriggerChange = NULL;
+
+ gm_mgPlayer0Change.mg_iCenterI = -1;
+ gm_mgPlayer1Change.mg_iCenterI = -1;
+ gm_mgPlayer2Change.mg_iCenterI = -1;
+ gm_mgPlayer3Change.mg_iCenterI = -1;
+ gm_mgPlayer0Change.mg_boxOnScreen = BoxMediumMiddle(4);
+ gm_mgPlayer1Change.mg_boxOnScreen = BoxMediumMiddle(5);
+ gm_mgPlayer2Change.mg_boxOnScreen = BoxMediumMiddle(6);
+ gm_mgPlayer3Change.mg_boxOnScreen = BoxMediumMiddle(7);
+ gm_mgPlayer0Change.mg_strTip =
+ gm_mgPlayer1Change.mg_strTip =
+ gm_mgPlayer2Change.mg_strTip =
+ gm_mgPlayer3Change.mg_strTip = TRANS("select profile for this player");
+ gm_lhGadgets.AddTail(gm_mgPlayer0Change.mg_lnNode);
+ gm_lhGadgets.AddTail(gm_mgPlayer1Change.mg_lnNode);
+ gm_lhGadgets.AddTail(gm_mgPlayer2Change.mg_lnNode);
+ gm_lhGadgets.AddTail(gm_mgPlayer3Change.mg_lnNode);
+
+ gm_mgNotes.mg_boxOnScreen = BoxMediumRow(9.0);
+ gm_mgNotes.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgNotes.mg_iCenterI = -1;
+ gm_mgNotes.mg_bEnabled = FALSE;
+ gm_mgNotes.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgNotes.mg_lnNode);
+ gm_mgNotes.mg_strText = "";
+
+ /* // options button
+ mgSplitOptions.mg_strText = TRANS("Game options");
+ mgSplitOptions.mg_boxOnScreen = BoxMediumRow(3);
+ mgSplitOptions.mg_bfsFontSize = BFS_MEDIUM;
+ mgSplitOptions.mg_iCenterI = 0;
+ mgSplitOptions.mg_pmgUp = &mgSplitLevel;
+ mgSplitOptions.mg_pmgDown = &mgSplitStartStart;
+ mgSplitOptions.mg_strTip = TRANS("adjust game rules");
+ mgSplitOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
+ gm_lhGadgets.AddTail( mgSplitOptions.mg_lnNode);*/
+
+ /* // start button
+ mgSplitStartStart.mg_bfsFontSize = BFS_LARGE;
+ mgSplitStartStart.mg_boxOnScreen = BoxBigRow(4);
+ mgSplitStartStart.mg_pmgUp = &mgSplitOptions;
+ mgSplitStartStart.mg_pmgDown = &mgSplitGameType;
+ mgSplitStartStart.mg_strText = TRANS("START");
+ gm_lhGadgets.AddTail( mgSplitStartStart.mg_lnNode);
+ mgSplitStartStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
+ */
+
+ ADD_GADGET(gm_mgStart, BoxMediumRow(11), &gm_mgSplitScreenCfg, &gm_mgPlayer0Change, NULL, NULL, TRANS("START"));
+ gm_mgStart.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStart.mg_iCenterI = 0;
+}
+
+void CSelectPlayersMenu::StartMenu(void)
+{
+ CGameMenu::StartMenu();
+ SelectPlayersFillMenu();
+ SelectPlayersApplyMenu();
+}
+
+void CSelectPlayersMenu::EndMenu(void)
+{
+ SelectPlayersApplyMenu();
+ CGameMenu::EndMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSelectPlayers.h b/Sources/SeriousSam/GUI/Menus/MSelectPlayers.h
new file mode 100644
index 0000000..ea6d68e
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSelectPlayers.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SELECTPLAYERS_H
+#define SE_INCL_GAME_MENU_SELECTPLAYERS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGChangePlayer.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CSelectPlayersMenu : public CGameMenu {
+public:
+ BOOL gm_bAllowDedicated;
+ BOOL gm_bAllowObserving;
+
+ CMGTitle gm_mgTitle;
+
+ CMGTrigger gm_mgDedicated;
+ CMGTrigger gm_mgObserver;
+ CMGTrigger gm_mgSplitScreenCfg;
+
+ CMGChangePlayer gm_mgPlayer0Change;
+ CMGChangePlayer gm_mgPlayer1Change;
+ CMGChangePlayer gm_mgPlayer2Change;
+ CMGChangePlayer gm_mgPlayer3Change;
+
+ CMGButton gm_mgNotes;
+
+ CMGButton gm_mgStart;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MServers.cpp b/Sources/SeriousSam/GUI/Menus/MServers.cpp
new file mode 100644
index 0000000..b03032d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MServers.cpp
@@ -0,0 +1,110 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MServers.h"
+
+CTString _strServerFilter[7];
+CMGButton mgServerColumn[7];
+CMGEdit mgServerFilter[7];
+
+void CServersMenu::Initialize_t(void)
+{
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("CHOOSE SERVER");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgList.mg_boxOnScreen = FLOATaabbox2D(FLOAT2D(0, 0), FLOAT2D(1, 1));
+ gm_mgList.mg_pmgLeft = &gm_mgList; // make sure it can get focus
+ gm_mgList.mg_bEnabled = TRUE;
+ gm_lhGadgets.AddTail(gm_mgList.mg_lnNode);
+
+ ASSERT(ARRAYCOUNT(mgServerColumn) == ARRAYCOUNT(mgServerFilter));
+ for (INDEX i = 0; i=2)");
+ mgServerFilter[4].mg_strTip = TRANS("filter by game (ie. coop)");
+ mgServerFilter[5].mg_strTip = TRANS("filter by mod");
+ mgServerFilter[6].mg_strTip = TRANS("filter by version");
+}
+
+void CServersMenu::StartMenu(void)
+{
+ extern void RefreshServerList(void);
+ RefreshServerList();
+
+ CGameMenu::StartMenu();
+}
+
+void CServersMenu::Think(void)
+{
+ if (!_pNetwork->ga_bEnumerationChange) {
+ return;
+ }
+ _pNetwork->ga_bEnumerationChange = FALSE;
+}
diff --git a/Sources/SeriousSam/GUI/Menus/MServers.h b/Sources/SeriousSam/GUI/Menus/MServers.h
new file mode 100644
index 0000000..f0d16dd
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MServers.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SERVERS_H
+#define SE_INCL_GAME_MENU_SERVERS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGEdit.h"
+#include "GUI/Components/MGServerList.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CServersMenu : public CGameMenu {
+public:
+ BOOL m_bInternet;
+
+ CMGTitle gm_mgTitle;
+ CMGServerList gm_mgList;
+ CMGButton gm_mgRefresh;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void Think(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSinglePlayer.cpp b/Sources/SeriousSam/GUI/Menus/MSinglePlayer.cpp
new file mode 100644
index 0000000..a052e63
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSinglePlayer.cpp
@@ -0,0 +1,156 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MSinglePlayer.h"
+
+
+void CSinglePlayerMenu::Initialize_t(void)
+{
+ // intialize single player menu
+ gm_mgTitle.mg_strText = TRANS("SINGLE PLAYER");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgPlayerLabel.mg_boxOnScreen = BoxBigRow(-1.0f);
+ gm_mgPlayerLabel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgPlayerLabel.mg_iCenterI = -1;
+ gm_mgPlayerLabel.mg_bEnabled = FALSE;
+ gm_mgPlayerLabel.mg_bLabel = TRUE;
+ gm_lhGadgets.AddTail(gm_mgPlayerLabel.mg_lnNode);
+
+ gm_mgNewGame.mg_strText = TRANS("NEW GAME");
+ gm_mgNewGame.mg_bfsFontSize = BFS_LARGE;
+ gm_mgNewGame.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_mgNewGame.mg_strTip = TRANS("start new game with current player");
+ gm_lhGadgets.AddTail(gm_mgNewGame.mg_lnNode);
+ gm_mgNewGame.mg_pmgUp = &gm_mgOptions;
+ gm_mgNewGame.mg_pmgDown = &gm_mgCustom;
+ gm_mgNewGame.mg_pActivatedFunction = NULL;
+
+ gm_mgCustom.mg_strText = TRANS("CUSTOM LEVEL");
+ gm_mgCustom.mg_bfsFontSize = BFS_LARGE;
+ gm_mgCustom.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgCustom.mg_strTip = TRANS("start new game on a custom level");
+ gm_lhGadgets.AddTail(gm_mgCustom.mg_lnNode);
+ gm_mgCustom.mg_pmgUp = &gm_mgNewGame;
+ gm_mgCustom.mg_pmgDown = &gm_mgQuickLoad;
+ gm_mgCustom.mg_pActivatedFunction = NULL;
+
+ gm_mgQuickLoad.mg_strText = TRANS("QUICK LOAD");
+ gm_mgQuickLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuickLoad.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
+ gm_lhGadgets.AddTail(gm_mgQuickLoad.mg_lnNode);
+ gm_mgQuickLoad.mg_pmgUp = &gm_mgCustom;
+ gm_mgQuickLoad.mg_pmgDown = &gm_mgLoad;
+ gm_mgQuickLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgLoad.mg_strText = TRANS("LOAD");
+ gm_mgLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgLoad.mg_strTip = TRANS("load a saved game of current player");
+ gm_lhGadgets.AddTail(gm_mgLoad.mg_lnNode);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgLoad.mg_pmgDown = &gm_mgTraining;
+ gm_mgLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgTraining.mg_strText = TRANS("TRAINING");
+ gm_mgTraining.mg_bfsFontSize = BFS_LARGE;
+ gm_mgTraining.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgTraining.mg_strTip = TRANS("start training level - KarnakDemo");
+ gm_lhGadgets.AddTail(gm_mgTraining.mg_lnNode);
+ gm_mgTraining.mg_pmgUp = &gm_mgLoad;
+ gm_mgTraining.mg_pmgDown = &gm_mgTechTest;
+ gm_mgTraining.mg_pActivatedFunction = NULL;
+
+ gm_mgTechTest.mg_strText = TRANS("TECHNOLOGY TEST");
+ gm_mgTechTest.mg_bfsFontSize = BFS_LARGE;
+ gm_mgTechTest.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgTechTest.mg_strTip = TRANS("start technology testing level");
+ gm_lhGadgets.AddTail(gm_mgTechTest.mg_lnNode);
+ gm_mgTechTest.mg_pmgUp = &gm_mgTraining;
+ gm_mgTechTest.mg_pmgDown = &gm_mgPlayersAndControls;
+ gm_mgTechTest.mg_pActivatedFunction = NULL;
+
+ gm_mgPlayersAndControls.mg_bfsFontSize = BFS_LARGE;
+ gm_mgPlayersAndControls.mg_boxOnScreen = BoxBigRow(6.0f);
+ gm_mgPlayersAndControls.mg_pmgUp = &gm_mgTechTest;
+ gm_mgPlayersAndControls.mg_pmgDown = &gm_mgOptions;
+ gm_mgPlayersAndControls.mg_strText = TRANS("PLAYERS AND CONTROLS");
+ gm_mgPlayersAndControls.mg_strTip = TRANS("change currently active player or adjust controls");
+ gm_lhGadgets.AddTail(gm_mgPlayersAndControls.mg_lnNode);
+ gm_mgPlayersAndControls.mg_pActivatedFunction = NULL;
+
+ gm_mgOptions.mg_strText = TRANS("GAME OPTIONS");
+ gm_mgOptions.mg_bfsFontSize = BFS_LARGE;
+ gm_mgOptions.mg_boxOnScreen = BoxBigRow(7.0f);
+ gm_mgOptions.mg_strTip = TRANS("adjust miscellaneous game options");
+ gm_lhGadgets.AddTail(gm_mgOptions.mg_lnNode);
+ gm_mgOptions.mg_pmgUp = &gm_mgPlayersAndControls;
+ gm_mgOptions.mg_pmgDown = &gm_mgNewGame;
+ gm_mgOptions.mg_pActivatedFunction = NULL;
+}
+
+void CSinglePlayerMenu::StartMenu(void)
+{
+ gm_mgTraining.mg_bEnabled = IsMenuEnabled("Training");
+ gm_mgTechTest.mg_bEnabled = IsMenuEnabled("Technology Test");
+
+ if (gm_mgTraining.mg_bEnabled) {
+ if (!gm_mgTraining.mg_lnNode.IsLinked()) {
+ gm_lhGadgets.AddTail(gm_mgTraining.mg_lnNode);
+ }
+
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgLoad.mg_pmgDown = &gm_mgTraining;
+
+ gm_mgTraining.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgTraining.mg_pmgUp = &gm_mgLoad;
+ gm_mgTraining.mg_pmgDown = &gm_mgTechTest;
+
+ gm_mgTechTest.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgTechTest.mg_pmgUp = &gm_mgTraining;
+ gm_mgTechTest.mg_pmgDown = &gm_mgPlayersAndControls;
+
+ gm_mgPlayersAndControls.mg_boxOnScreen = BoxBigRow(6.0f);
+ gm_mgOptions.mg_boxOnScreen = BoxBigRow(7.0f);
+
+ } else {
+ if (gm_mgTraining.mg_lnNode.IsLinked()) {
+ gm_mgTraining.mg_lnNode.Remove();
+ }
+
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgLoad.mg_pmgDown = &gm_mgTechTest;
+
+ gm_mgTechTest.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgTechTest.mg_pmgUp = &gm_mgLoad;
+ gm_mgTechTest.mg_pmgDown = &gm_mgPlayersAndControls;
+
+ gm_mgPlayersAndControls.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgOptions.mg_boxOnScreen = BoxBigRow(6.0f);
+ }
+
+ CGameMenu::StartMenu();
+
+ CPlayerCharacter &pc = _pGame->gm_apcPlayers[_pGame->gm_iSinglePlayer];
+ gm_mgPlayerLabel.mg_strText.PrintF(TRANS("Player: %s\n"), pc.GetNameForPrinting());
+}
diff --git a/Sources/SeriousSam/GUI/Menus/MSinglePlayer.h b/Sources/SeriousSam/GUI/Menus/MSinglePlayer.h
new file mode 100644
index 0000000..f49a6b9
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSinglePlayer.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SINGLEPLAYER_H
+#define SE_INCL_GAME_MENU_SINGLEPLAYER_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CSinglePlayerMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgPlayerLabel;
+ CMGButton gm_mgNewGame;
+ CMGButton gm_mgCustom;
+ CMGButton gm_mgQuickLoad;
+ CMGButton gm_mgLoad;
+ CMGButton gm_mgTraining;
+ CMGButton gm_mgTechTest;
+ CMGButton gm_mgPlayersAndControls;
+ CMGButton gm_mgOptions;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.cpp b/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.cpp
new file mode 100644
index 0000000..de00420
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.cpp
@@ -0,0 +1,100 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MSinglePlayerNew.h"
+
+
+void CSinglePlayerNewMenu::Initialize_t(void)
+{
+ // intialize single player new menu
+ gm_mgTitle.mg_strText = TRANS("NEW GAME");
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgTourist.mg_strText = TRANS("TOURIST");
+ gm_mgTourist.mg_bfsFontSize = BFS_LARGE;
+ gm_mgTourist.mg_boxOnScreen = BoxBigRow(0.0f);
+ gm_mgTourist.mg_strTip = TRANS("for non-FPS players");
+ gm_lhGadgets.AddTail(gm_mgTourist.mg_lnNode);
+ gm_mgTourist.mg_pmgUp = &gm_mgSerious;
+ gm_mgTourist.mg_pmgDown = &gm_mgEasy;
+ gm_mgTourist.mg_pActivatedFunction = NULL;
+
+ gm_mgEasy.mg_strText = TRANS("EASY");
+ gm_mgEasy.mg_bfsFontSize = BFS_LARGE;
+ gm_mgEasy.mg_boxOnScreen = BoxBigRow(1.0f);
+ gm_mgEasy.mg_strTip = TRANS("for unexperienced FPS players");
+ gm_lhGadgets.AddTail(gm_mgEasy.mg_lnNode);
+ gm_mgEasy.mg_pmgUp = &gm_mgTourist;
+ gm_mgEasy.mg_pmgDown = &gm_mgMedium;
+ gm_mgEasy.mg_pActivatedFunction = NULL;
+
+ gm_mgMedium.mg_strText = TRANS("NORMAL");
+ gm_mgMedium.mg_bfsFontSize = BFS_LARGE;
+ gm_mgMedium.mg_boxOnScreen = BoxBigRow(2.0f);
+ gm_mgMedium.mg_strTip = TRANS("for experienced FPS players");
+ gm_lhGadgets.AddTail(gm_mgMedium.mg_lnNode);
+ gm_mgMedium.mg_pmgUp = &gm_mgEasy;
+ gm_mgMedium.mg_pmgDown = &gm_mgHard;
+ gm_mgMedium.mg_pActivatedFunction = NULL;
+
+ gm_mgHard.mg_strText = TRANS("HARD");
+ gm_mgHard.mg_bfsFontSize = BFS_LARGE;
+ gm_mgHard.mg_boxOnScreen = BoxBigRow(3.0f);
+ gm_mgHard.mg_strTip = TRANS("for experienced Serious Sam players");
+ gm_lhGadgets.AddTail(gm_mgHard.mg_lnNode);
+ gm_mgHard.mg_pmgUp = &gm_mgMedium;
+ gm_mgHard.mg_pmgDown = &gm_mgSerious;
+ gm_mgHard.mg_pActivatedFunction = NULL;
+
+ gm_mgSerious.mg_strText = TRANS("SERIOUS");
+ gm_mgSerious.mg_bfsFontSize = BFS_LARGE;
+ gm_mgSerious.mg_boxOnScreen = BoxBigRow(4.0f);
+ gm_mgSerious.mg_strTip = TRANS("are you serious?");
+ gm_lhGadgets.AddTail(gm_mgSerious.mg_lnNode);
+ gm_mgSerious.mg_pmgUp = &gm_mgHard;
+ gm_mgSerious.mg_pmgDown = &gm_mgTourist;
+ gm_mgSerious.mg_pActivatedFunction = NULL;
+
+ gm_mgMental.mg_strText = TRANS("MENTAL");
+ gm_mgMental.mg_bfsFontSize = BFS_LARGE;
+ gm_mgMental.mg_boxOnScreen = BoxBigRow(5.0f);
+ gm_mgMental.mg_strTip = TRANS("you are not serious!");
+ gm_lhGadgets.AddTail(gm_mgMental.mg_lnNode);
+ gm_mgMental.mg_pmgUp = &gm_mgSerious;
+ gm_mgMental.mg_pmgDown = &gm_mgTourist;
+ gm_mgMental.mg_pActivatedFunction = NULL;
+ gm_mgMental.mg_bMental = TRUE;
+
+
+}
+void CSinglePlayerNewMenu::StartMenu(void)
+{
+ CGameMenu::StartMenu();
+ extern INDEX sam_bMentalActivated;
+ if (sam_bMentalActivated) {
+ gm_mgMental.Appear();
+ gm_mgSerious.mg_pmgDown = &gm_mgMental;
+ gm_mgTourist.mg_pmgUp = &gm_mgMental;
+ } else {
+ gm_mgMental.Disappear();
+ gm_mgSerious.mg_pmgDown = &gm_mgTourist;
+ gm_mgTourist.mg_pmgUp = &gm_mgSerious;
+ }
+}
diff --git a/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.h b/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.h
new file mode 100644
index 0000000..7100bfb
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSinglePlayerNew.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SINGLEPLAYERNEW_H
+#define SE_INCL_GAME_MENU_SINGLEPLAYERNEW_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CSinglePlayerNewMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgTourist;
+ CMGButton gm_mgEasy;
+ CMGButton gm_mgMedium;
+ CMGButton gm_mgHard;
+ CMGButton gm_mgSerious;
+ CMGButton gm_mgMental;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSplitScreen.cpp b/Sources/SeriousSam/GUI/Menus/MSplitScreen.cpp
new file mode 100644
index 0000000..e7e8e5d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSplitScreen.cpp
@@ -0,0 +1,60 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "MSplitScreen.h"
+
+
+void CSplitScreenMenu::Initialize_t(void)
+{
+ // intialize split screen menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("SPLIT SCREEN");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ gm_mgStart.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStart.mg_boxOnScreen = BoxBigRow(0);
+ gm_mgStart.mg_pmgUp = &gm_mgLoad;
+ gm_mgStart.mg_pmgDown = &gm_mgQuickLoad;
+ gm_mgStart.mg_strText = TRANS("NEW GAME");
+ gm_mgStart.mg_strTip = TRANS("start new split-screen game");
+ gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
+ gm_mgStart.mg_pActivatedFunction = NULL;
+
+ gm_mgQuickLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgQuickLoad.mg_boxOnScreen = BoxBigRow(1);
+ gm_mgQuickLoad.mg_pmgUp = &gm_mgStart;
+ gm_mgQuickLoad.mg_pmgDown = &gm_mgLoad;
+ gm_mgQuickLoad.mg_strText = TRANS("QUICK LOAD");
+ gm_mgQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
+ gm_lhGadgets.AddTail(gm_mgQuickLoad.mg_lnNode);
+ gm_mgQuickLoad.mg_pActivatedFunction = NULL;
+
+ gm_mgLoad.mg_bfsFontSize = BFS_LARGE;
+ gm_mgLoad.mg_boxOnScreen = BoxBigRow(2);
+ gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
+ gm_mgLoad.mg_pmgDown = &gm_mgStart;
+ gm_mgLoad.mg_strText = TRANS("LOAD");
+ gm_mgLoad.mg_strTip = TRANS("load a saved split-screen game");
+ gm_lhGadgets.AddTail(gm_mgLoad.mg_lnNode);
+ gm_mgLoad.mg_pActivatedFunction = NULL;
+}
+
+void CSplitScreenMenu::StartMenu(void)
+{
+ CGameMenu::StartMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSplitScreen.h b/Sources/SeriousSam/GUI/Menus/MSplitScreen.h
new file mode 100644
index 0000000..173de31
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSplitScreen.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SPLITSCREEN_H
+#define SE_INCL_GAME_MENU_SPLITSCREEN_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+
+
+class CSplitScreenMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGButton gm_mgStart;
+ CMGButton gm_mgQuickLoad;
+ CMGButton gm_mgLoad;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSplitStart.cpp b/Sources/SeriousSam/GUI/Menus/MSplitStart.cpp
new file mode 100644
index 0000000..62b955d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSplitStart.cpp
@@ -0,0 +1,101 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "LevelInfo.h"
+#include "MenuStuff.h"
+#include "MSplitStart.h"
+
+extern void UpdateSplitLevel(INDEX iDummy);
+
+
+void CSplitStartMenu::Initialize_t(void)
+{
+ // intialize split screen menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("START SPLIT SCREEN");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ // game type trigger
+ TRIGGER_MG(gm_mgGameType, 0,
+ gm_mgStart, gm_mgDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
+ gm_mgGameType.mg_ctTexts = ctGameTypeRadioTexts;
+ gm_mgGameType.mg_strTip = TRANS("choose type of multiplayer game");
+ gm_mgGameType.mg_pOnTriggerChange = &UpdateSplitLevel;
+
+ // difficulty trigger
+ TRIGGER_MG(gm_mgDifficulty, 1,
+ gm_mgGameType, gm_mgLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
+ gm_mgDifficulty.mg_strTip = TRANS("choose difficulty level");
+
+ // level name
+ gm_mgLevel.mg_strText = "";
+ gm_mgLevel.mg_strLabel = TRANS("Level:");
+ gm_mgLevel.mg_boxOnScreen = BoxMediumRow(2);
+ gm_mgLevel.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgLevel.mg_iCenterI = -1;
+ gm_mgLevel.mg_pmgUp = &gm_mgDifficulty;
+ gm_mgLevel.mg_pmgDown = &gm_mgOptions;
+ gm_mgLevel.mg_strTip = TRANS("choose the level to start");
+ gm_mgLevel.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgLevel.mg_lnNode);
+
+ // options button
+ gm_mgOptions.mg_strText = TRANS("Game options");
+ gm_mgOptions.mg_boxOnScreen = BoxMediumRow(3);
+ gm_mgOptions.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgOptions.mg_iCenterI = 0;
+ gm_mgOptions.mg_pmgUp = &gm_mgLevel;
+ gm_mgOptions.mg_pmgDown = &gm_mgStart;
+ gm_mgOptions.mg_strTip = TRANS("adjust game rules");
+ gm_mgOptions.mg_pActivatedFunction = NULL;
+ gm_lhGadgets.AddTail(gm_mgOptions.mg_lnNode);
+
+ // start button
+ gm_mgStart.mg_bfsFontSize = BFS_LARGE;
+ gm_mgStart.mg_boxOnScreen = BoxBigRow(4);
+ gm_mgStart.mg_pmgUp = &gm_mgOptions;
+ gm_mgStart.mg_pmgDown = &gm_mgGameType;
+ gm_mgStart.mg_strText = TRANS("START");
+ gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
+ gm_mgStart.mg_pActivatedFunction = NULL;
+}
+
+void CSplitStartMenu::StartMenu(void)
+{
+ extern INDEX sam_bMentalActivated;
+ gm_mgDifficulty.mg_ctTexts = sam_bMentalActivated ? 6 : 5;
+
+ gm_mgGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts - 1L);
+ gm_mgGameType.ApplyCurrentSelection();
+ gm_mgDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty") + 1;
+ gm_mgDifficulty.ApplyCurrentSelection();
+
+ // clamp maximum number of players to at least 4
+ _pShell->SetINDEX("gam_ctMaxPlayers", ClampDn(_pShell->GetINDEX("gam_ctMaxPlayers"), 4L));
+
+ UpdateSplitLevel(0);
+ CGameMenu::StartMenu();
+}
+
+void CSplitStartMenu::EndMenu(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", gm_mgDifficulty.mg_iSelected - 1);
+ _pShell->SetINDEX("gam_iStartMode", gm_mgGameType.mg_iSelected);
+
+ CGameMenu::EndMenu();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MSplitStart.h b/Sources/SeriousSam/GUI/Menus/MSplitStart.h
new file mode 100644
index 0000000..c0f6618
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MSplitStart.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_SPLITSTART_H
+#define SE_INCL_GAME_MENU_SPLITSTART_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+#include "GUI/Components/MGButton.h"
+#include "GUI/Components/MGTitle.h"
+#include "GUI/Components/MGTrigger.h"
+
+
+class CSplitStartMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGTrigger gm_mgGameType;
+ CMGTrigger gm_mgDifficulty;
+ CMGButton gm_mgLevel;
+ CMGButton gm_mgOptions;
+ CMGButton gm_mgStart;
+
+ void Initialize_t(void);
+ void StartMenu(void);
+ void EndMenu(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MVar.cpp b/Sources/SeriousSam/GUI/Menus/MVar.cpp
new file mode 100644
index 0000000..5b0a820
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MVar.cpp
@@ -0,0 +1,134 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include "MenuPrinting.h"
+#include "VarList.h"
+#include "MVar.h"
+
+extern BOOL _bVarChanged;
+
+
+void CVarMenu::Initialize_t(void)
+{
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = "";
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ for (INDEX iLabel = 0; iLabel= gm_iListOffset) &&
+ (iLabel<(gm_iListOffset + VARS_ON_SCREEN)))
+ {
+ bHasFirst |= (iLabel == 0);
+ bHasLast |= (iLabel == ctLabels - 1);
+ gm_mgVar[iInMenu].mg_pvsVar = &vs;
+ gm_mgVar[iInMenu].mg_strTip = vs.vs_strTip;
+ gm_mgVar[iInMenu].mg_bEnabled = gm_mgVar[iInMenu].IsEnabled();
+ gm_mgVar[iInMenu].mg_iInList = iLabel;
+ }
+ iLabel++;
+ }
+ // enable/disable up/down arrows
+ gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
+ gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
+}
+
+void CVarMenu::StartMenu(void)
+{
+ LoadVarSettings(gm_fnmMenuCFG);
+ // set default parameters for the list
+ gm_iListOffset = 0;
+ gm_ctListTotal = _lhVarSettings.Count();
+ gm_iListWantedItem = 0;
+ CGameMenu::StartMenu();
+}
+
+void CVarMenu::EndMenu(void)
+{
+ // disable all items first
+ for (INDEX i = 0; i
+#include "MenuPrinting.h"
+#include "MenuStuff.h"
+#include "MVideoOptions.h"
+
+extern void InitVideoOptionsButtons();
+extern void UpdateVideoOptionsButtons(INDEX iSelected);
+
+
+void CVideoOptionsMenu::Initialize_t(void)
+{
+ // intialize video options menu
+ gm_mgTitle.mg_boxOnScreen = BoxTitle();
+ gm_mgTitle.mg_strText = TRANS("VIDEO");
+ gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
+
+ TRIGGER_MG(gm_mgDisplayAPITrigger, 0,
+ gm_mgApply, gm_mgDisplayAdaptersTrigger, TRANS("GRAPHICS API"), astrDisplayAPIRadioTexts);
+ gm_mgDisplayAPITrigger.mg_strTip = TRANS("choose graphics API to be used");
+ TRIGGER_MG(gm_mgDisplayAdaptersTrigger, 1,
+ gm_mgDisplayAPITrigger, gm_mgDisplayPrefsTrigger, TRANS("DISPLAY ADAPTER"), astrNoYes);
+ gm_mgDisplayAdaptersTrigger.mg_strTip = TRANS("choose display adapter to be used");
+ TRIGGER_MG(gm_mgDisplayPrefsTrigger, 2,
+ gm_mgDisplayAdaptersTrigger, gm_mgResolutionsTrigger, TRANS("PREFERENCES"), astrDisplayPrefsRadioTexts);
+ gm_mgDisplayPrefsTrigger.mg_strTip = TRANS("balance between speed and rendering quality, depending on your system");
+ TRIGGER_MG(gm_mgResolutionsTrigger, 3,
+ gm_mgDisplayPrefsTrigger, gm_mgFullScreenTrigger, TRANS("RESOLUTION"), astrNoYes);
+ gm_mgResolutionsTrigger.mg_strTip = TRANS("select video mode resolution");
+ TRIGGER_MG(gm_mgFullScreenTrigger, 4,
+ gm_mgResolutionsTrigger, gm_mgBitsPerPixelTrigger, TRANS("FULL SCREEN"), astrNoYes);
+ gm_mgFullScreenTrigger.mg_strTip = TRANS("make game run in a window or in full screen");
+ TRIGGER_MG(gm_mgBitsPerPixelTrigger, 5,
+ gm_mgFullScreenTrigger, gm_mgVideoRendering, TRANS("BITS PER PIXEL"), astrBitsPerPixelRadioTexts);
+ gm_mgBitsPerPixelTrigger.mg_strTip = TRANS("select number of colors used for display");
+
+ gm_mgDisplayPrefsTrigger.mg_pOnTriggerChange = NULL;
+ gm_mgDisplayAPITrigger.mg_pOnTriggerChange = NULL;
+ gm_mgDisplayAdaptersTrigger.mg_pOnTriggerChange = NULL;
+ gm_mgFullScreenTrigger.mg_pOnTriggerChange = NULL;
+ gm_mgResolutionsTrigger.mg_pOnTriggerChange = NULL;
+ gm_mgBitsPerPixelTrigger.mg_pOnTriggerChange = NULL;
+
+ gm_mgVideoRendering.mg_bfsFontSize = BFS_MEDIUM;
+ gm_mgVideoRendering.mg_boxOnScreen = BoxMediumRow(7.0f);
+ gm_mgVideoRendering.mg_pmgUp = &gm_mgBitsPerPixelTrigger;
+ gm_mgVideoRendering.mg_pmgDown = &gm_mgApply;
+ gm_mgVideoRendering.mg_strText = TRANS("RENDERING OPTIONS");
+ gm_mgVideoRendering.mg_strTip = TRANS("manually adjust rendering settings");
+ gm_lhGadgets.AddTail(gm_mgVideoRendering.mg_lnNode);
+ gm_mgVideoRendering.mg_pActivatedFunction = NULL;
+
+ gm_mgApply.mg_bfsFontSize = BFS_LARGE;
+ gm_mgApply.mg_boxOnScreen = BoxBigRow(5.5f);
+ gm_mgApply.mg_pmgUp = &gm_mgVideoRendering;
+ gm_mgApply.mg_pmgDown = &gm_mgDisplayAPITrigger;
+ gm_mgApply.mg_strText = TRANS("APPLY");
+ gm_mgApply.mg_strTip = TRANS("apply selected options");
+ gm_lhGadgets.AddTail(gm_mgApply.mg_lnNode);
+ gm_mgApply.mg_pActivatedFunction = NULL;
+}
+
+void CVideoOptionsMenu::StartMenu(void)
+{
+ InitVideoOptionsButtons();
+
+ CGameMenu::StartMenu();
+
+ UpdateVideoOptionsButtons(-1);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MVideoOptions.h b/Sources/SeriousSam/GUI/Menus/MVideoOptions.h
new file mode 100644
index 0000000..29db6be
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MVideoOptions.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_GAME_MENU_VIDEOOPTIONS_H
+#define SE_INCL_GAME_MENU_VIDEOOPTIONS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "GameMenu.h"
+
+
+class CVideoOptionsMenu : public CGameMenu {
+public:
+ CMGTitle gm_mgTitle;
+ CMGTrigger gm_mgDisplayAPITrigger;
+ CMGTrigger gm_mgDisplayAdaptersTrigger;
+ CMGTrigger gm_mgFullScreenTrigger;
+ CMGTrigger gm_mgResolutionsTrigger;
+ CMGTrigger gm_mgDisplayPrefsTrigger;
+ CMGButton gm_mgVideoRendering;
+ CMGTrigger gm_mgBitsPerPixelTrigger;
+ CMGButton gm_mgApply;
+
+ void StartMenu(void);
+ void Initialize_t(void);
+};
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/Menu.cpp b/Sources/SeriousSam/GUI/Menus/Menu.cpp
new file mode 100644
index 0000000..355a8c1
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/Menu.cpp
@@ -0,0 +1,972 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+#include
+#include
+#include
+#include "MainWindow.h"
+#include
+#include
+#include
+#include "MenuPrinting.h"
+#include "LevelInfo.h"
+#include "VarList.h"
+#include "FileInfo.h"
+#include "MenuManager.h"
+
+#include "MenuActions.h"
+#include "MenuStuff.h"
+#include "MenuStarters.h"
+
+// macros for translating radio button text arrays
+#define TRANSLATERADIOARRAY(array) TranslateRadioTexts(array, ARRAYCOUNT(array))
+
+extern BOOL bMenuActive;
+extern BOOL bMenuRendering;
+extern CTextureObject *_ptoLogoCT;
+extern CTextureObject *_ptoLogoODI;
+extern CTextureObject *_ptoLogoEAX;
+
+INDEX _iLocalPlayer = -1;
+extern BOOL _bPlayerMenuFromSinglePlayer = FALSE;
+
+GameMode _gmMenuGameMode = GM_NONE;
+GameMode _gmRunningGameMode = GM_NONE;
+CListHead _lhServers;
+
+void OnPlayerSelect(void);
+
+// last tick done
+TIME _tmMenuLastTickDone = -1;
+// all possible menu entities
+CListHead lhMenuEntities;
+
+extern CTString _strLastPlayerAppearance = "";
+extern CTString sam_strNetworkSettings;
+
+// function to activate when level is chosen
+void (*_pAfterLevelChosen)(void);
+
+// functions for init actions
+
+void FixupBackButton(CGameMenu *pgm);
+
+// mouse cursor position
+extern PIX _pixCursorPosI = 0;
+extern PIX _pixCursorPosJ = 0;
+extern PIX _pixCursorExternPosI = 0;
+extern PIX _pixCursorExternPosJ = 0;
+extern BOOL _bMouseUsedLast = FALSE;
+extern CMenuGadget *_pmgUnderCursor = NULL;
+extern BOOL _bDefiningKey;
+extern BOOL _bEditingString;
+
+// thumbnail for showing in menu
+CTextureObject _toThumbnail;
+BOOL _bThumbnailOn = FALSE;
+
+CFontData _fdBig;
+CFontData _fdMedium;
+CFontData _fdSmall;
+CFontData _fdTitle;
+
+CSoundData *_psdSelect = NULL;
+CSoundData *_psdPress = NULL;
+CSoundObject *_psoMenuSound = NULL;
+
+static CTextureObject _toPointer;
+static CTextureObject _toLogoMenuA;
+static CTextureObject _toLogoMenuB;
+
+// -------------- All possible menu entities
+#define BIG_BUTTONS_CT 6
+
+#define CHANGETRIGGERARRAY(ltbmg, astr) \
+ ltbmg.mg_astrTexts = astr;\
+ ltbmg.mg_ctTexts = sizeof( astr)/sizeof( astr[0]);\
+ ltbmg.mg_iSelected = 0;\
+ ltbmg.mg_strText = astr[ltbmg.mg_iSelected];
+
+#define PLACEMENT(x,y,z) CPlacement3D( FLOAT3D( x, y, z), \
+ ANGLE3D( AngleDeg(0.0f), AngleDeg(0.0f), AngleDeg(0.0f)))
+
+// ptr to current menu
+CGameMenu *pgmCurrentMenu = NULL;
+
+// global back button
+CMGButton mgBack;
+
+// -------- console variable adjustment menu
+extern BOOL _bVarChanged = FALSE;
+
+extern void PlayMenuSound(CSoundData *psd)
+{
+ if (_psoMenuSound!=NULL && !_psoMenuSound->IsPlaying()) {
+ _psoMenuSound->Play(psd, SOF_NONGAME);
+ }
+}
+
+// translate all texts in array for one radio button
+void TranslateRadioTexts(CTString astr[], INDEX ct)
+{
+ for (INDEX i=0; iExecute( "FreeUnusedStock();");
+}
+
+void StartMenus(char *str)
+{
+ _tmMenuLastTickDone=_pTimer->GetRealTimeTick();
+ // disable printing of last lines
+ CON_DiscardLastLineTimes();
+
+ // stop all IFeel effects
+ IFeel_StopEffect(NULL);
+ if (pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu) {
+ if (_gmRunningGameMode==GM_NONE) {
+ pgmCurrentMenu = &_pGUIM->gmMainMenu;
+ } else {
+ pgmCurrentMenu = &_pGUIM->gmInGameMenu;
+ }
+ }
+
+ // start main menu, or last active one
+ if (pgmCurrentMenu!=NULL) {
+ ChangeToMenu(pgmCurrentMenu);
+ } else {
+ if (_gmRunningGameMode==GM_NONE) {
+ ChangeToMenu(&_pGUIM->gmMainMenu);
+ } else {
+ ChangeToMenu(&_pGUIM->gmInGameMenu);
+ }
+ }
+ if (CTString(str)=="load") {
+ StartCurrentLoadMenu();
+ _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL;
+ }
+ if (CTString(str)=="save") {
+ StartCurrentSaveMenu();
+ _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL;
+ FixupBackButton(&_pGUIM->gmLoadSaveMenu);
+ }
+ if (CTString(str)=="controls") {
+ void StartControlsMenuFromOptions(void);
+ StartControlsMenuFromOptions();
+ _pGUIM->gmControls.gm_pgmParentMenu = NULL;
+ FixupBackButton(&_pGUIM->gmControls);
+ }
+ if (CTString(str)=="join") {
+ void StartSelectPlayersMenuFromOpen(void);
+ StartSelectPlayersMenuFromOpen();
+ _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ FixupBackButton(&_pGUIM->gmSelectPlayersMenu);
+ }
+ if (CTString(str)=="hiscore") {
+ ChangeToMenu(&_pGUIM->gmHighScoreMenu);
+ _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ FixupBackButton(&_pGUIM->gmHighScoreMenu);
+ }
+ bMenuActive = TRUE;
+ bMenuRendering = TRUE;
+}
+
+
+void StopMenus( BOOL bGoToRoot /*=TRUE*/)
+{
+ ClearThumbnail();
+ if (pgmCurrentMenu!=NULL && bMenuActive) {
+ pgmCurrentMenu->EndMenu();
+ }
+ bMenuActive = FALSE;
+ if (bGoToRoot) {
+ if (_gmRunningGameMode==GM_NONE) {
+ pgmCurrentMenu = &_pGUIM->gmMainMenu;
+ } else {
+ pgmCurrentMenu = &_pGUIM->gmInGameMenu;
+ }
+ }
+}
+
+BOOL IsMenusInRoot(void)
+{
+ return pgmCurrentMenu == NULL || pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu;
+}
+
+// ------------------------ Global menu function implementation
+void InitializeMenus(void)
+{
+ _pGUIM = new CMenuManager();
+
+ try {
+ // initialize and load corresponding fonts
+ _fdSmall.Load_t( CTFILENAME( "Fonts\\Display3-narrow.fnt"));
+ _fdMedium.Load_t( CTFILENAME( "Fonts\\Display3-normal.fnt"));
+ _fdBig.Load_t( CTFILENAME( "Fonts\\Display3-caps.fnt"));
+ _fdTitle.Load_t( CTFILENAME( "Fonts\\Title2.fnt"));
+ _fdSmall.SetCharSpacing(-1);
+ _fdSmall.SetLineSpacing( 0);
+ _fdSmall.SetSpaceWidth(0.4f);
+ _fdMedium.SetCharSpacing(+1);
+ _fdMedium.SetLineSpacing( 0);
+ _fdMedium.SetSpaceWidth(0.4f);
+ _fdBig.SetCharSpacing(+1);
+ _fdBig.SetLineSpacing( 0);
+ _fdTitle.SetCharSpacing(+1);
+ _fdTitle.SetLineSpacing( 0);
+
+ // load menu sounds
+ _psdSelect = _pSoundStock->Obtain_t( CTFILENAME("Sounds\\Menu\\Select.wav"));
+ _psdPress = _pSoundStock->Obtain_t( CTFILENAME("Sounds\\Menu\\Press.wav"));
+ _psoMenuSound = new CSoundObject;
+
+ // initialize and load menu textures
+ _toPointer.SetData_t( CTFILENAME( "Textures\\General\\Pointer.tex"));
+ _toLogoMenuA.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256a.tex"));
+ _toLogoMenuB.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256b.tex"));
+ }
+ catch( char *strError) {
+ FatalError( strError);
+ }
+ // force logo textures to be of maximal size
+ ((CTextureData*)_toLogoMenuA.GetData())->Force(TEX_CONSTANT);
+ ((CTextureData*)_toLogoMenuB.GetData())->Force(TEX_CONSTANT);
+
+ // menu's relative placement
+ CPlacement3D plRelative = CPlacement3D( FLOAT3D( 0.0f, 0.0f, -9.0f),
+ ANGLE3D( AngleDeg(0.0f), AngleDeg(0.0f), AngleDeg(0.0f)));
+ try
+ {
+ TRANSLATERADIOARRAY(astrNoYes);
+ TRANSLATERADIOARRAY(astrComputerInvoke);
+ TRANSLATERADIOARRAY(astrDisplayAPIRadioTexts);
+ TRANSLATERADIOARRAY(astrDisplayPrefsRadioTexts);
+ TRANSLATERADIOARRAY(astrBitsPerPixelRadioTexts);
+ TRANSLATERADIOARRAY(astrFrequencyRadioTexts);
+ TRANSLATERADIOARRAY(astrSoundAPIRadioTexts);
+ TRANSLATERADIOARRAY(astrDifficultyRadioTexts);
+ TRANSLATERADIOARRAY(astrMaxPlayersRadioTexts);
+ TRANSLATERADIOARRAY(astrWeapon);
+ TRANSLATERADIOARRAY(astrSplitScreenRadioTexts);
+
+ // initialize game type strings table
+ InitGameTypes();
+
+ // ------------------- Initialize menus
+ _pGUIM->gmConfirmMenu.Initialize_t();
+ _pGUIM->gmConfirmMenu.gm_strName = "Confirm";
+ _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault = &_pGUIM->gmConfirmMenu.gm_mgConfirmYes;
+ _pGUIM->gmConfirmMenu.gm_pgmParentMenu = NULL;
+ InitActionsForConfirmMenu();
+
+ _pGUIM->gmMainMenu.Initialize_t();
+ _pGUIM->gmMainMenu.gm_strName = "Main";
+ _pGUIM->gmMainMenu.gm_pmgSelectedByDefault = &_pGUIM->gmMainMenu.gm_mgSingle;
+ _pGUIM->gmMainMenu.gm_pgmParentMenu = NULL;
+ InitActionsForMainMenu();
+
+ _pGUIM->gmInGameMenu.Initialize_t();
+ _pGUIM->gmInGameMenu.gm_strName = "InGame";
+ _pGUIM->gmInGameMenu.gm_pmgSelectedByDefault = &_pGUIM->gmInGameMenu.gm_mgQuickLoad;
+ _pGUIM->gmInGameMenu.gm_pgmParentMenu = NULL;
+ InitActionsForInGameMenu();
+
+ _pGUIM->gmSinglePlayerMenu.Initialize_t();
+ _pGUIM->gmSinglePlayerMenu.gm_strName = "SinglePlayer";
+ _pGUIM->gmSinglePlayerMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerMenu.gm_mgNewGame;
+ _pGUIM->gmSinglePlayerMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ InitActionsForSinglePlayerMenu();
+
+ _pGUIM->gmSinglePlayerNewMenu.Initialize_t();
+ _pGUIM->gmSinglePlayerNewMenu.gm_strName = "SinglePlayerNew";
+ _pGUIM->gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerNewMenu.gm_mgMedium;
+ _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+ InitActionsForSinglePlayerNewMenu();
+
+ _pGUIM->gmDisabledFunction.Initialize_t();
+ _pGUIM->gmDisabledFunction.gm_strName = "DisabledFunction";
+ _pGUIM->gmDisabledFunction.gm_pmgSelectedByDefault = &_pGUIM->gmDisabledFunction.gm_mgButton;
+ _pGUIM->gmDisabledFunction.gm_pgmParentMenu = NULL;
+
+ _pGUIM->gmPlayerProfile.Initialize_t();
+ _pGUIM->gmPlayerProfile.gm_strName = "PlayerProfile";
+ _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &_pGUIM->gmPlayerProfile.gm_mgNameField;
+ InitActionsForPlayerProfileMenu();
+
+ _pGUIM->gmControls.Initialize_t();
+ _pGUIM->gmControls.gm_strName = "Controls";
+ _pGUIM->gmControls.gm_pmgSelectedByDefault = &_pGUIM->gmControls.gm_mgButtons;
+ InitActionsForControlsMenu();
+
+ // warning! parent menu has to be set inside button activate function from where
+ // Load/Save menu is called
+ _pGUIM->gmLoadSaveMenu.Initialize_t();
+ _pGUIM->gmLoadSaveMenu.gm_strName = "LoadSave";
+ _pGUIM->gmLoadSaveMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLoadSaveMenu.gm_amgButton[0];
+
+ _pGUIM->gmHighScoreMenu.Initialize_t();
+ _pGUIM->gmHighScoreMenu.gm_strName = "HighScore";
+ _pGUIM->gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack;
+
+ _pGUIM->gmCustomizeKeyboardMenu.Initialize_t();
+ _pGUIM->gmCustomizeKeyboardMenu.gm_strName = "CustomizeKeyboard";
+ _pGUIM->gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeKeyboardMenu.gm_mgKey[0];
+ _pGUIM->gmCustomizeKeyboardMenu.gm_pgmParentMenu = &_pGUIM->gmControls;
+
+ _pGUIM->gmCustomizeAxisMenu.Initialize_t();
+ _pGUIM->gmCustomizeAxisMenu.gm_strName = "CustomizeAxis";
+ _pGUIM->gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeAxisMenu.gm_mgActionTrigger;
+ _pGUIM->gmCustomizeAxisMenu.gm_pgmParentMenu = &_pGUIM->gmControls;
+ InitActionsForCustomizeAxisMenu();
+
+ _pGUIM->gmOptionsMenu.Initialize_t();
+ _pGUIM->gmOptionsMenu.gm_strName = "Options";
+ _pGUIM->gmOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmOptionsMenu.gm_mgVideoOptions;
+ _pGUIM->gmOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ InitActionsForOptionsMenu();
+
+ _pGUIM->gmVideoOptionsMenu.Initialize_t();
+ _pGUIM->gmVideoOptionsMenu.gm_strName = "VideoOptions";
+ _pGUIM->gmVideoOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVideoOptionsMenu.gm_mgDisplayAPITrigger;
+ _pGUIM->gmVideoOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ InitActionsForVideoOptionsMenu();
+
+ _pGUIM->gmAudioOptionsMenu.Initialize_t();
+ _pGUIM->gmAudioOptionsMenu.gm_strName = "AudioOptions";
+ _pGUIM->gmAudioOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmAudioOptionsMenu.gm_mgFrequencyTrigger;
+ _pGUIM->gmAudioOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ InitActionsForAudioOptionsMenu();
+
+ _pGUIM->gmLevelsMenu.Initialize_t();
+ _pGUIM->gmLevelsMenu.gm_strName = "Levels";
+ _pGUIM->gmLevelsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLevelsMenu.gm_mgManualLevel[0];
+ _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+
+ _pGUIM->gmVarMenu.Initialize_t();
+ _pGUIM->gmVarMenu.gm_strName = "Var";
+ _pGUIM->gmVarMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVarMenu.gm_mgVar[0];
+ _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
+ InitActionsForVarMenu();
+
+ _pGUIM->gmServersMenu.Initialize_t();
+ _pGUIM->gmServersMenu.gm_strName = "Servers";
+ _pGUIM->gmServersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmServersMenu.gm_mgList;
+ _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
+ InitActionsForServersMenu();
+
+ _pGUIM->gmNetworkMenu.Initialize_t();
+ _pGUIM->gmNetworkMenu.gm_strName = "Network";
+ _pGUIM->gmNetworkMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkMenu.gm_mgJoin;
+ _pGUIM->gmNetworkMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ InitActionsForNetworkMenu();
+
+ _pGUIM->gmNetworkStartMenu.Initialize_t();
+ _pGUIM->gmNetworkStartMenu.gm_strName = "NetworkStart";
+ _pGUIM->gmNetworkStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkStartMenu.gm_mgStart;
+ _pGUIM->gmNetworkStartMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu;
+ InitActionsForNetworkStartMenu();
+
+ _pGUIM->gmNetworkJoinMenu.Initialize_t();
+ _pGUIM->gmNetworkJoinMenu.gm_strName = "NetworkJoin";
+ _pGUIM->gmNetworkJoinMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkJoinMenu.gm_mgLAN;
+ _pGUIM->gmNetworkJoinMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu;
+ InitActionsForNetworkJoinMenu();
+
+ _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
+ _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
+ _pGUIM->gmSelectPlayersMenu.Initialize_t();
+ _pGUIM->gmSelectPlayersMenu.gm_strName = "SelectPlayers";
+ _pGUIM->gmSelectPlayersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSelectPlayersMenu.gm_mgStart;
+ InitActionsForSelectPlayersMenu();
+
+ _pGUIM->gmNetworkOpenMenu.Initialize_t();
+ _pGUIM->gmNetworkOpenMenu.gm_strName = "NetworkOpen";
+ _pGUIM->gmNetworkOpenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkOpenMenu.gm_mgJoin;
+ _pGUIM->gmNetworkOpenMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu;
+ InitActionsForNetworkOpenMenu();
+
+ _pGUIM->gmSplitScreenMenu.Initialize_t();
+ _pGUIM->gmSplitScreenMenu.gm_strName = "SplitScreen";
+ _pGUIM->gmSplitScreenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitScreenMenu.gm_mgStart;
+ _pGUIM->gmSplitScreenMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ InitActionsForSplitScreenMenu();
+
+ _pGUIM->gmSplitStartMenu.Initialize_t();
+ _pGUIM->gmSplitStartMenu.gm_strName = "SplitStart";
+ _pGUIM->gmSplitStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitStartMenu.gm_mgStart;
+ _pGUIM->gmSplitStartMenu.gm_pgmParentMenu = &_pGUIM->gmSplitScreenMenu;
+ InitActionsForSplitStartMenu();
+ }
+ catch( char *strError)
+ {
+ FatalError( strError);
+ }
+}
+
+void DestroyMenus( void)
+{
+ _pGUIM->gmMainMenu.Destroy();
+ pgmCurrentMenu = NULL;
+ _pSoundStock->Release(_psdSelect);
+ _pSoundStock->Release(_psdPress);
+ delete _psoMenuSound;
+ _psdSelect = NULL;
+ _psdPress = NULL;
+ _psoMenuSound = NULL;
+}
+
+// go to parent menu if possible
+void MenuGoToParent(void)
+{
+ // if there is no parent menu
+ if( pgmCurrentMenu->gm_pgmParentMenu == NULL) {
+ // if in game
+ if (_gmRunningGameMode!=GM_NONE) {
+ // exit menus
+ StopMenus();
+ // if no game is running
+ } else {
+ // go to main menu
+ ChangeToMenu(&_pGUIM->gmMainMenu);
+ }
+ // if there is some parent menu
+ } else {
+ // go to parent menu
+ ChangeToMenu( pgmCurrentMenu->gm_pgmParentMenu);
+ }
+}
+
+void MenuOnKeyDown( int iVKey)
+{
+
+ // check if mouse buttons used
+ _bMouseUsedLast = (iVKey==VK_LBUTTON || iVKey==VK_RBUTTON || iVKey==VK_MBUTTON
+ || iVKey==10 || iVKey==11);
+
+ // ignore mouse when editing
+ if (_bEditingString && _bMouseUsedLast) {
+ _bMouseUsedLast = FALSE;
+ return;
+ }
+
+ // initially the message is not handled
+ BOOL bHandled = FALSE;
+
+ // if not a mouse button, or mouse is over some gadget
+ if (!_bMouseUsedLast || _pmgUnderCursor!=NULL) {
+ // ask current menu to handle the key
+ bHandled = pgmCurrentMenu->OnKeyDown( iVKey);
+ }
+
+ // if not handled
+ if(!bHandled) {
+ // if escape or right mouse pressed
+ if(iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) {
+ if (pgmCurrentMenu==&_pGUIM->gmLoadSaveMenu && _pGUIM->gmLoadSaveMenu.gm_bNoEscape) {
+ return;
+ }
+ // go to parent menu if possible
+ MenuGoToParent();
+ }
+ }
+}
+
+void MenuOnChar(MSG msg)
+{
+ // check if mouse buttons used
+ _bMouseUsedLast = FALSE;
+
+ // ask current menu to handle the key
+ pgmCurrentMenu->OnChar(msg);
+}
+
+void MenuOnMouseMove(PIX pixI, PIX pixJ)
+{
+ static PIX pixLastI = 0;
+ static PIX pixLastJ = 0;
+ if (pixLastI==pixI && pixLastJ==pixJ) {
+ return;
+ }
+ pixLastI = pixI;
+ pixLastJ = pixJ;
+ _bMouseUsedLast = !_bEditingString && !_bDefiningKey && !_pInput->IsInputEnabled();
+}
+
+void MenuUpdateMouseFocus(void)
+{
+ // get real cursor position
+ POINT pt;
+ GetCursorPos(&pt);
+ ScreenToClient(_hwndMain, &pt);
+ extern INDEX sam_bWideScreen;
+ extern CDrawPort *pdp;
+ if( sam_bWideScreen) {
+ const PIX pixHeight = pdp->GetHeight();
+ pt.y -= (pixHeight/0.75f-pixHeight)/2;
+ }
+ _pixCursorPosI += pt.x-_pixCursorExternPosI;
+ _pixCursorPosJ = _pixCursorExternPosJ;
+ _pixCursorExternPosI = pt.x;
+ _pixCursorExternPosJ = pt.y;
+
+ // if mouse not used last
+ if (!_bMouseUsedLast||_bDefiningKey||_bEditingString) {
+ // do nothing
+ return;
+ }
+
+ CMenuGadget *pmgActive = NULL;
+ // for all gadgets in menu
+ FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ CMenuGadget &mg = *itmg;
+ // if focused
+ if( itmg->mg_bFocused) {
+ // remember it
+ pmgActive = &itmg.Current();
+ }
+ }
+
+ // if there is some under cursor
+ if (_pmgUnderCursor!=NULL) {
+ _pmgUnderCursor->OnMouseOver(_pixCursorPosI, _pixCursorPosJ);
+ // if the one under cursor has no neighbours
+ if (_pmgUnderCursor->mg_pmgLeft ==NULL
+ &&_pmgUnderCursor->mg_pmgRight==NULL
+ &&_pmgUnderCursor->mg_pmgUp ==NULL
+ &&_pmgUnderCursor->mg_pmgDown ==NULL) {
+ // it cannot be focused
+ _pmgUnderCursor = NULL;
+ return;
+ }
+
+ // if the one under cursor is not active and not disappearing
+ if (pmgActive!=_pmgUnderCursor && _pmgUnderCursor->mg_bVisible) {
+ // change focus
+ if (pmgActive!=NULL) {
+ pmgActive->OnKillFocus();
+ }
+ _pmgUnderCursor->OnSetFocus();
+ }
+ }
+}
+
+static CTimerValue _tvInitialization;
+static TIME _tmInitializationTick = -1;
+extern TIME _tmMenuLastTickDone;
+
+void SetMenuLerping(void)
+{
+ CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
+
+ // if lerping was never set before
+ if (_tmInitializationTick<0) {
+ // initialize it
+ _tvInitialization = tvNow;
+ _tmInitializationTick = _tmMenuLastTickDone;
+ }
+
+ // get passed time from session state starting in precise time and in ticks
+ FLOAT tmRealDelta = FLOAT((tvNow-_tvInitialization).GetSeconds());
+ FLOAT tmTickDelta = _tmMenuLastTickDone-_tmInitializationTick;
+ // calculate factor
+ FLOAT fFactor = 1.0f-(tmTickDelta-tmRealDelta)/_pTimer->TickQuantum;
+
+ // if the factor starts getting below zero
+ if (fFactor<0) {
+ // clamp it
+ fFactor = 0.0f;
+ // readjust timers so that it gets better
+ _tvInitialization = tvNow;
+ _tmInitializationTick = _tmMenuLastTickDone-_pTimer->TickQuantum;
+ }
+ if (fFactor>1) {
+ // clamp it
+ fFactor = 1.0f;
+ // readjust timers so that it gets better
+ _tvInitialization = tvNow;
+ _tmInitializationTick = _tmMenuLastTickDone;
+ }
+ // set lerping factor and timer
+ _pTimer->SetCurrentTick(_tmMenuLastTickDone);
+ _pTimer->SetLerp(fFactor);
+}
+
+
+// render mouse cursor if needed
+void RenderMouseCursor(CDrawPort *pdp)
+{
+ // if mouse not used last
+ if (!_bMouseUsedLast|| _bDefiningKey || _bEditingString) {
+ // don't render cursor
+ return;
+ }
+ LCDSetDrawport(pdp);
+ LCDDrawPointer(_pixCursorPosI, _pixCursorPosJ);
+}
+
+
+BOOL DoMenu( CDrawPort *pdp)
+{
+ pdp->Unlock();
+ CDrawPort dpMenu(pdp, TRUE);
+ dpMenu.Lock();
+
+ MenuUpdateMouseFocus();
+
+ // if in fullscreen
+ CDisplayMode dmCurrent;
+ _pGfx->GetCurrentDisplayMode(dmCurrent);
+ if (dmCurrent.IsFullScreen()) {
+ // clamp mouse pointer
+ _pixCursorPosI = Clamp(_pixCursorPosI, 0L, dpMenu.GetWidth());
+ _pixCursorPosJ = Clamp(_pixCursorPosJ, 0L, dpMenu.GetHeight());
+ // if in window
+ } else {
+ // use same mouse pointer as windows
+ _pixCursorPosI = _pixCursorExternPosI;
+ _pixCursorPosJ = _pixCursorExternPosJ;
+ }
+
+ pgmCurrentMenu->Think();
+
+ TIME tmTickNow = _pTimer->GetRealTimeTick();
+
+ while( _tmMenuLastTickDoneSetCurrentTick(_tmMenuLastTickDone);
+ // call think for all gadgets in menu
+ FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ itmg->Think();
+ }
+ _tmMenuLastTickDone+=_pTimer->TickQuantum;
+ }
+
+ SetMenuLerping();
+
+ PIX pixW = dpMenu.GetWidth();
+ PIX pixH = dpMenu.GetHeight();
+
+ // blend background if menu is on
+ if( bMenuActive)
+ {
+ // get current time
+ TIME tmNow = _pTimer->GetLerpedCurrentTick();
+ UBYTE ubH1 = (INDEX)(tmNow*08.7f) & 255;
+ UBYTE ubH2 = (INDEX)(tmNow*27.6f) & 255;
+ UBYTE ubH3 = (INDEX)(tmNow*16.5f) & 255;
+ UBYTE ubH4 = (INDEX)(tmNow*35.4f) & 255;
+
+ // clear screen with background texture
+ LCDPrepare(1.0f);
+ LCDSetDrawport(&dpMenu);
+ // do not allow game to show through
+ dpMenu.Fill(C_BLACK|255);
+ LCDRenderClouds1();
+ LCDRenderGrid();
+ LCDRenderClouds2();
+
+ FLOAT fScaleW = (FLOAT)pixW / 640.0f;
+ FLOAT fScaleH = (FLOAT)pixH / 480.0f;
+ PIX pixI0, pixJ0, pixI1, pixJ1;
+ // put logo(s) to main menu (if logos exist)
+ if (pgmCurrentMenu == &_pGUIM->gmMainMenu)
+ {
+ if( _ptoLogoODI!=NULL) {
+ CTextureData &td = (CTextureData&)*_ptoLogoODI->GetData();
+ #define LOGOSIZE 50
+ const PIX pixLogoWidth = LOGOSIZE * dpMenu.dp_fWideAdjustment;
+ const PIX pixLogoHeight = LOGOSIZE* td.GetHeight() / td.GetWidth();
+ pixI0 = (640-pixLogoWidth -16)*fScaleW;
+ pixJ0 = (480-pixLogoHeight-16)*fScaleH;
+ pixI1 = pixI0+ pixLogoWidth *fScaleW;
+ pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
+ dpMenu.PutTexture( _ptoLogoODI, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
+ #undef LOGOSIZE
+ }
+ if( _ptoLogoCT!=NULL) {
+ CTextureData &td = (CTextureData&)*_ptoLogoCT->GetData();
+ #define LOGOSIZE 50
+ const PIX pixLogoWidth = LOGOSIZE * dpMenu.dp_fWideAdjustment;
+ const PIX pixLogoHeight = LOGOSIZE* td.GetHeight() / td.GetWidth();
+ pixI0 = 12*fScaleW;
+ pixJ0 = (480-pixLogoHeight-16)*fScaleH;
+ pixI1 = pixI0+ pixLogoWidth *fScaleW;
+ pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
+ dpMenu.PutTexture( _ptoLogoCT, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
+ #undef LOGOSIZE
+ }
+
+ {
+ FLOAT fResize = Min(dpMenu.GetWidth()/640.0f, dpMenu.GetHeight()/480.0f);
+ PIX pixSizeI = 256*fResize;
+ PIX pixSizeJ = 64*fResize;
+ PIX pixCenterI = dpMenu.GetWidth()/2;
+ PIX pixHeightJ = 10*fResize;
+ dpMenu.PutTexture(&_toLogoMenuA, PIXaabbox2D(
+ PIX2D( pixCenterI-pixSizeI, pixHeightJ),PIX2D( pixCenterI, pixHeightJ+pixSizeJ)));
+ dpMenu.PutTexture(&_toLogoMenuB, PIXaabbox2D(
+ PIX2D( pixCenterI, pixHeightJ),PIX2D( pixCenterI+pixSizeI, pixHeightJ+pixSizeJ)));
+ }
+ } else if (pgmCurrentMenu == &_pGUIM->gmAudioOptionsMenu) {
+ if( _ptoLogoEAX!=NULL) {
+ CTextureData &td = (CTextureData&)*_ptoLogoEAX->GetData();
+ const INDEX iSize = 95;
+ const PIX pixLogoWidth = iSize * dpMenu.dp_fWideAdjustment;
+ const PIX pixLogoHeight = iSize * td.GetHeight() / td.GetWidth();
+ pixI0 = (640-pixLogoWidth - 35)*fScaleW;
+ pixJ0 = (480-pixLogoHeight - 7)*fScaleH;
+ pixI1 = pixI0+ pixLogoWidth *fScaleW;
+ pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
+ dpMenu.PutTexture( _ptoLogoEAX, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
+ }
+ }
+
+#define THUMBW 96
+#define THUMBH 96
+ // if there is a thumbnail
+ if( _bThumbnailOn) {
+ const FLOAT fThumbScaleW = fScaleW * dpMenu.dp_fWideAdjustment;
+ PIX pixOfs = 8*fScaleW;
+ pixI0 = 8*fScaleW;
+ pixJ0 = (240-THUMBW/2)*fScaleH;
+ pixI1 = pixI0+ THUMBW*fThumbScaleW;
+ pixJ1 = pixJ0+ THUMBH*fScaleH;
+ if( _toThumbnail.GetData()!=NULL)
+ { // show thumbnail with shadow and border
+ dpMenu.Fill( pixI0+pixOfs, pixJ0+pixOfs, THUMBW*fThumbScaleW, THUMBH*fScaleH, C_BLACK|128);
+ dpMenu.PutTexture( &_toThumbnail, PIXaabbox2D( PIX2D( pixI0, pixJ0), PIX2D( pixI1, pixJ1)), C_WHITE|255);
+ dpMenu.DrawBorder( pixI0,pixJ0, THUMBW*fThumbScaleW,THUMBH*fScaleH, LCDGetColor(C_mdGREEN|255, "thumbnail border"));
+ } else {
+ dpMenu.SetFont( _pfdDisplayFont);
+ dpMenu.SetTextScaling( fScaleW);
+ dpMenu.SetTextAspect( 1.0f);
+ dpMenu.PutTextCXY( TRANS("no thumbnail"), (pixI0+pixI1)/2, (pixJ0+pixJ1)/2, LCDGetColor(C_GREEN|255, "no thumbnail"));
+ }
+ }
+
+ // assure we can listen to non-3d sounds
+ _pSound->UpdateSounds();
+ }
+
+ // if this is popup menu
+ if (pgmCurrentMenu->gm_bPopup) {
+
+ // render parent menu first
+ if (pgmCurrentMenu->gm_pgmParentMenu!=NULL) {
+ _pGame->MenuPreRenderMenu(pgmCurrentMenu->gm_pgmParentMenu->gm_strName);
+ FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_pgmParentMenu->gm_lhGadgets, itmg) {
+ if( itmg->mg_bVisible) {
+ itmg->Render( &dpMenu);
+ }
+ }
+ _pGame->MenuPostRenderMenu(pgmCurrentMenu->gm_pgmParentMenu->gm_strName);
+ }
+
+ // gray it out
+ dpMenu.Fill(C_BLACK|128);
+
+ // clear popup box
+ dpMenu.Unlock();
+ PIXaabbox2D box = FloatBoxToPixBox(&dpMenu, BoxPopup());
+ CDrawPort dpPopup(pdp, box);
+ dpPopup.Lock();
+ LCDSetDrawport(&dpPopup);
+ dpPopup.Fill(C_BLACK|255);
+ LCDRenderClouds1();
+ LCDRenderGrid();
+ //LCDRenderClouds2();
+ LCDScreenBox(LCDGetColor(C_GREEN|255, "popup box"));
+ dpPopup.Unlock();
+ dpMenu.Lock();
+ }
+
+ // no entity is under cursor initially
+ _pmgUnderCursor = NULL;
+
+ BOOL bStilInMenus = FALSE;
+ _pGame->MenuPreRenderMenu(pgmCurrentMenu->gm_strName);
+ // for each menu gadget
+ FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ // if gadget is visible
+ if( itmg->mg_bVisible) {
+ bStilInMenus = TRUE;
+ itmg->Render( &dpMenu);
+ if (FloatBoxToPixBox(&dpMenu, itmg->mg_boxOnScreen)>=PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
+ _pmgUnderCursor = itmg;
+ }
+ }
+ }
+ _pGame->MenuPostRenderMenu(pgmCurrentMenu->gm_strName);
+
+ // no currently active gadget initially
+ CMenuGadget *pmgActive = NULL;
+ // if mouse was not active last
+ if (!_bMouseUsedLast) {
+ // find focused gadget
+ FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ CMenuGadget &mg = *itmg;
+ // if focused
+ if( itmg->mg_bFocused) {
+ // it is active
+ pmgActive = &itmg.Current();
+ break;
+ }
+ }
+ // if mouse was active last
+ } else {
+ // gadget under cursor is active
+ pmgActive = _pmgUnderCursor;
+ }
+
+ // if editing
+ if (_bEditingString && pmgActive!=NULL) {
+ // dim the menu bit
+ dpMenu.Fill(C_BLACK|0x40);
+ // render the edit gadget again
+ pmgActive->Render(&dpMenu);
+ }
+
+ // if there is some active gadget and it has tips
+ if (pmgActive!=NULL && (pmgActive->mg_strTip!="" || _bEditingString)) {
+ CTString strTip = pmgActive->mg_strTip;
+ if (_bEditingString) {
+ strTip = TRANS("Enter - OK, Escape - Cancel");
+ }
+ // print the tip
+ SetFontMedium(&dpMenu);
+ dpMenu.PutTextC(strTip,
+ pixW*0.5f, pixH*0.92f, LCDGetColor(C_WHITE|255, "tool tip"));
+ }
+
+ _pGame->ConsolePrintLastLines(&dpMenu);
+
+ RenderMouseCursor(&dpMenu);
+
+ dpMenu.Unlock();
+ pdp->Lock();
+
+ return bStilInMenus;
+}
+
+void MenuBack(void)
+{
+ MenuGoToParent();
+}
+
+extern void FixupBackButton(CGameMenu *pgm)
+{
+ BOOL bResume = FALSE;
+
+ if (mgBack.mg_lnNode.IsLinked()) {
+ mgBack.mg_lnNode.Remove();
+ }
+
+ BOOL bHasBack = TRUE;
+
+ if (pgm->gm_bPopup) {
+ bHasBack = FALSE;
+ }
+
+ if (pgm->gm_pgmParentMenu==NULL) {
+ if (_gmRunningGameMode==GM_NONE) {
+ bHasBack = FALSE;
+ } else {
+ bResume = TRUE;
+ }
+ }
+ if (!bHasBack) {
+ mgBack.Disappear();
+ return;
+ }
+
+ if (bResume) {
+ mgBack.mg_strText = TRANS("RESUME");
+ mgBack.mg_strTip = TRANS("return to game");
+ } else {
+ if (_bVarChanged) {
+ mgBack.mg_strText = TRANS("CANCEL");
+ mgBack.mg_strTip = TRANS("cancel changes");
+ } else {
+ mgBack.mg_strText = TRANS("BACK");
+ mgBack.mg_strTip = TRANS("return to previous menu");
+ }
+ }
+
+ mgBack.mg_iCenterI = -1;
+ mgBack.mg_bfsFontSize = BFS_LARGE;
+ mgBack.mg_boxOnScreen = BoxBack();
+ mgBack.mg_boxOnScreen = BoxLeftColumn(16.5f);
+ pgm->gm_lhGadgets.AddTail( mgBack.mg_lnNode);
+
+ mgBack.mg_pmgLeft =
+ mgBack.mg_pmgRight =
+ mgBack.mg_pmgUp =
+ mgBack.mg_pmgDown = pgm->gm_pmgSelectedByDefault;
+
+ mgBack.mg_pActivatedFunction = &MenuBack;
+
+ mgBack.Appear();
+}
+
+void ChangeToMenu( CGameMenu *pgmNewMenu)
+{
+ // auto-clear old thumbnail when going out of menu
+ ClearThumbnail();
+
+ if( pgmCurrentMenu != NULL) {
+ if (!pgmNewMenu->gm_bPopup) {
+ pgmCurrentMenu->EndMenu();
+ } else {
+ FOREACHINLIST(CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
+ itmg->OnKillFocus();
+ }
+ }
+ }
+ pgmNewMenu->StartMenu();
+ if (pgmNewMenu->gm_pmgSelectedByDefault) {
+ if (mgBack.mg_bFocused) {
+ mgBack.OnKillFocus();
+ }
+ pgmNewMenu->gm_pmgSelectedByDefault->OnSetFocus();
+ }
+ FixupBackButton(pgmNewMenu);
+ pgmCurrentMenu = pgmNewMenu;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/Menu.h b/Sources/SeriousSam/GUI/Menus/Menu.h
new file mode 100644
index 0000000..aba8393
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/Menu.h
@@ -0,0 +1,69 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_H
+#define SE_INCL_MENU_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+// set new thumbnail
+void SetThumbnail(CTFileName fn);
+// remove thumbnail
+void ClearThumbnail(void);
+
+void InitializeMenus( void);
+void DestroyMenus( void);
+void MenuOnKeyDown( int iVKey);
+void MenuOnChar(MSG msg);
+void MenuOnMouseMove(PIX pixI, PIX pixJ);
+void MenuOnLMBDown(void);
+BOOL DoMenu( CDrawPort *pdp); // returns TRUE if still active, FALSE if should quit
+void StartMenus( char *str="");
+void StopMenus(BOOL bGoToRoot =TRUE);
+BOOL IsMenusInRoot(void);
+void ChangeToMenu( class CGameMenu *pgmNew);
+extern void PlayMenuSound(CSoundData *psd);
+
+#define KEYS_ON_SCREEN 14
+#define LEVELS_ON_SCREEN 16
+#define SERVERS_ON_SCREEN 15
+#define VARS_ON_SCREEN 14
+
+extern CListHead _lhServers;
+
+extern INDEX _iLocalPlayer;
+
+enum GameMode {
+ GM_NONE = 0,
+ GM_SINGLE_PLAYER,
+ GM_NETWORK,
+ GM_SPLIT_SCREEN,
+ GM_DEMO,
+ GM_INTRO,
+};
+extern GameMode _gmMenuGameMode;
+extern GameMode _gmRunningGameMode;
+
+extern CGameMenu *pgmCurrentMenu;
+
+#include "GameMenu.h"
+
+#include "MLoadSave.h"
+#include "MPlayerProfile.h"
+#include "MSelectPlayers.h"
+
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuActions.cpp b/Sources/SeriousSam/GUI/Menus/MenuActions.cpp
new file mode 100644
index 0000000..f1398f8
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuActions.cpp
@@ -0,0 +1,1272 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+
+#include "MenuManager.h"
+#include "MenuStarters.h"
+#include "MenuStuff.h"
+#include "GUI/Components/MenuGadget.h"
+#include "LevelInfo.h"
+#include "VarList.h"
+
+ENGINE_API extern INDEX snd_iFormat;
+extern BOOL _bMouseUsedLast;
+
+extern CMenuGadget *_pmgLastActivatedGadget;
+extern CMenuGadget *_pmgUnderCursor;
+
+static INDEX _ctAdapters = 0;
+static CTString * _astrAdapterTexts = NULL;
+static INDEX _ctResolutions = 0;
+static CTString * _astrResolutionTexts = NULL;
+static CDisplayMode *_admResolutionModes = NULL;
+
+#define VOLUME_STEPS 50
+
+
+// make description for a given resolution
+static CTString GetResolutionDescription(CDisplayMode &dm)
+{
+ CTString str;
+ // if dual head
+ if (dm.IsDualHead()) {
+ str.PrintF(TRANS("%dx%d double"), dm.dm_pixSizeI / 2, dm.dm_pixSizeJ);
+ // if widescreen
+ } else if (dm.IsWideScreen()) {
+ str.PrintF(TRANS("%dx%d wide"), dm.dm_pixSizeI, dm.dm_pixSizeJ);
+ // otherwise it is normal
+ } else {
+ str.PrintF("%dx%d", dm.dm_pixSizeI, dm.dm_pixSizeJ);
+ }
+ return str;
+}
+
+// make description for a given resolution
+static void SetResolutionInList(INDEX iRes, PIX pixSizeI, PIX pixSizeJ)
+{
+ ASSERT(iRes >= 0 && iRes<_ctResolutions);
+
+ CTString &str = _astrResolutionTexts[iRes];
+ CDisplayMode &dm = _admResolutionModes[iRes];
+ dm.dm_pixSizeI = pixSizeI;
+ dm.dm_pixSizeJ = pixSizeJ;
+ str = GetResolutionDescription(dm);
+}
+
+static void ResolutionToSize(INDEX iRes, PIX &pixSizeI, PIX &pixSizeJ)
+{
+ ASSERT(iRes >= 0 && iRes<_ctResolutions);
+ CDisplayMode &dm = _admResolutionModes[iRes];
+ pixSizeI = dm.dm_pixSizeI;
+ pixSizeJ = dm.dm_pixSizeJ;
+}
+
+static void SizeToResolution(PIX pixSizeI, PIX pixSizeJ, INDEX &iRes)
+{
+ for (iRes = 0; iRes<_ctResolutions; iRes++) {
+ CDisplayMode &dm = _admResolutionModes[iRes];
+ if (dm.dm_pixSizeI == pixSizeI && dm.dm_pixSizeJ == pixSizeJ) {
+ return;
+ }
+ }
+ // if none was found, search for default
+ for (iRes = 0; iRes<_ctResolutions; iRes++) {
+ CDisplayMode &dm = _admResolutionModes[iRes];
+ if (dm.dm_pixSizeI == 640 && dm.dm_pixSizeJ == 480) {
+ return;
+ }
+ }
+ // if still none found
+ ASSERT(FALSE); // this should never happen
+ // return first one
+ iRes = 0;
+}
+
+// ------------------------ CConfirmMenu implementation
+extern CTFileName _fnmModToLoad;
+extern CTString _strModServerJoin;
+
+CTFileName _fnmModSelected;
+CTString _strModURLSelected;
+CTString _strModServerSelected;
+
+static void ExitGame(void)
+{
+ _bRunning = FALSE;
+ _bQuitScreen = TRUE;
+}
+
+static void ExitConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ gmCurrent._pConfimedYes = &ExitGame;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+static void StopCurrentGame(void)
+{
+ _pGame->StopGame();
+ _gmRunningGameMode = GM_NONE;
+ StopMenus(TRUE);
+ StartMenus("");
+}
+
+static void StopConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ gmCurrent._pConfimedYes = &StopCurrentGame;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+static void ModLoadYes(void)
+{
+ _fnmModToLoad = _fnmModSelected;
+}
+
+static void ModConnect(void)
+{
+ _fnmModToLoad = _fnmModSelected;
+ _strModServerJoin = _strModServerSelected;
+}
+
+extern void ModConnectConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ if (_fnmModSelected == " ") {
+ _fnmModSelected = CTString("SeriousSam");
+ }
+
+ CTFileName fnmModPath = "Mods\\" + _fnmModSelected + "\\";
+ if (!FileExists(fnmModPath + "BaseWriteInclude.lst")
+ && !FileExists(fnmModPath + "BaseWriteExclude.lst")
+ && !FileExists(fnmModPath + "BaseBrowseInclude.lst")
+ && !FileExists(fnmModPath + "BaseBrowseExclude.lst")) {
+ extern void ModNotInstalled(void);
+ ModNotInstalled();
+ return;
+ }
+
+ CPrintF(TRANS("Server is running a different MOD (%s).\nYou need to reload to connect.\n"), _fnmModSelected);
+ gmCurrent._pConfimedYes = &ModConnect;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?");
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+void SaveConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ extern void OnFileSaveOK(void);
+ gmCurrent._pConfimedYes = &OnFileSaveOK;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?");
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+void ExitAndSpawnExplorer(void)
+{
+ _bRunning = FALSE;
+ _bQuitScreen = FALSE;
+ extern CTString _strURLToVisit;
+ _strURLToVisit = _strModURLSelected;
+}
+
+void ModNotInstalled(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ gmCurrent._pConfimedYes = &ExitAndSpawnExplorer;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText.PrintF(
+ TRANS("You don't have MOD '%s' installed.\nDo you want to visit its web site?"), (const char*)_fnmModSelected);
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeSmall();
+ ChangeToMenu(&gmCurrent);
+}
+
+extern void ModConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ gmCurrent._pConfimedYes = &ModLoadYes;
+ gmCurrent._pConfimedNo = NULL;
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?");
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+static void RevertVideoSettings(void);
+
+void VideoConfirm(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ // FIXUP: keyboard focus lost when going from full screen to window mode
+ // due to WM_MOUSEMOVE being sent
+ _bMouseUsedLast = FALSE;
+ _pmgUnderCursor = gmCurrent.gm_pmgSelectedByDefault;
+
+ gmCurrent._pConfimedYes = NULL;
+ gmCurrent._pConfimedNo = RevertVideoSettings;
+
+ gmCurrent.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?");
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.BeLarge();
+ ChangeToMenu(&gmCurrent);
+}
+
+static void ConfirmYes(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ if (gmCurrent._pConfimedYes != NULL) {
+ gmCurrent._pConfimedYes();
+ }
+ void MenuGoToParent(void);
+ MenuGoToParent();
+}
+
+static void ConfirmNo(void)
+{
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ if (gmCurrent._pConfimedNo != NULL) {
+ gmCurrent._pConfimedNo();
+ }
+ void MenuGoToParent(void);
+ MenuGoToParent();
+}
+
+void InitActionsForConfirmMenu() {
+ CConfirmMenu &gmCurrent = _pGUIM->gmConfirmMenu;
+
+ gmCurrent.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes;
+ gmCurrent.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo;
+}
+
+// ------------------------ CMainMenu implementation
+void InitActionsForMainMenu() {
+ CMainMenu &gmCurrent = _pGUIM->gmMainMenu;
+
+ gmCurrent.gm_mgSingle.mg_pActivatedFunction = &StartSinglePlayerMenu;
+ gmCurrent.gm_mgNetwork.mg_pActivatedFunction = StartNetworkMenu;
+ gmCurrent.gm_mgSplitScreen.mg_pActivatedFunction = &StartSplitScreenMenu;
+ gmCurrent.gm_mgDemo.mg_pActivatedFunction = &StartDemoLoadMenu;
+ gmCurrent.gm_mgMods.mg_pActivatedFunction = &StartModsLoadMenu;
+ gmCurrent.gm_mgHighScore.mg_pActivatedFunction = &StartHighScoreMenu;
+ gmCurrent.gm_mgOptions.mg_pActivatedFunction = &StartOptionsMenu;
+ gmCurrent.gm_mgQuit.mg_pActivatedFunction = &ExitConfirm;
+}
+
+// ------------------------ CInGameMenu implementation
+// start load/save menus depending on type of game running
+static void QuickSaveFromMenu()
+{
+ _pShell->SetINDEX("gam_bQuickSave", 2); // force save with reporting
+ StopMenus(TRUE);
+}
+
+static void StopRecordingDemo(void)
+{
+ _pNetwork->StopDemoRec();
+ void SetDemoStartStopRecText(void);
+ SetDemoStartStopRecText();
+}
+
+void InitActionsForInGameMenu()
+{
+ CInGameMenu &gmCurrent = _pGUIM->gmInGameMenu;
+
+ gmCurrent.gm_mgQuickLoad.mg_pActivatedFunction = &StartCurrentQuickLoadMenu;
+ gmCurrent.gm_mgQuickSave.mg_pActivatedFunction = &QuickSaveFromMenu;
+ gmCurrent.gm_mgLoad.mg_pActivatedFunction = &StartCurrentLoadMenu;
+ gmCurrent.gm_mgSave.mg_pActivatedFunction = &StartCurrentSaveMenu;
+ gmCurrent.gm_mgHighScore.mg_pActivatedFunction = &StartHighScoreMenu;
+ gmCurrent.gm_mgOptions.mg_pActivatedFunction = &StartOptionsMenu;
+ gmCurrent.gm_mgStop.mg_pActivatedFunction = &StopConfirm;
+ gmCurrent.gm_mgQuit.mg_pActivatedFunction = &ExitConfirm;
+}
+
+extern void SetDemoStartStopRecText(void)
+{
+ CInGameMenu &gmCurrent = _pGUIM->gmInGameMenu;
+
+ if (_pNetwork->IsRecordingDemo())
+ {
+ gmCurrent.gm_mgDemoRec.SetText(TRANS("STOP RECORDING"));
+ gmCurrent.gm_mgDemoRec.mg_strTip = TRANS("stop current recording");
+ gmCurrent.gm_mgDemoRec.mg_pActivatedFunction = &StopRecordingDemo;
+ } else {
+ gmCurrent.gm_mgDemoRec.SetText(TRANS("RECORD DEMO"));
+ gmCurrent.gm_mgDemoRec.mg_strTip = TRANS("start recording current game");
+ gmCurrent.gm_mgDemoRec.mg_pActivatedFunction = &StartDemoSaveMenu;
+ }
+}
+
+// ------------------------ CSinglePlayerMenu implementation
+extern CTString sam_strTechTestLevel;
+extern CTString sam_strTrainingLevel;
+
+static void StartSinglePlayerGame_Normal(void);
+static void StartTechTest(void)
+{
+ _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+ _pGame->gam_strCustomLevel = sam_strTechTestLevel;
+ StartSinglePlayerGame_Normal();
+}
+
+static void StartTraining(void)
+{
+ _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+ _pGame->gam_strCustomLevel = sam_strTrainingLevel;
+ ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu);
+}
+
+void InitActionsForSinglePlayerMenu()
+{
+ CSinglePlayerMenu &gmCurrent = _pGUIM->gmSinglePlayerMenu;
+
+ gmCurrent.gm_mgNewGame.mg_pActivatedFunction = &StartSinglePlayerNewMenu;
+ gmCurrent.gm_mgCustom.mg_pActivatedFunction = &StartSelectLevelFromSingle;
+ gmCurrent.gm_mgQuickLoad.mg_pActivatedFunction = &StartSinglePlayerQuickLoadMenu;
+ gmCurrent.gm_mgLoad.mg_pActivatedFunction = &StartSinglePlayerLoadMenu;
+ gmCurrent.gm_mgTraining.mg_pActivatedFunction = &StartTraining;
+ gmCurrent.gm_mgTechTest.mg_pActivatedFunction = &StartTechTest;
+ gmCurrent.gm_mgPlayersAndControls.mg_pActivatedFunction = &StartChangePlayerMenuFromSinglePlayer;
+ gmCurrent.gm_mgOptions.mg_pActivatedFunction = &StartSinglePlayerGameOptions;
+}
+
+// ------------------------ CSinglePlayerNewMenu implementation
+void StartSinglePlayerGame(void)
+{
+ _pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_iSinglePlayer;
+ _pGame->gm_aiStartLocalPlayers[1] = -1;
+ _pGame->gm_aiStartLocalPlayers[2] = -1;
+ _pGame->gm_aiStartLocalPlayers[3] = -1;
+
+ _pGame->gm_strNetworkProvider = "Local";
+ CUniversalSessionProperties sp;
+ _pGame->SetSinglePlayerSession(sp);
+
+ if (_pGame->NewGame(_pGame->gam_strCustomLevel, _pGame->gam_strCustomLevel, sp))
+ {
+ StopMenus();
+ _gmRunningGameMode = GM_SINGLE_PLAYER;
+ } else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+static void StartSinglePlayerGame_Tourist(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_TOURIST);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+static void StartSinglePlayerGame_Easy(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EASY);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+static void StartSinglePlayerGame_Normal(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_NORMAL);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+static void StartSinglePlayerGame_Hard(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_HARD);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+static void StartSinglePlayerGame_Serious(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EXTREME);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+static void StartSinglePlayerGame_Mental(void)
+{
+ _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EXTREME + 1);
+ _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
+ StartSinglePlayerGame();
+}
+
+void InitActionsForSinglePlayerNewMenu() {
+ CSinglePlayerNewMenu &gmCurrent = _pGUIM->gmSinglePlayerNewMenu;
+
+ gmCurrent.gm_mgTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist;
+ gmCurrent.gm_mgEasy.mg_pActivatedFunction = &StartSinglePlayerGame_Easy;
+ gmCurrent.gm_mgMedium.mg_pActivatedFunction = &StartSinglePlayerGame_Normal;
+ gmCurrent.gm_mgHard.mg_pActivatedFunction = &StartSinglePlayerGame_Hard;
+ gmCurrent.gm_mgSerious.mg_pActivatedFunction = &StartSinglePlayerGame_Serious;
+ gmCurrent.gm_mgMental.mg_pActivatedFunction = &StartSinglePlayerGame_Mental;
+}
+
+// ------------------------ CPlayerProfileMenu implementation
+static void ChangeCrosshair(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ pps->ps_iCrossHairType = iNew - 1;
+}
+
+static void ChangeWeaponSelect(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ pps->ps_iWeaponAutoSelect = iNew;
+}
+
+static void ChangeWeaponHide(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags |= PSF_HIDEWEAPON;
+ } else {
+ pps->ps_ulFlags &= ~PSF_HIDEWEAPON;
+ }
+}
+
+static void Change3rdPerson(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags |= PSF_PREFER3RDPERSON;
+ } else {
+ pps->ps_ulFlags &= ~PSF_PREFER3RDPERSON;
+ }
+}
+
+static void ChangeQuotes(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags &= ~PSF_NOQUOTES;
+ } else {
+ pps->ps_ulFlags |= PSF_NOQUOTES;
+ }
+}
+
+static void ChangeAutoSave(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags |= PSF_AUTOSAVE;
+ } else {
+ pps->ps_ulFlags &= ~PSF_AUTOSAVE;
+ }
+}
+
+static void ChangeCompDoubleClick(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags &= ~PSF_COMPSINGLECLICK;
+ } else {
+ pps->ps_ulFlags |= PSF_COMPSINGLECLICK;
+ }
+}
+
+static void ChangeViewBobbing(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags &= ~PSF_NOBOBBING;
+ } else {
+ pps->ps_ulFlags |= PSF_NOBOBBING;
+ }
+}
+
+static void ChangeSharpTurning(INDEX iNew)
+{
+ INDEX iPlayer = *_pGUIM->gmPlayerProfile.gm_piCurrentPlayer;
+ CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
+ if (iNew) {
+ pps->ps_ulFlags |= PSF_SHARPTURNING;
+ } else {
+ pps->ps_ulFlags &= ~PSF_SHARPTURNING;
+ }
+}
+
+extern void PPOnPlayerSelect(void)
+{
+ ASSERT(_pmgLastActivatedGadget != NULL);
+ if (_pmgLastActivatedGadget->mg_bEnabled) {
+ _pGUIM->gmPlayerProfile.SelectPlayer(((CMGButton *)_pmgLastActivatedGadget)->mg_iIndex);
+ }
+}
+
+void InitActionsForPlayerProfileMenu()
+{
+ CPlayerProfileMenu &gmCurrent = _pGUIM->gmPlayerProfile;
+
+ gmCurrent.gm_mgCrosshair.mg_pOnTriggerChange = ChangeCrosshair;
+ gmCurrent.gm_mgWeaponSelect.mg_pOnTriggerChange = ChangeWeaponSelect;
+ gmCurrent.gm_mgWeaponHide.mg_pOnTriggerChange = ChangeWeaponHide;
+ gmCurrent.gm_mg3rdPerson.mg_pOnTriggerChange = Change3rdPerson;
+ gmCurrent.gm_mgQuotes.mg_pOnTriggerChange = ChangeQuotes;
+ gmCurrent.gm_mgAutoSave.mg_pOnTriggerChange = ChangeAutoSave;
+ gmCurrent.gm_mgCompDoubleClick.mg_pOnTriggerChange = ChangeCompDoubleClick;
+ gmCurrent.gm_mgSharpTurning.mg_pOnTriggerChange = ChangeSharpTurning;
+ gmCurrent.gm_mgViewBobbing.mg_pOnTriggerChange = ChangeViewBobbing;
+ gmCurrent.gm_mgCustomizeControls.mg_pActivatedFunction = &StartControlsMenuFromPlayer;
+ gmCurrent.gm_mgModel.mg_pActivatedFunction = &StartPlayerModelLoadMenu;
+}
+
+// ------------------------ CControlsMenu implementation
+void InitActionsForControlsMenu()
+{
+ CControlsMenu &gmCurrent = _pGUIM->gmControls;
+
+ gmCurrent.gm_mgButtons.mg_pActivatedFunction = &StartCustomizeKeyboardMenu;
+ gmCurrent.gm_mgAdvanced.mg_pActivatedFunction = &StartCustomizeAxisMenu;
+ gmCurrent.gm_mgPredefined.mg_pActivatedFunction = &StartControlsLoadMenu;
+}
+
+// ------------------------ CCustomizeAxisMenu implementation
+void PreChangeAxis(INDEX iDummy)
+{
+ _pGUIM->gmCustomizeAxisMenu.ApplyActionSettings();
+}
+
+void PostChangeAxis(INDEX iDummy)
+{
+ _pGUIM->gmCustomizeAxisMenu.ObtainActionSettings();
+}
+
+void InitActionsForCustomizeAxisMenu()
+{
+ CCustomizeAxisMenu &gmCurrent = _pGUIM->gmCustomizeAxisMenu;
+
+ gmCurrent.gm_mgActionTrigger.mg_pPreTriggerChange = PreChangeAxis;
+ gmCurrent.gm_mgActionTrigger.mg_pOnTriggerChange = PostChangeAxis;
+}
+
+// ------------------------ COptionsMenu implementation
+void InitActionsForOptionsMenu()
+{
+ COptionsMenu &gmCurrent = _pGUIM->gmOptionsMenu;
+
+ gmCurrent.gm_mgVideoOptions.mg_pActivatedFunction = &StartVideoOptionsMenu;
+ gmCurrent.gm_mgAudioOptions.mg_pActivatedFunction = &StartAudioOptionsMenu;
+ gmCurrent.gm_mgPlayerProfileOptions.mg_pActivatedFunction = &StartChangePlayerMenuFromOptions;
+ gmCurrent.gm_mgNetworkOptions.mg_pActivatedFunction = &StartNetworkSettingsMenu;
+ gmCurrent.gm_mgCustomOptions.mg_pActivatedFunction = &StartCustomLoadMenu;
+ gmCurrent.gm_mgAddonOptions.mg_pActivatedFunction = &StartAddonsLoadMenu;
+}
+
+// ------------------------ CVideoOptionsMenu implementation
+static INDEX sam_old_bFullScreenActive;
+static INDEX sam_old_iScreenSizeI;
+static INDEX sam_old_iScreenSizeJ;
+static INDEX sam_old_iDisplayDepth;
+static INDEX sam_old_iDisplayAdapter;
+static INDEX sam_old_iGfxAPI;
+static INDEX sam_old_iVideoSetup; // 0==speed, 1==normal, 2==quality, 3==custom
+
+static void FillResolutionsList(void)
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ // free resolutions
+ if (_astrResolutionTexts != NULL) {
+ delete[] _astrResolutionTexts;
+ }
+ if (_admResolutionModes != NULL) {
+ delete[] _admResolutionModes;
+ }
+ _ctResolutions = 0;
+
+ // if window
+ if (gmCurrent.gm_mgFullScreenTrigger.mg_iSelected == 0) {
+ // always has fixed resolutions, but not greater than desktop
+
+ _ctResolutions = ARRAYCOUNT(apixWidths);
+ _astrResolutionTexts = new CTString[_ctResolutions];
+ _admResolutionModes = new CDisplayMode[_ctResolutions];
+ extern PIX _pixDesktopWidth;
+ INDEX iRes = 0;
+ for (; iRes<_ctResolutions; iRes++) {
+ if (apixWidths[iRes][0]>_pixDesktopWidth) break;
+ SetResolutionInList(iRes, apixWidths[iRes][0], apixWidths[iRes][1]);
+ }
+ _ctResolutions = iRes;
+
+ // if fullscreen
+ } else {
+ // get resolutions list from engine
+ CDisplayMode *pdm = _pGfx->EnumDisplayModes(_ctResolutions,
+ SwitchToAPI(gmCurrent.gm_mgDisplayAPITrigger.mg_iSelected), gmCurrent.gm_mgDisplayAdaptersTrigger.mg_iSelected);
+ // allocate that much
+ _astrResolutionTexts = new CTString[_ctResolutions];
+ _admResolutionModes = new CDisplayMode[_ctResolutions];
+ // for each resolution
+ for (INDEX iRes = 0; iRes<_ctResolutions; iRes++) {
+ // add it to list
+ SetResolutionInList(iRes, pdm[iRes].dm_pixSizeI, pdm[iRes].dm_pixSizeJ);
+ }
+ }
+
+ gmCurrent.gm_mgResolutionsTrigger.mg_astrTexts = _astrResolutionTexts;
+ gmCurrent.gm_mgResolutionsTrigger.mg_ctTexts = _ctResolutions;
+}
+
+static void FillAdaptersList(void)
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ if (_astrAdapterTexts != NULL) {
+ delete[] _astrAdapterTexts;
+ }
+
+ _ctAdapters = 0;
+
+ INDEX iApi = SwitchToAPI(gmCurrent.gm_mgDisplayAPITrigger.mg_iSelected);
+ _ctAdapters = _pGfx->gl_gaAPI[iApi].ga_ctAdapters;
+ _astrAdapterTexts = new CTString[_ctAdapters];
+ for (INDEX iAdapter = 0; iAdapter<_ctAdapters; iAdapter++) {
+ _astrAdapterTexts[iAdapter] = _pGfx->gl_gaAPI[iApi].ga_adaAdapter[iAdapter].da_strRenderer;
+ }
+
+ gmCurrent.gm_mgDisplayAdaptersTrigger.mg_astrTexts = _astrAdapterTexts;
+ gmCurrent.gm_mgDisplayAdaptersTrigger.mg_ctTexts = _ctAdapters;
+}
+
+extern void UpdateVideoOptionsButtons(INDEX iSelected)
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ const BOOL _bVideoOptionsChanged = (iSelected != -1);
+
+ const BOOL bOGLEnabled = _pGfx->HasAPI(GAT_OGL);
+#ifdef SE1_D3D
+ const BOOL bD3DEnabled = _pGfx->HasAPI(GAT_D3D);
+ ASSERT(bOGLEnabled || bD3DEnabled);
+#else //
+ ASSERT(bOGLEnabled);
+#endif // SE1_D3D
+
+ CDisplayAdapter &da = _pGfx->gl_gaAPI[SwitchToAPI(gmCurrent.gm_mgDisplayAPITrigger.mg_iSelected)]
+ .ga_adaAdapter[gmCurrent.gm_mgDisplayAdaptersTrigger.mg_iSelected];
+
+ // number of available preferences is higher if video setup is custom
+ gmCurrent.gm_mgDisplayPrefsTrigger.mg_ctTexts = 3;
+ if (sam_iVideoSetup == 3) gmCurrent.gm_mgDisplayPrefsTrigger.mg_ctTexts++;
+
+ // enumerate adapters
+ FillAdaptersList();
+
+ // show or hide buttons
+ gmCurrent.gm_mgDisplayAPITrigger.mg_bEnabled = bOGLEnabled
+#ifdef SE1_D3D
+ && bD3DEnabled
+#endif // SE1_D3D
+ ;
+ gmCurrent.gm_mgDisplayAdaptersTrigger.mg_bEnabled = _ctAdapters>1;
+ gmCurrent.gm_mgApply.mg_bEnabled = _bVideoOptionsChanged;
+ // determine which should be visible
+
+ gmCurrent.gm_mgFullScreenTrigger.mg_bEnabled = TRUE;
+ if (da.da_ulFlags&DAF_FULLSCREENONLY) {
+ gmCurrent.gm_mgFullScreenTrigger.mg_bEnabled = FALSE;
+ gmCurrent.gm_mgFullScreenTrigger.mg_iSelected = 1;
+ gmCurrent.gm_mgFullScreenTrigger.ApplyCurrentSelection();
+ }
+
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_bEnabled = TRUE;
+ if (gmCurrent.gm_mgFullScreenTrigger.mg_iSelected == 0) {
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_bEnabled = FALSE;
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch(DD_DEFAULT);
+ gmCurrent.gm_mgBitsPerPixelTrigger.ApplyCurrentSelection();
+ } else if (da.da_ulFlags&DAF_16BITONLY) {
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_bEnabled = FALSE;
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch(DD_16BIT);
+ gmCurrent.gm_mgBitsPerPixelTrigger.ApplyCurrentSelection();
+ }
+
+ // remember current selected resolution
+ PIX pixSizeI, pixSizeJ;
+ ResolutionToSize(gmCurrent.gm_mgResolutionsTrigger.mg_iSelected, pixSizeI, pixSizeJ);
+
+ // select same resolution again if possible
+ FillResolutionsList();
+ SizeToResolution(pixSizeI, pixSizeJ, gmCurrent.gm_mgResolutionsTrigger.mg_iSelected);
+
+ // apply adapter and resolutions
+ gmCurrent.gm_mgDisplayAdaptersTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgResolutionsTrigger.ApplyCurrentSelection();
+}
+
+extern void InitVideoOptionsButtons(void)
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ if (sam_bFullScreenActive) {
+ gmCurrent.gm_mgFullScreenTrigger.mg_iSelected = 1;
+ } else {
+ gmCurrent.gm_mgFullScreenTrigger.mg_iSelected = 0;
+ }
+
+ gmCurrent.gm_mgDisplayAPITrigger.mg_iSelected = APIToSwitch((GfxAPIType)(INDEX)sam_iGfxAPI);
+ gmCurrent.gm_mgDisplayAdaptersTrigger.mg_iSelected = sam_iDisplayAdapter;
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch((enum DisplayDepth)(INDEX)sam_iDisplayDepth);
+
+ FillResolutionsList();
+ SizeToResolution(sam_iScreenSizeI, sam_iScreenSizeJ, gmCurrent.gm_mgResolutionsTrigger.mg_iSelected);
+ gmCurrent.gm_mgDisplayPrefsTrigger.mg_iSelected = Clamp(int(sam_iVideoSetup), 0, 3);
+
+ gmCurrent.gm_mgFullScreenTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgDisplayPrefsTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgDisplayAPITrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgDisplayAdaptersTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgResolutionsTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgBitsPerPixelTrigger.ApplyCurrentSelection();
+}
+
+static void ApplyVideoOptions(void)
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ // Remember old video settings
+ sam_old_bFullScreenActive = sam_bFullScreenActive;
+ sam_old_iScreenSizeI = sam_iScreenSizeI;
+ sam_old_iScreenSizeJ = sam_iScreenSizeJ;
+ sam_old_iDisplayDepth = sam_iDisplayDepth;
+ sam_old_iDisplayAdapter = sam_iDisplayAdapter;
+ sam_old_iGfxAPI = sam_iGfxAPI;
+ sam_old_iVideoSetup = sam_iVideoSetup;
+
+ BOOL bFullScreenMode = gmCurrent.gm_mgFullScreenTrigger.mg_iSelected == 1;
+ PIX pixWindowSizeI, pixWindowSizeJ;
+ ResolutionToSize(gmCurrent.gm_mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ);
+ enum GfxAPIType gat = SwitchToAPI(gmCurrent.gm_mgDisplayAPITrigger.mg_iSelected);
+ enum DisplayDepth dd = SwitchToDepth(gmCurrent.gm_mgBitsPerPixelTrigger.mg_iSelected);
+ const INDEX iAdapter = gmCurrent.gm_mgDisplayAdaptersTrigger.mg_iSelected;
+
+ // setup preferences
+ extern INDEX _iLastPreferences;
+ if (sam_iVideoSetup == 3) _iLastPreferences = 3;
+ sam_iVideoSetup = gmCurrent.gm_mgDisplayPrefsTrigger.mg_iSelected;
+
+ // force fullscreen mode if needed
+ CDisplayAdapter &da = _pGfx->gl_gaAPI[gat].ga_adaAdapter[iAdapter];
+ if (da.da_ulFlags & DAF_FULLSCREENONLY) bFullScreenMode = TRUE;
+ if (da.da_ulFlags & DAF_16BITONLY) dd = DD_16BIT;
+ // force window to always be in default colors
+ if (!bFullScreenMode) dd = DD_DEFAULT;
+
+ // (try to) set mode
+ StartNewMode(gat, iAdapter, pixWindowSizeI, pixWindowSizeJ, dd, bFullScreenMode);
+
+ // refresh buttons
+ InitVideoOptionsButtons();
+ UpdateVideoOptionsButtons(-1);
+
+ // ask user to keep or restore
+ if (bFullScreenMode) VideoConfirm();
+}
+
+static void RevertVideoSettings(void)
+{
+ // restore previous variables
+ sam_bFullScreenActive = sam_old_bFullScreenActive;
+ sam_iScreenSizeI = sam_old_iScreenSizeI;
+ sam_iScreenSizeJ = sam_old_iScreenSizeJ;
+ sam_iDisplayDepth = sam_old_iDisplayDepth;
+ sam_iDisplayAdapter = sam_old_iDisplayAdapter;
+ sam_iGfxAPI = sam_old_iGfxAPI;
+ sam_iVideoSetup = sam_old_iVideoSetup;
+
+ // update the video mode
+ extern void ApplyVideoMode(void);
+ ApplyVideoMode();
+
+ // refresh buttons
+ InitVideoOptionsButtons();
+ UpdateVideoOptionsButtons(-1);
+}
+
+void InitActionsForVideoOptionsMenu()
+{
+ CVideoOptionsMenu &gmCurrent = _pGUIM->gmVideoOptionsMenu;
+
+ gmCurrent.gm_mgDisplayPrefsTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgDisplayAPITrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgDisplayAdaptersTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgFullScreenTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgResolutionsTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgBitsPerPixelTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
+ gmCurrent.gm_mgVideoRendering.mg_pActivatedFunction = &StartRenderingOptionsMenu;
+ gmCurrent.gm_mgApply.mg_pActivatedFunction = &ApplyVideoOptions;
+}
+
+// ------------------------ CAudioOptionsMenu implementation
+extern void RefreshSoundFormat(void)
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ switch (_pSound->GetFormat())
+ {
+ case CSoundLibrary::SF_NONE: {gmCurrent.gm_mgFrequencyTrigger.mg_iSelected = 0; break; }
+ case CSoundLibrary::SF_11025_16: {gmCurrent.gm_mgFrequencyTrigger.mg_iSelected = 1; break; }
+ case CSoundLibrary::SF_22050_16: {gmCurrent.gm_mgFrequencyTrigger.mg_iSelected = 2; break; }
+ case CSoundLibrary::SF_44100_16: {gmCurrent.gm_mgFrequencyTrigger.mg_iSelected = 3; break; }
+ default: gmCurrent.gm_mgFrequencyTrigger.mg_iSelected = 0;
+ }
+
+ gmCurrent.gm_mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1);
+ gmCurrent.gm_mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L);
+
+ gmCurrent.gm_mgWaveVolume.mg_iMinPos = 0;
+ gmCurrent.gm_mgWaveVolume.mg_iMaxPos = VOLUME_STEPS;
+ gmCurrent.gm_mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS + 0.5f);
+ gmCurrent.gm_mgWaveVolume.ApplyCurrentPosition();
+
+ gmCurrent.gm_mgMPEGVolume.mg_iMinPos = 0;
+ gmCurrent.gm_mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS;
+ gmCurrent.gm_mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS + 0.5f);
+ gmCurrent.gm_mgMPEGVolume.ApplyCurrentPosition();
+
+ gmCurrent.gm_mgAudioAutoTrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgAudioAPITrigger.ApplyCurrentSelection();
+ gmCurrent.gm_mgFrequencyTrigger.ApplyCurrentSelection();
+}
+
+static void ApplyAudioOptions(void)
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ sam_bAutoAdjustAudio = gmCurrent.gm_mgAudioAutoTrigger.mg_iSelected;
+ if (sam_bAutoAdjustAudio) {
+ _pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\"");
+ } else {
+ _pShell->SetINDEX("snd_iInterface", gmCurrent.gm_mgAudioAPITrigger.mg_iSelected);
+
+ switch (gmCurrent.gm_mgFrequencyTrigger.mg_iSelected)
+ {
+ case 0: {_pSound->SetFormat(CSoundLibrary::SF_NONE); break; }
+ case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16); break; }
+ case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16); break; }
+ case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16); break; }
+ default: _pSound->SetFormat(CSoundLibrary::SF_NONE);
+ }
+ }
+
+ RefreshSoundFormat();
+ snd_iFormat = _pSound->GetFormat();
+}
+
+static void OnWaveVolumeChange(INDEX iCurPos)
+{
+ _pShell->SetFLOAT("snd_fSoundVolume", iCurPos / FLOAT(VOLUME_STEPS));
+}
+
+static void WaveSliderChange(void)
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ gmCurrent.gm_mgWaveVolume.mg_iCurPos -= 5;
+ gmCurrent.gm_mgWaveVolume.ApplyCurrentPosition();
+}
+
+static void FrequencyTriggerChange(INDEX iDummy)
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ sam_bAutoAdjustAudio = 0;
+ gmCurrent.gm_mgAudioAutoTrigger.mg_iSelected = 0;
+ gmCurrent.gm_mgAudioAutoTrigger.ApplyCurrentSelection();
+}
+
+static void MPEGSliderChange(void)
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ gmCurrent.gm_mgMPEGVolume.mg_iCurPos -= 5;
+ gmCurrent.gm_mgMPEGVolume.ApplyCurrentPosition();
+}
+
+static void OnMPEGVolumeChange(INDEX iCurPos)
+{
+ _pShell->SetFLOAT("snd_fMusicVolume", iCurPos / FLOAT(VOLUME_STEPS));
+}
+
+void InitActionsForAudioOptionsMenu()
+{
+ CAudioOptionsMenu &gmCurrent = _pGUIM->gmAudioOptionsMenu;
+
+ gmCurrent.gm_mgFrequencyTrigger.mg_pOnTriggerChange = FrequencyTriggerChange;
+ gmCurrent.gm_mgWaveVolume.mg_pOnSliderChange = &OnWaveVolumeChange;
+ gmCurrent.gm_mgWaveVolume.mg_pActivatedFunction = WaveSliderChange;
+ gmCurrent.gm_mgMPEGVolume.mg_pOnSliderChange = &OnMPEGVolumeChange;
+ gmCurrent.gm_mgMPEGVolume.mg_pActivatedFunction = MPEGSliderChange;
+ gmCurrent.gm_mgApply.mg_pActivatedFunction = &ApplyAudioOptions;
+}
+
+// ------------------------ CVarMenu implementation
+static void VarApply(void)
+{
+ CVarMenu &gmCurrent = _pGUIM->gmVarMenu;
+
+ FlushVarSettings(TRUE);
+ gmCurrent.EndMenu();
+ gmCurrent.StartMenu();
+}
+
+void InitActionsForVarMenu() {
+ _pGUIM->gmVarMenu.gm_mgApply.mg_pActivatedFunction = &VarApply;
+}
+
+// ------------------------ CServersMenu implementation
+
+extern CMGButton mgServerColumn[7];
+extern CMGEdit mgServerFilter[7];
+
+static void SortByColumn(int i)
+{
+ CServersMenu &gmCurrent = _pGUIM->gmServersMenu;
+
+ if (gmCurrent.gm_mgList.mg_iSort == i) {
+ gmCurrent.gm_mgList.mg_bSortDown = !gmCurrent.gm_mgList.mg_bSortDown;
+ } else {
+ gmCurrent.gm_mgList.mg_bSortDown = FALSE;
+ }
+ gmCurrent.gm_mgList.mg_iSort = i;
+}
+
+static void SortByServer(void) { SortByColumn(0); }
+static void SortByMap(void) { SortByColumn(1); }
+static void SortByPing(void) { SortByColumn(2); }
+static void SortByPlayers(void){ SortByColumn(3); }
+static void SortByGame(void) { SortByColumn(4); }
+static void SortByMod(void) { SortByColumn(5); }
+static void SortByVer(void) { SortByColumn(6); }
+
+extern void RefreshServerList(void)
+{
+ _pNetwork->EnumSessions(_pGUIM->gmServersMenu.m_bInternet);
+}
+
+void RefreshServerListManually(void)
+{
+ ChangeToMenu(&_pGUIM->gmServersMenu); // this refreshes the list and sets focuses
+}
+
+void InitActionsForServersMenu() {
+ _pGUIM->gmServersMenu.gm_mgRefresh.mg_pActivatedFunction = &RefreshServerList;
+
+ mgServerColumn[0].mg_pActivatedFunction = SortByServer;
+ mgServerColumn[1].mg_pActivatedFunction = SortByMap;
+ mgServerColumn[2].mg_pActivatedFunction = SortByPing;
+ mgServerColumn[3].mg_pActivatedFunction = SortByPlayers;
+ mgServerColumn[4].mg_pActivatedFunction = SortByGame;
+ mgServerColumn[5].mg_pActivatedFunction = SortByMod;
+ mgServerColumn[6].mg_pActivatedFunction = SortByVer;
+}
+
+// ------------------------ CNetworkMenu implementation
+void InitActionsForNetworkMenu()
+{
+ CNetworkMenu &gmCurrent = _pGUIM->gmNetworkMenu;
+
+ gmCurrent.gm_mgJoin.mg_pActivatedFunction = &StartNetworkJoinMenu;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartNetworkStartMenu;
+ gmCurrent.gm_mgQuickLoad.mg_pActivatedFunction = &StartNetworkQuickLoadMenu;
+ gmCurrent.gm_mgLoad.mg_pActivatedFunction = &StartNetworkLoadMenu;
+}
+
+// ------------------------ CNetworkJoinMenu implementation
+void InitActionsForNetworkJoinMenu()
+{
+ CNetworkJoinMenu &gmCurrent = _pGUIM->gmNetworkJoinMenu;
+
+ gmCurrent.gm_mgLAN.mg_pActivatedFunction = &StartSelectServerLAN;
+ gmCurrent.gm_mgNET.mg_pActivatedFunction = &StartSelectServerNET;
+ gmCurrent.gm_mgOpen.mg_pActivatedFunction = &StartNetworkOpenMenu;
+}
+
+// ------------------------ CNetworkStartMenu implementation
+extern void UpdateNetworkLevel(INDEX iDummy)
+{
+ ValidateLevelForFlags(_pGame->gam_strCustomLevel,
+ GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected));
+ _pGUIM->gmNetworkStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
+}
+
+void InitActionsForNetworkStartMenu()
+{
+ CNetworkStartMenu &gmCurrent = _pGUIM->gmNetworkStartMenu;
+
+ gmCurrent.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork;
+ gmCurrent.gm_mgGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork;
+}
+
+// ------------------------ CSelectPlayersMenu implementation
+static INDEX FindUnusedPlayer(void)
+{
+ INDEX *ai = _pGame->gm_aiMenuLocalPlayers;
+ INDEX iPlayer = 0;
+ for (; iPlayer<8; iPlayer++) {
+ BOOL bUsed = FALSE;
+ for (INDEX iLocal = 0; iLocal<4; iLocal++) {
+ if (ai[iLocal] == iPlayer) {
+ bUsed = TRUE;
+ break;
+ }
+ }
+ if (!bUsed) {
+ return iPlayer;
+ }
+ }
+ ASSERT(FALSE);
+ return iPlayer;
+}
+
+extern void SelectPlayersFillMenu(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ INDEX *ai = _pGame->gm_aiMenuLocalPlayers;
+
+ gmCurrent.gm_mgPlayer0Change.mg_iLocalPlayer = 0;
+ gmCurrent.gm_mgPlayer1Change.mg_iLocalPlayer = 1;
+ gmCurrent.gm_mgPlayer2Change.mg_iLocalPlayer = 2;
+ gmCurrent.gm_mgPlayer3Change.mg_iLocalPlayer = 3;
+
+ if (gmCurrent.gm_bAllowDedicated && _pGame->gm_MenuSplitScreenCfg == CGame::SSC_DEDICATED) {
+ gmCurrent.gm_mgDedicated.mg_iSelected = 1;
+ } else {
+ gmCurrent.gm_mgDedicated.mg_iSelected = 0;
+ }
+
+ gmCurrent.gm_mgDedicated.ApplyCurrentSelection();
+
+ if (gmCurrent.gm_bAllowObserving && _pGame->gm_MenuSplitScreenCfg == CGame::SSC_OBSERVER) {
+ gmCurrent.gm_mgObserver.mg_iSelected = 1;
+ } else {
+ gmCurrent.gm_mgObserver.mg_iSelected = 0;
+ }
+
+ gmCurrent.gm_mgObserver.ApplyCurrentSelection();
+
+ if (_pGame->gm_MenuSplitScreenCfg >= CGame::SSC_PLAY1) {
+ gmCurrent.gm_mgSplitScreenCfg.mg_iSelected = _pGame->gm_MenuSplitScreenCfg;
+ gmCurrent.gm_mgSplitScreenCfg.ApplyCurrentSelection();
+ }
+
+ BOOL bHasDedicated = gmCurrent.gm_bAllowDedicated;
+ BOOL bHasObserver = gmCurrent.gm_bAllowObserving;
+ BOOL bHasPlayers = TRUE;
+
+ if (bHasDedicated && gmCurrent.gm_mgDedicated.mg_iSelected) {
+ bHasObserver = FALSE;
+ bHasPlayers = FALSE;
+ }
+
+ if (bHasObserver && gmCurrent.gm_mgObserver.mg_iSelected) {
+ bHasPlayers = FALSE;
+ }
+
+ CMenuGadget *apmg[8];
+ memset(apmg, 0, sizeof(apmg));
+ INDEX i = 0;
+
+ if (bHasDedicated) {
+ gmCurrent.gm_mgDedicated.Appear();
+ apmg[i++] = &gmCurrent.gm_mgDedicated;
+ } else {
+ gmCurrent.gm_mgDedicated.Disappear();
+ }
+
+ if (bHasObserver) {
+ gmCurrent.gm_mgObserver.Appear();
+ apmg[i++] = &gmCurrent.gm_mgObserver;
+ } else {
+ gmCurrent.gm_mgObserver.Disappear();
+ }
+
+ for (INDEX iLocal = 0; iLocal<4; iLocal++) {
+ if (ai[iLocal]<0 || ai[iLocal]>7) {
+ ai[iLocal] = 0;
+ }
+ for (INDEX iCopy = 0; iCopy= 1) {
+ gmCurrent.gm_mgPlayer1Change.Appear();
+ apmg[i++] = &gmCurrent.gm_mgPlayer1Change;
+ }
+ if (gmCurrent.gm_mgSplitScreenCfg.mg_iSelected >= 2) {
+ gmCurrent.gm_mgPlayer2Change.Appear();
+ apmg[i++] = &gmCurrent.gm_mgPlayer2Change;
+ }
+ if (gmCurrent.gm_mgSplitScreenCfg.mg_iSelected >= 3) {
+ gmCurrent.gm_mgPlayer3Change.Appear();
+ apmg[i++] = &gmCurrent.gm_mgPlayer3Change;
+ }
+ } else {
+ gmCurrent.gm_mgSplitScreenCfg.Disappear();
+ }
+ apmg[i++] = &gmCurrent.gm_mgStart;
+
+ // relink
+ for (INDEX img = 0; img<8; img++) {
+ if (apmg[img] == NULL) {
+ continue;
+ }
+ INDEX imgPred = (img + 8 - 1) % 8;
+ for (; imgPred != img; imgPred = (imgPred + 8 - 1) % 8) {
+ if (apmg[imgPred] != NULL) {
+ break;
+ }
+ }
+ INDEX imgSucc = (img + 1) % 8;
+ for (; imgSucc != img; imgSucc = (imgSucc + 1) % 8) {
+ if (apmg[imgSucc] != NULL) {
+ break;
+ }
+ }
+ apmg[img]->mg_pmgUp = apmg[imgPred];
+ apmg[img]->mg_pmgDown = apmg[imgSucc];
+ }
+
+ gmCurrent.gm_mgPlayer0Change.SetPlayerText();
+ gmCurrent.gm_mgPlayer1Change.SetPlayerText();
+ gmCurrent.gm_mgPlayer2Change.SetPlayerText();
+ gmCurrent.gm_mgPlayer3Change.SetPlayerText();
+
+ if (bHasPlayers && gmCurrent.gm_mgSplitScreenCfg.mg_iSelected >= 1) {
+ gmCurrent.gm_mgNotes.mg_strText = TRANS("Make sure you set different controls for each player!");
+ } else {
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ }
+}
+
+extern void SelectPlayersApplyMenu(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ if (gmCurrent.gm_bAllowDedicated && gmCurrent.gm_mgDedicated.mg_iSelected) {
+ _pGame->gm_MenuSplitScreenCfg = CGame::SSC_DEDICATED;
+ return;
+ }
+
+ if (gmCurrent.gm_bAllowObserving && gmCurrent.gm_mgObserver.mg_iSelected) {
+ _pGame->gm_MenuSplitScreenCfg = CGame::SSC_OBSERVER;
+ return;
+ }
+
+ _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) gmCurrent.gm_mgSplitScreenCfg.mg_iSelected;
+}
+
+static void UpdateSelectPlayers(INDEX i)
+{
+ SelectPlayersApplyMenu();
+ SelectPlayersFillMenu();
+}
+
+void InitActionsForSelectPlayersMenu()
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_mgDedicated.mg_pOnTriggerChange = UpdateSelectPlayers;
+ gmCurrent.gm_mgObserver.mg_pOnTriggerChange = UpdateSelectPlayers;
+ gmCurrent.gm_mgSplitScreenCfg.mg_pOnTriggerChange = UpdateSelectPlayers;
+}
+
+// ------------------------ CNetworkOpenMenu implementation
+void InitActionsForNetworkOpenMenu()
+{
+ _pGUIM->gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen;
+}
+
+// ------------------------ CSplitScreenMenu implementation
+void InitActionsForSplitScreenMenu()
+{
+ CSplitScreenMenu &gmCurrent = _pGUIM->gmSplitScreenMenu;
+
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartSplitStartMenu;
+ gmCurrent.gm_mgQuickLoad.mg_pActivatedFunction = &StartSplitScreenQuickLoadMenu;
+ gmCurrent.gm_mgLoad.mg_pActivatedFunction = &StartSplitScreenLoadMenu;
+}
+
+// ------------------------ CSplitStartMenu implementation
+void InitActionsForSplitStartMenu()
+{
+ CSplitStartMenu &gmCurrent = _pGUIM->gmSplitStartMenu;
+
+ gmCurrent.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromSplit;
+ gmCurrent.gm_mgOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
+}
+
+extern void UpdateSplitLevel(INDEX iDummy)
+{
+ CSplitStartMenu &gmCurrent = _pGUIM->gmSplitStartMenu;
+
+ ValidateLevelForFlags(_pGame->gam_strCustomLevel,
+ GetSpawnFlagsForGameType(gmCurrent.gm_mgGameType.mg_iSelected));
+ gmCurrent.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuActions.h b/Sources/SeriousSam/GUI/Menus/MenuActions.h
new file mode 100644
index 0000000..954b054
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuActions.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_ACTIONS_H
+#define SE_INCL_MENU_ACTIONS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+void InitActionsForAudioOptionsMenu();
+void InitActionsForConfirmMenu();
+void InitActionsForControlsMenu();
+void InitActionsForCustomizeAxisMenu();
+void InitActionsForMainMenu();
+void InitActionsForInGameMenu();
+void InitActionsForNetworkMenu();
+void InitActionsForNetworkJoinMenu();
+void InitActionsForNetworkOpenMenu();
+void InitActionsForNetworkStartMenu();
+void InitActionsForOptionsMenu();
+void InitActionsForPlayerProfileMenu();
+void InitActionsForSelectPlayersMenu();
+void InitActionsForServersMenu();
+void InitActionsForSinglePlayerMenu();
+void InitActionsForSinglePlayerNewMenu();
+void InitActionsForSplitScreenMenu();
+void InitActionsForSplitStartMenu();
+void InitActionsForVideoOptionsMenu();
+void InitActionsForVarMenu();
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/CDCheck.h b/Sources/SeriousSam/GUI/Menus/MenuManager.cpp
similarity index 81%
rename from Sources/SeriousSam/CDCheck.h
rename to Sources/SeriousSam/GUI/Menus/MenuManager.cpp
index eab3510..4e2e81e 100644
--- a/Sources/SeriousSam/CDCheck.h
+++ b/Sources/SeriousSam/GUI/Menus/MenuManager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2012 Croteam Ltd.
+/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
@@ -13,4 +13,9 @@ You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#define CD_CHECK 1
+#include "StdH.h"
+#include
+
+#include "MenuManager.h"
+
+extern CMenuManager* _pGUIM = NULL;
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuManager.h b/Sources/SeriousSam/GUI/Menus/MenuManager.h
new file mode 100644
index 0000000..33820ac
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuManager.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENUMANAGER_H
+#define SE_INCL_MENUMANAGER_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "MAudioOptions.h"
+#include "MConfirm.h"
+#include "MControls.h"
+#include "MCustomizeAxis.h"
+#include "MCustomizeKeyboard.h"
+#include "MCredits.h"
+#include "MDisabled.h"
+#include "MHighScore.h"
+#include "MInGame.h"
+#include "MLevels.h"
+#include "MMain.h"
+#include "MNetwork.h"
+#include "MNetworkJoin.h"
+#include "MNetworkOpen.h"
+#include "MNetworkStart.h"
+#include "MOptions.h"
+#include "MRenderingOptions.h"
+#include "MServers.h"
+#include "MSinglePlayer.h"
+#include "MSinglePlayerNew.h"
+#include "MSplitScreen.h"
+#include "MSplitStart.h"
+#include "MVar.h"
+#include "MVideoOptions.h"
+
+
+class CMenuManager {
+public:
+ CConfirmMenu gmConfirmMenu;
+ CMainMenu gmMainMenu;
+ CInGameMenu gmInGameMenu;
+ CSinglePlayerMenu gmSinglePlayerMenu;
+ CSinglePlayerNewMenu gmSinglePlayerNewMenu;
+ CDisabledMenu gmDisabledFunction;
+ CLevelsMenu gmLevelsMenu;
+ CVarMenu gmVarMenu;
+ CPlayerProfileMenu gmPlayerProfile;
+ CControlsMenu gmControls;
+ CLoadSaveMenu gmLoadSaveMenu;
+ CHighScoreMenu gmHighScoreMenu;
+ CCustomizeKeyboardMenu gmCustomizeKeyboardMenu;
+ CServersMenu gmServersMenu;
+ CCustomizeAxisMenu gmCustomizeAxisMenu;
+ COptionsMenu gmOptionsMenu;
+ CVideoOptionsMenu gmVideoOptionsMenu;
+ CAudioOptionsMenu gmAudioOptionsMenu;
+ CNetworkMenu gmNetworkMenu;
+ CNetworkJoinMenu gmNetworkJoinMenu;
+ CNetworkStartMenu gmNetworkStartMenu;
+ CNetworkOpenMenu gmNetworkOpenMenu;
+ CSplitScreenMenu gmSplitScreenMenu;
+ CSplitStartMenu gmSplitStartMenu;
+ CSelectPlayersMenu gmSelectPlayersMenu;
+};
+
+extern CMenuManager *_pGUIM; // TODO: Make singleton!
+
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/MenuPrinting.cpp b/Sources/SeriousSam/GUI/Menus/MenuPrinting.cpp
similarity index 99%
rename from Sources/SeriousSam/MenuPrinting.cpp
rename to Sources/SeriousSam/GUI/Menus/MenuPrinting.cpp
index bff301e..393bf2e 100644
--- a/Sources/SeriousSam/MenuPrinting.cpp
+++ b/Sources/SeriousSam/GUI/Menus/MenuPrinting.cpp
@@ -16,6 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "StdH.h"
#include "MenuPrinting.h"
+#include "ArrowDir.h"
static const FLOAT _fBigStartJ = 0.25f;
static const FLOAT _fBigSizeJ = 0.066f;
@@ -34,18 +35,21 @@ FLOATaabbox2D BoxTitle(void)
FLOAT2D(0, _fBigSizeJ),
FLOAT2D(1, _fBigSizeJ));
}
+
FLOATaabbox2D BoxNoUp(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI), _fNoUpStartJ),
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI)+_fNoSizeI, _fNoUpStartJ+_fNoSizeJ));
}
+
FLOATaabbox2D BoxNoDown(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI), _fNoDownStartJ),
FLOAT2D(_fNoStartI+fRow*(_fNoSizeI+_fNoSpaceI)+_fNoSizeI, _fNoDownStartJ+_fNoSizeJ));
}
+
FLOATaabbox2D BoxBigRow(FLOAT fRow)
{
return FLOATaabbox2D(
@@ -58,6 +62,7 @@ FLOATaabbox2D BoxBigLeft(FLOAT fRow)
FLOAT2D(0.1f, _fBigStartJ+fRow*_fBigSizeJ),
FLOAT2D(0.45f, _fBigStartJ+(fRow+1)*_fBigSizeJ));
}
+
FLOATaabbox2D BoxBigRight(FLOAT fRow)
{
return FLOATaabbox2D(
@@ -78,48 +83,56 @@ FLOATaabbox2D BoxVersion(void)
FLOAT2D(0.05f, _fBigStartJ+-5.5f*_fMediumSizeJ),
FLOAT2D(0.97f, _fBigStartJ+(-5.5f+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxMediumRow(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxKeyRow(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.15f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.85f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxMediumLeft(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.45f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxPlayerSwitch(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.05f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.65f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxMediumMiddle(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxPlayerEdit(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(_fNoStartI, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.65f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxMediumRight(FLOAT fRow)
{
return FLOATaabbox2D(
FLOAT2D(0.55f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.95f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxPopup(void)
{
return FLOATaabbox2D(FLOAT2D(0.2f, 0.4f), FLOAT2D(0.8f, 0.6f));
@@ -131,30 +144,35 @@ FLOATaabbox2D BoxPopupLabel(void)
FLOAT2D(0.22f, 0.43f),
FLOAT2D(0.78f, 0.49f));
}
+
FLOATaabbox2D BoxPopupYesLarge(void)
{
return FLOATaabbox2D(
FLOAT2D(0.30f, 0.51f),
FLOAT2D(0.48f, 0.57f));
}
+
FLOATaabbox2D BoxPopupNoLarge(void)
{
return FLOATaabbox2D(
FLOAT2D(0.52f, 0.51f),
FLOAT2D(0.70f, 0.57f));
}
+
FLOATaabbox2D BoxPopupYesSmall(void)
{
return FLOATaabbox2D(
FLOAT2D(0.30f, 0.54f),
FLOAT2D(0.48f, 0.59f));
}
+
FLOATaabbox2D BoxPopupNoSmall(void)
{
return FLOATaabbox2D(
FLOAT2D(0.52f, 0.54f),
FLOAT2D(0.70f, 0.59f));
}
+
FLOATaabbox2D BoxChangePlayer(INDEX iTable, INDEX iButton)
{
return FLOATaabbox2D(
@@ -217,6 +235,7 @@ FLOATaabbox2D BoxLeftColumn(FLOAT fRow)
FLOAT2D(0.02f, _fBigStartJ+fRow*_fMediumSizeJ),
FLOAT2D(0.15f, _fBigStartJ+(fRow+1)*_fMediumSizeJ));
}
+
FLOATaabbox2D BoxPlayerModel(void)
{
extern INDEX sam_bWideScreen;
@@ -226,10 +245,12 @@ FLOATaabbox2D BoxPlayerModel(void)
return FLOATaabbox2D(FLOAT2D(0.68f, 0.235f), FLOAT2D(0.68f+(0.965f-0.68f)*9.0f/12.0f, 0.78f));
}
}
+
FLOATaabbox2D BoxPlayerModelName(void)
{
return FLOATaabbox2D(FLOAT2D(0.68f, 0.78f), FLOAT2D(0.965f, 0.82f));
}
+
PIXaabbox2D FloatBoxToPixBox(const CDrawPort *pdp, const FLOATaabbox2D &boxF)
{
PIX pixW = pdp->GetWidth();
@@ -255,6 +276,7 @@ void SetFontTitle(CDrawPort *pdp)
pdp->SetTextScaling( 1.25f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(1.0f);
}
+
extern CFontData _fdBig;
void SetFontBig(CDrawPort *pdp)
{
@@ -262,6 +284,7 @@ void SetFontBig(CDrawPort *pdp)
pdp->SetTextScaling( 1.0f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(1.0f);
}
+
extern CFontData _fdMedium;
void SetFontMedium(CDrawPort *pdp)
{
@@ -269,6 +292,7 @@ void SetFontMedium(CDrawPort *pdp)
pdp->SetTextScaling( 1.0f * pdp->GetWidth() /640 *pdp->dp_fWideAdjustment);
pdp->SetTextAspect(0.75f);
}
+
void SetFontSmall(CDrawPort *pdp)
{
pdp->SetFont( _pfdConsoleFont);
diff --git a/Sources/SeriousSam/MenuPrinting.h b/Sources/SeriousSam/GUI/Menus/MenuPrinting.h
similarity index 100%
rename from Sources/SeriousSam/MenuPrinting.h
rename to Sources/SeriousSam/GUI/Menus/MenuPrinting.h
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp b/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp
new file mode 100644
index 0000000..35921d9
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp
@@ -0,0 +1,860 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+/* This file contains starter fuctions for all menus. */
+
+#include "StdH.h"
+#include
+
+#include "MenuManager.h"
+#include "MenuStarters.h"
+#include "MenuStartersAF.h"
+#include "MenuStuff.h"
+#include "LevelInfo.h"
+
+extern void(*_pAfterLevelChosen)(void);
+extern BOOL _bPlayerMenuFromSinglePlayer;
+
+extern CTString _strLastPlayerAppearance;
+extern CTString sam_strNetworkSettings;
+
+extern CTFileName _fnmModSelected;
+extern CTString _strModURLSelected;
+extern CTString _strModServerSelected;
+
+
+void StartVideoOptionsMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmVideoOptionsMenu);
+}
+
+void StartAudioOptionsMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmAudioOptionsMenu);
+}
+
+void StartSinglePlayerMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmSinglePlayerMenu);
+}
+
+void StartNetworkMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmNetworkMenu);
+}
+
+void StartNetworkJoinMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmNetworkJoinMenu);
+}
+
+void StartNetworkStartMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmNetworkStartMenu);
+}
+
+void StartNetworkOpenMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmNetworkOpenMenu);
+}
+
+void StartSplitScreenMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmSplitScreenMenu);
+}
+
+void StartSplitStartMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmSplitStartMenu);
+}
+
+void StartSinglePlayerNewMenuCustom(void)
+{
+ _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmLevelsMenu;
+ ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu);
+}
+
+static void SetQuickLoadNotes(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ if (_pShell->GetINDEX("gam_iQuickSaveSlots") <= 8) {
+ gmCurrent.gm_mgNotes.mg_strText = TRANS(
+ "In-game QuickSave shortcuts:\n"
+ "F6 - save a new QuickSave\n"
+ "F9 - load the last QuickSave\n");
+ } else {
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ }
+}
+
+extern CTString sam_strFirstLevel;
+
+void StartSinglePlayerNewMenu(void)
+{
+ CVarMenu &gmCurrent = _pGUIM->gmVarMenu;
+
+ _pGame->gam_strCustomLevel = sam_strFirstLevel;
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+// 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);
+}
+
+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 StartGameOptionsFromNetwork(void)
+{
+ StartVarGameOptions();
+ _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
+}
+
+void StartGameOptionsFromSplitScreen(void)
+{
+ StartVarGameOptions();
+ _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu;
+}
+
+// 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 StartCustomizeKeyboardMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmCustomizeKeyboardMenu);
+}
+
+void StartCustomizeAxisMenu(void)
+{
+ ChangeToMenu(&_pGUIM->gmCustomizeAxisMenu);
+}
+
+void StartOptionsMenu(void)
+{
+ _pGUIM->gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&_pGUIM->gmOptionsMenu);
+}
+
+void StartCurrentLoadMenu()
+{
+ if (_gmRunningGameMode == GM_NETWORK) {
+ void StartNetworkLoadMenu(void);
+ StartNetworkLoadMenu();
+ } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) {
+ void StartSplitScreenLoadMenu(void);
+ StartSplitScreenLoadMenu();
+ } else {
+ void StartSinglePlayerLoadMenu(void);
+ StartSinglePlayerLoadMenu();
+ }
+}
+
+void StartCurrentSaveMenu()
+{
+ if (_gmRunningGameMode == GM_NETWORK) {
+ void StartNetworkSaveMenu(void);
+ StartNetworkSaveMenu();
+ } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) {
+ void StartSplitScreenSaveMenu(void);
+ StartSplitScreenSaveMenu();
+ } else {
+ void StartSinglePlayerSaveMenu(void);
+ StartSinglePlayerSaveMenu();
+ }
+}
+
+void StartCurrentQuickLoadMenu()
+{
+ if (_gmRunningGameMode == GM_NETWORK) {
+ void StartNetworkQuickLoadMenu(void);
+ StartNetworkQuickLoadMenu();
+ } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) {
+ void StartSplitScreenQuickLoadMenu(void);
+ StartSplitScreenQuickLoadMenu();
+ } else {
+ void StartSinglePlayerQuickLoadMenu(void);
+ StartSinglePlayerQuickLoadMenu();
+ }
+}
+
+void StartChangePlayerMenuFromOptions(void)
+{
+ _bPlayerMenuFromSinglePlayer = FALSE;
+ _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer;
+ _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ ChangeToMenu(&_pGUIM->gmPlayerProfile);
+}
+
+void StartChangePlayerMenuFromSinglePlayer(void)
+{
+ _iLocalPlayer = -1;
+ _bPlayerMenuFromSinglePlayer = TRUE;
+ _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer;
+ _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+ ChangeToMenu(&_pGUIM->gmPlayerProfile);
+}
+
+void StartControlsMenuFromPlayer(void)
+{
+ _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile;
+ ChangeToMenu(&_pGUIM->gmControls);
+}
+
+void StartControlsMenuFromOptions(void)
+{
+ _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ ChangeToMenu(&_pGUIM->gmControls);
+}
+
+void StartHighScoreMenu(void)
+{
+ _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&_pGUIM->gmHighScoreMenu);
+}
+
+void StartSplitScreenGame(void)
+{
+ // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
+ _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
+ _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
+ _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
+ _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
+
+ CTFileName fnWorld = _pGame->gam_strCustomLevel;
+
+ _pGame->gm_strNetworkProvider = "Local";
+ CUniversalSessionProperties sp;
+ _pGame->SetMultiPlayerSession(sp);
+ if (_pGame->NewGame(fnWorld.FileName(), fnWorld, sp))
+ {
+ StopMenus();
+ _gmRunningGameMode = GM_SPLIT_SCREEN;
+ } else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+void StartNetworkGame(void)
+{
+ // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
+ _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
+ _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
+ _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
+ _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
+
+ CTFileName fnWorld = _pGame->gam_strCustomLevel;
+
+ _pGame->gm_strNetworkProvider = "TCP/IP Server";
+ CUniversalSessionProperties sp;
+ _pGame->SetMultiPlayerSession(sp);
+ if (_pGame->NewGame(_pGame->gam_strSessionName, fnWorld, sp))
+ {
+ StopMenus();
+ _gmRunningGameMode = GM_NETWORK;
+ // if starting a dedicated server
+ if (_pGame->gm_MenuSplitScreenCfg == CGame::SSC_DEDICATED) {
+ // pull down the console
+ extern INDEX sam_bToggleConsole;
+ sam_bToggleConsole = TRUE;
+ }
+ } else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+void JoinNetworkGame(void)
+{
+ // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
+ _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
+ _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
+ _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
+ _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
+
+ _pGame->gm_strNetworkProvider = "TCP/IP Client";
+ if (_pGame->JoinGame(CNetworkSession(_pGame->gam_strJoinAddress)))
+ {
+ StopMenus();
+ _gmRunningGameMode = GM_NETWORK;
+ } else {
+ if (_pNetwork->ga_strRequiredMod != "") {
+ extern CTFileName _fnmModToLoad;
+ extern CTString _strModServerJoin;
+ char strModName[256] = { 0 };
+ char strModURL[256] = { 0 };
+ _pNetwork->ga_strRequiredMod.ScanF("%250[^\\]\\%s", &strModName, &strModURL);
+ _fnmModSelected = CTString(strModName);
+ _strModURLSelected = strModURL;
+ if (_strModURLSelected = "") {
+ _strModURLSelected = "http://www.croteam.com/mods/Old";
+ }
+ _strModServerSelected.PrintF("%s:%s", _pGame->gam_strJoinAddress, _pShell->GetValue("net_iPort"));
+ extern void ModConnectConfirm(void);
+ ModConnectConfirm();
+ }
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+// -------- Servers Menu Functions
+void StartSelectServerLAN(void)
+{
+ CServersMenu &gmCurrent = _pGUIM->gmServersMenu;
+
+ gmCurrent.m_bInternet = FALSE;
+ ChangeToMenu(&gmCurrent);
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu;
+}
+
+void StartSelectServerNET(void)
+{
+ CServersMenu &gmCurrent = _pGUIM->gmServersMenu;
+
+ gmCurrent.m_bInternet = TRUE;
+ ChangeToMenu(&gmCurrent);
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu;
+}
+
+// -------- Levels Menu Functions
+void StartSelectLevelFromSingle(void)
+{
+ CLevelsMenu &gmCurrent = _pGUIM->gmLevelsMenu;
+
+ FilterLevels(GetSpawnFlagsForGameType(-1));
+ _pAfterLevelChosen = StartSinglePlayerNewMenuCustom;
+ ChangeToMenu(&gmCurrent);
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
+}
+
+void StartSelectLevelFromSplit(void)
+{
+ CLevelsMenu &gmCurrent = _pGUIM->gmLevelsMenu;
+
+ FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmSplitStartMenu.gm_mgGameType.mg_iSelected));
+ void StartSplitStartMenu(void);
+ _pAfterLevelChosen = StartSplitStartMenu;
+ ChangeToMenu(&gmCurrent);
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu;
+}
+
+void StartSelectLevelFromNetwork(void)
+{
+ CLevelsMenu &gmCurrent = _pGUIM->gmLevelsMenu;
+
+ FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected));
+ void StartNetworkStartMenu(void);
+ _pAfterLevelChosen = StartNetworkStartMenu;
+ ChangeToMenu(&gmCurrent);
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
+}
+
+// -------- Players Selection Menu Functions
+void StartSelectPlayersMenuFromSplit(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = FALSE;
+ gmCurrent.gm_bAllowObserving = FALSE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSelectPlayersMenuFromNetwork(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = TRUE;
+ gmCurrent.gm_bAllowObserving = TRUE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSelectPlayersMenuFromNetworkLoad(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = FALSE;
+ gmCurrent.gm_bAllowObserving = TRUE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartNetworkLoadGame;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSelectPlayersMenuFromSplitScreenLoad(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = FALSE;
+ gmCurrent.gm_bAllowObserving = FALSE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGameLoad;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSelectPlayersMenuFromOpen(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = FALSE;
+ gmCurrent.gm_bAllowObserving = TRUE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
+ ChangeToMenu(&gmCurrent);
+
+ /*if (sam_strNetworkSettings=="")*/ {
+ void StartNetworkSettingsMenu(void);
+ StartNetworkSettingsMenu();
+ _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE;
+ _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
+ _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &gmCurrent;
+ }
+}
+
+void StartSelectPlayersMenuFromServers(void)
+{
+ CSelectPlayersMenu &gmCurrent = _pGUIM->gmSelectPlayersMenu;
+
+ gmCurrent.gm_bAllowDedicated = FALSE;
+ gmCurrent.gm_bAllowObserving = TRUE;
+ gmCurrent.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmServersMenu;
+ ChangeToMenu(&gmCurrent);
+
+ /*if (sam_strNetworkSettings=="")*/ {
+ void StartNetworkSettingsMenu(void);
+ StartNetworkSettingsMenu();
+ _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE;
+ _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu;
+ _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &gmCurrent;
+ }
+}
+
+// -------- Save/Load Menu Calling Functions
+void StartPlayerModelLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("CHOOSE MODEL");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Models\\Player\\");
+ gmCurrent.gm_fnmSelected = _strLastPlayerAppearance;
+ gmCurrent.gm_fnmExt = CTString(".amc");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadPlayerModel;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartControlsLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("LOAD CONTROLS");
+ gmCurrent.gm_bAllowThumbnails = FALSE;
+ gmCurrent.gm_iSortType = LSSORT_FILEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Controls\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".ctl");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadControls;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmControls;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartCustomLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS");
+ gmCurrent.gm_bAllowThumbnails = FALSE;
+ gmCurrent.gm_iSortType = LSSORT_NAMEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".cfg");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadCustom;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartAddonsLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("EXECUTE ADDON");
+ gmCurrent.gm_bAllowThumbnails = FALSE;
+ gmCurrent.gm_iSortType = LSSORT_NAMEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Scripts\\Addons\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".ini");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadAddon;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartModsLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("CHOOSE MOD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_NAMEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Mods\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".des");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadMod;
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartNetworkSettingsMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("CONNECTION SETTINGS");
+ gmCurrent.gm_bAllowThumbnails = FALSE;
+ gmCurrent.gm_iSortType = LSSORT_FILEUP;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = FALSE;
+ gmCurrent.gm_fnmDirectory = CTString("Scripts\\NetSettings\\");
+ gmCurrent.gm_fnmSelected = sam_strNetworkSettings;
+ gmCurrent.gm_fnmExt = CTString(".ini");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadNetSettings;
+
+ if (sam_strNetworkSettings == "") {
+ gmCurrent.gm_mgNotes.mg_strText = TRANS(
+ "Before joining a network game,\n"
+ "you have to adjust your connection parameters.\n"
+ "Choose one option from the list.\n"
+ "If you have problems with connection, you can adjust\n"
+ "these parameters again from the Options menu.\n"
+ );
+ } else {
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ }
+
+ gmCurrent.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+
+void StartSinglePlayerQuickLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_SINGLE_PLAYER;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("QUICK LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\Quick\\", _pGame->gm_iSinglePlayer);
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadSinglePlayer;
+ SetQuickLoadNotes();
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSinglePlayerLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_SINGLE_PLAYER;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer);
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadSinglePlayer;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSinglePlayerSaveMenu(void)
+{
+ if (_gmRunningGameMode != GM_SINGLE_PLAYER) return;
+
+ // if no live players
+ if (_pGame->GetPlayersCount()>0 && _pGame->GetLivePlayersCount() <= 0) {
+ // do nothing
+ return;
+ }
+
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_SINGLE_PLAYER;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("SAVE");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = TRUE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer);
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmBaseName = CTString("SaveGame");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSSaveAnyGame;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ gmCurrent.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartDemoLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_DEMO;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("PLAY DEMO");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("Demos\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".dem");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadDemo;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartDemoSaveMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ if (_gmRunningGameMode == GM_NONE) return;
+ _gmMenuGameMode = GM_DEMO;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("RECORD DEMO");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEUP;
+ gmCurrent.gm_bSave = TRUE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("Demos\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmBaseName = CTString("Demo");
+ gmCurrent.gm_fnmExt = CTString(".dem");
+ gmCurrent.gm_pAfterFileChosen = &LSSaveDemo;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ gmCurrent.gm_strSaveDes = _pGame->GetDefaultGameDescription(FALSE);
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartNetworkQuickLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_NETWORK;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("QUICK LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\Network\\Quick\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadNetwork;
+ SetQuickLoadNotes();
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartNetworkLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_NETWORK;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\Network\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadNetwork;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartNetworkSaveMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ if (_gmRunningGameMode != GM_NETWORK) return;
+ _gmMenuGameMode = GM_NETWORK;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("SAVE");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = TRUE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\Network\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmBaseName = CTString("SaveGame");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSSaveAnyGame;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ gmCurrent.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSplitScreenQuickLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_SPLIT_SCREEN;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("QUICK LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\Quick\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadSplitScreen;
+ SetQuickLoadNotes();
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSplitScreenLoadMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ _gmMenuGameMode = GM_SPLIT_SCREEN;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("LOAD");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = FALSE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSLoadSplitScreen;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+void StartSplitScreenSaveMenu(void)
+{
+ CLoadSaveMenu &gmCurrent = _pGUIM->gmLoadSaveMenu;
+
+ if (_gmRunningGameMode != GM_SPLIT_SCREEN) return;
+ _gmMenuGameMode = GM_SPLIT_SCREEN;
+
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("SAVE");
+ gmCurrent.gm_bAllowThumbnails = TRUE;
+ gmCurrent.gm_iSortType = LSSORT_FILEDN;
+ gmCurrent.gm_bSave = TRUE;
+ gmCurrent.gm_bManage = TRUE;
+ gmCurrent.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\");
+ gmCurrent.gm_fnmSelected = CTString("");
+ gmCurrent.gm_fnmBaseName = CTString("SaveGame");
+ gmCurrent.gm_fnmExt = CTString(".sav");
+ gmCurrent.gm_pAfterFileChosen = &LSSaveAnyGame;
+ gmCurrent.gm_mgNotes.mg_strText = "";
+ gmCurrent.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ ChangeToMenu(&gmCurrent);
+}
+
+// -------- Disabled Menu Calling Function
+void DisabledFunction(void)
+{
+ CDisabledMenu &gmCurrent = _pGUIM->gmDisabledFunction;
+
+ gmCurrent.gm_pgmParentMenu = pgmCurrentMenu;
+ gmCurrent.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!");
+ gmCurrent.gm_mgTitle.mg_strText = TRANS("DISABLED");
+ ChangeToMenu(&gmCurrent);
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStarters.h b/Sources/SeriousSam/GUI/Menus/MenuStarters.h
new file mode 100644
index 0000000..6139174
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStarters.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_STARTERS_H
+#define SE_INCL_MENU_STARTERS_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+void StartVideoOptionsMenu(void);
+void StartAudioOptionsMenu(void);
+void StartNetworkMenu(void);
+void StartNetworkJoinMenu(void);
+void StartNetworkStartMenu(void);
+void StartNetworkOpenMenu(void);
+void StartSplitScreenMenu(void);
+void StartSplitStartMenu(void);
+void StartSinglePlayerNewMenuCustom(void);
+void StartSinglePlayerNewMenu(void);
+void StartSinglePlayerQuickLoadMenu(void);
+void StartSinglePlayerLoadMenu(void);
+void StartSinglePlayerSaveMenu(void);
+void StartDemoLoadMenu(void);
+void StartDemoSaveMenu(void);
+void StartNetworkQuickLoadMenu(void);
+void StartNetworkLoadMenu(void);
+void StartNetworkSaveMenu(void);
+void StartSplitScreenQuickLoadMenu(void);
+void StartSplitScreenLoadMenu(void);
+void StartSplitScreenSaveMenu(void);
+void StartVarGameOptions(void);
+void StartSinglePlayerGameOptions(void);
+void StartGameOptionsFromNetwork(void);
+void StartGameOptionsFromSplitScreen(void);
+void StartRenderingOptionsMenu(void);
+void StartCustomizeKeyboardMenu(void);
+void StartCustomizeAxisMenu(void);
+void StartOptionsMenu(void);
+void StartCurrentLoadMenu();
+void StartCurrentSaveMenu();
+void StartCurrentQuickLoadMenu();
+void StartChangePlayerMenuFromOptions(void);
+void StartChangePlayerMenuFromSinglePlayer(void);
+void StartControlsMenuFromPlayer(void);
+void StartControlsMenuFromOptions(void);
+void StartSelectLevelFromSingle(void);
+void StartHighScoreMenu(void);
+void StartSelectPlayersMenuFromSplit(void);
+void StartSelectPlayersMenuFromNetwork(void);
+void StartSelectPlayersMenuFromOpen(void);
+void StartSelectPlayersMenuFromServers(void);
+void StartSelectServerLAN(void);
+void StartSelectServerNET(void);
+void StartSelectLevelFromSplit(void);
+void StartSelectLevelFromNetwork(void);
+void StartSelectPlayersMenuFromSplitScreen(void);
+void StartSelectPlayersMenuFromNetworkLoad(void);
+void StartSelectPlayersMenuFromSplitScreenLoad(void);
+void StartPlayerModelLoadMenu(void);
+void StartControlsLoadMenu(void);
+void StartCustomLoadMenu(void);
+void StartAddonsLoadMenu(void);
+void StartModsLoadMenu(void);
+void StartNetworkSettingsMenu(void);
+void StartSinglePlayerMenu(void);
+void DisabledFunction(void);
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStartersAF.cpp b/Sources/SeriousSam/GUI/Menus/MenuStartersAF.cpp
new file mode 100644
index 0000000..b4b96a0
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStartersAF.cpp
@@ -0,0 +1,230 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+/* This file contains additional functions called from starters. */
+
+#include "StdH.h"
+#include
+
+#include "MenuManager.h"
+#include "MenuStartersAF.h"
+#include "MenuStarters.h"
+#include "MenuStuff.h"
+
+static CTFileName _fnDemoToPlay;
+static CTFileName _fnGameToLoad;
+
+extern CTString sam_strNetworkSettings;
+
+extern CTFileName _fnmModSelected;
+extern CTString _strModURLSelected;
+extern CTString _strModServerSelected;
+
+
+BOOL LSLoadSinglePlayer(const CTFileName &fnm)
+{
+ _pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_iSinglePlayer;
+ _pGame->gm_aiStartLocalPlayers[1] = -1;
+ _pGame->gm_aiStartLocalPlayers[2] = -1;
+ _pGame->gm_aiStartLocalPlayers[3] = -1;
+ _pGame->gm_strNetworkProvider = "Local";
+ if (_pGame->LoadGame(fnm)) {
+ StopMenus();
+ _gmRunningGameMode = GM_SINGLE_PLAYER;
+ }
+ else {
+ _gmRunningGameMode = GM_NONE;
+ }
+ return TRUE;
+}
+
+BOOL LSLoadNetwork(const CTFileName &fnm)
+{
+ // call local players menu
+ _fnGameToLoad = fnm;
+ StartSelectPlayersMenuFromNetworkLoad();
+ return TRUE;
+}
+
+BOOL LSLoadSplitScreen(const CTFileName &fnm)
+{
+ // call local players menu
+ _fnGameToLoad = fnm;
+ StartSelectPlayersMenuFromSplitScreenLoad();
+ return TRUE;
+}
+
+void StartDemoPlay(void)
+{
+ _pGame->gm_StartSplitScreenCfg = CGame::SSC_OBSERVER;
+ // play the demo
+ _pGame->gm_strNetworkProvider = "Local";
+ if (_pGame->StartDemoPlay(_fnDemoToPlay))
+ {
+ // exit menu and pull up the console
+ StopMenus();
+ if (_pGame->gm_csConsoleState != CS_OFF) _pGame->gm_csConsoleState = CS_TURNINGOFF;
+ _gmRunningGameMode = GM_DEMO;
+ }
+ else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+extern BOOL LSLoadDemo(const CTFileName &fnm)
+{
+ // call local players menu
+ _fnDemoToPlay = fnm;
+ StartDemoPlay();
+ return TRUE;
+}
+
+BOOL LSLoadPlayerModel(const CTFileName &fnm)
+{
+ // get base filename
+ CTString strBaseName = fnm.FileName();
+ // set it for current player
+ CPlayerCharacter &pc = _pGame->gm_apcPlayers[*_pGUIM->gmPlayerProfile.gm_piCurrentPlayer];
+ CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance;
+ memset(pps->ps_achModelFile, 0, sizeof(pps->ps_achModelFile));
+ strncpy(pps->ps_achModelFile, strBaseName, sizeof(pps->ps_achModelFile));
+
+ void MenuGoToParent(void);
+ MenuGoToParent();
+ return TRUE;
+}
+
+BOOL LSLoadControls(const CTFileName &fnm)
+{
+ try {
+ ControlsMenuOn();
+ _pGame->gm_ctrlControlsExtra.Load_t(fnm);
+ ControlsMenuOff();
+ }
+ catch (char *strError) {
+ CPrintF("%s", strError);
+ }
+
+ void MenuGoToParent(void);
+ MenuGoToParent();
+ return TRUE;
+}
+
+BOOL LSLoadAddon(const CTFileName &fnm)
+{
+ extern INDEX _iAddonExecState;
+ extern CTFileName _fnmAddonToExec;
+ _iAddonExecState = 1;
+ _fnmAddonToExec = fnm;
+ return TRUE;
+}
+
+BOOL LSLoadMod(const CTFileName &fnm)
+{
+ _fnmModSelected = fnm;
+ extern void ModConfirm(void);
+ ModConfirm();
+ return TRUE;
+}
+
+BOOL LSLoadCustom(const CTFileName &fnm)
+{
+ _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS");
+ // LoadStringVar(fnm.NoExt()+".des", mgVarTitle.mg_strText);
+ // mgVarTitle.mg_strText.OnlyFirstLine();
+ _pGUIM->gmVarMenu.gm_fnmMenuCFG = fnm;
+ _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu;
+ ChangeToMenu(&_pGUIM->gmVarMenu);
+ return TRUE;
+}
+
+BOOL LSLoadNetSettings(const CTFileName &fnm)
+{
+ sam_strNetworkSettings = fnm;
+ CTString strCmd;
+ strCmd.PrintF("include \"%s\"", (const char*)sam_strNetworkSettings);
+ _pShell->Execute(strCmd);
+
+ void MenuGoToParent(void);
+ MenuGoToParent();
+ return TRUE;
+}
+
+// same function for saving in singleplay, network and splitscreen
+BOOL LSSaveAnyGame(const CTFileName &fnm)
+{
+ if (_pGame->SaveGame(fnm)) {
+ StopMenus();
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+BOOL LSSaveDemo(const CTFileName &fnm)
+{
+ // save the demo
+ if (_pGame->StartDemoRec(fnm)) {
+ StopMenus();
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+void StartNetworkLoadGame(void)
+{
+ // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
+ _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
+ _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
+ _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
+ _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
+
+ _pGame->gm_strNetworkProvider = "TCP/IP Server";
+ if (_pGame->LoadGame(_fnGameToLoad))
+ {
+ StopMenus();
+ _gmRunningGameMode = GM_NETWORK;
+ }
+ else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
+
+void StartSplitScreenGameLoad(void)
+{
+ // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
+ _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
+
+ _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
+ _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
+ _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
+ _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
+
+ _pGame->gm_strNetworkProvider = "Local";
+ if (_pGame->LoadGame(_fnGameToLoad)) {
+ StopMenus();
+ _gmRunningGameMode = GM_SPLIT_SCREEN;
+ }
+ else {
+ _gmRunningGameMode = GM_NONE;
+ }
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStartersAF.h b/Sources/SeriousSam/GUI/Menus/MenuStartersAF.h
new file mode 100644
index 0000000..bda67c8
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStartersAF.h
@@ -0,0 +1,39 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_STARTERSAF_H
+#define SE_INCL_MENU_STARTERSAF_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+
+BOOL LSLoadSinglePlayer(const CTFileName &fnm);
+BOOL LSLoadNetwork(const CTFileName &fnm);
+BOOL LSLoadSplitScreen(const CTFileName &fnm);
+BOOL LSLoadDemo(const CTFileName &fnm);
+BOOL LSLoadPlayerModel(const CTFileName &fnm);
+BOOL LSLoadControls(const CTFileName &fnm);
+BOOL LSLoadAddon(const CTFileName &fnm);
+BOOL LSLoadMod(const CTFileName &fnm);
+BOOL LSLoadCustom(const CTFileName &fnm);
+BOOL LSLoadNetSettings(const CTFileName &fnm);
+BOOL LSSaveAnyGame(const CTFileName &fnm);
+BOOL LSSaveDemo(const CTFileName &fnm);
+void StartDemoPlay(void);
+void StartNetworkLoadGame(void);
+void StartSplitScreenGameLoad(void);
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStuff.cpp b/Sources/SeriousSam/GUI/Menus/MenuStuff.cpp
new file mode 100644
index 0000000..3964701
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStuff.cpp
@@ -0,0 +1,307 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#include "StdH.h"
+#include
+
+#include "MenuStuff.h"
+
+#define RADIOTRANS(str) ("ETRS" str)
+
+extern CTString astrNoYes[] = {
+ RADIOTRANS("No"),
+ RADIOTRANS("Yes"),
+};
+
+extern CTString astrComputerInvoke[] = {
+ RADIOTRANS("Use"),
+ RADIOTRANS("Double-click use"),
+};
+
+extern CTString astrWeapon[] = {
+ RADIOTRANS("Only if new"),
+ RADIOTRANS("Never"),
+ RADIOTRANS("Always"),
+ RADIOTRANS("Only if stronger"),
+};
+
+extern PIX apixWidths[][2] = {
+ 320, 240,
+ 400, 300,
+ 512, 384,
+ 640, 240,
+ 640, 480,
+ 720, 540,
+ 800, 300,
+ 800, 600,
+ 960, 720,
+ 1024, 384,
+ 1024, 768,
+ 1152, 864,
+ 1280, 480,
+ 1280, 960,
+ 1600, 600,
+ 1600, 1200,
+ 1920, 720,
+ 1920, 1440,
+ 2048, 786,
+ 2048, 1536,
+};
+
+extern CTString astrCrosshair[] = {
+ "",
+ "Textures\\Interface\\Crosshairs\\Crosshair1.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair2.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair3.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair4.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair5.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair6.tex",
+ "Textures\\Interface\\Crosshairs\\Crosshair7.tex",
+};
+
+extern CTString astrMaxPlayersRadioTexts[] = {
+ RADIOTRANS("2"),
+ RADIOTRANS("3"),
+ RADIOTRANS("4"),
+ RADIOTRANS("5"),
+ RADIOTRANS("6"),
+ RADIOTRANS("7"),
+ RADIOTRANS("8"),
+ RADIOTRANS("9"),
+ RADIOTRANS("10"),
+ RADIOTRANS("11"),
+ RADIOTRANS("12"),
+ RADIOTRANS("13"),
+ RADIOTRANS("14"),
+ RADIOTRANS("15"),
+ RADIOTRANS("16"),
+};
+// here, we just reserve space for up to 16 different game types
+// actual names are added later
+extern CTString astrGameTypeRadioTexts[] = {
+ "", "", "", "", "",
+ "", "", "", "", "",
+ "", "", "", "", "",
+ "", "", "", "", "",
+};
+
+extern INDEX ctGameTypeRadioTexts = 1;
+
+extern CTString astrDifficultyRadioTexts[] = {
+ RADIOTRANS("Tourist"),
+ RADIOTRANS("Easy"),
+ RADIOTRANS("Normal"),
+ RADIOTRANS("Hard"),
+ RADIOTRANS("Serious"),
+ RADIOTRANS("Mental"),
+};
+
+extern CTString astrSplitScreenRadioTexts[] = {
+ RADIOTRANS("1"),
+ RADIOTRANS("2 - split screen"),
+ RADIOTRANS("3 - split screen"),
+ RADIOTRANS("4 - split screen"),
+};
+
+extern CTString astrDisplayPrefsRadioTexts[] = {
+ RADIOTRANS("Speed"),
+ RADIOTRANS("Normal"),
+ RADIOTRANS("Quality"),
+ RADIOTRANS("Custom"),
+};
+
+extern CTString astrDisplayAPIRadioTexts[] = {
+ RADIOTRANS("OpenGL"),
+ RADIOTRANS("Direct3D"),
+};
+
+extern CTString astrBitsPerPixelRadioTexts[] = {
+ RADIOTRANS("Desktop"),
+ RADIOTRANS("16 BPP"),
+ RADIOTRANS("32 BPP"),
+};
+
+extern CTString astrFrequencyRadioTexts[] = {
+ RADIOTRANS("No sound"),
+ RADIOTRANS("11kHz"),
+ RADIOTRANS("22kHz"),
+ RADIOTRANS("44kHz"),
+};
+
+extern CTString astrSoundAPIRadioTexts[] = {
+ RADIOTRANS("WaveOut"),
+ RADIOTRANS("DirectSound"),
+ RADIOTRANS("EAX"),
+};
+
+ULONG GetSpawnFlagsForGameType(INDEX iGameType)
+{
+ if (iGameType == -1) return SPF_SINGLEPLAYER;
+
+ // get function that will provide us the flags
+ CShellSymbol *pss = _pShell->GetSymbol("GetSpawnFlagsForGameTypeSS", /*bDeclaredOnly=*/ TRUE);
+ // if none
+ if (pss == NULL) {
+ // error
+ ASSERT(FALSE);
+ return 0;
+ }
+
+ ULONG(*pFunc)(INDEX) = (ULONG(*)(INDEX))pss->ss_pvValue;
+ return pFunc(iGameType);
+}
+
+BOOL IsMenuEnabled(const CTString &strMenuName)
+{
+ // get function that will provide us the flags
+ CShellSymbol *pss = _pShell->GetSymbol("IsMenuEnabledSS", /*bDeclaredOnly=*/ TRUE);
+ // if none
+ if (pss == NULL) {
+ // error
+ ASSERT(FALSE);
+ return TRUE;
+ }
+
+ BOOL(*pFunc)(const CTString &) = (BOOL(*)(const CTString &))pss->ss_pvValue;
+ return pFunc(strMenuName);
+}
+
+// initialize game type strings table
+void InitGameTypes(void)
+{
+ // get function that will provide us the info about gametype
+ CShellSymbol *pss = _pShell->GetSymbol("GetGameTypeNameSS", /*bDeclaredOnly=*/ TRUE);
+ // if none
+ if (pss == NULL) {
+ // error
+ astrGameTypeRadioTexts[0] = "??>";
+ ctGameTypeRadioTexts = 1;
+ return;
+ }
+
+ // for each mode
+ for (ctGameTypeRadioTexts = 0; ctGameTypeRadioTextsss_pvValue;
+ CTString strMode = pFunc(ctGameTypeRadioTexts);
+ // if no mode modes
+ if (strMode == "") {
+ // stop
+ break;
+ }
+ // add that mode
+ astrGameTypeRadioTexts[ctGameTypeRadioTexts] = strMode;
+ }
+}
+
+int qsort_CompareFileInfos_NameUp(const void *elem1, const void *elem2)
+{
+ const CFileInfo &fi1 = **(CFileInfo **)elem1;
+ const CFileInfo &fi2 = **(CFileInfo **)elem2;
+ return strcmp(fi1.fi_strName, fi2.fi_strName);
+}
+
+int qsort_CompareFileInfos_NameDn(const void *elem1, const void *elem2)
+{
+ const CFileInfo &fi1 = **(CFileInfo **)elem1;
+ const CFileInfo &fi2 = **(CFileInfo **)elem2;
+ return -strcmp(fi1.fi_strName, fi2.fi_strName);
+}
+
+int qsort_CompareFileInfos_FileUp(const void *elem1, const void *elem2)
+{
+ const CFileInfo &fi1 = **(CFileInfo **)elem1;
+ const CFileInfo &fi2 = **(CFileInfo **)elem2;
+ return strcmp(fi1.fi_fnFile, fi2.fi_fnFile);
+}
+
+int qsort_CompareFileInfos_FileDn(const void *elem1, const void *elem2)
+{
+ const CFileInfo &fi1 = **(CFileInfo **)elem1;
+ const CFileInfo &fi2 = **(CFileInfo **)elem2;
+ return -strcmp(fi1.fi_fnFile, fi2.fi_fnFile);
+}
+
+INDEX APIToSwitch(enum GfxAPIType gat)
+{
+ switch (gat) {
+ case GAT_OGL: return 0;
+#ifdef SE1_D3D
+ case GAT_D3D: return 1;
+#endif // SE1_D3D
+ default: ASSERT(FALSE); return 0;
+ }
+}
+
+enum GfxAPIType SwitchToAPI(INDEX i)
+{
+ switch (i) {
+ case 0: return GAT_OGL;
+#ifdef SE1_D3D
+ case 1: return GAT_D3D;
+#endif // SE1_D3D
+ default: ASSERT(FALSE); return GAT_OGL;
+ }
+}
+
+INDEX DepthToSwitch(enum DisplayDepth dd)
+{
+ switch (dd) {
+ case DD_DEFAULT: return 0;
+ case DD_16BIT: return 1;
+ case DD_32BIT: return 2;
+ default: ASSERT(FALSE); return 0;
+ }
+}
+
+enum DisplayDepth SwitchToDepth(INDEX i)
+{
+ switch (i) {
+ case 0: return DD_DEFAULT;
+ case 1: return DD_16BIT;
+ case 2: return DD_32BIT;
+ default: ASSERT(FALSE); return DD_DEFAULT;
+ }
+}
+
+// controls that are currently customized
+CTFileName _fnmControlsToCustomize = CTString("");
+
+void ControlsMenuOn()
+{
+ _pGame->SavePlayersAndControls();
+ try {
+ _pGame->gm_ctrlControlsExtra.Load_t(_fnmControlsToCustomize);
+ }
+ catch (char *strError) {
+ WarningMessage(strError);
+ }
+}
+
+void ControlsMenuOff()
+{
+ try {
+ if (_pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count()>0) {
+ _pGame->gm_ctrlControlsExtra.Save_t(_fnmControlsToCustomize);
+ }
+ }
+ catch (char *strError) {
+ FatalError(strError);
+ }
+ FORDELETELIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct) {
+ delete &itAct.Current();
+ }
+ _pGame->LoadPlayersAndControls();
+}
\ No newline at end of file
diff --git a/Sources/SeriousSam/GUI/Menus/MenuStuff.h b/Sources/SeriousSam/GUI/Menus/MenuStuff.h
new file mode 100644
index 0000000..80a127d
--- /dev/null
+++ b/Sources/SeriousSam/GUI/Menus/MenuStuff.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2002-2012 Croteam Ltd.
+This program is free software; you can redistribute it and/or modify
+it under the terms of version 2 of the GNU General Public License as published by
+the Free Software Foundation
+
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+
+#ifndef SE_INCL_MENU_STUFF_H
+#define SE_INCL_MENU_STUFF_H
+#ifdef PRAGMA_ONCE
+ #pragma once
+#endif
+
+#include "FileInfo.h"
+
+#define TRIGGER_MG(mg, y, up, down, text, astr) \
+ mg.mg_pmgUp = &up; \
+ mg.mg_pmgDown = &down; \
+ mg.mg_boxOnScreen = BoxMediumRow(y); \
+ gm_lhGadgets.AddTail(mg.mg_lnNode); \
+ mg.mg_astrTexts = astr; \
+ mg.mg_ctTexts = sizeof(astr) / sizeof(astr[0]); \
+ mg.mg_iSelected = 0; \
+ mg.mg_strLabel = text; \
+ mg.mg_strValue = astr[0];
+
+
+extern INDEX ctGameTypeRadioTexts;
+
+extern CTString astrNoYes[2];
+extern CTString astrWeapon[4];
+extern CTString astrComputerInvoke[2];
+extern CTString astrCrosshair[8];
+extern CTString astrMaxPlayersRadioTexts[15];
+extern CTString astrGameTypeRadioTexts[20];
+extern CTString astrDifficultyRadioTexts[6];
+extern CTString astrSplitScreenRadioTexts[4];
+extern CTString astrDisplayPrefsRadioTexts[4];
+extern CTString astrDisplayAPIRadioTexts[2];
+extern CTString astrBitsPerPixelRadioTexts[3];
+extern CTString astrFrequencyRadioTexts[4];
+extern CTString astrSoundAPIRadioTexts[3];
+
+extern PIX apixWidths[20][2];
+
+ULONG GetSpawnFlagsForGameType(INDEX iGameType);
+BOOL IsMenuEnabled(const CTString &strMenuName);
+void InitGameTypes(void);
+
+int qsort_CompareFileInfos_NameUp(const void *elem1, const void *elem2);
+int qsort_CompareFileInfos_NameDn(const void *elem1, const void *elem2);
+int qsort_CompareFileInfos_FileUp(const void *elem1, const void *elem2);
+int qsort_CompareFileInfos_FileDn(const void *elem1, const void *elem2);
+
+INDEX APIToSwitch(enum GfxAPIType gat);
+enum GfxAPIType SwitchToAPI(INDEX i);
+INDEX DepthToSwitch(enum DisplayDepth dd);
+enum DisplayDepth SwitchToDepth(INDEX i);
+
+void ControlsMenuOn();
+void ControlsMenuOff();
+
+#endif /* include-once check. */
\ No newline at end of file
diff --git a/Sources/SeriousSam/Menu.cpp b/Sources/SeriousSam/Menu.cpp
deleted file mode 100644
index 5d5d7f9..0000000
--- a/Sources/SeriousSam/Menu.cpp
+++ /dev/null
@@ -1,6143 +0,0 @@
-/* Copyright (c) 2002-2012 Croteam Ltd.
-This program is free software; you can redistribute it and/or modify
-it under the terms of version 2 of the GNU General Public License as published by
-the Free Software Foundation
-
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-#include "StdH.h"
-#include
-#include
-#include
-#include
-#include "MainWindow.h"
-#include
-#include
-#include
-#include "MenuPrinting.h"
-#include "LevelInfo.h"
-#include "VarList.h"
-
-// macros for translating radio button text arrays
-#define RADIOTRANS(str) ("ETRS" str)
-#define TRANSLATERADIOARRAY(array) TranslateRadioTexts(array, ARRAYCOUNT(array))
-
-extern CMenuGadget *_pmgLastActivatedGadget;
-extern BOOL bMenuActive;
-extern BOOL bMenuRendering;
-extern CTextureObject *_ptoLogoCT;
-extern CTextureObject *_ptoLogoODI;
-extern CTextureObject *_ptoLogoEAX;
-
-INDEX _iLocalPlayer = -1;
-BOOL _bPlayerMenuFromSinglePlayer = FALSE;
-
-
-GameMode _gmMenuGameMode = GM_NONE;
-GameMode _gmRunningGameMode = GM_NONE;
-CListHead _lhServers;
-
-static INDEX sam_old_bFullScreenActive;
-static INDEX sam_old_iScreenSizeI;
-static INDEX sam_old_iScreenSizeJ;
-static INDEX sam_old_iDisplayDepth;
-static INDEX sam_old_iDisplayAdapter;
-static INDEX sam_old_iGfxAPI;
-static INDEX sam_old_iVideoSetup; // 0==speed, 1==normal, 2==quality, 3==custom
-
-ENGINE_API extern INDEX snd_iFormat;
-
-extern BOOL IsCDInDrive(void);
-
-void OnPlayerSelect(void);
-
-
-
-ULONG SpawnFlagsForGameType(INDEX iGameType)
-{
- if (iGameType==-1) return SPF_SINGLEPLAYER;
-
- // get function that will provide us the flags
- CShellSymbol *pss = _pShell->GetSymbol("GetSpawnFlagsForGameTypeSS", /*bDeclaredOnly=*/ TRUE);
- // if none
- if (pss==NULL) {
- // error
- ASSERT(FALSE);
- return 0;
- }
-
- ULONG (*pFunc)(INDEX) = (ULONG (*)(INDEX))pss->ss_pvValue;
- return pFunc(iGameType);
-}
-
-BOOL IsMenuEnabled(const CTString &strMenuName)
-{
- // get function that will provide us the flags
- CShellSymbol *pss = _pShell->GetSymbol("IsMenuEnabledSS", /*bDeclaredOnly=*/ TRUE);
- // if none
- if (pss==NULL) {
- // error
- ASSERT(FALSE);
- return TRUE;
- }
-
- BOOL (*pFunc)(const CTString &) = (BOOL (*)(const CTString &))pss->ss_pvValue;
- return pFunc(strMenuName);
-}
-
-// last tick done
-TIME _tmMenuLastTickDone = -1;
-// all possible menu entities
-CListHead lhMenuEntities;
-// controls that are currently customized
-CTFileName _fnmControlsToCustomize = CTString("");
-
-static CTString _strLastPlayerAppearance;
-extern CTString sam_strNetworkSettings;
-
-// function to activate when level is chosen
-void (*_pAfterLevelChosen)(void);
-
-// functions to activate when user chose 'yes/no' on confirmation
-void (*_pConfimedYes)(void) = NULL;
-void (*_pConfimedNo)(void) = NULL;
-
-void FixupBackButton(CGameMenu *pgm);
-
-void ConfirmYes(void)
-{
- if (_pConfimedYes!=NULL) {
- _pConfimedYes();
- }
- void MenuGoToParent(void);
- MenuGoToParent();
-}
-void ConfirmNo(void)
-{
- if (_pConfimedNo!=NULL) {
- _pConfimedNo();
- }
- void MenuGoToParent(void);
- MenuGoToParent();
-}
-
-
-void ControlsMenuOn()
-{
- _pGame->SavePlayersAndControls();
- try {
- _pGame->gm_ctrlControlsExtra.Load_t(_fnmControlsToCustomize);
- } catch( char *strError) {
- WarningMessage(strError);
- }
-}
-
-void ControlsMenuOff()
-{
- try {
- if (_pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count()>0) {
- _pGame->gm_ctrlControlsExtra.Save_t(_fnmControlsToCustomize);
- }
- } catch( char *strError) {
- FatalError(strError);
- }
- FORDELETELIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct) {
- delete &itAct.Current();
- }
- _pGame->LoadPlayersAndControls();
-}
-
-// mouse cursor position
-extern PIX _pixCursorPosI = 0;
-extern PIX _pixCursorPosJ = 0;
-extern PIX _pixCursorExternPosI = 0;
-extern PIX _pixCursorExternPosJ = 0;
-extern BOOL _bMouseUsedLast = FALSE;
-extern CMenuGadget *_pmgUnderCursor = NULL;
-extern BOOL _bDefiningKey;
-extern BOOL _bEditingString;
-extern BOOL _bMouseRight = FALSE;
-
-// thumbnail for showing in menu
-CTextureObject _toThumbnail;
-BOOL _bThumbnailOn = FALSE;
-
-CFontData _fdBig;
-CFontData _fdMedium;
-CFontData _fdSmall;
-CFontData _fdTitle;
-
-
-CSoundData *_psdSelect = NULL;
-CSoundData *_psdPress = NULL;
-CSoundObject *_psoMenuSound = NULL;
-
-static CTextureObject _toPointer;
-static CTextureObject _toLogoMenuA;
-static CTextureObject _toLogoMenuB;
-
-// -------------- All possible menu entities
-#define BIG_BUTTONS_CT 6
-#define SAVELOAD_BUTTONS_CT 14
-
-#define TRIGGER_MG(mg, y, up, down, text, astr) \
- mg.mg_pmgUp = &up;\
- mg.mg_pmgDown = &down;\
- mg.mg_boxOnScreen = BoxMediumRow(y);\
- gm_lhGadgets.AddTail( mg.mg_lnNode);\
- mg.mg_astrTexts = astr;\
- mg.mg_ctTexts = sizeof( astr)/sizeof( astr[0]);\
- mg.mg_iSelected = 0;\
- mg.mg_strLabel = text;\
- mg.mg_strValue = astr[0];
-
-#define CHANGETRIGGERARRAY(ltbmg, astr) \
- ltbmg.mg_astrTexts = astr;\
- ltbmg.mg_ctTexts = sizeof( astr)/sizeof( astr[0]);\
- ltbmg.mg_iSelected = 0;\
- ltbmg.mg_strText = astr[ltbmg.mg_iSelected];
-
-#define PLACEMENT(x,y,z) CPlacement3D( FLOAT3D( x, y, z), \
- ANGLE3D( AngleDeg(0.0f), AngleDeg(0.0f), AngleDeg(0.0f)))
-
-CTString astrNoYes[] = {
- RADIOTRANS( "No"),
- RADIOTRANS( "Yes"),
-};
-CTString astrComputerInvoke[] = {
- RADIOTRANS( "Use"),
- RADIOTRANS( "Double-click use"),
-};
-CTString astrWeapon[] = {
- RADIOTRANS( "Only if new"),
- RADIOTRANS( "Never"),
- RADIOTRANS( "Always"),
- RADIOTRANS( "Only if stronger"),
-};
-CTString astrCrosshair[] = {
- "",
- "Textures\\Interface\\Crosshairs\\Crosshair1.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair2.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair3.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair4.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair5.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair6.tex",
- "Textures\\Interface\\Crosshairs\\Crosshair7.tex",
-};
-
-CTString astrMaxPlayersRadioTexts[] = {
- RADIOTRANS( "2"),
- RADIOTRANS( "3"),
- RADIOTRANS( "4"),
- RADIOTRANS( "5"),
- RADIOTRANS( "6"),
- RADIOTRANS( "7"),
- RADIOTRANS( "8"),
- RADIOTRANS( "9"),
- RADIOTRANS( "10"),
- RADIOTRANS( "11"),
- RADIOTRANS( "12"),
- RADIOTRANS( "13"),
- RADIOTRANS( "14"),
- RADIOTRANS( "15"),
- RADIOTRANS( "16"),
-};
-// here, we just reserve space for up to 16 different game types
-// actual names are added later
-CTString astrGameTypeRadioTexts[] = {
- "", "", "", "", "",
- "", "", "", "", "",
- "", "", "", "", "",
- "", "", "", "", "",
-};
-INDEX ctGameTypeRadioTexts = 1;
-CTString astrDifficultyRadioTexts[] = {
- RADIOTRANS("Tourist"),
- RADIOTRANS("Easy"),
- RADIOTRANS("Normal"),
- RADIOTRANS("Hard"),
- RADIOTRANS("Serious"),
- RADIOTRANS("Mental"),
-};
-CTString astrSplitScreenRadioTexts[] = {
- RADIOTRANS( "1"),
- RADIOTRANS( "2 - split screen"),
- RADIOTRANS( "3 - split screen"),
- RADIOTRANS( "4 - split screen"),
-};
-
-// ptr to current menu
-CGameMenu *pgmCurrentMenu = NULL;
-
-// global back button
-CMGButton mgBack;
-
-// -------- Confirm menu
-CConfirmMenu gmConfirmMenu;
-CMGButton mgConfirmLabel;
-CMGButton mgConfirmYes;
-CMGButton mgConfirmNo;
-
-// -------- Main menu
-CMainMenu gmMainMenu;
-//CMGTitle mgMainTitle;
-CMGButton mgMainVersionLabel;
-CMGButton mgMainModLabel;
-CMGButton mgMainSingle;
-CMGButton mgMainNetwork;
-CMGButton mgMainSplitScreen;
-CMGButton mgMainDemo;
-CMGButton mgMainMods;
-CMGButton mgMainHighScore;
-CMGButton mgMainOptions;
-CMGButton mgMainQuit;
-
-// -------- InGame menu
-CInGameMenu gmInGameMenu;
-CMGTitle mgInGameTitle;
-CMGButton mgInGameLabel1;
-CMGButton mgInGameLabel2;
-CMGButton mgInGameQuickLoad;
-CMGButton mgInGameQuickSave;
-CMGButton mgInGameLoad;
-CMGButton mgInGameSave;
-CMGButton mgInGameDemoRec;
-CMGButton mgInGameHighScore;
-CMGButton mgInGameOptions;
-CMGButton mgInGameStop;
-CMGButton mgInGameQuit;
-
-// -------- Single player menu
-CSinglePlayerMenu gmSinglePlayerMenu;
-CMGTitle mgSingleTitle;
-CMGButton mgSinglePlayerLabel;
-CMGButton mgSingleNewGame;
-CMGButton mgSingleCustom;
-CMGButton mgSingleQuickLoad;
-CMGButton mgSingleLoad;
-CMGButton mgSingleTraining;
-CMGButton mgSingleTechTest;
-CMGButton mgSinglePlayersAndControls;
-CMGButton mgSingleOptions;
-
-// -------- New single player menu
-CSinglePlayerNewMenu gmSinglePlayerNewMenu;
-CMGTitle mgSingleNewTitle;
-CMGButton mgSingleNewTourist;
-CMGButton mgSingleNewEasy;
-CMGButton mgSingleNewMedium;
-CMGButton mgSingleNewHard;
-CMGButton mgSingleNewSerious;
-CMGButton mgSingleNewMental;
-// -------- Disabled menu
-CDisabledMenu gmDisabledFunction;
-CMGTitle mgDisabledTitle;
-CMGButton mgDisabledMenuButton;
-// -------- Manual levels menu
-CLevelsMenu gmLevelsMenu;
-CMGTitle mgLevelsTitle;
-CMGLevelButton mgManualLevel[ LEVELS_ON_SCREEN];
-CMGArrow mgLevelsArrowUp;
-CMGArrow mgLevelsArrowDn;
-
-// -------- console variable adjustment menu
-BOOL _bVarChanged = FALSE;
-CVarMenu gmVarMenu;
-CMGTitle mgVarTitle;
-CMGVarButton mgVar[LEVELS_ON_SCREEN];
-CMGButton mgVarApply;
-CMGArrow mgVarArrowUp;
-CMGArrow mgVarArrowDn;
-
-// -------- Player profile menu
-CPlayerProfileMenu gmPlayerProfile;
-CMGTitle mgPlayerProfileTitle;
-CMGButton mgPlayerNoLabel;
-CMGButton mgPlayerNo[8];
-CMGButton mgPlayerNameLabel;
-CMGEdit mgPlayerName;
-CMGButton mgPlayerTeamLabel;
-CMGEdit mgPlayerTeam;
-CMGButton mgPlayerCustomizeControls;
-CMGTrigger mgPlayerCrosshair;
-CMGTrigger mgPlayerWeaponSelect;
-CMGTrigger mgPlayerWeaponHide;
-CMGTrigger mgPlayer3rdPerson;
-CMGTrigger mgPlayerQuotes;
-CMGTrigger mgPlayerAutoSave;
-CMGTrigger mgPlayerCompDoubleClick;
-CMGTrigger mgPlayerViewBobbing;
-CMGTrigger mgPlayerSharpTurning;
-CMGModel mgPlayerModel;
-
-// -------- Controls menu
-CControlsMenu gmControls;
-CMGTitle mgControlsTitle;
-CMGButton mgControlsNameLabel;
-CMGButton mgControlsButtons;
-CMGSlider mgControlsSensitivity;
-CMGTrigger mgControlsInvertTrigger;
-CMGTrigger mgControlsSmoothTrigger;
-CMGTrigger mgControlsAccelTrigger;
-CMGTrigger mgControlsIFeelTrigger;
-CMGButton mgControlsPredefined;
-CMGButton mgControlsAdvanced;
-
-// -------- Load/Save menu
-CLoadSaveMenu gmLoadSaveMenu;
-CMGTitle mgLoadSaveTitle;
-CMGButton mgLoadSaveNotes;
-CMGFileButton amgLSButton[SAVELOAD_BUTTONS_CT];
-CMGArrow mgLSArrowUp;
-CMGArrow mgLSArrowDn;
-// -------- High-score menu
-CHighScoreMenu gmHighScoreMenu;
-CMGTitle mgHighScoreTitle;
-CMGHighScore mgHScore;
-// -------- Customize keyboard menu
-CCustomizeKeyboardMenu gmCustomizeKeyboardMenu;
-CMGTitle mgCustomizeKeyboardTitle;
-CMGKeyDefinition mgKey[KEYS_ON_SCREEN];
-CMGArrow mgCustomizeArrowUp;
-CMGArrow mgCustomizeArrowDn;
-
-// -------- Choose servers menu
-CServersMenu gmServersMenu;
-CMGTitle mgServersTitle;
-CMGServerList mgServerList;
-CMGButton mgServerColumn[7];
-CMGEdit mgServerFilter[7];
-CMGButton mgServerRefresh;
-
-// -------- Customize axis menu
-CCustomizeAxisMenu gmCustomizeAxisMenu;
-CMGTitle mgCustomizeAxisTitle;
-CMGTrigger mgAxisActionTrigger;
-CMGTrigger mgAxisMountedTrigger;
-CMGSlider mgAxisSensitivity;
-CMGSlider mgAxisDeadzone;
-CMGTrigger mgAxisInvertTrigger;
-CMGTrigger mgAxisRelativeTrigger;
-CMGTrigger mgAxisSmoothTrigger;
-
-// -------- Options menu
-COptionsMenu gmOptionsMenu;
-CMGTitle mgOptionsTitle;
-CMGButton mgVideoOptions;
-CMGButton mgAudioOptions;
-CMGButton mgPlayerProfileOptions;
-CMGButton mgNetworkOptions;
-CMGButton mgCustomOptions;
-CMGButton mgAddonOptions;
-
-// -------- Video options menu
-CVideoOptionsMenu gmVideoOptionsMenu;
-CMGTitle mgVideoOptionsTitle;
-CMGTrigger mgDisplayAPITrigger;
-CTString astrDisplayAPIRadioTexts[] = {
- RADIOTRANS( "OpenGL"),
- RADIOTRANS( "Direct3D"),
-};
-CMGTrigger mgDisplayAdaptersTrigger;
-CMGTrigger mgFullScreenTrigger;
-CMGTrigger mgResolutionsTrigger;
-CMGTrigger mgDisplayPrefsTrigger;
-CTString astrDisplayPrefsRadioTexts[] = {
- RADIOTRANS( "Speed"),
- RADIOTRANS( "Normal"),
- RADIOTRANS( "Quality"),
- RADIOTRANS( "Custom"),
-};
-INDEX _ctResolutions = 0;
-CTString * _astrResolutionTexts = NULL;
-CDisplayMode *_admResolutionModes = NULL;
-INDEX _ctAdapters = 0;
-CTString * _astrAdapterTexts = NULL;
-CMGButton mgVideoRendering;
-CMGTrigger mgBitsPerPixelTrigger;
-CTString astrBitsPerPixelRadioTexts[] = {
- RADIOTRANS( "Desktop"),
- RADIOTRANS( "16 BPP"),
- RADIOTRANS( "32 BPP"),
-};
-
-CMGButton mgVideoOptionsApply;
-
-// -------- Audio options menu
-CAudioOptionsMenu gmAudioOptionsMenu;
-CMGTitle mgAudioOptionsTitle;
-CMGTrigger mgAudioAutoTrigger;
-CMGTrigger mgAudioAPITrigger;
-CMGTrigger mgFrequencyTrigger;
-CTString astrFrequencyRadioTexts[] = {
- RADIOTRANS( "No sound"),
- RADIOTRANS( "11kHz"),
- RADIOTRANS( "22kHz"),
- RADIOTRANS( "44kHz"),
-};
-CTString astrSoundAPIRadioTexts[] = {
- RADIOTRANS( "WaveOut"),
- RADIOTRANS( "DirectSound"),
- RADIOTRANS( "EAX"),
-};
-CMGSlider mgWaveVolume;
-CMGSlider mgMPEGVolume;
-CMGButton mgAudioOptionsApply;
-
-// -------- Network menu
-CNetworkMenu gmNetworkMenu;
-CMGTitle mgNetworkTitle;
-CMGButton mgNetworkJoin;
-CMGButton mgNetworkStart;
-CMGButton mgNetworkQuickLoad;
-CMGButton mgNetworkLoad;
-
-// -------- Network join menu
-CNetworkJoinMenu gmNetworkJoinMenu;
-CMGTitle mgNetworkJoinTitle;
-CMGButton mgNetworkJoinLAN;
-CMGButton mgNetworkJoinNET;
-CMGButton mgNetworkJoinOpen;
-
-// -------- Network start menu
-CNetworkStartMenu gmNetworkStartMenu;
-CMGTitle mgNetworkStartTitle;
-CMGEdit mgNetworkSessionName;
-CMGTrigger mgNetworkGameType;
-CMGTrigger mgNetworkDifficulty;
-CMGButton mgNetworkLevel;
-CMGTrigger mgNetworkMaxPlayers;
-CMGTrigger mgNetworkWaitAllPlayers;
-CMGTrigger mgNetworkVisible;
-CMGButton mgNetworkGameOptions;
-CMGButton mgNetworkStartStart;
-
-// -------- Network open menu
-CNetworkOpenMenu gmNetworkOpenMenu;
-CMGTitle mgNetworkOpenTitle;
-CMGButton mgNetworkOpenAddressLabel;
-CMGEdit mgNetworkOpenAddress;
-CMGButton mgNetworkOpenPortLabel;
-CMGEdit mgNetworkOpenPort;
-CMGButton mgNetworkOpenJoin;
-
-// -------- Split screen menu
-CSplitScreenMenu gmSplitScreenMenu;
-CMGTitle mgSplitScreenTitle;
-CMGButton mgSplitScreenStart;
-CMGButton mgSplitScreenQuickLoad;
-CMGButton mgSplitScreenLoad;
-
-// -------- Split screen start menu
-CSplitStartMenu gmSplitStartMenu;
-CMGTitle mgSplitStartTitle;
-CMGTrigger mgSplitGameType;
-CMGTrigger mgSplitDifficulty;
-CMGButton mgSplitLevel;
-CMGButton mgSplitOptions;
-CMGButton mgSplitStartStart;
-
-// -------- Select players menu
-CSelectPlayersMenu gmSelectPlayersMenu;
-CMGTitle mgSelectPlayerTitle;
-
-CMGTrigger mgDedicated;
-CMGTrigger mgObserver;
-CMGTrigger mgSplitScreenCfg;
-
-CMGChangePlayer mgPlayer0Change;
-CMGChangePlayer mgPlayer1Change;
-CMGChangePlayer mgPlayer2Change;
-CMGChangePlayer mgPlayer3Change;
-
-CMGButton mgSelectPlayersNotes;
-
-CMGButton mgSelectPlayersStart;
-
-extern void PlayMenuSound(CSoundData *psd)
-{
- if (_psoMenuSound!=NULL && !_psoMenuSound->IsPlaying()) {
- _psoMenuSound->Play(psd, SOF_NONGAME);
- }
-}
-
-CModelObject *AddAttachment_t(CModelObject *pmoParent, INDEX iPosition,
- const CTFileName &fnmModel, INDEX iAnim,
- const CTFileName &fnmTexture,
- const CTFileName &fnmReflection,
- const CTFileName &fnmSpecular)
-{
- CAttachmentModelObject *pamo = pmoParent->AddAttachmentModel(iPosition);
- ASSERT(pamo!=NULL);
- pamo->amo_moModelObject.SetData_t(fnmModel);
- pamo->amo_moModelObject.PlayAnim(iAnim, AOF_LOOPING);
- pamo->amo_moModelObject.mo_toTexture.SetData_t(fnmTexture);
- pamo->amo_moModelObject.mo_toReflection.SetData_t(fnmReflection);
- pamo->amo_moModelObject.mo_toSpecular.SetData_t(fnmSpecular);
- return &pamo->amo_moModelObject;
-}
-
-void SetPlayerModel(CModelObject *pmoPlayer)
-{
-/* try {
- pmoPlayer->SetData_t( CTFILENAME( "Models\\Player\\SeriousSam\\Player.mdl"));
- pmoPlayer->mo_toTexture.SetData_t( CTFILENAME( "Models\\Player\\SeriousSam\\Player.tex"));
- pmoPlayer->PlayAnim(PLAYER_ANIM_WALK, AOF_LOOPING);
- CModelObject *pmoBody = AddAttachment_t(pmoPlayer, PLAYER_ATTACHMENT_TORSO,
- CTFILENAME("Models\\Player\\SeriousSam\\Body.mdl"), BODY_ANIM_MINIGUN_STAND,
- CTFILENAME("Models\\Player\\SeriousSam\\Body.tex"),
- CTFILENAME(""),
- CTFILENAME(""));
- CModelObject *pmoHead = AddAttachment_t(pmoBody, BODY_ATTACHMENT_HEAD,
- CTFILENAME("Models\\Player\\SeriousSam\\Head.mdl"), 0,
- CTFILENAME("Models\\Player\\SeriousSam\\Head.tex"),
- CTFILENAME(""),
- CTFILENAME(""));
- CModelObject *pmoMiniGun = AddAttachment_t(pmoBody, BODY_ATTACHMENT_MINIGUN,
- CTFILENAME("Models\\Weapons\\MiniGun\\MiniGunItem.mdl"), 0,
- CTFILENAME("Models\\Weapons\\MiniGun\\MiniGun.tex"),
- CTFILENAME(""),
- CTFILENAME(""));
- AddAttachment_t(pmoMiniGun, MINIGUNITEM_ATTACHMENT_BARRELS,
- CTFILENAME("Models\\Weapons\\MiniGun\\Barrels.mdl"), 0,
- CTFILENAME("Models\\Weapons\\MiniGun\\MiniGun.tex"),
- CTFILENAME("Models\\ReflectionTextures\\LightBlueMetal01.tex"),
- CTFILENAME("Models\\SpecularTextures\\Medium.tex"));
- AddAttachment_t(pmoMiniGun, MINIGUNITEM_ATTACHMENT_BODY,
- CTFILENAME("Models\\Weapons\\MiniGun\\Body.mdl"), 0,
- CTFILENAME("Models\\Weapons\\MiniGun\\MiniGun.tex"),
- CTFILENAME("Models\\ReflectionTextures\\LightBlueMetal01.tex"),
- CTFILENAME("Models\\SpecularTextures\\Medium.tex"));
- AddAttachment_t(pmoMiniGun, MINIGUNITEM_ATTACHMENT_ENGINE,
- CTFILENAME("Models\\Weapons\\MiniGun\\Engine.mdl"), 0,
- CTFILENAME("Models\\Weapons\\MiniGun\\MiniGun.tex"),
- CTFILENAME("Models\\ReflectionTextures\\LightBlueMetal01.tex"),
- CTFILENAME("Models\\SpecularTextures\\Medium.tex"));
-
- } catch( char *strError) {
- FatalError( strError);
- }
- */
-}
-
-// translate all texts in array for one radio button
-void TranslateRadioTexts(CTString astr[], INDEX ct)
-{
- for (INDEX i=0; i=0 && iRes<_ctResolutions);
-
- CTString &str = _astrResolutionTexts[iRes];
- CDisplayMode &dm = _admResolutionModes[iRes];
- dm.dm_pixSizeI = pixSizeI;
- dm.dm_pixSizeJ = pixSizeJ;
- str = GetResolutionDescription(dm);
-}
-
-// set new thumbnail
-void SetThumbnail(CTFileName fn)
-{
- _bThumbnailOn = TRUE;
- try {
- _toThumbnail.SetData_t(fn.NoExt()+"Tbn.tex");
- } catch(char *strError) {
- (void)strError;
- try {
- _toThumbnail.SetData_t(fn.NoExt()+".tbn");
- } catch(char *strError) {
- (void)strError;
- _toThumbnail.SetData(NULL);
- }
- }
-}
-
-// remove thumbnail
-void ClearThumbnail(void)
-{
- _bThumbnailOn = FALSE;
- _toThumbnail.SetData(NULL);
- _pShell->Execute( "FreeUnusedStock();");
-}
-
-// start load/save menus depending on type of game running
-
-void QuickSaveFromMenu()
-{
- _pShell->SetINDEX("gam_bQuickSave", 2); // force save with reporting
- StopMenus(TRUE);
-}
-
-void StartCurrentLoadMenu()
-{
- if (_gmRunningGameMode==GM_NETWORK) {
- void StartNetworkLoadMenu(void);
- StartNetworkLoadMenu();
- } else if (_gmRunningGameMode==GM_SPLIT_SCREEN) {
- void StartSplitScreenLoadMenu(void);
- StartSplitScreenLoadMenu();
- } else {
- void StartSinglePlayerLoadMenu(void);
- StartSinglePlayerLoadMenu();
- }
-}
-void StartCurrentSaveMenu()
-{
- if (_gmRunningGameMode==GM_NETWORK) {
- void StartNetworkSaveMenu(void);
- StartNetworkSaveMenu();
- } else if (_gmRunningGameMode==GM_SPLIT_SCREEN) {
- void StartSplitScreenSaveMenu(void);
- StartSplitScreenSaveMenu();
- } else {
- void StartSinglePlayerSaveMenu(void);
- StartSinglePlayerSaveMenu();
- }
-}
-void StartCurrentQuickLoadMenu()
-{
- if (_gmRunningGameMode==GM_NETWORK) {
- void StartNetworkQuickLoadMenu(void);
- StartNetworkQuickLoadMenu();
- } else if (_gmRunningGameMode==GM_SPLIT_SCREEN) {
- void StartSplitScreenQuickLoadMenu(void);
- StartSplitScreenQuickLoadMenu();
- } else {
- void StartSinglePlayerQuickLoadMenu(void);
- StartSinglePlayerQuickLoadMenu();
- }
-}
-
-void StartMenus(char *str)
-{
- _tmMenuLastTickDone=_pTimer->GetRealTimeTick();
- // disable printing of last lines
- CON_DiscardLastLineTimes();
-
- // stop all IFeel effects
- IFeel_StopEffect(NULL);
- if (pgmCurrentMenu==&gmMainMenu || pgmCurrentMenu==&gmInGameMenu) {
- if (_gmRunningGameMode==GM_NONE) {
- pgmCurrentMenu = &gmMainMenu;
- } else {
- pgmCurrentMenu = &gmInGameMenu;
- }
- }
-
- // start main menu, or last active one
- if (pgmCurrentMenu!=NULL) {
- ChangeToMenu(pgmCurrentMenu);
- } else {
- if (_gmRunningGameMode==GM_NONE) {
- ChangeToMenu(&gmMainMenu);
- } else {
- ChangeToMenu(&gmInGameMenu);
- }
- }
- if (CTString(str)=="load") {
- StartCurrentLoadMenu();
- gmLoadSaveMenu.gm_pgmParentMenu = NULL;
- }
- if (CTString(str)=="save") {
- StartCurrentSaveMenu();
- gmLoadSaveMenu.gm_pgmParentMenu = NULL;
- FixupBackButton(&gmLoadSaveMenu);
- }
- if (CTString(str)=="controls") {
- void StartControlsMenuFromOptions(void);
- StartControlsMenuFromOptions();
- gmControls.gm_pgmParentMenu = NULL;
- FixupBackButton(&gmControls);
- }
- if (CTString(str)=="join") {
- void StartSelectPlayersMenuFromOpen(void);
- StartSelectPlayersMenuFromOpen();
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmMainMenu;
- FixupBackButton(&gmSelectPlayersMenu);
- }
- if (CTString(str)=="hiscore") {
- ChangeToMenu( &gmHighScoreMenu);
- gmHighScoreMenu.gm_pgmParentMenu = &gmMainMenu;
- FixupBackButton(&gmHighScoreMenu);
- }
- bMenuActive = TRUE;
- bMenuRendering = TRUE;
-}
-
-
-void StopMenus( BOOL bGoToRoot /*=TRUE*/)
-{
- ClearThumbnail();
- if (pgmCurrentMenu!=NULL && bMenuActive) {
- pgmCurrentMenu->EndMenu();
- }
- bMenuActive = FALSE;
- if (bGoToRoot) {
- if (_gmRunningGameMode==GM_NONE) {
- pgmCurrentMenu = &gmMainMenu;
- } else {
- pgmCurrentMenu = &gmInGameMenu;
- }
- }
-}
-
-
-BOOL IsMenusInRoot(void)
-{
- return pgmCurrentMenu==NULL || pgmCurrentMenu==&gmMainMenu || pgmCurrentMenu==&gmInGameMenu;
-}
-
-// ---------------------- When activated functions
-void StartSinglePlayerMenu(void)
-{
- ChangeToMenu( &gmSinglePlayerMenu);
-}
-
-void ExitGame(void)
-{
- _bRunning = FALSE;
- _bQuitScreen = TRUE;
-}
-
-CTFileName _fnmModSelected;
-CTString _strModURLSelected;
-CTString _strModServerSelected;
-
-void ExitAndSpawnExplorer(void)
-{
- _bRunning = FALSE;
- _bQuitScreen = FALSE;
- extern CTString _strURLToVisit;
- _strURLToVisit = _strModURLSelected;
-}
-
-void ExitConfirm(void)
-{
- _pConfimedYes = &ExitGame;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-void StopConfirm(void)
-{
- extern void StopCurrentGame(void);
- _pConfimedYes = &StopCurrentGame;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-void ModConnect(void)
-{
- extern CTFileName _fnmModToLoad;
- extern CTString _strModServerJoin;
- _fnmModToLoad = _fnmModSelected;
- _strModServerJoin = _strModServerSelected;
-}
-
-void ModConnectConfirm(void)
-{
- if (_fnmModSelected==" ") {
- _fnmModSelected = CTString("SeriousSam");
- }
- CTFileName fnmModPath = "Mods\\"+_fnmModSelected+"\\";
- if (!FileExists(fnmModPath+"BaseWriteInclude.lst")
- &&!FileExists(fnmModPath+"BaseWriteExclude.lst")
- &&!FileExists(fnmModPath+"BaseBrowseInclude.lst")
- &&!FileExists(fnmModPath+"BaseBrowseExclude.lst")) {
- extern void ModNotInstalled(void);
- ModNotInstalled();
- return;
- }
-
- CPrintF(TRANS("Server is running a different MOD (%s).\nYou need to reload to connect.\n"), _fnmModSelected);
- _pConfimedYes = &ModConnect;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?");
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-void SaveConfirm(void)
-{
- extern void OnFileSaveOK(void);
- _pConfimedYes = &OnFileSaveOK;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("OVERWRITE?");
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-
-void ModLoadYes(void)
-{
- extern CTFileName _fnmModToLoad;
- _fnmModToLoad = _fnmModSelected;
-}
-
-void ModConfirm(void)
-{
- _pConfimedYes = &ModLoadYes;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?");
- gmConfirmMenu.gm_pgmParentMenu = &gmLoadSaveMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-void VideoConfirm(void)
-{
- // FIXUP: keyboard focus lost when going from full screen to window mode
- // due to WM_MOUSEMOVE being sent
- _bMouseUsedLast = FALSE;
- _pmgUnderCursor = gmConfirmMenu.gm_pmgSelectedByDefault;
-
- _pConfimedYes = NULL;
- void RevertVideoSettings(void);
- _pConfimedNo = RevertVideoSettings;
-
- mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?");
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
-}
-
-void CDConfirm(void (*pOk)(void))
-{
- _pConfimedYes = pOk;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?");
- if (pgmCurrentMenu!=&gmConfirmMenu) {
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeLarge();
- ChangeToMenu( &gmConfirmMenu);
- }
-}
-
-void StopCurrentGame(void)
-{
- _pGame->StopGame();
- _gmRunningGameMode=GM_NONE;
- StopMenus(TRUE);
- StartMenus("");
-}
-void StartSinglePlayerNewMenuCustom(void)
-{
- gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmLevelsMenu;
- ChangeToMenu( &gmSinglePlayerNewMenu);
-}
-void StartSinglePlayerNewMenu(void)
-{
- gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
- extern CTString sam_strFirstLevel;
- _pGame->gam_strCustomLevel = sam_strFirstLevel;
- ChangeToMenu( &gmSinglePlayerNewMenu);
-}
-
-void StartSinglePlayerGame(void)
-{
-/* if (!IsCDInDrive()) {
- CDConfirm(StartSinglePlayerGame);
- return;
- }
- */
-
- _pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_iSinglePlayer;
- _pGame->gm_aiStartLocalPlayers[1] = -1;
- _pGame->gm_aiStartLocalPlayers[2] = -1;
- _pGame->gm_aiStartLocalPlayers[3] = -1;
-
- _pGame->gm_strNetworkProvider = "Local";
- CUniversalSessionProperties sp;
- _pGame->SetSinglePlayerSession(sp);
-
- if (_pGame->NewGame( _pGame->gam_strCustomLevel, _pGame->gam_strCustomLevel, sp))
- {
- StopMenus();
- _gmRunningGameMode = GM_SINGLE_PLAYER;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-
-void StartSinglePlayerGame_Tourist(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_TOURIST);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-void StartSinglePlayerGame_Easy(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EASY);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-void StartSinglePlayerGame_Normal(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_NORMAL);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-void StartSinglePlayerGame_Hard(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_HARD);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-void StartSinglePlayerGame_Serious(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EXTREME);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-void StartSinglePlayerGame_Mental(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", CSessionProperties::GD_EXTREME+1);
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
- StartSinglePlayerGame();
-}
-
-void StartTraining(void)
-{
- gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
- extern CTString sam_strTrainingLevel;
- _pGame->gam_strCustomLevel = sam_strTrainingLevel;
- ChangeToMenu( &gmSinglePlayerNewMenu);
-}
-void StartTechTest(void)
-{
- gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
- extern CTString sam_strTechTestLevel;
- _pGame->gam_strCustomLevel = sam_strTechTestLevel;
- StartSinglePlayerGame_Normal();
-}
-
-void StartChangePlayerMenuFromOptions(void)
-{
- _bPlayerMenuFromSinglePlayer = FALSE;
- gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer;
- gmPlayerProfile.gm_pgmParentMenu = &gmOptionsMenu;
- ChangeToMenu( &gmPlayerProfile);
-}
-
-void StartChangePlayerMenuFromSinglePlayer(void)
-{
- _iLocalPlayer = -1;
- _bPlayerMenuFromSinglePlayer = TRUE;
- gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer;
- gmPlayerProfile.gm_pgmParentMenu = &gmSinglePlayerMenu;
- ChangeToMenu( &gmPlayerProfile);
-}
-
-void StartControlsMenuFromPlayer(void)
-{
- gmControls.gm_pgmParentMenu = &gmPlayerProfile;
- ChangeToMenu( &gmControls);
-}
-void StartControlsMenuFromOptions(void)
-{
- gmControls.gm_pgmParentMenu = &gmOptionsMenu;
- ChangeToMenu( &gmControls);
-}
-
-void DisabledFunction(void)
-{
- gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
- mgDisabledMenuButton.mg_strText = TRANS("The feature is not available in this version!");
- mgDisabledTitle.mg_strText = TRANS("DISABLED");
- ChangeToMenu( &gmDisabledFunction);
-}
-
-void ModNotInstalled(void)
-{
- _pConfimedYes = &ExitAndSpawnExplorer;
- _pConfimedNo = NULL;
- mgConfirmLabel.mg_strText.PrintF(
- TRANS("You don't have MOD '%s' installed.\nDo you want to visit its web site?"), (const char*)_fnmModSelected);
- gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
- gmConfirmMenu.BeSmall();
- ChangeToMenu( &gmConfirmMenu);
-
-/*
- gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
- mgDisabledMenuButton.mg_strText.PrintF(
- TRANS("You don't have MOD '%s' installed.\nPlease visit Croteam website for updates."), _fnmModSelected);
- mgDisabledTitle.mg_strText = TRANS("MOD REQUIRED");
- _strModURLSelected
- ChangeToMenu( &gmDisabledFunction);
- */
-}
-
-CTFileName _fnDemoToPlay;
-void StartDemoPlay(void)
-{
- _pGame->gm_StartSplitScreenCfg = CGame::SSC_OBSERVER;
- // play the demo
- _pGame->gm_strNetworkProvider = "Local";
- if( _pGame->StartDemoPlay( _fnDemoToPlay))
- {
- // exit menu and pull up the console
- StopMenus();
- if( _pGame->gm_csConsoleState!=CS_OFF) _pGame->gm_csConsoleState = CS_TURNINGOFF;
- _gmRunningGameMode = GM_DEMO;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-
-void StartSelectLevelFromSingle(void)
-{
- FilterLevels(SpawnFlagsForGameType(-1));
- _pAfterLevelChosen = StartSinglePlayerNewMenuCustom;
- ChangeToMenu( &gmLevelsMenu);
- gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
-}
-
-void StartNetworkGame(void)
-{
-// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
- _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
- _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
- _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
- _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
-
- CTFileName fnWorld = _pGame->gam_strCustomLevel;
-
- _pGame->gm_strNetworkProvider = "TCP/IP Server";
- CUniversalSessionProperties sp;
- _pGame->SetMultiPlayerSession(sp);
- if (_pGame->NewGame( _pGame->gam_strSessionName, fnWorld, sp))
- {
- StopMenus();
- _gmRunningGameMode = GM_NETWORK;
- // if starting a dedicated server
- if (_pGame->gm_MenuSplitScreenCfg==CGame::SSC_DEDICATED) {
- // pull down the console
- extern INDEX sam_bToggleConsole;
- sam_bToggleConsole = TRUE;
- }
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-void JoinNetworkGame(void)
-{
-// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
- _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
- _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
- _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
- _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
-
- _pGame->gm_strNetworkProvider = "TCP/IP Client";
- if (_pGame->JoinGame( CNetworkSession( _pGame->gam_strJoinAddress)))
- {
- StopMenus();
- _gmRunningGameMode = GM_NETWORK;
- } else {
- if (_pNetwork->ga_strRequiredMod != "") {
- extern CTFileName _fnmModToLoad;
- extern CTString _strModServerJoin;
- char strModName[256] = {0};
- char strModURL[256] = {0};
- _pNetwork->ga_strRequiredMod.ScanF("%250[^\\]\\%s", &strModName, &strModURL);
- _fnmModSelected = CTString(strModName);
- _strModURLSelected = strModURL;
- if (_strModURLSelected == "") {
- _strModURLSelected = "http://www.croteam.com/mods/Old";
- }
- _strModServerSelected.PrintF("%s:%s", _pGame->gam_strJoinAddress, _pShell->GetValue("net_iPort"));
- ModConnectConfirm();
- }
- _gmRunningGameMode = GM_NONE;
- }
-}
-void StartHighScoreMenu(void)
-{
- gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmHighScoreMenu);
-}
-CTFileName _fnGameToLoad;
-void StartNetworkLoadGame(void)
-{
-
-// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
- _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
- _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
- _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
- _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
-
- _pGame->gm_strNetworkProvider = "TCP/IP Server";
- if (_pGame->LoadGame( _fnGameToLoad))
- {
- StopMenus();
- _gmRunningGameMode = GM_NETWORK;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-
-void StartSplitScreenGame(void)
-{
-// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
- _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
- _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
- _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
- _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
-
- CTFileName fnWorld = _pGame->gam_strCustomLevel;
-
- _pGame->gm_strNetworkProvider = "Local";
- CUniversalSessionProperties sp;
- _pGame->SetMultiPlayerSession(sp);
- if (_pGame->NewGame( fnWorld.FileName(), fnWorld, sp))
- {
- StopMenus();
- _gmRunningGameMode = GM_SPLIT_SCREEN;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-
-void StartSplitScreenGameLoad(void)
-{
-// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
- _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0];
- _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1];
- _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2];
- _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3];
-
- _pGame->gm_strNetworkProvider = "Local";
- if (_pGame->LoadGame( _fnGameToLoad))
- {
- StopMenus();
- _gmRunningGameMode = GM_SPLIT_SCREEN;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
-}
-
-void StartSelectPlayersMenuFromSplit(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
- mgSelectPlayersStart.mg_pActivatedFunction = &StartSplitScreenGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmSplitStartMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-}
-
-void StartSelectPlayersMenuFromNetwork(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = TRUE;
- gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
- mgSelectPlayersStart.mg_pActivatedFunction = &StartNetworkGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmNetworkStartMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-}
-
-void StartSelectPlayersMenuFromOpen(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
- mgSelectPlayersStart.mg_pActivatedFunction = &JoinNetworkGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmNetworkOpenMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-
- /*if (sam_strNetworkSettings=="")*/ {
- void StartNetworkSettingsMenu(void);
- StartNetworkSettingsMenu();
- gmLoadSaveMenu.gm_bNoEscape = TRUE;
- gmLoadSaveMenu.gm_pgmParentMenu = &gmNetworkOpenMenu;
- gmLoadSaveMenu.gm_pgmNextMenu = &gmSelectPlayersMenu;
- }
-}
-void StartSelectPlayersMenuFromServers(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
- mgSelectPlayersStart.mg_pActivatedFunction = &JoinNetworkGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmServersMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-
- /*if (sam_strNetworkSettings=="")*/ {
- void StartNetworkSettingsMenu(void);
- StartNetworkSettingsMenu();
- gmLoadSaveMenu.gm_bNoEscape = TRUE;
- gmLoadSaveMenu.gm_pgmParentMenu = &gmServersMenu;
- gmLoadSaveMenu.gm_pgmNextMenu = &gmSelectPlayersMenu;
- }
-}
-void StartSelectServerLAN(void)
-{
- gmServersMenu.m_bInternet = FALSE;
- ChangeToMenu( &gmServersMenu);
- gmServersMenu.gm_pgmParentMenu = &gmNetworkJoinMenu;
-}
-void StartSelectServerNET(void)
-{
- gmServersMenu.m_bInternet = TRUE;
- ChangeToMenu( &gmServersMenu);
- gmServersMenu.gm_pgmParentMenu = &gmNetworkJoinMenu;
-}
-
-void StartSelectLevelFromSplit(void)
-{
- FilterLevels(SpawnFlagsForGameType(mgSplitGameType.mg_iSelected));
- void StartSplitStartMenu(void);
- _pAfterLevelChosen = StartSplitStartMenu;
- ChangeToMenu( &gmLevelsMenu);
- gmLevelsMenu.gm_pgmParentMenu = &gmSplitStartMenu;
-}
-void StartSelectLevelFromNetwork(void)
-{
- FilterLevels(SpawnFlagsForGameType(mgNetworkGameType.mg_iSelected));
- void StartNetworkStartMenu(void);
- _pAfterLevelChosen = StartNetworkStartMenu;
- ChangeToMenu( &gmLevelsMenu);
- gmLevelsMenu.gm_pgmParentMenu = &gmNetworkStartMenu;
-}
-
-void StartSelectPlayersMenuFromSplitScreen(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
-// mgSelectPlayersStart.mg_pActivatedFunction = &StartSplitScreenGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmSplitScreenMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-}
-void StartSelectPlayersMenuFromNetworkLoad(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
- mgSelectPlayersStart.mg_pActivatedFunction = &StartNetworkLoadGame;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmLoadSaveMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-}
-
-void StartSelectPlayersMenuFromSplitScreenLoad(void)
-{
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
- mgSelectPlayersStart.mg_pActivatedFunction = &StartSplitScreenGameLoad;
- gmSelectPlayersMenu.gm_pgmParentMenu = &gmLoadSaveMenu;
- ChangeToMenu( &gmSelectPlayersMenu);
-}
-
-BOOL LSLoadSinglePlayer(const CTFileName &fnm)
-{
- _pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1;
-
- _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_iSinglePlayer;
- _pGame->gm_aiStartLocalPlayers[1] = -1;
- _pGame->gm_aiStartLocalPlayers[2] = -1;
- _pGame->gm_aiStartLocalPlayers[3] = -1;
- _pGame->gm_strNetworkProvider = "Local";
- if (_pGame->LoadGame(fnm)) {
- StopMenus();
- _gmRunningGameMode = GM_SINGLE_PLAYER;
- } else {
- _gmRunningGameMode = GM_NONE;
- }
- return TRUE;
-}
-BOOL LSLoadNetwork(const CTFileName &fnm)
-{
- // call local players menu
- _fnGameToLoad = fnm;
- StartSelectPlayersMenuFromNetworkLoad();
- return TRUE;
-}
-BOOL LSLoadSplitScreen(const CTFileName &fnm)
-{
- // call local players menu
- _fnGameToLoad = fnm;
- StartSelectPlayersMenuFromSplitScreenLoad();
- return TRUE;
-}
-extern BOOL LSLoadDemo(const CTFileName &fnm)
-{
- // call local players menu
- _fnDemoToPlay = fnm;
- StartDemoPlay();
- return TRUE;
-}
-
-BOOL LSLoadPlayerModel(const CTFileName &fnm)
-{
- // get base filename
- CTString strBaseName = fnm.FileName();
- // set it for current player
- CPlayerCharacter &pc = _pGame->gm_apcPlayers[*gmPlayerProfile.gm_piCurrentPlayer];
- CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance;
- memset(pps->ps_achModelFile, 0, sizeof(pps->ps_achModelFile));
- strncpy(pps->ps_achModelFile, strBaseName, sizeof(pps->ps_achModelFile));
-
- void MenuGoToParent(void);
- MenuGoToParent();
- return TRUE;
-}
-
-BOOL LSLoadControls(const CTFileName &fnm)
-{
- try {
- ControlsMenuOn();
- _pGame->gm_ctrlControlsExtra.Load_t(fnm);
- ControlsMenuOff();
- } catch (char *strError) {
- CPrintF("%s", strError);
- }
-
- void MenuGoToParent(void);
- MenuGoToParent();
- return TRUE;
-}
-
-BOOL LSLoadAddon(const CTFileName &fnm)
-{
- extern INDEX _iAddonExecState;
- extern CTFileName _fnmAddonToExec;
- _iAddonExecState = 1;
- _fnmAddonToExec = fnm;
- return TRUE;
-}
-
-BOOL LSLoadMod(const CTFileName &fnm)
-{
- _fnmModSelected = fnm;
- ModConfirm();
- return TRUE;
-}
-
-BOOL LSLoadCustom(const CTFileName &fnm)
-{
- mgVarTitle.mg_strText = TRANS("ADVANCED OPTIONS");
-// LoadStringVar(fnm.NoExt()+".des", mgVarTitle.mg_strText);
-// mgVarTitle.mg_strText.OnlyFirstLine();
- gmVarMenu.gm_fnmMenuCFG = fnm;
- gmVarMenu.gm_pgmParentMenu = &gmLoadSaveMenu;
- ChangeToMenu( &gmVarMenu);
- return TRUE;
-}
-
-BOOL LSLoadNetSettings(const CTFileName &fnm)
-{
- sam_strNetworkSettings = fnm;
- CTString strCmd;
- strCmd.PrintF("include \"%s\"", (const char*)sam_strNetworkSettings);
- _pShell->Execute(strCmd);
-
- void MenuGoToParent(void);
- MenuGoToParent();
- return TRUE;
-}
-
-// same function for saving in singleplay, network and splitscreen
-BOOL LSSaveAnyGame(const CTFileName &fnm)
-{
- if( _pGame->SaveGame( fnm)) {
- StopMenus();
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOL LSSaveDemo(const CTFileName &fnm)
-{
- // save the demo
- if(_pGame->StartDemoRec(fnm)) {
- StopMenus();
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-// save/load menu calling functions
-void StartPlayerModelLoadMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("CHOOSE MODEL");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Models\\Player\\");
- gmLoadSaveMenu.gm_fnmSelected = _strLastPlayerAppearance;
- gmLoadSaveMenu.gm_fnmExt = CTString(".amc");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadPlayerModel;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmPlayerProfile;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartControlsLoadMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("LOAD CONTROLS");
- gmLoadSaveMenu.gm_bAllowThumbnails = FALSE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Controls\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".ctl");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadControls;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmControls;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartCustomLoadMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("ADVANCED OPTIONS");
- gmLoadSaveMenu.gm_bAllowThumbnails = FALSE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".cfg");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadCustom;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartAddonsLoadMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("EXECUTE ADDON");
- gmLoadSaveMenu.gm_bAllowThumbnails = FALSE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\Addons\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".ini");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadAddon;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartModsLoadMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("CHOOSE MOD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Mods\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".des");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadMod;
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmMainMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartNetworkSettingsMenu(void)
-{
- mgLoadSaveTitle.mg_strText = TRANS("CONNECTION SETTINGS");
- gmLoadSaveMenu.gm_bAllowThumbnails = FALSE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = FALSE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\NetSettings\\");
- gmLoadSaveMenu.gm_fnmSelected = sam_strNetworkSettings;
- gmLoadSaveMenu.gm_fnmExt = CTString(".ini");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetSettings;
- if (sam_strNetworkSettings=="") {
- mgLoadSaveNotes.mg_strText = TRANS(
- "Before joining a network game,\n"
- "you have to adjust your connection parameters.\n"
- "Choose one option from the list.\n"
- "If you have problems with connection, you can adjust\n"
- "these parameters again from the Options menu.\n"
- );
- } else {
- mgLoadSaveNotes.mg_strText = "";
- }
-
- gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void SetQuickLoadNotes(void)
-{
- if (_pShell->GetINDEX("gam_iQuickSaveSlots")<=8) {
- mgLoadSaveNotes.mg_strText = TRANS(
- "In-game QuickSave shortcuts:\n"
- "F6 - save a new QuickSave\n"
- "F9 - load the last QuickSave\n");
- } else {
- mgLoadSaveNotes.mg_strText = "";
- }
-}
-
-void StartSinglePlayerQuickLoadMenu(void)
-{
- _gmMenuGameMode = GM_SINGLE_PLAYER;
-
- mgLoadSaveTitle.mg_strText = TRANS("QUICK LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\Quick\\", _pGame->gm_iSinglePlayer);
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer;
- SetQuickLoadNotes();
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartSinglePlayerLoadMenu(void)
-{
- _gmMenuGameMode = GM_SINGLE_PLAYER;
-
- mgLoadSaveTitle.mg_strText = TRANS("LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer);
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-void StartSinglePlayerSaveMenu(void)
-{
- if( _gmRunningGameMode != GM_SINGLE_PLAYER) return;
- // if no live players
- if (_pGame->GetPlayersCount()>0 && _pGame->GetLivePlayersCount()<=0) {
- // do nothing
- return;
- }
- _gmMenuGameMode = GM_SINGLE_PLAYER;
- mgLoadSaveTitle.mg_strText = TRANS("SAVE");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = TRUE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer);
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame;
- mgLoadSaveNotes.mg_strText = "";
- gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-void StartDemoLoadMenu(void)
-{
- _gmMenuGameMode = GM_DEMO;
-
- mgLoadSaveTitle.mg_strText = TRANS("PLAY DEMO");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".dem");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadDemo;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-void StartDemoSaveMenu(void)
-{
- if( _gmRunningGameMode == GM_NONE) return;
- _gmMenuGameMode = GM_DEMO;
-
- mgLoadSaveTitle.mg_strText = TRANS("RECORD DEMO");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP;
- gmLoadSaveMenu.gm_bSave = TRUE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmBaseName = CTString("Demo");
- gmLoadSaveMenu.gm_fnmExt = CTString(".dem");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveDemo;
- mgLoadSaveNotes.mg_strText = "";
- gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(FALSE);
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartNetworkQuickLoadMenu(void)
-{
- _gmMenuGameMode = GM_NETWORK;
-
- mgLoadSaveTitle.mg_strText = TRANS("QUICK LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\Quick\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork;
- SetQuickLoadNotes();
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartNetworkLoadMenu(void)
-{
- _gmMenuGameMode = GM_NETWORK;
-
- mgLoadSaveTitle.mg_strText = TRANS("LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartNetworkSaveMenu(void)
-{
- if( _gmRunningGameMode != GM_NETWORK) return;
- _gmMenuGameMode = GM_NETWORK;
-
- mgLoadSaveTitle.mg_strText = TRANS("SAVE");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = TRUE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame;
- mgLoadSaveNotes.mg_strText = "";
- gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartSplitScreenQuickLoadMenu(void)
-{
- _gmMenuGameMode = GM_SPLIT_SCREEN;
-
- mgLoadSaveTitle.mg_strText = TRANS("QUICK LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\Quick\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen;
- SetQuickLoadNotes();
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-void StartSplitScreenLoadMenu(void)
-{
- _gmMenuGameMode = GM_SPLIT_SCREEN;
-
- mgLoadSaveTitle.mg_strText = TRANS("LOAD");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = FALSE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen;
- mgLoadSaveNotes.mg_strText = "";
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-void StartSplitScreenSaveMenu(void)
-{
- if( _gmRunningGameMode != GM_SPLIT_SCREEN) return;
- _gmMenuGameMode = GM_SPLIT_SCREEN;
-
- mgLoadSaveTitle.mg_strText = TRANS("SAVE");
- gmLoadSaveMenu.gm_bAllowThumbnails = TRUE;
- gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN;
- gmLoadSaveMenu.gm_bSave = TRUE;
- gmLoadSaveMenu.gm_bManage = TRUE;
- gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\");
- gmLoadSaveMenu.gm_fnmSelected = CTString("");
- gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame");
- gmLoadSaveMenu.gm_fnmExt = CTString(".sav");
- gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame;
- mgLoadSaveNotes.mg_strText = "";
- gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE);
-
- gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmLoadSaveMenu);
-}
-
-// game options var settings
-void StartVarGameOptions(void)
-{
- mgVarTitle.mg_strText = TRANS("GAME OPTIONS");
- gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg");
- ChangeToMenu( &gmVarMenu);
-}
-void StartSinglePlayerGameOptions(void)
-{
- mgVarTitle.mg_strText = TRANS("GAME OPTIONS");
- gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg");
- ChangeToMenu( &gmVarMenu);
- gmVarMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
-}
-
-
-void StartGameOptionsFromNetwork(void)
-{
- StartVarGameOptions();
- gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu;
-}
-
-void StartGameOptionsFromSplitScreen(void)
-{
- StartVarGameOptions();
- gmVarMenu.gm_pgmParentMenu = &gmSplitStartMenu;
-}
-
-// rendering options var settings
-void StartRenderingOptionsMenu(void)
-{
- mgVarTitle.mg_strText = TRANS("RENDERING OPTIONS");
- gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg");
- gmVarMenu.gm_pgmParentMenu = &gmVideoOptionsMenu;
- ChangeToMenu( &gmVarMenu);
-}
-
-void StartCustomizeKeyboardMenu(void)
-{
- ChangeToMenu( &gmCustomizeKeyboardMenu);
-}
-void StartCustomizeAxisMenu(void)
-{
- ChangeToMenu( &gmCustomizeAxisMenu);
-}
-void StopRecordingDemo(void)
-{
- _pNetwork->StopDemoRec();
- void SetDemoStartStopRecText(void);
- SetDemoStartStopRecText();
-}
-void StartOptionsMenu(void)
-{
- gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu;
- ChangeToMenu( &gmOptionsMenu);
-}
-static void ResolutionToSize(INDEX iRes, PIX &pixSizeI, PIX &pixSizeJ)
-{
- ASSERT(iRes>=0 && iRes<_ctResolutions);
- CDisplayMode &dm = _admResolutionModes[iRes];
- pixSizeI = dm.dm_pixSizeI;
- pixSizeJ = dm.dm_pixSizeJ;
-}
-static void SizeToResolution(PIX pixSizeI, PIX pixSizeJ, INDEX &iRes)
-{
- for(iRes=0; iRes<_ctResolutions; iRes++) {
- CDisplayMode &dm = _admResolutionModes[iRes];
- if (dm.dm_pixSizeI==pixSizeI && dm.dm_pixSizeJ==pixSizeJ) {
- return;
- }
- }
- // if none was found, search for default
- for(iRes=0; iRes<_ctResolutions; iRes++) {
- CDisplayMode &dm = _admResolutionModes[iRes];
- if (dm.dm_pixSizeI==640 && dm.dm_pixSizeJ==480) {
- return;
- }
- }
- // if still none found
- ASSERT(FALSE); // this should never happen
- // return first one
- iRes = 0;
-}
-
-
-static INDEX APIToSwitch(enum GfxAPIType gat)
-{
- switch(gat) {
- case GAT_OGL: return 0;
-#ifdef SE1_D3D
- case GAT_D3D: return 1;
-#endif // SE1_D3D
- default: ASSERT(FALSE); return 0;
- }
-}
-static enum GfxAPIType SwitchToAPI(INDEX i)
-{
- switch(i) {
- case 0: return GAT_OGL;
-#ifdef SE1_D3D
- case 1: return GAT_D3D;
-#endif // SE1_D3D
- default: ASSERT(FALSE); return GAT_OGL;
- }
-}
-
-static INDEX DepthToSwitch(enum DisplayDepth dd)
-{
- switch(dd) {
- case DD_DEFAULT: return 0;
- case DD_16BIT : return 1;
- case DD_32BIT : return 2;
- default: ASSERT(FALSE); return 0;
- }
-}
-static enum DisplayDepth SwitchToDepth(INDEX i)
-{
- switch(i) {
- case 0: return DD_DEFAULT;
- case 1: return DD_16BIT;
- case 2: return DD_32BIT;
- default: ASSERT(FALSE); return DD_DEFAULT;
- }
-}
-
-static void InitVideoOptionsButtons(void);
-static void UpdateVideoOptionsButtons(INDEX i);
-
-void RevertVideoSettings(void)
-{
- // restore previous variables
- sam_bFullScreenActive = sam_old_bFullScreenActive;
- sam_iScreenSizeI = sam_old_iScreenSizeI;
- sam_iScreenSizeJ = sam_old_iScreenSizeJ;
- sam_iDisplayDepth = sam_old_iDisplayDepth;
- sam_iDisplayAdapter = sam_old_iDisplayAdapter;
- sam_iGfxAPI = sam_old_iGfxAPI;
- sam_iVideoSetup = sam_old_iVideoSetup;
-
- // update the video mode
- extern void ApplyVideoMode(void);
- ApplyVideoMode();
-
- // refresh buttons
- InitVideoOptionsButtons();
- UpdateVideoOptionsButtons(-1);
-}
-
-void ApplyVideoOptions(void)
-{
- sam_old_bFullScreenActive = sam_bFullScreenActive;
- sam_old_iScreenSizeI = sam_iScreenSizeI;
- sam_old_iScreenSizeJ = sam_iScreenSizeJ;
- sam_old_iDisplayDepth = sam_iDisplayDepth;
- sam_old_iDisplayAdapter = sam_iDisplayAdapter;
- sam_old_iGfxAPI = sam_iGfxAPI;
- sam_old_iVideoSetup = sam_iVideoSetup;
-
- BOOL bFullScreenMode = mgFullScreenTrigger.mg_iSelected == 1;
- PIX pixWindowSizeI, pixWindowSizeJ;
- ResolutionToSize(mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ);
- enum GfxAPIType gat = SwitchToAPI(mgDisplayAPITrigger.mg_iSelected);
- enum DisplayDepth dd = SwitchToDepth(mgBitsPerPixelTrigger.mg_iSelected);
- const INDEX iAdapter = mgDisplayAdaptersTrigger.mg_iSelected;
-
- // setup preferences
- extern INDEX _iLastPreferences;
- if( sam_iVideoSetup==3) _iLastPreferences = 3;
- sam_iVideoSetup = mgDisplayPrefsTrigger.mg_iSelected;
-
- // force fullscreen mode if needed
- CDisplayAdapter &da = _pGfx->gl_gaAPI[gat].ga_adaAdapter[iAdapter];
- if( da.da_ulFlags & DAF_FULLSCREENONLY) bFullScreenMode = TRUE;
- if( da.da_ulFlags & DAF_16BITONLY) dd = DD_16BIT;
- // force window to always be in default colors
- if( !bFullScreenMode) dd = DD_DEFAULT;
-
- // (try to) set mode
- StartNewMode( gat, iAdapter, pixWindowSizeI, pixWindowSizeJ, dd, bFullScreenMode);
-
- // refresh buttons
- InitVideoOptionsButtons();
- UpdateVideoOptionsButtons(-1);
-
- // ask user to keep or restore
- if( bFullScreenMode) VideoConfirm();
-}
-
-#define VOLUME_STEPS 50
-
-void RefreshSoundFormat( void)
-{
- switch( _pSound->GetFormat())
- {
- case CSoundLibrary::SF_NONE: {mgFrequencyTrigger.mg_iSelected = 0;break;}
- case CSoundLibrary::SF_11025_16: {mgFrequencyTrigger.mg_iSelected = 1;break;}
- case CSoundLibrary::SF_22050_16: {mgFrequencyTrigger.mg_iSelected = 2;break;}
- case CSoundLibrary::SF_44100_16: {mgFrequencyTrigger.mg_iSelected = 3;break;}
- default: mgFrequencyTrigger.mg_iSelected = 0;
- }
-
- mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1);
- mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L);
-
- mgWaveVolume.mg_iMinPos = 0;
- mgWaveVolume.mg_iMaxPos = VOLUME_STEPS;
- mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS +0.5f);
- mgWaveVolume.ApplyCurrentPosition();
-
- mgMPEGVolume.mg_iMinPos = 0;
- mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS;
- mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS +0.5f);
- mgMPEGVolume.ApplyCurrentPosition();
-
- mgAudioAutoTrigger.ApplyCurrentSelection();
- mgAudioAPITrigger.ApplyCurrentSelection();
- mgFrequencyTrigger.ApplyCurrentSelection();
-}
-
-void ApplyAudioOptions(void)
-{
- sam_bAutoAdjustAudio = mgAudioAutoTrigger.mg_iSelected;
- if (sam_bAutoAdjustAudio) {
- _pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\"");
- } else {
- _pShell->SetINDEX("snd_iInterface", mgAudioAPITrigger.mg_iSelected);
-
- switch( mgFrequencyTrigger.mg_iSelected)
- {
- case 0: {_pSound->SetFormat(CSoundLibrary::SF_NONE) ;break;}
- case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16);break;}
- case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16);break;}
- case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16);break;}
- default: _pSound->SetFormat(CSoundLibrary::SF_NONE);
- }
- }
-
- RefreshSoundFormat();
- snd_iFormat = _pSound->GetFormat();
-}
-
-void StartVideoOptionsMenu(void)
-{
- ChangeToMenu( &gmVideoOptionsMenu);
-}
-
-void StartAudioOptionsMenu(void)
-{
- ChangeToMenu( &gmAudioOptionsMenu);
-}
-
-void StartNetworkMenu(void)
-{
- ChangeToMenu( &gmNetworkMenu);
-}
-void StartNetworkJoinMenu(void)
-{
- ChangeToMenu( &gmNetworkJoinMenu);
-}
-void StartNetworkStartMenu(void)
-{
- ChangeToMenu( &gmNetworkStartMenu);
-}
-
-void StartNetworkOpenMenu(void)
-{
- ChangeToMenu( &gmNetworkOpenMenu);
-}
-
-void StartSplitScreenMenu(void)
-{
- ChangeToMenu( &gmSplitScreenMenu);
-}
-void StartSplitStartMenu(void)
-{
- ChangeToMenu( &gmSplitStartMenu);
-}
-
-// initialize game type strings table
-void InitGameTypes(void)
-{
- // get function that will provide us the info about gametype
- CShellSymbol *pss = _pShell->GetSymbol("GetGameTypeNameSS", /*bDeclaredOnly=*/ TRUE);
- // if none
- if (pss==NULL) {
- // error
- astrGameTypeRadioTexts[0] = "??>";
- ctGameTypeRadioTexts = 1;
- return;
- }
-
- // for each mode
- for(ctGameTypeRadioTexts=0; ctGameTypeRadioTextsss_pvValue;
- CTString strMode = pFunc(ctGameTypeRadioTexts);
- // if no mode modes
- if (strMode=="") {
- // stop
- break;
- }
- // add that mode
- astrGameTypeRadioTexts[ctGameTypeRadioTexts] = strMode;
- }
-}
-
-
-// ------------------------ Global menu function implementation
-void InitializeMenus(void)
-{
- try {
- // initialize and load corresponding fonts
- _fdSmall.Load_t( CTFILENAME( "Fonts\\Display3-narrow.fnt"));
- _fdMedium.Load_t( CTFILENAME( "Fonts\\Display3-normal.fnt"));
- _fdBig.Load_t( CTFILENAME( "Fonts\\Display3-caps.fnt"));
- _fdTitle.Load_t( CTFILENAME( "Fonts\\Title2.fnt"));
- _fdSmall.SetCharSpacing(-1);
- _fdSmall.SetLineSpacing( 0);
- _fdSmall.SetSpaceWidth(0.4f);
- _fdMedium.SetCharSpacing(+1);
- _fdMedium.SetLineSpacing( 0);
- _fdMedium.SetSpaceWidth(0.4f);
- _fdBig.SetCharSpacing(+1);
- _fdBig.SetLineSpacing( 0);
- _fdTitle.SetCharSpacing(+1);
- _fdTitle.SetLineSpacing( 0);
-
- // load menu sounds
- _psdSelect = _pSoundStock->Obtain_t( CTFILENAME("Sounds\\Menu\\Select.wav"));
- _psdPress = _pSoundStock->Obtain_t( CTFILENAME("Sounds\\Menu\\Press.wav"));
- _psoMenuSound = new CSoundObject;
-
- // initialize and load menu textures
- _toPointer.SetData_t( CTFILENAME( "Textures\\General\\Pointer.tex"));
-#if _SE_DEMO || TECHTESTONLY
- _toLogoMenuA.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256a_demo.tex"));
- _toLogoMenuB.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256b_demo.tex"));
-#else
- _toLogoMenuA.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256a.tex"));
- _toLogoMenuB.SetData_t( CTFILENAME( "Textures\\Logo\\sam_menulogo256b.tex"));
-#endif
- }
- catch( char *strError) {
- FatalError( strError);
- }
- // force logo textures to be of maximal size
- ((CTextureData*)_toLogoMenuA.GetData())->Force(TEX_CONSTANT);
- ((CTextureData*)_toLogoMenuB.GetData())->Force(TEX_CONSTANT);
-
- // menu's relative placement
- CPlacement3D plRelative = CPlacement3D( FLOAT3D( 0.0f, 0.0f, -9.0f),
- ANGLE3D( AngleDeg(0.0f), AngleDeg(0.0f), AngleDeg(0.0f)));
- try
- {
- TRANSLATERADIOARRAY(astrNoYes);
- TRANSLATERADIOARRAY(astrComputerInvoke);
- TRANSLATERADIOARRAY(astrDisplayAPIRadioTexts);
- TRANSLATERADIOARRAY(astrDisplayPrefsRadioTexts);
- TRANSLATERADIOARRAY(astrBitsPerPixelRadioTexts);
- TRANSLATERADIOARRAY(astrFrequencyRadioTexts);
- TRANSLATERADIOARRAY(astrSoundAPIRadioTexts);
- TRANSLATERADIOARRAY(astrDifficultyRadioTexts);
- TRANSLATERADIOARRAY(astrMaxPlayersRadioTexts);
- TRANSLATERADIOARRAY(astrWeapon);
- TRANSLATERADIOARRAY(astrSplitScreenRadioTexts);
-
- // initialize game type strings table
- InitGameTypes();
-
- // ------------------- Initialize menus
- gmConfirmMenu.Initialize_t();
- gmConfirmMenu.gm_strName="Confirm";
- gmConfirmMenu.gm_pmgSelectedByDefault = &mgConfirmYes;
- gmConfirmMenu.gm_pgmParentMenu = NULL;
-
- gmMainMenu.Initialize_t();
- gmMainMenu.gm_strName="Main";
- gmMainMenu.gm_pmgSelectedByDefault = &mgMainSingle;
- gmMainMenu.gm_pgmParentMenu = NULL;
-
- gmInGameMenu.Initialize_t();
- gmInGameMenu.gm_strName="InGame";
- gmInGameMenu.gm_pmgSelectedByDefault = &mgInGameQuickLoad;
- gmInGameMenu.gm_pgmParentMenu = NULL;
-
- gmSinglePlayerMenu.Initialize_t();
- gmSinglePlayerMenu.gm_strName="SinglePlayer";
- gmSinglePlayerMenu.gm_pmgSelectedByDefault = &mgSingleNewGame;
- gmSinglePlayerMenu.gm_pgmParentMenu = &gmMainMenu;
-
- gmSinglePlayerNewMenu.Initialize_t();
- gmSinglePlayerNewMenu.gm_strName="SinglePlayerNew";
- gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &mgSingleNewMedium;
- gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
-
- gmDisabledFunction.Initialize_t();
- gmDisabledFunction.gm_strName="DisabledFunction";
- gmDisabledFunction.gm_pmgSelectedByDefault = &mgDisabledMenuButton;
- gmDisabledFunction.gm_pgmParentMenu = NULL;
-
- gmPlayerProfile.Initialize_t();
- gmPlayerProfile.gm_strName="PlayerProfile";
- gmPlayerProfile.gm_pmgSelectedByDefault = &mgPlayerName;
-
- gmControls.Initialize_t();
- gmControls.gm_strName="Controls";
- gmControls.gm_pmgSelectedByDefault = &mgControlsButtons;
-
- // warning! parent menu has to be set inside button activate function from where
- // Load/Save menu is called
- gmLoadSaveMenu.Initialize_t();
- gmLoadSaveMenu.gm_strName="LoadSave";
- gmLoadSaveMenu.gm_pmgSelectedByDefault = &amgLSButton[0];
-
- gmHighScoreMenu.Initialize_t();
- gmHighScoreMenu.gm_strName="HighScore";
- gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack;
-
- gmCustomizeKeyboardMenu.Initialize_t();
- gmCustomizeKeyboardMenu.gm_strName="CustomizeKeyboard";
- gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &mgKey[0];
- gmCustomizeKeyboardMenu.gm_pgmParentMenu = &gmControls;
-
- gmCustomizeAxisMenu.Initialize_t();
- gmCustomizeAxisMenu.gm_strName="CustomizeAxis";
- gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &mgAxisActionTrigger;
- gmCustomizeAxisMenu.gm_pgmParentMenu = &gmControls;
-
- gmOptionsMenu.Initialize_t();
- gmOptionsMenu.gm_strName="Options";
- gmOptionsMenu.gm_pmgSelectedByDefault = &mgVideoOptions;
- gmOptionsMenu.gm_pgmParentMenu = &gmMainMenu;
-
- gmVideoOptionsMenu.Initialize_t();
- gmVideoOptionsMenu.gm_strName="VideoOptions";
- gmVideoOptionsMenu.gm_pmgSelectedByDefault = &mgDisplayAPITrigger;
- gmVideoOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu;
-
- gmAudioOptionsMenu.Initialize_t();
- gmAudioOptionsMenu.gm_strName="AudioOptions";
- gmAudioOptionsMenu.gm_pmgSelectedByDefault = &mgFrequencyTrigger;
- gmAudioOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu;
-
- gmLevelsMenu.Initialize_t();
- gmLevelsMenu.gm_strName="Levels";
- gmLevelsMenu.gm_pmgSelectedByDefault = &mgManualLevel[0];
- gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
-
- gmVarMenu.Initialize_t();
- gmVarMenu.gm_strName="Var";
- gmVarMenu.gm_pmgSelectedByDefault = &mgVar[0];
- gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu;
-
- gmServersMenu.Initialize_t();
- gmServersMenu.gm_strName="Servers";
- gmServersMenu.gm_pmgSelectedByDefault = &mgServerList;
- gmServersMenu.gm_pgmParentMenu = &gmNetworkOpenMenu;
-
- gmNetworkMenu.Initialize_t();
- gmNetworkMenu.gm_strName="Network";
- gmNetworkMenu.gm_pmgSelectedByDefault = &mgNetworkJoin;
- gmNetworkMenu.gm_pgmParentMenu = &gmMainMenu;
-
- gmNetworkStartMenu.Initialize_t();
- gmNetworkStartMenu.gm_strName="NetworkStart";
- gmNetworkStartMenu.gm_pmgSelectedByDefault = &mgNetworkStartStart;
- gmNetworkStartMenu.gm_pgmParentMenu = &gmNetworkMenu;
-
- gmNetworkJoinMenu.Initialize_t();
- gmNetworkJoinMenu.gm_strName="NetworkJoin";
- gmNetworkJoinMenu.gm_pmgSelectedByDefault = &mgNetworkJoinLAN;
- gmNetworkJoinMenu.gm_pgmParentMenu = &gmNetworkMenu;
-
- gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
- gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
- gmSelectPlayersMenu.Initialize_t();
- gmSelectPlayersMenu.gm_strName="SelectPlayers";
- gmSelectPlayersMenu.gm_pmgSelectedByDefault = &mgSelectPlayersStart;
-
- gmNetworkOpenMenu.Initialize_t();
- gmNetworkOpenMenu.gm_strName="NetworkOpen";
- gmNetworkOpenMenu.gm_pmgSelectedByDefault = &mgNetworkOpenJoin;
- gmNetworkOpenMenu.gm_pgmParentMenu = &gmNetworkJoinMenu;
-
- gmSplitScreenMenu.Initialize_t();
- gmSplitScreenMenu.gm_strName="SplitScreen";
- gmSplitScreenMenu.gm_pmgSelectedByDefault = &mgSplitScreenStart;
- gmSplitScreenMenu.gm_pgmParentMenu = &gmMainMenu;
-
- gmSplitStartMenu.Initialize_t();
- gmSplitStartMenu.gm_strName="SplitStart";
- gmSplitStartMenu.gm_pmgSelectedByDefault = &mgSplitStartStart;
- gmSplitStartMenu.gm_pgmParentMenu = &gmSplitScreenMenu;
- }
- catch( char *strError)
- {
- FatalError( strError);
- }
-}
-
-
-void DestroyMenus( void)
-{
- gmMainMenu.Destroy();
- pgmCurrentMenu = NULL;
- _pSoundStock->Release(_psdSelect);
- _pSoundStock->Release(_psdPress);
- delete _psoMenuSound;
- _psdSelect = NULL;
- _psdPress = NULL;
- _psoMenuSound = NULL;
-}
-
-// go to parent menu if possible
-void MenuGoToParent(void)
-{
- // if there is no parent menu
- if( pgmCurrentMenu->gm_pgmParentMenu == NULL) {
- // if in game
- if (_gmRunningGameMode!=GM_NONE) {
- // exit menus
- StopMenus();
- // if no game is running
- } else {
- // go to main menu
- ChangeToMenu( &gmMainMenu);
- }
- // if there is some parent menu
- } else {
- // go to parent menu
- ChangeToMenu( pgmCurrentMenu->gm_pgmParentMenu);
- }
-}
-
-void MenuOnKeyDown( int iVKey)
-{
-
- // check if mouse buttons used
- _bMouseUsedLast = (iVKey==VK_LBUTTON || iVKey==VK_RBUTTON || iVKey==VK_MBUTTON
- || iVKey==10 || iVKey==11);
-
- // ignore mouse when editing
- if (_bEditingString && _bMouseUsedLast) {
- _bMouseUsedLast = FALSE;
- return;
- }
-
- // initially the message is not handled
- BOOL bHandled = FALSE;
-
- // if not a mouse button, or mouse is over some gadget
- if (!_bMouseUsedLast || _pmgUnderCursor!=NULL) {
- // ask current menu to handle the key
- bHandled = pgmCurrentMenu->OnKeyDown( iVKey);
- }
-
- // if not handled
- if(!bHandled) {
- // if escape or right mouse pressed
- if(iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) {
- if (pgmCurrentMenu==&gmLoadSaveMenu && gmLoadSaveMenu.gm_bNoEscape) {
- return;
- }
- // go to parent menu if possible
- MenuGoToParent();
- }
- }
-}
-
-void MenuOnChar(MSG msg)
-{
- // check if mouse buttons used
- _bMouseUsedLast = FALSE;
-
- // ask current menu to handle the key
- pgmCurrentMenu->OnChar(msg);
-}
-
-void MenuOnMouseMove(PIX pixI, PIX pixJ)
-{
- static PIX pixLastI = 0;
- static PIX pixLastJ = 0;
- if (pixLastI==pixI && pixLastJ==pixJ) {
- return;
- }
- pixLastI = pixI;
- pixLastJ = pixJ;
- _bMouseUsedLast = !_bEditingString && !_bDefiningKey && !_pInput->IsInputEnabled();
-}
-
-void MenuUpdateMouseFocus(void)
-{
- // get real cursor position
- POINT pt;
- GetCursorPos(&pt);
- ScreenToClient(_hwndMain, &pt);
- extern INDEX sam_bWideScreen;
- extern CDrawPort *pdp;
- if( sam_bWideScreen) {
- const PIX pixHeight = pdp->GetHeight();
- pt.y -= (pixHeight/0.75f-pixHeight)/2;
- }
- _pixCursorPosI += pt.x-_pixCursorExternPosI;
- _pixCursorPosJ = _pixCursorExternPosJ;
- _pixCursorExternPosI = pt.x;
- _pixCursorExternPosJ = pt.y;
-
- // if mouse not used last
- if (!_bMouseUsedLast||_bDefiningKey||_bEditingString) {
- // do nothing
- return;
- }
-
- CMenuGadget *pmgActive = NULL;
- // for all gadgets in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- CMenuGadget &mg = *itmg;
- // if focused
- if( itmg->mg_bFocused) {
- // remember it
- pmgActive = &itmg.Current();
- }
- }
-
- // if there is some under cursor
- if (_pmgUnderCursor!=NULL) {
- _pmgUnderCursor->OnMouseOver(_pixCursorPosI, _pixCursorPosJ);
- // if the one under cursor has no neighbours
- if (_pmgUnderCursor->mg_pmgLeft ==NULL
- &&_pmgUnderCursor->mg_pmgRight==NULL
- &&_pmgUnderCursor->mg_pmgUp ==NULL
- &&_pmgUnderCursor->mg_pmgDown ==NULL) {
- // it cannot be focused
- _pmgUnderCursor = NULL;
- return;
- }
-
- // if the one under cursor is not active and not disappearing
- if (pmgActive!=_pmgUnderCursor && _pmgUnderCursor->mg_bVisible) {
- // change focus
- if (pmgActive!=NULL) {
- pmgActive->OnKillFocus();
- }
- _pmgUnderCursor->OnSetFocus();
- }
- }
-}
-
-static CTimerValue _tvInitialization;
-static TIME _tmInitializationTick = -1;
-extern TIME _tmMenuLastTickDone;
-
-void SetMenuLerping(void)
-{
- CTimerValue tvNow = _pTimer->GetHighPrecisionTimer();
-
- // if lerping was never set before
- if (_tmInitializationTick<0) {
- // initialize it
- _tvInitialization = tvNow;
- _tmInitializationTick = _tmMenuLastTickDone;
- }
-
- // get passed time from session state starting in precise time and in ticks
- FLOAT tmRealDelta = FLOAT((tvNow-_tvInitialization).GetSeconds());
- FLOAT tmTickDelta = _tmMenuLastTickDone-_tmInitializationTick;
- // calculate factor
- FLOAT fFactor = 1.0f-(tmTickDelta-tmRealDelta)/_pTimer->TickQuantum;
-
- // if the factor starts getting below zero
- if (fFactor<0) {
- // clamp it
- fFactor = 0.0f;
- // readjust timers so that it gets better
- _tvInitialization = tvNow;
- _tmInitializationTick = _tmMenuLastTickDone-_pTimer->TickQuantum;
- }
- if (fFactor>1) {
- // clamp it
- fFactor = 1.0f;
- // readjust timers so that it gets better
- _tvInitialization = tvNow;
- _tmInitializationTick = _tmMenuLastTickDone;
- }
- // set lerping factor and timer
- _pTimer->SetCurrentTick(_tmMenuLastTickDone);
- _pTimer->SetLerp(fFactor);
-}
-
-
-// render mouse cursor if needed
-void RenderMouseCursor(CDrawPort *pdp)
-{
- // if mouse not used last
- if (!_bMouseUsedLast|| _bDefiningKey || _bEditingString) {
- // don't render cursor
- return;
- }
- LCDSetDrawport(pdp);
- LCDDrawPointer(_pixCursorPosI, _pixCursorPosJ);
-}
-
-
-BOOL DoMenu( CDrawPort *pdp)
-{
- pdp->Unlock();
- CDrawPort dpMenu(pdp, TRUE);
- dpMenu.Lock();
-
- MenuUpdateMouseFocus();
-
- // if in fullscreen
- CDisplayMode dmCurrent;
- _pGfx->GetCurrentDisplayMode(dmCurrent);
- if (dmCurrent.IsFullScreen()) {
- // clamp mouse pointer
- _pixCursorPosI = Clamp(_pixCursorPosI, 0L, dpMenu.GetWidth());
- _pixCursorPosJ = Clamp(_pixCursorPosJ, 0L, dpMenu.GetHeight());
- // if in window
- } else {
- // use same mouse pointer as windows
- _pixCursorPosI = _pixCursorExternPosI;
- _pixCursorPosJ = _pixCursorExternPosJ;
- }
-
- pgmCurrentMenu->Think();
-
- TIME tmTickNow = _pTimer->GetRealTimeTick();
-
- while( _tmMenuLastTickDoneSetCurrentTick(_tmMenuLastTickDone);
- // call think for all gadgets in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- itmg->Think();
- }
- _tmMenuLastTickDone+=_pTimer->TickQuantum;
- }
-
- SetMenuLerping();
-
- PIX pixW = dpMenu.GetWidth();
- PIX pixH = dpMenu.GetHeight();
-
- // blend background if menu is on
- if( bMenuActive)
- {
- // get current time
- TIME tmNow = _pTimer->GetLerpedCurrentTick();
- UBYTE ubH1 = (INDEX)(tmNow*08.7f) & 255;
- UBYTE ubH2 = (INDEX)(tmNow*27.6f) & 255;
- UBYTE ubH3 = (INDEX)(tmNow*16.5f) & 255;
- UBYTE ubH4 = (INDEX)(tmNow*35.4f) & 255;
-
- // clear screen with background texture
- LCDPrepare(1.0f);
- LCDSetDrawport(&dpMenu);
- // do not allow game to show through
- dpMenu.Fill(C_BLACK|255);
- LCDRenderClouds1();
- LCDRenderGrid();
- LCDRenderClouds2();
-
- FLOAT fScaleW = (FLOAT)pixW / 640.0f;
- FLOAT fScaleH = (FLOAT)pixH / 480.0f;
- PIX pixI0, pixJ0, pixI1, pixJ1;
- // put logo(s) to main menu (if logos exist)
- if( pgmCurrentMenu==&gmMainMenu)
- {
- if( _ptoLogoODI!=NULL) {
- CTextureData &td = (CTextureData&)*_ptoLogoODI->GetData();
- #define LOGOSIZE 50
- const PIX pixLogoWidth = LOGOSIZE * dpMenu.dp_fWideAdjustment;
- const PIX pixLogoHeight = LOGOSIZE* td.GetHeight() / td.GetWidth();
- pixI0 = (640-pixLogoWidth -16)*fScaleW;
- pixJ0 = (480-pixLogoHeight-16)*fScaleH;
- pixI1 = pixI0+ pixLogoWidth *fScaleW;
- pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
- dpMenu.PutTexture( _ptoLogoODI, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
- #undef LOGOSIZE
- }
- if( _ptoLogoCT!=NULL) {
- CTextureData &td = (CTextureData&)*_ptoLogoCT->GetData();
- #define LOGOSIZE 50
- const PIX pixLogoWidth = LOGOSIZE * dpMenu.dp_fWideAdjustment;
- const PIX pixLogoHeight = LOGOSIZE* td.GetHeight() / td.GetWidth();
- pixI0 = 12*fScaleW;
- pixJ0 = (480-pixLogoHeight-16)*fScaleH;
- pixI1 = pixI0+ pixLogoWidth *fScaleW;
- pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
- dpMenu.PutTexture( _ptoLogoCT, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
- #undef LOGOSIZE
- }
-
- {
- FLOAT fResize = Min(dpMenu.GetWidth()/640.0f, dpMenu.GetHeight()/480.0f);
- PIX pixSizeI = 256*fResize;
- PIX pixSizeJ = 64*fResize;
- PIX pixCenterI = dpMenu.GetWidth()/2;
- PIX pixHeightJ = 10*fResize;
- dpMenu.PutTexture(&_toLogoMenuA, PIXaabbox2D(
- PIX2D( pixCenterI-pixSizeI, pixHeightJ),PIX2D( pixCenterI, pixHeightJ+pixSizeJ)));
- dpMenu.PutTexture(&_toLogoMenuB, PIXaabbox2D(
- PIX2D( pixCenterI, pixHeightJ),PIX2D( pixCenterI+pixSizeI, pixHeightJ+pixSizeJ)));
- }
- } else if (pgmCurrentMenu==&gmAudioOptionsMenu) {
- if( _ptoLogoEAX!=NULL) {
- CTextureData &td = (CTextureData&)*_ptoLogoEAX->GetData();
- const INDEX iSize = 95;
- const PIX pixLogoWidth = iSize * dpMenu.dp_fWideAdjustment;
- const PIX pixLogoHeight = iSize * td.GetHeight() / td.GetWidth();
- pixI0 = (640-pixLogoWidth - 35)*fScaleW;
- pixJ0 = (480-pixLogoHeight - 7)*fScaleH;
- pixI1 = pixI0+ pixLogoWidth *fScaleW;
- pixJ1 = pixJ0+ pixLogoHeight*fScaleH;
- dpMenu.PutTexture( _ptoLogoEAX, PIXaabbox2D( PIX2D( pixI0, pixJ0),PIX2D( pixI1, pixJ1)));
- }
- }
-
-#define THUMBW 96
-#define THUMBH 96
- // if there is a thumbnail
- if( _bThumbnailOn) {
- const FLOAT fThumbScaleW = fScaleW * dpMenu.dp_fWideAdjustment;
- PIX pixOfs = 8*fScaleW;
- pixI0 = 8*fScaleW;
- pixJ0 = (240-THUMBW/2)*fScaleH;
- pixI1 = pixI0+ THUMBW*fThumbScaleW;
- pixJ1 = pixJ0+ THUMBH*fScaleH;
- if( _toThumbnail.GetData()!=NULL)
- { // show thumbnail with shadow and border
- dpMenu.Fill( pixI0+pixOfs, pixJ0+pixOfs, THUMBW*fThumbScaleW, THUMBH*fScaleH, C_BLACK|128);
- dpMenu.PutTexture( &_toThumbnail, PIXaabbox2D( PIX2D( pixI0, pixJ0), PIX2D( pixI1, pixJ1)), C_WHITE|255);
- dpMenu.DrawBorder( pixI0,pixJ0, THUMBW*fThumbScaleW,THUMBH*fScaleH, LCDGetColor(C_mdGREEN|255, "thumbnail border"));
- } else {
- dpMenu.SetFont( _pfdDisplayFont);
- dpMenu.SetTextScaling( fScaleW);
- dpMenu.SetTextAspect( 1.0f);
- dpMenu.PutTextCXY( TRANS("no thumbnail"), (pixI0+pixI1)/2, (pixJ0+pixJ1)/2, LCDGetColor(C_GREEN|255, "no thumbnail"));
- }
- }
-
- // assure we can listen to non-3d sounds
- _pSound->UpdateSounds();
- }
-
- // if this is popup menu
- if (pgmCurrentMenu->gm_bPopup) {
-
- // render parent menu first
- if (pgmCurrentMenu->gm_pgmParentMenu!=NULL) {
- _pGame->MenuPreRenderMenu(pgmCurrentMenu->gm_pgmParentMenu->gm_strName);
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_pgmParentMenu->gm_lhGadgets, itmg) {
- if( itmg->mg_bVisible) {
- itmg->Render( &dpMenu);
- }
- }
- _pGame->MenuPostRenderMenu(pgmCurrentMenu->gm_pgmParentMenu->gm_strName);
- }
-
- // gray it out
- dpMenu.Fill(C_BLACK|128);
-
- // clear popup box
- dpMenu.Unlock();
- PIXaabbox2D box = FloatBoxToPixBox(&dpMenu, BoxPopup());
- CDrawPort dpPopup(pdp, box);
- dpPopup.Lock();
- LCDSetDrawport(&dpPopup);
- dpPopup.Fill(C_BLACK|255);
- LCDRenderClouds1();
- LCDRenderGrid();
- //LCDRenderClouds2();
- LCDScreenBox(LCDGetColor(C_GREEN|255, "popup box"));
- dpPopup.Unlock();
- dpMenu.Lock();
- }
-
- // no entity is under cursor initially
- _pmgUnderCursor = NULL;
-
- BOOL bStilInMenus = FALSE;
- _pGame->MenuPreRenderMenu(pgmCurrentMenu->gm_strName);
- // for each menu gadget
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- // if gadget is visible
- if( itmg->mg_bVisible) {
- bStilInMenus = TRUE;
- itmg->Render( &dpMenu);
- if (FloatBoxToPixBox(&dpMenu, itmg->mg_boxOnScreen)>=PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
- _pmgUnderCursor = itmg;
- }
- }
- }
- _pGame->MenuPostRenderMenu(pgmCurrentMenu->gm_strName);
-
- // no currently active gadget initially
- CMenuGadget *pmgActive = NULL;
- // if mouse was not active last
- if (!_bMouseUsedLast) {
- // find focused gadget
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- CMenuGadget &mg = *itmg;
- // if focused
- if( itmg->mg_bFocused) {
- // it is active
- pmgActive = &itmg.Current();
- break;
- }
- }
- // if mouse was active last
- } else {
- // gadget under cursor is active
- pmgActive = _pmgUnderCursor;
- }
-
- // if editing
- if (_bEditingString && pmgActive!=NULL) {
- // dim the menu bit
- dpMenu.Fill(C_BLACK|0x40);
- // render the edit gadget again
- pmgActive->Render(&dpMenu);
- }
-
- // if there is some active gadget and it has tips
- if (pmgActive!=NULL && (pmgActive->mg_strTip!="" || _bEditingString)) {
- CTString strTip = pmgActive->mg_strTip;
- if (_bEditingString) {
- strTip = TRANS("Enter - OK, Escape - Cancel");
- }
- // print the tip
- SetFontMedium(&dpMenu);
- dpMenu.PutTextC(strTip,
- pixW*0.5f, pixH*0.92f, LCDGetColor(C_WHITE|255, "tool tip"));
- }
-
- _pGame->ConsolePrintLastLines(&dpMenu);
-
- RenderMouseCursor(&dpMenu);
-
- dpMenu.Unlock();
- pdp->Lock();
-
- return bStilInMenus;
-}
-
-void MenuBack(void)
-{
- MenuGoToParent();
-}
-
-void FixupBackButton(CGameMenu *pgm)
-{
- BOOL bResume = FALSE;
-
- if (mgBack.mg_lnNode.IsLinked()) {
- mgBack.mg_lnNode.Remove();
- }
-
- BOOL bHasBack = TRUE;
-
- if (pgm->gm_bPopup) {
- bHasBack = FALSE;
- }
-
- if (pgm->gm_pgmParentMenu==NULL) {
- if (_gmRunningGameMode==GM_NONE) {
- bHasBack = FALSE;
- } else {
- bResume = TRUE;
- }
- }
- if (!bHasBack) {
- mgBack.Disappear();
- return;
- }
-
- if (bResume) {
- mgBack.mg_strText = TRANS("RESUME");
- mgBack.mg_strTip = TRANS("return to game");
- } else {
- if (_bVarChanged) {
- mgBack.mg_strText = TRANS("CANCEL");
- mgBack.mg_strTip = TRANS("cancel changes");
- } else {
- mgBack.mg_strText = TRANS("BACK");
- mgBack.mg_strTip = TRANS("return to previous menu");
- }
- }
-
- mgBack.mg_iCenterI = -1;
- mgBack.mg_bfsFontSize = BFS_LARGE;
- mgBack.mg_boxOnScreen = BoxBack();
- mgBack.mg_boxOnScreen = BoxLeftColumn(16.5f);
- pgm->gm_lhGadgets.AddTail( mgBack.mg_lnNode);
-
- mgBack.mg_pmgLeft =
- mgBack.mg_pmgRight =
- mgBack.mg_pmgUp =
- mgBack.mg_pmgDown = pgm->gm_pmgSelectedByDefault;
-
- mgBack.mg_pActivatedFunction = &MenuBack;
-
- mgBack.Appear();
-}
-
-void ChangeToMenu( CGameMenu *pgmNewMenu)
-{
- // auto-clear old thumbnail when going out of menu
- ClearThumbnail();
-
- if( pgmCurrentMenu != NULL) {
- if (!pgmNewMenu->gm_bPopup) {
- pgmCurrentMenu->EndMenu();
- } else {
- FOREACHINLIST(CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- itmg->OnKillFocus();
- }
- }
- }
- pgmNewMenu->StartMenu();
- if (pgmNewMenu->gm_pmgSelectedByDefault) {
- if (mgBack.mg_bFocused) {
- mgBack.OnKillFocus();
- }
- pgmNewMenu->gm_pmgSelectedByDefault->OnSetFocus();
- }
- FixupBackButton(pgmNewMenu);
- pgmCurrentMenu = pgmNewMenu;
-}
-
-// ------------------------ SGameMenu implementation
-CGameMenu::CGameMenu( void)
-{
- gm_pgmParentMenu = NULL;
- gm_pmgSelectedByDefault = NULL;
- gm_pmgArrowUp = NULL;
- gm_pmgArrowDn = NULL;
- gm_pmgListTop = NULL;
- gm_pmgListBottom = NULL;
- gm_iListOffset = 0;
- gm_ctListVisible = 0;
- gm_ctListTotal = 0;
- gm_bPopup = FALSE;
-}
-
-void CGameMenu::Initialize_t( void)
-{
-}
-
-void CGameMenu::Destroy(void)
-{
-}
-void CGameMenu::FillListItems(void)
-{
- ASSERT(FALSE); // must be implemented to scroll up/down
-}
-
-// +-1 -> hit top/bottom when pressing up/down on keyboard
-// +-2 -> pressed pageup/pagedown on keyboard
-// +-3 -> pressed arrow up/down button in menu
-// +-4 -> scrolling with mouse wheel
-void CGameMenu::ScrollList(INDEX iDir)
-{
- // if not valid for scrolling
- if (gm_ctListTotal<=0
- || gm_pmgArrowUp == NULL || gm_pmgArrowDn == NULL
- || gm_pmgListTop == NULL || gm_pmgListBottom == NULL) {
- // do nothing
- return;
- }
-
- INDEX iOldTopKey = gm_iListOffset;
- // change offset
- switch(iDir) {
- case -1:
- gm_iListOffset -= 1;
- break;
- case -4:
- gm_iListOffset -= 3;
- break;
- case -2:
- case -3:
- gm_iListOffset -= gm_ctListVisible;
- break;
- case +1:
- gm_iListOffset += 1;
- break;
- case +4:
- gm_iListOffset += 3;
- break;
- case +2:
- case +3:
- gm_iListOffset += gm_ctListVisible;
- break;
- default:
- ASSERT(FALSE);
- return;
- }
- if (gm_ctListTotal<=gm_ctListVisible) {
- gm_iListOffset = 0;
- } else {
- gm_iListOffset = Clamp(gm_iListOffset, INDEX(0), INDEX(gm_ctListTotal-gm_ctListVisible));
- }
-
- // set new names
- FillListItems();
-
- // if scroling with wheel
- if (iDir==+4 || iDir==-4) {
- // no focus changing
- return;
- }
-
- // delete all focuses
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- itmg->OnKillFocus();
- }
-
- // set new focus
- const INDEX iFirst = 0;
- const INDEX iLast = gm_ctListVisible-1;
- switch(iDir) {
- case +1:
- gm_pmgListBottom->OnSetFocus();
- break;
- case +2:
- if (gm_iListOffset!=iOldTopKey) {
- gm_pmgListTop->OnSetFocus();
- } else {
- gm_pmgListBottom->OnSetFocus();
- }
- break;
- case +3:
- gm_pmgArrowDn->OnSetFocus();
- break;
- case -1:
- gm_pmgListTop->OnSetFocus();
- break;
- case -2:
- gm_pmgListTop->OnSetFocus();
- break;
- case -3:
- gm_pmgArrowUp->OnSetFocus();
- break;
- }
-}
-
-void CGameMenu::KillAllFocuses(void)
-{
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, gm_lhGadgets, itmg) {
- itmg->mg_bFocused = FALSE;
- }
-}
-
-void CGameMenu::StartMenu(void)
-{
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, gm_lhGadgets, itmg)
- {
- itmg->mg_bFocused = FALSE;
- // call appear
- itmg->Appear();
- }
-
- // if there is a list
- if (gm_pmgListTop!=NULL) {
- // scroll it so that the wanted tem is centered
- gm_iListOffset = gm_iListWantedItem-gm_ctListVisible/2;
- // clamp the scrolling
- gm_iListOffset = Clamp(gm_iListOffset, 0L, Max(0L, gm_ctListTotal-gm_ctListVisible));
-
- // fill the list
- FillListItems();
-
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, gm_lhGadgets, itmg) {
- // if in list, but disabled
- if (itmg->mg_iInList==-2) {
- // hide it
- itmg->mg_bVisible = FALSE;
- // if in list
- } else if (itmg->mg_iInList>=0) {
- // show it
- itmg->mg_bVisible = TRUE;
- }
- // if wanted
- if (itmg->mg_iInList==gm_iListWantedItem) {
- // focus it
- itmg->OnSetFocus();
- gm_pmgSelectedByDefault = itmg;
- }
- }
- }
-}
-
-void CGameMenu::EndMenu(void)
-{
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, gm_lhGadgets, itmg)
- {
- // call disappear
- itmg->Disappear();
- }
-}
-
-// return TRUE if handled
-BOOL CGameMenu::OnKeyDown( int iVKey)
-{
- // find curently active gadget
- CMenuGadget *pmgActive = NULL;
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- // if focused
- if( itmg->mg_bFocused) {
- // remember as active
- pmgActive = &itmg.Current();
- }
- }
-
- // if none focused
- if( pmgActive == NULL) {
- // do nothing
- return FALSE;
- }
-
- // if active gadget handles it
- if( pmgActive->OnKeyDown( iVKey)) {
- // key is handled
- return TRUE;
- }
-
- // process normal in menu movement
- switch( iVKey) {
- case VK_PRIOR:
- ScrollList(-2);
- return TRUE;
- case VK_NEXT:
- ScrollList(+2);
- return TRUE;
-
- case 11:
- ScrollList(-4);
- return TRUE;
- case 10:
- ScrollList(+4);
- return TRUE;
-
- case VK_UP:
- // if this is top button in list
- if (pmgActive==gm_pmgListTop) {
- // scroll list up
- ScrollList(-1);
- // key is handled
- return TRUE;
- }
- // if we can go up
- if(pmgActive->mg_pmgUp != NULL && pmgActive->mg_pmgUp->mg_bVisible) {
- // call lose focus to still active gadget and
- pmgActive->OnKillFocus();
- // set focus to new one
- pmgActive = pmgActive->mg_pmgUp;
- pmgActive->OnSetFocus();
- // key is handled
- return TRUE;
- }
- break;
- case VK_DOWN:
- // if this is bottom button in list
- if (pmgActive==gm_pmgListBottom) {
- // scroll list down
- ScrollList(+1);
- // key is handled
- return TRUE;
- }
- // if we can go down
- if(pmgActive->mg_pmgDown != NULL && pmgActive->mg_pmgDown->mg_bVisible) {
- // call lose focus to still active gadget and
- pmgActive->OnKillFocus();
- // set focus to new one
- pmgActive = pmgActive->mg_pmgDown;
- pmgActive->OnSetFocus();
- // key is handled
- return TRUE;
- }
- break;
- case VK_LEFT:
- // if we can go left
- if(pmgActive->mg_pmgLeft != NULL) {
- // call lose focus to still active gadget and
- pmgActive->OnKillFocus();
- // set focus to new one
- if (!pmgActive->mg_pmgLeft->mg_bVisible && gm_pmgSelectedByDefault!=NULL) {
- pmgActive = gm_pmgSelectedByDefault;
- } else {
- pmgActive = pmgActive->mg_pmgLeft;
- }
- pmgActive->OnSetFocus();
- // key is handled
- return TRUE;
- }
- break;
- case VK_RIGHT:
- // if we can go right
- if(pmgActive->mg_pmgRight != NULL) {
- // call lose focus to still active gadget and
- pmgActive->OnKillFocus();
- // set focus to new one
- if (!pmgActive->mg_pmgRight->mg_bVisible && gm_pmgSelectedByDefault!=NULL) {
- pmgActive = gm_pmgSelectedByDefault;
- } else {
- pmgActive = pmgActive->mg_pmgRight;
- }
- pmgActive->OnSetFocus();
- // key is handled
- return TRUE;
- }
- break;
- }
-
- // key is not handled
- return FALSE;
-}
-
-void CGameMenu::Think(void)
-{
-}
-
-BOOL CGameMenu::OnChar(MSG msg)
-{
- // find curently active gadget
- CMenuGadget *pmgActive = NULL;
- // for each menu gadget in menu
- FOREACHINLIST( CMenuGadget, mg_lnNode, pgmCurrentMenu->gm_lhGadgets, itmg) {
- // if focused
- if( itmg->mg_bFocused) {
- // remember as active
- pmgActive = &itmg.Current();
- }
- }
-
- // if none focused
- if( pmgActive == NULL) {
- // do nothing
- return FALSE;
- }
-
- // if active gadget handles it
- if( pmgActive->OnChar(msg)) {
- // key is handled
- return TRUE;
- }
-
- // key is not handled
- return FALSE;
-}
-
-// ------------------------ CConfirmMenu implementation
-void CConfirmMenu::Initialize_t(void)
-{
- gm_bPopup = TRUE;
-
- mgConfirmLabel.mg_strText = "";
- gm_lhGadgets.AddTail(mgConfirmLabel.mg_lnNode);
- mgConfirmLabel.mg_boxOnScreen = BoxPopupLabel();
- mgConfirmLabel.mg_iCenterI = 0;
- mgConfirmLabel.mg_bfsFontSize = BFS_LARGE;
-
- mgConfirmYes.mg_strText = TRANS("YES");
- gm_lhGadgets.AddTail(mgConfirmYes.mg_lnNode);
- mgConfirmYes.mg_boxOnScreen = BoxPopupYesLarge();
- mgConfirmYes.mg_pActivatedFunction = &ConfirmYes;
- mgConfirmYes.mg_pmgLeft =
- mgConfirmYes.mg_pmgRight = &mgConfirmNo;
- mgConfirmYes.mg_iCenterI = 1;
- mgConfirmYes.mg_bfsFontSize = BFS_LARGE;
-
- mgConfirmNo.mg_strText = TRANS("NO");
- gm_lhGadgets.AddTail(mgConfirmNo.mg_lnNode);
- mgConfirmNo.mg_boxOnScreen = BoxPopupNoLarge();
- mgConfirmNo.mg_pActivatedFunction = &ConfirmNo;
- mgConfirmNo.mg_pmgLeft =
- mgConfirmNo.mg_pmgRight = &mgConfirmYes;
- mgConfirmNo.mg_iCenterI = -1;
- mgConfirmNo.mg_bfsFontSize = BFS_LARGE;
-}
-
-void CConfirmMenu::BeLarge(void)
-{
- mgConfirmLabel.mg_bfsFontSize = BFS_LARGE;
- mgConfirmYes.mg_bfsFontSize = BFS_LARGE;
- mgConfirmNo.mg_bfsFontSize = BFS_LARGE;
- mgConfirmLabel.mg_iCenterI = 0;
- mgConfirmYes.mg_boxOnScreen = BoxPopupYesLarge();
- mgConfirmNo.mg_boxOnScreen = BoxPopupNoLarge();
-}
-
-void CConfirmMenu::BeSmall(void)
-{
- mgConfirmLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgConfirmYes.mg_bfsFontSize = BFS_MEDIUM;
- mgConfirmNo.mg_bfsFontSize = BFS_MEDIUM;
- mgConfirmLabel.mg_iCenterI = -1;
- mgConfirmYes.mg_boxOnScreen = BoxPopupYesSmall();
- mgConfirmNo.mg_boxOnScreen = BoxPopupNoSmall();
-}
-
-// return TRUE if handled
-BOOL CConfirmMenu::OnKeyDown(int iVKey)
-{
- if (iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) {
- ConfirmNo();
- return TRUE;
- }
- return CGameMenu::OnKeyDown(iVKey);
-}
-
-// ------------------------ CMainMenu implementation
-void CMainMenu::Initialize_t(void)
-{
- // intialize main menu
-/*
- mgMainTitle.mg_strText = "SERIOUS SAM - BETA"; // nothing to see here, kazuya
- mgMainTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgMainTitle.mg_lnNode);
- */
-
- extern CTString sam_strVersion;
- mgMainVersionLabel.mg_strText = sam_strVersion;
- mgMainVersionLabel.mg_boxOnScreen = BoxVersion();
- mgMainVersionLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgMainVersionLabel.mg_iCenterI = +1;
- mgMainVersionLabel.mg_bEnabled = FALSE;
- mgMainVersionLabel.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgMainVersionLabel.mg_lnNode);
-
- extern CTString sam_strModName;
- mgMainModLabel.mg_strText = sam_strModName;
- mgMainModLabel.mg_boxOnScreen = BoxMediumRow(-2.0f);
- mgMainModLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgMainModLabel.mg_iCenterI = 0;
- mgMainModLabel.mg_bEnabled = FALSE;
- mgMainModLabel.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgMainModLabel.mg_lnNode);
-
- mgMainSingle.mg_strText = TRANS("SINGLE PLAYER");
- mgMainSingle.mg_bfsFontSize = BFS_LARGE;
- mgMainSingle.mg_boxOnScreen = BoxBigRow(0.0f);
- mgMainSingle.mg_strTip = TRANS("single player game menus");
- gm_lhGadgets.AddTail( mgMainSingle.mg_lnNode);
- mgMainSingle.mg_pmgUp = &mgMainQuit;
- mgMainSingle.mg_pmgDown = &mgMainNetwork;
- mgMainSingle.mg_pActivatedFunction = &StartSinglePlayerMenu;
-
- mgMainNetwork.mg_strText = TRANS("NETWORK");
- mgMainNetwork.mg_bfsFontSize = BFS_LARGE;
- mgMainNetwork.mg_boxOnScreen = BoxBigRow(1.0f);
- mgMainNetwork.mg_strTip = TRANS("LAN/iNet multiplayer menus");
- gm_lhGadgets.AddTail( mgMainNetwork.mg_lnNode);
- mgMainNetwork.mg_pmgUp = &mgMainSingle;
- mgMainNetwork.mg_pmgDown = &mgMainSplitScreen;
- mgMainNetwork.mg_pActivatedFunction = StartNetworkMenu;
-
- mgMainSplitScreen.mg_strText = TRANS("SPLIT SCREEN");
- mgMainSplitScreen.mg_bfsFontSize = BFS_LARGE;
- mgMainSplitScreen.mg_boxOnScreen = BoxBigRow(2.0f);
- mgMainSplitScreen.mg_strTip = TRANS("play with multiple players on one computer");
- gm_lhGadgets.AddTail( mgMainSplitScreen.mg_lnNode);
- mgMainSplitScreen.mg_pmgUp = &mgMainNetwork;
- mgMainSplitScreen.mg_pmgDown = &mgMainDemo;
- mgMainSplitScreen.mg_pActivatedFunction = &StartSplitScreenMenu;
-
- mgMainDemo.mg_strText = TRANS("DEMO");
- mgMainDemo.mg_bfsFontSize = BFS_LARGE;
- mgMainDemo.mg_boxOnScreen = BoxBigRow(3.0f);
- mgMainDemo.mg_strTip = TRANS("play a game demo");
- gm_lhGadgets.AddTail( mgMainDemo.mg_lnNode);
- mgMainDemo.mg_pmgUp = &mgMainSplitScreen;
- mgMainDemo.mg_pmgDown = &mgMainMods;
- mgMainDemo.mg_pActivatedFunction = &StartDemoLoadMenu;
-
- mgMainMods.mg_strText = TRANS("MODS");
- mgMainMods.mg_bfsFontSize = BFS_LARGE;
- mgMainMods.mg_boxOnScreen = BoxBigRow(4.0f);
- mgMainMods.mg_strTip = TRANS("run one of installed game modifications");
- gm_lhGadgets.AddTail( mgMainMods.mg_lnNode);
- mgMainMods.mg_pmgUp = &mgMainDemo;
- mgMainMods.mg_pmgDown = &mgMainHighScore;
-
- #if TECHTESTONLY
- mgMainMods.mg_pActivatedFunction = &DisabledFunction;
- #else
- mgMainMods.mg_pActivatedFunction = &StartModsLoadMenu;
- #endif
-
- mgMainHighScore.mg_strText = TRANS("HIGH SCORES");
- mgMainHighScore.mg_bfsFontSize = BFS_LARGE;
- mgMainHighScore.mg_boxOnScreen = BoxBigRow(5.0f);
- mgMainHighScore.mg_strTip = TRANS("view list of top ten best scores");
- gm_lhGadgets.AddTail( mgMainHighScore.mg_lnNode);
- mgMainHighScore.mg_pmgUp = &mgMainMods;
- mgMainHighScore.mg_pmgDown = &mgMainOptions;
- mgMainHighScore.mg_pActivatedFunction = &StartHighScoreMenu;
-
- mgMainOptions.mg_strText = TRANS("OPTIONS");
- mgMainOptions.mg_bfsFontSize = BFS_LARGE;
- mgMainOptions.mg_boxOnScreen = BoxBigRow(6.0f);
- mgMainOptions.mg_strTip = TRANS("adjust video, audio and input options");
- gm_lhGadgets.AddTail( mgMainOptions.mg_lnNode);
- mgMainOptions.mg_pmgUp = &mgMainHighScore;
- mgMainOptions.mg_pmgDown = &mgMainQuit;
- mgMainOptions.mg_pActivatedFunction = &StartOptionsMenu;
-
- mgMainQuit.mg_strText = TRANS("QUIT");
- mgMainQuit.mg_bfsFontSize = BFS_LARGE;
- mgMainQuit.mg_boxOnScreen = BoxBigRow(7.0f);
- mgMainQuit.mg_strTip = TRANS("exit game immediately");
- gm_lhGadgets.AddTail( mgMainQuit.mg_lnNode);
- mgMainQuit.mg_pmgUp = &mgMainOptions;
- mgMainQuit.mg_pmgDown = &mgMainSingle;
- mgMainQuit.mg_pActivatedFunction = &ExitConfirm;
-}
-void CMainMenu::StartMenu(void)
-{
- mgMainSingle.mg_bEnabled = IsMenuEnabled("Single Player");
- mgMainNetwork.mg_bEnabled = IsMenuEnabled("Network");
- mgMainSplitScreen.mg_bEnabled = IsMenuEnabled("Split Screen");
- mgMainHighScore.mg_bEnabled = IsMenuEnabled("High Score");
- CGameMenu::StartMenu();
-}
-
-// ------------------------ CMainMenu implementation
-void CInGameMenu::Initialize_t(void)
-{
- // intialize main menu
- mgInGameTitle.mg_strText = TRANS("GAME");
- mgInGameTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgInGameTitle.mg_lnNode);
-
- mgInGameLabel1.mg_strText = "";
- mgInGameLabel1.mg_boxOnScreen = BoxMediumRow(-2.0);
- mgInGameLabel1.mg_bfsFontSize = BFS_MEDIUM;
- mgInGameLabel1.mg_iCenterI = -1;
- mgInGameLabel1.mg_bEnabled = FALSE;
- mgInGameLabel1.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgInGameLabel1.mg_lnNode);
-
- mgInGameLabel2.mg_strText = "";
- mgInGameLabel2.mg_boxOnScreen = BoxMediumRow(-1.0);
- mgInGameLabel2.mg_bfsFontSize = BFS_MEDIUM;
- mgInGameLabel2.mg_iCenterI = -1;
- mgInGameLabel2.mg_bEnabled = FALSE;
- mgInGameLabel2.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgInGameLabel2.mg_lnNode);
-
- mgInGameQuickLoad.mg_strText = TRANS("QUICK LOAD");
- mgInGameQuickLoad.mg_bfsFontSize = BFS_LARGE;
- mgInGameQuickLoad.mg_boxOnScreen = BoxBigRow(0.0f);
- mgInGameQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
- gm_lhGadgets.AddTail( mgInGameQuickLoad.mg_lnNode);
- mgInGameQuickLoad.mg_pmgUp = &mgInGameQuit;
- mgInGameQuickLoad.mg_pmgDown = &mgInGameQuickSave;
- mgInGameQuickLoad.mg_pActivatedFunction = &StartCurrentQuickLoadMenu;
-
- mgInGameQuickSave.mg_strText = TRANS("QUICK SAVE");
- mgInGameQuickSave.mg_bfsFontSize = BFS_LARGE;
- mgInGameQuickSave.mg_boxOnScreen = BoxBigRow(1.0f);
- mgInGameQuickSave.mg_strTip = TRANS("quick-save current game (F6)");
- gm_lhGadgets.AddTail( mgInGameQuickSave.mg_lnNode);
- mgInGameQuickSave.mg_pmgUp = &mgInGameQuickLoad;
- mgInGameQuickSave.mg_pmgDown = &mgInGameLoad;
- mgInGameQuickSave.mg_pActivatedFunction = &QuickSaveFromMenu;
-
- mgInGameLoad.mg_strText = TRANS("LOAD");
- mgInGameLoad.mg_bfsFontSize = BFS_LARGE;
- mgInGameLoad.mg_boxOnScreen = BoxBigRow(2.0f);
- mgInGameLoad.mg_strTip = TRANS("load a saved game");
- gm_lhGadgets.AddTail( mgInGameLoad.mg_lnNode);
- mgInGameLoad.mg_pmgUp = &mgInGameQuickSave;
- mgInGameLoad.mg_pmgDown = &mgInGameSave;
- mgInGameLoad.mg_pActivatedFunction = &StartCurrentLoadMenu;
-
- mgInGameSave.mg_strText = TRANS("SAVE");
- mgInGameSave.mg_bfsFontSize = BFS_LARGE;
- mgInGameSave.mg_boxOnScreen = BoxBigRow(3.0f);
- mgInGameSave.mg_strTip = TRANS("save current game (each player has own slots!)");
- gm_lhGadgets.AddTail( mgInGameSave.mg_lnNode);
- mgInGameSave.mg_pmgUp = &mgInGameLoad;
- mgInGameSave.mg_pmgDown = &mgInGameDemoRec;
- mgInGameSave.mg_pActivatedFunction = &StartCurrentSaveMenu;
-
- mgInGameDemoRec.mg_boxOnScreen = BoxBigRow(4.0f);
- mgInGameDemoRec.mg_bfsFontSize = BFS_LARGE;
- mgInGameDemoRec.mg_pmgUp = &mgInGameSave;
- mgInGameDemoRec.mg_pmgDown = &mgInGameHighScore;
- mgInGameDemoRec.mg_strText = "Text not set";
- gm_lhGadgets.AddTail( mgInGameDemoRec.mg_lnNode);
- mgInGameDemoRec.mg_pActivatedFunction = NULL; // !!! must be set on start menu
-
- mgInGameHighScore.mg_strText = TRANS("HIGH SCORES");
- mgInGameHighScore.mg_bfsFontSize = BFS_LARGE;
- mgInGameHighScore.mg_boxOnScreen = BoxBigRow(5.0f);
- mgInGameHighScore.mg_strTip = TRANS("view list of top ten best scores");
- gm_lhGadgets.AddTail( mgInGameHighScore.mg_lnNode);
- mgInGameHighScore.mg_pmgUp = &mgInGameDemoRec;
- mgInGameHighScore.mg_pmgDown = &mgInGameOptions;
- mgInGameHighScore.mg_pActivatedFunction = &StartHighScoreMenu;
-
- mgInGameOptions.mg_strText = TRANS("OPTIONS");
- mgInGameOptions.mg_bfsFontSize = BFS_LARGE;
- mgInGameOptions.mg_boxOnScreen = BoxBigRow(6.0f);
- mgInGameOptions.mg_strTip = TRANS("adjust video, audio and input options");
- gm_lhGadgets.AddTail( mgInGameOptions.mg_lnNode);
- mgInGameOptions.mg_pmgUp = &mgInGameHighScore;
- mgInGameOptions.mg_pmgDown = &mgInGameStop;
- mgInGameOptions.mg_pActivatedFunction = &StartOptionsMenu;
-
- mgInGameStop.mg_strText = TRANS("STOP GAME");
- mgInGameStop.mg_bfsFontSize = BFS_LARGE;
- mgInGameStop.mg_boxOnScreen = BoxBigRow(7.0f);
- mgInGameStop.mg_strTip = TRANS("stop currently running game");
- gm_lhGadgets.AddTail( mgInGameStop.mg_lnNode);
- mgInGameStop.mg_pmgUp = &mgInGameOptions;
- mgInGameStop.mg_pmgDown = &mgInGameQuit;
-#if TECHTESTONLY
- mgInGameStop.mg_pActivatedFunction = &ExitConfirm;
-#else
- mgInGameStop.mg_pActivatedFunction = &StopConfirm;
-#endif
-
- mgInGameQuit.mg_strText = TRANS("QUIT");
- mgInGameQuit.mg_bfsFontSize = BFS_LARGE;
- mgInGameQuit.mg_boxOnScreen = BoxBigRow(8.0f);
- mgInGameQuit.mg_strTip = TRANS("exit game immediately");
- gm_lhGadgets.AddTail( mgInGameQuit.mg_lnNode);
- mgInGameQuit.mg_pmgUp = &mgInGameStop;
- mgInGameQuit.mg_pmgDown = &mgInGameQuickLoad;
- mgInGameQuit.mg_pActivatedFunction = &ExitConfirm;
-}
-
-void SetDemoStartStopRecText(void)
-{
- if( _pNetwork->IsRecordingDemo())
- {
- mgInGameDemoRec.SetText( TRANS("STOP RECORDING"));
- mgInGameDemoRec.mg_strTip = TRANS("stop current recording");
- mgInGameDemoRec.mg_pActivatedFunction = &StopRecordingDemo;
- }
- else
- {
- mgInGameDemoRec.SetText( TRANS("RECORD DEMO"));
- mgInGameDemoRec.mg_strTip = TRANS("start recording current game");
- mgInGameDemoRec.mg_pActivatedFunction = &StartDemoSaveMenu;
- }
-}
-
-void CInGameMenu::StartMenu(void)
-{
- mgInGameQuickLoad.mg_bEnabled = _pNetwork->IsServer();
- mgInGameQuickSave.mg_bEnabled = _pNetwork->IsServer();
- mgInGameLoad.mg_bEnabled = _pNetwork->IsServer();
- mgInGameSave.mg_bEnabled = _pNetwork->IsServer();
- mgInGameDemoRec.mg_bEnabled = TRUE;//_pNetwork->IsServer();
- SetDemoStartStopRecText();
-
-
- if (_gmRunningGameMode==GM_SINGLE_PLAYER) {
- CPlayerCharacter &pc = _pGame->gm_apcPlayers[ _pGame->gm_iSinglePlayer];
- mgInGameLabel1.mg_strText.PrintF( TRANS("Player: %s"), pc.GetNameForPrinting());
- mgInGameLabel2.mg_strText = "";
-
- } else {
- if (_pNetwork->IsServer()) {
-
- CTString strHost, strAddress;
- CTString strHostName;
- _pNetwork->GetHostName(strHost, strAddress);
- if (strHost=="") {
- strHostName = TRANS("");
- } else {
- strHostName = strHost + " ("+strAddress+")";
- }
-
- mgInGameLabel1.mg_strText = TRANS("Address: ")+strHostName;
- mgInGameLabel2.mg_strText = "";
- } else {
-
- CTString strConfig;
- strConfig = TRANS("");
- if (sam_strNetworkSettings!="") {
- LoadStringVar(CTFileName(sam_strNetworkSettings).NoExt()+".des", strConfig);
- strConfig.OnlyFirstLine();
- }
-
- mgInGameLabel1.mg_strText = TRANS("Connected to: ")+_pGame->gam_strJoinAddress;
- mgInGameLabel2.mg_strText = TRANS("Connection: ")+strConfig;
- }
- }
-
- CGameMenu::StartMenu();
-}
-
-// ------------------------ CSinglePlayerMenu implementation
-void CSinglePlayerMenu::Initialize_t(void)
-{
- // intialize single player menu
- mgSingleTitle.mg_strText = TRANS("SINGLE PLAYER");
- mgSingleTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgSingleTitle.mg_lnNode);
-
- mgSinglePlayerLabel.mg_boxOnScreen = BoxBigRow(-1.0f);
- mgSinglePlayerLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgSinglePlayerLabel.mg_iCenterI = -1;
- mgSinglePlayerLabel.mg_bEnabled = FALSE;
- mgSinglePlayerLabel.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail(mgSinglePlayerLabel.mg_lnNode);
-
- mgSingleNewGame.mg_strText = TRANS("NEW GAME");
- mgSingleNewGame.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewGame.mg_boxOnScreen = BoxBigRow(0.0f);
- mgSingleNewGame.mg_strTip = TRANS("start new game with current player");
- gm_lhGadgets.AddTail( mgSingleNewGame.mg_lnNode);
- mgSingleNewGame.mg_pmgUp = &mgSingleOptions;
- mgSingleNewGame.mg_pmgDown = &mgSingleCustom;
- mgSingleNewGame.mg_pActivatedFunction = &StartSinglePlayerNewMenu;
-
- mgSingleCustom.mg_strText = TRANS("CUSTOM LEVEL");
- mgSingleCustom.mg_bfsFontSize = BFS_LARGE;
- mgSingleCustom.mg_boxOnScreen = BoxBigRow(1.0f);
- mgSingleCustom.mg_strTip = TRANS("start new game on a custom level");
- gm_lhGadgets.AddTail( mgSingleCustom.mg_lnNode);
- mgSingleCustom.mg_pmgUp = &mgSingleNewGame;
- mgSingleCustom.mg_pmgDown = &mgSingleQuickLoad;
- #if _SE_DEMO || TECHTESTONLY
- mgSingleCustom.mg_pActivatedFunction = &DisabledFunction;
- #else
- mgSingleCustom.mg_pActivatedFunction = &StartSelectLevelFromSingle;
- #endif
-
- mgSingleQuickLoad.mg_strText = TRANS("QUICK LOAD");
- mgSingleQuickLoad.mg_bfsFontSize = BFS_LARGE;
- mgSingleQuickLoad.mg_boxOnScreen = BoxBigRow(2.0f);
- mgSingleQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
- gm_lhGadgets.AddTail( mgSingleQuickLoad.mg_lnNode);
- mgSingleQuickLoad.mg_pmgUp = &mgSingleCustom;
- mgSingleQuickLoad.mg_pmgDown = &mgSingleLoad;
- mgSingleQuickLoad.mg_pActivatedFunction = &StartSinglePlayerQuickLoadMenu;
-
- mgSingleLoad.mg_strText = TRANS("LOAD");
- mgSingleLoad.mg_bfsFontSize = BFS_LARGE;
- mgSingleLoad.mg_boxOnScreen = BoxBigRow(3.0f);
- mgSingleLoad.mg_strTip = TRANS("load a saved game of current player");
- gm_lhGadgets.AddTail( mgSingleLoad.mg_lnNode);
- mgSingleLoad.mg_pmgUp = &mgSingleQuickLoad;
- mgSingleLoad.mg_pmgDown = &mgSingleTraining;
- mgSingleLoad.mg_pActivatedFunction = &StartSinglePlayerLoadMenu;
-
- mgSingleTraining.mg_strText = TRANS("TRAINING");
- mgSingleTraining.mg_bfsFontSize = BFS_LARGE;
- mgSingleTraining.mg_boxOnScreen = BoxBigRow(4.0f);
- mgSingleTraining.mg_strTip = TRANS("start training level - KarnakDemo");
- gm_lhGadgets.AddTail( mgSingleTraining.mg_lnNode);
- mgSingleTraining.mg_pmgUp = &mgSingleLoad;
- mgSingleTraining.mg_pmgDown = &mgSingleTechTest;
- mgSingleTraining.mg_pActivatedFunction = &StartTraining;
-
- mgSingleTechTest.mg_strText = TRANS("TECHNOLOGY TEST");
- mgSingleTechTest.mg_bfsFontSize = BFS_LARGE;
- mgSingleTechTest.mg_boxOnScreen = BoxBigRow(5.0f);
- mgSingleTechTest.mg_strTip = TRANS("start technology testing level");
- gm_lhGadgets.AddTail( mgSingleTechTest.mg_lnNode);
- mgSingleTechTest.mg_pmgUp = &mgSingleTraining;
- mgSingleTechTest.mg_pmgDown = &mgSinglePlayersAndControls;
- mgSingleTechTest.mg_pActivatedFunction = &StartTechTest;
-
- mgSinglePlayersAndControls.mg_bfsFontSize = BFS_LARGE;
- mgSinglePlayersAndControls.mg_boxOnScreen = BoxBigRow(6.0f);
- mgSinglePlayersAndControls.mg_pmgUp = &mgSingleTechTest;
- mgSinglePlayersAndControls.mg_pmgDown = &mgSingleOptions;
- mgSinglePlayersAndControls.mg_strText = TRANS("PLAYERS AND CONTROLS");
- mgSinglePlayersAndControls.mg_strTip = TRANS("change currently active player or adjust controls");
- gm_lhGadgets.AddTail( mgSinglePlayersAndControls.mg_lnNode);
- mgSinglePlayersAndControls.mg_pActivatedFunction = &StartChangePlayerMenuFromSinglePlayer;
-
- mgSingleOptions.mg_strText = TRANS("GAME OPTIONS");
- mgSingleOptions.mg_bfsFontSize = BFS_LARGE;
- mgSingleOptions.mg_boxOnScreen = BoxBigRow(7.0f);
- mgSingleOptions.mg_strTip = TRANS("adjust miscellaneous game options");
- gm_lhGadgets.AddTail( mgSingleOptions.mg_lnNode);
- mgSingleOptions.mg_pmgUp = &mgSinglePlayersAndControls;
- mgSingleOptions.mg_pmgDown = &mgSingleNewGame;
- mgSingleOptions.mg_pActivatedFunction = &StartSinglePlayerGameOptions;
-}
-
-void CSinglePlayerMenu::StartMenu(void)
-{
- mgSingleTraining.mg_bEnabled = IsMenuEnabled("Training");
- mgSingleTechTest.mg_bEnabled = IsMenuEnabled("Technology Test");
-
- if (mgSingleTraining.mg_bEnabled) {
- if (!mgSingleTraining.mg_lnNode.IsLinked()) {
- gm_lhGadgets.AddTail( mgSingleTraining.mg_lnNode);
- }
-
- mgSingleLoad.mg_boxOnScreen = BoxBigRow(3.0f);
- mgSingleLoad.mg_pmgUp = &mgSingleQuickLoad;
- mgSingleLoad.mg_pmgDown = &mgSingleTraining;
-
- mgSingleTraining.mg_boxOnScreen = BoxBigRow(4.0f);
- mgSingleTraining.mg_pmgUp = &mgSingleLoad;
- mgSingleTraining.mg_pmgDown = &mgSingleTechTest;
-
- mgSingleTechTest.mg_boxOnScreen = BoxBigRow(5.0f);
- mgSingleTechTest.mg_pmgUp = &mgSingleTraining;
- mgSingleTechTest.mg_pmgDown = &mgSinglePlayersAndControls;
-
- mgSinglePlayersAndControls.mg_boxOnScreen = BoxBigRow(6.0f);
- mgSingleOptions.mg_boxOnScreen = BoxBigRow(7.0f);
-
- } else {
- if (mgSingleTraining.mg_lnNode.IsLinked()) {
- mgSingleTraining.mg_lnNode.Remove();
- }
-
- mgSingleLoad.mg_boxOnScreen = BoxBigRow(3.0f);
- mgSingleLoad.mg_pmgUp = &mgSingleQuickLoad;
- mgSingleLoad.mg_pmgDown = &mgSingleTechTest;
-
- mgSingleTechTest.mg_boxOnScreen = BoxBigRow(4.0f);
- mgSingleTechTest.mg_pmgUp = &mgSingleLoad;
- mgSingleTechTest.mg_pmgDown = &mgSinglePlayersAndControls;
-
- mgSinglePlayersAndControls.mg_boxOnScreen = BoxBigRow(5.0f);
- mgSingleOptions.mg_boxOnScreen = BoxBigRow(6.0f);
- }
-
- CGameMenu::StartMenu();
-
- CPlayerCharacter &pc = _pGame->gm_apcPlayers[ _pGame->gm_iSinglePlayer];
- mgSinglePlayerLabel.mg_strText.PrintF( TRANS("Player: %s\n"), pc.GetNameForPrinting());
-}
-
-// ------------------------ CSinglePlayerNewMenu implementation
-void CSinglePlayerNewMenu::Initialize_t(void)
-{
- // intialize single player new menu
- mgSingleNewTitle.mg_strText = TRANS("NEW GAME");
- mgSingleNewTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgSingleNewTitle.mg_lnNode);
-
- mgSingleNewTourist.mg_strText = TRANS("TOURIST");
- mgSingleNewTourist.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewTourist.mg_boxOnScreen = BoxBigRow(0.0f);
- mgSingleNewTourist.mg_strTip = TRANS("for non-FPS players");
- gm_lhGadgets.AddTail( mgSingleNewTourist.mg_lnNode);
- mgSingleNewTourist.mg_pmgUp = &mgSingleNewSerious;
- mgSingleNewTourist.mg_pmgDown = &mgSingleNewEasy;
- mgSingleNewTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist;
-
- mgSingleNewEasy.mg_strText = TRANS("EASY");
- mgSingleNewEasy.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewEasy.mg_boxOnScreen = BoxBigRow(1.0f);
- mgSingleNewEasy.mg_strTip = TRANS("for unexperienced FPS players");
- gm_lhGadgets.AddTail( mgSingleNewEasy.mg_lnNode);
- mgSingleNewEasy.mg_pmgUp = &mgSingleNewTourist;
- mgSingleNewEasy.mg_pmgDown = &mgSingleNewMedium;
- mgSingleNewEasy.mg_pActivatedFunction = &StartSinglePlayerGame_Easy;
-
- mgSingleNewMedium.mg_strText = TRANS("NORMAL");
- mgSingleNewMedium.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewMedium.mg_boxOnScreen = BoxBigRow(2.0f);
- mgSingleNewMedium.mg_strTip = TRANS("for experienced FPS players");
- gm_lhGadgets.AddTail( mgSingleNewMedium.mg_lnNode);
- mgSingleNewMedium.mg_pmgUp = &mgSingleNewEasy;
- mgSingleNewMedium.mg_pmgDown = &mgSingleNewHard;
- mgSingleNewMedium.mg_pActivatedFunction = &StartSinglePlayerGame_Normal;
-
- mgSingleNewHard.mg_strText = TRANS("HARD");
- mgSingleNewHard.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewHard.mg_boxOnScreen = BoxBigRow(3.0f);
- mgSingleNewHard.mg_strTip = TRANS("for experienced Serious Sam players");
- gm_lhGadgets.AddTail( mgSingleNewHard.mg_lnNode);
- mgSingleNewHard.mg_pmgUp = &mgSingleNewMedium;
- mgSingleNewHard.mg_pmgDown = &mgSingleNewSerious;
- mgSingleNewHard.mg_pActivatedFunction = &StartSinglePlayerGame_Hard;
-
- mgSingleNewSerious.mg_strText = TRANS("SERIOUS");
- mgSingleNewSerious.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewSerious.mg_boxOnScreen = BoxBigRow(4.0f);
- mgSingleNewSerious.mg_strTip = TRANS("are you serious?");
- gm_lhGadgets.AddTail( mgSingleNewSerious.mg_lnNode);
- mgSingleNewSerious.mg_pmgUp = &mgSingleNewHard;
- mgSingleNewSerious.mg_pmgDown = &mgSingleNewTourist;
- mgSingleNewSerious.mg_pActivatedFunction = &StartSinglePlayerGame_Serious;
-
- mgSingleNewMental.mg_strText = TRANS("MENTAL");
- mgSingleNewMental.mg_bfsFontSize = BFS_LARGE;
- mgSingleNewMental.mg_boxOnScreen = BoxBigRow(5.0f);
- mgSingleNewMental.mg_strTip = TRANS("you are not serious!");
- gm_lhGadgets.AddTail( mgSingleNewMental.mg_lnNode);
- mgSingleNewMental.mg_pmgUp = &mgSingleNewSerious;
- mgSingleNewMental.mg_pmgDown = &mgSingleNewTourist;
- mgSingleNewMental.mg_pActivatedFunction = &StartSinglePlayerGame_Mental;
- mgSingleNewMental.mg_bMental = TRUE;
-}
-void CSinglePlayerNewMenu::StartMenu(void)
-{
- CGameMenu::StartMenu();
- extern INDEX sam_bMentalActivated;
- if (sam_bMentalActivated) {
- mgSingleNewMental.Appear();
- mgSingleNewSerious.mg_pmgDown = &mgSingleNewMental;
- mgSingleNewTourist.mg_pmgUp = &mgSingleNewMental;
- } else {
- mgSingleNewMental.Disappear();
- mgSingleNewSerious.mg_pmgDown = &mgSingleNewTourist;
- mgSingleNewTourist.mg_pmgUp = &mgSingleNewSerious;
- }
-}
-
-void CDisabledMenu::Initialize_t(void)
-{
- mgDisabledTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgDisabledTitle.mg_lnNode);
-
- mgDisabledMenuButton.mg_bfsFontSize = BFS_MEDIUM;
- mgDisabledMenuButton.mg_boxOnScreen = BoxBigRow(0.0f);
- gm_lhGadgets.AddTail( mgDisabledMenuButton.mg_lnNode);
- mgDisabledMenuButton.mg_pActivatedFunction = NULL;
-}
-
-void ChangeCrosshair(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- pps->ps_iCrossHairType = iNew-1;
-}
-void ChangeWeaponSelect(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- pps->ps_iWeaponAutoSelect = iNew;
-}
-void ChangeWeaponHide(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags |= PSF_HIDEWEAPON;
- } else {
- pps->ps_ulFlags &= ~PSF_HIDEWEAPON;
- }
-}
-void Change3rdPerson(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags |= PSF_PREFER3RDPERSON;
- } else {
- pps->ps_ulFlags &= ~PSF_PREFER3RDPERSON;
- }
-}
-void ChangeQuotes(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags &= ~PSF_NOQUOTES;
- } else {
- pps->ps_ulFlags |= PSF_NOQUOTES;
- }
-}
-void ChangeAutoSave(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags |= PSF_AUTOSAVE;
- } else {
- pps->ps_ulFlags &= ~PSF_AUTOSAVE;
- }
-}
-void ChangeCompDoubleClick(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags &= ~PSF_COMPSINGLECLICK;
- } else {
- pps->ps_ulFlags |= PSF_COMPSINGLECLICK;
- }
-}
-
-void ChangeViewBobbing(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags &= ~PSF_NOBOBBING;
- } else {
- pps->ps_ulFlags |= PSF_NOBOBBING;
- }
-}
-
-void ChangeSharpTurning(INDEX iNew)
-{
- INDEX iPlayer = *gmPlayerProfile.gm_piCurrentPlayer;
- CPlayerSettings *pps = (CPlayerSettings *)_pGame->gm_apcPlayers[iPlayer].pc_aubAppearance;
- if (iNew) {
- pps->ps_ulFlags |= PSF_SHARPTURNING;
- } else {
- pps->ps_ulFlags &= ~PSF_SHARPTURNING;
- }
-}
-
-// ------------------------ CPlayerProfileMenu implementation
-void CPlayerProfileMenu::Initialize_t(void)
-{
- // intialize player and controls menu
- _bPlayerMenuFromSinglePlayer = FALSE;
- mgPlayerProfileTitle.mg_boxOnScreen = BoxTitle();
- mgPlayerProfileTitle.mg_strText = TRANS("PLAYER PROFILE");
- gm_lhGadgets.AddTail( mgPlayerProfileTitle.mg_lnNode);
-
- mgPlayerNoLabel.mg_strText = TRANS("PROFILE:");
- mgPlayerNoLabel.mg_boxOnScreen = BoxMediumLeft(0.0f);
- mgPlayerNoLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerNoLabel.mg_iCenterI = -1;
- gm_lhGadgets.AddTail( mgPlayerNoLabel.mg_lnNode);
-
-#define ADD_SELECT_PLAYER_MG( index, mg, mgprev, mgnext, me)\
- mg.mg_iIndex = index;\
- mg.mg_bfsFontSize = BFS_MEDIUM;\
- mg.mg_boxOnScreen = BoxNoUp(index);\
- mg.mg_bRectangle = TRUE;\
- mg.mg_pmgLeft = &mgprev;\
- mg.mg_pmgRight = &mgnext;\
- mg.mg_pmgUp = &mgPlayerCustomizeControls;\
- mg.mg_pmgDown = &mgPlayerName;\
- mg.mg_pActivatedFunction = &OnPlayerSelect;\
- mg.mg_strText = #index;\
- mg.mg_strTip = TRANS("select new currently active player");\
- gm_lhGadgets.AddTail( mg.mg_lnNode);
-
- ADD_SELECT_PLAYER_MG( 0, mgPlayerNo[0], mgPlayerNo[7], mgPlayerNo[1], mePlayerNo[0]);
- ADD_SELECT_PLAYER_MG( 1, mgPlayerNo[1], mgPlayerNo[0], mgPlayerNo[2], mePlayerNo[1]);
- ADD_SELECT_PLAYER_MG( 2, mgPlayerNo[2], mgPlayerNo[1], mgPlayerNo[3], mePlayerNo[2]);
- ADD_SELECT_PLAYER_MG( 3, mgPlayerNo[3], mgPlayerNo[2], mgPlayerNo[4], mePlayerNo[3]);
- ADD_SELECT_PLAYER_MG( 4, mgPlayerNo[4], mgPlayerNo[3], mgPlayerNo[5], mePlayerNo[4]);
- ADD_SELECT_PLAYER_MG( 5, mgPlayerNo[5], mgPlayerNo[4], mgPlayerNo[6], mePlayerNo[5]);
- ADD_SELECT_PLAYER_MG( 6, mgPlayerNo[6], mgPlayerNo[5], mgPlayerNo[7], mePlayerNo[6]);
- ADD_SELECT_PLAYER_MG( 7, mgPlayerNo[7], mgPlayerNo[6], mgPlayerNo[0], mePlayerNo[7]);
- mgPlayerNo[7].mg_pmgRight = &mgPlayerModel;
-
- mgPlayerNameLabel.mg_strText = TRANS("NAME:");
- mgPlayerNameLabel.mg_boxOnScreen = BoxMediumLeft(1.25f);
- mgPlayerNameLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerNameLabel.mg_iCenterI = -1;
- gm_lhGadgets.AddTail( mgPlayerNameLabel.mg_lnNode);
-
- // setup of player name button is done on start menu
- mgPlayerName.mg_strText = "??>";
- mgPlayerName.mg_ctMaxStringLen = 25;
- mgPlayerName.mg_boxOnScreen = BoxPlayerEdit(1.25);
- mgPlayerName.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerName.mg_iCenterI = -1;
- mgPlayerName.mg_pmgUp = &mgPlayerNo[0];
- mgPlayerName.mg_pmgDown = &mgPlayerTeam;
- mgPlayerName.mg_pmgRight = &mgPlayerModel;
- mgPlayerName.mg_strTip = TRANS("rename currently active player");
- gm_lhGadgets.AddTail( mgPlayerName.mg_lnNode);
-
- mgPlayerTeamLabel.mg_strText = TRANS("TEAM:");
- mgPlayerTeamLabel.mg_boxOnScreen = BoxMediumLeft(2.25f);
- mgPlayerTeamLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerTeamLabel.mg_iCenterI = -1;
- gm_lhGadgets.AddTail( mgPlayerTeamLabel.mg_lnNode);
-
- // setup of player name button is done on start menu
- mgPlayerTeam.mg_strText = "??>";
- mgPlayerName.mg_ctMaxStringLen = 25;
- mgPlayerTeam.mg_boxOnScreen = BoxPlayerEdit(2.25f);
- mgPlayerTeam.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerTeam.mg_iCenterI = -1;
- mgPlayerTeam.mg_pmgUp = &mgPlayerName;
- mgPlayerTeam.mg_pmgDown = &mgPlayerCrosshair;
- mgPlayerTeam.mg_pmgRight = &mgPlayerModel;
- //mgPlayerTeam.mg_strTip = TRANS("teamplay is disabled in this version");
- mgPlayerTeam.mg_strTip = TRANS("enter team name, if playing in team");
- gm_lhGadgets.AddTail( mgPlayerTeam.mg_lnNode);
-
- TRIGGER_MG(mgPlayerCrosshair, 4.0, mgPlayerTeam, mgPlayerWeaponSelect, TRANS("CROSSHAIR"), astrCrosshair);
- mgPlayerCrosshair.mg_bVisual = TRUE;
- mgPlayerCrosshair.mg_boxOnScreen = BoxPlayerSwitch(5.0f);
- mgPlayerCrosshair.mg_iCenterI = -1;
- mgPlayerCrosshair.mg_pOnTriggerChange = ChangeCrosshair;
- TRIGGER_MG(mgPlayerWeaponSelect, 4.0, mgPlayerCrosshair, mgPlayerWeaponHide, TRANS("AUTO SELECT WEAPON"), astrWeapon);
- mgPlayerWeaponSelect.mg_boxOnScreen = BoxPlayerSwitch(6.0f);
- mgPlayerWeaponSelect.mg_iCenterI = -1;
- mgPlayerWeaponSelect.mg_pOnTriggerChange = ChangeWeaponSelect;
- TRIGGER_MG(mgPlayerWeaponHide, 4.0, mgPlayerWeaponSelect, mgPlayer3rdPerson, TRANS("HIDE WEAPON MODEL"), astrNoYes);
- mgPlayerWeaponHide.mg_boxOnScreen = BoxPlayerSwitch(7.0f);
- mgPlayerWeaponHide.mg_iCenterI = -1;
- mgPlayerWeaponHide.mg_pOnTriggerChange = ChangeWeaponHide;
- TRIGGER_MG(mgPlayer3rdPerson, 4.0, mgPlayerWeaponHide, mgPlayerQuotes, TRANS("PREFER 3RD PERSON VIEW"), astrNoYes);
- mgPlayer3rdPerson.mg_boxOnScreen = BoxPlayerSwitch(8.0f);
- mgPlayer3rdPerson.mg_iCenterI = -1;
- mgPlayer3rdPerson.mg_pOnTriggerChange = Change3rdPerson;
- TRIGGER_MG(mgPlayerQuotes, 4.0, mgPlayer3rdPerson, mgPlayerAutoSave, TRANS("VOICE QUOTES"), astrNoYes);
- mgPlayerQuotes.mg_boxOnScreen = BoxPlayerSwitch(9.0f);
- mgPlayerQuotes.mg_iCenterI = -1;
- mgPlayerQuotes.mg_pOnTriggerChange = ChangeQuotes;
- TRIGGER_MG(mgPlayerAutoSave, 4.0, mgPlayerQuotes, mgPlayerCompDoubleClick, TRANS("AUTO SAVE"), astrNoYes);
- mgPlayerAutoSave.mg_boxOnScreen = BoxPlayerSwitch(10.0f);
- mgPlayerAutoSave.mg_iCenterI = -1;
- mgPlayerAutoSave.mg_pOnTriggerChange = ChangeAutoSave;
- TRIGGER_MG(mgPlayerCompDoubleClick, 4.0, mgPlayerAutoSave, mgPlayerSharpTurning, TRANS("INVOKE COMPUTER"), astrComputerInvoke);
- mgPlayerCompDoubleClick.mg_boxOnScreen = BoxPlayerSwitch(11.0f);
- mgPlayerCompDoubleClick.mg_iCenterI = -1;
- mgPlayerCompDoubleClick.mg_pOnTriggerChange = ChangeCompDoubleClick;
- TRIGGER_MG(mgPlayerSharpTurning, 4.0, mgPlayerCompDoubleClick, mgPlayerViewBobbing, TRANS("SHARP TURNING"), astrNoYes);
- mgPlayerSharpTurning.mg_boxOnScreen = BoxPlayerSwitch(12.0f);
- mgPlayerSharpTurning.mg_iCenterI = -1;
- mgPlayerSharpTurning.mg_pOnTriggerChange = ChangeSharpTurning;
- TRIGGER_MG(mgPlayerViewBobbing, 4.0, mgPlayerSharpTurning, mgPlayerCustomizeControls, TRANS("VIEW BOBBING"), astrNoYes);
- mgPlayerViewBobbing.mg_boxOnScreen = BoxPlayerSwitch(13.0f);
- mgPlayerViewBobbing.mg_iCenterI = -1;
- mgPlayerViewBobbing.mg_pOnTriggerChange = ChangeViewBobbing;
-
- mgPlayerCustomizeControls.mg_strText = TRANS("CUSTOMIZE CONTROLS");
- mgPlayerCustomizeControls.mg_boxOnScreen = BoxMediumLeft(14.5f);
- mgPlayerCustomizeControls.mg_bfsFontSize = BFS_MEDIUM;
- mgPlayerCustomizeControls.mg_iCenterI = -1;
- mgPlayerCustomizeControls.mg_pmgUp = &mgPlayerViewBobbing;
- mgPlayerCustomizeControls.mg_pActivatedFunction = &StartControlsMenuFromPlayer;
- mgPlayerCustomizeControls.mg_pmgDown = &mgPlayerNo[0];
- mgPlayerCustomizeControls.mg_pmgRight = &mgPlayerModel;
- mgPlayerCustomizeControls.mg_strTip = TRANS("customize controls for this player");
- gm_lhGadgets.AddTail( mgPlayerCustomizeControls.mg_lnNode);
-
- mgPlayerModel.mg_boxOnScreen = BoxPlayerModel();
- mgPlayerModel.mg_pmgLeft = &mgPlayerName;
- mgPlayerModel.mg_pActivatedFunction = &StartPlayerModelLoadMenu;
- mgPlayerModel.mg_pmgDown = &mgPlayerName;
- mgPlayerModel.mg_pmgLeft = &mgPlayerName;
- mgPlayerModel.mg_strTip = TRANS("change model for this player");
- gm_lhGadgets.AddTail( mgPlayerModel.mg_lnNode);
-}
-
-INDEX CPlayerProfileMenu::ComboFromPlayer(INDEX iPlayer)
-{
- return iPlayer;
-}
-
-INDEX CPlayerProfileMenu::PlayerFromCombo(INDEX iCombo)
-{
- return iCombo;
-}
-
-void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer)
-{
- CPlayerCharacter &pc = _pGame->gm_apcPlayers[iPlayer];
-
- for( INDEX iPl=0; iPl<8; iPl++)
- {
- mgPlayerNo[iPl].mg_bHighlighted = FALSE;
- }
-
- mgPlayerNo[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;
- }
- mgPlayerName.mg_pstrToChange = &pc.pc_strName;
- mgPlayerName.SetText( *mgPlayerName.mg_pstrToChange);
- mgPlayerTeam.mg_pstrToChange = &pc.pc_strTeam;
- mgPlayerTeam.SetText( *mgPlayerTeam.mg_pstrToChange);
-
- CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance;
-
- mgPlayerCrosshair.mg_iSelected = pps->ps_iCrossHairType+1;
- mgPlayerCrosshair.ApplyCurrentSelection();
- mgPlayerWeaponSelect.mg_iSelected = pps->ps_iWeaponAutoSelect;
- mgPlayerWeaponSelect.ApplyCurrentSelection();
- mgPlayerWeaponHide.mg_iSelected = (pps->ps_ulFlags&PSF_HIDEWEAPON)?1:0;
- mgPlayerWeaponHide.ApplyCurrentSelection();
- mgPlayer3rdPerson.mg_iSelected = (pps->ps_ulFlags&PSF_PREFER3RDPERSON)?1:0;
- mgPlayer3rdPerson.ApplyCurrentSelection();
- mgPlayerQuotes.mg_iSelected = (pps->ps_ulFlags&PSF_NOQUOTES)?0:1;
- mgPlayerQuotes.ApplyCurrentSelection();
- mgPlayerAutoSave.mg_iSelected = (pps->ps_ulFlags&PSF_AUTOSAVE)?1:0;
- mgPlayerAutoSave.ApplyCurrentSelection();
- mgPlayerCompDoubleClick.mg_iSelected = (pps->ps_ulFlags&PSF_COMPSINGLECLICK)?0:1;
- mgPlayerCompDoubleClick.ApplyCurrentSelection();
- mgPlayerViewBobbing.mg_iSelected = (pps->ps_ulFlags&PSF_NOBOBBING)?0:1;
- mgPlayerViewBobbing.ApplyCurrentSelection();
- mgPlayerSharpTurning.mg_iSelected = (pps->ps_ulFlags&PSF_SHARPTURNING)?1:0;
- mgPlayerSharpTurning.ApplyCurrentSelection();
-
- // get function that will set player appearance
- CShellSymbol *pss = _pShell->GetSymbol("SetPlayerAppearance", /*bDeclaredOnly=*/ TRUE);
- // if none
- if (pss==NULL) {
- // no model
- mgPlayerModel.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(&mgPlayerModel.mg_moModel, &pc, strName, TRUE);
- mgPlayerModel.mg_strTip = TRANS("change model for this player");
- mgPlayerModel.mg_bEnabled = TRUE;
- } else {
- // cannot change player appearance in single player mode
- bSet = pFunc(&mgPlayerModel.mg_moModel, NULL, strName, TRUE);
- mgPlayerModel.mg_strTip = TRANS("cannot change model for single-player game");
- mgPlayerModel.mg_bEnabled = FALSE;
- }
- // ignore gender flags, if any
- strName.RemovePrefix("#female#");
- strName.RemovePrefix("#male#");
- mgPlayerModel.mg_plModel = CPlacement3D(FLOAT3D(0.1f,-1.0f,-3.5f), ANGLE3D(150,0,0));
- mgPlayerModel.mg_strText = strName;
- CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance;
- _strLastPlayerAppearance = pps->GetModelFilename();
- try {
- mgPlayerModel.mg_moFloor.SetData_t(CTFILENAME("Models\\Computer\\Floor.mdl"));
- mgPlayerModel.mg_moFloor.mo_toTexture.SetData_t(CTFILENAME("Models\\Computer\\Floor.tex"));
- } catch (char *strError) {
- (void)strError;
- }
- }
-}
-
-
-void OnPlayerSelect(void)
-{
- ASSERT( _pmgLastActivatedGadget != NULL);
- if (_pmgLastActivatedGadget->mg_bEnabled) {
- gmPlayerProfile.SelectPlayer( ((CMGButton *)_pmgLastActivatedGadget)->mg_iIndex);
- }
-}
-
-void CPlayerProfileMenu::StartMenu(void)
-{
- gmPlayerProfile.gm_pmgSelectedByDefault = &mgPlayerName;
-
- if (_gmRunningGameMode==GM_NONE || _gmRunningGameMode==GM_DEMO) {
- for(INDEX i=0; i<8; i++) {
- mgPlayerNo[i].mg_bEnabled = TRUE;
- }
- } else {
- for(INDEX i=0; i<8; i++) {
- mgPlayerNo[i].mg_bEnabled = FALSE;
- }
- INDEX iFirstEnabled = 0;
- {for(INDEX ilp=0; ilp<4; ilp++) {
- CLocalPlayer &lp = _pGame->gm_lpLocalPlayers[ilp];
- if (lp.lp_bActive) {
- mgPlayerNo[lp.lp_iPlayer].mg_bEnabled = TRUE;
- if (iFirstEnabled==0) {
- iFirstEnabled = lp.lp_iPlayer;
- }
- }
- }}
- // backup to first player in case current player is disabled
- if( !mgPlayerNo[*gm_piCurrentPlayer].mg_bEnabled) *gm_piCurrentPlayer = iFirstEnabled;
- }
- // done
- SelectPlayer( *gm_piCurrentPlayer);
- CGameMenu::StartMenu();
-}
-
-
-void CPlayerProfileMenu::EndMenu(void)
-{
- _pGame->SavePlayersAndControls();
- CGameMenu::EndMenu();
-}
-
-// ------------------------ CControlsMenu implementation
-void CControlsMenu::Initialize_t(void)
-{
- // intialize player and controls menu
- mgControlsTitle.mg_boxOnScreen = BoxTitle();
- mgControlsTitle.mg_strText = TRANS("CONTROLS");
- gm_lhGadgets.AddTail( mgControlsTitle.mg_lnNode);
-
- mgControlsNameLabel.mg_strText = "";
- mgControlsNameLabel.mg_boxOnScreen = BoxMediumRow(0.0);
- mgControlsNameLabel.mg_bfsFontSize = BFS_MEDIUM;
- mgControlsNameLabel.mg_iCenterI = -1;
- mgControlsNameLabel.mg_bEnabled = FALSE;
- mgControlsNameLabel.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgControlsNameLabel.mg_lnNode);
-
- mgControlsButtons.mg_strText = TRANS("CUSTOMIZE BUTTONS");
- mgControlsButtons.mg_boxOnScreen = BoxMediumRow(2.0);
- mgControlsButtons.mg_bfsFontSize = BFS_MEDIUM;
- mgControlsButtons.mg_iCenterI = 0;
- gm_lhGadgets.AddTail( mgControlsButtons.mg_lnNode);
- mgControlsButtons.mg_pmgUp = &mgControlsPredefined;
- mgControlsButtons.mg_pmgDown = &mgControlsAdvanced;
- mgControlsButtons.mg_pActivatedFunction = &StartCustomizeKeyboardMenu;
- mgControlsButtons.mg_strTip = TRANS("customize buttons in current controls");
-
- mgControlsAdvanced.mg_strText = TRANS("ADVANCED JOYSTICK SETUP");
- mgControlsAdvanced.mg_iCenterI = 0;
- mgControlsAdvanced.mg_boxOnScreen = BoxMediumRow(3);
- mgControlsAdvanced.mg_bfsFontSize = BFS_MEDIUM;
- gm_lhGadgets.AddTail( mgControlsAdvanced.mg_lnNode);
- mgControlsAdvanced.mg_pmgUp = &mgControlsButtons;
- mgControlsAdvanced.mg_pmgDown = &mgControlsSensitivity;
- mgControlsAdvanced.mg_pActivatedFunction = &StartCustomizeAxisMenu;
- mgControlsAdvanced.mg_strTip = TRANS("adjust advanced settings for joystick axis");
-
- mgControlsSensitivity.mg_boxOnScreen = BoxMediumRow(4.5);
- mgControlsSensitivity.mg_strText = TRANS("SENSITIVITY");
- mgControlsSensitivity.mg_pmgUp = &mgControlsAdvanced;
- mgControlsSensitivity.mg_pmgDown = &mgControlsInvertTrigger;
- mgControlsSensitivity.mg_strTip = TRANS("sensitivity for all axis in this control set");
- gm_lhGadgets.AddTail( mgControlsSensitivity.mg_lnNode);
-
- TRIGGER_MG( mgControlsInvertTrigger, 5.5, mgControlsSensitivity, mgControlsSmoothTrigger,
- TRANS("INVERT LOOK"), astrNoYes);
- mgControlsInvertTrigger.mg_strTip = TRANS("invert up/down looking");
- TRIGGER_MG( mgControlsSmoothTrigger, 6.5, mgControlsInvertTrigger, mgControlsAccelTrigger,
- TRANS("SMOOTH AXIS"), astrNoYes);
- mgControlsSmoothTrigger.mg_strTip = TRANS("smooth mouse/joystick movements");
- TRIGGER_MG( mgControlsAccelTrigger, 7.5, mgControlsSmoothTrigger, mgControlsIFeelTrigger,
- TRANS("MOUSE ACCELERATION"), astrNoYes);
- mgControlsAccelTrigger.mg_strTip = TRANS("allow mouse acceleration");
- TRIGGER_MG( mgControlsIFeelTrigger, 8.5, mgControlsAccelTrigger, mgControlsPredefined,
- TRANS("ENABLE IFEEL"), astrNoYes);
- mgControlsIFeelTrigger.mg_strTip = TRANS("enable support for iFeel tactile feedback mouse");
-
- mgControlsPredefined.mg_strText = TRANS("LOAD PREDEFINED SETTINGS");
- mgControlsPredefined.mg_iCenterI = 0;
- mgControlsPredefined.mg_boxOnScreen = BoxMediumRow(10);
- mgControlsPredefined.mg_bfsFontSize = BFS_MEDIUM;
- gm_lhGadgets.AddTail( mgControlsPredefined.mg_lnNode);
- mgControlsPredefined.mg_pmgUp = &mgControlsIFeelTrigger;
- mgControlsPredefined.mg_pmgDown = &mgControlsButtons;
- mgControlsPredefined.mg_pActivatedFunction = &StartControlsLoadMenu;
- mgControlsPredefined.mg_strTip = TRANS("load one of several predefined control settings");
-}
-
-void CControlsMenu::StartMenu(void)
-{
- gm_pmgSelectedByDefault = &mgControlsButtons;
- INDEX iPlayer = _pGame->gm_iSinglePlayer;
- if (_iLocalPlayer>=0 && _iLocalPlayer<4) {
- iPlayer = _pGame->gm_aiMenuLocalPlayers[_iLocalPlayer];
- }
- _fnmControlsToCustomize.PrintF("Controls\\Controls%d.ctl", iPlayer);
-
- ControlsMenuOn();
-
- mgControlsNameLabel.mg_strText.PrintF(TRANS("CONTROLS FOR: %s"), _pGame->gm_apcPlayers[iPlayer].GetNameForPrinting());
-
- ObtainActionSettings();
- CGameMenu::StartMenu();
-}
-
-void CControlsMenu::EndMenu(void)
-{
- ApplyActionSettings();
-
- ControlsMenuOff();
-
- CGameMenu::EndMenu();
-}
-
-void CControlsMenu::ObtainActionSettings(void)
-{
- CControls &ctrls = _pGame->gm_ctrlControlsExtra;
-
- mgControlsSensitivity.mg_iMinPos = 0;
- mgControlsSensitivity.mg_iMaxPos = 50;
- mgControlsSensitivity.mg_iCurPos = ctrls.ctrl_fSensitivity/2;
- mgControlsSensitivity.ApplyCurrentPosition();
-
- mgControlsInvertTrigger.mg_iSelected = ctrls.ctrl_bInvertLook ? 1 : 0;
- mgControlsSmoothTrigger.mg_iSelected = ctrls.ctrl_bSmoothAxes ? 1 : 0;
- mgControlsAccelTrigger .mg_iSelected = _pShell->GetINDEX("inp_bAllowMouseAcceleration") ? 1 : 0;
- mgControlsIFeelTrigger .mg_bEnabled = _pShell->GetINDEX("sys_bIFeelEnabled") ? 1 : 0;
- mgControlsIFeelTrigger .mg_iSelected = _pShell->GetFLOAT("inp_fIFeelGain")>0 ? 1 : 0;
-
- mgControlsInvertTrigger.ApplyCurrentSelection();
- mgControlsSmoothTrigger.ApplyCurrentSelection();
- mgControlsAccelTrigger .ApplyCurrentSelection();
- mgControlsIFeelTrigger .ApplyCurrentSelection();
-}
-
-void CControlsMenu::ApplyActionSettings(void)
-{
- CControls &ctrls = _pGame->gm_ctrlControlsExtra;
-
- FLOAT fSensitivity =
- FLOAT(mgControlsSensitivity.mg_iCurPos-mgControlsSensitivity.mg_iMinPos) /
- FLOAT(mgControlsSensitivity.mg_iMaxPos-mgControlsSensitivity.mg_iMinPos)*100.0f;
-
- BOOL bInvert = mgControlsInvertTrigger.mg_iSelected != 0;
- BOOL bSmooth = mgControlsSmoothTrigger.mg_iSelected != 0;
- BOOL bAccel = mgControlsAccelTrigger .mg_iSelected != 0;
- BOOL bIFeel = mgControlsIFeelTrigger .mg_iSelected != 0;
-
- if (INDEX(ctrls.ctrl_fSensitivity)!=INDEX(fSensitivity)) {
- ctrls.ctrl_fSensitivity = fSensitivity;
- }
- ctrls.ctrl_bInvertLook = bInvert;
- ctrls.ctrl_bSmoothAxes = bSmooth;
- _pShell->SetINDEX("inp_bAllowMouseAcceleration", bAccel);
- _pShell->SetFLOAT("inp_fIFeelGain", bIFeel ? 1.0f : 0.0f);
- ctrls.CalculateInfluencesForAllAxis();
-}
-
-// ------------------------ CLoadSaveMenu implementation
-void CLoadSaveMenu::Initialize_t(void)
-{
- gm_pgmNextMenu = NULL;
-
- mgLoadSaveTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgLoadSaveTitle.mg_lnNode);
-
- mgLoadSaveNotes.mg_boxOnScreen = BoxMediumRow(10.0);
- mgLoadSaveNotes.mg_bfsFontSize = BFS_MEDIUM;
- mgLoadSaveNotes.mg_iCenterI = -1;
- mgLoadSaveNotes.mg_bEnabled = FALSE;
- mgLoadSaveNotes.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgLoadSaveNotes.mg_lnNode);
-
- for( INDEX iLabel=0; iLabel afnmDir;
- MakeDirList(afnmDir, gm_fnmDirectory, "", 0);
- gm_iLastFile = -1;
-
- // for each file in the directory
- for (INDEX i=0; ifi_fnFile = fnm;
- pfi->fi_strName = strName;
- // add it to list
- gm_lhFileInfos.AddTail(pfi->fi_lnNode);
- }
- }
-
- // sort if needed
- switch (gm_iSortType) {
- default: ASSERT(FALSE);
- case LSSORT_NONE: break;
- case LSSORT_NAMEUP:
- gm_lhFileInfos.Sort(qsort_CompareFileInfos_NameUp, offsetof(CFileInfo, fi_lnNode));
- break;
- case LSSORT_NAMEDN:
- gm_lhFileInfos.Sort(qsort_CompareFileInfos_NameDn, offsetof(CFileInfo, fi_lnNode));
- break;
- case LSSORT_FILEUP:
- gm_lhFileInfos.Sort(qsort_CompareFileInfos_FileUp, offsetof(CFileInfo, fi_lnNode));
- break;
- case LSSORT_FILEDN:
- gm_lhFileInfos.Sort(qsort_CompareFileInfos_FileDn, offsetof(CFileInfo, fi_lnNode));
- break;
- }
-
- // if saving
- if (gm_bSave) {
- // add one info as empty slot
- CFileInfo *pfi = new CFileInfo;
- CTString strNumber;
- strNumber.PrintF("%04d", gm_iLastFile+1);
- pfi->fi_fnFile = gm_fnmDirectory+gm_fnmBaseName+strNumber+gm_fnmExt;
- pfi->fi_strName = EMPTYSLOTSTRING;
- // add it to beginning
- gm_lhFileInfos.AddHead(pfi->fi_lnNode);
- }
-
- // set default parameters for the list
- gm_iListOffset = 0;
- gm_ctListTotal = gm_lhFileInfos.Count();
-
- // find which one should be selected
- gm_iListWantedItem = 0;
- if (gm_fnmSelected != "") {
- INDEX i = 0;
- FOREACHINLIST(CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
- CFileInfo &fi = *itfi;
- if (fi.fi_fnFile==gm_fnmSelected) {
- gm_iListWantedItem = i;
- break;
- }
- i++;
- }
- }
-
- CGameMenu::StartMenu();
-}
-void CLoadSaveMenu::EndMenu(void)
-{
- // delete all file infos
- FORDELETELIST( CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
- delete &itfi.Current();
- }
- gm_pgmNextMenu = NULL;
- CGameMenu::EndMenu();
-}
-
-void CLoadSaveMenu::FillListItems(void)
-{
- // disable all items first
- for(INDEX i=0; i");
- amgLSButton[i].mg_strTip = "";
- amgLSButton[i].mg_iInList = -2;
- }
-
- BOOL bHasFirst = FALSE;
- BOOL bHasLast = FALSE;
- INDEX ctLabels = gm_lhFileInfos.Count();
- INDEX iLabel=0;
- FOREACHINLIST(CFileInfo, fi_lnNode, gm_lhFileInfos, itfi) {
- CFileInfo &fi = *itfi;
- INDEX iInMenu = iLabel-gm_iListOffset;
- if( (iLabel>=gm_iListOffset) &&
- (iLabel<(gm_iListOffset+SAVELOAD_BUTTONS_CT)) )
- {
- bHasFirst|=(iLabel==0);
- bHasLast |=(iLabel==ctLabels-1);
- amgLSButton[iInMenu].mg_iInList = iLabel;
- amgLSButton[iInMenu].mg_strDes = fi.fi_strName;
- amgLSButton[iInMenu].mg_fnm = fi.fi_fnFile;
- amgLSButton[iInMenu].mg_bEnabled = TRUE;
- amgLSButton[iInMenu].RefreshText();
- if (gm_bSave) {
- if (!FileExistsForWriting(amgLSButton[iInMenu].mg_fnm)) {
- amgLSButton[iInMenu].mg_strTip = TRANS("Enter - save in new slot");
- } else {
- amgLSButton[iInMenu].mg_strTip = TRANS("Enter - save here, F2 - rename, Del - delete");
- }
- } else if (gm_bManage) {
- amgLSButton[iInMenu].mg_strTip = TRANS("Enter - load this, F2 - rename, Del - delete");
- } else {
- amgLSButton[iInMenu].mg_strTip = TRANS("Enter - load this");
- }
- }
- iLabel++;
- }
-
- // enable/disable up/down arrows
- mgLSArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
- mgLSArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
-}
-
-// called to get info of a file from directory, or to skip it
-BOOL CLoadSaveMenu::ParseFile(const CTFileName &fnm, CTString &strName)
-{
- if (fnm.FileExt()!=gm_fnmExt) {
- return FALSE;
- }
- CTFileName fnSaveGameDescription = fnm.NoExt()+".des";
- try {
- strName.Load_t( fnSaveGameDescription);
- } catch( char *strError) {
- (void)strError;
- strName = fnm.FileName();
-
- if (fnm.FileExt()==".ctl") {
- INDEX iCtl = -1;
- strName.ScanF("Controls%d", &iCtl);
- if (iCtl>=0 && iCtl<=7) {
- strName.PrintF(TRANS("From player: %s"), _pGame->gm_apcPlayers[iCtl].GetNameForPrinting());
- }
- }
- }
-
- INDEX iFile = -1;
- fnm.FileName().ScanF((const char*)(gm_fnmBaseName+"%d"), &iFile);
-
- gm_iLastFile = Max(gm_iLastFile, iFile);
-
- return TRUE;
-}
-
-void CHighScoreMenu::Initialize_t(void)
-{
- mgHScore.mg_boxOnScreen = FLOATaabbox2D(FLOAT2D(0,0), FLOAT2D(1,0.5));
- gm_lhGadgets.AddTail( mgHScore.mg_lnNode);
-
- mgHighScoreTitle.mg_strText = TRANS("HIGH SCORE TABLE");
- mgHighScoreTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgHighScoreTitle.mg_lnNode);
-}
-
-void CHighScoreMenu::StartMenu(void)
-{
- gm_pgmParentMenu = pgmCurrentMenu;
- CGameMenu::StartMenu();
-}
-
-// ------------------------ CCustomizeKeyboardMenu implementation
-void CCustomizeKeyboardMenu::FillListItems(void)
-{
- // disable all items first
- for(INDEX i=0; igm_ctrlControlsExtra.ctrl_lhButtonActions.Count();
- FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct)
- {
- INDEX iInMenu = iLabel-gm_iListOffset;
- if( (iLabel>=gm_iListOffset) &&
- (iLabel<(gm_iListOffset+gm_ctListVisible)) )
- {
- bHasFirst|=(iLabel==0);
- bHasLast |=(iLabel==ctLabels-1);
- mgKey[iInMenu].mg_strLabel = TranslateConst(itAct->ba_strName, 0);
- mgKey[iInMenu].mg_iControlNumber = iLabel;
- mgKey[iInMenu].SetBindingNames(FALSE);
- mgKey[iInMenu].mg_strTip = TRANS("Enter - change binding, Backspace - unbind");
- mgKey[iInMenu].mg_bEnabled = TRUE;
- mgKey[iInMenu].mg_iInList = iLabel;
- }
- iLabel++;
- }
-
- // enable/disable up/down arrows
- mgCustomizeArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
- mgCustomizeArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
-}
-
-void CCustomizeKeyboardMenu::Initialize_t(void)
-{
- // intialize Audio options menu
- mgCustomizeKeyboardTitle.mg_strText = TRANS("CUSTOMIZE BUTTONS");
- mgCustomizeKeyboardTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgCustomizeKeyboardTitle.mg_lnNode);
-
-#define KL_START 3.0f
-#define KL_STEEP -1.45f
- for( INDEX iLabel=0; iLabelgm_ctrlControlsExtra.ctrl_lhButtonActions.Count();
- gm_iListWantedItem = 0;
- CGameMenu::StartMenu();
-}
-void CCustomizeKeyboardMenu::EndMenu(void)
-{
- ControlsMenuOff();
- CGameMenu::EndMenu();
-}
-
-CCustomizeAxisMenu::~CCustomizeAxisMenu(void)
-{
- delete[] mgAxisActionTrigger.mg_astrTexts;
- delete[] mgAxisMountedTrigger.mg_astrTexts;
-}
-
-void PreChangeAxis(INDEX iDummy)
-{
- gmCustomizeAxisMenu.ApplyActionSettings();
-}
-void PostChangeAxis(INDEX iDummy)
-{
- gmCustomizeAxisMenu.ObtainActionSettings();
-}
-
-void CCustomizeAxisMenu::Initialize_t(void)
-{
- // intialize axis menu
- mgCustomizeAxisTitle.mg_strText = TRANS("CUSTOMIZE AXIS");
- mgCustomizeAxisTitle.mg_boxOnScreen = BoxTitle();
- gm_lhGadgets.AddTail( mgCustomizeAxisTitle.mg_lnNode);
-
- TRIGGER_MG(mgAxisActionTrigger, 0, mgAxisSmoothTrigger, mgAxisMountedTrigger, TRANS("ACTION"), astrNoYes);
- mgAxisActionTrigger.mg_strTip = TRANS("choose action to customize");
- TRIGGER_MG(mgAxisMountedTrigger, 2, mgAxisActionTrigger, mgAxisSensitivity, TRANS("MOUNTED TO"), astrNoYes);
- mgAxisMountedTrigger.mg_strTip = TRANS("choose controller axis that will perform the action");
-
- mgAxisActionTrigger.mg_astrTexts = new CTString[ AXIS_ACTIONS_CT];
- mgAxisActionTrigger.mg_ctTexts = AXIS_ACTIONS_CT;
-
- mgAxisActionTrigger.mg_pPreTriggerChange = PreChangeAxis;
- mgAxisActionTrigger.mg_pOnTriggerChange = PostChangeAxis;
-
- // for all available axis type controlers
- for( INDEX iControler=0; iControlergm_astrAxisNames[ iControler]), 0);
- }
- mgAxisActionTrigger.mg_iSelected = 3;
-
- INDEX ctAxis = _pInput->GetAvailableAxisCount();
- mgAxisMountedTrigger.mg_astrTexts = new CTString[ ctAxis];
- mgAxisMountedTrigger.mg_ctTexts = ctAxis;
- // for all axis actions that can be mounted
- for( INDEX iAxis=0; iAxisGetAxisTransName( iAxis);
- }
-
- mgAxisSensitivity.mg_boxOnScreen = BoxMediumRow(3);
- mgAxisSensitivity.mg_strText = TRANS("SENSITIVITY");
- mgAxisSensitivity.mg_pmgUp = &mgAxisMountedTrigger;
- mgAxisSensitivity.mg_pmgDown = &mgAxisDeadzone;
- gm_lhGadgets.AddTail( mgAxisSensitivity.mg_lnNode);
- mgAxisSensitivity.mg_strTip = TRANS("set sensitivity for this axis");
-
- mgAxisDeadzone.mg_boxOnScreen = BoxMediumRow(4);
- mgAxisDeadzone.mg_strText = TRANS("DEAD ZONE");
- mgAxisDeadzone.mg_pmgUp = &mgAxisSensitivity;
- mgAxisDeadzone.mg_pmgDown = &mgAxisInvertTrigger;
- gm_lhGadgets.AddTail( mgAxisDeadzone.mg_lnNode);
- mgAxisDeadzone.mg_strTip = TRANS("set dead zone for this axis");
-
- TRIGGER_MG(mgAxisInvertTrigger, 5, mgAxisDeadzone, mgAxisRelativeTrigger, TRANS("INVERTED"), astrNoYes);
- mgAxisInvertTrigger.mg_strTip = TRANS("choose whether to invert this axis or not");
- TRIGGER_MG(mgAxisRelativeTrigger, 6, mgAxisInvertTrigger, mgAxisSmoothTrigger, TRANS("RELATIVE"), astrNoYes);
- mgAxisRelativeTrigger.mg_strTip = TRANS("select relative or absolute axis reading");
- TRIGGER_MG(mgAxisSmoothTrigger, 7, mgAxisRelativeTrigger, mgAxisActionTrigger, TRANS("SMOOTH"), astrNoYes);
- mgAxisSmoothTrigger.mg_strTip = TRANS("turn this on to filter readings on this axis");
-}
-
-void CCustomizeAxisMenu::ObtainActionSettings(void)
-{
- ControlsMenuOn();
- CControls &ctrls = _pGame->gm_ctrlControlsExtra;
- INDEX iSelectedAction = mgAxisActionTrigger.mg_iSelected;
- INDEX iMountedAxis = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_iAxisAction;
-
- mgAxisMountedTrigger.mg_iSelected = iMountedAxis;
-
- mgAxisSensitivity.mg_iMinPos = 0;
- mgAxisSensitivity.mg_iMaxPos = 50;
- mgAxisSensitivity.mg_iCurPos = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fSensitivity/2;
- mgAxisSensitivity.ApplyCurrentPosition();
-
- mgAxisDeadzone.mg_iMinPos = 0;
- mgAxisDeadzone.mg_iMaxPos = 50;
- mgAxisDeadzone.mg_iCurPos = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fDeadZone/2;
- mgAxisDeadzone.ApplyCurrentPosition();
-
- mgAxisInvertTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bInvert ? 1 : 0;
- mgAxisRelativeTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bRelativeControler ? 1 : 0;
- mgAxisSmoothTrigger.mg_iSelected = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bSmooth ? 1 : 0;
-
- mgAxisActionTrigger.ApplyCurrentSelection();
- mgAxisMountedTrigger.ApplyCurrentSelection();
- mgAxisInvertTrigger.ApplyCurrentSelection();
- mgAxisRelativeTrigger.ApplyCurrentSelection();
- mgAxisSmoothTrigger.ApplyCurrentSelection();
-}
-
-void CCustomizeAxisMenu::ApplyActionSettings(void)
-{
- CControls &ctrls = _pGame->gm_ctrlControlsExtra;
- INDEX iSelectedAction = mgAxisActionTrigger.mg_iSelected;
- INDEX iMountedAxis = mgAxisMountedTrigger.mg_iSelected;
- FLOAT fSensitivity =
- FLOAT(mgAxisSensitivity.mg_iCurPos-mgAxisSensitivity.mg_iMinPos) /
- FLOAT(mgAxisSensitivity.mg_iMaxPos-mgAxisSensitivity.mg_iMinPos)*100.0f;
- FLOAT fDeadZone =
- FLOAT(mgAxisDeadzone.mg_iCurPos-mgAxisDeadzone.mg_iMinPos) /
- FLOAT(mgAxisDeadzone.mg_iMaxPos-mgAxisDeadzone.mg_iMinPos)*100.0f;
-
- BOOL bInvert = mgAxisInvertTrigger.mg_iSelected != 0;
- BOOL bRelative = mgAxisRelativeTrigger.mg_iSelected != 0;
- BOOL bSmooth = mgAxisSmoothTrigger.mg_iSelected != 0;
-
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_iAxisAction = iMountedAxis;
- if (INDEX(ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fSensitivity)!=INDEX(fSensitivity)) {
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fSensitivity = fSensitivity;
- }
- if (INDEX(ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fDeadZone)!=INDEX(fDeadZone)) {
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_fDeadZone = fDeadZone;
- }
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bInvert = bInvert;
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bRelativeControler = bRelative;
- ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_bSmooth = bSmooth;
- ctrls.CalculateInfluencesForAllAxis();
- ControlsMenuOff();
-}
-
-void CCustomizeAxisMenu::StartMenu(void)
-{
- ObtainActionSettings();
-
- CGameMenu::StartMenu();
-}
-
-void CCustomizeAxisMenu::EndMenu(void)
-{
- ApplyActionSettings();
- CGameMenu::EndMenu();
-}
-
-// ------------------------ COptionsMenu implementation
-void COptionsMenu::Initialize_t(void)
-{
- // intialize options menu
- mgOptionsTitle.mg_boxOnScreen = BoxTitle();
- mgOptionsTitle.mg_strText = TRANS("OPTIONS");
- gm_lhGadgets.AddTail( mgOptionsTitle.mg_lnNode);
-
- mgVideoOptions.mg_bfsFontSize = BFS_LARGE;
- mgVideoOptions.mg_boxOnScreen = BoxBigRow(0.0f);
- mgVideoOptions.mg_pmgUp = &mgAddonOptions;
- mgVideoOptions.mg_pmgDown = &mgAudioOptions;
- mgVideoOptions.mg_strText = TRANS("VIDEO OPTIONS");
- mgVideoOptions.mg_strTip = TRANS("set video mode and driver");
- gm_lhGadgets.AddTail( mgVideoOptions.mg_lnNode);
- mgVideoOptions.mg_pActivatedFunction = &StartVideoOptionsMenu;
-
- mgAudioOptions.mg_bfsFontSize = BFS_LARGE;
- mgAudioOptions.mg_boxOnScreen = BoxBigRow(1.0f);
- mgAudioOptions.mg_pmgUp = &mgVideoOptions;
- mgAudioOptions.mg_pmgDown = &mgPlayerProfileOptions;
- mgAudioOptions.mg_strText = TRANS("AUDIO OPTIONS");
- mgAudioOptions.mg_strTip = TRANS("set audio quality and volume");
- gm_lhGadgets.AddTail( mgAudioOptions.mg_lnNode);
- mgAudioOptions.mg_pActivatedFunction = &StartAudioOptionsMenu;
-
- mgPlayerProfileOptions.mg_bfsFontSize = BFS_LARGE;
- mgPlayerProfileOptions.mg_boxOnScreen = BoxBigRow(2.0f);
- mgPlayerProfileOptions.mg_pmgUp = &mgAudioOptions;
- mgPlayerProfileOptions.mg_pmgDown = &mgNetworkOptions;
- mgPlayerProfileOptions.mg_strText = TRANS("PLAYERS AND CONTROLS");
- mgPlayerProfileOptions.mg_strTip = TRANS("change currently active player or adjust controls");
- gm_lhGadgets.AddTail( mgPlayerProfileOptions.mg_lnNode);
- mgPlayerProfileOptions.mg_pActivatedFunction = &StartChangePlayerMenuFromOptions;
-
- mgNetworkOptions.mg_bfsFontSize = BFS_LARGE;
- mgNetworkOptions.mg_boxOnScreen = BoxBigRow(3);
- mgNetworkOptions.mg_pmgUp = &mgPlayerProfileOptions;
- mgNetworkOptions.mg_pmgDown = &mgCustomOptions;
- mgNetworkOptions.mg_strText = TRANS("NETWORK CONNECTION");
- mgNetworkOptions.mg_strTip = TRANS("choose your connection parameters");
- gm_lhGadgets.AddTail( mgNetworkOptions.mg_lnNode);
- mgNetworkOptions.mg_pActivatedFunction = &StartNetworkSettingsMenu;
-
- mgCustomOptions.mg_bfsFontSize = BFS_LARGE;
- mgCustomOptions.mg_boxOnScreen = BoxBigRow(4);
- mgCustomOptions.mg_pmgUp = &mgNetworkOptions;
- mgCustomOptions.mg_pmgDown = &mgAddonOptions;
- mgCustomOptions.mg_strText = TRANS("ADVANCED OPTIONS");
- mgCustomOptions.mg_strTip = TRANS("for advanced users only");
- gm_lhGadgets.AddTail( mgCustomOptions.mg_lnNode);
- mgCustomOptions.mg_pActivatedFunction = &StartCustomLoadMenu;
-
- mgAddonOptions.mg_bfsFontSize = BFS_LARGE;
- mgAddonOptions.mg_boxOnScreen = BoxBigRow(5);
- mgAddonOptions.mg_pmgUp = &mgCustomOptions;
- mgAddonOptions.mg_pmgDown = &mgVideoOptions;
- mgAddonOptions.mg_strText = TRANS("EXECUTE ADDON");
- mgAddonOptions.mg_strTip = TRANS("choose from list of addons to execute");
- gm_lhGadgets.AddTail( mgAddonOptions.mg_lnNode);
- mgAddonOptions.mg_pActivatedFunction = &StartAddonsLoadMenu;
-}
-
-
-// ------------------------ CVideoOptionsMenu implementation
-
-static void FillResolutionsList(void)
-{
- // free resolutions
- if (_astrResolutionTexts!=NULL) {
- delete [] _astrResolutionTexts;
- }
- if (_admResolutionModes!=NULL) {
- delete [] _admResolutionModes;
- }
- _ctResolutions = 0;
-
- // if window
- if( mgFullScreenTrigger.mg_iSelected==0) {
- // always has fixed resolutions, but not greater than desktop
- static PIX apixWidths[][2] = {
- 320, 240,
- 400, 300,
- 512, 384,
- 640, 240,
- 640, 480,
- 720, 540,
- 800, 300,
- 800, 600,
- 960, 720,
- 1024, 384,
- 1024, 768,
- 1152, 864,
- 1280, 480,
- 1280, 960,
- 1600, 600,
- 1600,1200,
- 1920, 720,
- 1920,1440,
- 2048, 786,
- 2048,1536,
- };
- _ctResolutions = ARRAYCOUNT(apixWidths);
- _astrResolutionTexts = new CTString [_ctResolutions];
- _admResolutionModes = new CDisplayMode[_ctResolutions];
- extern PIX _pixDesktopWidth;
- INDEX iRes=0;
- for( ; iRes<_ctResolutions; iRes++) {
- if( apixWidths[iRes][0]>_pixDesktopWidth) break;
- SetResolutionInList( iRes, apixWidths[iRes][0], apixWidths[iRes][1]);
- }
- _ctResolutions = iRes;
-
- // if fullscreen
- } else {
- // get resolutions list from engine
- CDisplayMode *pdm = _pGfx->EnumDisplayModes(_ctResolutions,
- SwitchToAPI(mgDisplayAPITrigger.mg_iSelected), mgDisplayAdaptersTrigger.mg_iSelected);
- // allocate that much
- _astrResolutionTexts = new CTString [_ctResolutions];
- _admResolutionModes = new CDisplayMode[_ctResolutions];
- // for each resolution
- for( INDEX iRes=0; iRes<_ctResolutions; iRes++) {
- // add it to list
- SetResolutionInList( iRes, pdm[iRes].dm_pixSizeI, pdm[iRes].dm_pixSizeJ);
- }
- }
- mgResolutionsTrigger.mg_astrTexts = _astrResolutionTexts;
- mgResolutionsTrigger.mg_ctTexts = _ctResolutions;
-}
-
-
-static void FillAdaptersList(void)
-{
- if (_astrAdapterTexts!=NULL) {
- delete [] _astrAdapterTexts;
- }
- _ctAdapters = 0;
-
- INDEX iApi = SwitchToAPI(mgDisplayAPITrigger.mg_iSelected);
- _ctAdapters = _pGfx->gl_gaAPI[iApi].ga_ctAdapters;
- _astrAdapterTexts = new CTString[_ctAdapters];
- for(INDEX iAdapter = 0; iAdapter<_ctAdapters; iAdapter++) {
- _astrAdapterTexts[iAdapter] = _pGfx->gl_gaAPI[iApi].ga_adaAdapter[iAdapter].da_strRenderer;
- }
- mgDisplayAdaptersTrigger.mg_astrTexts = _astrAdapterTexts;
- mgDisplayAdaptersTrigger.mg_ctTexts = _ctAdapters;
-}
-
-
-static void UpdateVideoOptionsButtons(INDEX iSelected)
-{
- const BOOL _bVideoOptionsChanged = (iSelected != -1);
-
- const BOOL bOGLEnabled = _pGfx->HasAPI(GAT_OGL);
-#ifdef SE1_D3D
- const BOOL bD3DEnabled = _pGfx->HasAPI(GAT_D3D);
- ASSERT( bOGLEnabled || bD3DEnabled);
-#else //
- ASSERT( bOGLEnabled );
-#endif // SE1_D3D
- CDisplayAdapter &da = _pGfx->gl_gaAPI[SwitchToAPI(mgDisplayAPITrigger.mg_iSelected)]
- .ga_adaAdapter[mgDisplayAdaptersTrigger.mg_iSelected];
-
- // number of available preferences is higher if video setup is custom
- mgDisplayPrefsTrigger.mg_ctTexts = 3;
- if( sam_iVideoSetup==3) mgDisplayPrefsTrigger.mg_ctTexts++;
-
- // enumerate adapters
- FillAdaptersList();
-
- // show or hide buttons
- mgDisplayAPITrigger.mg_bEnabled = bOGLEnabled
-#ifdef SE1_D3D
- && bD3DEnabled
-#endif // SE1_D3D
- ;
- mgDisplayAdaptersTrigger.mg_bEnabled = _ctAdapters>1;
- mgVideoOptionsApply.mg_bEnabled = _bVideoOptionsChanged;
- // determine which should be visible
- mgFullScreenTrigger.mg_bEnabled = TRUE;
- if( da.da_ulFlags&DAF_FULLSCREENONLY) {
- mgFullScreenTrigger.mg_bEnabled = FALSE;
- mgFullScreenTrigger.mg_iSelected = 1;
- mgFullScreenTrigger.ApplyCurrentSelection();
- }
- mgBitsPerPixelTrigger.mg_bEnabled = TRUE;
- if( mgFullScreenTrigger.mg_iSelected==0) {
- mgBitsPerPixelTrigger.mg_bEnabled = FALSE;
- mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch(DD_DEFAULT);
- mgBitsPerPixelTrigger.ApplyCurrentSelection();
- } else if( da.da_ulFlags&DAF_16BITONLY) {
- mgBitsPerPixelTrigger.mg_bEnabled = FALSE;
- mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch(DD_16BIT);
- mgBitsPerPixelTrigger.ApplyCurrentSelection();
- }
-
- // remember current selected resolution
- PIX pixSizeI, pixSizeJ;
- ResolutionToSize(mgResolutionsTrigger.mg_iSelected, pixSizeI, pixSizeJ);
-
- // select same resolution again if possible
- FillResolutionsList();
- SizeToResolution(pixSizeI, pixSizeJ, mgResolutionsTrigger.mg_iSelected);
-
- // apply adapter and resolutions
- mgDisplayAdaptersTrigger.ApplyCurrentSelection();
- mgResolutionsTrigger.ApplyCurrentSelection();
-}
-
-
-static void InitVideoOptionsButtons(void)
-{
- if( sam_bFullScreenActive) {
- mgFullScreenTrigger.mg_iSelected = 1;
- } else {
- mgFullScreenTrigger.mg_iSelected = 0;
- }
-
- mgDisplayAPITrigger.mg_iSelected = APIToSwitch((GfxAPIType)(INDEX)sam_iGfxAPI);
- mgDisplayAdaptersTrigger.mg_iSelected = sam_iDisplayAdapter;
- mgBitsPerPixelTrigger.mg_iSelected = DepthToSwitch((enum DisplayDepth)(INDEX)sam_iDisplayDepth);
-
- FillResolutionsList();
- SizeToResolution( sam_iScreenSizeI, sam_iScreenSizeJ, mgResolutionsTrigger.mg_iSelected);
- mgDisplayPrefsTrigger.mg_iSelected = Clamp(int(sam_iVideoSetup), 0,3);
-
- mgFullScreenTrigger.ApplyCurrentSelection();
- mgDisplayPrefsTrigger.ApplyCurrentSelection();
- mgDisplayAPITrigger.ApplyCurrentSelection();
- mgDisplayAdaptersTrigger.ApplyCurrentSelection();
- mgResolutionsTrigger.ApplyCurrentSelection();
- mgBitsPerPixelTrigger.ApplyCurrentSelection();
-}
-
-
-void CVideoOptionsMenu::Initialize_t(void)
-{
- // intialize video options menu
- mgVideoOptionsTitle.mg_boxOnScreen = BoxTitle();
- mgVideoOptionsTitle.mg_strText = TRANS("VIDEO");
- gm_lhGadgets.AddTail( mgVideoOptionsTitle.mg_lnNode);
-
- TRIGGER_MG(mgDisplayAPITrigger, 0,
- mgVideoOptionsApply, mgDisplayAdaptersTrigger, TRANS("GRAPHICS API"), astrDisplayAPIRadioTexts);
- mgDisplayAPITrigger.mg_strTip = TRANS("choose graphics API to be used");
- TRIGGER_MG(mgDisplayAdaptersTrigger, 1,
- mgDisplayAPITrigger, mgDisplayPrefsTrigger, TRANS("DISPLAY ADAPTER"), astrNoYes);
- mgDisplayAdaptersTrigger.mg_strTip = TRANS("choose display adapter to be used");
- TRIGGER_MG(mgDisplayPrefsTrigger, 2,
- mgDisplayAdaptersTrigger, mgResolutionsTrigger, TRANS("PREFERENCES"), astrDisplayPrefsRadioTexts);
- mgDisplayPrefsTrigger.mg_strTip = TRANS("balance between speed and rendering quality, depending on your system");
- TRIGGER_MG(mgResolutionsTrigger, 3,
- mgDisplayPrefsTrigger, mgFullScreenTrigger, TRANS("RESOLUTION"), astrNoYes);
- mgResolutionsTrigger.mg_strTip = TRANS("select video mode resolution");
- TRIGGER_MG(mgFullScreenTrigger, 4,
- mgResolutionsTrigger, mgBitsPerPixelTrigger, TRANS("FULL SCREEN"), astrNoYes);
- mgFullScreenTrigger.mg_strTip = TRANS("make game run in a window or in full screen");
- TRIGGER_MG(mgBitsPerPixelTrigger, 5,
- mgFullScreenTrigger, mgVideoRendering, TRANS("BITS PER PIXEL"), astrBitsPerPixelRadioTexts);
- mgBitsPerPixelTrigger.mg_strTip = TRANS("select number of colors used for display");
-
- mgDisplayPrefsTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
- mgDisplayAPITrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
- mgDisplayAdaptersTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
- mgFullScreenTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
- mgResolutionsTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
- mgBitsPerPixelTrigger.mg_pOnTriggerChange = &UpdateVideoOptionsButtons;
-
-
- mgVideoRendering.mg_bfsFontSize = BFS_MEDIUM;
- mgVideoRendering.mg_boxOnScreen = BoxMediumRow(7.0f);
- mgVideoRendering.mg_pmgUp = &mgBitsPerPixelTrigger;
- mgVideoRendering.mg_pmgDown = &mgVideoOptionsApply;
- mgVideoRendering.mg_strText = TRANS("RENDERING OPTIONS");
- mgVideoRendering.mg_strTip = TRANS("manually adjust rendering settings");
- gm_lhGadgets.AddTail( mgVideoRendering.mg_lnNode);
- mgVideoRendering.mg_pActivatedFunction = &StartRenderingOptionsMenu;
-
- mgVideoOptionsApply.mg_bfsFontSize = BFS_LARGE;
- mgVideoOptionsApply.mg_boxOnScreen = BoxBigRow(5.5f);
- mgVideoOptionsApply.mg_pmgUp = &mgVideoRendering;
- mgVideoOptionsApply.mg_pmgDown = &mgDisplayAPITrigger;
- mgVideoOptionsApply.mg_strText = TRANS("APPLY");
- mgVideoOptionsApply.mg_strTip = TRANS("apply selected options");
- gm_lhGadgets.AddTail( mgVideoOptionsApply.mg_lnNode);
- mgVideoOptionsApply.mg_pActivatedFunction = &ApplyVideoOptions;
-}
-
-
-void CVideoOptionsMenu::StartMenu(void)
-{
- InitVideoOptionsButtons();
-
- CGameMenu::StartMenu();
-
- UpdateVideoOptionsButtons(-1);
-}
-
-// ------------------------ CAudioOptionsMenu implementation
-static void OnWaveVolumeChange(INDEX iCurPos)
-{
- _pShell->SetFLOAT("snd_fSoundVolume", iCurPos/FLOAT(VOLUME_STEPS));
-}
-
-void WaveSliderChange(void)
-{
- if (_bMouseRight) {
- mgWaveVolume.mg_iCurPos+=5;
- } else {
- mgWaveVolume.mg_iCurPos-=5;
- }
- mgWaveVolume.ApplyCurrentPosition();
-}
-
-void FrequencyTriggerChange(INDEX iDummy)
-{
- sam_bAutoAdjustAudio = 0;
- mgAudioAutoTrigger.mg_iSelected = 0;
- mgAudioAutoTrigger.ApplyCurrentSelection();
-}
-
-void MPEGSliderChange(void)
-{
- if (_bMouseRight) {
- mgMPEGVolume.mg_iCurPos+=5;
- } else {
- mgMPEGVolume.mg_iCurPos-=5;
- }
- mgMPEGVolume.ApplyCurrentPosition();
-}
-
-static void OnMPEGVolumeChange(INDEX iCurPos)
-{
- _pShell->SetFLOAT("snd_fMusicVolume", iCurPos/FLOAT(VOLUME_STEPS));
-}
-
-void CAudioOptionsMenu::Initialize_t(void)
-{
- // intialize Audio options menu
- mgAudioOptionsTitle.mg_boxOnScreen = BoxTitle();
- mgAudioOptionsTitle.mg_strText = TRANS("AUDIO");
- gm_lhGadgets.AddTail( mgAudioOptionsTitle.mg_lnNode);
-
- TRIGGER_MG(mgAudioAutoTrigger, 0,
- mgAudioOptionsApply, mgFrequencyTrigger, TRANS("AUTO-ADJUST"), astrNoYes);
- mgAudioAutoTrigger.mg_strTip = TRANS("adjust quality to fit your system");
-
- TRIGGER_MG(mgFrequencyTrigger, 1,
- mgAudioAutoTrigger, mgAudioAPITrigger, TRANS("FREQUENCY"), astrFrequencyRadioTexts);
- mgFrequencyTrigger.mg_strTip = TRANS("select sound quality or turn sound off");
- mgFrequencyTrigger.mg_pOnTriggerChange = FrequencyTriggerChange;
-
- TRIGGER_MG(mgAudioAPITrigger, 2,
- mgFrequencyTrigger, mgWaveVolume, TRANS("SOUND SYSTEM"), astrSoundAPIRadioTexts);
- mgAudioAPITrigger.mg_strTip = TRANS("choose sound system (API) to use");
- mgAudioAPITrigger.mg_pOnTriggerChange = FrequencyTriggerChange;
-
- mgWaveVolume.mg_boxOnScreen = BoxMediumRow(3);
- mgWaveVolume.mg_strText = TRANS("SOUND EFFECTS VOLUME");
- mgWaveVolume.mg_strTip = TRANS("adjust volume of in-game sound effects");
- mgWaveVolume.mg_pmgUp = &mgAudioAPITrigger;
- mgWaveVolume.mg_pmgDown = &mgMPEGVolume;
- mgWaveVolume.mg_pOnSliderChange = &OnWaveVolumeChange;
- mgWaveVolume.mg_pActivatedFunction = WaveSliderChange;
- gm_lhGadgets.AddTail( mgWaveVolume.mg_lnNode);
-
- mgMPEGVolume.mg_boxOnScreen = BoxMediumRow(4);
- mgMPEGVolume.mg_strText = TRANS("MUSIC VOLUME");
- mgMPEGVolume.mg_strTip = TRANS("adjust volume of in-game music");
- mgMPEGVolume.mg_pmgUp = &mgWaveVolume;
- mgMPEGVolume.mg_pmgDown = &mgAudioOptionsApply;
- mgMPEGVolume.mg_pOnSliderChange = &OnMPEGVolumeChange;
- mgMPEGVolume.mg_pActivatedFunction = MPEGSliderChange;
- gm_lhGadgets.AddTail( mgMPEGVolume.mg_lnNode);
-
- mgAudioOptionsApply.mg_bfsFontSize = BFS_LARGE;
- mgAudioOptionsApply.mg_boxOnScreen = BoxBigRow(4);
- mgAudioOptionsApply.mg_strText = TRANS("APPLY");
- mgAudioOptionsApply.mg_strTip = TRANS("activate selected options");
- gm_lhGadgets.AddTail( mgAudioOptionsApply.mg_lnNode);
- mgAudioOptionsApply.mg_pmgUp = &mgMPEGVolume;
- mgAudioOptionsApply.mg_pmgDown = &mgAudioAutoTrigger;
- mgAudioOptionsApply.mg_pActivatedFunction = &ApplyAudioOptions;
-}
-
-void CAudioOptionsMenu::StartMenu(void)
-{
- RefreshSoundFormat();
- CGameMenu::StartMenu();
-}
-
-// ------------------------ CLevelsMenu implementation
-void CLevelsMenu::FillListItems(void)
-{
- // disable all items first
- for(INDEX i=0; i");
- mgManualLevel[i].mg_iInList = -2;
- }
-
- BOOL bHasFirst = FALSE;
- BOOL bHasLast = FALSE;
- INDEX ctLabels = _lhFilteredLevels.Count();
- INDEX iLabel=0;
- FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itli) {
- CLevelInfo &li = *itli;
- INDEX iInMenu = iLabel-gm_iListOffset;
- if( (iLabel>=gm_iListOffset) &&
- (iLabel<(gm_iListOffset+LEVELS_ON_SCREEN)) )
- {
- bHasFirst|=(iLabel==0);
- bHasLast |=(iLabel==ctLabels-1);
- mgManualLevel[iInMenu].mg_strText = li.li_strName;
- mgManualLevel[iInMenu].mg_fnmLevel = li.li_fnLevel;
- mgManualLevel[iInMenu].mg_bEnabled = TRUE;
- mgManualLevel[iInMenu].mg_iInList = iLabel;
- }
- iLabel++;
- }
-
- // enable/disable up/down arrows
- mgLevelsArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
- mgLevelsArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
-}
-
-void CLevelsMenu::Initialize_t(void)
-{
- mgLevelsTitle.mg_boxOnScreen = BoxTitle();
- mgLevelsTitle.mg_strText = TRANS("CHOOSE LEVEL");
- gm_lhGadgets.AddTail( mgLevelsTitle.mg_lnNode);
-
- for( INDEX iLabel=0; iLabelgam_strCustomLevel) {
- // demand focus on it
- gm_iListWantedItem = i;
- break;
- }
- i++;
- }
- CGameMenu::StartMenu();
-}
-
-void VarApply(void)
-{
- FlushVarSettings(TRUE);
- gmVarMenu.EndMenu();
- gmVarMenu.StartMenu();
-}
-
-void CVarMenu::Initialize_t(void)
-{
- mgVarTitle.mg_boxOnScreen = BoxTitle();
- mgVarTitle.mg_strText = "";
- gm_lhGadgets.AddTail( mgVarTitle.mg_lnNode);
-
- for( INDEX iLabel=0; iLabel=gm_iListOffset) &&
- (iLabel<(gm_iListOffset+VARS_ON_SCREEN)) )
- {
- bHasFirst|=(iLabel==0);
- bHasLast |=(iLabel==ctLabels-1);
- mgVar[iInMenu].mg_pvsVar = &vs;
- mgVar[iInMenu].mg_strTip = vs.vs_strTip;
- mgVar[iInMenu].mg_bEnabled = mgVar[iInMenu].IsEnabled();
- mgVar[iInMenu].mg_iInList = iLabel;
- }
- iLabel++;
- }
- // enable/disable up/down arrows
- mgVarArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
- mgVarArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
-}
-
-void CVarMenu::StartMenu(void)
-{
- LoadVarSettings(gm_fnmMenuCFG);
- // set default parameters for the list
- gm_iListOffset = 0;
- gm_ctListTotal = _lhVarSettings.Count();
- gm_iListWantedItem = 0;
- CGameMenu::StartMenu();
-}
-
-void CVarMenu::EndMenu(void)
-{
- // disable all items first
- for(INDEX i=0; iEnumSessions(gmServersMenu.m_bInternet);
-}
-
-void RefreshServerListManually(void)
-{
- ChangeToMenu(&gmServersMenu); // this refreshes the list and sets focuses
-}
-
-void CServersMenu::Think(void)
-{
- if (!_pNetwork->ga_bEnumerationChange) {
- return;
- }
- _pNetwork->ga_bEnumerationChange = FALSE;
-}
-
-CTString _strServerFilter[7];
-
-void SortByColumn(int i)
-{
- if (mgServerList.mg_iSort==i) {
- mgServerList.mg_bSortDown = !mgServerList.mg_bSortDown;
- } else {
- mgServerList.mg_bSortDown = FALSE;
- }
- mgServerList.mg_iSort=i;
-}
-
-void SortByServer(void) { SortByColumn(0); }
-void SortByMap(void) { SortByColumn(1); }
-void SortByPing(void) { SortByColumn(2); }
-void SortByPlayers(void){ SortByColumn(3); }
-void SortByGame(void) { SortByColumn(4); }
-void SortByMod(void) { SortByColumn(5); }
-void SortByVer(void) { SortByColumn(6); }
-
-void CServersMenu::Initialize_t(void)
-{
- mgServersTitle.mg_boxOnScreen = BoxTitle();
- mgServersTitle.mg_strText = TRANS("CHOOSE SERVER");
- gm_lhGadgets.AddTail( mgServersTitle.mg_lnNode);
-
- mgServerList.mg_boxOnScreen = FLOATaabbox2D(FLOAT2D(0,0), FLOAT2D(1,1));
- mgServerList.mg_pmgLeft = &mgServerList; // make sure it can get focus
- mgServerList.mg_bEnabled = TRUE;
- gm_lhGadgets.AddTail(mgServerList.mg_lnNode);
-
- ASSERT(ARRAYCOUNT(mgServerColumn)==ARRAYCOUNT(mgServerFilter));
- for (INDEX i=0; i=2)");
- mgServerFilter[4].mg_strTip = TRANS("filter by game (ie. coop)") ;
- mgServerFilter[5].mg_strTip = TRANS("filter by mod") ;
- mgServerFilter[6].mg_strTip = TRANS("filter by version");
-}
-
-void CServersMenu::StartMenu(void)
-{
- RefreshServerList();
-
- CGameMenu::StartMenu();
-}
-
-// ------------------------ CNetworkMenu implementation
-void CNetworkMenu::Initialize_t(void)
-{
- // intialize network menu
- mgNetworkTitle.mg_boxOnScreen = BoxTitle();
- mgNetworkTitle.mg_strText = TRANS("NETWORK");
- gm_lhGadgets.AddTail( mgNetworkTitle.mg_lnNode);
-
- mgNetworkJoin.mg_bfsFontSize = BFS_LARGE;
- mgNetworkJoin.mg_boxOnScreen = BoxBigRow(1.0f);
- mgNetworkJoin.mg_pmgUp = &mgNetworkLoad;
- mgNetworkJoin.mg_pmgDown = &mgNetworkStart;
- mgNetworkJoin.mg_strText = TRANS("JOIN GAME");
- mgNetworkJoin.mg_strTip = TRANS("join a network game");
- gm_lhGadgets.AddTail( mgNetworkJoin.mg_lnNode);
- mgNetworkJoin.mg_pActivatedFunction = &StartNetworkJoinMenu;
-
- mgNetworkStart.mg_bfsFontSize = BFS_LARGE;
- mgNetworkStart.mg_boxOnScreen = BoxBigRow(2.0f);
- mgNetworkStart.mg_pmgUp = &mgNetworkJoin;
- mgNetworkStart.mg_pmgDown = &mgNetworkQuickLoad;
- mgNetworkStart.mg_strText = TRANS("START SERVER");
- mgNetworkStart.mg_strTip = TRANS("start a network game server");
- gm_lhGadgets.AddTail( mgNetworkStart.mg_lnNode);
- mgNetworkStart.mg_pActivatedFunction = &StartNetworkStartMenu;
-
- mgNetworkQuickLoad.mg_bfsFontSize = BFS_LARGE;
- mgNetworkQuickLoad.mg_boxOnScreen = BoxBigRow(3.0f);
- mgNetworkQuickLoad.mg_pmgUp = &mgNetworkStart;
- mgNetworkQuickLoad.mg_pmgDown = &mgNetworkLoad;
- mgNetworkQuickLoad.mg_strText = TRANS("QUICK LOAD");
- mgNetworkQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
- gm_lhGadgets.AddTail( mgNetworkQuickLoad.mg_lnNode);
- mgNetworkQuickLoad.mg_pActivatedFunction = &StartNetworkQuickLoadMenu;
-
- mgNetworkLoad.mg_bfsFontSize = BFS_LARGE;
- mgNetworkLoad.mg_boxOnScreen = BoxBigRow(4.0f);
- mgNetworkLoad.mg_pmgUp = &mgNetworkQuickLoad;
- mgNetworkLoad.mg_pmgDown = &mgNetworkJoin;
- mgNetworkLoad.mg_strText = TRANS("LOAD");
- mgNetworkLoad.mg_strTip = TRANS("start server and load a network game (server only)");
- gm_lhGadgets.AddTail( mgNetworkLoad.mg_lnNode);
- mgNetworkLoad.mg_pActivatedFunction = &StartNetworkLoadMenu;
-
-}
-void CNetworkMenu::StartMenu(void)
-{
- CGameMenu::StartMenu();
-}
-
-void UpdateNetworkLevel(INDEX iDummy)
-{
- ValidateLevelForFlags(_pGame->gam_strCustomLevel,
- SpawnFlagsForGameType(mgNetworkGameType.mg_iSelected));
- mgNetworkLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
-}
-
-// ------------------------ CNetworkJoinMenu implementation
-void CNetworkJoinMenu::Initialize_t(void)
-{
- // title
- mgNetworkJoinTitle.mg_boxOnScreen = BoxTitle();
- mgNetworkJoinTitle.mg_strText = TRANS("JOIN GAME");
- gm_lhGadgets.AddTail( mgNetworkJoinTitle.mg_lnNode);
-
- mgNetworkJoinLAN.mg_bfsFontSize = BFS_LARGE;
- mgNetworkJoinLAN.mg_boxOnScreen = BoxBigRow(1.0f);
- mgNetworkJoinLAN.mg_pmgUp = &mgNetworkJoinOpen;
- mgNetworkJoinLAN.mg_pmgDown = &mgNetworkJoinNET;
- mgNetworkJoinLAN.mg_strText = TRANS("SEARCH LAN");
- mgNetworkJoinLAN.mg_strTip = TRANS("search local network for servers");
- gm_lhGadgets.AddTail( mgNetworkJoinLAN.mg_lnNode);
- mgNetworkJoinLAN.mg_pActivatedFunction = &StartSelectServerLAN;
-
- mgNetworkJoinNET.mg_bfsFontSize = BFS_LARGE;
- mgNetworkJoinNET.mg_boxOnScreen = BoxBigRow(2.0f);
- mgNetworkJoinNET.mg_pmgUp = &mgNetworkJoinLAN;
- mgNetworkJoinNET.mg_pmgDown = &mgNetworkJoinOpen;
- mgNetworkJoinNET.mg_strText = TRANS("SEARCH INTERNET");
- mgNetworkJoinNET.mg_strTip = TRANS("search internet for servers");
- gm_lhGadgets.AddTail( mgNetworkJoinNET.mg_lnNode);
- mgNetworkJoinNET.mg_pActivatedFunction = &StartSelectServerNET;
-
- mgNetworkJoinOpen.mg_bfsFontSize = BFS_LARGE;
- mgNetworkJoinOpen.mg_boxOnScreen = BoxBigRow(3.0f);
- mgNetworkJoinOpen.mg_pmgUp = &mgNetworkJoinNET;
- mgNetworkJoinOpen.mg_pmgDown = &mgNetworkJoinLAN;
- mgNetworkJoinOpen.mg_strText = TRANS("SPECIFY SERVER");
- mgNetworkJoinOpen.mg_strTip = TRANS("type in server address to connect to");
- gm_lhGadgets.AddTail( mgNetworkJoinOpen.mg_lnNode);
- mgNetworkJoinOpen.mg_pActivatedFunction = &StartNetworkOpenMenu;
-}
-
-// ------------------------ CNetworkStartMenu implementation
-void CNetworkStartMenu::Initialize_t(void)
-{
- // title
- mgNetworkStartTitle.mg_boxOnScreen = BoxTitle();
- mgNetworkStartTitle.mg_strText = TRANS("START SERVER");
- gm_lhGadgets.AddTail( mgNetworkStartTitle.mg_lnNode);
-
- // session name edit box
- mgNetworkSessionName.mg_strText = _pGame->gam_strSessionName;
- mgNetworkSessionName.mg_strLabel = TRANS("Session name:");
- mgNetworkSessionName.mg_ctMaxStringLen = 25;
- mgNetworkSessionName.mg_pstrToChange = &_pGame->gam_strSessionName;
- mgNetworkSessionName.mg_boxOnScreen = BoxMediumRow(1);
- mgNetworkSessionName.mg_bfsFontSize = BFS_MEDIUM;
- mgNetworkSessionName.mg_iCenterI = -1;
- mgNetworkSessionName.mg_pmgUp = &mgNetworkStartStart;
- mgNetworkSessionName.mg_pmgDown = &mgNetworkGameType;
- mgNetworkSessionName.mg_strTip = TRANS("name the session to start");
- gm_lhGadgets.AddTail( mgNetworkSessionName.mg_lnNode);
-
- // game type trigger
- TRIGGER_MG(mgNetworkGameType, 2,
- mgNetworkSessionName, mgNetworkDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
- mgNetworkGameType.mg_ctTexts = ctGameTypeRadioTexts;
- mgNetworkGameType.mg_strTip = TRANS("choose type of multiplayer game");
- mgNetworkGameType.mg_pOnTriggerChange = &UpdateNetworkLevel;
- // difficulty trigger
- TRIGGER_MG(mgNetworkDifficulty, 3,
- mgNetworkGameType, mgNetworkLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
- mgNetworkDifficulty.mg_strTip = TRANS("choose difficulty level");
-
- // level name
- mgNetworkLevel.mg_strText = "";
- mgNetworkLevel.mg_strLabel = TRANS("Level:");
- mgNetworkLevel.mg_boxOnScreen = BoxMediumRow(4);
- mgNetworkLevel.mg_bfsFontSize = BFS_MEDIUM;
- mgNetworkLevel.mg_iCenterI = -1;
- mgNetworkLevel.mg_pmgUp = &mgNetworkDifficulty;
- mgNetworkLevel.mg_pmgDown = &mgNetworkMaxPlayers;
- mgNetworkLevel.mg_strTip = TRANS("choose the level to start");
- mgNetworkLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork;
- gm_lhGadgets.AddTail( mgNetworkLevel.mg_lnNode);
-
- // max players trigger
- TRIGGER_MG(mgNetworkMaxPlayers, 5,
- mgNetworkLevel, mgNetworkWaitAllPlayers, TRANS("Max players:"), astrMaxPlayersRadioTexts);
- mgNetworkMaxPlayers.mg_strTip = TRANS("choose maximum allowed number of players");
-
- // wait all players trigger
- TRIGGER_MG(mgNetworkWaitAllPlayers, 6,
- mgNetworkMaxPlayers, mgNetworkVisible, TRANS("Wait for all players:"), astrNoYes);
- mgNetworkWaitAllPlayers.mg_strTip = TRANS("if on, game won't start until all players have joined");
-
- // server visible trigger
- TRIGGER_MG(mgNetworkVisible, 7,
- mgNetworkMaxPlayers, mgNetworkGameOptions, TRANS("Server visible:"), astrNoYes);
- mgNetworkVisible.mg_strTip = TRANS("invisible servers are not listed, cleints have to join manually");
-
- // options button
- mgNetworkGameOptions.mg_strText = TRANS("Game options");
- mgNetworkGameOptions.mg_boxOnScreen = BoxMediumRow(8);
- mgNetworkGameOptions.mg_bfsFontSize = BFS_MEDIUM;
- mgNetworkGameOptions.mg_iCenterI = 0;
- mgNetworkGameOptions.mg_pmgUp = &mgNetworkVisible;
- mgNetworkGameOptions.mg_pmgDown = &mgNetworkStartStart;
- mgNetworkGameOptions.mg_strTip = TRANS("adjust game rules");
- mgNetworkGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork;
- gm_lhGadgets.AddTail( mgNetworkGameOptions.mg_lnNode);
-
- // start button
- mgNetworkStartStart.mg_bfsFontSize = BFS_LARGE;
- mgNetworkStartStart.mg_boxOnScreen = BoxBigRow(7);
- mgNetworkStartStart.mg_pmgUp = &mgNetworkGameOptions;
- mgNetworkStartStart.mg_pmgDown = &mgNetworkSessionName;
- mgNetworkStartStart.mg_strText = TRANS("START");
- gm_lhGadgets.AddTail( mgNetworkStartStart.mg_lnNode);
- mgNetworkStartStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork;
-}
-
-void CNetworkStartMenu::StartMenu(void)
-{
- extern INDEX sam_bMentalActivated;
- mgNetworkDifficulty.mg_ctTexts = sam_bMentalActivated?6:5;
-
- mgNetworkGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts-1L);
- mgNetworkGameType.ApplyCurrentSelection();
- mgNetworkDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty")+1;
- mgNetworkDifficulty.ApplyCurrentSelection();
-
- _pShell->SetINDEX("gam_iStartMode", CSessionProperties::GM_COOPERATIVE);
-
- INDEX ctMaxPlayers = _pShell->GetINDEX("gam_ctMaxPlayers");
- if (ctMaxPlayers<2 || ctMaxPlayers>16) {
- ctMaxPlayers = 2;
- _pShell->SetINDEX("gam_ctMaxPlayers", ctMaxPlayers);
- }
-
- mgNetworkMaxPlayers.mg_iSelected = ctMaxPlayers-2;
- mgNetworkMaxPlayers.ApplyCurrentSelection();
-
- mgNetworkWaitAllPlayers.mg_iSelected = Clamp(_pShell->GetINDEX("gam_bWaitAllPlayers"), 0L, 1L);
- mgNetworkWaitAllPlayers.ApplyCurrentSelection();
-
- mgNetworkVisible.mg_iSelected = _pShell->GetINDEX("ser_bEnumeration");
- mgNetworkVisible.ApplyCurrentSelection();
-
- UpdateNetworkLevel(0);
-
- CGameMenu::StartMenu();
-}
-
-void CNetworkStartMenu::EndMenu(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", mgNetworkDifficulty.mg_iSelected-1);
- _pShell->SetINDEX("gam_iStartMode", mgNetworkGameType.mg_iSelected);
- _pShell->SetINDEX("gam_bWaitAllPlayers", mgNetworkWaitAllPlayers.mg_iSelected);
- _pShell->SetINDEX("gam_ctMaxPlayers", mgNetworkMaxPlayers.mg_iSelected+2);
- _pShell->SetINDEX("ser_bEnumeration", mgNetworkVisible.mg_iSelected);
-
- CGameMenu::EndMenu();
-}
-
-#define ADD_GADGET( gd, box, up, dn, lf, rt, txt) \
- gd.mg_boxOnScreen = box;\
- gd.mg_pmgUp = up;\
- gd.mg_pmgDown = dn;\
- gd.mg_pmgLeft = lf;\
- gd.mg_pmgRight = rt;\
- gd.mg_strText = txt;\
- gm_lhGadgets.AddTail( gd.mg_lnNode);
-
-#define SET_CHGPLR( gd, iplayer, bnone, bauto, pmgit) \
- gd.mg_pmgInfoTable = pmgit;\
- gd.mg_bResetToNone = bnone;\
- gd.mg_bAutomatic = bauto;\
- gd.mg_iLocalPlayer = iplayer;
-
-// ------------------------ CSelectPlayersMenu implementation
-INDEX FindUnusedPlayer(void)
-{
- INDEX *ai = _pGame->gm_aiMenuLocalPlayers;
- INDEX iPlayer=0;
- for(; iPlayer<8; iPlayer++) {
- BOOL bUsed = FALSE;
- for (INDEX iLocal=0; iLocal<4; iLocal++) {
- if (ai[iLocal] == iPlayer) {
- bUsed = TRUE;
- break;
- }
- }
- if (!bUsed) {
- return iPlayer;
- }
- }
- ASSERT(FALSE);
- return iPlayer;
-}
-void SelectPlayersFillMenu(void)
-{
- INDEX *ai = _pGame->gm_aiMenuLocalPlayers;
-
- mgPlayer0Change.mg_iLocalPlayer = 0;
- mgPlayer1Change.mg_iLocalPlayer = 1;
- mgPlayer2Change.mg_iLocalPlayer = 2;
- mgPlayer3Change.mg_iLocalPlayer = 3;
-
- if (gmSelectPlayersMenu.gm_bAllowDedicated && _pGame->gm_MenuSplitScreenCfg==CGame::SSC_DEDICATED) {
- mgDedicated.mg_iSelected = 1;
- } else {
- mgDedicated.mg_iSelected = 0;
- }
- mgDedicated.ApplyCurrentSelection();
-
- if (gmSelectPlayersMenu.gm_bAllowObserving && _pGame->gm_MenuSplitScreenCfg==CGame::SSC_OBSERVER) {
- mgObserver.mg_iSelected = 1;
- } else {
- mgObserver.mg_iSelected = 0;
- }
- mgObserver.ApplyCurrentSelection();
-
- if (_pGame->gm_MenuSplitScreenCfg>=CGame::SSC_PLAY1) {
- mgSplitScreenCfg.mg_iSelected = _pGame->gm_MenuSplitScreenCfg;
- mgSplitScreenCfg.ApplyCurrentSelection();
- }
-
- BOOL bHasDedicated = gmSelectPlayersMenu.gm_bAllowDedicated;
- BOOL bHasObserver = gmSelectPlayersMenu.gm_bAllowObserving;
- BOOL bHasPlayers = TRUE;
-
- if (bHasDedicated && mgDedicated.mg_iSelected) {
- bHasObserver = FALSE;
- bHasPlayers = FALSE;
- }
-
- if (bHasObserver && mgObserver.mg_iSelected) {
- bHasPlayers = FALSE;
- }
-
- CMenuGadget *apmg[8];
- memset(apmg, 0, sizeof(apmg));
- INDEX i=0;
-
- if (bHasDedicated) {
- mgDedicated.Appear();
- apmg[i++] = &mgDedicated;
- } else {
- mgDedicated.Disappear();
- }
- if (bHasObserver) {
- mgObserver.Appear();
- apmg[i++] = &mgObserver;
- } else {
- mgObserver.Disappear();
- }
-
- for (INDEX iLocal=0; iLocal<4; iLocal++) {
- if (ai[iLocal]<0 || ai[iLocal]>7) {
- ai[iLocal] = 0;
- }
- for (INDEX iCopy=0; iCopy=1) {
- mgPlayer1Change.Appear();
- apmg[i++] = &mgPlayer1Change;
- }
- if (mgSplitScreenCfg.mg_iSelected>=2) {
- mgPlayer2Change.Appear();
- apmg[i++] = &mgPlayer2Change;
- }
- if (mgSplitScreenCfg.mg_iSelected>=3) {
- mgPlayer3Change.Appear();
- apmg[i++] = &mgPlayer3Change;
- }
- } else {
- mgSplitScreenCfg.Disappear();
- }
- apmg[i++] = &mgSelectPlayersStart;
-
- // relink
- for (INDEX img=0; img<8; img++) {
- if (apmg[img]==NULL) {
- continue;
- }
- INDEX imgPred=(img+8-1)%8;
- for (; imgPred!=img; imgPred = (imgPred+8-1)%8) {
- if (apmg[imgPred]!=NULL) {
- break;
- }
- }
- INDEX imgSucc=(img+1)%8;
- for (; imgSucc!=img; imgSucc = (imgSucc+1)%8) {
- if (apmg[imgSucc]!=NULL) {
- break;
- }
- }
- apmg[img]->mg_pmgUp = apmg[imgPred];
- apmg[img]->mg_pmgDown = apmg[imgSucc];
- }
-
- mgPlayer0Change.SetPlayerText();
- mgPlayer1Change.SetPlayerText();
- mgPlayer2Change.SetPlayerText();
- mgPlayer3Change.SetPlayerText();
-
- if (bHasPlayers && mgSplitScreenCfg.mg_iSelected>=1) {
- mgSelectPlayersNotes.mg_strText = TRANS("Make sure you set different controls for each player!");
- } else {
- mgSelectPlayersNotes.mg_strText = "";
- }
-}
-void SelectPlayersApplyMenu(void)
-{
- if (gmSelectPlayersMenu.gm_bAllowDedicated && mgDedicated.mg_iSelected) {
- _pGame->gm_MenuSplitScreenCfg = CGame::SSC_DEDICATED;
- return;
- }
-
- if (gmSelectPlayersMenu.gm_bAllowObserving && mgObserver.mg_iSelected) {
- _pGame->gm_MenuSplitScreenCfg = CGame::SSC_OBSERVER;
- return;
- }
-
- _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
-}
-
-void UpdateSelectPlayers(INDEX i)
-{
- SelectPlayersApplyMenu();
- SelectPlayersFillMenu();
-}
-
-void CSelectPlayersMenu::Initialize_t(void)
-{
- // intialize split screen menu
- mgSelectPlayerTitle.mg_boxOnScreen = BoxTitle();
- mgSelectPlayerTitle.mg_strText = TRANS("SELECT PLAYERS");
- gm_lhGadgets.AddTail( mgSelectPlayerTitle.mg_lnNode);
-
- TRIGGER_MG(mgDedicated, 0, mgSelectPlayersStart, mgObserver, TRANS("Dedicated:"), astrNoYes);
- mgDedicated.mg_strTip = TRANS("select to start dedicated server");
- mgDedicated.mg_pOnTriggerChange = UpdateSelectPlayers;
-
- TRIGGER_MG(mgObserver, 1, mgDedicated, mgSplitScreenCfg, TRANS("Observer:"), astrNoYes);
- mgObserver.mg_strTip = TRANS("select to join in for observing, not for playing");
- mgObserver.mg_pOnTriggerChange = UpdateSelectPlayers;
-
- // split screen config trigger
- TRIGGER_MG(mgSplitScreenCfg, 2, mgObserver, mgPlayer0Change, TRANS("Number of players:"), astrSplitScreenRadioTexts);
- mgSplitScreenCfg.mg_strTip = TRANS("choose more than one player to play in split screen");
- mgSplitScreenCfg.mg_pOnTriggerChange = UpdateSelectPlayers;
-
- mgPlayer0Change.mg_iCenterI = -1;
- mgPlayer1Change.mg_iCenterI = -1;
- mgPlayer2Change.mg_iCenterI = -1;
- mgPlayer3Change.mg_iCenterI = -1;
- mgPlayer0Change.mg_boxOnScreen = BoxMediumMiddle(4);
- mgPlayer1Change.mg_boxOnScreen = BoxMediumMiddle(5);
- mgPlayer2Change.mg_boxOnScreen = BoxMediumMiddle(6);
- mgPlayer3Change.mg_boxOnScreen = BoxMediumMiddle(7);
- mgPlayer0Change.mg_strTip =
- mgPlayer1Change.mg_strTip =
- mgPlayer2Change.mg_strTip =
- mgPlayer3Change.mg_strTip = TRANS("select profile for this player");
- gm_lhGadgets.AddTail( mgPlayer0Change.mg_lnNode);
- gm_lhGadgets.AddTail( mgPlayer1Change.mg_lnNode);
- gm_lhGadgets.AddTail( mgPlayer2Change.mg_lnNode);
- gm_lhGadgets.AddTail( mgPlayer3Change.mg_lnNode);
-
- mgSelectPlayersNotes.mg_boxOnScreen = BoxMediumRow(9.0);
- mgSelectPlayersNotes.mg_bfsFontSize = BFS_MEDIUM;
- mgSelectPlayersNotes.mg_iCenterI = -1;
- mgSelectPlayersNotes.mg_bEnabled = FALSE;
- mgSelectPlayersNotes.mg_bLabel = TRUE;
- gm_lhGadgets.AddTail( mgSelectPlayersNotes.mg_lnNode);
- mgSelectPlayersNotes.mg_strText = "";
-
- /* // options button
- mgSplitOptions.mg_strText = TRANS("Game options");
- mgSplitOptions.mg_boxOnScreen = BoxMediumRow(3);
- mgSplitOptions.mg_bfsFontSize = BFS_MEDIUM;
- mgSplitOptions.mg_iCenterI = 0;
- mgSplitOptions.mg_pmgUp = &mgSplitLevel;
- mgSplitOptions.mg_pmgDown = &mgSplitStartStart;
- mgSplitOptions.mg_strTip = TRANS("adjust game rules");
- mgSplitOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
- gm_lhGadgets.AddTail( mgSplitOptions.mg_lnNode);*/
-
-/* // start button
- mgSplitStartStart.mg_bfsFontSize = BFS_LARGE;
- mgSplitStartStart.mg_boxOnScreen = BoxBigRow(4);
- mgSplitStartStart.mg_pmgUp = &mgSplitOptions;
- mgSplitStartStart.mg_pmgDown = &mgSplitGameType;
- mgSplitStartStart.mg_strText = TRANS("START");
- gm_lhGadgets.AddTail( mgSplitStartStart.mg_lnNode);
- mgSplitStartStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
-*/
-
- ADD_GADGET( mgSelectPlayersStart, BoxMediumRow(11), &mgSplitScreenCfg, &mgPlayer0Change, NULL, NULL, TRANS("START"));
- mgSelectPlayersStart.mg_bfsFontSize = BFS_LARGE;
- mgSelectPlayersStart.mg_iCenterI = 0;
-}
-
-void CSelectPlayersMenu::StartMenu(void)
-{
- CGameMenu::StartMenu();
- SelectPlayersFillMenu();
- SelectPlayersApplyMenu();
-}
-
-void CSelectPlayersMenu::EndMenu(void)
-{
- SelectPlayersApplyMenu();
- CGameMenu::EndMenu();
-}
-
-CTString _strPort;
-// ------------------------ CNetworkOpenMenu implementation
-void CNetworkOpenMenu::Initialize_t(void)
-{
- // intialize network join menu
- mgNetworkOpenTitle.mg_boxOnScreen = BoxTitle();
- mgNetworkOpenTitle.mg_strText = TRANS("JOIN");
- gm_lhGadgets.AddTail( mgNetworkOpenTitle.mg_lnNode);
-
- mgNetworkOpenAddressLabel.mg_strText = TRANS("Address:");
- mgNetworkOpenAddressLabel.mg_boxOnScreen = BoxMediumLeft(1);
- mgNetworkOpenAddressLabel.mg_iCenterI = -1;
- gm_lhGadgets.AddTail( mgNetworkOpenAddressLabel.mg_lnNode);
-
- mgNetworkOpenAddress.mg_strText = _pGame->gam_strJoinAddress;
- mgNetworkOpenAddress.mg_ctMaxStringLen = 20;
- mgNetworkOpenAddress.mg_pstrToChange = &_pGame->gam_strJoinAddress;
- mgNetworkOpenAddress.mg_boxOnScreen = BoxMediumMiddle(1);
- mgNetworkOpenAddress.mg_bfsFontSize = BFS_MEDIUM;
- mgNetworkOpenAddress.mg_iCenterI = -1;
- mgNetworkOpenAddress.mg_pmgUp = &mgNetworkOpenJoin;
- mgNetworkOpenAddress.mg_pmgDown = &mgNetworkOpenPort;
- mgNetworkOpenAddress.mg_strTip = TRANS("specify server address");
- gm_lhGadgets.AddTail( mgNetworkOpenAddress.mg_lnNode);
-
- mgNetworkOpenPortLabel.mg_strText = TRANS("Port:");
- mgNetworkOpenPortLabel.mg_boxOnScreen = BoxMediumLeft(2);
- mgNetworkOpenPortLabel.mg_iCenterI = -1;
- gm_lhGadgets.AddTail( mgNetworkOpenPortLabel.mg_lnNode);
-
- mgNetworkOpenPort.mg_strText = "";
- mgNetworkOpenPort.mg_ctMaxStringLen = 10;
- mgNetworkOpenPort.mg_pstrToChange = &_strPort;
- mgNetworkOpenPort.mg_boxOnScreen = BoxMediumMiddle(2);
- mgNetworkOpenPort.mg_bfsFontSize = BFS_MEDIUM;
- mgNetworkOpenPort.mg_iCenterI = -1;
- mgNetworkOpenPort.mg_pmgUp = &mgNetworkOpenAddress;
- mgNetworkOpenPort.mg_pmgDown = &mgNetworkOpenJoin;
- mgNetworkOpenPort.mg_strTip = TRANS("specify server address");
- gm_lhGadgets.AddTail( mgNetworkOpenPort.mg_lnNode);
-
- mgNetworkOpenJoin.mg_boxOnScreen = BoxMediumMiddle(3);
- mgNetworkOpenJoin.mg_pmgUp = &mgNetworkOpenPort;
- mgNetworkOpenJoin.mg_pmgDown = &mgNetworkOpenAddress;
- mgNetworkOpenJoin.mg_strText = TRANS("Join");
- gm_lhGadgets.AddTail( mgNetworkOpenJoin.mg_lnNode);
- mgNetworkOpenJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen;
-}
-
-void CNetworkOpenMenu::StartMenu(void)
-{
- _strPort = _pShell->GetValue("net_iPort");
- mgNetworkOpenPort.mg_strText = _strPort;
-}
-
-void CNetworkOpenMenu::EndMenu(void)
-{
- _pShell->SetValue("net_iPort", _strPort);
-}
-
-// ------------------------ CSplitScreenMenu implementation
-void CSplitScreenMenu::Initialize_t(void)
-{
- // intialize split screen menu
- mgSplitScreenTitle.mg_boxOnScreen = BoxTitle();
- mgSplitScreenTitle.mg_strText = TRANS("SPLIT SCREEN");
- gm_lhGadgets.AddTail( mgSplitScreenTitle.mg_lnNode);
-
- mgSplitScreenStart.mg_bfsFontSize = BFS_LARGE;
- mgSplitScreenStart.mg_boxOnScreen = BoxBigRow(0);
- mgSplitScreenStart.mg_pmgUp = &mgSplitScreenLoad;
- mgSplitScreenStart.mg_pmgDown = &mgSplitScreenQuickLoad;
- mgSplitScreenStart.mg_strText = TRANS("NEW GAME");
- mgSplitScreenStart.mg_strTip = TRANS("start new split-screen game");
- gm_lhGadgets.AddTail( mgSplitScreenStart.mg_lnNode);
- mgSplitScreenStart.mg_pActivatedFunction = &StartSplitStartMenu;
-
- mgSplitScreenQuickLoad.mg_bfsFontSize = BFS_LARGE;
- mgSplitScreenQuickLoad.mg_boxOnScreen = BoxBigRow(1);
- mgSplitScreenQuickLoad.mg_pmgUp = &mgSplitScreenStart;
- mgSplitScreenQuickLoad.mg_pmgDown = &mgSplitScreenLoad;
- mgSplitScreenQuickLoad.mg_strText = TRANS("QUICK LOAD");
- mgSplitScreenQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
- gm_lhGadgets.AddTail( mgSplitScreenQuickLoad.mg_lnNode);
- mgSplitScreenQuickLoad.mg_pActivatedFunction = &StartSplitScreenQuickLoadMenu;
-
- mgSplitScreenLoad.mg_bfsFontSize = BFS_LARGE;
- mgSplitScreenLoad.mg_boxOnScreen = BoxBigRow(2);
- mgSplitScreenLoad.mg_pmgUp = &mgSplitScreenQuickLoad;
- mgSplitScreenLoad.mg_pmgDown = &mgSplitScreenStart;
- mgSplitScreenLoad.mg_strText = TRANS("LOAD");
- mgSplitScreenLoad.mg_strTip = TRANS("load a saved split-screen game");
- gm_lhGadgets.AddTail( mgSplitScreenLoad.mg_lnNode);
- mgSplitScreenLoad.mg_pActivatedFunction = &StartSplitScreenLoadMenu;
-}
-
-void CSplitScreenMenu::StartMenu(void)
-{
- CGameMenu::StartMenu();
-}
-
-void UpdateSplitLevel(INDEX iDummy)
-{
- ValidateLevelForFlags(_pGame->gam_strCustomLevel,
- SpawnFlagsForGameType(mgSplitGameType.mg_iSelected));
- mgSplitLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
-}
-
-// ------------------------ CSplitStartMenu implementation
-void CSplitStartMenu::Initialize_t(void)
-{
- // intialize split screen menu
- mgSplitStartTitle.mg_boxOnScreen = BoxTitle();
- mgSplitStartTitle.mg_strText = TRANS("START SPLIT SCREEN");
- gm_lhGadgets.AddTail( mgSplitStartTitle.mg_lnNode);
-
- // game type trigger
- TRIGGER_MG(mgSplitGameType, 0,
- mgSplitStartStart, mgSplitDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
- mgSplitGameType.mg_ctTexts = ctGameTypeRadioTexts;
- mgSplitGameType.mg_strTip = TRANS("choose type of multiplayer game");
- mgSplitGameType.mg_pOnTriggerChange = UpdateSplitLevel;
- // difficulty trigger
- TRIGGER_MG(mgSplitDifficulty, 1,
- mgSplitGameType, mgSplitLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
- mgSplitDifficulty.mg_strTip = TRANS("choose difficulty level");
-
- // level name
- mgSplitLevel.mg_strText = "";
- mgSplitLevel.mg_strLabel = TRANS("Level:");
- mgSplitLevel.mg_boxOnScreen = BoxMediumRow(2);
- mgSplitLevel.mg_bfsFontSize = BFS_MEDIUM;
- mgSplitLevel.mg_iCenterI = -1;
- mgSplitLevel.mg_pmgUp = &mgSplitDifficulty;
- mgSplitLevel.mg_pmgDown = &mgSplitOptions;
- mgSplitLevel.mg_strTip = TRANS("choose the level to start");
- mgSplitLevel.mg_pActivatedFunction = &StartSelectLevelFromSplit;
- gm_lhGadgets.AddTail( mgSplitLevel.mg_lnNode);
-
- // options button
- mgSplitOptions.mg_strText = TRANS("Game options");
- mgSplitOptions.mg_boxOnScreen = BoxMediumRow(3);
- mgSplitOptions.mg_bfsFontSize = BFS_MEDIUM;
- mgSplitOptions.mg_iCenterI = 0;
- mgSplitOptions.mg_pmgUp = &mgSplitLevel;
- mgSplitOptions.mg_pmgDown = &mgSplitStartStart;
- mgSplitOptions.mg_strTip = TRANS("adjust game rules");
- mgSplitOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
- gm_lhGadgets.AddTail( mgSplitOptions.mg_lnNode);
-
- // start button
- mgSplitStartStart.mg_bfsFontSize = BFS_LARGE;
- mgSplitStartStart.mg_boxOnScreen = BoxBigRow(4);
- mgSplitStartStart.mg_pmgUp = &mgSplitOptions;
- mgSplitStartStart.mg_pmgDown = &mgSplitGameType;
- mgSplitStartStart.mg_strText = TRANS("START");
- gm_lhGadgets.AddTail( mgSplitStartStart.mg_lnNode);
- mgSplitStartStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
-}
-
-void CSplitStartMenu::StartMenu(void)
-{
- extern INDEX sam_bMentalActivated;
- mgSplitDifficulty.mg_ctTexts = sam_bMentalActivated?6:5;
-
- mgSplitGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts-1L);
- mgSplitGameType.ApplyCurrentSelection();
- mgSplitDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty")+1;
- mgSplitDifficulty.ApplyCurrentSelection();
-
- // clamp maximum number of players to at least 4
- _pShell->SetINDEX("gam_ctMaxPlayers", ClampDn(_pShell->GetINDEX("gam_ctMaxPlayers"), 4L));
-
- UpdateSplitLevel(0);
- CGameMenu::StartMenu();
-}
-void CSplitStartMenu::EndMenu(void)
-{
- _pShell->SetINDEX("gam_iStartDifficulty", mgSplitDifficulty.mg_iSelected-1);
- _pShell->SetINDEX("gam_iStartMode", mgSplitGameType.mg_iSelected);
-
- CGameMenu::EndMenu();
-}
diff --git a/Sources/SeriousSam/Menu.h b/Sources/SeriousSam/Menu.h
deleted file mode 100644
index 148eb00..0000000
--- a/Sources/SeriousSam/Menu.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/* Copyright (c) 2002-2012 Croteam Ltd.
-This program is free software; you can redistribute it and/or modify
-it under the terms of version 2 of the GNU General Public License as published by
-the Free Software Foundation
-
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// set new thumbnail
-void SetThumbnail(CTFileName fn);
-// remove thumbnail
-void ClearThumbnail(void);
-
-void InitializeMenus( void);
-void DestroyMenus( void);
-void MenuOnKeyDown( int iVKey);
-void MenuOnChar(MSG msg);
-void MenuOnMouseMove(PIX pixI, PIX pixJ);
-void MenuOnLMBDown(void);
-BOOL DoMenu( CDrawPort *pdp); // returns TRUE if still active, FALSE if should quit
-void StartMenus( char *str="");
-void StopMenus(BOOL bGoToRoot =TRUE);
-BOOL IsMenusInRoot(void);
-void ChangeToMenu( class CGameMenu *pgmNew);
-extern void PlayMenuSound(CSoundData *psd);
-
-#define KEYS_ON_SCREEN 14
-#define LEVELS_ON_SCREEN 16
-#define SERVERS_ON_SCREEN 15
-#define VARS_ON_SCREEN 14
-
-extern CListHead _lhServers;
-
-extern class CPlayerProfileMenu gmPlayerProfile;
-extern class CSelectPlayersMenu gmSelectPlayersMenu;
-extern class CCustomizeAxisMenu gmCustomizeAxisMenu;
-extern INDEX _iLocalPlayer;
-
-enum GameMode {
- GM_NONE = 0,
- GM_SINGLE_PLAYER,
- GM_NETWORK,
- GM_SPLIT_SCREEN,
- GM_DEMO,
- GM_INTRO,
-};
-extern GameMode _gmMenuGameMode;
-extern GameMode _gmRunningGameMode;
-
-extern CGameMenu *pgmCurrentMenu;
-
-class CGameMenu {
-public:
- CListHead gm_lhGadgets;
- CGameMenu *gm_pgmParentMenu;
- BOOL gm_bPopup;
- const char *gm_strName; // menu name (for mod interface only)
- class CMenuGadget *gm_pmgSelectedByDefault;
- class CMenuGadget *gm_pmgArrowUp;
- class CMenuGadget *gm_pmgArrowDn;
- class CMenuGadget *gm_pmgListTop;
- class CMenuGadget *gm_pmgListBottom;
- INDEX gm_iListOffset;
- INDEX gm_iListWantedItem; // item you want to focus initially
- INDEX gm_ctListVisible;
- INDEX gm_ctListTotal;
- CGameMenu(void);
- void ScrollList(INDEX iDir);
- void KillAllFocuses(void);
- virtual void Initialize_t(void);
- virtual void Destroy(void);
- virtual void StartMenu(void);
- virtual void FillListItems(void);
- virtual void EndMenu(void);
- // return TRUE if handled
- virtual BOOL OnKeyDown( int iVKey);
- virtual BOOL OnChar(MSG msg);
- virtual void Think(void);
-};
-
-class CConfirmMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- // return TRUE if handled
- BOOL OnKeyDown( int iVKey);
-
- void BeLarge(void);
- void BeSmall(void);
-};
-
-class CMainMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CInGameMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CSinglePlayerMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CCreditsMenu : public CGameMenu {
-public:
- void Initialize_t(void);
-};
-
-class CDisabledMenu : public CGameMenu {
-public:
- void Initialize_t(void);
-};
-
-class CSinglePlayerNewMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CLevelsMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void FillListItems(void);
- void StartMenu(void);
-};
-
-class CVarMenu : public CGameMenu {
-public:
- CTFileName gm_fnmMenuCFG;
- void Initialize_t(void);
- void FillListItems(void);
- void StartMenu(void);
- void EndMenu(void);
- void Think(void);
-};
-
-class CServersMenu : public CGameMenu {
-public:
- BOOL m_bInternet;
- void Initialize_t(void);
- void StartMenu(void);
- void Think(void);
-};
-
-class CPlayerProfileMenu : public CGameMenu {
-public:
- INDEX *gm_piCurrentPlayer;
- void Initialize_t(void);
- INDEX ComboFromPlayer(INDEX iPlayer);
- INDEX PlayerFromCombo(INDEX iCombo);
- void SelectPlayer(INDEX iPlayer);
- void ApplyComboPlayer(INDEX iPlayer);
- void StartMenu(void);
- void EndMenu(void);
-};
-
-class CControlsMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
- void ObtainActionSettings(void);
- void ApplyActionSettings(void);
-};
-
-class CFileInfo {
-public:
- CListNode fi_lnNode;
- CTFileName fi_fnFile;
- CTString fi_strName;
-};
-
-class CLoadSaveMenu : public CGameMenu {
-public:
- // settings adjusted before starting the menu
- CGameMenu *gm_pgmNextMenu; // menu to go to after selecting a file (if null, use parent menu)
- CTFileName gm_fnmSelected; // file that is selected initially
- CTFileName gm_fnmDirectory; // directory that should be read
- CTFileName gm_fnmBaseName; // base file name for saving (numbers are auto-added)
- CTFileName gm_fnmExt; // accepted file extension
- BOOL gm_bSave; // set when chosing file for saving
- BOOL gm_bManage; // set if managing (rename/delet is enabled)
- CTString gm_strSaveDes; // default description (if saving)
- BOOL gm_bAllowThumbnails; // set when chosing file for saving
- BOOL gm_bNoEscape; // forbid exiting with escape/rmb
-#define LSSORT_NONE 0
-#define LSSORT_NAMEUP 1
-#define LSSORT_NAMEDN 2
-#define LSSORT_FILEUP 3
-#define LSSORT_FILEDN 4
- INDEX gm_iSortType; // sort type
-
- // function to activate when file is chosen
- // return true if saving succeeded - description is saved automatically
- // always return true for loading
- BOOL (*gm_pAfterFileChosen)(const CTFileName &fnm);
-
- // internal properties
- CListHead gm_lhFileInfos; // all file infos to list
- INDEX gm_iLastFile; // index of last saved file in numbered format
-
- // called to get info of a file from directory, or to skip it
- BOOL ParseFile(const CTFileName &fnm, CTString &strName);
-
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
- void FillListItems(void);
-};
-
-extern CLoadSaveMenu gmLoadSaveMenu;
-
-class CHighScoreMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CNetworkMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CNetworkStartMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
-};
-
-class CNetworkOpenMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
-};
-
-class CNetworkJoinMenu : public CGameMenu {
-public:
- void Initialize_t(void);
-};
-
-class CSplitScreenMenu: public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
-};
-
-class CSplitStartMenu: public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
-};
-
-class CSelectPlayersMenu: public CGameMenu {
-public:
- BOOL gm_bAllowDedicated;
- BOOL gm_bAllowObserving;
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
-};
-
-class COptionsMenu : public CGameMenu {
-public:
- void Initialize_t(void);
-};
-
-class CVideoOptionsMenu : public CGameMenu {
-public:
- void StartMenu(void);
- void Initialize_t(void);
-};
-
-class CRenderingOptionsMenu : public CGameMenu {
-public:
- void StartMenu(void);
- void EndMenu(void);
- void Initialize_t(void);
-};
-
-class CAudioOptionsMenu : public CGameMenu {
-public:
- void StartMenu(void);
- void Initialize_t(void);
-};
-
-class CCustomizeKeyboardMenu : public CGameMenu {
-public:
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
- void FillListItems(void);
-};
-
-class CCustomizeAxisMenu : public CGameMenu {
-public:
- ~CCustomizeAxisMenu(void);
- void Initialize_t(void);
- void StartMenu(void);
- void EndMenu(void);
- void ObtainActionSettings(void);
- void ApplyActionSettings(void);
-};
-
diff --git a/Sources/SeriousSam/MenuGadgets.cpp b/Sources/SeriousSam/MenuGadgets.cpp
deleted file mode 100644
index 953271e..0000000
--- a/Sources/SeriousSam/MenuGadgets.cpp
+++ /dev/null
@@ -1,1927 +0,0 @@
-/* Copyright (c) 2002-2012 Croteam Ltd.
-This program is free software; you can redistribute it and/or modify
-it under the terms of version 2 of the GNU General Public License as published by
-the Free Software Foundation
-
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-#include "StdH.h"
-#include
-#include
-#include "MenuPrinting.h"
-#include
-#include "LevelInfo.h"
-#include "VarList.h"
-
-extern CFontData _fdBig;
-extern CFontData _fdMedium;
-extern CFontData _fdSmall;
-extern CSoundData *_psdSelect;
-
-CMenuGadget *_pmgLastActivatedGadget = NULL;
-
-extern CSoundData *_psdPress;
-extern PIX _pixCursorPosI;
-extern PIX _pixCursorPosJ;
-extern BOOL _bDefiningKey = FALSE;
-extern BOOL _bEditingString = FALSE;
-extern INDEX sam_bWideScreen;
-
-
-CMenuGadget::CMenuGadget( void)
-{
- mg_pmgLeft = NULL;
- mg_pmgRight = NULL;
- mg_pmgUp = NULL;
- mg_pmgDown = NULL;
-
- mg_bVisible = TRUE;
- mg_bEnabled = TRUE;
- mg_bLabel = FALSE;
- mg_bFocused = FALSE;
- mg_iInList = -1; // not in list
-}
-
-void CMenuGadget::OnActivate( void)
-{
- NOTHING;
-}
-
-// return TRUE if handled
-BOOL CMenuGadget::OnKeyDown( int iVKey)
-{
- // if return pressed
- if( iVKey==VK_RETURN || iVKey==VK_LBUTTON) {
- // activate
- OnActivate();
- // key is handled
- return TRUE;
- }
- // key is not handled
- return FALSE;
-}
-
-
-BOOL CMenuGadget::OnChar(MSG msg)
-{
- // key is not handled
- return FALSE;
-}
-
-
-void CMenuGadget::OnSetFocus( void)
-{
- mg_bFocused = TRUE;
- if( !IsSeparator())
- {
- PlayMenuSound(_psdSelect);
- IFeel_PlayEffect("Menu_select");
- }
-}
-
-void CMenuGadget::OnKillFocus( void)
-{
- mg_bFocused = FALSE;
-}
-
-void CMenuGadget::Appear( void)
-{
- mg_bVisible = TRUE;
-}
-
-void CMenuGadget::Disappear( void)
-{
- mg_bVisible = FALSE;
- mg_bFocused = FALSE;
-}
-
-void CMenuGadget::Think( void)
-{
-}
-void CMenuGadget::OnMouseOver(PIX pixI, PIX pixJ)
-{
-}
-
-// get current color for the gadget
-COLOR CMenuGadget::GetCurrentColor(void)
-{
- // use normal colors
- COLOR colUnselected = LCDGetColor(C_GREEN, "unselected");
- COLOR colSelected = LCDGetColor(C_WHITE, "selected");
- // if disabled
- if (!mg_bEnabled) {
- // use a bit darker colors
- colUnselected = LCDGetColor(C_dGREEN, "disabled unselected");
- colSelected = LCDGetColor(C_GRAY, "disabled selected");
- // if label
- if (mg_bLabel) {
- // use white
- colUnselected = colSelected = LCDGetColor(C_WHITE, "label");
- }
- }
- // use unselected color
- COLOR colRet = colUnselected;
- // if selected
- if( mg_bFocused) {
- // oscilate towards selected color
- FLOAT tmNow = _pTimer->GetHighPrecisionTimer().GetSeconds();
- colRet = LerpColor( (colUnselected>>1)&0x7F7F7F7F, colSelected, sin(tmNow*10.0f)*0.5f+0.5f);
- }
-
- return colRet|CT_OPAQUE;
-}
-
-void CMenuGadget::Render( CDrawPort *pdp)
-{
-}
-
-void CMGTitle::Render( CDrawPort *pdp)
-{
- SetFontTitle(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixI = box.Center()(1);
- PIX pixJ = box.Min()(2);
-
- pdp->PutTextC( mg_strText, pixI, pixJ, LCDGetColor(C_WHITE|CT_OPAQUE, "title"));
-}
-
-CMGButton::CMGButton( void)
-{
- mg_pActivatedFunction = NULL;
- mg_iIndex = 0;
- mg_iCenterI = 0;
- mg_iTextMode = 1;
- mg_bfsFontSize = BFS_MEDIUM;
- mg_iCursorPos = -1;
- mg_bRectangle = FALSE;
- mg_bMental = FALSE;
-}
-
-
-void CMGButton::SetText( CTString strNew)
-{
- mg_strText = strNew;
-}
-
-
-void CMGButton::OnActivate( void)
-{
- if( mg_pActivatedFunction!=NULL && mg_bEnabled)
- {
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
- _pmgLastActivatedGadget = this;
- (*mg_pActivatedFunction)();
- }
-}
-
-
-BOOL CMGVarButton::IsSeparator(void)
-{
- if( mg_pvsVar==NULL) return FALSE;
- return mg_pvsVar->vs_bSeparator;
-}
-
-
-BOOL CMGVarButton::IsEnabled(void)
-{
- return( _gmRunningGameMode==GM_NONE
- || mg_pvsVar==NULL
- || mg_pvsVar->vs_bCanChangeInGame);
-}
-
-
-void CMGButton::Render( CDrawPort *pdp)
-{
- if (mg_bfsFontSize==BFS_LARGE) {
- SetFontBig(pdp);
- } else if (mg_bfsFontSize==BFS_MEDIUM) {
- SetFontMedium(pdp);
- } else {
- ASSERT(mg_bfsFontSize==BFS_SMALL);
- SetFontSmall(pdp);
- }
- pdp->SetTextMode(mg_iTextMode);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- COLOR col = GetCurrentColor();
- if(mg_bEditing) {
- col = LCDGetColor(C_GREEN|0xFF, "editing");
- }
-
- COLOR colRectangle = col;
- if( mg_bHighlighted) {
- col = LCDGetColor(C_WHITE|0xFF, "hilited");
- if( !mg_bFocused) {
- colRectangle = LCDGetColor(C_WHITE|0xFF, "hilited rectangle");
- }
- }
- if (mg_bMental) {
- FLOAT tmIn = 0.2f;
- FLOAT tmOut = 1.0f;
- FLOAT tmFade = 0.1f;
- FLOAT tmExist = tmFade+tmIn+tmFade;
- FLOAT tmTotal = tmFade+tmIn+tmFade+tmOut;
-
- FLOAT tmTime = _pTimer->GetHighPrecisionTimer().GetSeconds();
- FLOAT fFactor = 1;
- if (tmTime>0.1f) {
- tmTime = fmod(tmTime, tmTotal);
- fFactor = CalculateRatio(tmTime, 0, tmExist, tmFade/tmExist, tmFade/tmExist);
- }
- col = (col&~0xFF)|INDEX(0xFF*fFactor);
- }
-
- if( mg_bRectangle) {
- // put border
- const PIX pixLeft = box.Min()(1);
- const PIX pixUp = box.Min()(2)-3;
- const PIX pixWidth = box.Size()(1)+1;
- const PIX pixHeight = box.Size()(2);
- pdp->DrawBorder( pixLeft, pixUp, pixWidth, pixHeight, colRectangle);
- }
-
- if( mg_bEditing) {
- // put border
- PIX pixLeft = box.Min()(1);
- PIX pixUp = box.Min()(2)-3;
- PIX pixWidth = box.Size()(1)+1;
- PIX pixHeight = box.Size()(2);
- if (mg_strLabel!="") {
- pixLeft = box.Min()(1)+box.Size()(1)*0.55f;
- pixWidth = box.Size()(1)*0.45f+1;
- }
- pdp->Fill( pixLeft, pixUp, pixWidth, pixHeight, LCDGetColor(C_dGREEN|0x40, "edit fill"));
- }
-
-
- INDEX iCursor = mg_iCursorPos;
-
- // print text
- if (mg_strLabel!="") {
- PIX pixIL = box.Min()(1)+box.Size()(1)*0.45f;
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
-
- pdp->PutTextR( mg_strLabel, pixIL, pixJ, col);
- pdp->PutText( mg_strText, pixIR, pixJ, col);
- } else {
- CTString str = mg_strText;
- if (pdp->dp_FontData->fd_bFixedWidth) {
- str = str.Undecorated();
- INDEX iLen = str.Length();
- INDEX iMaxLen = ClampDn(box.Size()(1)/(pdp->dp_pixTextCharSpacing+pdp->dp_FontData->fd_pixCharWidth), 1L);
- if (iCursor>=iMaxLen) {
- str.TrimRight(iCursor);
- str.TrimLeft(iMaxLen);
- iCursor = iMaxLen;
- } else {
- str.TrimRight(iMaxLen);
- }
- }
- if( mg_iCenterI==-1) pdp->PutText( str, box.Min()(1), box.Min()(2), col);
- else if( mg_iCenterI==+1) pdp->PutTextR( str, box.Max()(1), box.Min()(2), col);
- else pdp->PutTextC( str, box.Center()(1), box.Min()(2), col);
- }
-
- // put cursor if editing
- if( mg_bEditing && (((ULONG)(_pTimer->GetRealTimeTick()*2))&1)) {
- PIX pixX = box.Min()(1) + GetCharOffset( pdp, iCursor);
- if (mg_strLabel!="") {
- pixX += box.Size()(1)*0.55f;
- }
- PIX pixY = box.Min()(2);
- if (!pdp->dp_FontData->fd_bFixedWidth) {
- pixY -= pdp->dp_fTextScaling *2;
- }
- pdp->PutText( "|", pixX, pixY, LCDGetColor(C_WHITE|0xFF, "editing cursor"));
- }
-}
-
-
-PIX CMGButton::GetCharOffset( CDrawPort *pdp, INDEX iCharNo)
-{
- if (pdp->dp_FontData->fd_bFixedWidth) {
- return (pdp->dp_FontData->fd_pixCharWidth+pdp->dp_pixTextCharSpacing)*(iCharNo-0.5f);
- }
- CTString strCut(mg_strText);
- strCut.TrimLeft( strlen(mg_strText)-iCharNo);
- PIX pixFullWidth = pdp->GetTextWidth(mg_strText);
- PIX pixCutWidth = pdp->GetTextWidth(strCut);
- // !!!! not implemented for different centering
- return pixFullWidth-pixCutWidth;
-}
-
-CMGModel::CMGModel(void)
-{
- mg_fFloorY = 0;
-}
-
-void CMGModel::Render( CDrawPort *pdp)
-{
- // if no model
- if (mg_moModel.GetData()==NULL) {
- // just render text
- mg_strText = TRANS("No model");
- CMGButton::Render(pdp);
- return;
- }
-
- // get position on screen
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- CDrawPort dpModel(pdp, box);
- dpModel.Lock();
- dpModel.FillZBuffer(1.0f);
-
- LCDSetDrawport(&dpModel);
- // clear menu here
- dpModel.Fill(C_BLACK|255);
- LCDRenderClouds1();
- LCDRenderClouds2();
-
- // prepare projection
- CRenderModel rmRenderModel;
- CPerspectiveProjection3D pr;
- pr.FOVL() = sam_bWideScreen ? AngleDeg(45.0f) : AngleDeg(30.0f);
- pr.ScreenBBoxL() = FLOATaabbox2D(
- FLOAT2D(0.0f, 0.0f),
- FLOAT2D((float)dpModel.GetWidth(), (float)dpModel.GetHeight())
- );
- pr.AspectRatioL() = 1.0f;
- pr.FrontClipDistanceL() = 0.3f;
- pr.ViewerPlacementL() = CPlacement3D(FLOAT3D(0,0,0), ANGLE3D(0,0,0));
-
- // initialize remdering
- CAnyProjection3D apr;
- apr = pr;
- BeginModelRenderingView(apr, &dpModel);
- rmRenderModel.rm_vLightDirection = FLOAT3D( 0.2f, -0.2f, -0.2f);
-
- // if model needs floor
- if (mg_moFloor.GetData()!=NULL) {
- // set floor's position
- CPlacement3D pl = mg_plModel;
- pl.pl_OrientationAngle = ANGLE3D(0,0,0);
- pl.pl_PositionVector = mg_plModel.pl_PositionVector;
- pl.pl_PositionVector(2) += mg_fFloorY;
- rmRenderModel.SetObjectPlacement(pl);
-
- // render the floor
- rmRenderModel.rm_colLight = C_WHITE;
- rmRenderModel.rm_colAmbient = C_WHITE;
- mg_moFloor.SetupModelRendering( rmRenderModel);
- mg_moFloor.RenderModel( rmRenderModel);
- }
-
- // set model's position
- CPlacement3D pl;
- pl.pl_OrientationAngle = mg_plModel.pl_OrientationAngle;
- pl.pl_PositionVector = mg_plModel.pl_PositionVector;
- extern FLOAT sam_fPlayerOffset;
- pl.pl_PositionVector(3) += sam_fPlayerOffset;
- rmRenderModel.SetObjectPlacement(pl);
-
- // render the model
- rmRenderModel.rm_colLight = LerpColor(C_BLACK, C_WHITE, 0.4f)|CT_OPAQUE;
- rmRenderModel.rm_colAmbient = LerpColor(C_BLACK, C_WHITE, 0.2f)|CT_OPAQUE;
- mg_moModel.SetupModelRendering( rmRenderModel);
- FLOATplane3D plFloorPlane = FLOATplane3D( FLOAT3D( 0.0f, 1.0f, 0.0f),
- mg_plModel.pl_PositionVector(2)+mg_fFloorY);
- FLOAT3D vShadowLightDir = FLOAT3D( -0.2f, -0.4f, -0.6f);
- CPlacement3D plLightPlacement = CPlacement3D(
- mg_plModel.pl_PositionVector+
- vShadowLightDir*mg_plModel.pl_PositionVector(3)*5,
- ANGLE3D(0,0,0));
- mg_moModel.RenderShadow( rmRenderModel, plLightPlacement, 200.0f, 200.0f, 1.0f, plFloorPlane);
- mg_moModel.RenderModel( rmRenderModel);
- EndModelRenderingView();
-
- LCDScreenBox(LCDGetColor(C_GREEN, "model box")|GetCurrentColor());
-
- dpModel.Unlock();
-
- pdp->Unlock();
- pdp->Lock();
- LCDSetDrawport(pdp);
-
- // print the model name
- {
- PIXaabbox2D box = FloatBoxToPixBox(pdp, BoxPlayerModelName());
- COLOR col = GetCurrentColor();
-
- PIX pixI = box.Min()(1);
- PIX pixJ = box.Max()(2);
- pdp->PutText( mg_strText, pixI, pixJ, col);
- }
-}
-
-
-// ------- Edit gadget implementation
-CMGEdit::CMGEdit(void)
-{
- mg_pstrToChange = NULL;
- mg_ctMaxStringLen = 70;
- Clear();
-}
-
-
-void CMGEdit::Clear(void)
-{
- mg_iCursorPos = 0;
- mg_bEditing = FALSE;
- _bEditingString = FALSE;
-}
-
-
-void CMGEdit::OnActivate(void)
-{
- if (!mg_bEnabled) {
- return;
- }
- ASSERT( mg_pstrToChange != NULL);
- PlayMenuSound( _psdPress);
- IFeel_PlayEffect("Menu_press");
- SetText( mg_strText);
- mg_iCursorPos = strlen(mg_strText);
- mg_bEditing = TRUE;
- _bEditingString = TRUE;
-}
-
-
-// focus lost
-void CMGEdit::OnKillFocus(void)
-{
- // go out of editing mode
- if( mg_bEditing) {
- OnKeyDown(VK_RETURN);
- Clear();
- }
- // proceed
- CMenuGadget::OnKillFocus();
-}
-
-
-// helper function for deleting char(s) from string
-static void Key_BackDel( CTString &str, INDEX &iPos, BOOL bShift, BOOL bRight)
-{
- // do nothing if string is empty
- INDEX ctChars = strlen(str);
- if( ctChars==0) return;
- if( bRight && iPos0) { // BACKSPACE key
- if( bShift) {
- // delete to start of line
- str.TrimLeft(ctChars-iPos);
- iPos=0;
- } else {
- // delete only one char
- str.DeleteChar(iPos-1);
- iPos--;
- }
- }
-}
-
-// key/mouse button pressed
-BOOL CMGEdit::OnKeyDown( int iVKey)
-{
- // if not in edit mode
- if( !mg_bEditing) {
- // behave like normal gadget
- return CMenuGadget::OnKeyDown(iVKey);
- }
-
- // finish editing?
- BOOL bShift = GetKeyState(VK_SHIFT) & 0x8000;
- switch( iVKey) {
- case VK_UP: case VK_DOWN:
- case VK_RETURN: case VK_LBUTTON: *mg_pstrToChange = mg_strText; Clear(); OnStringChanged(); break;
- case VK_ESCAPE: case VK_RBUTTON: mg_strText = *mg_pstrToChange; Clear(); OnStringCanceled(); break;
- case VK_LEFT: if( mg_iCursorPos > 0) mg_iCursorPos--; break;
- case VK_RIGHT: if( mg_iCursorPos < strlen(mg_strText)) mg_iCursorPos++; break;
- case VK_HOME: mg_iCursorPos = 0; break;
- case VK_END: mg_iCursorPos = strlen(mg_strText); break;
- case VK_BACK: Key_BackDel( mg_strText, mg_iCursorPos, bShift, FALSE); break;
- case VK_DELETE: Key_BackDel( mg_strText, mg_iCursorPos, bShift, TRUE); break;
- default: break; // ignore all other special keys
- }
-
- // key is handled
- return TRUE;
-}
-
-
-// char typed
-BOOL CMGEdit::OnChar( MSG msg)
-{
- // if not in edit mode
- if( !mg_bEditing) {
- // behave like normal gadget
- return CMenuGadget::OnChar(msg);
- }
- // only chars are allowed
- const INDEX ctFullLen = mg_strText.Length();
- const INDEX ctNakedLen = mg_strText.LengthNaked();
- mg_iCursorPos = Clamp( mg_iCursorPos, 0L, ctFullLen);
- int iVKey = msg.wParam;
- if( isprint(iVKey) && ctNakedLen<=mg_ctMaxStringLen) {
- mg_strText.InsertChar( mg_iCursorPos, (char)iVKey);
- mg_iCursorPos++;
- }
- // key is handled
- return TRUE;
-}
-
-
-void CMGEdit::Render( CDrawPort *pdp)
-{
- if( mg_bEditing) {
- mg_iTextMode = -1;
- } else if( mg_bFocused) {
- mg_iTextMode = 0;
- } else {
- mg_iTextMode = 1;
- }
- if (mg_strText=="" && !mg_bEditing) {
- if (mg_bfsFontSize==BFS_SMALL) {
- mg_strText="*";
- } else {
- mg_strText=TRANS("");
- }
- CMGButton::Render(pdp);
- mg_strText="";
- } else {
- CMGButton::Render(pdp);
- }
-}
-void CMGEdit::OnStringChanged(void)
-{
-}
-void CMGEdit::OnStringCanceled(void)
-{
-}
-
-
-void CMGArrow::Render( CDrawPort *pdp)
-{
- SetFontMedium(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- COLOR col = GetCurrentColor();
-
- CTString str;
- if (mg_adDirection==AD_NONE) {
- str = "???";
- } else if (mg_adDirection==AD_UP) {
- str = TRANS("Page Up");
- } else if (mg_adDirection==AD_DOWN) {
- str = TRANS("Page Down");
- } else {
- ASSERT(FALSE);
- }
- PIX pixI = box.Min()(1);
- PIX pixJ = box.Min()(2);
- pdp->PutText( str, pixI, pixJ, col);
-}
-
-void CMGArrow::OnActivate(void)
-{
- if (mg_adDirection==AD_UP) {
- pgmCurrentMenu->ScrollList(-3);
- } else if (mg_adDirection==AD_DOWN) {
- pgmCurrentMenu->ScrollList(+3);
- }
-}
-
-#define HSCOLUMNS 6
-CTString strHighScores[HIGHSCORE_COUNT+1][HSCOLUMNS];
-FLOAT afI[HSCOLUMNS] = {
- 0.12f, 0.15f, 0.6f, 0.7f, 0.78f, 0.9f
-};
-
-void CMGHighScore::Render( CDrawPort *pdp)
-{
- SetFontMedium(pdp);
-
- COLOR colHeader = LCDGetColor(C_GREEN|255, "hiscore header");
- COLOR colData = LCDGetColor(C_mdGREEN|255, "hiscore data");
- COLOR colLastSet = LCDGetColor(C_mlGREEN|255, "hiscore last set");
- INDEX iLastSet = _pGame->gm_iLastSetHighScore;
-
- CTString strText;
-
- strHighScores[0][0] = TRANS("No.");
- strHighScores[0][1] = TRANS("Player Name");
- strHighScores[0][2] = TRANS("Difficulty");
- strHighScores[0][3] = TRANS("Time");
- strHighScores[0][4] = TRANS("Kills");
- strHighScores[0][5] = TRANS("Score");
-
- {for (INDEX i=0; igm_ahseHighScores[i].hse_gdDifficulty) {
- default:
- ASSERT(FALSE);
- case (CSessionProperties::GameDifficulty)-100:
- strHighScores[i+1][1] = "---";
- continue;
- break;
- case CSessionProperties::GD_TOURIST:
- strHighScores[i+1][2] = TRANS("Tourist");
- break;
- case CSessionProperties::GD_EASY:
- strHighScores[i+1][2] = TRANS("Easy");
- break;
- case CSessionProperties::GD_NORMAL:
- strHighScores[i+1][2] = TRANS("Normal");
- break;
- case CSessionProperties::GD_HARD:
- strHighScores[i+1][2] = TRANS("Hard");
- break;
- case CSessionProperties::GD_EXTREME:
- strHighScores[i+1][2] = TRANS("Serious");
- break;
- case CSessionProperties::GD_EXTREME+1:
- strHighScores[i+1][2] = TRANS("Mental");
- break;
- }
- strHighScores[i+1][0].PrintF("%d", i+1);
- strHighScores[i+1][1] = _pGame->gm_ahseHighScores[i].hse_strPlayer;
- strHighScores[i+1][3] = TimeToString(_pGame->gm_ahseHighScores[i].hse_tmTime);
- strHighScores[i+1][4].PrintF("%03d", _pGame->gm_ahseHighScores[i].hse_ctKills);
- strHighScores[i+1][5].PrintF("%9d", _pGame->gm_ahseHighScores[i].hse_ctScore);
- }}
-
- PIX pixJ = pdp->GetHeight()*0.25f;
- {for (INDEX iRow=0; iRowGetWidth()*afI[iColumn];
- if (iColumn==1) {
- pdp->PutText(strHighScores[iRow][iColumn], pixI, pixJ, col);
- } else {
- pdp->PutTextR(strHighScores[iRow][iColumn], pixI, pixJ, col);
- }
- }}
- if (iRow==0) {
- pixJ+=pdp->GetHeight()*0.06f;
- } else {
- pixJ+=pdp->GetHeight()*0.04f;
- }
- }}
-}
-
-// ------- Trigger button implementation
-INDEX GetNewLoopValue( int iVKey, INDEX iCurrent, INDEX ctMembers)
-{
- INDEX iPrev = (iCurrent+ctMembers-1)%ctMembers;
- INDEX iNext = (iCurrent+1)%ctMembers;
- // return and right arrow set new text
- if( iVKey == VK_RETURN || iVKey==VK_LBUTTON || iVKey==VK_RIGHT )
- {
- return iNext;
- }
- // left arrow and backspace sets prev text
- else if( (iVKey == VK_BACK || iVKey==VK_RBUTTON) || (iVKey == VK_LEFT) )
- {
- return iPrev;
- }
- return iCurrent;
-}
-
-CMGTrigger::CMGTrigger( void)
-{
- mg_pOnTriggerChange = NULL;
- mg_iCenterI = 0;
- mg_bVisual = FALSE;
-}
-
-void CMGTrigger::ApplyCurrentSelection(void)
-{
- mg_iSelected = Clamp(mg_iSelected, 0L, mg_ctTexts-1L);
- mg_strValue = mg_astrTexts[ mg_iSelected];
-}
-
-
-void CMGTrigger::OnSetNextInList(int iVKey)
-{
- if( mg_pPreTriggerChange != NULL) {
- mg_pPreTriggerChange(mg_iSelected);
- }
-
- mg_iSelected = GetNewLoopValue( iVKey, mg_iSelected, mg_ctTexts);
- mg_strValue = mg_astrTexts[ mg_iSelected];
-
- if( mg_pOnTriggerChange != NULL) {
- (*mg_pOnTriggerChange)(mg_iSelected);
- }
-}
-
-
-BOOL CMGTrigger::OnKeyDown( int iVKey)
-{
- if( (iVKey == VK_RETURN || iVKey==VK_LBUTTON) ||
- (iVKey == VK_LEFT) ||
- (iVKey == VK_BACK || iVKey==VK_RBUTTON) ||
- (iVKey == VK_RIGHT) )
- {
- // key is handled
- if( mg_bEnabled) OnSetNextInList(iVKey);
- return TRUE;
- }
- // key is not handled
- return FALSE;
-}
-
-
-void CMGTrigger::Render( CDrawPort *pdp)
-{
- SetFontMedium(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIL = box.Min()(1)+box.Size()(1)*0.45f;
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
-
- COLOR col = GetCurrentColor();
- if (!mg_bVisual || mg_strValue=="") {
- CTString strValue = mg_strValue;
- if (mg_bVisual) {
- strValue = TRANS("none");
- }
- if (mg_iCenterI==-1) {
- pdp->PutText( mg_strLabel, box.Min()(1), pixJ, col);
- pdp->PutTextR( strValue, box.Max()(1), pixJ, col);
- } else {
- pdp->PutTextR( mg_strLabel, pixIL, pixJ, col);
- pdp->PutText( strValue, pixIR, pixJ, col);
- }
- } else {
- CTString strLabel = mg_strLabel+": ";
- pdp->PutText(strLabel, box.Min()(1), pixJ, col);
- CTextureObject to;
- try {
- to.SetData_t(mg_strValue);
- CTextureData *ptd = (CTextureData *)to.GetData();
- PIX pixSize = box.Size()(2);
- PIX pixCX = box.Max()(1)-pixSize/2;
- PIX pixCY = box.Center()(2);
- pdp->PutTexture( &to, PIXaabbox2D(
- PIX2D(pixCX-pixSize/2, pixCY-pixSize/2),
- PIX2D(pixCX-pixSize/2+pixSize, pixCY-pixSize/2+pixSize)), C_WHITE|255);
- } catch (char *strError) {
- CPrintF("%s\n", strError);
- }
- to.SetData(NULL);
- }
-}
-
-CMGSlider::CMGSlider()
-{
- mg_iMinPos = 0;
- mg_iMaxPos = 16;
- mg_iCurPos = 8;
- mg_pOnSliderChange = NULL;
- mg_fFactor = 1.0f;
-}
-
-void CMGSlider::ApplyCurrentPosition( void)
-{
- mg_iCurPos = Clamp(mg_iCurPos, mg_iMinPos, mg_iMaxPos);
- FLOAT fStretch = FLOAT(mg_iCurPos)/(mg_iMaxPos-mg_iMinPos);
- mg_fFactor = fStretch;
-
- if (mg_pOnSliderChange!=NULL) {
- mg_pOnSliderChange(mg_iCurPos);
- }
-}
-
-void CMGSlider::ApplyGivenPosition( INDEX iMin, INDEX iMax, INDEX iCur)
-{
- mg_iMinPos = iMin;
- mg_iMaxPos = iMax;
- mg_iCurPos = iCur;
- ApplyCurrentPosition();
-}
-
-
-BOOL CMGSlider::OnKeyDown( int iVKey)
-{
- // if scrolling left
- if( (iVKey==VK_BACK || iVKey==VK_LEFT) && mg_iCurPos>mg_iMinPos) {
- mg_iCurPos --;
- ApplyCurrentPosition();
- return TRUE;
- // if scrolling right
- } else if( (iVKey==VK_RETURN || iVKey==VK_RIGHT) && mg_iCurPos=PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
- // set new position exactly where mouse pointer is
- FLOAT fRatio = FLOAT(_pixCursorPosI-boxSlider.Min()(1))/boxSlider.Size()(1);
- fRatio = (fRatio-0.01f)/(0.99f-0.01f);
- fRatio = Clamp(fRatio, 0.0f, 1.0f);
- mg_iCurPos = fRatio*(mg_iMaxPos-mg_iMinPos) + mg_iMinPos;
- ApplyCurrentPosition();
- return TRUE;
- }
- }
- return CMenuGadget::OnKeyDown( iVKey);
-}
-
-
-PIXaabbox2D CMGSlider::GetSliderBox(void)
-{
- extern CDrawPort *pdp;
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
- PIX pixJSize = box.Size()(2)*0.95f;
- PIX pixISizeR = box.Size()(1)*0.45f;
- if( sam_bWideScreen) pixJSize++;
- return PIXaabbox2D( PIX2D(pixIR+1, pixJ+1), PIX2D(pixIR+pixISizeR-2, pixJ+pixJSize-2));
-}
-
-
-void CMGSlider::Render( CDrawPort *pdp)
-{
- SetFontMedium(pdp);
-
- // get geometry
- COLOR col = GetCurrentColor();
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIL = box.Min()(1)+box.Size()(1)*0.45f;
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
- PIX pixJSize = box.Size()(2)*0.95f;
- PIX pixISizeR = box.Size()(1)*0.45f;
- if( sam_bWideScreen) pixJSize++;
-
- // print text left of slider
- pdp->PutTextR( mg_strText, pixIL, pixJ, col);
-
- // draw box around slider
- LCDDrawBox(0, -1, PIXaabbox2D( PIX2D(pixIR+1, pixJ), PIX2D(pixIR+pixISizeR-2, pixJ+pixJSize-2)),
- LCDGetColor(C_GREEN|255, "slider box"));
-
- // draw filled part of slider
- pdp->Fill( pixIR+2, pixJ+1, (pixISizeR-5)*mg_fFactor, (pixJSize-4), col);
-
- // print percentage text
- CTString strPercentage;
- strPercentage.PrintF("%d%%", (int)floor(mg_fFactor*100+0.5f) );
- pdp->PutTextC( strPercentage, pixIR+pixISizeR/2, pixJ+1, col);
-}
-
-
-void CMGLevelButton::OnActivate(void)
-{
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
- _pGame->gam_strCustomLevel = mg_fnmLevel;
- extern void (*_pAfterLevelChosen)(void);
- _pAfterLevelChosen();
-}
-
-
-void CMGLevelButton::OnSetFocus(void)
-{
- SetThumbnail(mg_fnmLevel);
- CMGButton::OnSetFocus();
-}
-
-
-
-// return slider position on scren
-PIXaabbox2D CMGVarButton::GetSliderBox(void)
-{
- extern CDrawPort *pdp;
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
- PIX pixISize = box.Size()(1)*0.13f;
- PIX pixJSize = box.Size()(2);
- return PIXaabbox2D( PIX2D(pixIR, pixJ+1), PIX2D(pixIR+pixISize-4, pixJ+pixJSize-6));
-}
-
-extern BOOL _bVarChanged;
-BOOL CMGVarButton::OnKeyDown(int iVKey)
-{
- if (mg_pvsVar==NULL || mg_pvsVar->vs_bSeparator || !mg_pvsVar->Validate() || !mg_bEnabled) {
- return CMenuGadget::OnKeyDown(iVKey);
- }
-
- // handle slider
- if( mg_pvsVar->vs_iSlider && !mg_pvsVar->vs_bCustom) {
- // ignore RMB
- if( iVKey==VK_RBUTTON) return TRUE;
- // handle LMB
- if( iVKey==VK_LBUTTON) {
- // get position of slider box on screen
- PIXaabbox2D boxSlider = GetSliderBox();
- // if mouse is within
- if( boxSlider>=PIX2D(_pixCursorPosI, _pixCursorPosJ)) {
- // set new position exactly where mouse pointer is
- mg_pvsVar->vs_iValue = (FLOAT)(_pixCursorPosI-boxSlider.Min()(1))/boxSlider.Size()(1) * (mg_pvsVar->vs_ctValues);
- _bVarChanged = TRUE;
- }
- // handled
- return TRUE;
- }
- }
-
- if( iVKey==VK_RETURN) {
- FlushVarSettings(TRUE);
- void MenuGoToParent(void);
- MenuGoToParent();
- return TRUE;
- }
-
- if( iVKey==VK_LBUTTON || iVKey==VK_RIGHT) {
- if (mg_pvsVar!=NULL) {
- INDEX iOldValue = mg_pvsVar->vs_iValue;
- mg_pvsVar->vs_iValue++;
- if( mg_pvsVar->vs_iValue>=mg_pvsVar->vs_ctValues) {
- // wrap non-sliders, clamp sliders
- if( mg_pvsVar->vs_iSlider) mg_pvsVar->vs_iValue = mg_pvsVar->vs_ctValues-1L;
- else mg_pvsVar->vs_iValue = 0;
- }
- if( iOldValue != mg_pvsVar->vs_iValue) {
- _bVarChanged = TRUE;
- mg_pvsVar->vs_bCustom = FALSE;
- mg_pvsVar->Validate();
- }
- }
- return TRUE;
- }
-
- if( iVKey==VK_LEFT || iVKey==VK_RBUTTON) {
- if (mg_pvsVar!=NULL) {
- INDEX iOldValue = mg_pvsVar->vs_iValue;
- mg_pvsVar->vs_iValue--;
- if( mg_pvsVar->vs_iValue<0) {
- // wrap non-sliders, clamp sliders
- if( mg_pvsVar->vs_iSlider) mg_pvsVar->vs_iValue = 0;
- else mg_pvsVar->vs_iValue = mg_pvsVar->vs_ctValues-1L;
- }
- if( iOldValue != mg_pvsVar->vs_iValue) {
- _bVarChanged = TRUE;
- mg_pvsVar->vs_bCustom = FALSE;
- mg_pvsVar->Validate();
- }
- }
- return TRUE;
- }
-
- // not handled
- return CMenuGadget::OnKeyDown(iVKey);
-}
-
-
-void CMGVarButton::Render( CDrawPort *pdp)
-{
- if (mg_pvsVar==NULL) {
- return;
- }
-
- SetFontMedium(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIL = box.Min()(1)+box.Size()(1)*0.45f;
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixIC = box.Center()(1);
- PIX pixJ = box.Min()(2);
-
- if (mg_pvsVar->vs_bSeparator)
- {
- mg_bEnabled = FALSE;
- COLOR col = LCDGetColor(C_WHITE|255, "separator");
- CTString strText = mg_pvsVar->vs_strName;
- pdp->PutTextC(strText, pixIC, pixJ, col);
- }
- else if (mg_pvsVar->Validate())
- {
- // check whether the variable is disabled
- if( mg_pvsVar->vs_strFilter!="") mg_bEnabled = _pShell->GetINDEX(mg_pvsVar->vs_strFilter);
- COLOR col = GetCurrentColor();
- pdp->PutTextR( mg_pvsVar->vs_strName, pixIL, pixJ, col);
- // custom is by default
- CTString strText = TRANS("Custom");
- if( !mg_pvsVar->vs_bCustom)
- { // not custom!
- strText = mg_pvsVar->vs_astrTexts[mg_pvsVar->vs_iValue];
- // need slider?
- if( mg_pvsVar->vs_iSlider>0) {
- // draw box around slider
- PIX pixISize = box.Size()(1)*0.13f;
- PIX pixJSize = box.Size()(2);
- LCDDrawBox( 0,-1, PIXaabbox2D( PIX2D(pixIR, pixJ+1), PIX2D(pixIR+pixISize-4, pixJ+pixJSize-6)),
- LCDGetColor(C_GREEN|255, "slider box"));
- // draw filled part of slider
- if( mg_pvsVar->vs_iSlider==1) {
- // fill slider
- FLOAT fFactor = (FLOAT)(mg_pvsVar->vs_iValue+1) / mg_pvsVar->vs_ctValues;
- pdp->Fill( pixIR+1, pixJ+2, (pixISize-6)*fFactor, pixJSize-9, col);
- } else {
- // ratio slider
- ASSERT( mg_pvsVar->vs_iSlider==2);
- FLOAT fUnitWidth = (FLOAT)(pixISize-5) / mg_pvsVar->vs_ctValues;
- pdp->Fill( pixIR+1+(mg_pvsVar->vs_iValue*fUnitWidth), pixJ+2, fUnitWidth, pixJSize-9, col);
- }
- // move text printout to the right of slider
- pixIR += box.Size()(1)*0.15f;
- }
- }
- // write right text
- pdp->PutText(strText, pixIR, pixJ, col);
- }
-}
-
-
-CMGFileButton::CMGFileButton(void)
-{
- mg_iState = FBS_NORMAL;
-}
-
-// refresh current text from description
-void CMGFileButton::RefreshText(void)
-{
- mg_strText = mg_strDes;
- mg_strText.OnlyFirstLine();
- mg_strInfo = mg_strDes;
- mg_strInfo.RemovePrefix(mg_strText);
- mg_strInfo.DeleteChar(0);
-}
-
-void CMGFileButton::SaveDescription(void)
-{
- CTFileName fnFileNameDescription = mg_fnm.NoExt()+".des";
- try {
- mg_strDes.Save_t(fnFileNameDescription);
- } catch( char *strError) {
- CPrintF("%s\n", strError);
- }
-}
-
-CMGFileButton *_pmgFileToSave = NULL;
-void OnFileSaveOK(void)
-{
- if (_pmgFileToSave!=NULL) {
- _pmgFileToSave->SaveYes();
- }
-}
-
-void CMGFileButton::DoSave(void)
-{
- if (FileExistsForWriting(mg_fnm)) {
- _pmgFileToSave = this;
- extern void SaveConfirm(void);
- SaveConfirm();
- } else {
- SaveYes();
- }
-}
-
-void CMGFileButton::SaveYes(void)
-{
- ASSERT(gmLoadSaveMenu.gm_bSave);
- // call saving function
- BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
- // if saved
- if (bSucceeded) {
- // save the description too
- SaveDescription();
- }
-}
-
-void CMGFileButton::DoLoad(void)
-{
- ASSERT(!gmLoadSaveMenu.gm_bSave);
- // if no file
- if(!FileExists(mg_fnm)) {
- // do nothing
- return;
- }
- if (gmLoadSaveMenu.gm_pgmNextMenu!=NULL) {
- gmLoadSaveMenu.gm_pgmParentMenu = gmLoadSaveMenu.gm_pgmNextMenu;
- }
- // call loading function
- BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
- ASSERT(bSucceeded);
-}
-
-static CTString _strTmpDescription;
-static CTString _strOrgDescription;
-
-void CMGFileButton::StartEdit(void)
-{
- CMGEdit::OnActivate();
-}
-
-void CMGFileButton::OnActivate(void)
-{
- if (mg_fnm=="") {
- return;
- }
-
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
-
- // if loading
- if (!gmLoadSaveMenu.gm_bSave) {
- // load now
- DoLoad();
- // if saving
- } else {
- // switch to editing mode
- BOOL bWasEmpty = mg_strText==EMPTYSLOTSTRING;
- mg_strDes = gmLoadSaveMenu.gm_strSaveDes;
- RefreshText();
- _strOrgDescription = _strTmpDescription = mg_strText;
- if (bWasEmpty) {
- _strOrgDescription = EMPTYSLOTSTRING;
- }
- mg_pstrToChange = &_strTmpDescription;
- StartEdit();
- mg_iState = FBS_SAVENAME;
- }
-}
-BOOL CMGFileButton::OnKeyDown(int iVKey)
-{
- if (mg_iState == FBS_NORMAL) {
- if (gmLoadSaveMenu.gm_bSave || gmLoadSaveMenu.gm_bManage) {
- if (iVKey == VK_F2) {
- if (FileExistsForWriting(mg_fnm)) {
- // switch to renaming mode
- _strOrgDescription = mg_strText;
- _strTmpDescription = mg_strText;
- mg_pstrToChange = &_strTmpDescription;
- StartEdit();
- mg_iState = FBS_RENAME;
- }
- return TRUE;
- } else if (iVKey == VK_DELETE) {
- if (FileExistsForWriting(mg_fnm)) {
- // delete the file, its description and thumbnail
- RemoveFile(mg_fnm);
- RemoveFile(mg_fnm.NoExt()+".des");
- RemoveFile(mg_fnm.NoExt()+"Tbn.tex");
- // refresh menu
- gmLoadSaveMenu.EndMenu();
- gmLoadSaveMenu.StartMenu();
- OnSetFocus();
- }
- return TRUE;
- }
- }
- return CMenuGadget::OnKeyDown(iVKey);
- } else {
- // go out of editing mode
- if(mg_bEditing) {
- if (iVKey==VK_UP || iVKey==VK_DOWN) {
- CMGEdit::OnKeyDown(VK_ESCAPE);
- }
- }
- return CMGEdit::OnKeyDown(iVKey);
- }
-}
-
-void CMGFileButton::OnSetFocus(void)
-{
- mg_iState = FBS_NORMAL;
-
- if (gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) {
- SetThumbnail(mg_fnm);
- } else {
- ClearThumbnail();
- }
- pgmCurrentMenu->KillAllFocuses();
- CMGButton::OnSetFocus();
-}
-
-void CMGFileButton::OnKillFocus(void)
-{
- // go out of editing mode
- if(mg_bEditing) {
- OnKeyDown(VK_ESCAPE);
- }
- CMGEdit::OnKillFocus();
-}
-
-// override from edit gadget
-void CMGFileButton::OnStringChanged(void)
-{
- // if saving
- if (mg_iState == FBS_SAVENAME) {
- // do the save
- mg_strDes = _strTmpDescription+"\n"+mg_strInfo;
- DoSave();
- // if renaming
- } else if (mg_iState == FBS_RENAME) {
- // do the rename
- mg_strDes = _strTmpDescription+"\n"+mg_strInfo;
- SaveDescription();
- // refresh menu
- gmLoadSaveMenu.EndMenu();
- gmLoadSaveMenu.StartMenu();
- OnSetFocus();
- }
-}
-void CMGFileButton::OnStringCanceled(void)
-{
- mg_strText = _strOrgDescription;
-}
-
-void CMGFileButton::Render( CDrawPort *pdp)
-{
- // render original gadget first
- CMGEdit::Render(pdp);
-
- // if currently selected
- if (mg_bFocused && mg_bEnabled) {
- // add info at the bottom if screen
- SetFontMedium(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, BoxSaveLoad(15.0));
- PIX pixI = box.Min()(1);
- PIX pixJ = box.Min()(2);
-
- COLOR col = LCDGetColor(C_mlGREEN|255, "file info");
- pdp->PutText( mg_strInfo, pixI, pixJ, col);
- }
-}
-
-FLOATaabbox2D GetBoxPartHoriz(const FLOATaabbox2D &box, FLOAT fMin, FLOAT fMax)
-{
- FLOAT fBoxMin = box.Min()(1);
- FLOAT fBoxSize = box.Size()(1);
-
- return FLOATaabbox2D(
- FLOAT2D(fBoxMin+fBoxSize*fMin, box.Min()(2)),
- FLOAT2D(fBoxMin+fBoxSize*fMax, box.Max()(2)));
-}
-
-void PrintInBox(CDrawPort *pdp, PIX pixI, PIX pixJ, PIX pixSizeI, CTString str, COLOR col)
-{
- str = str.Undecorated();
- PIX pixCharSize = pdp->dp_pixTextCharSpacing+pdp->dp_FontData->fd_pixCharWidth;
- str.TrimRight(pixSizeI/pixCharSize);
-
- // print text
- pdp->PutText(str, pixI, pixJ, col);
-}
-
-CMGServerList::CMGServerList()
-{
- mg_iSelected = 0;
- mg_iFirstOnScreen = 0;
- mg_ctOnScreen = 10;
- mg_pixMinI = 0;
- mg_pixMaxI = 0;
- mg_pixListMinJ = 0;
- mg_pixListStepJ = 0;
- mg_pixDragJ = -1;
- mg_iDragLine = -1;
- mg_pixMouseDrag = -1;
- // by default, sort by ping, best on top
- mg_iSort = 2;
- mg_bSortDown = FALSE;
-}
-void CMGServerList::AdjustFirstOnScreen(void)
-{
- INDEX ctSessions = _lhServers.Count();
- mg_iSelected = Clamp(mg_iSelected, 0L, ClampDn(ctSessions-1L, 0L));
- mg_iFirstOnScreen = Clamp(mg_iFirstOnScreen, 0L, ClampDn(ctSessions-mg_ctOnScreen, 0L));
-
- if (mg_iSelected=mg_iFirstOnScreen+mg_ctOnScreen) {
- mg_iFirstOnScreen = ClampDn(mg_iSelected-mg_ctOnScreen+1L, 0L);
- }
-}
-
-BOOL _iSort = 0;
-BOOL _bSortDown = FALSE;
-
-int CompareSessions(const void *pv0, const void *pv1)
-{
- const CNetworkSession &ns0 = **(const CNetworkSession **)pv0;
- const CNetworkSession &ns1 = **(const CNetworkSession **)pv1;
-
- int iResult = 0;
- switch(_iSort) {
- case 0: iResult = stricmp(ns0.ns_strSession, ns1.ns_strSession); break;
- case 1: iResult = stricmp(ns0.ns_strWorld, ns1.ns_strWorld); break;
- case 2: iResult = Sgn(ns0.ns_tmPing-ns1.ns_tmPing); break;
- case 3: iResult = Sgn(ns0.ns_ctPlayers-ns1.ns_ctPlayers); break;
- case 4: iResult = stricmp(ns0.ns_strGameType, ns1.ns_strGameType); break;
- case 5: iResult = stricmp(ns0.ns_strMod, ns1.ns_strMod ); break;
- case 6: iResult = stricmp(ns0.ns_strVer, ns1.ns_strVer ); break;
- }
-
- if (iResult==0) { // make sure we always have unique order when resorting
- return stricmp(ns0.ns_strAddress, ns1.ns_strAddress);;
- }
-
- return _bSortDown?-iResult:iResult;
-}
-
-extern CMGButton mgServerColumn[7];
-extern CMGEdit mgServerFilter[7];
-
-void SortAndFilterServers(void)
-{
- {FORDELETELIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
- delete &*itns;
- }}
- {FOREACHINLIST(CNetworkSession, ns_lnNode, _pNetwork->ga_lhEnumeratedSessions, itns) {
- CNetworkSession &ns = *itns;
- extern CTString _strServerFilter[7];
- if (_strServerFilter[0]!="" && !ns.ns_strSession.Matches("*"+_strServerFilter[0]+"*")) continue;
- if (_strServerFilter[1]!="" && !ns.ns_strWorld.Matches("*"+_strServerFilter[1]+"*")) continue;
- if (_strServerFilter[2]!="") {
- char strCompare[3] = {0,0,0};
- int iPing = 0;
- _strServerFilter[2].ScanF("%2[<>=]%d", strCompare, &iPing);
- if (strcmp(strCompare, "<" )==0 && !(int(ns.ns_tmPing*1000)< iPing)) continue;
- if (strcmp(strCompare, "<=")==0 && !(int(ns.ns_tmPing*1000)<=iPing)) continue;
- if (strcmp(strCompare, ">" )==0 && !(int(ns.ns_tmPing*1000)> iPing)) continue;
- if (strcmp(strCompare, ">=")==0 && !(int(ns.ns_tmPing*1000)>=iPing)) continue;
- if (strcmp(strCompare, "=" )==0 && !(int(ns.ns_tmPing*1000)==iPing)) continue;
- }
- if (_strServerFilter[3]!="") {
- char strCompare[3] = {0,0,0};
- int iPlayers = 0;
- _strServerFilter[3].ScanF("%2[<>=]%d", strCompare, &iPlayers);
- if (strcmp(strCompare, "<" )==0 && !(ns.ns_ctPlayers< iPlayers)) continue;
- if (strcmp(strCompare, "<=")==0 && !(ns.ns_ctPlayers<=iPlayers)) continue;
- if (strcmp(strCompare, ">" )==0 && !(ns.ns_ctPlayers> iPlayers)) continue;
- if (strcmp(strCompare, ">=")==0 && !(ns.ns_ctPlayers>=iPlayers)) continue;
- if (strcmp(strCompare, "=" )==0 && !(ns.ns_ctPlayers==iPlayers)) continue;
- }
- if (_strServerFilter[4]!="" && !ns.ns_strGameType.Matches("*"+_strServerFilter[4]+"*")) continue;
- if (_strServerFilter[5]!="" && !ns.ns_strMod.Matches("*"+_strServerFilter[5]+"*")) continue;
- if (_strServerFilter[6]!="" && !ns.ns_strVer.Matches("*"+_strServerFilter[6]+"*")) continue;
-
- CNetworkSession *pnsNew = new CNetworkSession;
- pnsNew->Copy(*itns);
- _lhServers.AddTail(pnsNew->ns_lnNode);
- }}
-
- _lhServers.Sort(CompareSessions, offsetof(CNetworkSession, ns_lnNode));
-}
-
-void CMGServerList::Render(CDrawPort *pdp)
-{
- _iSort = mg_iSort ;
- _bSortDown = mg_bSortDown;
- SortAndFilterServers();
-
- SetFontSmall(pdp);
- BOOL bFocusedBefore = mg_bFocused;
- mg_bFocused = FALSE;
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- COLOR col = GetCurrentColor();
-
- PIX pixDPSizeI = pdp->GetWidth();
- PIX pixDPSizeJ = pdp->GetHeight();
- PIX pixCharSizeI = pdp->dp_pixTextCharSpacing+pdp->dp_FontData->fd_pixCharWidth;
- PIX pixCharSizeJ = pdp->dp_pixTextLineSpacing+pdp->dp_FontData->fd_pixCharHeight+1;
- PIX pixLineSize = 1;
- PIX pixSliderSizeI = 10;
- PIX pixOuterMargin = 20;
-
- INDEX ctSessions = _lhServers.Count();
- INDEX iSession=0;
-
- INDEX ctColumns[7];
- {for (INDEX i=0; iDrawLine(apixSeparatorI[i], pixTopJ, apixSeparatorI[i], pixBottomJ, col|CT_OPAQUE);
- }
- pdp->DrawLine(apixSeparatorI[0], pixTopJ, apixSeparatorI[8], pixTopJ, col|CT_OPAQUE);
- pdp->DrawLine(apixSeparatorI[0], pixListTopJ-pixLineSize, apixSeparatorI[8], pixListTopJ-pixLineSize, col|CT_OPAQUE);
- pdp->DrawLine(apixSeparatorI[0], pixBottomJ, apixSeparatorI[8], pixBottomJ, col|CT_OPAQUE);
-
- PIXaabbox2D boxHandle = GetScrollBarHandleBox();
- pdp->Fill(boxHandle.Min()(1)+2, boxHandle.Min()(2)+2, boxHandle.Size()(1)-3, boxHandle.Size()(2)-3, col|CT_OPAQUE);
-
- PIX pixJ = pixTopJ+pixLineSize*2+1;
-
- mg_ctOnScreen = ctSessionsOnScreen;
- AdjustFirstOnScreen();
-
- if (_lhServers.Count()==0) {
- if (_pNetwork->ga_strEnumerationStatus!="") {
- mg_bFocused = TRUE;
- COLOR colItem = GetCurrentColor();
- PrintInBox(pdp, apixSeparatorI[0]+pixCharSizeI, pixListTopJ+pixCharSizeJ+pixLineSize+1, apixSeparatorI[1]-apixSeparatorI[0],
- TRANS("searching..."), colItem);
- }
- } else {
- FOREACHINLIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
- CNetworkSession &ns = *itns;
-
- if (iSession=mg_iFirstOnScreen+ctSessionsOnScreen) {
- iSession++;
- continue;
- }
-
- PIX pixJ = pixListTopJ+(iSession-mg_iFirstOnScreen)*pixCharSizeJ+pixLineSize+1;
-
- mg_bFocused = bFocusedBefore&&iSession==mg_iSelected;
- COLOR colItem = GetCurrentColor();
-
- if (ns.ns_strVer!=_SE_VER_STRING) {
- colItem = MulColors(colItem, 0xA0A0A0FF);
- }
-
- CTString strPing(0,"%4d", INDEX(ns.ns_tmPing*1000));
- CTString strPlayersCt(0, "%2d/%2d", ns.ns_ctPlayers, ns.ns_ctMaxPlayers);
- CTString strMod = ns.ns_strMod;
- if (strMod=="") {
- strMod = "SeriousSam";
- }
- PrintInBox(pdp, apixSeparatorI[0]+pixCharSizeI/2, pixJ, apixSeparatorI[1]-apixSeparatorI[0]-pixCharSizeI, ns.ns_strSession, colItem);
- PrintInBox(pdp, apixSeparatorI[1]+pixCharSizeI/2, pixJ, apixSeparatorI[2]-apixSeparatorI[1]-pixCharSizeI, TranslateConst(ns.ns_strWorld), colItem);
- PrintInBox(pdp, apixSeparatorI[2]+pixCharSizeI/2, pixJ, apixSeparatorI[3]-apixSeparatorI[2]-pixCharSizeI, strPing, colItem);
- PrintInBox(pdp, apixSeparatorI[3]+pixCharSizeI/2, pixJ, apixSeparatorI[4]-apixSeparatorI[3]-pixCharSizeI, strPlayersCt, colItem);
- PrintInBox(pdp, apixSeparatorI[4]+pixCharSizeI/2, pixJ, apixSeparatorI[5]-apixSeparatorI[4]-pixCharSizeI, TranslateConst(ns.ns_strGameType), colItem);
- PrintInBox(pdp, apixSeparatorI[5]+pixCharSizeI/2, pixJ, apixSeparatorI[6]-apixSeparatorI[5]-pixCharSizeI, TranslateConst(strMod), colItem);
- PrintInBox(pdp, apixSeparatorI[6]+pixCharSizeI/2, pixJ, apixSeparatorI[7]-apixSeparatorI[6]-pixCharSizeI, ns.ns_strVer, colItem);
-
- iSession++;
- }
- }
-
- mg_bFocused = bFocusedBefore;
-}
-
-static INDEX SliderPixToIndex(PIX pixOffset, INDEX iVisible, INDEX iTotal, PIXaabbox2D boxFull)
-{
- FLOAT fSize = ClampUp(FLOAT(iVisible)/iTotal, 1.0f);
- PIX pixFull = boxFull.Size()(2);
- PIX pixSize = PIX(pixFull*fSize);
- if (pixSize>=boxFull.Size()(2)) {
- return 0;
- }
- return (iTotal*pixOffset)/pixFull;
-}
-
-static PIXaabbox2D GetSliderBox(INDEX iFirst, INDEX iVisible, INDEX iTotal,
- PIXaabbox2D boxFull)
-{
- if (iTotal<=0) {
- return boxFull;
- }
- FLOAT fSize = ClampUp(FLOAT(iVisible)/iTotal, 1.0f);
- PIX pixFull = boxFull.Size()(2);
- PIX pixSize = PIX(pixFull*fSize);
- pixSize = ClampDn(pixSize, boxFull.Size()(1));
- PIX pixTop = pixFull*(FLOAT(iFirst)/iTotal)+boxFull.Min()(2);
- PIX pixI0 = boxFull.Min()(1);
- PIX pixI1 = boxFull.Max()(1);
- return PIXaabbox2D(PIX2D(pixI0, pixTop), PIX2D(pixI1, pixTop+pixSize));
-}
-
-PIXaabbox2D CMGServerList::GetScrollBarFullBox(void)
-{
- return PIXaabbox2D(PIX2D(mg_pixSBMinI, mg_pixSBMinJ), PIX2D(mg_pixSBMaxI, mg_pixSBMaxJ));
-}
-PIXaabbox2D CMGServerList::GetScrollBarHandleBox(void)
-{
- return GetSliderBox(mg_iFirstOnScreen, mg_ctOnScreen, _lhServers.Count(), GetScrollBarFullBox());
-}
-
-void CMGServerList::OnMouseOver(PIX pixI, PIX pixJ)
-{
- mg_pixMouseI = pixI;
- mg_pixMouseJ = pixJ;
-
- if (!(GetKeyState(VK_LBUTTON)&0x8000)) {
- mg_pixDragJ = -1;
- }
-
- BOOL bInSlider = (pixI>=mg_pixSBMinI && pixI<=mg_pixSBMaxI && pixJ>=mg_pixSBMinJ && pixJ<=mg_pixSBMaxJ);
- if (mg_pixDragJ>=0 && bInSlider) {
- PIX pixDelta = pixJ-mg_pixDragJ;
- INDEX ctSessions = _lhServers.Count();
- INDEX iWantedLine = mg_iDragLine+
- SliderPixToIndex(pixDelta, mg_ctOnScreen, ctSessions, GetScrollBarFullBox());
- mg_iFirstOnScreen = Clamp(iWantedLine, 0L, ClampDn(ctSessions-mg_ctOnScreen, 0L));
- mg_iSelected = Clamp(mg_iSelected, mg_iFirstOnScreen, mg_iFirstOnScreen+mg_ctOnScreen-1L);
-// AdjustFirstOnScreen();
- return;
- }
-
- // if some server is selected
- if (pixI>=mg_pixMinI && pixI<=mg_pixMaxI) {
- INDEX iOnScreen = (pixJ-mg_pixListMinJ)/mg_pixListStepJ;
- if (iOnScreen>=0 && iOnScreen=mg_pixHeaderMinJ && mg_pixMouseJ<=mg_pixHeaderMidJ
- && mg_pixMouseI>=mg_pixHeaderI[0] && mg_pixMouseI<=mg_pixHeaderI[7]) {
- INDEX iNewSort = mg_iSort;
- if (mg_pixMouseI<=mg_pixHeaderI[1]) {
- iNewSort = 0;
- } else if (mg_pixMouseI<=mg_pixHeaderI[2]) {
- iNewSort = 1;
- } else if (mg_pixMouseI<=mg_pixHeaderI[3]) {
- iNewSort = 2;
- } else if (mg_pixMouseI<=mg_pixHeaderI[4]) {
- iNewSort = 3;
- } else if (mg_pixMouseI<=mg_pixHeaderI[5]) {
- iNewSort = 4;
- } else if (mg_pixMouseI<=mg_pixHeaderI[6]) {
- iNewSort = 5;
- } else if (mg_pixMouseI<=mg_pixHeaderI[7]) {
- iNewSort = 6;
- }
- if (iNewSort==mg_iSort) {
- mg_bSortDown = !mg_bSortDown;
- } else {
- mg_bSortDown = FALSE;
- }
- mg_iSort = iNewSort;
- break;
- } else */if (mg_pixMouseDrag>=0) {
- mg_pixDragJ = mg_pixMouseDrag;
- mg_iDragLine = mg_iFirstOnScreen;
- break;
- }
- case VK_RETURN:
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
- {INDEX i=0;
- FOREACHINLIST(CNetworkSession, ns_lnNode, _lhServers, itns) {
- if (i==mg_iSelected) {
-
- char strAddress[256];
- int iPort;
- itns->ns_strAddress.ScanF("%200[^:]:%d", &strAddress, &iPort);
- _pGame->gam_strJoinAddress = strAddress;
- _pShell->SetINDEX("net_iPort", iPort);
- extern void StartSelectPlayersMenuFromServers(void );
- StartSelectPlayersMenuFromServers();
- return TRUE;
- }
- i++;
- }}
- break;
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-void CMGServerList::OnSetFocus(void)
-{
- mg_bFocused = TRUE;
-}
-void CMGServerList::OnKillFocus(void)
-{
- mg_bFocused = FALSE;
-}
-
-// -------------------------------- Buttons for player selecting implementation
-void CMGChangePlayer::OnActivate(void)
-{
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
- _iLocalPlayer = mg_iLocalPlayer;
- if( _pGame->gm_aiMenuLocalPlayers[ mg_iLocalPlayer] < 0)
- _pGame->gm_aiMenuLocalPlayers[ mg_iLocalPlayer] = 0;
- gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[ mg_iLocalPlayer];
- gmPlayerProfile.gm_pgmParentMenu = &gmSelectPlayersMenu;
- extern BOOL _bPlayerMenuFromSinglePlayer;
- _bPlayerMenuFromSinglePlayer = FALSE;
- ChangeToMenu( &gmPlayerProfile);
-}
-
-void CMGChangePlayer::SetPlayerText(void)
-{
- INDEX iPlayer = _pGame->gm_aiMenuLocalPlayers[ mg_iLocalPlayer];
- CPlayerCharacter &pc = _pGame->gm_apcPlayers[ iPlayer];
- if (iPlayer<0 || iPlayer>7) {
- mg_strText = "????";
- } else {
- mg_strText.PrintF(TRANS("Player %d: %s\n"), mg_iLocalPlayer+1, pc.GetNameForPrinting());
- }
-}
-
-// ------- Key (from customize keyboard) implementation
-
-CMGKeyDefinition::CMGKeyDefinition( void)
-{
- mg_iState = DOING_NOTHING;
-}
-
-
-void CMGKeyDefinition::OnActivate(void)
-{
- PlayMenuSound(_psdPress);
- IFeel_PlayEffect("Menu_press");
- SetBindingNames(/*bDefining=*/TRUE);
- mg_iState = RELEASE_RETURN_WAITING;
-}
-
-
-BOOL CMGKeyDefinition::OnKeyDown( int iVKey)
-{
- // if waiting for a key definition
- if( mg_iState == PRESS_KEY_WAITING) {
- // do nothing
- return TRUE;
- }
-
- // if backspace pressed
- if(iVKey == VK_BACK) {
- // clear both keys
- DefineKey(KID_NONE);
- // message is processed
- return TRUE;
- }
-
- return CMenuGadget::OnKeyDown( iVKey);
-}
-
-// set names for both key bindings
-void CMGKeyDefinition::SetBindingNames(BOOL bDefining)
-{
- // find the button
- INDEX ict=0;
- INDEX iDik=0;
- FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) {
- if( ict == mg_iControlNumber) {
- CButtonAction &ba = *itba;
- // get the current bindings and names
- INDEX iKey1 = ba.ba_iFirstKey;
- INDEX iKey2 = ba.ba_iSecondKey;
- BOOL bKey1Bound = iKey1!=KID_NONE;
- BOOL bKey2Bound = iKey2!=KID_NONE;
- CTString strKey1 = _pInput->GetButtonTransName(iKey1);
- CTString strKey2 = _pInput->GetButtonTransName(iKey2);
-
- // if defining
- if (bDefining) {
- // if only first key is defined
- if (bKey1Bound && !bKey2Bound) {
- // put question mark for second key
- mg_strBinding = strKey1+TRANS(" or ")+"?";
- // otherwise
- } else {
- // put question mark only
- mg_strBinding = "?";
- }
- // if not defining
- } else {
- // if second key is defined
- if (bKey2Bound) {
- // add both
- mg_strBinding = strKey1+TRANS(" or ")+strKey2;
- // if second key is undefined
- } else {
- // display only first one
- mg_strBinding = strKey1;
- }
- }
- return ;
- }
- ict++;
- }
-
- // if not found, put errorneous string
- mg_strBinding = "???";
-}
-
-void CMGKeyDefinition::Appear(void)
-{
- SetBindingNames(/*bDefining=*/FALSE);
- CMenuGadget::Appear();
-}
-
-void CMGKeyDefinition::Disappear(void)
-{
- CMenuGadget::Disappear();
-}
-
-void CMGKeyDefinition::DefineKey(INDEX iDik)
-{
- // for each button in controls
- INDEX ict=0;
- FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) {
- CButtonAction &ba = *itba;
- // if it is this one
- if (ict == mg_iControlNumber) {
- // if should clear
- if (iDik == KID_NONE) {
- // unbind both
- ba.ba_iFirstKey = KID_NONE;
- ba.ba_iSecondKey = KID_NONE;
- }
- // if first key is unbound, or both keys are bound
- if (ba.ba_iFirstKey==KID_NONE || ba.ba_iSecondKey!=KID_NONE) {
- // bind first key
- ba.ba_iFirstKey = iDik;
- // clear second key
- ba.ba_iSecondKey = KID_NONE;
- // if only first key bound
- } else {
- // bind second key
- ba.ba_iSecondKey = iDik;
- }
- // if it is not this one
- } else {
- // clear bindings that contain this key
- if (ba.ba_iFirstKey == iDik) {
- ba.ba_iFirstKey = KID_NONE;
- }
- if (ba.ba_iSecondKey == iDik) {
- ba.ba_iSecondKey = KID_NONE;
- }
- }
- ict++;
- }
-
- SetBindingNames(/*bDefining=*/FALSE);
-}
-
-void CMGKeyDefinition::Think( void)
-{
- if( mg_iState == RELEASE_RETURN_WAITING)
- {
- _bDefiningKey = TRUE;
- extern BOOL _bMouseUsedLast;
- _bMouseUsedLast = FALSE;
- _pInput->SetJoyPolling(TRUE);
- _pInput->GetInput(FALSE);
- if( _pInput->IsInputEnabled() &&
- !_pInput->GetButtonState( KID_ENTER) &&
- !_pInput->GetButtonState( KID_MOUSE1 ) )
- {
- mg_iState = PRESS_KEY_WAITING;
- }
- }
- else if( mg_iState == PRESS_KEY_WAITING)
- {
- _pInput->SetJoyPolling(TRUE);
- _pInput->GetInput(FALSE);
- for( INDEX iDik = 0; iDikGetButtonState( iDik))
- {
- // skip keys that cannot be defined
- if (iDik == KID_TILDE) {
- continue;
- }
- // if escape not pressed
- if (iDik != KID_ESCAPE) {
- // define the new key
- DefineKey(iDik);
- // if escape pressed
- } else {
- // undefine the key
- DefineKey(KID_NONE);
- }
-
- // end defining loop
- mg_iState = DOING_NOTHING;
- _bDefiningKey = FALSE;
- // refresh all buttons
- pgmCurrentMenu->FillListItems();
- break;
- }
- }
- }
-}
-
-void CMGKeyDefinition::Render( CDrawPort *pdp)
-{
- SetFontMedium(pdp);
-
- PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
- PIX pixIL = box.Min()(1)+box.Size()(1)*0.45f;
- PIX pixIR = box.Min()(1)+box.Size()(1)*0.55f;
- PIX pixJ = box.Min()(2);
-
- COLOR col = GetCurrentColor();
- pdp->PutTextR( mg_strLabel, pixIL, pixJ, col);
- pdp->PutText( mg_strBinding, pixIR, pixJ, col);
-}
diff --git a/Sources/SeriousSam/MenuGadgets.h b/Sources/SeriousSam/MenuGadgets.h
deleted file mode 100644
index a734766..0000000
--- a/Sources/SeriousSam/MenuGadgets.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Copyright (c) 2002-2012 Croteam Ltd.
-This program is free software; you can redistribute it and/or modify
-it under the terms of version 2 of the GNU General Public License as published by
-the Free Software Foundation
-
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-#define DOING_NOTHING 0
-#define PRESS_KEY_WAITING 1
-#define RELEASE_RETURN_WAITING 2
-
-#define EMPTYSLOTSTRING TRANS("")
-
-class CMenuGadget {
-public:
- CListNode mg_lnNode;
- FLOATaabbox2D mg_boxOnScreen;
- BOOL mg_bVisible;
- BOOL mg_bEnabled;
- BOOL mg_bLabel;
- BOOL mg_bFocused;
- INDEX mg_iInList; // for scrollable gadget lists
-
- CTString mg_strTip;
- CMenuGadget *mg_pmgLeft;
- CMenuGadget *mg_pmgRight;
- CMenuGadget *mg_pmgUp;
- CMenuGadget *mg_pmgDown;
-
- CMenuGadget( void);
- // return TRUE if handled
- virtual BOOL OnKeyDown( int iVKey);
- virtual BOOL OnChar(MSG msg);
- virtual void OnActivate( void);
- virtual void OnSetFocus( void);
- virtual void OnKillFocus( void);
- virtual void Appear( void);
- virtual void Disappear( void);
- virtual void Think( void);
- virtual void OnMouseOver(PIX pixI, PIX pixJ);
-
- virtual COLOR GetCurrentColor(void);
- virtual void Render( CDrawPort *pdp);
- virtual BOOL IsSeparator(void) { return FALSE; };
-};
-
-enum ButtonFontSize {
- BFS_SMALL = 0,
- BFS_MEDIUM = 1,
- BFS_LARGE = 2,
-};
-
-class CMGTitle : public CMenuGadget {
-public:
- CTString mg_strText;
- void Render( CDrawPort *pdp);
-};
-
-class CMGHighScore : public CMenuGadget {
-public:
- void Render( CDrawPort *pdp);
-};
-
-class CMGButton : public CMenuGadget {
-public:
- CTString mg_strLabel; // for those that have labels separately from main text
- CTString mg_strText;
- INDEX mg_iCenterI;
- enum ButtonFontSize mg_bfsFontSize;
- BOOL mg_bEditing;
- BOOL mg_bHighlighted;
- BOOL mg_bRectangle;
- BOOL mg_bMental;
- INDEX mg_iTextMode;
- INDEX mg_iCursorPos;
-
- INDEX mg_iIndex;
- void (*mg_pActivatedFunction)(void);
- CMGButton(void);
- void SetText( CTString strNew);
- void OnActivate(void);
- void Render( CDrawPort *pdp);
- PIX GetCharOffset( CDrawPort *pdp, INDEX iCharNo);
-};
-
-enum ArrowDir {
- AD_NONE,
- AD_UP,
- AD_DOWN,
- AD_LEFT,
- AD_RIGHT,
-};
-
-class CMGArrow : public CMGButton {
-public:
- enum ArrowDir mg_adDirection;
- void Render( CDrawPort *pdp);
- void OnActivate( void);
-};
-
-class CMGModel : public CMGButton {
-public:
- CModelObject mg_moModel;
- CModelObject mg_moFloor;
- CPlacement3D mg_plModel;
- BOOL mg_fFloorY;
-
- CMGModel(void);
- void Render( CDrawPort *pdp);
-};
-
-class CMGEdit : public CMGButton {
-public:
- INDEX mg_ctMaxStringLen;
- CTString *mg_pstrToChange;
- CMGEdit(void);
- // return TRUE if handled
- BOOL OnKeyDown(int iVKey);
- BOOL OnChar(MSG msg);
- void Clear(void);
- void OnActivate(void);
- void OnKillFocus(void);
- void Render( CDrawPort *pdp);
- virtual void OnStringChanged(void);
- virtual void OnStringCanceled(void);
-};
-
-class CMGKeyDefinition : public CMenuGadget {
-public:
- INDEX mg_iState;
- INDEX mg_iControlNumber;
-
- CTString mg_strLabel;
- CTString mg_strBinding;
-
- CMGKeyDefinition(void);
- void Appear(void);
- void Disappear(void);
- void OnActivate(void);
- // return TRUE if handled
- BOOL OnKeyDown( int iVKey);
- void Think( void);
- // set names for both key bindings
- void SetBindingNames(BOOL bDefining);
- void DefineKey(INDEX iDik);
- void Render( CDrawPort *pdp);
-};
-
-class CMGTrigger : public CMenuGadget {
-public:
- CTString mg_strLabel;
- CTString mg_strValue;
- CTString *mg_astrTexts;
- INDEX mg_ctTexts;
- INDEX mg_iSelected;
- INDEX mg_iCenterI;
- BOOL mg_bVisual;
-
- CMGTrigger(void);
-
- void ApplyCurrentSelection(void);
- void OnSetNextInList(int iVKey);
- void (*mg_pPreTriggerChange)(INDEX iCurrentlySelected);
- void (*mg_pOnTriggerChange)(INDEX iCurrentlySelected);
-
- // return TRUE if handled
- BOOL OnKeyDown( int iVKey);
- void Render( CDrawPort *pdp);
-};
-
-class CMGSlider : public CMGButton {
-public:
- FLOAT mg_fFactor;
- INDEX mg_iMinPos;
- INDEX mg_iMaxPos;
- INDEX mg_iCurPos;
-
- CMGSlider();
- void ApplyCurrentPosition(void);
- void ApplyGivenPosition(INDEX iMin, INDEX iMax, INDEX iCur);
- // return TRUE if handled
- virtual BOOL OnKeyDown( int iVKey);
- void (*mg_pOnSliderChange)(INDEX iCurPos);
- PIXaabbox2D GetSliderBox(void);
- void Render( CDrawPort *pdp);
-};
-
-class CMGLevelButton : public CMGButton {
-public:
- CTFileName mg_fnmLevel;
-
- void OnActivate(void);
- void OnSetFocus( void);
-};
-
-class CMGVarButton : public CMGButton {
-public:
- class CVarSetting *mg_pvsVar;
- PIXaabbox2D GetSliderBox(void);
- BOOL OnKeyDown(int iVKey);
- void Render( CDrawPort *pdp);
- BOOL IsSeparator(void);
- BOOL IsEnabled(void);
-};
-
-// file button states
-#define FBS_NORMAL 0 // normal active state
-#define FBS_SAVENAME 1 // typing in the save name
-#define FBS_RENAME 2 // renaming existing file
-class CMGFileButton : public CMGEdit {
-public:
- CMGFileButton(void);
- CTFileName mg_fnm;
- CTString mg_strDes; // entire description goes here
- CTString mg_strInfo; // info part of text to print above the gadget tip
- INDEX mg_iState;
- // refresh current text from description
- void RefreshText(void);
- // save description to disk
- void SaveDescription(void);
- void SaveYes(void);
- void DoSave(void);
- void DoLoad(void);
- void StartEdit(void);
-
- // return TRUE if handled
- BOOL OnKeyDown(int iVKey);
- void OnActivate(void);
- void OnSetFocus(void);
- void OnKillFocus(void);
-
- // overrides from edit gadget
- void OnStringChanged(void);
- void OnStringCanceled(void);
- void Render( CDrawPort *pdp);
-};
-
-class CMGServerList : public CMGButton {
-public:
- INDEX mg_iSelected;
- INDEX mg_iFirstOnScreen;
- INDEX mg_ctOnScreen;
- // server list dimensions
- PIX mg_pixMinI;
- PIX mg_pixMaxI;
- PIX mg_pixListMinJ;
- PIX mg_pixListStepJ;
- // header dimensions
- PIX mg_pixHeaderMinJ;
- PIX mg_pixHeaderMidJ;
- PIX mg_pixHeaderMaxJ;
- PIX mg_pixHeaderI[8];
- // scrollbar dimensions
- PIX mg_pixSBMinI;
- PIX mg_pixSBMaxI;
- PIX mg_pixSBMinJ;
- PIX mg_pixSBMaxJ;
- // scrollbar dragging params
- PIX mg_pixDragJ;
- PIX mg_iDragLine;
- PIX mg_pixMouseDrag;
- // current mouse pos
- PIX mg_pixMouseI;
- PIX mg_pixMouseJ;
-
- INDEX mg_iSort; // column to sort by
- BOOL mg_bSortDown; // sort in reverse order
-
- CMGServerList();
- BOOL OnKeyDown(int iVKey);
- PIXaabbox2D GetScrollBarFullBox(void);
- PIXaabbox2D GetScrollBarHandleBox(void);
- void OnSetFocus(void);
- void OnKillFocus(void);
- void Render( CDrawPort *pdp);
- void AdjustFirstOnScreen(void);
- void OnMouseOver(PIX pixI, PIX pixJ);
-};
-
-class CMGChangePlayer : public CMGButton {
-public:
- INDEX mg_iLocalPlayer;
-
- void SetPlayerText(void);
- void OnActivate( void);
-};
diff --git a/Sources/SeriousSam/SeriousSam.cpp b/Sources/SeriousSam/SeriousSam.cpp
index d18f4d5..0c6deec 100644
--- a/Sources/SeriousSam/SeriousSam.cpp
+++ b/Sources/SeriousSam/SeriousSam.cpp
@@ -112,11 +112,8 @@ extern CTextureObject *_ptoLogoEAX = NULL;
extern CTString sam_strVersion = "1.10";
extern CTString sam_strModName = TRANS("- O P E N S O U R C E -");
-#if _SE_DEMO
- extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld";
-#else
- extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld";
-#endif
+
+extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld";
extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld";
extern CTString sam_strGameName = "serioussamse";
@@ -549,10 +546,6 @@ BOOL Init( HINSTANCE hInstance, int nCmdShow, CTString strCmdLine)
_pShell->SetString("net_strConnectPassword", cmd_strPassword);
}
-#if TECHTESTONLY
- cmd_strWorld = CTString("Levels\\TechTestElsa.wld");
-#endif
-
// if connecting to server from command line
if (cmd_strServer!="") {
CTString strPort = "";
@@ -608,7 +601,7 @@ void End(void)
// destroy the main window and its canvas
if (pvpViewPort!=NULL) {
- _pGfx->DestroyWindowCanvas( pvpViewPort);
+ _pGfx->DestroyWindowCanvas( pvpViewPort);
pvpViewPort = NULL;
pdpNormal = NULL;
}
@@ -1118,7 +1111,7 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
// teleport player
TeleportPlayer(msg.lParam);
// restore
- PostMessage(NULL, WM_SYSCOMMAND, SC_RESTORE, 0);
+ PostMessage(NULL, WM_SYSCOMMAND, SC_RESTORE, 0);
}
}
@@ -1272,7 +1265,7 @@ void CheckBrowser(void)
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
+ LPSTR lpCmdLine, int nCmdShow)
{
int iResult;
CTSTREAM_BEGIN {
@@ -1305,7 +1298,7 @@ BOOL TryToSetDisplayMode( enum GfxAPIType eGfxAPI, INDEX iAdapter, PIX pixSizeI,
// destroy canvas if existing
_pGame->DisableLoadingHook();
if( pvpViewPort!=NULL) {
- _pGfx->DestroyWindowCanvas( pvpViewPort);
+ _pGfx->DestroyWindowCanvas( pvpViewPort);
pvpViewPort = NULL;
pdpNormal = NULL;
}
@@ -1337,7 +1330,7 @@ BOOL TryToSetDisplayMode( enum GfxAPIType eGfxAPI, INDEX iAdapter, PIX pixSizeI,
// create canvas
ASSERT( pvpViewPort==NULL);
ASSERT( pdpNormal==NULL);
- _pGfx->CreateWindowCanvas( _hwndMain, &pvpViewPort, &pdpNormal);
+ _pGfx->CreateWindowCanvas( _hwndMain, &pvpViewPort, &pdpNormal);
// erase context of both buffers (for the sake of wide-screen)
pdp = pdpNormal;
@@ -1376,7 +1369,7 @@ BOOL TryToSetDisplayMode( enum GfxAPIType eGfxAPI, INDEX iAdapter, PIX pixSizeI,
// destroy canvas if existing
if( pvpViewPort!=NULL) {
_pGame->DisableLoadingHook();
- _pGfx->DestroyWindowCanvas( pvpViewPort);
+ _pGfx->DestroyWindowCanvas( pvpViewPort);
pvpViewPort = NULL;
pdpNormal = NULL;
}
@@ -1387,7 +1380,7 @@ BOOL TryToSetDisplayMode( enum GfxAPIType eGfxAPI, INDEX iAdapter, PIX pixSizeI,
}
// remember new settings
- sam_bFullScreenActive = bFullScreenMode;
+ sam_bFullScreenActive = bFullScreenMode;
sam_iScreenSizeI = pixSizeI;
sam_iScreenSizeJ = pixSizeJ;
sam_iDisplayDepth = eColorDepth;
@@ -1396,10 +1389,8 @@ BOOL TryToSetDisplayMode( enum GfxAPIType eGfxAPI, INDEX iAdapter, PIX pixSizeI,
// report success
return TRUE;
- }
-
// if couldn't set new mode
- else {
+ } else {
// close the application window
CloseMainWindow();
// report failure
diff --git a/Sources/SeriousSam/SeriousSam.h b/Sources/SeriousSam/SeriousSam.h
index 88fbf8a..6b671df 100644
--- a/Sources/SeriousSam/SeriousSam.h
+++ b/Sources/SeriousSam/SeriousSam.h
@@ -14,7 +14,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#define APPLICATION_NAME "SeriousSam"
-#include "CDCheck.h"
extern HINSTANCE _hInstance;
extern BOOL _bRunning, _bQuitScreen;
diff --git a/Sources/SeriousSam/SeriousSam.vcxproj b/Sources/SeriousSam/SeriousSam.vcxproj
index b361610..d5f2ca6 100644
--- a/Sources/SeriousSam/SeriousSam.vcxproj
+++ b/Sources/SeriousSam/SeriousSam.vcxproj
@@ -58,7 +58,7 @@
Debug\
Debug\
false
- $(SolutionDir);$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Include;$(IncludePath)
+ $(SolutionDir);$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Include;$(ProjectDir);$(IncludePath)
$(SolutionDir)..\Bin\Debug;$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Lib;$(LibraryPath)
true
true
@@ -67,7 +67,7 @@
Release\
Release\
false
- $(SolutionDir);$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Include;$(IncludePath)
+ $(SolutionDir);$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Include;$(ProjectDir);$(IncludePath)
$(SolutionDir)..\Bin;$(SolutionDir)..\Tools.Win32\Libraries\DX8SDK\Lib;$(LibraryPath)
true
true
@@ -179,22 +179,107 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ >nul
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Use
- StdH.h
- Use
- StdH.h
-
-
- Use
- StdH.h
- Use
- StdH.h
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Use
StdH.h
@@ -211,16 +296,14 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ >nul
-
+
+
-
-
-
diff --git a/Sources/SeriousSam/SeriousSam.vcxproj.filters b/Sources/SeriousSam/SeriousSam.vcxproj.filters
index 22f3188..433430c 100644
--- a/Sources/SeriousSam/SeriousSam.vcxproj.filters
+++ b/Sources/SeriousSam/SeriousSam.vcxproj.filters
@@ -19,6 +19,24 @@
{332d9393-d918-4caf-86b2-2e63c2cca9bd}
+
+ {b1fe2cd0-889c-48dd-897c-cdbbdcb0a131}
+
+
+ {3bc65fe2-8c15-4ecd-bf59-de962bb42275}
+
+
+ {df54d6d1-39c3-4f26-93f8-116311f5a0eb}
+
+
+ {4c95322d-560a-4738-a631-e3e860b59560}
+
+
+ {9a04e8a8-ecfc-42c3-bf28-fe3d8b49e626}
+
+
+ {47ffb7e3-433b-480c-a22a-849524a5bd1e}
+
@@ -39,15 +57,6 @@
Source Files
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
Source Files
@@ -60,11 +69,152 @@
Source Files
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Gadgets
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
+
+ Source Files\GUI\Menus
+
-
- Header Files
-
Header Files
@@ -83,15 +233,6 @@
Header Files
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
Header Files
@@ -107,6 +248,162 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Gadgets headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
+
+ Header Files\GUI headers\Menus headers
+
diff --git a/Sources/SeriousSam/StdH.h b/Sources/SeriousSam/StdH.h
index 26c7a5c..bb3ae60 100644
--- a/Sources/SeriousSam/StdH.h
+++ b/Sources/SeriousSam/StdH.h
@@ -33,8 +33,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include
#undef DECL_DLL
-#define TECHTESTONLY 0
-
#include "SeriousSam.h"
-#include "Menu.h"
-#include "MenuGadgets.h"
+#include "GUI/Menus/Menu.h"
\ No newline at end of file
diff --git a/Sources/WorldEditor/DlgBrowseByClass.cpp b/Sources/WorldEditor/DlgBrowseByClass.cpp
index 63e138a..65a0038 100644
--- a/Sources/WorldEditor/DlgBrowseByClass.cpp
+++ b/Sources/WorldEditor/DlgBrowseByClass.cpp
@@ -236,7 +236,7 @@ CTString GetItemValue(CEntity *pen, INDEX iColumn, INDEX &iFormat)
case COLUMN_INDEX:
{
INDEX iIndex=dcEntities.GetIndex(pen);
- strResult.PrintF("%d", FLOAT(iIndex));
+ strResult.PrintF("%d", iIndex);
iFormat=PDF_INDEX;
break;
}