[Gcblue-commits] gcb_wx/src/sim Game.cpp,1.49,1.50 tcAeroAirObject.cpp,1.2,1.3 tcCarrierObject.cpp,1
Status: Alpha
Brought to you by:
ddcforge
Update of /cvsroot/gcblue/gcb_wx/src/sim
In directory sc8-pr-cvs1:/tmp/cvs-serv12807/src/sim
Modified Files:
Game.cpp tcAeroAirObject.cpp tcCarrierObject.cpp
tcFlightPort.cpp tcMapView.cpp tcPlatformObject.cpp
tcSimState.cpp
Log Message:
Index: Game.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** Game.cpp 4 Jan 2004 22:24:52 -0000 1.49
--- Game.cpp 5 Jan 2004 02:48:03 -0000 1.50
***************
*** 112,116 ****
mbPaused = false;
mbScenarioEdit = false;
! mbAccelerateTime = false;
meScreenMode = TACTICAL;
mbSaveScenario = false;
--- 112,116 ----
mbPaused = false;
mbScenarioEdit = false;
! accelerateTime = 0;
meScreenMode = TACTICAL;
mbSaveScenario = false;
***************
*** 1206,1213 ****
mcSimState.SetTime(gameTime);
mcSimState.SetDateTime(gameDateZulu);
! if (mbAccelerateTime)
{
! const int accelSteps = 3;
! for (int step=0;step<accelSteps;step++)
{
mcSimState.Update();
--- 1206,1212 ----
mcSimState.SetTime(gameTime);
mcSimState.SetDateTime(gameDateZulu);
! if (accelerateTime)
{
! for (int step=0;step<accelerateTime;step++)
{
mcSimState.Update();
***************
*** 1221,1224 ****
--- 1220,1236 ----
directorTime += fdt;
dateTimeString = gameDateZulu.asString();
+ if (mbPaused)
+ {
+ char buff[16];
+ sprintf(buff," [PAUSED]");
+ dateTimeString += buff;
+ }
+ else if (accelerateTime)
+ {
+ char buff[16];
+ sprintf(buff," [%dx]",accelerateTime+1);
+ dateTimeString += buff;
+ }
+
tacticalMap->SetDateTime(dateTimeString);
viewer->SetGameTime(gameTime);
***************
*** 1458,1465 ****
{
case 'a':
! mbAccelerateTime = !mbAccelerateTime;
return;
case 'F':
viewer->ToggleFog();
return;
case 'p':
--- 1470,1488 ----
{
case 'a':
! accelerateTime++;
! if (accelerateTime == 4)
! {
! accelerateTime = 7; // jump to 8x from 4x
! }
! else if (accelerateTime > 7)
! {
! accelerateTime = 0; // return to normal time after 8x
! }
return;
case 'F':
viewer->ToggleFog();
+ return;
+ case 'K':
+ tacticalMap->ToggleShowTrackTags();
return;
case 'p':
Index: tcAeroAirObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tcAeroAirObject.cpp 9 Dec 2003 00:36:03 -0000 1.2
--- tcAeroAirObject.cpp 5 Jan 2004 02:48:03 -0000 1.3
***************
*** 179,191 ****
if (fuel_kg > 0)
{
if (throttleFraction <= 1.0f)
{
fThrust_N = mpDBObject->mfMaxThrust_N*throttleFraction;
! fuel_kg -= throttleFraction * mpDBObject->mfFuelRate_kgps * dt_s;
}
else
{
fThrust_N = mpDBObject->mfAfterburnThrust_N;
! fuel_kg -= mpDBObject->mfAfterburnFuelRate_kgps * dt_s;
}
if (fuel_kg < 0) fuel_kg = 0; // sets fuel back to zero after flame out
--- 179,192 ----
if (fuel_kg > 0)
{
+ float damagePenalty = 1.0f + 4.0f*mfDamageLevel; // fuel consumption increases with damage
if (throttleFraction <= 1.0f)
{
fThrust_N = mpDBObject->mfMaxThrust_N*throttleFraction;
! fuel_kg -= throttleFraction * mpDBObject->mfFuelRate_kgps * dt_s * damagePenalty;
}
else
{
fThrust_N = mpDBObject->mfAfterburnThrust_N;
! fuel_kg -= mpDBObject->mfAfterburnFuelRate_kgps * dt_s * damagePenalty;
}
if (fuel_kg < 0) fuel_kg = 0; // sets fuel back to zero after flame out
***************
*** 222,226 ****
K_dp = GetParasiticDragCoefficient(vmach);
! fDrag_N = rhv2*K_dp;
fThrust_N = UpdateThrust(dt_s);
--- 223,227 ----
K_dp = GetParasiticDragCoefficient(vmach);
! fDrag_N = rhv2*K_dp*(1 + mfDamageLevel); // drag increases with fractional damage
fThrust_N = UpdateThrust(dt_s);
Index: tcCarrierObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcCarrierObject.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tcCarrierObject.cpp 4 Jan 2004 22:24:52 -0000 1.5
--- tcCarrierObject.cpp 5 Jan 2004 02:48:03 -0000 1.6
***************
*** 53,57 ****
--- 53,100 ----
}
+ /**
+ * Supports aero air model and air generic models. Adding other
+ * model types will fail.
+ * @return true if successful, false otherwise
+ */
+ bool tcCarrierObject::AddChildToFlightDeck(std::string className, std::string unitName,
+ teLocation loc)
+ {
+ tcGameObject *child = NULL; // object to add to flight_deck
+
+ tcDatabaseObject *dbObj = database->GetObject(className);
+ if (tcAirDBObject *airDBObj = dynamic_cast<tcAirDBObject*>(dbObj))
+ {
+ child = new tcAeroAirObject(airDBObj);
+ }
+ else if (tcGenericDBObject *genericDBObj = dynamic_cast<tcGenericDBObject*>(dbObj))
+ {
+ if (genericDBObj->mnModelType == MTYPE_FIXEDWING)
+ {
+ child = new tcAirObject(genericDBObj);
+ }
+ else
+ {
+ std::cerr << "Attempted to add non-air generic object type to carrier: " <<
+ className << "\n";
+ return false;
+ }
+ }
+ else
+ {
+ std::cerr << "Attempted to add non-air object type to carrier: " <<
+ className << "\n";
+ return false;
+ }
+
+ child->mzUnit = unitName.c_str();
+ child->mnAlliance = mnAlliance;
+ child->SetRelativePosition(0,0,0);
+ child->SetRelativeOrientation(0,0,0);
+ AddChild(child); // add child to carrier object
+ flight_deck.AddObject(child, loc); // add child to flight_deck
+ return true;
+ }
/******************************************************************************/
void tcCarrierObject::RandInitNear(float afLon_deg, float afLat_deg) {
Index: tcFlightPort.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tcFlightPort.cpp 4 Jan 2004 22:24:53 -0000 1.4
--- tcFlightPort.cpp 5 Jan 2004 02:48:03 -0000 1.5
***************
*** 461,465 ****
int spot_idx = FindEmptySpot(airstate->goal_location, loc_vector);
airstate->goal_spot = spot_idx;
! airstate->ready_time = afStatusTime + 10.0f; // short times for test
MoveObjectToGoal(airstate);
}
--- 461,465 ----
int spot_idx = FindEmptySpot(airstate->goal_location, loc_vector);
airstate->goal_spot = spot_idx;
! airstate->ready_time = afStatusTime + 300.0f; // short times for test
MoveObjectToGoal(airstate);
}
Index: tcMapView.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** tcMapView.cpp 3 Jan 2004 00:45:13 -0000 1.13
--- tcMapView.cpp 5 Jan 2004 02:48:03 -0000 1.14
***************
*** 82,86 ****
mfLonCenter = mrectCurrentView.XCenter();
mfLatCenter = mrectCurrentView.YCenter();
! if (mfLonWidth < C_PIOVER180*2.0f) {
mfGridSize_rad = C_PIOVER180*(10.0f/60.0f); // 10 nmi
}
--- 82,86 ----
mfLonCenter = mrectCurrentView.XCenter();
mfLatCenter = mrectCurrentView.YCenter();
! if (mfLonWidth < C_PIOVER180*1.5f) {
mfGridSize_rad = C_PIOVER180*(10.0f/60.0f); // 10 nmi
}
***************
*** 1448,1452 ****
if (isControlDown)
{
! SetViewCenterZoom(point,2.0f);
if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);}
return;
--- 1448,1452 ----
if (isControlDown)
{
! SetViewCenterZoom(point,1.5f);
if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);}
return;
***************
*** 1481,1485 ****
if (isControlDown)
{
! SetViewCenterZoom(point,0.5f);
if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);}
return; // old returned true
--- 1481,1485 ----
if (isControlDown)
{
! SetViewCenterZoom(point,0.7f);
if (mpSound != NULL) {mpSound->PlayEffect(SEFFECT_BEEP2);}
return; // old returned true
Index: tcPlatformObject.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** tcPlatformObject.cpp 4 Jan 2004 22:24:53 -0000 1.8
--- tcPlatformObject.cpp 5 Jan 2004 02:48:03 -0000 1.9
***************
*** 112,116 ****
radtoplusminuspi(dh_rad); // map dh_deg to [-180,180]
float dh_max = C_PIOVER180*mpDBObject->mfTurnRate_degps*dt_s;
!
// linearly reduce turn rate near goal
float absdh_rad = fabsf(dh_rad);
--- 112,119 ----
radtoplusminuspi(dh_rad); // map dh_deg to [-180,180]
float dh_max = C_PIOVER180*mpDBObject->mfTurnRate_degps*dt_s;
! if (mfDamageLevel > 0.2f)
! {
! dh_max *= 0.5f;
! }
// linearly reduce turn rate near goal
float absdh_rad = fabsf(dh_rad);
Index: tcSimState.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** tcSimState.cpp 4 Jan 2004 22:24:53 -0000 1.21
--- tcSimState.cpp 5 Jan 2004 02:48:03 -0000 1.22
***************
*** 304,311 ****
/********************************************************************/
/**
! * normalize to toughness if a platform obj, otherwise return afDamage
*/
float tcSimState::GetFractionalDamage(float afDamage, tcGameObject *apGameObj)
{
tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(apGameObj);
if (pPlatformObj != NULL)
--- 304,318 ----
/********************************************************************/
/**
! * normalize to toughness if a platform obj, otherwise return afDamage.
! * This effectively sets all missile toughness to 1.0
*/
float tcSimState::GetFractionalDamage(float afDamage, tcGameObject *apGameObj)
{
+ float damageEffectiveness = randf(1.0f);
+
+ if (damageEffectiveness < 0.1f) return 0; // 10% of weapons duds for now!
+
+ afDamage = afDamage * damageEffectiveness; // scale damage by effectiveness
+
tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(apGameObj);
if (pPlatformObj != NULL)
|