Skip to content

Commit

Permalink
Fix clang warning messages for RAND_MAX
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Nov 21, 2023
1 parent 979f2fd commit 4b5b228
Show file tree
Hide file tree
Showing 36 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion SamTFE/Sources/Engine/Network/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ CTimerValue CPacketBufferStats::GetPacketSendTime(SLONG slSize)
if (pbs_fLatencyLimit<=0.0f && pbs_fLatencyVariation<=0.0f) {
tvLatency = CTimerValue(0.0);
} else {
tvLatency = CTimerValue(DOUBLE(pbs_fLatencyLimit+(pbs_fLatencyVariation*rand())/RAND_MAX));
tvLatency = CTimerValue(DOUBLE(pbs_fLatencyLimit+(pbs_fLatencyVariation*rand())/(float)(RAND_MAX)));
}

// time when the packet should be sent is max of
Expand Down
12 changes: 6 additions & 6 deletions SamTFE/Sources/Entities/Fish.es
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ functions:
for( INDEX i=0; i<4; i++)
{
FLOAT3D vDirection = vSource;
vDirection(1) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(1) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
Particles_Ghostbuster(vSource, vDirection, 32, 1.0f);
}
}
Expand Down Expand Up @@ -200,9 +200,9 @@ functions:
fDieFactor = 1.0-(ClampUp(fTimePassed-0.25f,0.5f)/0.5f);
}
// adjust light fx
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/RAND_MAX);
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/RAND_MAX);
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/RAND_MAX);
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/(float)(RAND_MAX));
colAmbient = RGBToColor( fR*128*fDieFactor, fG*128*fDieFactor, fB*128*fDieFactor);
colLight = C_WHITE;
return CEnemyBase::AdjustShadingParameters(vLightDirection, colLight, colAmbient);
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/Entities/PlayerAnimator.es
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ functions:
CAttachmentModelObject *pamo = pl.GetModelObject()->GetAttachmentModelList(
PLAYER_ATTACHMENT_TORSO, iAttachWeapon, iAttachObject, iAttachFlare, -1);
if (pamo!=NULL) {
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
CModelObject &mo = pamo->amo_moModelObject;
mo.StretchModel(FLOAT3D(1, 1, 1));
}
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/Entities/PlayerWeapons.es
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/Entities/PlayerWeaponsHD.es
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/Entities/PlayerWeapons_old.es
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/AirElemental.es
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static EntityInfo eiAirElemental = {
0.0f, AIRBOSS_BODY_HEIGHT, 0.0f,
};

#define RAND_05 (FLOAT(rand())/RAND_MAX-0.5f)
#define RAND_05 (FLOAT(rand())/(float)(RAND_MAX)-0.5f)
#define FIREPOS_TWISTER FLOAT3D(-0.04f, 0.91f, -1.06f)
#define SIZE_NORMAL 1
#define SIZE_BIG01 2
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/Fireworks.es
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
616
%{
#include "EntitiesMP/StdH/StdH.h"
#define RAND_05 (FLOAT(rand())/RAND_MAX-0.5f)
#define RAND_05 (FLOAT(rand())/(float)(RAND_MAX)-0.5f)
#define LAUNCH_SPEED 32.0f
%}

Expand Down
12 changes: 6 additions & 6 deletions SamTFE/Sources/EntitiesMP/Fish.es
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ functions:
for( INDEX i=0; i<4; i++)
{
FLOAT3D vDirection = vSource;
vDirection(1) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(1) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
Particles_Ghostbuster(vSource, vDirection, 32, 1.0f);
}
}
Expand Down Expand Up @@ -215,9 +215,9 @@ functions:
fDieFactor = 1.0f-(ClampUp(fTimePassed-0.25f,0.5f)/0.5f);
}
// adjust light fx
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/RAND_MAX);
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/RAND_MAX);
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/RAND_MAX);
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/(float)(RAND_MAX));
colAmbient = RGBToColor( (UBYTE) (fR*128*fDieFactor), (UBYTE) (fG*128*fDieFactor), (UBYTE) (fB*128*fDieFactor));
colLight = C_WHITE;
return CEnemyBase::AdjustShadingParameters(vLightDirection, colLight, colAmbient);
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/Flame.es
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ functions:
lsNew.ls_ulFlags = LSF_NONPERSISTENT|LSF_DYNAMIC;
if(m_bBurningBrush)
{
UBYTE ubRndH = UBYTE( 25+(FLOAT(rand())/RAND_MAX-0.5f)*28);
UBYTE ubRndH = UBYTE( 25+(FLOAT(rand())/(float)(RAND_MAX)-0.5f)*28);
UBYTE ubRndS = 166;
UBYTE ubRndV = 48;
lsNew.ls_colColor = HSVToColor(ubRndH, ubRndS, ubRndV);
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/PlayerAnimator.es
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ functions:
CAttachmentModelObject *pamo = pl.GetModelObject()->GetAttachmentModelList(
PLAYER_ATTACHMENT_TORSO, iAttachWeapon, iAttachObject, iAttachFlare, -1);
if (pamo!=NULL) {
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
CModelObject &mo = pamo->amo_moModelObject;
mo.StretchModel(FLOAT3D(1, 1, 1));
}
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/PlayerWeapons.es
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/PlayerWeaponsHD.es
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/PlayerWeapons_old.es
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTFE/Sources/EntitiesMP/Summoner.es
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ event ESummonerTeleport {
};

%{
#define RAND_05 (FLOAT(rand())/RAND_MAX-0.5f)
#define RAND_05 (FLOAT(rand())/(float)(RAND_MAX)-0.5f)
#define SUMMONER_SIZE 7.0f
#define TM_WAIT_BEFORE_FIRE 1.9f
#define SUMMONER_HEALTH 15000.0f
Expand Down
6 changes: 3 additions & 3 deletions SamTFE/Sources/WorldEditor/DlgBrowseByClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ void CDlgBrowseByClass::OnSelendokPluggins()
if( (pen->GetFlags() & ENF_ANCHORED) == 0)
{
CPlacement3D pl=pen->GetPlacement();
pl.pl_OrientationAngle(1)=((FLOAT)rand())/RAND_MAX*360.0f;
pl.pl_OrientationAngle(1)=((FLOAT)rand())/(float)(RAND_MAX)*360.0f;
pen->SetPlacement(pl);
}
}
Expand All @@ -1126,7 +1126,7 @@ void CDlgBrowseByClass::OnSelendokPluggins()
if( (pen->GetFlags() & ENF_ANCHORED) == 0)
{
CPlacement3D pl=pen->GetPlacement();
pl.pl_OrientationAngle(2)=((FLOAT)rand())/RAND_MAX*360.0f;
pl.pl_OrientationAngle(2)=((FLOAT)rand())/(float)(RAND_MAX)*360.0f;
pen->SetPlacement(pl);
}
}
Expand All @@ -1147,7 +1147,7 @@ void CDlgBrowseByClass::OnSelendokPluggins()
if( (pen->GetFlags() & ENF_ANCHORED) == 0)
{
CPlacement3D pl=pen->GetPlacement();
pl.pl_OrientationAngle(3)=((FLOAT)rand())/RAND_MAX*360.0f;
pl.pl_OrientationAngle(3)=((FLOAT)rand())/(float)(RAND_MAX)*360.0f;
pen->SetPlacement(pl);
}
}
Expand Down
6 changes: 3 additions & 3 deletions SamTFE/Sources/WorldEditor/TerrainEditing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void ApplyRNDNoise(void)
FLOAT fBrushMultiplier=GetBrushMultiplier(x,y);
INDEX iPixSrc=y*_rect.Width()+x;
FLOAT fInfluence=_puwBuffer[iPixSrc];
FLOAT fRnd=FLOAT(rand())/RAND_MAX-0.5f;
FLOAT fRnd=FLOAT(rand())/(float)(RAND_MAX)-0.5f;
FLOAT fValue=_puwBuffer[iPixSrc];
FLOAT fMaxRandomized=fValue+fRnd*fMaxNoise;
FLOAT fFilterPower=Clamp(fBrushMultiplier*_fStrength,0.0f,1.0f);
Expand Down Expand Up @@ -260,7 +260,7 @@ UWORD GetHMPixel(INDEX x, INDEX y)

UWORD RandomizePixel(FLOAT fmid, FLOAT fdmax)
{
FLOAT fRand=((FLOAT)rand())/RAND_MAX-0.5f;
FLOAT fRand=((FLOAT)rand())/(float)(RAND_MAX)-0.5f;
FLOAT fd=fdmax*fRand;
FLOAT fres=Clamp(fmid+fd,0.0f,65536.0f);
return fres;
Expand Down Expand Up @@ -337,7 +337,7 @@ void RandomizeWhiteNoise(void)
FLOAT *pfTemp=_pafWhiteNoise;
for(INDEX i=0; i<WNOISE*WNOISE; i++)
{
FLOAT fRnd=FLOAT(rand())/RAND_MAX-0.5f;
FLOAT fRnd=FLOAT(rand())/(float)(RAND_MAX)-0.5f;
*pfTemp=fRnd;
pfTemp++;
}
Expand Down
4 changes: 2 additions & 2 deletions SamTFE/Sources/WorldEditor/WorldEditorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13033,7 +13033,7 @@ void CWorldEditorView::OnRandomOffsetU()
if( pTD != NULL)
{
// add rnd offsets to mapping
itbpo->bpo_abptTextures[pDoc->m_iTexture].bpt_mdMapping.md_fUOffset+=((FLOAT)rand())/RAND_MAX*pTD->GetWidth();
itbpo->bpo_abptTextures[pDoc->m_iTexture].bpt_mdMapping.md_fUOffset+=((FLOAT)rand())/(float)(RAND_MAX)*pTD->GetWidth();
}
}
}
Expand All @@ -13048,7 +13048,7 @@ void CWorldEditorView::OnRandomOffsetV()
if( pTD != NULL)
{
// add rnd offsets to mapping
itbpo->bpo_abptTextures[pDoc->m_iTexture].bpt_mdMapping.md_fVOffset+=((FLOAT)rand())/RAND_MAX*pTD->GetHeight();
itbpo->bpo_abptTextures[pDoc->m_iTexture].bpt_mdMapping.md_fVOffset+=((FLOAT)rand())/(float)(RAND_MAX)*pTD->GetHeight();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Engine/Network/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ CTimerValue CPacketBufferStats::GetPacketSendTime(SLONG slSize)
if (pbs_fLatencyLimit<=0.0f && pbs_fLatencyVariation<=0.0f) {
tvLatency = CTimerValue(0.0);
} else {
tvLatency = CTimerValue(DOUBLE(pbs_fLatencyLimit+(pbs_fLatencyVariation*rand())/RAND_MAX));
tvLatency = CTimerValue(DOUBLE(pbs_fLatencyLimit+(pbs_fLatencyVariation*rand())/(float)(RAND_MAX)));
}

// time when the packet should be sent is max of
Expand Down
12 changes: 6 additions & 6 deletions SamTSE/Sources/Entities/Fish.es
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ functions:
for( INDEX i=0; i<4; i++)
{
FLOAT3D vDirection = vSource;
vDirection(1) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(1) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
Particles_Ghostbuster(vSource, vDirection, 32, 1.0f);
}
}
Expand Down Expand Up @@ -200,9 +200,9 @@ functions:
fDieFactor = 1.0-(ClampUp(fTimePassed-0.25f,0.5f)/0.5f);
}
// adjust light fx
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/RAND_MAX);
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/RAND_MAX);
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/RAND_MAX);
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/(float)(RAND_MAX));
colAmbient = RGBToColor( fR*128*fDieFactor, fG*128*fDieFactor, fB*128*fDieFactor);
colLight = C_WHITE;
return CEnemyBase::AdjustShadingParameters(vLightDirection, colLight, colAmbient);
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Entities/PlayerAnimator.es
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ functions:
CAttachmentModelObject *pamo = pl.GetModelObject()->GetAttachmentModelList(
PLAYER_ATTACHMENT_TORSO, iAttachWeapon, iAttachObject, iAttachFlare, -1);
if (pamo!=NULL) {
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
CModelObject &mo = pamo->amo_moModelObject;
mo.StretchModel(FLOAT3D(1, 1, 1));
}
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Entities/PlayerWeapons.es
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Entities/PlayerWeaponsHD.es
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/Entities/PlayerWeapons_old.es
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/AirElemental.es
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static EntityInfo eiAirElemental = {
0.0f, AIRBOSS_BODY_HEIGHT, 0.0f,
};

#define RAND_05 (FLOAT(rand())/RAND_MAX-0.5f)
#define RAND_05 (FLOAT(rand())/(float)(RAND_MAX)-0.5f)
#define FIREPOS_TWISTER FLOAT3D(-0.04f, 0.91f, -1.06f)
#define SIZE_NORMAL 1
#define SIZE_BIG01 2
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/Fireworks.es
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
616
%{
#include "EntitiesMP/StdH/StdH.h"
#define RAND_05 (FLOAT(rand())/RAND_MAX-0.5f)
#define RAND_05 (FLOAT(rand())/(float)(RAND_MAX)-0.5f)
#define LAUNCH_SPEED 32.0f
%}

Expand Down
12 changes: 6 additions & 6 deletions SamTSE/Sources/EntitiesMP/Fish.es
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ functions:
for( INDEX i=0; i<4; i++)
{
FLOAT3D vDirection = vSource;
vDirection(1) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/RAND_MAX)-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(1) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(2) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
vDirection(3) += ((FLOAT(rand())/(float)(RAND_MAX))-0.5f) * DISTANCE_ELECTRICITY/1.0f;
Particles_Ghostbuster(vSource, vDirection, 32, 1.0f);
}
}
Expand Down Expand Up @@ -215,9 +215,9 @@ functions:
fDieFactor = 1.0f-(ClampUp(fTimePassed-0.25f,0.5f)/0.5f);
}
// adjust light fx
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/RAND_MAX);
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/RAND_MAX);
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/RAND_MAX);
FLOAT fR = 0.7f+0.1f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fG = 0.7f+0.2f*(FLOAT(rand())/(float)(RAND_MAX));
FLOAT fB = 0.7f+0.3f*(FLOAT(rand())/(float)(RAND_MAX));
colAmbient = RGBToColor( (UBYTE) (fR*128*fDieFactor), (UBYTE) (fG*128*fDieFactor), (UBYTE) (fB*128*fDieFactor));
colLight = C_WHITE;
return CEnemyBase::AdjustShadingParameters(vLightDirection, colLight, colAmbient);
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/Flame.es
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ functions:
lsNew.ls_ulFlags = LSF_NONPERSISTENT|LSF_DYNAMIC;
if(m_bBurningBrush)
{
UBYTE ubRndH = UBYTE( 25+(FLOAT(rand())/RAND_MAX-0.5f)*28);
UBYTE ubRndH = UBYTE( 25+(FLOAT(rand())/(float)(RAND_MAX)-0.5f)*28);
UBYTE ubRndS = 166;
UBYTE ubRndV = 48;
lsNew.ls_colColor = HSVToColor(ubRndH, ubRndS, ubRndV);
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/PlayerAnimator.es
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ functions:
CAttachmentModelObject *pamo = pl.GetModelObject()->GetAttachmentModelList(
PLAYER_ATTACHMENT_TORSO, iAttachWeapon, iAttachObject, iAttachFlare, -1);
if (pamo!=NULL) {
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
CModelObject &mo = pamo->amo_moModelObject;
mo.StretchModel(FLOAT3D(1, 1, 1));
}
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/PlayerWeapons.es
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
2 changes: 1 addition & 1 deletion SamTSE/Sources/EntitiesMP/PlayerWeaponsHD.es
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ functions:
void ShowFlare(CModelObject &moWeapon, INDEX iAttachObject, INDEX iAttachFlare, FLOAT fSize) {
CModelObject *pmo = &(moWeapon.GetAttachmentModel(iAttachObject)->amo_moModelObject);
CAttachmentModelObject *pamo = pmo->GetAttachmentModel(iAttachFlare);
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/RAND_MAX;
pamo->amo_plRelative.pl_OrientationAngle(3) = (rand()*360.0f)/(float)(RAND_MAX);
pmo = &(pamo->amo_moModelObject);
pmo->StretchModel(FLOAT3D(fSize, fSize, fSize));
};
Expand Down
Loading

0 comments on commit 4b5b228

Please sign in to comment.