Documented ch Chompa

This commit is contained in:
Owlenuff
2024-09-30 22:25:10 +02:00
parent 1bfcd8ace5
commit da234765d7
9 changed files with 172 additions and 152 deletions

View File

@@ -140,7 +140,7 @@ void chGobiCCW_update(Actor *this) {
this->has_met_before = FALSE; this->has_met_before = FALSE;
local->unk4 = skeletalAnim_new(); local->unk4 = skeletalAnim_new();
local->spit_model = assetcache_get(ASSET_3F3_MODEL_GOBI_SPIT); local->spit_model = assetcache_get(ASSET_3F3_MODEL_GOBI_SPIT);
marker_setCollisionScripts(this->marker, 0, func_8038894C, 0); marker_setCollisionScripts(this->marker, NULL, func_8038894C, NULL);
if(!jiggyscore_isSpawned(JIGGY_4D_CCW_FLOWER)) { if(!jiggyscore_isSpawned(JIGGY_4D_CCW_FLOWER)) {
fileProgressFlag_set(FILEPROG_E5_CCW_FLOWER_AUTUMN, FALSE); fileProgressFlag_set(FILEPROG_E5_CCW_FLOWER_AUTUMN, FALSE);
} }

View File

@@ -90,7 +90,7 @@ void func_80388FD4(Actor *this) {
subaddie_set_state_with_direction(this, 4, 0.999f, 1); subaddie_set_state_with_direction(this, 4, 0.999f, 1);
actor_collisionOff(this); actor_collisionOff(this);
} else { } else {
marker_setCollisionScripts(this->marker, 0, &func_80388F50, 0); marker_setCollisionScripts(this->marker, NULL, &func_80388F50, NULL);
} }
this->unk38_0 = FALSE; this->unk38_0 = FALSE;
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;

View File

@@ -105,7 +105,7 @@ void func_8038D85C(Actor *this) {
if (!this->volatile_initialized) { if (!this->volatile_initialized) {
this->marker->propPtr->unk8_3 = TRUE; this->marker->propPtr->unk8_3 = TRUE;
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;
marker_setCollisionScripts(this->marker, 0, &func_8038D81C, 0); marker_setCollisionScripts(this->marker, NULL, &func_8038D81C, NULL);
func_8038D6D8(this, 1); func_8038D6D8(this, 1);
if (jiggyscore_isCollected(JIGGY_4B_CCW_GNAWTY) != 0) { if (jiggyscore_isCollected(JIGGY_4B_CCW_GNAWTY) != 0) {
levelSpecificFlags_set(0x25, 1); levelSpecificFlags_set(0x25, 1);

View File

@@ -2,91 +2,109 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern void func_80389484(ActorMarker *, f32); /* extern functions */
extern void chPortrait_break(ActorMarker *, f32);
typedef struct { typedef struct {
f32 unk0; f32 timer;
}ActorLocal_PortraitChompa; } ActorLocal_PortraitChompa;
void func_80388028(Actor *this); /* public functions */
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void chChompa_update(Actor *this);
Actor *chChompa_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
/* .data */ /* .data */
ActorInfo D_8038BAD0 = { enum chChompa_state_e {
MARKER_254_PORTRAIT_CHOMPA_A, ACTOR_381_PORTRAIT_CHOMPA, ASSET_521_MODEL_PORTRAIT_CHOMPA, CHOMPA_STATE_0_INIT,
CHOMPA_STATE_1_IDLE,
CHOMPA_STATE_2_GROWLING,
CHOMPA_STATE_3_WAITING_TO_BITE,
CHOMPA_STATE_4_BITING,
CHOMPA_STATE_5_DYING,
CHOMPA_STATE_6_DEAD
};
ActorInfo D_8038BAD0 = {
MARKER_254_PORTRAIT_CHOMPA_A, ACTOR_381_PORTRAIT_CHOMPA, ASSET_521_MODEL_PORTRAIT_CHOMPA,
0x0, NULL, 0x0, NULL,
func_80388028, NULL, func_80387AA0, chChompa_update, NULL, chChompa_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
/* .code */ /* .code */
Actor *func_80387AA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *chChompa_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
Actor* actor = marker_getActor(marker); Actor *actor = marker_getActor(marker);
if ((actor->state == 0) || (actor->state == 1) || (actor->state == 6) || (actor->state == 2)) {
if (actor->state == CHOMPA_STATE_0_INIT || actor->state == CHOMPA_STATE_1_IDLE || actor->state == CHOMPA_STATE_6_DEAD || actor->state == CHOMPA_STATE_2_GROWLING) {
return actor; return actor;
} }
return actor_draw(marker, gfx, mtx, vtx); return actor_draw(marker, gfx, mtx, vtx);
} }
void func_80387B14(Actor *this, s32 next_state){ void chChompa_setState(Actor *this, s32 next_state) {
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local; ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 tmp = 2.5f; f32 tmp = 2.5f;
this->marker->id = 0x1d1; this->marker->id = 0x1d1;
if(next_state == 1 || next_state == 2){ if (next_state == CHOMPA_STATE_1_IDLE || next_state == CHOMPA_STATE_2_GROWLING) {
skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f); skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f);
skeletalAnim_setProgress(this->unk148, 0.99f); skeletalAnim_setProgress(this->unk148, 0.99f);
skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_4_STOPPED); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_4_STOPPED);
if(this->state == 4){
local->unk0 = randf2(0.5f, 1.0f); if (this->state == CHOMPA_STATE_4_BITING) {
local->timer = randf2(0.5f, 1.0f);
} }
else{ else {
local->unk0 = 0.0f; local->timer = 0.0f;
} }
}//L80387BD0 }//L80387BD0
if(this->state == 1 && next_state == 2){ if (this->state == CHOMPA_STATE_1_IDLE && next_state == CHOMPA_STATE_2_GROWLING) {
FUNC_8030E624(SFX_3EF, 0.9f, 32675); FUNC_8030E624(SFX_3EF, 0.9f, 32675);
} }
if(next_state == 3){ if (next_state == CHOMPA_STATE_3_WAITING_TO_BITE) {
local->unk0 = 0.2f; local->timer = 0.2f;
} }
if(next_state == 4){ if (next_state == CHOMPA_STATE_4_BITING) {
this->marker->id = MARKER_254_PORTRAIT_CHOMPA_A; this->marker->id = MARKER_254_PORTRAIT_CHOMPA_A;
skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f); skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f);
skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE);
if(this->unk100){
func_80389484(this->unk100, tmp + 0.55); if (this->unk100) {
chPortrait_break(this->unk100, tmp + 0.55);
} }
FUNC_8030E624(SFX_3EF, 1.1f, 25000); FUNC_8030E624(SFX_3EF, 1.1f, 25000);
FUNC_8030E624(SFX_3EF, 1.1f, 25000); FUNC_8030E624(SFX_3EF, 1.1f, 25000);
}//L80387CAC }//L80387CAC
if(next_state == 5){ if (next_state == CHOMPA_STATE_5_DYING) {
func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2); func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2);
actor_collisionOff(this); actor_collisionOff(this);
} }
this->state = next_state; this->state = next_state;
} }
void MMM_func_80387CF4(ActorMarker *this_marker, ActorMarker *other_marker) { void __chChompa_hit(ActorMarker *this_marker, ActorMarker *other_marker) {
func_8030E6D4(0x1E); func_8030E6D4(SFX_1E_HITTING_AN_ENEMY_2);
} }
void func_80387D1C(ActorMarker* this_marker, ActorMarker *other_marker) { void __chChompa_die(ActorMarker *this_marker, ActorMarker *other_marker) {
Actor *this = marker_getActor(this_marker); Actor *this = marker_getActor(this_marker);
func_80387B14(this, 5); chChompa_setState(this, CHOMPA_STATE_5_DYING);
} }
void func_80387D48(ActorMarker *marker){ void __chChompa_spwanPortrait(ActorMarker *marker) {
Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker));
enum asset_e portrait_id; enum asset_e portrait_id;
Actor *portrait; Actor *portrait;
switch(this->unkF4_8){ switch (this->unkF4_8) {
case 0x32: case 0x32:
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY; portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break; break;
@@ -109,13 +127,14 @@ void func_80387D48(ActorMarker *marker){
portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY; portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY;
break; break;
} }
portrait = spawn_child_actor(portrait_id, &this); portrait = spawn_child_actor(portrait_id, &this);
portrait->yaw = this->yaw; portrait->yaw = this->yaw;
this->unk100 = portrait->marker; this->unk100 = portrait->marker;
portrait->unk10_1 = FALSE; portrait->unk10_1 = FALSE;
} }
void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) { void __chChompa_emitDust(f32 position[3], s32 count, enum asset_e sprite_id) {
static s32 D_8038BAF4[3] = {0xB4, 0xFF, 0x8C}; static s32 D_8038BAF4[3] = {0xB4, 0xFF, 0x8C};
static ParticleScaleAndLifetimeRanges D_8038BB00 = {{0.2f, 0.4f}, {1.8f, 2.8f}, {0.0f, 0.15f}, {0.7f, 1.2f}, 0.0f, 0.01f}; static ParticleScaleAndLifetimeRanges D_8038BB00 = {{0.2f, 0.4f}, {1.8f, 2.8f}, {0.0f, 0.15f}, {0.7f, 1.2f}, 0.0f, 0.01f};
static struct43s D_8038BB28 = { static struct43s D_8038BB28 = {
@@ -123,9 +142,8 @@ void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
{{ 0.0f, -600.0f, 0.0f}, { 0.0f, -600.0f, 0.0f}}, {{ 0.0f, -600.0f, 0.0f}, { 0.0f, -600.0f, 0.0f}},
{{ -50.0f, -50.0f, -50.0f}, { 50.0f, 50.0f, 50.0f}} {{ -50.0f, -50.0f, -50.0f}, { 50.0f, 50.0f, 50.0f}}
}; };
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count); ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setRGB(pCtrl, D_8038BAF4); particleEmitter_setRGB(pCtrl, D_8038BAF4);
particleEmitter_setSprite(pCtrl, sprite_id); particleEmitter_setSprite(pCtrl, sprite_id);
particleEmitter_setPosition(pCtrl, position); particleEmitter_setPosition(pCtrl, position);
@@ -134,16 +152,15 @@ void func_80387DF8(f32 position[3], s32 count, enum asset_e sprite_id) {
particleEmitter_emitN(pCtrl, count); particleEmitter_emitN(pCtrl, count);
} }
void func_80387E84(f32 position[3], s32 count, enum asset_e model_id) { void __chChompa_emitBones(f32 position[3], s32 count, enum asset_e model_id) {
static ParticleScaleAndLifetimeRanges D_8038BB70 = {{1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, {3.2f, 3.2f}, 0.0f, 0.45f}; static ParticleScaleAndLifetimeRanges D_8038BB70 = {{1.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 0.0f}, {3.2f, 3.2f}, 0.0f, 0.45f};
static struct43s D_8038BB98 = { static struct43s D_8038BB98 = {
{{-90.0f, 300.0f, -90.0f}, {90.0f, 660.0f, 90.0f}}, {{-90.0f, 300.0f, -90.0f}, {90.0f, 660.0f, 90.0f}},
{{ 0.0f, -1200.0f, 0.0f}, { 0.0f, -1200.0f, 0.0f}}, {{0.0f, -1200.0f, 0.0f}, {0.0f, -1200.0f, 0.0f}},
{{-50.0f, 0.0f, -50.0f}, {50.0f, 50.0f, 50.0f}} {{-50.0f, 0.0f, -50.0f}, {50.0f, 50.0f, 50.0f}}
}; };
ParticleEmitter *pCtrl;
pCtrl = partEmitMgr_newEmitter(count); ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count);
particleEmitter_setModel(pCtrl, model_id); particleEmitter_setModel(pCtrl, model_id);
particleEmitter_setPosition(pCtrl, position); particleEmitter_setPosition(pCtrl, position);
particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8038BB98); particleEmitter_setPositionVelocityAndAccelerationRanges(pCtrl, &D_8038BB98);
@@ -157,97 +174,103 @@ void func_80387E84(f32 position[3], s32 count, enum asset_e model_id) {
particleEmitter_emitN(pCtrl, count); particleEmitter_emitN(pCtrl, count);
} }
void func_80387F7C(Actor *this){ void __chChompa_emitDeathEffects(Actor *this) {
f32 sp2C[3]; f32 sp2C[3];
f32 sp20[3]; f32 sp20[3];
if(!this->marker->unk14_21) return; if (!this->marker->unk14_21) {
return;
}
func_8034A174(this->marker->unk44, 5, sp2C); func_8034A174(this->marker->unk44, 5, sp2C);
func_8034A174(this->marker->unk44, 6, sp20); func_8034A174(this->marker->unk44, 6, sp20);
func_80387E84(sp2C, 1, ASSET_523_MODEL_PORTRAIT_CHOMPA_TEETH);
func_80387E84(sp2C, 1, ASSET_524_MODEL_PORTRAIT_CHOMPA_HEAD); __chChompa_emitBones(sp2C, 1, ASSET_523_MODEL_PORTRAIT_CHOMPA_TEETH);
func_80387E84(sp20, 6, ASSET_525_MODEL_PORTRAIT_CHOMPA_PART); __chChompa_emitBones(sp2C, 1, ASSET_524_MODEL_PORTRAIT_CHOMPA_HEAD);
func_80387DF8(sp2C, 2, ASSET_700_SPRITE_DUST); __chChompa_emitBones(sp20, 6, ASSET_525_MODEL_PORTRAIT_CHOMPA_PART);
func_80387DF8(sp20, 2, ASSET_700_SPRITE_DUST);
__chChompa_emitDust(sp2C, 2, ASSET_700_SPRITE_DUST);
__chChompa_emitDust(sp20, 2, ASSET_700_SPRITE_DUST);
} }
void func_80388028(Actor *this){ void chChompa_update(Actor *this) {
ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local; ActorLocal_PortraitChompa *local = (ActorLocal_PortraitChompa *) &this->local;
f32 sp58 = time_getDelta(); f32 tick = time_getDelta();
f32 plyr_position[3]; f32 plyr_position[3];
f32 plyr_dist; f32 plyr_dist;
f32 sp44; f32 anim_prev_progress;
f32 sp40; f32 anim_progress;
if(!this->volatile_initialized){ if (!this->volatile_initialized) {
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;
this->unk16C_0 = TRUE; this->unk16C_0 = TRUE;
marker_setCollisionScripts(this->marker, NULL, MMM_func_80387CF4, func_80387D1C); marker_setCollisionScripts(this->marker, NULL, __chChompa_hit, __chChompa_die);
__spawnQueue_add_1((GenFunction_1)func_80387D48, reinterpret_cast(s32, this->marker)); __spawnQueue_add_1((GenFunction_1) __chChompa_spwanPortrait, reinterpret_cast(s32, this->marker));
func_80387B14(this, (this->state < 5) ? 1 : 6); chChompa_setState(this, this->state < CHOMPA_STATE_5_DYING ? CHOMPA_STATE_1_IDLE : CHOMPA_STATE_6_DEAD);
}//L803880B4 }//L803880B4
player_getPosition(plyr_position); player_getPosition(plyr_position);
plyr_dist = ml_distance_vec3f(this->position, plyr_position); plyr_dist = ml_distance_vec3f(this->position, plyr_position);
if(this->state == 4) if (this->state == CHOMPA_STATE_4_BITING) {
actor_collisionOn(this); actor_collisionOn(this);
else }
else {
actor_collisionOff(this); actor_collisionOff(this);
if(this->state == 1 && plyr_dist < this->scale*400.0f){
func_80387B14(this, 2);
} }
if(this->state == 2){ if (this->state == CHOMPA_STATE_1_IDLE && plyr_dist < this->scale * 400.0f) {
if(0.0f < local->unk0){ chChompa_setState(this, CHOMPA_STATE_2_GROWLING);
local->unk0 -= sp58; }
if (this->state == CHOMPA_STATE_2_GROWLING) {
if (0.0f < local->timer) {
local->timer -= tick;
} }
else if(plyr_dist < this->scale*300.0f){ else if (plyr_dist < this->scale * 300.0f) {
func_80387B14(this, 3); chChompa_setState(this, CHOMPA_STATE_3_WAITING_TO_BITE);
} }
else if(this->scale*500.0f < plyr_dist){ else if (this->scale * 500.0f < plyr_dist) {
func_80387B14(this, 1); chChompa_setState(this, CHOMPA_STATE_1_IDLE);
} }
}//L80388204 }//L80388204
if(this->state == 3){ if (this->state == CHOMPA_STATE_3_WAITING_TO_BITE) {
if(ml_timer_update(&local->unk0, sp58)){ if (ml_timer_update(&local->timer, tick)) {
func_80387B14(this, 4); chChompa_setState(this, CHOMPA_STATE_4_BITING);
} }
} }
if(this->state == 4){ if (this->state == CHOMPA_STATE_4_BITING) {
skeletalAnim_getProgressRange(this->unk148, &sp44, &sp40); skeletalAnim_getProgressRange(this->unk148, &anim_prev_progress, &anim_progress);
if(sp44 < 0.56 && 0.56 <= sp40){
if (anim_prev_progress < 0.56 && 0.56 <= anim_progress) {
this->marker->id = 0x1d1; this->marker->id = 0x1d1;
} }
if(sp44 < 0.5 && 0.5 <= sp40){ if (anim_prev_progress < 0.5 && 0.5 <= anim_progress) {
FUNC_8030E624(SFX_2_CLAW_SWIPE, 0.9f, 32000); FUNC_8030E624(SFX_2_CLAW_SWIPE, 0.9f, 32000);
} }
if( (sp44 < 0.11 && 0.11 <= sp40) if ((anim_prev_progress < 0.11 && 0.11 <= anim_progress) ||
|| (sp44 < 0.32 && 0.32 <= sp40) (anim_prev_progress < 0.32 && 0.32 <= anim_progress) ||
|| (sp44 < 0.53 && 0.53 <= sp40) (anim_prev_progress < 0.53 && 0.53 <= anim_progress)
){ ) {
func_8030E6A4(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000); func_8030E6A4(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000);
} }
if(sp44 < 0.9 && 0.9 <= sp40){ if (anim_prev_progress < 0.9 && 0.9 <= anim_progress) {
func_8030E6D4(SFX_2_CLAW_SWIPE); func_8030E6D4(SFX_2_CLAW_SWIPE);
} }
if(skeletalAnim_getLoopCount(this->unk148) > 0){
func_80387B14(this, 2); if (skeletalAnim_getLoopCount(this->unk148) > 0) {
chChompa_setState(this, CHOMPA_STATE_2_GROWLING);
} }
} }
if(this->state == 5){ if (this->state == CHOMPA_STATE_5_DYING) {
func_8030E6D4(SFX_D7_GRABBA_DEATH); func_8030E6D4(SFX_D7_GRABBA_DEATH);
func_80387F7C(this); __chChompa_emitDeathEffects(this);
func_80387B14(this, 6); chChompa_setState(this, CHOMPA_STATE_6_DEAD);
} }
} }

View File

@@ -2,11 +2,17 @@
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
Actor *func_80389350(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* public functions */
void func_803893A4(Actor *this); Actor *chPortrait_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chPortrait_update(Actor *this);
/* .data */ /* .data */
ActorAnimationInfo D_8038BE30[] ={ enum chPortrait_state_e {
PORTRAIT_STATE_1_IDLE = 1,
PORTRAIT_STATE_2_BROKEN
};
ActorAnimationInfo D_8038BE30[] = {
{0x000, 0.0f}, {0x000, 0.0f},
{0x23F, 10000000.0f}, {0x23F, 10000000.0f},
{0x23F, 2.0f}, {0x23F, 2.0f},
@@ -14,68 +20,69 @@ ActorAnimationInfo D_8038BE30[] ={
ActorInfo D_8038BE48 = { ActorInfo D_8038BE48 = {
MARKER_255_PORTRAIT_OF_GRUNTY, ACTOR_382_PORTRAIT_OF_GRUNTY, ASSET_522_MODEL_PORTRAIT_OF_GRUNTY, MARKER_255_PORTRAIT_OF_GRUNTY, ACTOR_382_PORTRAIT_OF_GRUNTY, ASSET_522_MODEL_PORTRAIT_OF_GRUNTY,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
ActorInfo D_8038BE6C = { ActorInfo D_8038BE6C = {
MARKER_257_PORTRAIT_OF_BLACKEYE, ACTOR_384_PORTRAIT_OF_BLACKEYE, ASSET_527_MODEL_PORTRAIT_OF_BLACKEYE, MARKER_257_PORTRAIT_OF_BLACKEYE, ACTOR_384_PORTRAIT_OF_BLACKEYE, ASSET_527_MODEL_PORTRAIT_OF_BLACKEYE,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
ActorInfo D_8038BE90 = { ActorInfo D_8038BE90 = {
MARKER_258_PORTRAIT_OF_TOWER, ACTOR_385_PORTRAIT_OF_TOWER, ASSET_528_MODEL_PORTRAIT_OF_TOWER, MARKER_258_PORTRAIT_OF_TOWER, ACTOR_385_PORTRAIT_OF_TOWER, ASSET_528_MODEL_PORTRAIT_OF_TOWER,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
ActorInfo D_8038BEB4 = { ActorInfo D_8038BEB4 = {
MARKER_259_PORTRAIT_OF_TREE_AND_MOON, ACTOR_386_PORTRAIT_OF_TREE_AND_MOON, ASSET_529_MODEL_PORTRAIT_OF_TREE_AND_MOON, MARKER_259_PORTRAIT_OF_TREE_AND_MOON, ACTOR_386_PORTRAIT_OF_TREE_AND_MOON, ASSET_529_MODEL_PORTRAIT_OF_TREE_AND_MOON,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
ActorInfo D_8038BED8 = { ActorInfo D_8038BED8 = {
MARKER_25A_PORTRAIT_OF_TEEHEE, ACTOR_387_PORTRAIT_OF_TEEHEE, ASSET_52A_MODEL_PORTRAIT_OF_TEEHEE, MARKER_25A_PORTRAIT_OF_TEEHEE, ACTOR_387_PORTRAIT_OF_TEEHEE, ASSET_52A_MODEL_PORTRAIT_OF_TEEHEE,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
ActorInfo D_8038BEFC = { ActorInfo D_8038BEFC = {
MARKER_25B_PORTRAIT_OF_MINION, ACTOR_388_PORTRAIT_OF_MINION, ASSET_52B_MODEL_PORTRAIT_OF_MINION, MARKER_25B_PORTRAIT_OF_MINION, ACTOR_388_PORTRAIT_OF_MINION, ASSET_52B_MODEL_PORTRAIT_OF_MINION,
0x1, D_8038BE30, 0x1, D_8038BE30,
func_803893A4, func_80326224, func_80389350, chPortrait_update, func_80326224, chPortrait_draw,
0, 0, 0.0f, 0 0, 0, 0.0f, 0
}; };
/* .code */ /* .code */
Actor *func_80389350(ActorMarker* marker, Gfx** graphics, Mtx** matrix, Vtx** vertex) { Actor *chPortrait_draw(ActorMarker *marker, Gfx **graphics, Mtx **matrix, Vtx **vertex) {
func_8033A45C(3, marker_getActor(marker)->unk38_31); func_8033A45C(3, marker_getActor(marker)->unk38_31);
return actor_draw(marker, graphics, matrix, vertex); return actor_draw(marker, graphics, matrix, vertex);
} }
void func_803893A4(Actor *this){ void chPortrait_update(Actor *this) {
if(!this->volatile_initialized){ if (!this->volatile_initialized) {
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;
this->marker->propPtr->unk8_3 = TRUE; this->marker->propPtr->unk8_3 = TRUE;
actor_collisionOff(this); actor_collisionOff(this);
this->unk38_31 = 2; this->unk38_31 = 2;
} }
switch(this->state){ switch (this->state) {
case 1: case PORTRAIT_STATE_1_IDLE:
animctrl_setAnimTimer(this->animctrl, 0.0f); animctrl_setAnimTimer(this->animctrl, 0.0f);
break; break;
case 2:
if(actor_animationIsAt(this, 0.999f)){ case PORTRAIT_STATE_2_BROKEN:
subaddie_set_state_with_direction(this, 1, 0.001f, 0); if (actor_animationIsAt(this, 0.999f)) {
subaddie_set_state_with_direction(this, PORTRAIT_STATE_1_IDLE, 0.001f, 0);
actor_playAnimationOnce(this); actor_playAnimationOnce(this);
this->unk38_31 = 2; this->unk38_31 = 2;
} }
@@ -83,10 +90,10 @@ void func_803893A4(Actor *this){
} }
} }
void func_80389484(ActorMarker * marker, f32 anim_duration){ void chPortrait_break(ActorMarker *marker, f32 anim_duration) {
Actor *this = marker_getActor(marker); Actor *this = marker_getActor(marker);
subaddie_set_state_with_direction(this, 2, 0.001f, 1); subaddie_set_state_with_direction(this, PORTRAIT_STATE_2_BROKEN, 0.001f, 1);
actor_playAnimationOnce(this); actor_playAnimationOnce(this);
animctrl_setDuration(this->animctrl, anim_duration); animctrl_setDuration(this->animctrl, anim_duration);
this->unk38_31 = 1; this->unk38_31 = 1;

View File

@@ -201,7 +201,7 @@ void func_803878B0(Actor *this){
if(!this->volatile_initialized){ if(!this->volatile_initialized){
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;
this->marker->actorFreeFunc = func_80387890; this->marker->actorFreeFunc = func_80387890;
marker_setCollisionScripts(this->marker, 0, func_80387850, 0); marker_setCollisionScripts(this->marker, NULL, func_80387850, NULL);
func_8032AA58(this, 1.1f); func_8032AA58(this, 1.1f);
func_8038756C(this, 1); func_8038756C(this, 1);
} }

View File

@@ -131,7 +131,7 @@ void SM_func_80386EF4(Actor *this) {
Actor *other; Actor *other;
if ((this->volatile_initialized) <= 0) { if ((this->volatile_initialized) <= 0) {
this->marker->propPtr->unk8_3 = 1; this->marker->propPtr->unk8_3 = 1;
marker_setCollisionScripts(this->marker, 0, 0, func_80386EB4); marker_setCollisionScripts(this->marker, NULL, NULL, func_80386EB4);
this->unk38_31 = 0; this->unk38_31 = 0;
this->unk138_31 = 1; this->unk138_31 = 1;
this->volatile_initialized = TRUE; this->volatile_initialized = TRUE;

View File

@@ -598,16 +598,12 @@ void ml_defrag(void)
//ml_timer_update //ml_timer_update
//decrement a counter and returns True if timer reaches 0 //decrement a counter and returns True if timer reaches 0
bool ml_timer_update(f32 *timer, f32 delta) bool ml_timer_update(f32 *timer, f32 delta) {
{ if (*timer > 0) {
if (*timer > 0)
{
*timer -= delta; *timer -= delta;
if (*timer <= 0) if (*timer <= 0) {
{
*timer = 0; *timer = 0;
return TRUE; return TRUE;
} }
} }

View File

@@ -4,55 +4,49 @@
#define CORE2_C31A0_VEC_COUNT 0x21 #define CORE2_C31A0_VEC_COUNT 0x21
void func_8034A130(struct5Bs *this){ void func_8034A130(struct5Bs *this) {
f32 (*iPtr)[3]; f32(*iPtr)[3];
for(iPtr = this->unk0; iPtr < this->unk4; iPtr++){
for (iPtr = this->unk0; iPtr < this->unk4; iPtr++) {
(*iPtr)[0] = (*iPtr)[1] = (*iPtr)[2] = 0.0f; (*iPtr)[0] = (*iPtr)[1] = (*iPtr)[2] = 0.0f;
} }
} }
void func_8034A174(struct5Bs *this, s32 indx,f32 dst[3]){ void func_8034A174(struct5Bs *this, s32 indx, f32 dst[3]) {
dst[0] = this->unk0[indx][0]; TUPLE_COPY(dst, this->unk0[indx])
dst[1] = this->unk0[indx][1];
dst[2] = this->unk0[indx][2];
} }
void func_8034A1B4(struct5Bs *this, s32 indx, s32 dst[3]){ void func_8034A1B4(struct5Bs *this, s32 indx, s32 dst[3]) {
dst[0] = (s32)this->unk0[indx][0]; TUPLE_COPY(dst, this->unk0[indx])
dst[1] = (s32)this->unk0[indx][1];
dst[2] = (s32)this->unk0[indx][2];
} }
void func_8034A214(struct5Bs *this, s32 indx1, s32 indx2, f32 dst[3]){ void func_8034A214(struct5Bs *this, s32 indx1, s32 indx2, f32 dst[3]) {
dst[0] = this->unk0[indx2][0] - this->unk0[indx1][0]; TUPLE_DIFF_COPY(dst, this->unk0[indx2], this->unk0[indx1])
dst[1] = this->unk0[indx2][1] - this->unk0[indx1][1];
dst[2] = this->unk0[indx2][2] - this->unk0[indx1][2];
ml_vec3f_normalize(dst); ml_vec3f_normalize(dst);
} }
void func_8034A2A8(struct5Bs *this){ void func_8034A2A8(struct5Bs *this) {
free(this); free(this);
} }
struct5Bs *func_8034A2C8(void){ struct5Bs *func_8034A2C8(void) {
struct5Bs *this = (struct5Bs *)malloc(sizeof(struct5Bs) + sizeof(f32[3])*CORE2_C31A0_VEC_COUNT); struct5Bs *this = (struct5Bs *) malloc(sizeof(struct5Bs) + sizeof(f32[3]) * CORE2_C31A0_VEC_COUNT);
this->unk0 = (f32(*)[3])((s32)this + sizeof(struct5Bs)); this->unk0 = (f32(*)[3])((s32) this + sizeof(struct5Bs));
this->unk4 = (f32(*)[3])((s32)this->unk0 + sizeof(f32[3])*CORE2_C31A0_VEC_COUNT); this->unk4 = (f32(*)[3])((s32) this->unk0 + sizeof(f32[3]) * CORE2_C31A0_VEC_COUNT);
func_8034A130(this); func_8034A130(this);
return this; return this;
} }
void func_8034A308(struct5Bs *this, s32 indx, f32 arg2[3]){ void func_8034A308(struct5Bs *this, s32 indx, f32 arg2[3]) {
this->unk0[indx][0] = arg2[0]; TUPLE_COPY(this->unk0[indx], arg2)
this->unk0[indx][1] = arg2[1];
this->unk0[indx][2] = arg2[2];
} }
struct5Bs *func_8034A348(struct5Bs *this){ struct5Bs *func_8034A348(struct5Bs *this) {
if(this){ if (this) {
this = (struct5Bs *)defrag(this); this = (struct5Bs *) defrag(this);
this->unk0 = (f32(*)[3])(((s32)this + sizeof(struct5Bs))); this->unk0 = (f32(*)[3])(((s32) this + sizeof(struct5Bs)));
this->unk4 = (f32(*)[3])((s32)this->unk0 + sizeof(f32[3])*CORE2_C31A0_VEC_COUNT); this->unk4 = (f32(*)[3])((s32) this->unk0 + sizeof(f32[3]) * CORE2_C31A0_VEC_COUNT);
} }
return this; return this;
} }