1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

z_message_PAL, message_data_static and surrounding doc (#996)

* Initial progress on z_message_PAL, very messy

* Fix merge

* Some more progress

* Fix merge

* More z_message_PAL

* Small progress

* More small progress

* message_data_static files OK

* Prepare z_message_tables

* Matched another function, small updates

* Attempt to use asm-processor static-symbols branch

* Refactor text id declarations

* Begin large text codes parser function

* Fix merge

* Refactor done

* Build OK, add color and highscore names

* Remove encoded text headers and automatically encode during build

* Fix kanfont

* Various cleanups

* DISP macros

* Another match aside data

* Further progress

* Small improvements

* Deduplicate magic values for text control codes, small improvements

* Tiny progress

* Minor cleanups

* Clean up z_message_PAL comment

* Progress on large functions

* Further progress on large functions

* Changes to mkldscript to link .data in the .rodata section

* data OK

* Few improvements

* Use gDPLoadTextureBlock macros where appropriate

* rm z_message_tables, progress on large functions

* 2 more matches

* Improvements

* Small progress

* More progress on big function

* progress

* match func_80107980

* match Message_Update

* match func_8010BED8

* done

* Progress on remaining large functions

* Small progress on largest function

* Another match, extract text and move to assets, improve text build system

* Small nonmatchings improvements

* docs wip

* Largest function maybe equivalent

* Fix merge

* Document do_action values, largest function is almost instruction-matching

* Rename NAVI do_action to NONE, as that appears to be how that value is used in practice

* Fix merge

* one match

* Last function is instruction-matching

* Fix

* Improvements thanks to engineer124

* Stack matched thanks to petrie911, now just a/v/low t regalloc issues, some cleanup

* More variables labeled, use text state enum everywhere

* More labels and names

* Fix

* Actor_IsTalking -> Actor_TalkRequested

* Match func_8010C39C and remove unused asm

* More docs

* Mostly ocarina related docs

* All msgModes named

* Fix assetclean

* Cleanup

* Extraction fixes and headers

* Suggestions

* Review suggestions

* Change text extraction again, only extract if the headers do not already exist

* Fix

* Use ast for charmap, fix assetclean for real this time

* Review suggestions

* BGM ids and ran formatter

* Review comments

* rename include_readonly to include_data_with_rodata

* Remove leading 0s in number directives

* Review suggestions for message_data_static

* textbox pos enum comments, rename several enum names from Message to TextBox

Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
This commit is contained in:
Tharo 2021-11-23 01:20:30 +00:00 committed by GitHub
parent 03636166b3
commit a497f33bda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
216 changed files with 7052 additions and 16801 deletions

View file

@ -98,9 +98,8 @@ void func_80A90E28(EnKakasi3* this) {
void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
s16 currentFrame;
s16 phi_v0;
s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx;
phi_v0 = globalCtx->msgCtx.unk_E410;
if (arg != 0) {
if (this->unk_19C[3] == 0) {
this->unk_19C[3] = (s16)Rand_ZeroFloat(10.99f) + 30;
@ -108,33 +107,33 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
}
this->unk_19A = (s16)Rand_ZeroFloat(2.99f) + 5;
phi_v0 = this->unk_1A6;
ocarinaNote = this->unk_1A6;
}
switch (phi_v0) {
case 0:
switch (ocarinaNote) {
case OCARINA_NOTE_A:
this->unk_19A++;
if (this->unk_1A4 == 0) {
this->unk_1A4 = 1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KAKASHI_ROLL);
}
break;
case 1:
case OCARINA_NOTE_C_DOWN:
this->unk_19A++;
this->unk_1B8 = 1.0f;
break;
case 2:
case OCARINA_NOTE_C_RIGHT:
this->unk_19A++;
if (this->unk_1AE == 0x0) {
this->unk_1AE = 0x1388;
}
break;
case 3:
case OCARINA_NOTE_C_LEFT:
this->unk_19A++;
if (this->unk_1AA == 0x0) {
this->unk_1AA = 0x1388;
}
break;
case 4:
case OCARINA_NOTE_C_UP:
this->unk_19A++;
this->unk_1B8 = 2.0f;
break;
@ -186,14 +185,14 @@ void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
this->actor.textId = 0x40A1;
this->dialogState = 6;
this->dialogState = TEXT_STATE_DONE;
this->unk_19A = 0;
if (!LINK_IS_ADULT) {
this->unk_194 = false;
if (gSaveContext.scarecrowSpawnSongSet) {
this->actor.textId = 0x40A0;
this->dialogState = 5;
this->dialogState = TEXT_STATE_EVENT;
this->unk_1A8 = 1;
}
} else {
@ -215,7 +214,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
func_80A90E28(this);
SkelAnime_Update(&this->skelAnime);
this->camId = SUBCAM_NONE;
if (func_8002F194(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (!this->unk_194) {
if (this->unk_1A8 == 0) {
this->actionFunc = func_80A91284;
@ -236,10 +235,10 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
if (player->stateFlags2 & 0x1000000) {
this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM);
globalCtx->msgCtx.msgMode = 0x37;
this->dialogState = 5;
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
this->dialogState = TEXT_STATE_EVENT;
this->unk_1B8 = 0.0f;
func_8010B680(globalCtx, 0x40A4, NULL);
Message_StartTextbox(globalCtx, 0x40A4, NULL);
player->stateFlags2 |= 0x800000;
this->actionFunc = func_80A915B8;
return;
@ -251,10 +250,10 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
if (player->stateFlags2 & 0x1000000) {
this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM);
globalCtx->msgCtx.msgMode = 0x37;
this->dialogState = 5;
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
this->dialogState = TEXT_STATE_EVENT;
this->unk_1B8 = 0.0f;
func_8010B680(globalCtx, 0x40A8, NULL);
Message_StartTextbox(globalCtx, 0x40A8, NULL);
player->stateFlags2 |= 0x800000;
this->actionFunc = func_80A9187C;
return;
@ -270,10 +269,9 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
}
void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) {
if (func_8010BDBC(&globalCtx->msgCtx) == 5 && func_80106BC8(globalCtx)) {
func_80106CCC(globalCtx);
func_8010BD58(globalCtx, 0x2C);
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_RECORDING);
this->actionFunc = func_80A91620;
}
}
@ -281,8 +279,9 @@ void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if ((globalCtx->msgCtx.unk_E3EE == 4 || (globalCtx->msgCtx.unk_E3EE >= 5 && globalCtx->msgCtx.unk_E3EE < 11)) &&
(globalCtx->msgCtx.msgMode == 0)) {
if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 ||
(globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) &&
(globalCtx->msgCtx.msgMode == MSGMODE_NONE)) {
OnePointCutscene_EndCutscene(globalCtx, this->camId);
if (globalCtx->cameraPtrs[this->camId] == NULL) {
@ -295,15 +294,15 @@ void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) {
return;
}
if (globalCtx->msgCtx.unk_E3EE == 3 && globalCtx->msgCtx.msgMode == 0) {
this->dialogState = 5;
func_8010B680(globalCtx, 0x40A5, NULL);
if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) {
this->dialogState = TEXT_STATE_EVENT;
Message_StartTextbox(globalCtx, 0x40A5, NULL);
func_8002DF54(globalCtx, NULL, 8);
this->actionFunc = func_80A91A90;
return;
}
if (globalCtx->msgCtx.unk_E3EE == 1) {
if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) {
func_80A90EBC(this, globalCtx, 0);
player->stateFlags2 |= 0x800000;
}
@ -313,9 +312,9 @@ void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) {
func_80A90E28(this);
SkelAnime_Update(&this->skelAnime);
if (this->dialogState == func_8010BDBC(&globalCtx->msgCtx) && func_80106BC8(globalCtx)) {
globalCtx->msgCtx.msgMode = 0x37;
func_8010BD58(globalCtx, 0x2D);
if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) {
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_PLAYBACK);
this->actionFunc = func_80A917FC;
this->camId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, MAIN_CAM);
}
@ -323,21 +322,20 @@ void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.unk_E3EE != 15) {
if (globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_0F) {
func_80A90EBC(this, globalCtx, 1);
} else {
globalCtx->msgCtx.unk_E3EE = 4;
func_80106CCC(globalCtx);
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
Message_CloseTextbox(globalCtx);
OnePointCutscene_EndCutscene(globalCtx, this->camId);
this->actionFunc = func_80A911F0;
}
}
void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) {
if (func_8010BDBC(&globalCtx->msgCtx) == 5 && func_80106BC8(globalCtx)) {
func_80106CCC(globalCtx);
func_8010BD58(globalCtx, 0x28);
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW);
this->actionFunc = func_80A918E4;
}
}
@ -347,13 +345,14 @@ void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) {
if (BREG(3) != 0) {
// "No way!"
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.unk_E3EE);
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ まさか! ☆☆☆☆☆ %d\n" VT_RST, globalCtx->msgCtx.ocarinaMode);
}
if ((globalCtx->msgCtx.unk_E3EE == 4 || (globalCtx->msgCtx.unk_E3EE >= 5 && globalCtx->msgCtx.unk_E3EE < 11)) &&
globalCtx->msgCtx.msgMode == 0) {
if ((globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04 ||
(globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) &&
globalCtx->msgCtx.msgMode == MSGMODE_NONE) {
func_8010B680(globalCtx, 0x40A6, NULL);
this->dialogState = 5;
Message_StartTextbox(globalCtx, 0x40A6, NULL);
this->dialogState = TEXT_STATE_EVENT;
OnePointCutscene_EndCutscene(globalCtx, this->camId);
this->camId = SUBCAM_NONE;
func_8002DF54(globalCtx, NULL, 8);
@ -361,23 +360,23 @@ void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) {
return;
}
if (globalCtx->msgCtx.unk_E3EE == 3 && globalCtx->msgCtx.msgMode == 0) {
globalCtx->msgCtx.unk_E3EE = 4;
if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03 && globalCtx->msgCtx.msgMode == MSGMODE_NONE) {
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
if (BREG(3) != 0) {
osSyncPrintf("\n\n");
// "With this, other guys are OK! That's it!"
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ これで、他の奴もOK!だ! ☆☆☆☆☆ %d\n" VT_RST,
globalCtx->msgCtx.unk_E3EE);
globalCtx->msgCtx.ocarinaMode);
}
this->unk_195 = true;
func_8010B680(globalCtx, 0x40A7, NULL);
this->dialogState = 5;
Message_StartTextbox(globalCtx, 0x40A7, NULL);
this->dialogState = TEXT_STATE_EVENT;
func_8002DF54(globalCtx, NULL, 8);
this->actionFunc = func_80A91A90;
return;
}
if (globalCtx->msgCtx.unk_E3EE == 1) {
if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) {
func_80A90EBC(this, globalCtx, 0);
player->stateFlags2 |= 0x800000;
}
@ -388,7 +387,7 @@ void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
func_8002DF54(globalCtx, NULL, 8);
if (this->dialogState == func_8010BDBC(&globalCtx->msgCtx) && func_80106BC8(globalCtx)) {
if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) {
if (this->unk_195) {
if (!(gSaveContext.eventChkInf[9] & 0x1000)) {
gSaveContext.eventChkInf[9] |= 0x1000;
@ -400,8 +399,8 @@ void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx) {
if (this->camId != SUBCAM_NONE) {
func_8005B1A4(globalCtx->cameraPtrs[this->camId]);
}
func_80106CCC(globalCtx);
globalCtx->msgCtx.unk_E3EE = 4;
Message_CloseTextbox(globalCtx);
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
func_8002DF54(globalCtx, NULL, 7);
this->actionFunc = func_80A911F0;
}