From 8f01eab5ab97c498fd308c091ad9c555b2f67b56 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 25 Feb 2020 20:01:56 +0100 Subject: Fixes for Serge's review --- src/control/Pickups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/control/Pickups.cpp') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 67c59101..b4ec7a0b 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -704,7 +704,7 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (double)(rand() & 0xF) * 0.1 + 3.0; + float radius = (double)(rand() & 0xF) * 0.1 + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); float size = (double)(rand() & 0xF) * 0.0005 + 0.6; CCoronas::RegisterCorona( (uintptr)entity, -- cgit v1.2.3 From c88c2115e227ef0dbac6368224f1564159a9e2df Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 25 Feb 2020 20:54:26 +0100 Subject: Remove unneeded double to float casts --- src/control/Pickups.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/control/Pickups.cpp') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index b4ec7a0b..c53cab3f 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -704,9 +704,9 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (double)(rand() & 0xF) * 0.1 + 3.0f; + float radius = (rand() & 0xF) * 0.1f + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); - float size = (double)(rand() & 0xF) * 0.0005 + 0.6; + float size = (rand() & 0xF) * 0.0005f + 0.6f; CCoronas::RegisterCorona( (uintptr)entity, aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f, 255, @@ -1044,4 +1044,4 @@ STARTPATCHES InjectHook(0x433E40, CPickups::Save, PATCH_JUMP); InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP); InjectHook(0x430860, &CPickup::Update, PATCH_JUMP); -ENDPATCHES \ No newline at end of file +ENDPATCHES -- cgit v1.2.3 From 337924c7944115a9212edfb1097a8f83e7f6daf0 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Fri, 28 Feb 2020 18:34:39 +0100 Subject: Cleanup audio code + fixes for review --- src/control/Pickups.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/control/Pickups.cpp') diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index c53cab3f..53da89f4 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1,27 +1,29 @@ #include "common.h" #include "patcher.h" #include "main.h" -#include "Pickups.h" + #include "Camera.h" -#include "Entity.h" -#include "Timer.h" -#include "Shadows.h" #include "Coronas.h" -#include "World.h" +#include "Darkel.h" +#include "Entity.h" +#include "Explosion.h" +#include "Font.h" +#include "Garages.h" +#include "General.h" #include "ModelIndices.h" -#include "PlayerPed.h" #include "Object.h" -#include "Pools.h" #include "Pad.h" +#include "Pickups.h" +#include "PlayerPed.h" +#include "PointLights.h" +#include "Pools.h" #include "Script.h" -#include "Darkel.h" -#include "Garages.h" -#include "Explosion.h" -#include "WaterLevel.h" +#include "Shadows.h" #include "SpecialFX.h" -#include "PointLights.h" #include "Sprite.h" -#include "Font.h" +#include "Timer.h" +#include "WaterLevel.h" +#include "World.h" CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98; int16 CPickups::NumMessages;// = *(int16*)0x95CC98; @@ -693,7 +695,7 @@ CPickups::DoPickUpEffects(CEntity *entity) CVector &pos = entity->GetPosition(); - float colorModifier = ((double)(rand() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; + float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; CShadows::StoreStaticShadow( (uintptr)entity, SHADOWTYPE_ADDITIVE, @@ -704,9 +706,9 @@ CPickups::DoPickUpEffects(CEntity *entity) aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f, 1.0f, 40.0f, false, 0.0f); - float radius = (rand() & 0xF) * 0.1f + 3.0f; + float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f; CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); - float size = (rand() & 0xF) * 0.0005f + 0.6f; + float size = (CGeneral::GetRandomNumber() & 0xF) * 0.0005f + 0.6f; CCoronas::RegisterCorona( (uintptr)entity, aWeaponReds[colorId] * modifiedSin / 2.0f, aWeaponGreens[colorId] * modifiedSin / 2.0f, aWeaponBlues[colorId] * modifiedSin / 2.0f, 255, -- cgit v1.2.3