1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 23:41:24 +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

@ -270,9 +270,10 @@ void EnGo2_GetItem(EnGo2* this, GlobalContext* globalCtx, s32 getItemId) {
}
s32 EnGo2_GetDialogState(EnGo2* this, GlobalContext* globalCtx) {
s16 dialogState = func_8010BDBC(&globalCtx->msgCtx);
s16 dialogState = Message_GetState(&globalCtx->msgCtx);
if ((this->dialogState == 10) || (this->dialogState == 5) || (this->dialogState == 2) || (this->dialogState == 1)) {
if ((this->dialogState == TEXT_STATE_AWAITING_NEXT) || (this->dialogState == TEXT_STATE_EVENT) ||
(this->dialogState == TEXT_STATE_CLOSING) || (this->dialogState == TEXT_STATE_DONE_HAS_NEXT)) {
if (dialogState != this->dialogState) {
this->unk_20C++;
}
@ -318,16 +319,16 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
s32 bombBagUpgrade;
switch (func_8010BDBC(&globalCtx->msgCtx)) {
case 2:
switch (Message_GetState(&globalCtx->msgCtx)) {
case TEXT_STATE_CLOSING:
return 2;
case 5:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
if (this->actor.textId == 0x3012) {
this->actionFunc = EnGo2_SetupGetItem;
bombBagUpgrade = CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30;
EnGo2_GetItem(this, globalCtx, bombBagUpgrade);
func_80106CCC(globalCtx);
Message_CloseTextbox(globalCtx);
gSaveContext.infTable[17] |= 0x4000;
return 2;
} else {
@ -345,16 +346,16 @@ u16 EnGo2_GetTextIdGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) {
// DMT Goron by Bomb Flower Choice
s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) {
switch (func_8010BDBC(&globalCtx->msgCtx)) {
case 2:
switch (Message_GetState(&globalCtx->msgCtx)) {
case TEXT_STATE_CLOSING:
if ((this->actor.textId == 0x300B) && (gSaveContext.infTable[14] & 0x800) == 0) {
gSaveContext.infTable[14] |= 0x800;
return 2;
} else {
return 0;
}
case 4:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(globalCtx)) {
// Ask question to DMT Goron by bomb flower
if (this->actor.textId == 0x300A) {
if (globalCtx->msgCtx.choiceIndex == 0) {
@ -362,7 +363,7 @@ s16 EnGo2_GetStateGoronDmtBombFlower(GlobalContext* globalCtx, EnGo2* this) {
} else {
this->actor.textId = 0x300D;
}
func_8010B720(globalCtx, this->actor.textId);
Message_ContinueTextbox(globalCtx, this->actor.textId);
}
return 1;
}
@ -380,7 +381,7 @@ u16 EnGo2_GetTextIdGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronDmtRollingSmall(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
return 0;
} else {
return 1;
@ -398,7 +399,7 @@ u16 EnGo2_GetTextIdGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronDmtDcEntrance(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3008) {
gSaveContext.infTable[14] |= 0x1;
}
@ -419,7 +420,7 @@ u16 EnGo2_GetTextIdGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronCityEntrance(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3014) {
gSaveContext.infTable[15] |= 0x1;
}
@ -440,7 +441,7 @@ u16 EnGo2_GetTextIdGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronCityIsland(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3016) {
gSaveContext.infTable[15] |= 0x10;
}
@ -463,7 +464,7 @@ u16 EnGo2_GetTextIdGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3018) {
gSaveContext.infTable[15] |= 0x100;
}
@ -480,7 +481,7 @@ u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
return gSaveContext.infTable[16] & 0x4000 ? 0x3038 : 0x3037;
} else if (gSaveContext.infTable[16] & 0x1000) {
this->unk_20C = 0;
this->dialogState = 0;
this->dialogState = TEXT_STATE_NONE;
return gSaveContext.infTable[16] & 0x400 ? 0x3033 : 0x3032;
} else {
return 0x3030;
@ -489,7 +490,7 @@ u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
switch (EnGo2_GetDialogState(this, globalCtx)) {
case 2:
case TEXT_STATE_CLOSING:
switch (this->actor.textId) {
case 0x3036:
EnGo2_GetItem(this, globalCtx, GI_TUNIC_GORON);
@ -500,8 +501,8 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
default:
return 0;
}
case 4:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(globalCtx)) {
if (this->actor.textId == 0x3034) {
if (globalCtx->msgCtx.choiceIndex == 0) {
this->actor.textId = gSaveContext.infTable[16] & 0x800 ? 0x3033 : 0x3035;
@ -514,22 +515,22 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
Audio_StopSfxById(NA_SE_EN_GOLON_CRY);
}
}
func_8010B720(globalCtx, this->actor.textId);
Message_ContinueTextbox(globalCtx, this->actor.textId);
this->unk_20C = 0;
}
} else {
break;
}
return 1;
case 5:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
switch (this->actor.textId) {
case 0x3035:
gSaveContext.infTable[16] |= 0x800;
case 0x3032:
case 0x3033:
this->actor.textId = 0x3034;
func_8010B720(globalCtx, this->actor.textId);
Message_ContinueTextbox(globalCtx, this->actor.textId);
return 1;
default:
return 2;
@ -562,7 +563,7 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
u8 dialogState = this->dialogState;
switch (EnGo2_GetDialogState(this, globalCtx)) {
case 6:
case TEXT_STATE_DONE:
if (this->actor.textId == 0x305E) {
if (!gSaveContext.bgsFlag) {
EnGo2_GetItem(this, globalCtx, GI_SWORD_BGS);
@ -574,25 +575,25 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
} else {
return 0;
}
case 3:
case TEXT_STATE_DONE_FADING:
switch (this->actor.textId) {
case 0x305E:
if (func_8002F368(globalCtx) != EXCH_ITEM_CLAIM_CHECK) {
break;
}
case 0x3059:
if (dialogState == 0) {
if (dialogState == TEXT_STATE_NONE) {
func_800F4524(&D_801333D4, NA_SE_EN_GOLON_WAKE_UP, 60);
}
case 0x3054:
if (dialogState == 0) {
if (dialogState == TEXT_STATE_NONE) {
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
}
}
return 1;
case 4:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(globalCtx)) {
if ((this->actor.textId == 0x3054) || (this->actor.textId == 0x3055)) {
if (globalCtx->msgCtx.choiceIndex == 0) {
EnGo2_GetItem(this, globalCtx, GI_PRESCRIPTION);
@ -600,15 +601,15 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
return 2;
}
this->actor.textId = 0x3056;
func_8010B720(globalCtx, this->actor.textId);
Message_ContinueTextbox(globalCtx, this->actor.textId);
}
return 1;
}
break;
case 5:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
if (this->actor.textId == 0x3059) {
globalCtx->msgCtx.msgMode = 0x37;
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
this->actionFunc = EnGo2_BiggoronEyedrops;
}
return 2;
@ -626,14 +627,14 @@ u16 EnGo2_GetTextIdGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronFireGeneric(GlobalContext* globalCtx, EnGo2* this) {
switch (func_8010BDBC(&globalCtx->msgCtx)) {
case 2:
switch (Message_GetState(&globalCtx->msgCtx)) {
case TEXT_STATE_CLOSING:
return 0;
case 5:
if (func_80106BC8(globalCtx)) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
if (this->actor.textId == 0x3071) {
this->actor.textId = EnGo2_GoronFireGenericGetTextId(this);
func_8010B720(globalCtx, this->actor.textId);
Message_ContinueTextbox(globalCtx, this->actor.textId);
}
return 1;
}
@ -647,7 +648,7 @@ u16 EnGo2_GetTextIdGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronCityStairwell(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x300E) {
gSaveContext.infTable[14] |= 0x8;
}
@ -663,7 +664,7 @@ u16 EnGo2_GetTextIdGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronMarketBazaar(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
return 0;
} else {
return 1;
@ -683,7 +684,7 @@ u16 EnGo2_GetTextIdGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronCityLostWoods(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
if (this->actor.textId == 0x3024) {
gSaveContext.infTable[14] |= 0x40;
}
@ -703,7 +704,7 @@ u16 EnGo2_GetTextIdGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) {
}
s16 EnGo2_GetStateGoronDmtFairyHint(GlobalContext* globalCtx, EnGo2* this) {
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
return 0;
} else {
return 1;
@ -791,7 +792,7 @@ s32 func_80A44790(EnGo2* this, GlobalContext* globalCtx) {
} else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && ((this->collider.base.ocFlags2 & 1) == 0)) {
return false;
} else {
if (func_8002F194(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
this->unk_194.unk_00 = 1;
return true;
} else if (this->unk_194.unk_00 != 0) {
@ -1756,7 +1757,7 @@ void EnGo2_SetupGetItem(EnGo2* this, GlobalContext* globalCtx) {
}
void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) {
if ((func_8010BDBC(&globalCtx->msgCtx) == 6) && func_80106BC8(globalCtx)) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) {
this->unk_194.unk_00 = 0;
switch (this->getItemId) {
case GI_CLAIM_CHECK:
@ -1803,7 +1804,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) {
} else {
func_800F4524(&D_801333D4, NA_SE_EN_GOLON_GOOD_BIG, 60);
func_80034EC0(&this->skelAnime, sAnimations, 6);
func_8010B720(globalCtx, 0x305A);
Message_ContinueTextbox(globalCtx, 0x305A);
this->eyeMouthTexState = 3;
this->goronState++;
func_800F483C(0x7F, 5);
@ -1813,7 +1814,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) {
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->eyeMouthTexState = 0;
}
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
func_80034EC0(&this->skelAnime, sAnimations, 1);
this->actor.flags |= 1;
this->unk_26E = 2;
@ -1832,10 +1833,10 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) {
switch (this->goronState) {
case 0:
if (func_8010BDBC(&globalCtx->msgCtx)) {
if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_NONE) {
return;
} else {
func_8010B680(globalCtx, 0x3031, NULL);
Message_StartTextbox(globalCtx, 0x3031, NULL);
player->actor.freezeTimer = 10;
this->goronState++;
}
@ -1845,7 +1846,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) {
return;
}
if (func_8010BDBC(&globalCtx->msgCtx) != 2) {
if (Message_GetState(&globalCtx->msgCtx) != TEXT_STATE_CLOSING) {
player->actor.freezeTimer = 10;
} else {
gSaveContext.infTable[16] |= 0x1000;
@ -1862,9 +1863,9 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) {
switch (this->goronState) {
case 0: // Wake up
if (func_8010BDBC(&globalCtx->msgCtx) == 2) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
EnGo2_GoronFireCamera(this, globalCtx);
globalCtx->msgCtx.msgMode = 0x37;
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
func_80034EC0(&this->skelAnime, sAnimations, 2);
this->waypoint = 1;
this->skelAnime.playSpeed = 2.0f;
@ -1884,7 +1885,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) {
player->actor.world.pos.z =
(f32)((Math_CosS(this->actor.world.rot.y) * -30.0f) + this->actor.world.pos.z);
func_8002DF54(globalCtx, &this->actor, 8);
func_800F5C64(NA_BGM_APPEAR);
Audio_PlayFanfare(NA_BGM_APPEAR);
}
break;
case 2: // Walking away
@ -1918,7 +1919,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) {
break;
}
case 4: // Finalize walking away
func_80106CCC(globalCtx);
Message_CloseTextbox(globalCtx);
EnGo2_GoronFireClearCamera(this, globalCtx);
func_8002DF54(globalCtx, &this->actor, 7);
Actor_Kill(&this->actor);