diff --git a/asm/battle_4.s b/asm/battle_4.s index 08de752f0..a7e61faec 100644 --- a/asm/battle_4.s +++ b/asm/battle_4.s @@ -14892,7 +14892,7 @@ _0804E170: ldr r1, =gBattleStruct ldr r1, [r1] ldrb r1, [r1, 0x10] - ldr r2, =gUnknown_020244E9 + ldr r2, =gPlayerPartyCount ldrb r2, [r2] subs r2, 0x1 lsls r2, 24 diff --git a/asm/battle_records.s b/asm/battle_records.s index ae210d9d8..f7be16379 100644 --- a/asm/battle_records.s +++ b/asm/battle_records.s @@ -336,8 +336,8 @@ _0813C1D4: .pool thumb_func_end sub_813C170 - thumb_func_start sub_813C1F8 -sub_813C1F8: @ 813C1F8 + thumb_func_start InitLinkBattleRecords +InitLinkBattleRecords: @ 813C1F8 push {lr} ldr r0, =gSaveBlock1Ptr ldr r0, [r0] @@ -347,7 +347,7 @@ sub_813C1F8: @ 813C1F8 pop {r0} bx r0 .pool - thumb_func_end sub_813C1F8 + thumb_func_end InitLinkBattleRecords thumb_func_start sub_813C214 sub_813C214: @ 813C214 diff --git a/asm/berry.s b/asm/berry.s index 67f768ddf..54c4333d5 100644 --- a/asm/berry.s +++ b/asm/berry.s @@ -256,9 +256,9 @@ _080E178E: bx r1 thumb_func_end WaterBerryTree - thumb_func_start RemoveAllBerryTrees -@ void RemoveAllBerryTrees() -RemoveAllBerryTrees: @ 80E1794 + thumb_func_start ClearBerryTrees +@ void ClearBerryTrees() +ClearBerryTrees: @ 80E1794 push {r4-r6,lr} movs r2, 0 ldr r6, =gSaveBlock1Ptr @@ -280,7 +280,7 @@ _080E17A2: pop {r0} bx r0 .pool - thumb_func_end RemoveAllBerryTrees + thumb_func_end ClearBerryTrees thumb_func_start BerryTreeGrow @ bool8 BerryTreeGrow(struct BerryTreeInfo *berryTree) diff --git a/asm/big_shroomish_barboach.s b/asm/big_shroomish_barboach.s index 99a58dc5b..585dbf356 100644 --- a/asm/big_shroomish_barboach.s +++ b/asm/big_shroomish_barboach.s @@ -327,8 +327,8 @@ _080F9A6E: .pool thumb_func_end sub_80F9A14 - thumb_func_start sub_80F9A7C -sub_80F9A7C: @ 80F9A7C + thumb_func_start InitSeedotSizeRecord +InitSeedotSizeRecord: @ 80F9A7C push {lr} ldr r0, =0x00004047 movs r1, 0x80 @@ -337,7 +337,7 @@ sub_80F9A7C: @ 80F9A7C pop {r0} bx r0 .pool - thumb_func_end sub_80F9A7C + thumb_func_end InitSeedotSizeRecord thumb_func_start sub_80F9A90 sub_80F9A90: @ 80F9A90 @@ -372,8 +372,8 @@ sub_80F9AAC: @ 80F9AAC .pool thumb_func_end sub_80F9AAC - thumb_func_start sub_80F9AD4 -sub_80F9AD4: @ 80F9AD4 + thumb_func_start InitLotadSizeRecord +InitLotadSizeRecord: @ 80F9AD4 push {lr} ldr r0, =0x0000404f movs r1, 0x80 @@ -382,7 +382,7 @@ sub_80F9AD4: @ 80F9AD4 pop {r0} bx r0 .pool - thumb_func_end sub_80F9AD4 + thumb_func_end InitLotadSizeRecord thumb_func_start sub_80F9AE8 sub_80F9AE8: @ 80F9AE8 diff --git a/asm/braille_puzzles.s b/asm/braille_puzzles.s index c35251674..7015f1d7a 100644 --- a/asm/braille_puzzles.s +++ b/asm/braille_puzzles.s @@ -92,7 +92,7 @@ sub_81796AC: @ 81796AC cmp r0, r1 bne _081796F4 bl calc_player_party_count - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r1, [r0] movs r0, 0x64 muls r0, r1 diff --git a/asm/contest.s b/asm/contest.s index bb595e747..0e2f45740 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -10,14 +10,14 @@ TaskDummy1: @ 80D7668 bx lr thumb_func_end TaskDummy1 - thumb_func_start sub_80D766C -sub_80D766C: @ 80D766C + thumb_func_start ResetLinkContestBoolean +ResetLinkContestBoolean: @ 80D766C ldr r1, =gUnknown_02039F2A movs r0, 0 strb r0, [r1] bx lr .pool - thumb_func_end sub_80D766C + thumb_func_end ResetLinkContestBoolean thumb_func_start sub_80D7678 sub_80D7678: @ 80D7678 @@ -14187,8 +14187,8 @@ sub_80DED60: @ 80DED60 .pool thumb_func_end sub_80DED60 - thumb_func_start sub_80DED74 -sub_80DED74: @ 80DED74 + thumb_func_start ResetContestLinkResults +ResetContestLinkResults: @ 80DED74 push {r4-r6,lr} movs r0, 0 ldr r6, =gSaveBlock2Ptr @@ -14214,7 +14214,7 @@ _080DED84: pop {r0} bx r0 .pool - thumb_func_end sub_80DED74 + thumb_func_end ResetContestLinkResults thumb_func_start sub_80DEDA8 sub_80DEDA8: @ 80DEDA8 @@ -14522,8 +14522,8 @@ _080DF03A: bx r1 thumb_func_end sub_80DEFA8 - thumb_func_start sub_80DF040 -sub_80DF040: @ 80DF040 + thumb_func_start ClearContestWinnerPicsInContestHall +ClearContestWinnerPicsInContestHall: @ 80DF040 push {r4-r7,lr} movs r2, 0 ldr r0, =gSaveBlock1Ptr @@ -14551,7 +14551,7 @@ _080DF04C: pop {r0} bx r0 .pool - thumb_func_end sub_80DF040 + thumb_func_end ClearContestWinnerPicsInContestHall thumb_func_start sub_80DF080 sub_80DF080: @ 80DF080 diff --git a/asm/daycare.s b/asm/daycare.s index d70d4c0f4..66066c51c 100644 --- a/asm/daycare.s +++ b/asm/daycare.s @@ -2179,7 +2179,7 @@ _08070B34: lsls r0, 24 lsrs r6, r0, 24 movs r5, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 bcs _08070BC0 @@ -2225,7 +2225,7 @@ _08070BA8: _08070BB4: adds r4, 0x64 adds r5, 0x1 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 bcc _08070B5C diff --git a/asm/dewford_trend.s b/asm/dewford_trend.s index 67dba95be..c3a7b192c 100644 --- a/asm/dewford_trend.s +++ b/asm/dewford_trend.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_81224D4 -sub_81224D4: @ 81224D4 + thumb_func_start InitDewfordTrend +InitDewfordTrend: @ 81224D4 push {r4-r7,lr} movs r6, 0 ldr r5, =gSaveBlock1Ptr @@ -77,7 +77,7 @@ _08122522: pop {r0} bx r0 .pool - thumb_func_end sub_81224D4 + thumb_func_end InitDewfordTrend thumb_func_start sub_8122580 sub_8122580: @ 8122580 diff --git a/asm/easy_chat.s b/asm/easy_chat.s index c629a8fe9..7d5e0df40 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -10202,8 +10202,8 @@ _0811F174: .pool thumb_func_end sub_811F108 - thumb_func_start sub_811F184 -sub_811F184: @ 811F184 + thumb_func_start InitEasyChatPhrases +InitEasyChatPhrases: @ 811F184 push {r4-r7,lr} movs r2, 0 ldr r5, =gSaveBlock1Ptr @@ -10320,7 +10320,7 @@ _0811F244: pop {r0} bx r0 .pool - thumb_func_end sub_811F184 + thumb_func_end InitEasyChatPhrases thumb_func_start sub_811F28C sub_811F28C: @ 811F28C diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s index f1214c557..45ca5f0aa 100644 --- a/asm/evolution_scene.s +++ b/asm/evolution_scene.s @@ -1031,7 +1031,7 @@ evovle_mon_internal_maybe: @ 813E3DC beq _0813E40C b _0813E546 _0813E40C: - ldr r6, =gUnknown_020244E9 + ldr r6, =gPlayerPartyCount ldrb r0, [r6] cmp r0, 0x5 bls _0813E416 @@ -1099,7 +1099,7 @@ _0813E484: cmp r4, 0x36 ble _0813E484 movs r4, 0x43 - ldr r7, =gUnknown_020244E9 + ldr r7, =gPlayerPartyCount _0813E4A0: ldrb r0, [r7] movs r6, 0x64 @@ -1112,7 +1112,7 @@ _0813E4A0: adds r4, 0x1 cmp r4, 0x4F ble _0813E4A0 - ldr r4, =gUnknown_020244E9 + ldr r4, =gPlayerPartyCount ldrb r0, [r4] muls r0, r6 adds r0, r5 @@ -2231,7 +2231,7 @@ _0813EF3E: lsls r5, 3 adds r5, r1 ldrb r1, [r5, 0x1C] - ldr r2, =gUnknown_020244E9 + ldr r2, =gPlayerPartyCount ldrb r2, [r2] subs r2, 0x1 lsls r2, 24 @@ -3382,7 +3382,7 @@ _0813FA3E: lsls r5, 3 adds r5, r1 ldrb r1, [r5, 0x1C] - ldr r2, =gUnknown_020244E9 + ldr r2, =gPlayerPartyCount ldrb r2, [r2] subs r2, 0x1 lsls r2, 24 diff --git a/asm/field_control_avatar.s b/asm/field_control_avatar.s index fd55e94ad..8b52e3b76 100644 --- a/asm/field_control_avatar.s +++ b/asm/field_control_avatar.s @@ -2172,7 +2172,7 @@ _0809D062: b _0809D084 _0809D07C: adds r0, r1, 0 - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript _0809D082: movs r0, 0 _0809D084: diff --git a/asm/intro.s b/asm/intro.s index 54baf2038..26ed312d6 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -312,14 +312,14 @@ c2_copyright_1: @ 816CEAC bl ResetSaveCounters movs r0, 0 bl sub_81534D0 - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0 beq _0816CEDE cmp r0, 0x2 bne _0816CEE2 _0816CEDE: - bl init_sav2 + bl Sav2_ClearSetDefault _0816CEE2: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] diff --git a/asm/item.s b/asm/item.s index 1473ae180..97582e190 100644 --- a/asm/item.s +++ b/asm/item.s @@ -1153,8 +1153,8 @@ _080D708C: bx r0 thumb_func_end sub_80D702C - thumb_func_start sub_80D7094 -sub_80D7094: @ 80D7094 + thumb_func_start ClearBag +ClearBag: @ 80D7094 push {r4,r5,lr} movs r4, 0 ldr r5, =gBagPockets @@ -1173,7 +1173,7 @@ _080D709A: pop {r0} bx r0 .pool - thumb_func_end sub_80D7094 + thumb_func_end ClearBag thumb_func_start CountTotalItemQuantityInBag @ u16 CountTotalItemQuantityInBag(u16 itemId) diff --git a/asm/link.s b/asm/link.s index 17ed8d718..39cf6ba5e 100644 --- a/asm/link.s +++ b/asm/link.s @@ -27719,7 +27719,7 @@ _08017D14: beq _08017D74 adds r4, 0x1 _08017D2E: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 blt _08017D14 @@ -27728,7 +27728,7 @@ _08017D2E: .pool _08017D44: movs r4, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 bge _08017D8E @@ -27757,7 +27757,7 @@ _08017D74: .pool _08017D84: adds r4, 0x1 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 blt _08017D50 @@ -28090,7 +28090,7 @@ sub_8018024: @ 8018024 push {r4-r6,lr} movs r6, 0 movs r5, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r6, r0 bge _08018064 @@ -28115,7 +28115,7 @@ _08018032: adds r6, 0x1 _0801805A: adds r5, 0x1 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 blt _08018032 @@ -28266,7 +28266,7 @@ _08018146: _0801816C: adds r5, 0x1 _0801816E: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 blt _08018146 @@ -34712,7 +34712,7 @@ _0801B628: ldr r1, [r0] adds r1, 0xA adds r0, r4, 0 - bl sub_80842F4 + bl CopyUnalignedWord mov r2, r8 ldr r1, [r2] adds r0, r6, 0 @@ -52660,8 +52660,8 @@ sub_8024668: @ 8024668 .pool thumb_func_end sub_8024668 - thumb_func_start sub_802467C -sub_802467C: @ 802467C + thumb_func_start SetBerryPowder +SetBerryPowder: @ 802467C ldr r2, =gSaveBlock2Ptr ldr r2, [r2] adds r2, 0xAC @@ -52670,7 +52670,7 @@ sub_802467C: @ 802467C str r2, [r0] bx lr .pool - thumb_func_end sub_802467C + thumb_func_end SetBerryPowder thumb_func_start sub_8024690 sub_8024690: @ 8024690 @@ -52749,14 +52749,14 @@ sub_8024700: @ 8024700 cmp r1, r2 bhi _08024730 adds r0, r5, 0 - bl sub_802467C + bl SetBerryPowder movs r0, 0x1 b _0802473A .pool _08024730: adds r0, r5, 0 adds r1, r2, 0 - bl sub_802467C + bl SetBerryPowder movs r0, 0 _0802473A: pop {r4,r5} @@ -52783,7 +52783,7 @@ sub_8024740: @ 8024740 adds r1, r0, 0 subs r1, r5 adds r0, r4, 0 - bl sub_802467C + bl SetBerryPowder movs r0, 0x1 b _08024776 .pool @@ -52815,7 +52815,7 @@ sub_802477C: @ 802477C ldrh r0, [r5] subs r1, r0 adds r0, r4, 0 - bl sub_802467C + bl SetBerryPowder movs r0, 0x1 b _080247B6 .pool @@ -72146,8 +72146,8 @@ sub_802E32C: @ 802E32C .pool thumb_func_end sub_802E32C - thumb_func_start sub_802E33C -sub_802E33C: @ 802E33C + thumb_func_start ResetPokeJumpResults +ResetPokeJumpResults: @ 802E33C push {lr} bl sub_802E32C movs r1, 0 @@ -72159,7 +72159,7 @@ sub_802E33C: @ 802E33C strh r1, [r0, 0x2] pop {r0} bx r0 - thumb_func_end sub_802E33C + thumb_func_end ResetPokeJumpResults thumb_func_start sub_802E354 sub_802E354: @ 802E354 diff --git a/asm/load_save.s b/asm/load_save.s index 205333800..344e05147 100644 --- a/asm/load_save.s +++ b/asm/load_save.s @@ -29,8 +29,8 @@ _08076B8A: .pool thumb_func_end CheckForFlashMemory - thumb_func_start memclr_stdsav2 -memclr_stdsav2: @ 8076B94 + thumb_func_start ClearSav2 +ClearSav2: @ 8076B94 push {lr} sub sp, 0x4 mov r1, sp @@ -44,10 +44,10 @@ memclr_stdsav2: @ 8076B94 pop {r0} bx r0 .pool - thumb_func_end memclr_stdsav2 + thumb_func_end ClearSav2 - thumb_func_start clear_sav1 -clear_sav1: @ 8076BB8 + thumb_func_start ClearSav1 +ClearSav1: @ 8076BB8 push {lr} sub sp, 0x4 mov r1, sp @@ -61,7 +61,7 @@ clear_sav1: @ 8076BB8 pop {r0} bx r0 .pool - thumb_func_end clear_sav1 + thumb_func_end ClearSav1 thumb_func_start InitSaveBlockPointersWithRandomOffset @ void InitSaveBlockPointersWithRandomOffset(u8 offset) @@ -258,7 +258,7 @@ copy_player_party_to_sav1: @ 8076D8C push {r4,lr} ldr r0, =gSaveBlock1Ptr ldr r0, [r0] - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldrb r1, [r1] movs r2, 0x8D lsls r2, 2 @@ -290,7 +290,7 @@ _08076DA0: thumb_func_start copy_player_party_from_sav1 copy_player_party_from_sav1: @ 8076DD4 push {r4,r5,lr} - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldr r0, =gSaveBlock1Ptr ldr r0, [r0] movs r2, 0x8D diff --git a/asm/lottery_corner.s b/asm/lottery_corner.s index e8e00fe33..fff59640f 100644 --- a/asm/lottery_corner.s +++ b/asm/lottery_corner.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_8177558 -sub_8177558: @ 8177558 + thumb_func_start ResetLotteryCorner +ResetLotteryCorner: @ 8177558 push {r4,lr} bl Random adds r4, r0, 0 @@ -23,7 +23,7 @@ sub_8177558: @ 8177558 pop {r0} bx r0 .pool - thumb_func_end sub_8177558 + thumb_func_end ResetLotteryCorner thumb_func_start sub_8177584 sub_8177584: @ 8177584 diff --git a/asm/main_menu.s b/asm/main_menu.s index 559c351ef..24923524b 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -278,7 +278,7 @@ _0802F900: movs r0, 0x1 strh r0, [r4, 0x1E] _0802F946: - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0x2 beq _0802F990 diff --git a/asm/mauville_old_man.s b/asm/mauville_old_man.s index ef08dc65f..e0b987f26 100644 --- a/asm/mauville_old_man.s +++ b/asm/mauville_old_man.s @@ -95,8 +95,8 @@ sub_8120154: @ 8120154 bx r0 thumb_func_end sub_8120154 - thumb_func_start sub_8120160 -sub_8120160: @ 8120160 + thumb_func_start SetMauvilleOldMan +SetMauvilleOldMan: @ 8120160 push {lr} ldr r0, =gSaveBlock2Ptr ldr r0, [r0] @@ -141,7 +141,7 @@ _081201C0: bl sub_8120B5C pop {r0} bx r0 - thumb_func_end sub_8120160 + thumb_func_end SetMauvilleOldMan thumb_func_start sub_81201C8 sub_81201C8: @ 81201C8 diff --git a/asm/money.s b/asm/money.s index f3f46855e..41f2b2532 100644 --- a/asm/money.s +++ b/asm/money.s @@ -18,9 +18,9 @@ DecryptMoney: @ 80E5114 .pool thumb_func_end DecryptMoney - thumb_func_start EncryptMoney -@ void EncryptMoney(u32 *moneyPointer, u32 moneyAmount) -EncryptMoney: @ 80E5128 + thumb_func_start SetMoney +@ void SetMoney(u32 *moneyPointer, u32 moneyAmount) +SetMoney: @ 80E5128 ldr r2, =gSaveBlock2Ptr ldr r2, [r2] adds r2, 0xAC @@ -29,7 +29,7 @@ EncryptMoney: @ 80E5128 str r2, [r0] bx lr .pool - thumb_func_end EncryptMoney + thumb_func_end SetMoney thumb_func_start IsEnoughMoney @ bool8 IsEnoughMoney(u32 *moneyPointer, u32 price) @@ -71,7 +71,7 @@ add_money: @ 80E5154 _080E5178: adds r0, r6, 0 adds r1, r5, 0 - bl EncryptMoney + bl SetMoney pop {r4-r6} pop {r0} bx r0 @@ -94,7 +94,7 @@ _080E51A0: subs r1, r4 _080E51A2: adds r0, r5, 0 - bl EncryptMoney + bl SetMoney pop {r4,r5} pop {r0} bx r0 diff --git a/asm/mystery_event_script.s b/asm/mystery_event_script.s index c3a7918c7..389b8146a 100644 --- a/asm/mystery_event_script.s +++ b/asm/mystery_event_script.s @@ -418,7 +418,7 @@ sub_8153ACC: @ 8153ACC subs r0, r1 ldr r1, [r4, 0x64] adds r0, r1 - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript movs r0, 0 pop {r4} pop {r1} @@ -680,7 +680,7 @@ _08153D18: movs r2, 0xB bl StringCopyN _08153D22: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r0, 0x6 bne _08153D4C diff --git a/asm/new_game.s b/asm/new_game.s index 3faf99744..5a13e5f3e 100644 --- a/asm/new_game.s +++ b/asm/new_game.s @@ -5,251 +5,13 @@ .text - thumb_func_start write_word_to_mem -@ void write_word_to_mem(int value, int *mem) -write_word_to_mem: @ 80842CC - strb r0, [r1] - lsrs r2, r0, 8 - strb r2, [r1, 0x1] - lsrs r2, r0, 16 - strb r2, [r1, 0x2] - lsrs r0, 24 - strb r0, [r1, 0x3] - bx lr - thumb_func_end write_word_to_mem - thumb_func_start sub_80842DC -sub_80842DC: @ 80842DC - adds r2, r0, 0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - ldrb r1, [r2, 0x2] - lsls r1, 16 - orrs r0, r1 - ldrb r1, [r2, 0x1] - lsls r1, 8 - orrs r0, r1 - ldrb r1, [r2] - orrs r0, r1 - bx lr - thumb_func_end sub_80842DC - - thumb_func_start sub_80842F4 -sub_80842F4: @ 80842F4 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - movs r2, 0 -_080842FC: - adds r0, r4, r2 - adds r1, r3, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0x3 - ble _080842FC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80842F4 - - thumb_func_start set_player_trainer_id -set_player_trainer_id: @ 8084310 - push {r4,lr} - bl Random - adds r4, r0, 0 - bl GetTrainerId - lsls r4, 16 - lsls r0, 16 - lsrs r0, 16 - orrs r4, r0 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r1, 0xA - adds r0, r4, 0 - bl write_word_to_mem - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end set_player_trainer_id - - thumb_func_start init_options -init_options: @ 808433C - ldr r3, =gSaveBlock2Ptr - ldr r2, [r3] - ldrb r1, [r2, 0x14] - movs r0, 0x8 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x14] - ldr r2, [r3] - ldrb r1, [r2, 0x14] - movs r0, 0x7 - ands r0, r1 - strb r0, [r2, 0x14] - ldr r2, [r3] - ldrb r1, [r2, 0x15] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] - ldr r2, [r3] - ldrb r1, [r2, 0x15] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] - ldr r2, [r3] - ldrb r1, [r2, 0x15] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] - ldr r2, [r3] - ldrb r1, [r2, 0x15] - movs r0, 0x9 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] - bx lr - .pool - thumb_func_end init_options - - thumb_func_start sub_8084390 -sub_8084390: @ 8084390 - push {r4,lr} - ldr r1, =gUnknown_030060B0 - movs r0, 0 - strb r0, [r1] - ldr r4, =gSaveBlock2Ptr - ldr r0, [r4] - adds r0, 0x28 - movs r1, 0 - movs r2, 0x34 - bl memset - ldr r0, [r4] - adds r0, 0x5C - movs r1, 0 - movs r2, 0x34 - bl memset - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8084390 - - thumb_func_start sub_80843C0 -sub_80843C0: @ 80843C0 - push {r4-r7,lr} - bl sub_80DF040 - movs r2, 0x8 - ldr r0, =gSaveBlock1Ptr - mov r12, r0 - ldr r4, =0x00002e90 - ldr r3, =gUnknown_08339D1C -_080843D0: - mov r1, r12 - ldr r0, [r1] - lsls r1, r2, 5 - adds r0, r1 - adds r0, r4 - adds r1, r3, 0 - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5,r6} - stm r0!, {r5,r6} - adds r2, 0x1 - cmp r2, 0xC - ble _080843D0 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80843C0 - - thumb_func_start sub_8084400 -sub_8084400: @ 8084400 - push {r4,lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r4, =gSaveBlock2Ptr - ldr r1, [r4] - ldr r0, =0x0000064c - adds r1, r0 - ldr r2, =0x05000238 - mov r0, sp - bl CpuSet - ldr r0, [r4] - ldr r1, =0x00000ee1 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - ldr r1, =0x00000ee9 - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8084400 - - thumb_func_start sub_808444C -sub_808444C: @ 808444C - push {lr} - sub sp, 0x4 - movs r3, 0x1 - negs r3, r3 - str r3, [sp] - movs r0, 0x19 - movs r1, 0x28 - adds r2, r3, 0 - bl warp1_set - bl warp_in - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_808444C - - thumb_func_start init_sav2 -init_sav2: @ 808446C - push {lr} - bl memclr_stdsav2 - bl init_options - pop {r0} - bx r0 - thumb_func_end init_sav2 - - thumb_func_start sub_808447C -sub_808447C: @ 808447C - push {lr} - ldr r1, =gUnknown_020322D4 - movs r0, 0 - strb r0, [r1] - bl sub_80BB358 - bl zero_player_party_data - bl zero_enemy_party_data - bl sub_81AAB70 - bl sub_813624C - pop {r0} - bx r0 - .pool - thumb_func_end sub_808447C thumb_func_start NewGameInitData @ void NewGameInitData() NewGameInitData: @ 80844A0 push {r4,r5,lr} - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0 beq _080844AE @@ -258,7 +20,7 @@ NewGameInitData: @ 80844A0 _080844AE: bl RtcReset _080844B2: - ldr r1, =gUnknown_020322D4 + ldr r1, =gDifferentSaveFile movs r0, 0x1 strb r0, [r1] ldr r4, =gSaveBlock2Ptr @@ -266,80 +28,80 @@ _080844B2: adds r0, 0xAC movs r5, 0 str r5, [r0] - bl zero_player_party_data - bl zero_enemy_party_data - bl sub_80BB2D0 + bl ZeroPlayerPartyMons + bl ZeroEnemyPartyMons + bl ResetPokedex bl sub_8084400 - bl clear_sav1 - bl sub_80D436C + bl ClearSav1 + bl ClearMailData ldr r0, [r4] strb r5, [r0, 0x9] ldr r0, [r4] adds r0, 0xA8 str r5, [r0] - bl set_player_trainer_id + bl InitPlayerTrainerId bl PlayTimeCounter_Reset - bl sub_8084390 + bl ClearPokedexFlags bl InitEventData - bl sub_80EBEE0 - bl GabbyAndTyNewGameInitData - bl sub_80E8B28 - bl RemoveAllBerryTrees + bl ClearTVShowData + bl ResetGabbyAndTy + bl ResetSecretBases + bl ClearBerryTrees ldr r4, =gSaveBlock1Ptr ldr r0, [r4] movs r1, 0x92 lsls r1, 3 adds r0, r1 ldr r1, =0x00000bb8 - bl EncryptMoney + bl SetMoney movs r0, 0 bl SetCoins - bl sub_80D766C - bl sub_80847A8 - bl sub_80843C0 - bl sub_813C1F8 - bl sub_80F9A7C - bl sub_80F9AD4 - ldr r0, =gUnknown_020244E9 + bl ResetLinkContestBoolean + bl ResetGameStats + bl ClearAllContestWinnerPics + bl InitLinkBattleRecords + bl InitSeedotSizeRecord + bl InitLotadSizeRecord + ldr r0, =gPlayerPartyCount strb r5, [r0] - bl zero_player_party_data - bl sub_80C7770 - bl sub_8161B34 - bl sub_8161B60 + bl ZeroPlayerPartyMons + bl ResetPokemonStorageSystem + bl ClearRoamerData + bl ClearRoamerLocationData ldr r0, [r4] ldr r1, =0x00000496 adds r0, r1 strh r5, [r0] - bl sub_80D7094 - bl sub_816ADF4 - bl sub_8136E88 - bl sub_81618B4 - bl sub_811F184 - bl sub_8120160 - bl sub_81224D4 - bl sub_813BA10 - bl sub_8177558 - bl sub_808444C + bl ClearBag + bl NewGameInitPCItems + bl ClearPokeblocks + bl ClearDecorationInventories + bl InitEasyChatPhrases + bl SetMauvilleOldMan + bl InitDewfordTrend + bl ResetFanClub + bl ResetLotteryCorner + bl WarpToTruck ldr r0, =gUnknown_082715DE - bl script_env_2_execute_new_script - bl sub_80845CC + bl ScriptContext2_RunNewScript + bl ResetMiniGamesResults bl copy_strings_to_sav1 - bl sub_818DA30 + bl SetLilycoveLady bl sub_819FAA0 bl sub_81A4B14 bl sub_8195E10 bl sub_801AFD8 bl sub_800E5AC bl sub_81D54BC - bl sub_80DED74 + bl ResetContestLinkResults pop {r4,r5} pop {r0} bx r0 .pool thumb_func_end NewGameInitData - thumb_func_start sub_80845CC -sub_80845CC: @ 80845CC + thumb_func_start ResetMiniGamesResults +ResetMiniGamesResults: @ 80845CC push {r4-r6,lr} sub sp, 0x4 mov r0, sp @@ -359,8 +121,8 @@ sub_80845CC: @ 80845CC lsls r1, 1 adds r0, r1 movs r1, 0 - bl sub_802467C - bl sub_802E33C + bl SetBerryPowder + bl ResetPokeJumpResults mov r0, sp adds r0, 0x2 strh r5, [r0] @@ -375,6 +137,6 @@ sub_80845CC: @ 80845CC pop {r0} bx r0 .pool - thumb_func_end sub_80845CC + thumb_func_end ResetMiniGamesResults .align 2, 0 @ Don't pad with nop. diff --git a/asm/player_pc.s b/asm/player_pc.s index 4d46af800..dc76f8138 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_816ADF4 -sub_816ADF4: @ 816ADF4 + thumb_func_start NewGameInitPCItems +NewGameInitPCItems: @ 816ADF4 push {r4-r6,lr} movs r4, 0 ldr r0, =gSaveBlock1Ptr @@ -53,7 +53,7 @@ _0816AE48: pop {r0} bx r0 .pool - thumb_func_end sub_816ADF4 + thumb_func_end NewGameInitPCItems thumb_func_start sub_816AE58 sub_816AE58: @ 816AE58 diff --git a/asm/pokedex.s b/asm/pokedex.s index ec9178ada..14deef48d 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_80BB2D0 -sub_80BB2D0: @ 80BB2D0 + thumb_func_start ResetPokedex +ResetPokedex: @ 80BB2D0 push {r4-r6,lr} ldr r0, =gUnknown_02039B50 movs r2, 0 @@ -62,7 +62,7 @@ _080BB30C: pop {r0} bx r0 .pool - thumb_func_end sub_80BB2D0 + thumb_func_end ResetPokedex thumb_func_start sub_80BB358 sub_80BB358: @ 80BB358 diff --git a/asm/pokemon_1.s b/asm/pokemon_1.s index 0bc58b905..e10ed54c5 100644 --- a/asm/pokemon_1.s +++ b/asm/pokemon_1.s @@ -79,9 +79,9 @@ zero_pokemon_struct: @ 8067A8C bx r0 thumb_func_end zero_pokemon_struct - thumb_func_start zero_player_party_data -@ void zero_player_party_data() -zero_player_party_data: @ 8067B0C + thumb_func_start ZeroPlayerPartyMons +@ void ZeroPlayerPartyMons() +ZeroPlayerPartyMons: @ 8067B0C push {r4,r5,lr} ldr r4, =gPlayerParty movs r0, 0xFA @@ -97,10 +97,10 @@ _08067B16: pop {r0} bx r0 .pool - thumb_func_end zero_player_party_data + thumb_func_end ZeroPlayerPartyMons - thumb_func_start zero_enemy_party_data -zero_enemy_party_data: @ 8067B2C + thumb_func_start ZeroEnemyPartyMons +ZeroEnemyPartyMons: @ 8067B2C push {r4,r5,lr} ldr r4, =gEnemyParty movs r0, 0xFA @@ -116,7 +116,7 @@ _08067B36: pop {r0} bx r0 .pool - thumb_func_end zero_enemy_party_data + thumb_func_end ZeroEnemyPartyMons thumb_func_start create_pokemon_set_level @ void create_pokemon_set_level(pokemon *mon, s16 species_num, u8 level, u8 forced_iv, char pokemon_id_is_nonrandom, int pokemon_id, u8 trainer_id_mode, int trainer_id) @@ -2139,7 +2139,7 @@ DoScriptedWildBattle: @ 8068C18 ldrh r4, [r0] ldr r0, =gSpecialVar_0x8006 ldrh r6, [r0] - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r7, =gEnemyParty lsls r4, 24 lsrs r4, 24 diff --git a/asm/pokemon_2.s b/asm/pokemon_2.s index d8c4410f7..2346d0916 100644 --- a/asm/pokemon_2.s +++ b/asm/pokemon_2.s @@ -2916,7 +2916,7 @@ _0806B446: adds r1, r6, 0 movs r2, 0x64 bl memcpy_pokemon - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount adds r0, r5, 0x1 strb r0, [r1] movs r0, 0 @@ -3014,7 +3014,7 @@ _0806B530: @ u8 calc_player_party_count() calc_player_party_count: @ 806B53C push {r4,lr} - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount movs r1, 0 strb r1, [r0] b _0806B554 @@ -3089,7 +3089,7 @@ sub_806B5C4: @ 806B5C4 push {r4-r6,lr} movs r6, 0 bl calc_player_party_count - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldrb r0, [r1] cmp r0, 0x1 beq _0806B628 @@ -3126,7 +3126,7 @@ _0806B5DC: adds r6, 0x1 _0806B616: adds r5, 0x1 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 blt _0806B5DC @@ -3262,7 +3262,7 @@ create_enemy_party: @ 806B70C push {r5-r7} sub sp, 0x14 adds r5, r0, 0 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r4, =gBattleResources ldr r0, [r4] ldr r0, [r0] diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 84cdaff7c..9efd38fe0 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -2484,12 +2484,12 @@ _080E8150: adds r5, r1, 0 adds r5, 0x34 adds r0, r5, 0 - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 mov r1, r9 ldr r0, [r1] adds r0, 0xA - bl sub_80842DC + bl ReadUnalignedWord cmp r4, r0 beq _080E819A movs r2, 0x1 @@ -2497,12 +2497,12 @@ _080E8150: str r6, [sp, 0x4] _080E819A: adds r0, r5, 0 - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 mov r1, r9 ldr r0, [r1] adds r0, 0xA - bl sub_80842DC + bl ReadUnalignedWord cmp r4, r0 bne _080E81B8 ldr r2, [sp, 0xC] @@ -2619,7 +2619,7 @@ _080E8286: ldr r1, [r2] adds r1, 0xA adds r0, r5, 0 - bl sub_80842F4 + bl CopyUnalignedWord movs r0, 0x2 strb r0, [r4, 0xE] mov r0, r10 @@ -2662,13 +2662,13 @@ _080E82DA: ldr r1, [r2] adds r1, 0xA adds r0, r5, 0 - bl sub_80842F4 + bl CopyUnalignedWord mov r0, r10 ldr r1, [r0] ldr r2, [sp, 0x8] adds r1, r2 adds r0, r6, 0 - bl sub_80842F4 + bl CopyUnalignedWord mov r0, r10 ldr r1, [r0] mov r0, r9 @@ -2810,10 +2810,10 @@ sub_80E841C: @ 80E841C _080E842E: adds r0, r7, 0 adds r0, 0x34 - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 adds r0, r6, 0 - bl sub_80842DC + bl ReadUnalignedWord cmp r4, r0 bne _080E844E ldrb r0, [r7, 0x2] @@ -3109,13 +3109,13 @@ _080E8666: ldr r6, [sp, 0x1C] adds r0, r6, r0 str r3, [sp, 0x4C] - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 ldr r1, [sp, 0x50] ldr r0, [r1] add r0, r9 adds r0, r7 - bl sub_80842DC + bl ReadUnalignedWord ldr r3, [sp, 0x4C] cmp r4, r0 bne _080E86A8 @@ -3271,7 +3271,7 @@ _080E878E: adds r5, r0, r6 adds r0, r5, 0 str r3, [sp, 0x4C] - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 movs r6, 0x90 lsls r6, 1 @@ -3279,18 +3279,18 @@ _080E878E: mov r1, r9 ldr r0, [r1] adds r0, r6 - bl sub_80842DC + bl ReadUnalignedWord ldr r3, [sp, 0x4C] cmp r4, r0 bne _080E8808 adds r0, r5, 0x4 - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 mov r2, r9 ldr r0, [r2] adds r0, r6 adds r0, 0x4 - bl sub_80842DC + bl ReadUnalignedWord ldr r3, [sp, 0x4C] cmp r4, r0 bne _080E8808 diff --git a/asm/reset_rtc_screen.s b/asm/reset_rtc_screen.s index f4904a147..ccef727ff 100644 --- a/asm/reset_rtc_screen.s +++ b/asm/reset_rtc_screen.s @@ -1154,7 +1154,7 @@ _0809F268: beq _0809F276 b _0809F404 _0809F276: - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0 beq _0809F282 diff --git a/asm/rom3.s b/asm/rom3.s index 114484544..88c5a015b 100644 --- a/asm/rom3.s +++ b/asm/rom3.s @@ -85,7 +85,7 @@ _080326B8: ands r0, r1 cmp r0, 0 beq _08032728 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r4, =gEnemyParty movs r1, 0x90 lsls r1, 1 diff --git a/asm/rom4.s b/asm/rom4.s index 498d8acac..2f047b639 100644 --- a/asm/rom4.s +++ b/asm/rom4.s @@ -9,7 +9,7 @@ sub_8084620: @ 8084620 push {r4,lr} ldr r0, =gUnknown_08271857 - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript ldr r0, =gSaveBlock1Ptr ldr r4, [r0] movs r0, 0x92 @@ -20,7 +20,7 @@ sub_8084620: @ 8084620 adds r1, r0, 0 lsrs r1, 1 adds r0, r4, 0 - bl EncryptMoney + bl SetMoney bl sp000_heal_pokemon bl sub_8084720 bl copy_saved_warp3_bank_and_enter_x_to_warp1 @@ -65,7 +65,7 @@ sub_808469C: @ 808469C ldr r0, =0x00000888 bl FlagReset ldr r0, =gUnknown_08271862 - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript pop {r0} bx r0 .pool @@ -138,8 +138,8 @@ sub_8084788: @ 8084788 .pool thumb_func_end sub_8084788 - thumb_func_start sub_80847A8 -sub_80847A8: @ 80847A8 + thumb_func_start ResetGameStats +ResetGameStats: @ 80847A8 push {r4,lr} movs r4, 0 _080847AC: @@ -153,7 +153,7 @@ _080847AC: pop {r4} pop {r0} bx r0 - thumb_func_end sub_80847A8 + thumb_func_end ResetGameStats thumb_func_start IncrementGameStat @ void IncrementGameStat(u8 a1) @@ -3496,7 +3496,7 @@ sub_8086230: @ 8086230 bl sub_808631C bl StopMapMusic bl ResetSafariZoneFlag_ - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0xFF bne _0808624A diff --git a/asm/rom6.s b/asm/rom6.s index 766aa8fba..9ded5bf72 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -2978,8 +2978,8 @@ sub_8136E20: @ 8136E20 .pool thumb_func_end sub_8136E20 - thumb_func_start sub_8136E88 -sub_8136E88: @ 8136E88 + thumb_func_start ClearPokeblocks +ClearPokeblocks: @ 8136E88 push {r4,lr} movs r4, 0 _08136E8C: @@ -2993,7 +2993,7 @@ _08136E8C: pop {r4} pop {r0} bx r0 - thumb_func_end sub_8136E88 + thumb_func_end ClearPokeblocks thumb_func_start sub_8136EA4 sub_8136EA4: @ 8136EA4 @@ -12124,8 +12124,8 @@ _0813BA08: bx r1 thumb_func_end sub_813B9C0 - thumb_func_start sub_813BA10 -sub_813BA10: @ 813BA10 + thumb_func_start ResetFanClub +ResetFanClub: @ 813BA10 ldr r0, =gSaveBlock1Ptr ldr r0, [r0] ldr r2, =0x0000141e @@ -12138,7 +12138,7 @@ sub_813BA10: @ 813BA10 strh r2, [r0] bx lr .pool - thumb_func_end sub_813BA10 + thumb_func_end ResetFanClub thumb_func_start sub_813BA30 sub_813BA30: @ 813BA30 diff --git a/asm/rom_8034C54.s b/asm/rom_8034C54.s index 838ba77a5..c83e3aab7 100644 --- a/asm/rom_8034C54.s +++ b/asm/rom_8034C54.s @@ -5742,7 +5742,7 @@ _0803800C: subs r6, 0x1 cmp r6, 0 bge _08037FA4 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r1, =gBattleCommunication ldrb r0, [r1] adds r0, 0x1 @@ -6278,7 +6278,7 @@ sub_803849C: @ 803849C negs r0, r0 ands r0, r2 strb r0, [r1] - bl zero_enemy_party_data + bl ZeroEnemyPartyMons movs r0, 0x5A bl m4aSongNumStop bl sub_805F094 @@ -6452,7 +6452,7 @@ _08038610: _08038624: cmp r2, 0x1 bne _0803862C - bl zero_enemy_party_data + bl ZeroEnemyPartyMons _0803862C: ldr r0, [r4] movs r1, 0x80 diff --git a/asm/rom_80C6FA0.s b/asm/rom_80C6FA0.s index d9bd820a8..440b576d2 100644 --- a/asm/rom_80C6FA0.s +++ b/asm/rom_80C6FA0.s @@ -991,8 +991,8 @@ _080C7764: bx r1 thumb_func_end sub_80C76A4 - thumb_func_start sub_80C7770 -sub_80C7770: @ 80C7770 + thumb_func_start ResetPokemonStorageSystem +ResetPokemonStorageSystem: @ 80C7770 push {r4-r6,lr} movs r0, 0 bl sub_80D1D18 @@ -1048,7 +1048,7 @@ _080C77C2: pop {r0} bx r0 .pool - thumb_func_end sub_80C7770 + thumb_func_end ResetPokemonStorageSystem thumb_func_start sub_80C77E8 sub_80C77E8: @ 80C77E8 @@ -5190,7 +5190,7 @@ _080C9CE4: bne _080C9D08 bl sub_80CABE0 bl calc_player_party_count - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount strb r0, [r1] ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -5322,7 +5322,7 @@ _080C9E18: bne _080C9E3C bl sub_80CABE0 bl calc_player_party_count - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount strb r0, [r1] ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -25542,8 +25542,8 @@ sub_80D4354: @ 80D4354 bx r0 thumb_func_end sub_80D4354 - thumb_func_start sub_80D436C -sub_80D436C: @ 80D436C + thumb_func_start ClearMailData +ClearMailData: @ 80D436C push {r4,r5,lr} movs r4, 0 ldr r5, =gSaveBlock1Ptr @@ -25565,7 +25565,7 @@ _080D4372: pop {r0} bx r0 .pool - thumb_func_end sub_80D436C + thumb_func_end ClearMailData thumb_func_start sub_80D439C sub_80D439C: @ 80D439C diff --git a/asm/rom_8158B30.s b/asm/rom_8158B30.s index 800904a89..05c81dcfc 100644 --- a/asm/rom_8158B30.s +++ b/asm/rom_8158B30.s @@ -15750,7 +15750,7 @@ _08160C56: ldr r1, [r1] adds r1, 0x44 ldrb r1, [r1] - ldr r2, =gUnknown_020244E9 + ldr r2, =gPlayerPartyCount ldrb r2, [r2] subs r2, 0x1 lsls r2, 24 @@ -17157,8 +17157,8 @@ _081618AA: .pool thumb_func_end sub_8161880 - thumb_func_start sub_81618B4 -sub_81618B4: @ 81618B4 + thumb_func_start ClearDecorationInventories +ClearDecorationInventories: @ 81618B4 push {r4,lr} movs r4, 0 _081618B8: @@ -17172,7 +17172,7 @@ _081618B8: pop {r4} pop {r0} bx r0 - thumb_func_end sub_81618B4 + thumb_func_end ClearDecorationInventories thumb_func_start sub_81618D0 sub_81618D0: @ 81618D0 @@ -17514,8 +17514,8 @@ _08161B16: bx r1 thumb_func_end sub_8161B10 - thumb_func_start sub_8161B34 -sub_8161B34: @ 8161B34 + thumb_func_start ClearRoamerData +ClearRoamerData: @ 8161B34 push {r4,r5,lr} ldr r5, =gSaveBlock1Ptr ldr r0, [r5] @@ -17532,10 +17532,10 @@ sub_8161B34: @ 8161B34 pop {r0} bx r0 .pool - thumb_func_end sub_8161B34 + thumb_func_end ClearRoamerData - thumb_func_start sub_8161B60 -sub_8161B60: @ 8161B60 + thumb_func_start ClearRoamerLocationData +ClearRoamerLocationData: @ 8161B60 push {r4-r6,lr} movs r2, 0 ldr r6, =gUnknown_0203BC86 @@ -17560,7 +17560,7 @@ _08161B6C: pop {r0} bx r0 .pool - thumb_func_end sub_8161B60 + thumb_func_end ClearRoamerLocationData thumb_func_start sub_8161B94 sub_8161B94: @ 8161B94 @@ -17692,8 +17692,8 @@ _08161BC8: thumb_func_start sub_8161CBC sub_8161CBC: @ 8161CBC push {lr} - bl sub_8161B34 - bl sub_8161B60 + bl ClearRoamerData + bl ClearRoamerLocationData ldr r0, =gSpecialVar_0x8004 ldrh r0, [r0] bl sub_8161B94 @@ -17868,7 +17868,7 @@ sub_8161E28: @ 8161E28 push {r4,r5,lr} sub sp, 0x4 ldr r5, =gEnemyParty - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r4, =gSaveBlock1Ptr ldr r0, [r4] ldr r1, =0x000031dc @@ -19954,7 +19954,7 @@ sub_8163048: @ 8163048 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gUnknown_02038BCA ldrh r0, [r0] movs r1, 0 @@ -19972,7 +19972,7 @@ sub_816306C: @ 816306C adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gUnknown_02038BCA ldrh r0, [r0] movs r1, 0 @@ -19995,7 +19995,7 @@ sub_81630A0: @ 81630A0 adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gUnknown_02038BCA ldrh r0, [r0] movs r1, 0 @@ -20604,7 +20604,7 @@ _08163580: thumb_func_start sub_8163590 sub_8163590: @ 8163590 push {lr} - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0x00000ca9 @@ -21340,7 +21340,7 @@ _08163BC4: b _08163E10 .pool _08163C10: - bl zero_enemy_party_data + bl ZeroEnemyPartyMons movs r5, 0 ldr r4, =gSaveBlock2Ptr _08163C18: @@ -21668,7 +21668,7 @@ _08163F52: ldr r4, =gSaveBlock2Ptr ldr r1, [r4] adds r1, 0xA - bl sub_80842F4 + bl CopyUnalignedWord adds r0, r5, 0x4 ldr r1, [r4] bl StringCopy7 @@ -23782,7 +23782,7 @@ _081651A6: adds r0, 0xC ldr r1, [r5] adds r1, 0xA - bl sub_80842F4 + bl CopyUnalignedWord adds r0, r7, 0x4 ldr r1, [r5] bl StringCopy7 diff --git a/asm/rom_81700F8.s b/asm/rom_81700F8.s index 115b9d0cb..4c35e747c 100644 --- a/asm/rom_81700F8.s +++ b/asm/rom_81700F8.s @@ -34,14 +34,14 @@ sub_81700F8: @ 81700F8 bl ResetSaveCounters movs r0, 0 bl sub_81534D0 - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0 beq _08170148 cmp r0, 0x2 bne _0817014C _08170148: - bl init_sav2 + bl Sav2_ClearSetDefault _0817014C: ldr r0, =gSaveBlock2Ptr ldr r0, [r0] diff --git a/asm/rom_8184DA4.s b/asm/rom_8184DA4.s index b3f81a6ec..f22214f93 100644 --- a/asm/rom_8184DA4.s +++ b/asm/rom_8184DA4.s @@ -1596,8 +1596,8 @@ sub_8185B60: @ 8185B60 push {r5-r7} sub sp, 0x4 adds r7, r0, 0 - bl zero_player_party_data - bl zero_enemy_party_data + bl ZeroPlayerPartyMons + bl ZeroEnemyPartyMons movs r6, 0 ldr r0, =gPlayerParty mov r8, r0 diff --git a/asm/rom_818CFC8.s b/asm/rom_818CFC8.s index f9a5aa0b5..fdf71043e 100644 --- a/asm/rom_818CFC8.s +++ b/asm/rom_818CFC8.s @@ -1332,8 +1332,8 @@ _0818DA24: .pool thumb_func_end sub_818D9C0 - thumb_func_start sub_818DA30 -sub_818DA30: @ 818DA30 + thumb_func_start SetLilycoveLady +SetLilycoveLady: @ 818DA30 push {lr} ldr r0, =gSaveBlock2Ptr ldr r0, [r0] @@ -1369,7 +1369,7 @@ _0818DA6E: _0818DA72: pop {r0} bx r0 - thumb_func_end sub_818DA30 + thumb_func_end SetLilycoveLady thumb_func_start sub_818DA78 sub_818DA78: @ 818DA78 @@ -5248,7 +5248,7 @@ sub_818FBDC: @ 818FBDC lsrs r0, 16 mov r8, r0 movs r6, 0 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons mov r0, r8 bl sub_818FC78 adds r5, r0, 0 @@ -18708,7 +18708,7 @@ sub_8196D74: @ 8196D74 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] adds r0, 0xA - bl sub_80842DC + bl ReadUnalignedWord adds r6, r0, 0 ldr r0, =0x0000ffff ands r6, r0 @@ -39145,11 +39145,11 @@ _081A13D4: ldr r0, [r7] add r0, r8 adds r0, 0x34 - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 ldr r0, [r7] adds r0, 0xA - bl sub_80842DC + bl ReadUnalignedWord cmp r4, r0 bne _081A13FC ldr r0, [r7] @@ -42698,7 +42698,7 @@ _081A3298: mov r3, r9 ldr r1, [r3] adds r1, r2 - bl write_word_to_mem + bl WriteUnalignedWord _081A32F2: mov r7, r9 ldr r0, [r7] @@ -45516,7 +45516,7 @@ _081A4B44: movs r1, 0 str r2, [sp] str r3, [sp, 0x4] - bl sub_80842F4 + bl CopyUnalignedWord ldr r3, [sp, 0x4] ldr r0, [r3] adds r0, r4 @@ -45567,14 +45567,14 @@ _081A4BAE: adds r0, r2 movs r1, 0 str r2, [sp] - bl sub_80842F4 + bl CopyUnalignedWord ldr r0, [r7] adds r0, r6 ldr r2, [sp] adds r0, r2 adds r0, 0x4 movs r1, 0 - bl sub_80842F4 + bl CopyUnalignedWord ldr r1, [r7] adds r1, r4 ldr r0, =0x00000586 @@ -45642,7 +45642,7 @@ _081A4C4E: adds r5, 0x64 cmp r4, r6 ble _081A4C4E - ldr r4, =gUnknown_020244E9 + ldr r4, =gPlayerPartyCount ldrb r5, [r4] bl copy_player_party_from_sav1 bl sub_8076D5C @@ -45859,7 +45859,7 @@ sub_81A4E04: @ 81A4E04 _081A4E44: movs r4, 0x7 _081A4E46: - bl zero_enemy_party_data + bl ZeroEnemyPartyMons movs r1, 0 str r1, [sp, 0x18] bl sub_8165C40 @@ -48079,7 +48079,7 @@ nullsub_123: @ 81A6184 thumb_func_start sub_81A6188 sub_81A6188: @ 81A6188 push {lr} - bl zero_player_party_data + bl ZeroPlayerPartyMons bl sub_819A4F8 pop {r0} bx r0 @@ -48509,7 +48509,7 @@ _081A6518: bls _081A6522 b _081A666C _081A6522: - bl zero_player_party_data + bl ZeroPlayerPartyMons movs r0, 0 mov r8, r0 mov r1, sp @@ -57200,8 +57200,8 @@ _081AAB5A: .pool thumb_func_end CalculateBattlePyramidPickupItemId - thumb_func_start sub_81AAB70 -sub_81AAB70: @ 81AAB70 + thumb_func_start ResetBagScrollPositions +ResetBagScrollPositions: @ 81AAB70 push {r4,lr} ldr r4, =gUnknown_0203CE58 movs r0, 0 @@ -57220,7 +57220,7 @@ sub_81AAB70: @ 81AAB70 pop {r0} bx r0 .pool - thumb_func_end sub_81AAB70 + thumb_func_end ResetBagScrollPositions thumb_func_start CB2_BagMenuFromStartMenu @ void CB2_BagMenuFromStartMenu() @@ -62757,7 +62757,7 @@ _081ADCAE: adds r0, r2 movs r1, 0x10 bl ClearItemSlots - bl sub_81AAB70 + bl ResetBagScrollPositions pop {r4-r6} pop {r0} bx r0 @@ -70216,7 +70216,7 @@ _081B187A: _081B1888: cmp r1, 0x6 bne _081B1898 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] subs r0, 0x1 b _081B1950 @@ -70234,7 +70234,7 @@ _081B1898: b _081B1950 .pool _081B18B0: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] subs r0, 0x1 b _081B1950 @@ -70250,7 +70250,7 @@ _081B18C0: beq _081B194E movs r1, 0 ldrsb r1, [r4, r1] - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] subs r0, 0x1 cmp r1, r0 @@ -70271,7 +70271,7 @@ _081B18F4: adds r0, r2, 0x1 b _081B1950 _081B18F8: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r0, 0x1 beq _081B1952 @@ -70359,7 +70359,7 @@ _081B1988: _081B1996: cmp r0, 0x6 bne _081B19A8 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] subs r0, 0x1 b _081B1AF2 @@ -71245,7 +71245,7 @@ sub_81B209C: @ 81B209C cmp r0, 0 bne _081B20FC movs r4, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 bcs _081B2126 @@ -71264,7 +71264,7 @@ _081B20C4: adds r0, r4, 0x1 lsls r0, 24 lsrs r4, r0, 24 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 bcc _081B20C4 @@ -71289,7 +71289,7 @@ _081B2100: lsls r0, 24 lsrs r4, r0, 24 _081B211E: - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r4, r0 bcc _081B2100 @@ -74058,7 +74058,7 @@ sub_81B3828: @ 81B3828 bl pokemon_change_order ldr r1, =gPlayerParty ldrb r2, [r4, 0x9] - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r3, [r0] subs r3, 0x1 lsls r3, 24 @@ -74072,7 +74072,7 @@ sub_81B3828: @ 81B3828 _081B3868: ldr r1, =gPlayerParty ldrb r2, [r4, 0x9] - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r3, [r0] subs r3, 0x1 lsls r3, 24 @@ -80497,7 +80497,7 @@ sub_81B70B8: @ 81B70B8 ldr r0, =gPlayerParty ldr r4, =gUnknown_0203CEC8 ldrb r1, [r4, 0x9] - ldr r2, =gUnknown_020244E9 + ldr r2, =gPlayerPartyCount ldrb r2, [r2] subs r2, 0x1 lsls r2, 24 @@ -84925,7 +84925,7 @@ sub_81B968C: @ 81B968C ldr r1, =gPlayerParty ldr r0, =gSpecialVar_0x8004 ldrb r2, [r0] - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r3, [r0] subs r3, 0x1 lsls r3, 24 @@ -85824,7 +85824,7 @@ _081B9E6E: thumb_func_start sub_81B9E78 sub_81B9E78: @ 81B9E78 push {lr} - bl zero_player_party_data + bl ZeroPlayerPartyMons bl sub_819A4F8 pop {r0} bx r0 diff --git a/asm/rom_81BE66C.s b/asm/rom_81BE66C.s index 808a7b661..297252c7e 100644 --- a/asm/rom_81BE66C.s +++ b/asm/rom_81BE66C.s @@ -46655,7 +46655,7 @@ _081D636A: thumb_func_start sub_81D6384 sub_81D6384: @ 81D6384 push {lr} - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gUnknown_02038BCA ldrh r0, [r0] movs r1, 0 @@ -46668,7 +46668,7 @@ sub_81D6384: @ 81D6384 thumb_func_start sub_81D639C sub_81D639C: @ 81D639C push {lr} - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gUnknown_02038BCA ldrh r0, [r0] movs r1, 0 @@ -53206,7 +53206,7 @@ sub_81D9AC4: @ 81D9AC4 ldr r0, =gSaveBlock2Ptr ldr r0, [r0] adds r0, 0xA - bl sub_80842DC + bl ReadUnalignedWord adds r4, r0, 0 lsls r4, 16 lsrs r4, 16 diff --git a/asm/safari_zone.s b/asm/safari_zone.s index 32e80e23d..9d6e73021 100644 --- a/asm/safari_zone.s +++ b/asm/safari_zone.s @@ -152,7 +152,7 @@ _080FC1D8: cmp r0, 0x8 bne _080FC208 ldr r0, =gUnknown_082A4B4C - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript bl warp_in ldr r1, =gUnknown_03005DAC ldr r0, =sub_80AF6F0 diff --git a/asm/script.s b/asm/script.s index be0a0ff8c..e625b5625 100644 --- a/asm/script.s +++ b/asm/script.s @@ -411,9 +411,9 @@ script_env_2_enable_and_set_ctx_running: @ 8098F3C .pool thumb_func_end script_env_2_enable_and_set_ctx_running - thumb_func_start script_env_2_execute_new_script -@ void script_env_2_execute_new_script(void *script_ptr) -script_env_2_execute_new_script: @ 8098F50 + thumb_func_start ScriptContext2_RunNewScript +@ void ScriptContext2_RunNewScript(void *script_ptr) +ScriptContext2_RunNewScript: @ 8098F50 push {r4,r5,lr} adds r5, r0, 0 ldr r4, =gUnknown_03000EB8 @@ -435,7 +435,7 @@ _08098F68: pop {r0} bx r0 .pool - thumb_func_end script_env_2_execute_new_script + thumb_func_end ScriptContext2_RunNewScript thumb_func_start mapheader_get_tagged_pointer mapheader_get_tagged_pointer: @ 8098F88 @@ -484,7 +484,7 @@ mapheader_run_script_by_tag: @ 8098FC8 bl mapheader_get_tagged_pointer cmp r0, 0 beq _08098FDA - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript _08098FDA: pop {r0} bx r0 @@ -616,7 +616,7 @@ mapheader_run_first_tag4_script_list_match: @ 8099098 bl mapheader_get_first_match_from_tagged_ptr_list cmp r0, 0 beq _080990A8 - bl script_env_2_execute_new_script + bl ScriptContext2_RunNewScript _080990A8: pop {r0} bx r0 diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index 427258bbe..b98058fa4 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -1184,7 +1184,7 @@ sp000_heal_pokemon: @ 80F9180 sub sp, 0x4 movs r0, 0 mov r8, r0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r8, r0 bcs _080F922C @@ -1253,7 +1253,7 @@ _080F91D4: lsls r0, r1, 24 lsrs r0, 24 mov r8, r0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r8, r0 bcc _080F919E @@ -1464,7 +1464,7 @@ sub_80F93A0: @ 80F93A0 lsrs r5, 24 lsls r7, r2, 16 lsrs r6, r7, 16 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons ldr r0, =gEnemyParty mov r8, r0 movs r0, 0 @@ -1509,7 +1509,7 @@ sub_80F9400: @ 80F9400 lsrs r2, 24 cmp r3, 0x6 bls _080F941C - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] subs r0, 0x1 lsls r0, 24 diff --git a/asm/secret_base.s b/asm/secret_base.s index f0bdf9acd..3f6db1f6b 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -36,8 +36,8 @@ _080E8B0A: .pool thumb_func_end sub_80E8AF0 - thumb_func_start sub_80E8B28 -sub_80E8B28: @ 80E8B28 + thumb_func_start ResetSecretBases +ResetSecretBases: @ 80E8B28 push {r4,r5,lr} movs r4, 0 ldr r5, =gSaveBlock1Ptr @@ -59,7 +59,7 @@ _080E8B2E: pop {r0} bx r0 .pool - thumb_func_end sub_80E8B28 + thumb_func_end ResetSecretBases thumb_func_start sub_80E8B58 sub_80E8B58: @ 80E8B58 diff --git a/asm/start_menu.s b/asm/start_menu.s index 79509d957..713923c79 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -1518,14 +1518,14 @@ _080A0124: beq _080A0168 b _080A0174 _080A012A: - ldr r0, =gUnknown_03006210 + ldr r0, =gSaveFileStatus ldrh r0, [r0] cmp r0, 0 beq _080A0136 cmp r0, 0x2 bne _080A013E _080A0136: - ldr r0, =gUnknown_020322D4 + ldr r0, =gDifferentSaveFile ldrb r0, [r0] cmp r0, 0 bne _080A0158 @@ -1556,7 +1556,7 @@ _080A0176: thumb_func_start sub_80A017C sub_80A017C: @ 80A017C push {lr} - ldr r0, =gUnknown_020322D4 + ldr r0, =gDifferentSaveFile ldrb r0, [r0] cmp r0, 0x1 bne _080A019C @@ -1658,7 +1658,7 @@ sub_80A024C: @ 80A024C movs r0, 0 bl IncrementGameStat bl sub_81A9E90 - ldr r4, =gUnknown_020322D4 + ldr r4, =gDifferentSaveFile ldrb r0, [r4] cmp r0, 0x1 bne _080A0274 diff --git a/asm/trade.s b/asm/trade.s index 0feabafcb..3758541bf 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -595,7 +595,7 @@ _080776A8: bl SetGpuReg ldr r2, =gUnknown_0203229C ldr r0, [r2] - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldrb r1, [r1] adds r0, 0x36 strb r1, [r0] @@ -1206,7 +1206,7 @@ _08077C6C: bl calc_enemy_party_count ldr r4, =gUnknown_0203229C ldr r0, [r4] - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldrb r1, [r1] adds r0, 0x36 strb r1, [r0] @@ -3382,7 +3382,7 @@ _08078F7E: .pool _08078F9C: ldr r0, =gPlayerParty - ldr r1, =gUnknown_020244E9 + ldr r1, =gPlayerPartyCount ldrb r1, [r1] ldr r2, =gUnknown_0203229C ldr r2, [r2] @@ -6557,7 +6557,7 @@ sub_807A918: @ 807A918 lsrs r1, 16 mov r8, r1 movs r5, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 bge _0807A95A @@ -6578,7 +6578,7 @@ _0807A934: _0807A94E: adds r4, 0x4 adds r5, 0x1 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r5, r0 blt _0807A934 @@ -6659,7 +6659,7 @@ _0807A9E0: _0807A9EA: movs r2, 0 movs r5, 0 - ldr r0, =gUnknown_020244E9 + ldr r0, =gPlayerPartyCount ldrb r0, [r0] cmp r2, r0 bge _0807AA0A diff --git a/asm/tv.s b/asm/tv.s index 1b74eef92..ccf232dd0 100644 --- a/asm/tv.s +++ b/asm/tv.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_80EBEE0 -sub_80EBEE0: @ 80EBEE0 + thumb_func_start ClearTVShowData +ClearTVShowData: @ 80EBEE0 push {r4-r7,lr} movs r3, 0 ldr r6, =gSaveBlock1Ptr @@ -49,7 +49,7 @@ _080EBF0A: pop {r0} bx r0 .pool - thumb_func_end sub_80EBEE0 + thumb_func_end ClearTVShowData thumb_func_start special_0x44 special_0x44: @ 80EBF3C @@ -419,8 +419,8 @@ _080EC216: bx r1 thumb_func_end special_0x4a - thumb_func_start GabbyAndTyNewGameInitData -GabbyAndTyNewGameInitData: @ 80EC21C + thumb_func_start ResetGabbyAndTy +ResetGabbyAndTy: @ 80EC21C push {r4-r6,lr} mov r6, r10 mov r5, r9 @@ -535,7 +535,7 @@ GabbyAndTyNewGameInitData: @ 80EC21C pop {r0} bx r0 .pool - thumb_func_end GabbyAndTyNewGameInitData + thumb_func_end ResetGabbyAndTy thumb_func_start GabbyAndTyBeforeInterview GabbyAndTyBeforeInterview: @ 80EC31C diff --git a/asm/wild_encounter.s b/asm/wild_encounter.s index ee654745c..c2e57a3f3 100644 --- a/asm/wild_encounter.s +++ b/asm/wild_encounter.s @@ -783,7 +783,7 @@ sub_80B4E68: @ 80B4E68 lsrs r6, r0, 16 lsls r1, 24 lsrs r7, r1, 24 - bl zero_enemy_party_data + bl ZeroEnemyPartyMons movs r2, 0x1 ldr r1, =gBaseStats lsls r0, r6, 3 diff --git a/common_syms/save.txt b/common_syms/save.txt index ccbbc3c87..92d31eb14 100644 --- a/common_syms/save.txt +++ b/common_syms/save.txt @@ -6,5 +6,5 @@ gSaveCounter gFastSaveSection gUnknown_03006208 gSaveUnusedVar -gUnknown_03006210 +gSaveFileStatus gGameContinueCallback diff --git a/data/data3.s b/data/data3.s index 845a418b9..ee1ad294a 100644 --- a/data/data3.s +++ b/data/data3.s @@ -507,7 +507,7 @@ gUnknown_08339CC8:: @ 8339CC8 gUnknown_08339D14:: @ 8339D14 .incbin "baserom.gba", 0x339d14, 0x8 -gUnknown_08339D1C:: @ 8339D1C +gContestWinnerPicDummy:: @ 8339D1C .incbin "baserom.gba", 0x339d1c, 0x20 gUnknown_08339D3C:: @ 8339D3C diff --git a/include/game_stat.h b/include/game_stat.h index 70b6f51ce..b8a5c3232 100644 --- a/include/game_stat.h +++ b/include/game_stat.h @@ -51,6 +51,9 @@ #define GAME_STAT_USED_DAYCARE 47 #define GAME_STAT_RODE_CABLE_CAR 48 #define GAME_STAT_ENTERED_HOT_SPRINGS 49 -#define NUM_GAME_STATS 50 + +/*TODO: add new stats added in Emerald*/ + +#define NUM_GAME_STATS 64 #endif // GUARD_GAME_STAT_H diff --git a/include/global.h b/include/global.h index 85ac787ec..c43b57e03 100644 --- a/include/global.h +++ b/include/global.h @@ -108,6 +108,32 @@ struct Pokedex /*0x44*/ u8 seen[52]; }; +struct PokemonJumpResults // possibly used in the game itself? +{ + u16 jumpsInRow; + u16 field2; + u16 excellentsInRow; + u16 field6; + u16 field8; + u16 fieldA; + u32 bestJumpScore; +}; + +struct BerryPickingResults // possibly used in the game itself? Size may be wrong as well +{ + u32 bestScore; + u16 berriesPicked; + u16 berriesPickedInRow; + // unk size +}; + +struct PyramidBag +{ + u16 items_Lvl50[10]; + u16 items_OpenLvl[10]; + u8 quantity[10]; +}; + struct SaveBlock2 { /*0x00*/ u8 playerName[8]; @@ -131,6 +157,34 @@ struct SaveBlock2 /*0xA0*/ struct Time lastBerryTreeUpdate; /*0xA8*/ u8 filler_A8[0x4]; /*0xAC*/ u32 encryptionKey; + + // TODO: fix and verify labels + /*0xB0*/ u8 field_B0[316]; + /*0x1EC*/ u16 berryCrushResults[4]; + /*0x1F4*/ u32 berryPowderAmount; + /*0x1F8*/ u32 field_1F8; + /*0x1FC*/ struct PokemonJumpResults pokeJumpResults; + /*0x20C*/ struct BerryPickingResults berryPickResults; + /*0x214*/ u8 field_214[1040]; + /*0x624*/ u16 contestLinkResults[20]; // 4 positions for 5 categories, possibly a struct or a 2d array + + // All below could be a one giant struct + + /*0x64C*/ u8 field_64C[1629]; + /*0xCA9*/ u8 frontierChosenLvl; + /*0xCAA*/ u8 field_CAA[368]; + /*0xE1A*/ u16 battlePyramidFloor; // possibly? + /*0xE1C*/ u8 field_E1C[16]; + /*0xE2C*/ struct PyramidBag pyramidBag; + /*0x???*/ u8 field_notSure[13]; + /*0xE6E*/ u16 battleTentWinStreak; + /*0xE70*/ u8 field_E70[72]; + /*0xEB8*/ u16 frontierBattlePoints; + /*0xEBA*/ u8 field_EBA[39]; + /*0xEE1*/ u8 field_EE1; + /*0xEE2*/ u8 field_EE2[7]; + /*0xEE9*/ u8 field_EE9; + /*0xEEA*/ u8 field_EEA[22]; }; extern struct SaveBlock2 *gSaveBlock2Ptr; @@ -219,12 +273,6 @@ struct RamScript struct RamScriptData data; }; -struct SB1_2EFC_Struct -{ - u16 var; - u8 unknown[0x1E]; -}; - struct EasyChatPair { u16 unk0_0:7; @@ -493,26 +541,6 @@ typedef union OldMan u8 filler[0x40]; } OldMan; -struct Unk_SB_Access_Struct1 -{ - u8 filler0[0xF8]; - struct SB1_2EFC_Struct sb1_2EFC_struct[5]; -}; - -struct Unk_SB_Access_Struct2 -{ - /*0x0000*/ struct SB1_2EFC_Struct sb1_2EFC_struct2[12]; // each is 0x20 - /*0x2F84*/ u8 filler[0x18]; -}; - -/*0x2E04*/ -typedef union SB_Struct -{ - struct Unk_SB_Access_Struct1 unkSB1; - struct Unk_SB_Access_Struct2 unkSB2; -} SB_Struct; -// size is 0x198 - struct UnknownSaveStruct2ABC { u8 val0; @@ -579,6 +607,17 @@ struct RecordMixingGift struct RecordMixingGiftData data; }; +struct ContestWinner +{ + u32 personality; + u32 trainerId; + u16 species; + u8 contestCategory; + u8 monName[11]; + u8 trainerName[8]; + u8 contestRank; +}; + #define FLAGS_NUMBER 300 #define VARS_NUMBER 256 @@ -617,61 +656,63 @@ struct SaveBlock1 /*0xC70*/ struct MapObjectTemplate mapObjectTemplates[64]; /*0x1270*/ u8 flags[FLAGS_NUMBER]; /*0x139C*/ u16 vars[VARS_NUMBER]; + /*0x159C*/ u32 gameStats[NUM_GAME_STATS]; + /*0x169C*/ struct BerryTree berryTrees[128]; + /*0x1A9C*/ struct SecretBaseRecord secretBases[20]; + /*0x271C*/ u8 playerRoomDecor[12]; + /*0x2728*/ u8 playerRoomDecorPos[12]; + /*0x2734*/ u8 decorDesk[10]; + /*0x????*/ u8 decorChair[10]; + /*0x????*/ u8 decorPlant[10]; + /*0x????*/ u8 decorOrnament[30]; + /*0x????*/ u8 decorMat[30]; + /*0x????*/ u8 decorPoster[10]; + /*0x????*/ u8 decorDoll[40]; + /*0x????*/ u8 decorCushion[10]; + /*0x27CA*/ u8 padding_27CA[2]; + /*0x27CC*/ TVShow tvShows[25]; + /*0x2B50*/ struct UnknownSaveStruct2ABC pokeNews[16]; + /*0x2B90*/ u16 outbreakPokemonSpecies; + /*0x????*/ u8 outbreakLocationMapNum; + /*0x????*/ u8 outbreakLocationMapGroup; + /*0x????*/ u8 outbreakPokemonLevel; + /*0x????*/ u8 outbreakUnk1; + /*0x????*/ u16 outbreakUnk2; + /*0x????*/ u16 outbreakPokemonMoves[4]; + /*0x????*/ u8 outbreakUnk4; + /*0x????*/ u8 outbreakPokemonProbability; + /*0x????*/ u16 outbreakUnk5; + /*0x2BA4*/ struct GabbyAndTyData gabbyAndTyData; + /*0x????*/ u16 unk2B1C[6]; + /*0x????*/ u16 unk2B28[6]; + /*0x????*/ u16 unk2B34[6]; + /*0x????*/ u16 unk2B40[6]; + /*0x2BE0*/ struct MailStruct mail[16]; + /*0x2E20*/ u8 additionalPhrases; // bitfield for 33 additional phrases in easy chat system + /*0x2E25*/ u8 unk2E25[3]; // possibly padding? + /*0x2E28*/ OldMan oldMan; + /*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff + /*0x2e8c*/ u8 filler_2E8C[0x4]; + /*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum - // TODO: FIX BELOW + // TODO: fix - /*0x1540*/ u32 gameStats[NUM_GAME_STATS]; - /*0x1608*/ struct BerryTree berryTrees[128]; - /*0x1A08*/ struct SecretBaseRecord secretBases[20]; - /*0x2688*/ u8 playerRoomDecor[12]; - /*0x2694*/ u8 playerRoomDecorPos[12]; - /*0x26A0*/ u8 decorDesk[10]; - /*0x26AA*/ u8 decorChair[10]; - /*0x26B4*/ u8 decorPlant[10]; - /*0x26BE*/ u8 decorOrnament[30]; - /*0x26DC*/ u8 decorMat[30]; - /*0x26FA*/ u8 decorPoster[10]; - /*0x2704*/ u8 decorDoll[40]; - /*0x272C*/ u8 decorCushion[10]; - /*0x2736*/ u8 padding_2736[2]; - /*0x2738*/ TVShow tvShows[25]; - /*0x2ABC*/ struct UnknownSaveStruct2ABC unknown_2ABC[16]; - /*0x2AFC*/ u16 outbreakPokemonSpecies; - /*0x2AFE*/ u8 outbreakLocationMapNum; - /*0x2AFF*/ u8 outbreakLocationMapGroup; - /*0x2B00*/ u8 outbreakPokemonLevel; - /*0x2B01*/ u8 outbreakUnk1; - /*0x2B02*/ u16 outbreakUnk2; - /*0x2B04*/ u16 outbreakPokemonMoves[4]; - /*0x2B0C*/ u8 outbreakUnk4; - /*0x2B0D*/ u8 outbreakPokemonProbability; - /*0x2B0E*/ u16 outbreakUnk5; - /*0x2B10*/ struct GabbyAndTyData gabbyAndTyData; - /*0x2B1C*/ u16 unk2B1C[6]; - /*0x2B28*/ u16 unk2B28[6]; - /*0x2B34*/ u16 unk2B34[6]; - /*0x2B40*/ u16 unk2B40[6]; - /*0x2B4C*/ struct MailStruct mail[16]; - /*0x2D8C*/ u8 unk2D8C[4]; - /*0x2D90*/ u8 filler_2D90[0x4]; - /*0x2D94*/ OldMan oldMan; - /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff - /*0x2DFC*/ u8 filler_2DFC[0x8]; - /*0x2E04*/ SB_Struct sbStruct; - /*0x2F9C*/ struct BoxPokemon daycareData[2]; - /*0x303C*/ struct RecordMixing_UnknownStruct filler_303C; - /*0x30AC*/ u8 filler_30B4[0x2]; - /*0x30B6*/ u8 filler_30B6; - /*0x30B7*/ u8 filler_30B7[1]; - /*0x30B8*/ struct LinkBattleRecord linkBattleRecords[5]; - /*0x3108*/ u8 filler_3108[8]; - /*0x3110*/ u8 giftRibbons[7]; - /*0x3117*/ u8 filler_311B[0x2D]; - /*0x3144*/ struct Roamer roamer; - /*0x3160*/ struct EnigmaBerry enigmaBerry; - /*0x3690*/ struct RamScript ramScript; - /*0x3A7C*/ struct RecordMixingGift recordMixingGift; - /*0x3A8C*/ u8 unk3A8C[52]; //pokedex related + /*0x????*/ struct BoxPokemon daycareData[2]; + /*0x????*/ struct RecordMixing_UnknownStruct filler_303C; + /*0x????*/ u8 filler_30B4[0x2]; + /*0x????*/ u8 filler_30B6; + /*0x????*/ u8 filler_30B7[1]; + /*0x????*/ struct LinkBattleRecord linkBattleRecords[5]; + /*0x????*/ u8 filler_3108[8]; + + /*0x31A8*/ u8 giftRibbons[52]; + /*0x31DC*/ struct Roamer roamer; + /*0x31F8*/ struct EnigmaBerry enigmaBerry; + + // TODO: fix + /*0x????*/ struct RamScript ramScript; + /*0x????*/ struct RecordMixingGift recordMixingGift; + /*0x????*/ u8 unk3A8C[52]; //pokedex related }; extern struct SaveBlock1* gSaveBlock1Ptr; diff --git a/include/new_game.h b/include/new_game.h new file mode 100644 index 000000000..00ab55d70 --- /dev/null +++ b/include/new_game.h @@ -0,0 +1,12 @@ +#ifndef GUARD_NEW_GAME_H +#define GUARD_NEW_GAME_H + +void WriteUnalignedWord(u32 var, u8 *dataPtr); +void CopyUnalignedWord(u8 *copyTo, u8 *copyFrom); +void InitPlayerTrainerId(void); +void SetDefaultOptions(void); +void ClearPokedexFlags(void); +void WarpToTruck(void); +void NewGameInitData(void); + +#endif // GUARD_NEW_GAME_H diff --git a/ld_script.txt b/ld_script.txt index c3c2b0de9..d0ae744d1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -77,6 +77,7 @@ SECTIONS { asm/trade.o(.text); asm/berry_blender.o(.text); src/play_time.o(.text); + src/new_game.o(.text); asm/new_game.o(.text); asm/rom4.o(.text); asm/fieldmap.o(.text); diff --git a/src/main.c b/src/main.c index 3b4387dd0..7c8075a6f 100644 --- a/src/main.c +++ b/src/main.c @@ -217,7 +217,7 @@ void SeedRngAndSetTrainerId(void) gTrainerId = val; } -u16 GetTrainerId(void) +u16 GetGeneratedTrainerIdLower(void) { return gTrainerId; } diff --git a/src/new_game.c b/src/new_game.c new file mode 100644 index 000000000..649cf4e6d --- /dev/null +++ b/src/new_game.c @@ -0,0 +1,111 @@ +#include "global.h" +#include "new_game.h" +#include "rng.h" + +extern u8 gPlayerPartyCount; +extern u8 gDifferentSaveFile; +extern u16 gSaveFileStatus; +extern u8 gUnknown_030060B0; + +extern u16 GetGeneratedTrainerIdLower(void); +extern void ClearContestWinnerPicsInContestHall(void); +extern void warp1_set(s8 mapBank, s8 mapNo, s8 warpNo, s8 xPos, s8 yPos); +extern void warp_in(void); +extern void sub_80BB358(void); +extern void ZeroPlayerPartyMons(void); +extern void ZeroEnemyPartyMons(void); +extern void ResetBagScrollPositions(void); +extern void sub_813624C(void); // clears something pokeblock related +extern void ClearSav2(void); // clears something pokeblock related + +void WriteUnalignedWord(u32 var, u8 *dataPtr) +{ + dataPtr[0] = var; + dataPtr[1] = var >> 8; + dataPtr[2] = var >> 16; + dataPtr[3] = var >> 24; +} + +u32 ReadUnalignedWord(u8* dataPtr) +{ + return (dataPtr[3] << 24) | (dataPtr[2] << 16) | (dataPtr[1] << 8) | (dataPtr[0]); +} + +void CopyUnalignedWord(u8 *copyTo, u8 *copyFrom) +{ + s32 i; + for (i = 0; i < 4; i++) + copyTo[i] = copyFrom[i]; +} + +void InitPlayerTrainerId(void) +{ + u32 trainerId = (Random() << 0x10) | GetGeneratedTrainerIdLower(); + WriteUnalignedWord(trainerId, gSaveBlock2Ptr->playerTrainerId); +} + +// L=A isnt set here for some reason. +void SetDefaultOptions(void) +{ + gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID; + gSaveBlock2Ptr->optionsWindowFrameType = 0; + gSaveBlock2Ptr->optionsSound = OPTIONS_SOUND_MONO; + gSaveBlock2Ptr->optionsBattleStyle = OPTIONS_BATTLE_STYLE_SHIFT; + gSaveBlock2Ptr->optionsBattleSceneOff = FALSE; + gSaveBlock2Ptr->regionMapZoom = FALSE; +} + +void ClearPokedexFlags(void) +{ + gUnknown_030060B0 = 0; + memset(&gSaveBlock2Ptr->pokedex.owned, 0, sizeof(gSaveBlock2Ptr->pokedex.owned)); + memset(&gSaveBlock2Ptr->pokedex.seen, 0, sizeof(gSaveBlock2Ptr->pokedex.seen)); +} + +extern const struct ContestWinner gContestWinnerPicDummy; + +void ClearAllContestWinnerPics(void) +{ + s32 i; + + ClearContestWinnerPicsInContestHall(); + for (i = 8; i < 13; i++) + gSaveBlock1Ptr->contestWinners[i] = gContestWinnerPicDummy; +} + +void sub_8084400(void) +{ + // probably clearing one struct for battle frontier + CpuFill32(0, gSaveBlock2Ptr->field_64C, 2272); + + // those look like strings + gSaveBlock2Ptr->field_EE1 = 0xFF; + gSaveBlock2Ptr->field_EE9 = 0xFF; +} + +void WarpToTruck(void) +{ + warp1_set(25, 40, -1, -1, -1); // inside of truck + warp_in(); +} + +void Sav2_ClearSetDefault(void) +{ + ClearSav2(); + SetDefaultOptions(); +} + +void sub_808447C(void) +{ + gDifferentSaveFile = 0; + sub_80BB358(); + ZeroPlayerPartyMons(); + ZeroEnemyPartyMons(); + ResetBagScrollPositions(); + sub_813624C(); +} +/* +void NewGameInitData(void) +{ + Finish when more header files are available +}*/ diff --git a/src/save.c b/src/save.c index 7eb7a84ee..ccb653f66 100644 --- a/src/save.c +++ b/src/save.c @@ -24,7 +24,7 @@ u32 gSaveCounter; struct SaveSection *gFastSaveSection; u16 gUnknown_03006208; u16 gSaveUnusedVar; -u16 gUnknown_03006210; +u16 gSaveFileStatus; void (*gGameContinueCallback)(void); EWRAM_DATA struct SaveSection gSaveDataBuffer = {0}; @@ -806,7 +806,7 @@ u8 sub_81534D0(u8 a1) if (gFlashMemoryPresent != TRUE) { - gUnknown_03006210 = 4; + gSaveFileStatus = 4; return 0xFF; } @@ -817,7 +817,7 @@ u8 sub_81534D0(u8 a1) default: result = sub_8152DD0(0xFFFF, gRamSaveSectionLocations); LoadSerializedGame(); - gUnknown_03006210 = result; + gSaveFileStatus = result; gGameContinueCallback = 0; break; case 3: diff --git a/sym_ewram.txt b/sym_ewram.txt index c1660c9c4..b2dcd8e41 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -596,7 +596,7 @@ gUnknown_020244E4: @ 20244E4 gUnknown_020244E8: @ 20244E8 .space 0x1 -gUnknown_020244E9: @ 20244E9 +gPlayerPartyCount: @ 20244E9 .space 0x1 gUnknown_020244EA: @ 20244EA @@ -707,7 +707,7 @@ gUnknown_020322BC: @ 20322BC gUnknown_020322D0: @ 20322D0 .space 0x4 -gUnknown_020322D4: @ 20322D4 +gDifferentSaveFile: @ 20322D4 .space 0x1 gUnknown_020322D5: @ 20322D5