gcblue-commits Mailing List for Global Conflict Blue (Page 38)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:48
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/include/scriptinterface Modified Files: tcPlatformInterface.h tcSimPythonInterface.h Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcPlatformInterface.h 7 Dec 2004 03:59:14 -0000 1.29 --- tcPlatformInterface.h 11 Dec 2004 01:09:05 -0000 1.30 *************** *** 1,5 **** ! /* @file tcPlatformInterface.h ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcPlatformInterface.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcSimPythonInterface.h 2 Dec 2004 04:17:24 -0000 1.17 --- tcSimPythonInterface.h 11 Dec 2004 01:09:05 -0000 1.18 *************** *** 101,112 **** void GetObjectStringByMode(char *str); // gets name of python object to pass to python function void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void SetMenuPlatform(long anID); ! void SetMenuGroup(std::vector<long>& unitIds); ! void ProcessCommand(std::string command, int param = -1, std::string textParam = ""); ! void ProcessCallback(std::string command, float afData, int param); ! void ProcessCallback(std::string command, float afData1, float afData2, int param); ! void ProcessCallback(std::string command, long anData, int param); void ProcessHotKey(unsigned int key, unsigned int flags); void ProcessSecondaryHook(long id); void ReportError(const char* text); void SelectFlightInterface(); ///< change to flightport menu --- 101,112 ---- void GetObjectStringByMode(char *str); // gets name of python object to pass to python function void LoadScenario(const char *filePath, const char *fileName); ///< loads scenario from Python script file ! void ProcessCommand(std::string command, long id, int param = -1, std::string textParam = ""); ! void ProcessCallback(std::string command, long id, float afData, int param); ! void ProcessCallback(std::string command, long id, float afData1, float afData2, int param); ! void ProcessCallback(std::string command, long id, long anData, int param); void ProcessHotKey(unsigned int key, unsigned int flags); void ProcessSecondaryHook(long id); + void PushMode(); + void PopMode(); void ReportError(const char* text); void SelectFlightInterface(); ///< change to flightport menu *************** *** 114,117 **** --- 114,119 ---- void SelectUnitMenu(); ///< change to unit menu void SelectGroupMenu(); ///< change to group menu + void SetMenuPlatform(long anID); + void SetMenuGroup(std::vector<long>& unitIds); tcSimPythonInterface(); *************** *** 141,144 **** --- 143,147 ---- tcPlatformObject *mpHookedObj; tcSoundConsole *mpConsole; + long menuPlatformID; enum teInterfaceMode { *************** *** 149,153 **** } meMenuMode; ! tcFlightPort* GetHookedObjFlightPort(void); }; } --- 152,160 ---- } meMenuMode; ! bool isModePushed; ///< true if mode is pushed and available for recall with PopMode ! teInterfaceMode pushedMode; ! long pushedPlatformID; ! ! tcFlightPort* GetHookedObjFlightPort(); }; } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:45
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338 Modified Files: GCblue.vcproj Log Message: Sonar work, passive sonar, torpedoes Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** GCblue.vcproj 7 Dec 2004 04:00:27 -0000 1.76 --- GCblue.vcproj 11 Dec 2004 01:09:03 -0000 1.77 *************** *** 440,443 **** --- 440,446 ---- </File> <File + RelativePath=".\src\sim\tcCommandQueue.cpp"> + </File> + <File RelativePath="src\sim\tcCustomControl.cpp"> </File> *************** *** 521,524 **** --- 524,530 ---- </File> <File + RelativePath=".\src\sim\tcSensorTrackIterator.cpp"> + </File> + <File RelativePath="src\sim\tcSimState.cpp"> </File> *************** *** 1340,1343 **** --- 1346,1352 ---- </File> <File + RelativePath=".\include\sim\tcCommandQueue.h"> + </File> + <File RelativePath="include\sim\tcCustomControl.h"> </File> *************** *** 1424,1427 **** --- 1433,1439 ---- </File> <File + RelativePath=".\include\sim\tcSensorTrackIterator.h"> + </File> + <File RelativePath="include\sim\tcSimState.h"> </File> |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/src/sim Modified Files: Game.cpp tcObjectControl.cpp tcOpticalSensor.cpp tcRadar.cpp tcSimState.cpp Added Files: tcCommandQueue.cpp tcSensorTrackIterator.cpp Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcSensorTrackIterator.cpp --- /** ** @file tcSensorTrackIterator.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 "tcSensorTrackIterator.h" #include "tcGameObject.h" #include "tcSensorMap.h" #include "tcSimState.h" #ifdef _DEBUG #define new DEBUG_NEW #endif namespace Sensor { tcSimState* tcSensorTrackIterator::simState = NULL; /** * */ void tcSensorTrackIterator::First() { if (!map) { currentPos = -1; currentObj = 0; nIterated = 1; return; } wxASSERT(map->GetTrackCount() >= 0); nSize = (unsigned int)map->GetTrackCount(); nIterated = 0; if (nSize == 0) { currentPos = -1; currentObj = 0; nIterated = 1; return; } currentPos = map->GetStartTrackPosition(); Next(); } /** * */ tcSensorMapTrack* tcSensorTrackIterator::Get() { return currentObj; } /** * Advance to next object that meets filter criteria. If * no objects are found, set currentObj to NULL */ void tcSensorTrackIterator::Next() { if (!map) { nIterated++; return; } bool searching = true; while ((nIterated <= nSize) && searching) { if (nIterated < nSize) // kind of a hack, nIterated > nSize is used for end condition { map->GetNextTrack(currentPos, currentObj); } nIterated++; if (PassesFilter(currentObj)) { searching = false; // found eligible object } else { currentObj = 0; } } } /** * */ bool tcSensorTrackIterator::NotDone() { return (nIterated <= nSize); } /** * Checks currentObj against filtering criteria. This is used * to iterate through a filtered set of objects. * @return true if current obj meets filtering criteria, false otherwise */ bool tcSensorTrackIterator::PassesFilter(const tcSensorMapTrack* track) { if (!track) return false; bool passesClassMask = (classMask & track->mnClassification) != 0; if (!passesClassMask) return false; if (!useRegion) return true; return region.ContainsPoint(track->mfLon_rad, track->mfLat_rad); } tcSensorTrackIterator::tcSensorTrackIterator(unsigned int alliance_, unsigned int classificationMask, const tcGeoRect& filterRegion) : useRegion(true), alliance(alliance_), classMask(classificationMask) { if (!simState) { simState = tcSimState::Get(); } region = filterRegion; map = simState->mcSensorMap.GetMap(alliance); First(); } tcSensorTrackIterator::tcSensorTrackIterator() : useRegion(false), alliance(0), classMask(0) { if (!simState) { simState = tcSimState::Get(); } map = simState->mcSensorMap.GetMap(alliance); First(); } tcSensorTrackIterator::~tcSensorTrackIterator() { } } Index: tcOpticalSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcOpticalSensor.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcOpticalSensor.cpp 2 Dec 2004 04:17:27 -0000 1.3 --- tcOpticalSensor.cpp 11 Dec 2004 01:09:08 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- #include "stdwx.h" #include "aerror.h" + #include "tcCommandQueue.h" #include "nsNav.h" #include "tcOpticalSensor.h" Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** tcSimState.cpp 7 Dec 2004 04:00:43 -0000 1.61 --- tcSimState.cpp 11 Dec 2004 01:09:08 -0000 1.62 *************** *** 33,36 **** --- 33,37 ---- #include "tcSimPythonInterface.h" #include "osg/Group" + #include "tcCommandQueue.h" #include "tcGoalTracker.h" #include "tcGoal.h" --- NEW FILE: tcCommandQueue.cpp --- /** ** @file tcCommandQueue.cpp */ /* Copyright (C) 2003-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" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcCommandQueue.h" #ifdef _DEBUG #define new DEBUG_NEW #endif /** * */ tcCommandQueue* tcCommandQueue::Get() { static tcCommandQueue instance; return &instance; } /** * */ void tcCommandQueue::AddCommand(const tsCommandInfo& newcmd) { if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * */ void tcCommandQueue::AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2) { tsCommandInfo newcmd; newcmd.meCmd = aeCmd; newcmd.mfData = afData; newcmd.mnData = anData; newcmd.mnData2 = anData2; newcmd.mbUsePython = false; newcmd.mbCallback = false; newcmd.mbGetUserInput = false; newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * For string commands */ void tcCommandQueue::AddCommand(const char *azCommand, int param) { tsCommandInfo newcmd; newcmd.meCmd = GC_TEXTCOMMAND; newcmd.mbUsePython = false; newcmd.mbCallback = false; newcmd.mbGetUserInput = false; newcmd.mnData = param; strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * version without user input and callback */ void tcCommandQueue::AddPythonCommand(const char *azCommand, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = false; newcmd.mbGetUserInput = false; newcmd.mnData = param; // int param newcmd.textParam = ""; // text param strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * version without user input and callback */ void tcCommandQueue::AddPythonCommand(const char *azCommand, std::string textParam) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = false; newcmd.mbGetUserInput = false; newcmd.mnData = -1; // int param newcmd.textParam = textParam; strcpy(newcmd.mzString , azCommand); strcpy(newcmd.mzUserInput, ""); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /* GetUserInput is called to add a command to get user input data. ** Once the user input is complete, the callback function is called though ** AddPythonCallback. Data that describes the user input is passed to the ** callback function along with an optional parameter. */ void tcCommandQueue::GetUserInput(const char *azCallback, const char *azUserInput, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = false; newcmd.mbGetUserInput = true; newcmd.mnData = param; newcmd.textParam = ""; strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * This version accepts a platformID parameter vs. defaulting to hooked platform * * GetUserInput is called to add a command to get user input data. * Once the user input is complete, the callback function is called though * AddPythonCallback. Data that describes the user input is passed to the * callback function along with an optional parameter. */ void tcCommandQueue::GetUserInputForID(const char *azCallback, const char *azUserInput, long platformID, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = false; newcmd.mbGetUserInput = true; newcmd.mnData = param; newcmd.textParam = ""; strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); newcmd.platformID = platformID; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * version for callback * Always applies to current hooked platform */ void tcCommandQueue::AddPythonCallback(const char *azCallback, const char *azUserInput, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = true; newcmd.mbGetUserInput = false; newcmd.mnData = param; newcmd.textParam = ""; strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * Version for specific platform ID vs. defaulting to hooked platform */ void tcCommandQueue::AddPythonCallbackForID(const char *azCallback, const char *azUserInput, long platformID, int param) { tsCommandInfo newcmd; newcmd.meCmd = (teGameCommand)0; newcmd.mbUsePython = true; newcmd.mbCallback = true; newcmd.mbGetUserInput = false; newcmd.mnData = param; newcmd.textParam = ""; strcpy(newcmd.mzString , azCallback); strcpy(newcmd.mzUserInput, azUserInput); newcmd.platformID = platformID; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * for sending messages */ void tcCommandQueue::DisplayInfoMessage(const char *azString) { tsCommandInfo newcmd; newcmd.meCmd = GC_DISPLAYMESSAGE; newcmd.mbUsePython = false; strcpy(newcmd.mzString, azString); newcmd.platformID = -1; if (mnCount < MAX_QUEUED_COMMANDS) { maCommand[mnCount++] = newcmd; } } /** * */ bool tcCommandQueue::GetCommand(tsCommandInfo& newcmd) { if (mnCount == 0) { newcmd.meCmd = GC_NULL; return false; } else { newcmd = maCommand[--mnCount]; return true; } } /** * */ tcCommandQueue::tcCommandQueue() { mnCount = 0; } /** * */ tcCommandQueue::~tcCommandQueue() { } Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcObjectControl.cpp 7 Dec 2004 04:00:43 -0000 1.26 --- tcObjectControl.cpp 11 Dec 2004 01:09:07 -0000 1.27 *************** *** 44,47 **** --- 44,48 ---- #include "tcAltitudeBarControl.h" #include "tcLauncherPopup.h" + #include "tcCommandQueue.h" #include <osg/Geometry> *************** *** 1736,1744 **** mnHookID = NULL_INDEX; mnPreviousHookID = NULL_INDEX; ! mpSS = NULL; mnLaunchers = 0; mpHookedGameObj = NULL; - mpCommandInterface = NULL; mpUserInfo = NULL; msOCSymbolList.mnSymbols = 0; --- 1737,1746 ---- mnHookID = NULL_INDEX; mnPreviousHookID = NULL_INDEX; ! ! mpSS = tcSimState::Get(); ! mpCommandInterface = tcCommandQueue::Get(); mnLaunchers = 0; mpHookedGameObj = NULL; mpUserInfo = NULL; msOCSymbolList.mnSymbols = 0; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** Game.cpp 7 Dec 2004 04:00:42 -0000 1.110 --- Game.cpp 11 Dec 2004 01:09:07 -0000 1.111 *************** *** 1,21 **** /** ! ** @file Game.cpp main application class */ ! /* Copyright (C) 2003-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 */ --- 1,22 ---- /** ! ** @file Game.cpp main application class */ ! /* ! ** Copyright (C) 2003-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 */ *************** *** 38,41 **** --- 39,43 ---- #include "tcCustomControl.h" #include "commandlist.h" // for custom command queue handler + #include "tcCommandQueue.h" #include "tcHookInfo.h" #include "tcOOBView.h" *************** *** 105,188 **** - /** - * The tcGame object constructor. - * - */ - tcGame::tcGame(const wxPoint& pos, const wxSize& size) : - wxFrame((wxFrame *)NULL, -1, "Global Conflict", pos, size, wxNO_FULL_REPAINT_ON_RESIZE), // | wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN - framePos(pos.x, pos.y), frameSize(size.GetWidth(), size.GetHeight()), - mnWidth(size.GetWidth()), mnHeight(size.GetHeight()), - gameDateZulu(2000,4,10,5,0,0) - { - viewer = NULL; - infoConsole = NULL; - briefingConsoleLeft = NULL; - briefingConsoleBottom = NULL; - tacticalMap = NULL; - worldMap = NULL; - editControl = NULL; - optionsView = NULL; - hookInfo = NULL; - objectControl = NULL; - oobView = NULL; - popupControl = NULL; - director = NULL; - networkView = NULL; - messageCenter = NULL; - - SetBackgroundColour(*wxBLACK); - Show(FALSE); - - simState = tcSimState::Get(); - database = tcDatabase::Get(); - - glCanvas = new wxGLCanvas(this, -1, wxPoint(0,0), size, 0, "GLCanvas", 0, wxNullPalette); - glCanvas->SetBackgroundColour(*wxBLACK); - - pythonInterface = new tcSimPythonInterface(); - goalTracker = simState->GetGoalTracker(); - - mbQuit = false; - mbPaused = false; - mbScenarioEdit = false; - accelerateTime = 0; - meScreenMode = TACTICAL; - mbSaveScenario = false; - strcpy(mzFileName,""); - mpGraphicsEngine = NULL; - mb3DActive = true; - size3D = MODE3D_SMALL; - meEditControlState = ECS_NONE; - mbSwitchToPlay = false; - gameTime = 0; - directorTime = 0; - nLastCount = 0; - multiplayerMode = 0; // single-player default - - mnBriefingWidth = 300; - mnLeftMargin = 000; - mnBottomMargin = 200; - - enableGraphicsEngine = true; - enableTacticalMap = true; - togglePopup = false; - - std::cout << "Game constructor success" << std::endl; - } - - /** - * The tcGame object destructor. - * - */ - tcGame::~tcGame() - { - if (pythonInterface) - { - delete pythonInterface; - } - messageConsole = NULL; - - Finish(); - } void tcGame::CheckGoals() --- 107,110 ---- *************** *** 543,547 **** chatBox = new tcChatBox(glCanvas, wxPoint(200, 200), wxSize(300, 180), "ChatBox"); chatBox->SetActive(false); ! chatBox->MoveToTop(); //database->LoadDBCSV(); --- 465,469 ---- chatBox = new tcChatBox(glCanvas, wxPoint(200, 200), wxSize(300, 180), "ChatBox"); chatBox->SetActive(false); ! //database->LoadDBCSV(); *************** *** 595,598 **** --- 517,522 ---- pythonInterface->AttachDirector(director); + viewer->Raise(); + InitSim(); } *************** *** 686,689 **** --- 610,614 ---- viewer->Show(FALSE); viewer->Freeze(); + mb3DActive = false; size3D = MODE3D_START; *************** *** 907,911 **** tacticalMap->AttachMapData(&mcMapData); tacticalMap->AttachOptions(tcOptions::Get()); ! tacticalMap->AttachCommandInterface(&mcCommandQueue); tacticalMap->Init(); --- 832,836 ---- tacticalMap->AttachMapData(&mcMapData); tacticalMap->AttachOptions(tcOptions::Get()); ! tacticalMap->AttachCommandInterface(commandQueue); tacticalMap->Init(); *************** *** 936,940 **** worldMap->AttachMapData(&mcMapData); worldMap->AttachOptions(tcOptions::Get()); ! worldMap->AttachCommandInterface(&mcCommandQueue); worldMap->Init(); worldMap->SetActive(false); --- 861,865 ---- worldMap->AttachMapData(&mcMapData); worldMap->AttachOptions(tcOptions::Get()); ! worldMap->AttachCommandInterface(commandQueue); worldMap->Init(); worldMap->SetActive(false); *************** *** 999,1004 **** objectControl->LoadBackgroundImage("console_b.jpg"); - objectControl->AttachCommandInterface(&mcCommandQueue); - objectControl->AttachSimState(simState); objectControl->AttachUserInfo(&mcUserInfo); --- 924,927 ---- *************** *** 1033,1037 **** } ! popupControl->AttachCommandInterface(&mcCommandQueue); popupControl->AttachPythonInterface(pythonInterface); popupControl->SetActive(false); --- 956,960 ---- } ! popupControl->AttachCommandInterface(commandQueue); popupControl->AttachPythonInterface(pythonInterface); popupControl->SetActive(false); *************** *** 1068,1072 **** #endif ! tcCustomControl::AttachCommandInterface(&mcCommandQueue); tcCustomControl::InitGdi(); --- 991,995 ---- #endif ! tcCustomControl::AttachCommandInterface(commandQueue); tcCustomControl::InitGdi(); *************** *** 1118,1122 **** simState->AttachPythonInterface(pythonInterface); simState->AttachUserInfo(&mcUserInfo); ! simState->AttachCommandInterface(&mcCommandQueue); --- 1041,1045 ---- simState->AttachPythonInterface(pythonInterface); simState->AttachUserInfo(&mcUserInfo); ! simState->AttachCommandInterface(commandQueue); *************** *** 1124,1128 **** wxASSERT(director); pythonInterface->AttachSensorMap(simState->mcSensorMap.GetMap(mcUserInfo.GetOwnAlliance())); ! pythonInterface->AttachCommandQueue(&mcCommandQueue); mcGameView.AttachSimState(simState); --- 1047,1051 ---- wxASSERT(director); pythonInterface->AttachSensorMap(simState->mcSensorMap.GetMap(mcUserInfo.GetOwnAlliance())); ! pythonInterface->AttachCommandQueue(commandQueue); mcGameView.AttachSimState(simState); *************** *** 2267,2275 **** void tcGame::ProcessCommandList() { ! for (unsigned nCmd=0; nCmd < mcCommandQueue.mnCount; nCmd++) { tsCommandInfo cmd_info; ! if(mcCommandQueue.GetCommand(cmd_info)) { if (cmd_info.mbUsePython) --- 2190,2198 ---- void tcGame::ProcessCommandList() { ! for (unsigned nCmd=0; nCmd < commandQueue->mnCount; nCmd++) { tsCommandInfo cmd_info; ! if(commandQueue->GetCommand(cmd_info)) { if (cmd_info.mbUsePython) *************** *** 2277,2285 **** if (cmd_info.mbCallback) { ! ProcessCallback(cmd_info.mzString, cmd_info.mzUserInput, cmd_info.mnData); } else if (cmd_info.mbGetUserInput) { ! GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, cmd_info.mnData); } else --- 2200,2211 ---- if (cmd_info.mbCallback) { ! ProcessCallback(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); } else if (cmd_info.mbGetUserInput) { ! if (cmd_info.platformID == -1) cmd_info.platformID = tacticalMap->GetHookID(); ! GetUserInput(cmd_info.mzString, cmd_info.mzUserInput, ! cmd_info.platformID, cmd_info.mnData); } else *************** *** 2287,2291 **** std::string s = cmd_info.mzString; int param = cmd_info.mnData; ! pythonInterface->ProcessCommand(s, param, cmd_info.textParam); } } --- 2213,2218 ---- std::string s = cmd_info.mzString; int param = cmd_info.mnData; ! pythonInterface->ProcessCommand(s, cmd_info.platformID, ! param, cmd_info.textParam); } } *************** *** 2339,2353 **** * Calls Python callback */ ! void tcGame::ProcessCallback(char *azCallback, char *azUserInput, int param) { if (strcmp(azUserInput,"Heading") == 0) { float fHeading = tacticalMap->GetMapCmdHeading(); ! pythonInterface->ProcessCallback(azCallback, fHeading, param); } else if (strcmp(azUserInput,"Target") == 0) { long nTarget = tacticalMap->GetMapCmdTarget(); ! pythonInterface->ProcessCallback(azCallback, nTarget, param); } else if (strcmp(azUserInput,"Datum") == 0) --- 2266,2280 ---- * Calls Python callback */ ! void tcGame::ProcessCallback(char *azCallback, char *azUserInput, long id, int param) { if (strcmp(azUserInput,"Heading") == 0) { float fHeading = tacticalMap->GetMapCmdHeading(); ! pythonInterface->ProcessCallback(azCallback, id, fHeading, param); } else if (strcmp(azUserInput,"Target") == 0) { long nTarget = tacticalMap->GetMapCmdTarget(); ! pythonInterface->ProcessCallback(azCallback, id, nTarget, param); } else if (strcmp(azUserInput,"Datum") == 0) *************** *** 2355,2359 **** tcPoint p; tacticalMap->GetMapCmdDatum(p); ! pythonInterface->ProcessCallback(azCallback, p.x, p.y, param); } else {} --- 2282,2286 ---- tcPoint p; tacticalMap->GetMapCmdDatum(p); ! pythonInterface->ProcessCallback(azCallback, id, p.x, p.y, param); } else {} *************** *** 2363,2369 **** * Gets user input for Python call back and then calls Python callback */ ! void tcGame::GetUserInput(char *azCallback, char *azUserInput, int param) { ! tacticalMap->SetMapCmdCallback(azCallback, param); if (strcmp(azUserInput,"Heading") == 0) --- 2290,2296 ---- * Gets user input for Python call back and then calls Python callback */ ! void tcGame::GetUserInput(char *azCallback, char *azUserInput, long id, int param) { ! tacticalMap->SetMapCmdCallback(azCallback, id, param); if (strcmp(azUserInput,"Heading") == 0) *************** *** 2381,2385 **** else { ! tacticalMap->SetMapCmdCallback("", -1); } } --- 2308,2312 ---- else { ! tacticalMap->SetMapCmdCallback("", id, -1); } } *************** *** 2424,2787 **** } - /* ** deferred methods * **/ - #if 0 - - bool tcGame::Init3DScene() { - tsSceneObjectInfo sSceneObjInfo; - tsSceneCameraInfo sCamInfo; - - sCamInfo.mfLat_deg = 50.1f; - sCamInfo.mfLon_deg = -5.0f; - sCamInfo.mfAlt_m = 1000.0f; - sCamInfo.mfLookAz_rad = 270.0f*C_PIOVER180; - sCamInfo.mfLookEl_rad = -10.0f*C_PIOVER180; - sCamInfo.mfNearPlane = 10.0f; - sCamInfo.mfFarPlane = 70000.0f; - sCamInfo.mfFOV_deg = 45.0f; - sCamInfo.mfAspect = (float)(mrect3D.right-mrect3D.left)/(float)(mrect3D.bottom-mrect3D.top); - sCamInfo.mfAspect = fabsf(sCamInfo.mfAspect); - mc3DScene.AttachMapData(&mcMapData); - mc3DScene.SetCameraInfo(sCamInfo); - mp3DSurface->Attach3dScene(&mc3DScene); - - // mfAz = 0; - // mfEl = 0; - // mfAzStart = sCamInfo.mfLookAz; - // mfElStart = sCamInfo.mfLookEl; - - memset(&sSceneObjInfo,0x00,sizeof(tsSceneObjectInfo)); - - - - ConsoleMessage("Initializing 3D terrain"); - mc3DScene.InitTerrain(); - - - return true; - } - bool tcGame::InitButtonBars(void) { - int nY = 30; - // button bar for lower left window selection - SetRect(&marectButtonBar[0],mrectConsole.right - 100,nY-25,mrectConsole.right,nY); - maButtonBar[0].SetWindow(marectButtonBar[0]); - maButtonBar[0].ClearButtons(); - maButtonBar[0].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Norm"); - maButtonBar[0].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Test"); - maButtonBar[0].SetTitle("Console"); - maButtonBar[0].UpdateWindow(); - maButtonBar[0].GetWindow(marectButtonBar[0]); - if(!maButtonBar[0].CreateSurfaces(mpGraphicsEngine)) {return false;} - if (maButtonBar[0].Init() == false) {return false;} ! // symbology selection ! SetRect(&marectButtonBar[1],mrectConsole.right - 200,nY-25,mrectConsole.right,nY); ! maButtonBar[1].SetWindow(marectButtonBar[1]); ! maButtonBar[1].ClearButtons(); ! maButtonBar[1].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","NTDS"); ! maButtonBar[1].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Icon"); ! maButtonBar[1].SetTitle("Symbology"); ! maButtonBar[1].UpdateWindow(); ! maButtonBar[1].GetWindow(marectButtonBar[1]); ! if(!maButtonBar[1].CreateSurfaces(mpGraphicsEngine)) {return false;} ! if (maButtonBar[1].Init() == false) {return false;} ! ! // 3D window size ! SetRect(&marectButtonBar[2],mrectConsole.right - 350,nY-25,mrectConsole.right,nY); ! maButtonBar[2].SetWindow(marectButtonBar[2]); ! maButtonBar[2].ClearButtons(); ! maButtonBar[2].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Small"); ! maButtonBar[2].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Large"); ! maButtonBar[2].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","OFF"); ! maButtonBar[2].SetTitle("3D Mode"); ! maButtonBar[2].UpdateWindow(); ! maButtonBar[2].GetWindow(marectButtonBar[2]); ! if(!maButtonBar[2].CreateSurfaces(mpGraphicsEngine)) {return false;} ! if (maButtonBar[2].Init() == false) {return false;} ! ! // upper left view selection ! SetRect(&marectButtonBar[3],20, mrectOOB.top + 20, 0, 0); ! maButtonBar[3].SetWindow(marectButtonBar[3]); ! maButtonBar[3].ClearButtons(); ! maButtonBar[3].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","OOB"); ! maButtonBar[3].AddButton("buttonbar_on.bmp","buttonbar_off.bmp","Help"); ! maButtonBar[3].SetTitle("View selection"); ! maButtonBar[3].UpdateWindow(); ! maButtonBar[3].GetWindow(marectButtonBar[3]); ! if(!maButtonBar[3].CreateSurfaces(mpGraphicsEngine)) {return false;} ! if (maButtonBar[3].Init() == false) {return false;} ! ! return true; ! } ! ! bool tcGame::PointInButtonBar(CPoint point) { ! for (int n=0;n<N_BUTTON_BARS;n++) { ! CRect r(marectButtonBar[n]); ! if (r.PtInRect(point)) { ! return true; ! } ! } ! return false; ! } ! void tcGame::UpdateButtonBarMode(teScreenMode aeMode) { ! static teScreenMode aeLastMode = NONE; ! if (aeMode == aeLastMode) {return;} ! SyncButtonBars(); // to synch when change is applied through options screen ! if (aeMode == TACTICAL) { ! for (int n=0;n<N_BUTTON_BARS;n++) { ! maButtonBar[n].SetActive(true); ! } ! } ! else { ! for (int n=0;n<N_BUTTON_BARS;n++) { ! maButtonBar[n].SetActive(false); ! } ! } ! aeLastMode = aeMode; ! } ! // should move to within buttonbar class, derive buttonbar from wxWindow ! bool tcGame::OnLButtonDownButtonBar(UINT nFlags, CPoint point) { ! bool bWithin = false; ! for (int n=0;(n<N_BUTTON_BARS)&&(!bWithin);n++) { ! CRect r(marectButtonBar[n]); ! if (r.PtInRect(point)) { ! maButtonBar[n].OnLButtonDown(nFlags,point); ! bWithin = true; ! } ! } ! mcOptions.mbUseNTDS = maButtonBar[1].mnCurrentButton == 0; ! if (maButtonBar[2].mnCurrentButton == 2) { ! mb3DActive = false; ! } ! else if (maButtonBar[2].mnCurrentButton == 0) { ! mb3DActive = true; ! mb3DSmall = true; ! } ! else { ! mb3DActive = true; ! mb3DSmall = false; ! } ! Update3DMode(); ! mcOptions.Synchronize(); ! return bWithin; ! } ! // synch button bar state to options, call when options are changed ! void tcGame::SyncButtonBars() ! { ! maButtonBar[1].mnCurrentButton = (mcOptions.mbUseNTDS) ? 0 : 1; ! } ! void tcGame::Update3DMode() ! { ! if (!mb3DActive) ! { ! tacticalMap->SetActive(true); ! mp3DSurface->mbActive = false; ! maButtonBar[2].mnCurrentButton = 2; ! } ! else ! { ! mp3DSurface->mbActive = true; ! if (mb3DSmall) ! { ! mrect3D = mrect3DSmall; ! mp3DSurface->mrectWindow = mrect3D; ! tacticalMap->SetActive(true); ! maButtonBar[2].mnCurrentButton = 0; ! } ! else ! { ! mrect3D = mrectMap; ! mp3DSurface->mrectWindow = mrect3D; ! tacticalMap->SetActive(false); ! maButtonBar[2].mnCurrentButton = 1; ! } ! } } - /** ! * change virtual base class function in CommandInterface if this is changed */ ! void tcGame::ProcessCommand(teGameCommand aeCmd, float afData, long anData, int anData2) { ! static float sfData; ! static long snData; ! static int snData2; ! static enum { ! PLATFORM_LOCATION, ! PLATFORM_DATUM, ! LAUNCHER_DATUM, ! PLATFORM_TARGET, ! LAUNCHER_TARGET ! } seMode; ! ! switch (aeCmd) { ! /* ! case GC_TOGGLEEDIT: ! mbScenarioEdit = !mbScenarioEdit; ! if (mbScenarioEdit) { ! mcOptions.mnViewMode = 1; ! mcOptions.mnCommandMode = 0; ! } ! else { ! mcOptions.mnViewMode = 2; ! mcOptions.mnCommandMode = 1; ! } ! mbPaused = true; ! break; ! */ ! case GC_QUIT: ! WTL("tcGame::ProcessCommand GC_QUIT"); ! mbQuit = true; ! break; ! /* ! case GC_RESETMAP: ! WTL("tcGame::ProcessCommand GC_RESETMAP"); ! simState->DeleteAllPlatforms(); ! simState->ClearSensorMaps(); ! simState->RandInit(); ! break; ! case GC_ADDRANDPLAT: ! WTL("tcGame::ProcessCommand GC_ADDRANDPLAT"); ! simState->AddRandomPlatform(); ! break; ! case GC_SAVESCEN: ! WTL("tcGame::ProcessCommand GC_SAVESCEN"); ! mcEditControl.SetActive(true); ! mcEditControl.SetCaption("Enter scenario name for save:"); ! mcEditControl.SetBuffer(""); ! meEditControlState = ECS_GETSAVESCENARIO; ! //mbSaveScenario = true; ! break; ! case GC_LOADSCEN: ! WTL("tcGame::ProcessCommand GC_LOADSCEN"); ! mcEditControl.SetActive(true); ! mcEditControl.SetCaption("Enter scenario name to load:"); ! mcEditControl.SetBuffer(""); ! meEditControlState = ECS_GETLOADSCENARIO; ! break; ! case PC_GETNEWHEADING: ! WTL("tcGame::ProcessCommand PC_GETNEWHEADING"); ! tacticalMap->ActivateCmd(MC_HEADING); ! break; ! case PC_GETNEWLOCATION: ! WTL("tcGame::ProcessCommand PC_GETNEWLOCATION"); ! tacticalMap->ActivateCmd(MC_DATUM); ! seMode = PLATFORM_LOCATION; // get new location for platform (scen edit mode) ! break; ! case PC_CHANGEHEADING: ! WTL("tcGame::ProcessCommand PC_CHANGEHEADING"); ! if (mbScenarioEdit) { ! simState->ChangeHeadingForced(tacticalMap->mnHookID,afData); ! } ! else { ! simState->ChangeHeading(tacticalMap->mnHookID,afData); ! } ! break; ! case PC_HALFSPEED: ! WTL("tcGame::ProcessCommand PC_HALFSPEED"); ! simState->ChangeNormSpeed(tacticalMap->mnHookID,0.5f); ! break; ! case PC_FULLSPEED: ! WTL("tcGame::ProcessCommand PC_FULLSPEED"); ! simState->ChangeNormSpeed(tacticalMap->mnHookID,1.0f); ! break; ! case PC_GETNEWTARGET: ! WTL("tcGame::ProcessCommand PC_GETNEWTARGET"); ! tacticalMap->ActivateCmd(MC_TARGET); ! seMode = PLATFORM_TARGET; ! break; ! case PC_GETLAUNCHERTARGET: ! WTL("tcGame::ProcessCommand PC_GETLAUNCHERTARGET"); ! tacticalMap->ActivateCmd(MC_TARGET); ! seMode = LAUNCHER_TARGET; ! break; ! case PC_DESIGNATETARGET: ! { ! WTL("tcGame::ProcessCommand PC_DESIGNATETARGET"); // change to TARGETSET ? ! tcPoint p; ! tacticalMap->GetMapCmdDatum(p); ! if (seMode == PLATFORM_TARGET) { ! simState->DesignateTarget(tacticalMap->mnHookID,anData); ! } ! else { ! if (simState->DesignateLauncherTarget(tacticalMap->mnHookID,anData,snData2)==false) { ! tcSound::Get()->PlayEffect(SEFFECT_REJECTBEEP); ! // failed, repeat command ! ProcessCommand(PC_GETLAUNCHERTARGET,0,0,anData); ! } ! } ! } ! break; ! case PC_GETDATUM: ! WTL("tcGame::ProcessCommand PC_GETDATUM"); ! tacticalMap->ActivateCmd(MC_DATUM); ! //tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); ! seMode = PLATFORM_DATUM; ! break; ! case PC_GETLAUNCHERDATUM: ! WTL("tcGame::ProcessCommand PC_GETLAUNCHERDATUM"); ! tacticalMap->ActivateCmd(MC_DATUM); ! //tcSound::Get()->PlayEffect(SEFFECT_TWOBEEPS); ! seMode = LAUNCHER_DATUM; ! break; ! case PC_DATUMSET: ! { ! WTL("tcGame::ProcessCommand PC_DATUMSET"); ! tcPoint p; ! tacticalMap->GetMapCmdDatum(p); ! if (seMode == PLATFORM_LOCATION) { ! simState->ChangeLocation(tacticalMap->mnHookID,p.x,p.y); ! } ! else if (seMode == PLATFORM_DATUM) { ! simState->DesignateDatum(tacticalMap->mnHookID,p); ! } ! else { ! simState->DesignateLauncherDatum(tacticalMap->mnHookID,p,snData2); ! } ! } ! break; ! case PC_LAUNCH: ! WTL("tcGame::ProcessCommand PC_LAUNCH"); ! if (simState->IsLauncherReady(tacticalMap->mnHookID,0)) { ! simState->RequestLaunch(tacticalMap->mnHookID,0); ! } ! else if (simState->IsLauncherReady(tacticalMap->mnHookID,1)) { ! simState->RequestLaunch(tacticalMap->mnHookID,1); ! } ! else if (simState->IsLauncherReady(tacticalMap->mnHookID,2)) { ! simState->RequestLaunch(tacticalMap->mnHookID,2); ! } ! else if (simState->IsLauncherReady(tacticalMap->mnHookID,3)) { ! simState->RequestLaunch(tacticalMap->mnHookID,3); ! } ! else { ! tcSound::Get()->PlayEffect(SEFFECT_REJECTBEEP); ! infoConsole->Print("No launchers ready to fire"); ! } ! break; ! case PC_DELETE: ! WTL("tcGame::ProcessCommand PC_DELETE"); ! simState->DeletePlatform(tacticalMap->mnHookID); ! tacticalMap->mnHookID = NULL_INDEX; ! mcHook.SetHookID(NULL_INDEX); ! mcObjectControl.SetHookID(NULL_INDEX); ! break; ! */ ! default: ! WTL("tcGame::ProcessCommand unrecognized game command"); ! break; } ! sfData = afData; ! snData = anData; ! snData2 = anData2; } - #endif \ No newline at end of file --- 2351,2435 ---- } ! /** ! * The tcGame object constructor. ! * ! */ ! tcGame::tcGame(const wxPoint& pos, const wxSize& size) : ! wxFrame((wxFrame *)NULL, -1, "Global Conflict", pos, size, wxNO_FULL_REPAINT_ON_RESIZE), // | wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN ! framePos(pos.x, pos.y), frameSize(size.GetWidth(), size.GetHeight()), ! mnWidth(size.GetWidth()), mnHeight(size.GetHeight()), ! gameDateZulu(2000,4,10,5,0,0) ! { ! viewer = NULL; ! infoConsole = NULL; ! briefingConsoleLeft = NULL; ! briefingConsoleBottom = NULL; ! tacticalMap = NULL; ! worldMap = NULL; ! editControl = NULL; ! optionsView = NULL; ! hookInfo = NULL; ! objectControl = NULL; ! oobView = NULL; ! popupControl = NULL; ! director = NULL; ! networkView = NULL; ! messageCenter = NULL; ! SetBackgroundColour(*wxBLACK); ! Show(FALSE); ! simState = tcSimState::Get(); ! database = tcDatabase::Get(); ! commandQueue = tcCommandQueue::Get(); ! glCanvas = new wxGLCanvas(this, -1, wxPoint(0,0), size, 0, "GLCanvas", 0, wxNullPalette); ! glCanvas->SetBackgroundColour(*wxBLACK); ! pythonInterface = new tcSimPythonInterface(); ! goalTracker = simState->GetGoalTracker(); + mbQuit = false; + mbPaused = false; + mbScenarioEdit = false; + accelerateTime = 0; + meScreenMode = TACTICAL; + mbSaveScenario = false; + strcpy(mzFileName,""); + mpGraphicsEngine = NULL; + mb3DActive = true; + size3D = MODE3D_SMALL; + meEditControlState = ECS_NONE; + mbSwitchToPlay = false; + gameTime = 0; + directorTime = 0; + nLastCount = 0; + multiplayerMode = 0; // single-player default ! mnBriefingWidth = 300; ! mnLeftMargin = 000; ! mnBottomMargin = 200; ! enableGraphicsEngine = true; ! enableTacticalMap = true; ! togglePopup = false; + std::cout << "Game constructor success" << std::endl; } /** ! * The tcGame object destructor. ! * */ ! tcGame::~tcGame() { ! if (pythonInterface) ! { ! delete pythonInterface; } ! messageConsole = NULL; ! ! Finish(); } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcRadar.cpp 7 Dec 2004 04:00:43 -0000 1.20 --- tcRadar.cpp 11 Dec 2004 01:09:08 -0000 1.21 *************** *** 22,25 **** --- 22,26 ---- #include "stdwx.h" #include "aerror.h" + #include "tcCommandQueue.h" #include "nsNav.h" #include "tcRadar.h" |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:19
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/xml Modified Files: options.xml Log Message: Sonar work, passive sonar, torpedoes Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** options.xml 5 Dec 2004 02:49:48 -0000 1.9 --- options.xml 11 Dec 2004 01:09:08 -0000 1.10 *************** *** 6,8 **** --- 6,9 ---- <xCopyDatabase /> <xWriteXmlDatabase /> + <xLog3DModelDetails /> </Options> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:17
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcSimPythonInterface.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcPlatformInterface.cpp 7 Dec 2004 04:00:41 -0000 1.32 --- tcPlatformInterface.cpp 11 Dec 2004 01:09:06 -0000 1.33 *************** *** 39,42 **** --- 39,43 ---- #include "tcSoundConsole.h" #include "commandlist.h" + #include "tcCommandQueue.h" #include "tcAeroAirObject.h" #include "tcBallisticDBObject.h" Index: tcSimPythonInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcSimPythonInterface.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSimPythonInterface.cpp 5 Dec 2004 02:49:48 -0000 1.23 --- tcSimPythonInterface.cpp 11 Dec 2004 01:09:07 -0000 1.24 *************** *** 363,367 **** } ! void tcSimPythonInterface::ProcessCommand(std::string command, int param, std::string textParam) { std::string s = "Menu."; --- 363,370 ---- } ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCommand(std::string command, long id, int param, std::string textParam) { std::string s = "Menu."; *************** *** 391,400 **** } ! void tcSimPythonInterface::ProcessCallback(std::string command, float afData, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; GetObjectStringByMode(zObject); --- 394,450 ---- } ! /** ! * Saves menu state. Restore with PopMode() ! */ ! void tcSimPythonInterface::PushMode() { ! pushedMode = meMenuMode; ! pushedPlatformID = menuPlatformID; ! isModePushed = true; ! } ! ! /** ! * Recalls menu state after call to push mode. ! */ ! void tcSimPythonInterface::PopMode() ! { ! if (!isModePushed) ! { ! fprintf(stderr, "tcSimPythonInterface::PopMode() - Mode not pushed\n"); ! return; ! } ! ! meMenuMode = pushedMode; ! ! // for group menu don't do anything (can't change group menu currently) ! if (meMenuMode == GROUP_MENU) return; ! ! // reselect menu platform ! SetMenuPlatform(pushedPlatformID); ! ! isModePushed = false; ! } ! ! ! ! ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData, int param) ! { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; + + GetObjectStringByMode(zObject); *************** *** 405,415 **** CallPython(zBuff,"Exception occured in ProcessCallback\n"); } ! // version for sending lat/lon coordinates ! void tcSimPythonInterface::ProcessCallback(std::string command, float afData1, float afData2, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; --- 455,476 ---- CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } ! /** ! * version for sending lat/lon coordinates ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, float afData1, float afData2, int param) { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; *************** *** 424,435 **** } CallPython(zBuff,"Exception occured in ProcessCallback\n"); } ! void tcSimPythonInterface::ProcessCallback(std::string command, long anData, int param) { ! if (mpHookedObj == NULL) {return;} char zBuff[128]; char zObject[64]; GetObjectStringByMode(zObject); if (param == -1) --- 485,509 ---- } CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } ! /** ! * ! */ ! void tcSimPythonInterface::ProcessCallback(std::string command, long id, long anData, int param) { ! PushMode(); ! SetMenuPlatform(id); ! ! if (mpHookedObj == NULL) ! { ! PopMode(); ! return; ! } char zBuff[128]; char zObject[64]; + GetObjectStringByMode(zObject); if (param == -1) *************** *** 439,442 **** --- 513,518 ---- CallPython(zBuff,"Exception occured in ProcessCallback\n"); + + PopMode(); } *************** *** 534,537 **** --- 610,617 ---- { + if (mpHookedObj && (mpHookedObj->mnID == anID)) return; // already set + + menuPlatformID = anID; + tcTrackInterface::SetTrack(anID); *************** *** 575,584 **** ! tcSimPythonInterface::tcSimPythonInterface() { ! mpConsole = NULL; ! director = NULL; mpSimState = tcSimState::Get(); ! mpHookedObj = NULL; tcPlatformInterface::AttachSimState(mpSimState); --- 655,669 ---- ! tcSimPythonInterface::tcSimPythonInterface() : ! mpConsole(0), ! director(0), ! mpHookedObj(0), ! isModePushed(false), ! pushedPlatformID(-1) ! { ! mpSimState = tcSimState::Get(); ! tcPlatformInterface::AttachSimState(mpSimState); *************** *** 671,675 **** // import AI script ! try { handle<>( PyRun_String("import AI\n" , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); --- 756,761 ---- // import AI script ! try ! { handle<>( PyRun_String("import AI\n" , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); *************** *** 679,683 **** , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) { // handle the exception in some way fprintf(stderr,"Exception occured during import\n"); --- 765,770 ---- , Py_file_input, mpDictionary->ptr(), mpDictionary->ptr()) ); } ! catch(error_already_set) ! { // handle the exception in some way fprintf(stderr,"Exception occured during import\n"); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:24
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcPlatformInterface.cpp 5 Dec 2004 02:49:47 -0000 1.31 --- tcPlatformInterface.cpp 7 Dec 2004 04:00:41 -0000 1.32 *************** *** 464,472 **** } const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); ! if (tcMissileDBObject* missileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj)) { info.mfRange_km = missileDBObj->mfRange_km; } else if (tcBallisticDBObject* ballisticDBObj = --- 464,475 ---- } const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); ! ! info.maxDepth_m = 0; ! if (tcMissileDBObject* missileDBObj = dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj)) { info.mfRange_km = missileDBObj->mfRange_km; + info.maxDepth_m = 30.0f; } else if (tcBallisticDBObject* ballisticDBObj = *************** *** 479,482 **** --- 482,486 ---- { info.mfRange_km = torpDBObj->mfRange_km; + info.maxDepth_m = torpDBObj->maxDepth_m; } else { *************** *** 554,558 **** { int launcherStatus = mpPlatformObj->SetLaunch(anLauncher, quantity); ! if (launcherStatus != tcLauncherState::LAUNCHER_READY) { DisplayMessage(tcLauncherState::TranslateLauncherStatus(launcherStatus)); --- 558,562 ---- { int launcherStatus = mpPlatformObj->SetLaunch(anLauncher, quantity); ! if (launcherStatus != tcLauncher::LAUNCHER_READY) { DisplayMessage(tcLauncherState::TranslateLauncherStatus(launcherStatus)); Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcPlatformInterfaceExtension.cpp 16 Aug 2004 01:43:31 -0000 1.11 --- tcPlatformInterfaceExtension.cpp 7 Dec 2004 04:00:41 -0000 1.12 *************** *** 119,122 **** --- 119,123 ---- .def_readonly("Range_km",&tcLauncherInfo::mfRange_km) .def_readonly("LaunchMode",&tcLauncherInfo::mnLaunchMode) // 0 - datum, 1 - handoff + .def_readonly("MaxDepth_m",&tcLauncherInfo::maxDepth_m) ; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:22
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/graphics Modified Files: tc3DModel.cpp tc3DWindow.cpp tcMapView.cpp tcOOBView.cpp Added Files: tcLauncherPopup.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMapView.cpp 5 Dec 2004 02:49:47 -0000 1.10 --- tcMapView.cpp 7 Dec 2004 04:00:41 -0000 1.11 *************** *** 452,458 **** osg::Vec4 color(0.784, 0.784, 0.784, 1.0); ! DrawTextR(sText.GetBuffer(), 50.0, mnHeight-25.0, defaultFont.get(), color, 16.0, CENTER_CENTER); ! nBarX1 = 120; nBarX2 = nBarX1 + nScaleBarWidth; --- 452,459 ---- osg::Vec4 color(0.784, 0.784, 0.784, 1.0); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, mnHeight-25.0, ! defaultFont.get(), color, 16.0, CENTER_CENTER); ! nBarX1 = leftMargin + 120; nBarX2 = nBarX1 + nScaleBarWidth; *************** *** 492,496 **** osg::Vec4 color(1, 1, 1, 1); ! DrawTextR(sText.GetBuffer(), 50.0, mnHeight - 50.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } --- 493,498 ---- osg::Vec4 color(1, 1, 1, 1); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, mnHeight - 50.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } *************** *** 628,632 **** /*** Draw grid ***/ ! DrawGrid(); /*** Draw scale bar ***/ --- 630,634 ---- /*** Draw grid ***/ ! //DrawGrid(); // disabled until the terrain view graphics are ported to OSG /*** Draw scale bar ***/ *************** *** 668,672 **** } ! DrawTextR(sText.GetBuffer(), 50.0, 50.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); if ((mpOptions!=NULL) && (mpOptions->mbShowMapDebug)) --- 670,675 ---- } ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 50.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); if ((mpOptions!=NULL) && (mpOptions->mbShowMapDebug)) *************** *** 678,682 **** vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, vp.mrectDisplay.X, vp.mrectDisplay.Y, vp.mrectDisplay.Width, vp.mrectDisplay.Height); ! DrawTextR(sText.GetBuffer(), 50.0, 80.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } --- 681,686 ---- vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, vp.mrectDisplay.X, vp.mrectDisplay.Y, vp.mrectDisplay.Width, vp.mrectDisplay.Height); ! DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 80.0, ! defaultFont.get(), color, 16.0, LEFT_BASE_LINE); } *************** *** 2031,2034 **** --- 2035,2046 ---- /** + * + */ + void tcTacticalMapView::SetTextLeftMargin(float x) + { + leftMargin = x; + } + + /** * OnLeaveWindow event handler */ *************** *** 2334,2337 **** --- 2346,2350 ---- meSymbology = NTDS; isLButtonDown = false; + leftMargin = 200.0f; ClearMapObjects(); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tc3DModel.cpp 23 Nov 2004 23:30:55 -0000 1.16 --- tc3DModel.cpp 7 Dec 2004 04:00:28 -0000 1.17 *************** *** 24,30 **** #ifndef WX_PRECOMP #include "wx/wx.h" - //#ifdef WIN32 - //#include "wx/msw/private.h" // for MS Windows specific definitions - //#endif // WIN32 #endif // WX_PRECOMP --- 24,27 ---- *************** *** 32,35 **** --- 29,33 ---- #include "tcGameObject.h" #include "tcPlatformObject.h" + #include "tcOptions.h" #include "ObjectUpdater.h" #include "tcParticleEffect.h" *************** *** 70,74 **** std::string name = node.getName(); #ifdef _DEBUG ! std::cout << " - "<< name << "\n"; #endif /* --- 68,75 ---- std::string name = node.getName(); #ifdef _DEBUG ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << " - "<< name << "\n"; ! } #endif /* *************** *** 139,143 **** animationInfo.push_back(ai); ! std::cout << "added animation info for: " << name <<"\n"; } else --- 140,147 ---- animationInfo.push_back(ai); ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << "added animation info for: " << name <<"\n"; ! } } else *************** *** 396,400 **** { if (modelNode.valid()) return; // model already loaded ! std::cout << "Loading 3D model: " << model_name << " \n"; model_name = model_name + ".3ds"; --- 400,407 ---- { if (modelNode.valid()) return; // model already loaded ! if (tcOptions::Get()->log3DModelDetails) ! { ! std::cout << "Loading 3D model: " << model_name << " \n"; ! } model_name = model_name + ".3ds"; *************** *** 411,416 **** modelNode->accept(smoothingVisitor); } ! ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); } --- 418,425 ---- modelNode->accept(smoothingVisitor); } ! if (tcOptions::Get()->log3DModelDetails) ! { ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); ! } } --- NEW FILE: tcLauncherPopup.cpp --- /** ** @file tcLauncherPopup.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" #include "tcLauncherPopup.h" #include "tcLauncher.h" #include "tcPlatformObject.h" #include "tcSimState.h" #include "tcTime.h" #include <stdio.h> #include <iostream> #ifdef _DEBUG #define new DEBUG_NEW #endif tc3DWindow* tcLauncherPopup::parent = 0; /** * */ void tcLauncherPopup::SetParent(tc3DWindow* par) { parent = par; } /** * */ void tcLauncherPopup::Draw() { unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; if (age % 10 == 0) redraw = true; if (!redraw) return; redraw = false; osg::Vec4 color(1, 1, 1, 1); float x = 10.0f; float y = 10.0f; tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObject(platformId)); DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), osg::Vec4(0, 0, 0, 0.5f), FILL_ON); DrawBorder(); if (!obj) { DrawTextR("CONTROL UNAVAILABLE", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); HideUnusedObjects(); return; } tcLauncher* launcher = obj->GetLauncher(launcherIdx); if (!launcher) { DrawTextR("LAUNCHER ERROR", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); HideUnusedObjects(); return; } wxString s; wxSize textSize; s = wxString::Format("%s : %s x %d\n", launcher->displayName.c_str(), launcher->GetChildClassName().c_str(), launcher->mnCurrent); DrawTextR(s.c_str(), x, y, defaultFont.get(), color, fontSize, LEFT_CENTER); MeasureText(defaultFont.get(), fontSize, s.c_str(), textSize); x += float(textSize.GetWidth()) + 5.0f; launchButton.Set(x, x + 10.0f, y - 0.5f * float(textSize.GetHeight()), y + 0.5 * float(textSize.GetHeight())); if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { color.set(0.4f, 1.0f, 0.4f, 1.0f); } else { color.set(1.0f, 0.4f, 0.4f, 1.0f); } DrawRectangleR(launchButton, color, FILL_ON); HideUnusedObjects(); } /** * @return associated launcher or NULL if error */ tcLauncher* tcLauncherPopup::GetLauncher() { tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObject(platformId)); if (!obj) { return 0; } else { return obj->GetLauncher(launcherIdx); } } /** * A hack job for now :) */ void tcLauncherPopup::OnLButtonDown(wxMouseEvent& event) { wxPoint pos = event.GetPosition(); if (launchButton.ContainsPoint(pos.x, pos.y)) { if (tcLauncher* launcher = GetLauncher()) { if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { launcher->mnUncommitted -= 1; if (launcher->mnUncommitted < 0) { launcher->mnUncommitted = 0; // don't set new cmd here since this is an error case std::cerr << "Error - tcLauncherState::SetLaunch - negative uncommitted\n"; } //else //{ // commandObj.SetNewCommand(GetLauncherFlag(nLauncher)); //} } } } else { ClearDrawObjects(); this->Destroy(); } } /** * */ void tcLauncherPopup::OnMouseOver(wxMouseEvent& event) { } /** * @param id Id of platform with launcher to control * @param idx Launcher idx on platform */ tcLauncherPopup::tcLauncherPopup(long id, unsigned idx, const wxPoint& pos) : tc3DWindow(parent, pos, wxSize(150, 50), "LauncherPopupControl", parent), platformId(id), launcherIdx(idx), redraw(true) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); birthCount = tcTime::Get()->Get30HzCount(); simState = tcSimState::Get(); wxASSERT(simState); SetActive(true); } tcLauncherPopup::~tcLauncherPopup() { } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcOOBView.cpp 2 Nov 2004 04:23:56 -0000 1.4 --- tcOOBView.cpp 7 Dec 2004 04:00:41 -0000 1.5 *************** *** 268,271 **** --- 268,274 ---- float yheader; + DrawRectangleR(0, 0, mnWidth, mnHeight, + osg::Vec4(0, 0, 0, 0.5f), FILL_ON); + yheader = GetCategoryY(surfaceObj); if (yheader > 0) *************** *** 443,446 **** --- 446,457 ---- } + /** + * Skips mouse move to allow tactical map underneath to receive + */ + void tcOOBView::OnMouseMove(wxMouseEvent& event) + { + event.Skip(); + } + tsOOBInfo* tcOOBView::ButtonContainingPoint(wxRealPoint pointf) { Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tc3DWindow.cpp 14 Nov 2004 22:52:21 -0000 1.11 --- tc3DWindow.cpp 7 Dec 2004 04:00:28 -0000 1.12 *************** *** 1685,1700 **** void tc3DWindow::MoveToTop() { ! /* ! if (!tcGraphicsEngine::Get()->MoveSurfaceToTop(mp2DSurface)) ! { ! std::cerr << "Error - tc3DWindow::MoveToTop() - surface not found" ! << std::endl; ! } ! if (mbCloned) ! { ! std::cerr << "Warning - tc3DWindow::MoveToTop() - called on shared surface" ! << std::endl; ! } ! */ } --- 1685,1689 ---- void tc3DWindow::MoveToTop() { ! wxWindow::Raise(); } *************** *** 1813,1816 **** --- 1802,1806 ---- root->setName(name.c_str()); osg::StateSet* stateSet = root->getOrCreateStateSet(); + stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); *************** *** 1823,1826 **** --- 1813,1817 ---- groupStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); groupStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + groupStateSet->setMode(GL_BLEND, osg::StateAttribute::ON); textRoot = new osg::Geode; *************** *** 1842,1846 **** backgroundStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); backgroundStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! backgroundStateSet->setMode(GL_BLEND, osg::StateAttribute::OFF); backgroundStateSet->setRenderBinDetails(baseRenderBin + backgroundRenderBin, "RenderBin"); --- 1833,1837 ---- backgroundStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); backgroundStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! backgroundStateSet->setMode(GL_BLEND, osg::StateAttribute::ON); backgroundStateSet->setRenderBinDetails(baseRenderBin + backgroundRenderBin, "RenderBin"); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:14
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/common Modified Files: tcOggStreamer.cpp tcOptions.cpp tcSoundConsole.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcSoundConsole.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSoundConsole.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcSoundConsole.cpp 2 Nov 2004 04:23:55 -0000 1.10 --- tcSoundConsole.cpp 7 Dec 2004 04:00:28 -0000 1.11 *************** *** 42,45 **** --- 42,48 ---- } + /** + * + */ void tcSoundConsole::Draw() { *************** *** 55,58 **** --- 58,66 ---- } + if (!IsBackgroundEnabled()) + { + DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0, 0, 0, 0.5f), FILL_ON); + } + DrawChildren(); Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcOggStreamer.cpp 5 Dec 2004 02:49:47 -0000 1.11 --- tcOggStreamer.cpp 7 Dec 2004 04:00:28 -0000 1.12 *************** *** 289,296 **** if (IsStopped()) { ! alSourcePlay(source); #ifdef _DEBUG fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif } --- 289,300 ---- if (IsStopped()) { ! ! alSourceStop(source); ! alSourcePlay(source); // crashes frequently in OpenAL32.dll thread after here ! #ifdef _DEBUG fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); #endif + return true; } Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcOptions.cpp 6 Nov 2004 15:13:41 -0000 1.13 --- tcOptions.cpp 7 Dec 2004 04:00:28 -0000 1.14 *************** *** 38,172 **** int tcOptions::Init() { ! tsOptionInfo oi; ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 2; ! oi.mpAssociated = &mnViewMode; ! oi.mzCaption[0] = "Omniscient view"; ! oi.mzCaption[1] = "Omniscient, no sensor tags"; ! oi.mzCaption[2] = "Legal view"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mnCommandMode; ! oi.mzCaption[0] = "Control all"; ! oi.mzCaption[1] = "Legal control (alliance only)"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = NULL; ! oi.mzCaption[0] = "Test 1"; ! oi.mzCaption[1] = "Test 2"; ! oi.mzCaption[2] = "Test 3"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &disableSound; ! oi.mzCaption[0] = "Sound Enabled"; ! oi.mzCaption[1] = "Sound Disabled"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbPlayMusic; ! oi.mzCaption[0] = "Music OFF"; ! oi.mzCaption[1] = "Music ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbShowMapDebug; ! oi.mzCaption[0] = "Map debug OFF"; ! oi.mzCaption[1] = "Map debug ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 0; ! oi.mpAssociated = &debugLevel; ! oi.mzCaption[0] = "Debug OFF"; ! oi.mzCaption[1] = "Debug 1"; ! oi.mzCaption[2] = "Debug 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = &mnMapMode; ! oi.mzCaption[0] = "MM 0"; ! oi.mzCaption[1] = "MM 1"; ! oi.mzCaption[2] = "MM 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbFillRangeCircles; ! oi.mzCaption[0] = "Circle sensor regions"; ! oi.mzCaption[1] = "Filled sensor regions"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbTextureMappedMaps; ! oi.mzCaption[0] = "Use bitmap maps"; ! oi.mzCaption[1] = "Use texture-mapped maps"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbUseNTDS; ! oi.mzCaption[0] = "Icon (2525B) symbols"; ! oi.mzCaption[1] = "NTDS symbols"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 4; ! oi.mnValue = 1; ! oi.mpAssociated = &mn3DCheatMode; ! oi.mzCaption[0] = "Own-alliance 3D only"; ! oi.mzCaption[1] = "Track 3D"; ! oi.mzCaption[2] = "Track 3D+"; ! oi.mzCaption[3] = "Cheat"; ! AddOption(oi); ! Serialize(true); // read option state from file (options.dat) ! // work around for sound disable via text xml file, cleanup later ! if (OptionStringExists("DisableSound")) ! { ! disableSound = true; ! maOptionInfo[3].mnValue = 1; ! Serialize(false); ! } ! return true; } /******************************************************************************/ void tcOptions::AddOption(tsOptionInfo& oi) { ! tsOptionInfo *poi; ! if (mnNumOptions >= N_OPTIONS) {return;} // no room for more options ! poi = &maOptionInfo[mnNumOptions++]; ! poi->meType = oi.meType; ! poi->mnStateCount = oi.mnStateCount; ! poi->mnValue = oi.mnValue; ! poi->mpAssociated = oi.mpAssociated; ! if (poi->mpAssociated != NULL) {*poi->mpAssociated = poi->mnValue;} ! for(int k=0;(k<poi->mnStateCount)&&(k<N_OPTION_VALUES);k++) ! { ! poi->mzCaption[k] = oi.mzCaption[k]; ! } } --- 38,174 ---- int tcOptions::Init() { ! tsOptionInfo oi; ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 2; ! oi.mpAssociated = &mnViewMode; ! oi.mzCaption[0] = "Omniscient view"; ! oi.mzCaption[1] = "Omniscient, no sensor tags"; ! oi.mzCaption[2] = "Legal view"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mnCommandMode; ! oi.mzCaption[0] = "Control all"; ! oi.mzCaption[1] = "Legal control (alliance only)"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = NULL; ! oi.mzCaption[0] = "Test 1"; ! oi.mzCaption[1] = "Test 2"; ! oi.mzCaption[2] = "Test 3"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &disableSound; ! oi.mzCaption[0] = "Sound Enabled"; ! oi.mzCaption[1] = "Sound Disabled"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbPlayMusic; ! oi.mzCaption[0] = "Music OFF"; ! oi.mzCaption[1] = "Music ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbShowMapDebug; ! oi.mzCaption[0] = "Map debug OFF"; ! oi.mzCaption[1] = "Map debug ON"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 0; ! oi.mpAssociated = &debugLevel; ! oi.mzCaption[0] = "Debug OFF"; ! oi.mzCaption[1] = "Debug 1"; ! oi.mzCaption[2] = "Debug 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 3; ! oi.mnValue = 1; ! oi.mpAssociated = &mnMapMode; ! oi.mzCaption[0] = "MM 0"; ! oi.mzCaption[1] = "MM 1"; ! oi.mzCaption[2] = "MM 2"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 0; ! oi.mpAssociated = &mbFillRangeCircles; ! oi.mzCaption[0] = "Circle sensor regions"; ! oi.mzCaption[1] = "Filled sensor regions"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbTextureMappedMaps; ! oi.mzCaption[0] = "Use bitmap maps"; ! oi.mzCaption[1] = "Use texture-mapped maps"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 2; ! oi.mnValue = 1; ! oi.mpAssociated = &mbUseNTDS; ! oi.mzCaption[0] = "Icon (2525B) symbols"; ! oi.mzCaption[1] = "NTDS symbols"; ! AddOption(oi); ! oi.meType = tsOptionInfo::OT_RADIOBUTTON; ! oi.mnStateCount = 4; ! oi.mnValue = 1; ! oi.mpAssociated = &mn3DCheatMode; ! oi.mzCaption[0] = "Own-alliance 3D only"; ! oi.mzCaption[1] = "Track 3D"; ! oi.mzCaption[2] = "Track 3D+"; ! oi.mzCaption[3] = "Cheat"; ! AddOption(oi); ! Serialize(true); // read option state from file (options.dat) ! // work around for sound disable via text xml file, cleanup later ! if (OptionStringExists("DisableSound")) ! { ! disableSound = true; ! maOptionInfo[3].mnValue = 1; ! Serialize(false); ! } ! log3DModelDetails = OptionStringExists("Log3DModelDetails"); ! ! return true; } /******************************************************************************/ void tcOptions::AddOption(tsOptionInfo& oi) { ! tsOptionInfo *poi; ! if (mnNumOptions >= N_OPTIONS) {return;} // no room for more options ! poi = &maOptionInfo[mnNumOptions++]; ! poi->meType = oi.meType; ! poi->mnStateCount = oi.mnStateCount; ! poi->mnValue = oi.mnValue; ! poi->mpAssociated = oi.mpAssociated; ! if (poi->mpAssociated != NULL) {*poi->mpAssociated = poi->mnValue;} ! for(int k=0;(k<poi->mnStateCount)&&(k<N_OPTION_VALUES);k++) ! { ! poi->mzCaption[k] = oi.mzCaption[k]; ! } } *************** *** 188,192 **** child = node->InsertEndChild(TiXmlText("default")); } ! return child->Value(); } --- 190,194 ---- child = node->InsertEndChild(TiXmlText("default")); } ! return child->Value(); } *************** *** 222,226 **** child = node->InsertEndChild(TiXmlText(optionValue)); } ! } --- 224,228 ---- child = node->InsertEndChild(TiXmlText(optionValue)); } ! } *************** *** 228,275 **** void tcOptions::Serialize(int abRead) { ! tcFile file; ! bool bWrite = !abRead; ! unsigned nReadCount; ! if (abRead) ! { // load options from file ! if (file.Open("options.dat",tcFile::modeRead)==0) ! { ! bWrite = true; // create and write defaults to file ! } ! else ! { ! for(int k=0;(k<mnNumOptions)&&(!bWrite);k++) ! { ! nReadCount = file.Read(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! if (maOptionInfo[k].mpAssociated != NULL) { ! *maOptionInfo[k].mpAssociated = maOptionInfo[k].mnValue; } ! if (nReadCount != sizeof(maOptionInfo[k].mnValue)) { ! WTL("tcOptions::Serialize - corrupt options.dat file, creating new default"); ! bWrite = true; } ! } ! file.Close(); ! } ! } ! if (bWrite) ! { ! if (file.Open("options.dat",tcFile::modeCreate|tcFile::modeWrite)==0) ! { ! WTL("tcOptions::Serialize - failed to create options.dat"); ! return; ! } ! else ! { ! for(int k=0;k<mnNumOptions;k++) ! { ! file.Write(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! } ! file.Close(); ! } ! } } --- 230,277 ---- void tcOptions::Serialize(int abRead) { ! tcFile file; ! bool bWrite = !abRead; ! unsigned nReadCount; ! if (abRead) ! { // load options from file ! if (file.Open("options.dat",tcFile::modeRead)==0) ! { ! bWrite = true; // create and write defaults to file ! } ! else ! { ! for(int k=0;(k<mnNumOptions)&&(!bWrite);k++) { ! nReadCount = file.Read(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); ! if (maOptionInfo[k].mpAssociated != NULL) ! { ! *maOptionInfo[k].mpAssociated = maOptionInfo[k].mnValue; ! } ! if (nReadCount != sizeof(maOptionInfo[k].mnValue)) ! { ! WTL("tcOptions::Serialize - corrupt options.dat file, creating new default"); ! bWrite = true; ! } } ! file.Close(); ! } ! } ! if (bWrite) ! { ! if (file.Open("options.dat",tcFile::modeCreate|tcFile::modeWrite)==0) ! { ! WTL("tcOptions::Serialize - failed to create options.dat"); ! return; ! } ! else ! { ! for(int k=0;k<mnNumOptions;k++) { ! file.Write(&maOptionInfo[k].mnValue,sizeof(maOptionInfo[k].mnValue)); } ! file.Close(); ! } ! } } *************** *** 278,288 **** void tcOptions::Synchronize() { ! for(int n=0;n<mnNumOptions;n++) ! { ! if (maOptionInfo[n].mpAssociated != NULL) ! { ! maOptionInfo[n].mnValue = *maOptionInfo[n].mpAssociated; ! } ! } } /******************************************************************************/ --- 280,290 ---- void tcOptions::Synchronize() { ! for(int n=0;n<mnNumOptions;n++) ! { ! if (maOptionInfo[n].mpAssociated != NULL) ! { ! maOptionInfo[n].mnValue = *maOptionInfo[n].mpAssociated; ! } ! } } /******************************************************************************/ *************** *** 328,332 **** if (childNode) { ! fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); } */ --- 330,334 ---- if (childNode) { ! fprintf(stdout, "TEST VALUE: [%s]\n", childNode->Value()); } */ |
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689/src/database Modified Files: tcGenericDBObject.cpp tcLauncherDBObject.cpp tcMissileDBObject.cpp tcSonarDBObject.cpp tcTorpedoDBObject.cpp tcWeaponDBObject.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcLauncherDBObject.cpp 5 Dec 2004 02:49:47 -0000 1.12 --- tcLauncherDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.13 *************** *** 104,108 **** *csv >> s; mzChildClass = s.c_str(); *csv >> fireControlSensorClass; ! *csv >> s; displayName = s.c_str(); int i; mnConfigurations = 0; --- 104,108 ---- *csv >> s; mzChildClass = s.c_str(); *csv >> fireControlSensorClass; ! int i; mnConfigurations = 0; *************** *** 125,129 **** *csv << mzChildClass.mz; *csv << fireControlSensorClass; - *csv << displayName; for(unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) --- 125,128 ---- *************** *** 160,164 **** localNode->SetAttribute("childClass", mzChildClass.mz); localNode->SetAttribute("fcSensorClass", fireControlSensorClass); - localNode->SetAttribute("displayName", displayName); for(unsigned int i=0;(i<mnConfigurations)&&(i<MAX_LAUNCHER_CONFIGURATIONS);i++) --- 159,162 ---- *************** *** 182,186 **** *csv << "Basic class"; *csv << "Fire control sensor class"; - *csv << "Display name"; for (unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) --- 180,183 ---- *************** *** 211,215 **** columnString += "BasicClass varchar(30),"; columnString += "FireControlSens varchar(30),"; - columnString += "DisplayName varchar(30),"; for(unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) --- 208,211 ---- *************** *** 233,237 **** mzChildClass = entry.GetString("BasicClass").c_str(); fireControlSensorClass = entry.GetString("FireControlSens"); - displayName = entry.GetString("DisplayName"); mnConfigurations = 0; --- 229,232 ---- *************** *** 265,269 **** s << "'" << mzChildClass.mz << "',"; s << "'" << fireControlSensorClass << "',"; - s << "'" << displayName << "',"; for(unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) --- 260,263 ---- *************** *** 295,299 **** mzChildClass = "NOCHILDCLASS"; fireControlSensorClass = ""; ! displayName = ""; for(unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) { --- 289,293 ---- mzChildClass = "NOCHILDCLASS"; fireControlSensorClass = ""; ! for(unsigned i=0;i<MAX_LAUNCHER_CONFIGURATIONS;i++) { *************** *** 318,322 **** mnConfigurations = obj.mnConfigurations; fireControlSensorClass = obj.fireControlSensorClass; - displayName = obj.displayName; } --- 312,315 ---- Index: tcSonarDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSonarDBObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSonarDBObject.cpp 2 Dec 2004 04:17:24 -0000 1.1 --- tcSonarDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.2 *************** *** 170,173 **** --- 170,180 ---- columnString += "maxFrequency_Hz number(5),"; columnString += "isPassive number(1),"; + columnString += "isActive number(1),"; + columnString += "isTowed number(1),"; + columnString += "maxScope_m number(4),"; + columnString += "isWakeHoming number(1),"; + columnString += "applyScanLoss number(1),"; + columnString += "bearingResolution_deg number(5),"; + columnString += "audioFile varchar(30)"; } *************** *** 184,187 **** --- 191,202 ---- maxFrequency_Hz = entry.GetDouble("maxFrequency_Hz"); isPassive = entry.GetInt("isPassive") != 0; + + isActive = entry.GetInt("isActive") != 0; + isTowed = entry.GetInt("isTowed") != 0; + maxScope_m = entry.GetDouble("maxScope_m"); + isWakeHoming = entry.GetInt("isWakeHoming") != 0; + applyScanLoss = entry.GetInt("applyScanLoss") != 0; + bearingResolution_deg = entry.GetDouble("bearingResolution_deg"); + audioFile = entry.GetString("audioFile"); } *************** *** 202,205 **** --- 217,229 ---- s << maxFrequency_Hz << ","; s << (long)isPassive << ","; + + s << (long)isActive << ","; + s << (long)isTowed << ","; + s << maxScope_m << ","; + s << (long)isWakeHoming << ","; + s << (long)applyScanLoss << ","; + s << bearingResolution_deg << ","; + + s << "'" << audioFile.c_str() << "'"; *************** *** 214,218 **** minFrequency_Hz(2000), maxFrequency_Hz(3000), ! isPassive(false) { mzClass = "Default Sonar"; --- 238,248 ---- minFrequency_Hz(2000), maxFrequency_Hz(3000), ! isPassive(false), ! isActive(true), ! isTowed(false), ! maxScope_m(0), ! isWakeHoming(false), ! applyScanLoss(false), ! bearingResolution_deg(5.0f) { mzClass = "Default Sonar"; *************** *** 233,237 **** minFrequency_Hz(obj.minFrequency_Hz), maxFrequency_Hz(obj.maxFrequency_Hz), ! isPassive(obj.isPassive) { mnClassID = DTYPE_SONAR; --- 263,273 ---- minFrequency_Hz(obj.minFrequency_Hz), maxFrequency_Hz(obj.maxFrequency_Hz), ! isPassive(obj.isPassive), ! isActive(obj.isActive), ! isTowed(obj.isTowed), ! maxScope_m(obj.maxScope_m), ! isWakeHoming(obj.isWakeHoming), ! applyScanLoss(obj.applyScanLoss), ! bearingResolution_deg(obj.bearingResolution_deg) { mnClassID = DTYPE_SONAR; Index: tcWeaponDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcWeaponDBObject.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcWeaponDBObject.cpp 29 Nov 2004 03:55:05 -0000 1.6 --- tcWeaponDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.7 *************** *** 112,115 **** --- 112,116 ---- localNode->SetAttribute("mfDamage" , mfDamage); localNode->SetAttribute("launchSpeed_mps" , launchSpeed_mps); + localNode->SetAttribute("targetFlags" , targetFlags); tcDatabaseObject::SerializeXml(node, load); *************** *** 122,125 **** --- 123,127 ---- *csv << "Damage"; *csv << "Launch Speed [m/s]"; + *csv << "Target Flags"; return 1; } *************** *** 136,140 **** columnString += "Damage number(5),"; ! columnString += "LaunchSpeed_mps number(5)"; } --- 138,143 ---- columnString += "Damage number(5),"; ! columnString += "LaunchSpeed_mps number(5),"; ! columnString += "targetFlags number(5)"; } *************** *** 145,148 **** --- 148,152 ---- mfDamage = entry.GetDouble("Damage"); launchSpeed_mps = entry.GetDouble("LaunchSpeed_mps"); + targetFlags = entry.GetInt("targetFlags"); } *************** *** 157,161 **** s << mfDamage << ","; ! s << launchSpeed_mps; valueString += s.str(); --- 161,166 ---- s << mfDamage << ","; ! s << launchSpeed_mps << ","; ! s << targetFlags; valueString += s.str(); *************** *** 163,173 **** ! tcWeaponDBObject::tcWeaponDBObject() : tcDatabaseObject() { mzClass = "Default weapon"; mnClassID = DTYPE_WEAPON; - - mfDamage = 1.0; - launchSpeed_mps = 0; } --- 168,178 ---- ! tcWeaponDBObject::tcWeaponDBObject() : tcDatabaseObject(), ! mfDamage(1.0), ! launchSpeed_mps(0), ! targetFlags(0) { mzClass = "Default weapon"; mnClassID = DTYPE_WEAPON; } *************** *** 178,181 **** --- 183,187 ---- mfDamage = obj.mfDamage; launchSpeed_mps = obj.launchSpeed_mps; + targetFlags = obj.targetFlags; } Index: tcMissileDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcMissileDBObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMissileDBObject.cpp 29 Nov 2004 03:55:04 -0000 1.14 --- tcMissileDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.15 *************** *** 154,161 **** file.Read(&maFlightProfile[i],sizeof(tsMissileFlightSegment)); } - if (anVersion >= VERSION_1_0_3) - { - file.Read(&mnTargetFlags,sizeof(mnTargetFlags)); - } } else --- 154,157 ---- *************** *** 186,192 **** file.Write(&maFlightProfile[i],sizeof(tsMissileFlightSegment)); } - if (anVersion >= VERSION_1_0_3) { - file.Write(&mnTargetFlags,sizeof(mnTargetFlags)); - } } return true; --- 182,185 ---- *************** *** 240,244 **** } - *csv >> mnTargetFlags; // set other params that do not come from database file --- 233,236 ---- *************** *** 285,289 **** } } - *csv << (long)mnTargetFlags; csv->WriteLine(); --- 277,280 ---- *************** *** 426,434 **** columnString += s.GetBuffer(); ! s.Format("GuidMode%d number(2),",i+1); columnString += s.GetBuffer(); - } ! columnString += "TargetFlags number(5)"; } --- 417,428 ---- columnString += s.GetBuffer(); ! s.Format("GuidMode%d number(2)",i+1); columnString += s.GetBuffer(); ! if (i < MAX_MISSILE_FLIGHT_SEGMENTS-1) ! { ! columnString += ","; ! } ! } } *************** *** 477,484 **** } - mnTargetFlags = entry.GetInt("TargetFlags"); // set other params that do not come from database file ! primarySeekerKey = NULL_INDEX; // what IS this? } --- 471,477 ---- } // set other params that do not come from database file ! primarySeekerKey = NULL_INDEX; } *************** *** 519,523 **** s << maFlightProfile[i].mfAltitude_m << ","; s << (long)maFlightProfile[i].meAltitudeMode << ","; ! s << (long)maFlightProfile[i].meGuidanceMode << ","; } else --- 512,516 ---- s << maFlightProfile[i].mfAltitude_m << ","; s << (long)maFlightProfile[i].meAltitudeMode << ","; ! s << (long)maFlightProfile[i].meGuidanceMode; } else *************** *** 526,533 **** s << "0,"; s << "0,"; ! s << "0,"; ! } ! } ! s << (long)mnTargetFlags; valueString += s.str(); --- 519,531 ---- s << "0,"; s << "0,"; ! s << "0"; ! } ! ! if (i < MAX_MISSILE_FLIGHT_SEGMENTS-1) ! { ! s << ","; ! } ! ! } valueString += s.str(); *************** *** 557,564 **** mfSustTime_s = obj.mfSustTime_s; mfShutdownSpeed_mps = obj.mfShutdownSpeed_mps; ! ! //mfDamage = obj.mfDamage; ! //meDamageType = obj.meDamageType; ! mnTargetFlags = obj.mnTargetFlags; mfRcs_dbsm = obj.mfRcs_dbsm; mfRange_km = obj.mfRange_km; --- 555,559 ---- mfSustTime_s = obj.mfSustTime_s; mfShutdownSpeed_mps = obj.mfShutdownSpeed_mps; ! mfRcs_dbsm = obj.mfRcs_dbsm; mfRange_km = obj.mfRange_km; Index: tcTorpedoDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcTorpedoDBObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcTorpedoDBObject.cpp 5 Dec 2004 02:58:25 -0000 1.1 --- tcTorpedoDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #include "tcTorpedoDBObject.h" + #include "tcSonarDBObject.h" #include "math_constants.h" #include "randfn.h" *************** *** 50,57 **** { maxTurnRate_radps = C_PIOVER180 * maxTurnRate_degps; ! fuelRate_kgpktps = fuelRate_kgps / maxSpeed_kts; } /** * workaround for write serialization issue --- 51,68 ---- { maxTurnRate_radps = C_PIOVER180 * maxTurnRate_degps; ! batteryRate_kWpkt = batteryRate_kW / maxSpeed_kts; ! ! // calculate range for simple model (overwrite param loaded from db) ! mfRange_km = (battery_kJ / batteryRate_kW) * maxSpeed_kts * 0.001f * C_KTSTOMPS; ! } + tcSonarDBObject* tcTorpedoDBObject::GetSeekerDBObj() const + { + wxASSERT(database); + return dynamic_cast<tcSonarDBObject*>(database->GetObject(sonarClass)); + } + /** * workaround for write serialization issue *************** *** 105,125 **** localNode->SetAttribute("maxDepth_m", maxDepth_m); localNode->SetAttribute("maxThrust_N", maxThrust_N); ! localNode->SetAttribute("fuel_kg", fuel_kg); ! localNode->SetAttribute("fuelRate_kgps", fuelRate_kgps); localNode->SetAttribute("maxSpeed_kts", maxSpeed_kts); localNode->SetAttribute("acceleration_ktsps", acceleration_ktsps); localNode->SetAttribute("mfRange_km", mfRange_km); localNode->SetAttribute("sonarClass", sonarClass.c_str()); ! ! ! for(size_t i=0; (i<defaultProfile.size())&&(i<MAX_TORPEDO_SEGMENTS); i++) ! { ! TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("segment"))->ToElement(); ! ! childNode->SetAttribute("range_km", defaultProfile[i].range_km); ! childNode->SetAttribute("depth_m", defaultProfile[i].depth_m); ! childNode->SetAttribute("thrust", defaultProfile[i].thrust); ! childNode->SetAttribute("guidanceMode", (int)defaultProfile[i].meGuidanceMode); ! } tcWeaponDBObject::SerializeXml(node, load); --- 116,127 ---- localNode->SetAttribute("maxDepth_m", maxDepth_m); localNode->SetAttribute("maxThrust_N", maxThrust_N); ! localNode->SetAttribute("battery_kJ", battery_kJ); ! localNode->SetAttribute("batteryRate_kW", batteryRate_kW); localNode->SetAttribute("maxSpeed_kts", maxSpeed_kts); localNode->SetAttribute("acceleration_ktsps", acceleration_ktsps); localNode->SetAttribute("mfRange_km", mfRange_km); localNode->SetAttribute("sonarClass", sonarClass.c_str()); ! localNode->SetAttribute("wireGuidance", wireGuidance); ! localNode->SetAttribute("preEnableSpeed_kts", preEnableSpeed_kts); tcWeaponDBObject::SerializeXml(node, load); *************** *** 143,177 **** columnString += "maxDepth_m number(8),"; columnString += "maxThrust_N number(8),"; ! columnString += "fuel_kg number(8),"; ! columnString += "fuelRate_kgps number(8),"; columnString += "maxSpeed_kts number(8),"; columnString += "acceleration_ktsps number(8),"; columnString += "mfRange_km number(8),"; columnString += "sonarClass varchar(30),"; ! ! ! ! for(unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) ! { ! tcString s; ! ! s.Format("Range%d_km number(5),",i+1); ! columnString += s.GetBuffer(); ! ! s.Format("Depth%d_m number(4),",i+1); ! columnString += s.GetBuffer(); ! ! s.Format("Thrust%d number(5),",i+1); ! columnString += s.GetBuffer(); ! ! s.Format("GuidMode%d number(2)",i+1); ! columnString += s.GetBuffer(); ! ! if (i < MAX_TORPEDO_SEGMENTS - 1) ! { ! columnString += ","; ! } ! } ! } --- 145,156 ---- columnString += "maxDepth_m number(8),"; columnString += "maxThrust_N number(8),"; ! columnString += "battery_kJ number(8),"; ! columnString += "batteryRate_kW number(8),"; columnString += "maxSpeed_kts number(8),"; columnString += "acceleration_ktsps number(8),"; columnString += "mfRange_km number(8),"; columnString += "sonarClass varchar(30),"; ! columnString += "wireGuidance number(1),"; ! columnString += "preEnableSpeed_kts number(3)"; } *************** *** 185,220 **** maxDepth_m = entry.GetDouble("maxDepth_m"); maxThrust_N = entry.GetDouble("maxThrust_N"); ! fuel_kg = entry.GetDouble("fuel_kg"); ! fuelRate_kgps = entry.GetDouble("fuelRate_kgps"); maxSpeed_kts = entry.GetDouble("maxSpeed_kts"); acceleration_ktsps = entry.GetDouble("acceleration_ktsps"); mfRange_km = entry.GetDouble("mfRange_km"); sonarClass = entry.GetString("sonarClass"); ! ! defaultProfile.clear(); ! ! for (unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) ! { ! float range, depth, thrust; ! int guidanceMode; ! ! range = entry.GetDouble("Range%d_km", i+1); ! depth = entry.GetDouble("Depth%d_m", i+1); ! thrust = entry.GetDouble("Thrust%d", i+1); ! guidanceMode = entry.GetInt("GuidMode%d", i+1); ! ! if ((range > 0)||(depth > 0)||(thrust > 0)) ! { ! tsTorpedoSegment seg; ! ! seg.range_km = range; ! seg.depth_m = depth; ! seg.thrust = thrust; ! seg.meGuidanceMode = (TorpedoGuidanceMode)guidanceMode; ///< guidance mode ! ! defaultProfile.push_back(seg); ! } ! ! } } --- 164,175 ---- maxDepth_m = entry.GetDouble("maxDepth_m"); maxThrust_N = entry.GetDouble("maxThrust_N"); ! battery_kJ = entry.GetDouble("battery_kJ"); ! batteryRate_kW = entry.GetDouble("batteryRate_kW"); maxSpeed_kts = entry.GetDouble("maxSpeed_kts"); acceleration_ktsps = entry.GetDouble("acceleration_ktsps"); mfRange_km = entry.GetDouble("mfRange_km"); sonarClass = entry.GetString("sonarClass"); ! wireGuidance = entry.GetInt("wireGuidance") != 0; ! preEnableSpeed_kts = entry.GetDouble("preEnableSpeed_kts"); } *************** *** 233,264 **** s << maxDepth_m << ","; s << maxThrust_N << ","; ! s << fuel_kg << ","; ! s << fuelRate_kgps << ","; s << maxSpeed_kts << ","; s << acceleration_ktsps << ","; s << mfRange_km << ","; s << "'" << sonarClass.c_str() << "'" << ","; ! ! for (unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) ! { ! if (i < defaultProfile.size()) ! { ! s << defaultProfile[i].range_km << ","; ! s << defaultProfile[i].depth_m << ","; ! s << defaultProfile[i].thrust << ","; ! s << (long)defaultProfile[i].meGuidanceMode; ! } ! else ! { ! s << "0,"; ! s << "0,"; ! s << "0,"; ! s << "0"; ! } ! if (i < MAX_TORPEDO_SEGMENTS - 1) ! { ! s << ","; ! } ! } --- 188,199 ---- s << maxDepth_m << ","; s << maxThrust_N << ","; ! s << battery_kJ << ","; ! s << batteryRate_kW << ","; s << maxSpeed_kts << ","; s << acceleration_ktsps << ","; s << mfRange_km << ","; s << "'" << sonarClass.c_str() << "'" << ","; ! s << wireGuidance << ","; ! s << preEnableSpeed_kts; *************** *** 275,284 **** maxDepth_m(obj.maxDepth_m), maxThrust_N(obj.maxThrust_N), ! fuel_kg(obj.fuel_kg), ! fuelRate_kgps(obj.fuelRate_kgps), maxSpeed_kts(obj.maxSpeed_kts), acceleration_ktsps(obj.acceleration_ktsps), mfRange_km(obj.mfRange_km), ! sonarClass(obj.sonarClass) { mnClassID = DTYPE_TORPEDO; --- 210,221 ---- maxDepth_m(obj.maxDepth_m), maxThrust_N(obj.maxThrust_N), ! battery_kJ(obj.battery_kJ), ! batteryRate_kW(obj.batteryRate_kW), maxSpeed_kts(obj.maxSpeed_kts), acceleration_ktsps(obj.acceleration_ktsps), mfRange_km(obj.mfRange_km), ! sonarClass(obj.sonarClass), ! wireGuidance(obj.wireGuidance), ! preEnableSpeed_kts(obj.preEnableSpeed_kts) { mnClassID = DTYPE_TORPEDO; *************** *** 295,304 **** maxDepth_m(500), maxThrust_N(100), ! fuel_kg(100), ! fuelRate_kgps(1), maxSpeed_kts(40), acceleration_ktsps(3), mfRange_km(10), ! sonarClass("") { mnClassID = DTYPE_TORPEDO; --- 232,243 ---- maxDepth_m(500), maxThrust_N(100), ! battery_kJ(100), ! batteryRate_kW(1), maxSpeed_kts(40), acceleration_ktsps(3), mfRange_km(10), ! sonarClass(""), ! wireGuidance(false), ! preEnableSpeed_kts(35) { mnClassID = DTYPE_TORPEDO; Index: tcGenericDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcGenericDBObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcGenericDBObject.cpp 29 Nov 2004 03:55:04 -0000 1.15 --- tcGenericDBObject.cpp 7 Dec 2004 04:00:28 -0000 1.16 *************** *** 600,603 **** --- 600,606 ---- columnString += s.GetBuffer(); + s.Format("L%d_name varchar(30),",i+1); + columnString += s.GetBuffer(); + s.Format("L%d_az number(8),",i+1); columnString += s.GetBuffer(); *************** *** 673,679 **** --- 676,685 ---- int i; mnNumLaunchers = 0; + launcherName.clear(); + for(i=0;i<MAXLAUNCHERS;i++) { std::string launcherClass; + std::string displayName; tcString s; *************** *** 681,688 **** --- 687,700 ---- launcherClass = entry.GetString(s.GetBuffer()); + s.Format("L%d_name",i+1); + displayName = entry.GetString(s.GetBuffer()); + + if (launcherClass.size() > 0) { maLauncherClass[mnNumLaunchers] = launcherClass.c_str(); + launcherName.push_back(displayName); + s.Format("L%d_az",i+1); launcherAz[mnNumLaunchers] = entry.GetDouble(s.GetBuffer()); *************** *** 796,799 **** --- 808,812 ---- { s << "'" << string(maLauncherClass[i].mz) << "',"; + s << "'" << launcherName[i].c_str() << "',"; s << launcherAz[i] << ","; s << launcherPosition[i].x << ","; *************** *** 804,807 **** --- 817,821 ---- { s << "'',"; + s << "'',"; s << "0,"; s << "0,"; *************** *** 913,919 **** mnNumSensors = obj.mnNumSensors; int i; ! for(i=0;i<MAXLAUNCHERS;i++) { maLauncherClass[i] = obj.maLauncherClass[i]; launcherAz[i] = obj.launcherAz[i]; launcherPosition[i] = obj.launcherPosition[i]; --- 927,934 ---- mnNumSensors = obj.mnNumSensors; int i; ! for(i=0;i<mnNumLaunchers;i++) { maLauncherClass[i] = obj.maLauncherClass[i]; + launcherName[i] = obj.launcherName[i]; launcherAz[i] = obj.launcherAz[i]; launcherPosition[i] = obj.launcherPosition[i]; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 04:01:11
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13689 Modified Files: GCblue.vcproj Log Message: Sonar work, passive sonar, torpedoes Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** GCblue.vcproj 5 Dec 2004 02:49:45 -0000 1.75 --- GCblue.vcproj 7 Dec 2004 04:00:27 -0000 1.76 *************** *** 312,315 **** --- 312,318 ---- </File> <File + RelativePath=".\src\graphics\tcLauncherPopup.cpp"> + </File> + <File RelativePath="src\graphics\tcMapObject.cpp"> </File> *************** *** 1206,1209 **** --- 1209,1215 ---- </File> <File + RelativePath=".\include\graphics\tcLauncherPopup.h"> + </File> + <File RelativePath="include\graphics\tcMapObject.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 03:59:47
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13413/include/database Modified Files: tcGenericDBObject.h tcLauncherDBObject.h tcMissileDBObject.h tcSonarDBObject.h tcTorpedoDBObject.h tcWeaponDBObject.h Log Message: Sonar work, passive sonar, torpedoes Index: tcSonarDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSonarDBObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcSonarDBObject.h 5 Dec 2004 02:49:46 -0000 1.2 --- tcSonarDBObject.h 7 Dec 2004 03:59:07 -0000 1.3 *************** *** 48,56 **** float maxFrequency_Hz; bool isPassive; ! //bool isActive ///< both isActive and isPassive indicate selectable ! //bool isTowed; ! //float maxTowedScope_m; ! //bool applyScanLoss; ! //float bearingResolution_deg; std::string audioFile; ///< filename for audio sound effect (active only) --- 48,57 ---- float maxFrequency_Hz; bool isPassive; ! bool isActive; ///< both isActive and isPassive indicate selectable at launch ! bool isTowed; ! float maxScope_m; ///< towed array scope or dipping sonar "scope" ! bool isWakeHoming; ///< wake homing vs. surface only ! bool applyScanLoss; ! float bearingResolution_deg; std::string audioFile; ///< filename for audio sound effect (active only) *************** *** 59,63 **** float alpha; ///< CALCULATED attenuation coefficent in dB/km ! // float bearingResolution_rad; ///< CALCULATED virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method --- 60,64 ---- float alpha; ///< CALCULATED attenuation coefficent in dB/km ! float bearingResolution_rad; ///< CALCULATED virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method Index: tcGenericDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcGenericDBObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcGenericDBObject.h 29 Nov 2004 03:54:49 -0000 1.12 --- tcGenericDBObject.h 7 Dec 2004 03:59:07 -0000 1.13 *************** *** 51,55 **** enum { ! MAXLAUNCHERS = 8, MAXSENSORS = 8, MAXANIMATIONS = 4, --- 51,55 ---- enum { ! MAXLAUNCHERS = 10, MAXSENSORS = 8, MAXANIMATIONS = 4, *************** *** 79,82 **** --- 79,83 ---- std::vector<long> sensorId; ///< database id's of sensors + std::vector<std::string> launcherName; ///< display names of launchers, e.g. "Tube 1" float launcherAz[MAXLAUNCHERS]; ///< pointing angles of launchers in degrees tc3DPoint launcherPosition[MAXLAUNCHERS]; ///< relative position of launchers in meters Index: tcTorpedoDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcTorpedoDBObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcTorpedoDBObject.h 5 Dec 2004 02:58:24 -0000 1.1 --- tcTorpedoDBObject.h 7 Dec 2004 03:59:07 -0000 1.2 *************** *** 35,39 **** { class tcSqlReader; ! --- 35,39 ---- { class tcSqlReader; ! class tcSonarDBObject; *************** *** 44,68 **** { public: - enum {MAX_TORPEDO_SEGMENTS = 4}; - /** - * Determines guidance type that is used flight segment. - */ - enum TorpedoGuidanceMode - { - GM_COMMAND = 0, ///< command guidance - GM_NAV = 1, ///< inertial - GM_SENSOR = 2 ///< use primary sensor - }; - /** - * Info that controls torpedo behavior for segment. - */ - struct tsTorpedoSegment - { - float range_km; ///< min range for this segment - float depth_m; ///< depth for segment - float thrust; /// relative thrust for segment, 0-1.0 - TorpedoGuidanceMode meGuidanceMode; ///< guidance mode - }; - // model parameters float mass_kg; ///< mass before launch, fuel assumed 0 kg --- 44,47 ---- *************** *** 72,80 **** float maxThrust_N; ///< max thrust [N] ! float fuel_kg; ! float fuelRate_kgps; ///< fuel rate at max thrust float maxSpeed_kts; ! float acceleration_ktsps; ///< for simple model only float mfRange_km; ///< [km] nominal range --- 51,59 ---- float maxThrust_N; ///< max thrust [N] ! float battery_kJ; ///< battery charge ! float batteryRate_kW; ///< battery rate at max thrust float maxSpeed_kts; ! float acceleration_ktsps; ///< for simple model only float mfRange_km; ///< [km] nominal range *************** *** 83,96 **** std::string sonarClass; ! /// flight profile, array of flight segment info ! std::vector<tsTorpedoSegment> defaultProfile; ///< default maneuver profile /// calculated parameters float maxTurnRate_radps; ///< CALCULATED ! float fuelRate_kgpktps; ///< [kg / kt / s] CALCULATED virtual const char* GetClassName() {return "Torpedo";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj ! virtual void PrintToFile(tcFile& file); --- 62,75 ---- std::string sonarClass; ! bool wireGuidance; ///< true if wire guidance available ! float preEnableSpeed_kts; ///< default pre-enable speed /// calculated parameters float maxTurnRate_radps; ///< CALCULATED ! float batteryRate_kWpkt; ///< [kW / kt] CALCULATED virtual const char* GetClassName() {return "Torpedo";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj ! tcSonarDBObject* GetSeekerDBObj() const; virtual void PrintToFile(tcFile& file); Index: tcLauncherDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcLauncherDBObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcLauncherDBObject.h 29 Nov 2004 03:54:49 -0000 1.9 --- tcLauncherDBObject.h 7 Dec 2004 03:59:07 -0000 1.10 *************** *** 50,54 **** std::string fireControlSensorClass; ///< class of sensor on platform for fire control ///< (track required to launch) - std::string displayName; ///< name to display in vehicle controls virtual const char* GetClassName() {return "Launcher";} ///< returns class name of database object --- 50,53 ---- Index: tcWeaponDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcWeaponDBObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcWeaponDBObject.h 29 Nov 2004 03:54:49 -0000 1.4 --- tcWeaponDBObject.h 7 Dec 2004 03:59:07 -0000 1.5 *************** *** 33,36 **** --- 33,43 ---- namespace Database { + + #define SURFACE_TARGET 0x0001 + #define AIR_TARGET 0x0002 + #define LAND_TARGET 0x0004 + #define MISSILE_TARGET 0x0008 + #define SUBSURFACE_TARGET 0x0010 + class tcSqlReader; *************** *** 40,43 **** --- 47,51 ---- float mfDamage; ///< damage value float launchSpeed_mps; ///< initial speed at launch, use zero to use plat speed + int targetFlags; ///< 0x01 surf, 0x02 air, 0x04 land, 0x08 missile, 0x10 sub virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcMissileDBObject.h 5 Dec 2004 02:49:46 -0000 1.15 --- tcMissileDBObject.h 7 Dec 2004 03:59:07 -0000 1.16 *************** *** 97,106 **** }; - /// these need to be moved to a common area - #define SURFACE_TARGET 0x0001 - #define AIR_TARGET 0x0002 - #define LAND_TARGET 0x0004 - #define MISSILE_TARGET 0x0008 - #define SUBSURFACE_TARGET 0x0010 class tcMissileDBObject : public tcWeaponDBObject --- 97,100 ---- *************** *** 127,131 **** //float mfDamage; ///< damage value //teDamageType meDamageType; ///< damage type enumeration - int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x04 - land float mfRcs_dbsm; ///< radar cross section, [dBsm] float mfRange_km; ///< [km] nominal range --- 121,124 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 03:59:45
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13413/include/common Modified Files: tcOptions.h Log Message: Sonar work, passive sonar, torpedoes Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcOptions.h 6 Nov 2004 15:13:39 -0000 1.9 --- tcOptions.h 7 Dec 2004 03:59:05 -0000 1.10 *************** *** 76,79 **** --- 76,81 ---- int mn3DCheatMode; + bool log3DModelDetails; ///< true to write detailed info to stdout.txt while loading 3D models + tsOptionInfo maOptionInfo[N_OPTIONS]; int mnNumOptions; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 03:59:25
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13413/include/sim Modified Files: tcLauncher.h tcLauncherState.h tcTorpedoObject.h Log Message: Sonar work, passive sonar, torpedoes Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcLauncher.h 5 Dec 2004 02:49:46 -0000 1.7 --- tcLauncher.h 7 Dec 2004 03:59:14 -0000 1.8 *************** *** 55,60 **** --- 55,78 ---- { public: + enum teLauncherStatus + { + LAUNCHER_READY = 0, + BAD_LAUNCHER = 1, ///< launcher index does not exist + LAUNCHER_EMPTY = 2, + LAUNCHER_BUSY = 3, ///< launcher reloading + NO_DATUM = 4, + NO_TARGET = 5, + NOT_DETECTED_FC = 6, ///< fire control sensor can't detect target (could be off) + NOT_DETECTED_SEEKER = 7, ///< seeker can't detect target + FC_BUSY = 8, ///< fire control sensor has no free tracks + LAUNCHER_ERROR = 9, + LAUNCHER_INACTIVE = 10, + NO_FIRECONTROL = 11, + TOO_DEEP = 12 ///< too deep for sub launch + }; ///< launcher status codes + int mbActive; + std::string displayName; long mnDBKey; ///< key in launcher database tcLauncherDBObject *mpLauncherDBObj; *************** *** 78,81 **** --- 96,107 ---- unsigned fireControlSensorIdx; ///< index of sensor on parent platform + // torpedo programming params + bool usePassive; + float preEnableSpeed_kts; + float runDepth_m; + float ceiling_m; + float floor_m; + float runToEnable_m; + tcCommandStream& operator<<(tcCommandStream& stream); tcCreateStream& operator<<(tcCreateStream& stream); *************** *** 89,105 **** void CopyCommandInfoFrom(const tcLauncher& launcher); std::string GetChildClassName() const; float GetCycleTime() const; int GetErrorCode() const {return errorCode;} void SetErrorCode(int code) {errorCode = code;} void SetChildClass(const std::string& childClass); void SetChildQuantity(unsigned int quantity); void SetLoadState(bool state); unsigned int GetCompatibleCount() const; std::string GetCompatibleName(unsigned int idx) const; bool IsItemCompatible(const std::string& item) const; tcLauncher(); ! tcLauncher(tcLauncherDBObject* dbObj); ~tcLauncher(); }; --- 115,140 ---- void CopyCommandInfoFrom(const tcLauncher& launcher); std::string GetChildClassName() const; + const std::string& GetLauncherName() const; float GetCycleTime() const; int GetErrorCode() const {return errorCode;} + int GetLauncherStatus(); + void SetErrorCode(int code) {errorCode = code;} void SetChildClass(const std::string& childClass); void SetChildQuantity(unsigned int quantity); void SetLoadState(bool state); + void SetParent(tcGameObject *obj); unsigned int GetCompatibleCount() const; std::string GetCompatibleName(unsigned int idx) const; bool IsItemCompatible(const std::string& item) const; + static std::string TranslateStatus(int status); + tcLauncher(); ! tcLauncher(tcLauncherDBObject* dbObj, tcGameObject* par); ~tcLauncher(); + private: + tcGameObject* parent; + static tcSimState* simState; }; Index: tcTorpedoObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcTorpedoObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcTorpedoObject.h 5 Dec 2004 02:58:24 -0000 1.1 --- tcTorpedoObject.h 7 Dec 2004 03:59:14 -0000 1.2 *************** *** 53,57 **** { SEARCH_STRAIGHT = 0, ! SEARCH_S = 1, SEARCH_LEFTCIRCLE = 2, SEARCH_RIGHTCIRCLE = 3 --- 53,57 ---- { SEARCH_STRAIGHT = 0, ! SEARCH_SNAKE = 1, SEARCH_LEFTCIRCLE = 2, SEARCH_RIGHTCIRCLE = 3 *************** *** 70,78 **** tsGeoPoint waypoint; // nav datum ! float rangeToObjective_km; // for segment determination ! unsigned int currentSegment; tcSonar seeker; ! float fuel_kg; float searchHeading_rad; ///< center of "S" sector to search int searchMode; --- 70,81 ---- tsGeoPoint waypoint; // nav datum ! float runToEnable_m; ! float ceiling_m; // min depth ! float floor_m; // max depth ! bool isWireActive; // true if wire is available to receive remote commands ! tcSonar seeker; ! float battery_kJ; ///< current battery charge float searchHeading_rad; ///< center of "S" sector to search int searchMode; *************** *** 88,92 **** virtual void UpdateGuidance(double t); virtual void SetHeading(float newHeading); - int GetCurrentGuidanceMode(); virtual void SetSpeed(float newSpeed); virtual tcSonar* GetSensorState(); --- 91,94 ---- Index: tcLauncherState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncherState.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcLauncherState.h 5 Dec 2004 02:49:46 -0000 1.12 --- tcLauncherState.h 7 Dec 2004 03:59:14 -0000 1.13 *************** *** 58,79 **** { public: - enum teLauncherStatus - { - LAUNCHER_READY = 0, - BAD_LAUNCHER = 1, ///< launcher index does not exist - LAUNCHER_EMPTY = 2, - LAUNCHER_BUSY = 3, ///< launcher reloading - NO_DATUM = 4, - NO_TARGET = 5, - NOT_DETECTED_FC = 6, ///< fire control sensor can't detect target (could be off) - NOT_DETECTED_SEEKER = 7, ///< seeker can't detect target - FC_BUSY = 8, ///< fire control sensor has no free tracks - LAUNCHER_ERROR = 9, - LAUNCHER_INACTIVE = 10, - NO_FIRECONTROL = 11, - TOO_DEEP = 12 ///< too deep for sub launch - }; ///< launcher status codes - - tcGameObject *parent; int mnCount; --- 58,61 ---- *************** *** 83,87 **** static void AttachSimState(tcSimState* ss) {simState = ss;} ! void AddFullLauncher(tnPoolIndex anKey, float azimuth_rad); float EstimateInterceptTimeForLauncher(unsigned nLauncher, tcTrack& track); const char* GetFireControlSensorClass(unsigned nLauncher) const; --- 65,69 ---- static void AttachSimState(tcSimState* ss) {simState = ss;} ! void AddFullLauncher(tnPoolIndex anKey, float azimuth_rad, const std::string& displayName); float EstimateInterceptTimeForLauncher(unsigned nLauncher, tcTrack& track); const char* GetFireControlSensorClass(unsigned nLauncher) const; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 03:59:24
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13413/include/graphics Modified Files: tcMapView.h tcOOBView.h Added Files: tcLauncherPopup.h Log Message: Sonar work, passive sonar, torpedoes Index: tcOOBView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcOOBView.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcOOBView.h 7 Oct 2004 22:01:12 -0000 1.2 --- tcOOBView.h 7 Dec 2004 03:59:08 -0000 1.3 *************** *** 96,99 **** --- 96,100 ---- void OnLButtonDown(wxMouseEvent& event); void OnLButtonUp(wxMouseEvent& event); + void OnMouseMove(wxMouseEvent& event); void SetHookID(long id) {mnSelectedKey = id;} tcOOBView(wxWindow *parent, --- NEW FILE: tcLauncherPopup.h --- /** ** @file tcLauncherPopup.h */ /* 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 */ #ifndef _LAUNCHERPOPUP_H_ #define _LAUNCHERPOPUP_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/string.h" #include <osg/Vec4> #include "tc3DWindow.h" class tcLauncher; class tcSimState; /** * Popup control to configure launcher, set torpedo presets */ class tcLauncherPopup : public tc3DWindow { public: virtual void Draw(); static void SetParent(tc3DWindow* par); tcLauncherPopup(long id, unsigned idx, const wxPoint& pos); virtual ~tcLauncherPopup(); protected: static tc3DWindow* parent; bool redraw; unsigned int birthCount; virtual void OnLButtonDown(wxMouseEvent& event); virtual void OnMouseOver(wxMouseEvent& event); private: long platformId; unsigned launcherIdx; tcSimState* simState; tcRect launchButton; tcLauncher* GetLauncher(); }; #endif Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMapView.h 5 Dec 2004 02:49:46 -0000 1.7 --- tcMapView.h 7 Dec 2004 03:59:07 -0000 1.8 *************** *** 325,328 **** --- 325,329 ---- void SetDateTime(std::string s) {dateTime = s;} void SetHookID(long id); + void SetTextLeftMargin(float x); void ToggleShowTrackTags() {mbShowTrackID = !mbShowTrackID;} void UpdateViewBounds() {mpMapData->GetTheaterArea(mrectViewBounds);} *************** *** 344,348 **** bool isLButtonDown; ///< true if left mouse button is down while in window (dragging) wxPoint buttonDownPoint; ///< start point for click-drag operations ! void Build2525(); void BuildNTDS(); --- 345,349 ---- bool isLButtonDown; ///< true if left mouse button is down while in window (dragging) wxPoint buttonDownPoint; ///< start point for click-drag operations ! float leftMargin; ///< screen position to use for info text and symbols void Build2525(); void BuildNTDS(); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-07 03:59:24
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13413/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcPlatformInterface.h 5 Dec 2004 02:49:46 -0000 1.28 --- tcPlatformInterface.h 7 Dec 2004 03:59:14 -0000 1.29 *************** *** 49,57 **** { public: ! int mnLauncher; // index of launcher, or -1 for none int mnQuantity; ! int mnTargetFlags; // 0x01 - surface, 0x02 - air, 0x04 - land float mfRange_km; ! int mnLaunchMode; // 0 - datum, 1 - handoff }; --- 49,58 ---- { public: ! int mnLauncher; ///< index of launcher, or -1 for none int mnQuantity; ! int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x04 - land float mfRange_km; ! float maxDepth_m; ///< max depth for subsurface launch ! int mnLaunchMode; ///< 0 - datum, 1 - handoff }; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:58:39
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22179/src/sim Added Files: tcTorpedoObject.cpp Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcTorpedoObject.cpp --- /** ** @file tcTorpedoObject.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" #include "tcTorpedoObject.h" #include "common/tcStream.h" #include "common/tcObjStream.h" #include "database/tcGenericDBObject.h" #include "database/tcTorpedoDBObject.h" #include "tc3DModel.h" #include "tcParticleEffect.h" #include "tcLauncher.h" #include "tcSimState.h" #include "tc3DPoint.h" #ifdef _DEBUG #define new DEBUG_NEW #endif /** * Load state from update stream */ tcUpdateStream& tcTorpedoObject::operator<<(tcUpdateStream& stream) { tcWeaponObject::operator<<(stream); stream >> goalHeading_rad; stream >> goalPitch_rad; stream >> goalSpeed_kts; stream >> interceptTime; stream >> lastGuidanceUpdate; stream >> guidanceUpdateInterval; waypoint << stream; stream >> rangeToObjective_km; stream >> currentSegment; seeker << stream; return stream; } /** * Save state to update stream */ tcUpdateStream& tcTorpedoObject::operator>>(tcUpdateStream& stream) { tcWeaponObject::operator>>(stream); stream << goalHeading_rad; stream << goalPitch_rad; stream << goalSpeed_kts; stream << interceptTime; stream << lastGuidanceUpdate; stream << guidanceUpdateInterval; waypoint >> stream; stream << rangeToObjective_km; stream << currentSegment; seeker << stream; return stream; } /** * @return guidance mode for current flight profile segment * Use default profile for now */ int tcTorpedoObject::GetCurrentGuidanceMode() { tcTorpedoDBObject::tsTorpedoSegment* segmentInfo = &mpDBObject->defaultProfile[currentSegment]; return (int)segmentInfo->meGuidanceMode; } /** * Initializes missile state for launch from game object. * Adds self to simulation * * @param obj launching game object * @param launcher index of launcher */ void tcTorpedoObject::LaunchFrom(tcGameObject* obj, unsigned nLauncher) { if (tcPlatformObject* platObj = dynamic_cast<tcPlatformObject*>(obj)) { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); tsGeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; mcKin.mfLat_rad = pos.mfLat_rad; mcKin.mfAlt_m = pos.mfAlt_m; } else { mcKin.mfLon_rad = obj->mcKin.mfLon_rad; mcKin.mfLat_rad = obj->mcKin.mfLat_rad; mcKin.mfAlt_m = obj->mcKin.mfAlt_m; } if (mcKin.mfAlt_m < 0) { mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts + C_MPSTOKTS * mpDBObject->launchSpeed_mps; searchMode = SEARCH_S; } else // air launched { mcKin.mfSpeed_kts = obj->mcKin.mfSpeed_kts; searchMode = SEARCH_LEFTCIRCLE; } mcKin.mfHeading_rad = obj->mcKin.mfHeading_rad; mcKin.mfPitch_rad = obj->mcKin.mfPitch_rad; const tcLauncher* pLauncher = obj->GetLauncher(nLauncher); goalHeading_rad = obj->mcKin.mfHeading_rad + pLauncher->pointingAngle; waypoint = pLauncher->msDatum; mfStatusTime = obj->mfStatusTime; mcKin.mfHeading_rad += pLauncher->pointingAngle; mcKin.mfPitch_rad += pLauncher->pointingElevation; mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; fuel_kg = mpDBObject->fuel_kg; // start with max fuel tcString s; s.Format("From %s", obj->mzUnit.mz); mzUnit = s.GetBuffer(); mnAlliance = obj->mnAlliance; simState->AddPlatform(static_cast<tcGameObject*>(this)); // Set intended target (has to be done after alliance and id is set). // This is a tcWeaponObject method SetIntendedTarget(pLauncher->mnTargetID); } /** * @return time remaining in seconds based on current fuel consumption */ float tcTorpedoObject::RuntimeRemaining() { return 0; // not implemented yet } /** * */ void tcTorpedoObject::SetHeading(float newHeading) { goalHeading_rad = newHeading; } /** * */ void tcTorpedoObject::SetSpeed(float newSpeed) { goalSpeed_kts = newSpeed; } /** * */ tcSonar* tcTorpedoObject::GetSensorState() { return &seeker; } /** * */ void tcTorpedoObject::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); mfStatusTime = afStatusTime; wxASSERT(mpDBObject); // air launched torpedoes drop into water first bool outOfWater = (mcKin.mfAlt_m > 0.0f); if (outOfWater) { UpdateDrop(dt_s); return; } UpdateSpeedSimple(dt_s); // from tcPlatformObject Move method float heading_rad = mcKin.mfHeading_rad; float fGroundSpeed_kts = cosf(mcKin.mfClimbAngle_rad)*mcKin.mfSpeed_kts; double fDistance_rad = fGroundSpeed_kts*dt_s*(float)C_KTSTORADPS; mcKin.mfLon_rad += fDistance_rad*(double)(sinf(heading_rad)/cosf((float)mcKin.mfLat_rad)); mcKin.mfLat_rad += (double)cosf(heading_rad)*fDistance_rad; mcKin.mfAlt_m += sinf(mcKin.mfClimbAngle_rad)*mcKin.mfSpeed_kts*C_KTSTOMPS*dt_s; if (!clientMode) { UpdateGuidance(afStatusTime); } /*** heading calculation ***/ float dh_rad, dh_min, dh_max; dh_rad = goalHeading_rad - mcKin.mfHeading_rad; radtoplusminuspi(dh_rad); // map dh_deg to [-pi,pi) dh_max = mpDBObject->maxTurnRate_radps * dt_s; dh_min = -dh_max; if (dh_rad < dh_min) {dh_rad = dh_min;} // restrict to turn rate else if (dh_rad > dh_max) {dh_rad = dh_max;} mcKin.mfHeading_rad += dh_rad; if (mcKin.mfHeading_rad >= C_TWOPI) {mcKin.mfHeading_rad -= C_TWOPI;} if (mcKin.mfHeading_rad < 0) {mcKin.mfHeading_rad += C_TWOPI;} /*** pitch calculation ***/ float dp_rad, dp_min, dp_max; dp_rad = goalPitch_rad - mcKin.mfPitch_rad; dp_max = 2 * mpDBObject->maxTurnRate_radps * dt_s; dp_min = -dp_max; if (dp_rad < dp_min) {dp_rad = dp_min;} else if (dp_rad > dp_max) {dp_rad = dp_max;} mcKin.mfPitch_rad += dp_rad; mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; UpdateEffects(); runTime += dt_s; if (clientMode) return; /*** check for crash ***/ if (mcTerrain.mfHeight_m >= mcKin.mfAlt_m) { mfDamageLevel = 1.0f; tcString s; s.Format("Object %s hit bottom at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } // update fuel fuel_kg -= dt_s * mpDBObject->fuelRate_kgpktps * mcKin.mfSpeed_kts; if (fuel_kg <= 0) { mfDamageLevel = 1.0f; // self-destruct tcString s; s.Format("Object %s shut down at time %.1f lon %.3f, lat %.3f", mzUnit.mz,afStatusTime,mcKin.mfLon_rad*C_180OVERPI,mcKin.mfLat_rad*C_180OVERPI); WTL(s.GetBuffer()); } seeker.Update(afStatusTime); } /** * */ void tcTorpedoObject::UpdateDrop(float dt_s) { float heading_rad = mcKin.mfHeading_rad; float fGroundSpeed_kts = cosf(mcKin.mfClimbAngle_rad) * mcKin.mfSpeed_kts; float vz_mps = C_KTSTOMPS * sinf(mcKin.mfClimbAngle_rad) * mcKin.mfSpeed_kts; float vxy_mps = C_KTSTOMPS * fGroundSpeed_kts; float z = mcKin.mfAlt_m; float dvz = C_G * dt_s; if (vz_mps < -50) { dvz = 0; } else if (vz_mps < -40) { dvz = 0.1f * (vz_mps + 50) * dvz; // gradually limit acceleration } vz_mps = vz_mps - dvz; if (vxy_mps > 0) { vxy_mps = vxy_mps - dt_s * 0.02f * vxy_mps * vxy_mps; // air drag } if (vxy_mps < 0) { vxy_mps = 0; } double fDistance_rad = fGroundSpeed_kts*dt_s*(float)C_KTSTORADPS; mcKin.mfLon_rad += fDistance_rad*(double)(sinf(heading_rad)/cosf((float)mcKin.mfLat_rad)); mcKin.mfLat_rad += (double)cosf(heading_rad)*fDistance_rad; mcKin.mfAlt_m += vz_mps*dt_s; mcKin.mfClimbAngle_rad = atan2(vz_mps, vxy_mps); mcKin.mfPitch_rad = mcKin.mfClimbAngle_rad; mcKin.mfSpeed_kts = C_MPSTOKTS * sqrtf(vz_mps*vz_mps + vxy_mps*vxy_mps); if (mcKin.mfAlt_m <= 0) mcKin.mfSpeed_kts *= 0.1f; // lose speed after hitting water } /** * */ void tcTorpedoObject::UpdateEffects() { if (model) { if ((mcKin.mfAlt_m < -5) && (mcKin.mfSpeed_kts > 15)) { model->SetSmokeMode(tcParticleEffect::BUBBLES); } else { model->SetSmokeMode(tcParticleEffect::OFF); } model->UpdateEffects(); } } /** * */ void tcTorpedoObject::UpdateGuidance(double t) { using tcTorpedoDBObject::tsTorpedoSegment; const float torpedo_acz = 50.0f; const float one_over_torpedo_acz = 1.0f / 50.0f; if ((t - lastGuidanceUpdate) < guidanceUpdateInterval) return; lastGuidanceUpdate = t; unsigned int nSegments = mpDBObject->defaultProfile.size(); wxASSERT(nSegments); if (currentSegment >= nSegments) return; // error case, shouldn't happen tsTorpedoSegment* segmentInfo = &mpDBObject->defaultProfile[currentSegment]; float fGoalAltitude_m = mcKin.mfAlt_m; goalSpeed_kts = segmentInfo->thrust * mpDBObject->maxSpeed_kts; //************ GuidanceMode update ************** bool useInterceptPitch = false; float interceptPitch_rad = 0; switch (segmentInfo->meGuidanceMode) { case tcTorpedoDBObject::GM_NAV: goalHeading_rad = mcKin.HeadingToGeoRad(&waypoint); rangeToObjective_km = mcKin.RangeToKm(&waypoint); goalDepth_m = segmentInfo->depth_m; break; case tcTorpedoDBObject::GM_COMMAND: break; case tcTorpedoDBObject::GM_SENSOR: if (!seeker.GetActive()) { seeker.SetActive(true); seeker.mnMode = SSMODE_SEEKERSEARCH; searchHeading_rad = goalHeading_rad; } guidanceUpdateInterval = 0.5f; if (seeker.mnMode == SSMODE_SEEKERTRACK) { if (seeker.mcTrack.mnFlags & TRACK_BEARING_ONLY) { goalHeading_rad = seeker.mcTrack.mfHeading_rad; // bearing in this case goalDepth_m = -seeker.mcTrack.mfAlt_m; } else { tcTrack predictedtrack; float tti_s; seeker.mcTrack.GetPrediction(predictedtrack, t); mcKin.GetInterceptData3D(predictedtrack, goalHeading_rad, interceptPitch_rad, tti_s, rangeToObjective_km); rangeToObjective_km *= C_RADTOKM; // convert to km useInterceptPitch = true; interceptTime = tti_s; } } else if (seeker.mnMode == SSMODE_SEEKERSEARCH) { switch (searchMode) { case SEARCH_S: goalHeading_rad = searchHeading_rad + 0.4f * sinf(0.2f * runTime); break; case SEARCH_LEFTCIRCLE: goalHeading_rad = searchHeading_rad - 0.2f * runTime; goalHeading_rad = fmodf(goalHeading_rad, C_TWOPI); break; case SEARCH_RIGHTCIRCLE: goalHeading_rad = searchHeading_rad + 0.2f * runTime; goalHeading_rad = fmodf(goalHeading_rad, C_TWOPI); break; default: break; } } else if (seeker.mnMode == SSMODE_SEEKERACQUIRE) { goalHeading_rad = mcKin.mfHeading_rad; // maintain heading during acquire searchMode = SEARCH_LEFTCIRCLE; // to revert to circle search if acq fails } break; default: { fprintf(stderr, "Error - tcTorpedoObject::UpdateGuidance - Bad segment guidance mode\n"); } break; } // update guidance update rate and seeker scan rate based on time to intercept if (interceptTime <= 5.0) { guidanceUpdateInterval = 0.2f; seeker.mfCurrentScanPeriod_s = 0.2f; } else if (interceptTime <= 2.0) { guidanceUpdateInterval = 0.1f; seeker.mfCurrentScanPeriod_s = 0.1f; } //************ update altitude control ************** if (useInterceptPitch) { wxASSERT(!_isnan(interceptPitch_rad)); goalPitch_rad = interceptPitch_rad; } else { float depth_m = -mcKin.mfAlt_m; if (depth_m > goalDepth_m + torpedo_acz) { goalPitch_rad = 0.7f; } else if (depth_m < goalDepth_m - torpedo_acz) { goalPitch_rad = -0.7f; } else { goalPitch_rad = 0.7f * (depth_m - goalDepth_m) * one_over_torpedo_acz; } } // swim level for first few seconds if (runTime < 5.0f) { goalHeading_rad = mcKin.mfHeading_rad; goalPitch_rad = 0.0f; } // switch to next segment if within range if (currentSegment < (nSegments-1)) { if (rangeToObjective_km < segmentInfo->range_km) { currentSegment++; } } } /** * Simple model for speed update * Flat max acceleration */ void tcTorpedoObject::UpdateSpeedSimple(float dt_s) { float ds_kts = goalSpeed_kts - mcKin.mfSpeed_kts; float ds_max = mpDBObject->acceleration_ktsps * dt_s; float ds_min = -ds_max; if (ds_kts < ds_min) {ds_kts = ds_min;} // restrict to acceleration else if (ds_kts > ds_max) {ds_kts = ds_max;} mcKin.mfSpeed_kts += ds_kts; if (mcKin.mfSpeed_kts < 0) mcKin.mfSpeed_kts = 0; } /** * */ void tcTorpedoObject::Clear() { tcGameObject::Clear(); } /** * */ void tcTorpedoObject::DesignateTarget(long anID) { seeker.mcTrack.mnID = anID; // needs to SSMODE_SEEKERACQUIRE so track is updated before guidance update seeker.mnMode = SSMODE_SEEKERACQUIRE; } /** * */ void tcTorpedoObject::RandInitNear(float afLon, float afLat) { //strcpy(mzClass.mz,mpDBObject->mzClass.mz); mzUnit.AssignRandomStringB(); mnAlliance = 0; mfStatusTime = 0; mcKin.mfLon_rad = afLon + randfc(1.1f); mcKin.mfLat_rad = afLat + randfc(1.1f); mcKin.mfHeading_rad = 360*randf(); mcKin.mfSpeed_kts = 100; mfDamageLevel = 0; //tcGameObject::RandInitNear(afLon,afLat); mcKin.mfAlt_m = -100.0f; SetHeading(mcKin.mfHeading_rad); SetSpeed(mcKin.mfSpeed_kts); mcKin.SetRelativeGeo(waypoint, mcKin.mfHeading_rad*(float)C_PIOVER180, 100.0f); } /** * If missile is targeting a land datum, gp.mnTargetID will be * set to -1. Otherwise gp.mnTargetID is set to the intended * target of the missile. * * @return 1 if missile is in terminal phase */ int tcTorpedoObject::GetGuidanceParameters(tsGuidanceParameters& gp) { if (seeker.mnMode == SSMODE_SEEKERTRACK) { gp.mnTargetID = seeker.mcTrack.mnID; if (seeker.IsPassive()) { gp.mfInterceptTime = 0; } else { gp.mfInterceptTime = interceptTime; } return 1; } else { return 0; } } /** * */ void tcTorpedoObject::PrintToFile(tcFile& file) { tcString s; tcGameObject::PrintToFile(file); s.Format(" Missile Object\n"); file.WriteString(s.GetBuffer()); } /** * */ void tcTorpedoObject::SaveToFile(tcFile& file) { tcGameObject::SaveToFile(file); wxASSERT(false); } /** * */ void tcTorpedoObject::LoadFromFile(tcFile& file) { tcGameObject::LoadFromFile(file); wxASSERT(false); } /** * */ void tcTorpedoObject::Serialize(tcFile& file, bool mbLoad) { if (mbLoad) { LoadFromFile(file); } else { SaveToFile(file); } } /** * */ tcTorpedoObject::tcTorpedoObject() : tcWeaponObject(), guidanceUpdateInterval(1.0f), lastGuidanceUpdate(0.0f), interceptTime(9999.0f), runTime(0), currentSegment(0), rangeToObjective_km(9999.0f), goalPitch_rad(0), goalSpeed_kts(35), searchHeading_rad(0), searchMode(SEARCH_S), mpDBObject(0) { Clear(); seeker.mnMode = SSMODE_SEEKERSEARCH; mnModelType = MTYPE_TORPEDO; } /** * Copy constructor. */ tcTorpedoObject::tcTorpedoObject(tcTorpedoObject& o) : tcWeaponObject(o) { mnModelType = MTYPE_TORPEDO; goalHeading_rad = o.goalHeading_rad; goalPitch_rad = o.goalPitch_rad; goalSpeed_kts = o.goalSpeed_kts; interceptTime = o.interceptTime; runTime = o.runTime; lastGuidanceUpdate = o.lastGuidanceUpdate; guidanceUpdateInterval = o.guidanceUpdateInterval; waypoint = o.waypoint; rangeToObjective_km = o.rangeToObjective_km; currentSegment = o.currentSegment; seeker = o.seeker; mpDBObject = o.mpDBObject; } /** * Constructor that initializes using info from database entry. */ tcTorpedoObject::tcTorpedoObject(tcTorpedoDBObject* obj) : tcWeaponObject(obj), guidanceUpdateInterval(1.0f), lastGuidanceUpdate(0.0f), interceptTime(9999.0f), runTime(0), currentSegment(0), rangeToObjective_km(9999.0f), goalPitch_rad(0), goalSpeed_kts(35), searchHeading_rad(0), searchMode(SEARCH_S), mpDBObject(obj) { mnModelType = MTYPE_TORPEDO; // init seeker tcDatabaseObject* sonarDBObj = database->GetObject(obj->sonarClass); if (sonarDBObj) { seeker.InitFromDatabase(sonarDBObj->mnKey); seeker.SetParent(this); seeker.SetMountAz(0); // torpedo seeker always points forward } else { fprintf(stderr, "Error - tcTorpedoObject::tcTorpedoObject(tcTorpedoDBObject* obj)" " - Bad or missing sensor for torpedo seeker\n"); } } /** * */ tcTorpedoObject::~tcTorpedoObject() { } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:58:35
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22179/src/database Added Files: tcTorpedoDBObject.cpp Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcTorpedoDBObject.cpp --- /* ** @file tcTorpedoDBObject.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" #if _MSC_VER > 1000 #pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library. #endif // _MSC_VER > 1000 #include "tcTorpedoDBObject.h" #include "math_constants.h" #include "randfn.h" #include "tcDatabase.h" #include "common/tinyxml.h" #include "database/tcSqlReader.h" #include <sstream> #ifdef _DEBUG #define new DEBUG_NEW #endif namespace Database { /** * Calculate parameters based on database values. */ void tcTorpedoDBObject::CalculateParams() { maxTurnRate_radps = C_PIOVER180 * maxTurnRate_degps; fuelRate_kgpktps = fuelRate_kgps / maxSpeed_kts; } /** * workaround for write serialization issue * @return true if db obj is a leaf obj */ bool tcTorpedoDBObject::IsLeaf() const { return mnClassID == DTYPE_TORPEDO; } void tcTorpedoDBObject::PrintToFile(tcFile& file) { tcString s; tcWeaponDBObject::PrintToFile(file); s.Format(" No torpedo info avail."); file.WriteString(s.GetBuffer()); } int tcTorpedoDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { tcWeaponDBObject::Serialize(file, mbLoad, anVersion); if (mbLoad) { wxASSERT(false); } else { wxASSERT(false); } return true; } /** * Loads/saves XML data for database object * @param load true to load, false to save */ void tcTorpedoDBObject::SerializeXml(TiXmlElement* node, bool load) { if (load) return; // write only for now wxASSERT(node); TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("torpedo"))->ToElement(); localNode->SetAttribute("mass_kg", mass_kg); localNode->SetAttribute("dragArea_sm", dragArea_sm); localNode->SetAttribute("maxTurnRate_degps", maxTurnRate_degps); localNode->SetAttribute("maxDepth_m", maxDepth_m); localNode->SetAttribute("maxThrust_N", maxThrust_N); localNode->SetAttribute("fuel_kg", fuel_kg); localNode->SetAttribute("fuelRate_kgps", fuelRate_kgps); localNode->SetAttribute("maxSpeed_kts", maxSpeed_kts); localNode->SetAttribute("acceleration_ktsps", acceleration_ktsps); localNode->SetAttribute("mfRange_km", mfRange_km); localNode->SetAttribute("sonarClass", sonarClass.c_str()); for(size_t i=0; (i<defaultProfile.size())&&(i<MAX_TORPEDO_SEGMENTS); i++) { TiXmlElement* childNode = node->InsertEndChild(TiXmlElement("segment"))->ToElement(); childNode->SetAttribute("range_km", defaultProfile[i].range_km); childNode->SetAttribute("depth_m", defaultProfile[i].depth_m); childNode->SetAttribute("thrust", defaultProfile[i].thrust); childNode->SetAttribute("guidanceMode", (int)defaultProfile[i].meGuidanceMode); } tcWeaponDBObject::SerializeXml(node, load); } /** * Adds sql column definitions to columnString. This is used for * SQL create table command */ void tcTorpedoDBObject::AddSqlColumns(std::string& columnString) { tcWeaponDBObject::AddSqlColumns(columnString); columnString += ","; columnString += "mass_kg number(8),"; columnString += "dragArea_sm number(8),"; columnString += "maxTurnRate_degps number(8),"; columnString += "maxDepth_m number(8),"; columnString += "maxThrust_N number(8),"; columnString += "fuel_kg number(8),"; columnString += "fuelRate_kgps number(8),"; columnString += "maxSpeed_kts number(8),"; columnString += "acceleration_ktsps number(8),"; columnString += "mfRange_km number(8),"; columnString += "sonarClass varchar(30),"; for(unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) { tcString s; s.Format("Range%d_km number(5),",i+1); columnString += s.GetBuffer(); s.Format("Depth%d_m number(4),",i+1); columnString += s.GetBuffer(); s.Format("Thrust%d number(5),",i+1); columnString += s.GetBuffer(); s.Format("GuidMode%d number(2)",i+1); columnString += s.GetBuffer(); if (i < MAX_TORPEDO_SEGMENTS - 1) { columnString += ","; } } } void tcTorpedoDBObject::ReadSql(tcSqlReader& entry) { tcWeaponDBObject::ReadSql(entry); mass_kg = entry.GetDouble("mass_kg"); dragArea_sm = entry.GetDouble("dragArea_sm"); maxTurnRate_degps = entry.GetDouble("maxTurnRate_degps"); maxDepth_m = entry.GetDouble("maxDepth_m"); maxThrust_N = entry.GetDouble("maxThrust_N"); fuel_kg = entry.GetDouble("fuel_kg"); fuelRate_kgps = entry.GetDouble("fuelRate_kgps"); maxSpeed_kts = entry.GetDouble("maxSpeed_kts"); acceleration_ktsps = entry.GetDouble("acceleration_ktsps"); mfRange_km = entry.GetDouble("mfRange_km"); sonarClass = entry.GetString("sonarClass"); defaultProfile.clear(); for (unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) { float range, depth, thrust; int guidanceMode; range = entry.GetDouble("Range%d_km", i+1); depth = entry.GetDouble("Depth%d_m", i+1); thrust = entry.GetDouble("Thrust%d", i+1); guidanceMode = entry.GetInt("GuidMode%d", i+1); if ((range > 0)||(depth > 0)||(thrust > 0)) { tsTorpedoSegment seg; seg.range_km = range; seg.depth_m = depth; seg.thrust = thrust; seg.meGuidanceMode = (TorpedoGuidanceMode)guidanceMode; ///< guidance mode defaultProfile.push_back(seg); } } } void tcTorpedoDBObject::WriteSql(std::string& valueString) { tcWeaponDBObject::WriteSql(valueString); std::stringstream s; s << ","; s << mass_kg << ","; s << dragArea_sm << ","; s << maxTurnRate_degps << ","; s << maxDepth_m << ","; s << maxThrust_N << ","; s << fuel_kg << ","; s << fuelRate_kgps << ","; s << maxSpeed_kts << ","; s << acceleration_ktsps << ","; s << mfRange_km << ","; s << "'" << sonarClass.c_str() << "'" << ","; for (unsigned i=0; i<MAX_TORPEDO_SEGMENTS; i++) { if (i < defaultProfile.size()) { s << defaultProfile[i].range_km << ","; s << defaultProfile[i].depth_m << ","; s << defaultProfile[i].thrust << ","; s << (long)defaultProfile[i].meGuidanceMode; } else { s << "0,"; s << "0,"; s << "0,"; s << "0"; } if (i < MAX_TORPEDO_SEGMENTS - 1) { s << ","; } } valueString += s.str(); } tcTorpedoDBObject::tcTorpedoDBObject(tcTorpedoDBObject& obj) : tcWeaponDBObject(obj), mass_kg(obj.mass_kg), dragArea_sm(obj.dragArea_sm), maxTurnRate_degps(obj.maxTurnRate_degps), maxDepth_m(obj.maxDepth_m), maxThrust_N(obj.maxThrust_N), fuel_kg(obj.fuel_kg), fuelRate_kgps(obj.fuelRate_kgps), maxSpeed_kts(obj.maxSpeed_kts), acceleration_ktsps(obj.acceleration_ktsps), mfRange_km(obj.mfRange_km), sonarClass(obj.sonarClass) { mnClassID = DTYPE_TORPEDO; mnModelType = MTYPE_TORPEDO; mnType = PTYPE_TORPEDO; CalculateParams(); } tcTorpedoDBObject::tcTorpedoDBObject() : tcWeaponDBObject() , mass_kg(100), dragArea_sm(1), maxTurnRate_degps(5), maxDepth_m(500), maxThrust_N(100), fuel_kg(100), fuelRate_kgps(1), maxSpeed_kts(40), acceleration_ktsps(3), mfRange_km(10), sonarClass("") { mnClassID = DTYPE_TORPEDO; mnModelType = MTYPE_TORPEDO; mnType = PTYPE_TORPEDO; CalculateParams(); } tcTorpedoDBObject::~tcTorpedoDBObject() { } } // namespace Database |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:58:35
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22179/include/sim Added Files: tcTorpedoObject.h Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcTorpedoObject.h --- /** ** @file tcTorpedoObject.h */ /* 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 */ #if _MSC_VER > 1000 #pragma once #endif #ifndef _TCTORPEDOOBJECT_H_ #define _TCTORPEDOOBJECT_H_ #include "tcWeaponObject.h" #include "tcGuidanceState.h" #include "tcSonar.h" class tcUpdateStream; namespace Database { class tcTorpedoDBObject; } /** * A class that models a torpedo. * * @see tcGameObject */ class tcTorpedoObject : public tcWeaponObject { public: /** * Search mode code for torpedo */ enum TorpedoSearchMode { SEARCH_STRAIGHT = 0, SEARCH_S = 1, SEARCH_LEFTCIRCLE = 2, SEARCH_RIGHTCIRCLE = 3 }; float goalDepth_m; float goalHeading_rad; float goalPitch_rad; float goalSpeed_kts; double interceptTime; float runTime; ///< [s] time elapsed since launch // are all 3 of these necessary? needs refactoring double lastGuidanceUpdate; float guidanceUpdateInterval; tsGeoPoint waypoint; // nav datum float rangeToObjective_km; // for segment determination unsigned int currentSegment; tcSonar seeker; float fuel_kg; float searchHeading_rad; ///< center of "S" sector to search int searchMode; tcTorpedoDBObject *mpDBObject; // pointer to valid database obj void Clear(); void LaunchFrom(tcGameObject* obj, unsigned nLauncher); void RandInitNear(float afLon_deg, float afLat_deg); virtual void Update(double afStatusTime); virtual void UpdateEffects(); virtual void UpdateGuidance(double t); virtual void SetHeading(float newHeading); int GetCurrentGuidanceMode(); virtual void SetSpeed(float newSpeed); virtual tcSonar* GetSensorState(); virtual void DesignateTarget(long anID); virtual int GetGuidanceParameters(tsGuidanceParameters& gp); float RuntimeRemaining(); void PrintToFile(tcFile&); void SaveToFile(tcFile& file); void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); tcTorpedoObject(); tcTorpedoObject(tcTorpedoObject&); tcTorpedoObject(tcTorpedoDBObject *obj); ~tcTorpedoObject(); protected: virtual void UpdateDrop(float dt_s); virtual void UpdateSpeedSimple(float dt_s); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:58:34
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22179/include/database Added Files: tcTorpedoDBObject.h Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcTorpedoDBObject.h --- /** ** @file tcTorpedoDBObject.h */ /* 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 */ #ifndef _TORPEDODBOBJECT_H_ #define _TORPEDODBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcWeaponDBObject.h" #include <vector> class TiXmlElement; namespace Database { class tcSqlReader; /** * */ class tcTorpedoDBObject : public tcWeaponDBObject { public: enum {MAX_TORPEDO_SEGMENTS = 4}; /** * Determines guidance type that is used flight segment. */ enum TorpedoGuidanceMode { GM_COMMAND = 0, ///< command guidance GM_NAV = 1, ///< inertial GM_SENSOR = 2 ///< use primary sensor }; /** * Info that controls torpedo behavior for segment. */ struct tsTorpedoSegment { float range_km; ///< min range for this segment float depth_m; ///< depth for segment float thrust; /// relative thrust for segment, 0-1.0 TorpedoGuidanceMode meGuidanceMode; ///< guidance mode }; // model parameters float mass_kg; ///< mass before launch, fuel assumed 0 kg float dragArea_sm; ///< area for parasitic drag float maxTurnRate_degps; ///< max turn rate float maxDepth_m; ///< maximum depth float maxThrust_N; ///< max thrust [N] float fuel_kg; float fuelRate_kgps; ///< fuel rate at max thrust float maxSpeed_kts; float acceleration_ktsps; ///< for simple model only float mfRange_km; ///< [km] nominal range // sensor info std::string sonarClass; /// flight profile, array of flight segment info std::vector<tsTorpedoSegment> defaultProfile; ///< default maneuver profile /// calculated parameters float maxTurnRate_radps; ///< CALCULATED float fuelRate_kgpktps; ///< [kg / kt / s] CALCULATED virtual const char* GetClassName() {return "Torpedo";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static void AddSqlColumns(std::string& columnString); void ReadSql(tcSqlReader& entry); void WriteSql(std::string& valueString); tcTorpedoDBObject(); tcTorpedoDBObject(tcTorpedoDBObject& obj); ///< copy constructor virtual ~tcTorpedoDBObject(); private: void CalculateParams(); }; } #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:42
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399 Modified Files: GCblue.vcproj Log Message: Sonar work, passive sonar, torpedoes Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** GCblue.vcproj 2 Dec 2004 04:17:22 -0000 1.74 --- GCblue.vcproj 5 Dec 2004 02:49:45 -0000 1.75 *************** *** 536,539 **** --- 536,542 ---- </File> <File + RelativePath=".\src\sim\tcTorpedoObject.cpp"> + </File> + <File RelativePath="src\sim\tcUserInfo.cpp"> </File> *************** *** 1433,1436 **** --- 1436,1442 ---- </File> <File + RelativePath=".\include\sim\tcTorpedoObject.h"> + </File> + <File RelativePath="include\sim\tcUserInfo.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:42
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/include/graphics Modified Files: tcMapView.h Log Message: Sonar work, passive sonar, torpedoes Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcMapView.h 23 Nov 2004 23:30:46 -0000 1.6 --- tcMapView.h 5 Dec 2004 02:49:46 -0000 1.7 *************** *** 362,365 **** --- 362,366 ---- osg::Geometry* DrawNTDSMissile(teAffiliation affil); osg::Geometry* DrawNTDSSubsurface(teAffiliation affil); + osg::Geometry* DrawNTDSTorpedo(teAffiliation affil); osg::Geometry* DrawNTDSUnknown(teAffiliation affil); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:41
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/include/database Modified Files: tcMissileDBObject.h tcSonarDBObject.h Log Message: Sonar work, passive sonar, torpedoes Index: tcSonarDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSonarDBObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcSonarDBObject.h 2 Dec 2004 04:17:23 -0000 1.1 --- tcSonarDBObject.h 5 Dec 2004 02:49:46 -0000 1.2 *************** *** 48,54 **** --- 48,63 ---- float maxFrequency_Hz; bool isPassive; + //bool isActive ///< both isActive and isPassive indicate selectable + //bool isTowed; + //float maxTowedScope_m; + //bool applyScanLoss; + //float bearingResolution_deg; + std::string audioFile; ///< filename for audio sound effect (active only) + + float alpha; ///< CALCULATED attenuation coefficent in dB/km + // float bearingResolution_rad; ///< CALCULATED virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMissileDBObject.h 29 Nov 2004 03:54:49 -0000 1.14 --- tcMissileDBObject.h 5 Dec 2004 02:49:46 -0000 1.15 *************** *** 97,104 **** --- 97,106 ---- }; + /// these need to be moved to a common area #define SURFACE_TARGET 0x0001 #define AIR_TARGET 0x0002 #define LAND_TARGET 0x0004 #define MISSILE_TARGET 0x0008 + #define SUBSURFACE_TARGET 0x0010 class tcMissileDBObject : public tcWeaponDBObject |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:40
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/include/common Modified Files: tcOggStreamer.h Log Message: Sonar work, passive sonar, torpedoes Index: tcOggStreamer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOggStreamer.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcOggStreamer.h 8 Aug 2004 00:31:32 -0000 1.6 --- tcOggStreamer.h 5 Dec 2004 02:49:45 -0000 1.7 *************** *** 54,59 **** --- 54,61 ---- bool GetPause() const {return paused;} void Init(); + bool IsPaused(); bool IsPlaying(); bool IsSongQueued() {return queuedSong.size() > 1;} + bool IsStopped(); float GetVolume() {return volume;} void Open(std::string path); *************** *** 87,91 **** int nFreeBuffers; ///< number of free buffers ! ALuint buffers[NUM_BUFFERS]; ALuint source; ALenum format; --- 89,93 ---- int nFreeBuffers; ///< number of free buffers ! ALuint buffers[8]; ALuint source; ALenum format; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:26
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/include/scriptinterface Modified Files: tcPlatformInterface.h tcScenarioInterface.h Log Message: Sonar work, passive sonar, torpedoes Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcPlatformInterface.h 29 Nov 2004 03:54:49 -0000 1.27 --- tcPlatformInterface.h 5 Dec 2004 02:49:46 -0000 1.28 *************** *** 285,290 **** // flightport (airstrip, cv flight deck, helo pad) /// true if platform has a flight port (e.g. carrier) ! bool HasFlightPort(void); ! tcFlightPortInterface GetFlightPortInfo(void); tcTrack GetLandingData(long id); int GetLandingState(); --- 285,290 ---- // flightport (airstrip, cv flight deck, helo pad) /// true if platform has a flight port (e.g. carrier) ! bool HasFlightPort(); ! tcFlightPortInterface GetFlightPortInfo(); tcTrack GetLandingData(long id); int GetLandingState(); *************** *** 293,296 **** --- 293,297 ---- // miscellaneous void GetUserInput(std::string callback, std::string uitype); + bool IsValid() const; void SendCommand(std::string command); /// display text message in user console Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcScenarioInterface.h 8 Aug 2004 00:31:32 -0000 1.11 --- tcScenarioInterface.h 5 Dec 2004 02:49:46 -0000 1.12 *************** *** 38,41 **** --- 38,44 ---- using namespace boost::python; + /** + * + */ namespace ScriptInterface { *************** *** 53,56 **** --- 56,62 ---- }; + /** + * + */ class tcScenarioUnit { *************** *** 71,74 **** --- 77,81 ---- bool Validate(); }; + /** * Interface class to python scenario generation scripts. *************** *** 81,84 **** --- 88,96 ---- bool AddUnitToFlightDeck(std::string parentName, std::string className, std::string unitName, int locCode); + void AddToUnitMagazine(const std::string& unitName, + const std::string& item, unsigned int quantity); + void SetUnitLauncherItem(const std::string& unitName, + unsigned int launcherIdx, const std::string& item, unsigned int quantity); + void CreateAlliance(int alliance, std::string name); tcOrder GetDefaultOrder(); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-05 02:50:00
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20399/src/database Modified Files: tcDatabase.cpp tcLauncherDBObject.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcLauncherDBObject.cpp 29 Nov 2004 03:55:04 -0000 1.11 --- tcLauncherDBObject.cpp 5 Dec 2004 02:49:47 -0000 1.12 *************** *** 246,251 **** maChildClass[mnConfigurations] = entry.GetString(s.GetBuffer()).c_str(); ! if (maCapacity[mnConfigurations] && ! (strlen(maChildClass[mnConfigurations].mz) > 0)) { mnConfigurations++; --- 246,250 ---- maChildClass[mnConfigurations] = entry.GetString(s.GetBuffer()).c_str(); ! if (strlen(maChildClass[mnConfigurations].mz) > 0) { mnConfigurations++; Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcDatabase.cpp 2 Dec 2004 04:17:24 -0000 1.21 --- tcDatabase.cpp 5 Dec 2004 02:49:47 -0000 1.22 *************** *** 49,52 **** --- 49,53 ---- #include "tcBallisticDBObject.h" #include "tcStoresDBObject.h" + #include "tcTorpedoDBObject.h" #include "tcDatabaseIterator.h" #include "common/tinyxml.h" *************** *** 309,313 **** else serializer.Save(); } ! BuildDictionaries(); } --- 310,320 ---- else serializer.Save(); } ! // tcTorpedoDBObject ! { ! tcDBObjSerializerSql<tcTorpedoDBObject> ! serializer(this, sqlConnection, "torpedo"); ! if (load) serializer.Load(); ! else serializer.Save(); ! } BuildDictionaries(); } |