gcblue-commits Mailing List for Global Conflict Blue (Page 37)
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-30 17:26:20
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/src/graphics Modified Files: tc3DModel.cpp Log Message: Group selection Ctrl and Alt+number commands Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tc3DModel.cpp 7 Dec 2004 04:00:28 -0000 1.17 --- tc3DModel.cpp 30 Dec 2004 17:26:07 -0000 1.18 *************** *** 68,72 **** std::string name = node.getName(); #ifdef _DEBUG ! if (tcOptions::Get()->log3DModelDetails) { std::cout << " - "<< name << "\n"; --- 68,72 ---- std::string name = node.getName(); #ifdef _DEBUG ! if (tcOptions::Get()->OptionStringExists("Log3DModelDetails")) { std::cout << " - "<< name << "\n"; *************** *** 140,144 **** animationInfo.push_back(ai); ! if (tcOptions::Get()->log3DModelDetails) { std::cout << "added animation info for: " << name <<"\n"; --- 140,144 ---- animationInfo.push_back(ai); ! if (tcOptions::Get()->OptionStringExists("Log3DModelDetails")) { std::cout << "added animation info for: " << name <<"\n"; *************** *** 400,415 **** { if (modelNode.valid()) return; // model already loaded ! if (tcOptions::Get()->log3DModelDetails) { std::cout << "Loading 3D model: " << model_name << " \n"; } ! model_name = model_name + ".3ds"; ! modelNode = osgDB::readNodeFile(model_name.c_str()); if (!modelNode.valid()) { ! std::cout << "Load of 3D model: " << model_name << " failed.\n"; ! std::cerr << "Load of 3D model: " << model_name << " failed.\n"; ! return; } if (useSmoothing) --- 400,422 ---- { if (modelNode.valid()) return; // model already loaded ! if (tcOptions::Get()->OptionStringExists("Log3DModelDetails")) { std::cout << "Loading 3D model: " << model_name << " \n"; } ! // try ive load first ! std::string full_name = model_name + ".ive"; ! ! modelNode = osgDB::readNodeFile(full_name.c_str()); if (!modelNode.valid()) { ! full_name = model_name + ".3ds"; ! modelNode = osgDB::readNodeFile(full_name.c_str()); ! if (!modelNode.valid()) ! { ! std::cout << "Load of 3D model: " << model_name << " failed.\n"; ! std::cerr << "Load of 3D model: " << model_name << " failed.\n"; ! return; ! } } if (useSmoothing) *************** *** 418,425 **** modelNode->accept(smoothingVisitor); } ! if (tcOptions::Get()->log3DModelDetails) ! { ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); ! } } --- 425,431 ---- modelNode->accept(smoothingVisitor); } ! ! fprintf(stdout,"tc3DModel--Loaded 3D model: %s\n", full_name.c_str()); ! } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-30 17:26:20
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/include/database Modified Files: tcDatabaseObject.h tcGenericDBObject.h Log Message: Group selection Ctrl and Alt+number commands Index: tcGenericDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcGenericDBObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcGenericDBObject.h 7 Dec 2004 03:59:07 -0000 1.13 --- tcGenericDBObject.h 30 Dec 2004 17:26:06 -0000 1.14 *************** *** 89,92 **** --- 89,93 ---- void Animate3DModel(); + virtual tc3DModel* Get3DModel(); virtual const char* GetClassName() {return "Generic";} ///< returns class name of database object bool IsLeaf() const; ///< returns true if db obj is a leaf obj Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcDatabaseObject.h 2 Dec 2004 04:17:23 -0000 1.18 --- tcDatabaseObject.h 30 Dec 2004 17:26:06 -0000 1.19 *************** *** 139,143 **** static void AttachDatabase(tcDatabase *db) {database = db;} virtual const char* GetClassName() {return "Object";} ///< returns class name of database object ! tc3DModel* Get3DModel(); bool IsLeaf() const; ///< returns true if db obj is a leaf obj void Load3DModel(); --- 139,143 ---- static void AttachDatabase(tcDatabase *db) {database = db;} virtual const char* GetClassName() {return "Object";} ///< returns class name of database object ! virtual tc3DModel* Get3DModel(); bool IsLeaf() const; ///< returns true if db obj is a leaf obj void Load3DModel(); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-30 17:26:20
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/include/common Modified Files: tcOptions.h Log Message: Group selection Ctrl and Alt+number commands Index: tcOptions.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptions.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcOptions.h 7 Dec 2004 03:59:05 -0000 1.10 --- tcOptions.h 30 Dec 2004 17:26:05 -0000 1.11 *************** *** 76,81 **** int mn3DCheatMode; - bool log3DModelDetails; ///< true to write detailed info to stdout.txt while loading 3D models - tsOptionInfo maOptionInfo[N_OPTIONS]; int mnNumOptions; --- 76,79 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-12-30 17:26:20
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/src/common Modified Files: tcOptions.cpp Log Message: Group selection Ctrl and Alt+number commands Index: tcOptions.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptions.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcOptions.cpp 7 Dec 2004 04:00:28 -0000 1.14 --- tcOptions.cpp 30 Dec 2004 17:26:06 -0000 1.15 *************** *** 151,156 **** } - log3DModelDetails = OptionStringExists("Log3DModelDetails"); - return true; } --- 151,154 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 23:51:39
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4432/src/graphics Modified Files: tcMapView.cpp Log Message: Group selection Ctrl and Alt+number commands Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcMapView.cpp 11 Dec 2004 01:09:06 -0000 1.12 --- tcMapView.cpp 28 Dec 2004 23:51:24 -0000 1.13 *************** *** 2286,2289 **** --- 2286,2294 ---- } + void tcTacticalMapView::SetGroupHook(std::vector<long>& hookedUnits) + { + hookedId = hookedUnits; + } + /** * If id != -1, sets hookedId to have one element equal to id, |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 23:51:38
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4432/include/graphics Modified Files: tcMapView.h Log Message: Group selection Ctrl and Alt+number commands Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcMapView.h 11 Dec 2004 01:09:04 -0000 1.9 --- tcMapView.h 28 Dec 2004 23:51:24 -0000 1.10 *************** *** 323,326 **** --- 323,327 ---- void SetDateTime(std::string s) {dateTime = s;} void SetHookID(long id); + void SetGroupHook(std::vector<long>& hookedUnits); void SetTextLeftMargin(float x); void ToggleShowTrackTags() {mbShowTrackID = !mbShowTrackID;} |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 23:51:38
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4432/xml Modified Files: options.xml Log Message: Group selection Ctrl and Alt+number commands Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** options.xml 11 Dec 2004 01:09:08 -0000 1.10 --- options.xml 28 Dec 2004 23:51:26 -0000 1.11 *************** *** 2,7 **** <HostAddress>192.168.0.102</HostAddress> <DisplaySettings>default</DisplaySettings> ! <LastScenarioPath>Test.SubTest.py</LastScenarioPath> ! <LastScenarioName>SubTest</LastScenarioName> <xCopyDatabase /> <xWriteXmlDatabase /> --- 2,7 ---- <HostAddress>192.168.0.102</HostAddress> <DisplaySettings>default</DisplaySettings> ! <LastScenarioPath>Test.SurfAir.py</LastScenarioPath> ! <LastScenarioName>SurfAir</LastScenarioName> <xCopyDatabase /> <xWriteXmlDatabase /> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 23:51:37
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4432/src/sim Modified Files: Game.cpp gcb.cpp Log Message: Group selection Ctrl and Alt+number commands Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** gcb.cpp 8 Aug 2004 00:31:34 -0000 1.16 --- gcb.cpp 28 Dec 2004 23:51:25 -0000 1.17 *************** *** 72,77 **** /** * Key down event handler. ! * ! * Skip this event. * * @param event wxKeyEvent object. --- 72,76 ---- /** * Key down event handler. ! * Route to gameFrame * * @param event wxKeyEvent object. *************** *** 79,83 **** void GcbApp::OnKeyDown(wxKeyEvent& event) { ! event.Skip(); } --- 78,82 ---- void GcbApp::OnKeyDown(wxKeyEvent& event) { ! gameFrame->OnKeyDown(event); } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** Game.cpp 28 Dec 2004 00:40:16 -0000 1.112 --- Game.cpp 28 Dec 2004 23:51:25 -0000 1.113 *************** *** 1963,1966 **** --- 1963,1967 ---- if (meGameMode == GM_START) { + event.Skip(); return; } *************** *** 1977,1983 **** groupCtrl->SetGroup(val, hookedUnits); } ! } } --- 1978,1986 ---- groupCtrl->SetGroup(val, hookedUnits); + s = wxString::Format("Formed group %d (%d units)\n", val, hookedUnits.size()); } ! return; } + event.Skip(); } *************** *** 2027,2032 **** } ! ! //tacticalMap->SetHookID(primaryHook); // why commented? hookInfo->SetHookID(primaryHook); oobView->SetHookID(primaryHook); --- 2030,2034 ---- } ! tacticalMap->SetGroupHook(groupUnits); hookInfo->SetHookID(primaryHook); oobView->SetHookID(primaryHook); *************** *** 2121,2125 **** } ! // first check for control key or priority game command key --- 2123,2130 ---- } ! if (controlDown) ! { ! int xx = 0; ! } // first check for control key or priority game command key |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:54:32
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13375/include/sim Modified Files: Game.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Game.h 11 Dec 2004 01:09:05 -0000 1.51 --- Game.h 28 Dec 2004 00:54:21 -0000 1.52 *************** *** 139,144 **** RECT mrectEdit; RECT mrectLowerLeft; - RECT marectButtonBar[N_BUTTON_BARS]; - RECT mrectButtonBarLowerLeft; const int mnWidth; --- 139,142 ---- *************** *** 223,226 **** --- 221,225 ---- bool togglePopup; ///< true to toggle popup menu state wxPoint rightButtonPoint; ///< position of mouse at last right button event + std::vector<long> hookedUnits; ///< vector of hooked unit ids void Activate(); *************** *** 239,242 **** --- 238,242 ---- void HookRandomFriendly(); ///< hooks random friendly platform void NewGroupHook(wxCommandEvent& event); ///< event for group of units hooked + void NewGroupHook(std::vector<long>& groupUnits); ///< implements group hook void NewHook(wxCommandEvent& event); ///< event for single unit hooked (deprecated) void NewHook(long hookID); |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:48:15
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12093/include/sim Removed Files: tcCreditView.h tcNetworkView.h tcPanel.h tcPopupControl.h tcScenarioSelectView.h tcStartView.h Log Message: Changes for OSG 0.9.8 --- tcPanel.h DELETED --- --- tcStartView.h DELETED --- --- tcCreditView.h DELETED --- --- tcPopupControl.h DELETED --- --- tcScenarioSelectView.h DELETED --- --- tcNetworkView.h DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:48:15
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12093/src/sim Removed Files: tcCreditView.cpp tcNetworkView.cpp tcPanel.cpp tcPopupControl.cpp tcScenarioSelectView.cpp tcStartView.cpp Log Message: Changes for OSG 0.9.8 --- tcStartView.cpp DELETED --- --- tcPanel.cpp DELETED --- --- tcCreditView.cpp DELETED --- --- tcScenarioSelectView.cpp DELETED --- --- tcPopupControl.cpp DELETED --- --- tcNetworkView.cpp DELETED --- |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:43:22
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11146 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** GCblue.vcproj 21 Dec 2004 02:26:16 -0000 1.78 --- GCblue.vcproj 28 Dec 2004 00:43:07 -0000 1.79 *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" *************** *** 554,557 **** --- 554,560 ---- </File> <File + RelativePath=".\src\sim\tcUserSelectedGroups.cpp"> + </File> + <File RelativePath="src\sim\tcWeaponObject.cpp"> </File> *************** *** 1466,1469 **** --- 1469,1475 ---- </File> <File + RelativePath=".\include\sim\tcUserSelectedGroups.h"> + </File> + <File RelativePath="include\sim\tcWeaponObject.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:42:44
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11018/include/graphics Added Files: tcNumberWidget.h Log Message: --- NEW FILE: tcNumberWidget.h --- /** ** @file tcNumberWidget.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 _TCNUMBERWIDGET_H_ #define _TCNUMBERWIDGET_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tc3DWindow.h" #include <string> namespace osg { class Texture2D; } class TiXmlNode; /** * GUI widget class derived from tc3DWindow. * Used to adjust and display float parameter graphically */ class tcNumberWidget : public tc3DWindow { public: virtual void Draw(); std::string GetCaption() const {return caption;} void SetBackgroundAlpha(float val); void SetCaption(std::string s) {caption = s;} void SetFontSize(float size); void SetSendRedraw(bool state); void SetSoundEffect(int effect) {soundEffect = effect;} tcNumberWidget(float& param, tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "NumberWidget"); virtual ~tcNumberWidget(); protected: float& val; ///< reference to parameter to adjust std::string caption; bool isMouseOver; int soundEffect; float fontSize; float backgroundAlpha; ///< transparency value for solid color background bool sendRedraw; bool autoChange; ///< true if mouse is down long enough, val will auto increment/decrement float changeIncrement; bool leftButtonDown; ///< true if left button is down unsigned int buttonDownTime; virtual void OnEnterWindow(wxMouseEvent& event); virtual void OnLButtonDown(wxMouseEvent& event); virtual void OnLButtonUp(wxMouseEvent& event); virtual void OnLeaveWindow(wxMouseEvent& event); virtual void OnRButtonDown(wxMouseEvent& event); void SendRedraw(); void UpdateAutoChange(); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:42:22
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10910/include/sim Added Files: tcUserSelectedGroups.h Log Message: --- NEW FILE: tcUserSelectedGroups.h --- /** @file tcUserSelectedGroups.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 _TCUSERSELECTEDGROUPS_H_ #define _TCUSERSELECTEDGROUPS_H_ #if _MSC_VER > 1000 #pragma once #endif #include <map> #include <vector> /** * Tracks ids of grouped units selected by user */ class tcUserSelectedGroups { public: void ClearGroups(); std::vector<long> GetGroup(int idx); void SetGroup(int idx, const std::vector<long>& platforms); static tcUserSelectedGroups* Get(); private: std::map<int, std::vector<long> > groupMap; tcUserSelectedGroups(); ~tcUserSelectedGroups(); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:41:45
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10691/src/graphics Added Files: tcNumberWidget.cpp Log Message: --- NEW FILE: tcNumberWidget.cpp --- /** ** @file tcNumberWidget.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 "tcNumberWidget.h" #include <osg/Texture2D> #include <osg/Vec4> #include "wxcommands.h" #include "tcSound.h" #include "tcTime.h" #include <iostream> #ifdef _DEBUG #define new DEBUG_NEW #endif /** * Drawing Graphics object is based on parent's window since * button is sharing a surface with the parent. * This also allows the button to draw outside of its wxWindow * screen area. */ void tcNumberWidget::Draw() { if (!mbActive) return; UpdateAutoChange(); // non-image drawing osg::Vec4 backgroundColor; osg::Vec4 textColor; if (isMouseOver) { backgroundColor.set(0.1, 0.1, 0.1, backgroundAlpha); textColor.set(1, 1, 1, 1); } else { backgroundColor.set(0.0, 0.0, 0.0, backgroundAlpha); textColor.set(1, 1, 1, backgroundAlpha); } DrawRectangle(0, 0, mnWidth, mnHeight, backgroundColor, FILL_ON); DrawRectangle(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, backgroundAlpha), FILL_OFF); float x = float(mnWidth) - 3.0f; float y = 0.5f * float(mnHeight); // draw caption to the left of the window area DrawText(caption.c_str(), -5.0f, y, defaultFont.get(), osg::Vec4(1, 1, 1, backgroundAlpha), fontSize, RIGHT_CENTER); wxString s = wxString::Format("%.0f", val); DrawText(s.c_str(), x, y, defaultFont.get(), textColor, fontSize, RIGHT_CENTER); HideUnusedObjects(); } /** * */ void tcNumberWidget::OnEnterWindow(wxMouseEvent& event) { if (!isMouseOver) { tcSound::Get()->PlayEffect(soundEffect); } isMouseOver = true; if (sendRedraw) { SendRedraw(); } } /** * */ void tcNumberWidget::OnLButtonDown(wxMouseEvent& event) { wxPoint pos = event.GetPosition(); leftButtonDown = true; buttonDownTime = tcTime::Get()->Get30HzCount(); bool upper = pos.y < mnHeight / 2; // measure could be done once per font size change instead wxSize numberSize; MeasureText(defaultFont.get(), fontSize, "8", numberSize); float digitIdx = floorf(float(mnWidth - pos.x - 2.0f) / float(numberSize.GetWidth())); if (digitIdx < 0) digitIdx = 0; else if (digitIdx > 3) digitIdx = 3; float increment = powf(10.0f, digitIdx); if (upper) { changeIncrement = increment; } else { changeIncrement = -increment; } SendRedraw(); tcSound::Get()->PlayEffect(19); } /** * */ void tcNumberWidget::OnLButtonUp(wxMouseEvent& event) { // implement change for simple click on release of mouse if (!autoChange) { val += changeIncrement; } autoChange = false; changeIncrement = 0; leftButtonDown = false; SendRedraw(); } /** * */ void tcNumberWidget::OnLeaveWindow(wxMouseEvent& event) { isMouseOver = false; leftButtonDown = false; if (sendRedraw) { SendRedraw(); } } /** * */ void tcNumberWidget::OnRButtonDown(wxMouseEvent& event) { event.Skip(); } /** * Send ID_BUTTONREDRAW message to force parent redraw */ void tcNumberWidget::SendRedraw() { wxCommandEvent cmd(wxEVT_COMMAND_BUTTON_CLICKED, ID_BUTTONREDRAW) ; cmd.SetEventObject(this); AddPendingEvent(cmd); } /** * */ void tcNumberWidget::SetBackgroundAlpha(float val) { backgroundAlpha = val; } /** * */ void tcNumberWidget::SetFontSize(float size) { fontSize = size; } /** * */ void tcNumberWidget::SetSendRedraw(bool state) { sendRedraw = state; } /** * Check if mouse button down long enough and * periodically increment / decrement val if so * Allows user to change value quickly by holding mouse * button down. */ void tcNumberWidget::UpdateAutoChange() { unsigned currentTime = tcTime::Get()->Get30HzCount(); if (currentTime - buttonDownTime > 20) { autoChange = true; } if (autoChange) { val += changeIncrement; } if (val < 0) val = 0; } /** * */ tcNumberWidget::tcNumberWidget(float& param, tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : tc3DWindow(parent, pos, size, name, parent), val(param), sendRedraw(false), autoChange(false), changeIncrement(0), leftButtonDown(false), buttonDownTime(0) { caption = "NULL"; isMouseOver = false; soundEffect = -1; fontSize = 10.0f; backgroundAlpha = 1.0f; } tcNumberWidget::~tcNumberWidget() { #ifdef _DEBUG fprintf(stdout, "Destroying number widget\n"); #endif } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:41:11
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10560/src/sim Added Files: tcUserSelectedGroups.cpp Log Message: --- NEW FILE: tcUserSelectedGroups.cpp --- /** @file tcUserSelectedGroups.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 "tcUserSelectedGroups.h" /** * Singleton instance accessor */ tcUserSelectedGroups* tcUserSelectedGroups::Get() { static tcUserSelectedGroups instance; return &instance; } /** * */ void tcUserSelectedGroups::ClearGroups() { groupMap.clear(); } /** * */ std::vector<long> tcUserSelectedGroups::GetGroup(int idx) { std::vector<long> platforms; std::map<int, std::vector<long> >::iterator iter; iter = groupMap.find(idx); if (iter != groupMap.end()) { platforms = iter->second; } return platforms; } /** * */ void tcUserSelectedGroups::SetGroup(int idx, const std::vector<long>& platforms) { groupMap[idx] = platforms; } /** * */ tcUserSelectedGroups::tcUserSelectedGroups() { } /** * */ tcUserSelectedGroups::~tcUserSelectedGroups() { } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-28 00:40:29
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10434/src/sim Modified Files: Game.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** Game.cpp 11 Dec 2004 01:09:07 -0000 1.111 --- Game.cpp 28 Dec 2004 00:40:16 -0000 1.112 *************** *** 59,62 **** --- 59,63 ---- #include "tcPopupMessage.h" #include "tcLauncherPopup.h" + #include "tcUserSelectedGroups.h" #if defined(_MSC_VER) *************** *** 1955,1958 **** --- 1956,1984 ---- void tcGame::OnKeyDown(wxKeyEvent& event) { + int nChar = event.GetKeyCode(); + bool controlDown = event.ControlDown(); + bool altDown = event.AltDown(); + + + if (meGameMode == GM_START) + { + return; + } + + /* If control is down and character is a number, set user selected group + */ + if (controlDown) + { + wxString s = wxString::Format("%c", nChar); + int val = (int)strtol(s.c_str(), NULL, 10); + if ((val >= 1) && (val <= 9)) + { + tcUserSelectedGroups* groupCtrl = tcUserSelectedGroups::Get(); + + groupCtrl->SetGroup(val, hookedUnits); + } + + } + } *************** *** 1967,2000 **** long hookCount = event.m_extraLong; ! if (hookCount <= 0) { ! NewHook(-1); ! return; } ! long* groupList = reinterpret_cast<long*>(event.m_clientData); - // first object id is used for single unit displays - long primaryHook = groupList[0]; if (hookCount == 1) { NewHook(primaryHook); - delete event.m_clientData; return; } ! //tacticalMap->SetHookID(primaryHook); hookInfo->SetHookID(primaryHook); oobView->SetHookID(primaryHook); objectControl->SetHookID(primaryHook); viewer->SetHookID(primaryHook); ! ! std::vector<long> groupUnits; ! for (int n = 0; n< hookCount; n++) ! { ! groupUnits.push_back(groupList[n]); ! } pythonInterface->SetMenuGroup(groupUnits); ! delete event.m_clientData; // is this necessary? tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); --- 1993,2041 ---- long hookCount = event.m_extraLong; ! long* groupList = reinterpret_cast<long*>(event.m_clientData); ! ! std::vector<long> groupUnits; ! for (int n = 0; n < hookCount; n++) { ! groupUnits.push_back(groupList[n]); } ! NewGroupHook(groupUnits); ! ! delete event.m_clientData; // is this necessary? ! } ! ! /** ! * ! */ ! void tcGame::NewGroupHook(std::vector<long>& groupUnits) ! { ! size_t hookCount = groupUnits.size(); ! ! if (hookCount == 0) ! { ! groupUnits.push_back(-1); // clear hook with -1 ! hookCount = 1; ! } ! ! long primaryHook = groupUnits[0]; if (hookCount == 1) { NewHook(primaryHook); return; } + ! //tacticalMap->SetHookID(primaryHook); // why commented? hookInfo->SetHookID(primaryHook); oobView->SetHookID(primaryHook); objectControl->SetHookID(primaryHook); viewer->SetHookID(primaryHook); ! tcGameObject::SetHookedId(primaryHook); ! pythonInterface->SetMenuGroup(groupUnits); ! ! hookedUnits = groupUnits; tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); *************** *** 2032,2035 **** --- 2073,2079 ---- } tcGameObject::SetHookedId(hookID); + + hookedUnits.clear(); + hookedUnits.push_back(hookID); } *************** *** 2037,2040 **** --- 2081,2087 ---- { int nChar = event.GetKeyCode(); + bool controlDown = event.ControlDown(); + bool altDown = event.AltDown(); + if (meGameMode == GM_START) *************** *** 2050,2053 **** --- 2097,2126 ---- } + /* If control is down and character is a number, set user selected group + ** If Alt is down, set group hook to user selected group (if group is empty + ** clear the current hook) + */ + if (altDown) + { + wxString s = wxString::Format("%c", nChar); + int val = (int)strtol(s.c_str(), NULL, 10); + if ((val >= 1) && (val <= 9)) + { + tcUserSelectedGroups* groupCtrl = tcUserSelectedGroups::Get(); + if (controlDown) + { + groupCtrl->SetGroup(val, hookedUnits); + } + else + { + std::vector<long> assignedGroup = groupCtrl->GetGroup(val); + NewGroupHook(assignedGroup); + } + return; + } + + } + + // first check for control key or priority game command key switch(nChar) |
|
From: Dewitt C. <ddc...@us...> - 2004-12-21 02:26:30
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31924/src/sim Modified Files: tcObjectControl.cpp tcSonar.cpp tcTorpedoObject.cpp Log Message: Changes for OSG 0.9.8 Index: tcObjectControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcObjectControl.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcObjectControl.cpp 11 Dec 2004 01:09:07 -0000 1.27 --- tcObjectControl.cpp 21 Dec 2004 02:26:18 -0000 1.28 *************** *** 1400,1404 **** { tcLauncherPopup* popupControl = ! new tcLauncherPopup(mpHookedGameObj->mnID, anLauncher, wxPoint(200, 200)); return true; --- 1400,1404 ---- { tcLauncherPopup* popupControl = ! new tcLauncherPopup(mpHookedGameObj->mnID, anLauncher, wxPoint(220, 200)); return true; Index: tcTorpedoObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTorpedoObject.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcTorpedoObject.cpp 7 Dec 2004 04:00:44 -0000 1.2 --- tcTorpedoObject.cpp 21 Dec 2004 02:26:18 -0000 1.3 *************** *** 155,159 **** goalSpeed_kts = pLauncher->preEnableSpeed_kts; ceiling_m = pLauncher->ceiling_m; ! floor_m = pLauncher->floor_m; --- 155,167 ---- goalSpeed_kts = pLauncher->preEnableSpeed_kts; ceiling_m = pLauncher->ceiling_m; ! ! if (floor_m > 0) ! { ! floor_m = pLauncher->floor_m; ! } ! else ! { ! floor_m = 8096.0f; ! } Index: tcSonar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSonar.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSonar.cpp 7 Dec 2004 04:00:44 -0000 1.3 --- tcSonar.cpp 21 Dec 2004 02:26:18 -0000 1.4 *************** *** 321,324 **** --- 321,325 ---- unsigned int detectMask = PTYPE_SURFACE; if (!mpDBObj->isWakeHoming) detectMask |= PTYPE_SUBSURFACE; + tcTorpedoObject* torpedo = dynamic_cast<tcTorpedoObject*>(parent); // find closest detectable target *************** *** 329,332 **** --- 330,341 ---- bool isEligible = (target->mpDBObject->mnType != PTYPE_TORPEDO) && ((target->mpDBObject->mnType & detectMask) != 0); + + // ignore targets (don't test) outside of programmed depth limits + if (torpedo && ((-target->mcKin.mfAlt_m > torpedo->floor_m) || + (-target->mcKin.mfAlt_m < torpedo->ceiling_m))) + { + isEligible = false; + } + if (isEligible && (target != parent)) // no self detection { |
|
From: Dewitt C. <ddc...@us...> - 2004-12-21 02:26:30
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31924/src/graphics Modified Files: tc3DViewer.cpp tc3DWindow.cpp tcButton.cpp tcLauncherPopup.cpp tcParticleEffect.cpp Log Message: Changes for OSG 0.9.8 Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcButton.cpp 11 Dec 2004 01:09:06 -0000 1.15 --- tcButton.cpp 21 Dec 2004 02:26:17 -0000 1.16 *************** *** 81,95 **** if (isButtonOn) { ! backgroundColor.set(0.392f, 1.0f, 0.392f, backgroundAlpha); textColor.set(0, 0, 0, backgroundAlpha); } else if (isMouseOver) { ! backgroundColor.set(1, 1, 1, backgroundAlpha); textColor.set(0, 0, 0, backgroundAlpha); } else { ! backgroundColor.set(0, 0, 0, backgroundAlpha); textColor.set(1, 1, 1, backgroundAlpha); } --- 81,98 ---- if (isButtonOn) { ! backgroundColor = onColor; ! backgroundColor._v[3] = backgroundAlpha; textColor.set(0, 0, 0, backgroundAlpha); } else if (isMouseOver) { ! backgroundColor = overColor; ! backgroundColor._v[3] = backgroundAlpha; textColor.set(0, 0, 0, backgroundAlpha); } else { ! backgroundColor = offColor; ! backgroundColor._v[3] = backgroundAlpha; textColor.set(1, 1, 1, backgroundAlpha); } *************** *** 174,181 **** /** * version to initialize from XML file */ tcButton::tcButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton", parent) { caption = "NULL"; --- 177,215 ---- /** + * + */ + void tcButton::SetBackgroundAlpha(float val) + { + backgroundAlpha = val; + } + + /** + * + */ + void tcButton::SetFillColors(const osg::Vec4& off_color, const osg::Vec4& over_color, + const osg::Vec4& on_color) + { + offColor = off_color; + overColor = over_color; + onColor = on_color; + } + + /** + * + */ + void tcButton::SetFontSize(float val) + { + fontSize = val; + } + + + /** * version to initialize from XML file */ tcButton::tcButton(tc3DWindow *parent, TiXmlNode *config) ! : tc3DWindow(parent, wxPoint(0,0), wxSize(10,10), "XMLButton", parent), ! offColor(0, 0, 0, 1), ! overColor(0.4, 1, 0.4, 1), ! onColor(1, 1, 1, 1) { caption = "NULL"; *************** *** 255,259 **** tcButton::tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tc3DWindow(parent, pos, size, name, parent) { --- 289,296 ---- tcButton::tcButton(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tc3DWindow(parent, pos, size, name, parent), ! offColor(0, 0, 0, 1), ! overColor(0.4, 1, 0.4, 1), ! onColor(1, 1, 1, 1) { Index: tcParticleEffect.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcParticleEffect.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcParticleEffect.cpp 23 Nov 2004 23:30:57 -0000 1.6 --- tcParticleEffect.cpp 21 Dec 2004 02:26:17 -0000 1.7 *************** *** 87,91 **** // or it's absolute; in the first case, we must transform the vectors // from local to world space. ! if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_TO_PARENTS) { // transform the center point (full transformation) xf_center_ = prg->transformLocalToWorld(center_); --- 87,91 ---- // or it's absolute; in the first case, we must transform the vectors // from local to world space. ! if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_RF) { // transform the center point (full transformation) xf_center_ = prg->transformLocalToWorld(center_); *************** *** 335,339 **** modularEmitter->setPlacer(particlePlacer); ! modularEmitter->setReferenceFrame(osgParticle::Emitter::RELATIVE_TO_ABSOLUTE); shooter = new osgParticle::RadialShooter; --- 335,339 ---- modularEmitter->setPlacer(particlePlacer); ! modularEmitter->setReferenceFrame(osgParticle::Emitter::ABSOLUTE_RF); shooter = new osgParticle::RadialShooter; *************** *** 364,368 **** particlePlacer->setCenter(0, 0, 0); smokeTrailEmitter->setPlacer(particlePlacer); ! smokeTrailEmitter->setReferenceFrame(osgParticle::Emitter::RELATIVE_TO_ABSOLUTE); program = new osgParticle::ModularProgram; --- 364,368 ---- particlePlacer->setCenter(0, 0, 0); smokeTrailEmitter->setPlacer(particlePlacer); ! smokeTrailEmitter->setReferenceFrame(osgParticle::Emitter::ABSOLUTE_RF); program = new osgParticle::ModularProgram; *************** *** 391,395 **** modularEmitter->setPlacer(particlePlacer); ! modularEmitter->setReferenceFrame(osgParticle::Emitter::RELATIVE_TO_ABSOLUTE); shooter = new osgParticle::RadialShooter; --- 391,395 ---- modularEmitter->setPlacer(particlePlacer); ! modularEmitter->setReferenceFrame(osgParticle::Emitter::ABSOLUTE_RF); shooter = new osgParticle::RadialShooter; Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tc3DViewer.cpp 11 Dec 2004 01:09:06 -0000 1.7 --- tc3DViewer.cpp 21 Dec 2004 02:26:17 -0000 1.8 *************** *** 1206,1210 **** osg::Light* light = new osg::Light; lightsource->setLight(light); ! lightsource->setReferenceFrame(osg::LightSource::RELATIVE_TO_ABSOLUTE); // headlight. lightsource->setLocalStateSetModes(osg::StateAttribute::ON); light->setPosition(osg::Vec4(0,0,1,1)); --- 1206,1210 ---- osg::Light* light = new osg::Light; lightsource->setLight(light); ! lightsource->setReferenceFrame(osg::LightSource::ABSOLUTE_RF); // headlight. lightsource->setLocalStateSetModes(osg::StateAttribute::ON); light->setPosition(osg::Vec4(0,0,1,1)); *************** *** 1265,1269 **** guiObjects = new osg::MatrixTransform; guiObjects->setMatrix(osg::Matrix::identity()); ! guiObjects->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_ABSOLUTE); guiView->setSceneData(guiObjects.get()); --- 1265,1269 ---- guiObjects = new osg::MatrixTransform; guiObjects->setMatrix(osg::Matrix::identity()); ! guiObjects->setReferenceFrame(osg::MatrixTransform::ABSOLUTE_RF); guiView->setSceneData(guiObjects.get()); *************** *** 1858,1862 **** hudObjects = new osg::MatrixTransform; hudObjects->setMatrix(osg::Matrix::identity()); ! hudObjects->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_ABSOLUTE); orthoProjection = new osg::Projection(); --- 1858,1862 ---- hudObjects = new osg::MatrixTransform; hudObjects->setMatrix(osg::Matrix::identity()); ! hudObjects->setReferenceFrame(osg::MatrixTransform::ABSOLUTE_RF); orthoProjection = new osg::Projection(); Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcLauncherPopup.cpp 11 Dec 2004 01:09:06 -0000 1.2 --- tcLauncherPopup.cpp 21 Dec 2004 02:26:17 -0000 1.3 *************** *** 22,27 **** --- 22,30 ---- #include "stdwx.h" + #include "wxcommands.h" + #include "tcButton.h" #include "tcLauncherPopup.h" #include "tcLauncher.h" + #include "tcNumberWidget.h" #include "tcPlatformObject.h" #include "tcSimState.h" *************** *** 36,39 **** --- 39,50 ---- #endif + + BEGIN_EVENT_TABLE(tcLauncherPopup, tc3DWindow) + EVT_COMMAND(LP_CLOSE, wxEVT_COMMAND_BUTTON_CLICKED, tcLauncherPopup::OnCloseCommand) + EVT_COMMAND(LP_LAUNCH, wxEVT_COMMAND_BUTTON_CLICKED, tcLauncherPopup::OnLaunchCommand) + EVT_COMMAND(LP_SETDATUM, wxEVT_COMMAND_BUTTON_CLICKED, tcLauncherPopup::OnDatumCommand) + EVT_COMMAND(ID_BUTTONREDRAW, wxEVT_COMMAND_BUTTON_CLICKED , tcLauncherPopup::OnChildRedraw) + END_EVENT_TABLE() + tc3DWindow* tcLauncherPopup::parent = 0; *************** *** 53,63 **** void tcLauncherPopup::Draw() { ! unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; ! if (age % 10 == 0) redraw = true; if (!redraw) return; redraw = false; --- 64,83 ---- void tcLauncherPopup::Draw() { ! if (destroy) ! { ! ClearDrawObjects(); ! this->Destroy(); ! return; ! } + unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; ! if (age % 1 == 0) redraw = true; if (!redraw) return; + + UpdateTorpedoLauncher(); + redraw = false; *************** *** 72,76 **** DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), ! osg::Vec4(0, 0, 0, 0.5f), FILL_ON); DrawBorder(); --- 92,96 ---- DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), ! osg::Vec4(0, 0, 0, 0.6f), FILL_ON); DrawBorder(); *************** *** 103,128 **** color, fontSize, LEFT_CENTER); - MeasureText(defaultFont.get(), fontSize, s.c_str(), textSize); - x += float(textSize.GetWidth()) + 5.0f; - - datumButton.Set(x, x + 10.0f, - y - 0.5f * float(textSize.GetHeight()), y + 0.5 * float(textSize.GetHeight())); - DrawRectangleR(datumButton, osg::Vec4(1, 1, 1, 1), FILL_OFF); - - - x += 15.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(); --- 123,140 ---- color, fontSize, LEFT_CENTER); if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { ! launchButton->SetFillColors(osg::Vec4(0.2, 0.5, 0.2, 1.0), osg::Vec4(0.4, 1.0, 0.4, 1.0), ! osg::Vec4(0.4, 1.0, 0.4, 1.0)); } else { ! launchButton->SetFillColors(osg::Vec4(0.5, 0.2, 0.2, 1.0), osg::Vec4(0.5, 0.2, 0.2, 1.0), ! osg::Vec4(0.5, 0.2, 0.2, 1.0)); } ! ! ! DrawChildren(); HideUnusedObjects(); *************** *** 148,188 **** /** ! * 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 if (datumButton.ContainsPoint(pos.x, pos.y)) { ! if (tcLauncher* launcher = GetLauncher()) { ! tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", platformId, launcherIdx); } } ! else { ! ClearDrawObjects(); ! this->Destroy(); } } --- 160,333 ---- /** ! * Create and initialize GUI objects for torpedo control */ ! void tcLauncherPopup::InitTorpedoControls() { ! const int widgetWidth = 40; ! const int widgetHeight = 12; ! const float widgetFontSize = 12.0; ! const float widgetAlpha = 0.9f; ! int x = 80; ! int y = 20; ! tcLauncher* launcher = GetLauncher(); ! wxASSERT(launcher); ! if (!launcher) return; ! ! launchButton = new tcButton(this, wxPoint(mnWidth - 40, 5), ! wxSize(widgetHeight, widgetHeight)); ! launchButton->SetActive(true); ! launchButton->SetBackgroundAlpha(widgetAlpha); ! launchButton->SetCaption("L"); ! launchButton->SetCommand(LP_LAUNCH); ! launchButton->SetFontSize(11.0); ! launchButton->SetSendRedraw(true); ! ! selectDatumButton = new tcButton(this, wxPoint(mnWidth - 55, 5), ! wxSize(widgetHeight, widgetHeight)); ! selectDatumButton->SetActive(true); ! selectDatumButton->SetBackgroundAlpha(widgetAlpha); ! selectDatumButton->SetCaption("D"); ! selectDatumButton->SetCommand(LP_SETDATUM); ! selectDatumButton->SetFontSize(11.0); ! selectDatumButton->SetSendRedraw(true); ! ! runToEnableAdjust = new tcNumberWidget(runToEnable, this, wxPoint(x, y), ! wxSize(widgetWidth, widgetHeight)); ! runToEnableAdjust->SetBackgroundAlpha(widgetAlpha); ! runToEnableAdjust->SetCaption("Run to enable"); ! runToEnableAdjust->SetFontSize(widgetFontSize); ! runToEnableAdjust->SetActive(true); ! runToEnableAdjust->SetSendRedraw(true); ! runToEnable = launcher->runToEnable_m; ! y += widgetHeight + 5; ! ! depthAdjust = new tcNumberWidget(depth, this, wxPoint(x, y), ! wxSize(widgetWidth, widgetHeight)); ! depthAdjust->SetBackgroundAlpha(widgetAlpha); ! depthAdjust->SetCaption("Depth"); ! depthAdjust->SetFontSize(widgetFontSize); ! depthAdjust->SetActive(true); ! depthAdjust->SetSendRedraw(true); ! depth = launcher->runDepth_m; ! y += widgetHeight + 5; ! ! speedAdjust = new tcNumberWidget(speed, this, wxPoint(x, y), ! wxSize(widgetWidth, widgetHeight)); ! speedAdjust->SetBackgroundAlpha(widgetAlpha); ! speedAdjust->SetCaption("Speed"); ! speedAdjust->SetFontSize(widgetFontSize); ! speedAdjust->SetActive(true); ! speedAdjust->SetSendRedraw(true); ! speed = launcher->preEnableSpeed_kts; ! y += widgetHeight + 5; ! ! ceilingAdjust = new tcNumberWidget(ceiling, this, wxPoint(x, y), ! wxSize(widgetWidth, widgetHeight)); ! ceilingAdjust->SetBackgroundAlpha(widgetAlpha); ! ceilingAdjust->SetCaption("Ceiling"); ! ceilingAdjust->SetFontSize(widgetFontSize); ! ceilingAdjust->SetActive(true); ! ceilingAdjust->SetSendRedraw(true); ! ceiling = launcher->ceiling_m; ! y += widgetHeight + 5; ! ! floorAdjust = new tcNumberWidget(floor, this, wxPoint(x, y), ! wxSize(widgetWidth, widgetHeight)); ! floorAdjust->SetBackgroundAlpha(widgetAlpha); ! floorAdjust->SetCaption("Floor"); ! floorAdjust->SetFontSize(widgetFontSize); ! floorAdjust->SetActive(true); ! floorAdjust->SetSendRedraw(true); ! floor = launcher->floor_m; ! y += widgetHeight + 5; ! ! //tcButton* activePassiveButton; ! } ! ! /** ! * Update torpedo launcher with GUI params ! */ ! void tcLauncherPopup::UpdateTorpedoLauncher() ! { ! tcLauncher* launcher = GetLauncher(); ! wxASSERT(launcher); ! ! launcher->runToEnable_m = runToEnable; ! ! launcher->runDepth_m = depth; ! launcher->preEnableSpeed_kts = speed; ! launcher->ceiling_m = ceiling; ! launcher->floor_m = floor; ! launcher->usePassive = isPassive; ! } ! ! /** ! * Intended to be overrided to intercept command events from GUI ! * objects within the window. ! * This routine intercepts the ID_BUTTONREDRAW event. ! */ ! void tcLauncherPopup::OnChildRedraw(wxCommandEvent& event) ! { ! redraw = true; ! } ! ! /** ! * Close and destroy popup ! */ ! void tcLauncherPopup::OnCloseCommand(wxCommandEvent& event) ! { ! destroy = true; ! } ! ! ! void tcLauncherPopup::OnDatumCommand(wxCommandEvent& event) ! { ! redraw = true; ! ! if (tcLauncher* launcher = GetLauncher()) { ! tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", platformId, launcherIdx); } ! } ! ! void tcLauncherPopup::OnLaunchCommand(wxCommandEvent& event) ! { ! redraw = true; ! ! 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)); ! //} } } ! } ! ! /** ! * A hack job for now :) ! */ ! void tcLauncherPopup::OnLButtonDown(wxMouseEvent& event) ! { ! wxPoint pos = event.GetPosition(); ! ! isLButtonDown = true; ! if ((pos.y <= 10) || (pos.y >= mnHeight)) { ! dragOn = true; ! // position in parent's frame of mouse pointer ! dragPoint = wxPoint(mrectWindow.GetLeft() + pos.x, mrectWindow.GetBottom() + pos.y); ! return; } + } *************** *** 190,195 **** * */ ! void tcLauncherPopup::OnMouseOver(wxMouseEvent& event) { } --- 335,362 ---- * */ ! void tcLauncherPopup::OnLButtonUp(wxMouseEvent& event) { + isLButtonDown = false; + dragOn = false; + } + + /** + * + */ + void tcLauncherPopup::OnMouseMove(wxMouseEvent& event) + { + if (!dragOn) return; + + wxPoint pos = event.GetPosition(); + + // position in parent's frame of mouse pointer + wxPoint current = wxPoint(mrectWindow.GetLeft() + pos.x, mrectWindow.GetBottom() + pos.y); + if (current != dragPoint) + { + wxPoint delta = current - dragPoint; + tc3DWindow::MoveWindow(mrectWindow.GetLeft() + delta.x, + mrectWindow.GetTop() + delta.y); + dragPoint = current; + } } *************** *** 200,207 **** */ 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); --- 367,376 ---- */ tcLauncherPopup::tcLauncherPopup(long id, unsigned idx, const wxPoint& pos) ! : tc3DWindow(parent, pos, wxSize(200, 150), "LauncherPopupControl", parent), platformId(id), launcherIdx(idx), ! redraw(true), ! dragOn(false), ! destroy(false) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); *************** *** 211,214 **** --- 380,396 ---- wxASSERT(simState); + const int closeButtonSize = 12; + closeButton = new tcButton(this, wxPoint(mnWidth - closeButtonSize, 0), + wxSize(closeButtonSize, closeButtonSize)); + closeButton->SetActive(true); + closeButton->SetBackgroundAlpha(1.0); + closeButton->SetCaption(""); + closeButton->SetCommand(LP_CLOSE); + closeButton->LoadImages("close.png", "close.png", "close.png", "close.png"); + closeButton->SetSendRedraw(true); + + + InitTorpedoControls(); + SetActive(true); } Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tc3DWindow.cpp 7 Dec 2004 04:00:28 -0000 1.12 --- tc3DWindow.cpp 21 Dec 2004 02:26:17 -0000 1.13 *************** *** 1538,1542 **** osg::ref_ptr<osg::MatrixTransform> transform = new osg::MatrixTransform; ! transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_PARENTS); transform->setDataVariance(osg::Object::DYNAMIC); --- 1538,1542 ---- osg::ref_ptr<osg::MatrixTransform> transform = new osg::MatrixTransform; ! transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_RF); transform->setDataVariance(osg::Object::DYNAMIC); *************** *** 1568,1571 **** --- 1568,1576 ---- HideUnusedObjects(); + + for (size_t n=0; n<children.size(); n++) + { + children[n]->ClearDrawObjects(); + } } *************** *** 1862,1866 **** transform->setDataVariance(osg::Object::DYNAMIC); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); ! transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_PARENTS); } else --- 1867,1871 ---- transform->setDataVariance(osg::Object::DYNAMIC); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); ! transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_RF); } else *************** *** 1869,1873 **** transform->setDataVariance(osg::Object::DYNAMIC); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); ! transform->setReferenceFrame(osg::MatrixTransform::RELATIVE_TO_ABSOLUTE); } --- 1874,1878 ---- transform->setDataVariance(osg::Object::DYNAMIC); transform->setMatrix(osg::Matrix::translate(pos.x, pos.y + yOffset, 0)); ! transform->setReferenceFrame(osg::MatrixTransform::ABSOLUTE_RF); } |
|
From: Dewitt C. <ddc...@us...> - 2004-12-21 02:26:30
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31924/include/graphics Modified Files: tc3DWindow.h tcButton.h tcLauncherPopup.h Log Message: Changes for OSG 0.9.8 Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tc3DWindow.h 23 Nov 2004 23:30:46 -0000 1.11 --- tc3DWindow.h 21 Dec 2004 02:26:17 -0000 1.12 *************** *** 65,68 **** --- 65,69 ---- using osgText::Text::LEFT_BASE_LINE; using osgText::Text::LEFT_CENTER; + using osgText::Text::RIGHT_CENTER; using osgText::Text::CENTER_CENTER; Index: tcLauncherPopup.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcLauncherPopup.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcLauncherPopup.h 11 Dec 2004 01:09:04 -0000 1.2 --- tcLauncherPopup.h 21 Dec 2004 02:26:17 -0000 1.3 *************** *** 37,40 **** --- 37,42 ---- class tcLauncher; class tcSimState; + class tcButton; + class tcNumberWidget; /** *************** *** 56,73 **** bool redraw; unsigned int birthCount; virtual void OnLButtonDown(wxMouseEvent& event); ! virtual void OnMouseOver(wxMouseEvent& event); private: long platformId; unsigned launcherIdx; tcSimState* simState; ! tcRect launchButton; ! tcRect datumButton; ! tcLauncher* GetLauncher(); }; --- 58,109 ---- bool redraw; unsigned int birthCount; + bool isLButtonDown; + bool dragOn; + wxPoint dragPoint; ///< initial point at start of drag + + virtual void OnChildRedraw(wxCommandEvent& event); + virtual void OnCloseCommand(wxCommandEvent& event); + virtual void OnDatumCommand(wxCommandEvent& event); + virtual void OnLaunchCommand(wxCommandEvent& event); + virtual void OnLButtonDown(wxMouseEvent& event); ! virtual void OnLButtonUp(wxMouseEvent& event); ! virtual void OnMouseMove(wxMouseEvent& event); ! ! private: + enum {LP_CLOSE = 0, LP_LAUNCH = 1, LP_SETDATUM = 2}; long platformId; unsigned launcherIdx; tcSimState* simState; ! bool destroy; ///< workaround to delay destruction of window to safe time ! tcLauncher* GetLauncher(); + void InitTorpedoControls(); + void UpdateTorpedoLauncher(); + + tcButton* closeButton; + + // torpedo launcher controls + tcButton* launchButton; + tcButton* selectDatumButton; + + tcNumberWidget* runToEnableAdjust; + tcNumberWidget* depthAdjust; + tcNumberWidget* speedAdjust; + tcNumberWidget* ceilingAdjust; + tcNumberWidget* floorAdjust; + tcButton* activePassiveButton; + float runToEnable; + float depth; + float speed; + float ceiling; + float floor; + bool isPassive; + DECLARE_EVENT_TABLE() }; Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcButton.h 11 Dec 2004 01:09:04 -0000 1.10 --- tcButton.h 21 Dec 2004 02:26:17 -0000 1.11 *************** *** 51,56 **** void LoadImages(std::string offImageName, std::string onImageName, std::string overOffImageName, std::string overOnImageName); void SetCaption(std::string s) {caption = s;} ! void SetCommand(long cmd) {command = cmd;} void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} --- 51,61 ---- void LoadImages(std::string offImageName, std::string onImageName, std::string overOffImageName, std::string overOnImageName); + + void SetBackgroundAlpha(float val); void SetCaption(std::string s) {caption = s;} ! void SetCommand(long cmd) {command = cmd;} ! void SetFillColors(const osg::Vec4& off_color, const osg::Vec4& over_color, ! const osg::Vec4& on_color); ! void SetFontSize(float val); void SetOn(bool state) {isButtonOn = state;} void SetSendRedraw(bool state) {sendRedraw = state;} *************** *** 71,74 **** --- 76,83 ---- bool sendRedraw; ///< true to send redraw message to parent on button state change float backgroundAlpha; ///< transparency value for solid color background + + osg::Vec4 offColor; + osg::Vec4 overColor; + osg::Vec4 onColor; osg::ref_ptr<osg::Texture2D> offImage; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-21 02:26:27
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31924 Modified Files: GCblue.vcproj Log Message: Changes for OSG 0.9.8 Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** GCblue.vcproj 11 Dec 2004 01:09:03 -0000 1.77 --- GCblue.vcproj 21 Dec 2004 02:26:16 -0000 1.78 *************** *** 333,336 **** --- 333,339 ---- </File> <File + RelativePath=".\src\graphics\tcNumberWidget.cpp"> + </File> + <File RelativePath=".\src\graphics\tcOOBView.cpp"> </File> *************** *** 1236,1239 **** --- 1239,1245 ---- </File> <File + RelativePath=".\include\graphics\tcNumberWidget.h"> + </File> + <File RelativePath=".\include\graphics\tcOOBView.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:56
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/include/graphics Modified Files: tcButton.h tcLauncherPopup.h tcMapView.h tcOOBView.h tcPopupControl.h Log Message: Sonar work, passive sonar, torpedoes Index: tcPopupControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcPopupControl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcPopupControl.h 1 Nov 2004 03:17:16 -0000 1.3 --- tcPopupControl.h 11 Dec 2004 01:09:04 -0000 1.4 *************** *** 42,45 **** --- 42,48 ---- class tcSimPythonInterface; } + + class tcCommandQueue; + using namespace ScriptInterface; Index: tcOOBView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcOOBView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcOOBView.h 7 Dec 2004 03:59:08 -0000 1.3 --- tcOOBView.h 11 Dec 2004 01:09:04 -0000 1.4 *************** *** 30,34 **** #include "wx/wx.h" ! #include "tc3DWindow.h" #include "tcPool.h" #include "tcDatabase.h" --- 30,34 ---- #include "wx/wx.h" ! #include "tcXmlWindow.h" #include "tcPool.h" #include "tcDatabase.h" *************** *** 48,64 **** struct tsOOBInfo { ! tnPoolIndex mnID; ! tcDBString mzName; ! tnPoolIndex mnLeaderID; ! std::vector<unsigned> maFollowers; ! bool mbRadiating; ! float mfDamage_fract; ///< damage over toughness ! std::string mzAction; ! tcRect rectf; ///< draw location (without offset for current scroll) ! tcRect remcon; ///< location for EMCON icon ! tcRect rdamage; ///< location for damage indicator ! tcRect raction; ///< loc for action string ! tsOOBInfo& operator= (const tsOOBInfo& rhs); }; --- 48,64 ---- struct tsOOBInfo { ! tnPoolIndex mnID; ! tcDBString mzName; ! tnPoolIndex mnLeaderID; ! std::vector<unsigned> maFollowers; ! bool mbRadiating; ! float mfDamage_fract; ///< damage over toughness ! std::string mzAction; ! tcRect rectf; ///< draw location (without offset for current scroll) ! tcRect remcon; ///< location for EMCON icon ! tcRect rdamage; ///< location for damage indicator ! tcRect raction; ///< loc for action string ! tsOOBInfo& operator= (const tsOOBInfo& rhs); }; *************** *** 72,132 **** * All of the code in this section is out of date and needs refactoring */ ! class tcOOBView : public tc3DWindow { public: ! tcSimState* mpSimState; ///< for retrieving platform info ! tcTacticalMapView *mpMapView; ! int mnAlliance; ///< alliance to display ! std::vector<tsOOBInfo> surfaceObj; ! std::vector<tsOOBInfo> airObj; ! std::vector<tsOOBInfo> flightopsObj; ///< carriers and airfields ! tnPoolIndex mnSelectedKey; ! struct ! { ! bool mbApply; ! tnPoolIndex mnFollowerKey; ! tnPoolIndex mnNewLeaderKey; ! } msFormationChangeInfo; ! void AttachMapView(tcTacticalMapView *apMapView) {mpMapView = apMapView;} ! void Update(); ! void Draw(); ! void OnLButtonDown(wxMouseEvent& event); ! void OnLButtonUp(wxMouseEvent& event); ! void OnMouseMove(wxMouseEvent& event); ! void SetHookID(long id) {mnSelectedKey = id;} ! tcOOBView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "OOBView"); ! ~tcOOBView(); private: ! bool mbMouseDrag; ! float mfRowSpacing; ! float mfYOffset; ///< offset for Y coord of first item ! float mfXOffset; ! float mfXIndent; ///< indent for formations ! tnPoolIndex objKeys[MAX_OOB_OBJECTS]; ! /* ! Gdiplus::SolidBrush* mpBrush; ! Gdiplus::Pen* mpPen; ! Gdiplus::Font* mpFont; ! */ ! tsOOBInfo* ButtonContainingPoint(wxRealPoint pointf); ! tsOOBInfo* ButtonContainingPointCategory(wxRealPoint pointf, ! std::vector<tsOOBInfo>& objInfo); ! void DrawCategory(std::vector<tsOOBInfo>& objInfo, float stopy); ! float GetCategoryY(std::vector<tsOOBInfo>& objInfo); ! void PlaceIcons(); ! void PlaceIconsCategory(std::vector<tsOOBInfo>& objInfo); ! void UpdateData(); ! void UpdateFormation(); ! void UpdateRect(); ! void UpdateRectCategory(std::vector<tsOOBInfo>& objInfo, float& y, float stopy); }; --- 72,155 ---- * All of the code in this section is out of date and needs refactoring */ ! class tcOOBView : public tcXmlWindow { public: ! tcSimState* mpSimState; ///< for retrieving platform info ! tcTacticalMapView *mpMapView; ! int mnAlliance; ///< alliance to display ! // own alliance ! std::vector<tsOOBInfo> surfaceObj; ! std::vector<tsOOBInfo> airObj; ! std::vector<tsOOBInfo> flightopsObj; ///< carriers and airfields ! std::vector<tsOOBInfo> heloObj; ! std::vector<tsOOBInfo> subObj; ! // tracks ! std::vector<tsOOBInfo> surfaceTracks; ! std::vector<tsOOBInfo> subTracks; ! std::vector<tsOOBInfo> airTracks; ! std::vector<tsOOBInfo> missileTracks; ! std::vector<tsOOBInfo> unknownTracks; ! tnPoolIndex mnSelectedKey; ! struct ! { ! bool mbApply; ! tnPoolIndex mnFollowerKey; ! tnPoolIndex mnNewLeaderKey; ! } msFormationChangeInfo; ! ! void AttachMapView(tcTacticalMapView *apMapView) {mpMapView = apMapView;} ! void Update(); ! void Draw(); ! void OnLButtonDown(wxMouseEvent& event); ! void OnLButtonUp(wxMouseEvent& event); ! void OnMouseMove(wxMouseEvent& event); ! void SetDisplayOwn(wxCommandEvent& event); ! void SetDisplayTrack(wxCommandEvent& event); ! void SetIPText(wxCommandEvent& event); ! ! void SetHookID(long id) {mnSelectedKey = id;} ! ! tcOOBView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "OOBView"); ! ~tcOOBView(); private: ! /** * */ ! enum DisplayMode ! { ! SHOW_OWN = 0, ! SHOW_TRACKS = 1 ! }; ! bool mbMouseDrag; ! float mfRowSpacing; ! float mfYOffset; ///< offset for Y coord of first item ! float mfXOffset; ! float mfXIndent; ///< indent for formations ! int displayMode; ! tnPoolIndex objKeys[MAX_OOB_OBJECTS]; ! tsOOBInfo* ButtonContainingPoint(wxRealPoint pointf); ! tsOOBInfo* ButtonContainingPointCategory(wxRealPoint pointf, ! std::vector<tsOOBInfo>& objInfo); ! void DrawCategory(std::vector<tsOOBInfo>& objInfo, float stopy); ! void DrawOwn(); ! void DrawTracks(); ! ! float GetCategoryY(std::vector<tsOOBInfo>& objInfo); ! void PlaceIcons(); ! void PlaceIconsCategory(std::vector<tsOOBInfo>& objInfo); ! void UpdateData(); ! void UpdateTrackData(); ! void UpdateFormation(); ! void UpdateRect(); ! void UpdateRectCategory(std::vector<tsOOBInfo>& objInfo, float& y, float stopy); ! ! DECLARE_EVENT_TABLE() }; *************** *** 135,138 **** --- 158,162 ---- + #endif Index: tcLauncherPopup.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcLauncherPopup.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcLauncherPopup.h 7 Dec 2004 03:59:08 -0000 1.1 --- tcLauncherPopup.h 11 Dec 2004 01:09:04 -0000 1.2 *************** *** 65,68 **** --- 65,69 ---- tcSimState* simState; tcRect launchButton; + tcRect datumButton; tcLauncher* GetLauncher(); Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcMapView.h 7 Dec 2004 03:59:07 -0000 1.8 --- tcMapView.h 11 Dec 2004 01:09:04 -0000 1.9 *************** *** 45,48 **** --- 45,49 ---- } + class tcCommandQueue; class tcMapData; class tcMapObject; *************** *** 273,276 **** --- 274,278 ---- char mzMapCmdCallback[128]; int callbackParam; + long callbackPlatformID; ///< platform ID for callback *************** *** 283,291 **** float GetMapCmdHeading() {return mfMapCmdHeading;} long GetMapCmdTarget() {return mnMapCmdTarget;} ! void SetMapCmdCallback(const char *azCallback, int param = -1) ! { ! strcpy(mzMapCmdCallback,azCallback); ! callbackParam = param; ! } void SetMousePoint(wxPoint point) {mpointMouse = point;} // used to be TranslatePoint(point); void ScrollMap(float afDirection_deg); --- 285,289 ---- float GetMapCmdHeading() {return mfMapCmdHeading;} long GetMapCmdTarget() {return mnMapCmdTarget;} ! void SetMapCmdCallback(const char *azCallback, long id, int param = -1); void SetMousePoint(wxPoint point) {mpointMouse = point;} // used to be TranslatePoint(point); void ScrollMap(float afDirection_deg); Index: tcButton.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcButton.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcButton.h 2 Oct 2004 22:41:32 -0000 1.9 --- tcButton.h 11 Dec 2004 01:09:04 -0000 1.10 *************** *** 70,73 **** --- 70,74 ---- float fontSize; bool sendRedraw; ///< true to send redraw message to parent on button state change + float backgroundAlpha; ///< transparency value for solid color background osg::ref_ptr<osg::Texture2D> offImage; |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:56
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/src/graphics Modified Files: tc3DViewer.cpp tcButton.cpp tcLauncherPopup.cpp tcMapView.cpp tcOOBView.cpp tcPopupControl.cpp Log Message: Sonar work, passive sonar, torpedoes Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcLauncherPopup.cpp 7 Dec 2004 04:00:41 -0000 1.1 --- tcLauncherPopup.cpp 11 Dec 2004 01:09:06 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- #include "tcSimState.h" #include "tcTime.h" + #include "tcCommandQueue.h" #include <stdio.h> *************** *** 105,108 **** --- 106,116 ---- x += float(textSize.GetWidth()) + 5.0f; + datumButton.Set(x, x + 10.0f, + y - 0.5f * float(textSize.GetHeight()), y + 0.5 * float(textSize.GetHeight())); + DrawRectangleR(datumButton, osg::Vec4(1, 1, 1, 1), FILL_OFF); + + + x += 15.0f; + launchButton.Set(x, x + 10.0f, y - 0.5f * float(textSize.GetHeight()), y + 0.5 * float(textSize.GetHeight())); *************** *** 165,168 **** --- 173,183 ---- } } + else if (datumButton.ContainsPoint(pos.x, pos.y)) + { + if (tcLauncher* launcher = GetLauncher()) + { + tcCommandQueue::Get()->GetUserInputForID("SetDatum", "Datum", platformId, launcherIdx); + } + } else { Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcOOBView.cpp 7 Dec 2004 04:00:41 -0000 1.5 --- tcOOBView.cpp 11 Dec 2004 01:09:06 -0000 1.6 *************** *** 31,34 **** --- 31,43 ---- #include "tcSimState.h" #include "tcSound.h" + #include "tcHeloObject.h" + #include "tcSubObject.h" + #include "tcSensorMap.h" + #include "tcSensorTrackIterator.h" + + BEGIN_EVENT_TABLE(tcOOBView, tcXmlWindow) + EVT_COMMAND(1, wxEVT_COMMAND_BUTTON_CLICKED, tcOOBView::SetDisplayOwn) [...1182 lines suppressed...] } *************** *** 522,529 **** tcOOBView::~tcOOBView() { ! /* ! if (mpPen != NULL) {delete mpPen;} ! if (mpFont != NULL) {delete mpFont;} ! if (mpBrush != NULL) {delete mpBrush;} ! */ } \ No newline at end of file --- 797,800 ---- tcOOBView::~tcOOBView() { ! } \ No newline at end of file Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMapView.cpp 7 Dec 2004 04:00:41 -0000 1.11 --- tcMapView.cpp 11 Dec 2004 01:09:06 -0000 1.12 *************** *** 31,34 **** --- 31,35 ---- #include "tcMapView.h" + #include "tcCommandQueue.h" #include "aerror.h" #include "mapsymbols.h" *************** *** 44,49 **** #include <math.h> ! #include <sys/timeb.h> ! #include <wingdi.h> using namespace std; --- 45,50 ---- #include <math.h> ! //#include <sys/timeb.h> ! //#include <wingdi.h> using namespace std; *************** *** 2071,2075 **** else { ! mpCommandInterface->AddPythonCallback(mzMapCmdCallback,"Heading",callbackParam); } mbMapCmdActive = false; --- 2072,2077 ---- else { ! mpCommandInterface->AddPythonCallbackForID(mzMapCmdCallback, "Heading", ! callbackPlatformID, callbackParam); } mbMapCmdActive = false; *************** *** 2088,2092 **** else { ! mpCommandInterface->AddPythonCallback(mzMapCmdCallback,"Target",callbackParam); } } --- 2090,2095 ---- else { ! mpCommandInterface->AddPythonCallbackForID(mzMapCmdCallback, "Target", ! callbackPlatformID, callbackParam); } } *************** *** 2105,2109 **** else { ! mpCommandInterface->AddPythonCallback(mzMapCmdCallback,"Datum",callbackParam); } break; --- 2108,2113 ---- else { ! mpCommandInterface->AddPythonCallbackForID(mzMapCmdCallback, "Datum", ! callbackPlatformID, callbackParam); } break; *************** *** 2295,2298 **** --- 2299,2312 ---- } + /** + * Sets callback parameters to use when map command is completed + */ + void tcTacticalMapView::SetMapCmdCallback(const char *azCallback, long id, int param) + { + strcpy(mzMapCmdCallback,azCallback); + callbackPlatformID = id; + callbackParam = param; + } + void tcTacticalMapView::UpdateNavPoints(vector<tcPoint> *mpPoints) { Index: tcPopupControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPopupControl.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcPopupControl.cpp 2 Dec 2004 04:17:25 -0000 1.6 --- tcPopupControl.cpp 11 Dec 2004 01:09:06 -0000 1.7 *************** *** 28,31 **** --- 28,32 ---- #include "tcPopupControl.h" #include "AError.h" + #include "tcCommandQueue.h" #include "tcSimPythonInterface.h" Index: tcButton.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcButton.cpp 2 Nov 2004 04:23:56 -0000 1.14 --- tcButton.cpp 11 Dec 2004 01:09:06 -0000 1.15 *************** *** 81,100 **** if (isButtonOn) { ! backgroundColor.set(0.392f, 1.0f, 0.392f, 1.0f); ! textColor.set(0, 0, 0, 1); } else if (isMouseOver) { ! backgroundColor.set(1, 1, 1, 1); ! textColor.set(0, 0, 0, 1); } else { ! backgroundColor.set(0, 0, 0, 1); ! textColor.set(1, 1, 1, 1); } DrawRectangle(0, 0, mnWidth, mnHeight, backgroundColor, FILL_ON); ! DrawRectangle(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, 1), FILL_OFF); /* --- 81,100 ---- if (isButtonOn) { ! backgroundColor.set(0.392f, 1.0f, 0.392f, backgroundAlpha); ! textColor.set(0, 0, 0, backgroundAlpha); } else if (isMouseOver) { ! backgroundColor.set(1, 1, 1, backgroundAlpha); ! textColor.set(0, 0, 0, backgroundAlpha); } else { ! backgroundColor.set(0, 0, 0, backgroundAlpha); ! textColor.set(1, 1, 1, backgroundAlpha); } DrawRectangle(0, 0, mnWidth, mnHeight, backgroundColor, FILL_ON); ! DrawRectangle(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, backgroundAlpha), FILL_OFF); /* *************** *** 186,189 **** --- 186,190 ---- fontSize = 12.0f; sendRedraw = false; + backgroundAlpha = 1.0f; ref_count++; *************** *** 201,204 **** --- 202,206 ---- int height; int command; + double alpha; current->Attribute("X", &x); *************** *** 213,216 **** --- 215,233 ---- SetName(caption.c_str()); + int ydir = 0; + current->Attribute("YDir", &ydir); + + if (ydir == 1) + { + wxSize parSize = parent->GetSize(); + y = float(parSize.GetHeight()) - y - height; + } + + current->Attribute("Alpha", &alpha); + if (alpha) backgroundAlpha = alpha; + + double xmlFontSize = fontSize; + current->Attribute("FontSize", &xmlFontSize); + if (xmlFontSize) fontSize = xmlFontSize; TiXmlNode* childNode = config->FirstChild("Image"); *************** *** 248,251 **** --- 265,269 ---- fontSize = 16.0f; sendRedraw = false; + backgroundAlpha = 1.0f; Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tc3DViewer.cpp 23 Nov 2004 23:30:55 -0000 1.6 --- tc3DViewer.cpp 11 Dec 2004 01:09:06 -0000 1.7 *************** *** 1026,1029 **** --- 1026,1035 ---- { if (cameraPosition._v[2] < -480.0) cameraPosition._v[2] = -480.0; + + // avoid sea-air boundary glitch + if ((cameraPosition._v[2] > -1) && (cameraPosition._v[2] < 1.5)) + { + cameraPosition._v[2] = 1.5; + } } else |
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/include/sim Modified Files: Game.h commandlist.h tcCustomControl.h tcObjectControl.h tcRadar.h tcSimState.h Added Files: tcCommandQueue.h tcSensorTrackIterator.h Log Message: Sonar work, passive sonar, torpedoes --- NEW FILE: tcCommandQueue.h --- /** ** @file tcCommandQueue.h */ /* 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 */ #ifndef _COMMANDQUEUE_H_ #define _COMMANDQUEUE_H_ #if _MSC_VER > 1000 #pragma once #endif #include "commandlist.h" /** * Converted into singleton class * Holdover from old code, needs cleaning */ class tcCommandQueue { public: enum {MAX_QUEUED_COMMANDS = 32}; tsCommandInfo maCommand[MAX_QUEUED_COMMANDS]; unsigned mnCount; void AddCommand(const tsCommandInfo& newcmd); void AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2 = 0); void AddCommand(const char *azCommand, int param = -1); void AddPythonCommand(const char *azCommand, int param = -1); void AddPythonCommand(const char *azCommand, std::string textParam); void GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) ; void GetUserInputForID(const char *azCallback, const char *azUserInput, long platformID, int param = -1) ; void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) ; void AddPythonCallbackForID(const char *azCallback, const char *azUserInput, long platformID, int param = -1) ; void DisplayInfoMessage(const char *azString); bool GetCommand(tsCommandInfo& newcmd); static tcCommandQueue* Get(); ///< singleton accessor private: tcCommandQueue(); ~tcCommandQueue(); }; #endif Index: tcObjectControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcObjectControl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcObjectControl.h 2 Dec 2004 04:17:24 -0000 1.11 --- tcObjectControl.h 11 Dec 2004 01:09:05 -0000 1.12 *************** *** 45,48 **** --- 45,49 ---- class tcGameObject; class tcControl; + class tcCommandQueue; namespace osg *************** *** 162,167 **** public: void Draw(); - void AttachSimState(tcSimState *apSS) {mpSS=apSS;} - void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} void AttachUserInfo(tcUserInfo *apUserInfo) {mpUserInfo=apUserInfo;} bool ButtonContainingPoint(wxPoint point, int& rnRow, int& rnColumn); --- 163,166 ---- Index: commandlist.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/commandlist.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** commandlist.h 2 Dec 2004 04:17:24 -0000 1.5 --- commandlist.h 11 Dec 2004 01:09:05 -0000 1.6 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file commandlist.h ! */ ! /* Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 22,26 **** #define _COMMANDLIST_H_ ! typedef enum _gamecommand { GC_NULL, GC_QUIT, --- 24,38 ---- #define _COMMANDLIST_H_ ! #if _MSC_VER > 1000 ! #pragma once ! #endif ! ! #include <string> ! ! /** ! * ! */ ! enum teGameCommand ! { GC_NULL, GC_QUIT, *************** *** 45,51 **** PC_LAUNCH, PC_DELETE ! } teGameCommand; - #define MAX_QUEUED_COMMANDS 32 /** --- 57,62 ---- PC_LAUNCH, PC_DELETE ! }; /** *************** *** 64,208 **** bool mbGetUserInput; std::string textParam; ///< string parameter for python }; - class tcCommandQueue - { - public: - tsCommandInfo maCommand[MAX_QUEUED_COMMANDS]; - unsigned mnCount; - - void AddCommand(const tsCommandInfo& newcmd) { - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - void AddCommand(teGameCommand aeCmd, float afData, long anData, int anData2 = 0) { - tsCommandInfo newcmd; - newcmd.meCmd = aeCmd; - newcmd.mfData = afData; - newcmd.mnData = anData; - newcmd.mnData2 = anData2; - newcmd.mbUsePython = false; - newcmd.mbCallback = false; - newcmd.mbGetUserInput = false; - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - // For string commands - void AddCommand(const char *azCommand, int param = -1) { - 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, ""); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - /** - * version without user input and callback - */ - void AddPythonCommand(const char *azCommand, int param = -1) - { - 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, ""); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - - /** - * version without user input and callback - */ - void 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, ""); - 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 GetUserInput(const char *azCallback, const char *azUserInput, int param = -1) - { - 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); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - /** - * version for callback - */ - void AddPythonCallback(const char *azCallback, const char *azUserInput, int param = -1) - { - 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); - - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - // for sending messages - void DisplayInfoMessage(const char *azString) { - tsCommandInfo newcmd; - newcmd.meCmd = GC_DISPLAYMESSAGE; - newcmd.mbUsePython = false; - strcpy(newcmd.mzString, azString); - if (mnCount < MAX_QUEUED_COMMANDS) { - maCommand[mnCount++] = newcmd; - } - } - - bool GetCommand(tsCommandInfo& newcmd) { - if (mnCount == 0) { - newcmd.meCmd = GC_NULL; - return false; - } - else { - newcmd = maCommand[--mnCount]; - return true; - } - } - tcCommandQueue() {mnCount = 0;} - }; --- 75,81 ---- bool mbGetUserInput; std::string textParam; ///< string parameter for python + long platformID; ///< -1 to use current hooked }; Index: tcRadar.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcRadar.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcRadar.h 2 Dec 2004 04:17:24 -0000 1.12 --- tcRadar.h 11 Dec 2004 01:09:05 -0000 1.13 *************** *** 1,20 **** /* ! * Copyright (C) 2003 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 --- 1,23 ---- + /** + ** @file tcRadar.h + */ /* ! ** 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 ! */ #if _MSC_VER > 1000 Index: tcCustomControl.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcCustomControl.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcCustomControl.h 17 Aug 2004 02:22:56 -0000 1.5 --- tcCustomControl.h 11 Dec 2004 01:09:05 -0000 1.6 *************** *** 27,33 **** --- 27,35 ---- #include "tcwindow.h" #include "commandlist.h" + #include "tcCommandQueue.h" #include "aerror.h" + class tcCustomControl : public tcWindow { Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcSimState.h 5 Dec 2004 02:49:46 -0000 1.31 --- tcSimState.h 11 Dec 2004 01:09:05 -0000 1.32 *************** *** 61,64 **** --- 61,65 ---- using namespace ScriptInterface; + class tcCommandQueue; class tcGoalTracker; class tcStream; Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Game.h 14 Nov 2004 22:52:20 -0000 1.50 --- Game.h 11 Dec 2004 01:09:05 -0000 1.51 *************** *** 53,56 **** --- 53,57 ---- } + class tcCommandQueue; class tcHookInfo; class tcOOBView; *************** *** 163,167 **** tcSimState* simState; tcMapData mcMapData; ! tcCommandQueue mcCommandQueue; tcSimPythonInterface* pythonInterface; tcUserInfo mcUserInfo; --- 164,168 ---- tcSimState* simState; tcMapData mcMapData; ! tcCommandQueue* commandQueue; tcSimPythonInterface* pythonInterface; tcUserInfo mcUserInfo; *************** *** 230,234 **** bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game --- 231,235 ---- bool Finish(); teMenuMode GetMenuMode(); ! void GetUserInput(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void Init(); ///< basic initialization and start screen init bool InitGame(); ///< game initialization called prior to starting game *************** *** 249,253 **** void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); --- 250,254 ---- void OnPaint(wxPaintEvent& event); void OnRButtonDown(wxMouseEvent& event); ! void ProcessCallback(char *azCallback, char *azUserInput, long id, int param = -1); ///< for python interface void ProcessCommandList(); void ProcessEsc(); --- NEW FILE: tcSensorTrackIterator.h --- /** ** @file tcSensorTrackIterator.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 _SENSORTRACKITERATOR_H_ #define _SENSORTRACKITERATOR_H_ #if _MSC_VER > 1000 #pragma once #endif #include "simmath.h" class tcSimState; namespace Sensor { class tcSensorMapTrack; class tcAllianceSensorMap; /** * This should subsume tcTrackIterator * @see tcTrackIterator */ class tcSensorTrackIterator { public: void First(); tcSensorMapTrack* Get(); void Next(); bool NotDone(); tcSensorTrackIterator(unsigned int alliance_, unsigned int classificationMask, const tcGeoRect& filterRegion); tcSensorTrackIterator(); virtual ~tcSensorTrackIterator(); private: static tcSimState *simState; tcAllianceSensorMap* map; long firstPos; ///< index of first game object, last advances to first long currentPos; ///< current position index for pool tcSensorMapTrack* currentObj; bool useRegion; tcGeoRect region; unsigned int classMask; unsigned int alliance; unsigned nIterated; ///< count of elements iterated unsigned nSize; ///< size of list bool PassesFilter(const tcSensorMapTrack* track); }; } #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-12-11 01:09:51
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30338/scripts Modified Files: AI.py UnitCommands.py Log Message: Sonar work, passive sonar, torpedoes Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AI.py 6 Nov 2004 15:13:40 -0000 1.14 --- AI.py 11 Dec 2004 01:09:06 -0000 1.15 *************** *** 413,416 **** --- 413,422 ---- return + # if sub, check launch depth requirements + adjust_depth = 0 + if (UI.IsSub()): + if (-UI.GetAlt() > launcher_info.MaxDepth_m): + adjust_depth = 1 + # use weapon if in range *************** *** 419,424 **** if (targetrange > launch_range): TTI = UI.SetHeadingToInterceptTarget() ! UI.SetSpeedToMax() UI.SetActionText('Int %d (%3.0f s)' % (targetid, TTI)) else: target_is_engaged = UI.GetVar(0) # engagement status stored in user var 0 --- 425,435 ---- if (targetrange > launch_range): TTI = UI.SetHeadingToInterceptTarget() ! if (UI.IsSub()): ! SetFractionalSpeed(UI, 0.5) ! else: ! UI.SetSpeedToMax() UI.SetActionText('Int %d (%3.0f s)' % (targetid, TTI)) + elif (adjust_depth): + UI.SetAlt(-launcher_info.MaxDepth_m + 1) else: target_is_engaged = UI.GetVar(0) # engagement status stored in user var 0 Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** UnitCommands.py 2 Dec 2004 04:17:24 -0000 1.12 --- UnitCommands.py 11 Dec 2004 01:09:06 -0000 1.13 *************** *** 56,59 **** --- 56,66 ---- UI.Launch(launcher_num, 1) + def SetDatum(UI, lon, lat, launcher_num): + datum_alt = UI.GetMapTerrainElevation(lon, lat) + if (datum_alt < 5.0): + datum_alt = 0.0 + UI.SendDatumToLauncher(lon,lat,datum_alt + 5.0,launcher_num) + + def TargetAndEngageWith(UI, target_id, launcher): UI.SetTarget(target_id) |