From bfc4b338cbd3e78062c71ff6f72f821631277c1b Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 22 Aug 2017 17:34:42 -0500 Subject: rename some mauville man stuff --- src/mauville_old_man.c | 179 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 116 insertions(+), 63 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 93684fc60..84c8f740c 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1,6 +1,7 @@ #include "global.h" #include "mauville_old_man.h" #include "easy_chat.h" +#include "easy_chat_constants.h" #include "menu.h" #include "rng.h" #include "script.h" @@ -11,79 +12,129 @@ extern u16 gScriptResult; extern u16 gSpecialVar_0x8004; -extern u32 gUnknown_083E5388[]; -extern u32 gUnknown_083E53A8[]; +extern const u8 *gGiddyAdjectives[]; +extern const u8 *gGiddyQuestions[]; -extern u16 gUnknown_083E537C[]; - -void sub_80F7A34(void) +const u16 gDefaultBardSongLyrics[] = +{ +#ifdef ENGLISH + EC_WORD_SISTER, + EC_WORD_EATS, + EC_WORD_SWEETS, + EC_WORD_VORACIOUS, + EC_WORD_AND, + EC_WORD_DROOLING, +#else + EC_WORD_SISTER, + EC_WORD_MUST_BE, + EC_WORD_SWEETS, + EC_WORD_VORACIOUS, + EC_WORD_DROOLING, + EC_WORD_THICK, +#endif +}; + +void SetupBard(void) { u16 i; - OldMan *oldMan = &gSaveBlock1.oldMan; + struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; - oldMan->oldMan1.unk_2D94 = 0; - oldMan->oldMan1.unk_2DBD = 0; - - for(i = 0; i < 6; i++) - oldMan->oldMan1.mauvilleOldMan_ecArray[i] = gUnknown_083E537C[i]; + bard->id = MAUVILLE_MAN_BARD; + bard->unk_2DBD = 0; + for (i = 0; i < 6; i++) + bard->songLyrics[i] = gDefaultBardSongLyrics[i]; } -void sub_80F7A6C(void) +void SetupHipster(void) { - struct UnkMauvilleOldManStruct *bard = &gSaveBlock1.oldMan.oldMan1; + struct MauvilleManHipster *hipster = &gSaveBlock1.oldMan.hipster; - bard->unk_2D94 = 1; - bard->unk_2D95 = 0; + hipster->id = MAUVILLE_MAN_HIPSTER; + hipster->unk1 = 0; } -void sub_80F7A7C(void) +void SetupStoryteller(void) { - sub_80F83F8(); + StorytellerSetup(); } -void sub_80F7A88(void) +void SetupGiddy(void) { - OldMan *oldMan = &gSaveBlock1.oldMan; + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; - oldMan->oldMan1.unk_2D94 = 4; - oldMan->oldMan1.unk_2D95 = 0; + giddy->id = MAUVILLE_MAN_GIDDY; + giddy->unk1 = 0; } -void sub_80F7A98(void) +void SetupTrader(void) { - sub_81099CC(); + TraderSetup(); } -void SetMauvilleOldMan(void) +void SetupMauvilleOldMan(void) { - u32 var = ((u16)((gSaveBlock2.playerTrainerId[1] << 8 | gSaveBlock2.playerTrainerId[0])) % 10) / 2; + u16 trainerId = (gSaveBlock2.playerTrainerId[1] << 8) | gSaveBlock2.playerTrainerId[0]; - switch(var) + // Determine man based on the last digit of the player's trainer ID. + switch ((trainerId % 10) / 2) { - case 0: - sub_80F7A34(); + case MAUVILLE_MAN_BARD: + SetupBard(); break; - case 1: - sub_80F7A6C(); + case MAUVILLE_MAN_HIPSTER: + SetupHipster(); break; - case 2: - sub_80F7A98(); + case MAUVILLE_MAN_TRADER: + SetupTrader(); break; - case 3: - sub_80F7A7C(); + case MAUVILLE_MAN_STORYTELLER: + SetupStoryteller(); break; - case 4: - sub_80F7A88(); + case MAUVILLE_MAN_GIDDY: + SetupGiddy(); break; } sub_80F83D0(); } +/* +// Safely changes man to test functionality u8 GetCurrentMauvilleOldMan(void) { - OldMan *oldMan = &gSaveBlock1.oldMan; + u8 newMan = MAUVILLE_MAN_GIDDY; + struct MauvilleManCommon *common = &gSaveBlock1.oldMan.common; + + if (common->id != newMan) + { + switch (newMan) + { + case MAUVILLE_MAN_BARD: + SetupBard(); + break; + case MAUVILLE_MAN_HIPSTER: + SetupHipster(); + break; + case MAUVILLE_MAN_TRADER: + SetupTrader(); + break; + case MAUVILLE_MAN_STORYTELLER: + SetupStoryteller(); + break; + case MAUVILLE_MAN_GIDDY: + SetupGiddy(); + break; + } + sub_80F83D0(); + } + return common->id; +} +*/ + +u8 GetCurrentMauvilleOldMan(void) +{ + struct MauvilleManCommon *common = &gSaveBlock1.oldMan.common; - return oldMan->oldMan1.unk_2D94; + return common->id; } void sub_80F7B14(void) @@ -96,29 +147,28 @@ void sub_80F7B2C(void) u16 *scriptPtr = &gScriptResult; // why?? OldMan *oldMan = &gSaveBlock1.oldMan; - *scriptPtr = oldMan->oldMan1.unk_2DBD; + *scriptPtr = oldMan->bard.unk_2DBD; } void sub_80F7B40(void) { u16 i; - OldMan *oldMan = &gSaveBlock1.oldMan; - //struct UnkMauvilleOldManStruct *oldManStruct = &gSaveBlock1.oldManStruct; + struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; - StringCopy(oldMan->oldMan1.playerName, gSaveBlock2.playerName); + StringCopy(bard->playerName, gSaveBlock2.playerName); for(i = 0; i < 4; i++) - oldMan->oldMan1.playerTrainerId[i] = gSaveBlock2.playerTrainerId[i]; + bard->playerTrainerId[i] = gSaveBlock2.playerTrainerId[i]; for(i = 0; i < 6; i++) - oldMan->oldMan1.mauvilleOldMan_ecArray[i] = oldMan->oldMan1.mauvilleOldMan_ecArray2[i]; + bard->songLyrics[i] = bard->mauvilleOldMan_ecArray2[i]; - oldMan->oldMan1.unk_2DBD = 1; + bard->unk_2DBD = 1; } void sub_80F7BA0(void) { - struct UnkMauvilleOldManStruct *oldMan = &gSaveBlock1.oldMan.oldMan1; + struct MauvilleManBard *oldMan = &gSaveBlock1.oldMan.bard; u16 specialVar = gSpecialVar_0x8004; // It's a bit odd to use this temp variable, but it seems needed to match. u16 *r5; u16 i; @@ -127,7 +177,7 @@ void sub_80F7BA0(void) r5 = oldMan->mauvilleOldMan_ecArray2; if (specialVar == 0) - r5 = oldMan->mauvilleOldMan_ecArray; + r5 = oldMan->songLyrics; ptr = gStringVar4; r4 = ptr; for (i = 0; i < 2; i++) @@ -178,14 +228,14 @@ void sub_80F7C70(void) u16 *scriptPtr = &gScriptResult; // again?? OldMan *oldMan = &gSaveBlock1.oldMan; - *scriptPtr = oldMan->oldMan1.unk_2D95; + *scriptPtr = oldMan->bard.unk_2D95; } void sub_80F7C84(void) { OldMan *oldMan = &gSaveBlock1.oldMan; - oldMan->oldMan1.unk_2D95 = 1; + oldMan->bard.unk_2D95 = 1; } void sub_80F7C90(void) @@ -207,41 +257,44 @@ void sub_80F7CC8(void) { OldMan *oldMan = &gSaveBlock1.oldMan; - if(oldMan->oldMan1.unk_2D95 == 10) + if (oldMan->bard.unk_2D95 == 10) { gScriptResult = FALSE; - oldMan->oldMan1.unk_2D95 = 0; + oldMan->bard.unk_2D95 = 0; } else + { gScriptResult = TRUE; + } } -void sub_80F7CF4(void) +void ScrSpecial_GenerateGiddyLine(void) { - struct UnkMauvilleOldManStruct2 *oldMan = &gSaveBlock1.oldMan.oldMan2; + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; - if(oldMan->unk1 == 0) + if (giddy->unk1 == 0) sub_80F7DC0(); - if(oldMan->mauvilleOldMan_ecArray[oldMan->unk1] != 0xFFFF) // is not the last element of the array? + if (giddy->mauvilleOldMan_ecArray[giddy->unk1] != 0xFFFF) // is not the last element of the array? { u8 *stringPtr; - u32 random = Random(); + u32 adjective = Random(); - random %= 8; - stringPtr = sub_80EB3FC(gStringVar4, oldMan->mauvilleOldMan_ecArray[oldMan->unk1]); + adjective %= 8; + stringPtr = sub_80EB3FC(gStringVar4, giddy->mauvilleOldMan_ecArray[giddy->unk1]); stringPtr = StringCopy(stringPtr, gOtherText_Is); - stringPtr = StringCopy(stringPtr, (u8 *)gUnknown_083E5388[random]); + stringPtr = StringCopy(stringPtr, gGiddyAdjectives[adjective]); StringCopy(stringPtr, gOtherText_DontYouAgree); } else { - StringCopy(gStringVar4, (u8 *)gUnknown_083E53A8[oldMan->mauvilleOldMan_ecArray2[oldMan->unk2++]]); + StringCopy(gStringVar4, gGiddyQuestions[giddy->mauvilleOldMan_ecArray2[giddy->unk2++]]); } - if(!(Random() % 10)) - oldMan->unk1 = 10; + + if (!(Random() % 10)) + giddy->unk1 = 10; else - oldMan->unk1++; + giddy->unk1++; gScriptResult = TRUE; } -- cgit v1.2.3 From 988f5a685a36d3591d07f71ca778d988fb26720a Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 01:10:30 -0500 Subject: decompile up to sub_80F8598 --- src/mauville_old_man.c | 726 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 723 insertions(+), 3 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 84c8f740c..87bc87e3b 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1,19 +1,30 @@ #include "global.h" +#include "bard_music.h" #include "mauville_old_man.h" #include "easy_chat.h" #include "easy_chat_constants.h" +#include "event_data.h" +#include "m4a.h" #include "menu.h" +#include "rom4.h" #include "rng.h" #include "script.h" +#include "songs.h" +#include "sound.h" #include "string_util.h" #include "strings.h" +#include "task.h" #include "trader.h" +#define MACRO1(a) (((a) % 4) + (((a) / 8) & 1)) + +extern struct MusicPlayerInfo gMPlay_SE2; + extern u16 gScriptResult; extern u16 gSpecialVar_0x8004; +extern struct UnkBard2 gUnknown_03005DA0; -extern const u8 *gGiddyAdjectives[]; -extern const u8 *gGiddyQuestions[]; +extern u16 gUnknown_020388BC; // set but not used? const u16 gDefaultBardSongLyrics[] = { @@ -34,6 +45,33 @@ const u16 gDefaultBardSongLyrics[] = #endif }; +const u8 *const gGiddyAdjectives[] = +{ + OtherText_SoPretty, + OtherText_SoDarling, + OtherText_SoRelaxed, + OtherText_SoSunny, + OtherText_SoDesirable, + OtherText_SoExciting, + OtherText_SoAmusing, + OtherText_SoMagical, +}; + +const u8 *const gGiddyQuestions[] = +{ + OtherText_WantVacationNicePlace, + OtherText_BoughtCrayonsIsNice, + OtherText_IfWeCouldFloat, + OtherText_SandWashesAwayMakeSad, + OtherText_WhatsBottomSeaLike, + OtherText_SeeSettingSun, + OtherText_LyingInGreenGrass, + OtherText_SecretBasesWonderful, +}; + +void sub_80F8184(u8); +void sub_80F8428(void); + void SetupBard(void) { u16 i; @@ -288,7 +326,7 @@ void ScrSpecial_GenerateGiddyLine(void) } else { - StringCopy(gStringVar4, gGiddyQuestions[giddy->mauvilleOldMan_ecArray2[giddy->unk2++]]); + StringCopy(gStringVar4, gGiddyQuestions[giddy->questionList[giddy->questionNum++]]); } if (!(Random() % 10)) @@ -298,3 +336,685 @@ void ScrSpecial_GenerateGiddyLine(void) gScriptResult = TRUE; } + +#ifdef NONMATCHING +void sub_80F7DC0(void) +{ + u16 arr[][2] = + { + { 0x0, 0}, + { 0xC, 0}, + { 0xD, 0}, + {0x12, 0}, + {0x13, 0}, + {0x15, 0}, + }; + u16 i; + u16 r10; + u16 r7; + + for (i = 0; i < 8; i++) + { + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + + //gSaveBlock1.oldMan.giddy.questionList[i] = i; + giddy->questionList[i] = i; + } + + // Scramble questions + for (i = 0; i < 8; i++) + { + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + + /* + u16 r1 = Random() % (i + 1); + u8 r7 = gSaveBlock1.oldMan.giddy.questionList[i]; + gSaveBlock1.oldMan.giddy.questionList[i] = gSaveBlock1.oldMan.giddy.questionList[r1]; + gSaveBlock1.oldMan.giddy.questionList[r1] = r7; + */ + u16 r1 = Random() % (i + 1); + u8 r7 = giddy->questionList[i]; + giddy->questionList[i] = giddy->questionList[r1]; + giddy->questionList[r1] = r7; + } + + r10 = 0; + for (i = 0; i < 6; i++) + { + arr[i][1] = sub_80EAE88(arr[i][0]); + r10 += arr[i][1]; + } + + { + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + giddy->questionNum = 0; + } + //gSaveBlock1.oldMan.giddy.questionNum = 0; + + r7 = 0; + for (i = 0; i < 10; i++) + { + struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + + u16 var = Random() % 10; + if (var < 3 && r7 < 8) + { + //gSaveBlock1.oldMan.giddy.mauvilleOldMan_ecArray[i] = 0xFFFF; + giddy->mauvilleOldMan_ecArray[i] = 0xFFFF; + r7++; + } + //_080F7E90 + else + { + s16 r2 = Random() % r10; + + u16 r1 = 0; + + while (i < 6) // comparing the wrong variable + { + r2 = arr[r1][1] - r2; + if (r2 <= 0) + break; + r1++; + } + + if (r1 == 6) + r1 = 0; + //gSaveBlock1.oldMan.giddy.mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); + giddy->mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); + } + } +} +#else + +const u16 gUnknown_083E53C8[][2] = +{ + { 0x0, 0}, + { 0xC, 0}, + { 0xD, 0}, + {0x12, 0}, + {0x13, 0}, + {0x15, 0}, +}; + +__attribute__((naked)) +void sub_80F7DC0(void) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x18\n\ + ldr r1, _080F7E84 @ =gUnknown_083E53C8\n\ + mov r0, sp\n\ + movs r2, 0x18\n\ + bl memcpy\n\ + movs r5, 0\n\ + movs r0, 0x2\n\ + add r0, sp\n\ + mov r8, r0\n\ + ldr r1, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + adds r1, 0x18\n\ + adds r3, r1, 0\n\ +_080F7DE4:\n\ + adds r0, r3, r5\n\ + strb r5, [r0]\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x7\n\ + bls _080F7DE4\n\ + movs r5, 0\n\ + ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + adds r2, 0x4\n\ + mov r9, r2\n\ + adds r6, r1, 0\n\ +_080F7DFC:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + adds r4, r5, 0x1\n\ + adds r1, r4, 0\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + adds r2, r6, r5\n\ + ldrb r7, [r2]\n\ + adds r1, r6, r1\n\ + ldrb r0, [r1]\n\ + strb r0, [r2]\n\ + strb r7, [r1]\n\ + lsls r4, 16\n\ + lsrs r5, r4, 16\n\ + cmp r5, 0x7\n\ + bls _080F7DFC\n\ + movs r3, 0\n\ + mov r10, r3\n\ + movs r5, 0\n\ +_080F7E2A:\n\ + lsls r4, r5, 2\n\ + mov r1, sp\n\ + adds r0, r1, r4\n\ + ldrb r0, [r0]\n\ + bl sub_80EAE88\n\ + add r4, r8\n\ + strh r0, [r4]\n\ + add r0, r10\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r10, r0\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x5\n\ + bls _080F7E2A\n\ + movs r0, 0\n\ + ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + strb r0, [r2, 0x2]\n\ + movs r7, 0\n\ + movs r5, 0\n\ +_080F7E56:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0xA\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + cmp r1, 0x2\n\ + bhi _080F7E90\n\ + cmp r7, 0x7\n\ + bhi _080F7E90\n\ + lsls r0, r5, 1\n\ + add r0, r9\n\ + ldr r1, _080F7E8C @ =0x0000ffff\n\ + strh r1, [r0]\n\ + adds r0, r7, 0x1\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + adds r4, r5, 0x1\n\ + b _080F7EE2\n\ + .align 2, 0\n\ +_080F7E84: .4byte gUnknown_083E53C8\n\ +_080F7E88: .4byte gSaveBlock1 + 0x2D94\n\ +_080F7E8C: .4byte 0x0000ffff\n\ +_080F7E90:\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r1, r10\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r2, r0, 16\n\ + movs r1, 0\n\ + adds r4, r5, 0x1\n\ + lsls r6, r5, 1\n\ + cmp r5, 0x5\n\ + bhi _080F7ECC\n\ + mov r3, r8\n\ + ldrh r0, [r3]\n\ + b _080F7EC2\n\ +_080F7EB2:\n\ + adds r0, r1, 0x1\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + cmp r5, 0x5\n\ + bhi _080F7ECC\n\ + lsls r0, r1, 2\n\ + adds r0, r3, r0\n\ + ldrh r0, [r0]\n\ +_080F7EC2:\n\ + subs r0, r2, r0\n\ + lsls r0, 16\n\ + lsrs r2, r0, 16\n\ + cmp r0, 0\n\ + bgt _080F7EB2\n\ +_080F7ECC:\n\ + cmp r1, 0x6\n\ + bne _080F7ED2\n\ + movs r1, 0\n\ +_080F7ED2:\n\ + lsls r0, r1, 2\n\ + add r0, sp\n\ + ldrh r0, [r0]\n\ + bl sub_80EB784\n\ + mov r2, r9\n\ + adds r1, r2, r6\n\ + strh r0, [r1]\n\ +_080F7EE2:\n\ + lsls r0, r4, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x9\n\ + bls _080F7E56\n\ + add sp, 0x18\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +void sub_80F7EFC(void) +{ + struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + + bard->unk_2DBD = 0; +} + +void sub_80F7F0C(void) +{ + struct MauvilleManHipster *hipster = &gSaveBlock1.oldMan.hipster; + + hipster->unk1 = 0; +} + +void sub_80F7F18(void) +{ + sub_8109A20(); +} + +void sub_80F7F24(void) +{ + sub_80F8428(); +} + +void sub_80F7F30(void) +{ + switch (GetCurrentMauvilleOldMan()) + { + case MAUVILLE_MAN_BARD: + sub_80F7EFC(); + break; + case MAUVILLE_MAN_HIPSTER: + sub_80F7F0C(); + break; + case MAUVILLE_MAN_STORYTELLER: + sub_80F7F24(); + break; + case MAUVILLE_MAN_TRADER: + sub_80F7F18(); + break; + case MAUVILLE_MAN_GIDDY: + break; + } + sub_80F83D0(); +} + +void sub_80F7F80(u8 a) +{ + u8 taskId = CreateTask(sub_80F8184, 0x50); + + gTasks[taskId].data[5] = a; +} + +void BardSingWord(struct Task *task, struct UnkBard2 *b) +{ + switch (task->data[0]) + { + case 0: + { + struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + u16 *r2; + s32 i; + + if (gSpecialVar_0x8004 == 0) + r2 = bard->songLyrics; + else + r2 = bard->mauvilleOldMan_ecArray2; + for (i = 0; i < 6; i++) + b->var0C[i] = r2[i]; + for (i = 0; i < 6; i++) + { + b->var18[i].var00 = 0xFFFF; + b->var18[i].var02 = 0; + b->var18[i].var04 = 0; + b->var18[i].var06 = 0; + } + b->var00 = 0; + b->var01 = 0; + b->var04 = 0; + } + break; + case 1: + break; + case 2: + { + u16 r4 = b->var0C[b->var00]; + // TODO: fix this return type + struct UnkBard *r1 = (struct UnkBard *)sub_814A2D0(r4 / 0x200, r4 % 0x200); + + b->var04 = 0; + sub_814A2EC(b, r1, (r4 % 4) + ((r4 / 8) & 1)); + } + break; + case 3: + case 4: + { + struct UnkBard3 *r7 = &b->var18[b->var01]; + + switch (b->var03) + { + case 0: + if (b->var02 == 0) + { + if (b->var01 == 6 || r7->var00 == 0xFF) + { + b->var03 = 0xFE; + break; + } + b->var02 = r7->var02; + if (r7->var00 <= 50) + { + u16 r1 = r7->var00 / 3; + + m4aSongNumStart(249 + r1 * 3); + } + b->var03 = 1; + } + else + { + if (b->var0A > 10) + b->volume -= 2; + if (b->var0A & 1) + b->pitch += 64; + else + b->pitch -= 64; + m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, b->volume); + m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, b->pitch); + b->var0A++; + } + b->var02--; + break; + case 1: + b->var01++; + b->var03 = 0; + if (r7->var00 <= 50) + { + b->volume = 0x100 + r7->var06 * 16; + m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, b->volume); + b->pitch = 0x200 + r7->var04; + m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, b->pitch); + } + break; + case 0xFE: + m4aMPlayStop(&gMPlay_SE2); + b->var03 = 0xFF; + break; + } + } + break; + case 5: + break; + } +} + +void sub_80F8184(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; // r5 + + BardSingWord(task, &gUnknown_03005DA0); + switch (task->data[0]) + { + case 0: + sub_80F7BA0(); + InitWindowFromConfig(gMenuWindowPtr, &gWindowConfig_81E6CE4); + sub_8002EB0(gMenuWindowPtr, gStringVar4, 2, 4, 15); + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = 0; + task->data[4] = 0; + FadeOutBGMTemporarily(4); + task->data[0] = 1; + break; + case 1: + if (IsBGMPausedOrStopped()) + task->data[0] = 2; + break; + case 2: + { + struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + u8 *string = gStringVar4 + task->data[3]; + u16 wordLen = 0; + // Can't get it to match without hacking + u32 temp; + register s16 zero asm("r1"); + + while (*string != CHAR_SPACE + && *string != CHAR_NEWLINE + && *string != EXT_CTRL_CODE_BEGIN + && *string != EOS) + { + string++; + wordLen++; + } + if (task->data[5] == 0) + gUnknown_020388BC = MACRO1(bard->songLyrics[task->data[4]]); + else + gUnknown_020388BC = MACRO1(bard->mauvilleOldMan_ecArray2[task->data[4]]); + temp = gUnknown_03005DA0.var04 / wordLen; + zero = 0; + gUnknown_03005DA0.var04 = temp; + if (gUnknown_03005DA0.var04 <= 0) + gUnknown_03005DA0.var04 = 1; + task->data[4]++; + if (task->data[2] == 0) + task->data[0] = 3; + else + task->data[0] = 5; + task->data[1] = zero; + } + break; + case 5: + if (task->data[2] == 0) + task->data[0] = 3; + else + task->data[2]--; + break; + case 3: + if (gStringVar4[task->data[3]] == EOS) + { + FadeInNewBGM(BGM_POKECEN, 6); + m4aMPlayFadeOutTemporarily(&gMPlay_SE2, 2); + EnableBothScriptContexts(); + DestroyTask(taskId); + } + else if (gStringVar4[task->data[3]] == CHAR_SPACE) + { + sub_8003418(gMenuWindowPtr); + task->data[3]++; + task->data[0] = 2; + task->data[2] = 0; + } + else if (gStringVar4[task->data[3]] == CHAR_NEWLINE) + { + task->data[3]++; + task->data[0] = 2; + task->data[2] = 0; + } + else if (gStringVar4[task->data[3]] == EXT_CTRL_CODE_BEGIN) + { + task->data[3] += 2; // skip over control codes + task->data[0] = 2; + task->data[2] = 8; + } + else if (gStringVar4[task->data[3]] == 0x37) // What is 0x37 supposed to be? + { + gStringVar4[task->data[3]] = 0; + sub_8003418(gMenuWindowPtr); + task->data[3]++; + task->data[2] = 0; + } + else + { + switch (task->data[1]) + { + case 0: + sub_8003418(gMenuWindowPtr); + task->data[1]++; + break; + case 1: + task->data[1]++; + break; + case 2: + task->data[3]++; + task->data[1] = 0; + task->data[2] = gUnknown_03005DA0.var04; + task->data[0] = 4; + break; + } + } + break; + case 4: + task->data[2]--; + if (task->data[2] == 0) + task->data[0] = 3; + break; + } +} + +void sub_80F83D0(void) +{ + VarSet(0x4010, 0x45 + GetCurrentMauvilleOldMan()); +} + +void StorytellerSetup(void) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + s32 i; + + storyteller->id = MAUVILLE_MAN_STORYTELLER; + storyteller->unk1 = 0; + for (i = 0; i < 4; i++) + { + storyteller->unk4[i] = 0; + storyteller->unk8[0][i] = EOS; // Maybe they meant storyteller->unk8[i][0] instead? + } +} + +void sub_80F8428(void) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + storyteller->id = MAUVILLE_MAN_STORYTELLER; + storyteller->unk1 = 0; +} + +u32 sub_80F8438(u8 stat) +{ + if (stat == 50) + stat = 0; + GetGameStat(stat); +} + +struct UnknownStruct1 +{ + u8 unk0; + u8 unk1; + const u8 *unk4; + const u8 *unk8; + const u8 *unkC; +}; + +extern const struct UnknownStruct1 gUnknown_083E53E0[]; + +const struct UnknownStruct1 *sub_80F844C(u32 a) +{ + s32 i; + + for (i = 0; i < 36; i++) + { + if (gUnknown_083E53E0[i].unk0 == a) + return &gUnknown_083E53E0[i]; + } + return &gUnknown_083E53E0[35]; +} + +const u8 *sub_80F8478(u32 a) +{ + return sub_80F844C(a)->unk4; +} + +const u8 *sub_80F8484(u32 a) +{ + return sub_80F844C(a)->unkC; +} + +const u8 *sub_80F8490(u32 a) +{ + return sub_80F844C(a)->unk8; +} + +u8 sub_80F849C(void) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + if (storyteller->unk4[i] == 0) + break; + } + return i; +} + +u32 sub_80F84C8(u32 a) +{ + u8 *ptr = gSaveBlock1.oldMan.storyteller.unk24[a]; + + return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); +} + +void sub_80F84EC(u32 a, u32 b) +{ + u8 *ptr = gSaveBlock1.oldMan.storyteller.unk24[a]; + + ptr[0] = b; + ptr[1] = b >> 8; + ptr[2] = b >> 16; + ptr[3] = b >> 24; +} + +bool8 sub_80F8508(u32 a) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + if (sub_80F8438(storyteller->unk4[a]) > sub_80F84C8(a)) + return TRUE; + else + return FALSE; +} + +void sub_80F8534(u32 a, void *b) +{ + u8 *ptr = gSaveBlock1.oldMan.storyteller.unk8[a]; + + memset(b, 0xFF, 8); + memcpy(b, ptr, 7); +} + +void sub_80F8560(u32 a, const u8 *b) +{ + u8 *ptr = gSaveBlock1.oldMan.storyteller.unk8[a]; + u8 len = StringLength(b); + + memset(ptr, 0xFF, 7); + StringCopyN(ptr, b, len); +} + +void sub_80F8598(u32 a, u32 b) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + storyteller->unk4[a] = b; + sub_80F8560(a, gSaveBlock2.playerName); + sub_80F84EC(a, sub_80F8438(b)); + ConvertIntToDecimalStringN(gStringVar1, sub_80F8438(b), 0, 10); + StringCopy(gStringVar2, sub_80F8490(b)); +} -- cgit v1.2.3 From a277e60789d9ea78fe03a4bcded2edf7b91e548e Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 13:40:03 -0500 Subject: finish decompiling mauville_old_man --- src/mauville_old_man.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 165 insertions(+), 3 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 87bc87e3b..9400dfc32 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -4,6 +4,7 @@ #include "easy_chat.h" #include "easy_chat_constants.h" #include "event_data.h" +#include "field_message_box.h" #include "m4a.h" #include "menu.h" #include "rom4.h" @@ -70,6 +71,7 @@ const u8 *const gGiddyQuestions[] = }; void sub_80F8184(u8); +void StorytellerSetup(void); void sub_80F8428(void); void SetupBard(void) @@ -889,7 +891,7 @@ void StorytellerSetup(void) s32 i; storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->unk1 = 0; + storyteller->unk1 = FALSE; for (i = 0; i < 4; i++) { storyteller->unk4[i] = 0; @@ -902,7 +904,7 @@ void sub_80F8428(void) struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->unk1 = 0; + storyteller->unk1 = FALSE; } u32 sub_80F8438(u8 stat) @@ -981,7 +983,7 @@ void sub_80F84EC(u32 a, u32 b) ptr[3] = b >> 24; } -bool8 sub_80F8508(u32 a) +bool32 sub_80F8508(u32 a) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; @@ -1018,3 +1020,163 @@ void sub_80F8598(u32 a, u32 b) ConvertIntToDecimalStringN(gStringVar1, sub_80F8438(b), 0, 10); StringCopy(gStringVar2, sub_80F8490(b)); } + +void sub_80F85FC(u8 *arr, s32 count) +{ + s32 i; + + for (i = 0; i < count; i++) + arr[i] = i; + for (i = 0; i < count; i++) + { + u32 a = Random() % count; + u32 b = Random() % count; + u8 temp = arr[a]; + arr[a] = arr[b]; + arr[b] = temp; + } +} + +extern const struct {u32 unk0; struct MauvilleManStoryteller *unk4; u32 unk8;} gUnknown_083E5620; +/* +static const struct {u32 unk0; struct MauvilleManStoryteller *unk4; u32 unk8;} gUnknown_083E5620 = +{ + 36, + &gSaveBlock1.oldMan.storyteller, + 12, +}; +*/ + +bool8 sub_80F8650(void) +{ + u8 arr[gUnknown_083E5620.unk0]; + s32 i; + s32 j; + + sub_80F85FC(arr, 36); + for (i = 0; i < 36; i++) + { + u8 r4 = gUnknown_083E53E0[arr[i]].unk0; + u8 r6 = gUnknown_083E53E0[arr[i]].unk1; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + for (j = 0; j < 4; j++) + { + if (gSaveBlock1.oldMan.storyteller.unk4[j] == r4) + break; + } + if (j == 4 && sub_80F8438(r4) >= r6) + { + storyteller->unk1 = TRUE; + sub_80F8598(sub_80F849C(), r4); + return TRUE; + } + } + return FALSE; +} + +void sub_80F8700(u32 a) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + u8 r6 = storyteller->unk4[a]; + + ConvertIntToDecimalStringN(gStringVar1, sub_80F84C8(a), 0, 10); + StringCopy(gStringVar2, sub_80F8490(r6)); + sub_80F8534(a, gStringVar3); + ShowFieldMessage(sub_80F8484(r6)); +} + +void sub_80F8758(void) +{ + s32 i; + + MenuDrawTextWindow(0, 0, 25, 4 + sub_80F849C() * 2); + for (i = 0; i < 4; i++) + { + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + u8 r0 = storyteller->unk4[i]; + + if (r0 == 0) + break; + MenuPrint(sub_80F8478(r0), 1, 2 + i * 2); + } + MenuPrint(gPCText_Cancel, 1, 2 + i * 2); +} + +extern u8 gUnknown_03000748; + +void sub_80F87C4(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + s32 selection; + + switch (task->data[0]) + { + case 0: + sub_80F8758(); + InitMenu(0, 1, 2, sub_80F849C() + 1, 0, 24); + task->data[0]++; + break; + case 1: + selection = ProcessMenuInput(); + if (selection == -2) + break; + if (selection == -1 || selection == sub_80F849C()) + { + gScriptResult = 0; + } + else + { + gScriptResult = 1; + gUnknown_03000748 = selection; + } + HandleDestroyMenuCursors(); + MenuZeroFillWindowRect(0, 0, 25, 12); + DestroyTask(taskId); + EnableBothScriptContexts(); + break; + } +} + +void sub_80F8874(void) +{ + CreateTask(sub_80F87C4, 0x50); +} + +void sub_80F8888(void) +{ + sub_80F8700(gUnknown_03000748); +} + +u8 sub_80F889C(void) +{ + return sub_80F849C(); +} + +bool8 sub_80F88AC(void) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + u8 r4 = storyteller->unk4[gUnknown_03000748]; + + if (sub_80F8508(gUnknown_03000748) == TRUE) + { + sub_80F8598(gUnknown_03000748, r4); + return TRUE; + } + return FALSE; +} + +bool8 sub_80F88E0(void) +{ + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + + if (storyteller->unk1 == FALSE) + return FALSE; + else + return TRUE; +} + +bool8 sub_80F88FC(void) +{ + return sub_80F8650(); +} -- cgit v1.2.3 From 1ae38be0a46d1d901a2d9e5bb22938a0cecf6b7f Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 15:19:55 -0500 Subject: do some renaming and reorganizing --- src/mauville_old_man.c | 337 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 242 insertions(+), 95 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 9400dfc32..3bf682ca0 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -23,11 +23,121 @@ extern struct MusicPlayerInfo gMPlay_SE2; extern u16 gScriptResult; extern u16 gSpecialVar_0x8004; + +extern const u8 UnknownString_81AEFFC[]; +extern const u8 UnknownString_81AF013[]; +extern const u8 UnknownString_81AF022[]; +extern const u8 UnknownString_81AF0A3[]; +extern const u8 UnknownString_81AF0BB[]; +extern const u8 UnknownString_81AF0CA[]; +extern const u8 UnknownString_81AF149[]; +extern const u8 UnknownString_81AF164[]; +extern const u8 UnknownString_81AF174[]; +extern const u8 UnknownString_81AF1E5[]; +extern const u8 UnknownString_81AF1FD[]; +extern const u8 UnknownString_81AF20A[]; +extern const u8 UnknownString_81AF281[]; +extern const u8 UnknownString_81AF299[]; +extern const u8 UnknownString_81AF2A9[]; +extern const u8 UnknownString_81AF32C[]; +extern const u8 UnknownString_81AF345[]; +extern const u8 UnknownString_81AF34D[]; +extern const u8 UnknownString_81AF3D0[]; +extern const u8 UnknownString_81AF3ED[]; +extern const u8 UnknownString_81AF3FC[]; +extern const u8 UnknownString_81AF46D[]; +extern const u8 UnknownString_81AF481[]; +extern const u8 UnknownString_81AF49B[]; +extern const u8 UnknownString_81AF511[]; +extern const u8 UnknownString_81AF529[]; +extern const u8 UnknownString_81AF536[]; +extern const u8 UnknownString_81AF5A9[]; +extern const u8 UnknownString_81AF5BD[]; +extern const u8 UnknownString_81AF5CD[]; +extern const u8 UnknownString_81AF63F[]; +extern const u8 UnknownString_81AF661[]; +extern const u8 UnknownString_81AF676[]; +extern const u8 UnknownString_81AF711[]; +extern const u8 UnknownString_81AF726[]; +extern const u8 UnknownString_81AF73D[]; +extern const u8 UnknownString_81AF7BF[]; +extern const u8 UnknownString_81AF7D9[]; +extern const u8 UnknownString_81AF7F1[]; +extern const u8 UnknownString_81AF88A[]; +extern const u8 UnknownString_81AF8A1[]; +extern const u8 UnknownString_81AF8AA[]; +extern const u8 UnknownString_81AF91B[]; +extern const u8 UnknownString_81AF935[]; +extern const u8 UnknownString_81AF943[]; +extern const u8 UnknownString_81AF9C8[]; +extern const u8 UnknownString_81AF9E0[]; +extern const u8 UnknownString_81AF9F6[]; +extern const u8 UnknownString_81AFA79[]; +extern const u8 UnknownString_81AFA92[]; +extern const u8 UnknownString_81AFA9E[]; +extern const u8 UnknownString_81AFB17[]; +extern const u8 UnknownString_81AFB2D[]; +extern const u8 UnknownString_81AFB48[]; +extern const u8 UnknownString_81AFBD8[]; +extern const u8 UnknownString_81AFBE7[]; +extern const u8 UnknownString_81AFC04[]; +extern const u8 UnknownString_81AFC8A[]; +extern const u8 UnknownString_81AFC9D[]; +extern const u8 UnknownString_81AFCBE[]; +extern const u8 UnknownString_81AFD44[]; +extern const u8 UnknownString_81AFD60[]; +extern const u8 UnknownString_81AFD80[]; +extern const u8 UnknownString_81AFE1D[]; +extern const u8 UnknownString_81AFE36[]; +extern const u8 UnknownString_81AFE42[]; +extern const u8 UnknownString_81AFEC2[]; +extern const u8 UnknownString_81AFEDD[]; +extern const u8 UnknownString_81AFEEE[]; +extern const u8 UnknownString_81AFF68[]; +extern const u8 UnknownString_81AFF7B[]; +extern const u8 UnknownString_81AFF88[]; +extern const u8 UnknownString_81AFFFB[]; +extern const u8 UnknownString_81B000D[]; +extern const u8 UnknownString_81B0015[]; +extern const u8 UnknownString_81B009D[]; +extern const u8 UnknownString_81B00B6[]; +extern const u8 UnknownString_81B00C9[]; +extern const u8 UnknownString_81B014D[]; +extern const u8 UnknownString_81B0165[]; +extern const u8 UnknownString_81B0173[]; +extern const u8 UnknownString_81B01E9[]; +extern const u8 UnknownString_81B0201[]; +extern const u8 UnknownString_81B0213[]; +extern const u8 UnknownString_81B0290[]; +extern const u8 UnknownString_81B02A5[]; +extern const u8 UnknownString_81B02B6[]; +extern const u8 UnknownString_81B0337[]; +extern const u8 UnknownString_81B0351[]; +extern const u8 UnknownString_81B0364[]; +extern const u8 UnknownString_81B03E9[]; +extern const u8 UnknownString_81B0401[]; +extern const u8 UnknownString_81B040C[]; +extern const u8 UnknownString_81B046E[]; +extern const u8 UnknownString_81B0489[]; +extern const u8 UnknownString_81B049A[]; +extern const u8 UnknownString_81B0523[]; +extern const u8 UnknownString_81B053E[]; +extern const u8 UnknownString_81B0554[]; +extern const u8 UnknownString_81B05D8[]; +extern const u8 UnknownString_81B05F3[]; +extern const u8 UnknownString_81B0610[]; +extern const u8 UnknownString_81B06A9[]; +extern const u8 UnknownString_81B06C6[]; +extern const u8 UnknownString_81B06D9[]; +extern const u8 UnknownString_81B0763[]; +extern const u8 UnknownString_81B0781[]; +extern const u8 UnknownString_81B0797[]; + extern struct UnkBard2 gUnknown_03005DA0; extern u16 gUnknown_020388BC; // set but not used? -const u16 gDefaultBardSongLyrics[] = +static const u16 gDefaultBardSongLyrics[] = { #ifdef ENGLISH EC_WORD_SISTER, @@ -46,7 +156,7 @@ const u16 gDefaultBardSongLyrics[] = #endif }; -const u8 *const gGiddyAdjectives[] = +static const u8 *const gGiddyAdjectives[] = { OtherText_SoPretty, OtherText_SoDarling, @@ -58,7 +168,7 @@ const u8 *const gGiddyAdjectives[] = OtherText_SoMagical, }; -const u8 *const gGiddyQuestions[] = +static const u8 *const gGiddyQuestions[] = { OtherText_WantVacationNicePlace, OtherText_BoughtCrayonsIsNice, @@ -70,24 +180,25 @@ const u8 *const gGiddyQuestions[] = OtherText_SecretBasesWonderful, }; -void sub_80F8184(u8); +void Task_BardSong(u8); +void StartBardSong(u8); void StorytellerSetup(void); void sub_80F8428(void); void SetupBard(void) { u16 i; - struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; bard->id = MAUVILLE_MAN_BARD; - bard->unk_2DBD = 0; + bard->hasChangedSong = FALSE; for (i = 0; i < 6; i++) bard->songLyrics[i] = gDefaultBardSongLyrics[i]; } void SetupHipster(void) { - struct MauvilleManHipster *hipster = &gSaveBlock1.oldMan.hipster; + struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; hipster->id = MAUVILLE_MAN_HIPSTER; hipster->unk1 = 0; @@ -100,7 +211,7 @@ void SetupStoryteller(void) void SetupGiddy(void) { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; giddy->id = MAUVILLE_MAN_GIDDY; giddy->unk1 = 0; @@ -137,12 +248,14 @@ void SetupMauvilleOldMan(void) sub_80F83D0(); } -/* +//#define TEST MAUVILLE_MAN_BARD + +#ifdef TEST // Safely changes man to test functionality u8 GetCurrentMauvilleOldMan(void) { - u8 newMan = MAUVILLE_MAN_GIDDY; - struct MauvilleManCommon *common = &gSaveBlock1.oldMan.common; + u8 newMan = TEST; + struct MauvilleManCommon *common = &gSaveBlock1.mauvilleMan.common; if (common->id != newMan) { @@ -168,56 +281,56 @@ u8 GetCurrentMauvilleOldMan(void) } return common->id; } -*/ - +#else u8 GetCurrentMauvilleOldMan(void) { - struct MauvilleManCommon *common = &gSaveBlock1.oldMan.common; + struct MauvilleManCommon *common = &gSaveBlock1.mauvilleMan.common; return common->id; } +#endif -void sub_80F7B14(void) +void ScrSpecial_GetCurrentMauvilleMan(void) { gScriptResult = GetCurrentMauvilleOldMan(); } -void sub_80F7B2C(void) +void ScrSpecial_HasBardSongBeenChanged(void) { - u16 *scriptPtr = &gScriptResult; // why?? - OldMan *oldMan = &gSaveBlock1.oldMan; + u16 *scriptResult = &gScriptResult; // why?? + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - *scriptPtr = oldMan->bard.unk_2DBD; + *scriptResult = bard->hasChangedSong; } -void sub_80F7B40(void) +void ScrSpecial_SaveBardSongLyrics(void) { u16 i; - struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; StringCopy(bard->playerName, gSaveBlock2.playerName); - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) bard->playerTrainerId[i] = gSaveBlock2.playerTrainerId[i]; - for(i = 0; i < 6; i++) + for (i = 0; i < 6; i++) bard->songLyrics[i] = bard->mauvilleOldMan_ecArray2[i]; - bard->unk_2DBD = 1; + bard->hasChangedSong = TRUE; } void sub_80F7BA0(void) { - struct MauvilleManBard *oldMan = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; u16 specialVar = gSpecialVar_0x8004; // It's a bit odd to use this temp variable, but it seems needed to match. u16 *r5; u16 i; u8 *ptr; u8 *r4; - r5 = oldMan->mauvilleOldMan_ecArray2; + r5 = bard->mauvilleOldMan_ecArray2; if (specialVar == 0) - r5 = oldMan->songLyrics; + r5 = bard->songLyrics; ptr = gStringVar4; r4 = ptr; for (i = 0; i < 2; i++) @@ -230,7 +343,7 @@ void sub_80F7BA0(void) r4++; } r4++; - *(ptr++) = 0; + *(ptr++) = CHAR_SPACE; ptr = sub_80EB3FC(ptr, *(r5++)); while (ptr != r4) { @@ -239,7 +352,7 @@ void sub_80F7BA0(void) r4++; } r4++; - *(ptr++) = 0xFE; + *(ptr++) = CHAR_NEWLINE; ptr = sub_80EB3FC(ptr, *(r5++)); while (ptr != r4) { @@ -247,7 +360,6 @@ void sub_80F7BA0(void) *r4 = 0x37; r4++; } - //_080F7C2A if (i == 0) { *(ptr++) = EXT_CTRL_CODE_BEGIN; @@ -256,33 +368,33 @@ void sub_80F7BA0(void) } } -void sub_80F7C54(void) +void ScrSpecial_PlayBardSong(void) { - sub_80F7F80(gSpecialVar_0x8004); + StartBardSong(gSpecialVar_0x8004); MenuDisplayMessageBox(); ScriptContext1_Stop(); } void sub_80F7C70(void) { - u16 *scriptPtr = &gScriptResult; // again?? - OldMan *oldMan = &gSaveBlock1.oldMan; + u16 *scriptResult = &gScriptResult; // again?? + struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - *scriptPtr = oldMan->bard.unk_2D95; + *scriptResult = hipster->unk1; } -void sub_80F7C84(void) +void ScrSpecial_SetHipsterSpokenFlag(void) { - OldMan *oldMan = &gSaveBlock1.oldMan; + struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - oldMan->bard.unk_2D95 = 1; + hipster->unk1 = 1; } void sub_80F7C90(void) { u16 var = sub_80EB8EC(); - if(var == 0xFFFF) + if (var == 0xFFFF) { gScriptResult = FALSE; } @@ -295,12 +407,12 @@ void sub_80F7C90(void) void sub_80F7CC8(void) { - OldMan *oldMan = &gSaveBlock1.oldMan; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - if (oldMan->bard.unk_2D95 == 10) + if (bard->unk_2D95 == 10) { gScriptResult = FALSE; - oldMan->bard.unk_2D95 = 0; + bard->unk_2D95 = 0; } else { @@ -310,7 +422,7 @@ void sub_80F7CC8(void) void ScrSpecial_GenerateGiddyLine(void) { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; if (giddy->unk1 == 0) sub_80F7DC0(); @@ -357,22 +469,22 @@ void sub_80F7DC0(void) for (i = 0; i < 8; i++) { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - //gSaveBlock1.oldMan.giddy.questionList[i] = i; + //gSaveBlock1.mauvilleMan.giddy.questionList[i] = i; giddy->questionList[i] = i; } // Scramble questions for (i = 0; i < 8; i++) { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; /* u16 r1 = Random() % (i + 1); - u8 r7 = gSaveBlock1.oldMan.giddy.questionList[i]; - gSaveBlock1.oldMan.giddy.questionList[i] = gSaveBlock1.oldMan.giddy.questionList[r1]; - gSaveBlock1.oldMan.giddy.questionList[r1] = r7; + u8 r7 = gSaveBlock1.mauvilleMan.giddy.questionList[i]; + gSaveBlock1.mauvilleMan.giddy.questionList[i] = gSaveBlock1.mauvilleMan.giddy.questionList[r1]; + gSaveBlock1.mauvilleMan.giddy.questionList[r1] = r7; */ u16 r1 = Random() % (i + 1); u8 r7 = giddy->questionList[i]; @@ -388,20 +500,20 @@ void sub_80F7DC0(void) } { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; giddy->questionNum = 0; } - //gSaveBlock1.oldMan.giddy.questionNum = 0; + //gSaveBlock1.mauvilleMan.giddy.questionNum = 0; r7 = 0; for (i = 0; i < 10; i++) { - struct MauvilleManGiddy *giddy = &gSaveBlock1.oldMan.giddy; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; u16 var = Random() % 10; if (var < 3 && r7 < 8) { - //gSaveBlock1.oldMan.giddy.mauvilleOldMan_ecArray[i] = 0xFFFF; + //gSaveBlock1.mauvilleMan.giddy.mauvilleOldMan_ecArray[i] = 0xFFFF; giddy->mauvilleOldMan_ecArray[i] = 0xFFFF; r7++; } @@ -422,7 +534,7 @@ void sub_80F7DC0(void) if (r1 == 6) r1 = 0; - //gSaveBlock1.oldMan.giddy.mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); + //gSaveBlock1.mauvilleMan.giddy.mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); giddy->mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); } } @@ -604,14 +716,14 @@ _080F7EE2:\n\ void sub_80F7EFC(void) { - struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - bard->unk_2DBD = 0; + bard->hasChangedSong = FALSE; } void sub_80F7F0C(void) { - struct MauvilleManHipster *hipster = &gSaveBlock1.oldMan.hipster; + struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; hipster->unk1 = 0; } @@ -648,9 +760,9 @@ void sub_80F7F30(void) sub_80F83D0(); } -void sub_80F7F80(u8 a) +void StartBardSong(u8 a) { - u8 taskId = CreateTask(sub_80F8184, 0x50); + u8 taskId = CreateTask(Task_BardSong, 0x50); gTasks[taskId].data[5] = a; } @@ -661,7 +773,7 @@ void BardSingWord(struct Task *task, struct UnkBard2 *b) { case 0: { - struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; u16 *r2; s32 i; @@ -756,7 +868,7 @@ void BardSingWord(struct Task *task, struct UnkBard2 *b) } } -void sub_80F8184(u8 taskId) +void Task_BardSong(u8 taskId) { struct Task *task = &gTasks[taskId]; // r5 @@ -780,7 +892,7 @@ void sub_80F8184(u8 taskId) break; case 2: { - struct MauvilleManBard *bard = &gSaveBlock1.oldMan.bard; + struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; u8 *string = gStringVar4 + task->data[3]; u16 wordLen = 0; // Can't get it to match without hacking @@ -885,9 +997,58 @@ void sub_80F83D0(void) VarSet(0x4010, 0x45 + GetCurrentMauvilleOldMan()); } +struct UnknownStruct1 +{ + u8 unk0; + u8 unk1; + const u8 *unk4; + const u8 *unk8; + const u8 *unkC; +}; + +static const struct UnknownStruct1 gUnknown_083E53E0[] = +{ + {0x32, 1, UnknownString_81AEFFC, UnknownString_81AF013, UnknownString_81AF022}, + {0x02, 1, UnknownString_81AF0A3, UnknownString_81AF0BB, UnknownString_81AF0CA}, + {0x03, 1, UnknownString_81AF149, UnknownString_81AF164, UnknownString_81AF174}, + {0x04, 1, UnknownString_81AF1E5, UnknownString_81AF1FD, UnknownString_81AF20A}, + {0x06, 1, UnknownString_81AF281, UnknownString_81AF299, UnknownString_81AF2A9}, + {0x09, 1, UnknownString_81AF32C, UnknownString_81AF345, UnknownString_81AF34D}, + {0x0B, 1, UnknownString_81AF3D0, UnknownString_81AF3ED, UnknownString_81AF3FC}, + {0x0C, 1, UnknownString_81AF46D, UnknownString_81AF481, UnknownString_81AF49B}, + {0x0D, 1, UnknownString_81AF511, UnknownString_81AF529, UnknownString_81AF536}, + {0x0E, 1, UnknownString_81AF5A9, UnknownString_81AF5BD, UnknownString_81AF5CD}, + {0x0F, 1, UnknownString_81AF63F, UnknownString_81AF661, UnknownString_81AF676}, + {0x10, 1, UnknownString_81AF711, UnknownString_81AF726, UnknownString_81AF73D}, + {0x11, 1, UnknownString_81AF7BF, UnknownString_81AF7D9, UnknownString_81AF7F1}, + {0x12, 1, UnknownString_81AF88A, UnknownString_81AF8A1, UnknownString_81AF8AA}, + {0x13, 1, UnknownString_81AF91B, UnknownString_81AF935, UnknownString_81AF943}, + {0x14, 1, UnknownString_81AF9C8, UnknownString_81AF9E0, UnknownString_81AF9F6}, + {0x1A, 1, UnknownString_81AFA79, UnknownString_81AFA92, UnknownString_81AFA9E}, + {0x1B, 1, UnknownString_81AFB17, UnknownString_81AFB2D, UnknownString_81AFB48}, + {0x1C, 1, UnknownString_81AFBD8, UnknownString_81AFBE7, UnknownString_81AFC04}, + {0x1D, 2, UnknownString_81AFC8A, UnknownString_81AFC9D, UnknownString_81AFCBE}, + {0x1E, 1, UnknownString_81AFD44, UnknownString_81AFD60, UnknownString_81AFD80}, + {0x21, 1, UnknownString_81AFE1D, UnknownString_81AFE36, UnknownString_81AFE42}, + {0x24, 1, UnknownString_81AFEC2, UnknownString_81AFEDD, UnknownString_81AFEEE}, + {0x25, 1, UnknownString_81AFF68, UnknownString_81AFF7B, UnknownString_81AFF88}, + {0x26, 1, UnknownString_81AFFFB, UnknownString_81B000D, UnknownString_81B0015}, + {0x27, 1, UnknownString_81B009D, UnknownString_81B00B6, UnknownString_81B00C9}, + {0x28, 1, UnknownString_81B014D, UnknownString_81B0165, UnknownString_81B0173}, + {0x29, 1, UnknownString_81B01E9, UnknownString_81B0201, UnknownString_81B0213}, + {0x2A, 1, UnknownString_81B0290, UnknownString_81B02A5, UnknownString_81B02B6}, + {0x2B, 1, UnknownString_81B0337, UnknownString_81B0351, UnknownString_81B0364}, + {0x2C, 1, UnknownString_81B03E9, UnknownString_81B0401, UnknownString_81B040C}, + {0x2D, 1, UnknownString_81B046E, UnknownString_81B0489, UnknownString_81B049A}, + {0x2E, 1, UnknownString_81B0523, UnknownString_81B053E, UnknownString_81B0554}, + {0x2F, 1, UnknownString_81B05D8, UnknownString_81B05F3, UnknownString_81B0610}, + {0x30, 1, UnknownString_81B06A9, UnknownString_81B06C6, UnknownString_81B06D9}, + {0x31, 1, UnknownString_81B0763, UnknownString_81B0781, UnknownString_81B0797}, +}; + void StorytellerSetup(void) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; s32 i; storyteller->id = MAUVILLE_MAN_STORYTELLER; @@ -901,7 +1062,7 @@ void StorytellerSetup(void) void sub_80F8428(void) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; storyteller->id = MAUVILLE_MAN_STORYTELLER; storyteller->unk1 = FALSE; @@ -914,17 +1075,6 @@ u32 sub_80F8438(u8 stat) GetGameStat(stat); } -struct UnknownStruct1 -{ - u8 unk0; - u8 unk1; - const u8 *unk4; - const u8 *unk8; - const u8 *unkC; -}; - -extern const struct UnknownStruct1 gUnknown_083E53E0[]; - const struct UnknownStruct1 *sub_80F844C(u32 a) { s32 i; @@ -958,7 +1108,7 @@ u8 sub_80F849C(void) for (i = 0; i < 4; i++) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; if (storyteller->unk4[i] == 0) break; @@ -968,14 +1118,14 @@ u8 sub_80F849C(void) u32 sub_80F84C8(u32 a) { - u8 *ptr = gSaveBlock1.oldMan.storyteller.unk24[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[a]; return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); } void sub_80F84EC(u32 a, u32 b) { - u8 *ptr = gSaveBlock1.oldMan.storyteller.unk24[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[a]; ptr[0] = b; ptr[1] = b >> 8; @@ -985,7 +1135,7 @@ void sub_80F84EC(u32 a, u32 b) bool32 sub_80F8508(u32 a) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; if (sub_80F8438(storyteller->unk4[a]) > sub_80F84C8(a)) return TRUE; @@ -995,7 +1145,7 @@ bool32 sub_80F8508(u32 a) void sub_80F8534(u32 a, void *b) { - u8 *ptr = gSaveBlock1.oldMan.storyteller.unk8[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk8[a]; memset(b, 0xFF, 8); memcpy(b, ptr, 7); @@ -1003,7 +1153,7 @@ void sub_80F8534(u32 a, void *b) void sub_80F8560(u32 a, const u8 *b) { - u8 *ptr = gSaveBlock1.oldMan.storyteller.unk8[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk8[a]; u8 len = StringLength(b); memset(ptr, 0xFF, 7); @@ -1012,7 +1162,7 @@ void sub_80F8560(u32 a, const u8 *b) void sub_80F8598(u32 a, u32 b) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; storyteller->unk4[a] = b; sub_80F8560(a, gSaveBlock2.playerName); @@ -1037,19 +1187,16 @@ void sub_80F85FC(u8 *arr, s32 count) } } -extern const struct {u32 unk0; struct MauvilleManStoryteller *unk4; u32 unk8;} gUnknown_083E5620; -/* -static const struct {u32 unk0; struct MauvilleManStoryteller *unk4; u32 unk8;} gUnknown_083E5620 = +static const struct {u32 length; struct MauvilleManStoryteller *unused1; u32 unused2;} gUnknown_083E5620 = { 36, - &gSaveBlock1.oldMan.storyteller, - 12, + &gSaveBlock1.mauvilleMan.storyteller, // unused + 12, // unused }; -*/ bool8 sub_80F8650(void) { - u8 arr[gUnknown_083E5620.unk0]; + u8 arr[gUnknown_083E5620.length]; s32 i; s32 j; @@ -1058,11 +1205,11 @@ bool8 sub_80F8650(void) { u8 r4 = gUnknown_083E53E0[arr[i]].unk0; u8 r6 = gUnknown_083E53E0[arr[i]].unk1; - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; for (j = 0; j < 4; j++) { - if (gSaveBlock1.oldMan.storyteller.unk4[j] == r4) + if (gSaveBlock1.mauvilleMan.storyteller.unk4[j] == r4) break; } if (j == 4 && sub_80F8438(r4) >= r6) @@ -1077,7 +1224,7 @@ bool8 sub_80F8650(void) void sub_80F8700(u32 a) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; u8 r6 = storyteller->unk4[a]; ConvertIntToDecimalStringN(gStringVar1, sub_80F84C8(a), 0, 10); @@ -1093,7 +1240,7 @@ void sub_80F8758(void) MenuDrawTextWindow(0, 0, 25, 4 + sub_80F849C() * 2); for (i = 0; i < 4; i++) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; u8 r0 = storyteller->unk4[i]; if (r0 == 0) @@ -1155,7 +1302,7 @@ u8 sub_80F889C(void) bool8 sub_80F88AC(void) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; u8 r4 = storyteller->unk4[gUnknown_03000748]; if (sub_80F8508(gUnknown_03000748) == TRUE) @@ -1168,7 +1315,7 @@ bool8 sub_80F88AC(void) bool8 sub_80F88E0(void) { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.oldMan.storyteller; + struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; if (storyteller->unk1 == FALSE) return FALSE; -- cgit v1.2.3 From 4a583141ba483dcd49f49760a29c403c5d259efb Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 15:33:07 -0500 Subject: more labeling and fix German build --- src/mauville_old_man.c | 70 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 33 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 3bf682ca0..4edcb1417 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -314,28 +314,29 @@ void ScrSpecial_SaveBardSongLyrics(void) bard->playerTrainerId[i] = gSaveBlock2.playerTrainerId[i]; for (i = 0; i < 6; i++) - bard->songLyrics[i] = bard->mauvilleOldMan_ecArray2[i]; + bard->songLyrics[i] = bard->temporaryLyrics[i]; bard->hasChangedSong = TRUE; } +// prepare song? void sub_80F7BA0(void) { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; u16 specialVar = gSpecialVar_0x8004; // It's a bit odd to use this temp variable, but it seems needed to match. - u16 *r5; + u16 *lyrics; u16 i; u8 *ptr; u8 *r4; - r5 = bard->mauvilleOldMan_ecArray2; + lyrics = bard->temporaryLyrics; if (specialVar == 0) - r5 = bard->songLyrics; + lyrics = bard->songLyrics; ptr = gStringVar4; r4 = ptr; for (i = 0; i < 2; i++) { - ptr = sub_80EB3FC(ptr, *(r5++)); + ptr = sub_80EB3FC(ptr, *(lyrics++)); while (ptr != r4) { if (*r4 == 0) @@ -344,7 +345,7 @@ void sub_80F7BA0(void) } r4++; *(ptr++) = CHAR_SPACE; - ptr = sub_80EB3FC(ptr, *(r5++)); + ptr = sub_80EB3FC(ptr, *(lyrics++)); while (ptr != r4) { if (*r4 == 0) @@ -353,7 +354,7 @@ void sub_80F7BA0(void) } r4++; *(ptr++) = CHAR_NEWLINE; - ptr = sub_80EB3FC(ptr, *(r5++)); + ptr = sub_80EB3FC(ptr, *(lyrics++)); while (ptr != r4) { if (*r4 == 0) @@ -780,7 +781,7 @@ void BardSingWord(struct Task *task, struct UnkBard2 *b) if (gSpecialVar_0x8004 == 0) r2 = bard->songLyrics; else - r2 = bard->mauvilleOldMan_ecArray2; + r2 = bard->temporaryLyrics; for (i = 0; i < 6; i++) b->var0C[i] = r2[i]; for (i = 0; i < 6; i++) @@ -868,12 +869,15 @@ void BardSingWord(struct Task *task, struct UnkBard2 *b) } } +#define tState data[0] +#define tCharIndex data[3] + void Task_BardSong(u8 taskId) { struct Task *task = &gTasks[taskId]; // r5 BardSingWord(task, &gUnknown_03005DA0); - switch (task->data[0]) + switch (task->tState) { case 0: sub_80F7BA0(); @@ -881,19 +885,19 @@ void Task_BardSong(u8 taskId) sub_8002EB0(gMenuWindowPtr, gStringVar4, 2, 4, 15); task->data[1] = 0; task->data[2] = 0; - task->data[3] = 0; + task->tCharIndex = 0; task->data[4] = 0; FadeOutBGMTemporarily(4); - task->data[0] = 1; + task->tState = 1; break; case 1: if (IsBGMPausedOrStopped()) - task->data[0] = 2; + task->tState = 2; break; case 2: { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u8 *string = gStringVar4 + task->data[3]; + u8 *string = gStringVar4 + task->tCharIndex; u16 wordLen = 0; // Can't get it to match without hacking u32 temp; @@ -910,7 +914,7 @@ void Task_BardSong(u8 taskId) if (task->data[5] == 0) gUnknown_020388BC = MACRO1(bard->songLyrics[task->data[4]]); else - gUnknown_020388BC = MACRO1(bard->mauvilleOldMan_ecArray2[task->data[4]]); + gUnknown_020388BC = MACRO1(bard->temporaryLyrics[task->data[4]]); temp = gUnknown_03005DA0.var04 / wordLen; zero = 0; gUnknown_03005DA0.var04 = temp; @@ -918,50 +922,50 @@ void Task_BardSong(u8 taskId) gUnknown_03005DA0.var04 = 1; task->data[4]++; if (task->data[2] == 0) - task->data[0] = 3; + task->tState = 3; else - task->data[0] = 5; + task->tState = 5; task->data[1] = zero; } break; case 5: if (task->data[2] == 0) - task->data[0] = 3; + task->tState = 3; else task->data[2]--; break; case 3: - if (gStringVar4[task->data[3]] == EOS) + if (gStringVar4[task->tCharIndex] == EOS) { FadeInNewBGM(BGM_POKECEN, 6); m4aMPlayFadeOutTemporarily(&gMPlay_SE2, 2); EnableBothScriptContexts(); DestroyTask(taskId); } - else if (gStringVar4[task->data[3]] == CHAR_SPACE) + else if (gStringVar4[task->tCharIndex] == CHAR_SPACE) { sub_8003418(gMenuWindowPtr); - task->data[3]++; - task->data[0] = 2; + task->tCharIndex++; + task->tState = 2; task->data[2] = 0; } - else if (gStringVar4[task->data[3]] == CHAR_NEWLINE) + else if (gStringVar4[task->tCharIndex] == CHAR_NEWLINE) { - task->data[3]++; - task->data[0] = 2; + task->tCharIndex++; + task->tState = 2; task->data[2] = 0; } - else if (gStringVar4[task->data[3]] == EXT_CTRL_CODE_BEGIN) + else if (gStringVar4[task->tCharIndex] == EXT_CTRL_CODE_BEGIN) { - task->data[3] += 2; // skip over control codes - task->data[0] = 2; + task->tCharIndex += 2; // skip over control codes + task->tState = 2; task->data[2] = 8; } - else if (gStringVar4[task->data[3]] == 0x37) // What is 0x37 supposed to be? + else if (gStringVar4[task->tCharIndex] == 0x37) // What is 0x37 supposed to be? { - gStringVar4[task->data[3]] = 0; + gStringVar4[task->tCharIndex] = CHAR_SPACE; sub_8003418(gMenuWindowPtr); - task->data[3]++; + task->tCharIndex++; task->data[2] = 0; } else @@ -976,10 +980,10 @@ void Task_BardSong(u8 taskId) task->data[1]++; break; case 2: - task->data[3]++; + task->tCharIndex++; task->data[1] = 0; task->data[2] = gUnknown_03005DA0.var04; - task->data[0] = 4; + task->tState = 4; break; } } @@ -987,7 +991,7 @@ void Task_BardSong(u8 taskId) case 4: task->data[2]--; if (task->data[2] == 0) - task->data[0] = 3; + task->tState = 3; break; } } -- cgit v1.2.3 From 1b715eb7ba38ff408acf5e5e0a9ea88642f912bb Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 16:52:49 -0500 Subject: more Mauville man labeling --- src/mauville_old_man.c | 360 ++++++++++++++++++++++++------------------------- 1 file changed, 180 insertions(+), 180 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 4edcb1417..e5d661e4a 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -24,114 +24,114 @@ extern struct MusicPlayerInfo gMPlay_SE2; extern u16 gScriptResult; extern u16 gSpecialVar_0x8004; -extern const u8 UnknownString_81AEFFC[]; -extern const u8 UnknownString_81AF013[]; -extern const u8 UnknownString_81AF022[]; -extern const u8 UnknownString_81AF0A3[]; -extern const u8 UnknownString_81AF0BB[]; -extern const u8 UnknownString_81AF0CA[]; -extern const u8 UnknownString_81AF149[]; -extern const u8 UnknownString_81AF164[]; -extern const u8 UnknownString_81AF174[]; -extern const u8 UnknownString_81AF1E5[]; -extern const u8 UnknownString_81AF1FD[]; -extern const u8 UnknownString_81AF20A[]; -extern const u8 UnknownString_81AF281[]; -extern const u8 UnknownString_81AF299[]; -extern const u8 UnknownString_81AF2A9[]; -extern const u8 UnknownString_81AF32C[]; -extern const u8 UnknownString_81AF345[]; -extern const u8 UnknownString_81AF34D[]; -extern const u8 UnknownString_81AF3D0[]; -extern const u8 UnknownString_81AF3ED[]; -extern const u8 UnknownString_81AF3FC[]; -extern const u8 UnknownString_81AF46D[]; -extern const u8 UnknownString_81AF481[]; -extern const u8 UnknownString_81AF49B[]; -extern const u8 UnknownString_81AF511[]; -extern const u8 UnknownString_81AF529[]; -extern const u8 UnknownString_81AF536[]; -extern const u8 UnknownString_81AF5A9[]; -extern const u8 UnknownString_81AF5BD[]; -extern const u8 UnknownString_81AF5CD[]; -extern const u8 UnknownString_81AF63F[]; -extern const u8 UnknownString_81AF661[]; -extern const u8 UnknownString_81AF676[]; -extern const u8 UnknownString_81AF711[]; -extern const u8 UnknownString_81AF726[]; -extern const u8 UnknownString_81AF73D[]; -extern const u8 UnknownString_81AF7BF[]; -extern const u8 UnknownString_81AF7D9[]; -extern const u8 UnknownString_81AF7F1[]; -extern const u8 UnknownString_81AF88A[]; -extern const u8 UnknownString_81AF8A1[]; -extern const u8 UnknownString_81AF8AA[]; -extern const u8 UnknownString_81AF91B[]; -extern const u8 UnknownString_81AF935[]; -extern const u8 UnknownString_81AF943[]; -extern const u8 UnknownString_81AF9C8[]; -extern const u8 UnknownString_81AF9E0[]; -extern const u8 UnknownString_81AF9F6[]; -extern const u8 UnknownString_81AFA79[]; -extern const u8 UnknownString_81AFA92[]; -extern const u8 UnknownString_81AFA9E[]; -extern const u8 UnknownString_81AFB17[]; -extern const u8 UnknownString_81AFB2D[]; -extern const u8 UnknownString_81AFB48[]; -extern const u8 UnknownString_81AFBD8[]; -extern const u8 UnknownString_81AFBE7[]; -extern const u8 UnknownString_81AFC04[]; -extern const u8 UnknownString_81AFC8A[]; -extern const u8 UnknownString_81AFC9D[]; -extern const u8 UnknownString_81AFCBE[]; -extern const u8 UnknownString_81AFD44[]; -extern const u8 UnknownString_81AFD60[]; -extern const u8 UnknownString_81AFD80[]; -extern const u8 UnknownString_81AFE1D[]; -extern const u8 UnknownString_81AFE36[]; -extern const u8 UnknownString_81AFE42[]; -extern const u8 UnknownString_81AFEC2[]; -extern const u8 UnknownString_81AFEDD[]; -extern const u8 UnknownString_81AFEEE[]; -extern const u8 UnknownString_81AFF68[]; -extern const u8 UnknownString_81AFF7B[]; -extern const u8 UnknownString_81AFF88[]; -extern const u8 UnknownString_81AFFFB[]; -extern const u8 UnknownString_81B000D[]; -extern const u8 UnknownString_81B0015[]; -extern const u8 UnknownString_81B009D[]; -extern const u8 UnknownString_81B00B6[]; -extern const u8 UnknownString_81B00C9[]; -extern const u8 UnknownString_81B014D[]; -extern const u8 UnknownString_81B0165[]; -extern const u8 UnknownString_81B0173[]; -extern const u8 UnknownString_81B01E9[]; -extern const u8 UnknownString_81B0201[]; -extern const u8 UnknownString_81B0213[]; -extern const u8 UnknownString_81B0290[]; -extern const u8 UnknownString_81B02A5[]; -extern const u8 UnknownString_81B02B6[]; -extern const u8 UnknownString_81B0337[]; -extern const u8 UnknownString_81B0351[]; -extern const u8 UnknownString_81B0364[]; -extern const u8 UnknownString_81B03E9[]; -extern const u8 UnknownString_81B0401[]; -extern const u8 UnknownString_81B040C[]; -extern const u8 UnknownString_81B046E[]; -extern const u8 UnknownString_81B0489[]; -extern const u8 UnknownString_81B049A[]; -extern const u8 UnknownString_81B0523[]; -extern const u8 UnknownString_81B053E[]; -extern const u8 UnknownString_81B0554[]; -extern const u8 UnknownString_81B05D8[]; -extern const u8 UnknownString_81B05F3[]; -extern const u8 UnknownString_81B0610[]; -extern const u8 UnknownString_81B06A9[]; -extern const u8 UnknownString_81B06C6[]; -extern const u8 UnknownString_81B06D9[]; -extern const u8 UnknownString_81B0763[]; -extern const u8 UnknownString_81B0781[]; -extern const u8 UnknownString_81B0797[]; +extern const u8 gTextStoryteller_Story1Title[]; +extern const u8 gTextStoryteller_Story1Action[]; +extern const u8 gTextStoryteller_Story1Text[]; +extern const u8 gTextStoryteller_Story2Title[]; +extern const u8 gTextStoryteller_Story2Action[]; +extern const u8 gTextStoryteller_Story2Text[]; +extern const u8 gTextStoryteller_Story3Title[]; +extern const u8 gTextStoryteller_Story3Action[]; +extern const u8 gTextStoryteller_Story3Text[]; +extern const u8 gTextStoryteller_Story4Title[]; +extern const u8 gTextStoryteller_Story4Action[]; +extern const u8 gTextStoryteller_Story4Text[]; +extern const u8 gTextStoryteller_Story5Title[]; +extern const u8 gTextStoryteller_Story5Action[]; +extern const u8 gTextStoryteller_Story5Text[]; +extern const u8 gTextStoryteller_Story6Title[]; +extern const u8 gTextStoryteller_Story6Action[]; +extern const u8 gTextStoryteller_Story6Text[]; +extern const u8 gTextStoryteller_Story7Title[]; +extern const u8 gTextStoryteller_Story7Action[]; +extern const u8 gTextStoryteller_Story7Text[]; +extern const u8 gTextStoryteller_Story8Title[]; +extern const u8 gTextStoryteller_Story8Action[]; +extern const u8 gTextStoryteller_Story8Text[]; +extern const u8 gTextStoryteller_Story9Title[]; +extern const u8 gTextStoryteller_Story9Action[]; +extern const u8 gTextStoryteller_Story9Text[]; +extern const u8 gTextStoryteller_Story10Title[]; +extern const u8 gTextStoryteller_Story10Action[]; +extern const u8 gTextStoryteller_Story10Text[]; +extern const u8 gTextStoryteller_Story11Title[]; +extern const u8 gTextStoryteller_Story11Action[]; +extern const u8 gTextStoryteller_Story11Text[]; +extern const u8 gTextStoryteller_Story12Title[]; +extern const u8 gTextStoryteller_Story12Action[]; +extern const u8 gTextStoryteller_Story12Text[]; +extern const u8 gTextStoryteller_Story13Title[]; +extern const u8 gTextStoryteller_Story13Action[]; +extern const u8 gTextStoryteller_Story13Text[]; +extern const u8 gTextStoryteller_Story14Title[]; +extern const u8 gTextStoryteller_Story14Action[]; +extern const u8 gTextStoryteller_Story14Text[]; +extern const u8 gTextStoryteller_Story15Title[]; +extern const u8 gTextStoryteller_Story15Action[]; +extern const u8 gTextStoryteller_Story15Text[]; +extern const u8 gTextStoryteller_Story16Title[]; +extern const u8 gTextStoryteller_Story16Action[]; +extern const u8 gTextStoryteller_Story16Text[]; +extern const u8 gTextStoryteller_Story17Title[]; +extern const u8 gTextStoryteller_Story17Action[]; +extern const u8 gTextStoryteller_Story17Text[]; +extern const u8 gTextStoryteller_Story18Title[]; +extern const u8 gTextStoryteller_Story18Action[]; +extern const u8 gTextStoryteller_Story18Text[]; +extern const u8 gTextStoryteller_Story19Title[]; +extern const u8 gTextStoryteller_Story19Action[]; +extern const u8 gTextStoryteller_Story19Text[]; +extern const u8 gTextStoryteller_Story20Title[]; +extern const u8 gTextStoryteller_Story20Action[]; +extern const u8 gTextStoryteller_Story20Text[]; +extern const u8 gTextStoryteller_Story21Title[]; +extern const u8 gTextStoryteller_Story21Action[]; +extern const u8 gTextStoryteller_Story21Text[]; +extern const u8 gTextStoryteller_Story22Title[]; +extern const u8 gTextStoryteller_Story22Action[]; +extern const u8 gTextStoryteller_Story22Text[]; +extern const u8 gTextStoryteller_Story23Title[]; +extern const u8 gTextStoryteller_Story23Action[]; +extern const u8 gTextStoryteller_Story23Text[]; +extern const u8 gTextStoryteller_Story24Title[]; +extern const u8 gTextStoryteller_Story24Action[]; +extern const u8 gTextStoryteller_Story24Text[]; +extern const u8 gTextStoryteller_Story25Title[]; +extern const u8 gTextStoryteller_Story25Action[]; +extern const u8 gTextStoryteller_Story25Text[]; +extern const u8 gTextStoryteller_Story26Title[]; +extern const u8 gTextStoryteller_Story26Action[]; +extern const u8 gTextStoryteller_Story26Text[]; +extern const u8 gTextStoryteller_Story27Title[]; +extern const u8 gTextStoryteller_Story27Action[]; +extern const u8 gTextStoryteller_Story27Text[]; +extern const u8 gTextStoryteller_Story28Title[]; +extern const u8 gTextStoryteller_Story28Action[]; +extern const u8 gTextStoryteller_Story28Text[]; +extern const u8 gTextStoryteller_Story29Title[]; +extern const u8 gTextStoryteller_Story29Action[]; +extern const u8 gTextStoryteller_Story29Text[]; +extern const u8 gTextStoryteller_Story30Title[]; +extern const u8 gTextStoryteller_Story30Action[]; +extern const u8 gTextStoryteller_Story30Text[]; +extern const u8 gTextStoryteller_Story31Title[]; +extern const u8 gTextStoryteller_Story31Action[]; +extern const u8 gTextStoryteller_Story31Text[]; +extern const u8 gTextStoryteller_Story32Title[]; +extern const u8 gTextStoryteller_Story32Action[]; +extern const u8 gTextStoryteller_Story32Text[]; +extern const u8 gTextStoryteller_Story33Title[]; +extern const u8 gTextStoryteller_Story33Action[]; +extern const u8 gTextStoryteller_Story33Text[]; +extern const u8 gTextStoryteller_Story34Title[]; +extern const u8 gTextStoryteller_Story34Action[]; +extern const u8 gTextStoryteller_Story34Text[]; +extern const u8 gTextStoryteller_Story35Title[]; +extern const u8 gTextStoryteller_Story35Action[]; +extern const u8 gTextStoryteller_Story35Text[]; +extern const u8 gTextStoryteller_Story36Title[]; +extern const u8 gTextStoryteller_Story36Action[]; +extern const u8 gTextStoryteller_Story36Text[]; extern struct UnkBard2 gUnknown_03005DA0; @@ -248,7 +248,7 @@ void SetupMauvilleOldMan(void) sub_80F83D0(); } -//#define TEST MAUVILLE_MAN_BARD +//#define TEST MAUVILLE_MAN_STORYTELLER #ifdef TEST // Safely changes man to test functionality @@ -376,7 +376,7 @@ void ScrSpecial_PlayBardSong(void) ScriptContext1_Stop(); } -void sub_80F7C70(void) +void ScrSpecial_GetHipsterSpokenFlag(void) { u16 *scriptResult = &gScriptResult; // again?? struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; @@ -391,7 +391,7 @@ void ScrSpecial_SetHipsterSpokenFlag(void) hipster->unk1 = 1; } -void sub_80F7C90(void) +void ScrSpecial_HipsterTeachWord(void) { u16 var = sub_80EB8EC(); @@ -1001,53 +1001,53 @@ void sub_80F83D0(void) VarSet(0x4010, 0x45 + GetCurrentMauvilleOldMan()); } -struct UnknownStruct1 +struct Story { u8 unk0; u8 unk1; - const u8 *unk4; - const u8 *unk8; - const u8 *unkC; + const u8 *title; + const u8 *action; + const u8 *fullText; }; -static const struct UnknownStruct1 gUnknown_083E53E0[] = +static const struct Story sStorytellerStories[] = { - {0x32, 1, UnknownString_81AEFFC, UnknownString_81AF013, UnknownString_81AF022}, - {0x02, 1, UnknownString_81AF0A3, UnknownString_81AF0BB, UnknownString_81AF0CA}, - {0x03, 1, UnknownString_81AF149, UnknownString_81AF164, UnknownString_81AF174}, - {0x04, 1, UnknownString_81AF1E5, UnknownString_81AF1FD, UnknownString_81AF20A}, - {0x06, 1, UnknownString_81AF281, UnknownString_81AF299, UnknownString_81AF2A9}, - {0x09, 1, UnknownString_81AF32C, UnknownString_81AF345, UnknownString_81AF34D}, - {0x0B, 1, UnknownString_81AF3D0, UnknownString_81AF3ED, UnknownString_81AF3FC}, - {0x0C, 1, UnknownString_81AF46D, UnknownString_81AF481, UnknownString_81AF49B}, - {0x0D, 1, UnknownString_81AF511, UnknownString_81AF529, UnknownString_81AF536}, - {0x0E, 1, UnknownString_81AF5A9, UnknownString_81AF5BD, UnknownString_81AF5CD}, - {0x0F, 1, UnknownString_81AF63F, UnknownString_81AF661, UnknownString_81AF676}, - {0x10, 1, UnknownString_81AF711, UnknownString_81AF726, UnknownString_81AF73D}, - {0x11, 1, UnknownString_81AF7BF, UnknownString_81AF7D9, UnknownString_81AF7F1}, - {0x12, 1, UnknownString_81AF88A, UnknownString_81AF8A1, UnknownString_81AF8AA}, - {0x13, 1, UnknownString_81AF91B, UnknownString_81AF935, UnknownString_81AF943}, - {0x14, 1, UnknownString_81AF9C8, UnknownString_81AF9E0, UnknownString_81AF9F6}, - {0x1A, 1, UnknownString_81AFA79, UnknownString_81AFA92, UnknownString_81AFA9E}, - {0x1B, 1, UnknownString_81AFB17, UnknownString_81AFB2D, UnknownString_81AFB48}, - {0x1C, 1, UnknownString_81AFBD8, UnknownString_81AFBE7, UnknownString_81AFC04}, - {0x1D, 2, UnknownString_81AFC8A, UnknownString_81AFC9D, UnknownString_81AFCBE}, - {0x1E, 1, UnknownString_81AFD44, UnknownString_81AFD60, UnknownString_81AFD80}, - {0x21, 1, UnknownString_81AFE1D, UnknownString_81AFE36, UnknownString_81AFE42}, - {0x24, 1, UnknownString_81AFEC2, UnknownString_81AFEDD, UnknownString_81AFEEE}, - {0x25, 1, UnknownString_81AFF68, UnknownString_81AFF7B, UnknownString_81AFF88}, - {0x26, 1, UnknownString_81AFFFB, UnknownString_81B000D, UnknownString_81B0015}, - {0x27, 1, UnknownString_81B009D, UnknownString_81B00B6, UnknownString_81B00C9}, - {0x28, 1, UnknownString_81B014D, UnknownString_81B0165, UnknownString_81B0173}, - {0x29, 1, UnknownString_81B01E9, UnknownString_81B0201, UnknownString_81B0213}, - {0x2A, 1, UnknownString_81B0290, UnknownString_81B02A5, UnknownString_81B02B6}, - {0x2B, 1, UnknownString_81B0337, UnknownString_81B0351, UnknownString_81B0364}, - {0x2C, 1, UnknownString_81B03E9, UnknownString_81B0401, UnknownString_81B040C}, - {0x2D, 1, UnknownString_81B046E, UnknownString_81B0489, UnknownString_81B049A}, - {0x2E, 1, UnknownString_81B0523, UnknownString_81B053E, UnknownString_81B0554}, - {0x2F, 1, UnknownString_81B05D8, UnknownString_81B05F3, UnknownString_81B0610}, - {0x30, 1, UnknownString_81B06A9, UnknownString_81B06C6, UnknownString_81B06D9}, - {0x31, 1, UnknownString_81B0763, UnknownString_81B0781, UnknownString_81B0797}, + {0x32, 1, gTextStoryteller_Story1Title, gTextStoryteller_Story1Action, gTextStoryteller_Story1Text}, + {0x02, 1, gTextStoryteller_Story2Title, gTextStoryteller_Story2Action, gTextStoryteller_Story2Text}, + {0x03, 1, gTextStoryteller_Story3Title, gTextStoryteller_Story3Action, gTextStoryteller_Story3Text}, + {0x04, 1, gTextStoryteller_Story4Title, gTextStoryteller_Story4Action, gTextStoryteller_Story4Text}, + {0x06, 1, gTextStoryteller_Story5Title, gTextStoryteller_Story5Action, gTextStoryteller_Story5Text}, + {0x09, 1, gTextStoryteller_Story6Title, gTextStoryteller_Story6Action, gTextStoryteller_Story6Text}, + {0x0B, 1, gTextStoryteller_Story7Title, gTextStoryteller_Story7Action, gTextStoryteller_Story7Text}, + {0x0C, 1, gTextStoryteller_Story8Title, gTextStoryteller_Story8Action, gTextStoryteller_Story8Text}, + {0x0D, 1, gTextStoryteller_Story9Title, gTextStoryteller_Story9Action, gTextStoryteller_Story9Text}, + {0x0E, 1, gTextStoryteller_Story10Title, gTextStoryteller_Story10Action, gTextStoryteller_Story10Text}, + {0x0F, 1, gTextStoryteller_Story11Title, gTextStoryteller_Story11Action, gTextStoryteller_Story11Text}, + {0x10, 1, gTextStoryteller_Story12Title, gTextStoryteller_Story12Action, gTextStoryteller_Story12Text}, + {0x11, 1, gTextStoryteller_Story13Title, gTextStoryteller_Story13Action, gTextStoryteller_Story13Text}, + {0x12, 1, gTextStoryteller_Story14Title, gTextStoryteller_Story14Action, gTextStoryteller_Story14Text}, + {0x13, 1, gTextStoryteller_Story15Title, gTextStoryteller_Story15Action, gTextStoryteller_Story15Text}, + {0x14, 1, gTextStoryteller_Story16Title, gTextStoryteller_Story16Action, gTextStoryteller_Story16Text}, + {0x1A, 1, gTextStoryteller_Story17Title, gTextStoryteller_Story17Action, gTextStoryteller_Story17Text}, + {0x1B, 1, gTextStoryteller_Story18Title, gTextStoryteller_Story18Action, gTextStoryteller_Story18Text}, + {0x1C, 1, gTextStoryteller_Story19Title, gTextStoryteller_Story19Action, gTextStoryteller_Story19Text}, + {0x1D, 2, gTextStoryteller_Story20Title, gTextStoryteller_Story20Action, gTextStoryteller_Story20Text}, + {0x1E, 1, gTextStoryteller_Story21Title, gTextStoryteller_Story21Action, gTextStoryteller_Story21Text}, + {0x21, 1, gTextStoryteller_Story22Title, gTextStoryteller_Story22Action, gTextStoryteller_Story22Text}, + {0x24, 1, gTextStoryteller_Story23Title, gTextStoryteller_Story23Action, gTextStoryteller_Story23Text}, + {0x25, 1, gTextStoryteller_Story24Title, gTextStoryteller_Story24Action, gTextStoryteller_Story24Text}, + {0x26, 1, gTextStoryteller_Story25Title, gTextStoryteller_Story25Action, gTextStoryteller_Story25Text}, + {0x27, 1, gTextStoryteller_Story26Title, gTextStoryteller_Story26Action, gTextStoryteller_Story26Text}, + {0x28, 1, gTextStoryteller_Story27Title, gTextStoryteller_Story27Action, gTextStoryteller_Story27Text}, + {0x29, 1, gTextStoryteller_Story28Title, gTextStoryteller_Story28Action, gTextStoryteller_Story28Text}, + {0x2A, 1, gTextStoryteller_Story29Title, gTextStoryteller_Story29Action, gTextStoryteller_Story29Text}, + {0x2B, 1, gTextStoryteller_Story30Title, gTextStoryteller_Story30Action, gTextStoryteller_Story30Text}, + {0x2C, 1, gTextStoryteller_Story31Title, gTextStoryteller_Story31Action, gTextStoryteller_Story31Text}, + {0x2D, 1, gTextStoryteller_Story32Title, gTextStoryteller_Story32Action, gTextStoryteller_Story32Text}, + {0x2E, 1, gTextStoryteller_Story33Title, gTextStoryteller_Story33Action, gTextStoryteller_Story33Text}, + {0x2F, 1, gTextStoryteller_Story34Title, gTextStoryteller_Story34Action, gTextStoryteller_Story34Text}, + {0x30, 1, gTextStoryteller_Story35Title, gTextStoryteller_Story35Action, gTextStoryteller_Story35Text}, + {0x31, 1, gTextStoryteller_Story36Title, gTextStoryteller_Story36Action, gTextStoryteller_Story36Text}, }; void StorytellerSetup(void) @@ -1060,7 +1060,7 @@ void StorytellerSetup(void) for (i = 0; i < 4; i++) { storyteller->unk4[i] = 0; - storyteller->unk8[0][i] = EOS; // Maybe they meant storyteller->unk8[i][0] instead? + storyteller->playerNames[0][i] = EOS; // Maybe they meant storyteller->playerNames[i][0] instead? } } @@ -1076,34 +1076,34 @@ u32 sub_80F8438(u8 stat) { if (stat == 50) stat = 0; - GetGameStat(stat); + return GetGameStat(stat); } -const struct UnknownStruct1 *sub_80F844C(u32 a) +const struct Story *GetStory(u32 a) { s32 i; for (i = 0; i < 36; i++) { - if (gUnknown_083E53E0[i].unk0 == a) - return &gUnknown_083E53E0[i]; + if (sStorytellerStories[i].unk0 == a) + return &sStorytellerStories[i]; } - return &gUnknown_083E53E0[35]; + return &sStorytellerStories[35]; } const u8 *sub_80F8478(u32 a) { - return sub_80F844C(a)->unk4; + return GetStory(a)->title; } const u8 *sub_80F8484(u32 a) { - return sub_80F844C(a)->unkC; + return GetStory(a)->fullText; } const u8 *sub_80F8490(u32 a) { - return sub_80F844C(a)->unk8; + return GetStory(a)->action; } u8 sub_80F849C(void) @@ -1147,30 +1147,30 @@ bool32 sub_80F8508(u32 a) return FALSE; } -void sub_80F8534(u32 a, void *b) +void GetStorytellerPlayerName(u32 player, void *dst) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk8[a]; + u8 *name = gSaveBlock1.mauvilleMan.storyteller.playerNames[player]; - memset(b, 0xFF, 8); - memcpy(b, ptr, 7); + memset(dst, EOS, 8); + memcpy(dst, name, 7); } -void sub_80F8560(u32 a, const u8 *b) +void SetStorytellerPlayerName(u32 player, const u8 *dst) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk8[a]; - u8 len = StringLength(b); + u8 *name = gSaveBlock1.mauvilleMan.storyteller.playerNames[player]; + u8 len = StringLength(dst); - memset(ptr, 0xFF, 7); - StringCopyN(ptr, b, len); + memset(name, EOS, 7); + StringCopyN(name, dst, len); } -void sub_80F8598(u32 a, u32 b) +void sub_80F8598(u32 player, u32 b) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - storyteller->unk4[a] = b; - sub_80F8560(a, gSaveBlock2.playerName); - sub_80F84EC(a, sub_80F8438(b)); + storyteller->unk4[player] = b; + SetStorytellerPlayerName(player, gSaveBlock2.playerName); + sub_80F84EC(player, sub_80F8438(b)); ConvertIntToDecimalStringN(gStringVar1, sub_80F8438(b), 0, 10); StringCopy(gStringVar2, sub_80F8490(b)); } @@ -1207,8 +1207,8 @@ bool8 sub_80F8650(void) sub_80F85FC(arr, 36); for (i = 0; i < 36; i++) { - u8 r4 = gUnknown_083E53E0[arr[i]].unk0; - u8 r6 = gUnknown_083E53E0[arr[i]].unk1; + u8 r4 = sStorytellerStories[arr[i]].unk0; + u8 r6 = sStorytellerStories[arr[i]].unk1; struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; for (j = 0; j < 4; j++) @@ -1226,14 +1226,14 @@ bool8 sub_80F8650(void) return FALSE; } -void sub_80F8700(u32 a) +void sub_80F8700(u32 player) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r6 = storyteller->unk4[a]; + u8 r6 = storyteller->unk4[player]; - ConvertIntToDecimalStringN(gStringVar1, sub_80F84C8(a), 0, 10); + ConvertIntToDecimalStringN(gStringVar1, sub_80F84C8(player), 0, 10); StringCopy(gStringVar2, sub_80F8490(r6)); - sub_80F8534(a, gStringVar3); + GetStorytellerPlayerName(player, gStringVar3); ShowFieldMessage(sub_80F8484(r6)); } -- cgit v1.2.3 From ded9b4a8d0a59dab3882ab3fe43817bc38bca834 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 19:13:29 -0500 Subject: more labeling --- src/mauville_old_man.c | 214 ++++++++++++++++++++++++++----------------------- 1 file changed, 112 insertions(+), 102 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index e5d661e4a..3cf5265c0 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -133,7 +133,7 @@ extern const u8 gTextStoryteller_Story36Title[]; extern const u8 gTextStoryteller_Story36Action[]; extern const u8 gTextStoryteller_Story36Text[]; -extern struct UnkBard2 gUnknown_03005DA0; +extern struct BardSong gUnknown_03005DA0; extern u16 gUnknown_020388BC; // set but not used? @@ -248,7 +248,7 @@ void SetupMauvilleOldMan(void) sub_80F83D0(); } -//#define TEST MAUVILLE_MAN_STORYTELLER +//#define TEST MAUVILLE_MAN_BARD #ifdef TEST // Safely changes man to test functionality @@ -319,52 +319,58 @@ void ScrSpecial_SaveBardSongLyrics(void) bard->hasChangedSong = TRUE; } -// prepare song? -void sub_80F7BA0(void) +// Copies lyrics into gStringVar4 +void PrepareSongText(void) { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; u16 specialVar = gSpecialVar_0x8004; // It's a bit odd to use this temp variable, but it seems needed to match. u16 *lyrics; - u16 i; - u8 *ptr; - u8 *r4; + u16 lineNum; + u8 *wordEnd; + u8 *str; lyrics = bard->temporaryLyrics; if (specialVar == 0) lyrics = bard->songLyrics; - ptr = gStringVar4; - r4 = ptr; - for (i = 0; i < 2; i++) + wordEnd = gStringVar4; + str = wordEnd; + // Put three words on each line + for (lineNum = 0; lineNum < 2; lineNum++) { - ptr = sub_80EB3FC(ptr, *(lyrics++)); - while (ptr != r4) + wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); + while (wordEnd != str) { - if (*r4 == 0) - *r4 = 0x37; - r4++; + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; } - r4++; - *(ptr++) = CHAR_SPACE; - ptr = sub_80EB3FC(ptr, *(lyrics++)); - while (ptr != r4) + + str++; + *(wordEnd++) = CHAR_SPACE; + + wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); + while (wordEnd != str) { - if (*r4 == 0) - *r4 = 0x37; - r4++; + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; } - r4++; - *(ptr++) = CHAR_NEWLINE; - ptr = sub_80EB3FC(ptr, *(lyrics++)); - while (ptr != r4) + + str++; + *(wordEnd++) = CHAR_NEWLINE; + + wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); + while (wordEnd != str) { - if (*r4 == 0) - *r4 = 0x37; - r4++; + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; } - if (i == 0) + + if (lineNum == 0) { - *(ptr++) = EXT_CTRL_CODE_BEGIN; - *(ptr++) = 0xF; + *(wordEnd++) = EXT_CTRL_CODE_BEGIN; + *(wordEnd++) = 15; } } } @@ -401,7 +407,7 @@ void ScrSpecial_HipsterTeachWord(void) } else { - sub_80EB3FC(gStringVar1, var); + EasyChat_GetWordText(gStringVar1, var); gScriptResult = TRUE; } } @@ -434,7 +440,7 @@ void ScrSpecial_GenerateGiddyLine(void) u32 adjective = Random(); adjective %= 8; - stringPtr = sub_80EB3FC(gStringVar4, giddy->mauvilleOldMan_ecArray[giddy->unk1]); + stringPtr = EasyChat_GetWordText(gStringVar4, giddy->mauvilleOldMan_ecArray[giddy->unk1]); stringPtr = StringCopy(stringPtr, gOtherText_Is); stringPtr = StringCopy(stringPtr, gGiddyAdjectives[adjective]); StringCopy(stringPtr, gOtherText_DontYouAgree); @@ -761,105 +767,112 @@ void sub_80F7F30(void) sub_80F83D0(); } -void StartBardSong(u8 a) +#define tState data[0] +#define tCharIndex data[3] +#define tCurrWord data[4] +#define tUseTemporaryLyrics data[5] + +void StartBardSong(bool8 useTemporaryLyrics) { u8 taskId = CreateTask(Task_BardSong, 0x50); - gTasks[taskId].data[5] = a; + gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics; } -void BardSingWord(struct Task *task, struct UnkBard2 *b) +void BardSingWord(struct Task *task, struct BardSong *song) { - switch (task->data[0]) + switch (task->tState) { - case 0: + case 0: // Initialize song { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u16 *r2; + u16 *lyrics; s32 i; + // Copy lyrics if (gSpecialVar_0x8004 == 0) - r2 = bard->songLyrics; + lyrics = bard->songLyrics; else - r2 = bard->temporaryLyrics; + lyrics = bard->temporaryLyrics; for (i = 0; i < 6; i++) - b->var0C[i] = r2[i]; + song->lyrics[i] = lyrics[i]; + for (i = 0; i < 6; i++) { - b->var18[i].var00 = 0xFFFF; - b->var18[i].var02 = 0; - b->var18[i].var04 = 0; - b->var18[i].var06 = 0; + song->phonemes[i].sound = 0xFFFF; + song->phonemes[i].length = 0; + song->phonemes[i].pitch = 0; + song->phonemes[i].volume = 0; } - b->var00 = 0; - b->var01 = 0; - b->var04 = 0; + song->currWord = 0; + song->currPhoneme = 0; + song->var04 = 0; } break; - case 1: + case 1: // Wait for BGM to end break; - case 2: + case 2: // Initialize word { - u16 r4 = b->var0C[b->var00]; + u16 word = song->lyrics[song->currWord]; // TODO: fix this return type - struct UnkBard *r1 = (struct UnkBard *)sub_814A2D0(r4 / 0x200, r4 % 0x200); + struct UnkBard *sounds = GetWordSoundInfo(EC_GROUP(word), EC_INDEX(word)); - b->var04 = 0; - sub_814A2EC(b, r1, (r4 % 4) + ((r4 / 8) & 1)); + song->var04 = 0; + GetWordPhonemes(song, r1, MACRO1(word)); } break; case 3: case 4: { - struct UnkBard3 *r7 = &b->var18[b->var01]; + struct BardPhoneme *phoneme = &song->phonemes[song->currPhoneme]; - switch (b->var03) + switch (song->state) { case 0: - if (b->var02 == 0) + if (song->phonemeTimer == 0) // Timer has expired. Move to next phoneme { - if (b->var01 == 6 || r7->var00 == 0xFF) + if (song->currPhoneme == 6 || phoneme->sound == 0xFF) { - b->var03 = 0xFE; + song->state = 0xFE; break; } - b->var02 = r7->var02; - if (r7->var00 <= 50) + song->phonemeTimer = phoneme->length; + if (phoneme->sound <= 50) { - u16 r1 = r7->var00 / 3; + u16 num = phoneme->sound / 3; - m4aSongNumStart(249 + r1 * 3); + m4aSongNumStart(249 + num * 3); } - b->var03 = 1; + song->state = 1; } else { - if (b->var0A > 10) - b->volume -= 2; - if (b->var0A & 1) - b->pitch += 64; + if (song->voiceInflection > 10) + song->volume -= 2; + if (song->voiceInflection & 1) + song->pitch += 64; else - b->pitch -= 64; - m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, b->volume); - m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, b->pitch); - b->var0A++; + song->pitch -= 64; + m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, song->volume); + m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, song->pitch); + song->voiceInflection++; } - b->var02--; + song->phonemeTimer--; break; case 1: - b->var01++; - b->var03 = 0; - if (r7->var00 <= 50) + song->currPhoneme++; + song->state = 0; + if (phoneme->sound <= 50) { - b->volume = 0x100 + r7->var06 * 16; - m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, b->volume); - b->pitch = 0x200 + r7->var04; - m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, b->pitch); + song->volume = 0x100 + phoneme->volume * 16; + m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, song->volume); + song->pitch = 0x200 + phoneme->pitch; + m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, song->pitch); } break; case 0xFE: m4aMPlayStop(&gMPlay_SE2); - b->var03 = 0xFF; + song->state = 0xFF; break; } } @@ -869,9 +882,6 @@ void BardSingWord(struct Task *task, struct UnkBard2 *b) } } -#define tState data[0] -#define tCharIndex data[3] - void Task_BardSong(u8 taskId) { struct Task *task = &gTasks[taskId]; // r5 @@ -879,48 +889,48 @@ void Task_BardSong(u8 taskId) BardSingWord(task, &gUnknown_03005DA0); switch (task->tState) { - case 0: - sub_80F7BA0(); + case 0: // Initialize song + PrepareSongText(); InitWindowFromConfig(gMenuWindowPtr, &gWindowConfig_81E6CE4); sub_8002EB0(gMenuWindowPtr, gStringVar4, 2, 4, 15); task->data[1] = 0; task->data[2] = 0; task->tCharIndex = 0; - task->data[4] = 0; + task->tCurrWord = 0; FadeOutBGMTemporarily(4); task->tState = 1; break; - case 1: + case 1: // Wait for BGM to end if (IsBGMPausedOrStopped()) task->tState = 2; break; - case 2: + case 2: // Initialize word { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u8 *string = gStringVar4 + task->tCharIndex; + u8 *str = gStringVar4 + task->tCharIndex; u16 wordLen = 0; // Can't get it to match without hacking u32 temp; register s16 zero asm("r1"); - while (*string != CHAR_SPACE - && *string != CHAR_NEWLINE - && *string != EXT_CTRL_CODE_BEGIN - && *string != EOS) + while (*str != CHAR_SPACE + && *str != CHAR_NEWLINE + && *str != EXT_CTRL_CODE_BEGIN + && *str != EOS) { - string++; + str++; wordLen++; } - if (task->data[5] == 0) - gUnknown_020388BC = MACRO1(bard->songLyrics[task->data[4]]); + if (!task->tUseTemporaryLyrics) + gUnknown_020388BC = MACRO1(bard->songLyrics[task->tCurrWord]); else - gUnknown_020388BC = MACRO1(bard->temporaryLyrics[task->data[4]]); + gUnknown_020388BC = MACRO1(bard->temporaryLyrics[task->tCurrWord]); temp = gUnknown_03005DA0.var04 / wordLen; zero = 0; gUnknown_03005DA0.var04 = temp; if (gUnknown_03005DA0.var04 <= 0) gUnknown_03005DA0.var04 = 1; - task->data[4]++; + task->tCurrWord++; if (task->data[2] == 0) task->tState = 3; else @@ -961,7 +971,7 @@ void Task_BardSong(u8 taskId) task->tState = 2; task->data[2] = 8; } - else if (gStringVar4[task->tCharIndex] == 0x37) // What is 0x37 supposed to be? + else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR) { gStringVar4[task->tCharIndex] = CHAR_SPACE; sub_8003418(gMenuWindowPtr); -- cgit v1.2.3 From df6720ea01ab251c3d90885d75847fc39cc862c9 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 19:26:19 -0500 Subject: fix build --- src/mauville_old_man.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 3cf5265c0..c8bbf8c86 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -815,10 +815,10 @@ void BardSingWord(struct Task *task, struct BardSong *song) { u16 word = song->lyrics[song->currWord]; // TODO: fix this return type - struct UnkBard *sounds = GetWordSoundInfo(EC_GROUP(word), EC_INDEX(word)); + const struct BardSound *sounds = GetWordSounds(EC_GROUP(word), EC_INDEX(word)); song->var04 = 0; - GetWordPhonemes(song, r1, MACRO1(word)); + GetWordPhonemes(song, sounds, MACRO1(word)); } break; case 3: -- cgit v1.2.3 From 19e06e09c9579c8230c66d6d0d267c5b722637e5 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 19:37:36 -0500 Subject: actually fix build --- src/mauville_old_man.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index c8bbf8c86..9e392a65a 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -797,6 +797,7 @@ void BardSingWord(struct Task *task, struct BardSong *song) for (i = 0; i < 6; i++) song->lyrics[i] = lyrics[i]; + // Clear phonemes for (i = 0; i < 6; i++) { song->phonemes[i].sound = 0xFFFF; @@ -814,7 +815,6 @@ void BardSingWord(struct Task *task, struct BardSong *song) case 2: // Initialize word { u16 word = song->lyrics[song->currWord]; - // TODO: fix this return type const struct BardSound *sounds = GetWordSounds(EC_GROUP(word), EC_INDEX(word)); song->var04 = 0; @@ -973,7 +973,7 @@ void Task_BardSong(u8 taskId) } else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR) { - gStringVar4[task->tCharIndex] = CHAR_SPACE; + gStringVar4[task->tCharIndex] = CHAR_SPACE; // restore it back to a space sub_8003418(gMenuWindowPtr); task->tCharIndex++; task->data[2] = 0; -- cgit v1.2.3 From 670255f950a98f8a5cc636a20682b9ed42a31b21 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 19:54:39 -0500 Subject: fix build for real this time --- src/mauville_old_man.c | 82 +++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 9e392a65a..a5b5cb914 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1013,8 +1013,8 @@ void sub_80F83D0(void) struct Story { - u8 unk0; - u8 unk1; + u8 stat; + u8 minVal; const u8 *title; const u8 *action; const u8 *fullText; @@ -1069,8 +1069,8 @@ void StorytellerSetup(void) storyteller->unk1 = FALSE; for (i = 0; i < 4; i++) { - storyteller->unk4[i] = 0; - storyteller->playerNames[0][i] = EOS; // Maybe they meant storyteller->playerNames[i][0] instead? + storyteller->gameStatIDs[i] = 0; + storyteller->trainerNames[0][i] = EOS; // Maybe they meant storyteller->trainerNames[i][0] instead? } } @@ -1082,36 +1082,36 @@ void sub_80F8428(void) storyteller->unk1 = FALSE; } -u32 sub_80F8438(u8 stat) +u32 StorytellerGetGameStat(u8 stat) { - if (stat == 50) + if (stat == NUM_GAME_STATS) stat = 0; return GetGameStat(stat); } -const struct Story *GetStory(u32 a) +const struct Story *GetStory(u32 stat) { s32 i; for (i = 0; i < 36; i++) { - if (sStorytellerStories[i].unk0 == a) + if (sStorytellerStories[i].stat == stat) return &sStorytellerStories[i]; } return &sStorytellerStories[35]; } -const u8 *sub_80F8478(u32 a) +const u8 *GetStoryTitle(u32 a) { return GetStory(a)->title; } -const u8 *sub_80F8484(u32 a) +const u8 *GetStoryText(u32 a) { return GetStory(a)->fullText; } -const u8 *sub_80F8490(u32 a) +const u8 *GetStoryAction(u32 a) { return GetStory(a)->action; } @@ -1124,34 +1124,34 @@ u8 sub_80F849C(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - if (storyteller->unk4[i] == 0) + if (storyteller->gameStatIDs[i] == 0) break; } return i; } -u32 sub_80F84C8(u32 a) +u32 StorytellerGetRecordedTrainerStat(u32 trainer) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[trainer]; return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); } -void sub_80F84EC(u32 a, u32 b) +void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[a]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[trainer]; - ptr[0] = b; - ptr[1] = b >> 8; - ptr[2] = b >> 16; - ptr[3] = b >> 24; + ptr[0] = val; + ptr[1] = val >> 8; + ptr[2] = val >> 16; + ptr[3] = val >> 24; } -bool32 sub_80F8508(u32 a) +bool32 sub_80F8508(u32 trainer) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - if (sub_80F8438(storyteller->unk4[a]) > sub_80F84C8(a)) + if (StorytellerGetGameStat(storyteller->gameStatIDs[trainer]) > StorytellerGetRecordedTrainerStat(trainer)) return TRUE; else return FALSE; @@ -1159,7 +1159,7 @@ bool32 sub_80F8508(u32 a) void GetStorytellerPlayerName(u32 player, void *dst) { - u8 *name = gSaveBlock1.mauvilleMan.storyteller.playerNames[player]; + u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; memset(dst, EOS, 8); memcpy(dst, name, 7); @@ -1167,22 +1167,22 @@ void GetStorytellerPlayerName(u32 player, void *dst) void SetStorytellerPlayerName(u32 player, const u8 *dst) { - u8 *name = gSaveBlock1.mauvilleMan.storyteller.playerNames[player]; + u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; u8 len = StringLength(dst); memset(name, EOS, 7); StringCopyN(name, dst, len); } -void sub_80F8598(u32 player, u32 b) +void sub_80F8598(u32 player, u32 stat) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - storyteller->unk4[player] = b; + storyteller->gameStatIDs[player] = stat; SetStorytellerPlayerName(player, gSaveBlock2.playerName); - sub_80F84EC(player, sub_80F8438(b)); - ConvertIntToDecimalStringN(gStringVar1, sub_80F8438(b), 0, 10); - StringCopy(gStringVar2, sub_80F8490(b)); + StorytellerSetRecordedTrainerStat(player, StorytellerGetGameStat(stat)); + ConvertIntToDecimalStringN(gStringVar1, StorytellerGetGameStat(stat), 0, 10); + StringCopy(gStringVar2, GetStoryAction(stat)); } void sub_80F85FC(u8 *arr, s32 count) @@ -1217,19 +1217,19 @@ bool8 sub_80F8650(void) sub_80F85FC(arr, 36); for (i = 0; i < 36; i++) { - u8 r4 = sStorytellerStories[arr[i]].unk0; - u8 r6 = sStorytellerStories[arr[i]].unk1; + u8 stat = sStorytellerStories[arr[i]].stat; + u8 minVal = sStorytellerStories[arr[i]].minVal; struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; for (j = 0; j < 4; j++) { - if (gSaveBlock1.mauvilleMan.storyteller.unk4[j] == r4) + if (gSaveBlock1.mauvilleMan.storyteller.gameStatIDs[j] == stat) break; } - if (j == 4 && sub_80F8438(r4) >= r6) + if (j == 4 && StorytellerGetGameStat(stat) >= minVal) { storyteller->unk1 = TRUE; - sub_80F8598(sub_80F849C(), r4); + sub_80F8598(sub_80F849C(), stat); return TRUE; } } @@ -1239,12 +1239,12 @@ bool8 sub_80F8650(void) void sub_80F8700(u32 player) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r6 = storyteller->unk4[player]; + u8 r6 = storyteller->gameStatIDs[player]; - ConvertIntToDecimalStringN(gStringVar1, sub_80F84C8(player), 0, 10); - StringCopy(gStringVar2, sub_80F8490(r6)); + ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), 0, 10); + StringCopy(gStringVar2, GetStoryAction(r6)); GetStorytellerPlayerName(player, gStringVar3); - ShowFieldMessage(sub_80F8484(r6)); + ShowFieldMessage(GetStoryText(r6)); } void sub_80F8758(void) @@ -1255,11 +1255,11 @@ void sub_80F8758(void) for (i = 0; i < 4; i++) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r0 = storyteller->unk4[i]; + u8 r0 = storyteller->gameStatIDs[i]; if (r0 == 0) break; - MenuPrint(sub_80F8478(r0), 1, 2 + i * 2); + MenuPrint(GetStoryTitle(r0), 1, 2 + i * 2); } MenuPrint(gPCText_Cancel, 1, 2 + i * 2); } @@ -1317,7 +1317,7 @@ u8 sub_80F889C(void) bool8 sub_80F88AC(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r4 = storyteller->unk4[gUnknown_03000748]; + u8 r4 = storyteller->gameStatIDs[gUnknown_03000748]; if (sub_80F8508(gUnknown_03000748) == TRUE) { -- cgit v1.2.3 From 8c57ef0fad270bc795d0b64a75d96fafc0f63513 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 20:50:39 -0500 Subject: finish labeling script --- src/mauville_old_man.c | 143 +++++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 70 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index a5b5cb914..6feee5184 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -214,7 +214,7 @@ void SetupGiddy(void) struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; giddy->id = MAUVILLE_MAN_GIDDY; - giddy->unk1 = 0; + giddy->taleCounter = 0; } void SetupTrader(void) @@ -248,7 +248,7 @@ void SetupMauvilleOldMan(void) sub_80F83D0(); } -//#define TEST MAUVILLE_MAN_BARD +//#define TEST MAUVILLE_MAN_STORYTELLER #ifdef TEST // Safely changes man to test functionality @@ -344,10 +344,10 @@ void PrepareSongText(void) *str = CHAR_SONG_WORD_SEPARATOR; str++; } - + str++; *(wordEnd++) = CHAR_SPACE; - + wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); while (wordEnd != str) { @@ -355,10 +355,10 @@ void PrepareSongText(void) *str = CHAR_SONG_WORD_SEPARATOR; str++; } - + str++; *(wordEnd++) = CHAR_NEWLINE; - + wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); while (wordEnd != str) { @@ -366,7 +366,7 @@ void PrepareSongText(void) *str = CHAR_SONG_WORD_SEPARATOR; str++; } - + if (lineNum == 0) { *(wordEnd++) = EXT_CTRL_CODE_BEGIN; @@ -412,14 +412,14 @@ void ScrSpecial_HipsterTeachWord(void) } } -void sub_80F7CC8(void) +void ScrSpecial_GiddyShouldTellAnotherTale(void) { - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; + struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - if (bard->unk_2D95 == 10) + if (giddy->taleCounter == 10) { gScriptResult = FALSE; - bard->unk_2D95 = 0; + giddy->taleCounter = 0; } else { @@ -431,16 +431,16 @@ void ScrSpecial_GenerateGiddyLine(void) { struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - if (giddy->unk1 == 0) + if (giddy->taleCounter == 0) sub_80F7DC0(); - if (giddy->mauvilleOldMan_ecArray[giddy->unk1] != 0xFFFF) // is not the last element of the array? + if (giddy->randomWords[giddy->taleCounter] != 0xFFFF) // is not the last element of the array? { u8 *stringPtr; u32 adjective = Random(); adjective %= 8; - stringPtr = EasyChat_GetWordText(gStringVar4, giddy->mauvilleOldMan_ecArray[giddy->unk1]); + stringPtr = EasyChat_GetWordText(gStringVar4, giddy->randomWords[giddy->taleCounter]); stringPtr = StringCopy(stringPtr, gOtherText_Is); stringPtr = StringCopy(stringPtr, gGiddyAdjectives[adjective]); StringCopy(stringPtr, gOtherText_DontYouAgree); @@ -451,9 +451,9 @@ void ScrSpecial_GenerateGiddyLine(void) } if (!(Random() % 10)) - giddy->unk1 = 10; + giddy->taleCounter = 10; else - giddy->unk1++; + giddy->taleCounter++; gScriptResult = TRUE; } @@ -520,8 +520,8 @@ void sub_80F7DC0(void) u16 var = Random() % 10; if (var < 3 && r7 < 8) { - //gSaveBlock1.mauvilleMan.giddy.mauvilleOldMan_ecArray[i] = 0xFFFF; - giddy->mauvilleOldMan_ecArray[i] = 0xFFFF; + //gSaveBlock1.mauvilleMan.giddy.randomWords[i] = 0xFFFF; + giddy->randomWords[i] = 0xFFFF; r7++; } //_080F7E90 @@ -541,8 +541,8 @@ void sub_80F7DC0(void) if (r1 == 6) r1 = 0; - //gSaveBlock1.mauvilleMan.giddy.mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); - giddy->mauvilleOldMan_ecArray[i] = sub_80EB784(arr[r1][0]); + //gSaveBlock1.mauvilleMan.giddy.randomWords[i] = sub_80EB784(arr[r1][0]); + giddy->randomWords[i] = sub_80EB784(arr[r1][0]); } } } @@ -796,7 +796,7 @@ void BardSingWord(struct Task *task, struct BardSong *song) lyrics = bard->temporaryLyrics; for (i = 0; i < 6; i++) song->lyrics[i] = lyrics[i]; - + // Clear phonemes for (i = 0; i < 6; i++) { @@ -1089,7 +1089,7 @@ u32 StorytellerGetGameStat(u8 stat) return GetGameStat(stat); } -const struct Story *GetStory(u32 stat) +const struct Story *GetStoryByStat(u32 stat) { s32 i; @@ -1101,22 +1101,22 @@ const struct Story *GetStory(u32 stat) return &sStorytellerStories[35]; } -const u8 *GetStoryTitle(u32 a) +const u8 *GetStoryTitleByStat(u32 stat) { - return GetStory(a)->title; + return GetStoryByStat(stat)->title; } -const u8 *GetStoryText(u32 a) +const u8 *GetStoryTextByStat(u32 stat) { - return GetStory(a)->fullText; + return GetStoryByStat(stat)->fullText; } -const u8 *GetStoryAction(u32 a) +const u8 *GetStoryActionByStat(u32 stat) { - return GetStory(a)->action; + return GetStoryByStat(stat)->action; } -u8 sub_80F849C(void) +u8 GetFreeStorySlot(void) { u8 i; @@ -1147,7 +1147,7 @@ void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) ptr[3] = val >> 24; } -bool32 sub_80F8508(u32 trainer) +bool32 HasTrainerStatIncreased(u32 trainer) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; @@ -1157,7 +1157,7 @@ bool32 sub_80F8508(u32 trainer) return FALSE; } -void GetStorytellerPlayerName(u32 player, void *dst) +void GetStoryByStattellerPlayerName(u32 player, void *dst) { u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; @@ -1165,27 +1165,27 @@ void GetStorytellerPlayerName(u32 player, void *dst) memcpy(dst, name, 7); } -void SetStorytellerPlayerName(u32 player, const u8 *dst) +void StorytellerSetPlayerName(u32 player, const u8 *src) { u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; - u8 len = StringLength(dst); + u8 len = StringLength(src); memset(name, EOS, 7); - StringCopyN(name, dst, len); + StringCopyN(name, src, len); } -void sub_80F8598(u32 player, u32 stat) +void StorytellerRecordNewStat(u32 player, u32 stat) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; storyteller->gameStatIDs[player] = stat; - SetStorytellerPlayerName(player, gSaveBlock2.playerName); + StorytellerSetPlayerName(player, gSaveBlock2.playerName); StorytellerSetRecordedTrainerStat(player, StorytellerGetGameStat(stat)); ConvertIntToDecimalStringN(gStringVar1, StorytellerGetGameStat(stat), 0, 10); - StringCopy(gStringVar2, GetStoryAction(stat)); + StringCopy(gStringVar2, GetStoryActionByStat(stat)); } -void sub_80F85FC(u8 *arr, s32 count) +void ScrambleStatList(u8 *arr, s32 count) { s32 i; @@ -1201,20 +1201,21 @@ void sub_80F85FC(u8 *arr, s32 count) } } -static const struct {u32 length; struct MauvilleManStoryteller *unused1; u32 unused2;} gUnknown_083E5620 = +// What purpose does this struct even serve? Only the length field is used. +static const struct {u32 length; struct MauvilleManStoryteller *unused1; u32 unused2;} sStorytellerStuff = { 36, &gSaveBlock1.mauvilleMan.storyteller, // unused - 12, // unused + 12, // unused }; -bool8 sub_80F8650(void) +bool8 StorytellerInitializeRandomStat(void) { - u8 arr[gUnknown_083E5620.length]; + u8 arr[sStorytellerStuff.length]; s32 i; s32 j; - sub_80F85FC(arr, 36); + ScrambleStatList(arr, 36); for (i = 0; i < 36; i++) { u8 stat = sStorytellerStories[arr[i]].stat; @@ -1229,44 +1230,44 @@ bool8 sub_80F8650(void) if (j == 4 && StorytellerGetGameStat(stat) >= minVal) { storyteller->unk1 = TRUE; - sub_80F8598(sub_80F849C(), stat); + StorytellerRecordNewStat(GetFreeStorySlot(), stat); return TRUE; } } return FALSE; } -void sub_80F8700(u32 player) +void StorytellerDisplayStory(u32 player) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r6 = storyteller->gameStatIDs[player]; + u8 stat = storyteller->gameStatIDs[player]; ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), 0, 10); - StringCopy(gStringVar2, GetStoryAction(r6)); - GetStorytellerPlayerName(player, gStringVar3); - ShowFieldMessage(GetStoryText(r6)); + StringCopy(gStringVar2, GetStoryActionByStat(stat)); + GetStoryByStattellerPlayerName(player, gStringVar3); + ShowFieldMessage(GetStoryTextByStat(stat)); } -void sub_80F8758(void) +void PrintStoryList(void) { s32 i; - MenuDrawTextWindow(0, 0, 25, 4 + sub_80F849C() * 2); + MenuDrawTextWindow(0, 0, 25, 4 + GetFreeStorySlot() * 2); for (i = 0; i < 4; i++) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r0 = storyteller->gameStatIDs[i]; + u8 stat = storyteller->gameStatIDs[i]; - if (r0 == 0) + if (stat == 0) break; - MenuPrint(GetStoryTitle(r0), 1, 2 + i * 2); + MenuPrint(GetStoryTitleByStat(stat), 1, 2 + i * 2); } MenuPrint(gPCText_Cancel, 1, 2 + i * 2); } extern u8 gUnknown_03000748; -void sub_80F87C4(u8 taskId) +void Task_StoryListMenu(u8 taskId) { struct Task *task = &gTasks[taskId]; s32 selection; @@ -1274,15 +1275,15 @@ void sub_80F87C4(u8 taskId) switch (task->data[0]) { case 0: - sub_80F8758(); - InitMenu(0, 1, 2, sub_80F849C() + 1, 0, 24); + PrintStoryList(); + InitMenu(0, 1, 2, GetFreeStorySlot() + 1, 0, 24); task->data[0]++; break; case 1: selection = ProcessMenuInput(); if (selection == -2) break; - if (selection == -1 || selection == sub_80F849C()) + if (selection == -1 || selection == GetFreeStorySlot()) { gScriptResult = 0; } @@ -1299,35 +1300,37 @@ void sub_80F87C4(u8 taskId) } } -void sub_80F8874(void) +// Sets gScriptResult to TRUE if player selected a story +void ScrSpecial_StorytellerStoryListMenu(void) { - CreateTask(sub_80F87C4, 0x50); + CreateTask(Task_StoryListMenu, 0x50); } -void sub_80F8888(void) +void ScrSpecial_StorytellerDisplayStory(void) { - sub_80F8700(gUnknown_03000748); + StorytellerDisplayStory(gUnknown_03000748); } -u8 sub_80F889C(void) +u8 ScrSpecial_StorytellerGetFreeStorySlot(void) { - return sub_80F849C(); + return GetFreeStorySlot(); } -bool8 sub_80F88AC(void) +// Returns TRUE if stat has increased +bool8 ScrSpecial_StorytellerUpdateStat(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; u8 r4 = storyteller->gameStatIDs[gUnknown_03000748]; - if (sub_80F8508(gUnknown_03000748) == TRUE) + if (HasTrainerStatIncreased(gUnknown_03000748) == TRUE) { - sub_80F8598(gUnknown_03000748, r4); + StorytellerRecordNewStat(gUnknown_03000748, r4); return TRUE; } return FALSE; } -bool8 sub_80F88E0(void) +bool8 ScrSpecial_HasStorytellerAlreadyRecorded(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; @@ -1337,7 +1340,7 @@ bool8 sub_80F88E0(void) return TRUE; } -bool8 sub_80F88FC(void) +bool8 ScrSpecial_StorytellerInitializeRandomStat(void) { - return sub_80F8650(); + return StorytellerInitializeRandomStat(); } -- cgit v1.2.3 From b6ea4d9a77cdb6b416d3dd94eef68ce8a56cd4eb Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Thu, 24 Aug 2017 21:18:07 -0500 Subject: label more stuff in mauville_old_man.c --- src/mauville_old_man.c | 150 +++++++++++++++++++------------------------------ 1 file changed, 58 insertions(+), 92 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 6feee5184..2f58e65fc 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -135,9 +135,9 @@ extern const u8 gTextStoryteller_Story36Text[]; extern struct BardSong gUnknown_03005DA0; -extern u16 gUnknown_020388BC; // set but not used? +EWRAM_DATA static u16 gUnknown_020388BC = 0; // set but not used? -static const u16 gDefaultBardSongLyrics[] = +static const u16 sDefaultBardSongLyrics[] = { #ifdef ENGLISH EC_WORD_SISTER, @@ -156,7 +156,7 @@ static const u16 gDefaultBardSongLyrics[] = #endif }; -static const u8 *const gGiddyAdjectives[] = +static const u8 *const sGiddyAdjectives[] = { OtherText_SoPretty, OtherText_SoDarling, @@ -168,7 +168,7 @@ static const u8 *const gGiddyAdjectives[] = OtherText_SoMagical, }; -static const u8 *const gGiddyQuestions[] = +static const u8 *const sGiddyQuestions[] = { OtherText_WantVacationNicePlace, OtherText_BoughtCrayonsIsNice, @@ -180,12 +180,13 @@ static const u8 *const gGiddyQuestions[] = OtherText_SecretBasesWonderful, }; -void Task_BardSong(u8); -void StartBardSong(u8); -void StorytellerSetup(void); -void sub_80F8428(void); +static void sub_80F7DC0(void); +static void Task_BardSong(u8); +static void StartBardSong(u8); +static void StorytellerSetup(void); +static void sub_80F8428(void); -void SetupBard(void) +static void SetupBard(void) { u16 i; struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; @@ -193,23 +194,23 @@ void SetupBard(void) bard->id = MAUVILLE_MAN_BARD; bard->hasChangedSong = FALSE; for (i = 0; i < 6; i++) - bard->songLyrics[i] = gDefaultBardSongLyrics[i]; + bard->songLyrics[i] = sDefaultBardSongLyrics[i]; } -void SetupHipster(void) +static void SetupHipster(void) { struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; hipster->id = MAUVILLE_MAN_HIPSTER; - hipster->unk1 = 0; + hipster->alreadySpoken = FALSE; } -void SetupStoryteller(void) +static void SetupStoryteller(void) { StorytellerSetup(); } -void SetupGiddy(void) +static void SetupGiddy(void) { struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; @@ -217,7 +218,7 @@ void SetupGiddy(void) giddy->taleCounter = 0; } -void SetupTrader(void) +static void SetupTrader(void) { TraderSetup(); } @@ -248,47 +249,12 @@ void SetupMauvilleOldMan(void) sub_80F83D0(); } -//#define TEST MAUVILLE_MAN_STORYTELLER - -#ifdef TEST -// Safely changes man to test functionality -u8 GetCurrentMauvilleOldMan(void) -{ - u8 newMan = TEST; - struct MauvilleManCommon *common = &gSaveBlock1.mauvilleMan.common; - - if (common->id != newMan) - { - switch (newMan) - { - case MAUVILLE_MAN_BARD: - SetupBard(); - break; - case MAUVILLE_MAN_HIPSTER: - SetupHipster(); - break; - case MAUVILLE_MAN_TRADER: - SetupTrader(); - break; - case MAUVILLE_MAN_STORYTELLER: - SetupStoryteller(); - break; - case MAUVILLE_MAN_GIDDY: - SetupGiddy(); - break; - } - sub_80F83D0(); - } - return common->id; -} -#else -u8 GetCurrentMauvilleOldMan(void) +static u8 GetCurrentMauvilleOldMan(void) { struct MauvilleManCommon *common = &gSaveBlock1.mauvilleMan.common; return common->id; } -#endif void ScrSpecial_GetCurrentMauvilleMan(void) { @@ -387,14 +353,14 @@ void ScrSpecial_GetHipsterSpokenFlag(void) u16 *scriptResult = &gScriptResult; // again?? struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - *scriptResult = hipster->unk1; + *scriptResult = hipster->alreadySpoken; } void ScrSpecial_SetHipsterSpokenFlag(void) { struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - hipster->unk1 = 1; + hipster->alreadySpoken = TRUE; } void ScrSpecial_HipsterTeachWord(void) @@ -442,12 +408,12 @@ void ScrSpecial_GenerateGiddyLine(void) adjective %= 8; stringPtr = EasyChat_GetWordText(gStringVar4, giddy->randomWords[giddy->taleCounter]); stringPtr = StringCopy(stringPtr, gOtherText_Is); - stringPtr = StringCopy(stringPtr, gGiddyAdjectives[adjective]); + stringPtr = StringCopy(stringPtr, sGiddyAdjectives[adjective]); StringCopy(stringPtr, gOtherText_DontYouAgree); } else { - StringCopy(gStringVar4, gGiddyQuestions[giddy->questionList[giddy->questionNum++]]); + StringCopy(gStringVar4, sGiddyQuestions[giddy->questionList[giddy->questionNum++]]); } if (!(Random() % 10)) @@ -459,7 +425,7 @@ void ScrSpecial_GenerateGiddyLine(void) } #ifdef NONMATCHING -void sub_80F7DC0(void) +static void sub_80F7DC0(void) { u16 arr[][2] = { @@ -548,7 +514,7 @@ void sub_80F7DC0(void) } #else -const u16 gUnknown_083E53C8[][2] = +static const u16 gUnknown_083E53C8[][2] = { { 0x0, 0}, { 0xC, 0}, @@ -559,7 +525,7 @@ const u16 gUnknown_083E53C8[][2] = }; __attribute__((naked)) -void sub_80F7DC0(void) +static void sub_80F7DC0(void) { asm(".syntax unified\n\ push {r4-r7,lr}\n\ @@ -721,26 +687,26 @@ _080F7EE2:\n\ } #endif -void sub_80F7EFC(void) +static void sub_80F7EFC(void) { struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; bard->hasChangedSong = FALSE; } -void sub_80F7F0C(void) +static void sub_80F7F0C(void) { struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - hipster->unk1 = 0; + hipster->alreadySpoken = FALSE; } -void sub_80F7F18(void) +static void sub_80F7F18(void) { sub_8109A20(); } -void sub_80F7F24(void) +static void sub_80F7F24(void) { sub_80F8428(); } @@ -772,14 +738,14 @@ void sub_80F7F30(void) #define tCurrWord data[4] #define tUseTemporaryLyrics data[5] -void StartBardSong(bool8 useTemporaryLyrics) +static void StartBardSong(bool8 useTemporaryLyrics) { u8 taskId = CreateTask(Task_BardSong, 0x50); gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics; } -void BardSingWord(struct Task *task, struct BardSong *song) +static void BardSing(struct Task *task, struct BardSong *song) { switch (task->tState) { @@ -882,11 +848,11 @@ void BardSingWord(struct Task *task, struct BardSong *song) } } -void Task_BardSong(u8 taskId) +static void Task_BardSong(u8 taskId) { struct Task *task = &gTasks[taskId]; // r5 - BardSingWord(task, &gUnknown_03005DA0); + BardSing(task, &gUnknown_03005DA0); switch (task->tState) { case 0: // Initialize song @@ -1060,13 +1026,13 @@ static const struct Story sStorytellerStories[] = {0x31, 1, gTextStoryteller_Story36Title, gTextStoryteller_Story36Action, gTextStoryteller_Story36Text}, }; -void StorytellerSetup(void) +static void StorytellerSetup(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; s32 i; storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->unk1 = FALSE; + storyteller->alreadyRecorded = FALSE; for (i = 0; i < 4; i++) { storyteller->gameStatIDs[i] = 0; @@ -1074,22 +1040,22 @@ void StorytellerSetup(void) } } -void sub_80F8428(void) +static void sub_80F8428(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->unk1 = FALSE; + storyteller->alreadyRecorded = FALSE; } -u32 StorytellerGetGameStat(u8 stat) +static u32 StorytellerGetGameStat(u8 stat) { if (stat == NUM_GAME_STATS) stat = 0; return GetGameStat(stat); } -const struct Story *GetStoryByStat(u32 stat) +static const struct Story *GetStoryByStat(u32 stat) { s32 i; @@ -1101,22 +1067,22 @@ const struct Story *GetStoryByStat(u32 stat) return &sStorytellerStories[35]; } -const u8 *GetStoryTitleByStat(u32 stat) +static const u8 *GetStoryTitleByStat(u32 stat) { return GetStoryByStat(stat)->title; } -const u8 *GetStoryTextByStat(u32 stat) +static const u8 *GetStoryTextByStat(u32 stat) { return GetStoryByStat(stat)->fullText; } -const u8 *GetStoryActionByStat(u32 stat) +static const u8 *GetStoryActionByStat(u32 stat) { return GetStoryByStat(stat)->action; } -u8 GetFreeStorySlot(void) +static u8 GetFreeStorySlot(void) { u8 i; @@ -1130,16 +1096,16 @@ u8 GetFreeStorySlot(void) return i; } -u32 StorytellerGetRecordedTrainerStat(u32 trainer) +static u32 StorytellerGetRecordedTrainerStat(u32 trainer) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[trainer]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.statValues[trainer]; return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); } -void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) +static void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) { - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.unk24[trainer]; + u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.statValues[trainer]; ptr[0] = val; ptr[1] = val >> 8; @@ -1147,7 +1113,7 @@ void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) ptr[3] = val >> 24; } -bool32 HasTrainerStatIncreased(u32 trainer) +static bool32 HasTrainerStatIncreased(u32 trainer) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; @@ -1157,7 +1123,7 @@ bool32 HasTrainerStatIncreased(u32 trainer) return FALSE; } -void GetStoryByStattellerPlayerName(u32 player, void *dst) +static void GetStoryByStattellerPlayerName(u32 player, void *dst) { u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; @@ -1165,7 +1131,7 @@ void GetStoryByStattellerPlayerName(u32 player, void *dst) memcpy(dst, name, 7); } -void StorytellerSetPlayerName(u32 player, const u8 *src) +static void StorytellerSetPlayerName(u32 player, const u8 *src) { u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; u8 len = StringLength(src); @@ -1174,7 +1140,7 @@ void StorytellerSetPlayerName(u32 player, const u8 *src) StringCopyN(name, src, len); } -void StorytellerRecordNewStat(u32 player, u32 stat) +static void StorytellerRecordNewStat(u32 player, u32 stat) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; @@ -1185,7 +1151,7 @@ void StorytellerRecordNewStat(u32 player, u32 stat) StringCopy(gStringVar2, GetStoryActionByStat(stat)); } -void ScrambleStatList(u8 *arr, s32 count) +static void ScrambleStatList(u8 *arr, s32 count) { s32 i; @@ -1209,7 +1175,7 @@ static const struct {u32 length; struct MauvilleManStoryteller *unused1; u32 unu 12, // unused }; -bool8 StorytellerInitializeRandomStat(void) +static bool8 StorytellerInitializeRandomStat(void) { u8 arr[sStorytellerStuff.length]; s32 i; @@ -1229,7 +1195,7 @@ bool8 StorytellerInitializeRandomStat(void) } if (j == 4 && StorytellerGetGameStat(stat) >= minVal) { - storyteller->unk1 = TRUE; + storyteller->alreadyRecorded = TRUE; StorytellerRecordNewStat(GetFreeStorySlot(), stat); return TRUE; } @@ -1237,7 +1203,7 @@ bool8 StorytellerInitializeRandomStat(void) return FALSE; } -void StorytellerDisplayStory(u32 player) +static void StorytellerDisplayStory(u32 player) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; u8 stat = storyteller->gameStatIDs[player]; @@ -1248,7 +1214,7 @@ void StorytellerDisplayStory(u32 player) ShowFieldMessage(GetStoryTextByStat(stat)); } -void PrintStoryList(void) +static void PrintStoryList(void) { s32 i; @@ -1267,7 +1233,7 @@ void PrintStoryList(void) extern u8 gUnknown_03000748; -void Task_StoryListMenu(u8 taskId) +static void Task_StoryListMenu(u8 taskId) { struct Task *task = &gTasks[taskId]; s32 selection; @@ -1334,7 +1300,7 @@ bool8 ScrSpecial_HasStorytellerAlreadyRecorded(void) { struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - if (storyteller->unk1 == FALSE) + if (storyteller->alreadyRecorded == FALSE) return FALSE; else return TRUE; -- cgit v1.2.3 From a9fa94206520cfde8a7f66bc078b0955e415d5d2 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Mon, 28 Aug 2017 21:08:09 -0500 Subject: oops --- src/mauville_old_man.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 2f58e65fc..50a6756f9 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -2,7 +2,6 @@ #include "bard_music.h" #include "mauville_old_man.h" #include "easy_chat.h" -#include "easy_chat_constants.h" #include "event_data.h" #include "field_message_box.h" #include "m4a.h" -- cgit v1.2.3 From 7f9ea1cd6df4c55bf2c198e40bc8634db8480412 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Tue, 29 Aug 2017 11:14:58 -0500 Subject: tabs to spaces --- src/mauville_old_man.c | 354 ++++++++++++++++++++++++------------------------- 1 file changed, 177 insertions(+), 177 deletions(-) (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 50a6756f9..d54e017f7 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -527,161 +527,161 @@ __attribute__((naked)) static void sub_80F7DC0(void) { asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x18\n\ - ldr r1, _080F7E84 @ =gUnknown_083E53C8\n\ - mov r0, sp\n\ - movs r2, 0x18\n\ - bl memcpy\n\ - movs r5, 0\n\ - movs r0, 0x2\n\ - add r0, sp\n\ - mov r8, r0\n\ - ldr r1, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - adds r1, 0x18\n\ - adds r3, r1, 0\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x18\n\ + ldr r1, _080F7E84 @ =gUnknown_083E53C8\n\ + mov r0, sp\n\ + movs r2, 0x18\n\ + bl memcpy\n\ + movs r5, 0\n\ + movs r0, 0x2\n\ + add r0, sp\n\ + mov r8, r0\n\ + ldr r1, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + adds r1, 0x18\n\ + adds r3, r1, 0\n\ _080F7DE4:\n\ - adds r0, r3, r5\n\ - strb r5, [r0]\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x7\n\ - bls _080F7DE4\n\ - movs r5, 0\n\ - ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - adds r2, 0x4\n\ - mov r9, r2\n\ - adds r6, r1, 0\n\ + adds r0, r3, r5\n\ + strb r5, [r0]\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x7\n\ + bls _080F7DE4\n\ + movs r5, 0\n\ + ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + adds r2, 0x4\n\ + mov r9, r2\n\ + adds r6, r1, 0\n\ _080F7DFC:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - adds r4, r5, 0x1\n\ - adds r1, r4, 0\n\ - bl __modsi3\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - adds r2, r6, r5\n\ - ldrb r7, [r2]\n\ - adds r1, r6, r1\n\ - ldrb r0, [r1]\n\ - strb r0, [r2]\n\ - strb r7, [r1]\n\ - lsls r4, 16\n\ - lsrs r5, r4, 16\n\ - cmp r5, 0x7\n\ - bls _080F7DFC\n\ - movs r3, 0\n\ - mov r10, r3\n\ - movs r5, 0\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + adds r4, r5, 0x1\n\ + adds r1, r4, 0\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + adds r2, r6, r5\n\ + ldrb r7, [r2]\n\ + adds r1, r6, r1\n\ + ldrb r0, [r1]\n\ + strb r0, [r2]\n\ + strb r7, [r1]\n\ + lsls r4, 16\n\ + lsrs r5, r4, 16\n\ + cmp r5, 0x7\n\ + bls _080F7DFC\n\ + movs r3, 0\n\ + mov r10, r3\n\ + movs r5, 0\n\ _080F7E2A:\n\ - lsls r4, r5, 2\n\ - mov r1, sp\n\ - adds r0, r1, r4\n\ - ldrb r0, [r0]\n\ - bl sub_80EAE88\n\ - add r4, r8\n\ - strh r0, [r4]\n\ - add r0, r10\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - mov r10, r0\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x5\n\ - bls _080F7E2A\n\ - movs r0, 0\n\ - ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - strb r0, [r2, 0x2]\n\ - movs r7, 0\n\ - movs r5, 0\n\ + lsls r4, r5, 2\n\ + mov r1, sp\n\ + adds r0, r1, r4\n\ + ldrb r0, [r0]\n\ + bl sub_80EAE88\n\ + add r4, r8\n\ + strh r0, [r4]\n\ + add r0, r10\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r10, r0\n\ + adds r0, r5, 0x1\n\ + lsls r0, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x5\n\ + bls _080F7E2A\n\ + movs r0, 0\n\ + ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ + strb r0, [r2, 0x2]\n\ + movs r7, 0\n\ + movs r5, 0\n\ _080F7E56:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - movs r1, 0xA\n\ - bl __umodsi3\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - cmp r1, 0x2\n\ - bhi _080F7E90\n\ - cmp r7, 0x7\n\ - bhi _080F7E90\n\ - lsls r0, r5, 1\n\ - add r0, r9\n\ - ldr r1, _080F7E8C @ =0x0000ffff\n\ - strh r1, [r0]\n\ - adds r0, r7, 0x1\n\ - lsls r0, 16\n\ - lsrs r7, r0, 16\n\ - adds r4, r5, 0x1\n\ - b _080F7EE2\n\ - .align 2, 0\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0xA\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + cmp r1, 0x2\n\ + bhi _080F7E90\n\ + cmp r7, 0x7\n\ + bhi _080F7E90\n\ + lsls r0, r5, 1\n\ + add r0, r9\n\ + ldr r1, _080F7E8C @ =0x0000ffff\n\ + strh r1, [r0]\n\ + adds r0, r7, 0x1\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + adds r4, r5, 0x1\n\ + b _080F7EE2\n\ + .align 2, 0\n\ _080F7E84: .4byte gUnknown_083E53C8\n\ _080F7E88: .4byte gSaveBlock1 + 0x2D94\n\ _080F7E8C: .4byte 0x0000ffff\n\ _080F7E90:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - mov r1, r10\n\ - bl __umodsi3\n\ - lsls r0, 16\n\ - lsrs r2, r0, 16\n\ - movs r1, 0\n\ - adds r4, r5, 0x1\n\ - lsls r6, r5, 1\n\ - cmp r5, 0x5\n\ - bhi _080F7ECC\n\ - mov r3, r8\n\ - ldrh r0, [r3]\n\ - b _080F7EC2\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + mov r1, r10\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r2, r0, 16\n\ + movs r1, 0\n\ + adds r4, r5, 0x1\n\ + lsls r6, r5, 1\n\ + cmp r5, 0x5\n\ + bhi _080F7ECC\n\ + mov r3, r8\n\ + ldrh r0, [r3]\n\ + b _080F7EC2\n\ _080F7EB2:\n\ - adds r0, r1, 0x1\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - cmp r5, 0x5\n\ - bhi _080F7ECC\n\ - lsls r0, r1, 2\n\ - adds r0, r3, r0\n\ - ldrh r0, [r0]\n\ + adds r0, r1, 0x1\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + cmp r5, 0x5\n\ + bhi _080F7ECC\n\ + lsls r0, r1, 2\n\ + adds r0, r3, r0\n\ + ldrh r0, [r0]\n\ _080F7EC2:\n\ - subs r0, r2, r0\n\ - lsls r0, 16\n\ - lsrs r2, r0, 16\n\ - cmp r0, 0\n\ - bgt _080F7EB2\n\ + subs r0, r2, r0\n\ + lsls r0, 16\n\ + lsrs r2, r0, 16\n\ + cmp r0, 0\n\ + bgt _080F7EB2\n\ _080F7ECC:\n\ - cmp r1, 0x6\n\ - bne _080F7ED2\n\ - movs r1, 0\n\ + cmp r1, 0x6\n\ + bne _080F7ED2\n\ + movs r1, 0\n\ _080F7ED2:\n\ - lsls r0, r1, 2\n\ - add r0, sp\n\ - ldrh r0, [r0]\n\ - bl sub_80EB784\n\ - mov r2, r9\n\ - adds r1, r2, r6\n\ - strh r0, [r1]\n\ + lsls r0, r1, 2\n\ + add r0, sp\n\ + ldrh r0, [r0]\n\ + bl sub_80EB784\n\ + mov r2, r9\n\ + adds r1, r2, r6\n\ + strh r0, [r1]\n\ _080F7EE2:\n\ - lsls r0, r4, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x9\n\ - bls _080F7E56\n\ - add sp, 0x18\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ + lsls r0, r4, 16\n\ + lsrs r5, r0, 16\n\ + cmp r5, 0x9\n\ + bls _080F7E56\n\ + add sp, 0x18\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ .syntax divided\n"); } #endif @@ -987,41 +987,41 @@ struct Story static const struct Story sStorytellerStories[] = { - {0x32, 1, gTextStoryteller_Story1Title, gTextStoryteller_Story1Action, gTextStoryteller_Story1Text}, - {0x02, 1, gTextStoryteller_Story2Title, gTextStoryteller_Story2Action, gTextStoryteller_Story2Text}, - {0x03, 1, gTextStoryteller_Story3Title, gTextStoryteller_Story3Action, gTextStoryteller_Story3Text}, - {0x04, 1, gTextStoryteller_Story4Title, gTextStoryteller_Story4Action, gTextStoryteller_Story4Text}, - {0x06, 1, gTextStoryteller_Story5Title, gTextStoryteller_Story5Action, gTextStoryteller_Story5Text}, - {0x09, 1, gTextStoryteller_Story6Title, gTextStoryteller_Story6Action, gTextStoryteller_Story6Text}, - {0x0B, 1, gTextStoryteller_Story7Title, gTextStoryteller_Story7Action, gTextStoryteller_Story7Text}, - {0x0C, 1, gTextStoryteller_Story8Title, gTextStoryteller_Story8Action, gTextStoryteller_Story8Text}, - {0x0D, 1, gTextStoryteller_Story9Title, gTextStoryteller_Story9Action, gTextStoryteller_Story9Text}, - {0x0E, 1, gTextStoryteller_Story10Title, gTextStoryteller_Story10Action, gTextStoryteller_Story10Text}, - {0x0F, 1, gTextStoryteller_Story11Title, gTextStoryteller_Story11Action, gTextStoryteller_Story11Text}, - {0x10, 1, gTextStoryteller_Story12Title, gTextStoryteller_Story12Action, gTextStoryteller_Story12Text}, - {0x11, 1, gTextStoryteller_Story13Title, gTextStoryteller_Story13Action, gTextStoryteller_Story13Text}, - {0x12, 1, gTextStoryteller_Story14Title, gTextStoryteller_Story14Action, gTextStoryteller_Story14Text}, - {0x13, 1, gTextStoryteller_Story15Title, gTextStoryteller_Story15Action, gTextStoryteller_Story15Text}, - {0x14, 1, gTextStoryteller_Story16Title, gTextStoryteller_Story16Action, gTextStoryteller_Story16Text}, - {0x1A, 1, gTextStoryteller_Story17Title, gTextStoryteller_Story17Action, gTextStoryteller_Story17Text}, - {0x1B, 1, gTextStoryteller_Story18Title, gTextStoryteller_Story18Action, gTextStoryteller_Story18Text}, - {0x1C, 1, gTextStoryteller_Story19Title, gTextStoryteller_Story19Action, gTextStoryteller_Story19Text}, - {0x1D, 2, gTextStoryteller_Story20Title, gTextStoryteller_Story20Action, gTextStoryteller_Story20Text}, - {0x1E, 1, gTextStoryteller_Story21Title, gTextStoryteller_Story21Action, gTextStoryteller_Story21Text}, - {0x21, 1, gTextStoryteller_Story22Title, gTextStoryteller_Story22Action, gTextStoryteller_Story22Text}, - {0x24, 1, gTextStoryteller_Story23Title, gTextStoryteller_Story23Action, gTextStoryteller_Story23Text}, - {0x25, 1, gTextStoryteller_Story24Title, gTextStoryteller_Story24Action, gTextStoryteller_Story24Text}, - {0x26, 1, gTextStoryteller_Story25Title, gTextStoryteller_Story25Action, gTextStoryteller_Story25Text}, - {0x27, 1, gTextStoryteller_Story26Title, gTextStoryteller_Story26Action, gTextStoryteller_Story26Text}, - {0x28, 1, gTextStoryteller_Story27Title, gTextStoryteller_Story27Action, gTextStoryteller_Story27Text}, - {0x29, 1, gTextStoryteller_Story28Title, gTextStoryteller_Story28Action, gTextStoryteller_Story28Text}, - {0x2A, 1, gTextStoryteller_Story29Title, gTextStoryteller_Story29Action, gTextStoryteller_Story29Text}, - {0x2B, 1, gTextStoryteller_Story30Title, gTextStoryteller_Story30Action, gTextStoryteller_Story30Text}, - {0x2C, 1, gTextStoryteller_Story31Title, gTextStoryteller_Story31Action, gTextStoryteller_Story31Text}, - {0x2D, 1, gTextStoryteller_Story32Title, gTextStoryteller_Story32Action, gTextStoryteller_Story32Text}, - {0x2E, 1, gTextStoryteller_Story33Title, gTextStoryteller_Story33Action, gTextStoryteller_Story33Text}, - {0x2F, 1, gTextStoryteller_Story34Title, gTextStoryteller_Story34Action, gTextStoryteller_Story34Text}, - {0x30, 1, gTextStoryteller_Story35Title, gTextStoryteller_Story35Action, gTextStoryteller_Story35Text}, + {0x32, 1, gTextStoryteller_Story1Title, gTextStoryteller_Story1Action, gTextStoryteller_Story1Text}, + {0x02, 1, gTextStoryteller_Story2Title, gTextStoryteller_Story2Action, gTextStoryteller_Story2Text}, + {0x03, 1, gTextStoryteller_Story3Title, gTextStoryteller_Story3Action, gTextStoryteller_Story3Text}, + {0x04, 1, gTextStoryteller_Story4Title, gTextStoryteller_Story4Action, gTextStoryteller_Story4Text}, + {0x06, 1, gTextStoryteller_Story5Title, gTextStoryteller_Story5Action, gTextStoryteller_Story5Text}, + {0x09, 1, gTextStoryteller_Story6Title, gTextStoryteller_Story6Action, gTextStoryteller_Story6Text}, + {0x0B, 1, gTextStoryteller_Story7Title, gTextStoryteller_Story7Action, gTextStoryteller_Story7Text}, + {0x0C, 1, gTextStoryteller_Story8Title, gTextStoryteller_Story8Action, gTextStoryteller_Story8Text}, + {0x0D, 1, gTextStoryteller_Story9Title, gTextStoryteller_Story9Action, gTextStoryteller_Story9Text}, + {0x0E, 1, gTextStoryteller_Story10Title, gTextStoryteller_Story10Action, gTextStoryteller_Story10Text}, + {0x0F, 1, gTextStoryteller_Story11Title, gTextStoryteller_Story11Action, gTextStoryteller_Story11Text}, + {0x10, 1, gTextStoryteller_Story12Title, gTextStoryteller_Story12Action, gTextStoryteller_Story12Text}, + {0x11, 1, gTextStoryteller_Story13Title, gTextStoryteller_Story13Action, gTextStoryteller_Story13Text}, + {0x12, 1, gTextStoryteller_Story14Title, gTextStoryteller_Story14Action, gTextStoryteller_Story14Text}, + {0x13, 1, gTextStoryteller_Story15Title, gTextStoryteller_Story15Action, gTextStoryteller_Story15Text}, + {0x14, 1, gTextStoryteller_Story16Title, gTextStoryteller_Story16Action, gTextStoryteller_Story16Text}, + {0x1A, 1, gTextStoryteller_Story17Title, gTextStoryteller_Story17Action, gTextStoryteller_Story17Text}, + {0x1B, 1, gTextStoryteller_Story18Title, gTextStoryteller_Story18Action, gTextStoryteller_Story18Text}, + {0x1C, 1, gTextStoryteller_Story19Title, gTextStoryteller_Story19Action, gTextStoryteller_Story19Text}, + {0x1D, 2, gTextStoryteller_Story20Title, gTextStoryteller_Story20Action, gTextStoryteller_Story20Text}, + {0x1E, 1, gTextStoryteller_Story21Title, gTextStoryteller_Story21Action, gTextStoryteller_Story21Text}, + {0x21, 1, gTextStoryteller_Story22Title, gTextStoryteller_Story22Action, gTextStoryteller_Story22Text}, + {0x24, 1, gTextStoryteller_Story23Title, gTextStoryteller_Story23Action, gTextStoryteller_Story23Text}, + {0x25, 1, gTextStoryteller_Story24Title, gTextStoryteller_Story24Action, gTextStoryteller_Story24Text}, + {0x26, 1, gTextStoryteller_Story25Title, gTextStoryteller_Story25Action, gTextStoryteller_Story25Text}, + {0x27, 1, gTextStoryteller_Story26Title, gTextStoryteller_Story26Action, gTextStoryteller_Story26Text}, + {0x28, 1, gTextStoryteller_Story27Title, gTextStoryteller_Story27Action, gTextStoryteller_Story27Text}, + {0x29, 1, gTextStoryteller_Story28Title, gTextStoryteller_Story28Action, gTextStoryteller_Story28Text}, + {0x2A, 1, gTextStoryteller_Story29Title, gTextStoryteller_Story29Action, gTextStoryteller_Story29Text}, + {0x2B, 1, gTextStoryteller_Story30Title, gTextStoryteller_Story30Action, gTextStoryteller_Story30Text}, + {0x2C, 1, gTextStoryteller_Story31Title, gTextStoryteller_Story31Action, gTextStoryteller_Story31Text}, + {0x2D, 1, gTextStoryteller_Story32Title, gTextStoryteller_Story32Action, gTextStoryteller_Story32Text}, + {0x2E, 1, gTextStoryteller_Story33Title, gTextStoryteller_Story33Action, gTextStoryteller_Story33Text}, + {0x2F, 1, gTextStoryteller_Story34Title, gTextStoryteller_Story34Action, gTextStoryteller_Story34Text}, + {0x30, 1, gTextStoryteller_Story35Title, gTextStoryteller_Story35Action, gTextStoryteller_Story35Text}, {0x31, 1, gTextStoryteller_Story36Title, gTextStoryteller_Story36Action, gTextStoryteller_Story36Text}, }; -- cgit v1.2.3 From 3e68cbc51f867e507644c1c19bb3be7a89fcd3e4 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Fri, 8 Sep 2017 22:02:20 -0500 Subject: mauville_old_man -> mauville_man --- src/mauville_old_man.c | 1311 ------------------------------------------------ 1 file changed, 1311 deletions(-) delete mode 100644 src/mauville_old_man.c (limited to 'src/mauville_old_man.c') diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c deleted file mode 100644 index d54e017f7..000000000 --- a/src/mauville_old_man.c +++ /dev/null @@ -1,1311 +0,0 @@ -#include "global.h" -#include "bard_music.h" -#include "mauville_old_man.h" -#include "easy_chat.h" -#include "event_data.h" -#include "field_message_box.h" -#include "m4a.h" -#include "menu.h" -#include "rom4.h" -#include "rng.h" -#include "script.h" -#include "songs.h" -#include "sound.h" -#include "string_util.h" -#include "strings.h" -#include "task.h" -#include "trader.h" - -#define MACRO1(a) (((a) % 4) + (((a) / 8) & 1)) - -extern struct MusicPlayerInfo gMPlay_SE2; - -extern u16 gScriptResult; -extern u16 gSpecialVar_0x8004; - -extern const u8 gTextStoryteller_Story1Title[]; -extern const u8 gTextStoryteller_Story1Action[]; -extern const u8 gTextStoryteller_Story1Text[]; -extern const u8 gTextStoryteller_Story2Title[]; -extern const u8 gTextStoryteller_Story2Action[]; -extern const u8 gTextStoryteller_Story2Text[]; -extern const u8 gTextStoryteller_Story3Title[]; -extern const u8 gTextStoryteller_Story3Action[]; -extern const u8 gTextStoryteller_Story3Text[]; -extern const u8 gTextStoryteller_Story4Title[]; -extern const u8 gTextStoryteller_Story4Action[]; -extern const u8 gTextStoryteller_Story4Text[]; -extern const u8 gTextStoryteller_Story5Title[]; -extern const u8 gTextStoryteller_Story5Action[]; -extern const u8 gTextStoryteller_Story5Text[]; -extern const u8 gTextStoryteller_Story6Title[]; -extern const u8 gTextStoryteller_Story6Action[]; -extern const u8 gTextStoryteller_Story6Text[]; -extern const u8 gTextStoryteller_Story7Title[]; -extern const u8 gTextStoryteller_Story7Action[]; -extern const u8 gTextStoryteller_Story7Text[]; -extern const u8 gTextStoryteller_Story8Title[]; -extern const u8 gTextStoryteller_Story8Action[]; -extern const u8 gTextStoryteller_Story8Text[]; -extern const u8 gTextStoryteller_Story9Title[]; -extern const u8 gTextStoryteller_Story9Action[]; -extern const u8 gTextStoryteller_Story9Text[]; -extern const u8 gTextStoryteller_Story10Title[]; -extern const u8 gTextStoryteller_Story10Action[]; -extern const u8 gTextStoryteller_Story10Text[]; -extern const u8 gTextStoryteller_Story11Title[]; -extern const u8 gTextStoryteller_Story11Action[]; -extern const u8 gTextStoryteller_Story11Text[]; -extern const u8 gTextStoryteller_Story12Title[]; -extern const u8 gTextStoryteller_Story12Action[]; -extern const u8 gTextStoryteller_Story12Text[]; -extern const u8 gTextStoryteller_Story13Title[]; -extern const u8 gTextStoryteller_Story13Action[]; -extern const u8 gTextStoryteller_Story13Text[]; -extern const u8 gTextStoryteller_Story14Title[]; -extern const u8 gTextStoryteller_Story14Action[]; -extern const u8 gTextStoryteller_Story14Text[]; -extern const u8 gTextStoryteller_Story15Title[]; -extern const u8 gTextStoryteller_Story15Action[]; -extern const u8 gTextStoryteller_Story15Text[]; -extern const u8 gTextStoryteller_Story16Title[]; -extern const u8 gTextStoryteller_Story16Action[]; -extern const u8 gTextStoryteller_Story16Text[]; -extern const u8 gTextStoryteller_Story17Title[]; -extern const u8 gTextStoryteller_Story17Action[]; -extern const u8 gTextStoryteller_Story17Text[]; -extern const u8 gTextStoryteller_Story18Title[]; -extern const u8 gTextStoryteller_Story18Action[]; -extern const u8 gTextStoryteller_Story18Text[]; -extern const u8 gTextStoryteller_Story19Title[]; -extern const u8 gTextStoryteller_Story19Action[]; -extern const u8 gTextStoryteller_Story19Text[]; -extern const u8 gTextStoryteller_Story20Title[]; -extern const u8 gTextStoryteller_Story20Action[]; -extern const u8 gTextStoryteller_Story20Text[]; -extern const u8 gTextStoryteller_Story21Title[]; -extern const u8 gTextStoryteller_Story21Action[]; -extern const u8 gTextStoryteller_Story21Text[]; -extern const u8 gTextStoryteller_Story22Title[]; -extern const u8 gTextStoryteller_Story22Action[]; -extern const u8 gTextStoryteller_Story22Text[]; -extern const u8 gTextStoryteller_Story23Title[]; -extern const u8 gTextStoryteller_Story23Action[]; -extern const u8 gTextStoryteller_Story23Text[]; -extern const u8 gTextStoryteller_Story24Title[]; -extern const u8 gTextStoryteller_Story24Action[]; -extern const u8 gTextStoryteller_Story24Text[]; -extern const u8 gTextStoryteller_Story25Title[]; -extern const u8 gTextStoryteller_Story25Action[]; -extern const u8 gTextStoryteller_Story25Text[]; -extern const u8 gTextStoryteller_Story26Title[]; -extern const u8 gTextStoryteller_Story26Action[]; -extern const u8 gTextStoryteller_Story26Text[]; -extern const u8 gTextStoryteller_Story27Title[]; -extern const u8 gTextStoryteller_Story27Action[]; -extern const u8 gTextStoryteller_Story27Text[]; -extern const u8 gTextStoryteller_Story28Title[]; -extern const u8 gTextStoryteller_Story28Action[]; -extern const u8 gTextStoryteller_Story28Text[]; -extern const u8 gTextStoryteller_Story29Title[]; -extern const u8 gTextStoryteller_Story29Action[]; -extern const u8 gTextStoryteller_Story29Text[]; -extern const u8 gTextStoryteller_Story30Title[]; -extern const u8 gTextStoryteller_Story30Action[]; -extern const u8 gTextStoryteller_Story30Text[]; -extern const u8 gTextStoryteller_Story31Title[]; -extern const u8 gTextStoryteller_Story31Action[]; -extern const u8 gTextStoryteller_Story31Text[]; -extern const u8 gTextStoryteller_Story32Title[]; -extern const u8 gTextStoryteller_Story32Action[]; -extern const u8 gTextStoryteller_Story32Text[]; -extern const u8 gTextStoryteller_Story33Title[]; -extern const u8 gTextStoryteller_Story33Action[]; -extern const u8 gTextStoryteller_Story33Text[]; -extern const u8 gTextStoryteller_Story34Title[]; -extern const u8 gTextStoryteller_Story34Action[]; -extern const u8 gTextStoryteller_Story34Text[]; -extern const u8 gTextStoryteller_Story35Title[]; -extern const u8 gTextStoryteller_Story35Action[]; -extern const u8 gTextStoryteller_Story35Text[]; -extern const u8 gTextStoryteller_Story36Title[]; -extern const u8 gTextStoryteller_Story36Action[]; -extern const u8 gTextStoryteller_Story36Text[]; - -extern struct BardSong gUnknown_03005DA0; - -EWRAM_DATA static u16 gUnknown_020388BC = 0; // set but not used? - -static const u16 sDefaultBardSongLyrics[] = -{ -#ifdef ENGLISH - EC_WORD_SISTER, - EC_WORD_EATS, - EC_WORD_SWEETS, - EC_WORD_VORACIOUS, - EC_WORD_AND, - EC_WORD_DROOLING, -#else - EC_WORD_SISTER, - EC_WORD_MUST_BE, - EC_WORD_SWEETS, - EC_WORD_VORACIOUS, - EC_WORD_DROOLING, - EC_WORD_THICK, -#endif -}; - -static const u8 *const sGiddyAdjectives[] = -{ - OtherText_SoPretty, - OtherText_SoDarling, - OtherText_SoRelaxed, - OtherText_SoSunny, - OtherText_SoDesirable, - OtherText_SoExciting, - OtherText_SoAmusing, - OtherText_SoMagical, -}; - -static const u8 *const sGiddyQuestions[] = -{ - OtherText_WantVacationNicePlace, - OtherText_BoughtCrayonsIsNice, - OtherText_IfWeCouldFloat, - OtherText_SandWashesAwayMakeSad, - OtherText_WhatsBottomSeaLike, - OtherText_SeeSettingSun, - OtherText_LyingInGreenGrass, - OtherText_SecretBasesWonderful, -}; - -static void sub_80F7DC0(void); -static void Task_BardSong(u8); -static void StartBardSong(u8); -static void StorytellerSetup(void); -static void sub_80F8428(void); - -static void SetupBard(void) -{ - u16 i; - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - - bard->id = MAUVILLE_MAN_BARD; - bard->hasChangedSong = FALSE; - for (i = 0; i < 6; i++) - bard->songLyrics[i] = sDefaultBardSongLyrics[i]; -} - -static void SetupHipster(void) -{ - struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - - hipster->id = MAUVILLE_MAN_HIPSTER; - hipster->alreadySpoken = FALSE; -} - -static void SetupStoryteller(void) -{ - StorytellerSetup(); -} - -static void SetupGiddy(void) -{ - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - giddy->id = MAUVILLE_MAN_GIDDY; - giddy->taleCounter = 0; -} - -static void SetupTrader(void) -{ - TraderSetup(); -} - -void SetupMauvilleOldMan(void) -{ - u16 trainerId = (gSaveBlock2.playerTrainerId[1] << 8) | gSaveBlock2.playerTrainerId[0]; - - // Determine man based on the last digit of the player's trainer ID. - switch ((trainerId % 10) / 2) - { - case MAUVILLE_MAN_BARD: - SetupBard(); - break; - case MAUVILLE_MAN_HIPSTER: - SetupHipster(); - break; - case MAUVILLE_MAN_TRADER: - SetupTrader(); - break; - case MAUVILLE_MAN_STORYTELLER: - SetupStoryteller(); - break; - case MAUVILLE_MAN_GIDDY: - SetupGiddy(); - break; - } - sub_80F83D0(); -} - -static u8 GetCurrentMauvilleOldMan(void) -{ - struct MauvilleManCommon *common = &gSaveBlock1.mauvilleMan.common; - - return common->id; -} - -void ScrSpecial_GetCurrentMauvilleMan(void) -{ - gScriptResult = GetCurrentMauvilleOldMan(); -} - -void ScrSpecial_HasBardSongBeenChanged(void) -{ - u16 *scriptResult = &gScriptResult; // why?? - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - - *scriptResult = bard->hasChangedSong; -} - -void ScrSpecial_SaveBardSongLyrics(void) -{ - u16 i; - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - - StringCopy(bard->playerName, gSaveBlock2.playerName); - - for (i = 0; i < 4; i++) - bard->playerTrainerId[i] = gSaveBlock2.playerTrainerId[i]; - - for (i = 0; i < 6; i++) - bard->songLyrics[i] = bard->temporaryLyrics[i]; - - bard->hasChangedSong = TRUE; -} - -// Copies lyrics into gStringVar4 -void PrepareSongText(void) -{ - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u16 specialVar = gSpecialVar_0x8004; // It's a bit odd to use this temp variable, but it seems needed to match. - u16 *lyrics; - u16 lineNum; - u8 *wordEnd; - u8 *str; - - lyrics = bard->temporaryLyrics; - if (specialVar == 0) - lyrics = bard->songLyrics; - wordEnd = gStringVar4; - str = wordEnd; - // Put three words on each line - for (lineNum = 0; lineNum < 2; lineNum++) - { - wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); - while (wordEnd != str) - { - if (*str == CHAR_SPACE) - *str = CHAR_SONG_WORD_SEPARATOR; - str++; - } - - str++; - *(wordEnd++) = CHAR_SPACE; - - wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); - while (wordEnd != str) - { - if (*str == CHAR_SPACE) - *str = CHAR_SONG_WORD_SEPARATOR; - str++; - } - - str++; - *(wordEnd++) = CHAR_NEWLINE; - - wordEnd = EasyChat_GetWordText(wordEnd, *(lyrics++)); - while (wordEnd != str) - { - if (*str == CHAR_SPACE) - *str = CHAR_SONG_WORD_SEPARATOR; - str++; - } - - if (lineNum == 0) - { - *(wordEnd++) = EXT_CTRL_CODE_BEGIN; - *(wordEnd++) = 15; - } - } -} - -void ScrSpecial_PlayBardSong(void) -{ - StartBardSong(gSpecialVar_0x8004); - MenuDisplayMessageBox(); - ScriptContext1_Stop(); -} - -void ScrSpecial_GetHipsterSpokenFlag(void) -{ - u16 *scriptResult = &gScriptResult; // again?? - struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - - *scriptResult = hipster->alreadySpoken; -} - -void ScrSpecial_SetHipsterSpokenFlag(void) -{ - struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - - hipster->alreadySpoken = TRUE; -} - -void ScrSpecial_HipsterTeachWord(void) -{ - u16 var = sub_80EB8EC(); - - if (var == 0xFFFF) - { - gScriptResult = FALSE; - } - else - { - EasyChat_GetWordText(gStringVar1, var); - gScriptResult = TRUE; - } -} - -void ScrSpecial_GiddyShouldTellAnotherTale(void) -{ - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - if (giddy->taleCounter == 10) - { - gScriptResult = FALSE; - giddy->taleCounter = 0; - } - else - { - gScriptResult = TRUE; - } -} - -void ScrSpecial_GenerateGiddyLine(void) -{ - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - if (giddy->taleCounter == 0) - sub_80F7DC0(); - - if (giddy->randomWords[giddy->taleCounter] != 0xFFFF) // is not the last element of the array? - { - u8 *stringPtr; - u32 adjective = Random(); - - adjective %= 8; - stringPtr = EasyChat_GetWordText(gStringVar4, giddy->randomWords[giddy->taleCounter]); - stringPtr = StringCopy(stringPtr, gOtherText_Is); - stringPtr = StringCopy(stringPtr, sGiddyAdjectives[adjective]); - StringCopy(stringPtr, gOtherText_DontYouAgree); - } - else - { - StringCopy(gStringVar4, sGiddyQuestions[giddy->questionList[giddy->questionNum++]]); - } - - if (!(Random() % 10)) - giddy->taleCounter = 10; - else - giddy->taleCounter++; - - gScriptResult = TRUE; -} - -#ifdef NONMATCHING -static void sub_80F7DC0(void) -{ - u16 arr[][2] = - { - { 0x0, 0}, - { 0xC, 0}, - { 0xD, 0}, - {0x12, 0}, - {0x13, 0}, - {0x15, 0}, - }; - u16 i; - u16 r10; - u16 r7; - - for (i = 0; i < 8; i++) - { - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - //gSaveBlock1.mauvilleMan.giddy.questionList[i] = i; - giddy->questionList[i] = i; - } - - // Scramble questions - for (i = 0; i < 8; i++) - { - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - /* - u16 r1 = Random() % (i + 1); - u8 r7 = gSaveBlock1.mauvilleMan.giddy.questionList[i]; - gSaveBlock1.mauvilleMan.giddy.questionList[i] = gSaveBlock1.mauvilleMan.giddy.questionList[r1]; - gSaveBlock1.mauvilleMan.giddy.questionList[r1] = r7; - */ - u16 r1 = Random() % (i + 1); - u8 r7 = giddy->questionList[i]; - giddy->questionList[i] = giddy->questionList[r1]; - giddy->questionList[r1] = r7; - } - - r10 = 0; - for (i = 0; i < 6; i++) - { - arr[i][1] = sub_80EAE88(arr[i][0]); - r10 += arr[i][1]; - } - - { - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - giddy->questionNum = 0; - } - //gSaveBlock1.mauvilleMan.giddy.questionNum = 0; - - r7 = 0; - for (i = 0; i < 10; i++) - { - struct MauvilleManGiddy *giddy = &gSaveBlock1.mauvilleMan.giddy; - - u16 var = Random() % 10; - if (var < 3 && r7 < 8) - { - //gSaveBlock1.mauvilleMan.giddy.randomWords[i] = 0xFFFF; - giddy->randomWords[i] = 0xFFFF; - r7++; - } - //_080F7E90 - else - { - s16 r2 = Random() % r10; - - u16 r1 = 0; - - while (i < 6) // comparing the wrong variable - { - r2 = arr[r1][1] - r2; - if (r2 <= 0) - break; - r1++; - } - - if (r1 == 6) - r1 = 0; - //gSaveBlock1.mauvilleMan.giddy.randomWords[i] = sub_80EB784(arr[r1][0]); - giddy->randomWords[i] = sub_80EB784(arr[r1][0]); - } - } -} -#else - -static const u16 gUnknown_083E53C8[][2] = -{ - { 0x0, 0}, - { 0xC, 0}, - { 0xD, 0}, - {0x12, 0}, - {0x13, 0}, - {0x15, 0}, -}; - -__attribute__((naked)) -static void sub_80F7DC0(void) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x18\n\ - ldr r1, _080F7E84 @ =gUnknown_083E53C8\n\ - mov r0, sp\n\ - movs r2, 0x18\n\ - bl memcpy\n\ - movs r5, 0\n\ - movs r0, 0x2\n\ - add r0, sp\n\ - mov r8, r0\n\ - ldr r1, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - adds r1, 0x18\n\ - adds r3, r1, 0\n\ -_080F7DE4:\n\ - adds r0, r3, r5\n\ - strb r5, [r0]\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x7\n\ - bls _080F7DE4\n\ - movs r5, 0\n\ - ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - adds r2, 0x4\n\ - mov r9, r2\n\ - adds r6, r1, 0\n\ -_080F7DFC:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - adds r4, r5, 0x1\n\ - adds r1, r4, 0\n\ - bl __modsi3\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - adds r2, r6, r5\n\ - ldrb r7, [r2]\n\ - adds r1, r6, r1\n\ - ldrb r0, [r1]\n\ - strb r0, [r2]\n\ - strb r7, [r1]\n\ - lsls r4, 16\n\ - lsrs r5, r4, 16\n\ - cmp r5, 0x7\n\ - bls _080F7DFC\n\ - movs r3, 0\n\ - mov r10, r3\n\ - movs r5, 0\n\ -_080F7E2A:\n\ - lsls r4, r5, 2\n\ - mov r1, sp\n\ - adds r0, r1, r4\n\ - ldrb r0, [r0]\n\ - bl sub_80EAE88\n\ - add r4, r8\n\ - strh r0, [r4]\n\ - add r0, r10\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - mov r10, r0\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x5\n\ - bls _080F7E2A\n\ - movs r0, 0\n\ - ldr r2, _080F7E88 @ =gSaveBlock1 + 0x2D94\n\ - strb r0, [r2, 0x2]\n\ - movs r7, 0\n\ - movs r5, 0\n\ -_080F7E56:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - movs r1, 0xA\n\ - bl __umodsi3\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - cmp r1, 0x2\n\ - bhi _080F7E90\n\ - cmp r7, 0x7\n\ - bhi _080F7E90\n\ - lsls r0, r5, 1\n\ - add r0, r9\n\ - ldr r1, _080F7E8C @ =0x0000ffff\n\ - strh r1, [r0]\n\ - adds r0, r7, 0x1\n\ - lsls r0, 16\n\ - lsrs r7, r0, 16\n\ - adds r4, r5, 0x1\n\ - b _080F7EE2\n\ - .align 2, 0\n\ -_080F7E84: .4byte gUnknown_083E53C8\n\ -_080F7E88: .4byte gSaveBlock1 + 0x2D94\n\ -_080F7E8C: .4byte 0x0000ffff\n\ -_080F7E90:\n\ - bl Random\n\ - lsls r0, 16\n\ - lsrs r0, 16\n\ - mov r1, r10\n\ - bl __umodsi3\n\ - lsls r0, 16\n\ - lsrs r2, r0, 16\n\ - movs r1, 0\n\ - adds r4, r5, 0x1\n\ - lsls r6, r5, 1\n\ - cmp r5, 0x5\n\ - bhi _080F7ECC\n\ - mov r3, r8\n\ - ldrh r0, [r3]\n\ - b _080F7EC2\n\ -_080F7EB2:\n\ - adds r0, r1, 0x1\n\ - lsls r0, 16\n\ - lsrs r1, r0, 16\n\ - cmp r5, 0x5\n\ - bhi _080F7ECC\n\ - lsls r0, r1, 2\n\ - adds r0, r3, r0\n\ - ldrh r0, [r0]\n\ -_080F7EC2:\n\ - subs r0, r2, r0\n\ - lsls r0, 16\n\ - lsrs r2, r0, 16\n\ - cmp r0, 0\n\ - bgt _080F7EB2\n\ -_080F7ECC:\n\ - cmp r1, 0x6\n\ - bne _080F7ED2\n\ - movs r1, 0\n\ -_080F7ED2:\n\ - lsls r0, r1, 2\n\ - add r0, sp\n\ - ldrh r0, [r0]\n\ - bl sub_80EB784\n\ - mov r2, r9\n\ - adds r1, r2, r6\n\ - strh r0, [r1]\n\ -_080F7EE2:\n\ - lsls r0, r4, 16\n\ - lsrs r5, r0, 16\n\ - cmp r5, 0x9\n\ - bls _080F7E56\n\ - add sp, 0x18\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .syntax divided\n"); -} -#endif - -static void sub_80F7EFC(void) -{ - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - - bard->hasChangedSong = FALSE; -} - -static void sub_80F7F0C(void) -{ - struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; - - hipster->alreadySpoken = FALSE; -} - -static void sub_80F7F18(void) -{ - sub_8109A20(); -} - -static void sub_80F7F24(void) -{ - sub_80F8428(); -} - -void sub_80F7F30(void) -{ - switch (GetCurrentMauvilleOldMan()) - { - case MAUVILLE_MAN_BARD: - sub_80F7EFC(); - break; - case MAUVILLE_MAN_HIPSTER: - sub_80F7F0C(); - break; - case MAUVILLE_MAN_STORYTELLER: - sub_80F7F24(); - break; - case MAUVILLE_MAN_TRADER: - sub_80F7F18(); - break; - case MAUVILLE_MAN_GIDDY: - break; - } - sub_80F83D0(); -} - -#define tState data[0] -#define tCharIndex data[3] -#define tCurrWord data[4] -#define tUseTemporaryLyrics data[5] - -static void StartBardSong(bool8 useTemporaryLyrics) -{ - u8 taskId = CreateTask(Task_BardSong, 0x50); - - gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics; -} - -static void BardSing(struct Task *task, struct BardSong *song) -{ - switch (task->tState) - { - case 0: // Initialize song - { - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u16 *lyrics; - s32 i; - - // Copy lyrics - if (gSpecialVar_0x8004 == 0) - lyrics = bard->songLyrics; - else - lyrics = bard->temporaryLyrics; - for (i = 0; i < 6; i++) - song->lyrics[i] = lyrics[i]; - - // Clear phonemes - for (i = 0; i < 6; i++) - { - song->phonemes[i].sound = 0xFFFF; - song->phonemes[i].length = 0; - song->phonemes[i].pitch = 0; - song->phonemes[i].volume = 0; - } - song->currWord = 0; - song->currPhoneme = 0; - song->var04 = 0; - } - break; - case 1: // Wait for BGM to end - break; - case 2: // Initialize word - { - u16 word = song->lyrics[song->currWord]; - const struct BardSound *sounds = GetWordSounds(EC_GROUP(word), EC_INDEX(word)); - - song->var04 = 0; - GetWordPhonemes(song, sounds, MACRO1(word)); - } - break; - case 3: - case 4: - { - struct BardPhoneme *phoneme = &song->phonemes[song->currPhoneme]; - - switch (song->state) - { - case 0: - if (song->phonemeTimer == 0) // Timer has expired. Move to next phoneme - { - if (song->currPhoneme == 6 || phoneme->sound == 0xFF) - { - song->state = 0xFE; - break; - } - song->phonemeTimer = phoneme->length; - if (phoneme->sound <= 50) - { - u16 num = phoneme->sound / 3; - - m4aSongNumStart(249 + num * 3); - } - song->state = 1; - } - else - { - if (song->voiceInflection > 10) - song->volume -= 2; - if (song->voiceInflection & 1) - song->pitch += 64; - else - song->pitch -= 64; - m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, song->volume); - m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, song->pitch); - song->voiceInflection++; - } - song->phonemeTimer--; - break; - case 1: - song->currPhoneme++; - song->state = 0; - if (phoneme->sound <= 50) - { - song->volume = 0x100 + phoneme->volume * 16; - m4aMPlayVolumeControl(&gMPlay_SE2, 0xFFFF, song->volume); - song->pitch = 0x200 + phoneme->pitch; - m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, song->pitch); - } - break; - case 0xFE: - m4aMPlayStop(&gMPlay_SE2); - song->state = 0xFF; - break; - } - } - break; - case 5: - break; - } -} - -static void Task_BardSong(u8 taskId) -{ - struct Task *task = &gTasks[taskId]; // r5 - - BardSing(task, &gUnknown_03005DA0); - switch (task->tState) - { - case 0: // Initialize song - PrepareSongText(); - InitWindowFromConfig(gMenuWindowPtr, &gWindowConfig_81E6CE4); - sub_8002EB0(gMenuWindowPtr, gStringVar4, 2, 4, 15); - task->data[1] = 0; - task->data[2] = 0; - task->tCharIndex = 0; - task->tCurrWord = 0; - FadeOutBGMTemporarily(4); - task->tState = 1; - break; - case 1: // Wait for BGM to end - if (IsBGMPausedOrStopped()) - task->tState = 2; - break; - case 2: // Initialize word - { - struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; - u8 *str = gStringVar4 + task->tCharIndex; - u16 wordLen = 0; - // Can't get it to match without hacking - u32 temp; - register s16 zero asm("r1"); - - while (*str != CHAR_SPACE - && *str != CHAR_NEWLINE - && *str != EXT_CTRL_CODE_BEGIN - && *str != EOS) - { - str++; - wordLen++; - } - if (!task->tUseTemporaryLyrics) - gUnknown_020388BC = MACRO1(bard->songLyrics[task->tCurrWord]); - else - gUnknown_020388BC = MACRO1(bard->temporaryLyrics[task->tCurrWord]); - temp = gUnknown_03005DA0.var04 / wordLen; - zero = 0; - gUnknown_03005DA0.var04 = temp; - if (gUnknown_03005DA0.var04 <= 0) - gUnknown_03005DA0.var04 = 1; - task->tCurrWord++; - if (task->data[2] == 0) - task->tState = 3; - else - task->tState = 5; - task->data[1] = zero; - } - break; - case 5: - if (task->data[2] == 0) - task->tState = 3; - else - task->data[2]--; - break; - case 3: - if (gStringVar4[task->tCharIndex] == EOS) - { - FadeInNewBGM(BGM_POKECEN, 6); - m4aMPlayFadeOutTemporarily(&gMPlay_SE2, 2); - EnableBothScriptContexts(); - DestroyTask(taskId); - } - else if (gStringVar4[task->tCharIndex] == CHAR_SPACE) - { - sub_8003418(gMenuWindowPtr); - task->tCharIndex++; - task->tState = 2; - task->data[2] = 0; - } - else if (gStringVar4[task->tCharIndex] == CHAR_NEWLINE) - { - task->tCharIndex++; - task->tState = 2; - task->data[2] = 0; - } - else if (gStringVar4[task->tCharIndex] == EXT_CTRL_CODE_BEGIN) - { - task->tCharIndex += 2; // skip over control codes - task->tState = 2; - task->data[2] = 8; - } - else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR) - { - gStringVar4[task->tCharIndex] = CHAR_SPACE; // restore it back to a space - sub_8003418(gMenuWindowPtr); - task->tCharIndex++; - task->data[2] = 0; - } - else - { - switch (task->data[1]) - { - case 0: - sub_8003418(gMenuWindowPtr); - task->data[1]++; - break; - case 1: - task->data[1]++; - break; - case 2: - task->tCharIndex++; - task->data[1] = 0; - task->data[2] = gUnknown_03005DA0.var04; - task->tState = 4; - break; - } - } - break; - case 4: - task->data[2]--; - if (task->data[2] == 0) - task->tState = 3; - break; - } -} - -void sub_80F83D0(void) -{ - VarSet(0x4010, 0x45 + GetCurrentMauvilleOldMan()); -} - -struct Story -{ - u8 stat; - u8 minVal; - const u8 *title; - const u8 *action; - const u8 *fullText; -}; - -static const struct Story sStorytellerStories[] = -{ - {0x32, 1, gTextStoryteller_Story1Title, gTextStoryteller_Story1Action, gTextStoryteller_Story1Text}, - {0x02, 1, gTextStoryteller_Story2Title, gTextStoryteller_Story2Action, gTextStoryteller_Story2Text}, - {0x03, 1, gTextStoryteller_Story3Title, gTextStoryteller_Story3Action, gTextStoryteller_Story3Text}, - {0x04, 1, gTextStoryteller_Story4Title, gTextStoryteller_Story4Action, gTextStoryteller_Story4Text}, - {0x06, 1, gTextStoryteller_Story5Title, gTextStoryteller_Story5Action, gTextStoryteller_Story5Text}, - {0x09, 1, gTextStoryteller_Story6Title, gTextStoryteller_Story6Action, gTextStoryteller_Story6Text}, - {0x0B, 1, gTextStoryteller_Story7Title, gTextStoryteller_Story7Action, gTextStoryteller_Story7Text}, - {0x0C, 1, gTextStoryteller_Story8Title, gTextStoryteller_Story8Action, gTextStoryteller_Story8Text}, - {0x0D, 1, gTextStoryteller_Story9Title, gTextStoryteller_Story9Action, gTextStoryteller_Story9Text}, - {0x0E, 1, gTextStoryteller_Story10Title, gTextStoryteller_Story10Action, gTextStoryteller_Story10Text}, - {0x0F, 1, gTextStoryteller_Story11Title, gTextStoryteller_Story11Action, gTextStoryteller_Story11Text}, - {0x10, 1, gTextStoryteller_Story12Title, gTextStoryteller_Story12Action, gTextStoryteller_Story12Text}, - {0x11, 1, gTextStoryteller_Story13Title, gTextStoryteller_Story13Action, gTextStoryteller_Story13Text}, - {0x12, 1, gTextStoryteller_Story14Title, gTextStoryteller_Story14Action, gTextStoryteller_Story14Text}, - {0x13, 1, gTextStoryteller_Story15Title, gTextStoryteller_Story15Action, gTextStoryteller_Story15Text}, - {0x14, 1, gTextStoryteller_Story16Title, gTextStoryteller_Story16Action, gTextStoryteller_Story16Text}, - {0x1A, 1, gTextStoryteller_Story17Title, gTextStoryteller_Story17Action, gTextStoryteller_Story17Text}, - {0x1B, 1, gTextStoryteller_Story18Title, gTextStoryteller_Story18Action, gTextStoryteller_Story18Text}, - {0x1C, 1, gTextStoryteller_Story19Title, gTextStoryteller_Story19Action, gTextStoryteller_Story19Text}, - {0x1D, 2, gTextStoryteller_Story20Title, gTextStoryteller_Story20Action, gTextStoryteller_Story20Text}, - {0x1E, 1, gTextStoryteller_Story21Title, gTextStoryteller_Story21Action, gTextStoryteller_Story21Text}, - {0x21, 1, gTextStoryteller_Story22Title, gTextStoryteller_Story22Action, gTextStoryteller_Story22Text}, - {0x24, 1, gTextStoryteller_Story23Title, gTextStoryteller_Story23Action, gTextStoryteller_Story23Text}, - {0x25, 1, gTextStoryteller_Story24Title, gTextStoryteller_Story24Action, gTextStoryteller_Story24Text}, - {0x26, 1, gTextStoryteller_Story25Title, gTextStoryteller_Story25Action, gTextStoryteller_Story25Text}, - {0x27, 1, gTextStoryteller_Story26Title, gTextStoryteller_Story26Action, gTextStoryteller_Story26Text}, - {0x28, 1, gTextStoryteller_Story27Title, gTextStoryteller_Story27Action, gTextStoryteller_Story27Text}, - {0x29, 1, gTextStoryteller_Story28Title, gTextStoryteller_Story28Action, gTextStoryteller_Story28Text}, - {0x2A, 1, gTextStoryteller_Story29Title, gTextStoryteller_Story29Action, gTextStoryteller_Story29Text}, - {0x2B, 1, gTextStoryteller_Story30Title, gTextStoryteller_Story30Action, gTextStoryteller_Story30Text}, - {0x2C, 1, gTextStoryteller_Story31Title, gTextStoryteller_Story31Action, gTextStoryteller_Story31Text}, - {0x2D, 1, gTextStoryteller_Story32Title, gTextStoryteller_Story32Action, gTextStoryteller_Story32Text}, - {0x2E, 1, gTextStoryteller_Story33Title, gTextStoryteller_Story33Action, gTextStoryteller_Story33Text}, - {0x2F, 1, gTextStoryteller_Story34Title, gTextStoryteller_Story34Action, gTextStoryteller_Story34Text}, - {0x30, 1, gTextStoryteller_Story35Title, gTextStoryteller_Story35Action, gTextStoryteller_Story35Text}, - {0x31, 1, gTextStoryteller_Story36Title, gTextStoryteller_Story36Action, gTextStoryteller_Story36Text}, -}; - -static void StorytellerSetup(void) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - s32 i; - - storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->alreadyRecorded = FALSE; - for (i = 0; i < 4; i++) - { - storyteller->gameStatIDs[i] = 0; - storyteller->trainerNames[0][i] = EOS; // Maybe they meant storyteller->trainerNames[i][0] instead? - } -} - -static void sub_80F8428(void) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - storyteller->id = MAUVILLE_MAN_STORYTELLER; - storyteller->alreadyRecorded = FALSE; -} - -static u32 StorytellerGetGameStat(u8 stat) -{ - if (stat == NUM_GAME_STATS) - stat = 0; - return GetGameStat(stat); -} - -static const struct Story *GetStoryByStat(u32 stat) -{ - s32 i; - - for (i = 0; i < 36; i++) - { - if (sStorytellerStories[i].stat == stat) - return &sStorytellerStories[i]; - } - return &sStorytellerStories[35]; -} - -static const u8 *GetStoryTitleByStat(u32 stat) -{ - return GetStoryByStat(stat)->title; -} - -static const u8 *GetStoryTextByStat(u32 stat) -{ - return GetStoryByStat(stat)->fullText; -} - -static const u8 *GetStoryActionByStat(u32 stat) -{ - return GetStoryByStat(stat)->action; -} - -static u8 GetFreeStorySlot(void) -{ - u8 i; - - for (i = 0; i < 4; i++) - { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - if (storyteller->gameStatIDs[i] == 0) - break; - } - return i; -} - -static u32 StorytellerGetRecordedTrainerStat(u32 trainer) -{ - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.statValues[trainer]; - - return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); -} - -static void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) -{ - u8 *ptr = gSaveBlock1.mauvilleMan.storyteller.statValues[trainer]; - - ptr[0] = val; - ptr[1] = val >> 8; - ptr[2] = val >> 16; - ptr[3] = val >> 24; -} - -static bool32 HasTrainerStatIncreased(u32 trainer) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - if (StorytellerGetGameStat(storyteller->gameStatIDs[trainer]) > StorytellerGetRecordedTrainerStat(trainer)) - return TRUE; - else - return FALSE; -} - -static void GetStoryByStattellerPlayerName(u32 player, void *dst) -{ - u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; - - memset(dst, EOS, 8); - memcpy(dst, name, 7); -} - -static void StorytellerSetPlayerName(u32 player, const u8 *src) -{ - u8 *name = gSaveBlock1.mauvilleMan.storyteller.trainerNames[player]; - u8 len = StringLength(src); - - memset(name, EOS, 7); - StringCopyN(name, src, len); -} - -static void StorytellerRecordNewStat(u32 player, u32 stat) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - storyteller->gameStatIDs[player] = stat; - StorytellerSetPlayerName(player, gSaveBlock2.playerName); - StorytellerSetRecordedTrainerStat(player, StorytellerGetGameStat(stat)); - ConvertIntToDecimalStringN(gStringVar1, StorytellerGetGameStat(stat), 0, 10); - StringCopy(gStringVar2, GetStoryActionByStat(stat)); -} - -static void ScrambleStatList(u8 *arr, s32 count) -{ - s32 i; - - for (i = 0; i < count; i++) - arr[i] = i; - for (i = 0; i < count; i++) - { - u32 a = Random() % count; - u32 b = Random() % count; - u8 temp = arr[a]; - arr[a] = arr[b]; - arr[b] = temp; - } -} - -// What purpose does this struct even serve? Only the length field is used. -static const struct {u32 length; struct MauvilleManStoryteller *unused1; u32 unused2;} sStorytellerStuff = -{ - 36, - &gSaveBlock1.mauvilleMan.storyteller, // unused - 12, // unused -}; - -static bool8 StorytellerInitializeRandomStat(void) -{ - u8 arr[sStorytellerStuff.length]; - s32 i; - s32 j; - - ScrambleStatList(arr, 36); - for (i = 0; i < 36; i++) - { - u8 stat = sStorytellerStories[arr[i]].stat; - u8 minVal = sStorytellerStories[arr[i]].minVal; - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - for (j = 0; j < 4; j++) - { - if (gSaveBlock1.mauvilleMan.storyteller.gameStatIDs[j] == stat) - break; - } - if (j == 4 && StorytellerGetGameStat(stat) >= minVal) - { - storyteller->alreadyRecorded = TRUE; - StorytellerRecordNewStat(GetFreeStorySlot(), stat); - return TRUE; - } - } - return FALSE; -} - -static void StorytellerDisplayStory(u32 player) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 stat = storyteller->gameStatIDs[player]; - - ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), 0, 10); - StringCopy(gStringVar2, GetStoryActionByStat(stat)); - GetStoryByStattellerPlayerName(player, gStringVar3); - ShowFieldMessage(GetStoryTextByStat(stat)); -} - -static void PrintStoryList(void) -{ - s32 i; - - MenuDrawTextWindow(0, 0, 25, 4 + GetFreeStorySlot() * 2); - for (i = 0; i < 4; i++) - { - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 stat = storyteller->gameStatIDs[i]; - - if (stat == 0) - break; - MenuPrint(GetStoryTitleByStat(stat), 1, 2 + i * 2); - } - MenuPrint(gPCText_Cancel, 1, 2 + i * 2); -} - -extern u8 gUnknown_03000748; - -static void Task_StoryListMenu(u8 taskId) -{ - struct Task *task = &gTasks[taskId]; - s32 selection; - - switch (task->data[0]) - { - case 0: - PrintStoryList(); - InitMenu(0, 1, 2, GetFreeStorySlot() + 1, 0, 24); - task->data[0]++; - break; - case 1: - selection = ProcessMenuInput(); - if (selection == -2) - break; - if (selection == -1 || selection == GetFreeStorySlot()) - { - gScriptResult = 0; - } - else - { - gScriptResult = 1; - gUnknown_03000748 = selection; - } - HandleDestroyMenuCursors(); - MenuZeroFillWindowRect(0, 0, 25, 12); - DestroyTask(taskId); - EnableBothScriptContexts(); - break; - } -} - -// Sets gScriptResult to TRUE if player selected a story -void ScrSpecial_StorytellerStoryListMenu(void) -{ - CreateTask(Task_StoryListMenu, 0x50); -} - -void ScrSpecial_StorytellerDisplayStory(void) -{ - StorytellerDisplayStory(gUnknown_03000748); -} - -u8 ScrSpecial_StorytellerGetFreeStorySlot(void) -{ - return GetFreeStorySlot(); -} - -// Returns TRUE if stat has increased -bool8 ScrSpecial_StorytellerUpdateStat(void) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - u8 r4 = storyteller->gameStatIDs[gUnknown_03000748]; - - if (HasTrainerStatIncreased(gUnknown_03000748) == TRUE) - { - StorytellerRecordNewStat(gUnknown_03000748, r4); - return TRUE; - } - return FALSE; -} - -bool8 ScrSpecial_HasStorytellerAlreadyRecorded(void) -{ - struct MauvilleManStoryteller *storyteller = &gSaveBlock1.mauvilleMan.storyteller; - - if (storyteller->alreadyRecorded == FALSE) - return FALSE; - else - return TRUE; -} - -bool8 ScrSpecial_StorytellerInitializeRandomStat(void) -{ - return StorytellerInitializeRandomStat(); -} -- cgit v1.2.3