gcblue-commits Mailing List for Global Conflict Blue (Page 52)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 22:37:22
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3774/src/sim Modified Files: Game.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** Game.cpp 14 Jun 2004 21:52:48 -0000 1.82 --- Game.cpp 14 Jun 2004 22:37:12 -0000 1.83 *************** *** 549,555 **** { wxASSERT(startView); - optionsView = new tcOptionsView(glCanvas, wxPoint(0,0), frameSize, - "OptionsView", startView); optionsView->AttachOptions(tcOptions::Get()); --- 549,555 ---- { wxASSERT(startView); + optionsView = new tcOptionsView(glCanvas, startView, wxPoint(0,0), frameSize); + optionsView->AttachOptions(tcOptions::Get()); *************** *** 907,910 **** --- 907,912 ---- //tcSound::Get()->PlayEffect(SEFFECT_WELCOME); + HookSomethingFriendly(); + return true; } *************** *** 1565,1568 **** --- 1567,1584 ---- } + /** + * Hooks first friendly platform. + * Used to avoid blank 3D screen in rand scenario + */ + void tcGame::HookSomethingFriendly() + { + long id; + + int ownAlliance = mcUserInfo.GetOwnAlliance(); + simState->GetAlliancePlatforms(&id, 1, ownAlliance); + + NewHook(id); + } + void tcGame::OnMouseMove(wxMouseEvent& event) {} *************** *** 1654,1667 **** long nHookID = event.m_extraLong; ! tacticalMap->SetHookID(nHookID); ! hookInfo->SetHookID(nHookID); ! oobView->SetHookID(nHookID); ! objectControl->SetHookID(nHookID); ! viewer->SetHookID(nHookID); ! if (nHookID != NULL_INDEX) { tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); ! pythonInterface->SetMenuPlatform(nHookID); } } --- 1670,1691 ---- long nHookID = event.m_extraLong; ! NewHook(nHookID); ! } ! /** ! * Update member objects with new hook ID. ! */ ! void tcGame::NewHook(long hookID) ! { ! tacticalMap->SetHookID(hookID); ! hookInfo->SetHookID(hookID); ! oobView->SetHookID(hookID); ! objectControl->SetHookID(hookID); ! viewer->SetHookID(hookID); ! ! if (hookID != NULL_INDEX) { tcSound::Get()->PlayEffect(SEFFECT_SHORTBEEP); ! pythonInterface->SetMenuPlatform(hookID); } } |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 22:37:22
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3774/include/common Modified Files: tcOptionsView.h Log Message: Index: tcOptionsView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOptionsView.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcOptionsView.h 9 Apr 2004 13:58:44 -0000 1.7 --- tcOptionsView.h 14 Jun 2004 22:37:11 -0000 1.8 *************** *** 1,4 **** /* ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,4 ---- /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 31,74 **** #endif #include "tcOptions.h" ! #include "tcWindow.h" #include "tcSound.h" // View and GUI for user options data ! class tcOptionsView : public tcWindow { ! // placement info for GUI buttons, text, etc. ! struct tsButtonInfo ! { ! int mnButtonX; ! int mnButtonY; ! int mnTextX; ! int mnTextY; ! }; public: ! void AttachOptions(tcOptions *apOptions) {mpOptions=apOptions;} ! bool Init(void); ! int Draw(void); ! void DrawButton(Gdiplus::Graphics *apGraphics, int x, int y, int abOn); ! void OnLButtonDown(wxMouseEvent& event); ! bool ButtonContainingPoint(wxPoint point, int& rnOption, int& rnValue); ! tcOptionsView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name = "OptionsView", ! tcWindow *sharedSurface = NULL); virtual ~tcOptionsView(); private: ! tcOptions *mpOptions; ! Gdiplus::Image *mpiBackground; ! Gdiplus::Image *mpiButtonOn; ! Gdiplus::Image *mpiButtonOff; ! Gdiplus::SolidBrush *mpBrush; ! Gdiplus::Font *mpFont; ! Gdiplus::Pen *mpPen; ! int mnBackgroundWidth,mnBackgroundHeight; ! int mnButtonWidth,mnButtonHeight; ! tsButtonInfo maButtonPosition[N_OPTIONS][N_OPTION_VALUES]; ! int mnXStart,mnYStart; }; --- 31,74 ---- #endif #include "tcOptions.h" ! #include "tcStandardWindow.h" #include "tcSound.h" // View and GUI for user options data ! class tcOptionsView : public tcStandardWindow { ! // placement info for GUI buttons, text, etc. ! struct tsButtonInfo ! { ! int mnButtonX; ! int mnButtonY; ! int mnTextX; ! int mnTextY; ! }; public: ! void AttachOptions(tcOptions *apOptions) {mpOptions=apOptions;} ! bool Init(void); ! int Draw(void); ! void DrawButton(Gdiplus::Graphics *apGraphics, int x, int y, int abOn); ! void OnLButtonDown(wxMouseEvent& event); ! bool ButtonContainingPoint(wxPoint point, int& rnOption, int& rnValue); ! ! tcOptionsView(wxWindow *parent, tcWindow *surfaceHost, ! const wxPoint& pos, const wxSize& size, ! const wxString& name = "OptionsView"); virtual ~tcOptionsView(); private: ! tcOptions *mpOptions; ! Gdiplus::Image *mpiBackground; ! Gdiplus::Image *mpiButtonOn; ! Gdiplus::Image *mpiButtonOff; ! Gdiplus::SolidBrush *mpBrush; ! Gdiplus::Font *mpFont; ! Gdiplus::Pen *mpPen; ! int mnBackgroundWidth,mnBackgroundHeight; ! int mnButtonWidth,mnButtonHeight; ! tsButtonInfo maButtonPosition[N_OPTIONS][N_OPTION_VALUES]; ! int mnXStart,mnYStart; }; |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 22:37:22
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3774/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CHANGES.txt 14 Jun 2004 15:23:38 -0000 1.21 --- CHANGES.txt 14 Jun 2004 22:37:11 -0000 1.22 *************** *** 3,6 **** --- 3,13 ---- 0.6 --------------------------------------------------------------------- + *** 2004-06-14 Dewitt Colclough *** + - Added features and GUI to change display settings (screen resolution) + - Converted tcOptionsView to use tcStandardWindow button bar + - Random scenario starts with a platform hooked to avoid blank 3D window + - Removed background erase from wxWindows to kill remaining flicker problems. + See updated BUILDING.txt file for details. + *** 2004-06-05 Dewitt Colclough *** - Added basic smoke effect using osgParticle library. |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:44
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** GCblue.vcproj 4 Jun 2004 21:39:15 -0000 1.54 --- GCblue.vcproj 14 Jun 2004 21:52:46 -0000 1.55 *************** *** 258,261 **** --- 258,267 ---- </File> <File + RelativePath=".\src\graphics\tcDisplayModes.cpp"> + </File> + <File + RelativePath=".\src\graphics\tcDisplaySettingsView.cpp"> + </File> + <File RelativePath="src\graphics\tcEditBox.cpp"> </File> *************** *** 646,649 **** --- 652,661 ---- </File> <File + RelativePath=".\include\graphics\tcDisplayModes.h"> + </File> + <File + RelativePath=".\include\graphics\tcDisplaySettingsView.h"> + </File> + <File RelativePath="include\graphics\tcEditBox.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:30
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/src/graphics Modified Files: tcGraphicsEngine.cpp tcWindow.cpp Added Files: tcDisplayModes.cpp tcDisplaySettingsView.cpp Log Message: Index: tcGraphicsEngine.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGraphicsEngine.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcGraphicsEngine.cpp 11 Apr 2004 22:25:33 -0000 1.15 --- tcGraphicsEngine.cpp 14 Jun 2004 21:52:47 -0000 1.16 *************** *** 38,41 **** --- 38,42 ---- #include <iostream> #include "wx/dcscreen.h" + #include "tcDisplayModes.h" #if _MSC_VER > 1000 *************** *** 851,855 **** wxMessageBox(text.c_str(),"Warning",wxICON_WARNING); } ! } --- 852,856 ---- wxMessageBox(text.c_str(),"Warning",wxICON_WARNING); } ! tcDisplayModes::Get()->LogModeInfo(); } Index: tcWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcWindow.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcWindow.cpp 11 Apr 2004 22:22:11 -0000 1.2 --- tcWindow.cpp 14 Jun 2004 21:52:48 -0000 1.3 *************** *** 41,47 **** BEGIN_EVENT_TABLE(tcWindow, wxWindow) ! //EVT_PAINT(tcWindow::OnPaint) ! //EVT_NC_PAINT(tcWindow::OnPaint) ! //EVT_ERASE_BACKGROUND(tcWindow::OnEraseBackground) EVT_MOVE(tcWindow::OnMove) EVT_LEFT_DOWN(tcWindow::OnLButtonDown) --- 41,47 ---- BEGIN_EVENT_TABLE(tcWindow, wxWindow) ! EVT_PAINT(tcWindow::OnPaint) ! EVT_NC_PAINT(tcWindow::OnPaint) ! EVT_ERASE_BACKGROUND(tcWindow::OnEraseBackground) EVT_MOVE(tcWindow::OnMove) EVT_LEFT_DOWN(tcWindow::OnLButtonDown) *************** *** 94,99 **** void tcWindow::OnEraseBackground(wxEraseEvent& event) { ! SetBackgroundColour(*wxBLACK); ! fprintf(stdout, "Erase [%s]\n",GetName()); } --- 94,100 ---- void tcWindow::OnEraseBackground(wxEraseEvent& event) { ! //SetBackgroundColour(*wxBLACK); ! //fprintf(stdout, "Erase [%s]\n",GetName()); ! return; } --- NEW FILE: tcDisplayModes.cpp --- /** @file tcDisplayModes.cpp ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #else #error "tcDisplayModes is Windows only at the moment" #endif #include "tcDisplayModes.h" #include "tcOptions.h" /** * Accessor for singleton instance */ tcDisplayModes* tcDisplayModes::Get() { static tcDisplayModes instance; return &instance; } void tcDisplayModes::ChangeMode(unsigned width, unsigned height, unsigned bits) { DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); winModeInfo.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; winModeInfo.dmBitsPerPel = bits; winModeInfo.dmPelsHeight = height; winModeInfo.dmPelsWidth = width; if (!IsModeValid(width, height, bits)) { fprintf(stderr, "tcDisplayModes::ChangeMode - Invalid mode: " "W:%d, H:%d, Bits:%d\n", width, height, bits); return; } long result = ChangeDisplaySettings(&winModeInfo, 0); // change dynamically if (result == DISP_CHANGE_SUCCESSFUL) { currentMode.bits = bits; currentMode.width = width; currentMode.height = height; } else if (result == DISP_CHANGE_BADMODE) { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode not supported: " "W:%d, H:%d, Bits:%d\n", width, height, bits); } else { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode change failed (%d)", result); } } /** * Changes display mode info in options xml file. Mode will take effect * after restart of game (if mode is valid). */ void tcDisplayModes::ChangeOptionsMode(unsigned width, unsigned height, unsigned bits) { if (!IsModeValid(width, height, bits)) { fprintf(stderr, "tcDisplayModes::ChangeOptionsMode - Invalid mode: " "W:%d, H:%d, Bits:%d\n", width, height, bits); return; } wxString modeString = wxString::Format("%d %d %d", width, height, bits); tcOptions::Get()->SetOptionString("DisplaySettings", modeString.GetData()); } /** * @return number of display modes (width, height, bits) */ unsigned int tcDisplayModes::GetModeCount() const { return (unsigned int)modeInfo.size(); } const tcDisplayModes::Info& tcDisplayModes::GetCurrentModeInfo() const { return currentMode; } const tcDisplayModes::Info& tcDisplayModes::GetModeInfo(unsigned int n) const { if (n >= modeInfo.size()) { fprintf(stderr, "tcDisplayModes::GetModeInfo - index out of bounds\n"); wxASSERT(0); } return modeInfo[n]; } bool tcDisplayModes::IsCurrentMode(unsigned n) const { if (n >= GetModeCount()) return false; tcDisplayModes::Info mode_n = modeInfo[n]; return ((mode_n.bits == currentMode.bits)&& (mode_n.height == currentMode.height)&& (mode_n.width == currentMode.width)); } /** * @return true if mode params match at least one of the modes in modeInfo */ bool tcDisplayModes::IsModeValid(unsigned width, unsigned height, unsigned bits) { unsigned int modeCount = GetModeCount(); for (unsigned int n=0; n<modeCount; n++) { tcDisplayModes::Info& info = modeInfo[n]; if ((info.bits == bits)&& (info.width == width)&& (info.height == height)) { return true; } } return false; } void tcDisplayModes::LoadModeFromOptions() { const char* modeString = tcOptions::Get()->GetOptionString("DisplaySettings"); int width; int height; int bits; if (sscanf(modeString, "%d %d %d", &width, &height, &bits) < 3) { return; } ChangeMode(width, height, bits); } /** * Writes modeInfo to stdout. PopulateModeInfo should be called first */ void tcDisplayModes::LogModeInfo() { unsigned int modeCount = GetModeCount(); for (unsigned int n=0; n<modeCount; n++) { tcDisplayModes::Info& info = modeInfo[n]; fprintf(stdout, "Display mode %d: W: %d, H: %d, Bits: %d\n", n, info.width, info.height, info.bits); } } /** * Initializes modeInfo vector with info on display modes. Ignores * modes with less than 16 bits per pixel and modes with width < 800. * WINDOWS ONLY for now. Next version of wxWidgets should have a * cross-platform version of these functions that we can use instead. */ void tcDisplayModes::PopulateModeInfo() { modeInfo.clear(); DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); unsigned lastBits = 0; unsigned lastWidth = 0; unsigned lastHeight = 0; int i = 0; while ( EnumDisplaySettings(0, i++, &winModeInfo) ) { tcDisplayModes::Info info; info.bits = winModeInfo.dmBitsPerPel; info.height = winModeInfo.dmPelsHeight; info.width = winModeInfo.dmPelsWidth; bool matchesLast = ((info.bits == lastBits)&& (info.width == lastWidth)&& (info.height == lastHeight)); if ((info.bits >= 16)&&(info.width >= 800)&&(!matchesLast)) { modeInfo.push_back(info); } lastBits = info.bits; lastWidth = info.width; lastHeight = info.height; } // ENUM_CURRENT_SETTINGS is defined as ((DWORD)-1) in windows.h EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &winModeInfo); currentMode.bits = winModeInfo.dmBitsPerPel; currentMode.height = winModeInfo.dmPelsHeight; currentMode.width = winModeInfo.dmPelsWidth; } tcDisplayModes::tcDisplayModes() { PopulateModeInfo(); startMode = currentMode; } tcDisplayModes::~tcDisplayModes() { ChangeMode(startMode.width, startMode.height, startMode.bits); } --- NEW FILE: tcDisplaySettingsView.cpp --- /* ** tcDisplaySettingsView.cpp ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include "wx/string.h" #include "tcDisplaySettingsView.h" #include "tcDisplayModes.h" #include "wxcommands.h" using namespace Gdiplus; /*******************************************************************************/ bool tcDisplaySettingsView::Init() { FontFamily ff(L"Arial"); mpFont = new Font(&ff,12,FontStyleBold,UnitPixel); if (mpFont == NULL) { fprintf(stderr, "tcDisplaySettingsView - mpFont creation failed\n"); return false; } mpBrush = new SolidBrush(Color(0xFEFFFFFF)); // color is ARGB if (mpBrush == NULL) { fprintf(stderr, "tcDisplaySettingsView - mpBrush creation failed\n"); return false; } mpPen = new Pen(Color(255,200,200,200),2); if (mpPen == NULL) { fprintf(stderr, "tcDisplaySettingsView - mpPen creation failed\n"); return false; } return true; } int tcDisplaySettingsView::Draw() { static nTestCount = 0; static WCHAR szwchar[256]; // wide char array buffer for string conversion Graphics *graphics; //Erase(); if (!GetGraphics(graphics)) { return false; } if (!modeListUpdated) { UpdateModeList(graphics); modeListUpdated = true; } DrawBackground(graphics); mpBrush->SetColor(0xFEFFFFFF); tcWindow::DrawText(graphics, mpFont, mpBrush, "To change display settings, select new display settings and restart game.", 25.0f, 80.0f); unsigned nModes = tcDisplayModes::Get()->GetModeCount(); RectF rstring; for(unsigned int n=0; n<nModes; n++) { modeDrawingInfo& drawingInfo = modeList[n]; wxString& modeText = drawingInfo.modeText; float xpos = drawingInfo.x; float ypos = drawingInfo.y; float height = drawingInfo.height; float textWidth = drawingInfo.width; if (n == mouseOverIdx) { mpBrush->SetColor(0xFE243280); } else if (tcDisplayModes::Get()->IsCurrentMode(n)) { mpBrush->SetColor(0xFE328032); } else { mpBrush->SetColor(0xFE122012); } graphics->FillRectangle(mpBrush, xpos, ypos, boxWidth, height); mpBrush->SetColor(0xFEFFFFFF); if (n == selectedModeIdx) { mpPen->SetColor(0xFEFFFFFF); graphics->DrawRectangle(mpPen, xpos, ypos, boxWidth, height); } float xoffset = 0.5f * (boxWidth - textWidth); tcWindow::DrawTextInRect(graphics, mpFont, mpBrush, modeText.GetData(), RectF(xpos + xoffset, ypos + 1.0f, boxWidth, height)); } DrawChildren(graphics); ReleaseGraphics(graphics); DrawBorder(); return true; } /** * @return index of mode containing screen point or -1 if none */ int tcDisplaySettingsView::GetBoxContainingPoint(const wxPoint& point) { std::map<unsigned int, modeDrawingInfo>::iterator iter = modeList.begin(); for(; iter != modeList.end(); ++iter) { RectF r(iter->second.x, iter->second.y, iter->second.width, iter->second.height); if (r.Contains(PointF(point.x, point.y))) { return (int)iter->first; } } return -1; } void tcDisplaySettingsView::OnLButtonDown(wxMouseEvent& event) { wxPoint point = event.GetPosition(); int downIdx = GetBoxContainingPoint(point); if ((downIdx >= 0) && ((unsigned)downIdx < tcDisplayModes::Get()->GetModeCount())) { const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo((unsigned)downIdx); tcDisplayModes::Get()->ChangeOptionsMode(info.width, info.height, info.bits); selectedModeIdx = downIdx; } } void tcDisplaySettingsView::OnMouseMove(wxMouseEvent& event) { wxPoint point = event.GetPosition(); mouseOverIdx = GetBoxContainingPoint(point); } /** * Updates modeList with bounding rectangle and mode text info. * Used for drawing and associating mouse location with a mode index. * Should be called at least once before drawing. */ void tcDisplaySettingsView::UpdateModeList(Gdiplus::Graphics *graphics) { static WCHAR szwchar[256]; // wide char array buffer for string conversion float xpos = 25.0f; const float ystart = 150.0f; float ypos = ystart; unsigned nModes = tcDisplayModes::Get()->GetModeCount(); RectF rstring; for(unsigned n=0; n<nModes; n++) { modeDrawingInfo drawingInfo; const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo(n); drawingInfo.modeText = wxString::Format("%d x %d (%d)", info.width, info.height, info.bits); MultiByteToWideChar(CP_ACP, 0, drawingInfo.modeText, -1, szwchar, 255); graphics->MeasureString(szwchar, -1, mpFont, PointF(0,0), &rstring); drawingInfo.x = xpos; drawingInfo.y = ypos - 1.0f; drawingInfo.width = rstring.Width; drawingInfo.height = rstring.Height + 2.0f; modeList[n] = drawingInfo; ypos += rstring.Height + 5.0f; if (ypos > float(mnHeight) - 20.0f) { ypos = ystart; xpos += boxWidth + 50.0f; } } } ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// /** * @param surfaceHost tcWindow to share surface of */ tcDisplaySettingsView::tcDisplaySettingsView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name) : tcStandardWindow(parent, pos, size, "xml/displaysettings_gui.xml", name, surfaceHost), mpPen(0), mpFont(0), mpBrush(0), selectedModeIdx(-1), mouseOverIdx(-1), boxWidth(140.0f), modeListUpdated(false) { wxASSERT(surfaceHost); Init(); LoadBackgroundImage("background.jpg"); if (config) { AddXMLControls(); } else { fprintf(stderr, "tcDisplaySettingsView::tcDisplaySettingsView - " "NULL xml config node\n"); return; } } tcDisplaySettingsView::~tcDisplaySettingsView() { if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} if (mpPen != NULL) {delete mpPen;} } |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:29
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/include/sim Modified Files: Game.h Log Message: Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Game.h 29 May 2004 00:11:53 -0000 1.37 --- Game.h 14 Jun 2004 21:52:47 -0000 1.38 *************** *** 61,64 **** --- 61,65 ---- class tcDirector; class tcNetworkView; + class tcDisplaySettingsView; class tcChatBox; *************** *** 95,98 **** --- 96,100 ---- SCENARIOSELECT, NETWORK, + DISPLAYSETTINGS, TACTICAL, TACTICALBRIEF, *************** *** 164,167 **** --- 166,170 ---- tcDirector* director; ///< displays scripted graphics and controls view for dramatic mission brief tcNetworkView* networkView; ///< network and multiplayer setup and test + tcDisplaySettingsView* displaySettingsView; tcChatBox* chatBox; ///< popup for multiplayer chat *************** *** 243,251 **** --- 246,257 ---- void SkipBriefing(wxCommandEvent& event); void StartGame(wxCommandEvent& event); + void SwitchToCredit(wxCommandEvent& event); + void SwitchToDisplaySettings(wxCommandEvent& event); void SwitchToNetwork(wxCommandEvent& event); void SwitchToOptions(wxCommandEvent& event); void SwitchToScenarioSelect(wxCommandEvent& event); void SwitchToStart(wxCommandEvent& event); + void SynchTimeAcceleration(); void Toggle3DSize(); *************** *** 259,262 **** --- 265,269 ---- void InitializeCreditView(); void InitializeDirector(); + void InitializeDisplaySettingsView(); void InitializeNetworkView(); void InitializeOptionsView(); |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:29
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/include/common Modified Files: wxcommands.h Log Message: Index: wxcommands.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/wxcommands.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxcommands.h 27 Apr 2004 01:24:14 -0000 1.14 --- wxcommands.h 14 Jun 2004 21:52:47 -0000 1.15 *************** *** 34,37 **** --- 34,38 ---- ID_DATABASEVIEW = 30, ///< switch to database view (not implemented yet) ID_OPTIONSVIEW = 40, ///< switch to options view + ID_DISPLAYSETTINGS = 42, ///< switch to display settings view ID_SCENARIOSELECTVIEW = 50, ///< switch to scenario select view ID_MULTIPLAYERVIEW = 60, ///< switch to multiplayer view |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:05
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/xml Modified Files: network_view.xml options.xml Added Files: displaysettings_gui.xml Log Message: Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** options.xml 4 Jun 2004 21:39:23 -0000 1.1 --- options.xml 14 Jun 2004 21:52:55 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- <Options> <HostAddress>192.168.0.102</HostAddress> + <DisplaySettings>1024 768 32</DisplaySettings> </Options> Index: network_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/network_view.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** network_view.xml 24 Mar 2004 21:09:27 -0000 1.2 --- network_view.xml 14 Jun 2004 21:52:55 -0000 1.3 *************** *** 3,7 **** <Button X="100" Y="50" Width="65" Height="15" Caption="Credits" Command="20"/> <Button X="170" Y="50" Width="65" Height="15" Caption="Database" Command="30"/> ! <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="40"/> <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50"/> --- 3,7 ---- <Button X="100" Y="50" Width="65" Height="15" Caption="Credits" Command="20"/> <Button X="170" Y="50" Width="65" Height="15" Caption="Database" Command="30"/> ! <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="42"/> <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50"/> --- NEW FILE: displaysettings_gui.xml --- <Window> <Button X="30" Y="50" Width="65" Height="15" Caption="Start" Command="10"/> <Button X="100" Y="50" Width="65" Height="15" Caption="Credits" Command="20"/> <Button X="170" Y="50" Width="65" Height="15" Caption="Database" Command="30"/> <Button X="240" Y="50" Width="65" Height="15" Caption="Options" Command="40"/> <Button X="310" Y="50" Width="65" Height="15" Caption="Scenarios" Command="50"/> </Window> |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:05
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/include/graphics Added Files: tcDisplayModes.h tcDisplaySettingsView.h Log Message: --- NEW FILE: tcDisplaySettingsView.h --- /* ** @file tcDisplaySettingsView.h ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCDISPLAYSETTINGSVIEW_H_ #define _TCDISPLAYSETTINGSVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include "tcOptions.h" #include "tcStandardWindow.h" #include "tcSound.h" /** * Display settings GUI */ class tcDisplaySettingsView : public tcStandardWindow { public: int Draw(); void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); tcDisplaySettingsView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name = "DisplaySettingsView"); virtual ~tcDisplaySettingsView(); private: struct modeDrawingInfo { float x, y, width, height; // dimensions of info box wxString modeText; }; Gdiplus::SolidBrush *mpBrush; Gdiplus::Font *mpFont; Gdiplus::Pen *mpPen; std::map<unsigned int, modeDrawingInfo> modeList; int selectedModeIdx; // -1 for none selected int mouseOverIdx; // -1 for over none float boxWidth; bool modeListUpdated; int GetBoxContainingPoint(const wxPoint& point); bool Init(); void UpdateModeList(Gdiplus::Graphics *graphics); }; #endif // _TCDISPLAYSETTINGSVIEW_H_ --- NEW FILE: tcDisplayModes.h --- /** @file tcDisplayModes.h ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCDISPLAYMODES_H_ #define _TCDISPLAYMODES_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <vector> /** * Singleton class to enumerate and set display modes */ class tcDisplayModes { public: struct Info { unsigned int width; unsigned int height; unsigned int bits; }; static tcDisplayModes* Get(); void ChangeMode(unsigned width, unsigned height, unsigned bits); void ChangeOptionsMode(unsigned width, unsigned height, unsigned bits); unsigned GetModeCount() const; const tcDisplayModes::Info& GetCurrentModeInfo() const; const tcDisplayModes::Info& GetModeInfo(unsigned n) const; bool IsCurrentMode(unsigned n) const; bool IsModeValid(unsigned width, unsigned height, unsigned bits); void LoadModeFromOptions(); void LogModeInfo(); private: std::vector<Info> modeInfo; tcDisplayModes::Info currentMode; tcDisplayModes::Info startMode; void PopulateModeInfo(); tcDisplayModes(); ~tcDisplayModes(); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 21:53:05
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3244/src/sim Modified Files: Game.cpp gcb.cpp Log Message: Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** Game.cpp 29 May 2004 00:11:54 -0000 1.81 --- Game.cpp 14 Jun 2004 21:52:48 -0000 1.82 *************** *** 48,51 **** --- 48,52 ---- #include "tcStandardWindow.h" #include "tcNetworkView.h" + #include "tcDisplaySettingsView.h" #include "network/tcMultiplayerInterface.h" #include "tcChatBox.h" *************** *** 75,78 **** --- 76,80 ---- EVT_COMMAND(ID_STARTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToStart) EVT_COMMAND(ID_CREDITVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToCredit) + EVT_COMMAND(ID_DISPLAYSETTINGS, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToDisplaySettings) EVT_COMMAND(ID_OPTIONSVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToOptions) EVT_COMMAND(ID_SCENARIOSELECTVIEW, wxEVT_COMMAND_BUTTON_CLICKED , tcGame::SwitchToScenarioSelect) *************** *** 299,302 **** --- 301,309 ---- } + void tcGame::SwitchToDisplaySettings(wxCommandEvent& event) + { + meScreenMode = DISPLAYSETTINGS; + } + void tcGame::SwitchToOptions(wxCommandEvent& event) { *************** *** 402,405 **** --- 409,413 ---- InitializeNetworkView(); InitializeScenarioSelectView(); + InitializeDisplaySettingsView(); tcMultiplayerInterface::Get()->SetEvtHandler(this); *************** *** 640,643 **** --- 648,663 ---- /** + * Initializes the Display Settings GUI + * + */ + void tcGame::InitializeDisplaySettingsView() + { + wxASSERT(startView); + + displaySettingsView = + new tcDisplaySettingsView(glCanvas, startView, wxPoint(0,0), frameSize); + } + + /** * Initializes the Select Scenario View screen. * *************** *** 1133,1136 **** --- 1153,1160 ---- optionsView->Draw(); break; + case DISPLAYSETTINGS: + displaySettingsView->SetActive(true); + displaySettingsView->Draw(); + break; case SCENARIOSELECT: scenarioSelectView->SetActive(true); *************** *** 1194,1197 **** --- 1218,1222 ---- optionsView->SetActive(false); networkView->SetActive(false); + displaySettingsView->SetActive(false); tacticalMap->SetActive(drawTacticalMap); infoConsole->SetActive(drawEdgeWindows); *************** *** 1225,1228 **** --- 1250,1254 ---- optionsView->SetActive(false); networkView->SetActive(false); + displaySettingsView->SetActive(false); tacticalMap->SetActive(drawTacticalMap); infoConsole->SetActive(false); *************** *** 1251,1254 **** --- 1277,1281 ---- optionsView->SetActive(true); //networkView->SetActive(false); + //displaySettingsView->SetActive(false); tacticalMap->SetActive(false); infoConsole->SetActive(false); *************** *** 1266,1269 **** --- 1293,1297 ---- //optionsView->SetActive(false); networkView->SetActive(true); + // displaySettingsView->SetActive(false); tacticalMap->SetActive(false); infoConsole->SetActive(false); *************** *** 1275,1278 **** --- 1303,1323 ---- networkView->Draw(); } + else if (meScreenMode == DISPLAYSETTINGS) + { + briefingConsoleLeft->SetActive(false); + briefingConsoleBottom->SetActive(false); + //optionsView->SetActive(false); + //networkView->SetActive(false); + displaySettingsView->SetActive(true); + tacticalMap->SetActive(false); + infoConsole->SetActive(false); + hookInfo->SetActive(false); + oobView->SetActive(false); + objectControl->SetActive(false); + viewer->SetActive(false); + chatBox->SetActive(false); + + displaySettingsView->Draw(); + } } Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gcb.cpp 6 Mar 2004 20:52:29 -0000 1.14 --- gcb.cpp 14 Jun 2004 21:52:55 -0000 1.15 *************** *** 33,36 **** --- 33,37 ---- #include "gcb.h" #include "Game.h" + #include "tcDisplayModes.h" using namespace Gdiplus; *************** *** 278,281 **** --- 279,283 ---- try { + tcDisplayModes::Get()->LoadModeFromOptions(); gameFrame = new tcGame(wxPoint(0,0), wxGetDisplaySize()); // full screen gameFrame->Init(); |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 15:23:47
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31741/docs Modified Files: BUILDING.txt CHANGES.txt Log Message: Index: BUILDING.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/BUILDING.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BUILDING.txt 20 Mar 2004 18:46:47 -0000 1.1 --- BUILDING.txt 14 Jun 2004 15:23:37 -0000 1.2 *************** *** 49,52 **** --- 49,53 ---- C:\3rdParty_2003-10-01\include C:\wxWindows-2.4.2\include + C:\wxWindows-2.4.2\lib\msw C:\OpenSceneGraph-0.9.6-2\include C:\OpenThreads-v1.2dev3-osg0.9.6\include *************** *** 166,169 **** --- 167,179 ---- #pragma warning(disable:4267) + - In src/msw/window.cpp add this line at the beginning of the + wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) method: + + return TRUE; // workaround for GCB to stop flicker + + This is a workaround to stop flicker. Since wxWindows / wxWidgets is not + used for drawing, it is safe to disable this code. Should get this added + as a flag to wxWidgets. + - Build Debug and Release configs for all projects in solution (do not build other configs like Debug DLL, Debug Unicode, etc.) Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CHANGES.txt 24 May 2004 00:14:44 -0000 1.20 --- CHANGES.txt 14 Jun 2004 15:23:38 -0000 1.21 *************** *** 3,6 **** --- 3,9 ---- 0.6 --------------------------------------------------------------------- + *** 2004-06-05 Dewitt Colclough *** + - Added basic smoke effect using osgParticle library. + *** 2004-05-23 Dewitt Colclough *** - Added launch (datum) and sensor activate/deactivate to commands |
|
From: Dewitt C. <ddc...@us...> - 2004-06-14 14:35:28
|
Update of /cvsroot/gcblue/gcb_data/3d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28498/3d Added Files: smoke.rgb Log Message: --- NEW FILE: smoke.rgb --- (This appears to be a binary file; contents omitted.) |
|
From: Dewitt C. <ddc...@us...> - 2004-06-05 19:31:52
|
Update of /cvsroot/gcblue/gcb_data/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27775/database Modified Files: air.csv Log Message: Index: air.csv =================================================================== RCS file: /cvsroot/gcblue/gcb_data/database/air.csv,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** air.csv 23 Mar 2004 22:26:22 -0000 1.4 --- air.csv 5 Jun 2004 19:31:42 -0000 1.5 *************** *** 1,3 **** Database class,Model class id,Functional class id,ImageFileName,3DModelFileName,Description,Rcs_dbsm,MaxSpeed_kts,Accel_ktsps,TurnRate_degps,FuelCapacity [kg],FuelRate [kg/s],MaxAltitude_m,MaxDepth_m,AltitudeRate_mps,Toughness,Damage,Weight[kg],MaxThrust[N],Range_km,Flightport Class,Launcher1,Launcher1-angle,Launcher2,Launcher2-angle,Launcher3,Launcher3-angle,Launcher4,Launcher4-angle,Launcher5,Launcher5-angle,Launcher6,Launcher6-angle,Launcher7,Launcher7-angle,Launcher8,Launcher8-angle,Sensor1,Sensor1-angle,Sensor2,Sensor2-angle,Sensor3,Sensor3-angle,Sensor4,Sensor4-angle,Sensor5,Sensor5-angle,Sensor6,Sensor6-angle,Sensor7,Sensor7-angle,Sensor8,Sensor8-angle,Animation1-obj,Animation1-type,Animation1-param,Animation2-obj,Animation2-type,Animation2-param,Animation3-obj,Animation3-type,Animation3-param,Animation4-obj,Animation4-type,Animation4-param,Thrust altitude decay factor [1/m],AfterburnFuelRate_kgps,AfterburnThrust_N,DragArea_sm,WingArea_sm,Cdpsub,Cdptran,Cdpsup,Mcm,Msupm,Kdi,MaxAoa_rad,MaxCl,Gmax ! Mig25,12,33,NONE,m50_co,Mig25 aero model test,10,2000,20,20,13500,6,20000,0,0,2,0,15000,150000,0,,AAM Launcher,0,,,,,,,,,,,,,,,Fighter radar,0,,,,,,,,,,,,,,,,,,,,,,,,,,,0.00004,20,220000,1,70,1,2,1.5,0.9,1.1,6,0.1,0.2,5 Harrier GR3a,12,33,NONE,gr3uk,"Single-engine; ""jump-jet"" fighter-bomber designed to fly from combat areas and aircraft carriers and to support ground forces. It was made by Hawker Siddeley Aviation and first flew on Aug. 31; 1966; after a long period of development.Powered by a vectored-thrust turbofan engine; the plane diverted its engine thrust downward for vertical takeoff using rotatable engine exhaust ports. It could carry a combination of armaments; including air-to-air missiles; air-to-surface antiship missiles; rockets; bombs.ÍÍ",0,639,20,20,1000,1,15600,0,0,2,0,15000,60000,0,,AAM-SR Launcher,0,ASM Launcher,0,,,,,,,,,,,,,Fighter radar,0,,,,,,,,,,,,,,,,,,,,,,,,,,,0.00001,8,85000,1,100,0.7,5,20,0.9,1.1,2,0.1,0.5,5 --- 1,3 ---- Database class,Model class id,Functional class id,ImageFileName,3DModelFileName,Description,Rcs_dbsm,MaxSpeed_kts,Accel_ktsps,TurnRate_degps,FuelCapacity [kg],FuelRate [kg/s],MaxAltitude_m,MaxDepth_m,AltitudeRate_mps,Toughness,Damage,Weight[kg],MaxThrust[N],Range_km,Flightport Class,Launcher1,Launcher1-angle,Launcher2,Launcher2-angle,Launcher3,Launcher3-angle,Launcher4,Launcher4-angle,Launcher5,Launcher5-angle,Launcher6,Launcher6-angle,Launcher7,Launcher7-angle,Launcher8,Launcher8-angle,Sensor1,Sensor1-angle,Sensor2,Sensor2-angle,Sensor3,Sensor3-angle,Sensor4,Sensor4-angle,Sensor5,Sensor5-angle,Sensor6,Sensor6-angle,Sensor7,Sensor7-angle,Sensor8,Sensor8-angle,Animation1-obj,Animation1-type,Animation1-param,Animation2-obj,Animation2-type,Animation2-param,Animation3-obj,Animation3-type,Animation3-param,Animation4-obj,Animation4-type,Animation4-param,Thrust altitude decay factor [1/m],AfterburnFuelRate_kgps,AfterburnThrust_N,DragArea_sm,WingArea_sm,Cdpsub,Cdptran,Cdpsup,Mcm,Msupm,Kdi,MaxAoa_rad,MaxCl,Gmax ! Mig25,12,33,NONE,m50_co,Mig25 aero model test,10,2000,20,20,13500,6,20000,0,0,2,0,15000,150000,0,,AAM Launcher,0,,,,,,,,,,,,,,,Fighter radar,0,,,,,,,,,,,,,,,,,,,,,,,,,,,0.00004,20,220000,1,90,1,2,1.5,0.9,1.1,6,0.1,0.2,5 Harrier GR3a,12,33,NONE,gr3uk,"Single-engine; ""jump-jet"" fighter-bomber designed to fly from combat areas and aircraft carriers and to support ground forces. It was made by Hawker Siddeley Aviation and first flew on Aug. 31; 1966; after a long period of development.Powered by a vectored-thrust turbofan engine; the plane diverted its engine thrust downward for vertical takeoff using rotatable engine exhaust ports. It could carry a combination of armaments; including air-to-air missiles; air-to-surface antiship missiles; rockets; bombs.ÍÍ",0,639,20,20,1000,1,15600,0,0,2,0,15000,60000,0,,AAM-SR Launcher,0,ASM Launcher,0,,,,,,,,,,,,,Fighter radar,0,,,,,,,,,,,,,,,,,,,,,,,,,,,0.00001,8,85000,1,100,0.7,5,20,0.9,1.1,2,0.1,0.5,5 |
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/src/sim Modified Files: tc3DViewer.cpp tcAirObject.cpp tcGameObject.cpp tcLauncherState.cpp tcMissileObject.cpp tcPlatformObject.cpp tcSurfaceObject.cpp Log Message: Index: tcAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAirObject.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcAirObject.cpp 24 May 2004 00:14:47 -0000 1.9 --- tcAirObject.cpp 4 Jun 2004 21:39:23 -0000 1.10 *************** *** 302,305 **** --- 302,307 ---- float dt_s = (float)(afStatusTime - mfStatusTime); + UpdateEffects(); + // shouldn't be called for child objects if (parent != NULL) {return;} // captive, let parent update if applicable Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcLauncherState.cpp 29 May 2004 00:11:54 -0000 1.10 --- tcLauncherState.cpp 4 Jun 2004 21:39:23 -0000 1.11 *************** *** 301,305 **** if (statusCode == 0) { ! statusCode = GetLauncherStatus(nLauncher); pLauncher->SetErrorCode(statusCode); } --- 301,305 ---- if (statusCode == 0) { ! statusCode = GetLauncherStatus(n); pLauncher->SetErrorCode(statusCode); } Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcSurfaceObject.cpp 1 May 2004 21:49:06 -0000 1.9 --- tcSurfaceObject.cpp 4 Jun 2004 21:39:23 -0000 1.10 *************** *** 28,31 **** --- 28,33 ---- #include "tcGenericDBObject.h" #include "tcMapData.h" + #include "tcParticleEffect.h" + #include "tc3DModel.h" *************** *** 70,77 **** } ! void tcSurfaceObject::Update(double afStatusTime) { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); if (parent != NULL) {return;} // captive, let parent update if applicable if (dt_s <= min_update_s) {return;} // added for pause case --- 72,82 ---- } ! void tcSurfaceObject::Update(double afStatusTime) ! { const float min_update_s = 0.0f; float dt_s = (float)(afStatusTime - mfStatusTime); + UpdateEffects(); + if (parent != NULL) {return;} // captive, let parent update if applicable if (dt_s <= min_update_s) {return;} // added for pause case *************** *** 97,100 **** --- 102,114 ---- } + void tcSurfaceObject::UpdateEffects() + { + if (model) + { + model->SetSmokeMode(tcParticleEffect::DAMAGE); + model->UpdateEffects(); + } + } + /******************************************************************************/ Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcPlatformObject.cpp 29 May 2004 00:11:54 -0000 1.24 --- tcPlatformObject.cpp 4 Jun 2004 21:39:23 -0000 1.25 *************** *** 246,249 **** --- 246,251 ---- float dt_s = (float)(afStatusTime - mfStatusTime); + UpdateEffects(); + if (parent != NULL) {return;} // captive, let parent update if applicable if (mpDBObject == NULL) {return;} Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcGameObject.cpp 1 May 2004 21:49:06 -0000 1.15 --- tcGameObject.cpp 4 Jun 2004 21:39:23 -0000 1.16 *************** *** 413,417 **** * Updates mcKin based on parent position and rel_pos. */ ! void tcGameObject::UpdateCaptivePosition(void) { if (parent == NULL) {return;} --- 413,417 ---- * Updates mcKin based on parent position and rel_pos. */ ! void tcGameObject::UpdateCaptivePosition() { if (parent == NULL) {return;} *************** *** 423,426 **** --- 423,430 ---- } + void tcGameObject::UpdateEffects() + { + } + /** * *************** *** 483,486 **** --- 487,492 ---- if (model) { + model->SetSmokeMode(0); + model->UpdateEffects(); // clear smoke particle generator model->DetachFromParent(); delete model; Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcMissileObject.cpp 1 May 2004 21:49:06 -0000 1.11 --- tcMissileObject.cpp 4 Jun 2004 21:39:23 -0000 1.12 *************** *** 21,24 **** --- 21,26 ---- #include "common/tcStream.h" #include "common/tcObjStream.h" + #include "tc3DModel.h" + #include "tcParticleEffect.h" /** *************** *** 115,118 **** --- 117,122 ---- mfStatusTime = afStatusTime; + UpdateEffects(); + if (clientMode) return; *************** *** 136,139 **** --- 140,154 ---- } + + void tcMissileObject::UpdateEffects() + { + if (model) + { + model->SetSmokeMode(tcParticleEffect::MISSILE); + model->UpdateEffects(); + } + } + + #define MISSILE_ACZ 500.0f Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tc3DViewer.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tc3DViewer.cpp 14 May 2004 23:37:08 -0000 1.30 --- tc3DViewer.cpp 4 Jun 2004 21:39:22 -0000 1.31 *************** *** 47,50 **** --- 47,52 ---- #include <osgText/Font> #include <osgText/Text> + #include <osgParticle/ParticleSystem> + #include <osgParticle/ParticleSystemUpdater> #include "ObjectUpdater.h" *************** *** 54,57 **** --- 56,60 ---- #include "cspSky.h" #include "tc3DModel.h" + #include "tcParticleEffect.h" *************** *** 245,249 **** /** ! * Sets position of camera for non-moveWithCamera modes. */ void tc3DViewer::SetGeoPosition(double lon_rad, double lat_rad, float alt_m) --- 248,252 ---- /** ! * Sets position of camera for non-movewith camera modes. */ void tc3DViewer::SetGeoPosition(double lon_rad, double lat_rad, float alt_m) *************** *** 252,255 **** --- 255,264 ---- cameraLatitude = lat_rad; cameraAltitude = alt_m; + + float x = LonToX(cameraLongitude); + float y = LatToY(cameraLatitude); + float z = cameraAltitude; + + cameraPosition.set(x,y,z); } *************** *** 337,340 **** --- 346,445 ---- } + + + #include <osgParticle/Particle> + #include <osgParticle/ParticleSystem> + #include <osgParticle/ParticleSystemUpdater> + #include <osgParticle/ModularEmitter> + #include <osgParticle/ModularProgram> + #include <osgParticle/RandomRateCounter> + #include <osgParticle/SectorPlacer> + #include <osgParticle/RadialShooter> + #include <osgParticle/AccelOperator> + #include <osgParticle/FluidFrictionOperator> + + osgParticle::ParticleSystem *create_simple_particle_system(osg::Group *root) + { + + // Ok folks, this is the first particle system we build; it will be + // very simple, with no textures and no special effects, just default + // values except for a couple of attributes. + + // First of all, we create the ParticleSystem object; it will hold + // our particles and expose the interface for managing them; this object + // is a Drawable, so we'll have to add it to a Geode later. + + osgParticle::ParticleSystem *ps = new osgParticle::ParticleSystem; + + // As for other Drawable classes, the aspect of graphical elements of + // ParticleSystem (the particles) depends on the StateAttribute's we + // give it. The ParticleSystem class has an helper function that let + // us specify a set of the most common attributes: setDefaultAttributes(). + // This method can accept up to three parameters; the first is a texture + // name (std::string), which can be empty to disable texturing, the second + // sets whether particles have to be "emissive" (additive blending) or not; + // the third parameter enables or disables lighting. + + ps->setDefaultAttributes("smoke.rgb", false, false); + + // Now that our particle system is set we have to create an emitter, that is + // an object (actually a Node descendant) that generate new particles at + // each frame. The best choice is to use a ModularEmitter, which allow us to + // achieve a wide variety of emitting styles by composing the emitter using + // three objects: a "counter", a "placer" and a "shooter". The counter must + // tell the ModularEmitter how many particles it has to create for the + // current frame; then, the ModularEmitter creates these particles, and for + // each new particle it instructs the placer and the shooter to set its + // position vector and its velocity vector, respectively. + // By default, a ModularEmitter object initializes itself with a counter of + // type RandomRateCounter, a placer of type PointPlacer and a shooter of + // type RadialShooter (see documentation for details). We are going to leave + // these default objects there, but we'll modify the counter so that it + // counts faster (more particles are emitted at each frame). + + osgParticle::ModularEmitter *emitter = new osgParticle::ModularEmitter; + + // the first thing you *MUST* do after creating an emitter is to set the + // destination particle system, otherwise it won't know where to create + // new particles. + + emitter->setParticleSystem(ps); + + // Ok, get a pointer to the emitter's Counter object. We could also + // create a new RandomRateCounter object and assign it to the emitter, + // but since the default counter is already a RandomRateCounter, we + // just get a pointer to it and change a value. + + osgParticle::RandomRateCounter *rrc = + static_cast<osgParticle::RandomRateCounter *>(emitter->getCounter()); + + // Now set the rate range to a better value. The actual rate at each frame + // will be chosen randomly within that range. + + rrc->setRateRange(20, 30); // generate 20 to 30 particles per second + + // The emitter is done! Let's add it to the scene graph. The cool thing is + // that any emitter node will take into account the accumulated local-to-world + // matrix, so you can attach an emitter to a transform node and see it move. + + root->addChild(emitter); + + // Ok folks, we have almost finished. We don't add any particle modifier + // here (see ModularProgram and Operator classes), so all we still need is + // to create a Geode and add the particle system to it, so it can be + // displayed. + + osg::Geode *geode = new osg::Geode; + geode->addDrawable(ps); + + // add the geode to the scene graph + root->addChild(geode); + + return ps; + + } + + + void tc3DViewer::CreateScene() { *************** *** 405,408 **** --- 510,515 ---- foggedObjects->addChild(terrainNode.get()); foggedObjects->addChild(skyLights.get()); + tc3DModel::SetWorldFrame(rootnode.get()); + rootnode->addChild(foggedObjects.get()); *************** *** 410,413 **** --- 517,539 ---- rootnode->addChild(orthoProjection.get()); + // tcParticleEffect* ps1 = new tcParticleEffect(); + // ps1->AddToSceneGraph(rootnode.get()); + + //osgParticle::ParticleSystem *ps1 = create_simple_particle_system(rootnode.get()); + + // Now that the particle systems and all other related objects have been + // created, we have to add an "updater" node to the scene graph. This node + // will react to cull traversal by updating the specified particles system. + + //osgParticle::ParticleSystemUpdater *psu = new osgParticle::ParticleSystemUpdater; + //psu->addParticleSystem(ps1); + + // add the updater node to the scene graph + //rootnode->addChild(psu); + + + //particleSystemUpdater = new osgParticle::ParticleSystemUpdater; + //tcParticleEffect::SetParticleSystemUpdater(particleSystemUpdater.get()); + } *************** *** 567,571 **** else { ! cameraPosition = GetCameraPosition(); } --- 693,697 ---- else { ! // cameraPosition = GetCameraPosition(); // leave camera at pos set by SetGeoPosiiton } *************** *** 676,688 **** /** ! * Converts lon/lat coords to world coords. ! * @return camera position in world coordinates. */ osg::Vec3 tc3DViewer::GetCameraPosition() { ! float x = LonToX(cameraLongitude); ! float y = LatToY(cameraLatitude); ! float z = cameraAltitude; ! return osg::Vec3(x,y,z); } --- 802,810 ---- /** ! * @return camera position vec3 in world coordinates. */ osg::Vec3 tc3DViewer::GetCameraPosition() { ! return cameraPosition; } *************** *** 888,892 **** osg::StateAttribute *sa = stateSet->getAttribute(StateAttribute::POLYGONMODE); osg::PolygonMode *pm = dynamic_cast<osg::PolygonMode*>(sa); ! if (pm == NULL) return; if (viewWireframe) { --- 1010,1020 ---- osg::StateAttribute *sa = stateSet->getAttribute(StateAttribute::POLYGONMODE); osg::PolygonMode *pm = dynamic_cast<osg::PolygonMode*>(sa); ! if (pm == NULL) ! { ! pm = new osg::PolygonMode(); ! pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::FILL); ! stateSet->setAttribute(pm, osg::StateAttribute::ON); ! } ! if (viewWireframe) { |
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:32
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/xml Added Files: options.xml Log Message: --- NEW FILE: options.xml --- <Options> <HostAddress>192.168.0.102</HostAddress> </Options> |
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:31
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/src/graphics Modified Files: ObjectUpdater.cpp tc3DModel.cpp Added Files: tcParticleEffect.cpp Log Message: --- NEW FILE: tcParticleEffect.cpp --- /** @file tcParticleEffect.cpp ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tcParticleEffect.h" #include <osg/Group> #include <osg/Geode> #include <osgParticle/Particle> #include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystemUpdater> #include <osgParticle/ModularEmitter> #include <osgParticle/ModularProgram> #include <osgParticle/RandomRateCounter> #include <osgParticle/SectorPlacer> #include <osgParticle/RadialShooter> #include <osgParticle/AccelOperator> #include <osgParticle/FluidFrictionOperator> #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #endif #include "tcParticlePlacer.h" ////////////////////////////////////////////////////////////////////////////// // CUSTOM OPERATOR CLASS ////////////////////////////////////////////////////////////////////////////// // This class demonstrates Operator subclassing. This way you can create // custom operators to apply your motion effects to the particles. See docs // for more details. class VortexOperator: public osgParticle::Operator { public: VortexOperator() : osgParticle::Operator(), center_(0, 0, 0), axis_(0, 0, 1), intensity_(0.1f) {} VortexOperator(const VortexOperator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY) : osgParticle::Operator(copy, copyop), center_(copy.center_), axis_(copy.axis_), intensity_(copy.intensity_) {} META_Object(osgParticle, VortexOperator); void setCenter(const osg::Vec3 &c) { center_ = c; } void setAxis(const osg::Vec3 &a) { axis_ = a / a.length(); } // this method is called by ModularProgram before applying // operators on the particle set via the operate() method. void beginOperate(osgParticle::Program *prg) { // we have to check whether the reference frame is relative to parents // or it's absolute; in the first case, we must transform the vectors // from local to world space. if (prg->getReferenceFrame() == osgParticle::Program::RELATIVE_TO_PARENTS) { // transform the center point (full transformation) xf_center_ = prg->transformLocalToWorld(center_); // transform the axis vector (only rotation and scale) xf_axis_ = prg->rotateLocalToWorld(axis_); } else { xf_center_ = center_; xf_axis_ = axis_; } } // apply a vortex-like acceleration. This code is not optimized, // it's here only for demonstration purposes. void operate(osgParticle::Particle *P, double dt) { float l = xf_axis_ * (P->getPosition() - xf_center_); osg::Vec3 lc = xf_center_ + xf_axis_ * l; osg::Vec3 R = P->getPosition() - lc; osg::Vec3 v = (R ^ xf_axis_) * P->getMassInv() * intensity_; // compute new position osg::Vec3 newpos = P->getPosition() + v * dt; // update the position of the particle without modifying its // velocity vector (this is unusual, normally you should call // the Particle::setVelocity() or Particle::addVelocity() // methods). P->setPosition(newpos); } protected: virtual ~VortexOperator() {} private: osg::Vec3 center_; osg::Vec3 xf_center_; osg::Vec3 axis_; osg::Vec3 xf_axis_; float intensity_; }; osgParticle::ParticleSystemUpdater* tcParticleEffect::particleSystemUpdater = NULL; void tcParticleEffect::SetParticleSystemUpdater(osgParticle::ParticleSystemUpdater* psu) { particleSystemUpdater = psu; } void tcParticleEffect::AddToSceneGraph(osg::Group* rootGroup) { if (root) { std::cerr << "Warning - tcParticleEffect already added to scene graph, " "detaching first\n"; DetachFromSceneGraph(); } root = rootGroup; // add the emitter to the scene graph wxASSERT(emitter.valid()); root->addChild(emitter.get()); // add program to the scene graph wxASSERT(program.valid()); root->addChild(program.get()); // add top-level geode to scene graph wxASSERT(geode.valid()); root->addChild(geode.get()); // add the updater node to the scene graph wxASSERT(updater.valid()); root->addChild(updater.get()); } /** * Configures particle template based on smoke mode */ void tcParticleEffect::ConfigureForMode() { osgParticle::Particle ptemplate; counter->setRateRange(30, 50); switch (smokeMode) { case MISSILE: { ptemplate.setLifeTime(3); // 3 seconds of life ptemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); ptemplate.setAlphaRange(osgParticle::rangef(0.0f, 1.5f)); ptemplate.setColorRange(osgParticle::rangev4( osg::Vec4(0.8f, 0.8f, 0.8f, 1.5f), osg::Vec4(0, 0.7f, 1.0f, 0.0f))); ptemplate.setRadius(1.5f); // 5 cm wide particles ptemplate.setMass(0.05f); // 50 g heavy shooter->setInitialSpeedRange(0, 0); accelOp->setAcceleration(osg::Vec3(0, 0, 0)); } break; case AFTERBURNER: { ptemplate.setLifeTime(3); // 3 seconds of life ptemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); ptemplate.setAlphaRange(osgParticle::rangef(0.0f, 1.5f)); ptemplate.setColorRange(osgParticle::rangev4( osg::Vec4(0.8f, 0.6f, 0.6f, 1.5f), osg::Vec4(0, 0.7f, 1.0f, 0.0f))); ptemplate.setRadius(0.5f); // 5 cm wide particles ptemplate.setMass(0.05f); // 50 g heavy shooter->setInitialSpeedRange(0, 0); accelOp->setAcceleration(osg::Vec3(0, 0, 0)); } break; case DAMAGE: { ptemplate.setLifeTime(8); // 3 seconds of life ptemplate.setSizeRange(osgParticle::rangef(2.5f, 5.0f)); ptemplate.setAlphaRange(osgParticle::rangef(0.0f, 1.5f)); ptemplate.setColorRange(osgParticle::rangev4( osg::Vec4(0.0f, 0.0f, 0.0f, 1.5f), osg::Vec4(0.7, 0.6f, 0.6f, 0.0f))); ptemplate.setRadius(25.0f); ptemplate.setMass(0.05f); // for friction op I guess shooter->setInitialSpeedRange(3, 15); //shooter->setPhiRange(-0.5, 0.5); //shooter->setThetaRange(-0.5, 0.5); accelOp->setAcceleration(osg::Vec3(0, 0, -0.1)); //osgParticle::FluidFrictionOperator *op = new osgParticle::FluidFrictionOperator; //op->setFluidToAir(); //program->addOperator(op); } break; default: break; } setDefaultAttributes("smoke.rgb", false, false); setDefaultParticleTemplate(ptemplate); } void tcParticleEffect::DetachFromSceneGraph() { if (!root) { std::cerr << "Warning - tcParticleEffect already removed from scene graph," "skipping\n"; return; } // remove the updater node from the scene graph wxASSERT(updater.valid()); root->removeChild(updater.get()); // remove geode from scene graph wxASSERT(geode.valid()); root->removeChild(geode.get()); // remove program from scene graph wxASSERT(program.valid()); root->removeChild(program.get()); // remove emitter from scene graph wxASSERT(emitter.valid()); root->removeChild(emitter.get()); root = 0; } tcParticleEffect::tcParticleEffect(int smokeModeCode) : root(0), smokeMode(smokeModeCode) { emitter = new osgParticle::ModularEmitter; emitter->setParticleSystem(this); counter = new osgParticle::RandomRateCounter; emitter->setCounter(counter.get()); particlePlacer = new osgParticle::tcParticlePlacer; particlePlacer->setCenter(0, 0, 0); emitter->setPlacer(particlePlacer); emitter->setReferenceFrame(osgParticle::Emitter::RELATIVE_TO_ABSOLUTE); shooter = new osgParticle::RadialShooter; emitter->setShooter(shooter.get()); program = new osgParticle::ModularProgram; program->setParticleSystem(this); // create an operator that simulates the gravity acceleration. accelOp = new osgParticle::AccelOperator; program->addOperator(accelOp.get()); /* VortexOperator *op2 = new VortexOperator; op2->setCenter(osg::Vec3(8, 0, 0)); program->addOperator(op2); // fluid operator to simulate air friction. osgParticle::FluidFrictionOperator *op3 = new osgParticle::FluidFrictionOperator; op3->setFluidToAir(); program->addOperator(op3); */ ConfigureForMode(); // create a Geode to contain the particle system. geode = new osg::Geode; geode->addDrawable(this); updater = new osgParticle::ParticleSystemUpdater; updater->addParticleSystem(this); } tcParticleEffect::~tcParticleEffect() { } Index: ObjectUpdater.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/ObjectUpdater.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ObjectUpdater.cpp 11 Apr 2004 21:59:16 -0000 1.7 --- ObjectUpdater.cpp 4 Jun 2004 21:39:22 -0000 1.8 *************** *** 4,7 **** --- 4,8 ---- #include "tc3DViewer.h" #include <osg/MatrixTransform> + #include "tcParticleEffect.h" using namespace osg; *************** *** 101,105 **** --- 102,126 ---- osg::Vec3 cameraDelta = osg::Vec3(x,y,z) - viewer->GetCameraPosition(); distanceFromCamera = cameraDelta.length(); + model->SetDistanceFromCamera(distanceFromCamera); + + if ((distanceFromCamera <= 20)&&(gameObject->parent == 0)) + { + int xx = 8; + } + /* + if ((abs(x) < 4000)&&(gameObject->parent == 0)) + { + int xx = 8; + osg::Vec3 camPos = viewer->GetCameraPosition(); + } + */ + + + if (model->IsSmokeEnabled()) + { + model->UpdateSmokePosition(x, y, z); + } + osg::Matrix m = osg::Matrix::rotate(osg::inRadians(roll),0.0f,1.0f,0.0f)* Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tc3DModel.cpp 13 Apr 2004 21:37:40 -0000 1.9 --- tc3DModel.cpp 4 Jun 2004 21:39:22 -0000 1.10 *************** *** 32,35 **** --- 32,37 ---- #include "tcPlatformObject.h" #include "ObjectUpdater.h" + #include "tcParticleEffect.h" + #include "tcParticlePlacer.h" #include "tcGenericDBObject.h" #include <osg/MatrixTransform> *************** *** 237,240 **** --- 239,245 ---- }; + + osg::ref_ptr<osg::Group> tc3DModel::world; + /** * Adds child to modelTransform of this model. *************** *** 260,263 **** --- 265,293 ---- } + /** + * Do not call this in the middle of scene graph traversal. + * This leads to a crash! + */ + void tc3DModel::DisableSmoke() + { + if (smokeTrail.valid()) + { + smokeTrail->DetachFromSceneGraph(); + smokeTrail.release(); + smokePlacer = 0; + } + } + + /** + * Do not call this in the middle of scene graph traversal. + * This leads to a crash! + */ + void tc3DModel::EnableSmoke() + { + smokeTrail = new tcParticleEffect(smokeMode); + smokeTrail->AddToSceneGraph(world.get()); + smokePlacer = smokeTrail->GetParticlePlacer(); + } + osg::ref_ptr<osg::Node> tc3DModel::GetNode() { *************** *** 350,353 **** --- 380,414 ---- /** + * Call outside of scene graph traversal + */ + void tc3DModel::UpdateEffects() + { + wxASSERT(gameObj); + + bool disableSmoke = ((smokeMode == tcParticleEffect::OFF) || + (gameObj->parent) || (distanceFromCamera > 2000)); + bool smokeDisabled = !IsSmokeEnabled(); + + if (disableSmoke != smokeDisabled) + { + if (disableSmoke) + { + DisableSmoke(); + } + else + { + EnableSmoke(); + } + } + } + + void tc3DModel::UpdateSmokePosition(float x, float y, float z) + { + wxASSERT(smokePlacer); + if (smokePlacer == 0) return; + smokePlacer->setCenter(x, y, z); + } + + /** * This constructor is used for the source/factory, notionally * stored as part of the database object. *************** *** 364,367 **** --- 425,430 ---- */ tc3DModel::tc3DModel(const tc3DModel* source) + : smokePlacer(0), + distanceFromCamera(1e10) { wxASSERT(source->modelNode.valid()); // error if modelNode not loaded yet *************** *** 398,402 **** - } --- 461,464 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:31
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/include/graphics Modified Files: tc3DModel.h Added Files: tcParticleEffect.h tcParticlePlacer.h Log Message: Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tc3DModel.h 11 Apr 2004 21:47:23 -0000 1.5 --- tc3DModel.h 4 Jun 2004 21:39:22 -0000 1.6 *************** *** 32,35 **** --- 32,41 ---- class tcGameObject; + class tcParticleEffect; + + namespace osgParticle + { + class tcParticlePlacer; + } /** *************** *** 68,89 **** --- 74,114 ---- tc3DModel* Clone(); void DetachFromParent(); + tcGameObject* GetGameObj() {return gameObj;} osg::ref_ptr<osg::Node> GetNode(); unsigned int GetNumParents(); + bool IsSmokeEnabled() const {return smokeTrail.valid();} void Load(std::string model_name); void ProcessAnimations(std::vector<animationDBInfo>& animDBInfo); void SetupAnimation(tcGameObject *obj); + void SetDistanceFromCamera(float distance) {distanceFromCamera = distance;} + void SetSmokeMode(int mode) {smokeMode = mode;} void SetupUpdate(tcGameObject *obj); + void UpdateEffects(); + void UpdateSmokePosition(float x, float y, float z); tc3DModel(); tc3DModel(const tc3DModel* source); ~tc3DModel(); + + static void SetWorldFrame(osg::Group* worldFrame) {world = worldFrame;} + + private: + osg::ref_ptr<tcParticleEffect> smokeTrail; + osgParticle::tcParticlePlacer* smokePlacer; + int smokeMode; + osg::ref_ptr<osg::LOD> modelGroup; ///< top level group for model, not shared osg::ref_ptr<osg::MatrixTransform> modelTransform; ///< positions object in world, not shared osg::ref_ptr<osg::Node> modelNode; ///< shared between instances of model + static osg::ref_ptr<osg::Group> world; + tcGameObject *gameObj; ///< game object to use to update model state bool useSmoothing; + float distanceFromCamera; + void DisableSmoke(); + void EnableSmoke(); }; --- NEW FILE: tcParticlePlacer.h --- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library 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 * OpenSceneGraph Public License for more details. */ //osgParticle - Copyright (C) 2002 Marco Jez #ifndef _TCPARTICLEPLACER_H_ #define _TCPARTICLEPLACER_H_ #include <osgParticle/CenteredPlacer> #include <osgParticle/Particle> #include <osg/CopyOp> #include <osg/Object> namespace osgParticle { /** A point-shaped particle placer. This placer class uses the center point defined in its base class <CODE>CenteredPlacer</CODE> to place there all incoming particles. */ class tcParticlePlacer: public CenteredPlacer { public: inline tcParticlePlacer(); inline tcParticlePlacer(const tcParticlePlacer ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, tcParticlePlacer); /** Place a particle. This method is called automatically by <CODE>ModularEmitter</CODE> and should not be called manually. */ inline void place(Particle *P) const; protected: virtual ~tcParticlePlacer() {} tcParticlePlacer &operator=(const tcParticlePlacer &) { return *this; } }; // INLINE FUNCTIONS inline tcParticlePlacer::tcParticlePlacer() : CenteredPlacer() { } inline tcParticlePlacer::tcParticlePlacer(const tcParticlePlacer ©, const osg::CopyOp ©op) : CenteredPlacer(copy, copyop) { } inline void tcParticlePlacer::place(Particle *P) const { P->setPosition(getCenter()); } } #endif --- NEW FILE: tcParticleEffect.h --- /** @file tcParticleEffect.h ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _TCPARTICLEEFFECT_H_ #define _TCPARTICLEEFFECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <osgParticle/ParticleSystem> #include <osgParticle/ParticleSystemUpdater> namespace osgParticle { class tcParticlePlacer; class ModularEmitter; class RadialShooter; class RandomRateCounter; class ModularProgram; class AccelOperator; } /** * osgFx-based particle effect class */ class tcParticleEffect : public osgParticle::ParticleSystem { public: enum { OFF = 0, MISSILE = 1, AFTERBURNER = 2, DAMAGE = 4 }; static void SetParticleSystemUpdater(osgParticle::ParticleSystemUpdater* psu); osgParticle::tcParticlePlacer* GetParticlePlacer() const {return particlePlacer;} void AddToSceneGraph(osg::Group* rootGroup); void DetachFromSceneGraph(); tcParticleEffect(int smokeModeCode); ~tcParticleEffect(); private: int smokeMode; osg::ref_ptr<osgParticle::ModularEmitter> emitter; osg::ref_ptr<osgParticle::RadialShooter> shooter; osg::ref_ptr<osgParticle::RandomRateCounter> counter; osg::ref_ptr<osgParticle::ModularProgram> program; osg::ref_ptr<osgParticle::AccelOperator> accelOp; osg::ref_ptr<osg::Geode> geode; osg::ref_ptr<osgParticle::ParticleSystemUpdater> updater; osgParticle::tcParticlePlacer* particlePlacer; osg::Group* root; static osgParticle::ParticleSystemUpdater* particleSystemUpdater; void ConfigureForMode(); }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:31
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924/include/sim Modified Files: tc3DViewer.h tcGameObject.h tcMissileObject.h tcSurfaceObject.h Log Message: Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcGameObject.h 29 May 2004 00:11:53 -0000 1.19 --- tcGameObject.h 4 Jun 2004 21:39:22 -0000 1.20 *************** *** 128,133 **** virtual void Serialize(tcFile& file, bool mbLoad); virtual void Update(double afStatusTime) {} ! virtual void UpdateCaptivePosition(void); ! virtual void DesignateDatum(tcPoint p) {} virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher) {} --- 128,133 ---- virtual void Serialize(tcFile& file, bool mbLoad); virtual void Update(double afStatusTime) {} ! virtual void UpdateCaptivePosition(); ! virtual void UpdateEffects(); virtual void DesignateDatum(tcPoint p) {} virtual void DesignateLauncherDatum(tcPoint p, unsigned int anLauncher) {} Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcMissileObject.h 1 May 2004 21:49:24 -0000 1.8 --- tcMissileObject.h 4 Jun 2004 21:39:22 -0000 1.9 *************** *** 56,59 **** --- 56,60 ---- void RandInitNear(float afLon_deg, float afLat_deg); virtual void Update(double afStatusTime); + virtual void UpdateEffects(); virtual void UpdateGuidance(double afStatusTime); virtual void SetHeading(float afNewHeading) {mfGoalHeading_rad=afNewHeading;} Index: tc3DViewer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tc3DViewer.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tc3DViewer.h 20 Jan 2004 03:02:52 -0000 1.22 --- tc3DViewer.h 4 Jun 2004 21:39:22 -0000 1.23 *************** *** 33,36 **** --- 33,37 ---- #include <osgUtil/Optimizer> #include <osgText/Text> + #include <osgParticle/ParticleSystemUpdater> #include "cspDate.h" *************** *** 63,66 **** --- 64,69 ---- osg::ref_ptr<osg::Group> worldObjects; ///< add unit objects to this group osg::ref_ptr<osg::Group> rootnode; + osg::ref_ptr<osgParticle::ParticleSystemUpdater> particleSystemUpdater; + osgUtil::Optimizer optimizer; tc3DTerrain *terrainManager; Index: tcSurfaceObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSurfaceObject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcSurfaceObject.h 13 Feb 2004 01:31:32 -0000 1.6 --- tcSurfaceObject.h 4 Jun 2004 21:39:22 -0000 1.7 *************** *** 43,46 **** --- 43,47 ---- virtual void RandInitNear(float afLon_deg, float afLat_deg); virtual void Update(double afStatusTime); + virtual void UpdateEffects(); virtual void UpdateHeading(float dt_s); |
|
From: Dewitt C. <ddc...@us...> - 2004-06-04 21:39:30
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4924 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** GCblue.vcproj 24 May 2004 00:14:44 -0000 1.53 --- GCblue.vcproj 4 Jun 2004 21:39:15 -0000 1.54 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32d.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" --- 39,43 ---- Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32d.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib Gdiplus.lib GLaux.lib OpenAL32.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" *************** *** 270,273 **** --- 270,276 ---- </File> <File + RelativePath=".\src\graphics\tcParticleEffect.cpp"> + </File> + <File RelativePath="src\graphics\tcRadioButton.cpp"> </File> *************** *** 655,658 **** --- 658,667 ---- </File> <File + RelativePath=".\include\graphics\tcParticleEffect.h"> + </File> + <File + RelativePath=".\include\graphics\tcParticlePlacer.h"> + </File> + <File RelativePath="include\graphics\tcRadioButton.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-05-29 00:12:05
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18876/src/sim Modified Files: Game.cpp tcLauncher.cpp tcLauncherState.cpp tcPlatformObject.cpp tcRadar.cpp Log Message: Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcLauncher.cpp 24 May 2004 00:14:47 -0000 1.1 --- tcLauncher.cpp 29 May 2004 00:11:54 -0000 1.2 *************** *** 32,35 **** --- 32,90 ---- * */ + tcCreateStream& tcLauncher::operator<<(tcCreateStream& stream) + { + return stream; + } + + + /** + * + */ + tcCreateStream& tcLauncher::operator>>(tcCreateStream& stream) + { + + return stream; + } + + + /** + * Loads state from update stream + */ + tcUpdateStream& tcLauncher::operator<<(tcUpdateStream& stream) + { + stream >> mfTimeToReady; + stream >> mnCurrent; + + if (mnUncommitted > mnCurrent) mnUncommitted = mnCurrent; + + stream >> errorCode; + if (errorCode != 0) + { + mnUncommitted = mnCurrent; + } + + return stream; + } + + /** + * Saves state to update stream + */ + tcUpdateStream& tcLauncher::operator>>(tcUpdateStream& stream) + { + + stream << mfTimeToReady; + stream << mnCurrent; + stream << errorCode; + + return stream; + } + + + + + + /** + * + */ tcCommandStream& tcLauncher::operator<<(tcCommandStream& stream) { *************** *** 92,138 **** } - /** - * - */ - tcCreateStream& tcLauncher::operator<<(tcCreateStream& stream) - { - return stream; - } - - /** - * Loads state from update stream - */ - tcUpdateStream& tcLauncher::operator<<(tcUpdateStream& stream) - { - stream >> mfTimeToReady; - stream >> mnCurrent; - if (mnUncommitted > mnCurrent) mnUncommitted = mnCurrent; - - return stream; - } - - /** - * Saves state to update stream - */ - tcUpdateStream& tcLauncher::operator>>(tcUpdateStream& stream) - { - - stream << mfTimeToReady; - stream << mnCurrent; - - return stream; - } - - - - /** - * - */ - tcCreateStream& tcLauncher::operator>>(tcCreateStream& stream) - { - - return stream; - } - --- 147,150 ---- Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcPlatformObject.cpp 24 May 2004 00:14:47 -0000 1.23 --- tcPlatformObject.cpp 29 May 2004 00:11:54 -0000 1.24 *************** *** 232,235 **** --- 232,236 ---- void tcPlatformObject::UpdateSensors(double t) { + if (clientMode) return; // no sensor update for client unsigned nSensors = mapSensorState.size(); for(unsigned n=0;n<nSensors;n++) Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** Game.cpp 24 May 2004 00:14:47 -0000 1.80 --- Game.cpp 29 May 2004 00:11:54 -0000 1.81 *************** *** 89,92 **** --- 89,97 ---- END_EVENT_TABLE() + + + tcSoundConsole* tcGame::messageConsole = NULL; + + /** * The tcGame object constructor. *************** *** 156,159 **** --- 161,165 ---- delete pythonInterface; } + messageConsole = NULL; Finish(); *************** *** 201,204 **** --- 207,221 ---- } + /** + * Static method to display generic message to user in game + */ + void tcGame::DisplayMessage(const char* msg) + { + if (messageConsole) + { + messageConsole->Print(msg); + } + } + /** *************** *** 678,681 **** --- 695,699 ---- infoConsole = new tcSoundConsole(glCanvas, wxPoint(mrectLowerLeft.left,mrectLowerLeft.top), wxSize(200,200)); + messageConsole = infoConsole; if (!infoConsole) Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcLauncherState.cpp 24 May 2004 00:14:47 -0000 1.9 --- tcLauncherState.cpp 29 May 2004 00:11:54 -0000 1.10 *************** *** 34,37 **** --- 34,43 ---- tcSimState* tcLauncherState::simState = NULL; + class tcGame + { + public: + static void DisplayMessage(const char* msg); + }; + /** * @param anKey, key of launcher database object in database *************** *** 89,92 **** --- 95,100 ---- new_launcher.pointingAngle = azimuth_rad; new_launcher.fireControlSensor = NULL; + new_launcher.errorCode = 0; + // set detailed launch mode if missile tcMissileDBObject* pMissileDBObj = *************** *** 180,183 **** --- 188,213 ---- wxASSERT(parent); + + // will launch and either proceed unguided or autonomously search out target + if (ldata.meLaunchMode == AUTO) + { + bool hasDatum = (ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0); + bool hasTarget = (ldata.mnTargetID == NULL_INDEX); + if ((!hasDatum) && (!hasTarget)) + { + return NO_TARGET; + } + else + { + return LAUNCHER_READY; + } + } + + // if running as multiplayer client, seeker track can't be checked so defer checking to server + if (parent->IsClientMode()) + { + return LAUNCHER_READY; + } + tcGameObject *targetObj = simState->GetObject(ldata.mnTargetID); *************** *** 227,244 **** } ! // will launch and either proceed unguided or autonomously search out target ! if (ldata.meLaunchMode == AUTO) ! { ! bool hasDatum = (ldata.msDatum.mfLat_rad != 0) || (ldata.msDatum.mfLon_rad != 0); ! bool hasTarget = (ldata.mnTargetID == NULL_INDEX); ! if ((!hasDatum) && (!hasTarget)) ! { ! return NO_TARGET; ! } ! else ! { ! return LAUNCHER_READY; ! } ! } return LAUNCHER_ERROR; // bad meLaunchMode --- 257,261 ---- } ! return LAUNCHER_ERROR; // bad meLaunchMode *************** *** 262,266 **** * This only handles one launch per call (not efficient for simultaneous launches) */ ! void tcLauncherState::Launch(tnPoolIndex& key, unsigned& nLauncher) { for (int n=0; n<mnCount; n++) --- 279,283 ---- * This only handles one launch per call (not efficient for simultaneous launches) */ ! void tcLauncherState::Launch(long& key, unsigned& nLauncher) { for (int n=0; n<mnCount; n++) *************** *** 273,283 **** if (bLaunch) { ! pLauncher->mnCurrent--; ! key = pLauncher->mnChildDBKey; ! nLauncher = n; ! pLauncher->mfTimeToReady = 2.0f; // TODO: add db parameter for this ! return; } } } key = NULL_INDEX; --- 290,326 ---- if (bLaunch) { ! /* If no error is set, then check for a new error. ! ** If this is a multiplayer client object, the only way to clear ! ** an error is for the client to remove the launch request. ! ** If a multiplayer server obj or single-player, the launch request ! ** should never happen in the first place. This is not the best way ! ** to do this. In the future add an auto-clear, or at least an error ! ** message to test this case. ! */ ! int statusCode = pLauncher->GetErrorCode(); ! if (statusCode == 0) ! { ! statusCode = GetLauncherStatus(nLauncher); ! pLauncher->SetErrorCode(statusCode); ! } ! ! if (statusCode == LAUNCHER_READY) ! { ! pLauncher->mnCurrent--; ! key = pLauncher->mnChildDBKey; ! nLauncher = n; ! pLauncher->mfTimeToReady = 2.0f; // TODO: add db parameter for this ! return; ! } ! else ! { ! } ! } } + else + { + pLauncher->SetErrorCode(0); // clear error if not active or no launch requested + } } key = NULL_INDEX; *************** *** 318,322 **** statusCode = GetLauncherStatus(nLauncher); ! if (statusCode != tcLauncherState::LAUNCHER_READY) return statusCode; tcLauncher* pLauncher = &launchers[nLauncher]; --- 361,369 ---- statusCode = GetLauncherStatus(nLauncher); ! ! if (statusCode != tcLauncherState::LAUNCHER_READY) ! { ! return statusCode; ! } tcLauncher* pLauncher = &launchers[nLauncher]; *************** *** 467,470 **** --- 514,523 ---- tcLauncher& ldata = launchers[n]; ldata << stream; + if (int errorCode = ldata.GetErrorCode()) + { + // set the new command flag to allow the launch request to be cleared + commandObj.SetNewCommand(GetLauncherFlag(n)); + tcGame::DisplayMessage(TranslateLauncherStatus(errorCode).c_str()); + } } Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcRadar.cpp 24 May 2004 00:14:47 -0000 1.7 --- tcRadar.cpp 29 May 2004 00:11:54 -0000 1.8 *************** *** 40,44 **** tcSensorState::operator<<(stream); ! //stream >> fireControlTrackCount; stream >> illuminatorID; stream >> illuminatorSensorIdx; --- 40,44 ---- tcSensorState::operator<<(stream); ! stream >> fireControlTrackCount; stream >> illuminatorID; stream >> illuminatorSensorIdx; *************** *** 56,60 **** tcSensorState::operator>>(stream); ! //stream << fireControlTrackCount; stream << illuminatorID; stream << illuminatorSensorIdx; --- 56,60 ---- tcSensorState::operator>>(stream); ! stream << fireControlTrackCount; stream << illuminatorID; stream << illuminatorSensorIdx; |
|
From: Dewitt C. <ddc...@us...> - 2004-05-29 00:12:05
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18876/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcPlatformInterface.cpp 24 May 2004 00:14:47 -0000 1.22 --- tcPlatformInterface.cpp 29 May 2004 00:11:53 -0000 1.23 *************** *** 203,210 **** } ! float tcPlatformInterface::GetRangeToTarget() { ! tcGameObject* pGameObj = GetTargetObj(); ! if (pGameObj == NULL) {return 0;} ! return mpPlatformObj->RangeTo(*pGameObj); } --- 203,214 ---- } ! float tcPlatformInterface::GetRangeToTarget() ! { ! tcSensorMapTrack track; ! if (!GetTargetTrack(track)) ! { ! return 0; ! } ! return mpPlatformObj->mcKin.RangeToKm(track); } *************** *** 213,220 **** { tcGameObject* pGameObj = GetTargetObj(); - if (pGameObj == NULL) {return false;} // target not found, do nothing ! // return truth data if own alliance ! if (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance)) { tcKinematics *pTargetKin = &pGameObj->mcKin; --- 217,225 ---- { tcGameObject* pGameObj = GetTargetObj(); ! /* return truth data if obj found and own alliance ! ** On client machine, only own-alliance objects exist in sim state ! */ ! if (pGameObj && (mpSimState->mpUserInfo->IsOwnAlliance(pGameObj->mnAlliance))) { tcKinematics *pTargetKin = &pGameObj->mcKin; *************** *** 231,238 **** return true; } ! else { tcSensorMapTrack *smtrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(pGameObj->mnID,mpPlatformObj->mnAlliance); if (smtrack) { --- 236,243 ---- return true; } ! else // check for sensor track { tcSensorMapTrack *smtrack = ! mpSimState->mcSensorMap.GetSensorMapTrack(GetTarget(), mpPlatformObj->mnAlliance); if (smtrack) { *************** *** 251,261 **** ! bool tcPlatformInterface::IsLauncherEffective(int anLauncher) { tcLauncherInfo info; ! if (GetLauncherInfo(info, anLauncher) == false) { return false; } tcSensorMapTrack track; ! if (GetTargetTrack(track) == false) { return false; } --- 256,269 ---- ! bool tcPlatformInterface::IsLauncherEffective(int anLauncher) ! { tcLauncherInfo info; ! if (GetLauncherInfo(info, anLauncher) == false) ! { return false; } tcSensorMapTrack track; ! if (GetTargetTrack(track) == false) ! { return false; } *************** *** 324,345 **** best.mfRange_km = 0; ! tcGameObject* pGameObj = GetTargetObj(); ! if (pGameObj == NULL) {return best;} // get range to target ! float mfTargetRange = mpPlatformObj->RangeTo(*pGameObj); // set target type int nTargetType; ! if (dynamic_cast<tcSurfaceObject*>(pGameObj)) { nTargetType = SURFACE_TARGET; } ! else if (dynamic_cast<tcAirObject*>(pGameObj)) { nTargetType = AIR_TARGET; } ! else if (dynamic_cast<tcMissileObject*>(pGameObj)) { nTargetType = MISSILE_TARGET; } ! else { nTargetType = 0; // error, unknown target type } --- 332,358 ---- best.mfRange_km = 0; ! tcSensorMapTrack track; ! if (!GetTargetTrack(track)) {return best;} // get range to target ! float mfTargetRange = mpPlatformObj->mcKin.RangeToKm(track); // set target type int nTargetType; ! ! if (track.IsSurface()) ! { nTargetType = SURFACE_TARGET; } ! else if (track.IsAir()) ! { nTargetType = AIR_TARGET; } ! else if (track.IsMissile()) ! { nTargetType = MISSILE_TARGET; } ! else ! { nTargetType = 0; // error, unknown target type } *************** *** 348,364 **** // or shortest range launcher if target is in range int nCount = GetLauncherCount(); ! for (int n=0;n<nCount;n++) { tcLauncherInfo info; ! if (GetLauncherInfo(info, n)) { int bCompatible = info.mnTargetFlags & nTargetType; bool bInRange = info.mfRange_km <= mfTargetRange; ! if (bCompatible && info.mnQuantity) { ! if (best.mnLauncher == -1) { best = info; } ! else if (bInRange && (info.mfRange_km < best.mfRange_km)) { best = info; } ! else if (info.mfRange_km > best.mfRange_km) { best = info; } --- 361,383 ---- // or shortest range launcher if target is in range int nCount = GetLauncherCount(); ! for (int n=0;n<nCount;n++) ! { tcLauncherInfo info; ! if (GetLauncherInfo(info, n)) ! { int bCompatible = info.mnTargetFlags & nTargetType; bool bInRange = info.mfRange_km <= mfTargetRange; ! if (bCompatible && info.mnQuantity) ! { ! if (best.mnLauncher == -1) ! { best = info; } ! else if (bInRange && (info.mfRange_km < best.mfRange_km)) ! { best = info; } ! else if (info.mfRange_km > best.mfRange_km) ! { best = info; } *************** *** 454,458 **** if (launcherStatus != tcLauncherState::LAUNCHER_READY) { - DisplayMessage(tcLauncherState::TranslateLauncherStatus(launcherStatus)); } --- 473,476 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-05-29 00:12:03
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18876/include/sim Modified Files: Game.h tcGameObject.h tcLauncher.h Log Message: Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcGameObject.h 1 May 2004 21:49:24 -0000 1.18 --- tcGameObject.h 29 May 2004 00:11:53 -0000 1.19 *************** *** 145,148 **** --- 145,150 ---- virtual int SetLaunch(int anLauncher, int anQuantity) {return 9;} virtual void SetFormation(tsFormationParameters asFP) {} + + static bool IsClientMode() {return clientMode;} static void SetClientMode(bool state) {clientMode = state;} static void SetGameObjectDatabase(Database::tcDatabase *db) {database = db;} Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcLauncher.h 24 May 2004 00:14:46 -0000 1.1 --- tcLauncher.h 29 May 2004 00:11:53 -0000 1.2 *************** *** 65,68 **** --- 65,69 ---- unsigned int mnCurrent; unsigned int mnUncommitted; ///< mnCurrent - mnUncommitted = # pending launch + int errorCode; ///< used in multiplayer to pass error code to client tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance *************** *** 85,88 **** --- 86,92 ---- bool CommandInfoMatches(const tcLauncher& launcher); void CopyCommandInfoFrom(const tcLauncher& launcher); + + int GetErrorCode() const {return errorCode;} + void SetErrorCode(int code) {errorCode = code;} }; #endif \ No newline at end of file Index: Game.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/Game.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Game.h 9 May 2004 20:40:21 -0000 1.36 --- Game.h 29 May 2004 00:11:53 -0000 1.37 *************** *** 266,269 **** --- 266,272 ---- void InitializeTacticalMap(); + static tcSoundConsole* messageConsole; + static void DisplayMessage(const char* msg); + tcGame(const wxPoint& pos, const wxSize& size); virtual ~tcGame(); |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:15:51
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/include/database Modified Files: tcLauncherDBObject.h Log Message: Multiplayer changes Index: tcLauncherDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcLauncherDBObject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcLauncherDBObject.h 28 Mar 2004 23:12:27 -0000 1.5 --- tcLauncherDBObject.h 24 May 2004 00:14:45 -0000 1.6 *************** *** 2,6 **** ** tcLauncherDBObject.h ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcLauncherDBObject.h ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:15:27
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112/docs Modified Files: CHANGES.txt Log Message: Multiplayer changes Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CHANGES.txt 8 May 2004 21:25:24 -0000 1.19 --- CHANGES.txt 24 May 2004 00:14:44 -0000 1.20 *************** *** 3,7 **** 0.6 --------------------------------------------------------------------- ! *** 2004-05-XX Dewitt Colclough *** - Added sensor update to multiplayer - Converted tcOptions into a singleton class --- 3,13 ---- 0.6 --------------------------------------------------------------------- ! *** 2004-05-23 Dewitt Colclough *** ! - Added launch (datum) and sensor activate/deactivate to commands ! supported by client. Launch at target needs work. Single-play mode ! is "cheating" by directly accessing sim object for target. This obj ! isn't available (and shouldn't be available) on client, just the sensor track. ! ! *** 2004-05-15 Dewitt Colclough *** - Added sensor update to multiplayer - Converted tcOptions into a singleton class |
|
From: Dewitt C. <ddc...@us...> - 2004-05-24 00:15:27
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26112 Modified Files: GCblue.vcproj Log Message: Multiplayer changes Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** GCblue.vcproj 9 May 2004 20:40:18 -0000 1.52 --- GCblue.vcproj 24 May 2004 00:14:44 -0000 1.53 *************** *** 344,347 **** --- 344,350 ---- </File> <File + RelativePath=".\src\sim\tcCommandObject.cpp"> + </File> + <File RelativePath="src\sim\tcCreditView.cpp"> </File> *************** *** 389,392 **** --- 392,398 ---- </File> <File + RelativePath=".\src\sim\tcLauncher.cpp"> + </File> + <File RelativePath="src\sim\tcLauncherState.cpp"> </File> *************** *** 723,726 **** --- 729,735 ---- </File> <File + RelativePath=".\include\sim\tcCommandObject.h"> + </File> + <File RelativePath="include\sim\tcCreditView.h"> </File> *************** *** 768,771 **** --- 777,783 ---- </File> <File + RelativePath=".\include\sim\tcLauncher.h"> + </File> + <File RelativePath="include\sim\tcLauncherState.h"> </File> |