Skip to content
Open
2 changes: 1 addition & 1 deletion config/RSPE01_01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20101,7 +20101,7 @@ mFormatBufferSize__Q34nw4r2ut17TextWriterBase<c> = .sdata:0x804BD388; // type:ob
NW4R_EF_Version___29@unnamed@ef_effectsystem_cpp@ = .sdata:0x804BD390; // type:object size:0x4 scope:local align:4 data:4byte
mDisplayVersion__Q34nw4r2ef12EffectSystem = .sdata:0x804BD394; // type:object size:0x1 scope:global align:1 data:byte
billboard_tex0_u8__Q24nw4r2ef = .sdata:0x804BD3A0; // type:object size:0x20 scope:global align:32
directional_tex0_u8__Q24nw4r2ef = .sdata:0x804BD3C0; // type:object size:0x20 scope:global
directional_tex0_u8__Q24nw4r2ef = .sdata:0x804BD3C0; // type:object size:0x20 scope:global align:32
free_tex0_u8__Q24nw4r2ef = .sdata:0x804BD3E0; // type:object size:0x8 scope:global
@4676 = .sdata:0x804BD3E8; // type:object size:0x4 scope:local align:4 data:float
@4668 = .sdata:0x804BD3F0; // type:object size:0x4 scope:local align:4 data:float
Expand Down
4 changes: 2 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def MatchingFor(*versions):
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/ef_emitter.cpp"),
Object(NonMatching, "nw4r/ef/ef_animcurve.cpp"),
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/ef_particle.cpp"),
Object(NonMatching, "nw4r/ef/ef_particlemanager.cpp"),
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/ef_particlemanager.cpp"),
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/ef_resource.cpp"),
Object(Matching, "nw4r/ef/ef_util.cpp"),
Object(Matching, "nw4r/ef/ef_handle.cpp"),
Expand All @@ -518,7 +518,7 @@ def MatchingFor(*versions):
Object(Matching, "nw4r/ef/emform/ef_cube.cpp"),
Object(Matching, "nw4r/ef/drawstrategy/ef_drawstrategybuilder.cpp"),
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/drawstrategy/ef_drawstrategyimpl.cpp"),
Object(NonMatching, "nw4r/ef/drawstrategy/ef_drawbillboardstrategy.cpp"),
Object(not MatchingFor("RSPE01_00"), "nw4r/ef/drawstrategy/ef_drawbillboardstrategy.cpp"),
Object(NonMatching, "nw4r/ef/drawstrategy/ef_drawdirectionalstrategy.cpp"),
Object(NonMatching, "nw4r/ef/drawstrategy/ef_drawfreestrategy.cpp"),
Object(Matching, "nw4r/ef/drawstrategy/ef_drawlinestrategy.cpp"),
Expand Down
4 changes: 3 additions & 1 deletion include/MSL/internal/math_double.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ inline float modff(float x, float* iptr) {
return frac;
}

float fabsf(float x);
inline float fabsf(float x) {
return __fabs(x);
}

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion include/nw4r/ef/drawstrategy/ef_drawbillboardstrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DrawBillboardStrategy : public DrawStrategyImpl {
inline void DispParticle_Directional(Particle* pParticle,
const math::MTX34& rViewMtx, f32 vx,
f32 vy, f32 vz, f32 rc, f32 rs, f32 sx,
f32 sy, const math::VEC2& rPivot,
f32 sy, f32 vs, const math::VEC2& rPivot,
int flags);

void DispPolygon(const math::VEC3& rP, const math::VEC3& rD1,
Expand Down
14 changes: 14 additions & 0 deletions include/nw4r/ef/drawstrategy/ef_drawdirectionalstrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ class DrawDirectionalStrategy : public DrawStrategyImpl {

virtual CalcAheadFunc
GetCalcAheadFunc(ParticleManager* pManager); // at 0x18
private:
void DrawDirectional(const DrawInfo& rInfo, ParticleManager* pManager);
void DrawDirectionalBillboard(const DrawInfo& rInfo, ParticleManager* pManager);
void InitGraphics(const DrawInfo& rInfo, ParticleManager* pManager);

enum DirectionalPivot {
DIRECTIONAL_PIVOT_NOP,
DIRECTIONAL_PIVOT_BILLBOARD,
DIRECTIONAL_PIVOT__MASK = 0x3
};

DirectionalPivot GetDirectionalPivot(const EmitterDrawSetting& rSetting) {
return static_cast<DirectionalPivot>(rSetting.typeOption2 & DIRECTIONAL_PIVOT__MASK);
}
};

} // namespace ef
Expand Down
29 changes: 28 additions & 1 deletion include/nw4r/ef/ef_random.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@
namespace nw4r {
namespace ef {

enum {
// tentative names
RANDOM_MULT = 0x343FD,
RANDOM_ADD = 0x269EC3 // perhaps RANDOM_INC would be a better name for the LCG increment?
};

inline u32 RANDOM_NEXT(u32 prev) {
// from TFP2
return prev * RANDOM_MULT + RANDOM_ADD;
}

inline u32 RANDOM_INIT(u16 objectSeed, u16 keySeed, u16 keyIdx, u32 keyDiv) {
// from TFP2
union {
u32 whole;
u8 part[4];
} result;

result.whole = objectSeed * 0x3F81F635 + keySeed * 0x30A74193 + keyDiv * 0x7B929 + keyIdx * 0x371097E7 + 0x4BF53; //TODO: clean up magic numbers

result.part[2] ^= result.part[3];
result.part[1] ^= result.part[2];
result.part[0] ^= result.part[1];

return result.whole;
}

class Random {
private:
u32 mSeed; // at 0x0
Expand All @@ -26,7 +53,7 @@ class Random {

private:
void MixRandomSeed() {
mSeed = mSeed * 0x343FD + 0x269EC3;
mSeed = mSeed * RANDOM_MULT + RANDOM_ADD;
}
};

Expand Down
27 changes: 7 additions & 20 deletions include/nw4r/ef/ef_res_animcurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum AnimCurveTarget {
// AC_TYPE_PARTICLE_F32
AC_TARGET_SIZE,
AC_TARGET_SCALE,
AC_TARGET_12,
AC_TARGET_ROTATE,
AC_TARGET_TEXTURE1SCALE = 17,
AC_TARGET_TEXTURE1ROTATE,
AC_TARGET_TEXTURE1TRANSLATE,
Expand All @@ -45,13 +45,13 @@ enum AnimCurveTarget {
AC_TARGET_TEXTUREINDROTATE,
AC_TARGET_TEXTUREINDTRANSLATE,

AC_TARGET_UNK32 = 32,
AC_TARGET_FIELD_GRAVITY = 32,
AC_TARGET_FIELD_SPEED,
AC_TARGET_UNK34,
AC_TARGET_UNK35,
AC_TARGET_UNK36,
AC_TARGET_UNK38 = 38, // FieldSpin?
AC_TARGET_UNK39,
AC_TARGET_FIELD_MAGNET,
AC_TARGET_FIELD_NEWTON,
AC_TARGET_FIELD_VORTEX,
AC_TARGET_FIELD_SPIN = 38,
AC_TARGET_FIELD_RANDOM,
AC_TARGET_EMIT_COMMONPARAM = 64,
AC_TARGET_EMIT_SCALE,
AC_TARGET_EMIT_ROTATE,
Expand All @@ -63,9 +63,6 @@ enum AnimCurveTarget {
AC_TARGET_EMIT_SPEED_SPECDIR,
AC_TARGET_EMIT_EMISSION,

// AC_TYPE_PARTICLE_ROTATE
AC_TARGET_ROTATE = 12,

// Texture target
// AC_TARGET_TEXTURE1 = 23,
// AC_TARGET_TEXTURE2 = 24,
Expand All @@ -74,16 +71,6 @@ enum AnimCurveTarget {
// Child target
// AC_TARGET_CHILD = 26,

// Field target
// AC_TARGET_FIELD_GRAVITY = 27,
// AC_TARGET_FIELD_SPEED = 28,
// AC_TARGET_FIELD_MAGNET = 29,
// AC_TARGET_FIELD_NEWTON = 30,
// AC_TARGET_FIELD_VORTEX = 31,
// AC_TARGET_FIELD_SPIN = 32,
// AC_TARGET_FIELD_RANDOM = 33,
// AC_TARGET_FIELD_TAIL = 34,

// Postfield target
// AC_TARGET_POSTFIELD_SIZE = 35,
// AC_TARGET_POSTFIELD_ROTATE = 36,
Expand Down
Loading
Loading