Skip to content

Commit

Permalink
Merge branch 'main' into exports-check
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmonik authored Jan 7, 2024
2 parents 3394583 + 0e5b7f8 commit eb4134a
Show file tree
Hide file tree
Showing 13 changed files with 7,636 additions and 7,405 deletions.
7,381 changes: 0 additions & 7,381 deletions GravityModels/jgmro_120d_sha.tab

This file was deleted.

7,381 changes: 7,381 additions & 0 deletions GravityModels/jgmro_120f_sha.tab

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions OVP/D3D9Client/D3D9Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,14 @@ void D3D9Client::clbkDestroyRenderWindow (bool fastclose)

}

// ==============================================================

void D3D9Client::clbkDebugString(const char* str)
{
D3D9DebugLog("%s", str);
}


// ==============================================================

void D3D9Client::PushSketchpad(SURFHANDLE surf, D3D9Pad *pSkp) const
Expand Down
2 changes: 2 additions & 0 deletions OVP/D3D9Client/D3D9Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class D3D9Client : public GraphicsClient
*/
void clbkOptionChanged(DWORD cat, DWORD item);

void clbkDebugString(const char* str);

/**
* \brief Texture request
*
Expand Down
6 changes: 6 additions & 0 deletions Orbitersdk/include/GraphicsAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ class OAPIFUNC GraphicsClient: public Module {
*/
virtual void clbkOptionChanged(DWORD cat, DWORD item) {}

/**
* \brief Print multiple debug strings onto a screen, will be cleared when printed on screen.
* \param str Text string to print
*/
virtual void clbkDebugString(const char *str) {}

/**
* \brief Texture request
*
Expand Down
7 changes: 7 additions & 0 deletions Orbitersdk/include/OrbiterAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,13 @@ OAPIFUNC void oapiRegisterModule (oapi::Module *module);
OAPIFUNC char *oapiDebugString ();


/**
* \brief Print multiple debug strings onto a screen, will be cleared when printed on screen.
* \param str Text string to print
*/
OAPIFUNC void oapiDebugString(const char*);


// ======================================================================
/**
* \defgroup ObjectAccess Object access functions
Expand Down
10 changes: 5 additions & 5 deletions Src/Orbiter/MfdUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Psys.h"
#include "Nav.h"
#include <stdio.h>
#include <strstream>
#include <sstream>
#include <iomanip>
#include "Log.h"
#include "Util.h"
Expand Down Expand Up @@ -397,11 +397,11 @@ void GraphMFD::Plot (HDC hDC, int g, int h0, int h1, const char *title)
}
}
if (gf.absc_title[0]) {
ostrstream oss(cbuf, 64);
ostringstream oss(cbuf, 64);
oss << gf.absc_title;
if (gf.absc_tickscale != 1.0f) oss << " x " << 1.0/gf.absc_tickscale;
oss << '\0';
TextOut (hDC, (x0+x1)/2, y0+(3*ch)/4, oss.str(), strlen(oss.str()));
TextOut (hDC, (x0+x1)/2, y0+(3*ch)/4, oss.str().c_str(), strlen(oss.str().c_str()));
}

// ordinate ticks/labels
Expand Down Expand Up @@ -430,11 +430,11 @@ void GraphMFD::Plot (HDC hDC, int g, int h0, int h1, const char *title)
SetTextAlign (hDC, TA_CENTER);
if (gf.data_title[0]) {
SelectDefaultFont (hDC, 2);
ostrstream oss(cbuf, 64);
ostringstream oss(cbuf, 64);
oss << gf.data_title;
if (gf.data_tickscale != 1.0f) oss << " x " << 1.0/gf.data_tickscale;
oss << '\0';
TextOut (hDC, 0, (y0+y1)/2, oss.str(), strlen(oss.str()));
TextOut (hDC, 0, (y0+y1)/2, oss.str().c_str(), strlen(oss.str().c_str()));
}

// plot frame
Expand Down
217 changes: 208 additions & 9 deletions Src/Orbiter/OptionsPages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,170 @@ BOOL OptionsPage_Visual::OnInitDialog(HWND hPage, WPARAM wParam, LPARAM lParam)

BOOL OptionsPage_Visual::OnCommand(HWND hPage, WORD ctrlId, WORD notification, HWND hCtrl)
{
switch (ctrlId) {
case IDC_OPT_VIS_CLOUD:
case IDC_OPT_VIS_REFWATER:
if (notification == BN_CLICKED) {
VisualsChanged(hPage);
return TRUE;
}
break;
switch (ctrlId)
{
case IDC_OPT_VIS_CLOUD:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_CLOUD, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bClouds = check;
VisualsChanged( hPage );
return FALSE;
}
break;
case IDC_OPT_VIS_CSHADOW:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_CSHADOW, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bCloudShadows = check;
return FALSE;
}
break;
case IDC_OPT_VIS_HAZE:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_HAZE, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bHaze = check;
return FALSE;
}
break;
case IDC_OPT_VIS_FOG:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_FOG, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bFog = check;
return FALSE;
}
break;
case IDC_OPT_VIS_REFWATER:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_REFWATER, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bWaterreflect = check;
VisualsChanged( hPage );
return FALSE;
}
break;
case IDC_OPT_VIS_RIPPLE:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_RIPPLE, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bSpecularRipple = check;
return FALSE;
}
break;
case IDC_OPT_VIS_LIGHTS:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_LIGHTS, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bNightlights = check;
VisualsChanged( hPage );
return FALSE;
}
break;
case IDC_OPT_VIS_LTLEVEL:
if (notification == EN_CHANGE)
{
char cbuf[16];
double d;
GetWindowText( GetDlgItem( hPage, IDC_OPT_VIS_LTLEVEL ), cbuf, 16 );
if (!sscanf( cbuf, "%lf", &d )) d = 0.5;
else if (d < 0) d = 0.0;
else if (d > 1) d = 1.0;
Cfg()->CfgVisualPrm.LightBrightness = d;
return FALSE;
}
break;
case IDC_OPT_VIS_ELEV:
if (notification == BN_CLICKED)
{
int elevmode = SendDlgItemMessage( hPage, IDC_OPT_VIS_ELEV, BM_GETCHECK, 0, 0 ) != BST_CHECKED ? 0 : (SendDlgItemMessage( hPage, IDC_OPT_VIS_ELEVMODE, CB_GETCURSEL, 0, 0 ) + 1);
Cfg()->CfgVisualPrm.ElevMode = elevmode;
VisualsChanged( hPage );
return FALSE;
}
break;
case IDC_OPT_VIS_ELEVMODE:
if (notification == CBN_SELCHANGE)
{
int elevmode = SendDlgItemMessage( hPage, IDC_OPT_VIS_ELEV, BM_GETCHECK, 0, 0 ) != BST_CHECKED ? 0 : (SendDlgItemMessage( hPage, IDC_OPT_VIS_ELEVMODE, CB_GETCURSEL, 0, 0 ) + 1);
Cfg()->CfgVisualPrm.ElevMode = elevmode;
return FALSE;
}
break;
case IDC_OPT_VIS_MAXLEVEL:
if (notification == EN_CHANGE)
{
char cbuf[16];
DWORD i;
GetWindowText( GetDlgItem( hPage, IDC_OPT_VIS_MAXLEVEL ), cbuf, 16 );
if (!sscanf( cbuf, "%lu", &i )) i = SURF_MAX_PATCHLEVEL2;
Cfg()->CfgVisualPrm.PlanetMaxLevel = max((DWORD)1, min((DWORD)SURF_MAX_PATCHLEVEL2, i));
return FALSE;
}
break;
case IDC_OPT_VIS_VSHADOW:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_VSHADOW, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bVesselShadows = check;
return FALSE;
}
break;
case IDC_OPT_VIS_REENTRY:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_REENTRY, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bReentryFlames = check;
return FALSE;
}
break;
case IDC_OPT_VIS_SHADOW:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_SHADOW, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bShadows = check;
return FALSE;
}
break;
case IDC_OPT_VIS_PARTICLE:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_PARTICLE, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bParticleStreams = check;
return FALSE;
}
break;
case IDC_OPT_VIS_SPECULAR:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_SPECULAR, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bSpecular = check;
return FALSE;
}
break;
case IDC_OPT_VIS_LOCALLIGHT:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_VIS_LOCALLIGHT, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgVisualPrm.bLocalLight = check;
return FALSE;
}
break;
case IDC_OPT_VIS_AMBIENT:
if (notification == EN_CHANGE)
{
char cbuf[16];
DWORD i;
GetWindowText( GetDlgItem(hPage, IDC_OPT_VIS_AMBIENT ), cbuf, 16 );
if (!sscanf( cbuf, "%lu", &i )) i = 15;
else if (i > 255) i = 255;
Cfg()->SetAmbientLevel( i );
return FALSE;
}
break;
}
return FALSE;
return TRUE;
}

//-----------------------------------------------------------------------------
Expand All @@ -548,6 +702,9 @@ void OptionsPage_Visual::VisualsChanged(HWND hPage)
SendDlgItemMessage(hPage, IDC_OPT_VIS_CLOUD, BM_GETCHECK, 0, 0) == BST_CHECKED);
EnableWindow(GetDlgItem(hPage, IDC_OPT_VIS_RIPPLE),
SendDlgItemMessage(hPage, IDC_OPT_VIS_REFWATER, BM_GETCHECK, 0, 0) == BST_CHECKED);
EnableWindow( GetDlgItem( hPage, IDC_OPT_VIS_ELEVMODE ), SendDlgItemMessage( hPage, IDC_OPT_VIS_ELEV, BM_GETCHECK, 0, 0 ) == BST_CHECKED );
EnableWindow( GetDlgItem( hPage, IDC_OPT_VIS_LTLEVEL ), SendDlgItemMessage( hPage, IDC_OPT_VIS_LIGHTS, BM_GETCHECK, 0, 0 ) == BST_CHECKED );
return;
}

// ======================================================================
Expand Down Expand Up @@ -612,6 +769,48 @@ BOOL OptionsPage_Physics::OnInitDialog(HWND hPage, WPARAM wParam, LPARAM lParam)
return TRUE;
}

// ----------------------------------------------------------------------

BOOL OptionsPage_Physics::OnCommand( HWND hPage, WORD ctrlId, WORD notification, HWND hCtrl )
{
switch (ctrlId)
{
case IDC_OPT_PHYS_DISTMASS:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_PHYS_DISTMASS, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgPhysicsPrm.bDistributedMass = check;
return FALSE;
}
break;
case IDC_OPT_PHYS_COMPLEXGRAV:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_PHYS_COMPLEXGRAV, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgPhysicsPrm.bNonsphericalGrav = check;
return FALSE;
}
break;
case IDC_OPT_PHYS_RPRESSURE:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_PHYS_RPRESSURE, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgPhysicsPrm.bRadiationPressure = check;
return FALSE;
}
break;
case IDC_OPT_PHYS_WIND:
if (notification == BN_CLICKED)
{
bool check = (SendDlgItemMessage( hPage, IDC_OPT_PHYS_WIND, BM_GETCHECK, 0, 0 ) == BST_CHECKED);
Cfg()->CfgPhysicsPrm.bAtmWind = check;
return FALSE;
}
break;
}
return TRUE;
}

// ======================================================================

OptionsPage_Instrument::OptionsPage_Instrument(OptionsPageContainer* container)
Expand Down
1 change: 1 addition & 0 deletions Src/Orbiter/OptionsPages.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class OptionsPage_Physics : public OptionsPage {

protected:
BOOL OnInitDialog(HWND hPage, WPARAM wParam, LPARAM lParam);
BOOL OnCommand( HWND hPage, WORD ctrlId, WORD notification, HWND hCtrl );
};

/************************************************************************
Expand Down
1 change: 0 additions & 1 deletion Src/Orbiter/Orbiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <stdio.h>
#include <time.h>
#include <fstream>
#include <strstream>
#include <iomanip>
#include <io.h>
#include "cmdline.h"
Expand Down
8 changes: 8 additions & 0 deletions Src/Orbiter/OrbiterAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,14 @@ DLLEXPORT char *oapiDebugString ()
return DBG_MSG;
}

DLLEXPORT void oapiDebugString(const char* str)
{
#ifndef INLINEGRAPHICS
oapi::GraphicsClient* gc = g_pOrbiter->GetGraphicsClient();
if (gc) gc->clbkDebugString(str);
#endif // !INLINEGRAPHICS
}

DLLEXPORT double oapiRand ()
{
static double irmax = 1.0/(double)RAND_MAX;
Expand Down
13 changes: 7 additions & 6 deletions Src/Orbiter/Vessel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4834,8 +4834,9 @@ void Vessel::UpdatePassive ()
proxybody = prnt->proxybody;
proxyplanet = prnt->proxyplanet;
fstatus = prnt->fstatus;

if (proxybody) UpdateSurfParams();
if (fstatus != FLIGHTSTATUS_LANDED) {
if (proxybody) UpdateSurfParams();
bSurfaceContact = false;
}
UpdateMass(); // register fuel consumption
Expand Down Expand Up @@ -5553,10 +5554,10 @@ bool Vessel::VCRedrawEvent (int id, int event, SURFHANDLE surf) const

bool Vessel::VCMouseEvent (int id, int event, Vector &p) const
{
if (modIntf.v && modIntf.v->Version() >= 1) {
VECTOR3 v = _V(p.x,p.y,p.z);
return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, v);
}
if (modIntf.v && modIntf.v->Version() >= 1) {
VECTOR3 v = _V(p.x,p.y,p.z);
return ((VESSEL2*)modIntf.v)->clbkVCMouseEvent (id, event, v);
}
else
return false;
}
Expand Down Expand Up @@ -8850,4 +8851,4 @@ bool VESSEL4::UnregisterMFDMode (int mode)
int VESSEL4::clbkNavProcess (int mode)
{
return mode;
}
}
Loading

0 comments on commit eb4134a

Please sign in to comment.