diff --git a/asm/battle_4.s b/asm/battle_4.s index 8651b9724..a1c1ddf7f 100644 --- a/asm/battle_4.s +++ b/asm/battle_4.s @@ -30996,7 +30996,7 @@ _08056D0A: movs r0, 0x2 adds r2, r6, 0 adds r3, r5, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen ldr r1, =gBattleCommunication ldrb r0, [r1] adds r0, 0x1 diff --git a/asm/egg_hatch.s b/asm/egg_hatch.s index d97fc8c65..194aedd7b 100644 --- a/asm/egg_hatch.s +++ b/asm/egg_hatch.s @@ -5,1014 +5,6 @@ .text - - thumb_func_start EggHatchSetMonNickname -EggHatchSetMonNickname: @ 80719FC - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r2, =gStringVar3 - movs r1, 0x2 - bl SetMonData - bl sub_805F094 - ldr r0, =gEggHatchData - ldr r0, [r0] - bl Free - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end EggHatchSetMonNickname - - thumb_func_start Task_EggHatchPlayBGM -Task_EggHatchPlayBGM: @ 8071A3C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08071A5C - bl StopMapMusic - bl play_some_sound -_08071A5C: - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _08071A6C - movs r0, 0xBC - lsls r0, 1 - bl PlayBGM -_08071A6C: - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x3C - ble _08071A80 - ldr r0, =0x00000179 - bl PlayBGM - adds r0, r5, 0 - bl DestroyTask -_08071A80: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Task_EggHatchPlayBGM - - thumb_func_start CB2_EggHatch_1 -CB2_EggHatch_1: @ 8071A94 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - ldr r1, =gEggHatchData - ldr r0, [r1] - ldrb r0, [r0, 0x2] - adds r5, r1, 0 - cmp r0, 0xC - bls _08071AAC - b _08071E06 -_08071AAC: - lsls r0, 2 - ldr r1, =_08071AC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08071AC0: - .4byte _08071AF4 - .4byte _08071B40 - .4byte _08071B68 - .4byte _08071BA0 - .4byte _08071BF8 - .4byte _08071C24 - .4byte _08071C88 - .4byte _08071C96 - .4byte _08071CA4 - .4byte _08071CE8 - .4byte _08071D1C - .4byte _08071DB4 - .4byte _08071DD4 -_08071AF4: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_0832BFFC - movs r1, 0x78 - movs r2, 0x4B - movs r3, 0x5 - bl CreateSprite - ldr r4, =gEggHatchData - ldr r1, [r4] - strb r0, [r1] - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - ldr r1, [r4] - ldrb r0, [r1, 0x2] - adds r0, 0x1 - strb r0, [r1, 0x2] - ldr r0, =Task_EggHatchPlayBGM - movs r1, 0x5 - bl CreateTask - b _08071E06 - .pool -_08071B40: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _08071B52 - b _08071E06 -_08071B52: - ldr r0, [r5] - ldrb r0, [r0, 0x8] - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, [r5] - strb r4, [r0, 0x3] - ldr r1, [r5] - b _08071DC8 - .pool -_08071B68: - ldr r1, [r5] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1E - bhi _08071B7A - b _08071E06 -_08071B7A: - ldr r1, [r5] - ldrb r0, [r1, 0x2] - adds r0, 0x1 - strb r0, [r1, 0x2] - ldr r2, =gSprites - ldr r0, [r5] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =SpriteCB_Egg_0 - str r1, [r0] - b _08071E06 - .pool -_08071BA0: - ldr r4, =gSprites - ldr r2, [r5] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08071BBC - b _08071E06 -_08071BBC: - ldrb r1, [r2, 0x4] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, [r5] - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r1, r7, 0 - movs r2, 0 - movs r3, 0x1 - bl DoMonFrontSpriteAnimation - ldr r1, [r5] - b _08071DC8 - .pool -_08071BF8: - ldr r2, =gSprites - ldr r3, [r5] - ldrb r1, [r3, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08071C12 - b _08071E06 -_08071C12: - ldrb r0, [r3, 0x2] - adds r0, 0x1 - strb r0, [r3, 0x2] - b _08071E06 - .pool -_08071C24: - ldr r0, [r5] - ldrb r1, [r0, 0x4] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNick - ldr r4, =gStringVar4 - ldr r1, =gUnknown_085ED5A5 - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r0, [r5] - ldrb r0, [r0, 0x8] - movs r1, 0xFF - str r1, [sp] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl sub_8072214 - ldr r0, =0x00000173 - bl PlayFanfare - ldr r1, [r5] - ldrb r0, [r1, 0x2] - adds r0, 0x1 - strb r0, [r1, 0x2] - ldr r0, [r5] - ldrb r0, [r0, 0x8] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x8] - movs r1, 0x3 - bl CopyWindowToVram - b _08071E06 - .pool -_08071C88: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - bne _08071C94 - b _08071E06 -_08071C94: - b _08071DC4 -_08071C96: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - bne _08071CA2 - b _08071E06 -_08071CA2: - b _08071DC4 -_08071CA4: - ldr r0, [r5] - ldrb r1, [r0, 0x4] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gStringVar1 - bl GetMonNick - ldr r4, =gStringVar4 - ldr r1, =gUnknown_085ED5BE - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r0, [r5] - ldrb r0, [r0, 0x8] - movs r1, 0x1 - str r1, [sp] - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x2 - bl sub_8072214 - ldr r1, [r5] - b _08071DC8 - .pool -_08071CE8: - ldr r0, [r5] - ldrb r0, [r0, 0x8] - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _08071CF8 - b _08071E06 -_08071CF8: - ldr r0, [r5] - ldrb r0, [r0, 0x8] - movs r4, 0xA0 - lsls r4, 1 - adds r1, r4, 0 - movs r2, 0xE0 - bl sub_809882C - ldr r0, =gUnknown_0832C07C - adds r1, r4, 0 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r1, [r5] - b _08071DC8 - .pool -_08071D1C: - bl sub_8198C58 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _08071D3C - cmp r1, 0 - bgt _08071D36 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08071DC4 - b _08071E06 -_08071D36: - cmp r1, 0x1 - beq _08071DC4 - b _08071E06 -_08071D3C: - ldr r0, =gEggHatchData - mov r8, r0 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - ldr r1, =gStringVar3 - mov r9, r1 - bl GetMonNick - mov r1, r8 - ldr r0, [r1] - ldrb r0, [r0, 0x4] - muls r0, r6 - adds r0, r5 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r7, r0, 16 - mov r1, r8 - ldr r0, [r1] - ldrb r0, [r0, 0x4] - muls r0, r6 - adds r0, r5 - bl GetMonGender - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r1, r8 - ldr r0, [r1] - ldrb r0, [r0, 0x4] - muls r0, r6 - adds r0, r5 - movs r1, 0 - movs r2, 0 - bl GetMonData - str r0, [sp] - ldr r0, =EggHatchSetMonNickname - str r0, [sp, 0x4] - movs r0, 0x3 - mov r1, r9 - adds r2, r7, 0 - adds r3, r4, 0 - bl do_choose_name_or_words_screen - b _08071E06 - .pool -_08071DB4: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_08071DC4: - ldr r0, =gEggHatchData - ldr r1, [r0] -_08071DC8: - ldrb r0, [r1, 0x2] - adds r0, 0x1 - strb r0, [r1, 0x2] - b _08071E06 - .pool -_08071DD4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08071E06 - bl sub_805F094 - ldr r4, =gEggHatchData - ldr r0, [r4] - ldrb r0, [r0, 0x8] - bl RemoveWindow - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - ldr r0, [r4] - bl Free - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 -_08071E06: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end CB2_EggHatch_1 - - thumb_func_start SpriteCB_Egg_0 -SpriteCB_Egg_0: @ 8071E34 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _08071E54 - ldr r0, =SpriteCB_Egg_1 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x2E] - b _08071E84 - .pool -_08071E54: - ldrh r0, [r4, 0x30] - adds r0, 0x14 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x1 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0xF - bne _08071E84 - movs r0, 0x17 - bl PlaySE - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAnim - bl CreateRandomEggShardSprite -_08071E84: - pop {r4} - pop {r0} - bx r0 - thumb_func_end SpriteCB_Egg_0 - - thumb_func_start SpriteCB_Egg_1 -SpriteCB_Egg_1: @ 8071E8C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - ble _08071EE8 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _08071EBC - ldr r0, =SpriteCB_Egg_2 - str r0, [r4, 0x1C] - strh r1, [r4, 0x2E] - strh r1, [r4, 0x32] - b _08071EE8 - .pool -_08071EBC: - ldrh r0, [r4, 0x30] - adds r0, 0x14 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x2 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0xF - bne _08071EE8 - movs r0, 0x17 - bl PlaySE - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAnim -_08071EE8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end SpriteCB_Egg_1 - - thumb_func_start SpriteCB_Egg_2 -SpriteCB_Egg_2: @ 8071EF0 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - movs r5, 0 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - ble _08071F9E - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x26 - ble _08071F5C - ldr r0, =SpriteCB_Egg_3 - str r0, [r4, 0x1C] - strh r5, [r4, 0x2E] - ldr r4, =gEggHatchData - ldr r0, [r4] - ldrb r1, [r0, 0x4] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - ldr r3, =gSprites - ldr r2, [r4] - ldrb r1, [r2, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r5, [r0, 0x24] - ldrb r1, [r2, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - strh r5, [r0, 0x26] - b _08071F9E - .pool -_08071F5C: - ldrh r0, [r4, 0x30] - adds r0, 0x14 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x2 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0xF - bne _08071F90 - movs r0, 0x17 - bl PlaySE - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAnim - bl CreateRandomEggShardSprite - bl CreateRandomEggShardSprite -_08071F90: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1E - bne _08071F9E - movs r0, 0x17 - bl PlaySE -_08071F9E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end SpriteCB_Egg_2 - - thumb_func_start SpriteCB_Egg_3 -SpriteCB_Egg_3: @ 8071FA4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - ble _08071FBE - ldr r0, =SpriteCB_Egg_4 - str r0, [r1, 0x1C] - movs r0, 0 - strh r0, [r1, 0x2E] -_08071FBE: - pop {r0} - bx r0 - .pool - thumb_func_end SpriteCB_Egg_3 - - thumb_func_start SpriteCB_Egg_4 -SpriteCB_Egg_4: @ 8071FC8 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08071FE8 - movs r1, 0x1 - negs r1, r1 - ldr r0, =0x0000ffff - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_08071FE8: - ldrh r0, [r5, 0x2E] - cmp r0, 0x3 - bhi _08072004 - movs r4, 0 -_08071FF0: - bl CreateRandomEggShardSprite - lsls r0, r4, 16 - movs r1, 0x80 - lsls r1, 9 - adds r0, r1 - lsrs r4, r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _08071FF0 -_08072004: - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08072032 - movs r0, 0x71 - bl PlaySE - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =SpriteCB_Egg_5 - str r0, [r5, 0x1C] - strh r4, [r5, 0x2E] -_08072032: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SpriteCB_Egg_4 - - thumb_func_start SpriteCB_Egg_5 -SpriteCB_Egg_5: @ 8072048 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08072084 - ldr r4, =gSprites - ldr r3, =gEggHatchData - ldr r0, [r3] - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, [r3] - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAffineAnim -_08072084: - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0x8 - bne _0807209E - movs r1, 0x1 - negs r1, r1 - ldr r0, =0x0000ffff - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0807209E: - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x9 - bgt _080720BC - ldr r2, =gSprites - ldr r0, =gEggHatchData - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x1 - strh r1, [r0, 0x22] -_080720BC: - ldrh r1, [r5, 0x2E] - movs r2, 0x2E - ldrsh r0, [r5, r2] - cmp r0, 0x28 - ble _080720CA - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] -_080720CA: - adds r0, r1, 0x1 - strh r0, [r5, 0x2E] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SpriteCB_Egg_5 - - thumb_func_start SpriteCB_EggShard -SpriteCB_EggShard: @ 80720E8 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - ldrh r1, [r2, 0x36] - adds r0, r1 - strh r0, [r2, 0x36] - ldrh r1, [r2, 0x32] - ldrh r3, [r2, 0x38] - adds r0, r1, r3 - strh r0, [r2, 0x38] - movs r4, 0x36 - ldrsh r0, [r2, r4] - cmp r0, 0 - bge _08072106 - adds r0, 0xFF -_08072106: - asrs r0, 8 - strh r0, [r2, 0x24] - movs r3, 0x38 - ldrsh r0, [r2, r3] - cmp r0, 0 - bge _08072114 - adds r0, 0xFF -_08072114: - asrs r0, 8 - strh r0, [r2, 0x26] - ldrh r0, [r2, 0x34] - adds r3, r1, r0 - strh r3, [r2, 0x32] - movs r4, 0x22 - ldrsh r1, [r2, r4] - movs r4, 0x26 - ldrsh r0, [r2, r4] - adds r0, r1, r0 - adds r1, 0x14 - cmp r0, r1 - ble _0807213A - lsls r0, r3, 16 - cmp r0, 0 - ble _0807213A - adds r0, r2, 0 - bl DestroySprite -_0807213A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end SpriteCB_EggShard - - thumb_func_start CreateRandomEggShardSprite -CreateRandomEggShardSprite: @ 8072140 - push {r4-r6,lr} - sub sp, 0x8 - ldr r2, =gUnknown_0832C084 - ldr r0, =gEggHatchData - ldr r6, [r0] - ldrb r3, [r6, 0x7] - lsls r0, r3, 2 - adds r1, r0, r2 - ldrh r5, [r1] - adds r2, 0x2 - adds r0, r2 - ldrh r4, [r0] - adds r3, 0x1 - strb r3, [r6, 0x7] - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsls r5, 16 - asrs r5, 16 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x64 - str r0, [sp] - lsrs r1, 16 - str r1, [sp, 0x4] - movs r0, 0x78 - movs r1, 0x3C - adds r2, r5, 0 - adds r3, r4, 0 - bl CreateEggShardSprite - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CreateRandomEggShardSprite - - thumb_func_start CreateEggShardSprite -CreateEggShardSprite: @ 8072194 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - mov r8, r3 - ldr r0, [sp, 0x1C] - mov r9, r0 - ldr r1, [sp, 0x20] - mov r10, r1 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 16 - lsrs r6, 16 - mov r0, r8 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - mov r1, r9 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gUnknown_0832C04C - adds r1, r4, 0 - adds r2, r5, 0 - movs r3, 0x4 - bl CreateSprite - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r6, [r0, 0x30] - mov r1, r8 - strh r1, [r0, 0x32] - mov r1, r9 - strh r1, [r0, 0x34] - mov r1, r10 - bl StartSpriteAnim - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CreateEggShardSprite - - thumb_func_start sub_8072214 -sub_8072214: @ 8072214 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x14 - adds r5, r0, 0 - mov r9, r1 - adds r6, r2, 0 - mov r8, r3 - ldr r4, [sp, 0x2C] - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r3, =gEggHatchData - ldr r0, [r3] - movs r2, 0 - strb r2, [r0, 0xE] - ldr r1, [r3] - movs r0, 0x5 - strb r0, [r1, 0xF] - ldr r1, [r3] - movs r0, 0x6 - strb r0, [r1, 0x10] - str r2, [sp] - str r2, [sp, 0x4] - ldr r0, [r3] - adds r0, 0xE - str r0, [sp, 0x8] - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - mov r0, r9 - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - mov r3, r8 - bl AddTextPrinterParametrized2 - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8072214 - thumb_func_start sub_807228C sub_807228C: @ 807228C push {r4-r6,lr} diff --git a/asm/main_menu.s b/asm/main_menu.s index ed04ba6f3..273d5d3b0 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -2951,7 +2951,7 @@ task_new_game_prof_birch_speech_17: @ 8031090 str r0, [sp, 0x4] movs r0, 0 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen _080310EC: add sp, 0x8 pop {r4,r5} diff --git a/asm/naming_screen.s b/asm/naming_screen.s index 2d79e464a..40ec65ff8 100644 --- a/asm/naming_screen.s +++ b/asm/naming_screen.s @@ -5,9 +5,9 @@ .text - thumb_func_start do_choose_name_or_words_screen -@ int do_choose_name_or_words_screen(u8 type, sav2 *sav2_ptr, s16 player_gender, s16 a4, int a5, void ( *after_finishing_callback)()) -do_choose_name_or_words_screen: @ 80E2D78 + thumb_func_start DoNamingScreen +@ int DoNamingScreen(u8 type, sav2 *sav2_ptr, s16 player_gender, s16 a4, int a5, void ( *after_finishing_callback)()) +DoNamingScreen: @ 80E2D78 push {r4-r7,lr} mov r7, r8 push {r7} @@ -65,7 +65,7 @@ _080E2DE2: pop {r0} bx r0 .pool - thumb_func_end do_choose_name_or_words_screen + thumb_func_end DoNamingScreen thumb_func_start c2_choose_name_or_words_screen c2_choose_name_or_words_screen: @ 80E2E04 @@ -4197,7 +4197,7 @@ sub_80E5074: @ 80E5074 str r0, [sp, 0x4] movs r0, 0 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r0} bx r0 @@ -4217,7 +4217,7 @@ sub_80E509C: @ 80E509C str r0, [sp, 0x4] movs r0, 0x1 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r0} bx r0 @@ -4237,7 +4237,7 @@ sub_80E50C4: @ 80E50C4 str r0, [sp, 0x4] movs r0, 0x2 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r0} bx r0 @@ -4257,7 +4257,7 @@ sub_80E50EC: @ 80E50EC str r0, [sp, 0x4] movs r0, 0x3 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r0} bx r0 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 3aca5c92d..af99e27e8 100755 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5433,7 +5433,7 @@ _080C9F1C: movs r0, 0x1 movs r2, 0 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen b _080C9F56 .pool _080C9F48: diff --git a/asm/tv.s b/asm/tv.s index 2ebdfc0a1..357cd3735 100644 --- a/asm/tv.s +++ b/asm/tv.s @@ -7530,7 +7530,7 @@ sub_80EFDDC: @ 80EFDDC mov r1, r10 adds r2, r5, 0 adds r3, r4, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r3-r5} mov r8, r3 @@ -7604,7 +7604,7 @@ sub_80EFEC4: @ 80EFEC4 mov r1, r8 adds r2, r5, 0 adds r3, r4, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r3} mov r8, r3 diff --git a/asm/walda_phrase.s b/asm/walda_phrase.s index dd5f30049..f7a1be6c2 100755 --- a/asm/walda_phrase.s +++ b/asm/walda_phrase.s @@ -22,7 +22,7 @@ walda_maybe: @ 81D99E4 adds r1, r4, 0 movs r2, 0 movs r3, 0 - bl do_choose_name_or_words_screen + bl DoNamingScreen add sp, 0x8 pop {r4} pop {r0} diff --git a/data/data3.s b/data/data3.s index 7af7a70e8..2a20d3693 100644 --- a/data/data3.s +++ b/data/data3.s @@ -50,7 +50,7 @@ gUnknown_0832C06C:: @ 832C06C gUnknown_0832C07C:: @ 832C07C .incbin "baserom.gba", 0x32c07c, 0x8 -gUnknown_0832C084:: @ 832C084 +sEggShardVelocities:: @ 832C084 .incbin "baserom.gba", 0x32c084, 0x4c gUnknown_0832C0D0:: @ 832C0D0 diff --git a/data/strings.s b/data/strings.s index c8a1b7683..485b4b5c2 100644 --- a/data/strings.s +++ b/data/strings.s @@ -2277,10 +2277,10 @@ gUnknown_085ED44A:: @ 85ED44A .string "My POKéMON and I help$" .string "my father’s research.$" -gUnknown_085ED5A5:: @ 85ED5A5 +gOtherText_HatchedFromEgg:: @ 85ED5A5 .string "{STR_VAR_1} hatched from the EGG!$" -gUnknown_085ED5BE:: @ 85ED5BE +gOtherText_NickHatchPrompt:: @ 85ED5BE .string "Would you like to nickname the newly\nhatched {STR_VAR_1}?$" .align 2 diff --git a/include/bg.h b/include/bg.h index ca21070e0..24484dd86 100644 --- a/include/bg.h +++ b/include/bg.h @@ -39,5 +39,7 @@ void UnsetBgTilemapBuffer(u8 bg); void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset); void CopyBgTilemapBufferToVram(u8 bg); u16 LoadBgTiles(u8 bg, const void* src, u16 size, u16 destOffset); +void ShowBg(u8 bg); +void HideBg(u8 bg); #endif // GUARD_BG_H diff --git a/include/pokemon.h b/include/pokemon.h index fefe2bd28..3472da04b 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -614,4 +614,8 @@ bool8 IsPokeSpriteNotFlipped(u16 species); bool8 IsMonShiny(struct Pokemon *mon); bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); +#include "sprite.h" + +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); + #endif // GUARD_POKEMON_H diff --git a/include/text.h b/include/text.h index 5aadaac32..f584b61ea 100644 --- a/include/text.h +++ b/include/text.h @@ -138,17 +138,26 @@ struct FontInfo u8 shadowColor:4; }; -struct GlyphWidthFunc{ +struct GlyphWidthFunc +{ u32 font_id; u32 (*func)(u16 glyphId, bool32 isJapanese); }; -struct KeypadIcon { +struct KeypadIcon +{ u16 tile_offset; u8 width; u8 height; }; +struct __attribute__((packed)) TextColor +{ + u8 fgColor; + u8 bgColor; + u8 shadowColor; +}; + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; @@ -159,7 +168,7 @@ void DeactivateAllTextPrinters(void); u16 PrintTextOnWindow(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); void RunTextPrinters(void); -bool8 IsTextPrinterActive(u8 id); +bool16 IsTextPrinterActive(u8 id); u32 RenderFont(struct TextPrinter *textPrinter); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 0b924fced..fc079444c 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -31,20 +31,14 @@ struct EggHatchData u8 CB2_state; u8 CB2_PalCounter; u8 eggPartyID; - u8 field_5; - u8 field_6; + u8 unused_5; + u8 unused_6; u8 eggShardVelocityID; - u8 field_8; - u8 field_9; - u8 field_A; - u8 field_B; + u8 windowId; + u8 unused_9; + u8 unused_A; u16 species; - u8 field_E; - u8 field_F; - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; + struct TextColor textColor; }; extern struct EggHatchData* gEggHatchData; @@ -68,31 +62,36 @@ extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern u8* GetMonNick(struct Pokemon* mon, u8* dst); extern u8* GetBoxMonNick(struct BoxPokemon* boxMon, u8* dst); extern u8 sav1_map_get_name(void); +extern s8 sub_8198C58(void); extern void sub_81DB5E8(u8* str1, u8* str2, u8); extern void sub_806A068(u16, u8); extern void fade_screen(u8, u8); extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); extern void init_uns_table_pokemon_copy(void); +extern void sub_805F094(void); extern void remove_some_task(void); extern void reset_temp_tile_data_buffers(void); +extern void c2_exit_to_overworld_2_switch(void); +extern void play_some_sound(void); extern void copy_decompressed_tile_data_to_vram_autofree(u8 bg_id, const void* src, u16 size, u16 offset, u8 mode); +extern void CreateYesNoMenu(const u8*, u16, u8, u8); +extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback); +extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); - void Task_EggHatch(u8 taskID); - void CB2_EggHatch_0(void); - void CB2_EggHatch_1(void); - void SpriteCB_Egg_0(struct Sprite* sprite); - void SpriteCB_Egg_1(struct Sprite* sprite); - void SpriteCB_Egg_2(struct Sprite* sprite); - void SpriteCB_Egg_3(struct Sprite* sprite); - void SpriteCB_Egg_4(struct Sprite* sprite); - void SpriteCB_Egg_5(struct Sprite* sprite); - void SpriteCB_EggShard(struct Sprite* sprite); - void EggHatchPrintMessage2(u8* src); - void EggHatchPrintMessage1(u8* src); - bool8 EggHatchUpdateWindowText(void); - void CreateRandomEggShardSprite(void); - void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex); +static void Task_EggHatch(u8 taskID); +static void CB2_EggHatch_0(void); +static void CB2_EggHatch_1(void); +static void SpriteCB_Egg_0(struct Sprite* sprite); +static void SpriteCB_Egg_1(struct Sprite* sprite); +static void SpriteCB_Egg_2(struct Sprite* sprite); +static void SpriteCB_Egg_3(struct Sprite* sprite); +static void SpriteCB_Egg_4(struct Sprite* sprite); +static void SpriteCB_Egg_5(struct Sprite* sprite); +static void SpriteCB_EggShard(struct Sprite* sprite); +static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed); +static void CreateRandomEggShardSprite(void); +static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex); static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp) { @@ -148,7 +147,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp) *egg = *temp; } -void AddHatchedMonToParty(u8 id) +static void AddHatchedMonToParty(u8 id) { u8 isEgg = 0x46; // ? u16 pokeNum; @@ -212,7 +211,7 @@ bool8 sub_8071614(void) return sub_807158C(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004); } -u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc) +static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc) { u8 r5 = 0; u8 spriteID = 0; @@ -251,21 +250,21 @@ u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc) return spriteID; } -void VBlankCB_EggHatch(void) +static void VBlankCB_EggHatch(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void EggHatch(void) +static void EggHatch(void) { ScriptContext2_Enable(); CreateTask(Task_EggHatch, 10); fade_screen(1, 0); } - void Task_EggHatch(u8 taskID) +static void Task_EggHatch(u8 taskID) { if (!gPaletteFade.active) { @@ -276,7 +275,7 @@ void EggHatch(void) } } - void CB2_EggHatch_0(void) +static void CB2_EggHatch_0(void) { switch (gMain.state) { @@ -315,7 +314,7 @@ void EggHatch(void) break; case 1: InitWindows(gUnknown_0832C06C); - gEggHatchData->field_8 = 0; + gEggHatchData->windowId = 0; gMain.state++; break; case 2: @@ -362,3 +361,315 @@ void EggHatch(void) BuildOamBuffer(); UpdatePaletteFade(); } + +static void EggHatchSetMonNickname(void) +{ + SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3); + sub_805F094(); + Free(gEggHatchData); + SetMainCallback2(c2_exit_to_overworld_2_switch); +} + +static void Task_EggHatchPlayBGM(u8 taskID) +{ + if (gTasks[taskID].data[0] == 0) + { + StopMapMusic(); + play_some_sound(); + } + if (gTasks[taskID].data[0] == 1) + PlayBGM(376); + if (gTasks[taskID].data[0] > 60) + { + PlayBGM(377); + DestroyTask(taskID); + // UB: task is destroyed, yet the value is incremented + } + gTasks[taskID].data[0]++; +} + +extern const struct SpriteTemplate gUnknown_0832BFFC; +extern const u8 gUnknown_0832C07C[]; +extern const u8 gOtherText_HatchedFromEgg[]; +extern const u8 gOtherText_NickHatchPrompt[]; + +static void CB2_EggHatch_1(void) +{ + u16 species; + u8 gender; + u32 personality; + + switch (gEggHatchData->CB2_state) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gEggHatchData->eggSpriteID = CreateSprite(&gUnknown_0832BFFC, 120, 75, 5); + ShowBg(0); + ShowBg(1); + gEggHatchData->CB2_state++; + CreateTask(Task_EggHatchPlayBGM, 5); + break; + case 1: + if (!gPaletteFade.active) + { + FillWindowPixelBuffer(gEggHatchData->windowId, 0); + gEggHatchData->CB2_PalCounter = 0; + gEggHatchData->CB2_state++; + } + break; + case 2: + if (++gEggHatchData->CB2_PalCounter > 30) + { + gEggHatchData->CB2_state++; + gSprites[gEggHatchData->eggSpriteID].callback = SpriteCB_Egg_0; + } + break; + case 3: + if (gSprites[gEggHatchData->eggSpriteID].callback == SpriteCallbackDummy) + { + species = GetMonData(&gPlayerParty[gEggHatchData->eggPartyID], MON_DATA_SPECIES); + DoMonFrontSpriteAnimation(&gSprites[gEggHatchData->pokeSpriteID], species, FALSE, 1); + gEggHatchData->CB2_state++; + } + break; + case 4: + if (gSprites[gEggHatchData->pokeSpriteID].callback == SpriteCallbackDummy) + { + gEggHatchData->CB2_state++; + } + break; + case 5: + GetMonNick(&gPlayerParty[gEggHatchData->eggPartyID], gStringVar1); + StringExpandPlaceholders(gStringVar4, gOtherText_HatchedFromEgg); + EggHatchPrintMessage(gEggHatchData->windowId, gStringVar4, 0, 3, 0xFF); + PlayFanfare(371); + gEggHatchData->CB2_state++; + PutWindowTilemap(gEggHatchData->windowId); + CopyWindowToVram(gEggHatchData->windowId, 3); + break; + case 6: + if (IsFanfareTaskInactive()) + gEggHatchData->CB2_state++; + break; + case 7: + if (IsFanfareTaskInactive()) + gEggHatchData->CB2_state++; + break; + case 8: + GetMonNick(&gPlayerParty[gEggHatchData->eggPartyID], gStringVar1); + StringExpandPlaceholders(gStringVar4, gOtherText_NickHatchPrompt); + EggHatchPrintMessage(gEggHatchData->windowId, gStringVar4, 0, 2, 1); + gEggHatchData->CB2_state++; + break; + case 9: + if (!IsTextPrinterActive(gEggHatchData->windowId)) + { + sub_809882C(gEggHatchData->windowId, 0x140, 0xE0); + CreateYesNoMenu(gUnknown_0832C07C, 0x140, 0xE, 0); + gEggHatchData->CB2_state++; + } + break; + case 10: + switch (sub_8198C58()) + { + case 0: + GetMonNick(&gPlayerParty[gEggHatchData->eggPartyID], gStringVar3); + species = GetMonData(&gPlayerParty[gEggHatchData->eggPartyID], MON_DATA_SPECIES); + gender = GetMonGender(&gPlayerParty[gEggHatchData->eggPartyID]); + personality = GetMonData(&gPlayerParty[gEggHatchData->eggPartyID], MON_DATA_PERSONALITY, 0); + DoNamingScreen(3, gStringVar3, species, gender, personality, EggHatchSetMonNickname); + break; + case 1: + case -1: + gEggHatchData->CB2_state++; + } + break; + case 11: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gEggHatchData->CB2_state++; + break; + case 12: + if (!gPaletteFade.active) + { + sub_805F094(); + RemoveWindow(gEggHatchData->windowId); + UnsetBgTilemapBuffer(0); + UnsetBgTilemapBuffer(1); + Free(gEggHatchData); + SetMainCallback2(c2_exit_to_overworld_2_switch); + } + break; + } + + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void SpriteCB_Egg_0(struct Sprite* sprite) +{ + if (++sprite->data0 > 20) + { + sprite->callback = SpriteCB_Egg_1; + sprite->data0 = 0; + } + else + { + sprite->data1 = (sprite->data1 + 20) & 0xFF; + sprite->pos2.x = Sin(sprite->data1, 1); + if (sprite->data0 == 15) + { + PlaySE(SE_BOWA); + StartSpriteAnim(sprite, 1); + CreateRandomEggShardSprite(); + } + } +} + +static void SpriteCB_Egg_1(struct Sprite* sprite) +{ + if (++sprite->data2 > 30) + { + if (++sprite->data0 > 20) + { + sprite->callback = SpriteCB_Egg_2; + sprite->data0 = 0; + sprite->data2 = 0; + } + else + { + sprite->data1 = (sprite->data1 + 20) & 0xFF; + sprite->pos2.x = Sin(sprite->data1, 2); + if (sprite->data0 == 15) + { + PlaySE(SE_BOWA); + StartSpriteAnim(sprite, 2); + } + } + } +} + +static void SpriteCB_Egg_2(struct Sprite* sprite) +{ + if (++sprite->data2 > 30) + { + if (++sprite->data0 > 38) + { + u16 species; + + sprite->callback = SpriteCB_Egg_3; + sprite->data0 = 0; + species = GetMonData(&gPlayerParty[gEggHatchData->eggPartyID], MON_DATA_SPECIES); + gSprites[gEggHatchData->pokeSpriteID].pos2.x = 0; + gSprites[gEggHatchData->pokeSpriteID].pos2.y = 0; + } + else + { + sprite->data1 = (sprite->data1 + 20) & 0xFF; + sprite->pos2.x = Sin(sprite->data1, 2); + if (sprite->data0 == 15) + { + PlaySE(SE_BOWA); + StartSpriteAnim(sprite, 2); + CreateRandomEggShardSprite(); + CreateRandomEggShardSprite(); + } + if (sprite->data0 == 30) + PlaySE(SE_BOWA); + } + } +} + +static void SpriteCB_Egg_3(struct Sprite* sprite) +{ + if (++sprite->data0 > 50) + { + sprite->callback = SpriteCB_Egg_4; + sprite->data0 = 0; + } +} + +static void SpriteCB_Egg_4(struct Sprite* sprite) +{ + s16 i; + if (sprite->data0 == 0) + BeginNormalPaletteFade(-1, -1, 0, 0x10, 0xFFFF); + if (sprite->data0 < 4u) + { + for (i = 0; i <= 3; i++) + CreateRandomEggShardSprite(); + } + sprite->data0++; + if (!gPaletteFade.active) + { + PlaySE(SE_TAMAGO); + sprite->invisible = 1; + sprite->callback = SpriteCB_Egg_5; + sprite->data0 = 0; + } +} + +static void SpriteCB_Egg_5(struct Sprite* sprite) +{ + if (sprite->data0 == 0) + { + gSprites[gEggHatchData->pokeSpriteID].invisible = 0; + StartSpriteAffineAnim(&gSprites[gEggHatchData->pokeSpriteID], 1); + } + if (sprite->data0 == 8) + BeginNormalPaletteFade(-1, -1, 0x10, 0, 0xFFFF); + if (sprite->data0 <= 9) + gSprites[gEggHatchData->pokeSpriteID].pos1.y -= 1; + if (sprite->data0 > 40) + sprite->callback = SpriteCallbackDummy; + sprite->data0++; +} + +static void SpriteCB_EggShard(struct Sprite* sprite) +{ + sprite->data4 += sprite->data1; + sprite->data5 += sprite->data2; + + sprite->pos2.x = sprite->data4 / 256; + sprite->pos2.y = sprite->data5 / 256; + + sprite->data2 += sprite->data3; + + if (sprite->pos1.y + sprite->pos2.y > sprite->pos1.y + 20 && sprite->data2 > 0) + DestroySprite(sprite); +} + +extern const s16 sEggShardVelocities[][2]; + +static void CreateRandomEggShardSprite(void) +{ + u16 spriteAnimIndex; + + s16 velocity1 = sEggShardVelocities[gEggHatchData->eggShardVelocityID][0]; + s16 velocity2 = sEggShardVelocities[gEggHatchData->eggShardVelocityID][1]; + gEggHatchData->eggShardVelocityID++; + spriteAnimIndex = Random() % 4; + CreateEggShardSprite(120, 60, velocity1, velocity2, 100, spriteAnimIndex); +} + +extern const struct SpriteTemplate gUnknown_0832C04C; + +static void CreateEggShardSprite(u8 x, u8 y, s16 data1, s16 data2, s16 data3, u8 spriteAnimIndex) +{ + u8 spriteID = CreateSprite(&gUnknown_0832C04C, x, y, 4); + gSprites[spriteID].data1 = data1; + gSprites[spriteID].data2 = data2; + gSprites[spriteID].data3 = data3; + StartSpriteAnim(&gSprites[spriteID], spriteAnimIndex); +} + +static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed) +{ + FillWindowPixelBuffer(windowId, 0xFF); + gEggHatchData->textColor.fgColor = 0; + gEggHatchData->textColor.bgColor = 5; + gEggHatchData->textColor.shadowColor = 6; + AddTextPrinterParametrized2(windowId, 1, x, y, 0, 0, &gEggHatchData->textColor, speed, string); +} diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 2d1dfb8b7..a2282539e 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1511,8 +1511,6 @@ static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) } } -void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); - void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) { if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))) diff --git a/src/text.c b/src/text.c index cad8326e3..4b963d1a6 100644 --- a/src/text.c +++ b/src/text.c @@ -244,12 +244,11 @@ void RunTextPrinters(void) } } -bool8 IsTextPrinterActive(u8 id) +bool16 IsTextPrinterActive(u8 id) { return gTextPrinters[id].sub_union.sub.active; } - u32 RenderFont(struct TextPrinter *textPrinter) { u32 ret;