[Gcblue-commits] gcb_wx/src/scriptinterface tcSubInterface.cpp,NONE,1.1 tcPlatformInterface.cpp,1.28
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29552/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp tcSimPythonInterface.cpp Added Files: tcSubInterface.cpp Log Message: Text message "message center" GUI screen Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcPlatformInterfaceExtensionB.cpp 16 Aug 2004 01:43:31 -0000 1.15 --- tcPlatformInterfaceExtensionB.cpp 23 Nov 2004 23:30:58 -0000 1.16 *************** *** 76,81 **** --- 76,83 ---- .def("IsAir", &tcPlatformInterface::IsAir) .def("IsHelo", &tcPlatformInterface::IsHelo) + .def("IsSub", &tcPlatformInterface::IsSub) .def("SetUpdate", &tcPlatformInterface::SetUpdateInterval) .def("SetActionText", &tcPlatformInterface::SetActionText) + .def("GetSubInterface", &tcPlatformInterface::GetSubInterface) // weapons and targeting Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcSimPythonInterface.cpp 14 Nov 2004 22:52:21 -0000 1.20 --- tcSimPythonInterface.cpp 23 Nov 2004 23:30:58 -0000 1.21 *************** *** 605,608 **** --- 605,622 ---- PanelInterface = PanelInterfaceType(); + SubInterfaceType = class_<tcSubInterface>("SubInterfaceClass") + .def("GetMaxDepth", &tcSubInterface::GetMaxDepth) + .def("GoToPeriscopeDepth", &tcSubInterface::GoToPeriscopeDepth) + .def("IsAtPeriscopeDepth", &tcSubInterface::IsAtPeriscopeDepth) + .def("IsPeriscopeRaised", &tcSubInterface::IsPeriscopeRaised) + .def("IsRadarMastRaised", &tcSubInterface::IsRadarMastRaised) + .def("IsValid", &tcSubInterface::IsValid) + .def("LowerPeriscope", &tcSubInterface::LowerPeriscope) + .def("LowerRadarMast", &tcSubInterface::LowerRadarMast) + .def("RaisePeriscope", &tcSubInterface::RaisePeriscope) + .def("RaiseRadarMast", &tcSubInterface::RaiseRadarMast) + ; + + TrackInterfaceType = class_<tcTrackInterface>("TrackInfoClass") .def("DeclareHostile", &tcTrackInterface::DeclareHostile) --- NEW FILE: tcSubInterface.cpp --- /** ** @file tcSubInterface.cpp */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB 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. ** GCB 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 GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcSubInterface.h" #include "tcGenericDBObject.h" #include "tcMessageInterface.h" #include "tcPlatformObject.h" #include "tcSimState.h" #include "tcSound.h" #include "tcSubObject.h" #ifdef _DEBUG #define new DEBUG_NEW #endif namespace ScriptInterface { tcMessageInterface* tcSubInterface::messageInterface = 0; tcSound* tcSubInterface::sound = 0; tcSimState* tcSubInterface::simState = 0; /** * @return maximum depth in meters */ float tcSubInterface::GetMaxDepth() const { if (!subObj) return 0; return subObj->mpDBObject->mfMaxDepth_m; } void tcSubInterface::GoToPeriscopeDepth() { if (subObj) { subObj->SetAltitude(-subObj->GetPeriscopeDepth() + 0.4f); } } bool tcSubInterface::IsAtPeriscopeDepth() { if (!subObj) return false; return subObj->IsAtPeriscopeDepth(); } bool tcSubInterface::IsPeriscopeRaised() const { if (!subObj) return false; return subObj->GetPeriscopeState(); } bool tcSubInterface::IsRadarMastRaised() const { if (!subObj) return false; return subObj->GetRadarMastState(); } /** * @return true if interface is valid sub interface */ bool tcSubInterface::IsValid() const { return (subObj != 0); } void tcSubInterface::LowerPeriscope() { if (subObj) { if (subObj->GetPeriscopeState()) { subObj->SetPeriscopeState(false); if (subObj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s): lowering scope\n", subObj->mzUnit.mz, subObj->mzClass.mz); messageInterface->ChannelMessage("Info", s.c_str()); sound->PlayEffect(SEFFECT_LOWBEEP); } } } } void tcSubInterface::LowerRadarMast() { if (subObj) { if (subObj->GetRadarMastState()) { subObj->SetRadarMastState(false); if (subObj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s): lowering radar mast\n", subObj->mzUnit.mz, subObj->mzClass.mz); messageInterface->ChannelMessage("Info", s.c_str()); sound->PlayEffect(SEFFECT_LOWBEEP); } } } } void tcSubInterface::RaisePeriscope() { if (subObj) { if (!subObj->GetPeriscopeState()) { subObj->SetPeriscopeState(true); if (subObj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s): raising scope\n", subObj->mzUnit.mz, subObj->mzClass.mz); messageInterface->ChannelMessage("Info", s.c_str()); sound->PlayEffect(SEFFECT_LOWBEEP); } } } } void tcSubInterface::RaiseRadarMast() { if (subObj) { if (!subObj->GetRadarMastState()) { subObj->SetRadarMastState(true); if (subObj->IsOwnAlliance()) { wxString s = wxString::Format("%s (%s): raising radar mast\n", subObj->mzUnit.mz, subObj->mzClass.mz); messageInterface->ChannelMessage("Info", s.c_str()); sound->PlayEffect(SEFFECT_LOWBEEP); } } } } tcSubInterface::tcSubInterface() : subObj(0) { } tcSubInterface::tcSubInterface(tcPlatformObject* obj) { subObj = dynamic_cast<tcSubObject*>(obj); if (!sound) { sound = tcSound::Get(); } if (!simState) { simState = tcSimState::Get(); } if (!messageInterface) { messageInterface = tcMessageInterface::Get(); } } tcSubInterface::~tcSubInterface() { } } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcScenarioInterface.cpp 8 Aug 2004 00:31:34 -0000 1.13 --- tcScenarioInterface.cpp 23 Nov 2004 23:30:58 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- #include "tcCarrierObject.h" #include "tcAeroAirObject.h" + #include "tcSubObject.h" #include "tcAirfieldObject.h" #include "tcGenericDBObject.h" *************** *** 230,233 **** --- 231,238 ---- airObj->SetAltitude(airObj->mcKin.mfAlt_m); } + if (tcSubObject* sub = dynamic_cast<tcSubObject*>(gameObj)) + { + sub->SetAltitude(sub->mcKin.mfAlt_m); + } // place ground objects relative to terrain height Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcPlatformInterface.cpp 3 Nov 2004 16:36:44 -0000 1.28 --- tcPlatformInterface.cpp 23 Nov 2004 23:30:57 -0000 1.29 *************** *** 78,81 **** --- 78,90 ---- /** + * @return sub interface object for sub-specific controls + */ + tcSubInterface tcPlatformInterface::GetSubInterface() + { + return tcSubInterface(mpPlatformObj); + } + + + /** * @return fraction of fuel remaining */ |