This commit is contained in:
Unnunu
2025-04-17 17:24:32 +03:00
parent b5022dc9fa
commit 88bfcc6d22
9 changed files with 482 additions and 463 deletions
+1 -1
View File
@@ -1744,7 +1744,7 @@ typedef struct SegmentPropertiesCamera {
typedef struct ObjectSegment {
/* 0x0000 */ ObjectTransform trans;
/* 0x0018 */ s16 animFrame;
/* 0x001A */ s16 unk1A;
/* 0x001A */ s16 numActiveEmitters;
/* 0x001C */ f32 x_velocity;
/* 0x0020 */ f32 y_velocity;
/* 0x0024 */ f32 z_velocity;
+7 -7
View File
@@ -2064,11 +2064,11 @@ s32 obj_init_emitter(Object *obj, ParticleEmitter *emitter) {
for (i = 0; i < obj->segment.header->particleCount; i++) {
if ((particleDataEntry[i].upper & 0xFFFF0000) == 0xFFFF0000) {
emitter_init(&obj->particleEmitter[i], (particleDataEntry[i].upper >> 8) & 0xFF,
particleDataEntry[i].upper & 0xFF);
particleDataEntry[i].upper & 0xFF);
} else {
emitter_init_with_pos(&obj->particleEmitter[i], (particleDataEntry[i].upper >> 0x18) & 0xFF,
(particleDataEntry[i].upper >> 0x10) & 0xFF, particleDataEntry[i].upper & 0xFFFF,
(particleDataEntry[i].lower >> 0x10) & 0xFFFF, particleDataEntry[i].lower & 0xFFFF);
(particleDataEntry[i].upper >> 0x10) & 0xFF, particleDataEntry[i].upper & 0xFFFF,
(particleDataEntry[i].lower >> 0x10) & 0xFFFF, particleDataEntry[i].lower & 0xFFFF);
}
}
return ((obj->segment.header->particleCount * sizeof(ParticleEmitter)) + 3) & ~3;
@@ -3347,7 +3347,8 @@ void func_80012F94(Object *obj) {
void render_object_parts(Object *obj) {
func_80012F94(obj);
if (obj->segment.trans.flags & OBJ_FLAGS_PARTICLE) {
render_particle((Particle *) obj, &gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList, PARTICLE_F40_8000);
render_particle((Particle *) obj, &gObjectCurrDisplayList, &gObjectCurrMatrix, &gObjectCurrVertexList,
PARTICLE_UNK_FLAG_8000);
} else {
if (obj->segment.header->modelType == OBJECT_MODEL_TYPE_3D_MODEL) {
render_3d_model(obj);
@@ -3393,7 +3394,7 @@ void render_bubble_trap(ObjectTransform *trans, Object_68 *gfxData, Object *obj,
z = cameraSegment->trans.z_position - obj->segment.trans.z_position;
dist = sqrtf((x * x) + (y * y) + (z * z));
if (dist > 0.0) {
dist = obj->segment.unk1A / dist;
dist = obj->segment.numActiveEmitters / dist;
x *= dist;
y *= dist;
z *= dist;
@@ -4353,8 +4354,7 @@ Object *find_taj_object(void) {
Object *current_obj;
for (i = gObjectListStart; i < gObjectCount; i++) {
current_obj = gObjPtrList[i];
if (!(current_obj->segment.trans.flags & OBJ_FLAGS_PARTICLE) &&
(current_obj->behaviorId == BHV_PARK_WARDEN)) {
if (!(current_obj->segment.trans.flags & OBJ_FLAGS_PARTICLE) && (current_obj->behaviorId == BHV_PARK_WARDEN)) {
return current_obj;
}
}
+385 -353
View File
File diff suppressed because it is too large Load Diff
+79 -92
View File
@@ -43,20 +43,20 @@ enum ParticleRandomizationFlags {
PARTICLE_RANDOM_SOURCE_DISTANCE = (1 << 0),
PARTICLE_RANDOM_SOURCE_YAW = (1 << 1),
PARTICLE_RANDOM_SOURCE_PITCH = (1 << 2),
PARTICLE_UNK00000008 = (1 << 3),
PARTICLE_UNK00000010 = (1 << 4),
PARTICLE_UNK00000020 = (1 << 5),
PARTICLE_UNK00000040 = (1 << 6),
PARTICLE_UNK00000080 = (1 << 7),
PARTICLE_RANDOM_SOURCE_ROLL = (1 << 3), // Unused
PARTICLE_RANDOM_EMISSION_SPEED = (1 << 4),
PARTICLE_RANDOM_EMISSION_DIR_YAW = (1 << 5),
PARTICLE_RANDOM_EMISSION_DIR_PITCH = (1 << 6),
PARTICLE_RANDOM_EMISSION_DIR_ROLL = (1 << 7), // Unused
PARTICLE_RANDOM_VELOCITY_X = (1 << 8),
PARTICLE_RANDOM_VELOCITY_Y = (1 << 9),
PARTICLE_RANDOM_VELOCITY_Z = (1 << 10),
PARTICLE_ANGLE_Y = (1 << 11),
PARTICLE_ANGLE_X = (1 << 12),
PARTICLE_ANGLE_Z = (1 << 13),
PARTICLE_ANGLEVEL_Y = (1 << 14),
PARTICLE_ANGLEVEL_X = (1 << 15),
PARTICLE_ANGLEVEL_Z = (1 << 16),
PARTICLE_RANDOM_YAW = (1 << 11),
PARTICLE_RANDOM_PITCH = (1 << 12),
PARTICLE_RANDOM_ROLL = (1 << 13),
PARTCILE_RANDOM_YAW_VELOCITY = (1 << 14),
PARTCILE_RANDOM_PITCH_VELOCITY = (1 << 15),
PARTCILE_RANDOM_ROLL_VELOCITY = (1 << 16),
PARTICLE_RANDOM_SCALE = (1 << 17),
PARTICLE_RANDOM_SCALE_VELOCITY = (1 << 18),
PARTICLE_RANDOM_MOVEMENT_PARAM = (1 << 19),
@@ -64,14 +64,6 @@ enum ParticleRandomizationFlags {
PARTICLE_RANDOM_COLOUR_GREEN = (1 << 21),
PARTICLE_RANDOM_COLOUR_BLUE = (1 << 22),
PARTICLE_RANDOM_COLOUR_ALPHA = (1 << 23),
PARTICLE_UNK01000000 = (1 << 24),
PARTICLE_UNK02000000 = (1 << 25),
PARTICLE_UNK04000000 = (1 << 26),
PARTICLE_UNK08000000 = (1 << 27),
PARTICLE_UNK10000000 = (1 << 28),
PARTICLE_UNK20000000 = (1 << 29),
PARTICLE_UNK40000000 = (1 << 30),
PARTICLE_UNK80000000 = (1 << 31),
};
enum ParticleBehaviorFlags {
@@ -79,7 +71,7 @@ enum ParticleBehaviorFlags {
PARTICLE_SOURCE_OFFSET_ENABLED = 0x1,
PARTICLE_SOURCE_ROTATION_ENABLED = 0x2,
PARTICLE_SOURCE_EMITS_WITH_VELOCITY = 0x4,
PARTICLE_BEHAVIOR_FLAG_8 = 0x8,
PARTICLE_ROTATING_DIRECTION = 0x8,
PARTICLE_VELOCITY_RELATIVE_TO_PARENT = 0x10,
PARTICLE_VELOCITY_ABSOLUTE = 0x20,
PARTICLE_VELOCITY_SCALED_FROM_PARENT = 0x40,
@@ -98,49 +90,46 @@ enum ParticleMovement {
PARTICLE_MOVEMENT_NONE,
PARTICLE_MOVEMENT_BASIC,
PARTICLE_MOVEMENT_ACCELERATION,
PARTICLE_MOVEMENT_VELOCITY_PARENT,
PARTICLE_MOVEMENT_ATTACHED_TO_PARENT,
PARTICLE_MOVEMENT_BASIC_PARENT,
PARTICLE_MOVEMENT_FORWARD,
};
enum ParticleField40 {
PARTICLE_F40_1 = 0x1,
PARTICLE_F40_2 = 0x2,
PARTICLE_F40_4 = 0x4,
PARTICLE_F40_8 = 0x8,
PARTICLE_TEXTURE_ANIM_FORWARD_ENABLED = 0x1,
PARTICLE_TEXTURE_ANIM_BACKWARD_ENABLED = 0x2,
PARTICLE_TEXTURE_ANIM_LOOP = 0x4,
PARTICLE_CURRENT_ANIMATION_BACKWARD = 0x8,
PARTICLE_F40_GRAVITY_1 = 0x10,
PARTICLE_F40_GRAVITY_2 = 0x20,
PARTICLE_F40_GRAVITY_3 = 0x40,
PARTICLE_F40_80 = 0x80,
PARTICLE_F40_100 = 0x100,
PARTICLE_F40_200 = 0x200,
PARTICLE_F40_400 = 0x400,
PARTICLE_F40_800 = 0x800,
PARTICLE_F40_1000 = 0x1000,
PARTICLE_F40_2000 = 0x2000,
PARTICLE_F40_4000 = 0x4000,
PARTICLE_F40_8000 = 0x8000,
PARTICLE_UNK_FLAG_8000 = 0x8000,
};
typedef struct ParticleDescriptor {
/* 0x00 */ u8 kind; // ParticleKind
/* 0x01 */ u8 movementType; // ParticleMovement
/* 0x02 */ u16 unk2;
/* 0x04 */ s16 textureID;
/* 0x06 */ s16 unk6;
/* 0x08 */ s16 lifeTime;
union {
/* 0x0A */ s16 lifeTimeRange;
struct {
/* 0x0A */ u16 unkA : 6;
/* 0x0A */ u16 unkB : 6;
/* 0x00 */ u8 kind; // ParticleKind
/* 0x01 */ u8 movementType; // ParticleMovement
/* 0x02 */ u16 unk2;
/* 0x04 */ s16 textureID;
/* 0x06 */ s16 textureFrameStep;
/* 0x08 */ s16 lifeTime;
union {
/* 0x0A */ s16 lifeTimeRange; // Used by general particle
struct {
/* 0x0A */ u16 unkA : 6; // Used by line particle
/* 0x0A */ u16 unkB : 6; // Used by line particle
};
/* 0x0A */ u16 qwe : 6; // Used by point particle
};
};
/* 0x0C */ u8 opacity;
/* 0x0D */ u8 opacityVel;
/* 0x0E */ s16 opacityTimer;
/* 0x10 */ f32 scale;
/* 0x14 */ ColourRGBA colour;
/* 0x0C */ u8 opacity;
/* 0x0D */ u8 opacityVel;
/* 0x0E */ s16 opacityTimer;
/* 0x10 */ f32 scale;
/* 0x14 */ ColourRGBA colour;
} ParticleDescriptor;
typedef struct XYStruct {
@@ -165,42 +154,33 @@ typedef struct ParticleBehavior {
/* 0x00 */ s32 flags;
/* 0x04 */ Vec3f emitterPos;
/* 0x10 */ f32 sourceDistance;
/* 0x14 */ Vec3s unk14;
/* 0x1A */ s16 unk1A;
/* 0x1C */ Vec2s unk1C;
s16 unk20;
s16 unk22;
s16 unk24;
s16 unk26;
s16 unk28;
s16 unk2A;
s16 unk2C;
s16 unk2E;
/* 0x14 */ Vec3s sourceRotation;
/* 0x1A */ s16 maxParticlesFromSamePos;
/* 0x1C */ Vec3s sourceAngularVelocity;
/* 0x22 */ Vec3s emissionDirection;
/* 0x28 */ s16 maxParticlesInSameDir;
/* 0x22 */ Vec3s emissionDirAngularVelocity;
/* 0x30 */ Vec3f velocityModifier; // The meaning of the modifier depends on the flags
/* 0x3C */ f32 emissionSpeed;
/* 0x40 */ s16 unk40;
/* 0x42 */ s16 unk42;
/* 0x40 */ s16 spawnInterval;
/* 0x42 */ s16 burstCount;
/* 0x44 */ Vec3s rotation;
/* 0x4A */ Vec3s angularVelocity;
f32 scale;
f32 scaleVelocity;
f32 movementParam;
s32 randomizationFlags;
s32 sourceDistanceRange;
/* 0x50 */ f32 scale;
/* 0x54 */ f32 scaleVelocity;
/* 0x58 */ f32 movementParam;
// The following parameters are used to randomize the initial particle properties
/* 0x5C */ s32 randomizationFlags;
/* 0x60 */ s32 sourceDistanceRange;
/* 0x64 */ Vec3s sourceDirRange;
s16 angleRangeY2;
s16 angleRangeX2;
s16 angleRangeZ2;
s32 emissionSpeedRange;
Vec3i velocityModifierRange;
s16 angleRangeY3;
s16 angleRangeX3;
s16 angleRangeZ3;
s16 unk86;
s16 unk88;
s16 unk8A;
s32 unk8C; // Something to do with scale
s32 unk90; // Something to do with scale
/* 0x6A */ Vec3s emissionDirRange;
/* 0x70 */ s32 emissionSpeedRange;
/* 0x74 */ Vec3i velocityModifierRange;
/* 0x80 */ Vec3s rotationRange;
/* 0x86 */ Vec3s angularVelocityRange;
/* 0x8C */ s32 scaleRange;
/* 0x90 */ s32 scaleVelocityRange;
s32 movementParamRange;
u8 colourRangeR;
u8 colourRangeG;
@@ -222,15 +202,22 @@ typedef struct ParticleEmitter {
/* 0x00 */ ParticleBehavior *behaviour;
/* 0x04 */ s16 flags;
union {
/* 0x06 */ u8 general_unk6; // Used by general particles
/* 0x06 */ u8 sourceRotationCounter; // Used by general particles
/* 0x06 */ u8 line_unk6; // Used by line particles
/* 0x06 */ u8 pointsNumber; // Used by point particles
/* 0x06 */ u8 pointCount; // Used by point particles
};
/* 0x07 */ u8 lifeTime;
/* 0x08 */ s16 descriptorID;
/* 0x0A */ s16 opacity;
union {
/* 0x000C */ Vec3f lineAnchor; // Valid for line particle
/* 0x07 */ u8 emissionDirRotationCounter; // Used by general particles
/* 0x07 */ u8 maxPointCount; // Used by point particles
};
/* 0x08 */ s16 descriptorID;
union {
/* 0x0A */ s16 line_opacity;
/* 0x0A */ s16 point_opacity;
/* 0x0A */ s16 timeFromLastSpawn; // Used by general particles
};
union {
/* 0x000C */ Vec3f lineAnchor; // Used for line particle
/* 0x000C */ unk800AF29C_C_400 unkC_400;
/* 0x000C */ ParticleAngle angle;
};
@@ -249,7 +236,7 @@ typedef struct ParticleModel {
typedef struct Particle {
/* 0x0000 */ ObjectTransform trans;
/* 0x0018 */ s16 textureFrame;
/* 0x001A */ s16 unk1A;
/* 0x001A */ s16 textureFrameStep;
/* 0x001C */ Vec3f velocity;
/* 0x0028 */ f32 scaleVelocity;
/* 0x002C */ s16 kind;
@@ -260,7 +247,7 @@ typedef struct Particle {
/* 0x0039 */ u8 movementType;
/* 0x003A */ s16 destroyTimer;
/* 0x003C */ Object *parentObj;
/* 0x0040 */ s32 unk40;
/* 0x0040 */ s32 miscFlags;
union {
/* 0x0044 */ ParticleModel *model;
/* 0x0044 */ Sprite *sprite; // Unclear whether this is the same as unk80068514_arg4
@@ -294,7 +281,7 @@ typedef struct Particle {
typedef struct PointParticle {
/* 0x0000 */ Particle base;
/* 0x0070 */ ParticleEmitter *pointEmitter;
/* 0x0074 */ u8 unk74;
/* 0x0074 */ u8 pointIndex;
/* 0x0075 */ u8 modelFrame;
/* 0x0076 */ u8 unk76;
/* 0x0077 */ s8 unk77;
@@ -312,13 +299,13 @@ void generate_particle_shape_line(ParticleModel *model, Vertex **vtx, Triangle *
void generate_particle_shape_point(ParticleModel *model, Vertex **vtx, Triangle **triangles);
void func_800AF0A4(Particle *particle);
void func_800AF0F0(Particle *particle);
void emitter_init(ParticleEmitter *emitter, s32 behaviourID, s32 propertyID);
void emitter_init_with_pos(ParticleEmitter *emitter, s32 behaviourID, s32 propertyID, s16 posX, s16 posY, s16 posZ);
void emitter_init(ParticleEmitter *emitter, s32 behaviourID, s32 particleID);
void emitter_init_with_pos(ParticleEmitter *emitter, s32 behaviourID, s32 particleID, s16 posX, s16 posY, s16 posZ);
void func_800AF6E4(Object *obj, s32 emitterIndex);
void emitter_cleanup(ParticleEmitter *emitter);
void func_800B263C(PointParticle *arg0);
void init_particle_assets(void);
void set_particle_texture_frame(Particle *particle);
void update_particle_texture_frame(Particle *particle);
void setup_particle_position(Particle *particle, Object *obj, ParticleEmitter *emitter, ParticleBehavior *behaviour);
void particle_deallocate(Particle *particle);
void particle_update(Particle *particle, s32 updateRate);
@@ -328,7 +315,7 @@ Particle *particle_allocate(s32 kind);
void func_800AFE5C(Object *obj, ParticleEmitter *emitter);
Particle *init_general_particle(Object *obj, ParticleEmitter *emitter);
void func_800AF52C(Object *obj, s32 emitterIndex);
void emitter_change_settings(ParticleEmitter *emitter, s32 behaviourID, s32 propertyID, s16 posX, s16 posY, s16 posZ);
void emitter_change_settings(ParticleEmitter *emitter, s32 behaviourID, s32 particleID, s16 posX, s16 posY, s16 posZ);
void render_particle(Particle *particle, Gfx **dList, MatrixS **mtx, Vertex **vtx, s32 flags);
void func_800B4668(Object *obj, s32 idx, s32 arg2, s32 arg3);
void func_800B46BC(Object *obj, s32 idx, s32 arg2, s32 arg3);
@@ -342,7 +329,7 @@ void func_800AF404(s32 updateRate); // Non Matching
void init_particle_buffers(s32 maxTriangleParticles, s32 maxRectangleParticles, s32 maxSpriteParticles,
s32 maxLineParticles, s32 maxPointParticles, s32 arg5); // Non Matching
void move_particle_basic_parent(Particle *);
void move_particle_velocity_parent(Particle *);
void move_particle_attached_to_parent(Particle *);
void move_particle_with_acceleration(Particle *);
void move_particle_basic(Particle *);
void move_particle_forward(Particle *);
+2 -2
View File
@@ -1656,9 +1656,9 @@ emitter_cleanup = 0x800B2860;
particle_update = 0x800B28FC;
func_800B263C = 0x800B2C3C;
update_line_particle = 0x800B2CE0;
set_particle_texture_frame = 0x800B35BC;
update_particle_texture_frame = 0x800B35BC;
move_particle_basic_parent = 0x800B3740;
move_particle_velocity_parent = 0x800B3840;
move_particle_attached_to_parent = 0x800B3840;
move_particle_with_acceleration = 0x800B3958;
move_particle_basic = 0x800B3AB0;
move_particle_forward = 0x800B3B64;
+2 -2
View File
@@ -1645,9 +1645,9 @@ emitter_cleanup = 0x800B22F0;
particle_update = 0x800B238C;
func_800B263C = 0x800B26CC;
update_line_particle = 0x800B2770;
set_particle_texture_frame = 0x800B304C;
update_particle_texture_frame = 0x800B304C;
move_particle_basic_parent = 0x800B31D0;
move_particle_velocity_parent = 0x800B32D0;
move_particle_attached_to_parent = 0x800B32D0;
move_particle_with_acceleration = 0x800B33E8;
move_particle_basic = 0x800B3540;
move_particle_forward = 0x800B35F4;
+2 -2
View File
@@ -1566,9 +1566,9 @@ emitter_cleanup = 0x800B2850;
particle_update = 0x800B28EC;
func_800B263C = 0x800B2C2C;
update_line_particle = 0x800B2CD0;
set_particle_texture_frame = 0x800B35AC;
update_particle_texture_frame = 0x800B35AC;
move_particle_basic_parent = 0x800B3730;
move_particle_velocity_parent = 0x800B3830;
move_particle_attached_to_parent = 0x800B3830;
move_particle_with_acceleration = 0x800B3948;
move_particle_basic = 0x800B3AA0;
move_particle_forward = 0x800B3B54;
+2 -2
View File
@@ -1651,9 +1651,9 @@ emitter_cleanup = 0x800B2260;
particle_update = 0x800B22FC;
func_800B263C = 0x800B263C;
update_line_particle = 0x800B26E0;
set_particle_texture_frame = 0x800B2FBC;
update_particle_texture_frame = 0x800B2FBC;
move_particle_basic_parent = 0x800B3140;
move_particle_velocity_parent = 0x800B3240;
move_particle_attached_to_parent = 0x800B3240;
move_particle_with_acceleration = 0x800B3358;
move_particle_basic = 0x800B34B0;
move_particle_forward = 0x800B3564;
+2 -2
View File
@@ -1565,9 +1565,9 @@ emitter_cleanup = 0x800B27C0;
particle_update = 0x800B285C;
func_800B263C = 0x800B2B9C;
update_line_particle = 0x800B2C40;
set_particle_texture_frame = 0x800B351C;
update_particle_texture_frame = 0x800B351C;
move_particle_basic_parent = 0x800B36A0;
move_particle_velocity_parent = 0x800B37A0;
move_particle_attached_to_parent = 0x800B37A0;
move_particle_with_acceleration = 0x800B38B8;
move_particle_basic = 0x800B3A10;
move_particle_forward = 0x800B3AC4;