Skip to content

Commit

Permalink
Merge pull request #1309 from TINYBOB1/LM_Additions
Browse files Browse the repository at this point in the history
Lunar Module Additions/Updates
  • Loading branch information
indy91 authored Jan 8, 2025
2 parents 1d1a225 + 1bc0af0 commit c78f192
Show file tree
Hide file tree
Showing 31 changed files with 63,213 additions and 48,437 deletions.
55 changes: 55 additions & 0 deletions Config/GC/ProjectApollo_LEM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,38 @@ SMOOTHNESS 0.192157 1.000000
MATERIAL 20
SMOOTHNESS 0.501961 1.000000
METALNESS 0.866667
; ---------------------------------------------
MATERIAL 24
EMISSION2 1.003922 1.003922 1.003922
SMOOTHNESS 0.192157 1.000000
METALNESS 0.501961
; ---------------------------------------------
MATERIAL 25
DIFFUSE 0.863806 0.863806 0.863806 1.000000
EMISSION2 1.003922 1.003922 1.003922
SMOOTHNESS 0.192157 1.000000
METALNESS 0.000000
; ---------------------------------------------
MATERIAL 27
DIFFUSE 0.799000 0.561030 0.009000 1.000000
EMISSIVE 0.000000 0.000000 0.000000
SMOOTHNESS 0.000000 1.000000
METALNESS 0.000000
; ---------------------------------------------
MATERIAL 28
DIFFUSE 0.650000 0.650000 0.650000 1.000000
SMOOTHNESS 0.356863 1.000000
METALNESS 0.501961
; ---------------------------------------------
MATERIAL 29
DIFFUSE 1.000000 1.000000 1.000000 1.000000
SMOOTHNESS 0.513726 1.000000
METALNESS 0.866667
; ---------------------------------------------
MATERIAL 31
DIFFUSE 1.000000 1.000000 1.000000 1.000000
SMOOTHNESS 0.513726 1.000000
METALNESS 0.000000
; =============================================
MESH ProjectApollo/LM_DescentStage
SHADER Metalness
Expand Down Expand Up @@ -89,3 +121,26 @@ METALNESS 0.431373
MATERIAL 9
SMOOTHNESS 0.000000 1.000000
METALNESS 0.172549
; ---------------------------------------------
MATERIAL 10
SMOOTHNESS 0.000000 1.000000
; ---------------------------------------------
MATERIAL 12
SMOOTHNESS 0.514000 1.000000
METALNESS 0.617000
; ---------------------------------------------
MATERIAL 13
SMOOTHNESS 0.000000 1.000000
; ---------------------------------------------
MATERIAL 14
SMOOTHNESS 0.000000 1.000000
METALNESS 0.624000
; ---------------------------------------------
MATERIAL 15
SMOOTHNESS 0.000000 1.000000
; ---------------------------------------------
MATERIAL 16
SMOOTHNESS 0.000000 1.000000
; ---------------------------------------------
MATERIAL 17
SMOOTHNESS 0.000000 1.000000
98,715 changes: 53,235 additions & 45,480 deletions Meshes/ProjectApollo/LM_AscentStage.msh

Large diffs are not rendered by default.

12,612 changes: 9,667 additions & 2,945 deletions Meshes/ProjectApollo/LM_DescentStage.msh

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Missions/ProjectApollo/Apollo 10.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Name=Apollo 10
LMDSKYVersion=1
HasAEAA=TRUE
LMHasDeflectors=FALSE
LMHasCask=FALSE
CMCVersion=Manche45R2
LGCVersion=LUM69R2
AEAVersion=FP6
Expand Down
1 change: 1 addition & 0 deletions Missions/ProjectApollo/Apollo 11.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Name=Apollo 11
LMHasCask=FALSE
CMCVersion=Comanche055
LGCVersion=Luminary099
AEAVersion=FP6
Expand Down
1 change: 1 addition & 0 deletions Missions/ProjectApollo/Apollo 9.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Name=Apollo 9
LMDSKYVersion=1
LMHasDeflectors=FALSE
LMHasCask=FALSE
CSMHasVHFRanging=FALSE
CMCVersion=Colossus249
LGCVersion=Sundance306ish
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 @@ -98,6 +98,7 @@ namespace mission {
bLMHasAscEngArmAssy = false;
bLMHasLegs = true;
bLMHasDeflectors = true;
bLMHasCask = true;
bCSMHasHGA = true;
bCSMHasVHFRanging = true;
strCMCVersion = "Artemis072";
Expand Down Expand Up @@ -231,6 +232,10 @@ namespace mission {
strncpy(buffer, line + 16, 255);
bLMHasDeflectors = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "LMHasCask=", 10)) {
strncpy(buffer, line + 10, 255);
bLMHasCask = !_strnicmp(buffer, "TRUE", 4);
}
else if (!_strnicmp(line, "CSMHasHGA=", 10)) {
strncpy(buffer, line + 10, 255);
bCSMHasHGA = !_strnicmp(buffer, "TRUE", 4);
Expand Down Expand Up @@ -514,6 +519,11 @@ namespace mission {
return bLMHasDeflectors;
}

bool Mission::LMHasCask() const
{
return bLMHasCask;
}

bool Mission::CSMHasHGA() const
{
return bCSMHasHGA;
Expand Down
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 @@ -100,6 +100,8 @@ namespace mission
virtual bool LMHasLegs() const;
//false = LM has no deflectors, true = LM has deflectors
virtual bool LMHasDeflectors() const;
//false = LM has no RTG Cask, true = LM has RTG Cask
virtual bool LMHasCask() const;
//false = CSM has no HGA, true = CSM has a HGA
virtual bool CSMHasHGA() const;
//false = CSM has no VHF Ranging System, true = CSM has VHF Ranging System
Expand Down Expand Up @@ -205,6 +207,7 @@ namespace mission
bool bLMHasAscEngArmAssy;
bool bLMHasLegs;
bool bLMHasDeflectors;
bool bLMHasCask;
bool bCSMHasHGA;
bool bCSMHasVHFRanging;
bool bInvertLMStageBit;
Expand Down
47 changes: 47 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_lm/LEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ void LEM::Init()
status = 0;
CDRinPLSS = 0;
LMPinPLSS = 0;
EVAAntHandleStatus = false;

CMPowerToCDRBusRelayA = false;
CMPowerToCDRBusRelayB = false;
Expand Down Expand Up @@ -623,6 +624,7 @@ void LEM::Init()
drogue = NULL;
probes = NULL;
deflectors = NULL;
cask = NULL;
cdrmesh = NULL;
lmpmesh = NULL;
vcmesh = NULL;
Expand Down Expand Up @@ -1237,12 +1239,39 @@ int LEM::clbkConsumeBufferedKey(DWORD key, bool down, char *keystate) {
return 0;
}

void LEM::SetAnimations(double simdt) {
//
//EVA Antenna
//
if (EVAAntHandleState.action == AnimState::CLOSING || EVAAntHandleState.action == AnimState::OPENING) {
double speed = 1.0; // Anim length in Seconds
double dp = simdt / speed;
if (EVAAntHandleState.action == AnimState::CLOSING) {
if (EVAAntHandleState.pos > 0.0) {
EVAAntHandleState.pos = max(0.0, EVAAntHandleState.pos - dp);
}
else
EVAAntHandleState.action = AnimState::CLOSED;
}
else { // opening
if (EVAAntHandleState.pos < 1.0)
EVAAntHandleState.pos = min(1.0, EVAAntHandleState.pos + dp);
else
EVAAntHandleState.action = AnimState::OPEN;
}
SetAnimation(EVAAntHandleAnim, EVAAntHandleState.pos);
LEM::VHF.SetAnimation(EVAAntHandleState.pos);
}
}

//
// Timestep code.
//

void LEM::clbkPreStep (double simt, double simdt, double mjd) {

SetAnimations(simdt);

if (CheckPanelIdInTimestep) {
oapiSetPanel(PanelId);
CheckPanelIdInTimestep = false;
Expand Down Expand Up @@ -1923,6 +1952,17 @@ void LEM::GetScenarioState(FILEHANDLE scn, void *vs)
else if (!strnicmp(line, "EVENTTIMER_START", sizeof("EVENTTIMER_START"))) {
EventTimerDisplay.LoadState(scn, EVENTTIMER_END_STRING);
}
else if (!strnicmp(line, "EVAANTENNAHANDLE", 16)) {
sscanf(line + 16, "%i", &EVAAntHandleStatus);
if (EVAAntHandleStatus) {
EVAAntHandleState.pos = 1.0; // This is for the Handle

// Maybe you need to add here the ".pos" for the Antenna too.
// One more thing. The antenna can be seen for one frame when
// the simulation is started in pause mode.

}
}
else if (!strnicmp(line, "<INTERNALS>", 11)) { //INTERNALS signals the PanelSDK part of the scenario
Panelsdk.Load(scn); //send the loading to the Panelsdk
}
Expand Down Expand Up @@ -2003,14 +2043,18 @@ void LEM::clbkVisualCreated(VISHANDLE vis, int refcount)
if (dscidx != -1 && pMission->LMHasLegs()) {
probes = GetDevMesh(vis, dscidx);
deflectors = GetDevMesh(vis, dscidx);
cask = GetDevMesh(vis, dscidx);
HideProbes();
HideDeflectors();
HideCask();
}

if (vcidx != -1) {
vcmesh = GetDevMesh(vis, vcidx);
SetCOAS();
}

AnimEVAAntHandle();
}

void LEM::clbkVisualDestroyed(VISHANDLE vis, int refcount)
Expand Down Expand Up @@ -2094,12 +2138,14 @@ void LEM::DefineAnimations()
{
// Call Animation Definitions where required
RR.DefineAnimations(ascidx);
VHF.DefineAnimations(ascidx);
SBandSteerable.DefineAnimations(ascidx);
OverheadHatch.DefineAnimations(ascidx);
ForwardHatch.DefineAnimations(ascidx);
OverheadHatch.DefineAnimationsVC(vcidx);
ForwardHatch.DefineAnimationsVC(vcidx);
if (stage < 2) DPS.DefineAnimations(dscidx);
if (stage < 2) LR.DefineAnimations(dscidx);
if (stage < 1 && pMission->LMHasLegs()) eds.DefineAnimations(dscidx);
DefineVCAnimations();
}
Expand Down Expand Up @@ -2247,6 +2293,7 @@ void LEM::clbkSaveState (FILEHANDLE scn)
oapiWriteScenario_int(scn, "COASRETICLEVISIBLE", COASreticlevisible);

oapiWriteScenario_int(scn, "WINDOWSHADESENABLED", LEMWindowShades);
oapiWriteScenario_int(scn, "EVAANTENNAHANDLE", EVAAntHandleStatus);

oapiWriteScenario_float (scn, "DSCFUEL", DescentFuelMassKg);
oapiWriteScenario_float (scn, "ASCFUEL", AscentFuelMassKg);
Expand Down
19 changes: 19 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_lm/LEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ class LEM : public Payload, public PanelSwitchListener {
void DrogueVis();
void HideProbes();
void HideDeflectors();
void HideCask();
void ShowXPointerShades();
void SetTrackLight();
void SetDockingLights();
Expand Down Expand Up @@ -545,6 +546,9 @@ class LEM : public Payload, public PanelSwitchListener {
void StartSeparationPyros();
void StopSeparationPyros();

void AnimEVAAntHandle();
void SetAnimations(double);

//
// VISHANDLE
//
Expand Down Expand Up @@ -1559,6 +1563,12 @@ class LEM : public Payload, public PanelSwitchListener {

int LEMWindowShades;

/////////////////////
// LEM EVA Antenna //
/////////////////////

CircuitBrakerSwitch EvaAntennaHandle;

///////////////////////////
// ORDEAL Panel switches //
///////////////////////////
Expand Down Expand Up @@ -1694,6 +1704,7 @@ class LEM : public Payload, public PanelSwitchListener {

DEVMESHHANDLE probes;
DEVMESHHANDLE deflectors;
DEVMESHHANDLE cask;
DEVMESHHANDLE drogue;
DEVMESHHANDLE cdrmesh;
DEVMESHHANDLE lmpmesh;
Expand Down Expand Up @@ -1768,6 +1779,14 @@ class LEM : public Payload, public PanelSwitchListener {
double vcFreeCamSpeed;
double vcFreeCamMaxOffset;

//
// EVA Antenna Handle
//

int EVAAntHandleStatus;
UINT EVAAntHandleAnim;
AnimState EVAAntHandleState;

//
// Failures.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@
#define AS_GRP_zCDR11 60
#define AS_GRP_zLMP11 61
#define AS_GRP_zWindowGlass 62
#define AS_GRP_EVA_Ant 63
#define AS_GRP_EVA_AntCone 64
#define AS_GRP_EVA_AntTop 65
16 changes: 14 additions & 2 deletions Orbitersdk/samples/ProjectApollo/src_lm/LM_DescentStageResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// ========================================================

// Number of mesh groups:
#define DS_NGRP 50
#define DS_NGRP 62

// Number of materials:
#define DS_NMAT 11
#define DS_NMAT 13

// Number of textures:
#define DS_NTEX 6
Expand Down Expand Up @@ -64,3 +64,15 @@
#define DS_GRP_SupportStruts2Left 48
#define DS_GRP_SupportStruts2Right 49
#define DS_GRP_Plaque 50
#define DS_GRP_LRAntenna 51
#define DS_GRP_LRAntennaBlack 52
#define DS_GRP_LRAntennaMount 53
#define DS_GRP_LRBase 54
#define DS_GRP_LRBaseFoil 55
#define DS_GRP_LRBasePivot 56
#define DS_GRP_LRShield 57
#define DS_GRP_LRShieldMount 58
#define DS_GRP_Cask 59
#define DS_GRP_CaskFoil 60
#define DS_GRP_Cask_Handle 61
#define DS_GRP_CaskMount 62
19 changes: 19 additions & 0 deletions Orbitersdk/samples/ProjectApollo/src_lm/Sat5LMDSC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void Sat5LMDSC::Setup()
if (state > 2) HideProbes();
}
HideDeflectors();
HideCask();
}

double tdph = -2.38;
Expand Down Expand Up @@ -263,6 +264,7 @@ void Sat5LMDSC::clbkVisualCreated(VISHANDLE vis, int refcount)
desstg_devmesh = GetDevMesh(vis, dscidx);
HideProbes();
HideDeflectors();
HideCask();
}
}

Expand Down Expand Up @@ -307,6 +309,23 @@ void Sat5LMDSC::HideDeflectors()
}
}

void Sat5LMDSC::HideCask()
{
if (!desstg_devmesh)
return;
if (!pMission->LMHasCask()) {
static UINT meshgroup_cask[4] = { DS_GRP_Cask, DS_GRP_CaskFoil, DS_GRP_CaskMount, DS_GRP_Cask_Handle };

GROUPEDITSPEC ges;
ges.flags = (GRPEDIT_ADDUSERFLAG);
ges.UsrFlag = 3;

for (int i = 0; i < 4; i++) {
oapiEditMeshGroup(desstg_devmesh, meshgroup_cask[i], &ges);
}
}
}

void Sat5LMDSC::SetState(int stage, int mission)
{
state = stage;
Expand Down
1 change: 1 addition & 0 deletions Orbitersdk/samples/ProjectApollo/src_lm/Sat5LMDSC.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Sat5LMDSC : public VESSEL3 {
void clbkSetClassCaps(FILEHANDLE cfg);
void HideProbes();
void HideDeflectors();
void HideCask();
void clbkVisualCreated(VISHANDLE vis, int refcount);
void clbkVisualDestroyed(VISHANDLE vis, int refcount);

Expand Down
Loading

0 comments on commit c78f192

Please sign in to comment.