[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.68,1.69 tcCreditView.cpp,1.9,1.10 tcMapView.cpp,1.19,1.20
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-03-20 18:56:48
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4103/src/sim Modified Files: Game.cpp tcCreditView.cpp tcMapView.cpp tcNetworkView.cpp tcScenarioSelectView.cpp tcTerrainView.cpp Log Message: Moved 2D surface creation code into tcWindow. Created docs folder Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcNetworkView.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcNetworkView.cpp 6 Mar 2004 20:52:29 -0000 1.6 --- tcNetworkView.cpp 20 Mar 2004 18:46:47 -0000 1.7 *************** *** 200,210 **** tcNetworkView::tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcStandardWindow(parent, pos, size, "xml/network_view.xml", name), networkMode(0) { wxASSERT(surfaceHost); - ShareSurfaceWith(surfaceHost); - LoadBackgroundImage("background.jpg"); --- 200,208 ---- tcNetworkView::tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcStandardWindow(parent, pos, size, "xml/network_view.xml", name, surfaceHost), networkMode(0) { wxASSERT(surfaceHost); LoadBackgroundImage("background.jpg"); Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCreditView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcCreditView.cpp 29 Feb 2004 22:51:36 -0000 1.9 --- tcCreditView.cpp 20 Mar 2004 18:46:46 -0000 1.10 *************** *** 324,329 **** tcCreditView::tcCreditView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcWindow(parent, pos, size, name) { mpFont = NULL; --- 324,330 ---- tcCreditView::tcCreditView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name, tcWindow *sharedSurface) ! : tcWindow(parent, pos, size, name, sharedSurface) { mpFont = NULL; *************** *** 335,339 **** } ! tcCreditView::~tcCreditView() { if (mpFont != NULL) {delete mpFont;} if (mpFontLarge != NULL) {delete mpFontLarge;} --- 336,341 ---- } ! tcCreditView::~tcCreditView() ! { if (mpFont != NULL) {delete mpFont;} if (mpFontLarge != NULL) {delete mpFontLarge;} Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcScenarioSelectView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcScenarioSelectView.cpp 29 Feb 2004 22:51:36 -0000 1.13 --- tcScenarioSelectView.cpp 20 Mar 2004 18:46:47 -0000 1.14 *************** *** 492,497 **** tcScenarioSelectView::tcScenarioSelectView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, const wxString& name) ! : tcWindow(parent, pos, size, name) { mpOptions = NULL; --- 492,498 ---- tcScenarioSelectView::tcScenarioSelectView(wxWindow *parent, ! const wxPoint& pos, const wxSize& size, ! const wxString& name, tcWindow *sharedSurface) ! : tcWindow(parent, pos, size, name, sharedSurface) { mpOptions = NULL; *************** *** 517,521 **** } ! tcScenarioSelectView::~tcScenarioSelectView() { if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} --- 518,523 ---- } ! tcScenarioSelectView::~tcScenarioSelectView() ! { if (mpFont != NULL) {delete mpFont;} if (mpBrush != NULL) {delete mpBrush;} Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcMapView.cpp 29 Feb 2004 22:51:36 -0000 1.19 --- tcMapView.cpp 20 Mar 2004 18:46:46 -0000 1.20 *************** *** 201,205 **** } /***********************************************************************************/ ! void tcMapView::SetView(tcPoint center, float afLonSpan) { float fLatSpan; float fMaxLonSpan, fMaxLatSpan; --- 201,206 ---- } /***********************************************************************************/ ! void tcMapView::SetView(tcPoint center, float afLonSpan) ! { float fLatSpan; float fMaxLonSpan, fMaxLatSpan; *************** *** 213,217 **** if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} fLatSpan = afLonSpan*mnHeight/mnWidth; ! if (fLatSpan > fMaxLatSpan) { fLatSpan = fMaxLatSpan; afLonSpan = fLatSpan*mnWidth/mnHeight; --- 214,219 ---- if (afLonSpan > fMaxLonSpan) {afLonSpan = fMaxLonSpan;} fLatSpan = afLonSpan*mnHeight/mnWidth; ! if (fLatSpan > fMaxLatSpan) ! { fLatSpan = fMaxLatSpan; afLonSpan = fLatSpan*mnWidth/mnHeight; *************** *** 223,227 **** mrectCurrentView = newview; ! if (newview.left > newview.right) { WTLC("wrap error"); } --- 225,230 ---- mrectCurrentView = newview; ! if (newview.left > newview.right) ! { WTLC("wrap error"); } *************** *** 230,234 **** } /***********************************************************************************/ ! void tcMapView::SetActive(bool abActive) { tcWindow::SetActive(abActive); terrainView->SetActive(abActive); --- 233,238 ---- } /***********************************************************************************/ ! void tcMapView::SetActive(bool abActive) ! { tcWindow::SetActive(abActive); terrainView->SetActive(abActive); *************** *** 241,255 **** } */ ! /***********************************************************************************/ ! int tcMapView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { ! if (mpMapData == NULL) { ! wxMessageBox("Error - tcMapView - CreateSurfaces called before attaching tcMapData obj"); ! } ! else { ! if (terrainView->CreateSurfaces(apGraphicsEngine) == false) {return false;} ! } ! WTL("tcMapView - CreateSurfaces - called"); ! return tcWindow::CreateSurfaces(apGraphicsEngine); // MapView on top of TerrainView ! } --- 245,249 ---- } */ ! *************** *** 258,265 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) { - terrainView = new tcTerrainView(parent, pos, size); - if (!terrainView) {wxMessageBox("terrainView init failed\n");} mpCommandInterface = NULL; --- 252,258 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name), ! terrainView(NULL) { mpCommandInterface = NULL; *************** *** 314,317 **** --- 307,311 ---- * tc2DGraphicsSurface bitmap. */ + /* int tcTacticalMapView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { *************** *** 328,331 **** --- 322,326 ---- return tcWindow::CreateSurfaces(apGraphicsEngine); // MapView on top of TerrainView } + */ /***********************************************************************************/ *************** *** 502,506 **** /***********************************************************************************/ ! int tcTacticalMapView::Draw() { Graphics *pGraphics; int i; --- 497,502 ---- /***********************************************************************************/ ! int tcTacticalMapView::Draw() ! { Graphics *pGraphics; int i; *************** *** 1391,1395 **** } /***********************************************************************************/ ! void tcTacticalMapView::Init() { tcPoint p; --- 1387,1392 ---- } /***********************************************************************************/ ! void tcTacticalMapView::Init() ! { tcPoint p; *************** *** 1615,1622 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! //terrainView = new tcTerrainView(parent, pos, size); ! //if (!terrainView) {wxMessageBox("terrainView init failed\n");} mbBypassPythonCallback = false; mnCounter = 0; --- 1612,1626 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) ! { ! terrainView = new tcTerrainView(parent, pos, size, true); ! if (!terrainView) ! { ! wxMessageBox("terrainView init failed\n"); ! } ! ! tcWindow::MoveToTop(); // so that color elevation map is underneath ! mbBypassPythonCallback = false; mnCounter = 0; *************** *** 1836,1843 **** const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! terrainView = new tcTerrainView(parent, pos, size); ! terrainView->SetActive(false); mnCounter = 0; ClearMapObjects(); --- 1840,1848 ---- const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcMapView(parent, pos, size, name) { ! terrainView = new tcTerrainView(parent, pos, size, false); ! if (!terrainView) {wxMessageBox("terrainView init failed\n");} ! mnCounter = 0; ClearMapObjects(); Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTerrainView.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcTerrainView.cpp 1 Feb 2004 22:19:09 -0000 1.8 --- tcTerrainView.cpp 20 Mar 2004 18:46:47 -0000 1.9 *************** *** 2,6 **** ** tcTerrainView.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcTerrainView.cpp ** ! ** Copyright (C) 2003-2004 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. *************** *** 116,120 **** mp2DSurface->SetRenderTexture(true); - mp2DSurface->SetActive(true); mp2DSurface->mbModified = true; --- 116,119 ---- *************** *** 161,165 **** mp2DSurface->mbModified = true; mp2DSurface->SetRenderTexture(mbTextureMaps); - mp2DSurface->SetActive(true); return true; --- 160,163 ---- *************** *** 212,221 **** tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name) : ! tcWindow(parent, pos, size, name) { mpMapData = NULL; mpOptions = NULL; - mbHighRes = true; // set true for high resolution surface SetResizeable2D(false); // do not resize 2D surface on resize } --- 210,220 ---- tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, + bool isHighRes, const wxString& name) : ! mbHighRes(isHighRes), ! tcWindow(parent, pos, size, name) { mpMapData = NULL; mpOptions = NULL; SetResizeable2D(false); // do not resize 2D surface on resize } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Game.cpp 6 Mar 2004 20:52:29 -0000 1.68 --- Game.cpp 20 Mar 2004 18:46:46 -0000 1.69 *************** *** 196,213 **** } /** ! * Skips to the end of the briefing and starts game */ ! void tcGame::SkipBriefing(wxCommandEvent& event) ! { ! if (meScreenMode != TACTICALBRIEF) return; // ignore if not in tactical briefing mode ! directorTime = 1e10; // set directorTime to large value to skip to end ! ! // deactivate delayed text so that briefing text is quickly available ! briefingConsoleLeft->SetDelayedTextEffect(false); ! } ! ! void tcGame::StartGame(wxCommandEvent& event) { if (InitGame()) { --- 196,206 ---- } + /** ! * Ends game and returns to start screen */ ! void tcGame::EndGame(wxCommandEvent& event) { + /* if (InitGame()) { *************** *** 243,246 **** --- 236,271 ---- wxMessageBox("Error starting game","ERROR",wxICON_ERROR); } + */ + } + + + /** + * Skips to the end of the briefing and starts game + */ + void tcGame::SkipBriefing(wxCommandEvent& event) + { + if (meScreenMode != TACTICALBRIEF) return; // ignore if not in tactical briefing mode + directorTime = 1e10; // set directorTime to large value to skip to end + + // deactivate delayed text so that briefing text is quickly available + briefingConsoleLeft->SetDelayedTextEffect(false); + } + + void tcGame::StartGame(wxCommandEvent& event) + { + if (InitGame()) + { + optionsView->SetActive(false); + startView->SetActive(false); + creditView->SetActive(false); + scenarioSelectView->SetActive(false); + + meGameMode = GM_PLAY; + meScreenMode = TACTICAL; + } + else + { + wxMessageBox("Error starting game","ERROR",wxICON_ERROR); + } } *************** *** 346,352 **** /* ** Init graphics engine * **/ ! mpGraphicsEngine = new tcGraphicsEngine; ! InitializeStartView(); InitializeOptionsView(); InitializeCreditView(); --- 371,379 ---- /* ** Init graphics engine * **/ ! mpGraphicsEngine = tcGraphicsEngine::Get(); ! /* start view has to be initialized first so that we can ! share its 2D surface with the other windows */ ! InitializeStartView(); InitializeOptionsView(); InitializeCreditView(); *************** *** 358,361 **** --- 385,389 ---- /*** Init edit control ***/ editControl = new tcEditControl(glCanvas, wxPoint(200,200),wxSize(100,50)); + editControl->SetActive(false); mcDatabase.LoadDBCSV(); *************** *** 467,477 **** startView = new tcStartView(glCanvas, wxPoint(0,0), frameSize); - startView->SetYMirror(mnHeight); - - if (!startView->CreateSurfaces(mpGraphicsEngine)) - { - throw exception(); - } - startView->AttachOptions(&mcOptions); startView->LoadBackgroundImage("start_background.jpg"); --- 495,498 ---- *************** *** 491,502 **** void tcGame::InitializeOptionsView() { ! optionsView = new tcOptionsView(glCanvas, wxPoint(0,0), frameSize); ! ! optionsView->SetYMirror(mnHeight); ! ! if(!optionsView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } optionsView->AttachOptions(&mcOptions); --- 512,518 ---- void tcGame::InitializeOptionsView() { ! wxASSERT(startView); ! optionsView = new tcOptionsView(glCanvas, wxPoint(0,0), frameSize, ! "OptionsView", startView); optionsView->AttachOptions(&mcOptions); *************** *** 517,522 **** { networkView = new tcNetworkView(glCanvas, startView, wxPoint(0,0), frameSize); - networkView->SetYMirror(mnHeight); - networkView->SetActive(false); } --- 533,536 ---- *************** *** 535,543 **** throw "briefingConsoleLeft init failed\n"; } ! briefingConsoleLeft->SetYMirror(mnHeight); ! if(!briefingConsoleLeft->CreateSurfaces(mpGraphicsEngine)) ! { ! throw "briefingConsoleLeft->CreateSurfaces failed"; ! } briefingConsoleLeft->SetEffect(SEFFECT_MUTEDBEEP); briefingConsoleLeft->InitGdi(10.0f,0xFF64FF64); --- 549,553 ---- throw "briefingConsoleLeft init failed\n"; } ! briefingConsoleLeft->SetEffect(SEFFECT_MUTEDBEEP); briefingConsoleLeft->InitGdi(10.0f,0xFF64FF64); *************** *** 559,567 **** throw "briefingConsoleBottom init failed\n"; } ! briefingConsoleBottom->SetYMirror(mnHeight); ! if(!briefingConsoleBottom->CreateSurfaces(mpGraphicsEngine)) ! { ! throw "briefingConsoleBottom->CreateSurfaces failed"; ! } briefingConsoleBottom->SetEffect(-1); briefingConsoleBottom->InitGdi(10.0f,0xFF64FF64); --- 569,573 ---- throw "briefingConsoleBottom init failed\n"; } ! briefingConsoleBottom->SetEffect(-1); briefingConsoleBottom->InitGdi(10.0f,0xFF64FF64); *************** *** 580,591 **** void tcGame::InitializeCreditView() { ! creditView = new tcCreditView(glCanvas, wxPoint(0,0), frameSize); ! ! creditView->SetYMirror(mnHeight); ! ! if(!creditView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } creditView->LoadBackgroundImage("start_background.jpg"); --- 586,592 ---- void tcGame::InitializeCreditView() { ! wxASSERT(startView); ! creditView = new tcCreditView(glCanvas, wxPoint(0,0), frameSize, ! "CreditView", startView); creditView->LoadBackgroundImage("start_background.jpg"); *************** *** 618,629 **** void tcGame::InitializeScenarioSelectView() { ! scenarioSelectView = new tcScenarioSelectView(glCanvas, wxPoint(0,0), frameSize); ! ! scenarioSelectView->SetYMirror(mnHeight); ! ! if(!scenarioSelectView->CreateSurfaces(mpGraphicsEngine)) ! { ! throw exception(); ! } scenarioSelectView->AttachSimState(&mcSimState); --- 619,625 ---- void tcGame::InitializeScenarioSelectView() { ! wxASSERT(startView); ! scenarioSelectView = new tcScenarioSelectView(glCanvas, ! wxPoint(0,0), frameSize, "ScenarioSelect", startView); scenarioSelectView->AttachSimState(&mcSimState); *************** *** 644,648 **** mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); ! tacticalMap = new tcTacticalMapView(glCanvas, wxPoint(mrectMap.left,mrectMap.top), wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; --- 640,645 ---- mrectMap.right = mnWidth; //GetSystemMetrics(SM_CXFULLSCREEN); mrectMap.bottom = mnHeight - 200; //GetSystemMetrics(SM_CYFULLSCREEN); ! tacticalMap = new tcTacticalMapView(glCanvas, wxPoint(mrectMap.left,mrectMap.top), ! wxSize(mrectMap.right-mrectMap.left, mrectMap.bottom-mrectMap.top)); tacticalMapSize = TM_LARGE; *************** *** 656,669 **** tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); - tacticalMap->SetYMirror(mnHeight); // was 200 - - if(!tacticalMap->CreateSurfaces(mpGraphicsEngine)) - { - throw "tacticalMap->CreateSurfaces failed"; - } tacticalMap->Init(); tacticalMap->SetActive(false); tacticalMap->SetBlend(true); } --- 653,661 ---- tacticalMap->AttachOptions(&mcOptions); tacticalMap->AttachCommandInterface(&mcCommandQueue); tacticalMap->Init(); tacticalMap->SetActive(false); tacticalMap->SetBlend(true); + tacticalMap->RefreshTerrainView(); } *************** *** 684,694 **** } - infoConsole->SetYMirror(mnHeight);// was -mrectLowerLeft.top - - if(!infoConsole->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - infoConsole->SetEffect(-1); //SEFFECT_MUTEDBEEP); // no sound infoConsole->InitGdi(10.0f,0xFF64FF64); --- 676,679 ---- *************** *** 709,719 **** } - hookInfo->SetYMirror(mnHeight); // was -mrectLowerLeft.top - - if(!hookInfo->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - hookInfo->LoadBackgroundImage("console_b.jpg"); hookInfo->AttachSimState(&mcSimState); --- 694,697 ---- *************** *** 732,742 **** } - objectControl->SetYMirror(mnHeight); - objectControl->LoadBackgroundImage("console_b.jpg"); ! if(!objectControl->CreateSurfaces(mpGraphicsEngine)) ! { ! return false; ! } objectControl->AttachCommandInterface(&mcCommandQueue); --- 710,715 ---- } ! objectControl->LoadBackgroundImage("console_b.jpg"); objectControl->AttachCommandInterface(&mcCommandQueue); *************** *** 759,769 **** } - oobView->SetYMirror(mnHeight); // was -mrectLowerLeft.top - oobView->LoadBackgroundImage("console_b.jpg"); ! if(!oobView->CreateSurfaces(mpGraphicsEngine)) ! { ! return false; ! } oobView->AttachMapView(tacticalMap); --- 732,737 ---- } ! oobView->LoadBackgroundImage("console_b.jpg"); oobView->AttachMapView(tacticalMap); *************** *** 787,797 **** } - popupControl->SetYMirror(mnHeight); - - if(!popupControl->CreateSurfaces(mpGraphicsEngine)) - { - return false; - } - popupControl->AttachCommandInterface(&mcCommandQueue); popupControl->AttachPythonInterface(pythonInterface); --- 755,758 ---- *************** *** 845,848 **** --- 806,811 ---- } + + bool tcGame::InitSim() { *************** *** 1383,1390 **** --- 1346,1356 ---- bool tcGame::Finish() { + mpGraphicsEngine->DeleteAllSurfaces(); + /* if (mpGraphicsEngine != NULL) { delete mpGraphicsEngine; } + */ tcSound::Get()->UnInit(); |