Skip to content

Commit

Permalink
Merge pull request #1295 from indy91/Apollo13
Browse files Browse the repository at this point in the history
Apollo 13 failures defined with mission file instead of using Apollo number 1301
  • Loading branch information
indy91 authored Sep 7, 2024
2 parents f3e9d7c + df7c90c commit 73bd594
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions Missions/ProjectApollo/Apollo 1301.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Name=Apollo 13
Apollo13Failures=TRUE
SMJCVersion=2
CMCVersion=Manche72R3
LGCVersion=LM131R1
Expand Down
10 changes: 10 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_aux/Mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ namespace mission {
bCrossPointerShades = false;
iLMNumber = 5; //LM-5
bLMEventTimerReverseAtZero = false;
bApollo13Failures = false;
strCDRName = "CDR";
strCMPName = "CMP";
strLMPName = "LMP";
Expand Down Expand Up @@ -291,6 +292,10 @@ namespace mission {
strncpy(buffer, line + 26, 255);
bLMEventTimerReverseAtZero = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "Apollo13Failures=", 17)) {
strncpy(buffer, line + 17, 255);
bApollo13Failures = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "CDRVesselName=", 14)) {
strncpy(buffer, line + 14, 255);
strCDRName.assign(buffer);
Expand Down Expand Up @@ -690,4 +695,9 @@ namespace mission {
{
return bLMEventTimerReverseAtZero;
}

bool Mission::DoApollo13Failures() const
{
return bApollo13Failures;
}
}
3 changes: 3 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_aux/Mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ namespace mission
virtual const std::string& GetLMPSuitName() const;
//false = LM event timer continues to count down through zero, true = when reaching zero it starts counting up
virtual bool IsLMEventTimerReversingAtZero() const;
//Run special Apollo 13 failure and audio code
virtual bool DoApollo13Failures() const;
protected:
bool GetCueCards(const std::vector<CueCardConfig> &cue, unsigned &counter, unsigned &loc, std::string &meshname, VECTOR3 &ofs);

Expand Down Expand Up @@ -175,6 +177,7 @@ namespace mission
double dTEPHEM0;
int iLMNumber;
bool bLMEventTimerReverseAtZero;
bool bApollo13Failures;

MATRIX3 CM_IMUDriftRates;
VECTOR3 CM_PIPABias;
Expand Down
3 changes: 2 additions & 1 deletion Orbitersdk/samples/ProjectApollo/src_csm/satswitches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "ioChannels.h"

#include "saturn.h"
#include "Mission.h"

#include "CM_VC_Resource.h"

Expand Down Expand Up @@ -223,7 +224,7 @@ void SaturnCryoQuantityMeter::DoDrawSwitch(double v, SURFHANDLE drawSurface)

#define O2FAILURETIME (46.0 * 3600.0 + 45.0 * 60.0)

if (Sat->GetApolloNo() == 1301) {
if (Sat->GetMission()->DoApollo13Failures()) {
if (Sat->GetMissionTime() >= (O2FAILURETIME + 5.0)) {
v = 1.05;
}
Expand Down
6 changes: 3 additions & 3 deletions Orbitersdk/samples/ProjectApollo/src_csm/saturn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ void Saturn::clbkPostCreation()
// Load Apollo-13 specific sounds.
//

if (ApolloNo == 1301) {
if (pMission->DoApollo13Failures()) {
if (!KranzPlayed)
soundlib.LoadMissionSound(SKranz, A13_KRANZ, NULL, INTERNAL_ONLY);
if (!CryoStir)
Expand Down Expand Up @@ -1749,7 +1749,7 @@ void Saturn::clbkSaveState(FILEHANDLE scn)
if (AutoSlow) {
oapiWriteScenario_int (scn, "AUTOSLOW", 1);
}
if (ApolloNo == 1301) {
if (pMission->DoApollo13Failures()) {
oapiWriteScenario_int (scn, "A13STATE", GetA13State());
}
if (SIVBPayload != PAYLOAD_LEM) {
Expand Down Expand Up @@ -4550,7 +4550,7 @@ void Saturn::LoadDefaultSounds()
void Saturn::StageSix(double simt){
UpdateMassAndCoG();

if (ApolloNo == 1301) {
if (pMission->DoApollo13Failures()) {

//
// Play cryo-stir audio.
Expand Down
1 change: 1 addition & 0 deletions Orbitersdk/samples/ProjectApollo/src_csm/saturn.h
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ class Saturn: public ProjectApolloConnectorVessel, public PanelSwitchListener {
virtual SIBSystems *GetSIB() { return NULL; }
virtual SICSystems *GetSIC() { return NULL; }
SECS *GetSECS() { return &secs; }
mission::Mission *GetMission() { return pMission; }

void ClearMeshes();

Expand Down

0 comments on commit 73bd594

Please sign in to comment.