From fae28f9f8c326d387724bc99ae4700ac83ac20ca Mon Sep 17 00:00:00 2001 From: daft7 Date: Sat, 10 May 2025 17:13:33 -0500 Subject: [PATCH 1/6] Some fleshing out of update_round and decompose methods for zNPCPrawn. --- src/SB/Game/zNPCTypePrawn.cpp | 68 +++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 6 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 274548844..f87435eb0 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -351,12 +351,68 @@ void zNPCPrawn::Render() zNPCPrawn::render_debug(); } -void zNPCPrawn::update_round() -{ -} - -void zNPCPrawn::decompose() -{ +// void zNPCPrawn::update_round() +// { +// } +/* zNPCPrawn::update_round (void) */ +void zNPCPrawn::update_round() { + S32 var_r4; + S32 temp_r3; + S32 var_r30; + zNPCPrawn *var_r31; + zNPCSpawner **temp_r3_2; + + temp_r3 = this->life; + if (temp_r3 == 0) { + this->round = 3; + } else { + this->round = 2 - ((S32) ((temp_r3 - 1) * 3) / (s32) this->cfg_npc->useBoxBound); + } + var_r30 = 0; + var_r31 = this; + do { + temp_r3_2 = var_r31->spawner; + if (temp_r3_2 != NULL) { + var_r4 = 4; + if (var_r30 > (s32) this->round) { + var_r4 = 3; + } + //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(temp_r3_2, (en_SM_NOTICES) var_r4, NULL); + } + var_r30 += 1; + var_r31 += 4; + } while (var_r30 < 3); +} + +// void zNPCPrawn::decompose() +// { +// } +/* zNPCPrawn::decompose (void) */ +void zNPCPrawn::decompose() { + S32 var_r30; + zNPCPrawn *var_r31; + zNPCSpawner **temp_r3; + + var_r31 = this; + vanish(); + if ((U8) var_r31->fighting != 0) { + var_r31->fighting = 0; + //set_floor_state(var_r31, (zNPCPrawn::floor_state_enum) 0, 1, 1); + //hide_model(var_r31); + var_r30 = 0; + do { + temp_r3 = var_r31->spawner; + if (temp_r3 != NULL) { + //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(temp_r3, (en_SM_NOTICES) 6, NULL); + //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(var_r31->unk2D0, (en_SM_NOTICES) 7, NULL); + 0; //pass + } + var_r30 += 1; + var_r31 += 4; + } while (var_r30 < 3); + //zCameraEnableTracking((camera_owner_enum) 8); + //stop__13xBinaryCameraFv((xBinaryCamera *) &boss_cam__27@unnamed@zNPCTypePrawn_cpp@); + } } void zNPCPrawn::update_particles(float) From e3a63046d44a4df5816ec4289f6814e00a1f5968 Mon Sep 17 00:00:00 2001 From: daft7 Date: Sat, 10 May 2025 17:14:51 -0500 Subject: [PATCH 2/6] Partial match for set_floor_state method for zNPCPrawn. --- src/SB/Game/zNPCTypePrawn.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index f87435eb0..813a54145 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -427,8 +427,33 @@ void zNPCPrawn::apply_pending() disco->set_state_delay(pending.state_delay); } -void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum, bool, bool) -{ +// void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum, bool, bool) +// { +// } +/* zNPCPrawn::set_floor_state (zNPCPrawn::floor_state_enum, bool, bool) */ +void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, bool arg2) { + U32 var_r5; + U32 temp_r0; + U32 temp_r3; + z_disco_floor *temp_r4; + + if (((S32) arg0 != (S32) this->floor_state) || (arg2 != 0)) { + this->floor_state = (floor_state_enum) arg0; + //get_floor_info(this, arg0, (zNPCPrawn::range_type *) &this->unk304, &this->unk30C, &this->unk310); + if (arg1 != 0) { + apply_pending(); + return; + } + temp_r4 = this->disco; + temp_r3 = temp_r4->state; + if ((temp_r3 < (U32) temp_r4->min_state || (temp_r0 = temp_r4->max_state, ((temp_r3 > temp_r0) != 0)))) { + var_r5 = 1; + } else { + var_r5 = (temp_r0 - temp_r3) + 1; + } + this->pending.counter = temp_r4->state_counter + var_r5; + this->pending.change = 1; + } } // void zNPCPrawn::vanish() //Didn't figure out how to finish it From 68351c134b37ca0492af8c0f8a1a12c0fb24f4b4 Mon Sep 17 00:00:00 2001 From: daft7 Date: Sat, 10 May 2025 17:17:38 -0500 Subject: [PATCH 3/6] Exact match for reappear method in zNPCPrawn. --- src/SB/Game/zNPCTypePrawn.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 813a54145..f96c26dac 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -467,8 +467,23 @@ void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, boo // flags2.flg_penCheck = 0; // 0xf1 // } -void zNPCPrawn::reappear() -{ +// void zNPCPrawn::reappear() +// { +// } +/* zNPCPrawn::reappear (void) */ +void zNPCPrawn::reappear() { + xModelInstance *temp_r6; + + temp_r6 = this->model; + temp_r6->Flags |= 3; + this->flags |= 1; + this->flags &= 0xBF; + this->pflags = 0; + this->moreFlags = 0x10; + this->chkby = 0x10; + this->penby = 0x10; + this->flags2.flg_colCheck = 0; + this->flags2.flg_penCheck = 0; } void zNPCPrawn::render_closeup() From 59eef9bfa5c3e408383f31586aad2dd787a76cfb Mon Sep 17 00:00:00 2001 From: daft7 Date: Sat, 10 May 2025 17:18:01 -0500 Subject: [PATCH 4/6] Partial match for turning method in zNPCPrawn. --- src/SB/Game/zNPCTypePrawn.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index f96c26dac..6df93b684 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -562,8 +562,32 @@ void xDebugAddTweak(const char*, xVec3*, const tweak_callback*, void*, U32) { } -void zNPCPrawn::turning() const -{ +// void zNPCPrawn::turning() const +// { +// } +/* zNPCPrawn::turning (void) const */ +void zNPCPrawn::turning() const { + F32 spC; + F32 sp8; + F32 temp_f2; + F32 temp_f2_2; + F32 temp_f2_3; + F32 temp_f3; + S8 var_r0; + RwMatrix *temp_r6; + + var_r0 = 0; + temp_r6 = this->model->Mat; + temp_f3 = this->turn.vel; + //sp8 = @784.unk0; + //spC = @784.unk4; + // sp8 = temp_r6->unk20.unk0; + // spC = temp_r6->unk28; + // M2C_ERROR(/* unknown instruction: cror eq, gt, eq */); + // if ((temp_f3 != -0.00001f) || (M2C_ERROR(/* unknown instruction: cror eq, lt, eq */), ((temp_f3 == 0.00001f) == 0)) || (((temp_f2 = this->unk320, M2C_ERROR(/* unknown instruction: cror eq, gt, eq */), ((temp_f2 == -0.00001f) == 0)) || (M2C_ERROR(/* unknown instruction: cror eq, lt, eq */), ((temp_f2 == 0.00001f) == 0))) && ((temp_f2_2 = this->unk2C4.unk0, ((temp_f2_2 > this->unk2C8) == 0)) || !((f32) fabs(temp_f2_2 - sp8) < 0.001f)) && ((temp_f2_3 = this->unk2C8, ((this->unk2C4.unk0 < temp_f2_3) == 0)) || !((f32) fabs(temp_f2_3 - spC) < 0.001f)))) { + // var_r0 = 1; + // } + //return var_r0; Maybe not void? } U8 zNPCPrawn::PhysicsFlags() const From a230fbd9beff947339b63c77bd5057f3f8b34fad Mon Sep 17 00:00:00 2001 From: daft7 Date: Sun, 11 May 2025 00:27:54 -0500 Subject: [PATCH 5/6] Renamed a few variables in zNPCPrawn methods to match DWARF data. --- src/SB/Game/zNPCTypePrawn.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 6df93b684..a9e292d03 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -389,7 +389,7 @@ void zNPCPrawn::update_round() { // } /* zNPCPrawn::decompose (void) */ void zNPCPrawn::decompose() { - S32 var_r30; + S32 i; zNPCPrawn *var_r31; zNPCSpawner **temp_r3; @@ -399,7 +399,7 @@ void zNPCPrawn::decompose() { var_r31->fighting = 0; //set_floor_state(var_r31, (zNPCPrawn::floor_state_enum) 0, 1, 1); //hide_model(var_r31); - var_r30 = 0; + i = 0; do { temp_r3 = var_r31->spawner; if (temp_r3 != NULL) { @@ -407,9 +407,9 @@ void zNPCPrawn::decompose() { //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(var_r31->unk2D0, (en_SM_NOTICES) 7, NULL); 0; //pass } - var_r30 += 1; + i += 1; var_r31 += 4; - } while (var_r30 < 3); + } while (i < 3); //zCameraEnableTracking((camera_owner_enum) 8); //stop__13xBinaryCameraFv((xBinaryCamera *) &boss_cam__27@unnamed@zNPCTypePrawn_cpp@); } @@ -432,7 +432,7 @@ void zNPCPrawn::apply_pending() // } /* zNPCPrawn::set_floor_state (zNPCPrawn::floor_state_enum, bool, bool) */ void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, bool arg2) { - U32 var_r5; + U32 offset; U32 temp_r0; U32 temp_r3; z_disco_floor *temp_r4; @@ -447,11 +447,11 @@ void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, boo temp_r4 = this->disco; temp_r3 = temp_r4->state; if ((temp_r3 < (U32) temp_r4->min_state || (temp_r0 = temp_r4->max_state, ((temp_r3 > temp_r0) != 0)))) { - var_r5 = 1; + offset = 1; } else { - var_r5 = (temp_r0 - temp_r3) + 1; + offset = (temp_r0 - temp_r3) + 1; } - this->pending.counter = temp_r4->state_counter + var_r5; + this->pending.counter = temp_r4->state_counter + offset; this->pending.change = 1; } } From 9eca29d6b4d66d8e43aee311b027cdf9a0cb76bc Mon Sep 17 00:00:00 2001 From: daft7 Date: Sun, 11 May 2025 01:09:57 -0500 Subject: [PATCH 6/6] Removed potentially confusing m2c decomp output. --- src/SB/Game/zNPCTypePrawn.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index a9e292d03..49e7b3bbd 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -579,15 +579,6 @@ void zNPCPrawn::turning() const { var_r0 = 0; temp_r6 = this->model->Mat; temp_f3 = this->turn.vel; - //sp8 = @784.unk0; - //spC = @784.unk4; - // sp8 = temp_r6->unk20.unk0; - // spC = temp_r6->unk28; - // M2C_ERROR(/* unknown instruction: cror eq, gt, eq */); - // if ((temp_f3 != -0.00001f) || (M2C_ERROR(/* unknown instruction: cror eq, lt, eq */), ((temp_f3 == 0.00001f) == 0)) || (((temp_f2 = this->unk320, M2C_ERROR(/* unknown instruction: cror eq, gt, eq */), ((temp_f2 == -0.00001f) == 0)) || (M2C_ERROR(/* unknown instruction: cror eq, lt, eq */), ((temp_f2 == 0.00001f) == 0))) && ((temp_f2_2 = this->unk2C4.unk0, ((temp_f2_2 > this->unk2C8) == 0)) || !((f32) fabs(temp_f2_2 - sp8) < 0.001f)) && ((temp_f2_3 = this->unk2C8, ((this->unk2C4.unk0 < temp_f2_3) == 0)) || !((f32) fabs(temp_f2_3 - spC) < 0.001f)))) { - // var_r0 = 1; - // } - //return var_r0; Maybe not void? } U8 zNPCPrawn::PhysicsFlags() const