Confirm fn_19947 (CEffectPrim::PrimDriftingSparks)
Batch #15302 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_19947 CEffectPrim::PrimDriftingSparks: logic confirmed by peer review (already on main) Peer-reviewed-by: ragnarok-clanker, gordaoprogramas, Toshiro Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
fdedd14722
commit
0fbb07da53
1 changed files with 49 additions and 41 deletions
|
|
@ -38,6 +38,14 @@
|
|||
#include <timeapi.h>
|
||||
|
||||
namespace {
|
||||
// INLINED
|
||||
vector3d& operator+=(vector3d& target, const vector3d& offset) {
|
||||
target.x += offset.x;
|
||||
target.y += offset.y;
|
||||
target.z += offset.z;
|
||||
return target;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
__forceinline int ClampedRandom(int range) {
|
||||
const int value = rand() % range;
|
||||
|
|
@ -4363,6 +4371,47 @@ bool CEffectPrim::PrimWind() {
|
|||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
// INLINED
|
||||
__forceinline int SafeRandom(int range) {
|
||||
if (range == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ClampedRandom(range);
|
||||
}
|
||||
|
||||
// INLINED
|
||||
__forceinline void DriftSlotAngles(EffectPrimitiveSlot& slot, int count, float rise = 1.0f, float fall = 1.0f) {
|
||||
for (int axis = 0; axis < count * 2; axis += 2) {
|
||||
float& angle = slot.height[axis];
|
||||
float& target = slot.height[axis + 1];
|
||||
|
||||
if (target > angle) {
|
||||
angle += rise;
|
||||
|
||||
if (angle > 359.0f) {
|
||||
angle = 359.0f;
|
||||
}
|
||||
|
||||
if (angle > target) {
|
||||
target = static_cast<float>(SafeRandom(static_cast<int>(angle)));
|
||||
}
|
||||
} else {
|
||||
angle -= fall;
|
||||
|
||||
if (angle < 0.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
|
||||
if (angle <= target) {
|
||||
target = static_cast<float>(359 - SafeRandom(static_cast<int>(angle)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00BC5580
|
||||
// FUNCTION: fn_19848
|
||||
bool CEffectPrim::PrimDriftingSquares() {
|
||||
|
|
@ -7156,47 +7205,6 @@ void CEffectPrim::PrimSTIN3() {
|
|||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
// INLINED
|
||||
__forceinline int SafeRandom(int range) {
|
||||
if (range == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NonNegativeRandom(range);
|
||||
}
|
||||
|
||||
// INLINED
|
||||
__forceinline void DriftSlotAngles(EffectPrimitiveSlot& slot, int count, float rise = 1.0f, float fall = 1.0f) {
|
||||
for (int axis = 0; axis < count * 2; axis += 2) {
|
||||
float& angle = slot.height[axis];
|
||||
float& target = slot.height[axis + 1];
|
||||
|
||||
if (target > angle) {
|
||||
angle += rise;
|
||||
|
||||
if (angle > 359.0f) {
|
||||
angle = 359.0f;
|
||||
}
|
||||
|
||||
if (angle > target) {
|
||||
target = static_cast<float>(SafeRandom(static_cast<int>(angle)));
|
||||
}
|
||||
} else {
|
||||
angle -= fall;
|
||||
|
||||
if (angle < 0.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
|
||||
if (angle <= target) {
|
||||
target = static_cast<float>(359 - SafeRandom(static_cast<int>(angle)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00BE8CE0
|
||||
// FUNCTION: fn_19947
|
||||
bool CEffectPrim::PrimDriftingSparks() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue