gcblue-commits Mailing List for Global Conflict Blue (Page 48)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2004-08-05 02:22:43
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29972/include/sim Modified Files: tcBallisticWeapon.h tcLauncher.h Log Message: Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcLauncher.h 27 Jul 2004 23:26:06 -0000 1.3 --- tcLauncher.h 5 Aug 2004 02:22:35 -0000 1.4 *************** *** 88,91 **** --- 88,92 ---- void CopyCommandInfoFrom(const tcLauncher& launcher); + float GetCycleTime() const; int GetErrorCode() const {return errorCode;} void SetErrorCode(int code) {errorCode = code;} Index: tcBallisticWeapon.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcBallisticWeapon.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcBallisticWeapon.h 29 Jul 2004 00:14:16 -0000 1.2 --- tcBallisticWeapon.h 5 Aug 2004 02:22:35 -0000 1.3 *************** *** 66,71 **** float vxy_mps; ///< lateral velocity [m/s] - float GetGunneryElevation(float range_m, float dz_m); - }; #endif \ No newline at end of file --- 66,69 ---- |
|
From: Dewitt C. <ddc...@us...> - 2004-07-30 00:13:09
|
Update of /cvsroot/gcblue/gcb_data/sound/wav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28403/sound/wav Added Files: NavalGun1.wav Log Message: --- NEW FILE: NavalGun1.wav --- (This appears to be a binary file; contents omitted.) |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:15:16
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** GCblue.vcproj 27 Jul 2004 23:26:06 -0000 1.59 --- GCblue.vcproj 29 Jul 2004 00:14:16 -0000 1.60 *************** *** 495,498 **** --- 495,501 ---- </File> <File + RelativePath=".\src\database\tcBallisticDBObject.cpp"> + </File> + <File RelativePath="src\database\tcDatabase.cpp"> </File> *************** *** 913,916 **** --- 916,922 ---- </File> <File + RelativePath=".\include\database\tcBallisticDBObject.h"> + </File> + <File RelativePath="include\database\tcDatabase.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:15:16
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CHANGES.txt 27 Jul 2004 00:16:22 -0000 1.28 --- CHANGES.txt 29 Jul 2004 00:14:16 -0000 1.29 *************** *** 3,6 **** --- 3,10 ---- 0.6 --------------------------------------------------------------------- + *** 2004-07-28 Dewitt Colclough *** + - Added ballistic database object and file + - Started naval gunfire targeting + *** 2004-07-26 Dewitt Colclough *** - Changed damage evaluation in tcSimState to check all low-alt |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:15:16
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/include/database Modified Files: tcDatabaseObject.h Added Files: tcBallisticDBObject.h Log Message: --- NEW FILE: tcBallisticDBObject.h --- /* ** @file tcBallisticDBObject.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BALLISTICDBOBJECT_H_ #define _BALLISTICDBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcWeaponDBObject.h" class TiXmlElement; namespace Database { class tcBallisticDBObject : public tcWeaponDBObject { public: virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); int SerializeCSV(CsvTranslator* csv, bool mbLoad); ///< CSV serialization virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings tcBallisticDBObject(tcBallisticDBObject& obj); ///< copy constructor tcBallisticDBObject(); virtual ~tcBallisticDBObject(); }; } // namespace Database #endif Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcDatabaseObject.h 27 Jul 2004 23:26:06 -0000 1.13 --- tcDatabaseObject.h 29 Jul 2004 00:14:16 -0000 1.14 *************** *** 68,71 **** --- 68,72 ---- #define PTYPE_TORPEDO 0x0082 #define PTYPE_FIXED 0x0100 + #define PTYPE_BALLISTIC 0x0200 UINT16 IdxToClassification(int anIdx); *************** *** 102,105 **** --- 103,107 ---- #define DTYPE_FLIGHTPORT 9 #define DTYPE_WEAPON 10 + #define DTYPE_BALLISTIC 11 #define DTYPE_NULL 0xFFFFFFFF |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:14:30
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/src/sim Modified Files: tcBallisticWeapon.cpp tcLauncherState.cpp tcRadar.cpp tcSimState.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** tcSimState.cpp 27 Jul 2004 00:16:24 -0000 1.48 --- tcSimState.cpp 29 Jul 2004 00:14:19 -0000 1.49 *************** *** 1,20 **** ! /* ! * Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" --- 1,22 ---- ! /** ! ** @file tcSimState.cpp */ + /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) + ** All rights reserved. + ** + ** This file is part of the Global Conflict Blue (GCB) program. + ** GCB is free software; you can redistribute it and/or modify + ** it under the terms of version 2 of the GNU General Public License as + ** published by the Free Software Foundation. + ** + ** GCB is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with GCB; if not, write to the Free Software + ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + **/ #include "stdwx.h" *************** *** 37,40 **** --- 39,45 ---- #include "tcAirfieldObject.h" #include "tcAeroAirObject.h" + #include "tcBallisticWeapon.h" + #include "tcBallisticDBObject.h" + #include "tcLauncher.h" #include "tcAirDBObject.h" *************** *** 1316,1319 **** --- 1321,1328 ---- missile->LaunchFrom(launchingPlatform, nLauncher); } + else if (tcBallisticWeapon* ballistic = dynamic_cast<tcBallisticWeapon*>(launched)) + { + ballistic->LaunchFrom(launchingPlatform, nLauncher); + } else { *************** *** 1372,1375 **** --- 1381,1388 ---- return new tcMissileObject(pMissileData); } + else if (tcBallisticDBObject* ballisticData = dynamic_cast<tcBallisticDBObject*>(apDBObject)) + { + return new tcBallisticWeapon(ballisticData); + } else { Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcBallisticWeapon.cpp 27 Jul 2004 23:26:07 -0000 1.1 --- tcBallisticWeapon.cpp 29 Jul 2004 00:14:18 -0000 1.2 *************** *** 1,24 **** ! /** @file tcBallisticWeapon.cpp */ /* ! * Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ! * All rights reserved. ! * ! * This file is part of the Global Conflict Blue (GCB) program. ! * GCB is free software; you can redistribute it and/or modify ! * it under the terms of version 2 of the GNU General Public License as ! * published by the Free Software Foundation. ! * ! * GCB is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with GCB; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tcBallisticWeapon.h" #include "common/tcStream.h" #include "common/tcObjStream.h" --- 1,26 ---- ! /** ! ** @file tcBallisticWeapon.cpp */ /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ! ** All rights reserved. ! ** ! ** This file is part of the Global Conflict Blue (GCB) program. ! ** GCB is free software; you can redistribute it and/or modify ! ** it under the terms of version 2 of the GNU General Public License as ! ** published by the Free Software Foundation. ! ** ! ** GCB is distributed in the hope that it will be useful, ! ** but WITHOUT ANY WARRANTY; without even the implied warranty of ! ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! ** GNU General Public License for more details. ! ** ! ** You should have received a copy of the GNU General Public License ! ** along with GCB; if not, write to the Free Software ! ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tcBallisticWeapon.h" + #include "tcBallisticDBObject.h" #include "common/tcStream.h" #include "common/tcObjStream.h" *************** *** 48,52 **** --- 50,80 ---- } + /** + * Gets elevation for ballistic shell to hit (non-moving) target at a + * horizontal range of range_m and altitude difference of dz_m + * (Altitude difference is ignored for now.) + */ + float tcBallisticWeapon::GetGunneryElevation(float range_m, float dz_m) + { + wxASSERT(mpDBObject); + + float launchSpeed = mpDBObject->launchSpeed_mps; + float c = 0.25f * range_m * range_m * C_G * C_G; + float b = -launchSpeed * launchSpeed; + float b2 = b * b; + float fac = 4.0f * c; + if (b2 < fac) + { + fprintf(stdout, "Warning - Gun out of range\n"); + return 0.25f * C_PI; + } + + float vz = sqrtf( 0.5f * (-b + sqrt(b2 - fac)) ); + + float elevation_rad = asinf(vz / launchSpeed); + + return elevation_rad; + } /** *************** *** 66,72 **** --- 94,110 ---- 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; + + tsGeoPoint targetDatum = pLauncher->msDatum; + mcKin.mfHeading_rad = obj->mcKin.HeadingToGeoRad(&targetDatum); + + float range_m = 1000.0f * obj->mcKin.RangeToKm(&targetDatum); + float dz_m = targetDatum.mfAlt_m - obj->mcKin.mfAlt_m; + + mcKin.mfPitch_rad = GetGunneryElevation(range_m, dz_m); } *************** *** 76,79 **** --- 114,119 ---- mnAlliance = obj->mnAlliance; + + simState->AddPlatform(static_cast<tcGameObject*>(this)); *************** *** 83,86 **** --- 123,128 ---- } + + /** * *************** *** 90,93 **** --- 132,137 ---- float dt_s = (float)(afStatusTime - mfStatusTime); + mfStatusTime = afStatusTime; + wxASSERT(mpDBObject); *************** *** 114,118 **** mcKin.mfAlt_m += vz_mps * dt_s; ! mcKin.mfPitch_rad = atan2f(vxy_mps, vz_mps); mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; mcKin.mfSpeed_kts = C_MPSTOKTS * sqrtf(vxy_mps*vxy_mps + vz_mps*vz_mps); --- 158,162 ---- mcKin.mfAlt_m += vz_mps * dt_s; ! mcKin.mfPitch_rad = atan2f(vz_mps, vxy_mps); mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; mcKin.mfSpeed_kts = C_MPSTOKTS * sqrtf(vxy_mps*vxy_mps + vz_mps*vz_mps); *************** *** 124,131 **** if (terrainHeight_m < 0) terrainHeight_m = 0; ! float dz = mcTerrain.mfHeight_m - mcKin.mfAlt_m; // height above ground or sea level float t_impact = dz / vz_mps; ! if (t_impact <= 0.03f) { Detonate(t_impact); --- 168,176 ---- if (terrainHeight_m < 0) terrainHeight_m = 0; ! float dz = terrainHeight_m - mcKin.mfAlt_m; // height above ground or sea level ! float t_impact = dz / vz_mps; ! if ((vz_mps < 0)&&(t_impact <= 0.03f)) { Detonate(t_impact); *************** *** 200,203 **** --- 245,249 ---- mnModelType = MTYPE_BALLISTIC; + mpDBObject = 0; } *************** *** 209,212 **** --- 255,259 ---- { mnModelType = MTYPE_BALLISTIC; + mpDBObject = o.mpDBObject; vz_mps = o.vz_mps; vxy_mps = o.vxy_mps; *************** *** 216,220 **** * Constructor that initializes using info from database entry. */ ! tcBallisticWeapon::tcBallisticWeapon(tcWeaponDBObject* obj) : tcWeaponObject(obj), vz_mps(0), --- 263,267 ---- * Constructor that initializes using info from database entry. */ ! tcBallisticWeapon::tcBallisticWeapon(tcBallisticDBObject* obj) : tcWeaponObject(obj), vz_mps(0), *************** *** 222,225 **** --- 269,273 ---- { mnModelType = MTYPE_BALLISTIC; + mpDBObject = obj; } Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcLauncherState.cpp 27 Jul 2004 23:26:07 -0000 1.13 --- tcLauncherState.cpp 29 Jul 2004 00:14:19 -0000 1.14 *************** *** 107,113 **** new_launcher.mnTargetFlags = pMissileDBObj->mnTargetFlags; } ! else { ! new_launcher.mnTargetFlags = LAND_TARGET; } launchers.push_back(new_launcher); --- 107,114 ---- new_launcher.mnTargetFlags = pMissileDBObj->mnTargetFlags; } ! else // assume ballistic vs. land (TODO rework this) { ! new_launcher.meLaunchMode = DATUM_ONLY; ! new_launcher.mnTargetFlags = SURFACE_TARGET | LAND_TARGET; } launchers.push_back(new_launcher); Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcRadar.cpp 19 Jul 2004 00:53:01 -0000 1.9 --- tcRadar.cpp 29 Jul 2004 00:14:19 -0000 1.10 *************** *** 26,29 **** --- 26,30 ---- #include "tcMissileObject.h" #include "tcAirfieldObject.h" + #include "tcBallisticWeapon.h" #include "tcGenericDBObject.h" *************** *** 141,144 **** --- 142,149 ---- isGround = true; } + else if (const tcBallisticWeapon* ball = dynamic_cast<const tcBallisticWeapon*>(target)) + { + return false; + } else { |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:14:27
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/src/database Modified Files: tcDatabase.cpp Added Files: tcBallisticDBObject.cpp Log Message: --- NEW FILE: tcBallisticDBObject.cpp --- /* ** @file tcBallisticDBObject.cpp */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #if _MSC_VER > 1000 #pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library. #endif // _MSC_VER > 1000 #include "tcBallisticDBObject.h" #include "math_constants.h" #include "randfn.h" #include "CsvTranslator.h" #include "common/tinyxml.h" using namespace std; namespace Database { void tcBallisticDBObject::PrintToFile(tcFile& file) { tcWeaponDBObject::PrintToFile(file); } int tcBallisticDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { tcWeaponDBObject::Serialize(file,mbLoad,anVersion); if (mbLoad) { } else { } return true; } int tcBallisticDBObject::SerializeCSV(CsvTranslator *csv, bool mbLoad) { tcWeaponDBObject::SerializeCSV(csv, mbLoad); if (mbLoad) { } else { csv->WriteLine(); } return 1; } /** * Loads/saves XML data for database object * @param load true to load, false to save */ void tcBallisticDBObject::SerializeXml(TiXmlElement* node, bool load) { if (load) return; // write only for now wxASSERT(node); TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("sensor"))->ToElement(); //localNode->SetAttribute("maxRange_km" ,mfMaxRange_km); tcWeaponDBObject::SerializeXml(node, load); } int tcBallisticDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { tcWeaponDBObject::WriteCSVHeader(csv); csv->WriteLine(); // write line since this is a leaf class return 1; } tcBallisticDBObject::tcBallisticDBObject() : tcWeaponDBObject() { mzClass = "Default Ballistic"; mnClassID = DTYPE_BALLISTIC; } tcBallisticDBObject::tcBallisticDBObject(tcBallisticDBObject& obj) : tcWeaponDBObject(obj) { } tcBallisticDBObject::~tcBallisticDBObject() { } } Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcDatabase.cpp 27 Jul 2004 00:16:23 -0000 1.12 --- tcDatabase.cpp 29 Jul 2004 00:14:17 -0000 1.13 *************** *** 1,6 **** /* ! ** tcDatabase.cpp ! ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tcDatabase.cpp ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 45,48 **** --- 45,49 ---- #include "tcAirDBObject.h" #include "tcFlightportDBObject.h" + #include "tcBallisticDBObject.h" #include "common/tinyxml.h" *************** *** 81,84 **** --- 82,86 ---- std::string airFileName = path + string("air") + suffix + ".csv"; std::string flightportFileName = path + string("flightport") + suffix + ".csv"; + std::string ballisticFileName = path + string("ballistic") + suffix + ".csv"; if (mbLoad) *************** *** 120,123 **** --- 122,130 ---- serializer.LoadCsv(); } + // tcBallisticDBObject + { + tcDBObjSerializer<tcBallisticDBObject> serializer(ballisticFileName, this); + serializer.LoadCsv(); + } } else *************** *** 159,162 **** --- 166,174 ---- serializer.SaveCsv(); } + // tcBallisticDBObject + { + tcDBObjSerializer<tcBallisticDBObject> serializer(ballisticFileName, this); + serializer.SaveCsv(); + } } |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:14:27
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/src/scriptinterface Modified Files: tcPlatformInterface.cpp Log Message: Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcPlatformInterface.cpp 19 Jul 2004 00:53:01 -0000 1.25 --- tcPlatformInterface.cpp 29 Jul 2004 00:14:18 -0000 1.26 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcPlatformInterface.cpp ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 39,42 **** --- 41,45 ---- #include "tcAeroAirObject.h" #include "tcGenericDBObject.h" + #include "tcBallisticDBObject.h" #include "tcLauncherState.h" #include "tcLauncher.h" *************** *** 418,430 **** } const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); ! tcMissileDBObject *pMissileDBObj = ! dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj); ! if (pMissileDBObj == NULL) ! { ! return false; // only missiles supported } info.mnLauncher = anLauncher; info.mnQuantity = pLauncherData->mnUncommitted; - info.mfRange_km = pMissileDBObj->mfRange_km; info.mnTargetFlags = pLauncherData->mnTargetFlags; --- 421,444 ---- } const tcLauncher* pLauncherData = mpPlatformObj->mcLauncherState.GetLauncher(anLauncher); ! ! if (tcMissileDBObject* missileDBObj = ! dynamic_cast<tcMissileDBObject*>(pLauncherData->mpChildDBObj)) ! { ! info.mfRange_km = missileDBObj->mfRange_km; ! } ! else if (tcBallisticDBObject* ballisticDBObj = ! dynamic_cast<tcBallisticDBObject*>(pLauncherData->mpChildDBObj)) ! { ! info.mfRange_km = 20; } + else + { + fprintf(stderr, "Error - unsupported launcher child class (%s)\n", + pLauncherData->mpChildDBObj->GetClassName()); + return false; + } + info.mnLauncher = anLauncher; info.mnQuantity = pLauncherData->mnUncommitted; info.mnTargetFlags = pLauncherData->mnTargetFlags; |
|
From: Dewitt C. <ddc...@us...> - 2004-07-29 00:14:26
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29425/include/sim Modified Files: tcBallisticWeapon.h tcSimState.h Log Message: Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** tcSimState.h 27 Jul 2004 00:16:23 -0000 1.26 --- tcSimState.h 29 Jul 2004 00:14:16 -0000 1.27 *************** *** 1,6 **** ! /* ** @file tcSimState.h ! ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ** @file tcSimState.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. Index: tcBallisticWeapon.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcBallisticWeapon.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcBallisticWeapon.h 27 Jul 2004 23:26:06 -0000 1.1 --- tcBallisticWeapon.h 29 Jul 2004 00:14:16 -0000 1.2 *************** *** 29,33 **** namespace Database { ! class tcWeaponDBObject; } --- 29,33 ---- namespace Database { ! class tcBallisticDBObject; } *************** *** 59,68 **** tcBallisticWeapon(); tcBallisticWeapon(tcBallisticWeapon&); ! tcBallisticWeapon(tcWeaponDBObject* obj); ~tcBallisticWeapon(); protected: float vz_mps; ///< vertical velocity [m/s] float vxy_mps; ///< lateral velocity [m/s] }; --- 59,70 ---- tcBallisticWeapon(); tcBallisticWeapon(tcBallisticWeapon&); ! tcBallisticWeapon(tcBallisticDBObject* obj); ~tcBallisticWeapon(); protected: + tcBallisticDBObject* mpDBObject; float vz_mps; ///< vertical velocity [m/s] float vxy_mps; ///< lateral velocity [m/s] + float GetGunneryElevation(float range_m, float dz_m); }; |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:16
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280/include/database Modified Files: tcDatabaseObject.h tcWeaponDBObject.h Log Message: Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcDatabaseObject.h 27 Jul 2004 00:16:23 -0000 1.12 --- tcDatabaseObject.h 27 Jul 2004 23:26:06 -0000 1.13 *************** *** 88,91 **** --- 88,92 ---- #define MTYPE_FIXEDWINGX 12 // model with more realism #define MTYPE_AIRFIELD 13 + #define MTYPE_BALLISTIC 14 // database object types (database class identifier) Index: tcWeaponDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcWeaponDBObject.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcWeaponDBObject.h 27 Jul 2004 00:16:23 -0000 1.1 --- tcWeaponDBObject.h 27 Jul 2004 23:26:06 -0000 1.2 *************** *** 37,40 **** --- 37,41 ---- public: float mfDamage; ///< damage value + float launchSpeed_mps; ///< initial speed at launch, use zero to use plat speed virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:16
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280/include/common Modified Files: math_constants.h Log Message: Index: math_constants.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/math_constants.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** math_constants.h 28 Mar 2004 11:25:48 -0000 1.5 --- math_constants.h 27 Jul 2004 23:26:06 -0000 1.6 *************** *** 43,47 **** #define C_MPSTODEGPS 8.999280e-006f #define C_MPSTORADPS 1.5706707e-7f ! #define C_G 9.80f #define C_KTSTODEGPS 4.6296296296296e-6f #define C_KTSTORADPS 8.0802280e-8f --- 43,47 ---- #define C_MPSTODEGPS 8.999280e-006f #define C_MPSTORADPS 1.5706707e-7f ! #define C_G 9.80665f #define C_KTSTODEGPS 4.6296296296296e-6f #define C_KTSTORADPS 8.0802280e-8f |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:16
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280/src/sim Modified Files: tcLauncher.cpp tcLauncherState.cpp tcMissileObject.cpp Added Files: tcBallisticWeapon.cpp Log Message: --- NEW FILE: tcBallisticWeapon.cpp --- /** @file tcBallisticWeapon.cpp */ /* * Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) * All rights reserved. * * This file is part of the Global Conflict Blue (GCB) program. * GCB is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * GCB is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GCB; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tcBallisticWeapon.h" #include "common/tcStream.h" #include "common/tcObjStream.h" #include "tc3DModel.h" #include "tcParticleEffect.h" #include "tcLauncher.h" #include "tcSimState.h" /** * Load state from update stream */ tcUpdateStream& tcBallisticWeapon::operator<<(tcUpdateStream& stream) { tcWeaponObject::operator<<(stream); return stream; } /** * Save state to update stream */ tcUpdateStream& tcBallisticWeapon::operator>>(tcUpdateStream& stream) { tcWeaponObject::operator>>(stream); return stream; } /** * Initializes ballistic weapon state for launch from game object. * Adds self to simulation * * @param obj launching game object * @param launcher index of launcher */ void tcBallisticWeapon::LaunchFrom(tcGameObject* obj, unsigned nLauncher) { const tcLauncher* pLauncher = obj->GetLauncher(nLauncher); mfStatusTime = obj->mfStatusTime; mcKin = obj->mcKin; mcKin.mfHeading_rad += pLauncher->pointingAngle; mcKin.mfPitch_rad += pLauncher->pointingElevation; if (mpDBObject->launchSpeed_mps != 0) { mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; } tcString s; s.Format("Ball %s", obj->mzUnit.mz); mzUnit = s.GetBuffer(); mnAlliance = obj->mnAlliance; simState->AddPlatform(static_cast<tcGameObject*>(this)); // Set intended target (has to be done after alliance and id is set). // This is a tcWeaponObject method SetIntendedTarget(pLauncher->mnTargetID); } /** * */ void tcBallisticWeapon::Update(double afStatusTime) { float dt_s = (float)(afStatusTime - mfStatusTime); wxASSERT(mpDBObject); // initialize local kinematic state variables if vxy_mps == 0 if (vxy_mps == 0) { float v = C_KTSTOMPS * mcKin.mfSpeed_kts; vz_mps = v * sinf(mcKin.mfPitch_rad); float cospitch = cosf(mcKin.mfPitch_rad); vxy_mps = v * cospitch; } vz_mps += -C_G * dt_s; float dist = C_MTORAD * dt_s * vxy_mps; float dlon = dist * sinf(mcKin.mfHeading_rad) / cosf(mcKin.mfLat_rad); float dlat = dist * cosf(mcKin.mfHeading_rad); mcKin.mfLon_rad += dlon; mcKin.mfLat_rad += dlat; mcKin.mfAlt_m += vz_mps * dt_s; mcKin.mfPitch_rad = atan2f(vxy_mps, vz_mps); mcKin.mfClimbAngle_rad = mcKin.mfPitch_rad; mcKin.mfSpeed_kts = C_MPSTOKTS * sqrtf(vxy_mps*vxy_mps + vz_mps*vz_mps); if (clientMode) return; /*** check for impact ***/ float terrainHeight_m = mcTerrain.mfHeight_m; if (terrainHeight_m < 0) terrainHeight_m = 0; float dz = mcTerrain.mfHeight_m - mcKin.mfAlt_m; // height above ground or sea level float t_impact = dz / vz_mps; if (t_impact <= 0.03f) { Detonate(t_impact); } } /** * */ void tcBallisticWeapon::Clear() { tcGameObject::Clear(); vz_mps = 0; vxy_mps = 0; } /** * */ void tcBallisticWeapon::PrintToFile(tcFile& file) { tcString s; tcWeaponObject::PrintToFile(file); s.Format(" Ballistic Weapon Object\n"); file.WriteString(s.GetBuffer()); } /** * */ void tcBallisticWeapon::SaveToFile(tcFile& file) { tcWeaponObject::SaveToFile(file); } /** * */ void tcBallisticWeapon::LoadFromFile(tcFile& file) { tcWeaponObject::LoadFromFile(file); } /** * */ void tcBallisticWeapon::Serialize(tcFile& file, bool mbLoad) { if (mbLoad) { LoadFromFile(file); } else { SaveToFile(file); } } /** * */ tcBallisticWeapon::tcBallisticWeapon() : tcWeaponObject() { Clear(); mnModelType = MTYPE_BALLISTIC; } /** * Copy constructor. */ tcBallisticWeapon::tcBallisticWeapon(tcBallisticWeapon& o) : tcWeaponObject(o) { mnModelType = MTYPE_BALLISTIC; vz_mps = o.vz_mps; vxy_mps = o.vxy_mps; } /** * Constructor that initializes using info from database entry. */ tcBallisticWeapon::tcBallisticWeapon(tcWeaponDBObject* obj) : tcWeaponObject(obj), vz_mps(0), vxy_mps(0) { mnModelType = MTYPE_BALLISTIC; } /** * */ tcBallisticWeapon::~tcBallisticWeapon() { } Index: tcLauncher.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncher.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcLauncher.cpp 29 May 2004 00:11:54 -0000 1.2 --- tcLauncher.cpp 27 Jul 2004 23:26:07 -0000 1.3 *************** *** 1,5 **** /** @file tcLauncher.cpp ! ** ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** --- 1,5 ---- /** @file tcLauncher.cpp ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** *************** *** 174,177 **** --- 174,178 ---- buffer >> mnTargetFlags; buffer >> pointingAngle; + buffer >> pointingElevation; buffer >> fireControlSensorIdx; *************** *** 201,204 **** --- 202,206 ---- buffer << mnTargetFlags; buffer << pointingAngle; + buffer << pointingElevation; buffer << fireControlSensorIdx; Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMissileObject.cpp 23 Jul 2004 00:45:47 -0000 1.14 --- tcMissileObject.cpp 27 Jul 2004 23:26:07 -0000 1.15 *************** *** 140,143 **** --- 140,144 ---- mcKin = obj->mcKin; mcKin.mfHeading_rad += pLauncher->pointingAngle; + mcKin.mfPitch_rad += pLauncher->pointingElevation; tcString s; Index: tcLauncherState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcLauncherState.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcLauncherState.cpp 19 Jul 2004 00:53:01 -0000 1.12 --- tcLauncherState.cpp 27 Jul 2004 23:26:07 -0000 1.13 *************** *** 81,84 **** --- 81,85 ---- tcLauncher new_launcher; + // this code should be moved to tcLauncher class new_launcher.mnChildDBKey = nChildKey; new_launcher.mpChildDBObj = pChildDBObj; *************** *** 94,97 **** --- 95,99 ---- new_launcher.mnUncommitted = new_launcher.mnCurrent; new_launcher.pointingAngle = azimuth_rad; + new_launcher.pointingElevation = 0; new_launcher.fireControlSensor = NULL; new_launcher.errorCode = 0; |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:16
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** GCblue.vcproj 27 Jul 2004 00:16:22 -0000 1.58 --- GCblue.vcproj 27 Jul 2004 23:26:06 -0000 1.59 *************** *** 350,353 **** --- 350,356 ---- </File> <File + RelativePath=".\src\sim\tcBallisticWeapon.cpp"> + </File> + <File RelativePath="src\sim\tcCarrierObject.cpp"> </File> *************** *** 759,762 **** --- 762,768 ---- </File> <File + RelativePath=".\include\sim\tcBallisticWeapon.h"> + </File> + <File RelativePath="include\sim\tcCarrierObject.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:16
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280/include/sim Modified Files: tcLauncher.h Added Files: tcBallisticWeapon.h Log Message: Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcLauncher.h 29 May 2004 00:11:53 -0000 1.2 --- tcLauncher.h 27 Jul 2004 23:26:06 -0000 1.3 *************** *** 72,75 **** --- 72,76 ---- int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x03 - land float pointingAngle; ///< boresight azimuth angle in radians relative nose/bow + float pointingElevation; ///< elevation angle in radians relative (to horizon?) tcRadar *fireControlSensor; ///< sensor for fire control guidance --- NEW FILE: tcBallisticWeapon.h --- /** @file tcBallisticWeapon.h ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #pragma once #ifndef _TCBALLISTICWEAPON_H_ #define _TCBALLISTICWEAPON_H_ #include "tcWeaponObject.h" namespace Database { class tcWeaponDBObject; } class tcUpdateStream; /** * Class for unguided ballistic weapons e.g. gun rounds, dumb bombs. * Detonation is on impact with terrain or ocean surface. * Currently this does not model drag to make targeting easy. * * @see tcWeaponObject */ class tcBallisticWeapon : public tcWeaponObject { public: void Clear(); void LaunchFrom(tcGameObject* obj, unsigned nLauncher); virtual void Update(double afStatusTime); void PrintToFile(tcFile&); void SaveToFile(tcFile& file); void LoadFromFile(tcFile& file); virtual void Serialize(tcFile& file, bool mbLoad); virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); tcBallisticWeapon(); tcBallisticWeapon(tcBallisticWeapon&); tcBallisticWeapon(tcWeaponDBObject* obj); ~tcBallisticWeapon(); protected: float vz_mps; ///< vertical velocity [m/s] float vxy_mps; ///< lateral velocity [m/s] }; #endif |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 23:26:15
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16280/src/database Modified Files: tcWeaponDBObject.cpp Log Message: Index: tcWeaponDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcWeaponDBObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcWeaponDBObject.cpp 27 Jul 2004 00:16:23 -0000 1.1 --- tcWeaponDBObject.cpp 27 Jul 2004 23:26:07 -0000 1.2 *************** *** 45,48 **** --- 45,51 ---- sprintf(zBuff," damage: %.1f \n", mfDamage); file.WriteString(zBuff); + + sprintf(zBuff," launch speed: %.1f mps \n", launchSpeed_mps); + file.WriteString(zBuff); } *************** *** 53,60 **** --- 56,65 ---- { file.Read(&mfDamage, sizeof(mfDamage)); + file.Read(&launchSpeed_mps, sizeof(launchSpeed_mps)); } else { file.Write(&mfDamage, sizeof(mfDamage)); + file.Write(&launchSpeed_mps, sizeof(launchSpeed_mps)); } return true; *************** *** 68,75 **** --- 73,82 ---- { *csv >> mfDamage; + *csv >> launchSpeed_mps; } else { *csv << mfDamage; + *csv << launchSpeed_mps; // csv->WriteLine(); // do not writeline since this isn't a leaf class } *************** *** 89,92 **** --- 96,100 ---- localNode->SetAttribute("mfDamage" , mfDamage); + localNode->SetAttribute("launchSpeed_mps" , launchSpeed_mps); tcDatabaseObject::SerializeXml(node, load); *************** *** 98,101 **** --- 106,110 ---- *csv << "Damage"; + *csv << "Launch Speed [m/s]"; return 1; } *************** *** 107,110 **** --- 116,120 ---- mfDamage = 1.0; + launchSpeed_mps = 0; } *************** *** 113,116 **** --- 123,127 ---- { mfDamage = obj.mfDamage; + launchSpeed_mps = obj.launchSpeed_mps; } |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:34
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/include/database Modified Files: tcDatabaseObject.h tcMissileDBObject.h tcSensorDBObject.h Added Files: tcWeaponDBObject.h Log Message: Index: tcDatabaseObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcDatabaseObject.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcDatabaseObject.h 18 Jul 2004 03:17:59 -0000 1.11 --- tcDatabaseObject.h 27 Jul 2004 00:16:23 -0000 1.12 *************** *** 100,103 **** --- 100,104 ---- #define DTYPE_AIR 8 #define DTYPE_FLIGHTPORT 9 + #define DTYPE_WEAPON 10 #define DTYPE_NULL 0xFFFFFFFF --- NEW FILE: tcWeaponDBObject.h --- /** ** @file tcWeaponDBObject.h */ /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _WEAPONDBOBJECT_H_ #define _WEAPONDBOBJECT_H_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "tcDatabaseObject.h" class TiXmlElement; namespace Database { class tcWeaponDBObject : public tcDatabaseObject { public: float mfDamage; ///< damage value virtual const char* GetClassName() {return "Sensor";} ///< returns class name of database object virtual void PrintToFile(tcFile& file); int Serialize(tcFile& file, bool mbLoad, UINT32 anVersion); int SerializeCSV(CsvTranslator* csv, bool mbLoad); ///< CSV serialization virtual void SerializeXml(TiXmlElement* node, bool load); ///< XML serialization static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings protected: tcWeaponDBObject(); tcWeaponDBObject(tcWeaponDBObject& obj); ///< copy constructor virtual ~tcWeaponDBObject(); }; } // namespace Database #endif Index: tcSensorDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSensorDBObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcSensorDBObject.h 28 Mar 2004 23:12:27 -0000 1.4 --- tcSensorDBObject.h 27 Jul 2004 00:16:23 -0000 1.5 *************** *** 48,51 **** --- 48,52 ---- static int WriteCSVHeader(CsvTranslator* csv); ///< writes column headings + protected: tcSensorDBObject(); tcSensorDBObject(tcSensorDBObject& obj); ///< copy constructor Index: tcMissileDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcMissileDBObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcMissileDBObject.h 19 Jul 2004 00:52:26 -0000 1.9 --- tcMissileDBObject.h 27 Jul 2004 00:16:23 -0000 1.10 *************** *** 1,6 **** ! /* ! ** tcMissileDBObject.h ! ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcMissileDBObject.h ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 27,31 **** #endif // _MSC_VER > 1000 ! #include "tcDatabaseObject.h" class TiXmlElement; --- 27,31 ---- #endif // _MSC_VER > 1000 ! #include "tcWeaponDBObject.h" class TiXmlElement; *************** *** 99,103 **** #define MISSILE_TARGET 0x0008 ! class tcMissileDBObject : public tcDatabaseObject { public: --- 99,103 ---- #define MISSILE_TARGET 0x0008 ! class tcMissileDBObject : public tcWeaponDBObject { public: *************** *** 120,125 **** // other parameters ! float mfDamage; ///< damage value ! teDamageType meDamageType; ///< damage type enumeration int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x04 - land float mfRcs_dbsm; ///< radar cross section, [dBsm] --- 120,125 ---- // other parameters ! //float mfDamage; ///< damage value ! //teDamageType meDamageType; ///< damage type enumeration int mnTargetFlags; ///< 0x01 - surface, 0x02 - air, 0x04 - land float mfRcs_dbsm; ///< radar cross section, [dBsm] |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:34
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/src/common Modified Files: simmath.cpp Log Message: Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** simmath.cpp 19 Jul 2004 00:53:00 -0000 1.12 --- simmath.cpp 27 Jul 2004 00:16:23 -0000 1.13 *************** *** 454,457 **** --- 454,477 ---- } + /** + * Predicts position ahead by dt_s seconds + */ + void tcKinematics::PredictPosition(float dt_s, + double& lon_rad, double& lat_rad, float& alt_m) + { + float v = C_KTSTOMPS*mfSpeed_kts; + float vz = v*sinf(mfPitch_rad); + + float cospitch = cosf(mfPitch_rad); + float k = C_MTORAD * dt_s * v * cospitch; + float dlon = k * sinf(mfHeading_rad) / cosf(mfLat_rad); + float dlat = k * cosf(mfHeading_rad); + + lon_rad = mfLon_rad + dlon; + lat_rad = mfLat_rad + dlat; + alt_m = mfAlt_m + vz * dt_s; + + } + // returns radian heading to track float tcKinematics::HeadingToTrack(const tcTrack& track) { |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:34
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/src/database Modified Files: tcDatabase.cpp tcMissileDBObject.cpp Added Files: tcWeaponDBObject.cpp Log Message: --- NEW FILE: tcWeaponDBObject.cpp --- /** ** @file tcWeaponDBObject.cpp */ /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" #if _MSC_VER > 1000 #pragma warning(disable:4786) // suppress warning for STL bug in VC6, see Q167355 in the MSDN Library. #endif // _MSC_VER > 1000 #include "tcWeaponDBObject.h" #include "math_constants.h" #include "randfn.h" #include "CsvTranslator.h" #include "common/tinyxml.h" using namespace std; namespace Database { void tcWeaponDBObject::PrintToFile(tcFile& file) { char zBuff[128]; tcDatabaseObject::PrintToFile(file); sprintf(zBuff," damage: %.1f \n", mfDamage); file.WriteString(zBuff); } int tcWeaponDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { tcDatabaseObject::Serialize(file,mbLoad,anVersion); if (mbLoad) { file.Read(&mfDamage, sizeof(mfDamage)); } else { file.Write(&mfDamage, sizeof(mfDamage)); } return true; } int tcWeaponDBObject::SerializeCSV(CsvTranslator *csv, bool mbLoad) { tcDatabaseObject::SerializeCSV(csv, mbLoad); if (mbLoad) { *csv >> mfDamage; } else { *csv << mfDamage; // csv->WriteLine(); // do not writeline since this isn't a leaf class } return 1; } /** * Loads/saves XML data for database object * @param load true to load, false to save */ void tcWeaponDBObject::SerializeXml(TiXmlElement* node, bool load) { if (load) return; // write only for now wxASSERT(node); TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("weapon"))->ToElement(); localNode->SetAttribute("mfDamage" , mfDamage); tcDatabaseObject::SerializeXml(node, load); } int tcWeaponDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { tcDatabaseObject::WriteCSVHeader(csv); *csv << "Damage"; return 1; } tcWeaponDBObject::tcWeaponDBObject() : tcDatabaseObject() { mzClass = "Default weapon"; mnClassID = DTYPE_WEAPON; mfDamage = 1.0; } tcWeaponDBObject::tcWeaponDBObject(tcWeaponDBObject& obj) : tcDatabaseObject(obj) { mfDamage = obj.mfDamage; } tcWeaponDBObject::~tcWeaponDBObject() { } } Index: tcMissileDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcMissileDBObject.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcMissileDBObject.cpp 30 Mar 2004 01:15:21 -0000 1.7 --- tcMissileDBObject.cpp 27 Jul 2004 00:16:23 -0000 1.8 *************** *** 1,6 **** /* ! ** tcMissileDBObject.cpp ! ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,7 ---- /* ! ** @file tcMissileDBObject.cpp ! */ ! /* ! ** Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 73,77 **** tcString s; ! tcDatabaseObject::PrintToFile(file); s.Format(" "); --- 74,78 ---- tcString s; ! tcWeaponDBObject::PrintToFile(file); s.Format(" "); *************** *** 81,85 **** int tcMissileDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { ! tcDatabaseObject::Serialize(file,mbLoad,anVersion); if (mbLoad) { --- 82,87 ---- int tcMissileDBObject::Serialize(tcFile& file, bool mbLoad, UINT32 anVersion) { ! tcWeaponDBObject::Serialize(file, mbLoad, anVersion); ! if (mbLoad) { *************** *** 98,103 **** file.Read(&mfSustThrust_N,sizeof(mfSustThrust_N)); file.Read(&mfSustTime_s,sizeof(mfSustTime_s)); ! file.Read(&mfDamage,sizeof(mfDamage)); ! file.Read(&meDamageType,sizeof(meDamageType)); file.Read(&mfRcs_dbsm,sizeof(mfRcs_dbsm)); file.Read(&mfRange_km,sizeof(mfRange_km)); --- 100,105 ---- file.Read(&mfSustThrust_N,sizeof(mfSustThrust_N)); file.Read(&mfSustTime_s,sizeof(mfSustTime_s)); ! //file.Read(&mfDamage,sizeof(mfDamage)); ! //file.Read(&meDamageType,sizeof(meDamageType)); file.Read(&mfRcs_dbsm,sizeof(mfRcs_dbsm)); file.Read(&mfRange_km,sizeof(mfRange_km)); *************** *** 135,140 **** file.Write(&mfSustThrust_N,sizeof(mfSustThrust_N)); file.Write(&mfSustTime_s,sizeof(mfSustTime_s)); ! file.Write(&mfDamage,sizeof(mfDamage)); ! file.Write(&meDamageType,sizeof(meDamageType)); file.Write(&mfRcs_dbsm,sizeof(mfRcs_dbsm)); file.Write(&mfRange_km,sizeof(mfRange_km)); --- 137,142 ---- file.Write(&mfSustThrust_N,sizeof(mfSustThrust_N)); file.Write(&mfSustTime_s,sizeof(mfSustTime_s)); ! //file.Write(&mfDamage,sizeof(mfDamage)); ! //file.Write(&meDamageType,sizeof(meDamageType)); file.Write(&mfRcs_dbsm,sizeof(mfRcs_dbsm)); file.Write(&mfRange_km,sizeof(mfRange_km)); *************** *** 155,163 **** int tcMissileDBObject::SerializeCSV(Database::CsvTranslator *csv, bool mbLoad) { ! tcDatabaseObject::SerializeCSV(csv, mbLoad); if (mbLoad) { std::string s; ! int val; *csv >> mfMass_kg; --- 157,165 ---- int tcMissileDBObject::SerializeCSV(Database::CsvTranslator *csv, bool mbLoad) { ! tcWeaponDBObject::SerializeCSV(csv, mbLoad); if (mbLoad) { std::string s; ! // int val; *csv >> mfMass_kg; *************** *** 175,180 **** *csv >> mfSustThrust_N; *csv >> mfSustTime_s; ! *csv >> mfDamage; ! *csv >> val; meDamageType = (teDamageType)val; *csv >> mfRcs_dbsm; *csv >> mfRange_km; --- 177,182 ---- *csv >> mfSustThrust_N; *csv >> mfSustTime_s; ! //*csv >> mfDamage; ! //*csv >> val; meDamageType = (teDamageType)val; *csv >> mfRcs_dbsm; *csv >> mfRange_km; *************** *** 221,226 **** *csv << mfSustThrust_N; *csv << mfSustTime_s; ! *csv << mfDamage; ! *csv << long(meDamageType); *csv << mfRcs_dbsm; *csv << mfRange_km; --- 223,228 ---- *csv << mfSustThrust_N; *csv << mfSustTime_s; ! //*csv << mfDamage; ! //*csv << long(meDamageType); *csv << mfRcs_dbsm; *csv << mfRange_km; *************** *** 277,282 **** localNode->SetAttribute("sustThrust_N", mfSustThrust_N); localNode->SetAttribute("sustTime_s", mfSustTime_s); ! localNode->SetAttribute("damage", mfDamage); ! localNode->SetAttribute("damageType", (int)meDamageType); localNode->SetAttribute("rcs_dbsm", mfRcs_dbsm); localNode->SetAttribute("range_km", mfRange_km); --- 279,284 ---- localNode->SetAttribute("sustThrust_N", mfSustThrust_N); localNode->SetAttribute("sustTime_s", mfSustTime_s); ! //localNode->SetAttribute("damage", mfDamage); ! //localNode->SetAttribute("damageType", (int)meDamageType); localNode->SetAttribute("rcs_dbsm", mfRcs_dbsm); localNode->SetAttribute("range_km", mfRange_km); *************** *** 295,304 **** } ! tcDatabaseObject::SerializeXml(node, load); } int tcMissileDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { ! tcDatabaseObject::WriteCSVHeader(csv); csv->WriteField("Mass_kg"); csv->WriteField("DragArea_sm"); --- 297,307 ---- } ! tcWeaponDBObject::SerializeXml(node, load); } int tcMissileDBObject::WriteCSVHeader(Database::CsvTranslator *csv) { ! tcWeaponDBObject::WriteCSVHeader(csv); ! csv->WriteField("Mass_kg"); csv->WriteField("DragArea_sm"); *************** *** 315,320 **** csv->WriteField("SustThrust_N"); csv->WriteField("SustTime_s"); ! csv->WriteField("Damage"); ! csv->WriteField("DamageType"); csv->WriteField("Rcs_dbsm"); csv->WriteField("Range_km"); --- 318,323 ---- csv->WriteField("SustThrust_N"); csv->WriteField("SustTime_s"); ! //csv->WriteField("Damage"); ! //csv->WriteField("DamageType"); csv->WriteField("Rcs_dbsm"); csv->WriteField("Range_km"); *************** *** 343,347 **** tcMissileDBObject::tcMissileDBObject(tcMissileDBObject& obj) ! : tcDatabaseObject(obj) { mfMass_kg = obj.mfMass_kg; --- 346,350 ---- tcMissileDBObject::tcMissileDBObject(tcMissileDBObject& obj) ! : tcWeaponDBObject(obj) { mfMass_kg = obj.mfMass_kg; *************** *** 361,366 **** mfShutdownSpeed_mps = obj.mfShutdownSpeed_mps; ! mfDamage = obj.mfDamage; ! meDamageType = obj.meDamageType; mnTargetFlags = obj.mnTargetFlags; mfRcs_dbsm = obj.mfRcs_dbsm; --- 364,369 ---- mfShutdownSpeed_mps = obj.mfShutdownSpeed_mps; ! //mfDamage = obj.mfDamage; ! //meDamageType = obj.meDamageType; mnTargetFlags = obj.mnTargetFlags; mfRcs_dbsm = obj.mfRcs_dbsm; *************** *** 378,382 **** } ! tcMissileDBObject::tcMissileDBObject() : tcDatabaseObject() { mnClassID = DTYPE_MISSILE; --- 381,385 ---- } ! tcMissileDBObject::tcMissileDBObject() : tcWeaponDBObject() { mnClassID = DTYPE_MISSILE; *************** *** 399,404 **** mfSustTime_s = 60.0f; // other parameters ! mfDamage = 100.0f; ! meDamageType = DT_GENERIC; mfRcs_dbsm = 0.0f; mfRange_km = 123.4f; --- 402,407 ---- mfSustTime_s = 60.0f; // other parameters ! //mfDamage = 100.0f; ! //meDamageType = DT_GENERIC; mfRcs_dbsm = 0.0f; mfRange_km = 123.4f; Index: tcDatabase.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcDatabase.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcDatabase.cpp 18 Jul 2004 03:18:00 -0000 1.11 --- tcDatabase.cpp 27 Jul 2004 00:16:23 -0000 1.12 *************** *** 496,500 **** // other parameters pmissile->mfDamage = 100.0f; ! pmissile->meDamageType = DT_GENERIC; pmissile->mfRcs_dbsm = 0.0f; pmissile->mfRange_km = 123.4f; --- 496,500 ---- // other parameters pmissile->mfDamage = 100.0f; ! //pmissile->meDamageType = DT_GENERIC; pmissile->mfRcs_dbsm = 0.0f; pmissile->mfRange_km = 123.4f; |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:34
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/src/sim Modified Files: tcSimState.cpp tcWeaponObject.cpp Log Message: Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** tcSimState.cpp 23 Jul 2004 00:45:47 -0000 1.47 --- tcSimState.cpp 27 Jul 2004 00:16:24 -0000 1.48 *************** *** 382,424 **** /** ! * Used for a missile used against fixed land targets. The region near * the collision point is searched for nearby targets. Damage is applied * to all targets that are close enough. */ ! void tcSimState::EvaluateImpactMissileHit(tcMissileObject* missile) { ! wxASSERT(missile); ! ! #if 0 ! float terrainHeight_m = missile->mcTerrain.mfHeight_m; ! if (missile->mcKin.mfAlt_m > terrainHeight_m + 25.0) return; ! const float blastHeight_m = 3.0f; // height above ground for detonation ! double lon_rad; ! double lat_rad; ! float tImpact = missile->mcKin.CalculateGroundImpactPoint( ! terrainHeight_m + blastHeight_m, lon_rad, lat_rad); ! if (tImpact > 0.03) return; // defer until future time step ! missile->mcKin.mfAlt_m = terrainHeight_m; ! missile->mcKin.mfLon_rad = lon_rad; ! missile->mcKin.mfLat_rad = lat_rad; ! #endif ! if (!missile->IsDetonated()) return; float rLat = 500.0 * C_MTORAD; ! float rLon = rLat / cosf(missile->mcKin.mfLat_rad); long blastPlats[16]; tcRect blastRegion; ! float west = missile->mcKin.mfLon_rad - rLon; ! float east = missile->mcKin.mfLon_rad + rLon; ! float north = missile->mcKin.mfLat_rad + rLat; ! float south = missile->mcKin.mfLat_rad - rLat; if (west < -C_PI) west += C_TWOPI; if (east >= C_PI) east -= C_TWOPI; --- 382,423 ---- /** ! * Used for a weapon used against fixed land targets. The region near * the collision point is searched for nearby targets. Damage is applied * to all targets that are close enough. */ ! void tcSimState::EvaluateImpactWeaponHit(tcWeaponObject* weapon) { ! wxASSERT(weapon); ! if (!weapon->IsDetonated()) return; ! float blastDelay = weapon->GetDetonationDelay(); ! if (blastDelay > 0.033) return; ! if (blastDelay > 0) ! { ! double lon_rad; ! double lat_rad; ! float alt_m; ! weapon->mcKin.PredictPosition(blastDelay, ! lon_rad, lat_rad, alt_m); ! weapon->mcKin.mfAlt_m = alt_m; ! weapon->mcKin.mfLon_rad = lon_rad; ! weapon->mcKin.mfLat_rad = lat_rad; ! } float rLat = 500.0 * C_MTORAD; ! float rLon = rLat / cosf(weapon->mcKin.mfLat_rad); long blastPlats[16]; tcRect blastRegion; ! float west = weapon->mcKin.mfLon_rad - rLon; ! float east = weapon->mcKin.mfLon_rad + rLon; ! float north = weapon->mcKin.mfLat_rad + rLat; ! float south = weapon->mcKin.mfLat_rad - rLat; if (west < -C_PI) west += C_TWOPI; if (east >= C_PI) east -= C_TWOPI; *************** *** 426,437 **** int nPlats = GetPlatformsWithinRegion(blastPlats, 16, &blastRegion); ! float fDamage = missile->mpDBObject->mfDamage; for (int idx = 0; idx < nPlats; idx++) { tcGameObject* target = GetObject(blastPlats[idx]); ! if (target && (target->mnID != missile->mnID)) { ! float range_m = 1000.0f * target->mcKin.RangeToKmAlt(missile->mcKin); if (range_m <= 80.0) { --- 425,436 ---- int nPlats = GetPlatformsWithinRegion(blastPlats, 16, &blastRegion); ! float fDamage = weapon->GetDamage(); for (int idx = 0; idx < nPlats; idx++) { tcGameObject* target = GetObject(blastPlats[idx]); ! if (target && (target->mnID != weapon->mnID)) { ! float range_m = 1000.0f * target->mcKin.RangeToKmAlt(weapon->mcKin); if (range_m <= 80.0) { *************** *** 443,447 **** tcString s; s.Format("weapon (impact) %d hit target %d, range: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); --- 442,446 ---- tcString s; s.Format("weapon (impact) %d hit target %d, range: %3.1f m, time %.1f s", ! weapon->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); *************** *** 459,463 **** tcString s; s.Format("weapon (DUD) %d target %d, range: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); } --- 458,462 ---- tcString s; s.Format("weapon (DUD) %d target %d, range: %3.1f m, time %.1f s", ! weapon->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); } *************** *** 468,472 **** tcString s; s.Format("weapon (impact) %d missed target %d, range: %3.1f m, time %.1f s", ! missile->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); } --- 467,471 ---- tcString s; s.Format("weapon (impact) %d missed target %d, range: %3.1f m, time %.1f s", ! weapon->mnID, target->mnID, range_m, mfSimTime); WTL(s.GetBuffer()); } *************** *** 474,478 **** } ! missile->mfDamageLevel += 1.0f; } --- 473,477 ---- } ! weapon->mfDamageLevel += 1.0f; } *************** *** 507,520 **** } } ! else { ! if (missileObj->mcKin.mfAlt_m < missileObj->mcTerrain.mfHeight_m + 200.0) ! { ! EvaluateImpactMissileHit(missileObj); ! } } - ! } } } --- 506,519 ---- } } ! } ! else if (tcWeaponObject* weapon = dynamic_cast<tcWeaponObject*>(obj)) ! { ! if ((weapon->mcKin.mfAlt_m < weapon->mcTerrain.mfHeight_m + 200.0) ! || (weapon->mcKin.mfAlt_m < 100.0)) { ! EvaluateImpactWeaponHit(weapon); } ! } } } *************** *** 762,766 **** } /********************************************************************/ ! int tcSimState::GetAllWeaponObjects(long *apKeyList,int anMaxLength) { tcGameObject *pobj; tnPoolIndex cmappos = maPlatformState.GetStartPosition(); --- 761,766 ---- } /********************************************************************/ ! int tcSimState::GetAllWeaponObjects(long *apKeyList,int anMaxLength) ! { tcGameObject *pobj; tnPoolIndex cmappos = maPlatformState.GetStartPosition(); *************** *** 772,778 **** { maPlatformState.GetNextAssoc(cmappos,nKey,pobj); ! if (pobj->mnModelType == MTYPE_MISSILE) { ! apKeyList[nListIndex++]=nKey; } } --- 772,778 ---- { maPlatformState.GetNextAssoc(cmappos,nKey,pobj); ! if (dynamic_cast<tcWeaponObject*>(pobj)) { ! apKeyList[nListIndex++] = nKey; } } Index: tcWeaponObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcWeaponObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcWeaponObject.cpp 23 Jul 2004 00:45:47 -0000 1.5 --- tcWeaponObject.cpp 27 Jul 2004 00:16:24 -0000 1.6 *************** *** 21,25 **** #include "tcWeaponObject.h" #include "tcGameObject.h" ! #include "tcDatabaseObject.h" #include "tcSensorMap.h" #include "tcSimState.h" --- 21,25 ---- #include "tcWeaponObject.h" #include "tcGameObject.h" ! #include "tcWeaponDBObject.h" #include "tcSensorMap.h" #include "tcSimState.h" *************** *** 55,61 **** * Called when weapon detonates */ ! void tcWeaponObject::Detonate() { fuseHasTriggered = true; } --- 55,77 ---- * Called when weapon detonates */ ! void tcWeaponObject::Detonate(float delay_s) { fuseHasTriggered = true; + fuseDelay = delay_s; + } + + float tcWeaponObject::GetDamage() const + { + return mpDBObject->mfDamage; + } + + float tcWeaponObject::GetDetonationDelay() const + { + return fuseDelay; + } + + long tcWeaponObject::GetIntendedTarget() const + { + return intendedTarget; } *************** *** 74,77 **** --- 90,98 ---- } + void tcWeaponObject::SetDetonationDelay(float delay_s) + { + fuseDelay = delay_s; + } + void tcWeaponObject::SetIntendedTarget(long targetId) { *************** *** 96,100 **** */ tcWeaponObject::tcWeaponObject() ! : fuseHasTriggered(false),intendedTarget(-1) { --- 117,122 ---- */ tcWeaponObject::tcWeaponObject() ! : fuseHasTriggered(false), fuseDelay(0), intendedTarget(-1), ! mpDBObject(0) { *************** *** 112,121 **** * Constructor that initializes using info from database entry. */ ! tcWeaponObject::tcWeaponObject(tcDatabaseObject *obj) ! : tcGameObject(obj), fuseHasTriggered(false) { wxASSERT(simState); - - intendedTarget = -1; } --- 134,143 ---- * Constructor that initializes using info from database entry. */ ! tcWeaponObject::tcWeaponObject(tcWeaponDBObject* obj) ! : tcGameObject(obj), ! fuseHasTriggered(false), fuseDelay(0), intendedTarget(-1), ! mpDBObject(obj) { wxASSERT(simState); } |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:34
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/include/sim Modified Files: tcSimState.h tcWeaponObject.h Log Message: Index: tcWeaponObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcWeaponObject.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcWeaponObject.h 23 Jul 2004 00:45:46 -0000 1.4 --- tcWeaponObject.h 27 Jul 2004 00:16:23 -0000 1.5 *************** *** 31,35 **** namespace Database { ! class tcDatabaseObject; } --- 31,35 ---- namespace Database { ! class tcWeaponDBObject; } *************** *** 42,48 **** --- 42,57 ---- { public: + float GetDamage() const; + float GetDetonationDelay() const; + + /// returns intended target for weap or -1 if none exists + long GetIntendedTarget() const; + bool IsDetonated(); /// returns true if id is intended target of this weapon bool IsIntendedTarget(long id); + + void SetDetonationDelay(float delay_s); + /// sets intended target void SetIntendedTarget(long targetId); *************** *** 51,63 **** long intendedTarget; bool fuseHasTriggered; ///< set true when weapon detonates virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); ! void Detonate(); tcWeaponObject(); tcWeaponObject(tcWeaponObject&); ! tcWeaponObject(tcDatabaseObject *obj); ~tcWeaponObject(); }; --- 60,79 ---- long intendedTarget; bool fuseHasTriggered; ///< set true when weapon detonates + tcWeaponDBObject* mpDBObject; + + /** + * Delay in seconds before detonation (allows some movement + * closer to target between time steps) + */ + float fuseDelay; virtual tcUpdateStream& operator<<(tcUpdateStream& stream); virtual tcUpdateStream& operator>>(tcUpdateStream& stream); ! void Detonate(float delay_s = 0); tcWeaponObject(); tcWeaponObject(tcWeaponObject&); ! tcWeaponObject(tcWeaponDBObject* obj); ~tcWeaponObject(); }; Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** tcSimState.h 19 Jul 2004 00:52:27 -0000 1.25 --- tcSimState.h 27 Jul 2004 00:16:23 -0000 1.26 *************** *** 36,39 **** --- 36,40 ---- #include "tcCarrierObject.h" #include "tcAirObject.h" + #include "tcWeaponObject.h" #include "tcSound.h" #include "tcMapData.h" *************** *** 193,197 **** void EvaluateGuidedMissileHit(tcMissileObject* missile, tcGameObject* target); ! void EvaluateImpactMissileHit(tcMissileObject* missile); float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); bool IsDetectedESM(tcESMSensor* apESM, const tcRadar* apEmitterRadar, float& rfAz_rad); --- 194,198 ---- void EvaluateGuidedMissileHit(tcMissileObject* missile, tcGameObject* target); ! void EvaluateImpactWeaponHit(tcWeaponObject* weapon); float GetFractionalDamage(float afDamage, tcGameObject *apGameObj); bool IsDetectedESM(tcESMSensor* apESM, const tcRadar* apEmitterRadar, float& rfAz_rad); |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:32
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** CHANGES.txt 26 Jul 2004 01:48:21 -0000 1.27 --- CHANGES.txt 27 Jul 2004 00:16:22 -0000 1.28 *************** *** 3,6 **** --- 3,12 ---- 0.6 --------------------------------------------------------------------- + *** 2004-07-26 Dewitt Colclough *** + - Changed damage evaluation in tcSimState to check all low-alt + tcWeaponObject objects for detonation. This will be used for + naval gunfire and dumb bomb objects. + - Added tcWeaponDBObject class + *** 2004-07-25 Dewitt Colclough *** - Changed terrain code using Demeter to use single texture with |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:32
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427 Modified Files: GCblue.vcproj Log Message: Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** GCblue.vcproj 18 Jul 2004 03:17:58 -0000 1.57 --- GCblue.vcproj 27 Jul 2004 00:16:22 -0000 1.58 *************** *** 524,527 **** --- 524,530 ---- RelativePath="src\database\tcSensorDBObject.cpp"> </File> + <File + RelativePath=".\src\database\tcWeaponDBObject.cpp"> + </File> </Filter> <Filter *************** *** 939,942 **** --- 942,948 ---- RelativePath="include\database\tcSensorDBObject.h"> </File> + <File + RelativePath=".\include\database\tcWeaponDBObject.h"> + </File> </Filter> <Filter |
|
From: Dewitt C. <ddc...@us...> - 2004-07-27 00:16:31
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10427/include/common Modified Files: simmath.h Log Message: Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** simmath.h 19 Jul 2004 00:52:26 -0000 1.15 --- simmath.h 27 Jul 2004 00:16:22 -0000 1.16 *************** *** 170,176 **** --- 170,179 ---- float CalculateCollisionPoint(const tcKinematics& collider, float& dxi, float& dyi, float& dzi); float CalculateGroundImpactPoint(float terrainHeight_m, double& lon_rad, double& lat_rad); + void Clear() {mfLon_rad=0;mfLat_rad=0;mfAlt_m=0; mfHeading_rad=0;mfClimbAngle_rad=0;mfSpeed_kts=0; mfYaw_rad=0;mfPitch_rad=0;mfRoll_rad=0;} + + void PredictPosition(float dt_s, double& lon_rad, double& lat_rad, float& alt_m); float HeadingToTrack(const tcTrack& track); float HeadingToGeoRad(const tsGeoPoint *apGeoPoint); |
|
From: Dewitt C. <ddc...@us...> - 2004-07-26 01:48:30
|
Update of /cvsroot/gcblue/gcb_wx/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5721/docs Modified Files: CHANGES.txt Log Message: Index: CHANGES.txt =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/docs/CHANGES.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** CHANGES.txt 18 Jul 2004 03:17:59 -0000 1.26 --- CHANGES.txt 26 Jul 2004 01:48:21 -0000 1.27 *************** *** 3,6 **** --- 3,15 ---- 0.6 --------------------------------------------------------------------- + *** 2004-07-25 Dewitt Colclough *** + - Changed terrain code using Demeter to use single texture with + bordered texture feature to eliminate texture seams. + - Added common texture as a temporary work-around to add some detail + to close up views. + - Moved sky dome inside of clipping plane as a workaround to ATI + sky rendering problems. Sky still shows artifacts near the horizon + on Radeon 9000 pro. + *** 2004-07-17 Dewitt Colclough *** - Made more detailed landing data available through script interface. |
|
From: Dewitt C. <ddc...@us...> - 2004-07-26 01:44:49
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5274/src/graphics Modified Files: cspSky.cpp tc3DTerrain.cpp tcTerrainTextureFactory.cpp Log Message: Index: tc3DTerrain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DTerrain.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tc3DTerrain.cpp 19 Jul 2004 00:53:01 -0000 1.13 --- tc3DTerrain.cpp 26 Jul 2004 01:44:40 -0000 1.14 *************** *** 1,6 **** /* ! ** tc3DTerrain.cpp ! ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- /* ! ** @file tc3DTerrain.cpp ! */ ! /* Copyright (C) 2003-2004 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 90,94 **** { wxASSERT(texFactory); ! if (texFactory) texFactory->Update(); } --- 90,94 ---- { wxASSERT(texFactory); ! //if (texFactory) texFactory->Update(); } *************** *** 111,117 **** } ! texFactory->BuildTextures(); terrain->SetAllElevations(&elevationArray[0], GRID_DIM, GRID_DIM, gridSpacing); ! unsigned t3 = tcTime::Get()->GetUpdated30HzCount(); //terrain->SetMaximumVisibleBlockSize(64); --- 111,126 ---- } ! texFactory->UpdateBaseTexture(baseTexture); ! ! //texFactory->BuildTextures(); ! ! ! terrain->SetAllElevations(&elevationArray[0], GRID_DIM, GRID_DIM, gridSpacing); ! ! terrain->SetTexture(baseTexture->GetBuffer(), baseTexture->GetWidth(), ! baseTexture->GetHeight()); ! ! unsigned t3 = tcTime::Get()->GetUpdated30HzCount(); //terrain->SetMaximumVisibleBlockSize(64); *************** *** 217,256 **** updateScheduled(false), updating(false), ! doGradualUpdate(true) { ! mapData = NULL; ! texFactory = NULL; ! gridSpacing = 1500.0f; gridOffset = -0.5f*((float)GRID_DIM)*gridSpacing; Demeter::Settings::GetInstance()->SetUseNormals(true); terrain = new Demeter::Terrain(&elevationArray[0], GRID_DIM, GRID_DIM, ! NULL ,GRID_DIM, GRID_DIM, ! NULL , 0, 0, ! gridSpacing,1.0f,50000, ! gridOffset,gridOffset); ! terrain->AllocateTextureCells(TEX_CELL_DIM, TEX_CELL_DIM); ! texFactory = new tcTerrainTextureFactory(terrain.get(), this, TEX_CELL_DIM); // deleted by terrain? ! terrain->SetTextureFactory(texFactory); ! Demeter::DemeterDrawable* pDrawable = new Demeter::DemeterDrawable; pDrawable->SetTerrain(terrain.get()); - - /* - osg::StateSet *terrain_state = pDrawable->getOrCreateStateSet(); - osg::Depth *depth = new osg::Depth; - depth->setFunction(osg::Depth::ALWAYS); - depth->setRange(1.0, 1.0); - depth->setWriteMask(true); - terrain_state->setAttributeAndModes(depth, osg::StateAttribute::ON); - // terrain_state->setMode(GL_DEPTH, osg::StateAttribute::OFF); - //terrain_state->setMode(GL_LIGHTING, StateAttribute::OFF); - // terrain_state->setMode(GL_CULL_FACE, StateAttribute::OFF); - //terrain_state->setMode(GL_FOG, osg::StateAttribute::ON); - terrain_state->setRenderBinDetails(-1,"RenderBin"); - */ --- 226,256 ---- updateScheduled(false), updating(false), ! doGradualUpdate(true), ! mapData(0), ! texFactory(0) { ! ! gridSpacing = 1000.0f; gridOffset = -0.5f*((float)GRID_DIM)*gridSpacing; Demeter::Settings::GetInstance()->SetUseNormals(true); + Demeter::Settings::GetInstance()->SetUseBorders(true); + + + + baseTexture = tcTerrainTextureFactory::CreateEmptyTexture(BASE_TEX_DIM); terrain = new Demeter::Terrain(&elevationArray[0], GRID_DIM, GRID_DIM, ! baseTexture->GetBuffer(), BASE_TEX_DIM, BASE_TEX_DIM, ! NULL, 0, 0, ! gridSpacing, 1.0f, 50000, ! gridOffset, gridOffset); + texFactory = new tcTerrainTextureFactory(terrain.get(), this, TEX_CELL_DIM); + + texFactory->UpdateCommonTexture(); Demeter::DemeterDrawable* pDrawable = new Demeter::DemeterDrawable; pDrawable->SetTerrain(terrain.get()); Index: tcTerrainTextureFactory.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcTerrainTextureFactory.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcTerrainTextureFactory.cpp 19 Jul 2004 00:53:01 -0000 1.9 --- tcTerrainTextureFactory.cpp 26 Jul 2004 01:44:40 -0000 1.10 *************** *** 49,52 **** --- 49,76 ---- /** + * Creates texSize x texSize square uninitialized texture + */ + Demeter::Texture* tcTerrainTextureFactory::CreateEmptyTexture(int texSize) + { + Demeter::Texture* texture; + + + + Uint8* pImage = new Uint8[texSize*texSize*3]; + texture = new Demeter::Texture(pImage, texSize, texSize, texSize, 0, + true, false, false); + texture->SetBufferPersistent(TRUE); ///< keeps tex in system memory for dynamic modification + delete pImage; + + return texture; + } + + void tcTerrainTextureFactory::UpdateBaseTexture(Demeter::Texture* texture) + { + UpdateTexture(texture, 0, 0, terrain->GetWidth(), terrain->GetHeight()); + } + + + /** * Create empty textures and update procedural texture data * if doGradualUpdate is true, set updateScheduled to true and *************** *** 95,100 **** Demeter::Texture* tcTerrainTextureFactory::CreateEmptyTexture(int nX, int nY) { - Demeter::Texture* pTexture; - // determine position of texture tile in grid bool edgeYLow = (nY < edgeDepthLow)||(nY >= gridDimension - edgeDepthLow); --- 119,122 ---- *************** *** 119,128 **** } ! Uint8* pImage = new Uint8[currentTextureSize*currentTextureSize*3]; ! pTexture = new Demeter::Texture(pImage,currentTextureSize,currentTextureSize,currentTextureSize,0,true,false,false); ! pTexture->SetBufferPersistent(TRUE); ///< keeps tex in system memory for dynamic modification ! delete pImage; ! ! return pTexture; } --- 141,145 ---- } ! return CreateEmptyTexture(currentTextureSize); } *************** *** 161,166 **** float width, float height) { ! ! float texelSpacing = width / pTexture->GetWidth(); // assumes square texture Uint8 *pImage = pTexture->GetBuffer(); --- 178,184 ---- float width, float height) { ! int nTexSize = pTexture->GetWidth(); ! float texSize = nTexSize; ! float texelSpacing = width / texSize; // assumes square texture Uint8 *pImage = pTexture->GetBuffer(); *************** *** 170,182 **** originY += yOffset; ! pTexture->UnloadTexture(); - int imageIndex = 0; float alpha[NUM_TEXTURES]; ! for (float y = originY; y < originY + height; y += texelSpacing) { ! for (float x = originX; x < originX + width; x += texelSpacing,imageIndex += 3) { // float elev = terrain->GetElevation(x,y); float elev = terrainManager->GetElevation(x,y); --- 188,204 ---- originY += yOffset; ! //pTexture->UnloadTexture(); float alpha[NUM_TEXTURES]; ! ! float y = originY; ! for (long yIdx = 0; yIdx < nTexSize; yIdx++) { ! float x = originX; ! for (long xIdx = 0; xIdx < nTexSize; xIdx++) { + long imageIndex = 3 * yIdx * nTexSize + 3 * xIdx; + // float elev = terrain->GetElevation(x,y); float elev = terrainManager->GetElevation(x,y); *************** *** 222,226 **** --- 244,252 ---- pImage[imageIndex + 1] = green; pImage[imageIndex + 2] = blue; + + x += texelSpacing; } + + y += texelSpacing; } } *************** *** 368,371 **** --- 394,400 ---- defaultTextureLand = new Demeter::Texture(mountainTexture->data(),texSize,texSize, texSize,0,true,false,false); + + groundDetailTexture = osgDB::readImageFile("sand_tex.bmp"); + } *************** *** 466,469 **** --- 495,508 ---- } + void tcTerrainTextureFactory::UpdateCommonTexture() + { + if (terrain) + { + terrain->SetCommonTexture(groundDetailTexture->data(), + groundDetailTexture->s(), groundDetailTexture->t()); + } + } + + tcTerrainTextureFactory::tcTerrainTextureFactory(Demeter::Terrain* pTerrain, tc3DTerrain *tm, int griddimension) Index: cspSky.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/cspSky.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cspSky.cpp 24 Jun 2004 01:43:44 -0000 1.10 --- cspSky.cpp 26 Jul 2004 01:44:40 -0000 1.11 *************** *** 157,161 **** int i; // FIXME this all needs *extensive* cleaning. just hacking for now... ! float R = 1000000.0; float phi, theta; for (i=0; i<n; i++) { --- 157,164 ---- int i; // FIXME this all needs *extensive* cleaning. just hacking for now... ! /* moved this inside the clipping plane as workaround for ATI card black sky problem ! ** See http://csp.sourceforge.net/forum/viewtopic.php?t=171&highlight=sky ! */ ! float R = 900000.0; float phi, theta; for (i=0; i<n; i++) { *************** *** 1140,1144 **** float x, y, z; float alpha, theta; ! float radius = 1100000.0f; m_Horizon = new FalseHorizon; #ifdef TEXDOME --- 1143,1148 ---- float x, y, z; float alpha, theta; ! //float radius = 1100000.0f; ! float radius = 95000.0f; m_Horizon = new FalseHorizon; #ifdef TEXDOME |