diff --git a/Sources/GameGUIMP/DlgPlayerControls.cpp b/Sources/GameGUIMP/DlgPlayerControls.cpp index c165f89..101a7d4 100644 --- a/Sources/GameGUIMP/DlgPlayerControls.cpp +++ b/Sources/GameGUIMP/DlgPlayerControls.cpp @@ -16,7 +16,7 @@ static char THIS_FILE[] = __FILE__; // CDlgPlayerControls dialog CDlgPlayerControls::CDlgPlayerControls(CControls &ctrlControls, CWnd* pParent /*=NULL*/) -: CDialog(CDlgPlayerControls::IDD, pParent), m_ctrlControls(_pGame->gm_ctrlControlsExtra) +: CDialog(CDlgPlayerControls::IDD, pParent), m_ctrlControls(*_pGame->gm_ctrlControlsExtra) { // make copy of the controls, we will change them m_ctrlControls = ctrlControls; diff --git a/Sources/GameGUIMP/DlgPlayerSettings.cpp b/Sources/GameGUIMP/DlgPlayerSettings.cpp index 88617c5..a7c985d 100644 --- a/Sources/GameGUIMP/DlgPlayerSettings.cpp +++ b/Sources/GameGUIMP/DlgPlayerSettings.cpp @@ -125,7 +125,7 @@ BOOL CDlgPlayerSettings::OnInitDialog() void CDlgPlayerSettings::OnEditControls() { - CControls &ctrlControls = _pGame->gm_ctrlControlsExtra; + CControls &ctrlControls = *_pGame->gm_ctrlControlsExtra; // try to try { diff --git a/Sources/GameMP/Game.cpp b/Sources/GameMP/Game.cpp index 381d8a5..1708031 100644 --- a/Sources/GameMP/Game.cpp +++ b/Sources/GameMP/Game.cpp @@ -74,6 +74,13 @@ EXPORTABLE CGame *GAME_Create(void) } // extern "C" +// Just working around a symbol reference in a shared library that isn't +// available in SeriousSam by turning gm_ctrlControlsExtra into a pointer +// instead of a full object. Messy; sorry! --ryan. +CGame::CGame() : gm_ctrlControlsExtra(new CControls) {} +CGame::~CGame() { delete gm_ctrlControlsExtra; } + + // recorded profiling stats static CTimerValue _tvDemoStarted; static CTimerValue _tvLastFrame; diff --git a/Sources/GameMP/Game.h b/Sources/GameMP/Game.h index c515e9a..b944570 100644 --- a/Sources/GameMP/Game.h +++ b/Sources/GameMP/Game.h @@ -150,6 +150,8 @@ public: */ class CGame { public: + CGame(); + virtual ~CGame(); enum ConsoleState gm_csConsoleState; enum ConsoleState gm_csComputerState; @@ -167,7 +169,7 @@ public: CPlayerCharacter gm_apcPlayers[8]; CControls gm_actrlControls[8]; - CControls gm_ctrlControlsExtra; + CControls *gm_ctrlControlsExtra; INDEX gm_iSinglePlayer; INDEX gm_iWEDSinglePlayer; diff --git a/Sources/SeriousSam/Menu.cpp b/Sources/SeriousSam/Menu.cpp index 7dabb0b..8016b9b 100644 --- a/Sources/SeriousSam/Menu.cpp +++ b/Sources/SeriousSam/Menu.cpp @@ -171,7 +171,7 @@ void ControlsMenuOn() { _pGame->SavePlayersAndControls(); try { - _pGame->gm_ctrlControlsExtra.Load_t(_fnmControlsToCustomize); + _pGame->gm_ctrlControlsExtra->Load_t(_fnmControlsToCustomize); } catch( char *strError) { WarningMessage(strError); } @@ -180,13 +180,13 @@ void ControlsMenuOn() void ControlsMenuOff() { try { - if (_pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count()>0) { - _pGame->gm_ctrlControlsExtra.Save_t(_fnmControlsToCustomize); + 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) { + FORDELETELIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions, itAct) { delete &itAct.Current(); } _pGame->LoadPlayersAndControls(); @@ -1477,7 +1477,7 @@ BOOL LSLoadControls(const CTFileName &fnm) { try { ControlsMenuOn(); - _pGame->gm_ctrlControlsExtra.Load_t(fnm); + _pGame->gm_ctrlControlsExtra->Load_t(fnm); ControlsMenuOff(); } catch (char *strError) { CPrintF("%s", strError); @@ -4280,7 +4280,7 @@ void CControlsMenu::EndMenu(void) void CControlsMenu::ObtainActionSettings(void) { - CControls &ctrls = _pGame->gm_ctrlControlsExtra; + CControls &ctrls = *_pGame->gm_ctrlControlsExtra; mgControlsSensitivity.mg_iMinPos = 0; mgControlsSensitivity.mg_iMaxPos = 50; @@ -4301,7 +4301,7 @@ void CControlsMenu::ObtainActionSettings(void) void CControlsMenu::ApplyActionSettings(void) { - CControls &ctrls = _pGame->gm_ctrlControlsExtra; + CControls &ctrls = *_pGame->gm_ctrlControlsExtra; FLOAT fSensitivity = FLOAT(mgControlsSensitivity.mg_iCurPos-mgControlsSensitivity.mg_iMinPos) / @@ -4587,8 +4587,8 @@ void CCustomizeKeyboardMenu::FillListItems(void) BOOL bHasLast = FALSE; // set diks to key buttons INDEX iLabel=0; - INDEX ctLabels = _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count(); - FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct) + INDEX ctLabels = _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions.Count(); + FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions, itAct) { INDEX iInMenu = iLabel-gm_iListOffset; if( (iLabel>=gm_iListOffset) && @@ -4654,7 +4654,7 @@ void CCustomizeKeyboardMenu::StartMenu(void) { ControlsMenuOn(); gm_iListOffset = 0; - gm_ctListTotal = _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count(); + gm_ctListTotal = _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions.Count(); gm_iListWantedItem = 0; CGameMenu::StartMenu(); } @@ -4736,7 +4736,7 @@ void CCustomizeAxisMenu::Initialize_t(void) void CCustomizeAxisMenu::ObtainActionSettings(void) { ControlsMenuOn(); - CControls &ctrls = _pGame->gm_ctrlControlsExtra; + CControls &ctrls = *_pGame->gm_ctrlControlsExtra; INDEX iSelectedAction = mgAxisActionTrigger.mg_iSelected; INDEX iMountedAxis = ctrls.ctrl_aaAxisActions[ iSelectedAction].aa_iAxisAction; @@ -4765,7 +4765,7 @@ void CCustomizeAxisMenu::ObtainActionSettings(void) void CCustomizeAxisMenu::ApplyActionSettings(void) { - CControls &ctrls = _pGame->gm_ctrlControlsExtra; + CControls &ctrls = *_pGame->gm_ctrlControlsExtra; INDEX iSelectedAction = mgAxisActionTrigger.mg_iSelected; INDEX iMountedAxis = mgAxisMountedTrigger.mg_iSelected; FLOAT fSensitivity = diff --git a/Sources/SeriousSam/MenuGadgets.cpp b/Sources/SeriousSam/MenuGadgets.cpp index 81e3852..c5d0c96 100644 --- a/Sources/SeriousSam/MenuGadgets.cpp +++ b/Sources/SeriousSam/MenuGadgets.cpp @@ -1756,7 +1756,7 @@ void CMGKeyDefinition::SetBindingNames(BOOL bDefining) // find the button INDEX ict=0; INDEX iDik=0; - FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) { + FOREACHINLIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions, itba) { if( ict == mg_iControlNumber) { CButtonAction &ba = *itba; // get the current bindings and names @@ -1814,7 +1814,7 @@ void CMGKeyDefinition::DefineKey(INDEX iDik) { // for each button in controls INDEX ict=0; - FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itba) { + FOREACHINLIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra->ctrl_lhButtonActions, itba) { CButtonAction &ba = *itba; // if it is this one if (ict == mg_iControlNumber) {