Fixed #348 Added Random in the possible cloud cover settings
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3376 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 4a3930e19f6ff213c6784b7b95c6c4c16720c8e5 Former-commit-id: 27d89e170a6edffe641c180453f1c29308d81c8e
This commit is contained in:
parent
9663df8813
commit
60b31c9478
6 changed files with 43 additions and 44 deletions
|
@ -382,8 +382,9 @@ typedef struct RmInfo
|
|||
#define RM_VAL_CLOUDS_SCARCE "scarce clouds"
|
||||
#define RM_VAL_CLOUDS_MANY "many clouds"
|
||||
#define RM_VAL_CLOUDS_FULL "full cover"
|
||||
#define RM_VAL_CLOUDS_RANDOM "random"
|
||||
#define RM_VALS_CLOUDS { RM_VAL_CLOUDS_NONE, RM_VAL_CLOUDS_FEW, RM_VAL_CLOUDS_SCARCE, \
|
||||
RM_VAL_CLOUDS_MANY, RM_VAL_CLOUDS_FULL }
|
||||
RM_VAL_CLOUDS_MANY, RM_VAL_CLOUDS_FULL, RM_VAL_CLOUDS_RANDOM }
|
||||
|
||||
#define RM_VAL_RAIN_NONE "none"
|
||||
#define RM_VAL_RAIN_LITTLE "little"
|
||||
|
|
|
@ -586,13 +586,14 @@ typedef struct TrackLocalInfo
|
|||
#define TR_CLOUDS_SCARCE 2
|
||||
#define TR_CLOUDS_MANY 3
|
||||
#define TR_CLOUDS_FULL 4
|
||||
#define TR_CLOUDS_RANDOM 5 // Must not be used in the clouds field. Race engine only.
|
||||
|
||||
int rain; /**< Rain strength / strength spec (warning : consistency with RM_VAL_RAIN_*) */
|
||||
#define TR_RAIN_NONE 0
|
||||
#define TR_RAIN_LITTLE 1
|
||||
#define TR_RAIN_MEDIUM 2
|
||||
#define TR_RAIN_HEAVY 3
|
||||
#define TR_RAIN_RANDOM 4
|
||||
#define TR_RAIN_RANDOM 4 // Must not be used in the rain field. Race engine only.
|
||||
|
||||
int water; /**< Water "level" on the ground (very simple constant model) */
|
||||
#define TR_WATER_NONE 0
|
||||
|
|
|
@ -103,7 +103,7 @@ ReInit(void)
|
|||
GfTracks::self()->setTrackInterface(&ReInfo->_reTrackItf);
|
||||
|
||||
/* The graphic modules isn't loaded at this moment, so make sure _reGraphicItf equals NULL */
|
||||
memset (&ReInfo->_reGraphicItf, 0, sizeof(tGraphicItf));
|
||||
//memset (&ReInfo->_reGraphicItf, 0, sizeof(tGraphicItf)); // Already done by calloc.
|
||||
|
||||
// Initialize the movie capture system.
|
||||
tRmMovieCapture *capture = &(ReInfo->movieCapture);
|
||||
|
|
|
@ -299,10 +299,13 @@ reTrackInitWeather(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Take care of the random case for rain falls, clouds cover and ground water.
|
||||
const char* pszWeatherSelect = "user-defined";
|
||||
if (rain == TR_RAIN_RANDOM)
|
||||
// Take care of the random case for rain falls and ground water.
|
||||
const bool bRandomRain = (rain == TR_RAIN_RANDOM);
|
||||
if (bRandomRain)
|
||||
{
|
||||
// Force random clouds, in case there is no rain at the end.
|
||||
clouds = TR_CLOUDS_RANDOM;
|
||||
|
||||
// Random rain (if random[0,1] < trackLocal->anyrainlkhood, then it rains).
|
||||
const tdble randDraw = (tdble)(rand()/(double)RAND_MAX);
|
||||
|
||||
|
@ -324,33 +327,36 @@ reTrackInitWeather(void)
|
|||
// otherwise, random[0,1] >= medium + little rain likelyhood => rain = Heavy rain
|
||||
else
|
||||
rain = TR_RAIN_HEAVY;
|
||||
|
||||
// Whatever rain level (except for none), heavy clouds.
|
||||
clouds = TR_CLOUDS_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No Rain.
|
||||
rain = TR_RAIN_NONE;
|
||||
|
||||
// Random clouds.
|
||||
clouds = rand() % (TR_CLOUDS_FULL + 1);
|
||||
}
|
||||
}
|
||||
|
||||
pszWeatherSelect = "randomly selected";
|
||||
// Take care of the random case for clouds cover.
|
||||
const bool bRandomClouds = (clouds == TR_CLOUDS_RANDOM);
|
||||
if (bRandomClouds)
|
||||
{
|
||||
if (rain != TR_RAIN_NONE)
|
||||
{
|
||||
// If any rain level, heavy clouds.
|
||||
clouds = TR_CLOUDS_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rain != TR_RAIN_NONE)
|
||||
// Whatever rain level (except for none), heavy clouds.
|
||||
clouds = TR_CLOUDS_FULL;
|
||||
// Really random clouds.
|
||||
clouds = rand() % (TR_CLOUDS_FULL + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Ground water = rain for the moment (might change in the future).
|
||||
const int water = rain;
|
||||
|
||||
GfLogInfo("Weather : Using %s rain (%d), clouds (%d) and ground water (%d) settings\n",
|
||||
pszWeatherSelect, rain, clouds, water);
|
||||
GfLogInfo("Weather : Using %s rain (%d) and ground water (%d) + %s clouds (%d) settings\n",
|
||||
bRandomRain ? "random" : "user defined", rain, water,
|
||||
bRandomClouds ? "random" : "user defined", clouds);
|
||||
|
||||
// Update track local info.
|
||||
trackLocal->rain = rain;
|
||||
|
|
|
@ -220,16 +220,6 @@ rmChangeClouds(void *vp)
|
|||
(GfRace::ECloudsSpec)
|
||||
((rmrpClouds + GfRace::nCloudsSpecNumber + delta) % GfRace::nCloudsSpecNumber);
|
||||
GfuiLabelSetText(ScrHandle, rmrpCloudsEditId, CloudsValues[rmrpClouds]);
|
||||
|
||||
if (rmrpConfMask & RM_CONF_RAIN_FALL)
|
||||
{
|
||||
// Make rain level compatible if needed.
|
||||
if (rmrpClouds != GfRace::eCloudsFull) // No heavy clouds => no rain
|
||||
{
|
||||
rmrpRain = GfRace::eRainNone;
|
||||
GfuiLabelSetText(ScrHandle, rmrpRainEditId, RainValues[rmrpRain]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -244,23 +234,22 @@ rmChangeRain(void *vp)
|
|||
if (rmrpConfMask & RM_CONF_CLOUD_COVER)
|
||||
{
|
||||
// Make clouds state compatible if needed.
|
||||
int cloudsComboVisibility;
|
||||
int cloudsComboEnabled = GFUI_ENABLE;
|
||||
if (rmrpRain == GfRace::eRainRandom) // Random rain => Random clouds.
|
||||
{
|
||||
cloudsComboVisibility = GFUI_INVISIBLE;
|
||||
GfuiLabelSetText(ScrHandle, rmrpCloudsEditId, "random");
|
||||
cloudsComboEnabled = GFUI_DISABLE;
|
||||
rmrpClouds = GfRace::eCloudsRandom;
|
||||
}
|
||||
else
|
||||
else if (rmrpRain != GfRace::eRainNone)
|
||||
{
|
||||
cloudsComboVisibility = GFUI_VISIBLE;
|
||||
if (rmrpRain != GfRace::eRainNone)
|
||||
cloudsComboEnabled = GFUI_DISABLE;
|
||||
rmrpClouds = GfRace::eCloudsFull; // Rain => Heavy clouds.
|
||||
GfuiLabelSetText(ScrHandle, rmrpCloudsEditId, CloudsValues[rmrpClouds]);
|
||||
}
|
||||
GfuiLabelSetText(ScrHandle, rmrpCloudsEditId, CloudsValues[rmrpClouds]);
|
||||
|
||||
// Show / hide clouds combo arrow buttons (random rain => no sky choice).
|
||||
GfuiVisibilitySet(ScrHandle, rmrpCloudsLeftArrowId, cloudsComboVisibility);
|
||||
GfuiVisibilitySet(ScrHandle, rmrpCloudsRightArrowId, cloudsComboVisibility);
|
||||
// Show / hide clouds combo arrow buttons (any rain => no sky choice).
|
||||
GfuiEnable(ScrHandle, rmrpCloudsLeftArrowId, cloudsComboEnabled);
|
||||
GfuiEnable(ScrHandle, rmrpCloudsRightArrowId, cloudsComboEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,7 +355,7 @@ RmRaceParamsMenu(void *vrp)
|
|||
// 4) According to the competitors.
|
||||
if ((rmrpConfMask & RM_CONF_DISP_MODE) && MenuData->pRace->hasHumanCompetitors())
|
||||
{
|
||||
GfLogTrace("Will not configure Display Mode as some human driver(s) in the session\n");
|
||||
GfLogTrace("Will not configure Display Mode as some human driver(s) are in\n");
|
||||
rmrpConfMask &= ~RM_CONF_DISP_MODE;
|
||||
}
|
||||
|
||||
|
@ -387,6 +376,7 @@ RmRaceParamsMenu(void *vrp)
|
|||
CreateLabelControl(ScrHandle, menuXMLDescHdle, "nooptionlabel");
|
||||
}
|
||||
|
||||
// Otherwise, create and initialize the race length configuration controls.
|
||||
if (rmrpConfMask & RM_CONF_RACE_LEN)
|
||||
{
|
||||
if (pRaceSessionParams->nDistance < 0)
|
||||
|
@ -489,9 +479,9 @@ RmRaceParamsMenu(void *vrp)
|
|||
GfuiLabelSetText(ScrHandle, rmrpTimeOfDayEditId, TimeOfDayValues[rmrpTimeOfDay]);
|
||||
}
|
||||
|
||||
// Create and initialize Clouds combo box (2 arrow buttons and a variable label).
|
||||
if (rmrpConfMask & RM_CONF_CLOUD_COVER)
|
||||
{
|
||||
// Create and initialize Clouds combo box (2 arrow buttons and a variable label).
|
||||
if (pRaceSessionParams->eCloudsSpec == GfRace::nCloudsSpecNumber)
|
||||
rmrpClouds = GfRace::eCloudsNone; // Default value.
|
||||
else
|
||||
|
@ -512,9 +502,9 @@ RmRaceParamsMenu(void *vrp)
|
|||
GfuiLabelSetText(ScrHandle, rmrpCloudsEditId, CloudsValues[rmrpClouds]);
|
||||
}
|
||||
|
||||
// Create and initialize Rain combo box (2 arrow buttons and a variable label).
|
||||
if ((rmrpConfMask & RM_CONF_RAIN_FALL) && (rmrpFeatures & RM_FEATURE_WETTRACK))
|
||||
{
|
||||
// Create and initialize Rain combo box (2 arrow buttons and a variable label).
|
||||
if (pRaceSessionParams->eRainSpec == GfRace::nRainSpecNumber)
|
||||
rmrpRain = GfRace::eRainNone; // Default value.
|
||||
else
|
||||
|
@ -535,6 +525,7 @@ RmRaceParamsMenu(void *vrp)
|
|||
rmChangeRain(0); // Make cloud cover settings compatible if needed.
|
||||
}
|
||||
|
||||
// Create and initialize Display mode combo-box-like control.
|
||||
if (rmrpConfMask & RM_CONF_DISP_MODE)
|
||||
{
|
||||
if (pRaceSessionParams->eDisplayMode == GfRace::nDisplayModeNumber)
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
eTimeDusk, eTimeNight, eTimeNow, eTimeFromTrack,
|
||||
nTimeSpecNumber }; // Last = invalid value = nb of valid ones.
|
||||
enum ECloudsSpec { eCloudsNone, eCloudsFew, eCloudsScarce, eCloudsMany, eCloudsFull,
|
||||
nCloudsSpecNumber}; // Last = invalid value = nb of valid ones.
|
||||
eCloudsRandom, nCloudsSpecNumber}; // Last = invalid value = nb of valid ones.
|
||||
enum ERainSpec { eRainNone, eRainLittle, eRainMedium, eRainHeavy, eRainRandom,
|
||||
nRainSpecNumber }; // Last = invalid value = nb of valid ones.
|
||||
class Parameters
|
||||
|
|
Loading…
Reference in a new issue