mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-31 09:21:28 -04:00
z_message progress (#701)
* 8 functions matching, 1 non-matching, 45 untouched * match func_801518B0 * match func_8014CC14 * matching 8 func, 1 non-matching * matched func_80148CBC * matched func_80156758 * matched func_80147564 * matched func_80151BB4 * matched func80152EC0/Message_Spawn_Song_Effect * matched func_80151C9C * WIP func_80148B98 * WIP func_80151938 * matched func_80151938 * matched func_80148B98 * matched func_80147734 * matched func_80147624 * WIP func_8014EBC * match func_801518B0 * matched func_80147564 * matched func80152EC0/Message_Spawn_Song_Effect * matched func_80151C9C * WIP func_80148B98 * matched func_80151938 * matched func_80148B98 * matched func_80147734 * matched func_80147624 * WIP#2 func_8014EBC * matched func_80149EBC * WIP func_8014CCB4 * matched func_8014CCB4 * matched func_80151A68 * WIP func_8014D62C * fix func_8015A68 signature * z_message_nes & z_message_staff progress * z_message_nes & z_message_staff renaming * documenting z_message * cleaning & renaming * documenting MessageContext * matched func_80151A68 * format * naming convention fix * re-add func_80147564 * apply renaming of Message_ShouldAdvanceSilent on the whole project * re-format, add clang-format off/on in z_message.c needed for matching * rename staff => credits; add renames in actorfixer. * change rupees array to ascii * remove useless comments * change MessageContext.decodedBuffer to a union * remove decodedBuffer from actorfixer * applied AngheloAlf suggestions & ran sfxconvert on z_message.c * rename message_struct => message_data_static; revert decodedBuffer as union creating differences. * use true/false instead of 1/0 * use SET_FULLSCREEN_VIEWPORT macro in func_80152c64 * AngheloAlf suggestions. * extract assign from dayTime calculation for readability in Message_LoadTimeNES * remove bss_reordering from osFlash, idle & boot_main to typedef MessageTableEntry in message_data_static & make decodedBuffer an union. * remove useless casts * Changes hexa to ascii chars when it's meaningful; add comments to func_8014CCB4 to show what hexa constant means. * Hensldm suggestions * ran actorfixer on new changes; fix new bss reordering error introduced with rebase * use new TIME_TO_MINUTES_F macro * re-ran format.sh * hensldm suggestions #2 + overall cleaning * remove useless parenthesis * Update include/message_data_static.h Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> * actorfixer and format * more fixes Co-authored-by: Andzura <andzura@andzura.fr> Co-authored-by: abaud <adrien.baud@inria.fr> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
@@ -159,14 +159,14 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 != 4) {
|
||||
if (temp_v0 != 5) {
|
||||
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
|
||||
if ((temp_v0 == 6) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
}
|
||||
// Duplicate return node #17. Try simplifying control flow for better match
|
||||
return;
|
||||
}
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
func_801477B4(globalCtx);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
@@ -175,7 +175,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
// Duplicate return node #17. Try simplifying control flow for better match
|
||||
return;
|
||||
}
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
temp_v0_2 = globalCtx->msgCtx.choiceIndex;
|
||||
if (temp_v0_2 != 0) {
|
||||
if (temp_v0_2 != 1) {
|
||||
@@ -211,7 +211,7 @@ which is long, messy, and contains some rather nasty-looking control flow, inclu
|
||||
temp_v0 = Message_GetState(&globalCtx->msgCtx);
|
||||
if (temp_v0 != 4) {
|
||||
if (temp_v0 != 5) {
|
||||
if ((temp_v0 == 6) && (func_80147624(globalCtx) != 0)) {
|
||||
if ((temp_v0 == 6) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
}
|
||||
@@ -248,13 +248,13 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
if (temp_v0 != 6) {
|
||||
goto block_17;
|
||||
}
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
block_5:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
@@ -262,7 +262,7 @@ block_5:
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
temp_v0_2 = globalCtx->msgCtx.choiceIndex;
|
||||
@@ -350,13 +350,13 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
if (temp_v0 != 6) {
|
||||
goto block_17;
|
||||
}
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
block_5:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
@@ -364,7 +364,7 @@ block_5:
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
goto block_17;
|
||||
}
|
||||
temp_v0_2 = globalCtx->msgCtx.choiceIndex;
|
||||
@@ -420,13 +420,13 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
if (temp_v0 != 6) {
|
||||
return;
|
||||
}
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
block_5:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
@@ -434,7 +434,7 @@ block_5:
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
temp_v0_2 = globalCtx->msgCtx.choiceIndex;
|
||||
@@ -557,7 +557,7 @@ There's a couple of other obvious things here:
|
||||
Well, at least the bottom half looks respectable now. Again, there is no code after the switch, so the next thing up, namely
|
||||
|
||||
```C
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
```
|
||||
@@ -578,13 +578,13 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
if (temp_v0 != 6) {
|
||||
return;
|
||||
}
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
this->actionFunc = func_80952734;
|
||||
return;
|
||||
block_5:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
@@ -592,7 +592,7 @@ block_5:
|
||||
this->actionFunc = func_809529AC;
|
||||
return;
|
||||
block_7:
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_801477B4(globalCtx);
|
||||
@@ -647,7 +647,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (func_80147624(globalCtx) == 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) == 0) {
|
||||
return;
|
||||
}
|
||||
func_801477B4(globalCtx);
|
||||
@@ -656,7 +656,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_801477B4(globalCtx);
|
||||
@@ -700,7 +700,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
func_801477B4(globalCtx);
|
||||
Actor_PickUp((Actor *) this, globalCtx, 0x35, this->actor.xzDistToPlayer, this->actor.playerHeightRel);
|
||||
this->actionFunc = func_809529AC;
|
||||
@@ -708,7 +708,7 @@ void func_809527F8(EnMs *this, GlobalContext *globalCtx) {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (func_80147624(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_801477B4(globalCtx);
|
||||
|
||||
@@ -183,7 +183,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) {
|
||||
if ((temp_v0_2 == 5) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
if (this->actor.textId == 0x2AD9) {
|
||||
Flags_SetSwitch(globalCtx, this->actor.params);
|
||||
Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f);
|
||||
@@ -500,7 +500,7 @@ void func_80C102D4(EnRecepgirl* this, GlobalContext* globalCtx) {
|
||||
if (temp_v0_2 == 2) {
|
||||
this->actor.textId = 0x2ADC; // hear directions again?
|
||||
func_80C10148(this);
|
||||
} else if ((temp_v0_2 == 5) && (func_80147624(globalCtx) != 0)) {
|
||||
} else if ((temp_v0_2 == 5) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
if (this->actor.textId == 0x2AD9) { // "Welcome..."
|
||||
Flags_SetSwitch(globalCtx, this->actor.params);
|
||||
Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 10.0f);
|
||||
|
||||
@@ -288,7 +288,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
|
||||
func_80C10148(this);
|
||||
return;
|
||||
}
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) {
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
temp_v0_3 = this->actor.textId;
|
||||
if (temp_v0_3 == 0x2AD9) {
|
||||
Flags_SetSwitch(globalCtx, (s32) this->actor.params);
|
||||
@@ -347,7 +347,7 @@ void func_80C102D4(EnRecepgirl *this, GlobalContext *globalCtx) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) {
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
if (this->actor.textId == 0x2AD9) {
|
||||
Flags_SetSwitch(globalCtx, this->actor.params);
|
||||
Animation_MorphToPlayOnce(&this->skelAnime, &D_0600AD98, 10.0f);
|
||||
@@ -397,7 +397,7 @@ somehow we skipped over `t0`. Where is this in the code? The `153` in the middle
|
||||
return;
|
||||
}
|
||||
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (func_80147624(globalCtx) != 0)) {
|
||||
if (((temp_v0_2 & 0xFF) == 5) && (Message_ShouldAdvance(globalCtx) != 0)) {
|
||||
```
|
||||
|
||||
If you look at the conditionals and the declaration of `temp_v0_2`, you may notice something odd: `temp_v0_2` is a `u8`. Therefore the `& 0xFF` does nothing! It's surprisingly common for this to happen, be it leaving out a `& 0xFF` or adding an extraneous one. If we remove it, we get a match:
|
||||
|
||||
Reference in New Issue
Block a user