[Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp,1.19,1.20 tcMapView.cpp,1.29,1.30
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-06-30 01:06:22
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31770/src/graphics Modified Files: tc3DViewer.cpp tcMapView.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tcMapView.cpp 28 Jun 2005 02:51:34 -0000 1.29 --- tcMapView.cpp 30 Jun 2005 01:06:10 -0000 1.30 *************** *** 664,668 **** // draw top info string based on mnGameMode, this function should go elsewhere? strange to have in map ! osg::Vec4 color(0.3, 0.3, 0.5, 1); if (mnGameMode == GAMEMODE_NORMAL) --- 664,668 ---- // draw top info string based on mnGameMode, this function should go elsewhere? strange to have in map ! osg::Vec4 color(0.1, 0.1, 0.2, 1); if (mnGameMode == GAMEMODE_NORMAL) Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tc3DViewer.cpp 28 Jun 2005 02:51:34 -0000 1.19 --- tc3DViewer.cpp 30 Jun 2005 01:06:10 -0000 1.20 *************** *** 985,996 **** void tc3DViewer::UpdateCamera() { ! tcGameObject *obj = simState->GetObject(hookID); ! if (!obj) return; ! ! osg::Vec3 targetPosition; ! if (lookAtTarget || moveWithTarget) ! { ! targetPosition = GetObjectPosition(obj); ! } if (moveWithTarget) { --- 985,991 ---- void tc3DViewer::UpdateCamera() { ! unsigned int objClassification; ! osg::Vec3 targetPosition = GetHookedObjectPositionAndType(objClassification); ! if (moveWithTarget) { *************** *** 1032,1036 **** const unsigned int limitMask = (~PTYPE_FIXED) & 0xFFF0; ! if ((obj->mpDBObject->mnType & limitMask) != 0) { if (cameraPosition._v[2] < -480.0) cameraPosition._v[2] = -480.0; --- 1027,1031 ---- const unsigned int limitMask = (~PTYPE_FIXED) & 0xFFF0; ! if ((objClassification & limitMask) != 0) { if (cameraPosition._v[2] < -480.0) cameraPosition._v[2] = -480.0; *************** *** 1065,1069 **** } ! bool shakeEligible = ((obj->mpDBObject->mnType & (PTYPE_AIR | PTYPE_MISSILE)) != 0) && (cameraRange < 25.0f); if (shakeAirCamera && shakeEligible) --- 1060,1064 ---- } ! bool shakeEligible = ((objClassification & (PTYPE_AIR | PTYPE_MISSILE)) != 0) && (cameraRange < 25.0f); if (shakeAirCamera && shakeEligible) *************** *** 1125,1128 **** --- 1120,1124 ---- unsigned int i = 0; + bool use3Dcheat = tcOptions::Get()->mn3DCheatMode == 3; bool isServer = simState->IsMultiplayerServer(); *************** *** 1132,1136 **** simState->maPlatformState.GetNextAssoc(poolpos,nKey,gameObj); wxASSERT(gameObj->model); // model should be created with gameObj ! if (isServer || gameObj->IsOwnAlliance()) { if (gameObj->model->GetNumParents()==0) --- 1128,1132 ---- simState->maPlatformState.GetNextAssoc(poolpos,nKey,gameObj); wxASSERT(gameObj->model); // model should be created with gameObj ! if (isServer || gameObj->IsOwnAlliance() || use3Dcheat) { if (gameObj->model->GetNumParents()==0) *************** *** 1220,1227 **** * @return object position in world coordinates. */ ! osg::Vec3 tc3DViewer::GetObjectPosition(tcGameObject* obj) { int n3DCheatMode = tcOptions::Get()->mn3DCheatMode; float x, y, z; if (n3DCheatMode == 3) --- 1216,1232 ---- * @return object position in world coordinates. */ ! const osg::Vec3& tc3DViewer::GetHookedObjectPositionAndType(unsigned int& classification) { + static osg::Vec3 lastPos(0, 0, 0); + int n3DCheatMode = tcOptions::Get()->mn3DCheatMode; + tcGameObject* obj = simState->GetObject(hookID); + if (obj == 0) + { + classification = 0; + return lastPos; + } + float x, y, z; if (n3DCheatMode == 3) *************** *** 1251,1262 **** } else ! { ! x = LonToX(obj->mcKin.mfLon_rad); ! y = LatToY(obj->mcKin.mfLat_rad); ! z = obj->mcKin.mfAlt_m; } } ! return osg::Vec3(x,y,z); } --- 1256,1268 ---- } else ! { ! x = lastPos._v[0]; ! y = lastPos._v[1]; ! z = lastPos._v[2]; } } ! lastPos.set(x, y, z); ! return lastPos; } |