gcblue-commits Mailing List for Global Conflict Blue (Page 9)
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...> - 2006-08-27 21:29:01
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/scripts Modified Files: Landing.py UnitCommands.py Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: UnitCommands.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/UnitCommands.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** UnitCommands.py 18 Jun 2006 00:47:42 -0000 1.27 --- UnitCommands.py 27 Aug 2006 21:28:54 -0000 1.28 *************** *** 32,36 **** def AddEngageAllOrder(UI): ! UI.AddTask('EngageAll', 2.0) def ToggleEngageAll(UI): --- 32,36 ---- def AddEngageAllOrder(UI): ! UI.AddTask('EngageAll', 2.0, 0) def ToggleEngageAll(UI): *************** *** 38,45 **** UI.DeleteTask('EngageAll') else: ! UI.AddTask('EngageAll', 2.0) def AddBombTargetTask(UI): ! UI.AddTask('BombTarget', 3.0) def AddBombDatumTask(UI, lon, lat): --- 38,45 ---- UI.DeleteTask('EngageAll') else: ! UI.AddTask('EngageAll', 2.0, 0) def AddBombTargetTask(UI): ! UI.AddTask('BombTarget', 3.0, 0) def AddBombDatumTask(UI, lon, lat): *************** *** 47,51 **** BB.Write('DatumLongitude', '%f' % lon) BB.Write('DatumLatitude', '%f' % lat) ! UI.AddTask('BombDatum', 3.0) def AddBombDatumTaskDeg(UI, lon, lat): --- 47,51 ---- BB.Write('DatumLongitude', '%f' % lon) BB.Write('DatumLatitude', '%f' % lat) ! UI.AddTask('BombDatum', 3.0, 0) def AddBombDatumTaskDeg(UI, lon, lat): *************** *** 54,58 **** BB.Write('DatumLongitude', '%f' % (deg_to_rad*lon)) BB.Write('DatumLatitude', '%f' % (deg_to_rad*lat)) ! UI.AddTask('BombDatum', 3.0) --- 54,58 ---- BB.Write('DatumLongitude', '%f' % (deg_to_rad*lon)) BB.Write('DatumLatitude', '%f' % (deg_to_rad*lat)) ! UI.AddTask('BombDatum', 3.0, 0) *************** *** 65,69 **** BB.Write('Bingo', '%f' % bingo_fuel) BB.Write('RTBtime', '%f' % (current_time + rtb_time)) ! UI.AddTask('ReturnToBase', 2.0) --- 65,69 ---- BB.Write('Bingo', '%f' % bingo_fuel) BB.Write('RTBtime', '%f' % (current_time + rtb_time)) ! UI.AddTask('ReturnToBase', 2.0, 0) *************** *** 98,107 **** def AddPatrolOrder(UI): if (UI.IsSub()): ! UI.AddTask('SubPatrol', 1.0) else: ! UI.AddTask('Patrol', 1.0) def AddPatrolStation(UI, lon, lat): ! UI.AddTask('PatrolCircle', 1.0) BB = UI.GetBlackboardInterface() BB.Write('StationLongitude', '%f' % lon) --- 98,107 ---- def AddPatrolOrder(UI): if (UI.IsSub()): ! UI.AddTask('SubPatrol', 1.0, 0) else: ! UI.AddTask('Patrol', 1.0, 0) def AddPatrolStation(UI, lon, lat): ! UI.AddTask('PatrolCircle', 1.0, 0) BB = UI.GetBlackboardInterface() BB.Write('StationLongitude', '%f' % lon) *************** *** 110,114 **** def AddPatrolStationDeg(UI, lon, lat): ! UI.AddTask('PatrolCircle', 1.0) BB = UI.GetBlackboardInterface() BB.Write('StationLongitude', '%f' % (deg_to_rad*lon)) --- 110,114 ---- def AddPatrolStationDeg(UI, lon, lat): ! UI.AddTask('PatrolCircle', 1.0, 0) BB = UI.GetBlackboardInterface() BB.Write('StationLongitude', '%f' % (deg_to_rad*lon)) *************** *** 118,124 **** def AddLandingOrder(UI, dest_id): if (UI.IsHelo()): ! UI.AddTask('LandHelo', 3.0) else: ! UI.AddTask('Land', 3.0) dest_name = UI.LookupFriendlyName(dest_id) --- 118,124 ---- def AddLandingOrder(UI, dest_id): if (UI.IsHelo()): ! UI.AddTask('LandHelo', 3.0, 0) else: ! UI.AddTask('Land', 3.0, 0) dest_name = UI.LookupFriendlyName(dest_id) *************** *** 127,131 **** def AddMissileWarnTask(UI): ! UI.AddTask('MissileWarning', 0.0) --- 127,131 ---- def AddMissileWarnTask(UI): ! UI.AddTask('MissileWarning', 0.0, 0) *************** *** 148,154 **** def MoveToAndPatrol(UI, lon, lat): ClearTasks(UI) ! UI.AddTask('Patrol', 1.0) ! UI.AddTask('Nav', 2.0) ! UI.AddTask('EngageAll', 3.0) AddWaypointOrder(UI, lon, lat) --- 148,154 ---- def MoveToAndPatrol(UI, lon, lat): ClearTasks(UI) ! UI.AddTask('Patrol', 1.0, 0) ! UI.AddTask('Nav', 2.0, 0) ! UI.AddTask('EngageAll', 3.0, 0) AddWaypointOrder(UI, lon, lat) Index: Landing.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Landing.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Landing.py 18 Jun 2006 00:47:42 -0000 1.1 --- Landing.py 27 Aug 2006 21:28:54 -0000 1.2 *************** *** 199,203 **** home_base = BB.ReadMessage('Home') BB.Write('LandTarget', home_base) ! UI.AddTask('Land', 2.0) TI.EndTask() --- 199,203 ---- home_base = BB.ReadMessage('Home') BB.Write('LandTarget', home_base) ! UI.AddTask('Land', 2.0, 0) TI.EndTask() *************** *** 210,214 **** BB = UI.GetBlackboardInterface() BB.Write('LandTarget', base_name) ! UI.AddTask('Land', 3.0) def CancelLanding(UI): --- 210,214 ---- BB = UI.GetBlackboardInterface() BB.Write('LandTarget', base_name) ! UI.AddTask('Land', 3.0, 0) def CancelLanding(UI): |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:58
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/include/ai Modified Files: Brain.h Nav.h ScriptedTask.h SelfPreservation.h Task.h Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: SelfPreservation.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/SelfPreservation.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelfPreservation.h 8 Mar 2006 01:10:22 -0000 1.2 --- SelfPreservation.h 27 Aug 2006 21:28:53 -0000 1.3 *************** *** 52,56 **** SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_); ~SelfPreservation(); --- 52,56 ---- SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_); ~SelfPreservation(); Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Brain.h 8 Mar 2006 01:10:22 -0000 1.10 --- Brain.h 27 Aug 2006 21:28:53 -0000 1.11 *************** *** 66,70 **** NAV_TASK = 1 }; ! void AddTask(const std::string& taskName, double priority_); /// gets a low priority, anonymous interface to board BlackboardInterface GetBlackboardInterface(); --- 66,72 ---- NAV_TASK = 1 }; ! ! ! void AddTask(const std::string& taskName, double priority_, int attributes_ = 0); /// gets a low priority, anonymous interface to board BlackboardInterface GetBlackboardInterface(); *************** *** 100,104 **** bool updating; ///< true if in the middle of Update bool hasNewCommand; ///< for multiplayer, true if task or bb state has been changed - Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; --- 102,105 ---- Index: Nav.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Nav.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Nav.h 8 Mar 2006 01:10:22 -0000 1.6 --- Nav.h 27 Aug 2006 21:28:53 -0000 1.7 *************** *** 66,70 **** Nav(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_); ~Nav(); --- 66,70 ---- Nav(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_); ~Nav(); Index: ScriptedTask.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/ScriptedTask.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ScriptedTask.h 8 Mar 2006 01:10:22 -0000 1.2 --- ScriptedTask.h 27 Aug 2006 21:28:53 -0000 1.3 *************** *** 55,59 **** ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& scriptName_); ~ScriptedTask(); --- 55,59 ---- ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& scriptName_); ~ScriptedTask(); Index: Task.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Task.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Task.h 8 Mar 2006 01:10:22 -0000 1.6 --- Task.h 27 Aug 2006 21:28:54 -0000 1.7 *************** *** 53,56 **** --- 53,65 ---- { public: + /** task type bit field */ + enum + { + DEFAULT_ATTRIBUTES = 0, + HIDDEN = 1, ///< task not displayed on user task list + PERMANENT = 2 ///< task not removed when user clears tasks + }; + + tcPlatformInterface GetPlatformInterface(); *************** *** 60,63 **** --- 69,77 ---- bool IsReadyForUpdate(double t) const; + int GetAttributes() const; + void SetAttributes(int attributes_); + bool IsHidden() const; + bool IsPermanent() const; + void SetUpdateInterval(float interval); virtual void Update(double t); *************** *** 65,69 **** Task(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_); virtual ~Task(); --- 79,83 ---- Task(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_); virtual ~Task(); *************** *** 72,76 **** const std::string taskName; ! private: double lastUpdateTime; --- 86,91 ---- const std::string taskName; ! int attributes; ///< bitfield of task attributes ! private: double lastUpdateTime; |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:58
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/src/sim Modified Files: tcMapData.cpp Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcMapData.cpp 17 Aug 2006 01:28:05 -0000 1.28 --- tcMapData.cpp 27 Aug 2006 21:28:54 -0000 1.29 *************** *** 256,277 **** maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; } ! for (int k=100; k<1024; k++) { ! nRed =(k-100); ! nGreen =(k-100); ! nBlue = (k-100)*8/10; ! /* For some reason values have to be limited to 128 to avoid distorted colors. ! ** This started happening after switching the terrain map to use osg::Texture ! */ ! nRed = min((unsigned int)128, nRed+80); ! nGreen = min((unsigned int)128,nGreen+80); ! nBlue = min((unsigned int)128,nBlue+60); maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; - //unsigned int nGray = (k-100); - //if (nGray > 128) nGray = 128; - //maPalette1[k] = nGray + (nGray << 8) + (nGray << 16) + alpha_val; } } --- 256,284 ---- maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; } ! for (int k=100; k<200; k++) { ! nRed =(k-100) + 80; ! nGreen =(k-100) + 80; ! nBlue = ((k-100)*8/10) + 60; ! nRed = min((unsigned int)255, nRed); ! nGreen = min((unsigned int)255, nGreen); ! nBlue = min((unsigned int)255, nBlue); ! ! maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; ! } ! for (int k=200; k<1024; k++) ! { ! nRed = ((k-200)/2) + 180; ! nGreen = ((k-200)/2) + 180; ! nBlue = ((k-200)*4/10) + 140; ! ! nRed = min((unsigned int)255, nRed); ! nGreen = min((unsigned int)255, nGreen); ! nBlue = min((unsigned int)255, nBlue); maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; } + } *************** *** 1055,1065 **** UINT32 tcMapData::YellowBlueMap(long pval) const { ! int nPaletteIndex = (pval/10) + 100; ! if (nPaletteIndex > 247) // TODO bug here that needs fixing, higher values distort on texture ! { ! nPaletteIndex = 247; ! } ! else if (nPaletteIndex < 0) { nPaletteIndex = 0; --- 1062,1077 ---- UINT32 tcMapData::YellowBlueMap(long pval) const { ! int nPaletteIndex = (pval/12) + 100; ! //if (nPaletteIndex > 247) // TODO bug here that needs fixing, higher values distort on texture ! //{ ! // nPaletteIndex = 247; ! //} ! //else if (nPaletteIndex < 0) ! //{ ! // nPaletteIndex = 0; ! //} ! ! if (nPaletteIndex < 0) { nPaletteIndex = 0; |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:58
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/src/common Modified Files: tcOggStreamer.cpp Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcOggStreamer.cpp 23 Mar 2006 01:11:01 -0000 1.19 --- tcOggStreamer.cpp 27 Aug 2006 21:28:54 -0000 1.20 *************** *** 54,57 **** --- 54,58 ---- { wxASSERT(source.valid()); + if (!source.valid()) return; source->seek(seekTime); *************** *** 68,71 **** --- 69,73 ---- wxASSERT(source.valid()); + if (!source.valid()) return; source->setGain(volume); *************** *** 78,81 **** --- 80,84 ---- { wxASSERT(source.valid()); + if (!source.valid()) return; source->stop(); *************** *** 95,98 **** --- 98,102 ---- { wxASSERT(source.valid()); + if (!source.valid()) return; paused = false; *************** *** 124,127 **** --- 128,132 ---- { wxASSERT(source.valid()); + if (!source.valid()) return false; return (source->getState() == openalpp::Paused); *************** *** 132,135 **** --- 137,141 ---- { wxASSERT(source.valid()); + if (!source.valid()) return false; return (source->getState() == openalpp::Playing); *************** *** 139,142 **** --- 145,149 ---- { wxASSERT(source.valid()); + if (!source.valid()) return true; return (source->getState() == openalpp::Stopped); *************** *** 145,148 **** --- 152,158 ---- void tcOggStreamer::Update() { + wxASSERT(source.valid()); + if (!source.valid()) return; + if (queuedSong.size() == 0) return; *************** *** 179,185 **** initializingStream(false) { ! source = new openalpp::Source; ! source->setAmbient(); ! source->setGain(volume); } --- 189,231 ---- initializingStream(false) { ! try ! { ! source = new openalpp::Source; ! } ! catch (openalpp::MemoryError e) ! { ! fprintf(stderr, "tcOggStreamer::tcOggStreamer: openalpp::MemoryError: %s\n", e.what()); ! wxMessageBox(e.what(), "Memory Error", wxICON_ERROR); ! } ! catch (openalpp::NameError e) ! { ! fprintf(stderr, "tcOggStreamer::tcOggStreamer: openalpp::NameError: %s\n", e.what()); ! wxMessageBox(e.what(), "Name Error", wxICON_ERROR); ! } ! catch (openalpp::FatalError e) ! { ! fprintf(stderr, "tcOggStreamer::tcOggStreamer: openalpp::FatalError: %s\n", e.what()); ! wxMessageBox(e.what(), "Fatal Error", wxICON_ERROR); ! } ! catch (openalpp::Error e) ! { ! fprintf(stderr, "tcOggStreamer::tcOggStreamer: openalpp::Error: %s\n", e.what()); ! wxMessageBox(e.what(), "General openAL++ Error", wxICON_ERROR); ! } ! catch (std::exception e) ! { ! fprintf(stderr, "tcOggStreamer::tcOggStreamer: std::exception: %s\n", e.what()); ! wxMessageBox(e.what(), "Exception", wxICON_ERROR); ! } ! ! if (source.valid()) ! { ! source->setAmbient(); ! source->setGain(volume); ! } ! else ! { ! fprintf(stderr, "OGG init error: music will be disabled!\n"); ! } } |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:58
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/src/ai Modified Files: Brain.cpp Nav.cpp ScriptedTask.cpp SelfPreservation.cpp Task.cpp Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: ScriptedTask.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/ScriptedTask.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ScriptedTask.cpp 23 Mar 2006 01:11:01 -0000 1.3 --- ScriptedTask.cpp 27 Aug 2006 21:28:54 -0000 1.4 *************** *** 112,117 **** ScriptedTask::ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& scriptName) ! : Task(platform_, bb, id_, priority_, scriptName) { --- 112,117 ---- ScriptedTask::ScriptedTask(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& scriptName) ! : Task(platform_, bb, id_, priority_, attributes_, scriptName) { Index: Task.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Task.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Task.cpp 23 Mar 2006 01:11:01 -0000 1.5 --- Task.cpp 27 Aug 2006 21:28:54 -0000 1.6 *************** *** 51,54 **** --- 51,59 ---- } + int Task::GetAttributes() const + { + return attributes; + } + tcPlatformInterface Task::GetPlatformInterface() { *************** *** 61,64 **** --- 66,79 ---- } + bool Task::IsHidden() const + { + return (attributes & HIDDEN) != 0; + } + + bool Task::IsPermanent() const + { + return (attributes & PERMANENT) != 0; + } + bool Task::IsReadyForUpdate(double t) const { *************** *** 67,70 **** --- 82,90 ---- + void Task::SetAttributes(int attributes_) + { + attributes = attributes_; + } + void Task::SetUpdateInterval(float interval) *************** *** 78,85 **** Task::Task(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_) : BlackboardInterface(bb, id_, priority_), platform(platform_), taskName(taskName_), lastUpdateTime(0), updateInterval(4.0f) --- 98,106 ---- Task::Task(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_) : BlackboardInterface(bb, id_, priority_), platform(platform_), taskName(taskName_), + attributes(attributes_), lastUpdateTime(0), updateInterval(4.0f) Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Brain.cpp 23 Mar 2006 01:11:01 -0000 1.12 --- Brain.cpp 27 Aug 2006 21:28:54 -0000 1.13 *************** *** 77,81 **** stream >> priority; ! AddTask(taskName, (double)priority); } --- 77,84 ---- stream >> priority; ! int attributes; ! stream >> attributes; ! ! AddTask(taskName, (double)priority, attributes); } *************** *** 111,114 **** --- 114,120 ---- float priority = (float)task->GetPriority(); stream << priority; + + int attributes = task->GetAttributes(); + stream << attributes; } *************** *** 224,227 **** --- 230,235 ---- /** + * Assumed that this is used for display purposes so hidden tasks are NOT + * returned in this list. * @return list of task names */ *************** *** 234,238 **** for (;iter != done; ++iter) { ! taskList.push_back(iter->first); } --- 242,249 ---- for (;iter != done; ++iter) { ! if (!iter->second->IsHidden()) ! { ! taskList.push_back(iter->first); ! } } *************** *** 257,269 **** } ! void Brain::AddTask(const std::string& taskName, double priority_) { ! // if task already exists, update priority std::map<std::string, Task*>::iterator tm_iter = taskMap.find(taskName); if (tm_iter != taskMap.end()) { tm_iter->second->SetPriority(priority_); fprintf(stderr, "Warning - Brain::AddTask - task already exists, " ! "updating priority (%s)\n", priority_); return; } --- 268,281 ---- } ! void Brain::AddTask(const std::string& taskName, double priority_, int attributes_) { ! // if task already exists, update priority and attributes std::map<std::string, Task*>::iterator tm_iter = taskMap.find(taskName); if (tm_iter != taskMap.end()) { tm_iter->second->SetPriority(priority_); + tm_iter->second->SetAttributes(attributes_); fprintf(stderr, "Warning - Brain::AddTask - task already exists, " ! "updating priority and attributes (%s)\n", taskName.c_str()); return; } *************** *** 276,280 **** { taskMap[taskName] = new ScriptedTask(platform, &board, ! nextId++, priority_, taskName); } else --- 288,292 ---- { taskMap[taskName] = new ScriptedTask(platform, &board, ! nextId++, priority_, attributes_, taskName); } else *************** *** 289,293 **** case NAV_TASK: taskMap[taskName] = new Nav(platform, &board, ! nextId++, priority_, taskName); break; default: --- 301,305 ---- case NAV_TASK: taskMap[taskName] = new Nav(platform, &board, ! nextId++, priority_, attributes_, taskName); break; default: *************** *** 310,318 **** if (taskMap.size() > 0) hasNewCommand = true; std::map<std::string, Task*>::iterator iter = taskMap.begin(); ! while (iter != taskMap.end()) { ! delete iter->second; ! taskMap.erase(iter++); } } --- 322,337 ---- if (taskMap.size() > 0) hasNewCommand = true; + // additional test to avoid infinite loop due to permanent task + size_t nTasks = taskMap.size(); + size_t nChecked = 0; + std::map<std::string, Task*>::iterator iter = taskMap.begin(); ! while ((iter != taskMap.end()) && (nChecked++ < nTasks)) { ! if (!iter->second->IsPermanent()) ! { ! delete iter->second; ! taskMap.erase(iter++); ! } } } *************** *** 349,352 **** --- 368,376 ---- if (iter != taskMap.end()) { + if (iter->second->IsPermanent()) + { + return; // ignore request + } + // remove all blackboard entries from the author being erased board.EraseAllFromAuthor(iter->second->GetAuthor()); Index: SelfPreservation.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/SelfPreservation.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelfPreservation.cpp 23 Mar 2006 01:11:01 -0000 1.3 --- SelfPreservation.cpp 27 Aug 2006 21:28:54 -0000 1.4 *************** *** 86,91 **** SelfPreservation::SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_) ! : Task(platform_, bb, id_, priority_, taskName_) { wxASSERT(platform); --- 86,91 ---- SelfPreservation::SelfPreservation(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_) ! : Task(platform_, bb, id_, priority_, attributes_, taskName_) { wxASSERT(platform); Index: Nav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Nav.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Nav.cpp 23 Mar 2006 01:11:01 -0000 1.7 --- Nav.cpp 27 Aug 2006 21:28:54 -0000 1.8 *************** *** 202,207 **** Nav::Nav(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, const std::string& taskName_) ! : Task(platform_, bb, id_, priority_, taskName_), currentWaypoint(0), loop(false) --- 202,207 ---- Nav::Nav(tcPlatformObject* platform_, Blackboard* bb, ! long id_, double priority_, int attributes_, const std::string& taskName_) ! : Task(platform_, bb, id_, priority_, attributes_, taskName_), currentWaypoint(0), loop(false) |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:57
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcScenarioInterface.cpp Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** tcPlatformInterface.cpp 17 Aug 2006 01:28:04 -0000 1.62 --- tcPlatformInterface.cpp 27 Aug 2006 21:28:54 -0000 1.63 *************** *** 815,819 **** ! void tcPlatformInterface::AddTask(const std::string& taskName, double priority) { if (mpPlatformObj->IsClientMode()) return; --- 815,819 ---- ! void tcPlatformInterface::AddTask(const std::string& taskName, double priority, int attributes) { if (mpPlatformObj->IsClientMode()) return; *************** *** 822,826 **** wxASSERT(brain); ! brain->AddTask(taskName, priority); } --- 822,826 ---- wxASSERT(brain); ! brain->AddTask(taskName, priority, attributes); } Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** tcScenarioInterface.cpp 17 Aug 2006 01:28:04 -0000 1.43 --- tcScenarioInterface.cpp 27 Aug 2006 21:28:54 -0000 1.44 *************** *** 457,461 **** */ void tcScenarioInterface::AddUnitTask(const std::string& unitName, const std::string& taskName, ! double priority) { wxASSERT(simState); --- 457,461 ---- */ void tcScenarioInterface::AddUnitTask(const std::string& unitName, const std::string& taskName, ! double priority, int attributes) { wxASSERT(simState); *************** *** 465,469 **** ai::Brain* brain = platform->GetBrain(); wxASSERT(brain); ! brain->AddTask(taskName, priority); } else --- 465,469 ---- ai::Brain* brain = platform->GetBrain(); wxASSERT(brain); ! brain->AddTask(taskName, priority, attributes); } else |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:57
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/src/graphics Modified Files: tcScenarioSelectView.cpp tcTerrainView.cpp Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcTerrainView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcTerrainView.cpp 23 Mar 2006 01:11:02 -0000 1.9 --- tcTerrainView.cpp 27 Aug 2006 21:28:54 -0000 1.10 *************** *** 147,151 **** mapImage->setImage(image); } ! image->allocateImage(width, height, 1, GL_RGBA, GL_BYTE, 1); mpMapData->GetWorldArea(mrectMap); --- 147,151 ---- mapImage->setImage(image); } ! image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1); mpMapData->GetWorldArea(mrectMap); *************** *** 187,191 **** mapImage->setImage(image); } ! image->allocateImage(width, height, 1, GL_RGBA, GL_BYTE, 1); --- 187,191 ---- mapImage->setImage(image); } ! image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1); Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcScenarioSelectView.cpp 18 Jun 2006 00:45:00 -0000 1.16 --- tcScenarioSelectView.cpp 27 Aug 2006 21:28:54 -0000 1.17 *************** *** 256,260 **** { wxString s = ! wxString::Format("Error in scenario %s (File may be missing, or file name may have space in it). " "Check log/pyerr.txt for details.", totalPath.c_str()); --- 256,260 ---- { wxString s = ! wxString::Format("Error in scenario %s (File may be missing, file name may have space in it, or error in scenario). " "Check log/pyerr.txt for details.", totalPath.c_str()); |
From: Dewitt C. <ddc...@us...> - 2006-08-27 21:28:57
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21970/include/scriptinterface Modified Files: tcPlatformInterface.h tcScenarioInterface.h Log Message: Added attributes (hidden and permanent) to AI tasks so that automation tasks can be hidden and not distract player Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** tcPlatformInterface.h 17 Aug 2006 01:27:10 -0000 1.52 --- tcPlatformInterface.h 27 Aug 2006 21:28:54 -0000 1.53 *************** *** 247,251 **** // order related commands /// add a task ! void AddTask(const std::string& taskName, double priority); /// adds navigation waypoint (creates nav task if necessary) void AddNavWaypoint(float afLon_rad, float afLat_rad); --- 247,251 ---- // order related commands /// add a task ! void AddTask(const std::string& taskName, double priority, int attributes); /// adds navigation waypoint (creates nav task if necessary) void AddNavWaypoint(float afLon_rad, float afLat_rad); Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcScenarioInterface.h 6 Jun 2006 00:08:34 -0000 1.28 --- tcScenarioInterface.h 27 Aug 2006 21:28:54 -0000 1.29 *************** *** 115,119 **** void AddUnitTask(const std::string& unitName, const std::string& taskName, ! double priority); bool AllianceExists(int alliance) const; --- 115,119 ---- void AddUnitTask(const std::string& unitName, const std::string& taskName, ! double priority, int attributes); bool AllianceExists(int alliance) const; |
From: Dewitt C. <ddc...@us...> - 2006-08-20 22:39:06
|
Update of /cvsroot/gcblue/gcb_wx/database/csv In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv26954/csv Log Message: Directory /cvsroot/gcblue/gcb_wx/database/csv added to the repository |
From: Dewitt C. <ddc...@us...> - 2006-08-20 22:24:06
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21251/src/graphics Modified Files: tc3DWindow.cpp tcDatabaseInfoPanel.cpp tcDatabaseInfoWindow.cpp tcScrollBar.cpp Log Message: Index: tcDatabaseInfoPanel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoPanel.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDatabaseInfoPanel.cpp 17 Aug 2006 01:28:04 -0000 1.1 --- tcDatabaseInfoPanel.cpp 20 Aug 2006 22:24:02 -0000 1.2 *************** *** 285,289 **** void tcDatabaseInfoPanel::PrintText(float x, float& y, const char* formatString, ...) { ! enum {STR_LENGTH = 256}; static char textBuffer[STR_LENGTH]; static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); --- 285,289 ---- void tcDatabaseInfoPanel::PrintText(float x, float& y, const char* formatString, ...) { ! enum {STR_LENGTH = 512}; static char textBuffer[STR_LENGTH]; static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); *************** *** 297,303 **** va_start(arguments, formatString); ! _vsnprintf(textBuffer, STR_LENGTH, formatString, arguments); va_end(arguments); float maxWidth = float(mnWidth - 20) - x; --- 297,308 ---- va_start(arguments, formatString); ! _vsnprintf(textBuffer, STR_LENGTH-8 , formatString, arguments); //STR_LENGTH-1 va_end(arguments); + if (strlen(textBuffer) >= STR_LENGTH-8) + { + strncat(textBuffer, "...", 4); + } + float maxWidth = float(mnWidth - 20) - x; Index: tcScrollBar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScrollBar.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcScrollBar.cpp 17 Aug 2006 01:28:04 -0000 1.1 --- tcScrollBar.cpp 20 Aug 2006 22:24:02 -0000 1.2 *************** *** 162,166 **** CaptureMouse(); } ! else if (buttonUpRect.ContainsPoint(pos.x, pos.y)) { UpdateYbar(ybar - clickScrollAmount); --- 162,166 ---- CaptureMouse(); } ! else if ((buttonUpRect.ContainsPoint(pos.x, pos.y)) || (pos.y < (int)barRect.GetTop())) { UpdateYbar(ybar - clickScrollAmount); *************** *** 168,172 **** autoScrollIncrement = -clickScrollAmount; } ! else if (buttonDownRect.ContainsPoint(pos.x, pos.y)) { UpdateYbar(ybar + clickScrollAmount); --- 168,172 ---- autoScrollIncrement = -clickScrollAmount; } ! else if ((buttonDownRect.ContainsPoint(pos.x, pos.y)) || (pos.y > (int)barRect.GetBottom())) { UpdateYbar(ybar + clickScrollAmount); Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tc3DWindow.cpp 17 Aug 2006 01:28:04 -0000 1.37 --- tc3DWindow.cpp 20 Aug 2006 22:24:02 -0000 1.38 *************** *** 1928,1932 **** text->setText("UNINTIALIZED"); ! text->setUseDisplayList(false); --- 1928,1932 ---- text->setText("UNINTIALIZED"); ! text->setUseDisplayList(true); Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcDatabaseInfoWindow.cpp 17 Aug 2006 01:28:04 -0000 1.7 --- tcDatabaseInfoWindow.cpp 20 Aug 2006 22:24:02 -0000 1.8 *************** *** 146,150 **** void tcDatabaseInfoWindow::PrintText(float x, float& y, const char* formatString, ...) { ! enum {STR_LENGTH = 256}; static char textBuffer[STR_LENGTH]; static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); --- 146,150 ---- void tcDatabaseInfoWindow::PrintText(float x, float& y, const char* formatString, ...) { ! enum {STR_LENGTH = 512}; static char textBuffer[STR_LENGTH]; static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); *************** *** 158,164 **** va_start(arguments, formatString); ! _vsnprintf(textBuffer, STR_LENGTH, formatString, arguments); va_end(arguments); float maxWidth = (y < yImage) ? xImage - x : float(mnWidth) - x; --- 158,169 ---- va_start(arguments, formatString); ! _vsnprintf(textBuffer, STR_LENGTH-8, formatString, arguments); va_end(arguments); + if (strlen(textBuffer) >= STR_LENGTH-8) + { + strncat(textBuffer, "...", 4); + } + float maxWidth = (y < yImage) ? xImage - x : float(mnWidth) - x; |
From: Dewitt C. <ddc...@us...> - 2006-08-20 22:24:05
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21251/src/database Modified Files: tcLauncherDBObject.cpp Log Message: Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcLauncherDBObject.cpp 18 Jun 2006 00:45:00 -0000 1.20 --- tcLauncherDBObject.cpp 20 Aug 2006 22:24:01 -0000 1.21 *************** *** 49,54 **** unsigned short tcLauncherDBObject::GetCapacityForItem(const std::string& item) const { ! unsigned nTypes = childClassList.size(); ! for (unsigned k=0; k<nTypes; k++) { if (item == childClassList[k]) --- 49,54 ---- unsigned short tcLauncherDBObject::GetCapacityForItem(const std::string& item) const { ! size_t nTypes = childClassList.size(); ! for (size_t k=0; k<nTypes; k++) { if (item == childClassList[k]) *************** *** 79,89 **** description = ""; ! size_t nConfigs = GetNumberConfigurations(); for (size_t n=0; n<nConfigs; n++) { ! description.Printf("%s %d x %s", description.c_str(), ! GetConfigurationCapacity(n), GetConfigurationClass(n).c_str()); if (n < nConfigs - 1) { --- 79,92 ---- description = ""; ! size_t nConfigs = GetNumberConfigurations(); for (size_t n=0; n<nConfigs; n++) { ! wxString config_string; ! config_string.Printf("%d x %s", GetConfigurationCapacity((unsigned int)n), ! GetConfigurationClass((unsigned int)n).c_str()); ! ! description.Append(config_string); if (n < nConfigs - 1) { *************** *** 97,101 **** unsigned int tcLauncherDBObject::GetNumberConfigurations() const { ! return childClassList.size(); } --- 100,104 ---- unsigned int tcLauncherDBObject::GetNumberConfigurations() const { ! return (unsigned int)childClassList.size(); } |
From: Dewitt C. <ddc...@us...> - 2006-08-20 22:23:28
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21221/database Modified Files: database.db Log Message: merged july 25 changes from raven58 Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 Binary files /tmp/cvskUR3Ct and /tmp/cvsR3LbHx differ |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:31:37
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23448/xml Modified Files: options.xml Log Message: Update for server name change Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** options.xml 18 Jun 2006 00:50:10 -0000 1.25 --- options.xml 17 Aug 2006 01:31:33 -0000 1.26 *************** *** 1,6 **** <Options> <HostAddress>192.168.0.100</HostAddress> ! <LastScenarioPath>Test.Launcher10test.py</LastScenarioPath> ! <LastScenarioName>Launcher10test</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> --- 1,6 ---- <Options> <HostAddress>192.168.0.100</HostAddress> ! <LastScenarioPath>Test.AirManagementTest.py</LastScenarioPath> ! <LastScenarioName>AirManagementTest</LastScenarioName> <noCopyDatabase /> <noWriteXmlDatabase /> |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:31:37
|
Update of /cvsroot/gcblue/gcb_wx/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23448/database Modified Files: database.db Log Message: Update for server name change Index: database.db =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/database/database.db,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 Binary files /tmp/cvsvGWCXc and /tmp/cvsrFCIBf differ |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:31:35
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23448 Modified Files: GCblue.vcproj ReleaseInstallScript_083dev.nsi Log Message: Update for server name change Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** GCblue.vcproj 18 Jun 2006 00:50:47 -0000 1.105 --- GCblue.vcproj 17 Aug 2006 01:31:32 -0000 1.106 *************** *** 347,350 **** --- 347,354 ---- </File> <File + RelativePath=".\src\graphics\tcBoundingBoxVisitor.cpp" + > + </File> + <File RelativePath=".\src\graphics\tcBriefingView.cpp" > *************** *** 379,382 **** --- 383,394 ---- </File> <File + RelativePath=".\src\graphics\tcDatabaseBrowsePanel.cpp" + > + </File> + <File + RelativePath=".\src\graphics\tcDatabaseInfoPanel.cpp" + > + </File> + <File RelativePath=".\src\graphics\tcDatabaseInfoWindow.cpp" > *************** *** 523,526 **** --- 535,542 ---- </File> <File + RelativePath=".\src\graphics\tcScrollBar.cpp" + > + </File> + <File RelativePath=".\src\graphics\tcShaderControl.cpp" > *************** *** 1641,1644 **** --- 1657,1664 ---- </File> <File + RelativePath=".\include\graphics\tcBoundingBoxVisitor.h" + > + </File> + <File RelativePath=".\include\graphics\tcBriefingView.h" > *************** *** 1673,1676 **** --- 1693,1704 ---- </File> <File + RelativePath=".\include\graphics\tcDatabaseBrowsePanel.h" + > + </File> + <File + RelativePath=".\include\graphics\tcDatabaseInfoPanel.h" + > + </File> + <File RelativePath=".\include\graphics\tcDatabaseInfoWindow.h" > *************** *** 1805,1808 **** --- 1833,1840 ---- </File> <File + RelativePath=".\include\graphics\tcScrollBar.h" + > + </File> + <File RelativePath=".\include\graphics\tcShaderControl.h" > Index: ReleaseInstallScript_083dev.nsi =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/ReleaseInstallScript_083dev.nsi,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReleaseInstallScript_083dev.nsi 18 Jun 2006 00:51:17 -0000 1.1 --- ReleaseInstallScript_083dev.nsi 17 Aug 2006 01:31:32 -0000 1.2 *************** *** 146,150 **** File "database\accounts.db" File "database\test_addon.db" ! File "database\raven58.db" File "database\LICENSE.txt" ; File "database\*.exe" ; Include database editor file --- 146,150 ---- File "database\accounts.db" File "database\test_addon.db" ! ; File "database\raven58.db" File "database\LICENSE.txt" ; File "database\*.exe" ; Include database editor file |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:29:14
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv22611/scripts Modified Files: AI.py Menu.py Added Files: AirManagement.py GameMenuCommands.py Log Message: Update for server name change --- NEW FILE: GameMenuCommands.py --- from random import * deg_to_rad = 0.01745329252 rad_to_deg = 57.2957795131 # workaround that passes UI object when nothing is hooked to # do a command pass-through def YellowBlueMap(UI): UI.SendCommand("YellowBlueMap") def CopperMap(UI): UI.SendCommand("CopperMap") def BlackBlueMap(UI): UI.SendCommand("BlackBlueMap") --- NEW FILE: AirManagement.py --- def RefuelAllAircraft(TI): UI = TI.GetPlatformInterface() FP = UI.GetFlightPortInfo() if (not FP.IsValid()): UI.DisplayMessage('No flightport') TI.EndTask() TI.SetUpdateInterval(20) nUnits = FP.GetUnitCount() for n in range(0, nUnits): unitStatus = FP.GetUnitStatus(n) unitName = unitStatus.name unitLoc = unitStatus.current_loc UI_n = FP.GetUnitPlatformInterface(n) if (UI_n.GetFuel() < 1.0) and (not UI_n.IsRefueling()): UI_n.DisplayMessage('Refueling %s' % unitName) UI_n.LoadOther('Fuel') def MaintainCAP(TI): UI = TI.GetPlatformInterface() FP = UI.GetFlightPortInfo() if (not FP.IsValid()): UI.DisplayMessage('No flightport') TI.EndTask() ######## FlightPort scripts ##### ##def BuildFlightPortPanel(UserPanel, FlightPortInfo, UnitInfo): ## # UnitInfo.DisplayMessage('BuildFlightPortPanelCalled') ## UserPanel.Clear() ## UserPanel.SetTitle('Flight Deck Control') ## ## # draw buttons for heading row ## UserPanel.AddItem('Unit Type','',10,10,80,12) ## UserPanel.BoldLastItem() ## UserPanel.AddItem('Location','',90,10,50,12) ## UserPanel.BoldLastItem() ## UserPanel.AddItem('Dest','',140,10,50,12) ## UserPanel.BoldLastItem() ## UserPanel.AddItem('Move','',190,10,60,12) ## UserPanel.BoldLastItem() ## UserPanel.AddItem('','',250,10,40,12) ## UserPanel.AddItem('','',290,10,40,12) ## nUnits = FlightPortInfo.GetUnitCount() ## rowy = 22 ## startx = 10 ## for n in range(0, nUnits): ## rowx = startx ## # two buttons for unit info ## unitStatus = FlightPortInfo.GetUnitStatus(n) ## unitName = unitStatus.name ## unitLoc = unitStatus.current_loc ## if (unitStatus.atDestination): ## unitGoalLoc = '---' ## else: ## unitGoalLoc = unitStatus.goal_loc ## ## bwidth = 80 ## UserPanel.AddItem(unitName,'',rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## bwidth = 50 ## UserPanel.AddItem(unitLoc,'',rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## UserPanel.AddItem(unitGoalLoc,'',rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## # buttons to move units to different positions on flight deck ## # hangar ## bwidth = 20 ## UserPanel.AddItemWithParam('H','MoveToHangar',n,rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## # Ready (on deck) ## UserPanel.AddItemWithParam('D','MoveToReady',n,rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## # Runway ## UserPanel.AddItemWithParam('R','MoveToRunway',n,rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## # Op time ## bwidth = 40 ## if (unitStatus.isIdle == 0): ## current_time = FlightPortInfo.GetCurrentTime() ## op_time = unitStatus.ready_time ## delta = op_time - current_time ## str = '%04.0f' % delta ## else: ## str = '' ## UserPanel.AddItem(str,'',rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## # Launch ## bwidth = 40 ## if (unitStatus.runway != -1): ## cmdstr = 'LaunchRunway%d' % unitStatus.runway ## UserPanel.AddItem('Launch',cmdstr,rowx,rowy,bwidth,12) ## else: ## UserPanel.AddItem('','',rowx,rowy,bwidth,12) ## rowx = rowx + bwidth ## ## rowy = rowy + 12 ## ##def LaunchRunway0(FlightPort): ## LaunchRunway(FlightPort, 0) ## ##def LaunchRunway1(FlightPort): ## LaunchRunway(FlightPort, 1) ## ##def LaunchRunway2(FlightPort): ## LaunchRunway(FlightPort, 2) ## ##def LaunchRunway(FlightPort, n): ## FlightPort.Launch(n) ## ##def MoveToHangar(FlightPort, n): ## FlightPort.SetDestination(n, 0) # 0 = Hangar ## ##def MoveToReady(FlightPort, n): ## FlightPort.SetDestination(n, 1) # 1 = Ready ## ##def MoveToRunway(FlightPort, n): ## FlightPort.SetDestination(n, 3) # 2 = Runway Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** AI.py 18 Jun 2006 00:47:42 -0000 1.26 --- AI.py 17 Aug 2006 01:29:11 -0000 1.27 *************** *** 2,5 **** --- 2,6 ---- from SubTactics import * from Landing import * + from AirManagement import * import math Index: Menu.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/Menu.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Menu.py 18 Jun 2006 00:47:42 -0000 1.23 --- Menu.py 17 Aug 2006 01:29:11 -0000 1.24 *************** *** 1,4 **** --- 1,5 ---- from UnitCommands import * from MissionEditCommands import * + from GameMenuCommands import * from HotKey import * from FlightPort import * *************** *** 360,363 **** --- 361,365 ---- # top-level edit menu def BuildEditMenu(UnitMenu, SM): + page_count = 25 UnitMenu.Clear() *************** *** 371,427 **** ### Create surface ship submenu ### UnitMenu.AddItem('Surface','') ! ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('Surface') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) ! UnitMenu.EndSubMenu() ! ### Create submarine submenu ### UnitMenu.AddItem('Submarine','') ! ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('Sub') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) ! UnitMenu.EndSubMenu() ! ### Create fixed wing air submenu ### UnitMenu.AddItem('Air fixed wing','') ! ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('AirFW') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) ! UnitMenu.EndSubMenu() ### Create helo submenu ### UnitMenu.AddItem('Helo','') ! ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('Helo') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) ! UnitMenu.EndSubMenu() ### Create land submenu ### UnitMenu.AddItem('Land','') ! ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('Land') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) ! UnitMenu.EndSubMenu() UnitMenu.EndSubMenu() --- 373,397 ---- ### Create surface ship submenu ### UnitMenu.AddItem('Surface','') ! BuildPagedCreateMenu(SM, UnitMenu, 'Surface', page_count) ! ### Create submarine submenu ### UnitMenu.AddItem('Submarine','') ! BuildPagedCreateMenu(SM, UnitMenu, 'Sub', page_count) ! ### Create fixed wing air submenu ### UnitMenu.AddItem('Air fixed wing','') ! BuildPagedCreateMenu(SM, UnitMenu, 'AirFW', page_count) ! ### Create helo submenu ### UnitMenu.AddItem('Helo','') ! BuildPagedCreateMenu(SM, UnitMenu, 'Helo', page_count) ! ### Create land submenu ### UnitMenu.AddItem('Land','') ! BuildPagedCreateMenu(SM, UnitMenu, 'Land', page_count) ! UnitMenu.EndSubMenu() *************** *** 432,453 **** ### Create fixed wing air on carrier or airstrip ### UnitMenu.AddItem('Air fixed wing','') ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('AirFW') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatformToFlightDeck', 'Target', className) ! UnitMenu.EndSubMenu() ! ### Create helo on carrier or airstrip ### UnitMenu.AddItem('Helo','') ! UnitMenu.BeginSubMenu() ! platforms = SM.GetPlatformListByClass('Helo') ! nPlatforms = platforms.Size() ! for n in range(0, nPlatforms): ! className = platforms.GetString(n) ! UnitMenu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatformToFlightDeck', 'Target', className) ! UnitMenu.EndSubMenu() --- 402,411 ---- ### Create fixed wing air on carrier or airstrip ### UnitMenu.AddItem('Air fixed wing','') ! BuildPagedCreateChildMenu(SM, UnitMenu, 'AirFW', page_count) ! ### Create helo on carrier or airstrip ### UnitMenu.AddItem('Helo','') ! BuildPagedCreateChildMenu(SM, UnitMenu, 'Helo', page_count) *************** *** 455,457 **** --- 413,459 ---- + def BuildPagedCreateMenu(SM, Menu, create_class, page_count): + Menu.BeginSubMenu() + platforms = SM.GetPlatformListByClass(create_class) + nPlatforms = platforms.Size() + if (nPlatforms > page_count): + nSubmenus = nPlatforms/page_count + 1 + for sm in range(0, nSubmenus): + Menu.AddItem('Page %d' % (sm+1),'') + Menu.BeginSubMenu() + nPlatformsPage = min(page_count, nPlatforms - sm*page_count) + for n in range(0, nPlatformsPage): + className = platforms.GetString(n+sm*page_count) + Menu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) + Menu.EndSubMenu() + else: + for n in range(0, nPlatforms): + className = platforms.GetString(n) + Menu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatform', 'Datum', className) + Menu.EndSubMenu() + + + def BuildPagedCreateChildMenu(SM, Menu, create_class, page_count): + Menu.BeginSubMenu() + platforms = SM.GetPlatformListByClass(create_class) + nPlatforms = platforms.Size() + if (nPlatforms > page_count): + nSubmenus = nPlatforms/page_count + 1 + for sm in range(0, nSubmenus): + Menu.AddItem('Page %d' % (sm+1),'') + Menu.BeginSubMenu() + nPlatformsPage = min(page_count, nPlatforms - sm*page_count) + for n in range(0, nPlatformsPage): + className = platforms.GetString(n+sm*page_count) + Menu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatformToFlightDeck', 'Target', className) + Menu.EndSubMenu() + else: + for n in range(0, nPlatforms): + className = platforms.GetString(n) + Menu.AddItemUIWithTextParam('%s' % className, 'AddNewPlatformToFlightDeck', 'Target', className) + Menu.EndSubMenu() + + + + |
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/graphics Modified Files: tc3DModel.cpp tc3DViewer.cpp tc3DWindow.cpp tcContainerGui.cpp tcCreditView.cpp tcDatabaseInfoWindow.cpp tcDatabaseViewer.cpp tcGameView.cpp tcGraphicsEngine.cpp tcMapObject.cpp tcMapOverlay.cpp tcMapView.cpp tcOOBView.cpp tcPopupControl.cpp tcStoresGui.cpp Added Files: tcBoundingBoxVisitor.cpp tcDatabaseBrowsePanel.cpp tcDatabaseInfoPanel.cpp tcScrollBar.cpp Log Message: Update for server name change --- NEW FILE: tcDatabaseInfoPanel.cpp --- /** ** @file tcDatabaseInfoPanel.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 "tcDatabaseInfoPanel.h" #include "tcDatabaseObject.h" #include "tcGenericDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" #include "tcTorpedoDBObject.h" #include "tc3DModel.h" #include "tcSensorMap.h" #include "tcSimState.h" #include "common/tinyxml.h" #include "tcTime.h" #include "tcScrollBar.h" #include <osg/Geometry> #ifdef _DEBUG #define new DEBUG_NEW #endif BEGIN_EVENT_TABLE(tcDatabaseInfoPanel, tc3DWindow) EVT_COMMAND(-1, wxEVT_COMMAND_SCROLLBAR_UPDATED, tcDatabaseInfoPanel::OnScrollbarUpdated) END_EVENT_TABLE() using database::tcDatabaseObject; void tcDatabaseInfoPanel::Draw() { DrawChildren(); //if (!IsBackgroundEnabled()) //{ // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(0.15, 0.15, 0.15, 1.0f), // FILL_ON); //} DrawDatabaseInfo(); //DrawBorder(); HideUnusedObjects(); } void tcDatabaseInfoPanel::DrawDatabaseInfo() { wxString s; tcDatabaseObject* databaseObj = GetDatabaseObject(); if (databaseObj == 0) return; const float yStart = 20.0f; const float maxSpan = float(mnHeight); float textx = 2.0f; float maxWidth = float(mnWidth) - textx - 5.0f; float texty = yStart; osg::BoundingBox textBox; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); texty -= yOffset; PrintText(textx, texty, "Unit cost: %s", databaseObj->GetCostString()); PrintText(textx, texty, "%s", databaseObj->mzDescription); texty += 5.0f; if (tcGenericDBObject* generic = dynamic_cast<tcGenericDBObject*>(databaseObj)) { DrawDatabaseInfo(generic, texty); } else if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(databaseObj)) { DrawDatabaseInfo(missile, texty); } else if (tcTorpedoDBObject* torpedo = dynamic_cast<tcTorpedoDBObject*>(databaseObj)) { DrawDatabaseInfo(torpedo, texty); } // update scroll bar (only need to do this once per database object) float ySpan = yCurrent + yOffset - yStart + 25.0f; scrollBar->SetBarFraction(maxSpan / ySpan); } void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart) { float textx = 10.0f; float maxWidth = float(mnWidth) - textx - 5.0f; float texty = yStart; osg::BoundingBox textBox; osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); PrintText(textx, texty, "Max speed: %.0f kts", genericData->mfMaxSpeed_kts); if (IsEmbedded()) { PrintText(textx, texty, "Turn rate: %.1f deg/s", genericData->mfTurnRate_degps); } PrintText(textx, texty, "Survivability: %.0f", genericData->mfToughness); PrintText(textx, texty, "RCS %.0f dBsm", genericData->mfRcs_dbsm); if ((genericData->mfFuelRate_kgps > 0) && IsEmbedded()) { float fuelTimeHours = 2.778e-4 * genericData->mfFuelCapacity_kg / genericData->mfFuelRate_kgps; switch (genericData->mnModelType) { case MTYPE_SURFACE: case MTYPE_CARRIER: case MTYPE_AIR: PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * genericData->mfMaxSpeed_kts * C_NMITOKM); break; case MTYPE_FIXEDWINGX: PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); break; case MTYPE_HELO: PrintText(textx, texty, "Endurance %.1f hrs", 2.0f * fuelTimeHours); break; case MTYPE_SUBMARINE: PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); break; } } texty += 10.0f; DrawLauncherInfo(genericData, texty); texty += 10.0f; DrawSensorInfo(genericData, texty); yCurrent = texty; } void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart) { wxASSERT(missileData); float textx = 10.0f; float texty = yStart; PrintText(textx, texty, "Nominal range %.0f km", missileData->mfRange_km); PrintText(textx, texty, "Max speed Mach %.1f", missileData->mfMsupm); PrintText(textx, texty, "Warhead %.0f kg", missileData->mfDamage); PrintText(textx, texty, "Seeker FOV %.0f deg", C_180OVERPI*missileData->GetSeekerFOV()); yCurrent = texty; } void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart) { wxASSERT(torpedoData); float textx = 10.0f; float texty = yStart; if (torpedoData->batteryRate_kW > 0) { float range_km = 2.778e-4f * C_NMITOKM * torpedoData->maxSpeed_kts * torpedoData->battery_kJ / torpedoData->batteryRate_kW; PrintText(textx, texty, "Range %.0f km", range_km); } else { PrintText(textx, texty, "Nominal range %.0f km", torpedoData->mfRange_km); } PrintText(textx, texty, "Max speed %.0f kts", torpedoData->maxSpeed_kts); PrintText(textx, texty, "Warhead %.0f kg", torpedoData->mfDamage); yCurrent = texty; } void tcDatabaseInfoPanel::DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y) { wxASSERT(genericData != 0); int nLaunchers = genericData->mnNumLaunchers; if (nLaunchers <= 0) return; PrintText(10.0, y, "MOUNTS"); database::tcDatabase* database = tcDatabase::Get(); for (int n=0; n<nLaunchers; n++) { std::string launcherClass = genericData->maLauncherClass[n].c_str(); database::tcLauncherDBObject* launcherData = dynamic_cast<database::tcLauncherDBObject*>( database->GetObject(launcherClass)); wxString s; if (launcherData != 0) { s = launcherData->GetConfigurationDescription(); } else { s.Printf("ERROR: Launcher not found (%s)", launcherClass.c_str()); } PrintText(20.0, y, "%s", s.c_str()); } } void tcDatabaseInfoPanel::DrawSensorInfo(database::tcGenericDBObject* genericData, float& y) { wxASSERT(genericData != 0); int nSensors = genericData->sensorClass.size(); if (nSensors <= 0) return; database::tcDatabase* database = tcDatabase::Get(); PrintText(10.0, y, "SENSORS"); for (int n=0; n<nSensors; n++) { std::string& sensorClass = genericData->sensorClass[n]; database::tcRadarDBObject* radarData = dynamic_cast<database::tcRadarDBObject*>( database->GetObject(sensorClass)); if (radarData) { float displayRange = 0; if (radarData->mbDetectsAir) displayRange = 2.0f * radarData->mfRefRange_km; // 12 dBsm assumed else displayRange = 5.66f * radarData->mfRefRange_km; // 30 dBsm assumed PrintText(20.0, y, "%s (%.0f km)", sensorClass.c_str(), displayRange); } else { PrintText(20.0, y, "%s", sensorClass.c_str()); } } } void tcDatabaseInfoPanel::PrintText(float x, float& y, const char* formatString, ...) { enum {STR_LENGTH = 256}; static char textBuffer[STR_LENGTH]; static osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); static osg::BoundingBox textBox; const float textFontSize = 12.0f; //if (y > float(mnHeight) - 15.0f) return; va_list arguments; va_start(arguments, formatString); _vsnprintf(textBuffer, STR_LENGTH, formatString, arguments); va_end(arguments); float maxWidth = float(mnWidth - 20) - x; DrawTextR(textBuffer, x, y, defaultFont.get(), color, textFontSize, LEFT_BASE_LINE, maxWidth, textBox); y += textBox.yMax() - textBox.yMin() + 2.0f; } void tcDatabaseInfoPanel::OnScrollbarUpdated(wxCommandEvent& event) { yOffset = 0.25 * float(event.m_extraLong); } database::tcDatabaseObject* tcDatabaseInfoPanel::GetDatabaseObject() { if (databaseClassName.size() > 1) { return tcDatabase::Get()->GetObject(databaseClassName); } tcSimState* simState = tcSimState::Get(); tcGameObject* obj = simState->GetObject(objId); if ((obj != 0) && (obj->IsOwnAlliance())) { databaseClassName = obj->mpDBObject->mzClass.c_str(); return obj->mpDBObject; } else { tcSensorMap* sensorMap = simState->GetSensorMap(); wxASSERT(sensorMap != 0); tcSensorMapTrack* track = sensorMap->GetSensorMapTrack(objId, tcUserInfo::Get()->GetOwnAlliance()); if (track) { return tcDatabase::Get()->GetObject(track->GetDatabaseId()); } else { return 0; } } } bool tcDatabaseInfoPanel::IsEmbedded() const { return (viewMode == EMBED); } bool tcDatabaseInfoPanel::IsPopup() const { return (viewMode == POPUP); } void tcDatabaseInfoPanel::SetDatabaseClassName(const std::string& className) { databaseClassName = className; yOffset = 0; } void tcDatabaseInfoPanel::SetDatabaseObject(long id) { objId = id; databaseClassName = ""; yOffset = 0; } void tcDatabaseInfoPanel::SetViewMode(int mode) { viewMode = (ViewMode)mode; } /** * if hostParent argument is not used then static method SetParent must be called first */ tcDatabaseInfoPanel::tcDatabaseInfoPanel(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxString& name, tc3DWindow* graphicsHost) : tc3DWindow(parent, pos, size, name, graphicsHost), objId(-1), databaseClassName(""), viewMode(EMBED), yOffset(0) { wxASSERT(hostParent != 0); // put gui window on top SetBaseRenderBin(hostParent->GetBaseRenderBin() + 10); wxWindow::Raise(); SetBackgroundColor(osg::Vec4(0, 0, 0.1, 0.1)); SetBackgroundDraw(true); SetActive(true); SetStencilLayer(hostParent->GetBaseRenderBin()/ 8); int scrollBarWidth = 16; scrollBar = new tcScrollBar(this, wxPoint(mnWidth-scrollBarWidth, 0), wxSize(scrollBarWidth, mnHeight)); scrollBar->SetBackgroundAlpha(0.25f); } tcDatabaseInfoPanel::~tcDatabaseInfoPanel() { } Index: tcDatabaseViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseViewer.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcDatabaseViewer.cpp 18 Jun 2006 00:45:00 -0000 1.5 --- tcDatabaseViewer.cpp 17 Aug 2006 01:28:04 -0000 1.6 *************** *** 37,40 **** --- 37,41 ---- #include "tcDatabaseIterator.h" #include "tcDatabaseInfoWindow.h" + #include "tcDatabaseBrowsePanel.h" #include "tc3DViewer.h" *************** *** 43,46 **** --- 44,48 ---- #endif + BEGIN_EVENT_TABLE(tcDatabaseViewer, tcXmlWindow) EVT_COMMAND(101, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseSurface) *************** *** 52,55 **** --- 54,58 ---- EVT_COMMAND(107, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseTorpedo) EVT_COMMAND(108, wxEVT_COMMAND_BUTTON_CLICKED, tcDatabaseViewer::BrowseBallistic) + EVT_COMMAND(-1, wxEVT_COMMAND_TEXT_UPDATED, tcDatabaseViewer::SelectDisplayClass) END_EVENT_TABLE() *************** *** 105,131 **** - /** - * Updates browse info data based on classificationMask - * Should be called after changing classificationMask - */ - void tcDatabaseViewer::BuildBrowseInfo() - { - browseInfo.clear(); - - database::tcDatabaseIterator iter(classificationMask); - - for (iter.First(); !iter.IsDone(); iter.Next()) - { - database::tcDatabaseObject* obj = iter.Get(); - wxASSERT(obj); - wxASSERT(obj->mnKey != -1); - - BrowseItem item; - item.className = obj->mzClass.c_str(); - - browseInfo.push_back(item); - } - - } const std::string& tcDatabaseViewer::GetDisplayClass() const --- 108,111 ---- *************** *** 134,156 **** } - /** - * - */ - bool tcDatabaseViewer::ProcessMouseClick(std::vector<BrowseItem>& info, wxPoint pos) - { - for (size_t n=0; n < info.size(); ++n) - { - wxRect r(info[n].drawBox.x, info[n].drawBox.y, - info[n].drawBox.width, info[n].drawBox.height); - - if (r.Inside(pos)) - { - SelectDisplayClass(info[n].className); - return true; - } - } - return false; - } void tcDatabaseViewer::SetClassificationMask(unsigned int mask) --- 114,118 ---- *************** *** 160,234 **** classificationMask = mask; ! BuildBrowseInfo(); ! UpdateDrawInfo(browseInfo); ! } /** - * Update drawing info of browseInfo vector - */ - void tcDatabaseViewer::UpdateDrawInfo(std::vector<BrowseItem>& info) - { - - float x = 50.0f; - float y = 150.0f; - float xWidth = 100.0f; - float yHeight = 15.0f; - - for (size_t n=0; n < info.size(); ++n) - { - BrowseItem& item = info[n]; - - item.drawBox.x = x; - item.drawBox.y = y; - item.drawBox.height = yHeight - 2; - item.drawBox.width = xWidth; - - y += yHeight; - - wxRect r(item.drawBox.x, item.drawBox.y, - item.drawBox.width, item.drawBox.height); - - int oldState = item.drawState; - - if (item.className == displayClassName) - { - item.drawState = BrowseItem::ON; - item.color = osg::Vec4(1, 1, 1, 1); - if (item.drawState != oldState) tcSound::Get()->PlayEffect("Beep2"); - } - else if (r.Inside(mousePosition)) - { - item.drawState = BrowseItem::OVER; - item.color = osg::Vec4(0.6, 0.6, 1, 1); - if (item.drawState != oldState) tcSound::Get()->PlayEffect("Thuck"); - } - else - { - item.drawState = BrowseItem::OFF; - item.color = osg::Vec4(0.5, 0.5, 0.5, 1); - } - } - } - - /** * */ void tcDatabaseViewer::Draw() { - DrawChildren(); - - for (size_t n=0; n<browseInfo.size(); n++) - { - BrowseItem& item = browseInfo[n]; - - DrawTextR(item.className.c_str(), item.drawBox.x, - item.drawBox.y + item.drawBox.height - 3, defaultFont.get(), - item.color, 16.0f, LEFT_BASE_LINE); - } - DrawBorder(); --- 122,136 ---- classificationMask = mask; ! browsePanel->SetClassificationMask(mask); } /** * */ void tcDatabaseViewer::Draw() { DrawChildren(); DrawBorder(); *************** *** 314,317 **** --- 216,225 ---- } + void tcDatabaseViewer::InitializeBrowsePanel() + { + browsePanel = new tcDatabaseBrowsePanel(this, wxPoint(50, 150), wxSize(220, 500), "BrowsePanel", this); + } + + void tcDatabaseViewer::InitializeDatabaseInfoWindow() { *************** *** 324,327 **** --- 232,236 ---- } + /** * *************** *** 330,335 **** { mousePosition = event.GetPosition(); - - UpdateDrawInfo(browseInfo); } --- 239,242 ---- *************** *** 346,355 **** mousePosition = event.GetPosition(); - - if (ProcessMouseClick(browseInfo, mousePosition)) - { - UpdateDrawInfo(browseInfo); - return; - } } --- 253,256 ---- *************** *** 376,379 **** --- 277,287 ---- } + void tcDatabaseViewer::SelectDisplayClass(wxCommandEvent& event) + { + std::string className = event.GetString().c_str(); + + SelectDisplayClass(className); + } + void tcDatabaseViewer::SelectDisplayClass(const std::string& className) { *************** *** 422,426 **** --- 330,336 ---- InitializeButtons(); + InitializeBrowsePanel(); InitializeDatabaseInfoWindow(); + SetClassificationMask(PTYPE_SURFACE); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tc3DModel.cpp 18 Jun 2006 00:45:00 -0000 1.37 --- tc3DModel.cpp 17 Aug 2006 01:28:04 -0000 1.38 *************** *** 38,41 **** --- 38,42 ---- #include "tcSimState.h" #include "tc3DViewer.h" + #include "tcBoundingBoxVisitor.h" #include "common/tinyxml.h" #include <osg/MatrixTransform> *************** *** 46,49 **** --- 47,51 ---- #include <osgParticle/ExplosionDebrisEffect> + //#include <osgAL/SoundNode> //#include <osgAL/SoundRoot> *************** *** 556,589 **** * GetBoundingBox does not exist for osg::Node. */ ! const osg::BoundingBox& tc3DModel::GetBoundingBox() const { ! static osg::BoundingBox bb(0, 0, 0, 0, 0, 0); ! bb.set(0, 0, 0, 0, 0, 0); ! ! wxASSERT(false); // this does not work! ! return bb; ! if (const osg::Group* group = modelNode.get()->asGroup()) ! { ! // initialize with first child ! if (const osg::Geode* geode = dynamic_cast<const osg::Geode*>(group->getChild(0))) ! { ! bb = geode->getBoundingBox(); ! } ! // expand to include remaining children ! for (size_t n=1; n<group->getNumChildren(); n++) ! { ! if (const osg::Geode* geode = dynamic_cast<const osg::Geode*>(group->getChild(0))) ! { ! bb.expandBy(geode->getBoundingBox()); ! } ! } ! return bb; ! } ! wxASSERT(false); ! return bb; } tcSensorMapTrack* tc3DModel::GetSensorTrack() const --- 558,598 ---- * GetBoundingBox does not exist for osg::Node. */ ! const osg::BoundingBox& tc3DModel::GetBoundingBox() { ! if (boundingBoxComputed) ! { ! return boundingBox; ! } ! osg::Matrix matrix; ! matrix.makeIdentity(); ! tcBoundingBoxVisitor bbvis(matrix); ! modelNode->accept(bbvis); ! ! boundingBox = bbvis.getBound(); ! ! boundingBoxComputed = true; ! return boundingBox; } + /** + * Workaround for const-ness requirements. + */ + const osg::BoundingBox& tc3DModel::GetBoundingBoxConst() const + { + static osg::BoundingBox zeroBox(0, 0, 0, 0, 0, 0); + + if (boundingBoxComputed) + { + return boundingBox; + } + else + { + wxASSERT(false); + return zeroBox; + } + + } tcSensorMapTrack* tc3DModel::GetSensorTrack() const *************** *** 627,630 **** --- 636,648 ---- fprintf(stdout, "tc3DModel--Loaded 3D model: %s\n", model_name.c_str()); + + #ifdef _DEBUG + osg::BoundingBox bb = GetBoundingBox(); + fprintf(stdout, " Bounding box dimensions X: %f %f, Y: %f %f, Z: %f %f\n", + bb.xMin(), bb.xMax(), bb.yMin(), bb.yMax(), bb.zMin(), bb.zMax()); + + #endif + + } *************** *** 1010,1014 **** : gameObj(0), sensorTrack(0), ! author("") { } --- 1028,1033 ---- : gameObj(0), sensorTrack(0), ! author(""), ! boundingBoxComputed(false) { } *************** *** 1022,1026 **** gameObj(source->gameObj), sensorTrack(source->sensorTrack), ! author(source->author) { static int addCount = 0; --- 1041,1047 ---- gameObj(source->gameObj), sensorTrack(source->sensorTrack), ! author(source->author), ! boundingBox(source->boundingBox), ! boundingBoxComputed(source->boundingBoxComputed) { static int addCount = 0; --- NEW FILE: tcBoundingBoxVisitor.cpp --- /** ** @file tcBoundingBoxVisitor.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 ** ** Based on code by Farshid Lashkari posted to the osg-users list on April 18, 2006 */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif // WX_PRECOMP #include "tcBoundingBoxVisitor.h" #include <osg/BoundingBox> #include <osg/Geode> #include <osg/Transform> #ifdef _DEBUG #define new DEBUG_NEW #endif void tcBoundingBoxVisitor::apply(osg::Node &node) { traverse(node); } void tcBoundingBoxVisitor::apply(osg::Geode &geode) { for(unsigned int i = 0; i < geode.getNumDrawables(); i++) { osg::BoundingBox bb = geode.getDrawable(i)->getBound(); m_bb.expandBy(bb.corner(0)*m_curMatrix); m_bb.expandBy(bb.corner(1)*m_curMatrix); m_bb.expandBy(bb.corner(2)*m_curMatrix); m_bb.expandBy(bb.corner(3)*m_curMatrix); m_bb.expandBy(bb.corner(4)*m_curMatrix); m_bb.expandBy(bb.corner(5)*m_curMatrix); m_bb.expandBy(bb.corner(6)*m_curMatrix); m_bb.expandBy(bb.corner(7)*m_curMatrix); } traverse(geode); } void tcBoundingBoxVisitor::apply(osg::Transform& node) { osg::Matrix matrix; node.computeLocalToWorldMatrix(matrix, this); osg::Matrix prevMatrix = m_curMatrix; m_curMatrix.preMult(matrix); traverse(node); m_curMatrix = prevMatrix; } osg::BoundingBox tcBoundingBoxVisitor::getBound() const { return m_bb; } tcBoundingBoxVisitor::tcBoundingBoxVisitor(const osg::Matrix &mat) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) { m_curMatrix = mat; } Index: tcOOBView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcOOBView.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcOOBView.cpp 18 Jun 2006 00:45:00 -0000 1.14 --- tcOOBView.cpp 17 Aug 2006 01:28:04 -0000 1.15 *************** *** 405,409 **** DrawRectangleR(0, 0, mnWidth, mnHeight, ! osg::Vec4(0, 0, 0, 0.5f), FILL_ON); DrawBorder(); --- 405,409 ---- DrawRectangleR(0, 0, mnWidth, mnHeight, ! osg::Vec4(0, 0, 0, 0.7f), FILL_ON); DrawBorder(); Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcMapView.cpp 4 May 2006 22:47:26 -0000 1.45 --- tcMapView.cpp 17 Aug 2006 01:28:04 -0000 1.46 *************** *** 1524,1527 **** --- 1524,1531 ---- osg::Geometry* pSurface = DrawNTDSSurface((teAffiliation)nAffiliation); + // carrier symbol + osg::Geometry* pCarrier = DrawNTDSSurface((teAffiliation)nAffiliation); + + // fixed ground symbol osg::Geometry* pGround = DrawNTDSGround((teAffiliation)nAffiliation); *************** *** 1560,1563 **** --- 1564,1570 ---- pSymbol = pSurface; break; + case SYMBOL_CARRIER: + pSymbol = pCarrier; + break; case SYMBOL_MISSILE: pSymbol = pMissile; *************** *** 1578,1581 **** --- 1585,1589 ---- break; case SYMBOL_FIXED: + case SYMBOL_AIRFIELD: pSymbol = pGround; break; *************** *** 1624,1627 **** --- 1632,1638 ---- osg::Geometry* pSurface = CreateTexturedSymbol(zBuff); + sprintf(zBuff,"carrier%s",zAffil); + osg::Geometry* pCarrier = CreateTexturedSymbol(zBuff); + sprintf(zBuff,"air_fw%s",zAffil); osg::Geometry* pAir = CreateTexturedSymbol(zBuff); *************** *** 1636,1639 **** --- 1647,1653 ---- osg::Geometry* pFixed = CreateTexturedSymbol(zBuff); + sprintf(zBuff,"airfield%s",zAffil); + osg::Geometry* pAirfield = CreateTexturedSymbol(zBuff); + sprintf(zBuff,"sub%s",zAffil); osg::Geometry* pSub = CreateTexturedSymbol(zBuff); *************** *** 1660,1663 **** --- 1674,1680 ---- pSymbol = pSurface; break; + case SYMBOL_CARRIER: + pSymbol = pCarrier; + break; case SYMBOL_MISSILE: pSymbol = pMissile; *************** *** 1680,1683 **** --- 1697,1703 ---- pSymbol = pFixed; break; + case SYMBOL_AIRFIELD: + pSymbol = pAirfield; + break; case SYMBOL_MARK: pSymbol = pMark; *************** *** 1811,1814 **** --- 1831,1835 ---- /** * Version that uses pre-drawn images to draw symbols + * This is a mess, clean this up (draw out of symbol class perhaps) */ void tcTacticalMapView::DrawSymbol2(tcMapObj* pMO) *************** *** 2018,2023 **** if (mbShowTrackID && !suppressTrackId) { ! wxString s = wxString::Format("%04d", pMO->mnID); ! DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 10.0, LEFT_BASE_LINE); } --- 2039,2052 ---- if (mbShowTrackID && !suppressTrackId) { ! wxString s; ! if (pMO->speed_kts > 0) ! { ! s = wxString::Format("%04d\n%04.0f", pMO->mnID, pMO->speed_kts); ! } ! else ! { ! s = wxString::Format("%04d", pMO->mnID); ! } ! DrawTextR(s.c_str(), x-9.0f, y+16.0f, defaultFont.get(), symbolColor, 11.0, LEFT_BASE_LINE); } *************** *** 2325,2328 **** --- 2354,2359 ---- Build2525(); CreateAlternateSymbols(); + + UpdateMapObjectColors(); } *************** *** 2342,2345 **** --- 2373,2415 ---- RefreshTerrainView(); + + UpdateMapObjectColors(); + } + + /** + * Update color of map objects based on map color mode. + */ + void tcTacticalMapView::UpdateMapObjectColors() + { + osg::Vec4 color; + switch (tcOptions::Get()->mnMapMode) + { + case 0 : + color = osg::Vec4(0, 0, 0, 1); + tcMapObject::LoadMarker("black_marker.png"); + break; + case 1 : + color = osg::Vec4(0, 0, 0, 1); + tcMapObject::LoadMarker("black_marker.png"); + break; + case 2 : + color = osg::Vec4(1, 1, 1, 1); + tcMapObject::LoadMarker("white_marker.png"); + break; + default: + wxASSERT(false); + color = osg::Vec4(1, 0, 0, 1); + break; + } + + int nObjects = (int)specialGraphics.size(); + for(int n=0; n<nObjects; n++) + { + tcMapObject* obj = specialGraphics[n]; + obj->SetColor(color); + } + + if (overlay != 0) overlay->SetColor(color); + } Index: tcMapObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapObject.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMapObject.cpp 23 Mar 2006 01:11:02 -0000 1.10 --- tcMapObject.cpp 17 Aug 2006 01:28:04 -0000 1.11 *************** *** 84,88 **** } ! void tcMapObject::LoadMarker() { float w = 10.0f; --- 84,88 ---- } ! void tcMapObject::LoadMarker(const std::string& filename) { float w = 10.0f; *************** *** 127,131 **** // add texture ! osg::Image* image = tc3DWindow::LoadImage("marker.png"); osg::Texture2D* texture = new osg::Texture2D; --- 127,136 ---- // add texture ! osg::Image* image = tc3DWindow::LoadImage(filename.c_str()); ! if (image == 0) ! { ! fprintf(stderr, "tcMapObject::LoadMarker -- image not found (%s)\n", filename.c_str()); ! } ! osg::Texture2D* texture = new osg::Texture2D; *************** *** 200,204 **** markerEnabled = true; ! if (!marker.valid()) LoadMarker(); } --- 205,209 ---- markerEnabled = true; ! if (!marker.valid()) LoadMarker("black_marker.png"); } Index: tcContainerGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcContainerGui.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcContainerGui.cpp 23 Mar 2006 01:11:02 -0000 1.9 --- tcContainerGui.cpp 17 Aug 2006 01:28:04 -0000 1.10 *************** *** 455,458 **** --- 455,460 ---- wxWindow::Raise(); + tc3DWindow::SetStencilLayer(windowLayer-3); // assumes windowLayer starts at 4 + windowLayer++; --- NEW FILE: tcDatabaseBrowsePanel.cpp --- /** ** @file tcDatabaseBrowsePanel.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 "tcDatabaseBrowsePanel.h" #include <osg/Texture2D> #include <osg/Vec4> #include "wxcommands.h" #include "common/tinyxml.h" #include "tcDatabase.h" #include "tcDatabaseObject.h" #include "tcDatabaseIterator.h" #include "tcScrollBar.h" #include "tcSound.h" #ifdef _DEBUG #define new DEBUG_NEW #endif BEGIN_EVENT_TABLE(tcDatabaseBrowsePanel, tc3DWindow) EVT_COMMAND(-1, wxEVT_COMMAND_SCROLLBAR_UPDATED, tcDatabaseBrowsePanel::OnScrollbarUpdated) END_EVENT_TABLE() /** * Updates browse info data based on classificationMask * Should be called after changing classificationMask */ void tcDatabaseBrowsePanel::BuildBrowseInfo() { yOffset = 0; browseInfo.clear(); database::tcDatabaseIterator iter(classificationMask); for (iter.First(); !iter.IsDone(); iter.Next()) { database::tcDatabaseObject* obj = iter.Get(); wxASSERT(obj); wxASSERT(obj->mnKey != -1); BrowseItem item; item.className = obj->mzClass.c_str(); browseInfo.push_back(item); } } const std::string& tcDatabaseBrowsePanel::GetDisplayClass() const { return displayClassName; } /** * */ bool tcDatabaseBrowsePanel::ProcessMouseClick(const wxPoint& pos) { std::vector<BrowseItem>& info = browseInfo; for (size_t n=0; n < info.size(); ++n) { wxRect r(info[n].drawBox.x, info[n].drawBox.y, info[n].drawBox.width, info[n].drawBox.height); if (r.Inside(pos)) { SelectDisplayClass(info[n].className); return true; } } return false; } void tcDatabaseBrowsePanel::SetClassificationMask(unsigned int mask) { if (mask == classificationMask) return; classificationMask = mask; BuildBrowseInfo(); UpdateDrawInfo(); } void tcDatabaseBrowsePanel::ClearMouseOver() { std::vector<BrowseItem>& info = browseInfo; for (size_t n=0; n < info.size(); ++n) { BrowseItem& item = info[n]; if (item.className == displayClassName) { item.drawState = BrowseItem::ON; item.color = osg::Vec4(1, 1, 1, 1); } else { item.drawState = BrowseItem::OFF; item.color = osg::Vec4(0.5, 0.5, 0.5, 1); } } } /** * Update drawing info of browseInfo vector */ void tcDatabaseBrowsePanel::UpdateDrawInfo() { std::vector<BrowseItem>& info = browseInfo; float x = 5.0f; float y = 15.0f; float xWidth = float(mnWidth); float yHeight = 15.0f; for (size_t n=0; n < info.size(); ++n) { BrowseItem& item = info[n]; item.drawBox.x = x; item.drawBox.y = y - yOffset; item.drawBox.height = yHeight - 2; item.drawBox.width = xWidth; y += yHeight; wxRect r(item.drawBox.x, item.drawBox.y, item.drawBox.width, item.drawBox.height); int oldState = item.drawState; if (item.className == displayClassName) { item.drawState = BrowseItem::ON; item.color = osg::Vec4(1, 1, 1, 1); if (item.drawState != oldState) tcSound::Get()->PlayEffect("Beep2"); } else if (mouseOver && (r.Inside(mousePosition))) { item.drawState = BrowseItem::OVER; item.color = osg::Vec4(0.6, 0.6, 1, 1); if (item.drawState != oldState) tcSound::Get()->PlayEffect("Thuck"); } else { item.drawState = BrowseItem::OFF; item.color = osg::Vec4(0.5, 0.5, 0.5, 1); } } // update scroll bar (only need to do this once per browse change) float ySpan = 50.0f + float(info.size())*yHeight; float maxSpan = float(mnHeight); scrollBar->SetBarFraction(maxSpan / ySpan); } /** * */ void tcDatabaseBrowsePanel::Draw() { DrawChildren(); for (size_t n=0; n<browseInfo.size(); n++) { BrowseItem& item = browseInfo[n]; DrawTextR(item.className.c_str(), item.drawBox.x, item.drawBox.y + item.drawBox.height - 3, defaultFont.get(), item.color, 16.0f, LEFT_BASE_LINE); } HideUnusedObjects(); } /** * */ void tcDatabaseBrowsePanel::OnMouseMove(wxMouseEvent& event) { mousePosition = event.GetPosition(); UpdateDrawInfo(); } /** * */ void tcDatabaseBrowsePanel::OnLButtonDown(wxMouseEvent& event) { if (!mbActive) { event.Skip(); return; } mousePosition = event.GetPosition(); if (ProcessMouseClick(mousePosition)) { UpdateDrawInfo(); return; } } void tcDatabaseBrowsePanel::OnEnterWindow(wxMouseEvent& event) { mouseOver = true; } void tcDatabaseBrowsePanel::OnLeaveWindow(wxMouseEvent& event) { ClearMouseOver(); mouseOver = false; } void tcDatabaseBrowsePanel::OnScrollbarUpdated(wxCommandEvent& event) { yOffset = 0.25 * float(event.m_extraLong); UpdateDrawInfo(); } void tcDatabaseBrowsePanel::SelectDisplayClass(const std::string& className) { displayClassName = className; wxCommandEvent cmd(wxEVT_COMMAND_TEXT_UPDATED, 1); cmd.SetEventObject(this); cmd.m_cmdString = className.c_str(); AddPendingEvent(cmd); } tcDatabaseBrowsePanel::tcDatabaseBrowsePanel(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxString& name, tc3DWindow* graphicsHost) : tc3DWindow(parent, pos, size, name, graphicsHost), classificationMask(0), displayClassName(""), yOffset(0), mouseOver(false) { SetBackgroundColor(osg::Vec4(0, 0, 0, 0.01)); // 0.01 so it doesn't get culled !? SetBackgroundDraw(true); // put gui window on top SetBaseRenderBin(hostParent->GetBaseRenderBin() + 10); wxWindow::Raise(); SetStencilLayer(1 + hostParent->GetBaseRenderBin()/ 8); // 1+ hack to ensure different than tcDatabaseInfoPanel int scrollBarWidth = 16; scrollBar = new tcScrollBar(this, wxPoint(mnWidth-scrollBarWidth, 0), wxSize(scrollBarWidth, mnHeight)); scrollBar->SetBackgroundAlpha(0.25f); } tcDatabaseBrowsePanel::~tcDatabaseBrowsePanel() { } --- NEW FILE: tcScrollBar.cpp --- /** ** @file tcScrollBar.cpp */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 "tcScrollBar.h" #include "tcTime.h" #include <osg/Texture2D> #include <osg/Vec4> #include "wxcommands.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 tcScrollBar::Draw() { if ((!mbActive) || (barFraction > 1)) return; UpdateAutoScroll(); float w = float(mnWidth); float h = float(mnHeight); if (!overArrowUp) { DrawImageR(arrowUp.get(), 0, 0, w, w, ALIGN_BOTTOM_LEFT); } else { DrawImageR(arrowUpOver.get(), 0, 0, w, w, ALIGN_BOTTOM_LEFT); } if (!overArrowDown) { DrawImageR(arrowDown.get(), 0, h-w, w, w, ALIGN_BOTTOM_LEFT); } else { DrawImageR(arrowDownOver.get(), 0, h-w, w, w, ALIGN_BOTTOM_LEFT); } osg::Vec4 barColor; if (!scrollDrag) { if (!overScrollBar) { barColor.set(0.2, 0.5, 0.2, backgroundAlpha); } else { barColor.set(0.4, 1, 0.4, backgroundAlpha); } } else { barColor.set(1, 1, 1, backgroundAlpha); } osg::Vec4 baseColor(0.2, 0.5, 0.2, backgroundAlpha); //DrawRectangle(0, w, mnWidth, mnHeight-w, backgroundColor, FILL_ON); DrawRectangle(0, 0, w, h, baseColor, FILL_OFF); DrawLine(0, w, w, w, baseColor); DrawLine(0, h-w, w, h-w, baseColor); // draw scroll bar rectangle float barHeight = barFraction*(h - 2*w); barRect.Set(0, w, w+ybar, w+ybar+barHeight); buttonUpRect.Set(0, w, 0, w); buttonDownRect.Set(0, w, h-w, h); DrawRectangleR(barRect, barColor, FILL_ON); HideUnusedObjects(); } void tcScrollBar::LoadImages() { arrowUp = tc3DWindow::LoadTexture("up_arrow.png"); arrowDown = tc3DWindow::LoadTexture("down_arrow.png"); arrowUpOver = tc3DWindow::LoadTexture("up_arrow_over.png"); arrowDownOver = tc3DWindow::LoadTexture("down_arrow_over.png"); } /** * */ void tcScrollBar::OnEnterWindow(wxMouseEvent& event) { isMouseOver = true; } /** * Treat double click as single click */ void tcScrollBar::OnLButtonDClick(wxMouseEvent& event) { OnLButtonDown(event); } /** * */ void tcScrollBar::OnLButtonDown(wxMouseEvent& event) { wxPoint pos = event.GetPosition(); autoScrollIncrement = 0; leftButtonDown = true; if (barRect.ContainsPoint(pos.x, pos.y)) { scrollDrag = true; scrollDragStart = pos; ybarStart = ybar; CaptureMouse(); } else if (buttonUpRect.ContainsPoint(pos.x, pos.y)) { UpdateYbar(ybar - clickScrollAmount); buttonDownTime = tcTime::Get()->Get30HzCount(); autoScrollIncrement = -clickScrollAmount; } else if (buttonDownRect.ContainsPoint(pos.x, pos.y)) { UpdateYbar(ybar + clickScrollAmount); buttonDownTime = tcTime::Get()->Get30HzCount(); autoScrollIncrement = clickScrollAmount; } } /** * */ void tcScrollBar::OnLButtonUp(wxMouseEvent& event) { if (scrollDrag) { ReleaseMouse(); } leftButtonDown = false; scrollDrag = false; autoScrollIncrement = 0; autoScroll = false; } /** * */ void tcScrollBar::OnLeaveWindow(wxMouseEvent& event) { autoScrollIncrement = 0; autoScroll = false; overScrollBar = false; overArrowUp = false; overArrowDown = false; } /** * */ void tcScrollBar::OnMouseMove(wxMouseEvent& event) { wxPoint pos = event.GetPosition(); overScrollBar = false; overArrowUp = false; overArrowDown = false; if (barRect.ContainsPoint(pos.x, pos.y)) { overScrollBar = true; } else if (buttonUpRect.ContainsPoint(pos.x, pos.y)) { overArrowUp = true; } else if (buttonDownRect.ContainsPoint(pos.x, pos.y)) { overArrowDown = true; } if (!scrollDrag) return; float dy = float(pos.y - scrollDragStart.y); UpdateYbar(ybarStart + dy); } void tcScrollBar::SendScrollbarUpdated() { if (ybar == lastybar) return; lastybar = ybar; wxCommandEvent cmd(wxEVT_COMMAND_SCROLLBAR_UPDATED, 1); cmd.SetEventObject(this); cmd.m_extraLong = long(ybar * 4.0f / barFraction); AddPendingEvent(cmd); } /** * */ void tcScrollBar::SetBackgroundAlpha(float val) { backgroundAlpha = val; } void tcScrollBar::SetBarFraction(float val) { if (barFraction == val) return; barFraction = val; if (barFraction < 0.005) barFraction = 0.005; SetActive(barFraction < 1.0); ybar = 0; } /** * 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. * * Similar to method in tcNumberWidget * @see tcNumberWidget::UpdateAutoChange */ void tcScrollBar::UpdateAutoScroll() { if (autoScrollIncrement == 0) return; unsigned currentTime = tcTime::Get()->Get30HzCount(); if (currentTime - buttonDownTime > 20) { autoScroll = true; } if (autoScroll) { UpdateYbar(ybar + autoScrollIncrement); } } void tcScrollBar::UpdateYbar(float ynew) { ybar = ynew; float ybarMax = float(mnHeight) - float(2*mnWidth) - barRect.Height(); if (ybar < 0) ybar = 0; else if (ybar > ybarMax) ybar = ybarMax; SendScrollbarUpdated(); } /** * */ tcScrollBar::tcScrollBar(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : tc3DWindow(parent, pos, size, name, parent), isMouseOver(false), leftButtonDown(false), overArrowUp(false), overArrowDown(false), overScrollBar(false), scrollDrag(false), backgroundAlpha(0.8f), barFraction(1.1f), ybar(0), lastybar(9999.9f), clickScrollAmount(5.0f), autoScroll(false), autoScrollIncrement(0), buttonDownTime(0) { LoadImages(); SetBaseRenderBin(parent->GetBaseRenderBin() + 10); wxWindow::Raise(); SetActive(false); } tcScrollBar::~tcScrollBar() { #ifdef _DEBUG fprintf(stdout, "Destroying tcScrollBar\n"); #endif } Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcDatabaseInfoWindow.cpp 21 Apr 2006 23:29:09 -0000 1.6 --- tcDatabaseInfoWindow.cpp 17 Aug 2006 01:28:04 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- #include "common/tinyxml.h" #include "tcTime.h" + #include "tcDatabaseInfoPanel.h" #include <osg/Geometry> *************** *** 51,54 **** --- 52,56 ---- using database::tcDatabaseObject; + tc3DWindow* tcDatabaseInfoWindow::parent = 0; *************** *** 130,157 **** DrawDatabaseImages(); - PrintText(textx, texty, "Unit cost: %s", databaseObj->GetCostString()); - - PrintText(textx, texty, "%s", databaseObj->mzDescription); - - - texty += 5.0f; - - if (tcGenericDBObject* generic = dynamic_cast<tcGenericDBObject*>(databaseObj)) - { - DrawDatabaseInfo(generic, texty); - } - else if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(databaseObj)) - { - DrawDatabaseInfo(missile, texty); - } - else if (tcTorpedoDBObject* torpedo = dynamic_cast<tcTorpedoDBObject*>(databaseObj)) - { - DrawDatabaseInfo(torpedo, texty); - } - textx = xImage + 10.0f; texty = float(mnHeight) - 15.0f; const std::string& artists = databaseObj->Get3DModel()->GetAuthor(); ! if (artists.size() > 0) { PrintText(textx, texty, "3D Artist(s): %s", artists.c_str()); --- 132,139 ---- DrawDatabaseImages(); textx = xImage + 10.0f; texty = float(mnHeight) - 15.0f; const std::string& artists = databaseObj->Get3DModel()->GetAuthor(); ! if ((artists.size() > 0) && IsEmbedded()) { PrintText(textx, texty, "3D Artist(s): %s", artists.c_str()); *************** *** 161,312 **** - void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart) - { - float textx = 10.0f; - float maxWidth = float(mnWidth) - textx - 5.0f; - float texty = yStart; - osg::BoundingBox textBox; - osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); - - - PrintText(textx, texty, "Max speed: %.0f kts", genericData->mfMaxSpeed_kts); - - if (IsEmbedded()) - { - PrintText(textx, texty, "Turn rate: %.1f deg/s", genericData->mfTurnRate_degps); - } - - - PrintText(textx, texty, "Survivability: %.0f", genericData->mfToughness); - - PrintText(textx, texty, "RCS %.0f dBsm", genericData->mfRcs_dbsm); - - if ((genericData->mfFuelRate_kgps > 0) && IsEmbedded()) - { - float fuelTimeHours = 2.778e-4 * genericData->mfFuelCapacity_kg / genericData->mfFuelRate_kgps; - - switch (genericData->mnModelType) - { - case MTYPE_SURFACE: - case MTYPE_CARRIER: - case MTYPE_AIR: - PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * genericData->mfMaxSpeed_kts * C_NMITOKM); - break; - case MTYPE_FIXEDWINGX: - PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); - break; - case MTYPE_HELO: - PrintText(textx, texty, "Endurance %.1f hrs", 2.0f * fuelTimeHours); - break; - case MTYPE_SUBMARINE: - PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); - break; - } - } - - texty += 10.0f; - DrawLauncherInfo(genericData, texty); - - texty += 10.0f; - DrawSensorInfo(genericData, texty); - } - - - void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart) - { - wxASSERT(missileData); - - float textx = 10.0f; - float texty = yStart; - - PrintText(textx, texty, "Nominal range %.0f km", missileData->mfRange_km); - - PrintText(textx, texty, "Max speed Mach %.1f", missileData->mfMsupm); - - PrintText(textx, texty, "Warhead %.0f kg", missileData->mfDamage); - - PrintText(textx, texty, "Seeker FOV %.0f deg", missileData->GetSeekerFOV()); - - } - - void tcDatabaseInfoWindow::DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart) - { - wxASSERT(torpedoData); - - float textx = 10.0f; - float texty = yStart; - - if (torpedoData->batteryRate_kW > 0) - { - float range_km = 2.778e-4f * C_NMITOKM * torpedoData->maxSpeed_kts * torpedoData->battery_kJ / - torpedoData->batteryRate_kW; - PrintText(textx, texty, "Range %.0f km", range_km); - } - else - { - PrintText(textx, texty, "Nominal range %.0f km", torpedoData->mfRange_km); - } - - PrintText(textx, texty, "Max speed %.0f kts", torpedoData->maxSpeed_kts); - - PrintText(textx, texty, "Warhead %.0f kg", torpedoData->mfDamage); - - } - - - void tcDatabaseInfoWindow::DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y) - { - wxASSERT(genericData != 0); - - int nLaunchers = genericData->mnNumLaunchers; - if (nLaunchers <= 0) return; - - PrintText(10.0, y, "MOUNTS"); - - database::tcDatabase* database = tcDatabase::Get(); - - for (int n=0; n<nLaunchers; n++) - { - std::string launcherClass = genericData->maLauncherClass[n].c_str(); - database::tcLauncherDBObject* launcherData = - dynamic_cast<database::tcLauncherDBObject*>( - database->GetObject(launcherClass)); - wxString s = launcherData->GetConfigurationDescription(); - PrintText(20.0, y, "%s", s.c_str()); - } - - } - - void tcDatabaseInfoWindow::DrawSensorInfo(database::tcGenericDBObject* genericData, float& y) - { - wxASSERT(genericData != 0); - - int nSensors = genericData->sensorClass.size(); - if (nSensors <= 0) return; - - database::tcDatabase* database = tcDatabase::Get(); - - PrintText(10.0, y, "SENSORS"); - - for (int n=0; n<nSensors; n++) - { - std::string& sensorClass = genericData->sensorClass[n]; - database::tcRadarDBObject* radarData = dynamic_cast<database::tcRadarDBObject*>( - database->GetObject(sensorClass)); - if (radarData) - { - float displayRange = 0; - if (radarData->mbDetectsAir) displayRange = 2.0f * radarData->mfRefRange_km; // 12 dBsm assumed - else displayRange = 5.66f * radarData->mfRefRange_km; // 30 dBsm assumed - - PrintText(20.0, y, "%s (%.0f km)", sensorClass.c_str(), displayRange); - } - else - { - PrintText(20.0, y, "%s", sensorClass.c_str()); - } - } - - } void tcDatabaseInfoWindow::PrintText(float x, float& y, const char* formatString, ...) --- 143,146 ---- *************** *** 340,345 **** float imageWidth = 150.0f; float imageHeight = 100.0f; ! float imagex = float(mnWidth) - imageWidth - 20.0f; ! float imagey = 10.0f; if (IsEmbedded()) --- 174,179 ---- float imageWidth = 150.0f; float imageHeight = 100.0f; ! float imagex = float(mnWidth) - imageWidth - 10.0f; ! float imagey = 25.0f; if (IsEmbedded()) *************** *** 348,352 **** imageHeight = 200.0f; imagex = float(mnWidth) - imageWidth - 10.0f; ! imagey = 10.0f; } --- 182,186 ---- imageHeight = 200.0f; imagex = float(mnWidth) - imageWidth - 10.0f; ! imagey = 25.0f; } *************** *** 394,397 **** --- 228,233 ---- } + + database::tcDatabaseObject* tcDatabaseInfoWindow::GetDatabaseObject() { *************** *** 521,524 **** --- 357,362 ---- databaseClassName = className; LoadImageList(); + + infoPanel->SetDatabaseClassName(className); } *************** *** 532,535 **** --- 370,375 ---- LoadImageList(); + + infoPanel->SetDatabaseObject(id); } *************** *** 606,609 **** --- 446,463 ---- SetActive(true); + + + int panelWidth = mnWidth - 175; + int panely = 25; + int panelHeight = mnHeight - panely - 10.0f; + + if (viewMode == EMBED) + { + panelWidth = mnWidth - 330; + } + + infoPanel = new tcDatabaseInfoPanel(this, wxPoint(10, panely), wxSize(panelWidth, panelHeight), "DBpanel", this); + + } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tc3DViewer.cpp 18 Jun 2006 00:45:00 -0000 1.35 --- tc3DViewer.cpp 17 Aug 2006 01:28:04 -0000 1.36 *************** *** 40,43 **** --- 40,44 ---- #include <osg/PolygonMode> #include <osg/PositionAttitudeTransform> + #include <osg/Stencil> #include <osgDB/Registry> #include <osgDB/ReadFile> *************** *** 49,52 **** --- 50,54 ---- #include <osgUtil/SceneView> #include <osgUtil/UpdateVisitor> + #include <osgUtil/DisplayRequirementsVisitor> //#include <osgAL/SoundNode> *************** *** 451,455 **** if (modeCode == 1) { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT); } else if (modeCode == 2) --- 453,457 ---- if (modeCode == 1) { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } else if (modeCode == 2) *************** *** 457,465 **** if (useFarSceneView) { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT); } else { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); } } --- 459,467 ---- if (useFarSceneView) { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } else { ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } } *************** *** 474,482 **** if (modeCode == 1) { ! stageFar->setClearMask(GL_DEPTH_BUFFER_BIT); } else if (modeCode == 2) { ! stageFar->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); } else --- 476,484 ---- if (modeCode == 1) { ! stageFar->setClearMask(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } else if (modeCode == 2) { ! stageFar->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } else *************** *** 860,863 **** --- 862,867 ---- } + + terrainManager = new tc3DTerrain(); osg::ref_ptr<osg::Node> terrainNode = terrainManager->GetTerrainNode().get(); *************** *** 988,992 **** } ! //guiView->update(); // necessary? guiView->cull(); guiView->draw(); --- 992,996 ---- } ! guiView->update(); // necessary? guiView->cull(); guiView->draw(); *************** *** 1439,1442 **** --- 1443,1448 ---- displaySettings = new osg::DisplaySettings; displaySettings->setDepthBuffer(true); + displaySettings->setMinimumNumStencilBits(8); + displaySettings->setDoubleBuffer(true); } *************** *** 1478,1487 **** wxASSERT(guiView->getDisplaySettings()==NULL); - displaySettings = new osg::DisplaySettings; - displaySettings->setDepthBuffer(false); ! guiView->setDisplaySettings(displaySettings.get()); guiView->setDefaults(); ! guiView->setState(sceneView->getState()); //guiView->getState()->setContextID(0); --- 1484,1498 ---- wxASSERT(guiView->getDisplaySettings()==NULL); ! osg::DisplaySettings* guiDisplaySettings = new osg::DisplaySettings; ! guiDisplaySettings->setDepthBuffer(false); ! guiDisplaySettings->setMinimumNumStencilBits(8); ! guiDisplaySettings->setDoubleBuffer(true); ! ! ! ! guiView->setDisplaySettings(guiDisplaySettings); guiView->setDefaults(); ! //guiView->setState(sceneView->getState()); //guiView->getState()->setContextID(0); *************** *** 1503,1507 **** // set up the clear mask. osgUtil::RenderStage *stage = guiView->getRenderStage(); ! stage->setClearMask(0); guiFrameStamp = new osg::FrameStamp; --- 1514,1518 ---- // set up the clear mask. osgUtil::RenderStage *stage = guiView->getRenderStage(); ! stage->setClearMask(GL_STENCIL_BUFFER_BIT); guiFrameStamp = new osg::FrameStamp; *************** *** 1531,1536 **** --- 1542,1549 ---- wxASSERT(sceneView->getDisplaySettings()==NULL); + displaySettings = new osg::DisplaySettings; displaySettings->setDepthBuffer(true); + displaySettings->setMinimumNumStencilBits(8); // displaySettings->setRGB(true); *************** *** 1542,1545 **** --- 1555,1565 ---- sceneView->getState()->setContextID(0); + + osg::StateSet* stateSet = sceneView->getGlobalStateSet(); + + //stateSet->setMode(GL_STENCIL_TEST, osg::StateAttribute::ON); + + + wxWindow *parent = wxWindow::GetParent(); wxSize parentSize = parent->GetSize(); *************** *** 1577,1581 **** stage->setClearDepth(1.0f); //stage->setClearColor(osg::Vec4(0,0,0,1.0f)); ! stage->setClearMask(GL_DEPTH_BUFFER_BIT); frameStamp = new osg::FrameStamp; --- 1597,1601 ---- stage->setClearDepth(1.0f); //stage->setClearColor(osg::Vec4(0,0,0,1.0f)); ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); frameStamp = new osg::FrameStamp; *************** *** 1603,1606 **** --- 1623,1627 ---- displaySettings = new osg::DisplaySettings; displaySettings->setDepthBuffer(true); + displaySettings->setMinimumNumStencilBits(8); } *************** *** 1611,1615 **** sceneViewFar->setDisplaySettings(displaySettings.get()); sceneViewFar->setDefaults(); ! sceneViewFar->setState(sceneView->getState()); //sceneViewFar->getState()->setContextID(0); --- 1632,1636 ---- sceneViewFar->setDisplaySettings(displaySettings.get()); sceneViewFar->setDefaults(); ! //sceneViewFar->setState(sceneView->getState()); //sceneViewFar->getState()->setContextID(0); *************** *** 1646,1650 **** // set up the clear mask. osgUtil::RenderStage *stage = sceneViewFar->getRenderStage(); ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); stage->setClearDepth(1.0f); stage->setClearColor(osg::Vec4(0,0,0,1.0f)); --- 1667,1671 ---- // set up the clear mask. osgUtil::RenderStage *stage = sceneViewFar->getRenderStage(); ! stage->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); stage->setClearDepth(1.0f); stage->setClearColor(osg::Vec4(0,0,0,1.0f)); *************** *** 1669,1684 **** globalStateSet = new osg::StateSet; sceneView->setGlobalStateSet(globalStateSet); } { ! #if 1 //globalStateSet->setGlobalDefaults(); // enable depth testing by default. osg::Depth* depth = new osg::Depth(osg::Depth::LESS, 0, 1); globalStateSet->setAttributeAndModes(depth, osg::StateAttribute::ON ); //globalStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON); ! #endif osg::PolygonMode *pm = new osg::PolygonMode(); pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::FILL); --- 1690,1708 ---- globalStateSet = new osg::StateSet; sceneView->setGlobalStateSet(globalStateSet); + //globalStateSet->setGlobalDefaults(); } { ! #if 0 //globalStateSet->setGlobalDefaults(); // enable depth testing by default. osg::Depth* depth = new osg::Depth(osg::Depth::LESS, 0, 1); globalStateSet->setAttributeAndModes(depth, osg::StateAttribute::ON ); + + //globalStateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON); ! osg::PolygonMode *pm = new osg::PolygonMode(); pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::FILL); *************** *** 1704,1708 **** globalStateSet->setAttributeAndModes(alphafunc, osg::StateAttribute::ON); ! //globalStateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::INHERIT); //globalStateSet->setTextureMode(1, GL_TEXTURE_2D, osg::StateAttribute::INHERIT); --- 1728,1735 ---- globalStateSet->setAttributeAndModes(alphafunc, osg::StateAttribute::ON); ! ! ! ! //globalStateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::INHERIT); //globalStateSet->setTextureMode(1, GL_TEXTURE_2D, osg::StateAttribute::INHERIT); *************** *** 1710,1713 **** --- 1737,1742 ---- globalStateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::PROTECTED | osg::StateAttribute::ON); + #endif + } } *************** *** 1734,1738 **** textState->setMode(GL_FOG, osg::StateAttribute::OFF); textState->setMode(GL_DEPTH, osg::StateAttribute::OFF); ! textState->setMode(GL_BLEND, osg::StateAttribute::OFF); /* --- 1763,1768 ---- textState->setMode(GL_FOG, osg::StateAttribute::OFF); textState->setMode(GL_DEPTH, osg::StateAttribute::OFF); ! textState->setMode(GL_BLEND, osg::StateAttribute::OFF ); ! /* *************** *** 1987,1990 **** --- 2017,2021 ---- } + if (useFarSceneView) { *************** *** 2171,2175 **** // to suppress "Number display lists deleted" stdout text // doesn't work with OSG 0.9.5, should work with 0.9.6 and beyond ! osg::setNotifyLevel(osg::NOTICE); /* ALWAYS=0, --- 2202,2206 ---- // to suppress "Number display lists deleted" stdout text // doesn't work with OSG 0.9.5, should work with 0.9.6 and beyond ! osg::setNotifyLevel(osg::NOTICE); // NOTICE /* ALWAYS=0, Index: tcStoresGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStoresGui.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcStoresGui.cpp 18 Jun 2006 00:45:00 -0000 1.8 --- tcStoresGui.cpp 17 Aug 2006 01:28:04 -0000 1.9 *************** *** 104,108 **** wxString captionText = wxString::Format("%s: %s", unitName, storesDisplayName.c_str()); DrawTextR(captionText.c_str(), 10.0f, 20.0f, defaultFont.get(), ! captionColor, 18.0f, LEFT_BASE_LINE, guiWidth - 20.0f); --- 104,108 ---- wxString captionText = wxString::Format("%s: %s", unitName, storesDisplayName.c_str()); DrawTex... [truncated message content] |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:28:09
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/sim Modified Files: Game.cpp tcGameObject.cpp tcMapData.cpp tcMissileObject.cpp tcOpticalSensor.cpp tcRadar.cpp tcSensorPlatform.cpp tcStores.cpp Log Message: Update for server name change Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcMissileObject.cpp 18 Jun 2006 00:45:03 -0000 1.35 --- tcMissileObject.cpp 17 Aug 2006 01:28:05 -0000 1.36 *************** *** 584,589 **** break; case AM_AGL: ! fGoalAltitude_m = pSegmentInfo->mfAltitude_m + ! mcTerrain.mfHeight_m; break; case AM_INTERCEPT: // use seeker data or maintain altitude --- 584,591 ---- break; case AM_AGL: ! { ! float effectiveTerrainHeight_m = (mcTerrain.mfHeight_m > 0) ? mcTerrain.mfHeight_m : 0; ! fGoalAltitude_m = pSegmentInfo->mfAltitude_m + effectiveTerrainHeight_m; ! } break; case AM_INTERCEPT: // use seeker data or maintain altitude Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** Game.cpp 18 Jun 2006 00:45:01 -0000 1.157 --- Game.cpp 17 Aug 2006 01:28:05 -0000 1.158 *************** *** 107,110 **** --- 107,111 ---- EVT_COMMAND(ID_SETBRIEFING, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetBriefingMode) EVT_COMMAND(ID_MULTIPLAYERMODE, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SetMultiplayerMode) + EVT_COMMAND(ID_REFRESHMAPS, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::RefreshMaps) EVT_COMMAND(ID_SETPAUSE, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetPauseMode) EVT_COMMAND(ID_SETTIMEACCEL, wxEVT_COMMAND_BUTTON_CLICKED, tcGame::SetTimeAccel) *************** *** 327,330 **** --- 328,353 ---- /** + * If game mode is GM_START do nothing, since map isn't instantiated. Otherwise + * reload the high resolution map with the new color mode. + */ + void tcGame::RefreshMaps() + { + if (meGameMode == GM_START) return; + + if (tacticalMap == 0) + { + wxASSERT(false); + return; + } + + tacticalMap->Refresh(); + } + + void tcGame::RefreshMaps(wxCommandEvent& event) + { + RefreshMaps(); + } + + /** * Skips to the end of the briefing and starts game */ *************** *** 759,763 **** startView->AttachOptions(tcOptions::Get()); ! startView->LoadBackgroundImage("start_background.jpg"); if (startView->Init() == false) --- 782,786 ---- startView->AttachOptions(tcOptions::Get()); ! startView->LoadBackgroundImage("start_background_dev.jpg"); if (startView->Init() == false) *************** *** 1534,1541 **** break; case DATABASEVIEW: - databaseViewer->SetActive(true); - databaseViewer->Draw(); viewer->SetActive(true); viewer->SetDatabaseView(true); if (lastMode != DATABASEVIEW) { --- 1557,1566 ---- break; case DATABASEVIEW: viewer->SetActive(true); viewer->SetDatabaseView(true); + databaseViewer->SetActive(true); + databaseViewer->Raise(); + databaseViewer->Draw(); + if (lastMode != DATABASEVIEW) { *************** *** 1815,1818 **** --- 1840,1844 ---- viewer->SetDatabaseView(true); viewer->SetActive(true); + databaseViewer->Raise(); if (lastMode != DATABASEVIEW) { *************** *** 2364,2377 **** if (objectControl) objectControl->SetHookID(hookID); viewer->SetHookID(hookID); if (hookID != NULL_INDEX) { tcSound::Get()->PlayEffect("ShortBeep"); - pythonInterface->SetMenuPlatform(hookID); } - tcGameObject::SetHookedId(hookID); - hookedUnits.clear(); - hookedUnits.push_back(hookID); } --- 2390,2404 ---- if (objectControl) objectControl->SetHookID(hookID); viewer->SetHookID(hookID); + pythonInterface->SetMenuPlatform(hookID); + tcGameObject::SetHookedId(hookID); + + hookedUnits.clear(); + hookedUnits.push_back(hookID); if (hookID != NULL_INDEX) { tcSound::Get()->PlayEffect("ShortBeep"); } } *************** *** 2823,2826 **** --- 2850,2868 ---- } } + else if (s == "CopperMap") + { + tcOptions::Get()->mnMapMode = 0; + RefreshMaps(); + } + else if (s == "YellowBlueMap") + { + tcOptions::Get()->mnMapMode = 1; + RefreshMaps(); + } + else if (s == "BlackBlueMap") + { + tcOptions::Get()->mnMapMode = 2; + RefreshMaps(); + } } *************** *** 2884,2888 **** commandQueue = tcCommandQueue::Get(); ! glCanvas = new wxGLCanvas(this, -1, wxPoint(0,0), size, 0, "GLCanvas", 0, wxNullPalette); glCanvas->SetBackgroundColour(*wxBLACK); --- 2926,2944 ---- commandQueue = tcCommandQueue::Get(); ! ! int attribList[15]; ! attribList[0] = WX_GL_RGBA; ! attribList[1] = 1; ! attribList[2] = WX_GL_DEPTH_SIZE; ! attribList[3] = 16; ! attribList[4] = WX_GL_MIN_ALPHA; ! attribList[5] = 8; ! attribList[6] = WX_GL_STENCIL_SIZE; ! attribList[7] = 8; ! attribList[8] = WX_GL_DOUBLEBUFFER; ! attribList[9] = 1; ! attribList[10] = 0; ! ! glCanvas = new wxGLCanvas(this, -1, wxPoint(0,0), size, 0, "GLCanvas", attribList, wxNullPalette); glCanvas->SetBackgroundColour(*wxBLACK); Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tcRadar.cpp 18 Jun 2006 00:45:03 -0000 1.38 --- tcRadar.cpp 17 Aug 2006 01:28:05 -0000 1.39 *************** *** 226,229 **** --- 226,230 ---- bool isGround = false; float rcs_dBsm; + float targetHeight_m = target->mcKin.mfAlt_m; // equivalent height of target for radar horizon // Need more efficient implementation here, gotta be a better way to do this! *************** *** 232,235 **** --- 233,237 ---- rcs_dBsm = surfaceObj->mpDBObject->mfRcs_dbsm; isSurface = true; + targetHeight_m = 0.5f * surfaceObj->GetZmaxConst(); // use half max for equivalent radar height } else if (const tcAirObject* airObj = dynamic_cast<const tcAirObject*>(target)) *************** *** 262,265 **** --- 264,268 ---- rcs_dBsm = sub->mpDBObject->mfRcs_dbsm; isSurface = true; + targetHeight_m += 2.0f + 0.4f * surfaceObj->GetZmaxConst(); } else *************** *** 294,300 **** } ! float fRadarHorizon = C_RADARHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m + mfSensorHeight_m)); fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); range_km = fTargetRange_km; last_range_km = range_km; --- 297,304 ---- } ! float fRadarHorizon = C_RADARHOR*(sqrtf(targetHeight_m) +sqrtf(rdr_kin->mfAlt_m + mfSensorHeight_m)); ! fTargetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad,tgt_kin->mfLon_rad, rdr_kin->mfAlt_m, tgt_kin->mfAlt_m); range_km = fTargetRange_km; last_range_km = range_km; Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** tcGameObject.cpp 18 Jun 2006 00:45:02 -0000 1.45 --- tcGameObject.cpp 17 Aug 2006 01:28:05 -0000 1.46 *************** *** 499,502 **** --- 499,521 ---- /** + * @return the maximum vertical coordinate of the 3D model for this object + * Useful for estimating radar antenna height and effective height for radar horizon + */ + float tcGameObject::GetZmax() + { + return model->GetBoundingBox().zMax(); + } + + /** + * @return the maximum vertical coordinate of the 3D model for this object + * Useful for estimating radar antenna height and effective height for radar horizon + * Workaround for const-ness requirements + */ + float tcGameObject::GetZmaxConst() const + { + return model->GetBoundingBoxConst().zMax(); + } + + /** * Linear search to verify child */ Index: tcOpticalSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcOpticalSensor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcOpticalSensor.cpp 26 Mar 2006 00:32:15 -0000 1.11 --- tcOpticalSensor.cpp 17 Aug 2006 01:28:05 -0000 1.12 *************** *** 129,133 **** float horizonRange_km = C_VISUALHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m)); targetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad,tgt_kin->mfLon_rad); range_km = targetRange_km; if ((targetRange_km > horizonRange_km) || (targetRange_km > mpDBObj->mfMaxRange_km)) --- 129,133 ---- float horizonRange_km = C_VISUALHOR*(sqrtf(tgt_kin->mfAlt_m) +sqrtf(rdr_kin->mfAlt_m)); targetRange_km = C_RADTOKM*nsNav::GCDistanceApprox_rad(rdr_kin->mfLat_rad, rdr_kin->mfLon_rad, ! tgt_kin->mfLat_rad,tgt_kin->mfLon_rad, rdr_kin->mfAlt_m, tgt_kin->mfAlt_m); range_km = targetRange_km; if ((targetRange_km > horizonRange_km) || (targetRange_km > mpDBObj->mfMaxRange_km)) Index: tcSensorPlatform.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorPlatform.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcSensorPlatform.cpp 18 Jun 2006 00:45:03 -0000 1.12 --- tcSensorPlatform.cpp 17 Aug 2006 01:28:05 -0000 1.13 *************** *** 417,421 **** wxASSERT(sensor); ! sensor->mfSensorHeight_m = 0.1f * parent->GetSpan(); //< guess sensor height is 10% of length sensor->SetMountAz(0); sensorState.push_back(sensor); --- 417,421 ---- wxASSERT(sensor); ! sensor->mfSensorHeight_m = 0.8f * parent->GetZmax(); //< guess sensor height is 80% of zmax sensor->SetMountAz(0); sensorState.push_back(sensor); Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcMapData.cpp 18 Jun 2006 00:45:03 -0000 1.27 --- tcMapData.cpp 17 Aug 2006 01:28:05 -0000 1.28 *************** *** 1006,1012 **** } /** ! * use anMapID = 0 for low res, 1 for high res ! * TODO: fix */ void tcMapData::CreateMapImage(int anMode, int anMapID, UINT32 *apData) --- 1006,1085 ---- } + + UINT32 tcMapData::BlackBlueMap(long pval) const + { + bool subZero = (pval < 0); + bool missingData = pval == MISSING_DATA_VAL; + + + if (subZero && (!missingData)) + { + return 0xFFBF2010; + } + else if (subZero && missingData) + { + return 0xFF000040; // set missing data to red + } + else + { + return 0xFF000000; + } + } + + UINT32 tcMapData::CopperBlueMap(long pval) const + { + if (pval > 1000) pval = 1000; + + if (pval <= 0) + { + if (pval != MISSING_DATA_VAL) + { + return 0xFF700000; + } + else + { + return 0xFF000000; + } + } + else + { + pval = pval/20; + if (pval > 115) + { + pval = 115; + } + return 0x010102*pval + 0xFF252515; + } + } + + UINT32 tcMapData::YellowBlueMap(long pval) const + { + int nPaletteIndex = (pval/10) + 100; + + if (nPaletteIndex > 247) // TODO bug here that needs fixing, higher values distort on texture + { + nPaletteIndex = 247; + } + else if (nPaletteIndex < 0) + { + nPaletteIndex = 0; + } + + if (pval != MISSING_DATA_VAL) + { + return maPalette1[nPaletteIndex]; + } + else + { + return 0xFF000000; + } + } + + + + + /** ! * Use anMapID = 0 for low res, 1 for high res */ void tcMapData::CreateMapImage(int anMode, int anMapID, UINT32 *apData) *************** *** 1027,1137 **** } ! if (apData == NULL) {return;} ! ! // create map image using map data ! switch (anMode) { ! case 0: ! for(m=0;m<M;m++) ! { ! for(n=0;n<N;n++) ! { ! pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; ! if (pval > 1000) pval = 1000; ! if (pval <= 0) ! { ! if (pval == MISSING_DATA_VAL) ! { ! pval = 0x000000; ! } ! else ! { ! pval = 0x700000; ! } ! } ! else ! { ! pval = pval/20; ! if (pval > 115) ! { ! pval = 115; ! } ! pval = 0x010102*pval + 0x252515; ! } ! apData[(M-1-m)*N + n] = pval + nAlphaOffset; ! } ! } ! break; ! case 1: ! int nPaletteIndex; ! for(m=0;m<M;m++) { ! for(n=0;n<N;n++) { ! pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; // TODO: move out of loop somehow ! nPaletteIndex = (pval/10) + 100; ! if (nPaletteIndex > 247) // TODO bug here that needs fixing, higher values distort on texture ! { ! nPaletteIndex = 247; ! } ! else if (nPaletteIndex < 0) ! { ! nPaletteIndex = 0; ! } ! ! if (pval == MISSING_DATA_VAL) ! { ! apData[(M-1-m)*N + n] = 0x00000000 + nAlphaOffset; ! } ! else ! { ! pval = maPalette1[nPaletteIndex]; ! apData[(M-1-m)*N + n] = (0x00FFFFFF & pval) + nAlphaOffset; ! } ! //apWindow->SetPixel(n,M-1-m,pval + nAlphaOffset); } } ! break; ! case 2: ! for(m=0;m<M;m++) { ! for(n=0;n<N;n++) { ! pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; ! if (pval < 0) ! { ! if (pval == MISSING_DATA_VAL) // set missing data to red ! { ! apData[(M-1-m)*N + n] = 0x00000040 + nAlphaOffset; ! } ! else ! { ! apData[(M-1-m)*N + n] = 0x00BF2010 + nAlphaOffset; ! } ! } ! else ! { ! apData[(M-1-m)*N + n] = 0x00000000 + nAlphaOffset; ! //apWindow->SetPixel(n,M-1-m,0x00000000 + nAlphaOffset); ! } } } - break; - default: - break; } - /* - // draw longitude and latitude points for debug - for(m=0;m<M;m+=(M/18)) { - for(n=0;n<N;n+=(N/36)) { - apWindow->SetPixel(n,m,pval + 0xFE00FF00); - } - } - */ // for low res map, darken the unavailable tiles if (anMapID == 0) --- 1100,1147 ---- } ! if (apData == NULL) return; ! UINT32 (tcMapData::*MapOperator)(long) const = 0; ! switch (anMode) { ! case 0: MapOperator = &tcMapData::CopperBlueMap; break; ! case 1: MapOperator = &tcMapData::YellowBlueMap; break; ! case 2: MapOperator = &tcMapData::BlackBlueMap; break; ! default: ! wxASSERT(false); ! fprintf(stderr, "tcMapData::CreateMapImage -- bad mode (%d)\n", anMode); ! return; ! } ! ! // create map image using map data ! if (anMapID == 0) // global map ! { ! for(m=0; m<M; m++) { ! size_t rowIndex = (M-1-m)*N; ! for(n=0; n<N; n++) { ! pval = maGlobal[m][n]; ! apData[rowIndex + n] = (this->*MapOperator)(pval); } } ! } ! else // theater map ! { ! for(m=0; m<M; m++) { ! size_t rowIndex = (M-1-m)*N; ! for(n=0; n<N; n++) { ! pval = maTheater[m][n]; ! ! apData[rowIndex + n] = (this->*MapOperator)(pval); } } } // for low res map, darken the unavailable tiles if (anMapID == 0) *************** *** 1140,1144 **** } ! //LabelLowRes(); // TODO: add country and geopol labels fprintf(stdout, "tcMapData - CreateMapImage - success\n"); --- 1150,1154 ---- } ! //LabelLowRes(); // TODO: add country and geopol labels fprintf(stdout, "tcMapData - CreateMapImage - success\n"); Index: tcStores.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStores.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcStores.cpp 18 Jun 2006 00:45:04 -0000 1.10 --- tcStores.cpp 17 Aug 2006 01:28:05 -0000 1.11 *************** *** 815,819 **** } ! long fuelNeeded_kg = long(platform->mpDBObject->mfFuelCapacity_kg - platform->fuel_kg); if (fuelNeeded_kg <= 0) --- 815,819 ---- } ! long fuelNeeded_kg = long(ceilf((platform->mpDBObject->mfFuelCapacity_kg - platform->fuel_kg))); if (fuelNeeded_kg <= 0) |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:28:08
|
Update of /cvsroot/gcblue/gcb_wx/src/sqlite In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/sqlite Modified Files: sqlite3x_reader.cpp Log Message: Update for server name change Index: sqlite3x_reader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sqlite/sqlite3x_reader.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sqlite3x_reader.cpp 23 Mar 2006 01:11:02 -0000 1.2 --- sqlite3x_reader.cpp 17 Aug 2006 01:28:05 -0000 1.3 *************** *** 55,58 **** --- 55,60 ---- if(!this->cmd) throw database_error("reader is closed"); + isStringError = false; // modified code DDC, reset string error after each call read() + switch(sqlite3_step(this->cmd->stmt)) { case SQLITE_ROW: *************** *** 109,113 **** if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); ! const char* s = (const char*)sqlite3_column_text(this->cmd->stmt, index); //, sqlite3_column_bytes(this->cmd->stmt, index)); if (s != 0) --- 111,115 ---- if(!this->cmd) throw database_error("reader is closed"); if((index)>(this->cmd->argc-1)) throw std::out_of_range("index out of range"); ! const char* s = (const char*)sqlite3_column_text(this->cmd->stmt, index); //, sqlite3_column_bytes(this->cmd->stmt, index)); if (s != 0) *************** *** 115,125 **** return std::string(s); } ! else { ! fprintf(stderr, "(Known bug)sqlite3_reader::getstring -- Bad column index (%d)\n", index); return std::string(""); } } std::wstring sqlite3_reader::getstring16(int index) { if(!this->cmd) throw database_error("reader is closed"); --- 117,138 ---- return std::string(s); } ! else // modified code DDC { ! #ifdef _DEBUG ! isStringError = true; ! fprintf(stderr, "sqlite3_reader::getstring -- Null string for column index (%d). Should be benign\n", index); ! #endif return std::string(""); } } + /** + * New code DDC + */ + bool sqlite3_reader::getStringError() const + { + return isStringError; + } + std::wstring sqlite3_reader::getstring16(int index) { if(!this->cmd) throw database_error("reader is closed"); |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:28:07
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/scriptinterface Modified Files: tcFlightPortInterface.cpp tcPlatformInterface.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp Log Message: Update for server name change Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tcScenarioInterface.cpp 18 Jun 2006 00:45:01 -0000 1.42 --- tcScenarioInterface.cpp 17 Aug 2006 01:28:04 -0000 1.43 *************** *** 1050,1054 **** { simState->Clear(); ! database::tcDatabase::Get()->Clear(); } --- 1050,1054 ---- { simState->Clear(); ! database::tcDatabase::Get()->SerializeSql("", true); // reload default database } Index: tcFlightPortInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcFlightPortInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcFlightPortInterface.cpp 18 Jun 2006 00:45:01 -0000 1.10 --- tcFlightPortInterface.cpp 17 Aug 2006 01:28:04 -0000 1.11 *************** *** 31,34 **** --- 31,35 ---- #include <string> #include "tcFlightPortInterface.h" + #include "tcPlatformInterface.h" #include "tcSimState.h" #include "simmath.h" *************** *** 64,67 **** --- 65,69 ---- .def("GetUnitLocation", &tcFlightPortInterface::GetUnitLocation) .def("GetUnitGoalLocation", &tcFlightPortInterface::GetUnitGoalLocation) + .def("GetUnitPlatformInterface", &tcFlightPortInterface::GetUnitPlatformInterface) .def("IsValid", &tcFlightPortInterface::IsValid) .def("Launch", &tcFlightPortInterface::Launch) *************** *** 154,157 **** --- 156,169 ---- } + tcPlatformInterface tcFlightPortInterface::GetUnitPlatformInterface(int n) + { + if ((n<0)||(n>=(int)flightport->units.size())) return tcPlatformInterface(0); + + tcAirState* airstate = flightport->units[n]; + wxASSERT(airstate != 0); + tcPlatformObject *obj = dynamic_cast<tcPlatformObject*>(airstate->obj); + return tcPlatformInterface(obj); + } + bool tcFlightPortInterface::IsValid() { Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** tcPlatformInterface.cpp 18 Jun 2006 00:45:01 -0000 1.61 --- tcPlatformInterface.cpp 17 Aug 2006 01:28:04 -0000 1.62 *************** *** 721,725 **** * */ ! void tcPlatformInterface::LoadLauncher(int anLauncher, std::string item) { if (!mpPlatformObj->IsControlled()) return; --- 721,725 ---- * */ ! void tcPlatformInterface::LoadLauncher(int anLauncher, const std::string& item) { if (!mpPlatformObj->IsControlled()) return; *************** *** 748,751 **** --- 748,788 ---- } + + void tcPlatformInterface::LoadOther(const std::string& item) + { + if (!mpPlatformObj->IsControlled()) return; + + size_t nMagazines = mpPlatformObj->GetMagazineCount(); + for (size_t n=0; n<nMagazines; n++) + { + tcStores* mag = mpPlatformObj->GetMagazine(n); + if (mag->CurrentItemQuantity(item)) + { + mag->LoadOther(item, mpPlatformObj); + return; + } + } + + if (tcPlatformObject* parent = dynamic_cast<tcPlatformObject*>(mpPlatformObj->parent)) + { + size_t nMagazines = parent->GetMagazineCount(); + for (size_t n=0; n<nMagazines; n++) + { + tcStores* mag = parent->GetMagazine(n); + if (mag->CurrentItemQuantity(item)) + { + mag->LoadOther(item, mpPlatformObj); + return; + } + } + } + } + + + bool tcPlatformInterface::IsRefueling() const + { + return mpPlatformObj->IsRefueling(); + } + /** * *************** *** 1603,1608 **** } ! mpSensorMap = mpSimState->mcSensorMap.GetMap(mpPlatformObj->GetAlliance()); ! wxASSERT(mpSensorMap); } --- 1640,1645 ---- } ! mpSensorMap = (mpPlatformObj != 0) ? mpSimState->mcSensorMap.GetMap(mpPlatformObj->GetAlliance()) : 0; ! } Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tcPlatformInterfaceExtensionB.cpp 18 Jun 2006 00:45:01 -0000 1.31 --- tcPlatformInterfaceExtensionB.cpp 17 Aug 2006 01:28:04 -0000 1.32 *************** *** 37,40 **** --- 37,41 ---- #include "tcSoundConsole.h" #include "ai/BlackboardInterface.h" + #include "tcFlightPortInterface.h" #ifdef _DEBUG *************** *** 106,110 **** .def("LoadLauncher", &tcPlatformInterface::LoadLauncher) .def("UnloadLauncher", &tcPlatformInterface::UnloadLauncher) ! // task interface commands --- 107,112 ---- .def("LoadLauncher", &tcPlatformInterface::LoadLauncher) .def("UnloadLauncher", &tcPlatformInterface::UnloadLauncher) ! .def("LoadOther", &tcPlatformInterface::LoadOther) ! .def("IsRefueling", &tcPlatformInterface::IsRefueling) // task interface commands *************** *** 142,145 **** --- 144,148 ---- .def("SetLandingState",&tcPlatformInterface::SetLandingState) .def("HasFlightPort",&tcPlatformInterface::HasFlightPort) + .def("GetFlightPortInfo",&tcPlatformInterface::GetFlightPortInfo) .def("GetLandingData", &tcPlatformInterface::GetLandingData) .def("GetUserInput",&tcPlatformInterface::GetUserInput) |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:28:07
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/database Modified Files: tcDatabase.cpp tcDatabaseObject.cpp tcMissileDBObject.cpp tcSqlReader.cpp Log Message: Update for server name change Index: tcMissileDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcMissileDBObject.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMissileDBObject.cpp 18 Jun 2006 00:45:00 -0000 1.23 --- tcMissileDBObject.cpp 17 Aug 2006 01:28:03 -0000 1.24 *************** *** 115,123 **** bool tcMissileDBObject::HasAllEmitters(std::vector<long>& emitters) { ! unsigned int nEmitters = emitters.size(); long seekerKey = GetSensorKey(); ! for (unsigned int k=0; k<nEmitters; k++) { long emitterId = emitters[k]; --- 115,123 ---- bool tcMissileDBObject::HasAllEmitters(std::vector<long>& emitters) { ! size_t nEmitters = emitters.size(); long seekerKey = GetSensorKey(); ! for (size_t k=0; k<nEmitters; k++) { long emitterId = emitters[k]; Index: tcDatabaseObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabaseObject.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcDatabaseObject.cpp 18 Jun 2006 00:44:59 -0000 1.22 --- tcDatabaseObject.cpp 17 Aug 2006 01:28:03 -0000 1.23 *************** *** 219,222 **** --- 219,227 ---- } + const char* tcDatabaseObject::GetName() const + { + return mzClass.c_str(); + } + /** * @return string array with parsed filenames of images for this db object *************** *** 421,425 **** strncpy(mzDescription, desc.c_str(),DESCRIPTION_STRING_LENGTH-1); ! //Load3DModel(); // do lazy load instead } --- 426,436 ---- strncpy(mzDescription, desc.c_str(),DESCRIPTION_STRING_LENGTH-1); ! #ifdef _DEBUG ! if (entry.GetStringError()) ! { ! fprintf(stderr, "tcDatabaseObject::ReadSql - warning: null string occurred in entry: %s\n", ! mzClass.c_str()); ! } ! #endif } Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** tcDatabase.cpp 18 Jun 2006 00:44:59 -0000 1.35 --- tcDatabase.cpp 17 Aug 2006 01:28:03 -0000 1.36 *************** *** 383,389 **** --- 383,401 ---- void tcDatabase::SerializeSql(const std::string& suffix, bool load) { + if (load) // start fresh when Serialize called, unlike UpdateSql that updates + { + ClearDictionaries(); + Clear(); + } + std::string path(DATABASE_PATH); std::string fileName = path + string("database") + suffix + ".db"; + if (load) + { + fprintf(stdout, "Loading default database %s (previous entries cleared)\n", + fileName.c_str()); + } + ReadWriteSql(fileName, load); } *************** *** 398,402 **** void tcDatabase::UpdateSql(const std::string& fileName) { ! ClearDictionaries(); ReadWriteSql(fileName, true); // true to load --- 410,416 ---- void tcDatabase::UpdateSql(const std::string& fileName) { ! fprintf(stdout, "Updating database with %s\n", ! fileName.c_str()); ! ReadWriteSql(fileName, true); // true to load *************** *** 583,587 **** } ! void tcDatabase::Clear() { mcObjectData.RemoveAll(); } --- 597,602 ---- } ! void tcDatabase::Clear() ! { mcObjectData.RemoveAll(); } *************** *** 707,715 **** { wxASSERT(false); ! fprintf(stderr, "Error - tcDatabase::DeleteObject - Obj doesn't exist"); return 0; } ! std::string className(obj->GetClassName()); std::map<std::string, long>::iterator mapIter = nameToKey.find(className); --- 722,731 ---- { wxASSERT(false); ! fprintf(stderr, "Error - tcDatabase::DeleteObject - Obj doesn't exist (key %d)\n", ! anKey); return 0; } ! std::string className(obj->GetName()); std::map<std::string, long>::iterator mapIter = nameToKey.find(className); *************** *** 982,987 **** if (mapIter == nameToKey.end()) { fprintf(stderr, "Error - tcDatabase::GetObject - not found in nameToKey (%s)\n", ! className.c_str()); return 0; } --- 998,1009 ---- if (mapIter == nameToKey.end()) { + std::string missingClass = className.c_str(); + if (missingClass.size() == 0) + { + missingClass = "Empty string"; + } + fprintf(stderr, "Error - tcDatabase::GetObject - not found in nameToKey (%s)\n", ! missingClass.c_str()); return 0; } Index: tcSqlReader.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcSqlReader.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcSqlReader.cpp 23 Mar 2006 01:11:02 -0000 1.7 --- tcSqlReader.cpp 17 Aug 2006 01:28:03 -0000 1.8 *************** *** 151,156 **** --- 151,163 ---- + bool tcSqlReader::GetStringError() const + { + return data.getStringError(); + } + unsigned int tcSqlReader::LookupFieldIndex(const std::string& field) { + static std::string errorMessage; + std::map<std::string, unsigned int>::const_iterator mapIter; *************** *** 158,162 **** if (mapIter == columnLookup.end()) { ! throw std::invalid_argument("tcSqlReader - field not found"); } else --- 165,170 ---- if (mapIter == columnLookup.end()) { ! errorMessage = wxString::Format("tcSqlReader - field not found (%s)", field.c_str()).c_str(); ! throw std::invalid_argument(errorMessage); } else |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:28:07
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21820/src/common Modified Files: AError.cpp nsNav.cpp tcOptionsView.cpp Log Message: Update for server name change Index: tcOptionsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOptionsView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcOptionsView.cpp 28 Mar 2006 23:58:12 -0000 1.16 --- tcOptionsView.cpp 17 Aug 2006 01:28:03 -0000 1.17 *************** *** 162,165 **** --- 162,167 ---- } + int startMapMode = mpOptions->mnMapMode; + // TranslatePoint(point); // adjust for flipped up/down bButtonClicked = ButtonContainingPoint(event.GetPosition(), nOption, nValue); *************** *** 191,194 **** --- 193,204 ---- } + if (mpOptions->mnMapMode != startMapMode) + { + wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_REFRESHMAPS); + command.SetEventObject(this); + + AddPendingEvent(command); + } + } /******************************************************************************/ Index: AError.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/AError.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AError.cpp 23 Mar 2006 01:11:01 -0000 1.9 --- AError.cpp 17 Aug 2006 01:28:03 -0000 1.10 *************** *** 30,33 **** --- 30,34 ---- #include <stdio.h> #include <string.h> + #include <wx/string.h> *************** *** 79,84 **** if (logfile==NULL) { logfile = fopen("log\\log.txt","wt"); ! if (logfile==NULL) { ! wxMkdir(L"log"); logfile = fopen("log\\log.txt","wt"); if (logfile==NULL) { --- 80,86 ---- if (logfile==NULL) { logfile = fopen("log\\log.txt","wt"); ! if (logfile==NULL) ! { // create directory and try again ! wxMkdir("log"); // wxMkdir(L"log") caused link errors on laptop !? logfile = fopen("log\\log.txt","wt"); if (logfile==NULL) { *************** *** 99,102 **** --- 101,105 ---- return; + } Index: nsNav.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/nsNav.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nsNav.cpp 4 May 2006 22:47:26 -0000 1.10 --- nsNav.cpp 17 Aug 2006 01:28:03 -0000 1.11 *************** *** 97,101 **** float fDeltaLat = afLatA_rad - afLatB_rad; float fDeltaLon = afLonA_rad - afLonB_rad; ! float fDeltaAlt = 0.001f*C_KMTORAD*(afAltA_m - afAltB_m); if (fDeltaLon > C_PI) {fDeltaLon -= C_TWOPI;} else if (fDeltaLon < -C_PI) {fDeltaLon += C_TWOPI;} --- 97,101 ---- float fDeltaLat = afLatA_rad - afLatB_rad; float fDeltaLon = afLonA_rad - afLonB_rad; ! float fDeltaAlt = C_MTORAD*(afAltA_m - afAltB_m); if (fDeltaLon > C_PI) {fDeltaLon -= C_TWOPI;} else if (fDeltaLon < -C_PI) {fDeltaLon += C_TWOPI;} |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:27:14
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21395/include/graphics Modified Files: tc3DModel.h tc3DWindow.h tcDatabaseInfoWindow.h tcDatabaseViewer.h tcMapObject.h tcMapOverlay.h tcMapView.h Added Files: tcBoundingBoxVisitor.h tcDatabaseBrowsePanel.h tcDatabaseInfoPanel.h tcScrollBar.h Log Message: Update for server name change --- NEW FILE: tcDatabaseBrowsePanel.h --- /** ** @file tcDatabaseBrowsePanel.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 _DATABASEBROWSEPANEL_H_ #define _DATABASEBROWSEPANEL_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tc3DWindow.h" namespace osg { class Texture2D; } class tcScrollBar; /** * Class to browse database platform list */ class tcDatabaseBrowsePanel : public tc3DWindow { struct BrowseItem { std::string className; ///< dir name or filename without the .py extension struct { float x; float y; float width; float height; } drawBox; ///< location to draw to screen osg::Vec4 color; enum {OFF = 0, OVER = 1, ON = 2} drawState; }; public: void Draw(); void OnEnterWindow(wxMouseEvent& event); void OnLButtonDown(wxMouseEvent& event); void OnLeaveWindow(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); void OnScrollbarUpdated(wxCommandEvent& event); const std::string& GetDisplayClass() const; void SelectDisplayClass(const std::string& className); void SetClassificationMask(unsigned int mask); void Set3DViewer(tc3DViewer* viewer_); tcDatabaseBrowsePanel(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxString& name="BrowsePanel", tc3DWindow* graphicsHost=0); virtual ~tcDatabaseBrowsePanel(); private: unsigned int classificationMask; ///< mask for current platform type on browse list std::string displayClassName; ///< class name of current platform displayed std::vector<BrowseItem> browseInfo; wxPoint mousePosition; bool mouseOver; tcScrollBar* scrollBar; float yOffset; void BuildBrowseInfo(); void ClearMouseOver(); bool ProcessMouseClick(const wxPoint& pos); void UpdateDrawInfo(); DECLARE_EVENT_TABLE() }; #endif --- NEW FILE: tcDatabaseInfoPanel.h --- /** ** @file tcDatabaseInfoPanel.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 _tcDatabaseInfoPanel_H_ #define _tcDatabaseInfoPanel_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tc3DWindow.h" #include <stdarg.h> namespace database { class tcDatabaseObject; class tcGenericDBObject; class tcMissileDBObject; class tcTorpedoDBObject; } class tcScrollBar; /** * Window class for subpanel for display info for database object */ class tcDatabaseInfoPanel : public tc3DWindow { public: virtual void Draw(); /// set database class name to display info for void SetDatabaseClassName(const std::string& className); /// set id of game object to display info for (must be classified if track) void SetDatabaseObject(long id); void SetViewMode(int mode); tcDatabaseInfoPanel(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxString& name = "DBpanel", tc3DWindow* graphicsHost = 0); virtual ~tcDatabaseInfoPanel(); private: enum ViewMode { POPUP = 0, ///< compact view for popups EMBED = 1 ///< mode for database viewer screen } viewMode; ///< mode automatically selected based on hostParent argument to constructor long objId; ///< id of obj or track to display info for std::string databaseClassName; ///< class name of database object, empty if not looked up yet tcScrollBar* scrollBar; float yOffset; ///< offset for scrolling float yCurrent; ///< used to track how much space the text needs for scrolling void DrawDatabaseInfo(); void DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart); void DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart); void DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart); void DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y); void DrawSensorInfo(database::tcGenericDBObject* genericData, float& y); void PrintText(float x, float& y, const char* formatString, ...); database::tcDatabaseObject* GetDatabaseObject(); void LoadImageList(); bool IsEmbedded() const; bool IsPopup() const; void OnScrollbarUpdated(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; #endif Index: tcDatabaseViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseViewer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDatabaseViewer.h 21 Apr 2006 23:28:31 -0000 1.3 --- tcDatabaseViewer.h 17 Aug 2006 01:27:10 -0000 1.4 *************** *** 38,41 **** --- 38,42 ---- class tc3DViewer; class tcButton; + class tcDatabaseBrowsePanel; namespace osg *************** *** 68,71 **** --- 69,73 ---- const std::string& GetDisplayClass() const; void SelectDisplayClass(const std::string& className); + void SelectDisplayClass(wxCommandEvent& event); void SetClassificationMask(unsigned int mask); void Set3DViewer(tc3DViewer* viewer_); *************** *** 82,90 **** unsigned int classificationMask; ///< mask for current platform type on browse list std::string displayClassName; ///< class name of current platform displayed ! std::vector<BrowseItem> browseInfo; tcDatabaseInfoWindow* databaseInfoWindow; tc3DViewer* viewer; std::vector<tcButton*> buttons; const wxRealPoint basePosition; wxPoint mousePosition; --- 84,94 ---- unsigned int classificationMask; ///< mask for current platform type on browse list std::string displayClassName; ///< class name of current platform displayed ! tcDatabaseBrowsePanel* browsePanel; tcDatabaseInfoWindow* databaseInfoWindow; tc3DViewer* viewer; std::vector<tcButton*> buttons; + + const wxRealPoint basePosition; wxPoint mousePosition; *************** *** 102,108 **** void InitializeButtons(); void InitializeDatabaseInfoWindow(); ! bool ProcessMouseClick(std::vector<BrowseItem>& info, wxPoint pos); void SetButtonOn(size_t idx); - void UpdateDrawInfo(std::vector<BrowseItem>& info); DECLARE_EVENT_TABLE() --- 106,111 ---- void InitializeButtons(); void InitializeDatabaseInfoWindow(); ! void InitializeBrowsePanel(); void SetButtonOn(size_t idx); DECLARE_EVENT_TABLE() Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcMapView.h 4 May 2006 22:47:06 -0000 1.29 --- tcMapView.h 17 Aug 2006 01:27:10 -0000 1.30 *************** *** 62,80 **** SYMBOL_SMALLSURFACE = 2, SYMBOL_LARGESURFACE = 3, ! SYMBOL_AIR = 4, ! SYMBOL_FIXEDWING = 5, ! SYMBOL_MISSILE = 6, ! SYMBOL_HELO = 7, ! SYMBOL_SUBSURFACE = 8, ! SYMBOL_SUBMARINE = 9, ! SYMBOL_TORPEDO = 10, ! SYMBOL_FIXED = 11, ! SYMBOL_MARK = 12, ! SYMBOL_SENSOR = 13, ! SYMBOL_TARGET = 14, ! SYMBOL_PIE = 15 }; ! #define MAX_SYMBOL 16 enum teSymbology --- 62,82 ---- SYMBOL_SMALLSURFACE = 2, SYMBOL_LARGESURFACE = 3, ! SYMBOL_CARRIER = 4, ! SYMBOL_AIR = 5, ! SYMBOL_FIXEDWING = 6, ! SYMBOL_MISSILE = 7, ! SYMBOL_HELO = 8, ! SYMBOL_SUBSURFACE = 9, ! SYMBOL_SUBMARINE = 10, ! SYMBOL_TORPEDO = 11, ! SYMBOL_FIXED = 12, ! SYMBOL_AIRFIELD = 13, ! SYMBOL_MARK = 14, ! SYMBOL_SENSOR = 15, ! SYMBOL_TARGET = 16, ! SYMBOL_PIE = 17 }; ! #define MAX_SYMBOL 18 enum teSymbology *************** *** 92,95 **** --- 94,99 ---- float mfHeading; double mfLon,mfLat; + float speed_kts; + float alt_m; teSymbol meSymbol; teAffiliation meAffiliation; *************** *** 106,110 **** meAffiliation = UNKNOWN; meSymbol = SYMBOL_UNKNOWN; ! mbExists=0;mbFocus=0;mnColor=0;mfHeading=0;mfLon=0;mfLat=0;mnID=0; mnFlags = 0; isStaleTrack = false; --- 110,114 ---- meAffiliation = UNKNOWN; meSymbol = SYMBOL_UNKNOWN; ! mbExists=0;mbFocus=0;mnColor=0;mfHeading=0;mfLon=0;mfLat=0;mnID=0;speed_kts=0;alt_m=0; mnFlags = 0; isStaleTrack = false; *************** *** 318,321 **** --- 322,326 ---- void OnSize(wxSizeEvent& event); void Refresh(); + void UpdateMapObjectColors(); void ActivateCmd(teMapCmdType aeCmd); void DeactivateCmd(); Index: tcMapOverlay.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapOverlay.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcMapOverlay.h 22 Mar 2006 01:23:29 -0000 1.3 --- tcMapOverlay.h 17 Aug 2006 01:27:10 -0000 1.4 *************** *** 65,68 **** --- 65,69 ---- /// redraw overlay during next call to Draw() void Redraw(); + void SetColor(osg::Vec4& color); virtual tcUpdateStream& operator<<(tcUpdateStream& stream); Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tc3DModel.h 18 Jun 2006 00:47:51 -0000 1.23 --- tc3DModel.h 17 Aug 2006 01:27:10 -0000 1.24 *************** *** 29,32 **** --- 29,33 ---- #include "tcSmoker.h" #include <osg/ref_ptr> + #include <osg/BoundingBox> #include <osg/Group> #include <osg/LOD> *************** *** 37,40 **** --- 38,42 ---- class tcParticleEffect; + namespace osgParticle { *************** *** 122,126 **** osg::ref_ptr<osg::Node> GetNode(); ///< transformed to camera frame unsigned int GetNumParents(); ! const osg::BoundingBox& GetBoundingBox() const; float GetRadius(); float GetRadiusGeneric(); --- 124,129 ---- osg::ref_ptr<osg::Node> GetNode(); ///< transformed to camera frame unsigned int GetNumParents(); ! const osg::BoundingBox& GetBoundingBox(); ! const osg::BoundingBox& GetBoundingBoxConst() const; float GetRadius(); float GetRadiusGeneric(); *************** *** 190,193 **** --- 193,200 ---- int genericMode; + osg::BoundingBox boundingBox; + bool boundingBoxComputed; + + void DisableSmoke(); void EnableSmoke(); --- NEW FILE: tcScrollBar.h --- /** ** @file tcScrollBar.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 _TCSCROLLBAR_H_ #define _TCSCROLLBAR_H_ #if _MSC_VER > 1000 #pragma once #endif #include "tc3DWindow.h" #include <string> namespace osg { class Texture2D; } class TiXmlNode; /** * GUI scroll bar class */ class tcScrollBar : public tc3DWindow { public: virtual void Draw(); void SetBackgroundAlpha(float val); void SetBarFraction(float val); tcScrollBar(tc3DWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "ScrollBar"); virtual ~tcScrollBar(); protected: float barFraction; float ybar; tcRect barRect; tcRect buttonUpRect; tcRect buttonDownRect; bool isMouseOver; bool leftButtonDown; bool scrollDrag; bool overArrowUp; ///< true if mouse is over up arrow bool overArrowDown; ///< true if mouse if over down arrow bool overScrollBar; wxPoint scrollDragStart; float ybarStart; bool autoScroll; ///< true if mouse is down long enough on up/down arrow, will auto scroll float autoScrollIncrement; ///< set to 0 when left button is not down over up/down arrow unsigned int buttonDownTime; float backgroundAlpha; ///< transparency value for solid color background virtual void OnEnterWindow(wxMouseEvent& event); virtual void OnLButtonDown(wxMouseEvent& event); virtual void OnLButtonDClick(wxMouseEvent& event); virtual void OnLButtonUp(wxMouseEvent& event); virtual void OnMouseMove(wxMouseEvent& event); virtual void OnLeaveWindow(wxMouseEvent& event); private: const float clickScrollAmount; ///< amount to scroll by when up/down arrow clicked osg::ref_ptr<osg::Texture2D> arrowUp; osg::ref_ptr<osg::Texture2D> arrowDown; osg::ref_ptr<osg::Texture2D> arrowUpOver; osg::ref_ptr<osg::Texture2D> arrowDownOver; float lastybar; void LoadImages(); void SendScrollbarUpdated(); void UpdateAutoScroll(); void UpdateYbar(float ynew); }; #endif Index: tcDatabaseInfoWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDatabaseInfoWindow.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcDatabaseInfoWindow.h 21 Apr 2006 23:28:31 -0000 1.5 --- tcDatabaseInfoWindow.h 17 Aug 2006 01:27:10 -0000 1.6 *************** *** 40,43 **** --- 40,46 ---- } + class tcDatabaseInfoPanel; + + /** * Window class to display info for database object *************** *** 105,118 **** float xImage; ///< x coordinate of image float yImage; ///< y coordinate of image static tc3DWindow* parent; void DrawDatabaseInfo(); - void DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart); - void DrawDatabaseInfo(database::tcMissileDBObject* missileData, float yStart); - void DrawDatabaseInfo(database::tcTorpedoDBObject* torpedoData, float yStart); void DrawDatabaseImages(); - void DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y); - void DrawSensorInfo(database::tcGenericDBObject* genericData, float& y); void PrintText(float x, float& y, const char* formatString, ...); --- 108,117 ---- float xImage; ///< x coordinate of image float yImage; ///< y coordinate of image + tcDatabaseInfoPanel* infoPanel; static tc3DWindow* parent; void DrawDatabaseInfo(); void DrawDatabaseImages(); void PrintText(float x, float& y, const char* formatString, ...); Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tc3DWindow.h 18 Jun 2006 00:47:51 -0000 1.26 --- tc3DWindow.h 17 Aug 2006 01:27:10 -0000 1.27 *************** *** 195,198 **** --- 195,200 ---- void SetBackgroundDraw(bool state); void SetResizeable2D(bool abState) {resizeable2DSurface = abState;} ///< @see tc3DWindow::OnSize + unsigned char GetStencilLayer() const; + void SetStencilLayer(unsigned char n); ///< set to 0 to deactivate virtual void SetYMirror(int y) {yMirror = y;} virtual void Thaw(); *************** *** 248,251 **** --- 250,255 ---- wxRect iconPosition; ///< minimized, icon pos of window const int iconSize; + unsigned char stencilLayer; ///< Set non-zero to keep window graphics in window (0/off by default) + static tc3DViewer* viewer; *************** *** 324,327 **** --- 328,332 ---- void LogStatus(); void UpdateChildren(); + void UpdateStencil(); DECLARE_EVENT_TABLE() Index: tcMapObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMapObject.h 22 Mar 2006 01:23:29 -0000 1.11 --- tcMapObject.h 17 Aug 2006 01:27:10 -0000 1.12 *************** *** 72,75 **** --- 72,77 ---- static void SetMapView(tcMapView *mv); + static void LoadMarker(const std::string& filename); + virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); *************** *** 86,90 **** static tcMapView *mapView; ///< used to translate lat/lon coords into screen coords - static void LoadMarker(); private: bool useRelativeCoords; ///< interpret lat_rad and lon_rad as rel screen coords [0-1] --- 88,91 ---- --- NEW FILE: tcBoundingBoxVisitor.h --- /** ** @file tcBoundingBoxVisitor.h */ /* Copyright (C) 2006 Dewitt Colclough (de...@gc...) ** 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 ** ** Based on code by Farshid Lashkari posted to the osg-users list on April 18, 2006 */ #ifndef _TCBOUNDINGBOXVISITOR_H_ #define _TCBOUNDINGBOXVISITOR_H_ #if _MSC_VER > 1000 #pragma once #endif #include <osg/NodeVisitor> #include <osg/BoundingBox> namespace osg { class Geode; }; class tcBoundingBoxVisitor : public osg::NodeVisitor { public : tcBoundingBoxVisitor(const osg::Matrix &mat); virtual void apply(osg::Node &node); virtual void apply(osg::Geode &geode); virtual void apply(osg::Transform& node); osg::BoundingBox getBound() const; private: osg::BoundingBox m_bb; osg::Matrix m_curMatrix; }; #endif |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:27:14
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21395/include/database Modified Files: tcDBObjSerializerSql.h tcDatabaseObject.h tcMissileDBObject.h tcSqlReader.h Log Message: Update for server name change Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcDatabaseObject.h 18 Jun 2006 00:47:51 -0000 1.30 --- tcDatabaseObject.h 17 Aug 2006 01:27:10 -0000 1.31 *************** *** 63,66 **** --- 63,67 ---- #define PTYPE_SMALLSURFACE 0x0011 #define PTYPE_LARGESURFACE 0x0012 + #define PTYPE_CARRIER 0x0014 #define PTYPE_AIR 0x0020 #define PTYPE_FIXEDWING 0x0021 *************** *** 72,75 **** --- 73,77 ---- #define PTYPE_SONOBUOY 0x0084 #define PTYPE_FIXED 0x0100 + #define PTYPE_AIRFIELD 0x0101 #define PTYPE_BALLISTIC 0x0200 *************** *** 144,147 **** --- 146,150 ---- static void AttachDatabase(tcDatabase *db) {database = db;} + const char* GetName() const; ///< returns name of this instance virtual const char* GetClassName() {return "Object";} ///< returns class name of database object float GetCost() const {return cost;} Index: tcSqlReader.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSqlReader.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSqlReader.h 22 Mar 2006 01:23:28 -0000 1.6 --- tcSqlReader.h 17 Aug 2006 01:27:10 -0000 1.7 *************** *** 64,67 **** --- 64,69 ---- std::string GetString(const std::string& field); std::string GetString(const char* fmt, ...); + + bool GetStringError() const; bool Read(); Index: tcDBObjSerializerSql.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDBObjSerializerSql.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcDBObjSerializerSql.h 18 Jun 2006 00:47:51 -0000 1.8 --- tcDBObjSerializerSql.h 17 Aug 2006 01:27:10 -0000 1.9 *************** *** 122,129 **** // if the obj already exists, delete the old and add the new (update) // (doesn't work for duplicates within database since BuildDictionaries needs to be called) ! if (database->ObjectExists(obj->GetClassName())) { ! fprintf(stdout, "Updating database class: %s\n", obj->GetClassName()); ! tcDatabaseObject* oldObj = database->GetObject(obj->GetClassName()); wxASSERT(oldObj != 0); --- 122,129 ---- // if the obj already exists, delete the old and add the new (update) // (doesn't work for duplicates within database since BuildDictionaries needs to be called) ! if (database->ObjectExists(obj->GetName())) { ! fprintf(stdout, "Updating database class: %s\n", obj->GetName()); ! tcDatabaseObject* oldObj = database->GetObject(obj->GetName()); wxASSERT(oldObj != 0); Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcMissileDBObject.h 18 Jun 2006 00:47:51 -0000 1.24 --- tcMissileDBObject.h 17 Aug 2006 01:27:10 -0000 1.25 *************** *** 142,146 **** teWeaponLaunchMode GetLaunchMode(); long GetSensorKey(); ! float GetSeekerFOV(); bool HasAllEmitters(std::vector<long>& emitters); bool NeedsFireControl() const; --- 142,146 ---- teWeaponLaunchMode GetLaunchMode(); long GetSensorKey(); ! float GetSeekerFOV(); ///< @returns FOV in radians bool HasAllEmitters(std::vector<long>& emitters); bool NeedsFireControl() const; |
From: Dewitt C. <ddc...@us...> - 2006-08-17 01:27:14
|
Update of /cvsroot/gcblue/gcb_wx/include/sqlite In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv21395/include/sqlite Modified Files: sqlite3x.hpp Log Message: Update for server name change Index: sqlite3x.hpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sqlite/sqlite3x.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sqlite3x.hpp 16 Sep 2005 21:58:05 -0000 1.1 --- sqlite3x.hpp 17 Aug 2006 01:27:11 -0000 1.2 *************** *** 146,149 **** --- 146,151 ---- public: + bool isStringError; ///< modified code DDC + sqlite3_reader(); sqlite3_reader(const sqlite3_reader ©); *************** *** 162,165 **** --- 164,168 ---- std::string getstring(int index); std::wstring getstring16(int index); + bool getStringError() const; std::string getblob(int index); |