[Gcblue-commits] gcb_wx/src/graphics cspSky.cpp, 1.18, 1.19 tc3DModel.cpp, 1.39, 1.40 tc3DViewer.cp
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29807/src/graphics Modified Files: cspSky.cpp tc3DModel.cpp tc3DViewer.cpp tcAltitudeBarControl.cpp tcBriefingView.cpp tcContainerGui.cpp tcContainerItem.cpp tcCreditView.cpp tcDatabaseInfoPanel.cpp tcDatabaseInfoWindow.cpp tcFlightPortGui.cpp tcHookInfo.cpp tcLauncherPopup.cpp tcPlatformGui.cpp tcScenarioSelectView.cpp tcStoresGui.cpp Log Message: Index: tcDatabaseInfoPanel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoPanel.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcDatabaseInfoPanel.cpp 24 Sep 2006 19:50:20 -0000 1.3 --- tcDatabaseInfoPanel.cpp 20 Nov 2006 00:17:42 -0000 1.4 *************** *** 28,35 **** #include "tcDatabaseInfoPanel.h" #include "tcDatabaseObject.h" ! #include "tcGenericDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" #include "tcTorpedoDBObject.h" #include "tc3DModel.h" #include "tcSensorMap.h" --- 28,38 ---- #include "tcDatabaseInfoPanel.h" #include "tcDatabaseObject.h" ! #include "tcPlatformDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" #include "tcTorpedoDBObject.h" + #include "tcShipDBObject.h" + #include "tcAirDBObject.h" + #include "tcGroundDBObject.h" #include "tc3DModel.h" #include "tcSensorMap.h" *************** *** 99,110 **** PrintText(textx, texty, "Unit cost: %s", databaseObj->GetCostString()); ! PrintText(textx, texty, "%s", databaseObj->mzDescription); texty += 5.0f; ! if (tcGenericDBObject* generic = dynamic_cast<tcGenericDBObject*>(databaseObj)) { ! DrawDatabaseInfo(generic, texty); } else if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(databaseObj)) --- 102,121 ---- PrintText(textx, texty, "Unit cost: %s", databaseObj->GetCostString()); ! PrintText(textx, texty, "%s", databaseObj->mzDescription.c_str()); texty += 5.0f; ! if (tcShipDBObject* shipData = dynamic_cast<tcShipDBObject*>(databaseObj)) { ! DrawDatabaseInfo(shipData, texty); ! } ! else if (tcAirDBObject* airData = dynamic_cast<tcAirDBObject*>(databaseObj)) ! { ! DrawDatabaseInfo(airData, texty); ! } ! else if (tcGroundDBObject* groundData = dynamic_cast<tcGroundDBObject*>(databaseObj)) ! { ! DrawDatabaseInfo(groundData, texty); } else if (tcMissileDBObject* missile = dynamic_cast<tcMissileDBObject*>(databaseObj)) *************** *** 124,128 **** ! void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcGenericDBObject* genericData, float yStart) { float textx = 10.0f; --- 135,144 ---- ! void DrawDatabaseInfo(database::tcShipDBObject* shipData, float yStart); ! void DrawDatabaseInfo(database::tcAirDBObject* airData, float yStart); ! void DrawDatabaseInfo(database::tcGroundDBObject* groundData, float yStart); ! ! ! void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcShipDBObject* shipData, float yStart) { float textx = 10.0f; *************** *** 133,167 **** ! PrintText(textx, texty, "Max speed: %.0f kts", genericData->mfMaxSpeed_kts); if (IsEmbedded()) { ! PrintText(textx, texty, "Turn rate: %.1f deg/s", genericData->mfTurnRate_degps); } ! PrintText(textx, texty, "Survivability: %.0f", genericData->mfToughness); ! PrintText(textx, texty, "RCS %.0f dBsm", genericData->mfRcs_dbsm); ! if ((genericData->mfFuelRate_kgps > 0) && IsEmbedded()) { ! float fuelTimeHours = 2.778e-4 * genericData->mfFuelCapacity_kg / genericData->mfFuelRate_kgps; ! switch (genericData->mnModelType) { case MTYPE_SURFACE: case MTYPE_CARRIER: case MTYPE_AIR: ! PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * genericData->mfMaxSpeed_kts * C_NMITOKM); break; case MTYPE_FIXEDWINGX: ! PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); break; case MTYPE_HELO: PrintText(textx, texty, "Endurance %.1f hrs", 2.0f * fuelTimeHours); break; ! case MTYPE_SUBMARINE: ! PrintText(textx, texty, "Fuel capacity %.0f kg", genericData->mfFuelCapacity_kg); break; } --- 149,229 ---- ! PrintText(textx, texty, "Max speed: %.0f kts", shipData->mfMaxSpeed_kts); if (IsEmbedded()) { ! PrintText(textx, texty, "Turn rate: %.1f deg/s", shipData->mfTurnRate_degps); } ! PrintText(textx, texty, "Survivability: %.0f", shipData->mfToughness); ! PrintText(textx, texty, "RCS %.0f dBsm", shipData->RCS_dBsm); ! if ((shipData->mfFuelRate_kgps > 0) && IsEmbedded()) { ! float fuelTimeHours = 2.778e-4 * shipData->GetInternalFuelCapacity() / shipData->mfFuelRate_kgps; ! switch (shipData->mnModelType) { case MTYPE_SURFACE: case MTYPE_CARRIER: + PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * shipData->mfMaxSpeed_kts * C_NMITOKM); + break; + default: + PrintText(textx, texty, "MODEL TYPE ERROR (%d)", shipData->mnModelType); + break; + } + } + + texty += 10.0f; + DrawLauncherInfo(shipData, texty); + + texty += 10.0f; + DrawSensorInfo(shipData, texty); + + yCurrent = texty; + } + + + void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcAirDBObject* airData, float yStart) + { + float textx = 10.0f; + float maxWidth = float(mnWidth) - textx - 5.0f; + float texty = yStart; + osg::BoundingBox textBox; + osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); + + + PrintText(textx, texty, "Max speed: %.0f kts", airData->mfMaxSpeed_kts); + + if (IsEmbedded()) + { + PrintText(textx, texty, "Turn rate: %.1f deg/s", airData->mfTurnRate_degps); + } + + + PrintText(textx, texty, "Survivability: %.0f", airData->mfToughness); + + PrintText(textx, texty, "RCS %.0f dBsm", airData->RCS_dBsm); + + if ((airData->mfFuelRate_kgps > 0) && IsEmbedded()) + { + float fuelTimeHours = 2.778e-4 * airData->GetInternalFuelCapacity() / airData->mfFuelRate_kgps; + + switch (airData->mnModelType) + { case MTYPE_AIR: ! case MTYPE_FIXEDWING: ! PrintText(textx, texty, "Cruise range %.0f km", fuelTimeHours * airData->mfMaxSpeed_kts * C_NMITOKM); break; case MTYPE_FIXEDWINGX: ! PrintText(textx, texty, "Internal fuel cap %.0f kg", airData->GetInternalFuelCapacity()); break; case MTYPE_HELO: PrintText(textx, texty, "Endurance %.1f hrs", 2.0f * fuelTimeHours); break; ! default: ! PrintText(textx, texty, "MODEL TYPE ERROR (%d)", airData->mnModelType); break; } *************** *** 169,176 **** texty += 10.0f; ! DrawLauncherInfo(genericData, texty); texty += 10.0f; ! DrawSensorInfo(genericData, texty); yCurrent = texty; --- 231,273 ---- texty += 10.0f; ! DrawLauncherInfo(airData, texty); texty += 10.0f; ! DrawSensorInfo(airData, texty); ! ! yCurrent = texty; ! } ! ! ! void tcDatabaseInfoPanel::DrawDatabaseInfo(database::tcGroundDBObject* groundData, float yStart) ! { ! float textx = 10.0f; ! float maxWidth = float(mnWidth) - textx - 5.0f; ! float texty = yStart; ! osg::BoundingBox textBox; ! osg::Vec4 color(0.4f, 1.0f, 0.4f, 1.0f); ! ! ! if (groundData->mfMaxSpeed_kts > 0) ! { ! PrintText(textx, texty, "Max speed: %.0f kts", groundData->mfMaxSpeed_kts); ! ! if (IsEmbedded()) ! { ! PrintText(textx, texty, "Turn rate: %.1f deg/s", groundData->mfTurnRate_degps); ! } ! } ! ! ! PrintText(textx, texty, "Survivability: %.0f", groundData->mfToughness); ! ! PrintText(textx, texty, "RCS %.0f dBsm", groundData->RCS_dBsm); ! ! ! texty += 10.0f; ! DrawLauncherInfo(groundData, texty); ! ! texty += 10.0f; ! DrawSensorInfo(groundData, texty); yCurrent = texty; *************** *** 222,226 **** ! void tcDatabaseInfoPanel::DrawLauncherInfo(database::tcGenericDBObject* genericData, float& y) { wxASSERT(genericData != 0); --- 319,323 ---- ! void tcDatabaseInfoPanel::DrawLauncherInfo(database::tcPlatformDBObject* genericData, float& y) { wxASSERT(genericData != 0); *************** *** 258,262 **** } ! void tcDatabaseInfoPanel::DrawSensorInfo(database::tcGenericDBObject* genericData, float& y) { wxASSERT(genericData != 0); --- 355,359 ---- } ! void tcDatabaseInfoPanel::DrawSensorInfo(database::tcPlatformDBObject* genericData, float& y) { wxASSERT(genericData != 0); Index: tcFlightPortGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcFlightPortGui.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcFlightPortGui.cpp 1 Oct 2006 21:07:40 -0000 1.11 --- tcFlightPortGui.cpp 20 Nov 2006 00:17:42 -0000 1.12 *************** *** 2,7 **** ** @file tcFlightPortGui.cpp */ ! /* ! ** Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. --- 2,6 ---- ** @file tcFlightPortGui.cpp */ ! /* Copyright (C) 2005-2006 Dewitt Colclough (de...@gc...) ** All rights reserved. *************** *** 37,40 **** --- 36,41 ---- #include "tcPlatformObject.h" #include "tcSimState.h" + #include "tcStores.h" + #include "tcStoresGui.h" #include <osg/Geometry> #include "ai/tcMissionManager.h" *************** *** 134,138 **** { size_t nSlots = slots.size(); ! for (size_t n=readyOffset; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; --- 135,139 ---- { size_t nSlots = slots.size(); ! for (size_t n=readyOffset; n<magazineIdx; n++) { tcContainerSlot& slot = slots[n]; *************** *** 175,188 **** { tcContainerSlot& slot = slots[n]; ! tcEntityContainerItem* item = dynamic_cast<tcEntityContainerItem*>(slot.GetItem()); bool isMouseOver = slot.IsMouseOver(); bool unitQueuedForTakeoff = false; ! if (item) { ! int drawState = item->GetDrawState(); ! osg::Vec4 itemColor(1, 1, 1, 1); ! /* Determine item color (color mixed with image color) ** Damaged - red ** Not fully equipped and refueled - yellow --- 176,193 ---- { tcContainerSlot& slot = slots[n]; ! tcContainerItem* item = slot.GetItem(); ! tcEntityContainerItem* entityItem = dynamic_cast<tcEntityContainerItem*>(item); bool isMouseOver = slot.IsMouseOver(); bool unitQueuedForTakeoff = false; ! osg::Vec4 itemColor(1, 1, 1, 1); ! std::string caption; ! ! if (entityItem != 0) { ! int drawState = item->GetDrawState(); ! ! /* Determine entityItem color (color mixed with image color) ** Damaged - red ** Not fully equipped and refueled - yellow *************** *** 190,201 **** ** Reserved for mission - darken 50% */ ! tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(item->GetEntity()); ! if (platform != 0) { ! if (platform->GetDamageLevel() > 0) { itemColor.set(1, 0, 0, 1); } ! else if (!platform->IsReadyForLaunch()) { itemColor.set(1, 1, 0.5, 1); --- 195,206 ---- ** Reserved for mission - darken 50% */ ! tcAirObject* air = dynamic_cast<tcAirObject*>(entityItem->GetEntity()); ! if (air != 0) { ! if (air->GetDamageLevel() > 0) { itemColor.set(1, 0, 0, 1); } ! else if (!air->IsReadyForLaunch()) { itemColor.set(1, 1, 0.5, 1); *************** *** 206,218 **** } ! if (flightPort->GetMissionManager()->IsAircraftReserved(platform->mnID)) { itemColor = itemColor * 0.7; } ! unitQueuedForTakeoff = flightPort->IsQueuedForTakeoff(platform->mnID); } ! osg::Geometry* icon = slot.GetIcon(); osg::Vec4Array* colorArray = dynamic_cast<osg::Vec4Array*>(icon->getColorArray()); // assumes color array already created --- 211,234 ---- } ! if (flightPort->GetMissionManager()->IsAircraftReserved(air->mnID)) { itemColor = itemColor * 0.7; } ! unitQueuedForTakeoff = flightPort->IsQueuedForTakeoff(air->mnID); } ! // draw description caption if mouse is over slot ! if (isMouseOver) ! { ! caption = entityItem->GetDescription(); ! } ! } ! ! if (item != 0) ! { ! int drawState = item->GetDrawState(); ! ! osg::Geometry* icon = slot.GetIcon(); osg::Vec4Array* colorArray = dynamic_cast<osg::Vec4Array*>(icon->getColorArray()); // assumes color array already created *************** *** 222,234 **** ! // draw description caption if mouse is over slot ! if (isMouseOver) ! { const osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! DrawTextR(item->GetDescription().c_str(), slot.loc.GetLeft(), slot.loc.GetTop() + 15.0f, defaultFont.get(), color, 14.0f, LEFT_BASE_LINE); ! } } ! // draw expanded rectangle for slot border tcRect r = slot.loc; --- 238,256 ---- ! if (isMouseOver) ! { ! if (caption.size() == 0) ! { ! caption = item->GetItemName().c_str(); ! } ! const osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! DrawTextR(caption.c_str(), slot.loc.GetLeft(), slot.loc.GetTop() + 15.0f, defaultFont.get(), color, 14.0f, LEFT_BASE_LINE); ! } ! } ! ! // draw expanded rectangle for slot border tcRect r = slot.loc; *************** *** 352,361 **** // add hangar slots hangarOffset = GetNumSlots(); ! slotLoc.Set(hangarLoc.x, hangarLoc.x + slotSize, ! hangarLoc.y, hangarLoc.y + slotSize); size_t nRow = 0; for (size_t n=0; n<databaseObj->hangarCapacity; n++) { ! AddSlot(slotLoc); slotLoc.Offset(hangarHorizontalSpacing, 0); nRow++; --- 374,384 ---- // add hangar slots hangarOffset = GetNumSlots(); ! slotLoc.Set(hangarLoc.x, hangarLoc.x + hangarSlotSize, ! hangarLoc.y, hangarLoc.y + hangarSlotSize); size_t nRow = 0; + tcContainerGui::IconSize hangarIconSize = useSmallHangarSlots ? tcContainerGui::SMALL_ICON_SIZE : tcContainerGui::NORMAL_ICON_SIZE; for (size_t n=0; n<databaseObj->hangarCapacity; n++) { ! AddSlot(slotLoc, hangarIconSize); slotLoc.Offset(hangarHorizontalSpacing, 0); nRow++; *************** *** 366,369 **** --- 389,414 ---- } } + + // add magazine slots + magazineIdx = GetNumSlots(); + tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(tcSimState::Get()->GetObject(platformId)); + if (platform == 0) + { + wxASSERT(false); + return; + } + + slotLoc.Set(magazineLoc.x, magazineLoc.x + slotSize, + magazineLoc.y, magazineLoc.y + slotSize); + nMagazines = platform->GetMagazineCount(); + for (size_t n=0; n<nMagazines; n++) + { + AddSlot(slotLoc); + + slotLoc.Offset(magazineOffset.x, magazineOffset.y); + } + + // load icons + magazineIcon = tc3DWindow::CreateTexturedSymbol("icons\\magazine.jpg", slotSize); } *************** *** 425,429 **** size_t nSlots = slots.size(); ! for (size_t n=launchOffset; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; --- 470,474 ---- size_t nSlots = slots.size(); ! for (size_t n=launchOffset; n<magazineIdx; n++) { tcContainerSlot& slot = slots[n]; *************** *** 445,452 **** --- 490,548 ---- } + // check if cursor is over a magazine slot + for (size_t n=magazineIdx; n<magazineIdx+nMagazines; n++) + { + tcContainerSlot& slot = slots[n]; + + if (slot.loc.ContainsPoint(x, y)) + { + tcContainerItem* item = slot.GetItem(); + wxASSERT(item); + if (item == 0) return; + + tcContainerGui* gui = item->GetGui(); + + // toggle gui + if (gui == 0) + { + OpenMagazineGui(n - magazineIdx, item); + } + else + { + gui->DestroyGui(); + item->SetGui(0); + } + return; + } + } + } + + + /** + * Open magazine gui + * Copied from tcPlatformGui, needs refactoring + */ + void tcFlightPortGui::OpenMagazineGui(unsigned int idx, tcContainerItem* item) + { + tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(tcSimState::Get()->GetObject(platformId)); + if (platform == 0) return; + + tcStores* magazine = platform->GetMagazine(idx); + if (magazine) + { + wxPoint pos = wxWindow::GetPosition(); + wxSize size = wxWindow::GetSize(); + tcStoresGui* gui = new tcStoresGui(platformId, -1, idx, wxPoint(pos.x + size.GetWidth() + 10, pos.y), + "xml/stores_gui_table.xml"); + wxASSERT(item); + item->SetGui(gui); + gui->SetParentItem(item); + } + } + void tcFlightPortGui::OpenPlatformGui(tcContainerItem* item) { *************** *** 495,499 **** TiXmlElement* elt = current->ToElement(); ! double slotSizeXml = 16.0; double launchX = 0; double launchY = 0; --- 591,595 ---- TiXmlElement* elt = current->ToElement(); ! double slotSizeXml = 32.0; double launchX = 0; double launchY = 0; *************** *** 507,511 **** --- 603,613 ---- double hangarSpacingV = 10.0; int hangarRowSizeXml = 10; + double hangarSlotSizeXml = 0; + double magazineLocX = 0; + double magazineLocY = 0; + double magazineOffsetX = 0; + double magazineOffsetY = 0; + elt->Attribute("SlotSize", &slotSizeXml); elt->Attribute("LaunchX", &launchX); *************** *** 517,524 **** --- 619,633 ---- elt->Attribute("HangarX", &hangarX); elt->Attribute("HangarY", &hangarY); + elt->Attribute("HangarSlotSize", &hangarSlotSizeXml); elt->Attribute("HangarSpacingH", &hangarSpacingH); elt->Attribute("HangarSpacingV", &hangarSpacingV); elt->Attribute("HangarRowSize", &hangarRowSizeXml); + elt->Attribute("MagazineLocX", &magazineLocX); + elt->Attribute("MagazineLocY", &magazineLocY); + elt->Attribute("MagazineOffsetX", &magazineOffsetX); + elt->Attribute("MagazineOffsetY", &magazineOffsetY); + + slotSize = slotSizeXml; *************** *** 536,540 **** hangarVerticalSpacing = hangarSpacingV; hangarRowSize = hangarRowSizeXml; ! } --- 645,656 ---- hangarVerticalSpacing = hangarSpacingV; hangarRowSize = hangarRowSizeXml; ! hangarSlotSize = hangarSlotSizeXml; ! useSmallHangarSlots = ((hangarSlotSize < 32.0) && (hangarSlotSize > 0)); ! if (hangarSlotSize <= 0) hangarSlotSize = slotSize; ! ! magazineLoc.x = magazineLocX; ! magazineLoc.y = magazineLocY; ! magazineOffset.x = magazineOffsetX; ! magazineOffset.y = magazineOffsetY; } *************** *** 616,619 **** --- 732,759 ---- } + + // update magazine slots (add item if not added yet) + tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(tcSimState::Get()->GetObject(platformId)); + if (platform != 0) + { + for (size_t n=magazineIdx; n<magazineIdx+nMagazines; n++) + { + tcContainerSlot& slot = slots[n]; + + tcContainerItem* item = slot.GetItem(); + if (item == 0) + { + tcStores* magazine = platform->GetMagazine(n - magazineIdx); + const std::string& magazineName = magazine->GetDisplayName(); + item = new tcContainerItem(); + slot.SetItem(item); + item->SetIcon(magazineIcon.get()); + item->SetItemName(magazineName); + } + slot.SetUpdated(true); + } + } + + // delete items that were not updated for (size_t n=0; n<slots.size(); n++) Index: tcLauncherPopup.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcLauncherPopup.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcLauncherPopup.cpp 23 Mar 2006 01:11:02 -0000 1.12 --- tcLauncherPopup.cpp 20 Nov 2006 00:17:42 -0000 1.13 *************** *** 53,56 **** --- 53,57 ---- wxPoint tcLauncherPopup::userPositions[MAX_LAUNCHERS]; bool tcLauncherPopup::userPositionsInitialized = false; + std::map<long, bool> tcLauncherPopup::registry; const wxPoint& tcLauncherPopup::GetUserPosition(unsigned int idx) *************** *** 60,64 **** for (unsigned int k=0; k<MAX_LAUNCHERS; k++) { ! userPositions[k] = wxPoint(220 + k*210, 200); } userPositionsInitialized = true; --- 61,65 ---- for (unsigned int k=0; k<MAX_LAUNCHERS; k++) { ! userPositions[k] = wxPoint(220 + (k%3)*210, 200 + 155*(k/3)); } userPositionsInitialized = true; *************** *** 96,99 **** --- 97,192 ---- + bool tcLauncherPopup::ForceClose(long id, unsigned idx) + { + long key = GetKey(id, idx); + + std::map<long, bool>::iterator iter = + registry.find(key); + if (iter != registry.end()) + { + iter->second = true; + return true; + } + else + { + return false; // not found + } + } + + bool tcLauncherPopup::GetForceClose(long id, unsigned idx) + { + long key = GetKey(id, idx); + + std::map<long, bool>::iterator iter = + registry.find(key); + if (iter != registry.end()) + { + return iter->second; + } + else + { + fprintf(stderr, "tcLauncherPopup::GetForceClose - not in registry!\n"); + wxASSERT(false); + return false; // not found + } + } + + long tcLauncherPopup::GetKey(long id, unsigned idx) + { + return long((id << 4) + idx); + } + + void tcLauncherPopup::RegisterWindow(long id, unsigned idx) + { + long key = GetKey(id, idx); + + std::map<long, bool>::iterator iter = + registry.find(key); + + if (iter != registry.end()) + { + fprintf(stderr, "tcLauncherPopup::RegisterWindow - already exists!\n"); + wxASSERT(false); + return; + } + + registry[key] = false; + } + + void tcLauncherPopup::UnregisterWindow(long id, unsigned idx) + { + long key = GetKey(id, idx); + + std::map<long, bool>::iterator iter = + registry.find(key); + + if (iter == registry.end()) + { + fprintf(stderr, "tcLauncherPopup::UnregisterWindow - does not exist!\n"); + wxASSERT(false); + return; + } + + registry.erase(iter); + } + + + void tcLauncherPopup::UnregisterAll() + { + registry.clear(); + } + + bool tcLauncherPopup::WindowExists(long id, unsigned idx) + { + long key = GetKey(id, idx); + + std::map<long, bool>::iterator iter = + registry.find(key); + + return (iter != registry.end()); + } + + + /** * *************** *** 101,104 **** --- 194,199 ---- void tcLauncherPopup::Draw() { + if (GetForceClose(platformId, launcherIdx)) destroy = true; + if (destroy) { *************** *** 530,533 **** --- 625,630 ---- InitTorpedoControls(); + RegisterWindow(id, idx); + SetActive(true); } *************** *** 535,539 **** tcLauncherPopup::~tcLauncherPopup() { ! } --- 632,636 ---- tcLauncherPopup::~tcLauncherPopup() { ! UnregisterWindow(platformId, launcherIdx); } Index: tcDatabaseInfoWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDatabaseInfoWindow.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcDatabaseInfoWindow.cpp 20 Aug 2006 22:24:02 -0000 1.8 --- tcDatabaseInfoWindow.cpp 20 Nov 2006 00:17:42 -0000 1.9 *************** *** 28,32 **** #include "tcDatabaseInfoWindow.h" #include "tcDatabaseObject.h" ! #include "tcGenericDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" --- 28,32 ---- #include "tcDatabaseInfoWindow.h" #include "tcDatabaseObject.h" ! #include "tcPlatformDBObject.h" #include "tcLauncherDBObject.h" #include "tcMissileDBObject.h" Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** tc3DModel.cpp 5 Sep 2006 01:04:25 -0000 1.39 --- tc3DModel.cpp 20 Nov 2006 00:17:42 -0000 1.40 *************** *** 34,38 **** #include "tcParticlePlacer.h" #include "tcSound.h" ! #include "tcGenericDBObject.h" #include "tcSensorMapTrack.h" #include "tcSimState.h" --- 34,38 ---- #include "tcParticlePlacer.h" #include "tcSound.h" ! #include "tcPlatformDBObject.h" #include "tcSensorMapTrack.h" #include "tcSimState.h" *************** *** 878,882 **** if (info.param >= (int)plat->GetSensorCount()) { ! std::cerr << "sensor animation param out of range\n"; wxASSERT(0); return; --- 878,882 ---- if (info.param >= (int)plat->GetSensorCount()) { ! fprintf(stderr, "tc3DModel::SetupAnimation - Sensor animation param out of range (%s)\n", obj->mzClass.c_str()); wxASSERT(0); return; Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcHookInfo.cpp 18 Jun 2006 00:45:00 -0000 1.20 --- tcHookInfo.cpp 20 Nov 2006 00:17:42 -0000 1.21 *************** *** 520,524 **** void tcHookInfo::GetObjectInfo(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject) { ! char zClass[8], zModel[8], zType[8]; if (apDBObject == NULL) { --- 520,524 ---- void tcHookInfo::GetObjectInfo(std::string& s, tcDatabaseObject *apDBObject, tcGameObject *apGameObject) { ! char zClass[24], zModel[8], zType[8]; if (apDBObject == NULL) { *************** *** 532,562 **** } ! switch (apDBObject->mnClassID) ! { ! case DTYPE_GENERIC: ! strcpy(zClass,"GEN"); ! break; ! case DTYPE_MISSILE: ! strcpy(zClass,"MIS"); ! break; ! case DTYPE_LAUNCHER: ! strcpy(zClass,"LAU"); ! break; ! case DTYPE_AIR: ! strcpy(zClass,"AIR"); ! break; ! case DTYPE_BALLISTIC: ! strcpy(zClass,"BAL"); ! break; ! case DTYPE_TORPEDO: ! strcpy(zClass, "TOR"); ! break; ! case DTYPE_SUBMARINE: ! strcpy(zClass, "SUB"); ! break; ! default: ! strcpy(zClass,"UNK"); ! break; ! } switch (apGameObject->mnModelType) --- 532,538 ---- } ! std::string databaseClass = apDBObject->GetClassName(); ! ! strcpy_s(zClass, 24, databaseClass.c_str()); switch (apGameObject->mnModelType) Index: tcAltitudeBarControl.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcAltitudeBarControl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcAltitudeBarControl.cpp 23 Mar 2006 01:11:02 -0000 1.3 --- tcAltitudeBarControl.cpp 20 Nov 2006 00:17:42 -0000 1.4 *************** *** 33,37 **** #include "tcPlatformObject.h" #include "tcSubObject.h" ! #include "tcGenericDBObject.h" #include <osg/Texture2D> #include <osg/Vec4> --- 33,39 ---- #include "tcPlatformObject.h" #include "tcSubObject.h" ! #include "tcAirDBObject.h" ! #include "tcPlatformDBObject.h" ! #include "tcSubDBObject.h" #include <osg/Texture2D> #include <osg/Vec4> *************** *** 204,211 **** void tcAltitudeBarControl::UpdateDrawParameters() { ! tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(obj); ! if (!platform) return; ! isDepth = platform->mpDBObject->mfMaxDepth_m > 0; float limit, terrain; --- 206,215 ---- void tcAltitudeBarControl::UpdateDrawParameters() { ! tcAirObject* air = dynamic_cast<tcAirObject*>(obj); ! tcSubObject* sub = dynamic_cast<tcSubObject*>(obj); ! if ((air == 0) && (sub == 0)) return; ! ! isDepth = (sub != 0); float limit, terrain; *************** *** 213,227 **** if (isDepth) { ! currentValue = -platform->mcKin.mfAlt_m; ! limit = platform->mpDBObject->mfMaxDepth_m; ! terrain = -platform->mcTerrain.mfHeight_m; ! currentGoal = -platform->mcGS.mfGoalAltitude_m; } else { ! currentValue = platform->mcKin.mfAlt_m; ! limit = platform->mpDBObject->mfMaxAltitude_m; ! terrain = platform->mcTerrain.mfHeight_m; ! currentGoal = platform->mcGS.mfGoalAltitude_m; if (terrain < 0) terrain = 0; } --- 217,231 ---- if (isDepth) { ! currentValue = -sub->mcKin.mfAlt_m; ! limit = sub->mpDBObject->mfMaxDepth_m; ! terrain = -sub->mcTerrain.mfHeight_m; ! currentGoal = -sub->mcGS.mfGoalAltitude_m; } else { ! currentValue = air->mcKin.mfAlt_m; ! limit = air->mpDBObject->maxAltitude_m; ! terrain = air->mcTerrain.mfHeight_m; ! currentGoal = air->mcGS.mfGoalAltitude_m; if (terrain < 0) terrain = 0; } Index: tcPlatformGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcPlatformGui.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcPlatformGui.cpp 28 Sep 2006 02:01:53 -0000 1.13 --- tcPlatformGui.cpp 20 Nov 2006 00:17:42 -0000 1.14 *************** *** 32,36 **** #include "tcFlightOpsObject.h" #include "tcDatabaseObject.h" ! #include "tcGenericDBObject.h" #include "common/tinyxml.h" #include "tcTime.h" --- 32,37 ---- #include "tcFlightOpsObject.h" #include "tcDatabaseObject.h" ! #include "tcAirDBObject.h" ! #include "tcPlatformDBObject.h" #include "common/tinyxml.h" #include "tcTime.h" *************** *** 197,200 **** --- 198,222 ---- captionColor, 18.0f, LEFT_BASE_LINE, 400.0f); + if (tcAirObject* air = dynamic_cast<tcAirObject*>(platform)) + { + if (air->parent != 0) + { + float loadedWeight_kg = air->GetTotalWeight(); + float maxTakeoffWeight_kg = air->mpDBObject->maxTakeoffWeight_kg; + if (loadedWeight_kg <= maxTakeoffWeight_kg) + { + wxString s = wxString::Format("%.0f / %.0f kg", loadedWeight_kg, maxTakeoffWeight_kg); + DrawTextR(s.c_str(), 10.0f, 85.0f, defaultFont.get(), + osg::Vec4(0.4, 1, 0.4, 1), 14.0f, LEFT_BASE_LINE, 400.0f); + } + else + { + DrawTextR("OVERWEIGHT", 10.0f, 85.0f, defaultFont.get(), + osg::Vec4(1, 1, 0, 1), 14.0f, LEFT_BASE_LINE, 400.0f); + } + + } + } + // draw slots and items *************** *** 278,282 **** float x = fuelSlot.loc.GetLeft(); float y = fuelSlot.loc.GetTop() + 15.0f; ! float fuelCapacity_kg = platform->mpDBObject->mfFuelCapacity_kg; wxString caption; --- 300,304 ---- float x = fuelSlot.loc.GetLeft(); float y = fuelSlot.loc.GetTop() + 15.0f; ! float fuelCapacity_kg = platform->GetFuelCapacity(); wxString caption; *************** *** 529,534 **** wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); tcFlightPortGui* gui = new tcFlightPortGui(platform->mnID, wxPoint(pos.x, pos.y + size.GetHeight() + 10), ! "xml/flightport_gui_default.xml"); wxASSERT(item); item->SetGui(gui); --- 551,567 ---- wxPoint pos = wxWindow::GetPosition(); wxSize size = wxWindow::GetSize(); + + std::string xmlFile; + if (flightPort->GetHangarCapacity() > 20) + { + xmlFile = "xml/flightport_gui_large.xml"; + } + else + { + xmlFile = "xml/flightport_gui_default.xml"; + } + tcFlightPortGui* gui = new tcFlightPortGui(platform->mnID, wxPoint(pos.x, pos.y + size.GetHeight() + 10), ! xmlFile.c_str()); wxASSERT(item); item->SetGui(gui); *************** *** 550,554 **** wxSize size = wxWindow::GetSize(); tcStoresGui* gui = new tcStoresGui(platformId, hostId, idx, wxPoint(pos.x + size.GetWidth() + 10, pos.y), ! "xml/stores_gui_default.xml"); wxASSERT(item); item->SetGui(gui); --- 583,587 ---- wxSize size = wxWindow::GetSize(); tcStoresGui* gui = new tcStoresGui(platformId, hostId, idx, wxPoint(pos.x + size.GetWidth() + 10, pos.y), ! "xml/stores_gui_table.xml"); wxASSERT(item); item->SetGui(gui); Index: tcCreditView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcCreditView.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcCreditView.cpp 24 Oct 2006 01:34:04 -0000 1.22 --- tcCreditView.cpp 20 Nov 2006 00:17:42 -0000 1.23 *************** *** 77,80 **** --- 77,83 ---- AddCredit(s, 25.0f, 1); + s = "GulfKnight"; + AddCredit(s, 25.0f, 1); + s = "Jason Simpson"; AddCredit(s, 25.0f, 1); Index: tcContainerItem.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcContainerItem.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcContainerItem.cpp 1 Oct 2006 21:07:40 -0000 1.4 --- tcContainerItem.cpp 20 Nov 2006 00:17:42 -0000 1.5 *************** *** 53,56 **** --- 53,61 ---- } + osg::Geometry* tcContainerItem::GetIconSmall() + { + return iconSmall.get(); + } + long tcContainerItem::GetId() const { *************** *** 69,72 **** --- 74,100 ---- /** + * @return quantity label, characters k and M are used for thousands and millions + */ + const char* tcContainerItem::GetQuantityLabel() const + { + static wxString s; + + if (quantity > 99999) + { + s.Printf("%.1fM", 1e-6 * float(quantity)); + } + else if (quantity > 999) + { + s.Printf("%.1fk", 1e-3 * float(quantity)); + } + else + { + s.Printf("%d", quantity); + } + + return s.c_str(); + } + + /** * @return true if val matches id of this item AND val != 0 * 0 is used as an invalid id *************** *** 95,98 **** --- 123,138 ---- { icon = new osg::Geometry(*icon_, osg::CopyOp(osg::CopyOp::DEEP_COPY_DRAWABLES)); + + iconSmall = new osg::Geometry(*icon_, osg::CopyOp(osg::CopyOp::DEEP_COPY_DRAWABLES)); + if (!iconSmall.valid()) return; + + // scale by 0.625 (32 -> 20) + osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(iconSmall.get()->getVertexArray()); + + size_t nVertices = vertices->size(); + for (size_t n=0; n<nVertices; n++) + { + vertices->at(n) *= 0.625; + } } Index: cspSky.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/cspSky.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** cspSky.cpp 24 Oct 2006 01:34:03 -0000 1.18 --- cspSky.cpp 20 Nov 2006 00:17:42 -0000 1.19 *************** *** 165,169 **** float phi, theta; for (i=0; i<n; i++) { ! float I = 0.5f * randf(); //_catalog->_stars[i].I; // C is used to reduce star color saturation as an // ad hoc approximation to human color vision response --- 165,169 ---- float phi, theta; for (i=0; i<n; i++) { ! float I = 0.3f * randf(); //_catalog->_stars[i].I; // C is used to reduce star color saturation as an // ad hoc approximation to human color vision response *************** *** 813,820 **** SkyShader::SkyShader() { m_OverLuminescence = 1.2; ! m_HaloSharpness = 0.5; m_SunsetSharpness = 4.0; m_NightBase = 0.02; ! m_FullMoonColor = Color(0.008, 0.035, 0.140, Color::RGB); setTurbidity(TURBIDITY); setSunElevation(0.0); --- 813,821 ---- SkyShader::SkyShader() { m_OverLuminescence = 1.2; ! m_HaloSharpness = 0.6; m_SunsetSharpness = 4.0; m_NightBase = 0.02; ! //m_FullMoonColor = Color(0.008, 0.035, 0.140, Color::RGB); ! m_FullMoonColor = Color(0.008, 0.035, 0.170, Color::RGB); setTurbidity(TURBIDITY); setSunElevation(0.0); *************** *** 1388,1392 **** double jitter = 0.0; int i, j, ci = 0; ! m_AverageIntensity = 0.0; float dark = m_Moon.getApparentBrightness(); osg::Vec4 horizon_average; --- 1389,1393 ---- double jitter = 0.0; int i, j, ci = 0; ! m_AverageIntensity = 0.5; float dark = m_Moon.getApparentBrightness(); osg::Vec4 horizon_average; Index: tcScenarioSelectView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcScenarioSelectView.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcScenarioSelectView.cpp 27 Aug 2006 21:28:54 -0000 1.17 --- tcScenarioSelectView.cpp 20 Nov 2006 00:17:42 -0000 1.18 *************** *** 230,244 **** - /* random loading broken for now - if (!wxString(caption.c_str()).Contains("Random")) - { - - } - else - { - mpSimState->mpPythonInterface->LoadScenario("", ""); // to clear director - mpSimState->RandInit(); - } - */ if (mpSimState->msScenarioInfo.mbLoaded) --- 230,233 ---- Index: tcStoresGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStoresGui.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcStoresGui.cpp 17 Aug 2006 01:28:04 -0000 1.9 --- tcStoresGui.cpp 20 Nov 2006 00:17:42 -0000 1.10 *************** *** 107,113 **** // draw slots and items ! size_t nSlots = slots.size(); ! for (size_t n=0; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; --- 107,121 ---- + // calculate slots to draw based on page info + size_t startIdx = currentPage * slotsPerPage; + size_t stopIdx = startIdx + slotsPerPage; + size_t nSlots = slots.size(); + if (stopIdx > nSlots) stopIdx = nSlots; + if ((startIdx+1) > nSlots) startIdx = nSlots - 1; // won't draw anyway if nSlots==0 + + // draw slots and items ! ! for (size_t n=startIdx; n<stopIdx; n++) { tcContainerSlot& slot = slots[n]; *************** *** 126,164 **** DrawGeometryR(icon, slot.loc.XCenter(), slot.loc.YCenter()); // draw quantity label ! wxString quantityText = wxString::Format("%d", item->GetQuantity()); ! const osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! DrawTextR(quantityText.c_str(), slot.loc.GetLeft() + 2.0f, slot.loc.GetTop() - 3.0f, defaultFont.get(), color, 12.0f, LEFT_BASE_LINE); - } ! // draw description caption if mouse is over slot ! if (isMouseOver) ! { ! const osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! float left = slot.loc.GetLeft(); float maxWidth = guiWidth - left - 10.0f; ! DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() + 15.0f, defaultFont.get(), color, 14.0f, LEFT_BASE_LINE, maxWidth); ! ! } } ! ! // draw expanded rectangle for slot border ! tcRect r = slot.loc; ! r.Expand(1.0, 1.0); ! if (isMouseOver) ! { ! DrawRectangleR(r, osg::Vec4(1, 1, 1, 1), tc3DWindow::FILL_OFF); ! } ! else ! { ! DrawRectangleR(r, osg::Vec4(0.5, 0.5, 0.5, 1), tc3DWindow::FILL_OFF); ! } ! } DrawBorder(); --- 134,192 ---- DrawGeometryR(icon, slot.loc.XCenter(), slot.loc.YCenter()); + osg::Vec4 color; + if (!isMouseOver) color.set(0.6f, 0.6f, 0.6f, 1.0f); + else color.set(1.0f, 1.0f, 1.0f, 1.0f); + // draw quantity label ! DrawTextR(item->GetQuantityLabel(), slot.loc.GetRight() + 5.0f, slot.loc.GetTop() - 2.0f, defaultFont.get(), color, 12.0f, LEFT_BASE_LINE); ! // draw item name ! float left = slot.loc.GetRight() + 32.0f; float maxWidth = guiWidth - left - 10.0f; ! DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() - 2.0f, defaultFont.get(), color, 14.0f, LEFT_BASE_LINE, maxWidth); ! } ! ! // draw description caption if mouse is over slot ! //if (isMouseOver) ! //{ ! // const osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); ! // float left = slot.loc.GetLeft(); ! // float maxWidth = guiWidth - left - 10.0f; ! ! // DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() + 15.0f, defaultFont.get(), ! // color, 14.0f, LEFT_BASE_LINE, maxWidth); ! //} ! ! // draw expanded rectangle for slot border ! tcRect r = slot.loc; ! r.Expand(1.0, 1.0); ! if (isMouseOver) ! { ! DrawRectangleR(r, osg::Vec4(1, 1, 1, 1), tc3DWindow::FILL_OFF); ! } ! else ! { ! DrawRectangleR(r, osg::Vec4(0.5, 0.5, 0.5, 1), tc3DWindow::FILL_OFF); ! } ! } ! } + // draw page boxes + for (size_t n=0; n<pageBoxes.size(); n++) + { + int fillMode = (n == currentPage) ? tc3DWindow::FILL_ON : tc3DWindow::FILL_OFF; + osg::Vec4 color(0.5, 0.5, 0.5, 0.5); + if (n == mouseOverPage) color.set(1, 1, 1, 1); + + DrawRectangleR(pageBoxes[n], color, fillMode); + } + + DrawBorder(); *************** *** 231,252 **** wxASSERT(storesData); ! size_t nSlots = 16; // use magic number for now ! tcRect slotLoc(upperLeft.x, upperLeft.x + slotSize, ! upperLeft.y, upperLeft.y + slotSize); ! size_t nRow = 0; ! for (size_t n=0; n<nSlots; n++) { ! AddSlot(slotLoc); ! slotLoc.Offset(horizontalSpacing, 0); ! if (++nRow >= rowSize) ! { ! slotLoc.Offset(upperLeft.x - slotLoc.GetLeft(), verticalSpacing); ! nRow = 0; } } } --- 259,313 ---- wxASSERT(storesData); ! for (size_t n=0; n<maxSlots; n++) ! { ! tcRect slotLoc(upperLeft.x, upperLeft.x + slotSize, ! upperLeft.y, upperLeft.y + slotSize + float(n%slotsPerPage)*verticalSpacing); ! AddSlot(slotLoc, tcContainerGui::SMALL_ICON_SIZE); ! } ! SetCurrentPage(0); ! } ! ! /** ! * Change page if click in page box ! */ ! void tcStoresGui::OnLButtonDown(wxMouseEvent& event) ! { ! wxPoint pos = event.GetPosition(); ! ! size_t nPages = pageBoxes.size(); ! for (size_t n=0; n<nPages; n++) { ! if (pageBoxes[n].ContainsPoint(float(pos.x), float(pos.y))) ! { ! if (n != currentPage) SetCurrentPage(n); ! return; ! } ! } ! tcContainerGui::OnLButtonDown(event); ! } ! /** ! * Update mouseOverPage ! */ ! void tcStoresGui::OnMouseMove(wxMouseEvent& event) ! { ! wxPoint pos = event.GetPosition(); ! ! mouseOverPage = 9999; ! ! size_t nPages = pageBoxes.size(); ! for (size_t n=0; n<nPages; n++) ! { ! if (pageBoxes[n].ContainsPoint(float(pos.x), float(pos.y))) ! { ! mouseOverPage = n; ! return; } } + + tcContainerGui::OnMouseMove(event); } *************** *** 304,307 **** --- 365,395 ---- } + void tcStoresGui::SetCurrentPage(size_t page) + { + if (page >= nPages) return; + + currentPage = page; + + size_t startIdx = slotsPerPage * currentPage; + size_t stopIdx = startIdx + slotsPerPage; + + for (size_t n=0; n<maxSlots; n++) + { + if ((n >= startIdx) && (n < stopIdx)) + { + float yOffset = float(n%slotsPerPage)*verticalSpacing; + + slots[n].loc.Set(upperLeft.x, upperLeft.x + slotSize, + upperLeft.y + yOffset, upperLeft.y + slotSize + yOffset); + } + else + { + slots[n].loc.Set(0, 0, -10.0, -10.0); + } + + } + + } + /** * Update slot items based on tcStores state *************** *** 318,322 **** } ! size_t nTypes = stores->GetNumberItemTypes(); for (size_t n=0; (n<nTypes)&&(n<slots.size()); n++) --- 406,410 ---- } ! std::string s; size_t nTypes = stores->GetNumberItemTypes(); for (size_t n=0; (n<nTypes)&&(n<slots.size()); n++) *************** *** 325,329 **** const std::string& itemName = stores->GetItemName(n); ! unsigned int itemQuantity = stores->CurrentItemQuantity(itemName); AddOrUpdateItem(slot, itemName, itemQuantity, stores); --- 413,417 ---- const std::string& itemName = stores->GetItemName(n); ! unsigned int itemQuantity = stores->CurrentItemQuantity(itemName, s); AddOrUpdateItem(slot, itemName, itemQuantity, stores); *************** *** 339,343 **** } } ! } --- 427,451 ---- } } ! ! nPages = ((slotsPerPage - 1 + stores->GetNumberItemTypes()) / slotsPerPage); ! size_t maxPages = (maxSlots - 1 + slotsPerPage) / slotsPerPage; ! if (nPages > maxPages) nPages = maxPages; ! ! // update page boxes ! pageBoxes.clear(); ! if (nPages > 1) // don't bother showing icon for single page ! { ! float xPageBox = float(mnWidth) - 10.0f; ! float yPageBox = 30.0f; ! float wPageBox = 7.0f; ! ! ! for (size_t n=0; n<nPages; n++) ! { ! float yOffset = float(n)*wPageBox; ! pageBoxes.push_back(tcRect(xPageBox, xPageBox + wPageBox, yPageBox, yPageBox + wPageBox)); ! yPageBox += wPageBox + 2.0f; ! } ! } } *************** *** 350,354 **** platformId(id), hostId(host), ! storesIdx(idx) { ReadGuiParameters(); --- 458,467 ---- platformId(id), hostId(host), ! storesIdx(idx), ! slotsPerPage(10), ! nPages(1), ! currentPage(0), ! maxSlots(100), ! mouseOverPage(9999) { ReadGuiParameters(); Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tc3DViewer.cpp 24 Oct 2006 01:34:04 -0000 1.40 --- tc3DViewer.cpp 20 Nov 2006 00:17:42 -0000 1.41 *************** *** 690,693 **** --- 690,701 ---- terrainManager->SetOrigin(lon, lat); } + + if (sky.valid()) + { + wxASSERT(simState != 0); + DateZulu dz; + simState->GetDateZulu(dz); + sky->update(latOrigin_rad, lonOrigin_rad, dz); + } } *************** *** 1547,1551 **** --- 1555,1567 ---- } + const tcPoint& tc3DViewer::GetOrigin() const + { + static tcPoint p; + + p.x = lonOrigin_rad; + p.y = latOrigin_rad; + return p; + } /** Index: tcContainerGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcContainerGui.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcContainerGui.cpp 17 Aug 2006 01:28:04 -0000 1.10 --- tcContainerGui.cpp 20 Nov 2006 00:17:42 -0000 1.11 *************** *** 51,60 **** return 0; } ! else { return item->GetIcon(); } } tcContainerItem* tcContainerSlot::GetItem() const { --- 51,65 ---- return 0; } ! else if (!useSmallIcon) { return item->GetIcon(); } + else + { + return item->GetIconSmall(); + } } + tcContainerItem* tcContainerSlot::GetItem() const { *************** *** 97,104 **** } tcContainerSlot::tcContainerSlot() : item(0), updated(false), ! isMouseOver(false) { } --- 102,115 ---- } + void tcContainerSlot::SetUseSmallIcon(bool state) + { + useSmallIcon = state; + } + tcContainerSlot::tcContainerSlot() : item(0), updated(false), ! isMouseOver(false), ! useSmallIcon(false) { } *************** *** 108,112 **** item(src.item), updated(src.updated), ! isMouseOver(src.isMouseOver) { } --- 119,124 ---- item(src.item), updated(src.updated), ! isMouseOver(src.isMouseOver), ! useSmallIcon(src.useSmallIcon) { } *************** *** 138,142 **** ! void tcContainerGui::AddSlot(tcRect& loc) { tcContainerSlot slot; --- 150,154 ---- ! void tcContainerGui::AddSlot(tcRect& loc, IconSize iconSize) { tcContainerSlot slot; *************** *** 145,148 **** --- 157,165 ---- slot.updated = false; + if (iconSize == SMALL_ICON_SIZE) + { + slot.SetUseSmallIcon(true); + } + slots.push_back(slot); } Index: tcBriefingView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcBriefingView.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcBriefingView.cpp 23 Mar 2006 01:11:02 -0000 1.2 --- tcBriefingView.cpp 20 Nov 2006 00:17:42 -0000 1.3 *************** *** 55,59 **** const std::string& briefingText = scenarioInterface->GetSimpleBriefing(userAlliance); ! float x = 55.0f; float y = 150.0f; float fontSize; --- 55,59 ---- const std::string& briefingText = scenarioInterface->GetSimpleBriefing(userAlliance); ! float x = 65.0f; float y = 150.0f; float fontSize; |