[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.118,1.119 tcBallisticWeapon.cpp,1.7,1.8 tcESMSensor.cpp,1
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16201/src/sim Modified Files: Game.cpp tcBallisticWeapon.cpp tcESMSensor.cpp tcGameObject.cpp tcGroundObject.cpp tcLauncher.cpp tcMenu.cpp tcRadar.cpp Log Message: Ground SAM related updates Index: tcGroundObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGroundObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcGroundObject.cpp 31 Jan 2005 01:33:09 -0000 1.1 --- tcGroundObject.cpp 1 Feb 2005 02:29:15 -0000 1.2 *************** *** 86,89 **** --- 86,91 ---- } + + /** * Update method calls updates that are not Index: tcESMSensor.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcESMSensor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcESMSensor.cpp 27 Jan 2005 01:01:55 -0000 1.11 --- tcESMSensor.cpp 1 Feb 2005 02:29:15 -0000 1.12 *************** *** 198,206 **** if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(target)) { ! tcRadar* emitter = pMissileObj->GetSensorState(); ! bDetected = IsDetected(emitter, fAz_rad); ! if ((bDetected) && (nEmitters < MAX_EMITTERS)) { ! maEmitter[nEmitters++] = emitter->mnDBKey; } } --- 198,208 ---- if (tcMissileObject *pMissileObj = dynamic_cast<tcMissileObject*>(target)) { ! if (tcRadar* emitter = pMissileObj->GetSensorState()) // some AGMs have no sensor { ! bDetected = IsDetected(emitter, fAz_rad); ! if ((bDetected) && (nEmitters < MAX_EMITTERS)) ! { ! maEmitter[nEmitters++] = emitter->mnDBKey; ! } } } Index: tcMenu.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMenu.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMenu.cpp 2 Dec 2004 04:17:26 -0000 1.10 --- tcMenu.cpp 1 Feb 2005 02:29:15 -0000 1.11 *************** *** 43,84 **** void tcMenu::InitSubmenuIcon() { ! float w = 2.0f; ! submenuIcon = new osg::Geometry; ! osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f)); ! submenuIcon->setColorArray(colors); ! submenuIcon->setColorBinding(osg::Geometry::BIND_OVERALL); ! // create vertex array ! osg::Vec3Array* vertices = new osg::Vec3Array; ! submenuIcon->setVertexArray(vertices); ! vertices->push_back(osg::Vec3(w, 0, 0)); ! vertices->push_back(osg::Vec3(-w, w, 0)); ! vertices->push_back(osg::Vec3(-w, -w, 0)); ! submenuIcon->addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLES, 0, 3)); ! submenuIcon->setUseDisplayList(true); ! // set state ! osg::StateSet* stateSet = submenuIcon->getOrCreateStateSet(); ! stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); ! stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); ! stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); ! stateSet->setRenderBinDetails(31, "RenderBin"); } void tcMenu::SetSubmenuIconRenderBin(int bin) { ! wxASSERT(submenuIcon.valid()); ! osg::StateSet* stateSet = submenuIcon->getOrCreateStateSet(); ! stateSet->setRenderBinDetails(bin, "RenderBin"); } --- 43,84 ---- void tcMenu::InitSubmenuIcon() { ! float w = 2.0f; ! submenuIcon = new osg::Geometry; ! osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f)); ! submenuIcon->setColorArray(colors); ! submenuIcon->setColorBinding(osg::Geometry::BIND_OVERALL); ! // create vertex array ! osg::Vec3Array* vertices = new osg::Vec3Array; ! submenuIcon->setVertexArray(vertices); ! vertices->push_back(osg::Vec3(w, 0, 0)); ! vertices->push_back(osg::Vec3(-w, w, 0)); ! vertices->push_back(osg::Vec3(-w, -w, 0)); ! submenuIcon->addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLES, 0, 3)); ! submenuIcon->setUseDisplayList(true); ! // set state ! osg::StateSet* stateSet = submenuIcon->getOrCreateStateSet(); ! stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); ! stateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF); ! stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); ! stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); ! stateSet->setRenderBinDetails(31, "RenderBin"); } void tcMenu::SetSubmenuIconRenderBin(int bin) { ! wxASSERT(submenuIcon.valid()); ! osg::StateSet* stateSet = submenuIcon->getOrCreateStateSet(); ! stateSet->setRenderBinDetails(bin, "RenderBin"); } *************** *** 86,123 **** void tcMenu::AddItem(string caption, int command) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = ""; ! md.mzUserInput = ""; ! md.mnCommand = command; ! maMenuData.push_back(md); ! } ! else ! { ! mpCurrent->AddItem(caption, command); ! } } void tcMenu::AddItem(string caption, std::string command, int param) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = command; ! md.mzUserInput = ""; ! md.mnCommand = param; ! maMenuData.push_back(md); ! } ! else { ! mpCurrent->AddItem(caption, command, param); ! } } --- 86,123 ---- void tcMenu::AddItem(string caption, int command) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = ""; ! md.mzUserInput = ""; ! md.mnCommand = command; ! maMenuData.push_back(md); ! } ! else ! { ! mpCurrent->AddItem(caption, command); ! } } void tcMenu::AddItem(string caption, std::string command, int param) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = command; ! md.mzUserInput = ""; ! md.mnCommand = param; ! maMenuData.push_back(md); ! } ! else { ! mpCurrent->AddItem(caption, command, param); ! } } *************** *** 127,146 **** void tcMenu::AddItem(std::string caption, std::string command, std::string textParam) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = command; ! md.mzUserInput = ""; ! md.mnCommand = -1; md.textParam = textParam; ! maMenuData.push_back(md); ! } ! else { ! mpCurrent->AddItem(caption, command, textParam); ! } } --- 127,146 ---- void tcMenu::AddItem(std::string caption, std::string command, std::string textParam) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = command; ! md.mzUserInput = ""; ! md.mnCommand = -1; md.textParam = textParam; ! maMenuData.push_back(md); ! } ! else { ! mpCurrent->AddItem(caption, command, textParam); ! } } *************** *** 151,326 **** void tcMenu::AddItemUI(std::string caption, std::string callback, std::string input, int param) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = callback; ! md.mzUserInput = input; ! md.mnCommand = param; ! maMenuData.push_back(md); ! } ! else ! { ! mpCurrent->AddItemUI(caption, callback, input, param); ! } } void tcMenu::BeginSubMenu() { ! if (mpCurrent == this) ! { ! int nSize = (int)maMenuData.size(); ! if (nSize == 0) {return;} // can't add submenu to empty menu ! tsMenuData& md = maMenuData[nSize-1]; ! if (md.mpSubMenu == NULL) ! { ! // create new menu with this as parent ! tcMenu *pNewMenu = new tcMenu(this); ! md.mpSubMenu = pNewMenu; ! } ! // set mpCurrent to submenu of last item ! mpCurrent = md.mpSubMenu; ! md.mnCommand = 0; // item with subitems can't have command ! md.mzCommand = ""; ! } ! else ! { ! mpCurrent->BeginSubMenu(); ! } } void tcMenu::EndSubMenu() { ! if (mpCurrent == this) ! { ! if (mpParent == NULL) {return;} // error endsub on top level ! mpParent->mpCurrent = mpParent; ! } ! else { ! mpCurrent->EndSubMenu(); ! } } void tcMenu::ClearSelected() { ! int nMenuSize = (int)maMenuData.size(); ! for(int i=0;i<nMenuSize;i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! pmd->mbSelected = false; ! if (pmd->mpSubMenu != NULL) {pmd->mpSubMenu->ClearSelected();} ! } } void tcMenu::Clear() { ! int nMenuSize = (int)maMenuData.size(); ! // clear submenus first ! for(int i=0;i<nMenuSize;i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! if (pmd->mpSubMenu != NULL) ! { ! pmd->mpSubMenu->Clear(); ! delete pmd->mpSubMenu; ! pmd->mpSubMenu = NULL; ! } ! } ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = NULL; } void tcMenu::Draw() { ! if (mbUpdateRegions) ! { ! UpdateRegions(); ! mbUpdateRegions = false; ! } ! int nMenuSize = (int)maMenuData.size(); // number of items in menu ! for (int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! DrawItem(pmd); ! } } void tcMenu::DrawItem(tsMenuData *apMD) { ! float alpha = 0.8f; ! osg::Vec4 color(0, 0, 0, 1); ! wxASSERT(parentWindow); ! //if the menu item is selected ! if (apMD->mbSelected) ! { ! color.set(0, 0.6f, 1.0f, alpha); ! } ! else ! { ! color.set(0.8f, 0.8f, 0.84f, alpha); ! } ! tcRect item_rect = apMD->mrect; ! item_rect.Offset(anchor.x, anchor.y); ! parentWindow->DrawRectangleR(item_rect, color, tc3DWindow::FILL_ON); ! if (apMD->mbSelected) ! { ! color.set(1, 1, 1, alpha); ! } ! else ! { ! color.set(0, 0, 0, alpha); ! } ! wxRealPoint pointf(apMD->mrect.GetLeft() + 5.0f, apMD->mrect.GetTop() - 2.0f); ! pointf = pointf + anchor; ! parentWindow->DrawTextR(apMD->mzCaption.c_str(), pointf.x, pointf.y, ! parentWindow->GetDefaultFont(), color, fontSize, LEFT_BASE_LINE); ! if (apMD->mpSubMenu != NULL) ! { ! float subx = item_rect.left + mfItemWidth - 4.0f; ! float suby = item_rect.YCenter(); ! parentWindow->DrawGeometryR(submenuIcon.get(), subx, suby); #if 0 ! ! // draw submenu triangle icon ! PointF aSubIcon[3]; // points for tri submenu icon, rel to upper left of item ! aSubIcon[0].X = item_rect.X + mfItemWidth - 5.0f; ! aSubIcon[0].Y = item_rect.Y + 0.5f*item_rect.Height; ! aSubIcon[1].X = aSubIcon[0].X - 5.0f; ! aSubIcon[1].Y = aSubIcon[0].Y - 5.0f; ! aSubIcon[2].X = aSubIcon[1].X; ! aSubIcon[2].Y = aSubIcon[0].Y + 5.0f; ! apGraphics->FillPolygon(mpBrush,aSubIcon,3); #endif ! // if item is selected, draw the submenu ! if (apMD->mbSelected) ! { ! wxRealPoint submenu_offset; ! submenu_offset.x = item_rect.GetRight()-1.0f; ! submenu_offset.y = item_rect.GetBottom(); ! apMD->mpSubMenu->SetAnchor(submenu_offset); ! apMD->mpSubMenu->Draw(); ! } ! } --- 151,326 ---- void tcMenu::AddItemUI(std::string caption, std::string callback, std::string input, int param) { ! if (mpCurrent == this) ! { ! tsMenuData md; ! md.Clear(); ! md.mzCaption = caption; ! md.mzCommand = callback; ! md.mzUserInput = input; ! md.mnCommand = param; ! maMenuData.push_back(md); ! } ! else ! { ! mpCurrent->AddItemUI(caption, callback, input, param); ! } } void tcMenu::BeginSubMenu() { ! if (mpCurrent == this) ! { ! int nSize = (int)maMenuData.size(); ! if (nSize == 0) {return;} // can't add submenu to empty menu ! tsMenuData& md = maMenuData[nSize-1]; ! if (md.mpSubMenu == NULL) ! { ! // create new menu with this as parent ! tcMenu *pNewMenu = new tcMenu(this); ! md.mpSubMenu = pNewMenu; ! } ! // set mpCurrent to submenu of last item ! mpCurrent = md.mpSubMenu; ! md.mnCommand = 0; // item with subitems can't have command ! md.mzCommand = ""; ! } ! else ! { ! mpCurrent->BeginSubMenu(); ! } } void tcMenu::EndSubMenu() { ! if (mpCurrent == this) ! { ! if (mpParent == NULL) {return;} // error endsub on top level ! mpParent->mpCurrent = mpParent; ! } ! else { ! mpCurrent->EndSubMenu(); ! } } void tcMenu::ClearSelected() { ! int nMenuSize = (int)maMenuData.size(); ! for(int i=0;i<nMenuSize;i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! pmd->mbSelected = false; ! if (pmd->mpSubMenu != NULL) {pmd->mpSubMenu->ClearSelected();} ! } } void tcMenu::Clear() { ! int nMenuSize = (int)maMenuData.size(); ! // clear submenus first ! for(int i=0;i<nMenuSize;i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! if (pmd->mpSubMenu != NULL) ! { ! pmd->mpSubMenu->Clear(); ! delete pmd->mpSubMenu; ! pmd->mpSubMenu = NULL; ! } ! } ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = NULL; } void tcMenu::Draw() { ! if (mbUpdateRegions) ! { ! UpdateRegions(); ! mbUpdateRegions = false; ! } ! int nMenuSize = (int)maMenuData.size(); // number of items in menu ! for (int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! DrawItem(pmd); ! } } void tcMenu::DrawItem(tsMenuData *apMD) { ! float alpha = 0.8f; ! osg::Vec4 color(0, 0, 0, 1); ! wxASSERT(parentWindow); ! //if the menu item is selected ! if (apMD->mbSelected) ! { ! color.set(0, 0.6f, 1.0f, alpha); ! } ! else ! { ! color.set(0.8f, 0.8f, 0.84f, alpha); ! } ! tcRect item_rect = apMD->mrect; ! item_rect.Offset(anchor.x, anchor.y); ! parentWindow->DrawRectangleR(item_rect, color, tc3DWindow::FILL_ON); ! if (apMD->mbSelected) ! { ! color.set(1, 1, 1, alpha); ! } ! else ! { ! color.set(0, 0, 0, alpha); ! } ! wxRealPoint pointf(apMD->mrect.GetLeft() + 5.0f, apMD->mrect.GetTop() - 2.0f); ! pointf = pointf + anchor; ! parentWindow->DrawTextR(apMD->mzCaption.c_str(), pointf.x, pointf.y, ! parentWindow->GetDefaultFont(), color, fontSize, LEFT_BASE_LINE); ! if (apMD->mpSubMenu != NULL) ! { ! float subx = item_rect.left + mfItemWidth - 4.0f; ! float suby = item_rect.YCenter(); ! parentWindow->DrawGeometryR(submenuIcon.get(), subx, suby); #if 0 ! ! // draw submenu triangle icon ! PointF aSubIcon[3]; // points for tri submenu icon, rel to upper left of item ! aSubIcon[0].X = item_rect.X + mfItemWidth - 5.0f; ! aSubIcon[0].Y = item_rect.Y + 0.5f*item_rect.Height; ! aSubIcon[1].X = aSubIcon[0].X - 5.0f; ! aSubIcon[1].Y = aSubIcon[0].Y - 5.0f; ! aSubIcon[2].X = aSubIcon[1].X; ! aSubIcon[2].Y = aSubIcon[0].Y + 5.0f; ! apGraphics->FillPolygon(mpBrush,aSubIcon,3); #endif ! // if item is selected, draw the submenu ! if (apMD->mbSelected) ! { ! wxRealPoint submenu_offset; ! submenu_offset.x = item_rect.GetRight()-1.0f; ! submenu_offset.y = item_rect.GetBottom(); ! apMD->mpSubMenu->SetAnchor(submenu_offset); ! apMD->mpSubMenu->Draw(); ! } ! } *************** *** 333,357 **** tsMenuData* tcMenu::ItemContainingPoint(const wxRealPoint& point) { ! int nMenuSize = (int)maMenuData.size(); ! wxRealPoint local_point = point - anchor; // adjust for anchor ! for(int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! if (pmd->mrect.ContainsPoint(local_point.x, local_point.y)) ! { ! return pmd; ! } ! // if item is selected and has submenu, check submenu ! if ((pmd->mpSubMenu != NULL) && (pmd->mbSelected)) ! { ! tsMenuData *psub = pmd->mpSubMenu->ItemContainingPoint(point); ! if (psub != NULL) {return psub;} ! } ! } ! return NULL; // not found } --- 333,357 ---- tsMenuData* tcMenu::ItemContainingPoint(const wxRealPoint& point) { ! int nMenuSize = (int)maMenuData.size(); ! wxRealPoint local_point = point - anchor; // adjust for anchor ! for(int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! if (pmd->mrect.ContainsPoint(local_point.x, local_point.y)) ! { ! return pmd; ! } ! // if item is selected and has submenu, check submenu ! if ((pmd->mpSubMenu != NULL) && (pmd->mbSelected)) ! { ! tsMenuData *psub = pmd->mpSubMenu->ItemContainingPoint(point); ! if (psub != NULL) {return psub;} ! } ! } ! return NULL; // not found } *************** *** 362,399 **** bool tcMenu::UpdateSelection(const wxRealPoint& point) { ! int nMenuSize = (int)maMenuData.size(); ! wxRealPoint local_point = point - anchor; // adjust for anchor ! // if (!menubox.Contains(point)) { return NULL;} ! bool bResult = false; ! for(int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! tcMenu *pSubMenu = pmd->mpSubMenu; ! bool bSelected = pmd->mbSelected; ! if (pmd->mrect.ContainsPoint(local_point.x, local_point.y)) ! { ! pmd->mbSelected = true; ! if (pSubMenu != NULL) {pSubMenu->ClearSelected();} ! bResult = true; ! } ! else if ((pSubMenu != NULL)&&(bSelected)) ! { ! if (pSubMenu->UpdateSelection(point) == false) ! { ! pmd->mbSelected = false; ! } ! else ! { ! bResult = true; ! } ! } ! else ! { ! pmd->mbSelected = false; ! } ! } ! return bResult; // not found } --- 362,400 ---- bool tcMenu::UpdateSelection(const wxRealPoint& point) { ! int nMenuSize = (int)maMenuData.size(); ! wxRealPoint local_point = point - anchor; // adjust for anchor ! // if (!menubox.Contains(point)) { return NULL;} ! bool bResult = false; ! ! for(int i=0; i<nMenuSize; i++) ! { ! tsMenuData *pmd = &maMenuData[i]; ! tcMenu *pSubMenu = pmd->mpSubMenu; ! bool bSelected = pmd->mbSelected; ! if (!bResult && pmd->mrect.ContainsPoint(local_point.x, local_point.y)) ! { ! pmd->mbSelected = true; ! if (pSubMenu != NULL) {pSubMenu->ClearSelected();} ! bResult = true; ! } ! else if ((pSubMenu != NULL)&&(bSelected)) ! { ! if (pSubMenu->UpdateSelection(point) == false) ! { ! pmd->mbSelected = false; ! } ! else ! { ! bResult = true; ! } ! } ! else ! { ! pmd->mbSelected = false; ! } ! } ! return bResult; // not found } *************** *** 401,476 **** { ! int maxWidth = 0; ! int maxHeight = 0; ! tsMenuData *pmd; ! int nMenuSize = (int)maMenuData.size(); ! // find max item width and height ! for(int i=0; i<nMenuSize; i++) ! { ! wxSize boundingBox; ! pmd = &maMenuData[i]; ! parentWindow->MeasureText(parentWindow->GetDefaultFont(), fontSize, pmd->mzCaption.c_str(), ! boundingBox); ! ! int w = boundingBox.GetWidth(); ! if (pmd->mpSubMenu) w += 3; ! maxWidth = (w > maxWidth) ? w : maxWidth; ! maxHeight = (boundingBox.GetHeight() > maxHeight) ? boundingBox.GetHeight() : maxHeight; ! } ! mfItemWidth = float(maxWidth) + 12.0f; ! mfItemHeight = float(maxHeight) + 2.0f; ! menubox.left = 0; ! menubox.bottom = 0; // upper-left corner ! menubox.right = menubox.left + float(maxWidth) + 12.0f; ! menubox.top = menubox.bottom + (float(maxHeight) + 4.0f)*((float)nMenuSize); ! // set item rectangles ! tcRect itemrect; ! itemrect.Set(0, mfItemWidth, 0, mfItemHeight); ! for(int i=0; i<nMenuSize; i++) ! { ! pmd = &maMenuData[i]; ! pmd->mrect = itemrect; ! itemrect.bottom += mfItemHeight - 1.0f; ! itemrect.top += mfItemHeight - 1.0f; ! } } tcMenu::tcMenu() ! : fontSize(14.0) { ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = NULL; ! if (!submenuIcon.valid()) ! { ! InitSubmenuIcon(); ! } } tcMenu::tcMenu(tcMenu* apParent) ! : fontSize(14.0) { ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = apParent; ! if (!submenuIcon.valid()) ! { ! InitSubmenuIcon(); ! } } --- 402,477 ---- { ! int maxWidth = 0; ! int maxHeight = 0; ! tsMenuData *pmd; ! int nMenuSize = (int)maMenuData.size(); ! // find max item width and height ! for(int i=0; i<nMenuSize; i++) ! { ! wxSize boundingBox; ! pmd = &maMenuData[i]; ! parentWindow->MeasureText(parentWindow->GetDefaultFont(), fontSize, pmd->mzCaption.c_str(), ! boundingBox); ! int w = boundingBox.GetWidth(); ! if (pmd->mpSubMenu) w += 3; ! ! maxWidth = (w > maxWidth) ? w : maxWidth; ! maxHeight = (boundingBox.GetHeight() > maxHeight) ? boundingBox.GetHeight() : maxHeight; ! } ! mfItemWidth = float(maxWidth) + 12.0f; ! mfItemHeight = float(maxHeight) + 3.0f; ! menubox.left = 0; ! menubox.bottom = 0; // upper-left corner ! menubox.right = menubox.left + float(maxWidth) + 12.0f; ! menubox.top = menubox.bottom + (float(maxHeight) + 4.0f)*((float)nMenuSize); ! // set item rectangles ! tcRect itemrect; ! itemrect.Set(0, mfItemWidth, 0, mfItemHeight); ! for(int i=0; i<nMenuSize; i++) ! { ! pmd = &maMenuData[i]; ! pmd->mrect = itemrect; ! itemrect.bottom += mfItemHeight - 1.0f; ! itemrect.top += mfItemHeight - 1.0f; ! } } tcMenu::tcMenu() ! : fontSize(16.0) { ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = NULL; ! if (!submenuIcon.valid()) ! { ! InitSubmenuIcon(); ! } } tcMenu::tcMenu(tcMenu* apParent) ! : fontSize(16.0) { ! maMenuData.clear(); ! mbUpdateRegions = true; ! mpCurrent = this; ! mpParent = apParent; ! if (!submenuIcon.valid()) ! { ! InitSubmenuIcon(); ! } } *************** *** 479,482 **** tcMenu::~tcMenu() { ! Clear(); } --- 480,483 ---- tcMenu::~tcMenu() { ! Clear(); } Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** Game.cpp 31 Jan 2005 01:33:08 -0000 1.118 --- Game.cpp 1 Feb 2005 02:29:07 -0000 1.119 *************** *** 215,218 **** --- 215,222 ---- mcUserInfo.GetOwnAlliance()); + // clear old hook info + NewHook(-1); + pythonInterface->SetMenuPlatform(-1); + // hide all game windows briefingConsoleLeft->SetActive(false); Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcLauncher.cpp 7 Dec 2004 04:00:42 -0000 1.9 --- tcLauncher.cpp 1 Feb 2005 02:29:15 -0000 1.10 *************** *** 284,287 **** --- 284,295 ---- tcGameObject *targetObj = simState->GetObject(mnTargetID); + // TODO: called here as quick way to add autopoint feature, move to better location + if (IsAutoPoint()) + { + pointingAngle = parent->BearingToRad(*targetObj) - parent->mcKin.mfHeading_rad; + if (pointingAngle >= C_PI) pointingAngle -= C_TWOPI; + else if (pointingAngle < -C_PI) pointingAngle += C_TWOPI; + } + // needs a fire control track (launching platform) to launch if ((meLaunchMode == FC_TRACK)||(meLaunchMode == SEEKER_TRACK)) *************** *** 330,338 **** - return LAUNCHER_ERROR; // bad meLaunchMode } /** * @return true if item is compatible with launcher (can be loaded) */ --- 338,354 ---- return LAUNCHER_ERROR; // bad meLaunchMode } /** + * autopoint launchers will automatically point to target before launch + * @return true if launcher is auto-pointable + */ + bool tcLauncher::IsAutoPoint() const + { + return mpLauncherDBObj->isAutoPoint; + } + + /** * @return true if item is compatible with launcher (can be loaded) */ Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** tcGameObject.cpp 31 Jan 2005 01:33:08 -0000 1.27 --- tcGameObject.cpp 1 Feb 2005 02:29:15 -0000 1.28 *************** *** 286,289 **** --- 286,298 ---- /** + * @return bearing to p in radians + */ + float tcGameObject::BearingToRad(tcGameObject& p) + { + return (float)(atan2(p.mcKin.mfLon_rad-mcKin.mfLon_rad, + p.mcKin.mfLat_rad-mcKin.mfLat_rad)); + } + + /** * mapData must be set with SetGameObjectMapData before using this method. * @see SetGameObjectMapData Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcBallisticWeapon.cpp 31 Jan 2005 01:33:08 -0000 1.7 --- tcBallisticWeapon.cpp 1 Feb 2005 02:29:15 -0000 1.8 *************** *** 98,104 **** mcKin.mfPitch_rad += pLauncher->pointingElevation; ! // assume non-zero launch speed means shell, set az and el to intercept target datum ! // TODO, add this option directly to ballistic DB obj ! if (mpDBObject->launchSpeed_mps != 0) { mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; --- 98,103 ---- mcKin.mfPitch_rad += pLauncher->pointingElevation; ! // For gun round, set az and el to intercept target datum ! if (mpDBObject->IsGunRound()) { mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcRadar.cpp 31 Jan 2005 01:33:09 -0000 1.23 --- tcRadar.cpp 1 Feb 2005 02:29:15 -0000 1.24 *************** *** 480,484 **** if (nClassification & PTYPE_MISSILE) {eAffil = HOSTILE;} // surfaced sub classified as small surface ! if (nClassification & PTYPE_SUBMARINE) { nClassification = PTYPE_SMALLSURFACE; --- 480,484 ---- if (nClassification & PTYPE_MISSILE) {eAffil = HOSTILE;} // surfaced sub classified as small surface ! if (nClassification == PTYPE_SUBMARINE) { nClassification = PTYPE_SMALLSURFACE; |