diff --git a/Makefile b/Makefile index b9e2fb289..c38d8fe76 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,11 @@ LDFLAGS = -Map ../../$(MAP) OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy -LIBGCC := tools/agbcc/lib/libgcc.a -LIBC := tools/agbcc/lib/libc.a +ifeq ($(OS),Windows_NT) + LIB := ../../tools/agbcc/lib/libgcc.a ../../tools/agbcc/lib/libc.a +else + LIB := -L ../../tools/agbcc/lib -lgcc -lc +endif SHA1 := sha1sum -c @@ -163,7 +166,7 @@ $(OBJ_DIR)/ld_script.ld: ld_script.txt $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_comm cd $(OBJ_DIR) && sed -f ../../ld_script.sed ../../$< | sed "s#tools/#../../tools/#g" > ld_script.ld $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) - cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) ../../$(LIBGCC) ../../$(LIBC) + cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) $(ROM): $(ELF) $(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@ diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index 031bf2128..9a8b378ac 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -12802,7 +12802,7 @@ _08104EDC: lsls r0, 16 cmp r2, r0 bgt _08104F1A - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r4, r0 @@ -12839,7 +12839,7 @@ _08104F1A: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_8104F54 str r0, [r5] add sp, 0xC @@ -12919,7 +12919,7 @@ _08104FCC: ldrsh r0, [r3, r1] cmp r0, 0 blt _08104FF0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers lsls r0, 1 adds r0, r2 ldrh r1, [r3, 0x14] @@ -12943,7 +12943,7 @@ _08104FF0: ldrsh r1, [r3, r2] cmp r0, r1 blt _0810500E - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] adds r0, r4, 0 @@ -18518,7 +18518,7 @@ _08107D8C: movs r3, 0 movs r2, 0x10 ldrsh r0, [r4, r2] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers mov r12, r1 cmp r3, r0 bge _08107DCA @@ -18555,7 +18555,7 @@ _08107DCA: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107E04 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -18584,7 +18584,7 @@ _08107E04: asrs r0, r2, 16 cmp r0, 0x9F bgt _08107E3A - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -18652,7 +18652,7 @@ _08107E7A: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -18689,8 +18689,8 @@ _08107ED8: ldrsh r0, [r4, r1] cmp r3, r0 bge _08107F0C - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107EE6: lsls r1, r3, 16 asrs r1, 16 @@ -18719,8 +18719,8 @@ _08107F0C: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107F40 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F1E: asrs r3, r2, 16 lsls r2, r3, 1 @@ -18745,8 +18745,8 @@ _08107F40: asrs r0, r1, 16 cmp r0, 0x9F bgt _08108022 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F4E: asrs r3, r1, 16 lsls r2, r3, 1 @@ -18771,8 +18771,8 @@ _08107F78: ldrsh r0, [r4, r1] cmp r3, r0 bge _08107FAC - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107F86: lsls r1, r3, 16 asrs r1, 16 @@ -18801,8 +18801,8 @@ _08107FAC: ldrsh r0, [r4, r3] cmp r1, r0 bge _08107FE0 - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107FBE: asrs r3, r2, 16 lsls r2, r3, 1 @@ -18827,8 +18827,8 @@ _08107FE0: asrs r0, r1, 16 cmp r0, 0x9F bgt _0810800C - ldr r6, =gUnknown_02038C28 - ldr r5, =gUnknown_02039B28 + ldr r6, =gScanlineEffectRegBuffers + ldr r5, =gScanlineEffect _08107FEE: asrs r3, r1, 16 lsls r2, r3, 1 @@ -34618,7 +34618,7 @@ _0810FEC0: adds r0, 0x40 cmp r1, r0 bgt _0810FEFA - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -34651,7 +34651,7 @@ _0810FEFA: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_810FF34 str r0, [r4] add sp, 0xC @@ -34700,7 +34700,7 @@ _0810FF66: ldr r0, =gSineTable mov r9, r0 movs r7, 0x3 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers mov r12, r1 movs r2, 0xF0 lsls r2, 3 @@ -34775,7 +34775,7 @@ _0810FFFE: ble _08110026 b _08110014 _0811000E: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08110014: @@ -38728,7 +38728,7 @@ _08112054: _0811206C: movs r2, 0x2 movs r3, 0x6 - bl sub_80BA384 + bl ScanlineEffect_InitWave lsls r0, 24 lsrs r0, 24 strh r0, [r5, 0x1C] @@ -38884,7 +38884,7 @@ _081121A8: beq _081121F0 b _08112258 _081121AE: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] movs r0, 0x1 @@ -41152,7 +41152,7 @@ _0811345A: ldrsh r0, [r4, r1] cmp r3, r0 bgt _08113488 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -41175,7 +41175,7 @@ _08113488: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_81134B8 str r0, [r4] add sp, 0xC @@ -41264,7 +41264,7 @@ _0811354E: bl sub_8113574 b _0811356E _08113556: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] ldrh r0, [r2, 0x8] @@ -41292,11 +41292,11 @@ sub_8113574: @ 8113574 ldrsh r0, [r5, r1] cmp r4, r0 bgt _081135CA - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers mov r12, r7 ldr r0, =gSineTable mov r8, r0 - ldr r6, =gUnknown_02039B28 + ldr r6, =gScanlineEffect _08113592: lsls r2, r4, 1 ldrb r1, [r6, 0x14] @@ -42169,7 +42169,7 @@ _08113CB0: movs r0, 0x3 bl sub_8114374 movs r3, 0 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r4, r0 @@ -42189,7 +42189,7 @@ _08113CDC: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams movs r0, 0x3F eors r7, r0 movs r1, 0xFC @@ -42344,7 +42344,7 @@ _08113E3E: b _08113E5E .pool _08113E58: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08113E5E: @@ -42534,7 +42534,7 @@ _08114002: str r0, [sp, 0x10] movs r3, 0 add r4, sp, 0x10 - ldr r6, =gUnknown_02038C28 + ldr r6, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r7, r6, r0 @@ -42563,7 +42563,7 @@ _08114010: strb r2, [r4, 0x9] ldr r0, [sp, 0x10] ldr r2, [r4, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams _08114044: ldrh r0, [r5, 0x8] adds r0, 0x1 @@ -42772,7 +42772,7 @@ _081141DA: bne _08114232 b _08114204 _081141FE: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08114204: @@ -42827,9 +42827,9 @@ sub_8114244: @ 8114244 movs r4, 0 cmp r0, 0 ble _081142A4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect _08114278: lsls r2, r4, 16 asrs r2, 16 @@ -42861,9 +42861,9 @@ _081142A4: ldrsh r0, [r6, r2] cmp r1, r0 bgt _081142EE - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect _081142B8: asrs r4, r3, 16 cmp r4, 0 @@ -42904,8 +42904,8 @@ _081142EE: ldrsh r0, [r6, r3] cmp r1, r0 bge _08114366 - ldr r7, =gUnknown_02038C28 - ldr r4, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r4, =gScanlineEffect _08114306: asrs r3, r2, 16 cmp r3, 0 @@ -42935,7 +42935,7 @@ _08114338: adds r5, r0, 0 adds r5, 0x9F movs r4, 0 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers movs r2, 0xF0 lsls r2, 3 adds r6, r3, r2 @@ -44235,7 +44235,7 @@ _08114E4E: b _08114E7E .pool _08114E78: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _08114E7E: @@ -44510,7 +44510,7 @@ _08115094: ldrsh r0, [r0, r1] cmp r0, 0 bne _081150DA - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _081150C2: @@ -44561,7 +44561,7 @@ _08115114: asrs r4, r0, 16 cmp r2, r0 bge _08115140 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -44584,7 +44584,7 @@ _08115140: asrs r0, r1, 16 cmp r0, 0x9F bgt _0811516E - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers lsls r0, r3, 16 asrs r0, 16 adds r3, r0, 0 @@ -44616,7 +44616,7 @@ _0811516E: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams add sp, 0xC pop {r4-r6} pop {r0} @@ -50740,9 +50740,9 @@ _08118442: strh r0, [r1, 0xC] _0811845A: movs r3, 0 - ldr r5, =gUnknown_02039B28 + ldr r5, =gScanlineEffect mov r9, r5 - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers mov r6, r9 adds r5, r1, 0 _08118466: @@ -50760,8 +50760,8 @@ _08118466: ble _08118466 cmp r3, 0x9F bgt _081184AA - ldr r7, =gUnknown_02038C28 - ldr r6, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r6, =gScanlineEffect ldr r1, =gTasks mov r2, r12 adds r0, r2, r4 @@ -51089,9 +51089,9 @@ _0811873C: strh r0, [r1, 0xC] _08118752: movs r3, 0 - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r8, r0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers mov r12, r2 mov r7, r8 adds r4, r1, 0 @@ -51110,9 +51110,9 @@ _08118760: ble _08118760 cmp r3, 0x9F bgt _081187A4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect ldr r1, =gTasks adds r0, r6, r5 lsls r0, 3 @@ -51378,9 +51378,9 @@ _081189BA: strh r0, [r1, 0xC] _081189D0: movs r3, 0 - ldr r6, =gUnknown_02039B28 + ldr r6, =gScanlineEffect mov r8, r6 - ldr r7, =gUnknown_02038C28 + ldr r7, =gScanlineEffectRegBuffers adds r4, r1, 0 _081189DA: lsls r2, r3, 1 @@ -51397,8 +51397,8 @@ _081189DA: ble _081189DA cmp r3, 0x9F bgt _08118A1E - ldr r7, =gUnknown_02038C28 - ldr r6, =gUnknown_02039B28 + ldr r7, =gScanlineEffectRegBuffers + ldr r6, =gScanlineEffect ldr r1, =gTasks mov r2, r12 adds r0, r2, r5 @@ -51707,9 +51707,9 @@ _08118C90: strh r0, [r1, 0xC] _08118CA6: movs r3, 0 - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r12, r0 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers mov r8, r2 mov r7, r12 adds r4, r1, 0 @@ -51728,9 +51728,9 @@ _08118CB4: ble _08118CB4 cmp r3, 0x9F bgt _08118CF8 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r8, r0 - ldr r7, =gUnknown_02039B28 + ldr r7, =gScanlineEffect ldr r1, =gTasks adds r0, r5, r6 lsls r0, 3 @@ -52025,7 +52025,7 @@ _08118F28: lsls r1, 7 movs r0, 0xC bl SetGpuReg - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] ldr r1, =gTasks diff --git a/asm/battle_anim_815A0D4.s b/asm/battle_anim_815A0D4.s index d583f1e85..f3b72792d 100644 --- a/asm/battle_anim_815A0D4.s +++ b/asm/battle_anim_815A0D4.s @@ -1689,7 +1689,7 @@ _0815AE58: ldrsh r0, [r5, r6] cmp r1, r0 bgt _0815AE8E - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r0, r4 @@ -1729,7 +1729,7 @@ _0815AEA2: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_815AED8 str r0, [r5] add sp, 0xC @@ -1820,7 +1820,7 @@ _0815AF5C: ldrsh r0, [r4, r2] cmp r1, r0 bge _0815AF90 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -1848,7 +1848,7 @@ _0815AF90: ldrsh r0, [r4, r2] cmp r1, r0 bgt _0815AFC4 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r6, r5, r0 @@ -1877,7 +1877,7 @@ _0815AFC4: ldrsh r0, [r4, r1] cmp r0, 0 beq _0815AFDA - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0815AFDA: @@ -6151,7 +6151,7 @@ _0815D316: ldrh r3, [r0] movs r7, 0 movs r2, 0 - ldr r6, =gUnknown_02038C28 + ldr r6, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r0, r6 @@ -6192,7 +6192,7 @@ _0815D326: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_815D398 str r0, [r4] add sp, 0xC @@ -6304,7 +6304,7 @@ _0815D40E: ldrsh r0, [r6, r3] cmp r1, r0 ble _0815D52E - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect mov r10, r0 ldr r1, [sp, 0x4] lsls r0, r1, 16 @@ -6325,7 +6325,7 @@ _0815D47E: subs r0, r1 lsls r0, 7 adds r2, r0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers adds r2, r0 lsls r4, 16 asrs r4, 16 @@ -6343,7 +6343,7 @@ _0815D47E: subs r0, r1 lsls r0, 7 adds r3, r0 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r3, r1 lsls r1, r7, 16 asrs r1, 16 @@ -6407,7 +6407,7 @@ _0815D52E: lsls r1, r2, 17 cmp r1, 0 blt _0815D55A - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r7, [sp, 0x4] lsls r0, r7, 16 asrs r0, 16 @@ -6487,7 +6487,7 @@ _0815D5CC: asrs r0, 16 cmp r0, 0xC ble _0815D63C - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] movs r0, 0 diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index c2517586e..31d5d3fbe 100644 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -7096,7 +7096,7 @@ _081926B0: movs r1, 0x1 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] @@ -8779,7 +8779,7 @@ _081934B0: mov r1, r10 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] @@ -8927,7 +8927,7 @@ _081935FA: movs r1, 0x1 str r1, [sp, 0x8] ldr r1, =sub_8190938 - bl sub_80D2CC4 + bl CreateMonIcon ldr r1, [r6] adds r1, r4 strb r0, [r1] @@ -11000,8 +11000,8 @@ _0819486C: movs r1, 0 strh r1, [r0, 0x8] _08194878: - bl dp12_8087EA4 - ldr r0, =gUnknown_02038C28 + bl ScanlineEffect_Clear + ldr r0, =gScanlineEffectRegBuffers ldr r2, =0x00001f0a movs r4, 0xF0 lsls r4, 3 @@ -11017,7 +11017,7 @@ _08194888: bge _08194888 movs r5, 0x5B ldr r3, =gUnknown_0860CF44 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers ldr r2, =0x00001f09 ldr r4, =0x00000836 adds r1, r0, r4 @@ -11033,7 +11033,7 @@ _081948A4: ldr r0, [r3] ldr r1, [r3, 0x4] ldr r2, [r3, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams mov r0, r8 bl DestroyTask _081948C2: @@ -11513,7 +11513,7 @@ sub_8194CE4: @ 8194CE4 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index 2a87fbf18..8a32f5b3a 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -486,7 +486,7 @@ sub_817804C: @ 817804C str r6, [sp, 0xC] str r1, [sp, 0x10] movs r1, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x14 pop {r4-r6} pop {r0} diff --git a/asm/cable_club.s b/asm/cable_club.s index 36ec01cb5..3b5c392fc 100644 --- a/asm/cable_club.s +++ b/asm/cable_club.s @@ -1808,7 +1808,7 @@ _080B32E0: _080B32F8: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r1, =gLinkType ldr r2, =0x00002211 adds r0, r2, 0 @@ -1921,7 +1921,7 @@ _080B33E8: _080B3408: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =gLinkType ldr r2, =0x00002211 adds r1, r2, 0 @@ -2399,7 +2399,7 @@ _080B382E: bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl ClearLinkCallback_2 b _080B3864 _080B3840: @@ -2470,7 +2470,7 @@ _080B38C6: bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl Rfu_set_zero b _080B38FC _080B38D8: diff --git a/asm/contest.s b/asm/contest.s index 10e6ee591..f46c1bee9 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -563,7 +563,7 @@ _080D7B4E: bl sub_80D779C bl sub_80D77E4 bl sub_80D7678 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetPaletteFade ldr r2, =gPaletteFade ldrb r0, [r2, 0x8] @@ -1367,7 +1367,7 @@ vblank_cb_battle: @ 80D827C bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index dc052607c..c07be821f 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -344,7 +344,7 @@ sub_80F5B00: @ 80F5B00 bl SetVBlankCallback bl sub_80F7DF4 bl sub_80F57C4 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetPaletteFade bl ResetSpriteData bl ResetTasks @@ -492,7 +492,7 @@ sub_80F5C24: @ 80F5C24 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 .pool diff --git a/asm/coord_event_weather.s b/asm/coord_event_weather.s deleted file mode 100644 index 7c1188ad6..000000000 --- a/asm/coord_event_weather.s +++ /dev/null @@ -1,156 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_809D7BC -sub_809D7BC: @ 809D7BC - push {lr} - movs r0, 0x1 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7BC - - thumb_func_start sub_809D7C8 -sub_809D7C8: @ 809D7C8 - push {lr} - movs r0, 0x2 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7C8 - - thumb_func_start sub_809D7D4 -sub_809D7D4: @ 809D7D4 - push {lr} - movs r0, 0x3 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7D4 - - thumb_func_start sub_809D7E0 -sub_809D7E0: @ 809D7E0 - push {lr} - movs r0, 0x4 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7E0 - - thumb_func_start sub_809D7EC -sub_809D7EC: @ 809D7EC - push {lr} - movs r0, 0x5 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7EC - - thumb_func_start sub_809D7F8 -sub_809D7F8: @ 809D7F8 - push {lr} - movs r0, 0x6 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D7F8 - - thumb_func_start sub_809D804 -sub_809D804: @ 809D804 - push {lr} - movs r0, 0x9 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D804 - - thumb_func_start sub_809D810 -sub_809D810: @ 809D810 - push {lr} - movs r0, 0x7 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D810 - - thumb_func_start sub_809D81C -sub_809D81C: @ 809D81C - push {lr} - movs r0, 0x8 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D81C - - thumb_func_start sub_809D828 -sub_809D828: @ 809D828 - push {lr} - movs r0, 0xB - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D828 - - thumb_func_start sub_809D834 -sub_809D834: @ 809D834 - push {lr} - movs r0, 0xC - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D834 - - thumb_func_start sub_809D840 -sub_809D840: @ 809D840 - push {lr} - movs r0, 0x14 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D840 - - thumb_func_start sub_809D84C -sub_809D84C: @ 809D84C - push {lr} - movs r0, 0x15 - bl sub_80AEDF0 - pop {r0} - bx r0 - thumb_func_end sub_809D84C - - thumb_func_start trigger_activate_weather -trigger_activate_weather: @ 809D858 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0 - ldr r3, =gUnknown_085102E0 -_0809D862: - lsls r1, r2, 3 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r4 - bne _0809D87C - adds r0, r3, 0x4 - adds r0, r1, r0 - ldr r0, [r0] - bl _call_via_r0 - b _0809D886 - .pool -_0809D87C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xC - bls _0809D862 -_0809D886: - pop {r4} - pop {r0} - bx r0 - thumb_func_end trigger_activate_weather - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/credits.s b/asm/credits.s index 33bf413c1..a8a665b06 100644 --- a/asm/credits.s +++ b/asm/credits.s @@ -149,7 +149,7 @@ _081755E4: movs r0, 0 movs r1, 0x1 adds r3, r5, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r4,r5} pop {r0} diff --git a/asm/easy_chat.s b/asm/easy_chat.s index 86c78d2cf..db2ffac14 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -652,7 +652,7 @@ sub_811A7E4: @ 811A7E4 _0811A804: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _0811A840 _0811A80E: ldr r0, =gPaletteFade diff --git a/asm/field_control_avatar.s b/asm/field_control_avatar.s index e0e7b5efb..89e6efa6a 100644 --- a/asm/field_control_avatar.s +++ b/asm/field_control_avatar.s @@ -2155,7 +2155,7 @@ trigger_activate: @ 809D04C cmp r1, 0 bne _0809D062 ldrb r0, [r4, 0x6] - bl trigger_activate_weather + bl DoCoordEventWeather b _0809D082 _0809D062: ldrh r0, [r4, 0x6] diff --git a/asm/field_effect.s b/asm/field_effect.s index 770f1932c..80f2030aa 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -764,8 +764,8 @@ _080B608E: bx r0 thumb_func_end sub_80B6070 - thumb_func_start sub_80B609C -sub_80B609C: @ 80B609C + thumb_func_start MultiplyInvertedPaletteRGBComponents +MultiplyInvertedPaletteRGBComponents: @ 80B609C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -832,7 +832,7 @@ sub_80B609C: @ 80B609C pop {r0} bx r0 .pool - thumb_func_end sub_80B609C + thumb_func_end MultiplyInvertedPaletteRGBComponents thumb_func_start sub_80B6128 sub_80B6128: @ 80B6128 @@ -1469,7 +1469,7 @@ _080B65D8: mov r9, r3 add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] adds r4, 0x2 mov r0, r8 @@ -1488,7 +1488,7 @@ _080B65D8: ldrb r2, [r2] add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] adds r4, 0x1 mov r3, r8 @@ -1507,7 +1507,7 @@ _080B65D8: ldrb r2, [r2] add r4, r9 ldrb r3, [r4] - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r4, [r7, 0x32] lsls r4, 24 lsrs r4, 24 @@ -1527,7 +1527,7 @@ _080B65D8: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r10 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1538,7 +1538,7 @@ _080B65D8: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents movs r3, 0x34 ldrsh r0, [r7, r3] cmp r0, 0x2 @@ -1612,7 +1612,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1624,7 +1624,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1636,7 +1636,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1647,7 +1647,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents mov r0, r8 bl IndexOfSpritePaletteTag lsls r0, 24 @@ -1658,7 +1658,7 @@ _080B6718: adds r1, r6, 0 adds r2, r5, 0 adds r3, r4, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents pop {r3} mov r8, r3 pop {r4-r6} diff --git a/asm/field_message_box.s b/asm/field_message_box.s deleted file mode 100644 index 0c1fae6de..000000000 --- a/asm/field_message_box.s +++ /dev/null @@ -1,337 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8098128 -sub_8098128: @ 8098128 - ldr r1, =gUnknown_020375BC - movs r0, 0 - strb r0, [r1] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - movs r1, 0x3 - negs r1, r1 - ands r0, r1 - subs r1, 0x2 - ands r0, r1 - subs r1, 0x4 - ands r0, r1 - strb r0, [r2] - bx lr - .pool - thumb_func_end sub_8098128 - - thumb_func_start sub_8098154 -sub_8098154: @ 8098154 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _08098188 - cmp r0, 0x1 - bgt _0809817C - cmp r0, 0 - beq _08098182 - b _080981B0 - .pool -_0809817C: - cmp r0, 0x2 - beq _08098198 - b _080981B0 -_08098182: - bl sub_81973A4 - b _08098190 -_08098188: - movs r0, 0 - movs r1, 0x1 - bl sub_81973C4 -_08098190: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080981B0 -_08098198: - bl sub_8197224 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - beq _080981B0 - ldr r1, =gUnknown_020375BC - movs r0, 0 - strb r0, [r1] - adds r0, r5, 0 - bl DestroyTask -_080981B0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098154 - - thumb_func_start task_add_textbox -task_add_textbox: @ 80981BC - push {lr} - ldr r0, =sub_8098154 - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end task_add_textbox - - thumb_func_start task_del_textbox -task_del_textbox: @ 80981D0 - push {lr} - ldr r0, =sub_8098154 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _080981E4 - bl DestroyTask -_080981E4: - pop {r0} - bx r0 - .pool - thumb_func_end task_del_textbox - - thumb_func_start ShowFieldMessage -ShowFieldMessage: @ 80981EC - push {r4,lr} - adds r1, r0, 0 - ldr r4, =gUnknown_020375BC - ldrb r0, [r4] - cmp r0, 0 - bne _0809820C - adds r0, r1, 0 - movs r1, 0x1 - bl textbox_fdecode_auto_and_task_add - movs r0, 0x2 - strb r0, [r4] - movs r0, 0x1 - b _0809820E - .pool -_0809820C: - movs r0, 0 -_0809820E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end ShowFieldMessage - - thumb_func_start sub_8098214 -sub_8098214: @ 8098214 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_8196094 - adds r1, r0, 0 - cmp r1, 0 - bne _0809822E - ldr r0, =gUnknown_020375BC - strb r1, [r0] - adds r0, r4, 0 - bl DestroyTask -_0809822E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098214 - - thumb_func_start sub_8098238 -sub_8098238: @ 8098238 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_020375BC - ldrb r0, [r5] - cmp r0, 0 - bne _08098270 - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl StringExpandPlaceholders - ldr r0, =sub_8098214 - movs r1, 0 - bl CreateTask - adds r0, r4, 0 - bl sub_8196080 - movs r0, 0x2 - strb r0, [r5] - movs r0, 0x1 - b _08098272 - .pool -_08098270: - movs r0, 0 -_08098272: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8098238 - - thumb_func_start ShowFieldAutoScrollMessage -ShowFieldAutoScrollMessage: @ 8098278 - push {lr} - adds r1, r0, 0 - ldr r2, =gUnknown_020375BC - ldrb r0, [r2] - cmp r0, 0 - bne _08098298 - movs r0, 0x3 - strb r0, [r2] - adds r0, r1, 0 - movs r1, 0 - bl textbox_fdecode_auto_and_task_add - movs r0, 0x1 - b _0809829A - .pool -_08098298: - movs r0, 0 -_0809829A: - pop {r1} - bx r1 - thumb_func_end ShowFieldAutoScrollMessage - - thumb_func_start sub_80982A0 -sub_80982A0: @ 80982A0 - push {lr} - ldr r2, =gUnknown_020375BC - movs r1, 0x3 - strb r1, [r2] - movs r1, 0x1 - bl textbox_fdecode_auto_and_task_add - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80982A0 - - thumb_func_start sub_80982B8 -sub_80982B8: @ 80982B8 - push {lr} - ldr r1, =gUnknown_020375BC - ldrb r0, [r1] - cmp r0, 0 - bne _080982D4 - movs r0, 0x2 - strb r0, [r1] - bl textbox_auto_and_task_add - movs r0, 0x1 - b _080982D6 - .pool -_080982D4: - movs r0, 0 -_080982D6: - pop {r1} - bx r1 - thumb_func_end sub_80982B8 - - thumb_func_start textbox_fdecode_auto_and_task_add -textbox_fdecode_auto_and_task_add: @ 80982DC - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldr r0, =gStringVar4 - adds r1, r2, 0 - bl StringExpandPlaceholders - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl AddTextPrinterForMessage - bl task_add_textbox - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end textbox_fdecode_auto_and_task_add - - thumb_func_start textbox_auto_and_task_add -textbox_auto_and_task_add: @ 8098304 - push {lr} - movs r0, 0x1 - bl AddTextPrinterForMessage - bl task_add_textbox - pop {r0} - bx r0 - thumb_func_end textbox_auto_and_task_add - - thumb_func_start HideFieldMessageBox -HideFieldMessageBox: @ 8098314 - push {lr} - bl task_del_textbox - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - ldr r1, =gUnknown_020375BC - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end HideFieldMessageBox - - thumb_func_start textbox_any_visible -textbox_any_visible: @ 8098330 - ldr r0, =gUnknown_020375BC - ldrb r0, [r0] - bx lr - .pool - thumb_func_end textbox_any_visible - - thumb_func_start IsFieldMessageBoxHidden -IsFieldMessageBoxHidden: @ 809833C - push {lr} - ldr r0, =gUnknown_020375BC - ldrb r0, [r0] - cmp r0, 0 - beq _08098350 - movs r0, 0 - b _08098352 - .pool -_08098350: - movs r0, 0x1 -_08098352: - pop {r1} - bx r1 - thumb_func_end IsFieldMessageBoxHidden - - thumb_func_start sub_8098358 -sub_8098358: @ 8098358 - push {lr} - bl task_del_textbox - movs r0, 0 - movs r1, 0x1 - bl sub_81973FC - ldr r1, =gUnknown_020375BC - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098358 - - thumb_func_start sub_8098374 -sub_8098374: @ 8098374 - push {lr} - bl task_del_textbox - ldr r1, =gUnknown_020375BC - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098374 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/field_player_avatar.s b/asm/field_player_avatar.s index 5385e2eba..cd4f83681 100644 --- a/asm/field_player_avatar.s +++ b/asm/field_player_avatar.s @@ -2602,8 +2602,8 @@ _0808BD2C: .pool thumb_func_end sub_808BCF4 - thumb_func_start sub_808BD3C -sub_808BD3C: @ 808BD3C + thumb_func_start GetRivalAvatarGraphicsIdByStateIdAndGender +GetRivalAvatarGraphicsIdByStateIdAndGender: @ 808BD3C lsls r0, 24 lsls r1, 24 lsrs r1, 24 @@ -2614,7 +2614,7 @@ sub_808BD3C: @ 808BD3C ldrb r0, [r1] bx lr .pool - thumb_func_end sub_808BD3C + thumb_func_end GetRivalAvatarGraphicsIdByStateIdAndGender thumb_func_start GetPlayerAvatarGraphicsIdByStateIdAndGender @ u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 stateId, u8 gender) @@ -4538,7 +4538,7 @@ fish9: @ 808CC64 movs r0, 0 movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -4695,7 +4695,7 @@ fishB: @ 808CD94 movs r0, 0 movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized movs r0, 0xD strh r0, [r5, 0x8] movs r0, 0x1 @@ -4743,7 +4743,7 @@ fishC: @ 808CE04 movs r0, 0 movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldrh r0, [r5, 0x8] adds r0, 0x1 strh r0, [r5, 0x8] diff --git a/asm/field_screen.s b/asm/field_screen.s index 4aea710d2..0943fe1e3 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -1625,8 +1625,8 @@ _080ABCBC: .pool thumb_func_end sub_80ABC7C - thumb_func_start fade_screen -fade_screen: @ 80ABCD0 + thumb_func_start FadeScreen +FadeScreen: @ 80ABCD0 push {r4,r5,lr} sub sp, 0x4 lsls r0, 24 @@ -1762,7 +1762,7 @@ _080ABDE4: pop {r0} bx r0 .pool - thumb_func_end fade_screen + thumb_func_end FadeScreen thumb_func_start sub_80ABDFC sub_80ABDFC: @ 80ABDFC @@ -2339,43 +2339,43 @@ _080AC290: .4byte _080AC300 _080AC2B8: movs r0, 0x1 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2C0: movs r0, 0x2 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2C8: movs r0, 0x3 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2D0: movs r0, 0x4 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2D8: movs r0, 0x5 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2E0: movs r0, 0x6 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2E8: movs r0, 0x9 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2F0: movs r0, 0x7 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC2F8: movs r0, 0x8 - bl sub_80AEDF0 + bl SetWeather b _080AC306 _080AC300: movs r0, 0xB - bl sub_80AEDF0 + bl SetWeather _080AC306: pop {r0} bx r0 @@ -2472,15 +2472,15 @@ _080AC3B6: bx r0 thumb_func_end play_some_sound - thumb_func_start sub_80AC3BC -sub_80AC3BC: @ 80AC3BC + thumb_func_start IsWeatherChangeComplete +IsWeatherChangeComplete: @ 80AC3BC ldr r0, =gUnknown_02038454 ldr r1, =0x000006d3 adds r0, r1 ldrb r0, [r0] bx lr .pool - thumb_func_end sub_80AC3BC + thumb_func_end IsWeatherChangeComplete thumb_func_start sub_80AC3D0 sub_80AC3D0: @ 80AC3D0 @@ -7537,8 +7537,8 @@ GetSav1Weather: @ 80AEDAC .pool thumb_func_end GetSav1Weather - thumb_func_start sub_80AEDBC -sub_80AEDBC: @ 80AEDBC + thumb_func_start SetSav1WeatherFromCurrMapHeader +SetSav1WeatherFromCurrMapHeader: @ 80AEDBC push {r4,r5,lr} ldr r4, =gSaveBlock1Ptr ldr r0, [r4] @@ -7559,10 +7559,10 @@ sub_80AEDBC: @ 80AEDBC pop {r0} bx r0 .pool - thumb_func_end sub_80AEDBC + thumb_func_end SetSav1WeatherFromCurrMapHeader - thumb_func_start sub_80AEDF0 -sub_80AEDF0: @ 80AEDF0 + thumb_func_start SetWeather +SetWeather: @ 80AEDF0 push {lr} bl SetSav1Weather bl GetSav1Weather @@ -7571,7 +7571,7 @@ sub_80AEDF0: @ 80AEDF0 bl weather_set pop {r0} bx r0 - thumb_func_end sub_80AEDF0 + thumb_func_end SetWeather thumb_func_start sub_80AEE08 sub_80AEE08: @ 80AEE08 @@ -7872,13 +7872,13 @@ _080AF06A: bl palette_bg_faded_fill_black movs r0, 0 movs r1, 0 - bl fade_screen + bl FadeScreen b _080AF084 _080AF078: bl palette_bg_faded_fill_white movs r0, 0x2 movs r1, 0 - bl fade_screen + bl FadeScreen _080AF084: pop {r4} pop {r0} @@ -7891,7 +7891,7 @@ sub_80AF08C: @ 80AF08C bl palette_bg_faded_fill_white movs r0, 0x2 movs r1, 0x8 - bl fade_screen + bl FadeScreen pop {r0} bx r0 thumb_func_end sub_80AF08C @@ -7902,7 +7902,7 @@ pal_fill_black: @ 80AF0A0 bl palette_bg_faded_fill_black movs r0, 0 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 thumb_func_end pal_fill_black @@ -7928,12 +7928,12 @@ sub_80AF0B4: @ 80AF0B4 _080AF0DA: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _080AF0EC _080AF0E4: movs r0, 0x3 movs r1, 0 - bl fade_screen + bl FadeScreen _080AF0EC: pop {r4} pop {r0} @@ -8761,7 +8761,7 @@ sub_80AF79C: @ 80AF79C bl music_something movs r0, 0x3 movs r1, 0x8 - bl fade_screen + bl FadeScreen bl play_some_sound ldr r0, =gFieldCallback ldr r1, =sub_80AF3B0 @@ -8990,7 +8990,7 @@ _080AF99A: bl ClearLinkCallback_2 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen bl music_something movs r0, 0x9 bl PlaySE @@ -9572,12 +9572,12 @@ _080AFE30: beq _080AFEBC b _080AFEC6 _080AFE36: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r2, 0x2 ldrsh r1, [r4, r2] @@ -9591,12 +9591,12 @@ _080AFE36: b _080AFEC6 .pool _080AFE64: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r6, 0x2 ldrsh r1, [r4, r6] @@ -9631,7 +9631,7 @@ _080AFEB4: bl DestroyTask b _080AFEC6 _080AFEBC: - bl dp12_8087EA4 + bl ScanlineEffect_Clear adds r0, r5, 0 bl DestroyTask _080AFEC6: @@ -9665,12 +9665,12 @@ _080AFEF4: beq _080AFF80 b _080AFF8A _080AFEFA: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r2, 0x2 ldrsh r1, [r4, r2] @@ -9684,12 +9684,12 @@ _080AFEFA: b _080AFF8A .pool _080AFF28: - ldr r0, =gUnknown_02039B28 + ldr r0, =gScanlineEffect ldrb r1, [r0, 0x14] lsls r0, r1, 4 subs r0, r1 lsls r0, 7 - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers adds r0, r1 movs r6, 0x2 ldrsh r1, [r4, r6] @@ -9724,7 +9724,7 @@ _080AFF78: bl DestroyTask b _080AFF8A _080AFF80: - bl dp12_8087EA4 + bl ScanlineEffect_Clear adds r0, r5, 0 bl DestroyTask _080AFF8A: @@ -9914,7 +9914,7 @@ sub_80B00E8: @ 80B00E8 lsrs r0, 24 cmp r0, 0 beq _080B0116 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r1, =gUnknown_0854FE64 lsls r0, 1 adds r0, r1 @@ -9940,7 +9940,7 @@ _080B0116: thumb_func_start door_upload_tiles door_upload_tiles: @ 80B0124 push {r4,lr} - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldr r1, =0x00000e68 @@ -10261,7 +10261,7 @@ _080B0368: bl sub_8199C30 movs r0, 0 bl schedule_bg_copy_tilemap_to_vram - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r2, 0x4 ldrsh r1, [r5, r2] movs r0, 0x6 @@ -10280,7 +10280,7 @@ _080B0368: ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams movs r0, 0x1 strh r0, [r5] b _080B052C diff --git a/asm/field_specials.s b/asm/field_specials.s index bcbfcec93..03c0d600a 100644 --- a/asm/field_specials.s +++ b/asm/field_specials.s @@ -5639,7 +5639,7 @@ _0813AAAA: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldr r1, =gUnknown_085B312C lsls r0, r5, 1 adds r1, r0, r1 @@ -5665,7 +5665,7 @@ _0813AAE8: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldr r1, =gUnknown_085B3142 lsls r0, r5, 1 adds r1, r0, r1 @@ -5712,7 +5712,7 @@ _0813AB5C: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldr r1, =gUnknown_085B314E lsls r0, r5, 1 adds r0, r1 @@ -5736,7 +5736,7 @@ _0813AB94: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldr r1, =gUnknown_085B315C lsls r0, r5, 1 adds r0, r1 diff --git a/asm/intro.s b/asm/intro.s index 62ac7ed2d..3bfae63da 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -11,7 +11,7 @@ sub_816CBE8: @ 816CBE8 bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_816CBE8 @@ -2124,7 +2124,7 @@ task_intro_17: @ 816DEEC movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave add sp, 0xC pop {r0} bx r0 @@ -2411,7 +2411,7 @@ _0816E156: adds r0, r1 ldr r1, =task_intro_19 str r1, [r0] - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0816E176: @@ -2623,7 +2623,7 @@ task_intro_19: @ 816E2A0 movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave add sp, 0xC pop {r4} pop {r0} @@ -3038,7 +3038,7 @@ _0816E69C: adds r0, r1 ldr r1, =task_intro_21 str r1, [r0] - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] _0816E6BC: diff --git a/asm/item_menu.s b/asm/item_menu.s index 1d79852fe..591b91775 100644 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -6043,7 +6043,7 @@ bag_menu_print: @ 81AE0BC str r4, [sp, 0xC] str r2, [sp, 0x10] mov r2, r9 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x14 pop {r3,r4} mov r8, r3 diff --git a/asm/item_use.s b/asm/item_use.s deleted file mode 100644 index 0d9f30ec3..000000000 --- a/asm/item_use.s +++ /dev/null @@ -1,2863 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start SetUpItemUseCallback -@ void SetUpItemUseCallback(u8 taskId) -SetUpItemUseCallback: @ 80FD060 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gSpecialVar_ItemId - ldrh r0, [r1] - cmp r0, 0xAF - bne _080FD084 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrb r0, [r1, 0x10] - b _080FD08A - .pool -_080FD084: - ldrh r0, [r1] - bl ItemId_GetType -_080FD08A: - subs r0, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FD0B8 - ldr r0, =gUnknown_0203CE54 - ldr r2, [r0] - ldr r1, =gUnknown_085920D8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - adds r0, r5, 0 - bl unknown_ItemMenu_Confirm - b _080FD0CC - .pool -_080FD0B8: - ldr r0, =gUnknown_0203CF2C - ldr r2, [r0] - ldr r1, =gUnknown_085920D8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - adds r0, r5, 0 - bl sub_81C5B14 -_080FD0CC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetUpItemUseCallback - - thumb_func_start SetUpItemUseOnFieldCallback -@ void SetUpItemUseOnFieldCallback() -SetUpItemUseOnFieldCallback: @ 80FD0DC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _080FD110 - ldr r1, =gFieldCallback - ldr r0, =MapPostLoadHook_UseItem - str r0, [r1] - adds r0, r2, 0 - bl SetUpItemUseCallback - b _080FD11A - .pool -_080FD110: - ldr r0, =gUnknown_0203A0F4 - ldr r1, [r0] - adds r0, r2, 0 - bl _call_via_r1 -_080FD11A: - pop {r0} - bx r0 - .pool - thumb_func_end SetUpItemUseOnFieldCallback - - thumb_func_start MapPostLoadHook_UseItem -@ void MapPostLoadHook_UseItem() -MapPostLoadHook_UseItem: @ 80FD124 - push {lr} - bl pal_fill_black - ldr r0, =Task_CallItemUseOnFieldCallback - movs r1, 0x8 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end MapPostLoadHook_UseItem - - thumb_func_start Task_CallItemUseOnFieldCallback -@ void Task_CallItemUseOnFieldCallback(u8 taskId) -Task_CallItemUseOnFieldCallback: @ 80FD13C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD158 - ldr r0, =gUnknown_0203A0F4 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 -_080FD158: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end Task_CallItemUseOnFieldCallback - - thumb_func_start DisplayCannotUseItemMessage -@ void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField, u8 *str) -DisplayCannotUseItemMessage: @ 80FD164 - push {r4-r6,lr} - adds r4, r1, 0 - adds r1, r2, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gStringVar4 - adds r0, r6, 0 - bl StringExpandPlaceholders - cmp r4, 0 - bne _080FD1B4 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FD1A0 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl DisplayItemMessage - b _080FD1BE - .pool -_080FD1A0: - ldr r1, =gText_DadsAdvice - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid - b _080FD1BE - .pool -_080FD1B4: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r6, 0 - bl DisplayItemMessageOnField -_080FD1BE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end DisplayCannotUseItemMessage - - thumb_func_start DisplayDadsAdviceCannotUseItemMessage -@ void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) -DisplayDadsAdviceCannotUseItemMessage: @ 80FD1C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gText_DadsAdvice - bl DisplayCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end DisplayDadsAdviceCannotUseItemMessage - - thumb_func_start DisplayCannotDismountBikeMessage -@ void DisplayCannotDismountBikeMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) -DisplayCannotDismountBikeMessage: @ 80FD1E0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gText_CantDismountBike - bl DisplayCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end DisplayCannotDismountBikeMessage - - thumb_func_start CleanUpAfterFailingToUseRegisteredKeyItemOnField -@ void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId) -CleanUpAfterFailingToUseRegisteredKeyItemOnField: @ 80FD1F8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - adds r0, r4, 0 - bl DestroyTask - bl sub_80984F4 - bl ScriptContext2_Disable - pop {r4} - pop {r0} - bx r0 - thumb_func_end CleanUpAfterFailingToUseRegisteredKeyItemOnField - - thumb_func_start CheckIfItemIsTMHMOrEvolutionStone -@ u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId) -CheckIfItemIsTMHMOrEvolutionStone: @ 80FD21C - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl ItemId_GetFieldFunc - ldr r1, =ItemUseOutOfBattle_TMHM - cmp r0, r1 - bne _080FD238 - movs r0, 0x1 - b _080FD24E - .pool -_080FD238: - adds r0, r4, 0 - bl ItemId_GetFieldFunc - ldr r1, =ItemUseOutOfBattle_EvolutionStone - cmp r0, r1 - beq _080FD24C - movs r0, 0 - b _080FD24E - .pool -_080FD24C: - movs r0, 0x2 -_080FD24E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end CheckIfItemIsTMHMOrEvolutionStone - - thumb_func_start sub_80FD254 -sub_80FD254: @ 80FD254 - push {lr} - sub sp, 0x24 - mov r1, sp - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - strh r0, [r1, 0x20] - ldr r1, =bag_menu_mail_related - mov r0, sp - movs r2, 0 - bl ReadMail - add sp, 0x24 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FD254 - - thumb_func_start ItemUseOutOfBattle_Mail -@ void ItemUseOutOfBattle_Mail(int taskId) -ItemUseOutOfBattle_Mail: @ 80FD278 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CE54 - ldr r2, [r1] - ldr r1, =sub_80FD254 - str r1, [r2] - bl unknown_ItemMenu_Confirm - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Mail - - thumb_func_start ItemUseOutOfBattle_Bike -@ void ItemUseOutOfBattle_Bike(int taskId) -ItemUseOutOfBattle_Bike: @ 80FD298 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =0x0000088b - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsVerticalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsHorizontalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsIsolatedVerticalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD30E - adds r0, r4, 0 - bl MetatileBehavior_IsIsolatedHorizontalRail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD320 -_080FD30E: - ldrb r1, [r6, 0x6] - adds r0, r5, 0 - bl DisplayCannotDismountBikeMessage - b _080FD350 - .pool -_080FD320: - bl sav1_map_is_biking_allowed - cmp r0, 0x1 - bne _080FD348 - bl IsBikingDisallowedByPlayer - lsls r0, 24 - cmp r0, 0 - bne _080FD348 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Bike - str r0, [r1] - adds r0, r5, 0 - bl SetUpItemUseOnFieldCallback - b _080FD350 - .pool -_080FD348: - ldrb r1, [r6, 0x6] - adds r0, r5, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FD350: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end ItemUseOutOfBattle_Bike - - thumb_func_start ItemUseOnFieldCB_Bike -ItemUseOnFieldCB_Bike: @ 80FD358 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetSecondaryId - lsls r0, 24 - cmp r0, 0 - bne _080FD378 - movs r0, 0x2 - bl GetOnOffBike - b _080FD37E - .pool -_080FD378: - movs r0, 0x4 - bl GetOnOffBike -_080FD37E: - bl sub_80984F4 - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end ItemUseOnFieldCB_Bike - - thumb_func_start CanFish -@ bool8 CanFish() -CanFish: @ 80FD394 - push {r4-r6,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 16 - lsrs r6, r0, 16 - lsls r0, r6, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl MetatileBehavior_IsWaterfall - lsls r0, 24 - cmp r0, 0 - bne _080FD41C - movs r0, 0x10 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _080FD41C - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _080FD3EC - bl IsPlayerFacingSurfableFishableWater - lsls r0, 24 - cmp r0, 0 - beq _080FD41C -_080FD3E8: - movs r0, 0x1 - b _080FD41E -_080FD3EC: - adds r0, r5, 0 - bl MetatileBehavior_IsSurfableWaterOrUnderwater - lsls r0, 24 - cmp r0, 0 - beq _080FD40C - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridIsImpassableAt - lsls r0, 24 - cmp r0, 0 - beq _080FD3E8 -_080FD40C: - lsls r0, r6, 24 - lsrs r0, 24 - bl MetatileBehavior_8089510 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FD3E8 -_080FD41C: - movs r0, 0 -_080FD41E: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end CanFish - - thumb_func_start ItemUseOutOfBattle_Rod -ItemUseOutOfBattle_Rod: @ 80FD428 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl CanFish - cmp r0, 0x1 - bne _080FD44C - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Rod - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FD45E - .pool -_080FD44C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FD45E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Rod - - thumb_func_start ItemUseOnFieldCB_Rod -ItemUseOnFieldCB_Rod: @ 80FD468 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetSecondaryId - lsls r0, 24 - lsrs r0, 24 - bl StartFishing - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOnFieldCB_Rod - - thumb_func_start ItemUseOutOfBattle_Itemfinder -ItemUseOutOfBattle_Itemfinder: @ 80FD490 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x27 - bl IncrementGameStat - ldr r1, =gUnknown_0203A0F4 - ldr r0, =ItemUseOnFieldCB_Itemfinder - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Itemfinder - - thumb_func_start ItemUseOnFieldCB_Itemfinder -ItemUseOnFieldCB_Itemfinder: @ 80FD4B8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMapHeader - ldr r0, [r0, 0x4] - adds r1, r4, 0 - bl ItemfinderCheckForHiddenItems - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD4EC - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FD504 - str r0, [r1] - b _080FD4F6 - .pool -_080FD4EC: - ldr r1, =gText_ItemFinderNothing - ldr r2, =sub_80FD5CC - adds r0, r4, 0 - bl DisplayItemMessageOnField -_080FD4F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOnFieldCB_Itemfinder - - thumb_func_start sub_80FD504 -sub_80FD504: @ 80FD504 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r6, r5, 2 - adds r0, r6, r5 - lsls r7, r0, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r4, r7, r0 - movs r1, 0x6 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FD5B8 - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x4 - bne _080FD5AC - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x2 - ldrsh r1, [r4, r2] - bl sub_80FD9B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080FD564 - ldr r1, =gUnknown_085920E4 - subs r0, 0x1 - adds r0, r1 - ldrb r0, [r0] - bl sub_80FDA24 - mov r0, r8 - subs r0, 0x8 - adds r0, r7, r0 - ldr r1, =sub_80FDA94 - str r1, [r0] - b _080FD5C2 - .pool -_080FD564: - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - adds r3, r6, 0 - ldr r7, =gUnknown_085920E4 - movs r6, 0x3 -_080FD574: - adds r0, r1, r7 - adds r1, 0x1 - ldrb r0, [r0] - cmp r2, r0 - bne _080FD584 - adds r0, r1, 0 - ands r0, r6 - strh r0, [r4, 0xA] -_080FD584: - lsls r0, r1, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _080FD574 - ldr r1, =gTasks - adds r0, r3, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80FDADC - str r1, [r0] - movs r0, 0 - strh r0, [r4, 0x6] - strh r0, [r4, 0x4] - b _080FD5C2 - .pool -_080FD5AC: - movs r0, 0x48 - bl PlaySE - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080FD5B8: - ldrh r0, [r4, 0x6] - adds r0, 0x1 - movs r1, 0x1F - ands r0, r1 - strh r0, [r4, 0x6] -_080FD5C2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80FD504 - - thumb_func_start sub_80FD5CC -sub_80FD5CC: @ 80FD5CC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - bl sub_80984F4 - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FD5CC - - thumb_func_start ItemfinderCheckForHiddenItems -@ bool8 ItemfinderCheckForHiddenItems(struct map_events *events, u8 taskId) -ItemfinderCheckForHiddenItems: @ 80FD5F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r5, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xC] - movs r3, 0 - mov r9, r4 - ldrb r0, [r5, 0x3] - cmp r3, r0 - bge _080FD6A4 - subs r1, 0x5 - mov r8, r1 -_080FD628: - lsls r3, 16 - asrs r1, r3, 16 - ldr r2, [r5, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r4, r0, 2 - adds r1, r4, r2 - ldrb r0, [r1, 0x5] - adds r7, r3, 0 - cmp r0, 0x7 - bne _080FD694 - movs r2, 0xFA - lsls r2, 1 - adds r0, r2, 0 - ldrh r1, [r1, 0xA] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080FD694 - ldr r1, [r5, 0x10] - adds r1, r4, r1 - ldrh r2, [r1] - adds r2, 0x7 - mov r0, sp - ldrh r0, [r0] - subs r2, r0 - ldrh r0, [r1, 0x2] - adds r0, 0x7 - mov r3, r9 - ldrh r1, [r3] - subs r0, r1 - lsls r0, 16 - lsrs r0, 16 - lsls r2, 16 - asrs r1, r2, 16 - movs r3, 0xE0 - lsls r3, 11 - adds r2, r3 - lsrs r2, 16 - cmp r2, 0xE - bhi _080FD694 - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, r8 - blt _080FD694 - cmp r2, 0x5 - bgt _080FD694 - adds r0, r6, 0 - bl sub_80FD8E0 -_080FD694: - movs r1, 0x80 - lsls r1, 9 - adds r0, r7, r1 - lsrs r3, r0, 16 - asrs r0, 16 - ldrb r2, [r5, 0x3] - cmp r0, r2 - blt _080FD628 -_080FD6A4: - adds r0, r6, 0 - bl sub_80FD7C8 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r3, 0xC - ldrsh r0, [r1, r3] - cmp r0, 0x1 - beq _080FD6C4 - movs r0, 0 - b _080FD6C6 - .pool -_080FD6C4: - movs r0, 0x1 -_080FD6C6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end ItemfinderCheckForHiddenItems - - thumb_func_start sub_80FD6D4 -sub_80FD6D4: @ 80FD6D4 - push {r4-r6,lr} - lsls r1, 16 - lsrs r3, r1, 16 - lsls r2, 16 - lsrs r4, r2, 16 - ldrb r2, [r0, 0x3] - ldr r5, [r0, 0x10] - movs r1, 0 - cmp r1, r2 - bge _080FD728 - lsls r0, r3, 16 - asrs r6, r0, 16 - lsls r0, r4, 16 - asrs r4, r0, 16 - adds r3, r5, 0 -_080FD6F2: - ldrb r0, [r3, 0x5] - cmp r0, 0x7 - bne _080FD720 - ldrh r0, [r3] - cmp r6, r0 - bne _080FD720 - ldrh r0, [r3, 0x2] - cmp r4, r0 - bne _080FD720 - movs r1, 0xFA - lsls r1, 1 - adds r0, r1, 0 - ldrh r3, [r3, 0xA] - adds r0, r3 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080FD728 - movs r0, 0x1 - b _080FD72A -_080FD720: - adds r3, 0xC - adds r1, 0x1 - cmp r1, r2 - blt _080FD6F2 -_080FD728: - movs r0, 0 -_080FD72A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80FD6D4 - - thumb_func_start sub_80FD730 -sub_80FD730: @ 80FD730 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - bl mapconnection_get_mapheader - adds r3, r0, 0 - ldrb r0, [r4] - cmp r0, 0x2 - beq _080FD758 - cmp r0, 0x2 - bgt _080FD74E - cmp r0, 0x1 - beq _080FD76C - b _080FD7AC -_080FD74E: - cmp r0, 0x3 - beq _080FD784 - cmp r0, 0x4 - beq _080FD78E - b _080FD7AC -_080FD758: - ldr r0, [r4, 0x4] - adds r0, 0x7 - subs r0, r5, r0 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, [r3] - ldr r0, [r0, 0x4] - subs r0, 0x7 - adds r0, r6 - b _080FD7A2 -_080FD76C: - ldr r0, [r4, 0x4] - adds r0, 0x7 - subs r0, r5, r0 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0, 0x4] - b _080FD79E - .pool -_080FD784: - ldr r0, [r3] - ldr r0, [r0] - subs r0, 0x7 - adds r0, r5 - b _080FD798 -_080FD78E: - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x7 - subs r0, r5, r0 -_080FD798: - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, [r4, 0x4] -_080FD79E: - adds r0, 0x7 - subs r0, r6, r0 -_080FD7A2: - lsls r0, 16 - lsrs r2, r0, 16 - b _080FD7B0 - .pool -_080FD7AC: - movs r0, 0 - b _080FD7C2 -_080FD7B0: - ldr r0, [r3, 0x4] - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - bl sub_80FD6D4 - lsls r0, 24 - lsrs r0, 24 -_080FD7C2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80FD730 - - thumb_func_start sub_80FD7C8 -sub_80FD7C8: @ 80FD7C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - ldr r0, =gMapHeader - ldr r1, [r0] - ldr r0, [r1] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - ldr r0, [r1, 0x4] - adds r0, 0x7 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - ldrh r0, [r0] - subs r0, 0x7 - lsls r0, 16 - lsrs r3, r0, 16 - asrs r0, 16 - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - adds r1, 0x7 - cmp r0, r1 - bgt _080FD8CC -_080FD816: - mov r5, sp - ldrh r0, [r5, 0x2] - subs r0, 0x5 - lsls r0, 16 - lsrs r4, r0, 16 - lsls r2, r4, 16 - asrs r1, r2, 16 - movs r6, 0x2 - ldrsh r0, [r5, r6] - adds r0, 0x5 - lsls r3, 16 - mov r8, r3 - cmp r1, r0 - bgt _080FD8B6 - movs r0, 0x7 - str r0, [sp, 0x10] - mov r1, r8 - asrs r1, 16 - mov r9, r1 - mov r10, r0 -_080FD83E: - ldr r3, [sp, 0x10] - cmp r3, r9 - bgt _080FD860 - ldr r5, [sp, 0x8] - lsls r0, r5, 16 - asrs r0, 16 - cmp r9, r0 - bge _080FD860 - asrs r1, r2, 16 - cmp r10, r1 - bgt _080FD860 - ldr r6, [sp, 0xC] - lsls r0, r6, 16 - asrs r0, 16 - lsls r7, r4, 16 - cmp r1, r0 - blt _080FD89E -_080FD860: - mov r0, r8 - asrs r5, r0, 16 - lsls r4, 16 - asrs r6, r4, 16 - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_8088A8C - adds r7, r4, 0 - cmp r0, 0 - beq _080FD89E - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_80FD730 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FD89E - mov r0, sp - ldrh r1, [r0] - subs r1, r5, r1 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r0, 0x2] - subs r2, r6, r2 - lsls r2, 16 - asrs r2, 16 - ldr r0, [sp, 0x4] - bl sub_80FD8E0 -_080FD89E: - movs r1, 0x80 - lsls r1, 9 - adds r0, r7, r1 - lsrs r4, r0, 16 - lsls r2, r4, 16 - asrs r1, r2, 16 - mov r3, sp - movs r5, 0x2 - ldrsh r0, [r3, r5] - adds r0, 0x5 - cmp r1, r0 - ble _080FD83E -_080FD8B6: - movs r1, 0x80 - lsls r1, 9 - add r1, r8 - lsrs r3, r1, 16 - asrs r1, 16 - mov r0, sp - movs r6, 0 - ldrsh r0, [r0, r6] - adds r0, 0x7 - cmp r1, r0 - ble _080FD816 -_080FD8CC: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FD7C8 - - thumb_func_start sub_80FD8E0 -sub_80FD8E0: @ 80FD8E0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - mov r12, r2 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r3, r1, r0 - movs r1, 0x4 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080FD918 - strh r7, [r3] - mov r0, r12 - strh r0, [r3, 0x2] - movs r0, 0x1 - strh r0, [r3, 0x4] - b _080FD9A2 - .pool -_080FD918: - movs r1, 0 - ldrsh r0, [r3, r1] - cmp r0, 0 - bge _080FD928 - negs r0, r0 - lsls r0, 16 - lsrs r4, r0, 16 - b _080FD92A -_080FD928: - ldrh r4, [r3] -_080FD92A: - movs r1, 0x2 - ldrsh r0, [r3, r1] - ldrh r1, [r3, 0x2] - mov r9, r1 - cmp r0, 0 - bge _080FD93E - negs r0, r0 - lsls r0, 16 - lsrs r2, r0, 16 - b _080FD940 -_080FD93E: - ldrh r2, [r3, 0x2] -_080FD940: - lsls r1, r7, 16 - asrs r0, r1, 16 - cmp r0, 0 - bge _080FD950 - negs r0, r0 - lsls r0, 16 - lsrs r6, r0, 16 - b _080FD952 -_080FD950: - lsrs r6, r1, 16 -_080FD952: - mov r1, r12 - lsls r0, r1, 16 - asrs r1, r0, 16 - mov r8, r0 - cmp r1, 0 - bge _080FD964 - negs r0, r1 - lsls r0, 16 - b _080FD966 -_080FD964: - mov r0, r8 -_080FD966: - lsrs r5, r0, 16 - lsls r0, r4, 16 - asrs r0, 16 - lsls r1, r2, 16 - asrs r2, r1, 16 - adds r4, r0, r2 - lsls r0, r6, 16 - asrs r0, 16 - lsls r1, r5, 16 - asrs r1, 16 - adds r0, r1 - cmp r4, r0 - ble _080FD988 - strh r7, [r3] - mov r1, r12 - strh r1, [r3, 0x2] - b _080FD9A2 -_080FD988: - cmp r4, r0 - bne _080FD9A2 - cmp r2, r1 - bgt _080FD99C - cmp r2, r1 - bne _080FD9A2 - mov r1, r9 - lsls r0, r1, 16 - cmp r0, r8 - bge _080FD9A2 -_080FD99C: - strh r7, [r3] - mov r0, r12 - strh r0, [r3, 0x2] -_080FD9A2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80FD8E0 - - thumb_func_start sub_80FD9B0 -sub_80FD9B0: @ 80FD9B0 - push {r4,r5,lr} - lsls r0, 16 - lsls r1, 16 - lsrs r1, 16 - lsrs r2, r0, 16 - cmp r0, 0 - bne _080FD9C2 - cmp r1, 0 - beq _080FDA1C -_080FD9C2: - lsls r0, r2, 16 - asrs r2, r0, 16 - adds r5, r0, 0 - cmp r2, 0 - bge _080FD9D4 - negs r0, r2 - lsls r0, 16 - lsrs r4, r0, 16 - b _080FD9D6 -_080FD9D4: - lsrs r4, r5, 16 -_080FD9D6: - lsls r0, r1, 16 - asrs r2, r0, 16 - adds r1, r0, 0 - cmp r2, 0 - bge _080FD9E8 - negs r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - b _080FD9EA -_080FD9E8: - lsrs r3, r1, 16 -_080FD9EA: - lsls r0, r4, 16 - asrs r2, r0, 16 - lsls r0, r3, 16 - asrs r0, 16 - cmp r2, r0 - ble _080FDA02 - cmp r5, 0 - bge _080FD9FE - movs r0, 0x4 - b _080FDA1E -_080FD9FE: - movs r0, 0x2 - b _080FDA1E -_080FDA02: - cmp r2, r0 - bge _080FDA0C - cmp r1, 0 - blt _080FDA14 - b _080FDA18 -_080FDA0C: - cmp r2, r0 - bne _080FDA1C - cmp r1, 0 - bge _080FDA18 -_080FDA14: - movs r0, 0x1 - b _080FDA1E -_080FDA18: - movs r0, 0x3 - b _080FDA1E -_080FDA1C: - movs r0, 0 -_080FDA1E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80FD9B0 - - thumb_func_start sub_80FDA24 -sub_80FDA24: @ 80FDA24 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r4, =gMapObjects - adds r0, r4 - bl FieldObjectClearAnimIfSpecialAnimFinished - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FieldObjectClearAnim - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl npc_sync_anim_pause_bits - adds r0, r5, 0 - bl PlayerTurnInPlace - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDA24 - - thumb_func_start sub_80FDA94 -sub_80FDA94: @ 80FDA94 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r0, r1 - bl FieldObjectCheckIfSpecialAnimFinishedOrInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDACA - ldr r1, =gText_ItemFinderNearby - ldr r2, =sub_80FD5CC - adds r0, r4, 0 - bl DisplayItemMessageOnField -_080FDACA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDA94 - - thumb_func_start sub_80FDADC -sub_80FDADC: @ 80FDADC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - bl GetFieldObjectIdByLocalIdAndMap - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gMapObjects - adds r0, r1 - bl FieldObjectCheckIfSpecialAnimFinishedOrInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080FDB1C - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080FDB50 -_080FDB1C: - ldr r1, =gUnknown_085920E4 - movs r2, 0xA - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r0, [r0] - bl sub_80FDA24 - movs r0, 0x1 - strh r0, [r4, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bne _080FDB50 - ldr r1, =gText_ItemFinderOnTop - ldr r2, =sub_80FD5CC - adds r0, r5, 0 - bl DisplayItemMessageOnField -_080FDB50: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDADC - - thumb_func_start ItemUseOutOfBattle_PokeblockCase -ItemUseOutOfBattle_PokeblockCase: @ 80FDB6C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDB98 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage - b _080FDBDA - .pool -_080FDB98: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r5, r1, r0 - movs r1, 0xE - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _080FDBC8 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =sub_80FDBEC - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FDBDA - .pool -_080FDBC8: - ldr r0, =gFieldCallback - ldr r1, =sub_80AF6D4 - str r1, [r0] - movs r0, 0x1 - movs r1, 0 - bl fade_screen - ldr r0, =sub_80FDC00 - str r0, [r5] -_080FDBDA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PokeblockCase - - thumb_func_start sub_80FDBEC -sub_80FDBEC: @ 80FDBEC - push {lr} - ldr r1, =bag_menu_mail_related - movs r0, 0 - bl OpenPokeblockCase - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDBEC - - thumb_func_start sub_80FDC00 -sub_80FDC00: @ 80FDC00 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080FDC24 - bl overworld_free_bg_tilemaps - ldr r1, =c2_exit_to_overworld_2_switch - movs r0, 0 - bl OpenPokeblockCase - adds r0, r4, 0 - bl DestroyTask -_080FDC24: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDC00 - - thumb_func_start ItemUseOutOfBattle_CoinCase -ItemUseOutOfBattle_CoinCase: @ 80FDC34 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gStringVar1 - bl GetCoins - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_CoinCase - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080FDC90 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _080FDC9A - .pool -_080FDC90: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_080FDC9A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_CoinCase - - thumb_func_start ItemUseOutOfBattle_PowderJar -ItemUseOutOfBattle_PowderJar: @ 80FDCA4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gStringVar1 - bl sub_80247BC - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_PowderQty - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0xE - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _080FDCFC - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage - b _080FDD06 - .pool -_080FDCFC: - ldr r2, =CleanUpAfterFailingToUseRegisteredKeyItemOnField - adds r0, r5, 0 - adds r1, r4, 0 - bl DisplayItemMessageOnField -_080FDD06: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PowderJar - - thumb_func_start sub_80FDD10 -sub_80FDD10: @ 80FDD10 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl IsPlayerFacingPlantedBerryTree - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDD58 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDD74 - str r0, [r1] - ldr r1, =gFieldCallback - ldr r0, =MapPostLoadHook_UseItem - str r0, [r1] - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =c2_exit_to_overworld_2_switch - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FDD68 - .pool -_080FDD58: - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetFieldFunc - adds r1, r0, 0 - adds r0, r4, 0 - bl _call_via_r1 -_080FDD68: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDD10 - - thumb_func_start sub_80FDD74 -sub_80FDD74: @ 80FDD74 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - bl ScriptContext2_Enable - ldr r0, =Route102_EventScript_274482 - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDD74 - - thumb_func_start ItemUseOutOfBattle_WailmerPail -ItemUseOutOfBattle_WailmerPail: @ 80FDDA4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_80FDE2C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDDC8 - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDE7C - b _080FDDD8 - .pool -_080FDDC8: - bl TryToWaterBerryTree - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FDDEC - ldr r1, =gUnknown_0203A0F4 - ldr r0, =sub_80FDE08 -_080FDDD8: - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FDDFE - .pool -_080FDDEC: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r5, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FDDFE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_WailmerPail - - thumb_func_start sub_80FDE08 -sub_80FDE08: @ 80FDE08 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - ldr r0, =Route102_EventScript_2744C0 - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDE08 - - thumb_func_start sub_80FDE2C -sub_80FDE2C: @ 80FDE2C - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - bl PlayerGetZCoord - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - mov r0, sp - ldrh r0, [r0] - ldrh r1, [r4] - bl GetFieldObjectIdByXYZ - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x10 - beq _080FDE68 - ldr r0, =gMapObjects - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x5] - cmp r0, 0xE4 - beq _080FDE70 -_080FDE68: - movs r0, 0 - b _080FDE72 - .pool -_080FDE70: - movs r0, 0x1 -_080FDE72: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80FDE2C - - thumb_func_start sub_80FDE7C -sub_80FDE7C: @ 80FDE7C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - ldr r0, =BattleFrontier_OutsideEast_EventScript_242CFC - bl ScriptContext1_SetupScript - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDE7C - - thumb_func_start ItemUseOutOfBattle_Medicine -ItemUseOutOfBattle_Medicine: @ 80FDEA0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =ItemUseCB_Medicine - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Medicine - - thumb_func_start ItemUseOutOfBattle_ReduceEV -ItemUseOutOfBattle_ReduceEV: @ 80FDEBC - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B67C8 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_ReduceEV - - thumb_func_start ItemUseOutOfBattle_SacredAsh -ItemUseOutOfBattle_SacredAsh: @ 80FDED8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B79E8 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_SacredAsh - - thumb_func_start ItemUseOutOfBattle_PPRecovery -ItemUseOutOfBattle_PPRecovery: @ 80FDEF4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_ether - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PPRecovery - - thumb_func_start ItemUseOutOfBattle_PPUp -ItemUseOutOfBattle_PPUp: @ 80FDF10 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_pp_up - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_PPUp - - thumb_func_start ItemUseOutOfBattle_RareCandy -ItemUseOutOfBattle_RareCandy: @ 80FDF2C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_rare_candy - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_RareCandy - - thumb_func_start ItemUseOutOfBattle_TMHM -ItemUseOutOfBattle_TMHM: @ 80FDF48 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r1, [r0] - movs r0, 0xA9 - lsls r0, 1 - cmp r1, r0 - bls _080FDF74 - ldr r2, =gText_BootedUpHM - ldr r3, =sub_80FDF90 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FDF80 - .pool -_080FDF74: - ldr r2, =gText_BootedUpTM - ldr r3, =sub_80FDF90 - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage -_080FDF80: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_TMHM - - thumb_func_start sub_80FDF90 -sub_80FDF90: @ 80FDF90 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - bl PlaySE - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =task08_0809AD8C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FDF90 - - thumb_func_start task08_0809AD8C -task08_0809AD8C: @ 80FDFBC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080FE000 - ldr r4, =gStringVar1 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemIdToBattleMoveId - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_TMHMContainedVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r3, =sub_80FE024 - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl DisplayItemMessage -_080FE000: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task08_0809AD8C - - thumb_func_start sub_80FE024 -sub_80FE024: @ 80FE024 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_085920E8 - movs r1, 0x6 - bl bag_menu_yes_no - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE024 - - thumb_func_start sub_80FE03C -sub_80FE03C: @ 80FE03C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B6DC4 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE03C - - thumb_func_start sub_80FE058 -sub_80FE058: @ 80FE058 - push {r4,lr} - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - ldrh r0, [r4] - ldr r1, =gStringVar2 - bl CopyItemName - ldr r0, =gStringVar4 - ldr r1, =gText_PlayerUsedVar2 - bl StringExpandPlaceholders - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE0AC - ldrh r0, [r4] - bl ItemId_GetPocket - lsls r0, 24 - lsrs r0, 24 - bl sub_81AB9A8 - ldrh r0, [r4] - bl ItemId_GetPocket - lsls r0, 24 - lsrs r0, 24 - bl sub_81ABA88 - b _080FE0B4 - .pool -_080FE0AC: - bl sub_81C5924 - bl sub_81C59BC -_080FE0B4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FE058 - - thumb_func_start ItemUseOutOfBattle_Repel -ItemUseOutOfBattle_Repel: @ 80FE0BC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =0x00004021 - bl VarGet - lsls r0, 16 - cmp r0, 0 - bne _080FE0EC - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FE124 - str r0, [r1] - b _080FE116 - .pool -_080FE0EC: - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE10C - ldr r2, =gText_RepelEffectsLingered - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE116 - .pool -_080FE10C: - ldr r1, =gText_RepelEffectsLingered - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE116: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_Repel - - thumb_func_start sub_80FE124 -sub_80FE124: @ 80FE124 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r5, =gTasks + 0x8 - adds r1, r4, r5 - ldrh r0, [r1, 0x10] - adds r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE156 - movs r0, 0 - strh r0, [r1, 0x10] - movs r0, 0x2F - bl PlaySE - adds r0, r5, 0 - subs r0, 0x8 - adds r0, r4, r0 - ldr r1, =sub_80FE164 - str r1, [r0] -_080FE156: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE124 - - thumb_func_start sub_80FE164 -sub_80FE164: @ 80FE164 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _080FE1C2 - ldr r4, =0x00004021 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl ItemId_GetHoldEffectParam - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl VarSet - bl sub_80FE058 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE1B8 - ldr r2, =gStringVar4 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r5, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE1C2 - .pool -_080FE1B8: - ldr r1, =gStringVar4 - ldr r2, =sub_81C6714 - adds r0, r6, 0 - bl DisplayItemMessageInBattlePyramid -_080FE1C2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE164 - - thumb_func_start sub_80FE1D0 -sub_80FE1D0: @ 80FE1D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE226 - movs r0, 0x75 - bl PlaySE - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE21C - ldr r2, =gStringVar4 - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE226 - .pool -_080FE21C: - ldr r1, =gStringVar4 - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE226: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE1D0 - - thumb_func_start ItemUseOutOfBattle_BlackWhiteFlute -ItemUseOutOfBattle_BlackWhiteFlute: @ 80FE234 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - ldr r1, =gStringVar2 - bl CopyItemName - ldrh r0, [r4] - cmp r0, 0x2B - bne _080FE278 - ldr r0, =0x000008ad - bl FlagSet - ldr r0, =0x000008ae - bl FlagClear - ldr r0, =gStringVar4 - ldr r1, =gText_UsedVar2WildLured - bl StringExpandPlaceholders - b _080FE28C - .pool -_080FE278: - ldr r0, =0x000008ae - bl FlagSet - ldr r0, =0x000008ad - bl FlagClear - ldr r0, =gStringVar4 - ldr r1, =gText_UsedVar2WildRepelled - bl StringExpandPlaceholders -_080FE28C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x18] - ldr r1, =sub_80FE1D0 - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_BlackWhiteFlute - - thumb_func_start task08_080A1C44 -task08_080A1C44: @ 80FE2BC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl player_avatar_init_params_reset - bl sub_80B7CC8 - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end task08_080A1C44 - - thumb_func_start re_escape_rope -re_escape_rope: @ 80FE2D8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl flagmods_08054D70 - bl sub_80FE058 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x8] - ldr r1, =gStringVar4 - ldr r2, =task08_080A1C44 - adds r0, r4, 0 - bl DisplayItemMessageOnField - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end re_escape_rope - - thumb_func_start sub_80FE314 -sub_80FE314: @ 80FE314 - push {lr} - ldr r0, =gMapHeader - ldrb r1, [r0, 0x1A] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _080FE32C - movs r0, 0 - b _080FE32E - .pool -_080FE32C: - movs r0, 0x1 -_080FE32E: - pop {r1} - bx r1 - thumb_func_end sub_80FE314 - - thumb_func_start ItemUseOutOfBattle_EscapeRope -ItemUseOutOfBattle_EscapeRope: @ 80FE334 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80FE314 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FE35C - ldr r1, =gUnknown_0203A0F4 - ldr r0, =re_escape_rope - str r0, [r1] - adds r0, r4, 0 - bl SetUpItemUseOnFieldCallback - b _080FE36E - .pool -_080FE35C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FE36E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EscapeRope - - thumb_func_start ItemUseOutOfBattle_EvolutionStone -ItemUseOutOfBattle_EvolutionStone: @ 80FE378 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B7C74 - str r1, [r2] - bl SetUpItemUseCallback - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EvolutionStone - - thumb_func_start ItemUseInBattle_PokeBall -ItemUseInBattle_PokeBall: @ 80FE394 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl IsPlayerPartyAndPokemonStorageFull - lsls r0, 24 - cmp r0, 0 - bne _080FE3D0 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE3C8 - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE3FA - .pool -_080FE3C8: - adds r0, r4, 0 - bl sub_81C5B14 - b _080FE3FA -_080FE3D0: - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE3F0 - ldr r2, =gText_BoxFull - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE3FA - .pool -_080FE3F0: - ldr r1, =gText_BoxFull - ldr r2, =sub_81C6714 - adds r0, r5, 0 - bl DisplayItemMessageInBattlePyramid -_080FE3FA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_PokeBall - - thumb_func_start sub_80FE408 -sub_80FE408: @ 80FE408 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080FE43A - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE434 - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE43A - .pool -_080FE434: - adds r0, r5, 0 - bl sub_81C5B14 -_080FE43A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80FE408 - - thumb_func_start sub_80FE440 -sub_80FE440: @ 80FE440 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080FE4AC - movs r0, 0x1 - bl PlaySE - ldr r4, =gSpecialVar_ItemId - ldrh r0, [r4] - movs r1, 0x1 - bl RemoveBagItem - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE49C - ldrh r0, [r4] - bl sub_806CF78 - adds r2, r0, 0 - ldr r3, =sub_80FE408 - adds r0, r5, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE4AC - .pool -_080FE49C: - ldrh r0, [r4] - bl sub_806CF78 - adds r1, r0, 0 - ldr r2, =sub_80FE408 - adds r0, r6, 0 - bl DisplayItemMessageInBattlePyramid -_080FE4AC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE440 - - thumb_func_start ItemUseInBattle_StatIncrease -ItemUseInBattle_StatIncrease: @ 80FE4B8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gBattlePartyID - ldr r0, =gBankInMenu - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - lsls r2, 24 - lsrs r2, 24 - movs r3, 0 - bl ExecuteTableBasedItemEffect_ - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080FE52C - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE518 - ldr r2, =gText_WontHaveEffect - ldr r3, =bag_menu_inits_lists_menu - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE53C - .pool -_080FE518: - ldr r1, =gText_WontHaveEffect - ldr r2, =sub_81C6714 - adds r0, r4, 0 - bl DisplayItemMessageInBattlePyramid - b _080FE53C - .pool -_080FE52C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80FE440 - str r0, [r1] - strh r2, [r1, 0x18] -_080FE53C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_StatIncrease - - thumb_func_start sub_80FE54C -sub_80FE54C: @ 80FE54C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE574 - ldr r0, =gUnknown_0203CE54 - ldr r1, [r0] - ldr r0, =sub_81B89F0 - str r0, [r1] - adds r0, r4, 0 - bl unknown_ItemMenu_Confirm - b _080FE582 - .pool -_080FE574: - ldr r0, =gUnknown_0203CF2C - ldr r1, [r0] - ldr r0, =sub_81B89F0 - str r0, [r1] - adds r0, r4, 0 - bl sub_81C5B14 -_080FE582: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE54C - - thumb_func_start ItemUseInBattle_Medicine -ItemUseInBattle_Medicine: @ 80FE590 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =ItemUseCB_Medicine - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_Medicine - - thumb_func_start sub_80FE5AC -sub_80FE5AC: @ 80FE5AC - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =sub_81B79E8 - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FE5AC - - thumb_func_start ItemUseInBattle_PPRecovery -ItemUseInBattle_PPRecovery: @ 80FE5C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gUnknown_03006328 - ldr r1, =dp05_ether - str r1, [r2] - bl sub_80FE54C - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_PPRecovery - - thumb_func_start ItemUseInBattle_Escape -ItemUseInBattle_Escape: @ 80FE5E4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x8 - ands r0, r1 - cmp r0, 0 - bne _080FE634 - bl sub_80FE058 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080FE620 - ldr r2, =gStringVar4 - ldr r3, =unknown_ItemMenu_Confirm - adds r0, r4, 0 - movs r1, 0x1 - bl DisplayItemMessage - b _080FE646 - .pool -_080FE620: - ldr r1, =gStringVar4 - ldr r2, =sub_81C5B14 - adds r0, r4, 0 - bl DisplayItemMessageInBattlePyramid - b _080FE646 - .pool -_080FE634: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrb r1, [r1, 0xE] - adds r0, r4, 0 - bl DisplayDadsAdviceCannotUseItemMessage -_080FE646: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseInBattle_Escape - - thumb_func_start ItemUseOutOfBattle_EnigmaBerry -ItemUseOutOfBattle_EnigmaBerry: @ 80FE650 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x14 - bls _080FE66A - b _080FE75C -_080FE66A: - lsls r0, 2 - ldr r1, =_080FE67C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FE67C: - .4byte _080FE708 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE75C - .4byte _080FE75C - .4byte _080FE6EC - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE6D0 - .4byte _080FE75C - .4byte _080FE724 - .4byte _080FE724 - .4byte _080FE740 -_080FE6D0: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_Medicine - b _080FE770 - .pool -_080FE6EC: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_SacredAsh - b _080FE770 - .pool -_080FE708: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_RareCandy - b _080FE770 - .pool -_080FE724: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_PPUp - b _080FE770 - .pool -_080FE740: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_PPRecovery - b _080FE770 - .pool -_080FE75C: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x4 - strh r0, [r1, 0x10] - adds r0, r4, 0 - bl ItemUseOutOfBattle_CannotUse -_080FE770: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_EnigmaBerry - - thumb_func_start ItemUseInBattle_EnigmaBerry -ItemUseInBattle_EnigmaBerry: @ 80FE77C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - bl GetItemEffectType - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x15 - bhi _080FE814 - lsls r0, 2 - ldr r1, =_080FE7A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FE7A4: - .4byte _080FE7FC - .4byte _080FE814 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE804 - .4byte _080FE814 - .4byte _080FE804 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE814 - .4byte _080FE80C -_080FE7FC: - adds r0, r4, 0 - bl ItemUseInBattle_StatIncrease - b _080FE81A -_080FE804: - adds r0, r4, 0 - bl ItemUseInBattle_Medicine - b _080FE81A -_080FE80C: - adds r0, r4, 0 - bl ItemUseInBattle_PPRecovery - b _080FE81A -_080FE814: - adds r0, r4, 0 - bl ItemUseOutOfBattle_CannotUse -_080FE81A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end ItemUseInBattle_EnigmaBerry - - thumb_func_start ItemUseOutOfBattle_CannotUse -ItemUseOutOfBattle_CannotUse: @ 80FE820 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r1, [r1, 0xE] - bl DisplayDadsAdviceCannotUseItemMessage - pop {r0} - bx r0 - .pool - thumb_func_end ItemUseOutOfBattle_CannotUse - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/list_menu.s b/asm/list_menu.s index 7fa0a8dd2..58719093c 100644 --- a/asm/list_menu.s +++ b/asm/list_menu.s @@ -773,7 +773,7 @@ ListMenuPrint: @ 81AE9B4 str r6, [sp, 0x10] adds r2, r7, 0 mov r3, r12 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 ldrb r1, [r5, 0x3] movs r0, 0x7F ands r0, r1 @@ -810,7 +810,7 @@ _081AEA20: str r6, [sp, 0x10] adds r2, r7, 0 mov r3, r12 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 _081AEA5E: add sp, 0x18 pop {r4-r7} diff --git a/asm/main_menu.s b/asm/main_menu.s index 9d6cba40f..08e0c3103 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -1495,7 +1495,7 @@ _08030478: b _0803048A .pool _08030480: - ldr r0, =sub_8178974 + ldr r0, =CB2_InitMysteryEventMenu b _0803048A .pool _08030488: diff --git a/asm/map_obj_8097404.s b/asm/map_obj_8097404.s deleted file mode 100644 index 4a6ae9945..000000000 --- a/asm/map_obj_8097404.s +++ /dev/null @@ -1,1861 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8097404 -@ bool8 sub_8097404(struct npc_state *fieldObject) -sub_8097404: @ 8097404 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r1, [r5] - movs r0, 0xA0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - bne _0809748C - ldrb r0, [r5, 0x1] - movs r4, 0x1 - orrs r0, r4 - strb r0, [r5, 0x1] - ldr r3, =gSprites - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x2C - ldrb r1, [r0] - lsls r1, 25 - lsrs r1, 31 - lsls r1, 7 - ldrb r2, [r5, 0x2] - movs r0, 0x7F - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x2] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x2C - ldrb r1, [r0] - lsrs r1, 7 - ands r1, r4 - ldrb r2, [r5, 0x3] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r5, 0x3] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - movs r0, 0 - b _0809748E - .pool -_0809748C: - movs r0, 0x1 -_0809748E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8097404 - - thumb_func_start FreezeMapObjects -@ void FreezeMapObjects() -FreezeMapObjects: @ 8097494 - push {r4,r5,lr} - movs r4, 0 - ldr r5, =gMapObjects -_0809749A: - lsls r0, r4, 3 - adds r0, r4 - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1] - lsls r0, 31 - cmp r0, 0 - beq _080974B8 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - cmp r4, r0 - beq _080974B8 - adds r0, r1, 0 - bl sub_8097404 -_080974B8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0809749A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end FreezeMapObjects - - thumb_func_start sub_80974D0 -sub_80974D0: @ 80974D0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r6, =gMapObjects -_080974DA: - cmp r4, r5 - beq _080974FC - lsls r0, r4, 3 - adds r0, r4 - lsls r0, 2 - adds r1, r0, r6 - ldrb r0, [r1] - lsls r0, 31 - cmp r0, 0 - beq _080974FC - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - cmp r4, r0 - beq _080974FC - adds r0, r1, 0 - bl sub_8097404 -_080974FC: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _080974DA - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80974D0 - - thumb_func_start npc_sync_anim_pause_bits -@ void npc_sync_anim_pause_bits(struct npc_state *fieldObject) -npc_sync_anim_pause_bits: @ 8097514 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r2, [r5] - ldr r1, =0x00000101 - adds r0, r1, 0 - ands r0, r2 - cmp r0, r1 - bne _0809756C - ldrb r1, [r5, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r5, 0x1] - ldr r4, =gSprites - ldrb r0, [r5, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r2, [r5, 0x2] - adds r1, 0x2C - lsrs r2, 7 - lsls r2, 6 - ldrb r3, [r1] - movs r0, 0x41 - negs r0, r0 - ands r0, r3 - orrs r0, r2 - strb r0, [r1] - ldrb r0, [r5, 0x4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r4 - ldrb r1, [r5, 0x3] - lsls r1, 31 - lsrs r1, 31 - adds r2, 0x2C - lsls r1, 7 - ldrb r3, [r2] - movs r0, 0x7F - ands r0, r3 - orrs r0, r1 - strb r0, [r2] -_0809756C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end npc_sync_anim_pause_bits - - thumb_func_start UnfreezeMapObjects -UnfreezeMapObjects: @ 809757C - push {r4,r5,lr} - movs r4, 0 - ldr r5, =gMapObjects -_08097582: - lsls r0, r4, 3 - adds r0, r4 - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1] - lsls r0, 31 - cmp r0, 0 - beq _08097598 - adds r0, r1, 0 - bl npc_sync_anim_pause_bits -_08097598: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _08097582 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UnfreezeMapObjects - - thumb_func_start little_step -@ void little_step(struct obj *object, u8 direction) -little_step: @ 80975AC - lsls r1, 24 - ldr r2, =gUnknown_0850DB7C - lsrs r1, 22 - adds r1, r2 - ldrh r2, [r1] - ldrh r3, [r0, 0x20] - adds r2, r3 - strh r2, [r0, 0x20] - ldrh r1, [r1, 0x2] - ldrh r2, [r0, 0x22] - adds r1, r2 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end little_step - - thumb_func_start double_little_steps -double_little_steps: @ 80975CC - lsls r1, 24 - ldr r2, =gUnknown_0850DB7C - lsrs r1, 22 - adds r1, r2 - ldrh r2, [r1] - lsls r2, 1 - ldrh r3, [r0, 0x20] - adds r2, r3 - strh r2, [r0, 0x20] - ldrh r1, [r1, 0x2] - lsls r1, 1 - ldrh r2, [r0, 0x22] - adds r1, r2 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end double_little_steps - - thumb_func_start triple_little_steps -triple_little_steps: @ 80975F0 - lsls r1, 24 - ldr r2, =gUnknown_0850DB7C - lsrs r1, 22 - adds r1, r2 - ldrh r2, [r1] - lsls r3, r2, 1 - adds r2, r3 - ldrh r3, [r0, 0x20] - adds r2, r3 - strh r2, [r0, 0x20] - ldrh r1, [r1, 0x2] - lsls r2, r1, 1 - adds r1, r2 - ldrh r2, [r0, 0x22] - adds r1, r2 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end triple_little_steps - - thumb_func_start quad_little_steps -quad_little_steps: @ 8097618 - lsls r1, 24 - ldr r2, =gUnknown_0850DB7C - lsrs r1, 22 - adds r1, r2 - ldrh r2, [r1] - lsls r2, 2 - ldrh r3, [r0, 0x20] - adds r2, r3 - strh r2, [r0, 0x20] - ldrh r1, [r1, 0x2] - lsls r1, 2 - ldrh r2, [r0, 0x22] - adds r1, r2 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end quad_little_steps - - thumb_func_start oct_little_steps -@ void oct_little_steps(struct obj *object, u8 direction) -oct_little_steps: @ 809763C - lsls r1, 24 - ldr r2, =gUnknown_0850DB7C - lsrs r1, 22 - adds r1, r2 - ldrh r2, [r1] - lsls r2, 3 - ldrh r3, [r0, 0x20] - adds r2, r3 - strh r2, [r0, 0x20] - ldrh r1, [r1, 0x2] - lsls r1, 3 - ldrh r2, [r0, 0x22] - adds r1, r2 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end oct_little_steps - - thumb_func_start oamt_npc_ministep_reset -@ void oamt_npc_ministep_reset(struct obj *object, u8 direction, u8 speed) -oamt_npc_ministep_reset: @ 8097660 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - movs r3, 0 - strh r1, [r0, 0x34] - strh r2, [r0, 0x36] - strh r3, [r0, 0x38] - bx lr - thumb_func_end oamt_npc_ministep_reset - - thumb_func_start obj_npc_ministep -@ bool8 obj_npc_ministep(struct obj *object) -obj_npc_ministep: @ 8097674 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_0850E768 - movs r0, 0x36 - ldrsh r2, [r4, r0] - lsls r0, r2, 1 - adds r0, r5 - movs r3, 0x38 - ldrsh r1, [r4, r3] - movs r3, 0 - ldrsh r0, [r0, r3] - cmp r1, r0 - bge _080976D4 - ldr r1, =gUnknown_0850E754 - lsls r0, r2, 2 - adds r0, r1 - movs r1, 0x38 - ldrsh r2, [r4, r1] - ldr r0, [r0] - lsls r2, 2 - adds r2, r0 - ldrh r1, [r4, 0x34] - lsls r1, 24 - lsrs r1, 24 - ldr r2, [r2] - adds r0, r4, 0 - bl _call_via_r2 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r2, 0x36 - ldrsh r1, [r4, r2] - lsls r1, 1 - adds r1, r5 - lsls r0, 16 - asrs r0, 16 - movs r3, 0 - ldrsh r1, [r1, r3] - cmp r0, r1 - blt _080976D4 - movs r0, 0x1 - b _080976D6 - .pool -_080976D4: - movs r0, 0 -_080976D6: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end obj_npc_ministep - - thumb_func_start sub_80976DC -@ void sub_80976DC(struct obj *object, u8 direction) -sub_80976DC: @ 80976DC - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - strh r1, [r0, 0x34] - strh r2, [r0, 0x36] - strh r2, [r0, 0x38] - bx lr - thumb_func_end sub_80976DC - - thumb_func_start sub_80976EC -@ bool8 sub_80976EC(struct obj *object) -sub_80976EC: @ 80976EC - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x36] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0809770C - ldrh r1, [r4, 0x34] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl little_step - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_0809770C: - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0xF - bgt _0809771E - movs r0, 0 - b _08097720 -_0809771E: - movs r0, 0x1 -_08097720: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80976EC - - thumb_func_start sub_8097728 -sub_8097728: @ 8097728 - ldr r1, =gUnknown_0850E7BA - lsls r0, 16 - asrs r0, 16 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bx lr - .pool - thumb_func_end sub_8097728 - - thumb_func_start sub_809773C -sub_809773C: @ 809773C - ldr r1, =gUnknown_0850E772 - lsls r0, 16 - asrs r0, 16 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bx lr - .pool - thumb_func_end sub_809773C - - thumb_func_start sub_8097750 -sub_8097750: @ 8097750 - movs r1, 0 - strh r1, [r0, 0x3A] - strh r1, [r0, 0x3C] - bx lr - thumb_func_end sub_8097750 - - thumb_func_start sub_8097758 -sub_8097758: @ 8097758 - push {r4-r6,lr} - adds r5, r0, 0 - movs r6, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0809778E - cmp r0, 0x1 - bgt _08097770 - cmp r0, 0 - beq _0809777A - b _080977F2 -_08097770: - cmp r0, 0x2 - beq _080977B6 - cmp r0, 0x3 - beq _080977CA - b _080977F2 -_0809777A: - movs r2, 0x3A - ldrsh r0, [r5, r2] - bl sub_809773C - ldrh r1, [r5, 0x24] - adds r0, r1 - strh r0, [r5, 0x24] - movs r2, 0x3A - ldrsh r0, [r5, r2] - b _080977E8 -_0809778E: - ldrh r0, [r5, 0x3A] - movs r4, 0x47 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - bl sub_809773C - ldrh r1, [r5, 0x24] - subs r1, r0 - strh r1, [r5, 0x24] - ldrh r0, [r5, 0x3A] - subs r4, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - bl sub_8097728 - ldrh r2, [r5, 0x26] - adds r0, r2 - b _080977F0 -_080977B6: - movs r1, 0x3A - ldrsh r0, [r5, r1] - bl sub_809773C - ldrh r1, [r5, 0x24] - subs r1, r0 - strh r1, [r5, 0x24] - movs r2, 0x3A - ldrsh r0, [r5, r2] - b _080977E8 -_080977CA: - ldrh r0, [r5, 0x3A] - movs r4, 0x47 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - bl sub_809773C - ldrh r2, [r5, 0x24] - adds r0, r2 - strh r0, [r5, 0x24] - ldrh r0, [r5, 0x3A] - subs r4, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 -_080977E8: - bl sub_8097728 - ldrh r1, [r5, 0x26] - adds r0, r1 -_080977F0: - strh r0, [r5, 0x26] -_080977F2: - ldrh r0, [r5, 0x3A] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0x3A] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x48 - bne _0809780A - strh r1, [r5, 0x3A] - ldrh r0, [r5, 0x3C] - adds r0, 0x1 - strh r0, [r5, 0x3C] -_0809780A: - movs r2, 0x3C - ldrsh r0, [r5, r2] - cmp r0, 0x4 - bne _08097818 - strh r1, [r5, 0x26] - strh r1, [r5, 0x24] - movs r6, 0x1 -_08097818: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8097758 - - thumb_func_start sub_8097820 -sub_8097820: @ 8097820 - lsls r1, 24 - ldr r2, =gUnknown_0850E834 - lsrs r1, 22 - adds r1, r2 - lsls r0, 16 - asrs r0, 16 - ldr r1, [r1] - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - bx lr - .pool - thumb_func_end sub_8097820 - - thumb_func_start sub_809783C -sub_809783C: @ 809783C - push {r4,lr} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - movs r4, 0 - strh r1, [r0, 0x34] - strh r2, [r0, 0x36] - strh r3, [r0, 0x38] - strh r4, [r0, 0x3A] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_809783C - - thumb_func_start sub_809785C -sub_809785C: @ 809785C - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r1, =gUnknown_0850E840 - mov r0, sp - movs r2, 0x6 - bl memcpy - add r5, sp, 0x8 - ldr r1, =gUnknown_0850E846 - adds r0, r5, 0 - movs r2, 0x3 - bl memcpy - movs r6, 0 - movs r1, 0x36 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0809788E - ldrh r1, [r4, 0x34] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl little_step -_0809788E: - movs r2, 0x3A - ldrsh r0, [r4, r2] - movs r2, 0x36 - ldrsh r1, [r4, r2] - adds r1, r5, r1 - ldrb r1, [r1] - asrs r0, r1 - ldrh r1, [r4, 0x38] - lsls r1, 24 - lsrs r1, 24 - bl sub_8097820 - strh r0, [r4, 0x26] - ldrh r1, [r4, 0x3A] - adds r1, 0x1 - strh r1, [r4, 0x3A] - movs r2, 0x36 - ldrsh r0, [r4, r2] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - lsls r0, 16 - asrs r2, r0, 16 - lsls r1, 16 - asrs r1, 16 - asrs r0, 17 - cmp r1, r0 - bne _080978C8 - movs r6, 0x1 -_080978C8: - cmp r1, r2 - blt _080978D2 - movs r0, 0 - strh r0, [r4, 0x26] - movs r6, 0xFF -_080978D2: - adds r0, r6, 0 - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_809785C - - thumb_func_start sub_80978E4 -sub_80978E4: @ 80978E4 - push {r4-r6,lr} - sub sp, 0xC - adds r5, r0, 0 - ldr r1, =gUnknown_0850E84A - mov r0, sp - movs r2, 0x6 - bl memcpy - add r4, sp, 0x8 - ldr r1, =gUnknown_0850E850 - adds r0, r4, 0 - movs r2, 0x3 - bl memcpy - movs r6, 0 - movs r1, 0x36 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _08097920 - ldrh r1, [r5, 0x3A] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08097920 - ldrh r1, [r5, 0x34] - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl little_step -_08097920: - movs r2, 0x3A - ldrsh r0, [r5, r2] - movs r2, 0x36 - ldrsh r1, [r5, r2] - adds r1, r4, r1 - ldrb r1, [r1] - asrs r0, r1 - ldrh r1, [r5, 0x38] - lsls r1, 24 - lsrs r1, 24 - bl sub_8097820 - strh r0, [r5, 0x26] - ldrh r1, [r5, 0x3A] - adds r1, 0x1 - strh r1, [r5, 0x3A] - movs r2, 0x36 - ldrsh r0, [r5, r2] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - lsls r0, 16 - asrs r2, r0, 16 - lsls r1, 16 - asrs r1, 16 - asrs r0, 17 - cmp r1, r0 - bne _0809795A - movs r6, 0x1 -_0809795A: - cmp r1, r2 - blt _08097964 - movs r0, 0 - strh r0, [r5, 0x26] - movs r6, 0xFF -_08097964: - adds r0, r6, 0 - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80978E4 - - thumb_func_start SetFieldObjectStepTimer -@ void SetFieldObjectStepTimer(struct obj *object, u16 a2) -SetFieldObjectStepTimer: @ 8097978 - strh r1, [r0, 0x34] - bx lr - thumb_func_end SetFieldObjectStepTimer - - thumb_func_start RunFieldObjectStepTimer -@ bool8 RunFieldObjectStepTimer(struct obj *object) -RunFieldObjectStepTimer: @ 809797C - push {lr} - ldrh r1, [r0, 0x34] - subs r1, 0x1 - strh r1, [r0, 0x34] - lsls r1, 16 - cmp r1, 0 - beq _0809798E - movs r0, 0 - b _08097990 -_0809798E: - movs r0, 0x1 -_08097990: - pop {r1} - bx r1 - thumb_func_end RunFieldObjectStepTimer - - thumb_func_start obj_anim_image_set_and_seek -obj_anim_image_set_and_seek: @ 8097994 - push {r4,lr} - lsls r2, 24 - lsrs r2, 24 - adds r3, r0, 0 - adds r3, 0x2A - strb r1, [r3] - adds r4, r0, 0 - adds r4, 0x2C - ldrb r3, [r4] - movs r1, 0x41 - negs r1, r1 - ands r1, r3 - strb r1, [r4] - adds r1, r2, 0 - bl SeekSpriteAnim - pop {r4} - pop {r0} - bx r0 - thumb_func_end obj_anim_image_set_and_seek - - thumb_func_start sub_80979BC -sub_80979BC: @ 80979BC - push {lr} - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _080979CE - movs r0, 0 - b _080979D0 -_080979CE: - movs r0, 0x1 -_080979D0: - pop {r1} - bx r1 - thumb_func_end sub_80979BC - - thumb_func_start sub_80979D4 -sub_80979D4: @ 80979D4 - push {r4-r6,lr} - mov r12, r0 - lsls r1, 24 - lsrs r1, 24 - mov r3, r12 - adds r3, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r1, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08097A3C - mov r0, r12 - ldrh r1, [r0, 0x24] - ldrh r2, [r0, 0x20] - adds r1, r2 - mov r4, r12 - adds r4, 0x28 - movs r0, 0 - ldrsb r0, [r4, r0] - ldr r2, =gSpriteCoordOffsetX - adds r0, r1 - ldrh r2, [r2] - adds r0, r2 - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r12 - ldrh r1, [r0, 0x26] - ldrh r2, [r0, 0x22] - adds r1, r2 - subs r3, 0x15 - movs r0, 0 - ldrsb r0, [r3, r0] - ldr r2, =gSpriteCoordOffsetY - adds r0, r1 - ldrh r2, [r2] - adds r0, r2 - lsls r0, 16 - lsrs r5, r0, 16 - adds r2, r3, 0 - b _08097A6A - .pool -_08097A3C: - mov r0, r12 - ldrh r1, [r0, 0x24] - ldrh r2, [r0, 0x20] - adds r1, r2 - mov r3, r12 - adds r3, 0x28 - movs r0, 0 - ldrsb r0, [r3, r0] - adds r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r12 - ldrh r1, [r0, 0x26] - ldrh r2, [r0, 0x22] - adds r1, r2 - mov r2, r12 - adds r2, 0x29 - movs r0, 0 - ldrsb r0, [r2, r0] - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r4, r3, 0 -_08097A6A: - ldrb r0, [r4] - lsls r0, 24 - asrs r0, 25 - subs r0, r6, r0 - lsls r0, 16 - lsrs r3, r0, 16 - ldrb r0, [r2] - lsls r0, 24 - asrs r0, 25 - subs r0, r5, r0 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r0, r6, 16 - asrs r0, 16 - cmp r0, 0xFF - bgt _08097A96 - lsls r0, r3, 16 - asrs r0, 16 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _08097AA2 -_08097A96: - mov r4, r12 - adds r4, 0x3E - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] -_08097AA2: - lsls r0, r5, 16 - asrs r0, 16 - cmp r0, 0xAF - bgt _08097AB6 - lsls r0, r2, 16 - asrs r0, 16 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _08097AC2 -_08097AB6: - mov r0, r12 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_08097AC2: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80979D4 - - thumb_func_start sub_8097AC8 -sub_8097AC8: @ 8097AC8 - push {r4,lr} - adds r4, r0, 0 - bl sub_8097D68 - ldrh r0, [r4, 0x30] - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - movs r2, 0x1 - bl SetObjectSubpriorityByZCoord - ldrh r1, [r4, 0x32] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80979D4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8097AC8 - - thumb_func_start sub_8097AF0 -sub_8097AF0: @ 8097AF0 - push {r4,r5,lr} - movs r5, 0 - movs r4, 0x3F -_08097AF6: - ldr r0, =gSprites - adds r2, r5, r0 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08097B16 - ldr r1, [r2, 0x1C] - ldr r0, =sub_8097AC8 - cmp r1, r0 - bne _08097B16 - adds r0, r2, 0 - bl DestroySprite -_08097B16: - adds r5, 0x44 - subs r4, 0x1 - cmp r4, 0 - bge _08097AF6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097AF0 - - thumb_func_start sub_8097B2C -sub_8097B2C: @ 8097B2C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r3, 0 - ldr r6, =gSprites - movs r4, 0 -_08097B38: - adds r2, r4, r6 - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08097B68 - ldr r1, [r2, 0x1C] - ldr r0, =sub_8097AC8 - cmp r1, r0 - bne _08097B68 - ldrh r0, [r2, 0x2E] - lsls r0, 24 - lsrs r0, 24 - cmp r0, r5 - bne _08097B68 - adds r0, r3, 0 - b _08097B72 - .pool -_08097B68: - adds r4, 0x44 - adds r3, 0x1 - cmp r3, 0x3F - ble _08097B38 - movs r0, 0x40 -_08097B72: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8097B2C - - thumb_func_start sub_8097B78 -sub_8097B78: @ 8097B78 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - bl sub_8097B2C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _08097BAA - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r5, 0 - bl FieldObjectDirectionToImageAnimId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim -_08097BAA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097B78 - - thumb_func_start sub_8097BB4 -sub_8097BB4: @ 8097BB4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - bl sub_8097B2C - adds r1, r0, 0 - cmp r1, 0x40 - beq _08097C3E - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r0, r5, 0 - bl GetFieldObjectGraphicsInfo - ldrh r3, [r4, 0x4] - lsls r3, 22 - ldr r1, [r0, 0x10] - ldr r2, [r1, 0x4] - ldr r1, [r1] - str r1, [r4] - str r2, [r4, 0x4] - lsrs r3, 22 - ldrh r2, [r4, 0x4] - ldr r1, =0xfffffc00 - ands r1, r2 - orrs r1, r3 - strh r1, [r4, 0x4] - ldrb r2, [r0, 0xC] - lsls r2, 28 - lsrs r2, 24 - ldrb r3, [r4, 0x5] - movs r1, 0xF - ands r1, r3 - orrs r1, r2 - strb r1, [r4, 0x5] - ldr r1, [r0, 0x1C] - str r1, [r4, 0xC] - ldr r1, [r0, 0x14] - cmp r1, 0 - bne _08097C20 - str r1, [r4, 0x18] - adds r0, r4, 0 - adds r0, 0x42 - strb r1, [r0] - b _08097C36 - .pool -_08097C20: - adds r0, r4, 0 - bl SetSubspriteTables - adds r2, r4, 0 - adds r2, 0x42 - ldrb r0, [r2] - movs r1, 0x3F - ands r1, r0 - movs r0, 0x80 - orrs r1, r0 - strb r1, [r2] -_08097C36: - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAnim -_08097C3E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8097BB4 - - thumb_func_start sub_8097C44 -sub_8097C44: @ 8097C44 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097B2C - lsls r0, 24 - lsrs r2, r0, 24 - adds r3, r2, 0 - cmp r2, 0x40 - beq _08097C80 - cmp r4, 0 - beq _08097C74 - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x32] - b _08097C80 - .pool -_08097C74: - ldr r1, =gSprites - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r1 - strh r4, [r0, 0x32] -_08097C80: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097C44 - - thumb_func_start sub_8097C8C -sub_8097C8C: @ 8097C8C - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_8097B2C - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - bne _08097CA2 - movs r0, 0 - b _08097CBA -_08097CA2: - movs r3, 0 - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - movs r2, 0x32 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _08097CB8 - movs r3, 0x1 -_08097CB8: - adds r0, r3, 0 -_08097CBA: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8097C8C - - thumb_func_start sub_8097CC4 -sub_8097CC4: @ 8097CC4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - bl sub_8097B2C - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _08097CEA - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - movs r0, 0 - strh r4, [r1, 0x34] - strh r0, [r1, 0x36] -_08097CEA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097CC4 - - thumb_func_start sub_8097CF4 -sub_8097CF4: @ 8097CF4 - push {lr} - adds r2, r0, 0 - movs r1, 0x36 - ldrsh r0, [r2, r1] - cmp r0, 0 - beq _08097D06 - cmp r0, 0x1 - beq _08097D0E - b _08097D2C -_08097D06: - strh r0, [r2, 0x26] - ldrh r0, [r2, 0x36] - adds r0, 0x1 - strh r0, [r2, 0x36] -_08097D0E: - ldrh r0, [r2, 0x26] - subs r0, 0x8 - movs r3, 0 - strh r0, [r2, 0x26] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xA0 - negs r1, r1 - cmp r0, r1 - bne _08097D2C - strh r3, [r2, 0x26] - movs r0, 0x1 - strh r0, [r2, 0x32] - strh r3, [r2, 0x34] - strh r3, [r2, 0x36] -_08097D2C: - pop {r0} - bx r0 - thumb_func_end sub_8097CF4 - - thumb_func_start sub_8097D30 -sub_8097D30: @ 8097D30 - push {lr} - adds r1, r0, 0 - movs r2, 0x36 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _08097D42 - cmp r0, 0x1 - beq _08097D4C - b _08097D5E -_08097D42: - ldr r0, =0x0000ff60 - strh r0, [r1, 0x26] - ldrh r0, [r1, 0x36] - adds r0, 0x1 - strh r0, [r1, 0x36] -_08097D4C: - ldrh r0, [r1, 0x26] - adds r0, 0x8 - strh r0, [r1, 0x26] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _08097D5E - strh r0, [r1, 0x34] - strh r0, [r1, 0x36] -_08097D5E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097D30 - - thumb_func_start sub_8097D68 -sub_8097D68: @ 8097D68 - push {lr} - adds r1, r0, 0 - movs r2, 0x34 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - beq _08097D84 - cmp r0, 0x1 - bgt _08097D7E - cmp r0, 0 - beq _08097D98 - b _08097D94 -_08097D7E: - cmp r0, 0x2 - beq _08097D8C - b _08097D94 -_08097D84: - adds r0, r1, 0 - bl sub_8097D30 - b _08097D98 -_08097D8C: - adds r0, r1, 0 - bl sub_8097CF4 - b _08097D98 -_08097D94: - movs r0, 0 - strh r0, [r1, 0x34] -_08097D98: - pop {r0} - bx r0 - thumb_func_end sub_8097D68 - - thumb_func_start sub_8097D9C -sub_8097D9C: @ 8097D9C - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_8097B2C - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _08097DC0 - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - movs r2, 0x34 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08097DC8 -_08097DC0: - movs r0, 0 - b _08097DCA - .pool -_08097DC8: - movs r0, 0x1 -_08097DCA: - pop {r1} - bx r1 - thumb_func_end sub_8097D9C - - thumb_func_start oe_exec_and_other_stuff -oe_exec_and_other_stuff: @ 8097DD0 - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gFieldEffectArguments - adds r2, r1, 0x4 - adds r3, r1, 0 - adds r3, 0x8 - bl FieldObjectGetLocalIdAndMap - adds r0, r4, 0 - bl FieldEffectStart - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end oe_exec_and_other_stuff - - thumb_func_start DoShadowFieldEffect -DoShadowFieldEffect: @ 8097DF8 - push {lr} - adds r1, r0, 0 - ldrb r2, [r1, 0x2] - lsls r0, r2, 25 - cmp r0, 0 - blt _08097E10 - movs r0, 0x40 - orrs r0, r2 - strb r0, [r1, 0x2] - movs r0, 0x3 - bl oe_exec_and_other_stuff -_08097E10: - pop {r0} - bx r0 - thumb_func_end DoShadowFieldEffect - - thumb_func_start DoRippleFieldEffect -@ void DoRippleFieldEffect(struct npc_state *fieldObject, struct obj *object) -DoRippleFieldEffect: @ 8097E14 - push {r4,lr} - adds r4, r1, 0 - ldrb r0, [r0, 0x5] - bl GetFieldObjectGraphicsInfo - ldr r2, =gFieldEffectArguments - movs r3, 0x20 - ldrsh r1, [r4, r3] - str r1, [r2] - movs r3, 0x22 - ldrsh r1, [r4, r3] - ldrh r0, [r0, 0xA] - lsls r0, 16 - asrs r0, 17 - adds r1, r0 - subs r1, 0x2 - str r1, [r2, 0x4] - movs r0, 0x97 - str r0, [r2, 0x8] - movs r0, 0x3 - str r0, [r2, 0xC] - movs r0, 0x5 - bl FieldEffectStart - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end DoRippleFieldEffect - - thumb_func_start sub_8097E50 -sub_8097E50: @ 8097E50 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - mov r8, r1 - movs r0, 0 - mov r12, r0 - ldr r0, =gUnknown_020375B8 - ldr r1, [r0] - adds r6, r0, 0 - cmp r1, 0 - bne _08097E80 - movs r0, 0x14 - bl AllocZeroed - str r0, [r6] - ldrb r1, [r4, 0x8] - strb r1, [r0] - ldr r1, [r6] - movs r0, 0x1 - strb r0, [r1, 0x10] - b _08097ECC - .pool -_08097E80: - movs r2, 0x10 - movs r5, 0 - movs r1, 0 - adds r3, r6, 0 - b _08097E90 -_08097E8A: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 -_08097E90: - cmp r1, 0xF - bhi _08097EB2 - cmp r2, 0x10 - bne _08097EA4 - ldr r0, [r3] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08097EA4 - adds r2, r1, 0 -_08097EA4: - ldr r0, [r3] - adds r0, r1 - ldrb r0, [r0] - ldrb r7, [r4, 0x8] - cmp r0, r7 - bne _08097E8A - movs r5, 0x1 -_08097EB2: - cmp r5, 0 - bne _08097ECE - cmp r2, 0x10 - beq _08097ECE - ldr r0, [r6] - adds r0, r2 - ldrb r1, [r4, 0x8] - strb r1, [r0] - ldr r1, [r6] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - movs r0, 0x1 -_08097ECC: - mov r12, r0 -_08097ECE: - mov r1, r12 - cmp r1, 0x1 - bne _08097EE0 - ldrb r0, [r4, 0x1] - movs r1, 0x10 - orrs r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r4, 0x1] -_08097EE0: - movs r0, 0x1 - mov r7, r8 - strh r0, [r7, 0x32] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8097E50 - - thumb_func_start sub_8097EF0 -sub_8097EF0: @ 8097EF0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - mov r8, r1 - movs r0, 0x1 - strh r0, [r1, 0x32] - ldr r5, =gUnknown_020375B8 - ldr r0, [r5] - cmp r0, 0 - beq _08097F68 - movs r7, 0 - adds r0, r6, 0 - bl sub_8097F78 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x10 - beq _08097F28 - ldr r0, [r5] - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r1, [r5] - ldrb r0, [r1, 0x10] - subs r0, 0x1 - strb r0, [r1, 0x10] - movs r7, 0x1 -_08097F28: - ldr r0, [r5] - ldrb r4, [r0, 0x10] - cmp r4, 0 - bne _08097F36 - bl Free - str r4, [r5] -_08097F36: - cmp r7, 0x1 - bne _08097F68 - ldrb r0, [r6, 0x5] - bl GetFieldObjectGraphicsInfo - ldrb r1, [r0, 0xC] - lsls r1, 25 - lsrs r1, 31 - lsls r1, 4 - ldrb r2, [r6, 0x1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - movs r1, 0x3 - negs r1, r1 - ands r0, r1 - strb r0, [r6, 0x1] - mov r2, r8 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_08097F68: - movs r0, 0x1 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8097EF0 - - thumb_func_start sub_8097F78 -@ signed int sub_8097F78(npc_state *a1) -sub_8097F78: @ 8097F78 - push {lr} - movs r2, 0 - ldr r1, =gUnknown_020375B8 - ldr r1, [r1] - ldrb r3, [r0, 0x8] -_08097F82: - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, r3 - bne _08097F94 - adds r0, r2, 0 - b _08097FA0 - .pool -_08097F94: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xF - bls _08097F82 - movs r0, 0x10 -_08097FA0: - pop {r1} - bx r1 - thumb_func_end sub_8097F78 - - thumb_func_start sub_8097FA4 -sub_8097FA4: @ 8097FA4 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r0, =sub_8097FE4 - movs r1, 0xFF - bl CreateTask - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - adds r0, r4, 0 - adds r0, 0x8 - adds r1, r6, 0 - bl StoreWordInTwoHalfwords - strb r5, [r6, 0x1B] - ldr r0, =0x0000ffff - strh r0, [r4, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097FA4 - - thumb_func_start sub_8097FE4 -sub_8097FE4: @ 8097FE4 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - adds r0, r4, 0 - adds r0, 0x8 - mov r1, sp - bl LoadWordFromTwoHalfwords - ldr r0, [sp] - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - ldrh r1, [r4, 0xC] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08098020 - ldrh r0, [r4, 0xE] - ldrh r1, [r2, 0x26] - adds r0, r1 - strh r0, [r2, 0x26] -_08098020: - ldrh r1, [r4, 0xC] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _08098030 - ldrh r0, [r4, 0xE] - negs r0, r0 - strh r0, [r4, 0xE] -_08098030: - adds r0, r1, 0x1 - strh r0, [r4, 0xC] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8097FE4 - - thumb_func_start sub_8098044 -sub_8098044: @ 8098044 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - adds r0, 0x8 - mov r1, sp - bl LoadWordFromTwoHalfwords - adds r0, r4, 0 - bl DestroyTask - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098044 - - thumb_func_start sub_8098074 -sub_8098074: @ 8098074 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - movs r4, 0 - ldr r7, =gMapObjects -_08098082: - cmp r4, r6 - beq _080980A8 - cmp r4, r5 - beq _080980A8 - lsls r0, r4, 3 - adds r0, r4 - lsls r0, 2 - adds r1, r0, r7 - ldrb r0, [r1] - lsls r0, 31 - cmp r0, 0 - beq _080980A8 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - cmp r4, r0 - beq _080980A8 - adds r0, r1, 0 - bl sub_8097404 -_080980A8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _08098082 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8098074 - - thumb_func_start sub_80980C0 -sub_80980C0: @ 80980C0 - movs r0, 0 - strh r0, [r1, 0x26] - ldrh r0, [r1, 0x32] - adds r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0 - bx lr - thumb_func_end sub_80980C0 - - thumb_func_start sub_80980D0 -sub_80980D0: @ 80980D0 - push {lr} - adds r2, r1, 0 - ldrh r0, [r2, 0x26] - subs r0, 0x8 - strh r0, [r2, 0x26] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xA0 - negs r1, r1 - cmp r0, r1 - bne _080980EC - ldrh r0, [r2, 0x32] - adds r0, 0x1 - strh r0, [r2, 0x32] -_080980EC: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_80980D0 - - thumb_func_start sub_80980F4 -sub_80980F4: @ 80980F4 - ldr r0, =0x0000ff60 - strh r0, [r1, 0x26] - ldrh r0, [r1, 0x32] - adds r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0 - bx lr - .pool - thumb_func_end sub_80980F4 - - thumb_func_start sub_8098108 -sub_8098108: @ 8098108 - push {lr} - ldrh r0, [r1, 0x26] - adds r0, 0x8 - strh r0, [r1, 0x26] - lsls r0, 16 - cmp r0, 0 - bne _0809811C - ldrh r0, [r1, 0x32] - adds r0, 0x1 - strh r0, [r1, 0x32] -_0809811C: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_8098108 - - thumb_func_start sub_8098124 -sub_8098124: @ 8098124 - movs r0, 0x1 - bx lr - thumb_func_end sub_8098124 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/map_obj_lock.s b/asm/map_obj_lock.s index 3cf009175..97abc7fec 100644 --- a/asm/map_obj_lock.s +++ b/asm/map_obj_lock.s @@ -109,7 +109,7 @@ _0809842A: cmp r0, 0 blt _08098452 adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject movs r0, 0x1 strh r0, [r5, 0xA] _08098452: @@ -154,7 +154,7 @@ LockSelectedMapObject: @ 80984A0 push {r4,r5,lr} ldr r4, =gSelectedMapObject ldrb r0, [r4] - bl sub_80974D0 + bl FreezeMapObjectsExceptOne ldr r0, =sub_8098400 movs r1, 0x50 bl CreateTask @@ -171,7 +171,7 @@ LockSelectedMapObject: @ 80984A0 cmp r0, 0 blt _080984DE adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject ldr r0, =gTasks lsls r1, r5, 2 adds r1, r5 @@ -317,7 +317,7 @@ _080985E8: cmp r0, 0 blt _0809860C adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject movs r0, 0x1 strh r0, [r5, 0xA] _0809860C: @@ -385,7 +385,7 @@ sub_8098630: @ 8098630 cmp r0, 0 blt _0809869A adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject movs r0, 0x1 strh r0, [r6, 0xA] _0809869A: @@ -410,14 +410,14 @@ _0809869A: cmp r0, 0 blt _0809871A adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject movs r0, 0x1 strh r0, [r4, 0xA] b _0809871A .pool _080986E0: adds r0, r4, 0 - bl sub_80974D0 + bl FreezeMapObjectsExceptOne ldr r0, =sub_80985BC movs r1, 0x50 bl CreateTask @@ -439,7 +439,7 @@ _080986E0: cmp r0, 0 blt _0809871A adds r0, r1, 0 - bl sub_8097404 + bl FreezeMapObject movs r0, 0x1 strh r0, [r5, 0xA] _0809871A: diff --git a/asm/menu.s b/asm/menu.s index fac6ed72a..cbea45c75 100644 --- a/asm/menu.s +++ b/asm/menu.s @@ -35,7 +35,7 @@ AddTextPrinterWithCallbackForMessage: @ 8197A9C str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4,r5} pop {r0} @@ -992,7 +992,7 @@ _0819829E: movs r1, 0x1 movs r2, 0x4 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 mov r2, r9 cmp r2, 0 beq _081982C8 @@ -4736,9 +4736,9 @@ box_print: @ 8199E64 bx r0 thumb_func_end box_print - thumb_func_start AddTextPrinterParametrized2 -@ void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, u8 speed, u8 *str) -AddTextPrinterParametrized2: @ 8199EEC + thumb_func_start AddTextPrinterParameterized2 +@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, u8 speed, u8 *str) +AddTextPrinterParameterized2: @ 8199EEC push {r4-r6,lr} mov r6, r9 mov r5, r8 @@ -4806,7 +4806,7 @@ AddTextPrinterParametrized2: @ 8199EEC pop {r4-r6} pop {r0} bx r0 - thumb_func_end AddTextPrinterParametrized2 + thumb_func_end AddTextPrinterParameterized2 thumb_func_start sub_8199F74 sub_8199F74: @ 8199F74 diff --git a/asm/menu_helpers.s b/asm/menu_helpers.s index 26e800944..90e846b97 100644 --- a/asm/menu_helpers.s +++ b/asm/menu_helpers.s @@ -156,7 +156,7 @@ _08121EC0: adds r1, r7, 0 adds r2, r4, 0 adds r3, r5, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized ldr r1, =gUnknown_0300117C ldr r0, [sp, 0x34] str r0, [r1] diff --git a/asm/mystery_event_menu.s b/asm/mystery_event_menu.s deleted file mode 100644 index f5e808416..000000000 --- a/asm/mystery_event_menu.s +++ /dev/null @@ -1,669 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8178944 -sub_8178944: @ 8178944 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8178944 - - thumb_func_start sub_8178958 -sub_8178958: @ 8178958 - push {lr} - movs r2, 0 - ldr r1, =gLinkPlayers - ldrh r0, [r1, 0x1A] - ldrh r1, [r1, 0x36] - cmp r0, r1 - bne _08178968 - movs r2, 0x1 -_08178968: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8178958 - - thumb_func_start sub_8178974 -sub_8178974: @ 8178974 - push {r4,lr} - sub sp, 0x8 - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - ldr r0, =sub_8178944 - bl SetVBlankCallback - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085EFD64 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - ldr r0, =gUnknown_085EFD68 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - beq _08178A22 - bl DeactivateAllTextPrinters - movs r4, 0 -_081789AC: - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - adds r4, 0x1 - cmp r4, 0x1 - ble _081789AC - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl sub_809882C - movs r0, 0xE0 - bl sub_81978B0 - movs r1, 0xA0 - lsls r1, 1 - movs r0, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r0, =Task_DestroySelf - movs r1, 0 - bl CreateTask - bl StopMapMusic - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - ldr r0, =sub_8178A78 - bl SetMainCallback2 -_08178A22: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8178974 - - thumb_func_start sub_8178A40 -sub_8178A40: @ 8178A40 - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r1, 0 - movs r5, 0x1 - cmp r4, 0 - bne _08178A54 - ldr r1, =gText_EventSafelyLoaded - bl StringCopy - movs r5, 0 -_08178A54: - cmp r4, 0x2 - bne _08178A5A - movs r5, 0 -_08178A5A: - cmp r4, 0x1 - bne _08178A66 - ldr r1, =gText_LoadErrorEndingSession - adds r0, r6, 0 - bl StringCopy -_08178A66: - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8178A40 - - thumb_func_start sub_8178A78 -sub_8178A78: @ 8178A78 - push {r4-r6,lr} - sub sp, 0x8 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x10 - bls _08178A8E - b _08178E58 -_08178A8E: - lsls r0, 2 - ldr r1, =_08178AA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08178AA0: - .4byte _08178AE4 - .4byte _08178B12 - .4byte _08178B48 - .4byte _08178B80 - .4byte _08178BCC - .4byte _08178BDC - .4byte _08178C54 - .4byte _08178D28 - .4byte _08178D38 - .4byte _08178D58 - .4byte _08178D60 - .4byte _08178D74 - .4byte _08178DBC - .4byte _08178DE0 - .4byte _08178E0C - .4byte _08178E24 - .4byte _08178E48 -_08178AE4: - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0xD - bl SetWindowBorderStyle - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - movs r0, 0 - bl ShowBg - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - b _08178E30 -_08178B12: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08178B20 - b _08178E58 -_08178B20: - ldr r1, =gText_LinkStandby2 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08178E3C - .pool -_08178B48: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _08178B56 - b _08178E58 -_08178B56: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r1, =gLinkType - ldr r2, =0x00005501 - adds r0, r2, 0 - strh r0, [r1] - bl OpenLink - b _08178E58 - .pool -_08178B80: - ldr r0, =gLinkStatus - ldr r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _08178B8E - b _08178D00 -_08178B8E: - movs r0, 0x1C - ands r1, r0 - cmp r1, 0x4 - bhi _08178B98 - b _08178D00 -_08178B98: - movs r0, 0x15 - bl PlaySE - ldr r1, =gText_PressAToLoadEvent - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08178D00 - .pool -_08178BCC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _08178BDA - b _08178E58 -_08178BDA: - b _08178E34 -_08178BDC: - bl GetLinkPlayerCount_2 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x2 - bne _08178CD0 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08178C38 - movs r0, 0x5 - bl PlaySE - bl sub_800A620 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0xD - bl SetWindowBorderStyle - ldr r1, =gText_LoadingEvent - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - movs r2, 0x87 - lsls r2, 3 - adds r1, r4, r2 - b _08178E3C - .pool -_08178C38: - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _08178C42 - b _08178E58 -_08178C42: - movs r0, 0x5 - bl PlaySE - bl CloseLink - movs r0, 0x87 - lsls r0, 3 - adds r1, r4, r0 - b _08178D1E -_08178C54: - bl IsLinkConnectionEstablished - lsls r0, 24 - cmp r0, 0 - beq _08178D00 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08178C68 - b _08178E58 -_08178C68: - movs r0, 0x2 - movs r1, 0x2 - bl GetLinkPlayerDataExchangeStatusTimed - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _08178CAC - bl sub_800AC34 - ldr r4, =gStringVar4 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8178A40 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - b _08178CF2 - .pool -_08178CAC: - bl sub_8178958 - lsls r0, 24 - cmp r0, 0 - beq _08178CCC - ldr r1, =gText_DontRemoveCableTurnOff - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - b _08178E34 - .pool -_08178CCC: - bl CloseLink -_08178CD0: - ldr r4, =gStringVar4 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8178A40 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 -_08178CF2: - movs r1, 0xD - strb r1, [r0] - b _08178E58 - .pool -_08178D00: - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08178D0E - b _08178E58 -_08178D0E: - movs r0, 0x5 - bl PlaySE - bl CloseLink - movs r2, 0x87 - lsls r2, 3 - adds r1, r4, r2 -_08178D1E: - movs r0, 0xF - strb r0, [r1] - b _08178E58 - .pool -_08178D28: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _08178D36 - b _08178E58 -_08178D36: - b _08178E34 -_08178D38: - bl GetBlockReceivedStatus - lsls r0, 24 - cmp r0, 0 - bne _08178D44 - b _08178E58 -_08178D44: - bl ResetBlockReceivedFlags - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08178E3C - .pool -_08178D58: - movs r0, 0x87 - lsls r0, 3 - adds r1, r4, r0 - b _08178E3C -_08178D60: - bl sub_800AC34 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08178E3C - .pool -_08178D74: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r6, [r0] - cmp r6, 0 - bne _08178E58 - ldr r5, =0x0201c000 - adds r0, r5, 0 - bl RunMysteryEventScript - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - str r6, [sp, 0x4] - ldr r2, =0x050001f5 - add r0, sp, 0x4 - adds r1, r5, 0 - bl CpuSet - ldr r0, =gStringVar4 - adds r1, r4, 0 - bl sub_8178A40 - lsls r0, 24 - cmp r0, 0 - bne _08178E34 - movs r0, 0 - bl TrySavingData - b _08178E34 - .pool -_08178DBC: - ldr r1, =gStringVar4 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08178E3C - .pool -_08178DE0: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - bne _08178E58 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, =gUnknown_0203BCF8 - strb r2, [r0] - b _08178E58 - .pool -_08178E0C: - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08178E58 - movs r0, 0x5 - bl PlaySE - movs r2, 0x87 - lsls r2, 3 - adds r1, r4, r2 - b _08178E3C -_08178E24: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 -_08178E30: - bl BeginNormalPaletteFade -_08178E34: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_08178E3C: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08178E58 - .pool -_08178E48: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08178E58 - bl DoSoftReset -_08178E58: - ldr r0, =gLinkStatus - ldr r0, [r0] - movs r1, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08178E98 - bl IsLinkMaster - lsls r0, 24 - cmp r0, 0 - bne _08178E98 - bl CloseLink - ldr r4, =gStringVar4 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8178A40 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl sub_8178EC4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0xD - strb r1, [r0] -_08178E98: - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8178A78 - - thumb_func_start sub_8178EC4 -sub_8178EC4: @ 8178EC4 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x1C - adds r5, r0, 0 - mov r10, r1 - adds r6, r2, 0 - ldr r4, [sp, 0x38] - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - mov r9, r0 - movs r1, 0x1 - mov r8, r1 - add r0, sp, 0x14 - mov r1, r8 - strb r1, [r0] - adds r1, r0, 0 - movs r0, 0x2 - strb r0, [r1, 0x1] - movs r0, 0x3 - strb r0, [r1, 0x2] - adds r0, r1, 0 - ldrb r0, [r0] - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - str r3, [sp, 0x18] - bl FillWindowPixelBuffer - mov r0, r9 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - add r0, sp, 0x14 - str r0, [sp, 0x8] - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - mov r1, r10 - str r1, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - ldr r3, [sp, 0x18] - bl AddTextPrinterParametrized2 - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8178EC4 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/naming_screen.s b/asm/naming_screen.s deleted file mode 100644 index 07ec0662f..000000000 --- a/asm/naming_screen.s +++ /dev/null @@ -1,4267 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - 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} - mov r8, r1 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r2, 16 - lsrs r5, r2, 16 - lsls r3, 16 - lsrs r6, r3, 16 - ldr r4, =gUnknown_02039F94 - movs r0, 0xF2 - lsls r0, 5 - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _080E2DA8 - ldr r0, [sp, 0x1C] - bl SetMainCallback2 - b _080E2DE2 - .pool -_080E2DA8: - ldr r1, =0x00001e2c - adds r0, r1 - strb r7, [r0] - ldr r0, [r4] - ldr r2, =0x00001e34 - adds r1, r0, r2 - strh r5, [r1] - adds r2, 0x2 - adds r1, r0, r2 - strh r6, [r1] - ldr r1, =0x00001e38 - adds r2, r0, r1 - ldr r1, [sp, 0x18] - str r1, [r2] - ldr r2, =0x00001e30 - adds r1, r0, r2 - mov r2, r8 - str r2, [r1] - ldr r1, =0x00001e3c - adds r0, r1 - ldr r2, [sp, 0x1C] - str r2, [r0] - cmp r7, 0 - bne _080E2DDC - bl StartTimer1 -_080E2DDC: - ldr r0, =c2_choose_name_or_words_screen - bl SetMainCallback2 -_080E2DE2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DoNamingScreen - - thumb_func_start c2_choose_name_or_words_screen -c2_choose_name_or_words_screen: @ 80E2E04 - push {lr} - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x7 - bhi _080E2E9C - lsls r0, 2 - ldr r1, =_080E2E28 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E2E28: - .4byte _080E2E48 - .4byte _080E2E52 - .4byte _080E2E58 - .4byte _080E2E5E - .4byte _080E2E68 - .4byte _080E2E6E - .4byte _080E2E74 - .4byte _080E2E7A -_080E2E48: - bl sub_80E4F70 - bl choose_name_or_words_screen_setup - b _080E2E86 -_080E2E52: - bl choose_name_or_words_screen_init_bgs - b _080E2E86 -_080E2E58: - bl ResetPaletteFade - b _080E2E86 -_080E2E5E: - bl ResetSpriteData - bl FreeAllSpritePalettes - b _080E2E86 -_080E2E68: - bl ResetTasks - b _080E2E86 -_080E2E6E: - bl choose_name_or_words_screen_apply_bg_pals - b _080E2E86 -_080E2E74: - bl choose_name_or_words_screen_load_bg_tile_patterns - b _080E2E86 -_080E2E7A: - bl sub_80E3CC8 - bl UpdatePaletteFade - bl sub_80E501C -_080E2E86: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080E2EA4 - .pool -_080E2E9C: - bl sub_80E4CB8 - bl sub_80E3194 -_080E2EA4: - pop {r0} - bx r0 - thumb_func_end c2_choose_name_or_words_screen - - thumb_func_start choose_name_or_words_screen_setup -@ void choose_name_or_words_screen_setup() -choose_name_or_words_screen_setup: @ 80E2EA8 - push {r4-r7,lr} - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e10 - adds r0, r1 - movs r2, 0 - strb r2, [r0] - ldr r1, [r5] - ldr r3, =0x00001e18 - adds r0, r1, r3 - movs r4, 0 - strh r2, [r0] - ldr r7, =0x00001e1a - adds r0, r1, r7 - strh r2, [r0] - ldr r0, =0x00001e1c - adds r2, r1, r0 - movs r3, 0x1 - movs r0, 0x1 - strh r0, [r2] - adds r7, 0x4 - adds r2, r1, r7 - movs r0, 0x2 - strh r0, [r2] - movs r0, 0xF1 - lsls r0, 5 - adds r1, r0 - strb r4, [r1] - ldr r0, [r5] - ldr r1, =0x00001e21 - adds r0, r1 - strb r3, [r0] - ldr r1, [r5] - ldr r6, =0x00001e28 - adds r3, r1, r6 - ldr r2, =gUnknown_0858BFD8 - ldr r4, =0x00001e2c - adds r0, r1, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldr r0, [r0] - str r0, [r3] - ldrb r0, [r0, 0x4] - ldr r2, =0x00001e22 - adds r1, r2 - strb r0, [r1] - ldr r2, [r5] - adds r0, r2, r6 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 3 - movs r0, 0xF0 - subs r0, r1 - asrs r3, r0, 1 - adds r0, r3, 0x6 - subs r7, 0x8 - adds r1, r2, r7 - strh r0, [r1] - adds r2, r4 - ldrb r0, [r2] - cmp r0, 0x4 - bne _080E2F2C - adds r0, r3, 0 - adds r0, 0x11 - strh r0, [r1] -_080E2F2C: - ldr r0, [r5] - ldr r4, =gKeyRepeatStartDelay - ldrh r1, [r4] - ldr r2, =0x00001e25 - adds r0, r2 - strb r1, [r0] - ldr r0, [r5] - movs r3, 0xC0 - lsls r3, 5 - adds r0, r3 - movs r1, 0xFF - movs r2, 0x10 - bl memset - ldr r1, [r5] - adds r0, r1, r6 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _080E2F64 - movs r7, 0xC0 - lsls r7, 5 - adds r0, r1, r7 - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy -_080E2F64: - movs r0, 0x10 - strh r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_setup - - thumb_func_start sub_80E2FA4 -sub_80E2FA4: @ 80E2FA4 - push {r4,r5,lr} - movs r3, 0 - ldr r4, =gSprites - movs r5, 0x5 - negs r5, r5 -_080E2FAE: - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r0, r4 - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - lsls r0, r1, 31 - cmp r0, 0 - beq _080E2FC8 - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2] -_080E2FC8: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3F - bls _080E2FAE - movs r0, 0 - bl sub_80E3E3C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E2FA4 - - thumb_func_start choose_name_or_words_screen_init_bgs -choose_name_or_words_screen_init_bgs: @ 80E2FE4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0xC - mov r8, r0 - add r2, sp, 0x8 - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_080E300A: - strh r6, [r2] - add r0, sp, 0x8 - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _080E300A - strh r6, [r2] - add r2, sp, 0x8 - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0xC] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - add r0, sp, 0x8 - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0858BE00 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl sub_81971D0 - bl sub_8197200 -_080E30D8: - lsls r0, r4, 3 - ldr r1, =gUnknown_0858BE10 - adds r0, r1 - bl AddWindow - ldr r5, =gUnknown_02039F94 - ldr r1, [r5] - ldr r2, =0x00001e11 - adds r1, r2 - adds r1, r4 - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _080E30D8 - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r1, 0xC8 - lsls r1, 3 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x0000080c - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r5] - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r5] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r1, [r5] - movs r2, 0x80 - lsls r2, 5 - adds r1, r2 - movs r0, 0x3 - bl SetBgTilemapBuffer - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_init_bgs - - thumb_func_start sub_80E3194 -sub_80E3194: @ 80E3194 - push {lr} - ldr r0, =sub_80E31B0 - movs r1, 0x2 - bl CreateTask - ldr r0, =sub_80E4F58 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3194 - - thumb_func_start sub_80E31B0 -sub_80E31B0: @ 80E31B0 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x9 - bhi _080E3240 - lsls r0, 2 - ldr r1, =_080E31D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080E31D8: - .4byte _080E3200 - .4byte _080E320E - .4byte _080E3218 - .4byte _080E3214 - .4byte _080E321E - .4byte _080E3224 - .4byte _080E322A - .4byte _080E3230 - .4byte _080E3236 - .4byte _080E323C -_080E3200: - bl sub_80E3294 - bl sub_80E2FA4 - bl sub_80E4F84 - b _080E3240 -_080E320E: - bl sub_80E335C - b _080E3240 -_080E3214: - bl sub_80E33A8 -_080E3218: - bl sub_80E3398 - b _080E3240 -_080E321E: - bl sub_80E3640 - b _080E3240 -_080E3224: - bl sub_80E3680 - b _080E3240 -_080E322A: - bl pokemon_store - b _080E3240 -_080E3230: - bl sub_80E3604 - b _080E3240 -_080E3236: - bl sub_80E3448 - b _080E3240 -_080E323C: - bl sub_80E347C -_080E3240: - pop {r0} - bx r0 - thumb_func_end sub_80E31B0 - - thumb_func_start sub_80E3244 -sub_80E3244: @ 80E3244 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0858BEBB - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3244 - - thumb_func_start sub_80E3254 -sub_80E3254: @ 80E3254 - ldr r1, =gUnknown_0858BEBE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3254 - - thumb_func_start sub_80E3274 -sub_80E3274: @ 80E3274 - ldr r1, =gUnknown_0858BEC1 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80E3274 - - thumb_func_start sub_80E3294 -sub_80E3294: @ 80E3294 - push {r4-r6,lr} - sub sp, 0x4 - ldr r1, =gUnknown_08DD4544 - movs r0, 0x3 - bl sub_80E4CF8 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e22 - adds r0, r1 - movs r6, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r1, =gUnknown_08DD46E0 - movs r0, 0x2 - bl sub_80E4CF8 - ldr r1, =gUnknown_08DD4620 - movs r0, 0x1 - bl sub_80E4CF8 - ldr r0, [r5] - ldr r1, =0x00001e12 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0 - bl sub_80E4DE4 - ldr r0, [r5] - ldr r1, =0x00001e11 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_80E4DE4 - movs r0, 0x2 - movs r1, 0 - bl nullsub_10 - movs r0, 0x1 - movs r1, 0x1 - bl nullsub_10 - bl sub_80E4D10 - bl sub_80E4964 - bl sub_80E4EF0 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - str r6, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r5] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3294 - - thumb_func_start sub_80E335C -sub_80E335C: @ 80E335C - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080E3384 - movs r0, 0x1 - bl sub_80E4630 - movs r0, 0x1 - bl sub_80E3E94 - ldr r0, =gUnknown_02039F94 - ldr r1, [r0] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080E3384: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E335C - - thumb_func_start sub_80E3398 -sub_80E3398: @ 80E3398 - push {lr} - bl sub_80E44BC - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80E3398 - - thumb_func_start sub_80E33A8 -sub_80E33A8: @ 80E33A8 - push {lr} - bl sub_80E3F04 - lsls r0, 24 - cmp r0, 0 - beq _080E33CA - movs r0, 0x1 - bl sub_80E4630 - bl sub_80E3E28 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] -_080E33CA: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E33A8 - - thumb_func_start pokemon_store -pokemon_store: @ 80E33D8 - push {r4,lr} - bl sub_80E4BE4 - movs r0, 0 - bl sub_80E4630 - movs r0, 0 - bl sub_80E3E94 - movs r0, 0x3 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 - ldr r4, =gUnknown_02039F94 - ldr r0, [r4] - ldr r1, =0x00001e2c - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x2 - bne _080E342C - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _080E342C - bl pokemon_transfer_to_pc_with_message - ldr r0, [r4] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x7 - strb r1, [r0] - movs r0, 0 - b _080E343A - .pool -_080E342C: - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] - movs r0, 0x1 -_080E343A: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end pokemon_store - - thumb_func_start sub_80E3448 -sub_80E3448: @ 80E3448 - push {lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_02039F94 - ldr r1, [r0] - ldr r0, =0x00001e10 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3448 - - thumb_func_start sub_80E347C -sub_80E347C: @ 80E347C - push {r4,r5,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _080E34C6 - ldr r4, =gUnknown_02039F94 - ldr r0, [r4] - ldr r1, =0x00001e2c - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080E34A0 - bl SeedRngAndSetTrainerId -_080E34A0: - ldr r0, [r4] - ldr r1, =0x00001e3c - adds r0, r1 - ldr r0, [r0] - bl SetMainCallback2 - ldr r0, =sub_80E31B0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - bl FreeAllWindowBuffers - ldr r0, [r4] - bl Free - str r5, [r4] -_080E34C6: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E347C - - thumb_func_start pokemon_transfer_to_pc_with_message -pokemon_transfer_to_pc_with_message: @ 80E34E4 - push {r4,r5,lr} - sub sp, 0x10 - movs r5, 0 - bl sub_813B260 - lsls r0, 24 - cmp r0, 0 - bne _080E3534 - ldr r4, =gStringVar1 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - b _080E3574 - .pool -_080E3534: - ldr r4, =gStringVar1 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e30 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r4, =gStringVar3 - bl get_unknown_box_id - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - movs r5, 0x2 -_080E3574: - ldr r0, =0x000008ab - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080E3586 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_080E3586: - ldr r4, =gStringVar4 - ldr r1, =gUnknown_0858BDB8 - lsls r0, r5, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0 - bl sub_81973C4 - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParametrized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_transfer_to_pc_with_message - - thumb_func_start sub_80E3604 -sub_80E3604: @ 80E3604 - push {lr} - bl RunTextPrinters - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _080E362E - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080E362E - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] -_080E362E: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3604 - - thumb_func_start sub_80E3640 -sub_80E3640: @ 80E3640 - push {lr} - movs r0, 0 - bl sub_80E4630 - bl sub_80E4050 - bl sub_80E373C - movs r0, 0x1 - bl sub_80E3E3C - movs r0, 0 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 - movs r0, 0x6 - bl PlaySE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3640 - - thumb_func_start sub_80E3680 -sub_80E3680: @ 80E3680 - push {r4-r6,lr} - sub sp, 0x4 - bl sub_80E3794 - lsls r0, 24 - cmp r0, 0 - beq _080E3732 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl sub_80E3DFC - bl sub_80E3F70 - movs r5, 0 - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r0, 24 - lsrs r0, 24 - adds r6, r4, 0 - cmp r1, r0 - bne _080E36B2 - movs r5, 0x1 -_080E36B2: - ldr r2, =gUnknown_02039F94 - ldr r0, [r2] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r1, [r2] - ldr r3, =0x00001e22 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r4, [r2] - adds r4, r3 - ldrb r0, [r4] - movs r1, 0x3 - bl __umodsi3 - strb r0, [r4] - cmp r5, 0 - beq _080E36F4 - mov r4, sp - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - b _080E3712 - .pool -_080E36F4: - mov r0, sp - movs r2, 0 - ldrsh r4, [r0, r2] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _080E3714 - mov r4, sp - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 -_080E3712: - strh r0, [r4] -_080E3714: - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r6, r2] - bl sub_80E3D78 - bl sub_80E4E5C - movs r0, 0x1 - bl sub_80E4630 - movs r0, 0 - bl sub_80E3E3C -_080E3732: - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80E3680 - - thumb_func_start sub_80E373C -sub_80E373C: @ 80E373C - push {r4,lr} - ldr r4, =sub_80E375C - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E373C - - thumb_func_start sub_80E375C -sub_80E375C: @ 80E375C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0858BEC4 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_080E376E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080E376E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E375C - - thumb_func_start sub_80E3794 -sub_80E3794: @ 80E3794 - push {lr} - ldr r0, =sub_80E375C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _080E37AC - movs r0, 0 - b _080E37AE - .pool -_080E37AC: - movs r0, 0x1 -_080E37AE: - pop {r1} - bx r1 - thumb_func_end sub_80E3794 - - thumb_func_start sub_80E37B4 -sub_80E37B4: @ 80E37B4 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r3, =0x00001e18 - adds r2, r1, r3 - movs r3, 0 - strh r3, [r2] - ldr r2, =0x00001e1a - adds r1, r2 - strh r3, [r1] - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - movs r0, 0 - bx lr - .pool - thumb_func_end sub_80E37B4 - - thumb_func_start sub_80E37DC -sub_80E37DC: @ 80E37DC - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r2, =0x00001e1a - adds r1, r0, r2 - str r1, [sp] - ldr r1, =0x00001e18 - adds r0, r1 - str r0, [sp, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x4 - strh r0, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - movs r1, 0x28 - bl Sin - ldr r1, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - ldrh r0, [r4, 0xA] - adds r0, 0x80 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x28 - bl Sin - ldr r1, [r5] - ldr r2, =0x00001e21 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _080E3852 - ldr r0, [r5] - ldr r1, =0x00001e1c - adds r2, r0, r1 - ldrb r3, [r2] - adds r1, 0x2 - adds r0, r1 - ldrh r1, [r0] - strh r1, [r2] - strh r3, [r0] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080E3852: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E37DC - - thumb_func_start sub_80E3870 -sub_80E3870: @ 80E3870 - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r2, =0x00001e1a - adds r1, r0, r2 - str r1, [sp] - ldr r3, =0x00001e18 - adds r0, r3 - str r0, [sp, 0x4] - ldrh r0, [r4, 0xA] - adds r0, 0x4 - strh r0, [r4, 0xA] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0x28 - bl Sin - ldr r1, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - ldrh r0, [r4, 0xA] - adds r0, 0x80 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x28 - bl Sin - ldr r1, [r5] - ldr r3, =0x00001e21 - adds r1, r3 - ldrb r1, [r1] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - strh r0, [r1] - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _080E38EA - ldr r0, [r5] - movs r2, 0xF1 - lsls r2, 5 - adds r1, r0, r2 - ldrb r2, [r1] - adds r0, r3 - ldrb r0, [r0] - strb r0, [r1] - ldr r0, [r5] - adds r0, r3 - strb r2, [r0] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080E38EA: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3870 - - thumb_func_start sub_80E3904 -sub_80E3904: @ 80E3904 - push {lr} - ldr r0, =sub_80E375C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3904 - - thumb_func_start sub_80E3920 -sub_80E3920: @ 80E3920 - push {lr} - ldr r0, =c3_0809E58C - movs r1, 0x3 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0x3 - strh r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3920 - - thumb_func_start sub_80E3948 -sub_80E3948: @ 80E3948 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r0, =c3_0809E58C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r5, r0 - bne _080E3988 - cmp r6, 0 - bne _080E3988 - strh r7, [r4, 0xA] - movs r0, 0x1 - strh r0, [r4, 0xC] - b _080E39B4 - .pool -_080E3988: - cmp r5, 0x3 - bne _080E3998 - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _080E3998 - cmp r6, 0 - beq _080E39B4 -_080E3998: - ldrh r1, [r4, 0x8] - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - beq _080E39AA - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_80E3AE8 -_080E39AA: - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r7, 0 - bl sub_80E3B10 -_080E39B4: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E3948 - - thumb_func_start c3_0809E58C -c3_0809E58C: @ 80E39BC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - ldrh r1, [r4, 0x8] - movs r2, 0x8 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - beq _080E3A6E - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _080E3A6E - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_80E3A74 - lsls r0, 16 - lsrs r0, 16 - ldrb r3, [r4, 0xE] - adds r1, r3, 0 - adds r2, r3, 0 - bl sub_80B609C - ldrh r1, [r4, 0x12] - movs r2, 0x12 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080E3A08 - subs r0, r1, 0x1 - strh r0, [r4, 0x12] - lsls r0, 16 - cmp r0, 0 - bne _080E3A6E -_080E3A08: - movs r0, 0x2 - strh r0, [r4, 0x12] - ldrh r1, [r4, 0x10] - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r0, 0 - blt _080E3A32 - ldrh r2, [r4, 0xE] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r0, 0xD - bgt _080E3A28 - adds r0, r2, r1 - b _080E3A36 - .pool -_080E3A28: - movs r0, 0x10 - strh r0, [r4, 0xE] - ldrh r0, [r4, 0x14] - adds r0, 0x1 - b _080E3A3C -_080E3A32: - ldrh r3, [r4, 0xE] - adds r0, r1, r3 -_080E3A36: - strh r0, [r4, 0xE] - ldrh r2, [r4, 0x14] - adds r0, r1, r2 -_080E3A3C: - strh r0, [r4, 0x14] - movs r3, 0xE - ldrsh r0, [r4, r3] - ldrh r1, [r4, 0xE] - cmp r0, 0x10 - bne _080E3A5C - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0x16 - bne _080E3A5C - ldr r0, =0x0000fffc - strh r0, [r4, 0x10] - b _080E3A6E - .pool -_080E3A5C: - lsls r0, r1, 16 - asrs r1, r0, 16 - cmp r1, 0 - bne _080E3A6E - ldrh r0, [r4, 0xA] - strh r0, [r4, 0xC] - movs r0, 0x2 - strh r0, [r4, 0x10] - strh r1, [r4, 0x14] -_080E3A6E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end c3_0809E58C - - thumb_func_start sub_80E3A74 -sub_80E3A74: @ 80E3A74 - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x4 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - movs r1, 0x87 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - add r6, sp, 0x8 - strh r0, [r6] - movs r0, 0x6 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - adds r0, r5 - mov r1, sp - adds r1, 0xA - strh r0, [r1] - movs r0, 0x7 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - adds r0, r5 - add r1, sp, 0xC - strh r0, [r1] - movs r0, 0x7 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 20 - ldr r1, =0x00000101 - adds r0, r1 - mov r1, sp - adds r1, 0xE - strh r0, [r1] - mov r0, sp - adds r1, r6, 0 - movs r2, 0x8 - bl memcpy - lsls r4, 1 - mov r1, sp - adds r0, r1, r4 - ldrh r0, [r0] - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3A74 - - thumb_func_start sub_80E3AE8 -sub_80E3AE8: @ 80E3AE8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_80E3A74 - lsls r0, 16 - ldr r2, =gPlttBufferFaded - lsrs r0, 15 - adds r2, r0, r2 - ldr r1, =gPlttBufferUnfaded - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3AE8 - - thumb_func_start sub_80E3B10 -sub_80E3B10: @ 80E3B10 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - movs r3, 0 - strh r1, [r0, 0x8] - strh r2, [r0, 0xA] - movs r1, 0x1 - strh r1, [r0, 0xC] - movs r2, 0x4 - strh r2, [r0, 0xE] - movs r1, 0x2 - strh r1, [r0, 0x10] - strh r3, [r0, 0x12] - strh r2, [r0, 0x14] - bx lr - thumb_func_end sub_80E3B10 - - thumb_func_start sub_80E3B30 -sub_80E3B30: @ 80E3B30 - push {r4-r6,lr} - adds r5, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080E3B48 - adds r0, r5, 0 - movs r1, 0 - bl StartSpriteAnim -_080E3B48: - ldrh r0, [r5, 0x36] - movs r1, 0xFF - ands r1, r0 - adds r6, r5, 0 - adds r6, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r6] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6] - movs r0, 0x2E - ldrsh r4, [r5, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E3B7C - ldrb r0, [r6] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r6] -_080E3B7C: - ldrb r1, [r6] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080E3BAC - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _080E3BAC - movs r2, 0x2E - ldrsh r1, [r5, r2] - movs r2, 0x32 - ldrsh r0, [r5, r2] - cmp r1, r0 - bne _080E3BAC - movs r0, 0x30 - ldrsh r1, [r5, r0] - movs r2, 0x34 - ldrsh r0, [r5, r2] - cmp r1, r0 - beq _080E3BB6 -_080E3BAC: - movs r0, 0 - strh r0, [r5, 0x38] - movs r0, 0x2 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x3C] -_080E3BB6: - ldrh r0, [r5, 0x3C] - subs r0, 0x1 - strh r0, [r5, 0x3C] - lsls r0, 16 - cmp r0, 0 - bne _080E3BDE - ldrh r1, [r5, 0x3A] - ldrh r2, [r5, 0x38] - adds r0, r1, r2 - strh r0, [r5, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - beq _080E3BD6 - cmp r0, 0 - bne _080E3BDA -_080E3BD6: - negs r0, r1 - strh r0, [r5, 0x3A] -_080E3BDA: - movs r0, 0x2 - strh r0, [r5, 0x3C] -_080E3BDE: - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0xFF - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _080E3C14 - ldrh r4, [r5, 0x38] - lsls r5, r4, 24 - lsrs r5, 24 - lsls r4, 16 - asrs r4, 17 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x5 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 4 - ldr r2, =0x01010000 - adds r0, r2 - lsrs r0, 16 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r5, 0 - bl sub_80B609C -_080E3C14: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3B30 - - thumb_func_start sub_80E3C20 -sub_80E3C20: @ 80E3C20 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r1, =gUnknown_0858BED4 - mov r0, sp - movs r2, 0x8 - bl memcpy - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _080E3C44 - subs r0, r1, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _080E3C52 -_080E3C44: - movs r0, 0x8 - strh r0, [r4, 0x2E] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0x30] -_080E3C52: - movs r1, 0x30 - ldrsh r0, [r4, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r4, 0x24] - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3C20 - - thumb_func_start sub_80E3C6C -sub_80E3C6C: @ 80E3C6C - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r1, =gUnknown_0858BEDC - mov r0, sp - movs r2, 0x8 - bl memcpy - bl sub_80E4A60 - lsls r0, 24 - ldrh r1, [r4, 0x2E] - lsls r1, 24 - cmp r0, r1 - beq _080E3C98 - movs r0, 0 - strh r0, [r4, 0x26] - strh r0, [r4, 0x30] - b _080E3CBE - .pool -_080E3C98: - movs r1, 0x30 - ldrsh r0, [r4, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _080E3CC0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - strh r0, [r4, 0x30] - movs r0, 0 -_080E3CBE: - strh r0, [r4, 0x32] -_080E3CC0: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80E3C6C - - thumb_func_start sub_80E3CC8 -sub_80E3CC8: @ 80E3CC8 - push {lr} - bl sub_80E3CE4 - bl sub_80E3F8C - bl sub_80E4218 - bl sub_80E4290 - bl sub_80E4354 - pop {r0} - bx r0 - thumb_func_end sub_80E3CC8 - - thumb_func_start sub_80E3CE4 -sub_80E3CE4: @ 80E3CE4 - push {r4-r6,lr} - ldr r0, =gUnknown_0858C138 - movs r1, 0x26 - movs r2, 0x58 - movs r3, 0x1 - bl CreateSprite - ldr r5, =gUnknown_02039F94 - ldr r1, [r5] - ldr r4, =0x00001e23 - adds r1, r4 - strb r0, [r1] - movs r0, 0x1 - bl sub_80E3E3C - ldr r6, =gSprites - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r3, [r1, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r0, [r5] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x1] - ands r2, r1 - orrs r2, r3 - strb r2, [r0, 0x1] - ldr r2, [r5] - adds r2, r4 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - strh r1, [r0, 0x3A] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x2 - strh r1, [r0, 0x3A] - movs r0, 0 - movs r1, 0 - bl sub_80E3D78 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3CE4 - - thumb_func_start sub_80E3D78 -sub_80E3D78: @ 80E3D78 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsls r1, 16 - lsrs r7, r1, 16 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e23 - adds r1, r2 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r5, r1, r2 - lsrs r1, r0, 16 - mov r8, r1 - asrs r6, r0, 16 - ldr r4, =gUnknown_0858BEA0 - bl sub_80E3274 - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r0, [r0] - cmp r6, r0 - bge _080E3DD8 - bl sub_80E3274 - ldr r1, =gUnknown_0858BEA3 - lsls r0, 24 - lsrs r0, 21 - adds r0, r6, r0 - adds r0, r1 - ldrb r0, [r0] - adds r0, 0x26 - b _080E3DDA - .pool -_080E3DD8: - movs r0, 0 -_080E3DDA: - strh r0, [r5, 0x20] - lsls r0, r7, 16 - asrs r0, 12 - adds r0, 0x58 - strh r0, [r5, 0x22] - ldrh r0, [r5, 0x2E] - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x30] - strh r0, [r5, 0x34] - mov r2, r8 - strh r2, [r5, 0x2E] - strh r7, [r5, 0x30] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E3D78 - - thumb_func_start sub_80E3DFC -sub_80E3DFC: @ 80E3DFC - ldr r2, =gUnknown_02039F94 - ldr r2, [r2] - ldr r3, =0x00001e23 - adds r2, r3 - ldrb r3, [r2] - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - ldr r3, =gSprites - adds r2, r3 - ldrh r3, [r2, 0x2E] - strh r3, [r0] - ldrh r0, [r2, 0x30] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_80E3DFC - - thumb_func_start sub_80E3E28 -sub_80E3E28: @ 80E3E28 - push {lr} - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl sub_80E3D78 - pop {r0} - bx r0 - thumb_func_end sub_80E3E28 - - thumb_func_start sub_80E3E3C -sub_80E3E3C: @ 80E3E3C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gSprites - ldr r1, =gUnknown_02039F94 - ldr r4, [r1] - ldr r1, =0x00001e23 - adds r4, r1 - ldrb r1, [r4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - ldrh r3, [r2, 0x36] - ldr r1, =0xffffff00 - ands r1, r3 - strh r1, [r2, 0x36] - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - ldrh r2, [r1, 0x36] - orrs r0, r2 - strh r0, [r1, 0x36] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0 - bl StartSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3E3C - - thumb_func_start sub_80E3E94 -sub_80E3E94: @ 80E3E94 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gSprites - ldr r1, =gUnknown_02039F94 - ldr r4, [r1] - ldr r1, =0x00001e23 - adds r4, r1 - ldrb r1, [r4] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r5 - ldrh r3, [r2, 0x36] - movs r1, 0xFF - ands r1, r3 - strh r1, [r2, 0x36] - ldrb r2, [r4] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r5 - lsrs r0, 16 - ldrh r2, [r1, 0x36] - orrs r0, r2 - strh r0, [r1, 0x36] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3E94 - - thumb_func_start sub_80E3ED8 -sub_80E3ED8: @ 80E3ED8 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e23 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3ED8 - - thumb_func_start sub_80E3F04 -sub_80E3F04: @ 80E3F04 - ldr r2, =gSprites - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e23 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_80E3F04 - - thumb_func_start sub_80E3F30 -sub_80E3F30: @ 80E3F30 - push {r4,r5,lr} - sub sp, 0x4 - mov r5, sp - adds r5, 0x2 - mov r0, sp - adds r1, r5, 0 - bl sub_80E3DFC - mov r0, sp - movs r1, 0 - ldrsh r4, [r0, r1] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - blt _080E3F64 - ldr r0, =gUnknown_0858BEE4 - movs r2, 0 - ldrsh r1, [r5, r2] - adds r1, r0 - ldrb r0, [r1] - b _080E3F66 - .pool -_080E3F64: - movs r0, 0 -_080E3F66: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80E3F30 - - thumb_func_start sub_80E3F70 -sub_80E3F70: @ 80E3F70 - push {r4,lr} - ldr r4, =gUnknown_0858BEA0 - bl sub_80E3274 - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r0, [r0] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E3F70 - - thumb_func_start sub_80E3F8C -sub_80E3F8C: @ 80E3F8C - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_0858C0C0 - movs r1, 0xCC - movs r2, 0x58 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e24 - adds r1, r2 - strb r0, [r1] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r0, =gSprites - mov r8, r0 - add r5, r8 - ldr r1, =gUnknown_0858C050 - adds r0, r5, 0 - bl SetSubspriteTables - adds r1, r5, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r6, 0x4 - orrs r0, r6 - strb r0, [r1] - ldr r0, =gUnknown_0858C0F0 - movs r1, 0xCC - movs r2, 0x54 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x3A] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - add r4, r8 - ldr r1, =gUnknown_0858C058 - adds r0, r4, 0 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - orrs r0, r6 - strb r0, [r4] - ldr r0, =gUnknown_0858C0D8 - movs r1, 0xCC - movs r2, 0x53 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldrb r3, [r2, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r6 - strb r1, [r2, 0x5] - strh r0, [r5, 0x3C] - adds r2, 0x3E - ldrb r0, [r2] - orrs r0, r6 - strb r0, [r2] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E3F8C - - thumb_func_start sub_80E4050 -sub_80E4050: @ 80E4050 - ldr r0, =gUnknown_02039F94 - ldr r2, [r0] - ldr r1, =0x00001e24 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x2 - strh r1, [r0, 0x2E] - ldr r1, =0x00001e22 - adds r2, r1 - ldrb r1, [r2] - strh r1, [r0, 0x30] - bx lr - .pool - thumb_func_end sub_80E4050 - - thumb_func_start sub_80E4084 -sub_80E4084: @ 80E4084 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =gUnknown_0858BEE8 -_080E408A: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080E408A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4084 - - thumb_func_start sub_80E40AC -sub_80E40AC: @ 80E40AC - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x3A - ldrsh r0, [r6, r1] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r1, =gSprites - adds r5, r1 - movs r2, 0x3C - ldrsh r0, [r6, r2] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r1 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e22 - adds r0, r1 - ldrb r0, [r0] - bl sub_80E3244 - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_80E41B8 - ldrh r0, [r6, 0x2E] - adds r0, 0x1 - strh r0, [r6, 0x2E] - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E40AC - - thumb_func_start sub_80E4100 -sub_80E4100: @ 80E4100 - movs r0, 0 - bx lr - thumb_func_end sub_80E4100 - - thumb_func_start sub_80E4104 -sub_80E4104: @ 80E4104 - push {r4,r5,lr} - adds r3, r0, 0 - movs r0, 0x3A - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r2, =gSprites - adds r4, r0, r2 - movs r0, 0x3C - ldrsh r1, [r3, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080E4168 - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] - ldr r0, =0x0000fffc - strh r0, [r4, 0x26] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldrh r0, [r3, 0x30] - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - bl __modsi3 - lsls r0, 24 - lsrs r0, 24 - bl sub_80E3244 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_80E41B8 -_080E4168: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4104 - - thumb_func_start sub_80E4178 -sub_80E4178: @ 80E4178 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - ldrh r0, [r2, 0x26] - adds r0, 0x1 - strh r0, [r2, 0x26] - lsls r0, 16 - cmp r0, 0 - blt _080E41AC - movs r0, 0 - strh r0, [r2, 0x26] - movs r0, 0x1 - strh r0, [r4, 0x2E] -_080E41AC: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4178 - - thumb_func_start sub_80E41B8 -sub_80E41B8: @ 80E41B8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - adds r6, r1, 0 - mov r8, r2 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_0858BEF8 - lsls r4, r5, 1 - adds r0, r4, r0 - ldrh r0, [r0] - bl IndexOfSpritePaletteTag - lsls r0, 4 - mov r1, r8 - ldrb r2, [r1, 0x5] - movs r1, 0xF - ands r1, r2 - orrs r1, r0 - mov r0, r8 - strb r1, [r0, 0x5] - ldr r0, =gUnknown_0858BEFE - adds r4, r0 - ldrh r0, [r4] - bl GetSpriteTileStartByTag - adds r1, r6, 0 - adds r1, 0x40 - strh r0, [r1] - adds r6, 0x42 - movs r1, 0x3F - ands r1, r5 - ldrb r2, [r6] - movs r0, 0x40 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E41B8 - - thumb_func_start sub_80E4218 -sub_80E4218: @ 80E4218 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r0, =gUnknown_0858C108 - movs r1, 0xCC - movs r2, 0x74 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r6, =gSprites - adds r4, r6 - ldr r0, =gUnknown_0858C070 - mov r8, r0 - adds r0, r4, 0 - mov r1, r8 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - movs r5, 0x4 - orrs r0, r5 - strb r0, [r4] - ldr r0, =gUnknown_0858C120 - movs r1, 0xCC - movs r2, 0x8C - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r6 - adds r0, r4, 0 - mov r1, r8 - bl SetSubspriteTables - adds r4, 0x3E - ldrb r0, [r4] - orrs r0, r5 - strb r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4218 - - thumb_func_start sub_80E4290 -sub_80E4290: @ 80E4290 - push {r4-r6,lr} - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e16 - adds r0, r4 - ldrh r1, [r0] - subs r1, 0x5 - ldr r0, =gUnknown_0858C150 - lsls r1, 16 - asrs r1, 16 - movs r2, 0x38 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - ldr r3, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r5] - adds r4, r0, r4 - ldrh r1, [r4] - movs r5, 0 - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r5, r0 - bcs _080E4334 - adds r6, r3, 0 -_080E42E2: - lsls r1, 16 - asrs r4, r1, 16 - movs r0, 0xC0 - lsls r0, 10 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_0858C168 - movs r2, 0x3C - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - strh r5, [r0, 0x2E] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - adds r4, 0x8 - lsls r4, 16 - lsrs r1, r4, 16 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r5, r0 - bcc _080E42E2 -_080E4334: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4290 - - thumb_func_start sub_80E4354 -sub_80E4354: @ 80E4354 - push {lr} - ldr r1, =gUnknown_0858BF04 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4354 - - thumb_func_start TaskDummy2 -TaskDummy2: @ 80E4380 - bx lr - thumb_func_end TaskDummy2 - - thumb_func_start sub_80E4384 -sub_80E4384: @ 80E4384 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e34 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0 - bl sub_808BD3C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =SpriteCallbackDummy - movs r2, 0 - str r2, [sp] - movs r2, 0x38 - movs r3, 0x25 - bl AddPseudoFieldObject - 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 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x4 - bl StartSpriteAnim - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4384 - - thumb_func_start sub_80E43E0 -sub_80E43E0: @ 80E43E0 - push {r4,lr} - ldr r0, =gUnknown_0858C180 - movs r1, 0x38 - movs r2, 0x29 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - ldr r1, =gUnknown_0858C078 - adds r0, r4, 0 - bl SetSubspriteTables - ldrb r0, [r4, 0x5] - movs r1, 0xC - orrs r0, r1 - strb r0, [r4, 0x5] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E43E0 - - thumb_func_start sub_80E4420 -sub_80E4420: @ 80E4420 - push {lr} - sub sp, 0xC - bl sub_80D2F04 - ldr r0, =gUnknown_02039F94 - ldr r3, [r0] - ldr r1, =0x00001e34 - adds r0, r3, r1 - ldrh r0, [r0] - ldr r1, =SpriteCallbackDummy - movs r2, 0 - str r2, [sp] - ldr r2, =0x00001e38 - adds r3, r2 - ldr r2, [r3] - str r2, [sp, 0x4] - movs r2, 0x1 - str r2, [sp, 0x8] - movs r2, 0x38 - movs r3, 0x28 - bl sub_80D2CC4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x5] - movs r2, 0xC - orrs r0, r2 - strb r0, [r1, 0x5] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4420 - - thumb_func_start sub_80E447C -sub_80E447C: @ 80E447C - push {lr} - sub sp, 0x4 - ldr r1, =SpriteCallbackDummy - movs r0, 0 - str r0, [sp] - movs r0, 0x13 - movs r2, 0x38 - movs r3, 0x25 - bl AddPseudoFieldObject - 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 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0x4 - bl StartSpriteAnim - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E447C - - thumb_func_start sub_80E44BC -sub_80E44BC: @ 80E44BC - push {r4,r5,lr} - bl sub_80E460C - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_80E3F30 - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0x8 - bne _080E44DA - bl sub_80E45E0 - b _080E44F6 -_080E44DA: - cmp r4, 0x6 - bne _080E44E4 - bl sub_80E4AF8 - b _080E4504 -_080E44E4: - cmp r5, 0x9 - beq _080E4500 - ldr r1, =gUnknown_0858BF18 - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 -_080E44F6: - lsls r0, 24 - lsrs r0, 24 - b _080E4506 - .pool -_080E4500: - bl sub_80E3E28 -_080E4504: - movs r0, 0 -_080E4506: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80E44BC - - thumb_func_start sub_80E450C -sub_80E450C: @ 80E450C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - bne _080E4546 - bl sub_80E4B54 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80E3ED8 - cmp r4, 0 - beq _080E4546 - movs r0, 0x2 - bl sub_80E4630 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x3 - strb r1, [r0] -_080E4546: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E450C - - thumb_func_start sub_80E4558 -sub_80E4558: @ 80E4558 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - beq _080E4572 - movs r0, 0 - b _080E457A -_080E4572: - bl sub_80E45E0 - lsls r0, 24 - lsrs r0, 24 -_080E457A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4558 - - thumb_func_start sub_80E4580 -sub_80E4580: @ 80E4580 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - bne _080E459A - bl sub_80E4AF8 -_080E459A: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4580 - - thumb_func_start sub_80E45A4 -sub_80E45A4: @ 80E45A4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - movs r1, 0x1 - movs r2, 0 - bl sub_80E3948 - cmp r4, 0x5 - beq _080E45BE - movs r0, 0 - b _080E45D2 -_080E45BE: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x6 - strb r1, [r0] - movs r0, 0x1 -_080E45D2: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E45A4 - - thumb_func_start sub_80E45E0 -sub_80E45E0: @ 80E45E0 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r1, =0x00001e10 - adds r0, r1 - movs r1, 0x4 - strb r1, [r0] - movs r0, 0x1 - bx lr - .pool - thumb_func_end sub_80E45E0 - - thumb_func_start sub_80E45F8 -sub_80E45F8: @ 80E45F8 - push {lr} - ldr r0, =sub_80E465C - movs r1, 0x1 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E45F8 - - thumb_func_start sub_80E460C -sub_80E460C: @ 80E460C - push {lr} - ldr r0, =sub_80E465C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrb r0, [r1, 0xA] - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E460C - - thumb_func_start sub_80E4630 -sub_80E4630: @ 80E4630 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80E465C - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4630 - - thumb_func_start sub_80E465C -sub_80E465C: @ 80E465C - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gUnknown_0858BF28 - ldr r2, =gTasks - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r2, 0x8 - ldrsh r1, [r0, r2] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl _call_via_r1 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E465C - - thumb_func_start sub_80E468C -sub_80E468C: @ 80E468C - movs r1, 0 - strh r1, [r0, 0xA] - bx lr - thumb_func_end sub_80E468C - - thumb_func_start sub_80E4692 -sub_80E4692: @ 80E4692 - push {lr} - adds r2, r0, 0 - movs r0, 0 - strh r0, [r2, 0xA] - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080E46B4 - movs r0, 0x5 - strh r0, [r2, 0xA] - b _080E46E4 - .pool -_080E46B4: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080E46C2 - movs r0, 0x6 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46C2: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080E46D0 - movs r0, 0x8 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46D0: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _080E46DE - movs r0, 0x9 - strh r0, [r2, 0xA] - b _080E46E4 -_080E46DE: - adds r0, r2, 0 - bl sub_80E46F0 -_080E46E4: - pop {r0} - bx r0 - thumb_func_end sub_80E4692 - - thumb_func_start sub_80E46E8 -sub_80E46E8: @ 80E46E8 - movs r1, 0 - strh r1, [r0, 0xA] - bx lr - thumb_func_end sub_80E46E8 - - thumb_func_start sub_80E46F0 -sub_80E46F0: @ 80E46F0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - mov r9, r0 - ldr r1, =gUnknown_0858BF34 - mov r0, sp - movs r2, 0xA - bl memcpy - add r0, sp, 0xC - mov r10, r0 - ldr r1, =gUnknown_0858BF3E - movs r2, 0xA - bl memcpy - mov r1, sp - adds r1, 0x18 - str r1, [sp, 0x2C] - ldr r1, =gUnknown_0858BF48 - ldr r0, [sp, 0x2C] - movs r2, 0x8 - bl memcpy - mov r2, sp - adds r2, 0x20 - str r2, [sp, 0x30] - ldr r1, =gUnknown_0858BF50 - adds r0, r2, 0 - movs r2, 0x6 - bl memcpy - add r4, sp, 0x28 - mov r5, sp - adds r5, 0x2A - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80E3DFC - ldr r0, =gMain - ldrh r2, [r0, 0x30] - movs r0, 0x40 - ands r0, r2 - lsls r0, 16 - lsrs r0, 16 - negs r0, r0 - lsrs r1, r0, 31 - movs r0, 0x80 - ands r0, r2 - adds r6, r4, 0 - cmp r0, 0 - beq _080E475E - movs r1, 0x2 -_080E475E: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _080E4768 - movs r1, 0x3 -_080E4768: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _080E4772 - movs r1, 0x4 -_080E4772: - ldrh r0, [r6] - mov r8, r0 - lsls r1, 1 - mov r2, sp - adds r7, r2, r1 - ldrh r0, [r7] - add r0, r8 - strh r0, [r6] - add r1, r10 - ldrh r0, [r1] - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - movs r2, 0 - ldrsh r0, [r6, r2] - cmp r0, 0 - bge _080E479E - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] -_080E479E: - movs r0, 0 - ldrsh r4, [r6, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - ble _080E47B2 - movs r0, 0 - strh r0, [r6] -_080E47B2: - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _080E481E - movs r2, 0 - ldrsh r4, [r6, r2] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E47F0 - ldrh r0, [r5] - mov r1, r9 - strh r0, [r1, 0xC] - movs r2, 0 - ldrsh r0, [r5, r2] - lsls r0, 1 - ldr r1, [sp, 0x2C] - adds r0, r1, r0 - b _080E481A - .pool -_080E47F0: - mov r2, r8 - lsls r4, r2, 16 - asrs r4, 16 - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E481E - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - bne _080E4810 - mov r2, r9 - ldrh r0, [r2, 0xC] - b _080E481C -_080E4810: - movs r1, 0 - ldrsh r0, [r5, r1] - lsls r0, 1 - ldr r2, [sp, 0x30] - adds r0, r2, r0 -_080E481A: - ldrh r0, [r0] -_080E481C: - strh r0, [r5] -_080E481E: - movs r0, 0 - ldrsh r4, [r6, r0] - bl sub_80E3F70 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080E4860 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _080E483A - movs r0, 0x2 - strh r0, [r5] -_080E483A: - movs r2, 0 - ldrsh r0, [r5, r2] - cmp r0, 0x2 - ble _080E4846 - movs r0, 0 - strh r0, [r5] -_080E4846: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _080E4856 - movs r0, 0x1 - mov r2, r9 - strh r0, [r2, 0xC] - b _080E4878 -_080E4856: - cmp r0, 0x2 - bne _080E4878 - mov r1, r9 - strh r0, [r1, 0xC] - b _080E4878 -_080E4860: - movs r2, 0 - ldrsh r0, [r5, r2] - cmp r0, 0 - bge _080E486C - movs r0, 0x3 - strh r0, [r5] -_080E486C: - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x3 - ble _080E4878 - movs r0, 0 - strh r0, [r5] -_080E4878: - movs r2, 0 - ldrsh r0, [r6, r2] - movs r2, 0 - ldrsh r1, [r5, r2] - bl sub_80E3D78 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80E46F0 - - thumb_func_start sub_80E4894 -sub_80E4894: @ 80E4894 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e14 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r1, [r5] - adds r0, r1, r4 - ldrb r0, [r0] - ldr r2, =0x00001e28 - adds r1, r2 - ldr r1, [r1] - ldr r2, [r1, 0x8] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4894 - - thumb_func_start sub_80E48E8 -sub_80E48E8: @ 80E48E8 - push {r4,r5,lr} - sub sp, 0x2C - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e34 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - add r0, sp, 0xC - bl StringCopy - ldr r0, [r5] - ldr r1, =0x00001e28 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x8] - add r0, sp, 0xC - movs r2, 0xF - bl StringAppendN - ldr r0, [r5] - ldr r4, =0x00001e14 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - movs r3, 0x8 - bl PrintTextOnWindow - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - add sp, 0x2C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E48E8 - - thumb_func_start sub_80E4964 -sub_80E4964: @ 80E4964 - push {lr} - ldr r1, =gUnknown_0858BF58 - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e2c - adds r0, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4964 - - thumb_func_start sub_80E498C -sub_80E498C: @ 80E498C - push {lr} - ldr r1, =gUnknown_0858BF6C - ldr r0, =gUnknown_02039F94 - ldr r0, [r0] - ldr r2, =0x00001e28 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E498C - - thumb_func_start TaskDummy3 -TaskDummy3: @ 80E49B8 - bx lr - thumb_func_end TaskDummy3 - - thumb_func_start sub_80E49BC -sub_80E49BC: @ 80E49BC - push {r4,r5,lr} - sub sp, 0x10 - movs r4, 0 - ldr r1, =gText_MaleSymbol - add r0, sp, 0xC - bl StringCopy - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e36 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0xFF - beq _080E4A0C - cmp r0, 0xFE - bne _080E49E6 - ldr r1, =gText_FemaleSymbol - add r0, sp, 0xC - bl StringCopy - movs r4, 0x1 -_080E49E6: - ldr r0, [r5] - ldr r1, =0x00001e13 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r4, 1 - adds r1, r4 - ldr r2, =gUnknown_0858BF74 - adds r1, r2 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - add r1, sp, 0xC - str r1, [sp, 0x8] - movs r1, 0x1 - movs r2, 0x68 - movs r3, 0x1 - bl box_print -_080E4A0C: - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E49BC - - thumb_func_start sub_80E4A2C -sub_80E4A2C: @ 80E4A2C - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - ldr r6, =gUnknown_0858BE40 - bl sub_80E3274 - lsls r4, 16 - asrs r4, 16 - lsls r5, 16 - asrs r5, 13 - adds r4, r5 - lsls r0, 24 - lsrs r0, 19 - adds r4, r0 - adds r4, r6 - ldrb r0, [r4] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4A2C - - thumb_func_start sub_80E4A60 -sub_80E4A60: @ 80E4A60 - push {r4,r5,lr} - movs r2, 0 - ldr r0, =gUnknown_02039F94 - ldr r4, [r0] - ldr r3, =0x00001e28 - adds r1, r4, r3 - ldr r1, [r1] - ldrb r3, [r1, 0x1] - adds r5, r0, 0 - cmp r2, r3 - bcs _080E4A9A - movs r0, 0xC0 - lsls r0, 5 - adds r1, r4, r0 -_080E4A7C: - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080E4A90 - adds r0, r2, 0 - b _080E4AAA - .pool -_080E4A90: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r3 - bcc _080E4A7C -_080E4A9A: - ldr r0, [r5] - ldr r1, =0x00001e28 - adds r0, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_080E4AAA: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E4A60 - - thumb_func_start sub_80E4AB4 -sub_80E4AB4: @ 80E4AB4 - push {lr} - ldr r0, =gUnknown_02039F94 - ldr r2, [r0] - ldr r1, =0x00001e28 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - subs r0, 0x1 - lsls r1, r0, 24 - cmp r1, 0 - ble _080E4AF0 - movs r0, 0xC0 - lsls r0, 5 - adds r3, r2, r0 -_080E4AD0: - asrs r2, r1, 24 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0xFF - beq _080E4AE8 - lsrs r0, r1, 24 - b _080E4AF2 - .pool -_080E4AE8: - subs r0, r2, 0x1 - lsls r1, r0, 24 - cmp r1, 0 - bgt _080E4AD0 -_080E4AF0: - movs r0, 0 -_080E4AF2: - pop {r1} - bx r1 - thumb_func_end sub_80E4AB4 - - thumb_func_start sub_80E4AF8 -sub_80E4AF8: @ 80E4AF8 - push {r4-r6,lr} - bl sub_80E4AB4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_02039F94 - ldr r0, [r6] - movs r5, 0xC0 - lsls r5, 5 - adds r0, r5 - adds r0, r4 - movs r1, 0 - strb r1, [r0] - bl sub_80E4D10 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - adds r0, r5 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] - bl sub_80E3F30 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080E4B38 - cmp r0, 0x2 - bne _080E4B42 -_080E4B38: - movs r0, 0x1 - movs r1, 0 - movs r2, 0x1 - bl sub_80E3948 -_080E4B42: - movs r0, 0x17 - bl PlaySE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4AF8 - - thumb_func_start sub_80E4B54 -sub_80E4B54: @ 80E4B54 - push {r4,lr} - sub sp, 0x4 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl sub_80E3DFC - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl sub_80E4A2C - lsls r0, 24 - lsrs r0, 24 - bl sub_80E4BBC - bl sub_80E4D10 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x5 - bl PlaySE - bl sub_80E4AB4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - ldr r2, =0x00001e28 - adds r1, r2 - ldr r1, [r1] - ldrb r1, [r1, 0x1] - subs r1, 0x1 - cmp r0, r1 - bne _080E4BB0 - movs r0, 0x1 - b _080E4BB2 - .pool -_080E4BB0: - movs r0, 0 -_080E4BB2: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80E4B54 - - thumb_func_start sub_80E4BBC -sub_80E4BBC: @ 80E4BBC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80E4A60 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039F94 - ldr r1, [r1] - movs r2, 0xC0 - lsls r2, 5 - adds r1, r2 - adds r1, r0 - strb r4, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4BBC - - thumb_func_start sub_80E4BE4 -sub_80E4BE4: @ 80E4BE4 - push {r4,r5,lr} - movs r2, 0 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r4, =0x00001e28 - adds r0, r4 - ldr r0, [r0] - adds r5, r1, 0 - b _080E4C44 - .pool -_080E4C00: - ldr r1, [r1] - movs r0, 0xC0 - lsls r0, 5 - adds r3, r1, r0 - adds r0, r3, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080E4C34 - cmp r0, 0xFF - beq _080E4C34 - ldr r2, =0x00001e30 - adds r0, r1, r2 - ldr r0, [r0] - adds r1, r4 - ldr r1, [r1] - ldrb r2, [r1, 0x1] - adds r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - adds r1, r3, 0 - bl StringCopyN - b _080E4C4A - .pool -_080E4C34: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r1, r5, 0 - ldr r0, [r1] - ldr r4, =0x00001e28 - adds r0, r4 - ldr r0, [r0] -_080E4C44: - ldrb r0, [r0, 0x1] - cmp r2, r0 - bcc _080E4C00 -_080E4C4A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4BE4 - - thumb_func_start choose_name_or_words_screen_load_bg_tile_patterns -choose_name_or_words_screen_load_bg_tile_patterns: @ 80E4C54 - push {r4-r6,lr} - ldr r0, =gNamingScreenMenu_Gfx - ldr r6, =gUnknown_02039F94 - ldr r1, [r6] - ldr r4, =0x00001810 - adds r1, r4 - bl LZ77UnCompWram - ldr r1, [r6] - adds r1, r4 - movs r5, 0xC0 - lsls r5, 3 - movs r0, 0x1 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r6] - adds r1, r4 - movs r0, 0x2 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r1, [r6] - adds r1, r4 - movs r0, 0x3 - adds r2, r5, 0 - movs r3, 0 - bl LoadBgTiles - ldr r0, =gUnknown_0858C1C8 - bl LoadSpriteSheets - ldr r0, =gUnknown_0858C230 - bl LoadSpritePalettes - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_load_bg_tile_patterns - - thumb_func_start sub_80E4CB8 -sub_80E4CB8: @ 80E4CB8 - push {lr} - bl sub_80E45F8 - bl sub_80E3920 - pop {r0} - bx r0 - thumb_func_end sub_80E4CB8 - - thumb_func_start choose_name_or_words_screen_apply_bg_pals -choose_name_or_words_screen_apply_bg_pals: @ 80E4CC8 - push {lr} - ldr r0, =gNamingScreenMenu_Pal - movs r1, 0 - movs r2, 0xC0 - bl LoadPalette - ldr r0, =gUnknown_0858BD78 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0x2 - bl stdpal_get - movs r1, 0xB0 - movs r2, 0x20 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end choose_name_or_words_screen_apply_bg_pals - - thumb_func_start sub_80E4CF8 -sub_80E4CF8: @ 80E4CF8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - pop {r0} - bx r0 - thumb_func_end sub_80E4CF8 - - thumb_func_start nullsub_10 -nullsub_10: @ 80E4D0C - bx lr - thumb_func_end nullsub_10 - - thumb_func_start sub_80E4D10 -sub_80E4D10: @ 80E4D10 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r7, =gUnknown_02039F94 - ldr r1, [r7] - ldr r2, =0x00001e28 - adds r0, r1, r2 - ldr r0, [r0] - ldrb r6, [r0, 0x1] - subs r2, 0x12 - adds r0, r1, r2 - ldrh r0, [r0] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldr r0, =0x00001e13 - adds r1, r0 - ldrb r0, [r1] - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r4, 0 - cmp r4, r6 - bcs _080E4DA6 - add r5, sp, 0xC - mov r10, r4 - ldr r0, =gExpandedPlaceholder_Empty - ldrb r0, [r0] - mov r8, r0 -_080E4D52: - ldr r0, [r7] - movs r1, 0xC0 - lsls r1, 5 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - strb r0, [r5] - mov r2, r8 - strb r2, [r5, 0x1] - ldrb r0, [r5] - bl sub_80E503C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r0, 0x1 - bne _080E4D76 - movs r1, 0x2 -_080E4D76: - ldr r0, [r7] - ldr r2, =0x00001e13 - adds r0, r2 - ldrb r0, [r0] - lsls r3, r4, 3 - add r3, r9 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl PrintTextOnWindow - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _080E4D52 -_080E4DA6: - bl sub_80E498C - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e13 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4D10 - - thumb_func_start sub_80E4DE4 -sub_80E4DE4: @ 80E4DE4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_0858BF88 - adds r0, r5, r0 - ldrb r1, [r0] - adds r0, r6, 0 - bl FillWindowPixelBuffer - movs r4, 0 - ldr r1, =gUnknown_0858BF8C - lsls r0, r5, 2 - adds r0, r1 - ldr r7, [r0] - ldr r0, =gUnknown_0858C198 - mov r8, r0 -_080E4E0E: - lsls r3, r4, 4 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r7, [sp] - movs r0, 0 - str r0, [sp, 0x4] - lsls r0, r4, 2 - lsls r1, r5, 4 - adds r0, r1 - add r0, r8 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x1 - movs r2, 0 - bl box_print - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _080E4E0E - adds r0, r6, 0 - bl PutWindowTilemap - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4DE4 - - thumb_func_start sub_80E4E5C -sub_80E4E5C: @ 80E4E5C - push {r4-r6,lr} - movs r0, 0xA - bl GetGpuReg - adds r4, r0, 0 - movs r5, 0x3 - ands r4, r5 - movs r0, 0xC - bl GetGpuReg - ands r0, r5 - cmp r4, r0 - bls _080E4E8C - movs r5, 0x1 - movs r6, 0x1 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r2, =0x00001e11 - b _080E4E96 - .pool -_080E4E8C: - movs r5, 0x2 - movs r6, 0x2 - ldr r1, =gUnknown_02039F94 - ldr r0, [r1] - ldr r2, =0x00001e12 -_080E4E96: - adds r0, r2 - ldrb r4, [r0] - adds r0, r1, 0 - ldr r1, =gUnknown_0858BF98 - ldr r0, [r0] - ldr r2, =0x00001e22 - adds r0, r2 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl sub_80E4CF8 - bl sub_80E3254 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80E4DE4 - bl sub_80E3254 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl nullsub_10 - adds r0, r6, 0 - bl CopyBgTilemapBufferToVram - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4E5C - - thumb_func_start sub_80E4EF0 -sub_80E4EF0: @ 80E4EF0 - push {r4,r5,lr} - sub sp, 0x10 - ldr r1, =gUnknown_0858BFA4 - add r0, sp, 0xC - movs r2, 0x3 - bl memcpy - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r4, =0x00001e15 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - add r1, sp, 0xC - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gText_MoveOkBack - str r1, [sp, 0x8] - movs r1, 0 - movs r2, 0x2 - movs r3, 0x1 - bl box_print - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4EF0 - - thumb_func_start sub_80E4F58 -sub_80E4F58: @ 80E4F58 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80E4F58 - - thumb_func_start sub_80E4F70 -sub_80E4F70: @ 80E4F70 - push {lr} - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - pop {r0} - bx r0 - thumb_func_end sub_80E4F70 - - thumb_func_start sub_80E4F84 -sub_80E4F84: @ 80E4F84 - push {lr} - ldr r0, =sub_80E4F94 - bl SetVBlankCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4F84 - - thumb_func_start sub_80E4F94 -sub_80E4F94: @ 80E4F94 - push {r4,r5,lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - ldr r5, =gUnknown_02039F94 - ldr r0, [r5] - ldr r1, =0x00001e18 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1a - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - movs r0, 0xA - bl GetGpuReg - ldr r4, =0x0000fffc - adds r1, r4, 0 - ands r1, r0 - movs r0, 0xA - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1c - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xA - bl SetGpuRegBits - movs r0, 0xC - bl GetGpuReg - ands r4, r0 - movs r0, 0xC - adds r1, r4, 0 - bl SetGpuReg - ldr r0, [r5] - ldr r1, =0x00001e1e - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xC - bl SetGpuRegBits - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E4F94 - - thumb_func_start sub_80E501C -sub_80E501C: @ 80E501C - push {lr} - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - pop {r0} - bx r0 - thumb_func_end sub_80E501C - - thumb_func_start sub_80E503C -sub_80E503C: @ 80E503C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0 - ldr r0, =gUnknown_0858BDC8 - ldrb r1, [r0] - adds r3, r0, 0 - cmp r1, 0xFF - beq _080E5066 - adds r1, r3, 0 -_080E5050: - adds r0, r2, r1 - ldrb r0, [r0] - cmp r4, r0 - beq _080E5066 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080E5050 -_080E5066: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80E503C - - thumb_func_start sub_80E5074 -sub_80E5074: @ 80E5074 - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E5074 - - thumb_func_start sub_80E509C -sub_80E509C: @ 80E509C - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E509C - - thumb_func_start sub_80E50C4 -sub_80E50C4: @ 80E50C4 - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E50C4 - - thumb_func_start sub_80E50EC -sub_80E50EC: @ 80E50EC - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldrb r2, [r1, 0x8] - movs r0, 0 - str r0, [sp] - ldr r0, =sub_8086194 - str r0, [sp, 0x4] - movs r0, 0x3 - movs r3, 0 - bl DoNamingScreen - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E50EC - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/new_menu_helpers.s b/asm/new_menu_helpers.s index 25f7fe605..5089ae909 100644 --- a/asm/new_menu_helpers.s +++ b/asm/new_menu_helpers.s @@ -95,9 +95,9 @@ sub_8197224: @ 8197224 bx r1 thumb_func_end sub_8197224 - thumb_func_start AddTextPrinterParametrized -@ u16 AddTextPrinterParametrized(u8 windowId, u8 fontId, u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor) -AddTextPrinterParametrized: @ 8197238 + thumb_func_start AddTextPrinterParameterized +@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor) +AddTextPrinterParameterized: @ 8197238 push {r4-r7,lr} mov r7, r8 push {r7} @@ -166,7 +166,7 @@ AddTextPrinterParametrized: @ 8197238 pop {r1} bx r1 .pool - thumb_func_end AddTextPrinterParametrized + thumb_func_end AddTextPrinterParameterized thumb_func_start AddTextPrinterForMessage @ void AddTextPrinterForMessage(u8 allowSkippingDelayWithButtonPress) @@ -198,7 +198,7 @@ AddTextPrinterForMessage: @ 81972C4 str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4,r5} pop {r0} @@ -236,7 +236,7 @@ AddTextPrinterForMessage_2: @ 8197310 str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4} pop {r0} @@ -273,7 +273,7 @@ AddTextPrinterWithCustomSpeedForMessage: @ 819735C str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4,r5} pop {r0} diff --git a/asm/option_menu.s b/asm/option_menu.s deleted file mode 100644 index c3fc4d140..000000000 --- a/asm/option_menu.s +++ /dev/null @@ -1,10 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/overworld.s b/asm/overworld.s index 69751d298..64ee678df 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -1383,7 +1383,7 @@ _080850C8: adds r1, r5, 0 bl TryUpdateRandomTrainerRematches bl DoTimeBasedEvents - bl sub_80AEDBC + bl SetSav1WeatherFromCurrMapHeader bl sub_8085B2C bl update_sav1_flash_used_on_map bl Overworld_ClearSavedMusic @@ -1483,7 +1483,7 @@ _080851A2: beq _080851EE bl DoTimeBasedEvents _080851EE: - bl sub_80AEDBC + bl SetSav1WeatherFromCurrMapHeader bl sub_8085B2C cmp r5, 0 beq _08085200 @@ -3637,7 +3637,7 @@ VBlankCB_Field: @ 8086390 push {lr} bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer bl FieldUpdateBgTilemapScroll bl TransferPlttBuffer bl TransferTilesetAnimsBuffer @@ -3657,7 +3657,7 @@ sub_80863B0: @ 80863B0 ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams b _080863F0 .pool _080863D4: @@ -3671,7 +3671,7 @@ _080863D4: ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams _080863F0: pop {r0} bx r0 @@ -4294,7 +4294,7 @@ sub_8086988: @ 8086988 bl ResetTasks bl ResetSpriteData bl ResetPaletteFade - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl dp13_810BB8C bl ResetCameraUpdateInfo bl InstallCameraPanAheadCallback @@ -6698,7 +6698,7 @@ _08087C38: lsls r1, 30 lsrs r1, 31 movs r0, 0 - bl sub_808BD3C + bl GetRivalAvatarGraphicsIdByStateIdAndGender _08087C44: lsls r0, 24 lsrs r0, 24 diff --git a/asm/party_menu.s b/asm/party_menu.s index 730e90932..0dc03a1e2 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -4268,7 +4268,7 @@ _081B243E: adds r0, r4, 0 movs r1, 0 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 adds r0, r4, 0 bl PutWindowTilemap adds r0, r4, 0 @@ -5946,7 +5946,7 @@ _081B328C: str r1, [sp, 0x10] movs r1, 0x1 mov r2, r9 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -6007,7 +6007,7 @@ sub_81B3300: @ 81B3300 movs r0, 0x6 movs r1, 0x1 adds r2, r4, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4} pop {r0} @@ -10415,7 +10415,7 @@ party_menu_link_mon_icon_anim: @ 81B5A2C ldr r0, [sp, 0x20] str r0, [sp, 0x8] adds r0, r5, 0 - bl sub_80D2CC4 + bl CreateMonIcon strb r0, [r4, 0x9] ldr r2, =gSprites ldrb r0, [r4, 0x9] @@ -17171,7 +17171,7 @@ sub_81B9404: @ 81B9404 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B9424 movs r1, 0xA bl CreateTask @@ -17247,7 +17247,7 @@ sub_81B94B0: @ 81B94B0 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B94D0 movs r1, 0xA bl CreateTask @@ -17297,7 +17297,7 @@ sub_81B951C: @ 81B951C bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B953C movs r1, 0xA bl CreateTask @@ -17418,7 +17418,7 @@ sub_81B9620: @ 81B9620 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81B9640 movs r1, 0xA bl CreateTask diff --git a/asm/player_pc.s b/asm/player_pc.s index 5f32a00c2..5d9314f80 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -552,7 +552,7 @@ sub_816B2C8: @ 816B2C8 str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 .pool @@ -1221,7 +1221,7 @@ sub_816B878: @ 816B878 lsrs r4, 24 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r1, =gTasks lsls r0, r4, 2 adds r0, r4 @@ -1494,7 +1494,7 @@ sub_816BABC: @ 816BABC _0816BAD4: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =gTasks lsls r1, r4, 2 adds r1, r4 @@ -2150,7 +2150,7 @@ _0816C030: movs r1, 0x1 movs r2, 0 adds r3, r6, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 _0816C050: add sp, 0x14 pop {r4-r6} diff --git a/asm/pokedex.s b/asm/pokedex.s index 8da7d6df0..cb40f0eda 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -3035,7 +3035,7 @@ sub_80BCE2C: @ 80BCE2C str r4, [sp, 0xC] str r2, [sp, 0x10] mov r2, r8 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r3} mov r8, r3 @@ -6163,7 +6163,7 @@ sub_80BE8DC: @ 80BE8DC movs r0, 0 movs r1, 0x1 adds r2, r5, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r4,r5} pop {r0} @@ -9974,7 +9974,7 @@ sub_80C0A88: @ 80C0A88 str r4, [sp, 0xC] str r1, [sp, 0x10] movs r1, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r4-r6} pop {r0} @@ -11022,7 +11022,7 @@ sub_80C1270: @ 80C1270 movs r0, 0 movs r1, 0x1 adds r2, r5, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r4,r5} pop {r0} diff --git a/asm/pokemon_animation.s b/asm/pokemon_animation.s deleted file mode 100644 index a625f8511..000000000 --- a/asm/pokemon_animation.s +++ /dev/null @@ -1,11782 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start nullsub_69 -nullsub_69: @ 817F3EC - bx lr - thumb_func_end nullsub_69 - - thumb_func_start sub_817F3F0 -sub_817F3F0: @ 817F3F0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x4 - mov r9, r0 - mov r8, r1 - adds r5, r2, 0 - adds r4, r3, 0 - lsls r5, 16 - negs r5, r5 - lsls r4, 16 - negs r4, r4 - lsrs r4, 16 - mov r0, r8 - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - asrs r5, 16 - adds r1, r5, 0 - bl Cos - adds r6, r0, 0 - lsls r4, 16 - asrs r4, 16 - mov r0, r8 - adds r1, r4, 0 - bl Sin - subs r6, r0 - lsls r6, 16 - lsrs r6, 16 - mov r0, r8 - adds r1, r4, 0 - bl Cos - adds r2, r0, 0 - mov r0, r8 - adds r1, r5, 0 - str r2, [sp] - bl Sin - ldr r2, [sp] - adds r2, r0 - negs r5, r5 - negs r4, r4 - lsls r6, 16 - asrs r6, 16 - lsls r5, 16 - asrs r5, 16 - adds r6, r5 - mov r0, r9 - strh r6, [r0, 0x24] - lsls r2, 16 - asrs r2, 16 - lsls r4, 16 - asrs r4, 16 - adds r2, r4 - strh r2, [r0, 0x26] - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817F3F0 - - thumb_func_start GetSpeciesBackAnimId -GetSpeciesBackAnimId: @ 817F474 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =gUnknown_0860A8C8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _0817F48C - movs r0, 0 - b _0817F492 - .pool -_0817F48C: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_0817F492: - pop {r1} - bx r1 - thumb_func_end GetSpeciesBackAnimId - - thumb_func_start sub_817F498 -sub_817F498: @ 817F498 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r6, r5, 2 - adds r0, r6, r5 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0xA - ldrsh r0, [r2, r3] - lsls r3, r0, 16 - movs r4, 0xC - ldrsh r0, [r2, r4] - orrs r3, r0 - movs r0, 0x8 - ldrsh r4, [r2, r0] - mov r8, r1 - ldr r0, =SpriteCallbackDummy - mov r12, r0 - cmp r4, 0 - bne _0817F508 - ldrh r0, [r3, 0x2E] - strh r0, [r2, 0x10] - ldrh r0, [r3, 0x32] - strh r0, [r2, 0x12] - movs r0, 0x1 - strh r0, [r3, 0x30] - strh r4, [r3, 0x2E] - movs r0, 0x2 - adds r1, r6, 0 - ldr r6, =gUnknown_0860AA88 - ldr r7, =gUnknown_03001274 - movs r4, 0 - adds r2, r3, 0 - adds r2, 0x32 -_0817F4E2: - strh r4, [r2] - adds r2, 0x2 - adds r0, 0x1 - cmp r0, 0x7 - bls _0817F4E2 - adds r1, r5 - lsls r1, 3 - add r1, r8 - movs r2, 0xE - ldrsh r0, [r1, r2] - lsls r0, 2 - adds r0, r6 - ldr r0, [r0] - str r0, [r3, 0x1C] - movs r0, 0 - str r0, [r7] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0817F508: - ldr r0, [r3, 0x1C] - cmp r0, r12 - bne _0817F528 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - add r0, r8 - ldrh r1, [r0, 0x10] - movs r2, 0 - strh r1, [r3, 0x2E] - ldrh r0, [r0, 0x12] - strh r0, [r3, 0x32] - strh r2, [r3, 0x30] - adds r0, r5, 0 - bl DestroyTask -_0817F528: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817F498 - - thumb_func_start LaunchAnimationTaskForFrontSprite -LaunchAnimationTaskForFrontSprite: @ 817F544 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r4, r1, 24 - lsrs r4, 24 - ldr r0, =sub_817F498 - movs r1, 0x80 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - lsrs r0, r5, 16 - strh r0, [r1, 0xA] - strh r5, [r1, 0xC] - strh r4, [r1, 0xE] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchAnimationTaskForFrontSprite - - thumb_func_start sub_817F578 -sub_817F578: @ 817F578 - lsls r1, 24 - ldr r3, =gUnknown_03001274 - movs r2, 0x1 - str r2, [r3] - ldr r2, =gUnknown_0860AA88 - lsrs r1, 22 - adds r1, r2 - ldr r1, [r1] - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_817F578 - - thumb_func_start LaunchAnimationTaskForBackSprite -LaunchAnimationTaskForBackSprite: @ 817F594 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r6, r1, 24 - lsrs r6, 24 - ldr r0, =sub_817F498 - movs r1, 0x80 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - lsrs r0, r5, 16 - strh r0, [r4, 0xA] - strh r5, [r4, 0xC] - ldrh r0, [r5, 0x2E] - lsls r0, 24 - ldr r1, =gBattlePartyID - lsrs r0, 23 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNature - lsls r0, 24 - lsrs r0, 24 - lsls r1, r6, 1 - ldr r2, =gUnknown_0860AD2F - adds r0, r2 - adds r1, r6 - ldrb r0, [r0] - adds r1, r0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_0860ACE4 - adds r1, r0 - ldrb r0, [r1] - strh r0, [r4, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchAnimationTaskForBackSprite - - thumb_func_start sub_817F60C -sub_817F60C: @ 817F60C - ldr r1, =nullsub_69 - str r1, [r0, 0x1C] - bx lr - .pool - thumb_func_end sub_817F60C - - thumb_func_start sub_817F618 -sub_817F618: @ 817F618 - push {r4,r5,lr} - sub sp, 0x10 - lsls r1, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r4, =0xffff0000 - lsls r2, 16 - lsrs r1, 16 - orrs r1, r2 - str r1, [sp] - ldr r1, [sp, 0x4] - ands r1, r4 - orrs r1, r3 - str r1, [sp, 0x4] - ldrb r4, [r0, 0x3] - lsls r4, 26 - lsrs r4, 27 - add r5, sp, 0x8 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ObjAffineSet - ldr r0, =gOamMatrices - lsls r4, 3 - adds r4, r0 - ldrh r0, [r5] - strh r0, [r4] - ldrh r0, [r5, 0x2] - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r4, 0x4] - ldrh r0, [r5, 0x6] - strh r0, [r4, 0x6] - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817F618 - - thumb_func_start sub_817F670 -sub_817F670: @ 817F670 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r0, =gSpriteAffineAnimTable_860AD68 - str r0, [r4, 0x10] - ldr r0, =gUnknown_03001274 - ldr r0, [r0] - cmp r0, 0x1 - bne _0817F68E - adds r0, r4, 0 - bl InitSpriteAffineAnim -_0817F68E: - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817F6A8 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _0817F6B0 - .pool -_0817F6A8: - adds r0, r4, 0 - movs r1, 0 - bl StartSpriteAffineAnim -_0817F6B0: - ldrb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - adds r2, r4, 0 - adds r2, 0x2C - ldrb r0, [r2] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F670 - - thumb_func_start sub_817F6D4 -sub_817F6D4: @ 817F6D4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - movs r5, 0x30 - ldrsh r0, [r4, r5] - cmp r0, 0 - bne _0817F6F8 - lsls r0, r1, 16 - negs r0, r0 - lsrs r1, r0, 16 - negs r0, r3 - lsls r0, 16 - lsrs r3, r0, 16 -_0817F6F8: - lsls r1, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - bl sub_817F618 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817F6D4 - - thumb_func_start sub_817F70C -sub_817F70C: @ 817F70C - push {lr} - adds r1, r0, 0 - movs r2, 0x30 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0817F720 - movs r2, 0x24 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0x24] -_0817F720: - pop {r0} - bx r0 - thumb_func_end sub_817F70C - - thumb_func_start sub_817F724 -sub_817F724: @ 817F724 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bhi _0817F750 - ldr r1, =gUnknown_03001240 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - movs r2, 0 - strh r2, [r0, 0x6] - strh r2, [r0] - movs r1, 0x1 - strh r1, [r0, 0x4] - strh r2, [r0, 0x2] - strh r2, [r0, 0x8] - movs r0, 0x1 - b _0817F752 - .pool -_0817F750: - movs r0, 0 -_0817F752: - pop {r1} - bx r1 - thumb_func_end sub_817F724 - - thumb_func_start sub_817F758 -sub_817F758: @ 817F758 - push {r4,lr} - ldr r4, =gUnknown_03001270 - ldrb r1, [r4] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 2 - lsls r0, 2 - subs r0, r2, r0 - strb r0, [r4] - ldrb r0, [r4] - bl sub_817F724 - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817F758 - - thumb_func_start sub_817F77C -sub_817F77C: @ 817F77C - push {r4,r5,lr} - adds r4, r0, 0 - ldrb r0, [r4, 0x1] - movs r3, 0x4 - negs r3, r3 - ands r3, r0 - movs r5, 0x1 - orrs r3, r5 - strb r3, [r4, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r4, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r4, 0 - bl CalcCenterToCornerVec - ldr r0, =gUnknown_03001274 - ldr r0, [r0] - cmp r0, 0x1 - bne _0817F800 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817F7C0 - adds r1, r4, 0 - adds r1, 0x3F - ldrb r0, [r1] - orrs r0, r5 - strb r0, [r1] - adds r5, r1, 0 - b _0817F7D0 - .pool -_0817F7C0: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r2, [r0] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - adds r5, r0, 0 -_0817F7D0: - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r2, [r4, 0x3] - lsls r1, r2, 26 - lsrs r1, 27 - ldrb r0, [r5] - lsls r0, 31 - lsrs r0, 31 - lsls r0, 3 - orrs r1, r0 - lsls r1, 1 - movs r0, 0x3F - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, 0x3] - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] -_0817F800: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817F77C - - thumb_func_start pokemonanimfunc_01 -pokemonanimfunc_01: @ 817F808 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0817F81A - adds r0, r6, 0 - bl sub_817F670 -_0817F81A: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x28 - ble _0817F840 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _0817F88C - .pool -_0817F840: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 9 - movs r1, 0x28 - bl __divsi3 - adds r4, r0, 0 - cmp r0, 0 - bge _0817F854 - adds r4, 0xFF -_0817F854: - asrs r4, 8 - lsls r4, 8 - subs r4, r0, r4 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - bl Cos - adds r0, r5 - strh r0, [r6, 0x38] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F6D4 -_0817F88C: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_01 - - thumb_func_start pokemonanimfunc_02 -pokemonanimfunc_02: @ 817F898 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _0817F8B4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F8EE - .pool -_0817F8B4: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _0817F8C0 - movs r5, 0x1 -_0817F8C0: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F8D4 - adds r0, 0xFF -_0817F8D4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_0817F8EE: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_02 - - thumb_func_start sub_817F8FC -sub_817F8FC: @ 817F8FC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _0817F91C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F946 - .pool -_0817F91C: - movs r0, 0x32 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F936 - adds r0, 0xFF -_0817F936: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin -_0817F946: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F8FC - - thumb_func_start pokemonanimfunc_03 -pokemonanimfunc_03: @ 817F95C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_03 - - thumb_func_start sub_817F978 -sub_817F978: @ 817F978 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _0817F998 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817F9C4 - .pool -_0817F998: - movs r0, 0x32 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r2, 0x2E - ldrsh r1, [r4, r2] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817F9B2 - adds r0, 0xFF -_0817F9B2: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - negs r0, r0 -_0817F9C4: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F978 - - thumb_func_start pokemonanimfunc_04 -pokemonanimfunc_04: @ 817F9D8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F978 - ldr r0, =sub_817F978 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_04 - - thumb_func_start sub_817F9F4 -sub_817F9F4: @ 817F9F4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0xC0 - lsls r0, 1 - cmp r1, r0 - ble _0817FA14 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0817FA5E - .pool -_0817FA14: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FA1C - adds r0, 0x7F -_0817FA1C: - asrs r2, r0, 7 - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0 - blt _0817FA60 - cmp r0, 0x1 - ble _0817FA48 - cmp r0, 0x3 - bgt _0817FA60 - ldr r2, =0xffffff00 - adds r1, r2 - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x2E - ldrsh r2, [r4, r1] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 16 - b _0817FA56 - .pool -_0817FA48: - lsls r0, r2, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x2E - ldrsh r1, [r4, r2] - lsls r1, 17 -_0817FA56: - asrs r1, 16 - bl Sin - negs r0, r0 -_0817FA5E: - strh r0, [r4, 0x26] -_0817FA60: - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817F9F4 - - thumb_func_start pokemonanimfunc_1E -pokemonanimfunc_1E: @ 817FA6C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F9F4 - ldr r0, =sub_817F9F4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1E - - thumb_func_start pokemonanimfunc_06 -pokemonanimfunc_06: @ 817FA88 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0xC0 - lsls r0, 2 - cmp r2, r0 - ble _0817FAA8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0817FB56 - .pool -_0817FAA8: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FAB0 - adds r0, 0x7F -_0817FAB0: - lsls r0, 9 - asrs r0, 16 - cmp r0, 0x5 - bhi _0817FB3C - lsls r0, 2 - ldr r1, =_0817FAC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0817FAC8: - .4byte _0817FAE0 - .4byte _0817FAE0 - .4byte _0817FAE4 - .4byte _0817FAE8 - .4byte _0817FB04 - .4byte _0817FB1E -_0817FAE0: - movs r0, 0 - b _0817FB3A -_0817FAE4: - movs r2, 0 - b _0817FB3C -_0817FAE8: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FAF0 - adds r0, 0x7F -_0817FAF0: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _0817FB00 - adds r0, 0x7F -_0817FB00: - asrs r0, 7 - b _0817FB3A -_0817FB04: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB0C - adds r0, 0x7F -_0817FB0C: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - cmp r0, 0 - bge _0817FB18 - adds r0, 0x7 -_0817FB18: - asrs r0, 3 - subs r0, 0x8 - b _0817FB3A -_0817FB1E: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB26 - adds r0, 0x7F -_0817FB26: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _0817FB36 - adds r0, 0x7F -_0817FB36: - asrs r0, 7 - adds r0, 0x8 -_0817FB3A: - strh r0, [r4, 0x24] -_0817FB3C: - adds r0, r2, 0 - cmp r2, 0 - bge _0817FB44 - adds r0, 0x7F -_0817FB44: - asrs r0, 7 - lsls r0, 7 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_0817FB56: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_06 - - thumb_func_start pokemonanimfunc_09 -pokemonanimfunc_09: @ 817FB64 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0817FB76 - adds r0, r6, 0 - bl sub_817F670 -_0817FB76: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x28 - ble _0817FB9C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _0817FC12 - .pool -_0817FB9C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0817FBB0 - adds r0, 0xFF -_0817FBB0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - lsrs r4, r0, 16 - ldrh r0, [r6, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0817FBE0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - b _0817FBFA -_0817FBE0: - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x8 -_0817FBFA: - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F6D4 -_0817FC12: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_09 - - thumb_func_start sub_817FC20 -sub_817FC20: @ 817FC20 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FC32 - strh r0, [r4, 0x34] -_0817FC32: - ldr r2, =gUnknown_0860AD70 - movs r5, 0x34 - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r2, 0x2 - adds r3, r0, r1 - movs r1, 0 - ldrsb r1, [r3, r1] - movs r5, 0x32 - ldrsh r0, [r4, r5] - cmp r1, r0 - bne _0817FC6A - adds r0, r1, 0 - cmp r0, 0 - bne _0817FC60 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FC6A - .pool -_0817FC60: - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x34] - strh r1, [r4, 0x32] -_0817FC6A: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r1, r0, r1 - adds r0, r2, 0x2 - adds r0, r1, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _0817FC8C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FCBE - .pool -_0817FC8C: - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r5, 0x34 - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r2, 0x1 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C -_0817FCBE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_817FC20 - - thumb_func_start pokemonanimfunc_0A -pokemonanimfunc_0A: @ 817FCC4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817FC20 - ldr r0, =sub_817FC20 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0A - - thumb_func_start sub_817FCDC -sub_817FCDC: @ 817FCDC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r1, r0 - ble _0817FCF8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817FD12 - .pool -_0817FCF8: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FD00 - adds r0, 0xFF -_0817FD00: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl Sin -_0817FD12: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817FCDC - - thumb_func_start pokemonanimfunc_0F -pokemonanimfunc_0F: @ 817FD24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0F - - thumb_func_start sub_817FD44 -sub_817FD44: @ 817FD44 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r1, r0 - ble _0817FD60 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0817FD78 - .pool -_0817FD60: - adds r0, r1, 0 - cmp r1, 0 - bge _0817FD68 - adds r0, 0xFF -_0817FD68: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x3 - bl Sin -_0817FD78: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_817FD44 - - thumb_func_start pokemonanimfunc_10 -pokemonanimfunc_10: @ 817FD88 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817FD44 - ldr r0, =sub_817FD44 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_10 - - thumb_func_start pokemonanimfunc_11 -pokemonanimfunc_11: @ 817FDA4 - push {r4-r7,lr} - adds r7, r0, 0 - ldrh r2, [r7, 0x32] - movs r0, 0x32 - ldrsh r1, [r7, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _0817FDC8 - ldr r0, =sub_8184D88 - str r0, [r7, 0x1C] - movs r0, 0 - strh r0, [r7, 0x24] - strh r0, [r7, 0x26] - b _0817FE24 - .pool -_0817FDC8: - movs r0, 0x1 - ands r0, r2 - movs r5, 0xFF - cmp r0, 0 - bne _0817FDD4 - movs r5, 0x1 -_0817FDD4: - movs r1, 0x32 - ldrsh r0, [r7, r1] - cmp r0, 0 - bge _0817FDDE - adds r0, 0x3 -_0817FDDE: - asrs r0, 2 - movs r1, 0x8 - bl Sin - lsls r0, 16 - asrs r6, r0, 16 - movs r0, 0x32 - ldrsh r1, [r7, r0] - adds r4, r1, 0 - cmp r1, 0 - bge _0817FDF6 - adds r4, 0xFF -_0817FDF6: - asrs r4, 8 - lsls r4, 8 - subs r4, r1, r4 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - adds r1, r6, 0 - bl Sin - lsls r5, 24 - asrs r5, 24 - adds r1, r0, 0 - muls r1, r5 - adds r0, r1, 0 - strh r0, [r7, 0x26] - adds r0, r4, 0 - adds r1, r6, 0 - bl Cos - adds r1, r0, 0 - muls r1, r5 - adds r0, r1, 0 - strh r0, [r7, 0x24] -_0817FE24: - ldrh r0, [r7, 0x32] - adds r0, 0x9 - strh r0, [r7, 0x32] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_11 - - thumb_func_start sub_817FE30 -sub_817FE30: @ 817FE30 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r2, =gUnknown_03001240 - ldrh r6, [r4, 0x2E] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - ldrh r0, [r5] - cmp r0, 0 - beq _0817FE54 - subs r0, 0x1 - strh r0, [r5] - b _0817FEF8 - .pool -_0817FE54: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FE70 - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _0817FE70 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_0817FE70: - ldr r2, =gUnknown_03001240 - lsls r1, r6, 16 - asrs r1, 16 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r5, r0, r2 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x6 - ldrsh r0, [r5, r2] - cmp r1, r0 - ble _0817FEC4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r1, [r5, 0x4] - movs r2, 0x4 - ldrsh r0, [r5, r2] - cmp r0, 0x1 - ble _0817FEB4 - subs r0, r1, 0x1 - movs r1, 0 - strh r0, [r5, 0x4] - movs r0, 0xA - strh r0, [r5] - strh r1, [r4, 0x32] - b _0817FEF2 - .pool -_0817FEB4: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FEF2 - .pool -_0817FEC4: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _0817FED0 - adds r0, 0xFF -_0817FED0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x80 - lsls r1, 5 - bl Sin - strh r0, [r4, 0x3A] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0817FEF2: - ldrh r0, [r4, 0x32] - adds r0, 0x10 - strh r0, [r4, 0x32] -_0817FEF8: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817FE30 - - thumb_func_start pokemonanimfunc_12 -pokemonanimfunc_12: @ 817FF00 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 2 - strh r0, [r1, 0x6] - strh r3, [r1] - adds r0, r4, 0 - bl sub_817FE30 - ldr r0, =sub_817FE30 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_12 - - thumb_func_start sub_817FF3C -sub_817FF3C: @ 817FF3C - push {r4-r6,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0817FF54 - adds r0, r4, 0 - bl sub_817F670 -_0817FF54: - movs r2, 0x32 - ldrsh r6, [r4, r2] - ldr r1, =gUnknown_03001240 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - cmp r6, r1 - ble _0817FF8C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0817FFAA - .pool -_0817FF8C: - movs r2, 0x8 - ldrsh r1, [r0, r2] - movs r0, 0x80 - lsls r0, 9 - bl __divsi3 - muls r0, r6 - strh r0, [r4, 0x3A] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0817FFAA: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_817FF3C - - thumb_func_start pokemonanimfunc_1F -pokemonanimfunc_1F: @ 817FFB8 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3C - strh r0, [r1] - movs r0, 0x14 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_817FF3C - ldr r0, =sub_817FF3C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1F - - thumb_func_start sub_817FFF0 -sub_817FFF0: @ 817FFF0 - push {r4-r7,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x2E] - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r5, 0 - bl sub_817F70C - ldr r1, =gUnknown_03001240 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r6, r0, r1 - movs r0, 0x32 - ldrsh r1, [r5, r0] - movs r2, 0x6 - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818002C - movs r0, 0 - strh r0, [r5, 0x24] - strh r0, [r5, 0x26] - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - b _0818006A - .pool -_0818002C: - movs r0, 0x32 - ldrsh r1, [r5, r0] - adds r0, r1, 0 - adds r0, 0xC0 - adds r4, r0, 0 - cmp r0, 0 - bge _0818003E - ldr r2, =0x000001bf - adds r4, r1, r2 -_0818003E: - asrs r4, 8 - lsls r4, 8 - subs r4, r0, r4 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x8 - ldrsh r1, [r6, r0] - lsls r1, 17 - asrs r1, 16 - adds r0, r4, 0 - bl Cos - negs r0, r0 - strh r0, [r5, 0x24] - movs r2, 0x8 - ldrsh r1, [r6, r2] - adds r0, r4, 0 - bl Sin - ldrh r1, [r6, 0x8] - adds r0, r1 - strh r0, [r5, 0x26] -_0818006A: - ldr r0, =gUnknown_03001240 - lsls r1, r7, 1 - adds r1, r7 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x2] - ldrh r1, [r5, 0x32] - adds r0, r1 - strh r0, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F70C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817FFF0 - - thumb_func_start pokemonanimfunc_14 -pokemonanimfunc_14: @ 8180090 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 2 - strh r0, [r1, 0x6] - movs r0, 0x6 - strh r0, [r1, 0x8] - movs r0, 0x18 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_14 - - thumb_func_start pokemonanimfunc_15 -pokemonanimfunc_15: @ 81800D0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081800EC - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_081800EC: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _0818010C - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180128 - .pool -_0818010C: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0x10 - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - movs r1, 0x10 - movs r3, 0 - bl BlendPalette -_08180128: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_15 - - thumb_func_start pokemonanimfunc_16 -pokemonanimfunc_16: @ 8180134 - push {r4-r7,lr} - adds r6, r0, 0 - movs r7, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180148 - adds r0, r6, 0 - bl sub_817F670 -_08180148: - ldrh r5, [r6, 0x32] - movs r2, 0x32 - ldrsh r0, [r6, r2] - cmp r0, 0x28 - ble _08180170 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180204 - .pool -_08180170: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r5, 0 - subs r0, 0xA - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x13 - bhi _08180196 - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r7, 0xFF - ands r7, r0 -_08180196: - movs r2, 0x30 - ldrsh r0, [r6, r2] - cmp r0, 0 - bne _081801C4 - lsls r5, r4, 16 - asrs r0, r5, 16 - movs r1, 0x28 - bl Sin - adds r4, r0, 0 - adds r0, r7, 0 - movs r1, 0x10 - bl Sin - ldr r1, =0xffffff00 - adds r0, r1 - adds r4, r0 - strh r4, [r6, 0x36] - adds r4, r5, 0 - b _081801E4 - .pool -_081801C4: - adds r0, r7, 0 - movs r1, 0x10 - bl Sin - adds r5, r0, 0 - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x28 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r5 - subs r1, r0 - strh r1, [r6, 0x36] -_081801E4: - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r6, 0x38] - movs r2, 0x36 - ldrsh r1, [r6, r2] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F618 -_08180204: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_16 - - thumb_func_start pokemonanimfunc_17 -pokemonanimfunc_17: @ 8180210 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - movs r0, 0 - mov r8, r0 - movs r7, 0 - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0818022C - adds r0, r5, 0 - bl sub_817F670 -_0818022C: - ldrh r6, [r5, 0x32] - movs r2, 0x32 - ldrsh r0, [r5, r2] - cmp r0, 0x28 - ble _08180258 - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - mov r0, r8 - strh r0, [r5, 0x26] - b _0818030A - .pool -_08180258: - movs r1, 0x32 - ldrsh r0, [r5, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r6, 0 - subs r0, 0xA - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x13 - bhi _0818027E - ldrh r0, [r5, 0x3C] - adds r0, 0x33 - strh r0, [r5, 0x3C] - movs r7, 0xFF - ands r7, r0 -_0818027E: - movs r2, 0x30 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _081802A0 - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - ldr r2, =0xffffff00 - adds r1, r2, 0 - subs r1, r0 - strh r1, [r5, 0x36] - b _081802B2 - .pool -_081802A0: - lsls r4, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r5, 0x36] -_081802B2: - adds r6, r4, 0 - adds r0, r7, 0 - movs r1, 0x8 - bl Sin - adds r4, r0, 0 - asrs r0, r6, 16 - movs r1, 0x28 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r4, r1, r4 - subs r4, r0 - strh r4, [r5, 0x38] - lsls r4, 16 - asrs r4, 16 - lsls r1, 16 - asrs r1, 16 - cmp r4, r1 - beq _081802F0 - movs r2, 0x38 - ldrsh r0, [r5, r2] - subs r0, r1, r0 - cmp r0, 0 - bge _081802EA - adds r0, 0x7 -_081802EA: - lsls r0, 13 - lsrs r0, 16 - mov r8, r0 -_081802F0: - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r5, 0x26] - movs r2, 0x36 - ldrsh r1, [r5, r2] - movs r0, 0x38 - ldrsh r2, [r5, r0] - adds r0, r5, 0 - movs r3, 0 - bl sub_817F618 -_0818030A: - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_17 - - thumb_func_start sub_818031C -sub_818031C: @ 818031C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gUnknown_0860AA80 - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r0, 1 - adds r1, r0, r2 - ldrb r5, [r1] - adds r2, 0x1 - adds r0, r2 - ldrb r6, [r0] - movs r1, 0 - cmp r5, 0xFE - beq _08180358 - subs r0, r6, r7 - muls r0, r5 - adds r1, r6, 0 - bl __divsi3 - lsls r0, 24 - lsrs r1, r0, 24 -_08180358: - cmp r5, 0xFF - bne _08180370 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - b _08180394 - .pool -_08180370: - mov r0, r8 - bl Sin - strh r0, [r4, 0x26] - cmp r7, r6 - bne _08180386 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r0, 0 - b _08180392 -_08180386: - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 -_08180392: - strh r0, [r4, 0x3A] -_08180394: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_818031C - - thumb_func_start pokemonanimfunc_19 -pokemonanimfunc_19: @ 81803A0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x30 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_818031C - ldr r0, =sub_818031C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_19 - - thumb_func_start pokemonanimfunc_1A -pokemonanimfunc_1A: @ 81803BC - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - lsls r7, r0, 24 - lsrs r5, r7, 24 - mov r8, r5 - cmp r0, 0 - bne _081803DA - adds r0, r4, 0 - bl sub_817F670 -_081803DA: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x23 - ble _08180404 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0818045E - .pool -_08180404: - adds r6, r5, 0 - subs r6, 0xA - lsls r0, r6, 7 - movs r1, 0x14 - bl __divsi3 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r5, 0x9 - bhi _0818042A - movs r2, 0x80 - lsls r2, 1 - lsrs r3, r7, 25 - lsls r3, 9 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - b _0818045E -_0818042A: - lsls r0, r6, 24 - lsrs r0, 24 - cmp r0, 0x13 - bhi _08180442 - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x5 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - b _0818045E -_08180442: - movs r2, 0x80 - lsls r2, 1 - movs r3, 0x23 - mov r0, r8 - subs r3, r0 - lsrs r0, r3, 31 - adds r3, r0 - asrs r3, 1 - lsls r3, 26 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 -_0818045E: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_1A - - thumb_func_start pokemonanimfunc_1B -pokemonanimfunc_1B: @ 8180474 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180486 - adds r0, r6, 0 - bl sub_817F670 -_08180486: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _081804B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r0, 0 - strh r0, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _081804E8 - .pool -_081804B0: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - strh r0, [r6, 0x26] - movs r5, 0x80 - lsls r5, 1 - ldr r1, =0x00000ccc - adds r0, r4, 0 - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl sub_817F6D4 -_081804E8: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1B - - thumb_func_start sub_81804F8 -sub_81804F8: @ 81804F8 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0818050C - adds r0, r6, 0 - bl sub_817F670 -_0818050C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _08180534 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180582 - .pool -_08180534: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r4, 16 - movs r0, 0x2E - ldrsh r1, [r6, r0] - adds r0, r4, 0 - bl Sin - strh r0, [r6, 0x26] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_08180582: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81804F8 - - thumb_func_start pokemonanimfunc_1C -pokemonanimfunc_1C: @ 8180594 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0xA - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81804F8 - ldr r0, =sub_81804F8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1C - - thumb_func_start sub_81805B0 -sub_81805B0: @ 81805B0 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081805C4 - adds r0, r6, 0 - bl sub_817F670 -_081805C4: - movs r2, 0x32 - ldrsh r0, [r6, r2] - cmp r0, 0x64 - ble _081805EC - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x26] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08180644 - .pool -_081805EC: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r0, r4, 16 - lsrs r4, 31 - adds r0, r4 - asrs r0, 1 - movs r2, 0x2E - ldrsh r1, [r6, r2] - lsls r1, 17 - asrs r1, 16 - bl Sin - negs r0, r0 - strh r0, [r6, 0x26] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_08180644: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81805B0 - - thumb_func_start pokemonanimfunc_18 -pokemonanimfunc_18: @ 8180654 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81805B0 - ldr r0, =sub_81805B0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_18 - - thumb_func_start pokemonanimfunc_1D -pokemonanimfunc_1D: @ 8180670 - push {r4-r6,lr} - adds r6, r0, 0 - bl sub_817F70C - movs r5, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08180688 - adds r0, r6, 0 - bl sub_817F670 -_08180688: - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x64 - ble _081806B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r6, 0x24] - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _081806FC - .pool -_081806B0: - movs r0, 0x32 - ldrsh r5, [r6, r0] - lsls r0, r5, 8 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 9 - adds r0, r5, 0 - movs r1, 0x64 - bl __divsi3 - adds r5, r0, 0 - movs r0, 0xFF - ands r5, r0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - strh r0, [r6, 0x24] - movs r4, 0x80 - lsls r4, 1 - adds r0, r5, 0 - ldr r1, =0x00000ccc - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r4, 0 - bl sub_817F6D4 -_081806FC: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_1D - - thumb_func_start sub_8180714 -sub_8180714: @ 8180714 - push {r4-r6,lr} - adds r4, r0, 0 - movs r6, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818072A - adds r0, r4, 0 - bl sub_817F670 - strh r6, [r4, 0x34] -_0818072A: - adds r0, r4, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - cmp r2, r0 - ble _08180760 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r6, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _081807FE - .pool -_08180760: - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - lsls r0, 16 - lsrs r5, r0, 16 - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08180796 - adds r2, r0, 0 - lsls r0, r2, 1 - cmp r1, r0 - bge _08180796 - movs r0, 0x80 - adds r1, r2, 0 - bl __divsi3 - ldrh r1, [r4, 0x34] - adds r1, r0 - strh r1, [r4, 0x34] -_08180796: - lsls r0, r5, 16 - asrs r1, r0, 16 - movs r2, 0x80 - lsls r2, 1 - adds r5, r0, 0 - cmp r1, r2 - ble _081807B0 - subs r0, r2, r1 - cmp r0, 0 - bge _081807AC - adds r0, 0x7 -_081807AC: - lsls r0, 13 - lsrs r6, r0, 16 -_081807B0: - movs r1, 0x34 - ldrsh r0, [r4, r1] - movs r1, 0xA - bl Sin - negs r0, r0 - lsls r1, r6, 16 - asrs r1, 16 - subs r0, r1 - strh r0, [r4, 0x26] - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - asrs r1, 16 - asrs r2, r5, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - movs r0, 0x2E - ldrsh r1, [r4, r0] - movs r0, 0x80 - bl __divsi3 - ldrh r1, [r4, 0x36] - adds r1, r0 - movs r0, 0xFF - ands r1, r0 - strh r1, [r4, 0x36] -_081807FE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8180714 - - thumb_func_start pokemonanimfunc_00 -pokemonanimfunc_00: @ 818080C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x10 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_8180714 - ldr r0, =sub_8180714 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_00 - - thumb_func_start sub_8180828 -sub_8180828: @ 8180828 - push {r4-r6,lr} - adds r5, r0, 0 - movs r6, 0 - movs r0, 0x32 - ldrsh r4, [r5, r0] - movs r2, 0x3A - ldrsh r1, [r5, r2] - movs r0, 0x80 - bl __divsi3 - movs r2, 0x3C - ldrsh r1, [r5, r2] - muls r0, r1 - cmp r4, r0 - ble _08180868 - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r6, [r5, 0x26] - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - b _081808D0 - .pool -_08180868: - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - ble _08180894 - subs r0, r1, r0 - cmp r0, 0 - bge _08180890 - adds r0, 0x7 -_08180890: - lsls r0, 13 - lsrs r6, r0, 16 -_08180894: - lsls r0, r6, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x30 - bl Sin - adds r1, r0, 0 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - lsls r2, r4, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x3A] - ldrh r1, [r5, 0x36] - adds r0, r1 - movs r1, 0xFF - ands r0, r1 - strh r0, [r5, 0x36] -_081808D0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8180828 - - thumb_func_start pokemonanimfunc_13 -pokemonanimfunc_13: @ 81808D8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081808F2 - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x3 - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] -_081808F2: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_13 - - thumb_func_start sub_8180900 -sub_8180900: @ 8180900 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x2E] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_03001240 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x6] - str r1, [sp] - ldr r5, =gUnknown_0860AD8E - movs r3, 0x36 - ldrsh r2, [r4, r3] - lsls r1, r2, 1 - adds r1, r2 - movs r3, 0x8 - ldrsh r2, [r0, r3] - lsls r0, r2, 1 - adds r0, r2 - lsls r6, r0, 3 - adds r1, r6 - adds r2, r1, r5 - adds r0, r5, 0x1 - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - ldrb r2, [r2] - lsls r2, 24 - asrs r2, 24 - mov r9, r2 - subs r0, r2 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldrh r7, [r4, 0x34] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818096C - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_0818096C: - movs r2, 0x36 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - adds r0, r6 - adds r5, 0x2 - mov r8, r5 - adds r1, r0, r5 - movs r5, 0 - ldrsb r5, [r1, r5] - cmp r5, 0 - bne _081809B0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180A3A - .pool -_081809B0: - lsls r0, r7, 16 - asrs r5, r0, 16 - lsls r0, r5, 7 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - mov r3, r10 - lsls r0, r3, 16 - asrs r0, 16 - muls r0, r5 - movs r1, 0x36 - ldrsh r2, [r4, r1] - lsls r1, r2, 1 - adds r1, r2 - adds r1, r6 - add r1, r8 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl __divsi3 - add r0, r9 - strh r0, [r4, 0x24] - ldr r2, [sp] - lsls r0, r2, 16 - asrs r0, 16 - movs r3, 0x24 - ldrsh r1, [r4, r3] - muls r0, r1 - negs r0, r0 - cmp r0, 0 - bge _08180A04 - adds r0, 0x7 -_08180A04: - lsls r3, r0, 13 - lsrs r3, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - adds r0, r6 - add r0, r8 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r5, r0 - bne _08180A34 - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r0, 0 - b _08180A38 -_08180A34: - ldrh r0, [r4, 0x34] - adds r0, 0x1 -_08180A38: - strh r0, [r4, 0x34] -_08180A3A: - adds r0, r4, 0 - bl sub_817F70C - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8180900 - - thumb_func_start pokemonanimfunc_05 -pokemonanimfunc_05: @ 8180A50 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 5 - strh r0, [r1, 0x6] - ldrh r0, [r4, 0x3A] - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_8180900 - ldr r0, =sub_8180900 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_05 - - thumb_func_start pokemonanimfunc_20 -pokemonanimfunc_20: @ 8180A8C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180AA8 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180AA8: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180ACC - ldrh r0, [r4, 0x3C] - ldr r3, =0x000002df - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180AE8 - .pool -_08180ACC: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x000002df - movs r1, 0x10 - bl BlendPalette -_08180AE8: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_20 - - thumb_func_start pokemonanimfunc_21 -pokemonanimfunc_21: @ 8180AF8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180B14 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180B14: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180B34 - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0x1F - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180B50 - .pool -_08180B34: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - movs r1, 0x10 - movs r3, 0x1F - bl BlendPalette -_08180B50: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_21 - - thumb_func_start pokemonanimfunc_22 -pokemonanimfunc_22: @ 8180B5C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180B78 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180B78: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180B98 - ldrh r0, [r4, 0x3C] - movs r3, 0xF8 - lsls r3, 7 - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180BB6 - .pool -_08180B98: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - movs r3, 0xF8 - lsls r3, 7 - movs r1, 0x10 - bl BlendPalette -_08180BB6: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_22 - - thumb_func_start pokemonanimfunc_23 -pokemonanimfunc_23: @ 8180BC4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180BE0 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180BE0: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180C04 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180C20 - .pool -_08180C04: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x000003ff - movs r1, 0x10 - bl BlendPalette -_08180C20: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_23 - - thumb_func_start pokemonanimfunc_24 -pokemonanimfunc_24: @ 8180C30 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180C4C - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - adds r0, r1 - strh r0, [r4, 0x3C] -_08180C4C: - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x80 - ble _08180C70 - ldrh r0, [r4, 0x3C] - ldr r3, =0x00006018 - movs r1, 0x10 - movs r2, 0 - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08180C8C - .pool -_08180C70: - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x00006018 - movs r1, 0x10 - bl BlendPalette -_08180C8C: - ldrh r0, [r4, 0x32] - adds r0, 0x2 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_24 - - thumb_func_start pokemonanimfunc_25 -pokemonanimfunc_25: @ 8180C9C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - ldr r0, =sub_8180CB4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_25 - - thumb_func_start sub_8180CB4 -sub_8180CB4: @ 8180CB4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x24] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _08180CD6 - movs r0, 0x8 - strh r0, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x3C] - ldr r0, =sub_8180CE8 - str r0, [r4, 0x1C] -_08180CD6: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180CB4 - - thumb_func_start sub_8180CE8 -sub_8180CE8: @ 8180CE8 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - ldrh r0, [r4, 0x3C] - subs r1, r0 - strh r1, [r4, 0x24] - adds r0, 0x1 - adds r2, r0, 0 - strh r0, [r4, 0x3C] - lsls r1, 16 - cmp r1, 0 - bgt _08180D32 - lsls r0, r2, 24 - lsrs r2, r0, 24 - movs r0, 0 - strh r0, [r4, 0x3A] - ldrh r1, [r4, 0x24] - ldr r5, =sub_8180D44 - movs r3, 0x8 - negs r3, r3 -_08180D14: - subs r0, r1, r2 - lsls r0, 16 - ldrh r1, [r4, 0x3A] - adds r1, 0x1 - strh r1, [r4, 0x3A] - adds r1, r2, 0x1 - lsls r1, 24 - lsrs r2, r1, 24 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, r3 - bgt _08180D14 - movs r0, 0x1 - strh r0, [r4, 0x38] - str r5, [r4, 0x1C] -_08180D32: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180CE8 - - thumb_func_start sub_8180D44 -sub_8180D44: @ 8180D44 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x3C] - subs r0, r1 - strh r0, [r4, 0x24] - adds r1, 0x1 - strh r1, [r4, 0x3C] - movs r0, 0x38 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl __divsi3 - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r1, [r4, r3] - cmp r0, r1 - ble _08180D84 - strh r2, [r4, 0x38] -_08180D84: - movs r2, 0x80 - lsls r2, 1 - lsls r3, r5, 8 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r1, 0x8 - negs r1, r1 - cmp r0, r1 - bge _08180DAE - strh r1, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0 - strh r0, [r4, 0x34] - strh r5, [r4, 0x32] - ldr r0, =sub_8180DC0 - str r0, [r4, 0x1C] -_08180DAE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180D44 - - thumb_func_start sub_8180DC0 -sub_8180DC0: @ 8180DC0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0xB - ble _08180E08 - ldrh r0, [r4, 0x32] - subs r0, 0x2 - strh r0, [r4, 0x32] - lsls r0, 16 - cmp r0, 0 - bge _08180DE2 - movs r0, 0 - strh r0, [r4, 0x32] -_08180DE2: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x32] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08180E1C - ldr r0, =sub_8180E28 - str r0, [r4, 0x1C] - b _08180E1C - .pool -_08180E08: - ldrh r0, [r4, 0x36] - ldrh r2, [r4, 0x24] - adds r0, r2 - strh r0, [r4, 0x24] - movs r2, 0x36 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x36] - adds r0, r1, 0x1 - strh r0, [r4, 0x34] -_08180E1C: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8180DC0 - - thumb_func_start sub_8180E28 -sub_8180E28: @ 8180E28 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x2 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - ble _08180E4A - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08180E4A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180E28 - - thumb_func_start pokemonanimfunc_26 -pokemonanimfunc_26: @ 8180E5C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r0, 0 - strh r0, [r4, 0x34] - ldr r0, =sub_8180E78 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_26 - - thumb_func_start sub_8180E78 -sub_8180E78: @ 8180E78 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x24] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08180EA2 - movs r1, 0x34 - ldrsh r0, [r4, r1] - cmp r0, 0 - bgt _08180EA2 - movs r0, 0xA - strh r0, [r4, 0x34] -_08180EA2: - movs r1, 0x24 - ldrsh r0, [r4, r1] - cmp r0, 0x7 - ble _08180EBA - movs r1, 0 - movs r0, 0x8 - strh r0, [r4, 0x24] - ldr r0, =0x0000fff8 - strh r0, [r4, 0x26] - strh r1, [r4, 0x36] - ldr r0, =sub_8180ED0 - str r0, [r4, 0x1C] -_08180EBA: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180E78 - - thumb_func_start sub_8180ED0 -sub_8180ED0: @ 8180ED0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Cos - subs r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x36 - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x26] - movs r1, 0x36 - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08180F08 - movs r0, 0xA0 - strh r0, [r4, 0x32] - movs r0, 0xA - strh r0, [r4, 0x34] - ldr r0, =sub_8180F2C - str r0, [r4, 0x1C] -_08180F08: - ldrh r0, [r4, 0x36] - adds r0, 0x8 - strh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x40 - ble _08180F1A - movs r0, 0x40 - strh r0, [r4, 0x36] -_08180F1A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180ED0 - - thumb_func_start sub_8180F2C -sub_8180F2C: @ 8180F2C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08180F44 - subs r0, r1, 0x1 - strh r0, [r4, 0x34] - b _08180F96 -_08180F44: - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl Cos - subs r0, 0x4 - movs r5, 0 - strh r0, [r4, 0x24] - movs r2, 0x32 - ldrsh r0, [r4, r2] - movs r1, 0x5 - bl Sin - negs r0, r0 - adds r0, 0x4 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - subs r0, 0x4 - strh r0, [r4, 0x32] - movs r0, 0x32 - ldrsh r3, [r4, r0] - subs r3, 0x20 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 25 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bgt _08180F96 - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08180F96: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8180F2C - - thumb_func_start pokemonanimfunc_27 -pokemonanimfunc_27: @ 8180FA8 - push {r4,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x34] - movs r2, 0x34 - ldrsh r0, [r3, r2] - cmp r0, 0 - ble _08180FBA - subs r0, r1, 0x1 - b _08180FFE -_08180FBA: - movs r2, 0 - movs r1, 0x36 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _08180FC6 - movs r2, 0x1 -_08180FC6: - strh r2, [r3, 0x36] - movs r0, 0x3E - adds r0, r3 - mov r12, r0 - lsls r2, 2 - ldrb r1, [r0] - movs r4, 0x5 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - orrs r0, r2 - mov r1, r12 - strb r0, [r1] - ldrh r0, [r3, 0x32] - adds r0, 0x1 - strh r0, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _08180FFC - ldrb r0, [r1] - adds r1, r4, 0 - ands r1, r0 - mov r2, r12 - strb r1, [r2] - ldr r0, =sub_8184D88 - str r0, [r3, 0x1C] -_08180FFC: - movs r0, 0x2 -_08180FFE: - strh r0, [r3, 0x34] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_27 - - thumb_func_start pokemonanimfunc_28 -pokemonanimfunc_28: @ 818100C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - ldr r0, =sub_8181024 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_28 - - thumb_func_start sub_8181024 -sub_8181024: @ 8181024 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - subs r0, 0x1 - strh r0, [r4, 0x24] - ldrh r1, [r4, 0x26] - adds r1, 0x1 - strh r1, [r4, 0x26] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bgt _08181054 - ldr r0, =0x0000fff0 - strh r0, [r4, 0x24] - movs r0, 0x10 - strh r0, [r4, 0x26] - ldr r0, =sub_8181068 - str r0, [r4, 0x1C] - movs r0, 0xA0 - strh r0, [r4, 0x32] -_08181054: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181024 - - thumb_func_start sub_8181068 -sub_8181068: @ 8181068 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - subs r0, 0x4 - strh r0, [r4, 0x32] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x16 - bl Cos - strh r0, [r4, 0x24] - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x16 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r0, 0x32 - ldrsh r3, [r4, r0] - subs r3, 0x20 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 25 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x20 - bgt _081810B2 - ldr r0, =sub_81810C4 - str r0, [r4, 0x1C] -_081810B2: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181068 - - thumb_func_start sub_81810C4 -sub_81810C4: @ 81810C4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - subs r1, 0x1 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - cmp r1, 0 - bgt _081810E8 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_081810E8: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81810C4 - - thumb_func_start pokemonanimfunc_29 -pokemonanimfunc_29: @ 81810F8 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - ldr r0, =sub_8181110 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_29 - - thumb_func_start sub_8181110 -sub_8181110: @ 8181110 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - adds r1, 0x1 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0xF - ble _08181134 - movs r0, 0 - strh r0, [r4, 0x32] - ldr r0, =sub_8181144 - str r0, [r4, 0x1C] -_08181134: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181110 - - thumb_func_start sub_8181144 -sub_8181144: @ 8181144 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - adds r0, 0x10 - strh r0, [r4, 0x32] - ldrh r2, [r4, 0x24] - movs r0, 0x24 - ldrsh r1, [r4, r0] - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - bgt _0818117C - ldr r0, =0x0000fff0 - strh r0, [r4, 0x24] - movs r0, 0x10 - strh r0, [r4, 0x26] - movs r0, 0 - strh r0, [r4, 0x32] - ldr r0, =sub_81811A4 - str r0, [r4, 0x1C] - b _08181186 - .pool -_0818117C: - subs r0, r2, 0x2 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] -_08181186: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x32] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181144 - - thumb_func_start sub_81811A4 -sub_81811A4: @ 81811A4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x24] - adds r1, 0x1 - movs r2, 0 - strh r1, [r4, 0x24] - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - lsls r1, 16 - cmp r1, 0 - blt _081811CE - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_081811CE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81811A4 - - thumb_func_start pokemonanimfunc_2A -pokemonanimfunc_2A: @ 81811E0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x2 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_8181214 - ldr r0, =sub_8181214 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2A - - thumb_func_start sub_8181214 -sub_8181214: @ 8181214 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrh r0, [r1] - cmp r0, 0 - beq _08181238 - subs r0, 0x1 - strh r0, [r1] - b _0818134A - .pool -_08181238: - adds r0, r4, 0 - bl sub_817F70C - ldrh r0, [r4, 0x32] - movs r1, 0x32 - ldrsh r5, [r4, r1] - cmp r5, 0 - bne _08181270 - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F670 - movs r2, 0x2E - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrh r0, [r0, 0x2] - strh r0, [r4, 0x3C] - ldr r0, =0x0000ffff - strh r0, [r4, 0x34] - movs r0, 0x1 - negs r0, r0 - strh r0, [r4, 0x36] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3A] -_08181270: - movs r3, 0x3C - ldrsh r1, [r4, r3] - movs r6, 0x34 - ldrsh r0, [r4, r6] - lsls r0, 1 - muls r1, r0 - ldrh r0, [r4, 0x24] - adds r1, r0 - strh r1, [r4, 0x24] - ldrh r2, [r4, 0x3C] - ldrh r0, [r4, 0x36] - adds r3, r0, 0 - muls r3, r2 - adds r0, r3, 0 - ldrh r6, [r4, 0x26] - adds r2, r0, r6 - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x3A] - adds r0, 0x8 - strh r0, [r4, 0x3A] - adds r1, 0xF - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x1E - bls _081812B8 - movs r1, 0x34 - ldrsh r0, [r4, r1] - lsls r0, 4 - strh r0, [r4, 0x24] - movs r2, 0x34 - ldrsh r0, [r4, r2] - negs r0, r0 - strh r0, [r4, 0x34] - b _081812D4 - .pool -_081812B8: - adds r0, r2, 0 - adds r0, 0xF - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bls _081812DA - movs r3, 0x36 - ldrsh r0, [r4, r3] - lsls r0, 4 - strh r0, [r4, 0x26] - movs r6, 0x36 - ldrsh r0, [r4, r6] - negs r0, r0 - strh r0, [r4, 0x36] -_081812D4: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081812DA: - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x5 - ble _08181332 - movs r2, 0x24 - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08181332 - movs r3, 0 - strh r3, [r4, 0x24] - strh r3, [r4, 0x26] - ldr r5, =gUnknown_03001240 - movs r6, 0x2E - ldrsh r0, [r4, r6] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldrh r2, [r1, 0x4] - movs r6, 0x4 - ldrsh r0, [r1, r6] - cmp r0, 0x1 - ble _08181328 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r4, 0x38] - strh r3, [r4, 0x3A] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xA - strh r1, [r0] - b _08181332 - .pool -_08181328: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08181332: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C -_0818134A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181214 - - thumb_func_start pokemonanimfunc_2B -pokemonanimfunc_2B: @ 8181354 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r0, 0 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] - ldr r0, =sub_8181370 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2B - - thumb_func_start sub_8181370 -sub_8181370: @ 8181370 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3A] - adds r0, 0x4 - strh r0, [r4, 0x3A] - movs r1, 0x3A - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 1 - movs r1, 0xFF - ands r0, r1 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0xC0 - ble _081813BA - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _081813BA - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - b _081813D2 -_081813BA: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x40 - ble _081813DE - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081813DE - ldr r1, =0xffffff00 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 -_081813D2: - movs r3, 0 - bl sub_817F6D4 - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] -_081813DE: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0xFF - ble _08181404 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08181404: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181370 - - thumb_func_start pokemonanimfunc_2C -pokemonanimfunc_2C: @ 8181418 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08181442 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - strh r2, [r4, 0x3A] - strh r2, [r4, 0x38] - strh r2, [r4, 0x36] -_08181442: - ldr r1, =gUnknown_0860AA64 - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r2, r0, 1 - adds r0, r1, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08181464 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _081814CE - .pool -_08181464: - movs r3, 0x36 - ldrsh r0, [r4, r3] - cmp r0, 0x1 - bne _0818149A - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08181488 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - b _08181494 - .pool -_08181488: - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette -_08181494: - movs r0, 0 - strh r0, [r4, 0x36] - ldr r1, =gUnknown_0860AA64 -_0818149A: - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r1, 0x1 - adds r0, r1 - ldrb r1, [r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - bne _081814C8 - movs r1, 0 - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - b _081814CE - .pool -_081814C8: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081814CE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_2C - - thumb_func_start sub_81814D4 -sub_81814D4: @ 81814D4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081814E6 - adds r0, r6, 0 - bl sub_817F670 -_081814E6: - adds r0, r6, 0 - bl sub_817F70C - ldr r4, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r6, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r3, 0x8 - ldrsh r0, [r2, r3] - cmp r1, r0 - ble _0818154C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r3, 0 - strh r3, [r6, 0x24] - movs r0, 0x2E - ldrsh r1, [r6, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r2, [r1, 0x4] - movs r4, 0x4 - ldrsh r0, [r1, r4] - cmp r0, 0x1 - ble _0818153C - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r6, 0x32] - b _08181588 - .pool -_0818153C: - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08181588 - .pool -_0818154C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r3, 0x8 - ldrsh r1, [r2, r3] - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r6, 0x24] - movs r5, 0x80 - lsls r5, 1 - ldr r1, =0x00000ccc - adds r0, r4, 0 - bl Sin - adds r3, r0, 0 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl sub_817F6D4 -_08181588: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81814D4 - - thumb_func_start pokemonanimfunc_2D -pokemonanimfunc_2D: @ 81815A0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81814D4 - ldr r0, =sub_81814D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2D - - thumb_func_start sub_81815D4 -sub_81815D4: @ 81815D4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081815E6 - adds r0, r6, 0 - bl sub_817F670 -_081815E6: - adds r0, r6, 0 - bl sub_817F70C - ldr r4, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r6, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r4 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r3, 0x8 - ldrsh r0, [r2, r3] - cmp r1, r0 - ble _0818164C - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r3, 0 - strh r3, [r6, 0x24] - movs r0, 0x2E - ldrsh r1, [r6, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r2, [r1, 0x4] - movs r4, 0x4 - ldrsh r0, [r1, r4] - cmp r0, 0x1 - ble _0818163C - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r3, [r6, 0x32] - b _0818168A - .pool -_0818163C: - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _0818168A - .pool -_0818164C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - lsls r0, 8 - movs r3, 0x8 - ldrsh r1, [r2, r3] - bl __divsi3 - adds r4, r0, 0 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0xA - bl Sin - negs r0, r0 - strh r0, [r6, 0x24] - movs r5, 0x80 - lsls r5, 1 - ldr r1, =0x00000ccc - adds r0, r4, 0 - bl Sin - adds r3, r0, 0 - negs r3, r3 - lsls r3, 16 - lsrs r3, 16 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl sub_817F6D4 -_0818168A: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81815D4 - - thumb_func_start pokemonanimfunc_2E -pokemonanimfunc_2E: @ 81816A0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81815D4 - ldr r0, =sub_81815D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2E - - thumb_func_start pokemonanimfunc_2F -pokemonanimfunc_2F: @ 81816D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - adds r0, r4, 0 - adds r0, 0x28 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - movs r1, 0xA - bl __divsi3 - negs r0, r0 - strh r0, [r4, 0x3A] - movs r0, 0x80 - strh r0, [r4, 0x3C] - ldr r0, =sub_8181708 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_2F - - thumb_func_start sub_8181708 -sub_8181708: @ 8181708 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - subs r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Cos - ldrh r1, [r4, 0x3A] - adds r0, r1 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - subs r3, 0x80 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x78 - bgt _08181760 - movs r0, 0x78 - strh r0, [r4, 0x3C] - movs r0, 0 - strh r0, [r4, 0x34] - ldr r0, =sub_8181770 - str r0, [r4, 0x1C] -_08181760: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181708 - - thumb_func_start sub_8181770 -sub_8181770: @ 8181770 - push {lr} - adds r1, r0, 0 - movs r2, 0x34 - ldrsh r0, [r1, r2] - cmp r0, 0x14 - bne _08181784 - ldr r0, =sub_8181794 - str r0, [r1, 0x1C] - movs r0, 0 - strh r0, [r1, 0x34] -_08181784: - ldrh r0, [r1, 0x34] - adds r0, 0x1 - strh r0, [r1, 0x34] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181770 - - thumb_func_start sub_8181794 -sub_8181794: @ 8181794 - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - adds r0, 0x2 - movs r6, 0 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Cos - ldrh r1, [r4, 0x3A] - adds r0, r1 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r2, 0x3A - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r5, 0x80 - lsls r5, 1 - ldrh r3, [r4, 0x3C] - subs r3, 0x80 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - bl sub_817F6D4 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _08181800 - strh r6, [r4, 0x24] - strh r6, [r4, 0x26] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - movs r3, 0 - bl sub_817F6D4 - strh r6, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =pokemonanimfunc_10 - str r0, [r4, 0x1C] -_08181800: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181794 - - thumb_func_start sub_8181810 -sub_8181810: @ 8181810 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r4, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r4 - ldrh r0, [r1] - adds r6, r0, 0 - cmp r6, 0 - beq _08181834 - subs r0, 0x1 - strh r0, [r1] - b _08181950 - .pool -_08181834: - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0818184A - adds r0, r5, 0 - bl sub_817F670 - strh r6, [r5, 0x36] - strh r6, [r5, 0x38] - movs r0, 0x1 - strh r0, [r5, 0x32] -_0818184A: - movs r3, 0x38 - ldrsh r0, [r5, r3] - cmp r0, 0 - bne _081818A2 - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - bl Sin - strh r0, [r5, 0x3C] - movs r3, 0x36 - ldrsh r0, [r5, r3] - movs r1, 0x10 - bl Sin - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - adds r1, r0, 0 - strh r1, [r5, 0x3A] - subs r1, r4, r1 - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r5, 0x3C] - adds r2, r4 - lsls r2, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl sub_817F6D4 - movs r3, 0x36 - ldrsh r0, [r5, r3] - cmp r0, 0x80 - bne _0818193A - strh r6, [r5, 0x36] - movs r0, 0x1 - strh r0, [r5, 0x38] - b _0818193A -_081818A2: - cmp r0, 0x1 - bne _0818193A - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x20 - bl Sin - strh r0, [r5, 0x3C] - movs r3, 0x36 - ldrsh r0, [r5, r3] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r5, 0x26] - movs r1, 0x36 - ldrsh r0, [r5, r1] - movs r1, 0x80 - bl Sin - adds r1, r0, 0 - strh r1, [r5, 0x3A] - movs r3, 0x80 - lsls r3, 1 - adds r2, r3, 0 - adds r1, r2 - lsls r1, 16 - asrs r1, 16 - ldrh r0, [r5, 0x3C] - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl sub_817F6D4 - movs r1, 0x36 - ldrsh r0, [r5, r1] - cmp r0, 0x80 - bne _0818193A - movs r3, 0x2E - ldrsh r0, [r5, r3] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrh r2, [r1, 0x4] - movs r3, 0x4 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _08181922 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - movs r0, 0x2E - ldrsh r1, [r5, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xA - strh r1, [r0] - strh r6, [r5, 0x36] - strh r6, [r5, 0x38] - b _0818193A -_08181922: - movs r2, 0x80 - lsls r2, 1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r5, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] -_0818193A: - ldr r2, =gUnknown_03001240 - movs r3, 0x2E - ldrsh r1, [r5, r3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x6] - ldrh r1, [r5, 0x36] - adds r0, r1 - strh r0, [r5, 0x36] -_08181950: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181810 - - thumb_func_start pokemonanimfunc_30 -pokemonanimfunc_30: @ 8181960 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - adds r0, r4, 0 - bl sub_8181810 - ldr r0, =sub_8181810 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_30 - - thumb_func_start pokemonanimfunc_31 -pokemonanimfunc_31: @ 8181994 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r4, [r5, r0] - adds r0, r5, 0 - bl sub_817F70C - movs r0, 0x80 - lsls r0, 2 - cmp r4, r0 - ble _081819B8 - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - movs r0, 0 - strh r0, [r5, 0x24] - b _08181A62 - .pool -_081819B8: - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bge _081819C2 - adds r0, 0x7F -_081819C2: - asrs r0, 7 - cmp r0, 0x1 - beq _081819F8 - cmp r0, 0x1 - bgt _081819D2 - cmp r0, 0 - beq _081819DC - b _08181A48 -_081819D2: - cmp r0, 0x2 - beq _08181A12 - cmp r0, 0x3 - beq _08181A2A - b _08181A48 -_081819DC: - adds r0, r4, 0 - cmp r4, 0 - bge _081819E4 - adds r0, 0x7F -_081819E4: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _081819F4 - adds r0, 0x7F -_081819F4: - asrs r0, 7 - b _08181A46 -_081819F8: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A00 - adds r0, 0x7F -_08181A00: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - cmp r0, 0 - bge _08181A0C - adds r0, 0xF -_08181A0C: - asrs r0, 4 - subs r0, 0x8 - b _08181A46 -_08181A12: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A1A - adds r0, 0x7F -_08181A1A: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - cmp r0, 0 - bge _08181A26 - adds r0, 0xF -_08181A26: - asrs r0, 4 - b _08181A46 -_08181A2A: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A32 - adds r0, 0x7F -_08181A32: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 3 - negs r0, r0 - cmp r0, 0 - bge _08181A42 - adds r0, 0x7F -_08181A42: - asrs r0, 7 - adds r0, 0x8 -_08181A46: - strh r0, [r5, 0x24] -_08181A48: - adds r0, r4, 0 - cmp r4, 0 - bge _08181A50 - adds r0, 0x7F -_08181A50: - asrs r0, 7 - lsls r0, 7 - subs r0, r4, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_08181A62: - strh r0, [r5, 0x26] - ldrh r0, [r5, 0x32] - adds r0, 0xC - strh r0, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_31 - - thumb_func_start pokemonanimfunc_32 -pokemonanimfunc_32: @ 8181A78 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldr r0, =0x0000ffff - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_817F670 - strh r5, [r4, 0x34] - adds r0, r4, 0 - bl sub_8181ABC - ldr r0, =sub_8181ABC - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_32 - - thumb_func_start sub_8181ABC -sub_8181ABC: @ 8181ABC - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r6 - ldrh r0, [r1] - adds r5, r0, 0 - cmp r5, 0 - beq _08181AE0 - subs r0, 0x1 - strh r0, [r1] - b _08181B44 - .pool -_08181AE0: - adds r0, r4, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r0, 0x80 - ble _08181AFC - strh r5, [r4, 0x32] - ldr r0, =sub_8181B4C - str r0, [r4, 0x1C] - b _08181B3E - .pool -_08181AFC: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - movs r3, 0x8 - ldrsh r0, [r1, r3] - lsls r3, r0, 3 - adds r0, r2, 0 - cmp r2, 0 - bge _08181B16 - adds r0, 0x7F -_08181B16: - asrs r0, 7 - lsls r0, 7 - subs r1, r2, r0 - adds r0, r3, 0 - muls r0, r1 - cmp r0, 0 - bge _08181B26 - adds r0, 0x7F -_08181B26: - asrs r0, 7 - strh r0, [r4, 0x24] - lsls r0, r1, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] -_08181B3E: - adds r0, r4, 0 - bl sub_817F70C -_08181B44: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8181ABC - - thumb_func_start sub_8181B4C -sub_8181B4C: @ 8181B4C - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x30 - ble _08181B7C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r0, 0 - strh r0, [r4, 0x26] - strh r0, [r4, 0x32] - ldr r0, =sub_8181C2C - str r0, [r4, 0x1C] - b _08181C1A - .pool -_08181B7C: - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x40 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r6, r1, 0 - adds r0, r6 - lsls r0, 16 - lsrs r3, r0, 16 - ldrh r0, [r4, 0x32] - subs r0, 0x10 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xF - bhi _08181BBA - ldrh r0, [r4, 0x34] - adds r0, 0x8 - strh r0, [r4, 0x34] - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r4, 0x24] - ldrh r0, [r0, 0x8] - subs r1, r0 - strh r1, [r4, 0x24] -_08181BBA: - movs r5, 0 - lsls r1, r3, 16 - asrs r2, r1, 16 - lsls r0, r6, 16 - asrs r0, 16 - adds r6, r1, 0 - cmp r2, r0 - ble _08181BD6 - subs r0, r2 - cmp r0, 0 - bge _08181BD2 - adds r0, 0x7 -_08181BD2: - lsls r0, 13 - lsrs r5, r0, 16 -_08181BD6: - movs r1, 0x34 - ldrsh r0, [r4, r1] - movs r1, 0x14 - bl Sin - negs r0, r0 - lsls r1, r5, 16 - asrs r1, 16 - subs r0, r1 - strh r0, [r4, 0x26] - movs r2, 0x36 - ldrsh r0, [r4, r2] - movs r1, 0x20 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - asrs r1, 16 - asrs r2, r6, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x36] - adds r0, 0x8 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x36] -_08181C1A: - adds r0, r4, 0 - bl sub_817F70C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181B4C - - thumb_func_start sub_8181C2C -sub_8181C2C: @ 8181C2C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r3, [r4, r0] - cmp r3, 0x80 - ble _08181C90 - ldr r3, =gUnknown_03001240 - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrh r2, [r1, 0x4] - movs r5, 0x4 - ldrsh r0, [r1, r5] - cmp r0, 0x1 - ble _08181C7C - subs r0, r2, 0x1 - movs r2, 0 - strh r0, [r1, 0x4] - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0xA - strh r1, [r0] - strh r2, [r4, 0x34] - strh r2, [r4, 0x32] - strh r2, [r4, 0x36] - ldr r0, =sub_8181ABC - b _08181C84 - .pool -_08181C7C: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 -_08181C84: - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _08181CD0 - .pool -_08181C90: - ldr r2, =gUnknown_03001240 - movs r5, 0x2E - ldrsh r1, [r4, r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x8 - ldrsh r5, [r0, r1] - lsls r1, r5, 3 - adds r0, r3, 0 - cmp r3, 0 - bge _08181CAC - adds r0, 0x7F -_08181CAC: - asrs r0, 7 - lsls r0, 7 - subs r2, r3, r0 - adds r0, r1, 0 - muls r0, r2 - cmp r0, 0 - bge _08181CBC - adds r0, 0x7F -_08181CBC: - asrs r0, 7 - lsls r1, r5, 3 - subs r0, r1 - strh r0, [r4, 0x24] - lsls r0, r2, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 -_08181CD0: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181C2C - - thumb_func_start sub_8181CE8 -sub_8181CE8: @ 8181CE8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08181D00 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08181D00: - adds r0, r4, 0 - bl sub_817F70C - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r0, 0xFE - ble _08181D60 - movs r5, 0 - strh r5, [r4, 0x24] - strh r5, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - ldrh r2, [r1, 0x4] - movs r3, 0x4 - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _08181D48 - subs r0, r2, 0x1 - strh r0, [r1, 0x4] - strh r5, [r4, 0x32] - strh r5, [r4, 0x3C] - b _08181D52 - .pool -_08181D48: - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08181D52: - adds r0, r4, 0 - bl sub_817F70C - b _08181DA6 - .pool -_08181D60: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r3, 0x3C - ldrsh r0, [r4, r3] - movs r1, 0x20 - bl Sin - adds r3, r0, 0 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - ldr r2, =gUnknown_03001240 - movs r0, 0x2E - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x6] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F70C -_08181DA6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181CE8 - - thumb_func_start pokemonanimfunc_33 -pokemonanimfunc_33: @ 8181DB0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - adds r0, r4, 0 - bl sub_8181CE8 - ldr r0, =sub_8181CE8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_33 - - thumb_func_start pokemonanimfunc_34 -pokemonanimfunc_34: @ 8181DE4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08181DFC - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08181DFC: - adds r0, r4, 0 - bl sub_817F70C - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0xFE - ble _08181E34 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - adds r0, r4, 0 - bl sub_817F70C - b _08181E8A - .pool -_08181E34: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08181E4E - adds r0, 0x7F -_08181E4E: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - adds r3, r0, 0 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F70C -_08181E8A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_34 - - thumb_func_start pokemonanimfunc_35 -pokemonanimfunc_35: @ 8181E90 - push {r4,r5,lr} - adds r3, r0, 0 - movs r1, 0x32 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _08181E9E - strh r0, [r3, 0x3C] -_08181E9E: - ldrh r4, [r3, 0x32] - movs r5, 0x32 - ldrsh r1, [r3, r5] - ldrh r2, [r3, 0x3C] - movs r5, 0x3C - ldrsh r0, [r3, r5] - cmp r1, r0 - bne _08181EC8 - movs r0, 0 - strh r0, [r3, 0x3C] - adds r0, r4, 0x1 - strh r0, [r3, 0x32] - adds r1, r3, 0 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r2, r1, 0 - b _08181ED8 -_08181EC8: - adds r0, r2, 0x1 - strh r0, [r3, 0x3C] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_08181ED8: - movs r1, 0x32 - ldrsh r0, [r3, r1] - cmp r0, 0xA - ble _08181EEE - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - ldr r0, =sub_8184D88 - str r0, [r3, 0x1C] -_08181EEE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_35 - - thumb_func_start pokemonanimfunc_36 -pokemonanimfunc_36: @ 8181EF8 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r0, 0 - strh r0, [r4, 0x3C] - ldr r0, =sub_8181F14 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_36 - - thumb_func_start sub_8181F14 -sub_8181F14: @ 8181F14 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x1F - ble _08181F34 - movs r0, 0 - movs r1, 0x20 - strh r1, [r4, 0x3C] - strh r0, [r4, 0x32] - ldr r0, =sub_8181F50 - str r0, [r4, 0x1C] - b _08181F38 - .pool -_08181F34: - adds r0, r1, 0x4 - strh r0, [r4, 0x3C] -_08181F38: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181F14 - - thumb_func_start sub_8181F50 -sub_8181F50: @ 8181F50 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08181F74 - ldr r0, =sub_8181FC0 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08181FAE - .pool -_08181F74: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 4 - negs r0, r0 - cmp r0, 0 - bge _08181F84 - ldr r1, =0x000001ff - adds r0, r1 -_08181F84: - asrs r0, 9 - strh r0, [r4, 0x24] - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08181F94 - adds r0, 0x7F -_08181F94: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0xC - strh r0, [r4, 0x32] -_08181FAE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8181F50 - - thumb_func_start sub_8181FC0 -sub_8181FC0: @ 8181FC0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - subs r0, 0x2 - movs r1, 0 - strh r0, [r4, 0x3C] - lsls r0, 16 - cmp r0, 0 - bge _08181FEC - strh r1, [r4, 0x3C] - strh r1, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08181FFE - .pool -_08181FEC: - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsls r0, 17 - asrs r0, 16 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] -_08181FFE: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8181FC0 - - thumb_func_start pokemonanimfunc_37 -pokemonanimfunc_37: @ 818201C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182036 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182036: - adds r0, r4, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0xFF - ble _08182060 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _081820A6 - .pool -_08182060: - adds r0, r1, 0 - adds r0, 0x10 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182072 - adds r0, 0x7F -_08182072: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _08182092 - adds r0, 0x7F -_08182092: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_081820A6: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081820B2 - adds r0, 0x7F -_081820B2: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - adds r3, r0, 0 - movs r2, 0x80 - lsls r2, 1 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_37 - - thumb_func_start pokemonanimfunc_38 -pokemonanimfunc_38: @ 81820E0 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r0, 0 - strh r0, [r4, 0x3C] - strh r0, [r4, 0x36] - ldr r0, =sub_81820FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_38 - - thumb_func_start sub_81820FC -sub_81820FC: @ 81820FC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x18 - ble _0818212C - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _0818214A - movs r0, 0 - strh r0, [r4, 0x36] - ldr r0, =sub_818216C - str r0, [r4, 0x1C] - b _0818214A - .pool -_0818212C: - adds r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_0818214A: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81820FC - - thumb_func_start sub_818216C -sub_818216C: @ 818216C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x20 - ble _0818218C - movs r0, 0x1 - strh r0, [r4, 0x3A] - ldr r0, =sub_81821CC - str r0, [r4, 0x1C] - b _081821AA - .pool -_0818218C: - adds r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_081821AA: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_818216C - - thumb_func_start sub_81821CC -sub_81821CC: @ 81821CC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x9 - ble _081821F0 - movs r0, 0x20 - strh r0, [r4, 0x3C] - ldr r0, =sub_8182248 - str r0, [r4, 0x1C] -_081821F0: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - subs r0, 0x1D - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x6 - bls _08182224 - movs r1, 0x3A - ldrsh r0, [r4, r1] - negs r0, r0 - strh r0, [r4, 0x3A] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_08182224: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81821CC - - thumb_func_start sub_8182248 -sub_8182248: @ 8182248 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08182270 - movs r0, 0 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0818228E - .pool -_08182270: - subs r0, r1, 0x2 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] -_0818228E: - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3C] - negs r3, r3 - lsls r3, 24 - lsrs r3, 16 - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8182248 - - thumb_func_start pokemonanimfunc_39 -pokemonanimfunc_39: @ 81822B0 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _081822D0 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - b _0818235C - .pool -_081822D0: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _081822DC - movs r5, 0x1 -_081822DC: - movs r0, 0x32 - ldrsh r2, [r4, r0] - adds r0, r2, 0 - cmp r2, 0 - bge _081822E8 - adds r0, r2, 0x3 -_081822E8: - asrs r0, 2 - lsls r0, 2 - subs r0, r2, r0 - lsls r0, 16 - asrs r1, r0, 16 - lsrs r0, 31 - adds r1, r0 - asrs r1, 1 - cmp r1, 0 - bne _0818232C - lsls r0, r2, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0818230C - adds r0, 0xFF -_0818230C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 - strh r0, [r4, 0x24] - negs r0, r0 - b _0818235A -_0818232C: - lsls r0, r2, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _0818233C - adds r0, 0xFF -_0818233C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - bl Sin - lsls r0, 16 - asrs r0, 16 - negs r0, r0 - lsls r1, r5, 24 - asrs r1, 24 - muls r0, r1 - strh r0, [r4, 0x24] -_0818235A: - strh r0, [r4, 0x26] -_0818235C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_39 - - thumb_func_start pokemonanimfunc_3A -pokemonanimfunc_3A: @ 8182370 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182392 - adds r0, r4, 0 - bl sub_817F670 - strh r5, [r4, 0x38] - strh r5, [r4, 0x3A] - strh r5, [r4, 0x3C] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08182392: - ldrh r1, [r4, 0x3A] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _081823E4 - subs r0, r1, 0x1 - strh r0, [r4, 0x3A] - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - beq _08182494 - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r0, 3 - movs r1, 0x14 - bl __divsi3 - adds r1, r0, 0 - ldrh r0, [r4, 0x3C] - lsls r1, 16 - asrs r1, 16 - subs r0, r1 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x40 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - lsls r0, 16 - asrs r0, 16 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - b _08182494 -_081823E4: - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0x3 - bne _08182424 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08182410 - movs r0, 0x40 - strh r0, [r4, 0x3C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08182410: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x40 - bl Cos - lsls r0, 16 - lsrs r3, r0, 16 - b _08182474 - .pool -_08182424: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x40 - bl Sin - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x3F - ble _08182448 - movs r0, 0 - movs r1, 0x3 - strh r1, [r4, 0x38] - movs r1, 0xA - strh r1, [r4, 0x3A] - strh r0, [r4, 0x3C] - b _08182474 -_08182448: - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x30 - ble _0818245C - movs r1, 0x38 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _0818245C - movs r0, 0x2 - b _0818246E -_0818245C: - lsls r0, r3, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08182474 - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08182474 - movs r0, 0x1 -_0818246E: - strh r0, [r4, 0x38] - movs r0, 0x14 - strh r0, [r4, 0x3A] -_08182474: - ldrh r0, [r4, 0x3C] - adds r0, 0x2 - strh r0, [r4, 0x3C] - movs r0, 0x80 - lsls r0, 1 - adds r2, r0, 0 - lsls r0, r3, 16 - asrs r0, 16 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_08182494: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3A - - thumb_func_start pokemonanimfunc_3B -pokemonanimfunc_3B: @ 81824A0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081824BA - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_081824BA: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _081824E8 - movs r0, 0 - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08182540 - .pool -_081824E8: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081824F4 - adds r0, 0xFF -_081824F4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182518 - adds r0, 0x7F -_08182518: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - movs r1, 0x80 - lsls r1, 1 - lsls r2, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 -_08182540: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3B - - thumb_func_start pokemonanimfunc_3C -pokemonanimfunc_3C: @ 8182548 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182562 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182562: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r5, 0x80 - lsls r5, 1 - cmp r0, r5 - ble _08182590 - movs r0, 0 - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r5, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _081825D4 - .pool -_08182590: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x10 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x3C] - adds r0, 0x4 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081825AE - adds r0, 0x3F -_081825AE: - asrs r0, 6 - lsls r0, 6 - subs r0, r1, r0 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x80 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - asrs r2, 16 - adds r2, r5 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r5, 0 - movs r3, 0 - bl sub_817F6D4 -_081825D4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3C - - thumb_func_start pokemonanimfunc_3D -pokemonanimfunc_3D: @ 81825DC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - ldr r0, =sub_81825F8 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_3D - - thumb_func_start sub_81825F8 -sub_81825F8: @ 81825F8 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - movs r1, 0 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _0818261C - strh r1, [r4, 0x3C] - strh r1, [r4, 0x3A] - ldr r0, =sub_8182648 - str r0, [r4, 0x1C] - movs r0, 0x40 - b _08182620 - .pool -_0818261C: - movs r1, 0x3C - ldrsh r0, [r4, r1] -_08182620: - movs r1, 0x80 - bl Sin - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x80 - lsls r1, 1 - lsls r2, r0, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81825F8 - - thumb_func_start sub_8182648 -sub_8182648: @ 8182648 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x4 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5F - ble _08182672 - movs r0, 0 - movs r1, 0x80 - bl Cos - lsls r0, 16 - lsrs r2, r0, 16 - movs r0, 0 - strh r0, [r4, 0x3C] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - b _081826C8 -_08182672: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Sin - movs r2, 0x3A - ldrsh r1, [r4, r2] - lsls r1, 2 - negs r1, r1 - subs r1, r0 - strh r1, [r4, 0x26] - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0x3F - ble _081826A4 - ldr r5, =0x0000ffff - adds r0, r1, 0 - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - b _081826A8 - .pool -_081826A4: - movs r5, 0x1 - movs r0, 0 -_081826A8: - lsls r0, 16 - asrs r0, 15 - ldrh r1, [r4, 0x3C] - adds r0, r1 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x80 - bl Cos - lsls r1, r5, 16 - asrs r1, 16 - adds r2, r1, 0 - muls r2, r0 - adds r0, r2, 0 - lsls r0, 16 - lsrs r2, r0, 16 -_081826C8: - movs r1, 0x80 - lsls r1, 1 - lsls r2, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x3 - bne _081826EE - movs r0, 0 - strh r0, [r4, 0x3C] - ldr r0, =sub_81826F8 - str r0, [r4, 0x1C] -_081826EE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8182648 - - thumb_func_start sub_81826F8 -sub_81826F8: @ 81826F8 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x80 - bl Cos - lsls r0, 16 - lsrs r5, r0, 16 - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0xC - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0x3F - ble _08182742 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_08182742: - movs r1, 0x80 - lsls r1, 1 - lsls r2, r5, 16 - asrs r2, 16 - adds r2, r1 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81826F8 - - thumb_func_start sub_8182764 -sub_8182764: @ 8182764 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08182798 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - b _081827F4 - .pool -_08182798: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081827A4 - adds r0, 0xFF -_081827A4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _081827CC - adds r0, 0x7F -_081827CC: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - movs r0, 0x80 - lsls r0, 17 - adds r1, r0 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 -_081827F4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8182764 - - thumb_func_start pokemonanimfunc_3E -pokemonanimfunc_3E: @ 81827FC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182822 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r1, 0x8 - strh r1, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] -_08182822: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3E - - thumb_func_start sub_8182830 -sub_8182830: @ 8182830 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08182864 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - b _081828C0 - .pool -_08182864: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182870 - adds r0, 0xFF -_08182870: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3A] - ldrh r1, [r4, 0x3C] - adds r0, r1 - strh r0, [r4, 0x3C] - movs r2, 0x3C - ldrsh r1, [r4, r2] - adds r0, r1, 0 - cmp r1, 0 - bge _08182898 - adds r0, 0x3F -_08182898: - asrs r0, 6 - lsls r0, 6 - subs r0, r1, r0 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x80 - bl Sin - adds r1, r0, 0 - lsls r1, 16 - movs r0, 0x80 - lsls r0, 17 - adds r1, r0 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - movs r3, 0 - bl sub_817F6D4 -_081828C0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8182830 - - thumb_func_start pokemonanimfunc_3F -pokemonanimfunc_3F: @ 81828C8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081828EE - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - adds r0, 0xFC - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_081828EE: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_3F - - thumb_func_start pokemonanimfunc_40 -pokemonanimfunc_40: @ 81828FC - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _0818291A - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_0818291A: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08182948 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0818299E - .pool -_08182948: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182954 - adds r0, 0xFF -_08182954: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182978 - adds r0, 0x7F -_08182978: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_0818299E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_40 - - thumb_func_start pokemonanimfunc_41 -pokemonanimfunc_41: @ 81829AC - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _081829CA - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_081829CA: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _081829F8 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08182A5E - .pool -_081829F8: - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182A04 - adds r1, 0xFF -_08182A04: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x10 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182A30 - adds r1, 0xFF -_08182A30: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x40 - bl Sin - adds r2, r0, 0 - negs r2, r2 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_08182A5E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_41 - - thumb_func_start pokemonanimfunc_42 -pokemonanimfunc_42: @ 8182A6C - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08182A8A - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] -_08182A8A: - movs r0, 0x3C - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 2 - cmp r1, r0 - ble _08182AB8 - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08182B16 - .pool -_08182AB8: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182AC4 - adds r0, 0xFF -_08182AC4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x8 - strh r0, [r4, 0x3C] - movs r1, 0x3C - ldrsh r0, [r4, r1] - adds r1, r0, 0 - cmp r0, 0 - bge _08182AEA - adds r1, 0xFF -_08182AEA: - asrs r1, 8 - lsls r1, 8 - subs r1, r0, r1 - lsls r1, 16 - asrs r0, r1, 16 - lsrs r1, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x60 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - movs r0, 0x80 - lsls r0, 17 - adds r2, r0 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_08182B16: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_42 - - thumb_func_start pokemonanimfunc_43 -pokemonanimfunc_43: @ 8182B24 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08182B48 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08182C08 - .pool -_08182B48: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08182B56 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08182B56: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08182B62 - adds r0, r1, 0x3 -_08182B62: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08182BA4 - cmp r0, 0x1 - bgt _08182B80 - cmp r0, 0 - beq _08182B8A - b _08182BE2 - .pool -_08182B80: - cmp r0, 0x2 - beq _08182BB8 - cmp r0, 0x3 - beq _08182BCA - b _08182BE2 -_08182B8A: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08182B9C - ldr r1, =0x000001ff - adds r0, r1 -_08182B9C: - asrs r0, 9 - b _08182BE0 - .pool -_08182BA4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08182BB2 - adds r0, 0x1F -_08182BB2: - asrs r0, 5 - subs r0, 0x10 - b _08182BE0 -_08182BB8: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08182BC6 - adds r0, 0x1F -_08182BC6: - asrs r0, 5 - b _08182BE0 -_08182BCA: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08182BDC - ldr r1, =0x000001ff - adds r0, r1 -_08182BDC: - asrs r0, 9 - adds r0, 0x10 -_08182BE0: - strh r0, [r4, 0x24] -_08182BE2: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08182BEE - adds r0, 0x7F -_08182BEE: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x18 - strh r0, [r4, 0x32] -_08182C08: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_43 - - thumb_func_start pokemonanimfunc_44 -pokemonanimfunc_44: @ 8182C18 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08182C34 - strh r0, [r4, 0x3A] - movs r0, 0x40 - strh r0, [r4, 0x3C] - adds r0, r1, 0x1 - strh r0, [r4, 0x32] -_08182C34: - ldrh r0, [r4, 0x3C] - adds r1, r0, 0 - adds r1, 0x8 - movs r3, 0 - strh r1, [r4, 0x3C] - ldrh r2, [r4, 0x3A] - movs r5, 0x3A - ldrsh r0, [r4, r5] - cmp r0, 0x4 - bne _08182C52 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _08182C60 - b _08182C5A -_08182C52: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _08182C60 -_08182C5A: - strh r3, [r4, 0x3C] - adds r0, r2, 0x1 - strh r0, [r4, 0x3A] -_08182C60: - movs r1, 0x3A - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _08182D08 - lsls r0, 2 - ldr r1, =_08182C78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08182C78: - .4byte _08182CEC - .4byte _08182C8C - .4byte _08182CAA - .4byte _08182CCC - .4byte _08182CEC -_08182C8C: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Cos - negs r0, r0 - strh r0, [r4, 0x24] - movs r5, 0x3C - ldrsh r0, [r4, r5] - movs r1, 0x8 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x26] - b _08182D12 -_08182CAA: - ldrh r0, [r4, 0x3C] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - b _08182D12 -_08182CCC: - movs r2, 0x3C - ldrsh r0, [r4, r2] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x3C] - adds r0, 0x80 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - adds r0, 0x8 - strh r0, [r4, 0x26] - b _08182D12 -_08182CEC: - movs r5, 0x3C - ldrsh r0, [r4, r5] - movs r1, 0x8 - bl Sin - subs r0, 0x8 - strh r0, [r4, 0x24] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x26] - b _08182D12 -_08182D08: - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_08182D12: - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_44 - - thumb_func_start pokemonanimfunc_45 -pokemonanimfunc_45: @ 8182D24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x20 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_8180714 - ldr r0, =sub_8180714 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_45 - - thumb_func_start pokemonanimfunc_46 -pokemonanimfunc_46: @ 8182D40 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_46 - - thumb_func_start pokemonanimfunc_47 -pokemonanimfunc_47: @ 8182D5C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x50 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F978 - ldr r0, =sub_817F978 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_47 - - thumb_func_start pokemonanimfunc_48 -pokemonanimfunc_48: @ 8182D78 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 4 - strh r0, [r1, 0x6] - ldrh r0, [r4, 0x3A] - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_8180900 - ldr r0, =sub_8180900 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_48 - - thumb_func_start pokemonanimfunc_49 -pokemonanimfunc_49: @ 8182DB4 - push {lr} - movs r1, 0x1 - strh r1, [r0, 0x3A] - bl pokemonanimfunc_05 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_49 - - thumb_func_start pokemonanimfunc_4A -pokemonanimfunc_4A: @ 8182DC4 - push {lr} - movs r1, 0x1 - strh r1, [r0, 0x3A] - bl pokemonanimfunc_48 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_4A - - thumb_func_start pokemonanimfunc_4B -pokemonanimfunc_4B: @ 8182DD4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08182DE2 - strh r0, [r4, 0x2E] -_08182DE2: - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0 - bgt _08182DF6 - adds r0, r4, 0 - bl sub_817FC20 - movs r0, 0x1 - b _08182DF8 -_08182DF6: - subs r0, r1, 0x1 -_08182DF8: - strh r0, [r4, 0x2E] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_4B - - thumb_func_start pokemonanimfunc_4C -pokemonanimfunc_4C: @ 8182E00 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4C - - thumb_func_start pokemonanimfunc_4D -pokemonanimfunc_4D: @ 8182E20 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817FD44 - ldr r0, =sub_817FD44 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4D - - thumb_func_start pokemonanimfunc_4E -pokemonanimfunc_4E: @ 8182E3C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 3 - strh r0, [r1, 0x6] - strh r3, [r1] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_817FE30 - ldr r0, =sub_817FE30 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4E - - thumb_func_start pokemonanimfunc_4F -pokemonanimfunc_4F: @ 8182E7C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 2 - strh r0, [r1, 0x6] - movs r0, 0x3 - strh r0, [r1, 0x8] - movs r0, 0xC - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_4F - - thumb_func_start pokemonanimfunc_50 -pokemonanimfunc_50: @ 8182EBC - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x18 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_818031C - ldr r0, =sub_818031C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_50 - - thumb_func_start pokemonanimfunc_51 -pokemonanimfunc_51: @ 8182ED8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_81804F8 - ldr r0, =sub_81804F8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_51 - - thumb_func_start pokemonanimfunc_52 -pokemonanimfunc_52: @ 8182EF4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F9F4 - ldr r0, =sub_817F9F4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_52 - - thumb_func_start pokemonanimfunc_53 -pokemonanimfunc_53: @ 8182F10 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x3C - strh r0, [r1] - movs r0, 0x1E - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_817FF3C - ldr r0, =sub_817FF3C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_53 - - thumb_func_start pokemonanimfunc_54 -pokemonanimfunc_54: @ 8182F48 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x1 - strh r0, [r1, 0x2] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_8181214 - ldr r0, =sub_8181214 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_54 - - thumb_func_start pokemonanimfunc_55 -pokemonanimfunc_55: @ 8182F80 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_8181810 - ldr r0, =sub_8181810 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_55 - - thumb_func_start pokemonanimfunc_56 -pokemonanimfunc_56: @ 8182FB8 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_817F670 - strh r5, [r4, 0x34] - adds r0, r4, 0 - bl sub_8181ABC - ldr r0, =sub_8181ABC - str r0, [r4, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_56 - - thumb_func_start pokemonanimfunc_07 -pokemonanimfunc_07: @ 8182FFC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x2 - strh r0, [r1, 0x6] - adds r0, r4, 0 - bl sub_8181CE8 - ldr r0, =sub_8181CE8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_07 - - thumb_func_start pokemonanimfunc_08 -pokemonanimfunc_08: @ 8183030 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x4 - strh r0, [r1, 0x6] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_8181CE8 - ldr r0, =sub_8181CE8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_08 - - thumb_func_start pokemonanimfunc_0B -pokemonanimfunc_0B: @ 8183068 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x64 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81814D4 - ldr r0, =sub_81814D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0B - - thumb_func_start pokemonanimfunc_0C -pokemonanimfunc_0C: @ 818309C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81814D4 - ldr r0, =sub_81814D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0C - - thumb_func_start pokemonanimfunc_0D -pokemonanimfunc_0D: @ 81830D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x64 - strh r0, [r1, 0x8] - adds r0, r4, 0 - bl sub_81815D4 - ldr r0, =sub_81815D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0D - - thumb_func_start pokemonanimfunc_0E -pokemonanimfunc_0E: @ 8183108 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x32 - strh r0, [r1, 0x8] - movs r0, 0x2 - strh r0, [r1, 0x4] - adds r0, r4, 0 - bl sub_81815D4 - ldr r0, =sub_81815D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_0E - - thumb_func_start sub_8183140 -sub_8183140: @ 8183140 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r0, 0x90 - lsls r0, 4 - cmp r2, r0 - ble _0818315C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _08183180 - .pool -_0818315C: - adds r1, r2, 0 - adds r1, 0xC0 - adds r0, r1, 0 - cmp r1, 0 - bge _0818316A - ldr r3, =0x000001bf - adds r0, r2, r3 -_0818316A: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl Sin - ldrh r1, [r4, 0x3C] - adds r0, r1 -_08183180: - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - ldrh r3, [r4, 0x32] - adds r0, r3 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8183140 - - thumb_func_start pokemonanimfunc_57 -pokemonanimfunc_57: @ 8183194 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3C - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_57 - - thumb_func_start pokemonanimfunc_58 -pokemonanimfunc_58: @ 81831B4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1E - strh r0, [r4, 0x2E] - movs r0, 0x3 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_58 - - thumb_func_start pokemonanimfunc_59 -pokemonanimfunc_59: @ 81831D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _081831F8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _081832BC - .pool -_081831F8: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08183206 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08183206: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08183212 - adds r0, r1, 0x3 -_08183212: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183268 - cmp r0, 0x1 - bgt _08183230 - cmp r0, 0 - beq _0818323A - b _08183298 - .pool -_08183230: - cmp r0, 0x2 - beq _0818324C - cmp r0, 0x3 - beq _08183284 - b _08183298 -_0818323A: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183248 - adds r0, 0x1F -_08183248: - asrs r0, 5 - b _08183296 -_0818324C: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _0818325E - ldr r1, =0x000001ff - adds r0, r1 -_0818325E: - asrs r0, 9 - b _08183296 - .pool -_08183268: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _0818327A - ldr r1, =0x000001ff - adds r0, r1 -_0818327A: - asrs r0, 9 - adds r0, 0x10 - b _08183296 - .pool -_08183284: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183292 - adds r0, 0x1F -_08183292: - asrs r0, 5 - subs r0, 0x10 -_08183296: - strh r0, [r4, 0x24] -_08183298: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081832A4 - adds r0, 0x7F -_081832A4: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x18 - strh r0, [r4, 0x32] -_081832BC: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_59 - - thumb_func_start sub_81832C8 -sub_81832C8: @ 81832C8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - movs r0, 0 - mov r8, r0 - movs r2, 0x38 - ldrsh r1, [r6, r2] - movs r2, 0x3A - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818331A - mov r0, r8 - strh r0, [r6, 0x26] - strh r0, [r6, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r1, [r6, 0x36] - movs r2, 0x36 - ldrsh r0, [r6, r2] - cmp r0, 0x1 - bgt _08183310 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _081833DC - .pool -_08183310: - subs r0, r1, 0x1 - strh r0, [r6, 0x36] - mov r0, r8 - strh r0, [r6, 0x3C] - b _081833DC -_0818331A: - movs r1, 0x38 - ldrsh r5, [r6, r1] - lsls r0, r5, 7 - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r4, 0 - bge _08183334 - adds r4, 0x3 -_08183334: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r5, r1 - blt _08183358 - cmp r5, r0 - bge _08183358 - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r1, 0xFF - mov r8, r1 - ands r1, r0 - mov r8, r1 -_08183358: - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0818337C - lsls r4, r2, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - ldr r2, =0xffffff00 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - b _08183392 - .pool -_0818337C: - lsls r4, r2, 16 - asrs r0, r4, 16 - movs r1, 0x10 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 -_08183392: - adds r7, r4, 0 - ldrh r4, [r6, 0x34] - lsls r4, 24 - lsrs r4, 24 - mov r5, r8 - adds r0, r4, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl Sin - adds r5, r0, 0 - asrs r0, r7, 16 - adds r1, r4, 0 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - subs r2, r5 - subs r2, r0 - mov r0, r9 - lsls r1, r0, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r6, 0 - movs r3, 0 - bl sub_817F618 - ldrh r0, [r6, 0x38] - adds r0, 0x1 - strh r0, [r6, 0x38] -_081833DC: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81832C8 - - thumb_func_start pokemonanimfunc_5A -pokemonanimfunc_5A: @ 81833E8 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _0818340A - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_0818340A: - adds r0, r5, 0 - bl sub_81832C8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5A - - thumb_func_start sub_8183418 -sub_8183418: @ 8183418 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - movs r0, 0 - mov r8, r0 - movs r2, 0x38 - ldrsh r1, [r6, r2] - movs r2, 0x3A - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818346A - mov r0, r8 - strh r0, [r6, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r1, [r6, 0x36] - movs r2, 0x36 - ldrsh r0, [r6, r2] - cmp r0, 0x1 - bgt _08183460 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08183538 - .pool -_08183460: - subs r0, r1, 0x1 - strh r0, [r6, 0x36] - mov r0, r8 - strh r0, [r6, 0x3C] - b _08183538 -_0818346A: - movs r1, 0x38 - ldrsh r5, [r6, r1] - lsls r0, r5, 7 - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - cmp r4, 0 - bge _08183486 - adds r4, 0x3 -_08183486: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r5, r1 - blt _081834AC - cmp r5, r0 - bge _081834AC - ldrh r0, [r6, 0x3C] - adds r0, 0x33 - strh r0, [r6, 0x3C] - movs r1, 0xFF - mov r8, r1 - mov r2, r8 - ands r2, r0 - mov r8, r2 -_081834AC: - ldrh r0, [r6, 0x34] - lsls r0, 24 - lsrs r7, r0, 24 - movs r1, 0x30 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _081834F0 - mov r2, r9 - lsls r0, r2, 16 - asrs r0, 16 - adds r1, r7, 0 - bl Sin - adds r4, r0, 0 - mov r5, r8 - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r5, 0 - bl Sin - ldr r1, =0xffffff00 - adds r0, r1 - adds r4, r0 - lsls r4, 16 - lsrs r1, r4, 16 - b _08183522 - .pool -_081834F0: - mov r4, r8 - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r4, 0 - bl Sin - adds r4, r0, 0 - mov r2, r9 - lsls r0, r2, 16 - asrs r0, 16 - adds r1, r7, 0 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r4 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 -_08183522: - lsls r1, 16 - asrs r1, 16 - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - movs r3, 0 - bl sub_817F618 - ldrh r0, [r6, 0x38] - adds r0, 0x1 - strh r0, [r6, 0x38] -_08183538: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183418 - - thumb_func_start pokemonanimfunc_5B -pokemonanimfunc_5B: @ 8183544 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183566 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183566: - adds r0, r5, 0 - bl sub_8183418 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5B - - thumb_func_start sub_8183574 -sub_8183574: @ 8183574 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r4, r0, 0 - ldrh r0, [r4, 0x32] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldrh r0, [r4, 0x3A] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r3, =gUnknown_0860AA80 - movs r1, 0x38 - ldrsh r0, [r4, r1] - lsls r1, r0, 1 - adds r0, r1, r3 - ldrb r5, [r0] - adds r2, r5, 0 - cmp r5, 0xFF - beq _081835A6 - ldrh r0, [r4, 0x3C] - lsls r0, 24 - lsrs r5, r0, 24 -_081835A6: - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r6, [r0] - movs r7, 0 - cmp r2, 0xFE - beq _081835C2 - mov r1, r9 - subs r0, r6, r1 - muls r0, r5 - adds r1, r6, 0 - bl __divsi3 - lsls r0, 24 - lsrs r7, r0, 24 -_081835C2: - cmp r5, 0xFF - bne _081835D8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x26] - b _0818360A - .pool -_081835D8: - mov r1, r8 - adds r1, 0xC0 - adds r0, r1, 0 - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - adds r1, r7, 0 - bl Sin - adds r0, r7 - strh r0, [r4, 0x26] - cmp r9, r6 - bne _081835FC - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - movs r0, 0 - b _08183608 -_081835FC: - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x32] - adds r0, r1 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 -_08183608: - strh r0, [r4, 0x3A] -_0818360A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183574 - - thumb_func_start pokemonanimfunc_5C -pokemonanimfunc_5C: @ 8183618 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x28 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5C - - thumb_func_start pokemonanimfunc_5D -pokemonanimfunc_5D: @ 8183638 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x46 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_817FCDC - ldr r0, =sub_817FCDC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5D - - thumb_func_start pokemonanimfunc_5E -pokemonanimfunc_5E: @ 8183658 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x14 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl sub_817F8FC - ldr r0, =sub_817F8FC - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_5E - - thumb_func_start pokemonanimfunc_5F -pokemonanimfunc_5F: @ 8183674 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _08183690 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _081836CA - .pool -_08183690: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _0818369C - movs r5, 0x1 -_0818369C: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081836B0 - adds r0, 0xFF -_081836B0: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x9 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_081836CA: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_5F - - thumb_func_start pokemonanimfunc_60 -pokemonanimfunc_60: @ 81836D8 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x32] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0x28 - ble _081836F4 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - b _0818372E - .pool -_081836F4: - movs r0, 0x1 - ands r0, r1 - movs r5, 0xFF - cmp r0, 0 - bne _08183700 - movs r5, 0x1 -_08183700: - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r1, 0x28 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _08183714 - adds r0, 0xFF -_08183714: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0xC - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 -_0818372E: - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_60 - - thumb_func_start pokemonanimfunc_61 -pokemonanimfunc_61: @ 818373C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x46 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183140 - ldr r0, =sub_8183140 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_61 - - thumb_func_start pokemonanimfunc_62 -pokemonanimfunc_62: @ 818375C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x18 - strh r0, [r4, 0x2E] - movs r0, 0x6 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_62 - - thumb_func_start pokemonanimfunc_63 -pokemonanimfunc_63: @ 818377C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x38 - strh r0, [r4, 0x2E] - movs r0, 0x9 - strh r0, [r4, 0x3C] - adds r0, r4, 0 - bl sub_8183574 - ldr r0, =sub_8183574 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_63 - - thumb_func_start pokemonanimfunc_64 -pokemonanimfunc_64: @ 818379C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2E] - ldr r2, =gUnknown_03001240 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0x80 - lsls r0, 3 - strh r0, [r1, 0x6] - movs r0, 0x6 - strh r0, [r1, 0x8] - movs r0, 0x18 - strh r0, [r1, 0x2] - adds r0, r4, 0 - bl sub_817FFF0 - ldr r0, =sub_817FFF0 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_64 - - thumb_func_start sub_81837DC -sub_81837DC: @ 81837DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r7, r0, 0 - movs r5, 0 - movs r0, 0x38 - ldrsh r1, [r7, r0] - movs r2, 0x3A - ldrsh r0, [r7, r2] - cmp r1, r0 - ble _0818382C - strh r5, [r7, 0x26] - strh r5, [r7, 0x38] - movs r2, 0x80 - lsls r2, 1 - adds r0, r7, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - ldrh r1, [r7, 0x36] - movs r2, 0x36 - ldrsh r0, [r7, r2] - cmp r0, 0x1 - bgt _08183824 - adds r0, r7, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r7, 0x1C] - b _0818392C - .pool -_08183824: - subs r0, r1, 0x1 - strh r0, [r7, 0x36] - strh r5, [r7, 0x3C] - b _0818392C -_0818382C: - movs r0, 0x38 - ldrsh r6, [r7, r0] - lsls r0, r6, 7 - movs r1, 0x3A - ldrsh r4, [r7, r1] - adds r1, r4, 0 - bl __divsi3 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r4, 0 - bge _08183846 - adds r4, 0x3 -_08183846: - asrs r1, r4, 2 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r6, r1 - blt _08183866 - cmp r6, r0 - bge _08183866 - ldrh r0, [r7, 0x3C] - adds r0, 0x33 - strh r0, [r7, 0x3C] - movs r5, 0xFF - ands r5, r0 -_08183866: - ldrh r0, [r7, 0x34] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r1, 0x30 - ldrsh r0, [r7, r1] - cmp r0, 0 - bne _081838B0 - lsls r2, 16 - mov r8, r2 - asrs r0, r2, 16 - mov r1, r9 - bl Sin - adds r4, r0, 0 - lsls r6, r5, 16 - asrs r5, r6, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r5, 0 - bl Sin - ldr r2, =0xffffff00 - adds r4, r2 - adds r0, r4 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - mov r0, r8 - b _081838EA - .pool -_081838B0: - lsls r2, 16 - mov r8, r2 - asrs r0, r2, 16 - mov r1, r9 - bl Sin - adds r6, r0, 0 - lsls r5, 16 - asrs r4, r5, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 23 - adds r0, r4, 0 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r6 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - mov r10, r1 - mov r0, r8 - adds r6, r5, 0 -_081838EA: - asrs r0, 16 - mov r1, r9 - bl Sin - adds r5, r0, 0 - asrs r4, r6, 16 - mov r0, r9 - movs r1, 0x5 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r2, r1, 0 - subs r2, r5 - subs r2, r0 - mov r0, r10 - lsls r1, r0, 16 - asrs r1, 16 - lsls r2, 16 - asrs r2, 16 - adds r0, r7, 0 - movs r3, 0 - bl sub_817F618 - ldrh r0, [r7, 0x38] - adds r0, 0x1 - strh r0, [r7, 0x38] -_0818392C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81837DC - - thumb_func_start pokemonanimfunc_65 -pokemonanimfunc_65: @ 818393C - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _0818395E - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x28 - strh r0, [r5, 0x3A] - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_0818395E: - adds r0, r5, 0 - bl sub_81837DC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_65 - - thumb_func_start pokemonanimfunc_66 -pokemonanimfunc_66: @ 818396C - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08183990 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08183A54 - .pool -_08183990: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _0818399E - ldr r1, =0x000001ff - adds r0, r2, r1 -_0818399E: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _081839AA - adds r0, r1, 0x3 -_081839AA: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183A00 - cmp r0, 0x1 - bgt _081839C8 - cmp r0, 0 - beq _081839D2 - b _08183A30 - .pool -_081839C8: - cmp r0, 0x2 - beq _081839E4 - cmp r0, 0x3 - beq _08183A1C - b _08183A30 -_081839D2: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _081839E0 - adds r0, 0x1F -_081839E0: - asrs r0, 5 - b _08183A2E -_081839E4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _081839F6 - ldr r1, =0x000001ff - adds r0, r1 -_081839F6: - asrs r0, 9 - b _08183A2E - .pool -_08183A00: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183A12 - ldr r1, =0x000001ff - adds r0, r1 -_08183A12: - asrs r0, 9 - adds r0, 0x10 - b _08183A2E - .pool -_08183A1C: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183A2A - adds r0, 0x1F -_08183A2A: - asrs r0, 5 - subs r0, 0x10 -_08183A2E: - strh r0, [r4, 0x24] -_08183A30: - movs r0, 0x32 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08183A3C - adds r0, 0x7F -_08183A3C: - asrs r0, 7 - lsls r0, 7 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x30 - strh r0, [r4, 0x32] -_08183A54: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_66 - - thumb_func_start pokemonanimfunc_67 -pokemonanimfunc_67: @ 8183A60 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r1, [r4, r0] - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - ble _08183A84 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3A] - b _08183B40 - .pool -_08183A84: - movs r1, 0x32 - ldrsh r2, [r4, r1] - adds r0, r2, 0 - cmp r2, 0 - bge _08183A92 - ldr r1, =0x000001ff - adds r0, r2, r1 -_08183A92: - asrs r3, r0, 9 - adds r1, r3, 0 - adds r0, r1, 0 - cmp r1, 0 - bge _08183A9E - adds r0, r1, 0x3 -_08183A9E: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - beq _08183AF4 - cmp r0, 0x1 - bgt _08183ABC - cmp r0, 0 - beq _08183AC6 - b _08183B24 - .pool -_08183ABC: - cmp r0, 0x2 - beq _08183AD8 - cmp r0, 0x3 - beq _08183B10 - b _08183B24 -_08183AC6: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183AD4 - adds r0, 0x1F -_08183AD4: - asrs r0, 5 - b _08183B22 -_08183AD8: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183AEA - ldr r1, =0x000001ff - adds r0, r1 -_08183AEA: - asrs r0, 9 - b _08183B22 - .pool -_08183AF4: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 12 - negs r0, r0 - cmp r0, 0 - bge _08183B06 - ldr r1, =0x000001ff - adds r0, r1 -_08183B06: - asrs r0, 9 - adds r0, 0x10 - b _08183B22 - .pool -_08183B10: - lsls r0, r3, 9 - subs r0, r2, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _08183B1E - adds r0, 0x1F -_08183B1E: - asrs r0, 5 - subs r0, 0x10 -_08183B22: - strh r0, [r4, 0x24] -_08183B24: - movs r1, 0x32 - ldrsh r0, [r4, r1] - movs r1, 0x60 - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x4 - bl Sin - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x40 - strh r0, [r4, 0x32] -_08183B40: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_67 - - thumb_func_start sub_8183B4C -sub_8183B4C: @ 8183B4C - push {r4-r7,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183B5E - strh r0, [r4, 0x34] -_08183B5E: - ldr r7, =gUnknown_0860ADBE - movs r2, 0x34 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - adds r5, r7, 0x2 - adds r0, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl __divsi3 - movs r2, 0x32 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _08183B8C - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x34] - strh r1, [r4, 0x32] -_08183B8C: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r6, r0, r1 - adds r0, r6, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - movs r1, 0x38 - ldrsh r5, [r4, r1] - adds r1, r5, 0 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bne _08183BCC - ldrh r0, [r4, 0x3A] - subs r0, 0x1 - strh r0, [r4, 0x3A] - lsls r0, 16 - cmp r0, 0 - bne _08183BC8 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08183C06 - .pool -_08183BC8: - strh r1, [r4, 0x32] - b _08183C06 -_08183BCC: - adds r0, r6, r7 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - muls r0, r5 - ldrh r2, [r4, 0x24] - adds r0, r2 - strh r0, [r4, 0x24] - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - adds r1, r7, 0x1 - adds r0, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - ldrh r0, [r4, 0x38] - adds r2, r0, 0 - muls r2, r1 - adds r0, r2, 0 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F70C -_08183C06: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8183B4C - - thumb_func_start pokemonanimfunc_68 -pokemonanimfunc_68: @ 8183C0C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - strh r0, [r4, 0x38] - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_68 - - thumb_func_start pokemonanimfunc_69 -pokemonanimfunc_69: @ 8183C2C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strh r0, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_69 - - thumb_func_start pokemonanimfunc_6A -pokemonanimfunc_6A: @ 8183C4C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strh r0, [r4, 0x38] - strh r0, [r4, 0x3A] - adds r0, r4, 0 - bl sub_8183B4C - ldr r0, =sub_8183B4C - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_6A - - thumb_func_start sub_8183C6C -sub_8183C6C: @ 8183C6C - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x3C] - movs r2, 0x3C - ldrsh r0, [r4, r2] - cmp r0, 0xFF - ble _08183CAE - ldrh r1, [r4, 0x38] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bgt _08183CA4 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - b _08183CE8 - .pool -_08183CA4: - subs r0, r1, 0x1 - movs r1, 0 - strh r0, [r4, 0x38] - strh r1, [r4, 0x3C] - b _08183CE8 -_08183CAE: - ldrh r0, [r4, 0x3A] - adds r0, r1, r0 - strh r0, [r4, 0x3C] - lsls r0, 16 - asrs r0, 16 - movs r5, 0x80 - lsls r5, 1 - cmp r0, r5 - ble _08183CC2 - strh r5, [r4, 0x3C] -_08183CC2: - movs r1, 0x3C - ldrsh r0, [r4, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0x40 - bl Sin - adds r2, r0, 0 - lsls r2, 16 - asrs r2, 16 - subs r2, r5, r2 - lsls r2, 16 - asrs r2, 16 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 -_08183CE8: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8183C6C - - thumb_func_start pokemonanimfunc_6B -pokemonanimfunc_6B: @ 8183CF0 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D16 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - movs r0, 0x1 - strh r0, [r4, 0x38] -_08183D16: - adds r0, r4, 0 - bl sub_8183C6C - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6B - - thumb_func_start pokemonanimfunc_6C -pokemonanimfunc_6C: @ 8183D28 - push {r4,r5,lr} - adds r4, r0, 0 - bl sub_817F70C - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D4E - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x2 - strh r0, [r4, 0x38] -_08183D4E: - adds r0, r4, 0 - bl sub_8183C6C - adds r0, r4, 0 - bl sub_817F70C - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6C - - thumb_func_start pokemonanimfunc_6D -pokemonanimfunc_6D: @ 8183D60 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183D88 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183D88: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6D - - thumb_func_start pokemonanimfunc_6E -pokemonanimfunc_6E: @ 8183D94 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183DBA - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] - adds r0, 0xFC - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183DBA: - adds r0, r4, 0 - bl sub_8182764 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6E - - thumb_func_start pokemonanimfunc_6F -pokemonanimfunc_6F: @ 8183DC8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183DF0 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - movs r0, 0x10 - strh r0, [r4, 0x36] -_08183DF0: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_6F - - thumb_func_start pokemonanimfunc_70 -pokemonanimfunc_70: @ 8183DFC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183E22 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - strh r5, [r4, 0x3C] - movs r1, 0x8 - strh r1, [r4, 0x3A] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] -_08183E22: - adds r0, r4, 0 - bl sub_8182830 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_70 - - thumb_func_start pokemonanimfunc_71 -pokemonanimfunc_71: @ 8183E30 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183E4A - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x5 - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] -_08183E4A: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_71 - - thumb_func_start pokemonanimfunc_72 -pokemonanimfunc_72: @ 8183E58 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08183E72 - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x3 - strh r0, [r4, 0x3C] - movs r0, 0x4 - strh r0, [r4, 0x3A] -_08183E72: - adds r0, r4, 0 - bl sub_8180828 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_72 - - thumb_func_start pokemonanimfunc_73 -pokemonanimfunc_73: @ 8183E80 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183EA2 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x3C] -_08183EA2: - adds r0, r5, 0 - bl sub_81832C8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_73 - - thumb_func_start pokemonanimfunc_74 -pokemonanimfunc_74: @ 8183EB0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183ED4 - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x3C] -_08183ED4: - adds r0, r4, 0 - bl sub_81832C8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_74 - - thumb_func_start pokemonanimfunc_75 -pokemonanimfunc_75: @ 8183EE0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183F06 - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3C] -_08183F06: - adds r0, r4, 0 - bl sub_8183418 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_75 - - thumb_func_start pokemonanimfunc_76 -pokemonanimfunc_76: @ 8183F14 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183F38 - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183F38: - adds r0, r5, 0 - bl sub_8183418 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_76 - - thumb_func_start pokemonanimfunc_77 -pokemonanimfunc_77: @ 8183F44 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08183F6A - movs r0, 0x1 - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x2 - strh r0, [r4, 0x36] - movs r0, 0x14 - strh r0, [r4, 0x3A] - movs r0, 0x46 - strh r0, [r4, 0x34] - strh r5, [r4, 0x38] - strh r5, [r4, 0x3C] -_08183F6A: - adds r0, r4, 0 - bl sub_81837DC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_77 - - thumb_func_start pokemonanimfunc_78 -pokemonanimfunc_78: @ 8183F78 - push {r4-r6,lr} - adds r5, r0, 0 - movs r0, 0x32 - ldrsh r6, [r5, r0] - cmp r6, 0 - bne _08183F9C - movs r4, 0x1 - strh r4, [r5, 0x32] - adds r0, r5, 0 - bl sub_817F670 - strh r4, [r5, 0x36] - movs r0, 0x1E - strh r0, [r5, 0x3A] - movs r0, 0x3C - strh r0, [r5, 0x34] - strh r6, [r5, 0x38] - strh r6, [r5, 0x3C] -_08183F9C: - adds r0, r5, 0 - bl sub_81837DC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_78 - - thumb_func_start sub_8183FA8 -sub_8183FA8: @ 8183FA8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0xFF - ble _08183FEA - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r0, [r4, r3] - cmp r0, 0x1 - bgt _08183FD0 - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - b _0818403E - .pool -_08183FD0: - movs r0, 0x3C - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08183FDC - adds r0, 0xFF -_08183FDC: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - strh r0, [r4, 0x3C] - subs r0, r2, 0x1 - strh r0, [r4, 0x3A] - b _0818403E -_08183FEA: - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - movs r3, 0x3C - ldrsh r2, [r4, r3] - adds r1, r2, 0 - adds r1, 0xC0 - adds r0, r1, 0 - cmp r1, 0 - bge _0818400C - ldr r3, =0x000001bf - adds r0, r2, r3 -_0818400C: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x36 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x26] - lsls r0, 16 - cmp r0, 0 - ble _0818402E - movs r3, 0x26 - ldrsh r0, [r4, r3] - negs r0, r0 - strh r0, [r4, 0x26] -_0818402E: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x34] - ldrh r2, [r4, 0x3C] - adds r0, r2 - strh r0, [r4, 0x3C] -_0818403E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8183FA8 - - thumb_func_start pokemonanimfunc_79 -pokemonanimfunc_79: @ 8184048 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _08184066 - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x4 - strh r0, [r1, 0x34] -_08184066: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_79 - - thumb_func_start pokemonanimfunc_7A -pokemonanimfunc_7A: @ 8184070 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _0818408E - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x6 - strh r0, [r1, 0x34] -_0818408E: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7A - - thumb_func_start pokemonanimfunc_7B -pokemonanimfunc_7B: @ 8184098 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _081840B8 - movs r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0x2 - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0xC - strh r0, [r1, 0x38] - strh r0, [r1, 0x36] - movs r0, 0x8 - strh r0, [r1, 0x34] -_081840B8: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7B - - thumb_func_start sub_81840C4 -sub_81840C4: @ 81840C4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - movs r1, 0x80 - lsls r1, 1 - cmp r0, r1 - ble _081840FC - movs r2, 0x3A - ldrsh r1, [r5, r2] - ldrh r2, [r5, 0x36] - movs r3, 0x36 - ldrsh r0, [r5, r3] - cmp r1, r0 - bgt _081840EC - ldr r0, =sub_8184D88 - str r0, [r5, 0x1C] - b _081840F4 - .pool -_081840EC: - adds r0, r2, 0x1 - movs r1, 0 - strh r0, [r5, 0x36] - strh r1, [r5, 0x3C] -_081840F4: - movs r0, 0 - strh r0, [r5, 0x24] - strh r0, [r5, 0x26] - b _08184188 -_081840FC: - cmp r0, 0x9F - ble _08184126 - cmp r0, r1 - ble _08184106 - strh r1, [r5, 0x3C] -_08184106: - movs r0, 0x3C - ldrsh r1, [r5, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _08184112 - adds r0, 0xFF -_08184112: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x8 - bl Sin - negs r0, r0 - b _08184154 -_08184126: - cmp r0, 0x5F - ble _0818414A - movs r0, 0x60 - movs r1, 0x6 - bl Sin - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r5, r1] - subs r0, 0x60 - lsls r0, 17 - asrs r0, 16 - movs r1, 0x4 - bl Sin - subs r4, r0 - strh r4, [r5, 0x26] - b _08184156 -_0818414A: - movs r2, 0x3C - ldrsh r0, [r5, r2] - movs r1, 0x6 - bl Sin -_08184154: - strh r0, [r5, 0x26] -_08184156: - movs r3, 0x3C - ldrsh r0, [r5, r3] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r2, 0x38 - ldrsh r1, [r5, r2] - bl Sin - negs r0, r0 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r5, 0x36] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0818417E - lsls r0, r2, 16 - negs r0, r0 - lsrs r2, r0, 16 -_0818417E: - strh r2, [r5, 0x24] - ldrh r0, [r5, 0x34] - ldrh r3, [r5, 0x3C] - adds r0, r3 - strh r0, [r5, 0x3C] -_08184188: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81840C4 - - thumb_func_start pokemonanimfunc_7C -pokemonanimfunc_7C: @ 8184190 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _081841B0 - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x2 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x4 - strh r0, [r2, 0x34] -_081841B0: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7C - - thumb_func_start pokemonanimfunc_7D -pokemonanimfunc_7D: @ 81841BC - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _081841DC - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x2 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x6 - strh r0, [r2, 0x34] -_081841DC: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7D - - thumb_func_start pokemonanimfunc_7E -pokemonanimfunc_7E: @ 81841E8 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r3, [r2, r0] - cmp r3, 0 - bne _08184208 - movs r1, 0x1 - strh r1, [r2, 0x32] - movs r0, 0x3 - strh r0, [r2, 0x3A] - strh r3, [r2, 0x3C] - movs r0, 0x10 - strh r0, [r2, 0x38] - strh r1, [r2, 0x36] - movs r0, 0x8 - strh r0, [r2, 0x34] -_08184208: - adds r0, r2, 0 - bl sub_81840C4 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7E - - thumb_func_start pokemonanimfunc_7F -pokemonanimfunc_7F: @ 8184214 - push {lr} - adds r2, r0, 0 - movs r0, 0x32 - ldrsh r1, [r2, r0] - cmp r1, 0 - bne _08184232 - movs r0, 0x1 - strh r0, [r2, 0x32] - strh r0, [r2, 0x3A] - strh r1, [r2, 0x3C] - movs r1, 0x4 - strh r1, [r2, 0x38] - movs r0, 0x6 - strh r0, [r2, 0x36] - strh r1, [r2, 0x34] -_08184232: - adds r0, r2, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_7F - - thumb_func_start pokemonanimfunc_80 -pokemonanimfunc_80: @ 818423C - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _0818425A - movs r0, 0x1 - strh r0, [r1, 0x32] - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0x4 - strh r0, [r1, 0x38] - movs r0, 0x6 - strh r0, [r1, 0x36] - strh r0, [r1, 0x34] -_0818425A: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_80 - - thumb_func_start pokemonanimfunc_81 -pokemonanimfunc_81: @ 8184264 - push {lr} - adds r1, r0, 0 - movs r0, 0x32 - ldrsh r2, [r1, r0] - cmp r2, 0 - bne _08184286 - movs r0, 0x1 - strh r0, [r1, 0x32] - movs r0, 0x2 - strh r0, [r1, 0x3A] - strh r2, [r1, 0x3C] - movs r0, 0x4 - strh r0, [r1, 0x38] - movs r0, 0x6 - strh r0, [r1, 0x36] - movs r0, 0x8 - strh r0, [r1, 0x34] -_08184286: - adds r0, r1, 0 - bl sub_8183FA8 - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_81 - - thumb_func_start sub_8184290 -sub_8184290: @ 8184290 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsls r0, 7 - movs r2, 0x3C - ldrsh r1, [r4, r2] - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x38 - ldrsh r1, [r4, r2] - bl Sin - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - lsls r0, r1, 8 - negs r0, r0 - strh r0, [r4, 0x3A] - movs r0, 0x36 - ldrsh r2, [r4, r0] - adds r0, r4, 0 - movs r3, 0 - bl sub_817F3F0 - movs r2, 0x80 - lsls r2, 1 - ldrh r3, [r4, 0x3A] - adds r0, r4, 0 - adds r1, r2, 0 - bl sub_817F6D4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8184290 - - thumb_func_start pokemonanimfunc_82 -pokemonanimfunc_82: @ 81842DC - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184300 - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x3C - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x1 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184300: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _0818434C - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _08184348 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08184358 - .pool -_08184348: - strh r2, [r4, 0x32] - b _08184352 -_0818434C: - adds r0, r4, 0 - bl sub_8184290 -_08184352: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08184358: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_82 - - thumb_func_start pokemonanimfunc_83 -pokemonanimfunc_83: @ 8184360 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184384 - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x5A - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x1 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184384: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _081843D0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _081843CC - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _081843DC - .pool -_081843CC: - strh r2, [r4, 0x32] - b _081843D6 -_081843D0: - adds r0, r4, 0 - bl sub_8184290 -_081843D6: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_081843DC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_83 - - thumb_func_start pokemonanimfunc_84 -pokemonanimfunc_84: @ 81843E4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _08184408 - adds r0, r4, 0 - bl sub_817F670 - movs r0, 0x1E - strh r0, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x38] - ldr r0, =0x0000ffe0 - strh r0, [r4, 0x36] - movs r0, 0x2 - strh r0, [r4, 0x34] - strh r5, [r4, 0x2E] -_08184408: - movs r2, 0x32 - ldrsh r1, [r4, r2] - movs r3, 0x3C - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _08184454 - movs r2, 0x80 - lsls r2, 1 - adds r0, r4, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - movs r2, 0 - strh r2, [r4, 0x24] - strh r2, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r3, 0x34 - ldrsh r1, [r4, r3] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - bgt _08184450 - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _08184460 - .pool -_08184450: - strh r2, [r4, 0x32] - b _0818445A -_08184454: - adds r0, r4, 0 - bl sub_8184290 -_0818445A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] -_08184460: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_84 - - thumb_func_start sub_8184468 -sub_8184468: @ 8184468 - push {r4-r6,lr} - adds r6, r0, 0 - movs r0, 0x32 - ldrsh r1, [r6, r0] - movs r2, 0x3C - ldrsh r0, [r6, r2] - cmp r1, r0 - ble _0818449C - movs r0, 0 - strh r0, [r6, 0x26] - movs r2, 0x80 - lsls r2, 1 - adds r0, r6, 0 - adds r1, r2, 0 - movs r3, 0 - bl sub_817F6D4 - adds r0, r6, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r6, 0x1C] - b _08184544 - .pool -_0818449C: - movs r1, 0x32 - ldrsh r0, [r6, r1] - movs r2, 0x3A - ldrsh r4, [r6, r2] - adds r1, r4, 0 - bl __modsi3 - lsls r0, 24 - lsrs r0, 16 - adds r1, r4, 0 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081844BC - adds r0, 0xFF -_081844BC: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - lsrs r4, r0, 16 - ldrh r0, [r6, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _081844F8 - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - movs r1, 0x80 - lsls r1, 1 - adds r5, r1, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x20 - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - adds r0, r4, 0 - movs r1, 0x20 - b _0818451E -_081844F8: - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - movs r2, 0x80 - lsls r2, 1 - adds r5, r2, 0 - adds r0, r5 - strh r0, [r6, 0x36] - adds r0, r4, 0 - movs r1, 0x8 - bl Sin - adds r0, r5 - strh r0, [r6, 0x38] - adds r0, r4, 0 - movs r1, 0x8 -_0818451E: - bl Sin - lsls r0, 24 - lsrs r0, 24 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bge _08184530 - adds r0, 0x7 -_08184530: - lsrs r0, 3 - strh r0, [r6, 0x26] - movs r0, 0x36 - ldrsh r1, [r6, r0] - movs r0, 0x38 - ldrsh r2, [r6, r0] - adds r0, r6, 0 - movs r3, 0 - bl sub_817F6D4 -_08184544: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8184468 - - thumb_func_start pokemonanimfunc_85 -pokemonanimfunc_85: @ 8184550 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08184570 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x28 - strh r0, [r4, 0x3A] - movs r0, 0x50 - strh r0, [r4, 0x3C] -_08184570: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_85 - - thumb_func_start pokemonanimfunc_86 -pokemonanimfunc_86: @ 818457C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0818459A - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x28 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] -_0818459A: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_86 - - thumb_func_start pokemonanimfunc_87 -pokemonanimfunc_87: @ 81845A8 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _081845C6 - adds r0, r4, 0 - bl sub_817F670 - ldrh r0, [r4, 0x26] - adds r0, 0x2 - strh r0, [r4, 0x26] - movs r0, 0x50 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x3C] -_081845C6: - adds r0, r4, 0 - bl sub_8184468 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_87 - - thumb_func_start sub_81845D4 -sub_81845D4: @ 81845D4 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - ldrh r1, [r4, 0x32] - subs r0, r1 - strh r0, [r4, 0x24] - movs r0, 0x24 - ldrsh r1, [r4, r0] - movs r2, 0x3A - ldrsh r0, [r4, r2] - cmn r1, r0 - bgt _081845FE - ldrh r0, [r4, 0x3A] - negs r0, r0 - strh r0, [r4, 0x24] - movs r0, 0x2 - strh r0, [r4, 0x3C] - ldr r0, =sub_8184610 - str r0, [r4, 0x1C] -_081845FE: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81845D4 - - thumb_func_start sub_8184610 -sub_8184610: @ 8184610 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - ldrh r2, [r4, 0x24] - adds r1, r0, r2 - strh r1, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x3C] - lsls r1, 16 - cmp r1, 0 - blt _0818462E - ldr r0, =sub_8184640 - str r0, [r4, 0x1C] -_0818462E: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8184610 - - thumb_func_start sub_8184640 -sub_8184640: @ 8184640 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x3C] - ldrh r2, [r4, 0x24] - adds r1, r0, r2 - strh r1, [r4, 0x24] - adds r0, 0x1 - strh r0, [r4, 0x3C] - lsls r1, 16 - asrs r1, 16 - ldrh r2, [r4, 0x3A] - movs r3, 0x3A - ldrsh r0, [r4, r3] - cmp r1, r0 - ble _08184668 - strh r2, [r4, 0x24] - ldr r0, =sub_8184678 - str r0, [r4, 0x1C] -_08184668: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8184640 - - thumb_func_start sub_8184678 -sub_8184678: @ 8184678 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r2, [r4, 0x34] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r3, 0x38 - ldrsh r0, [r4, r3] - cmp r1, r0 - blt _08184698 - ldr r0, =sub_81846B8 - str r0, [r4, 0x1C] - b _081846AC - .pool -_08184698: - ldrh r0, [r4, 0x36] - ldrh r1, [r4, 0x24] - adds r0, r1 - strh r0, [r4, 0x24] - movs r3, 0x36 - ldrsh r0, [r4, r3] - negs r0, r0 - strh r0, [r4, 0x36] - adds r0, r2, 0x1 - strh r0, [r4, 0x34] -_081846AC: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8184678 - - thumb_func_start sub_81846B8 -sub_81846B8: @ 81846B8 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F70C - ldrh r0, [r4, 0x24] - subs r0, 0x2 - strh r0, [r4, 0x24] - lsls r0, 16 - cmp r0, 0 - bgt _081846DA - movs r0, 0 - strh r0, [r4, 0x24] - adds r0, r4, 0 - bl sub_817F77C - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] -_081846DA: - adds r0, r4, 0 - bl sub_817F70C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81846B8 - - thumb_func_start pokemonanimfunc_88 -pokemonanimfunc_88: @ 81846EC - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r2, 0 - movs r1, 0x4 - strh r1, [r4, 0x3C] - movs r0, 0xC - strh r0, [r4, 0x3A] - movs r0, 0x10 - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_88 - - thumb_func_start pokemonanimfunc_89 -pokemonanimfunc_89: @ 8184718 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r2, 0 - movs r1, 0x2 - strh r1, [r4, 0x3C] - movs r0, 0x8 - strh r0, [r4, 0x3A] - movs r0, 0xC - strh r0, [r4, 0x38] - strh r1, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_89 - - thumb_func_start pokemonanimfunc_8A -pokemonanimfunc_8A: @ 8184744 - push {r4,lr} - adds r4, r0, 0 - bl sub_817F670 - movs r1, 0 - strh r1, [r4, 0x3C] - movs r0, 0x6 - strh r0, [r4, 0x3A] - strh r0, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r1, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x32] - ldr r0, =sub_81845D4 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end pokemonanimfunc_8A - - thumb_func_start sub_8184770 -sub_8184770: @ 8184770 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - strh r0, [r1, 0x24] - ldrh r2, [r1, 0x2E] - movs r3, 0x2E - ldrsh r0, [r1, r3] - cmp r0, 0x1 - ble _0818478E - movs r2, 0x30 - ldrsh r0, [r1, r2] - negs r0, r0 - strh r0, [r1, 0x30] - movs r0, 0 - b _08184790 -_0818478E: - adds r0, r2, 0x1 -_08184790: - strh r0, [r1, 0x2E] - pop {r0} - bx r0 - thumb_func_end sub_8184770 - - thumb_func_start sub_8184798 -sub_8184798: @ 8184798 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r1, =gUnknown_0860AE7C - movs r2, 0x34 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - adds r0, r4, 0 - bl sub_8184770 - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r1, r0, r5 - ldrb r0, [r1, 0x1] - cmp r0, 0xFF - bne _081847D0 - movs r0, 0 - strh r0, [r4, 0x24] - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0818482E - .pool -_081847D0: - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bne _08184800 - ldrb r0, [r1] - cmp r0, 0 - beq _081847F0 - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0x10 - bl BlendPalette - b _081847FC - .pool -_081847F0: - ldrh r0, [r4, 0x3C] - ldr r3, =0x000003ff - movs r1, 0x10 - movs r2, 0 - bl BlendPalette -_081847FC: - movs r0, 0 - strh r0, [r4, 0x36] -_08184800: - movs r1, 0x3A - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldrb r1, [r0, 0x1] - movs r2, 0x38 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08184828 - movs r1, 0 - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x3A] - adds r0, 0x1 - strh r0, [r4, 0x3A] - b _0818482E - .pool -_08184828: - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_0818482E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8184798 - - thumb_func_start pokemonanimfunc_8B -pokemonanimfunc_8B: @ 8184834 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _08184860 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - strh r3, [r2, 0x34] -_08184860: - adds r0, r2, 0 - bl sub_8184798 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8B - - thumb_func_start pokemonanimfunc_8C -pokemonanimfunc_8C: @ 818486C - push {r4,r5,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0x1 - bne _08184898 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r5, 0x80 - lsls r5, 1 - adds r1, r5, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - strh r4, [r2, 0x34] -_08184898: - adds r0, r2, 0 - bl sub_8184798 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8C - - thumb_func_start pokemonanimfunc_8D -pokemonanimfunc_8D: @ 81848A4 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - adds r0, 0x1 - movs r3, 0 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _081848D2 - ldrb r0, [r2, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r4, 0x80 - lsls r4, 1 - adds r1, r4, 0 - adds r0, r1 - strh r0, [r2, 0x3C] - strh r3, [r2, 0x3A] - strh r3, [r2, 0x38] - strh r3, [r2, 0x36] - movs r0, 0x2 - strh r0, [r2, 0x34] -_081848D2: - adds r0, r2, 0 - bl sub_8184798 - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8D - - thumb_func_start sub_81848E0 -sub_81848E0: @ 81848E0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x7F - ble _08184904 - ldrh r0, [r4, 0x3C] - movs r1, 0x10 - movs r2, 0 - movs r3, 0x1F - bl BlendPalette - ldr r0, =sub_8184D88 - str r0, [r4, 0x1C] - b _0818492A - .pool -_08184904: - movs r5, 0x32 - ldrsh r0, [r4, r5] - movs r1, 0xC - bl Sin - adds r2, r0, 0 - strh r2, [r4, 0x3A] - ldrh r0, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =gUnknown_0860AE88 - movs r5, 0x30 - ldrsh r1, [r4, r5] - lsls r1, 1 - adds r1, r3 - ldrh r3, [r1] - movs r1, 0x10 - bl BlendPalette -_0818492A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81848E0 - - thumb_func_start sub_8184934 -sub_8184934: @ 8184934 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r1, r0 - bge _081849CC - adds r0, r4, 0 - bl sub_817F70C - movs r3, 0x38 - ldrsh r1, [r4, r3] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r1, r0 - ble _08184970 - ldrh r0, [r4, 0x34] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x36 - ldrsh r1, [r4, r3] - cmp r0, r1 - bge _0818496C - strh r2, [r4, 0x38] -_0818496C: - strh r2, [r4, 0x24] - b _081849C6 -_08184970: - movs r0, 0x34 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r0, 1 - lsls r0, 1 - subs r1, r0 - lsls r1, 16 - asrs r1, 15 - movs r0, 0x1 - subs r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0x38 - ldrsh r1, [r4, r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 7 - movs r3, 0x2E - ldrsh r1, [r4, r3] - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _081849A4 - adds r0, 0xFF -_081849A4: - asrs r0, 8 - lsls r0, 8 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x6 - bl Sin - lsls r1, r5, 24 - asrs r1, 24 - adds r2, r1, 0 - muls r2, r0 - adds r0, r2, 0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] -_081849C6: - adds r0, r4, 0 - bl sub_817F70C -_081849CC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8184934 - - thumb_func_start pokemonanimfunc_8E -pokemonanimfunc_8E: @ 81849D4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _081849FE - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_081849FE: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184A0E - adds r0, r4, 0 - bl sub_81848E0 -_08184A0E: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184A30 - adds r0, r4, 0 - bl sub_8184934 -_08184A30: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8E - - thumb_func_start pokemonanimfunc_8F -pokemonanimfunc_8F: @ 8184A3C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184A66 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_08184A66: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184A76 - adds r0, r4, 0 - bl sub_81848E0 -_08184A76: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184A98 - adds r0, r4, 0 - bl sub_8184934 -_08184A98: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_8F - - thumb_func_start pokemonanimfunc_90 -pokemonanimfunc_90: @ 8184AA4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184ACE - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r2, [r4, 0x30] -_08184ACE: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184ADE - adds r0, r4, 0 - bl sub_81848E0 -_08184ADE: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184B00 - adds r0, r4, 0 - bl sub_8184934 -_08184B00: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_90 - - thumb_func_start pokemonanimfunc_91 -pokemonanimfunc_91: @ 8184B0C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184B38 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x1 - strh r0, [r4, 0x30] -_08184B38: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184B48 - adds r0, r4, 0 - bl sub_81848E0 -_08184B48: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184B6A - adds r0, r4, 0 - bl sub_8184934 -_08184B6A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_91 - - thumb_func_start pokemonanimfunc_92 -pokemonanimfunc_92: @ 8184B78 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184BA2 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184BA2: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184BB2 - adds r0, r4, 0 - bl sub_81848E0 -_08184BB2: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184BD4 - adds r0, r4, 0 - bl sub_8184934 -_08184BD4: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_92 - - thumb_func_start pokemonanimfunc_93 -pokemonanimfunc_93: @ 8184BE0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184C0A - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184C0A: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184C1A - adds r0, r4, 0 - bl sub_81848E0 -_08184C1A: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184C3C - adds r0, r4, 0 - bl sub_8184934 -_08184C3C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_93 - - thumb_func_start pokemonanimfunc_94 -pokemonanimfunc_94: @ 8184C48 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184C72 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0xA - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x2 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - strh r0, [r4, 0x30] -_08184C72: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184C82 - adds r0, r4, 0 - bl sub_81848E0 -_08184C82: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184CA4 - adds r0, r4, 0 - bl sub_8184934 -_08184CA4: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_94 - - thumb_func_start pokemonanimfunc_95 -pokemonanimfunc_95: @ 8184CB0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184CDC - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x14 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x30] -_08184CDC: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184CEC - adds r0, r4, 0 - bl sub_81848E0 -_08184CEC: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184D0E - adds r0, r4, 0 - bl sub_8184934 -_08184D0E: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_95 - - thumb_func_start pokemonanimfunc_96 -pokemonanimfunc_96: @ 8184D1C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x32 - ldrsh r2, [r4, r0] - cmp r2, 0 - bne _08184D48 - ldrb r0, [r4, 0x5] - lsrs r0, 4 - lsls r0, 4 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - adds r0, r1 - strh r0, [r4, 0x3C] - movs r0, 0x50 - strh r0, [r4, 0x2E] - strh r2, [r4, 0x38] - movs r0, 0x1 - strh r0, [r4, 0x36] - strh r2, [r4, 0x34] - movs r0, 0x2 - strh r0, [r4, 0x30] -_08184D48: - ldrh r0, [r4, 0x32] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08184D58 - adds r0, r4, 0 - bl sub_81848E0 -_08184D58: - movs r0, 0x32 - ldrsh r2, [r4, r0] - movs r3, 0x2E - ldrsh r1, [r4, r3] - movs r3, 0x36 - ldrsh r0, [r4, r3] - muls r1, r0 - movs r0, 0x80 - subs r0, r1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - cmp r2, r0 - blt _08184D7A - adds r0, r4, 0 - bl sub_8184934 -_08184D7A: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - pop {r4} - pop {r0} - bx r0 - thumb_func_end pokemonanimfunc_96 - - thumb_func_start sub_8184D88 -sub_8184D88: @ 8184D88 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08184D9C - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_08184D9C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8184D88 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokemon_icon.s b/asm/pokemon_icon.s index 9157059db..40291bee4 100644 --- a/asm/pokemon_icon.s +++ b/asm/pokemon_icon.s @@ -5,9 +5,9 @@ .text - thumb_func_start sub_80D2CC4 -@ int sub_80D2CC4(u16 speciesId, int a2, u16 a3, u16 a4, u8 a5, u32 personality, int a7) -sub_80D2CC4: @ 80D2CC4 + thumb_func_start CreateMonIcon +@ int CreateMonIcon(u16 speciesId, int a2, u16 a3, u16 a4, u8 a5, u32 personality, int a7) +CreateMonIcon: @ 80D2CC4 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -84,7 +84,7 @@ _080D2D2A: pop {r1} bx r1 .pool - thumb_func_end sub_80D2CC4 + thumb_func_end CreateMonIcon thumb_func_start sub_80D2D78 sub_80D2D78: @ 80D2D78 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 4a445d524..8fc10ba29 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -233,7 +233,7 @@ _080C72AC: movs r0, 0 movs r1, 0x1 movs r3, 0xFF - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized movs r0, 0 movs r1, 0x3 bl CopyWindowToVram @@ -339,7 +339,7 @@ _080C7392: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized b _080C756A .pool _080C73D0: @@ -406,7 +406,7 @@ _080C7428: _080C745C: movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen movs r0, 0x4 strh r0, [r5, 0x8] b _080C756A @@ -509,7 +509,7 @@ _080C7532: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized strh r4, [r5, 0x8] b _080C756A .pool diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 0030b33d2..a04939c12 100644 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -2049,7 +2049,7 @@ sub_81C4F24: @ 81C4F24 bl ScriptContext2_Enable movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen ldr r0, =sub_81C4F44 movs r1, 0xA bl CreateTask @@ -5362,7 +5362,7 @@ sub_81C6C3C: @ 81C6C3C str r4, [sp, 0xC] str r1, [sp, 0x10] movs r1, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x14 pop {r3} mov r8, r3 @@ -5408,7 +5408,7 @@ sub_81C6C94: @ 81C6C94 str r4, [sp, 0xC] str r1, [sp, 0x10] movs r1, 0x7 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x14 pop {r3} mov r8, r3 diff --git a/asm/pokenav.s b/asm/pokenav.s index 8428b1b4d..2b5450d3e 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -44,7 +44,7 @@ sub_81C72A4: @ 81C72A4 bl SetMainCallback2 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r0} bx r0 .pool @@ -7068,7 +7068,7 @@ sub_81CA914: @ 81CA914 bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_81CA914 @@ -7101,7 +7101,7 @@ titlescreen_0: @ 81CA92C ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldr r0, =sub_81CA914 bl c3args_set_0toR1_1to0 ldr r0, =sub_81CA9EC @@ -7220,7 +7220,7 @@ sub_81CAA3C: @ 81CAA3C mov r0, sp movs r6, 0 strh r6, [r0] - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers ldr r0, =0x010000a0 mov r8, r0 mov r0, sp @@ -15647,7 +15647,7 @@ sub_81CEE44: @ 81CEE44 bl TransferPlttBuffer adds r0, r4, 0 bl sub_81D2108 - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r4} pop {r0} bx r0 @@ -21900,7 +21900,7 @@ _081D1D8C: movs r1, 0x1 movs r2, 0x8 adds r3, r5, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 _081D1DAC: add sp, 0x34 pop {r4,r5} @@ -22318,7 +22318,7 @@ sub_81D20BC: @ 81D20BC b _081D20FA .pool _081D20D4: - bl dp12_8087EA4 + bl ScanlineEffect_Clear ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -22332,7 +22332,7 @@ _081D20E2: ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams ldrb r0, [r4] adds r0, 0x1 strb r0, [r4] @@ -22366,7 +22366,7 @@ sub_81D2108: @ 81D2108 adds r0, r6, 0 bl sub_81D2634 movs r7, 0 - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers mov r12, r5 movs r0, 0xF0 lsls r0, 3 @@ -23765,7 +23765,7 @@ sub_81D2BF4: @ 81D2BF4 str r0, [sp, 0xC] movs r1, 0x1 adds r2, r4, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r4} pop {r0} diff --git a/asm/rayquaza_scene.s b/asm/rayquaza_scene.s index f60b2a252..8832d3942 100644 --- a/asm/rayquaza_scene.s +++ b/asm/rayquaza_scene.s @@ -1058,7 +1058,7 @@ _081D6FC8: sub_81D6FD0: @ 81D6FD0 push {lr} bl sub_81D67EC - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_81D6FD0 @@ -1183,12 +1183,12 @@ sub_81D7134: @ 81D7134 lsls r6, r1, 3 ldr r7, =gTasks + 0x8 adds r5, r6, r7 - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl sub_81D6FE0 bl sub_81D706C movs r4, 0 str r4, [sp, 0x4] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r2, =0x010003c0 add r0, sp, 0x4 bl CpuFastSet @@ -1196,7 +1196,7 @@ sub_81D7134: @ 81D7134 ldr r0, [r2] ldr r1, [r2, 0x4] ldr r2, [r2, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams strh r4, [r5] ldr r0, =sub_81D7228 movs r1, 0 @@ -1278,7 +1278,7 @@ sub_81D7228: @ 81D7228 adds r3, r1, r0 movs r1, 0x18 ldr r7, =gUnknown_0203CF60 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers movs r0, 0xF0 lsls r0, 3 adds r5, r4, r0 diff --git a/asm/reset_rtc_screen.s b/asm/reset_rtc_screen.s index ab5e0840c..b314afbf5 100644 --- a/asm/reset_rtc_screen.s +++ b/asm/reset_rtc_screen.s @@ -888,7 +888,7 @@ _0809EFCA: bl ResetOamRange bl LoadOam bl ScanlineEffect_Stop - bl dp12_8087EA4 + bl ScanlineEffect_Clear bl ResetSpriteData bl ResetTasks bl ResetPaletteFade diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 2fc97120a..939ed073e 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -3923,7 +3923,7 @@ _080148CC: bne _080149B2 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen movs r0, 0x2 strh r0, [r7] b _080149B2 @@ -11150,7 +11150,7 @@ _08018720: movs r1, 0x1 movs r2, 0x4 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 movs r0, 0 adds r1, r7, 0 movs r2, 0xDE @@ -11166,7 +11166,7 @@ _08018720: movs r0, 0 movs r1, 0 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 movs r0, 0 movs r1, 0x2 bl CopyWindowToVram @@ -11338,7 +11338,7 @@ sub_8018884: @ 8018884 movs r1, 0x1 movs r2, 0 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 movs r0, 0x1 movs r1, 0x1 movs r2, 0xF @@ -11691,7 +11691,7 @@ _08018B4A: str r1, [sp, 0x10] movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 ldrb r0, [r4] movs r1, 0x1 movs r2, 0xF @@ -11837,7 +11837,7 @@ _08018C8C: str r1, [sp, 0x10] movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 ldrb r0, [r5] movs r1, 0x1 movs r2, 0xF @@ -13672,7 +13672,7 @@ _08019B84: b _08019B9C _08019B96: adds r0, r4, 0 - bl sub_8097404 + bl FreezeMapObject _08019B9C: movs r0, 0x1 _08019B9E: @@ -15389,7 +15389,7 @@ _0801A93A: adds r0, r7, 0 adds r1, r6, 0 adds r2, r5, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r4-r7} pop {r0} @@ -15710,7 +15710,7 @@ sub_801AB68: @ 801AB68 movs r1, 0x1 adds r2, r6, 0 ldr r3, [sp, 0x14] - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x18 pop {r3-r5} mov r8, r3 @@ -22076,7 +22076,7 @@ sub_801DF20: @ 801DF20 bl TransferPlttBuffer bl LoadOam bl ProcessSpriteCopyRequests - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer pop {r0} bx r0 thumb_func_end sub_801DF20 @@ -24807,7 +24807,7 @@ sub_801F544: @ 801F544 str r0, [r4] _0801F55A: bl FreeAllWindowBuffers - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] pop {r4} @@ -27114,13 +27114,13 @@ sub_8020770: @ 8020770 strh r1, [r0, 0x20] str r1, [sp, 0xC] add r0, sp, 0xC - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r2, =0x010003c0 bl CpuFastSet ldr r0, [sp] ldr r1, [sp, 0x4] ldr r2, [sp, 0x8] - bl sub_80BA038 + bl ScanlineEffect_SetParams add sp, 0x10 pop {r0} bx r0 @@ -27135,12 +27135,12 @@ sub_80207C0: @ 80207C0 lsrs r0, 16 mov r1, sp strh r0, [r1] - ldr r5, =gUnknown_02039B28 + ldr r5, =gScanlineEffect ldrb r0, [r5, 0x14] lsls r1, r0, 4 subs r1, r0 lsls r1, 7 - ldr r4, =gUnknown_02038C28 + ldr r4, =gScanlineEffectRegBuffers adds r1, r4 ldr r2, =0x01000090 mov r0, sp @@ -27178,7 +27178,7 @@ sub_8020818: @ 8020818 lsrs r4, 16 mov r0, sp strh r4, [r0] - ldr r5, =gUnknown_02038C28 + ldr r5, =gScanlineEffectRegBuffers ldr r0, =0x01000090 mov r9, r0 mov r0, sp @@ -30787,7 +30787,7 @@ _08022616: str r4, [sp, 0x10] movs r1, 0x2 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 b _0802269C .pool _08022668: @@ -30814,7 +30814,7 @@ _08022668: str r4, [sp, 0x10] movs r1, 0x2 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 _0802269C: ldr r1, =0x000001bb adds r0, r6, r1 @@ -31690,7 +31690,7 @@ _08022D42: movs r0, 0 movs r1, 0x1 adds r2, r4, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized b _08022DB2 .pool _08022D90: @@ -31709,7 +31709,7 @@ _08022D90: str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized _08022DB2: movs r0, 0 movs r1, 0x3 @@ -34273,7 +34273,7 @@ _080241A6: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized movs r0, 0 movs r1, 0x3 bl CopyWindowToVram @@ -34632,7 +34632,7 @@ _08024460: str r1, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized b _080244AC .pool _08024490: @@ -34648,7 +34648,7 @@ _08024490: str r0, [sp, 0xC] movs r0, 0 movs r1, 0x1 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized _080244AC: movs r0, 0 movs r1, 0x3 @@ -46362,7 +46362,7 @@ _0802A3AE: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized b _0802A410 .pool _0802A3D8: diff --git a/asm/script_menu.s b/asm/script_menu.s index 1f7c86e84..7317317a3 100644 --- a/asm/script_menu.s +++ b/asm/script_menu.s @@ -877,7 +877,7 @@ ScriptMenu_DisplayPCStartupPrompt: @ 80E2514 movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized add sp, 0x10 pop {r0} bx r0 @@ -1606,7 +1606,7 @@ _080E2B12: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized b _080E2B70 .pool _080E2B40: @@ -1630,7 +1630,7 @@ _080E2B40: movs r0, 0 movs r1, 0x1 movs r3, 0 - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized _080E2B70: add sp, 0x10 pop {r4} diff --git a/asm/script_movement.s b/asm/script_movement.s index 5f06fd179..8c6a6257c 100644 --- a/asm/script_movement.s +++ b/asm/script_movement.s @@ -553,7 +553,7 @@ _080D36DC: adds r1, r6, 0 bl sub_80D355C adds r0, r4, 0 - bl sub_8097404 + bl FreezeMapObject b _080D370E .pool _080D36F8: diff --git a/asm/shop.s b/asm/shop.s index 4ecab08ca..70429c7cf 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -188,7 +188,7 @@ HandleShopMenuBuy: @ 80DFBD0 str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r4} pop {r0} bx r0 @@ -216,7 +216,7 @@ HandleShopMenuSell: @ 80DFC0C str r0, [r1] movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen pop {r4} pop {r0} bx r0 @@ -839,7 +839,7 @@ _080E0176: adds r0, r6, 0 movs r1, 0x7 adds r3, r7, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 _080E01AC: add sp, 0x14 pop {r4-r7} @@ -1201,7 +1201,7 @@ BuyMenuPrint: @ 80E04A4 str r6, [sp, 0xC] str r1, [sp, 0x10] movs r1, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 add sp, 0x14 pop {r4-r6} pop {r0} diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 800b66a55..4a331b313 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -8934,7 +8934,7 @@ sub_812EB48: @ 812EB48 ldrb r3, [r1] adds r1, r3, 0 adds r2, r3, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents ldrh r0, [r4, 0x38] adds r0, 0x1 movs r1, 0x1 @@ -8979,7 +8979,7 @@ sub_812EBCC: @ 812EBCC movs r1, 0 movs r2, 0 movs r3, 0 - bl sub_80B609C + bl MultiplyInvertedPaletteRGBComponents movs r4, 0 _0812EBEA: ldr r0, =gUnknown_0203AB34 diff --git a/asm/start_menu.s b/asm/start_menu.s index 0ecc2f275..4497087da 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -449,7 +449,7 @@ _0809FB34: beq _0809FBA0 movs r0, 0x1 movs r1, 0 - bl fade_screen + bl FadeScreen b _0809FBA0 .pool _0809FB98: @@ -1561,7 +1561,7 @@ _080A0490: bl ResetSpriteData bl ResetTasks bl ResetPaletteFade - bl dp12_8087EA4 + bl ScanlineEffect_Clear b _080A04FC _080A04A2: movs r0, 0 @@ -1695,7 +1695,7 @@ _080A05AC: movs r0, 0 movs r1, 0x1 movs r3, 0xFF - bl AddTextPrinterParametrized + bl AddTextPrinterParameterized movs r0, 0 movs r1, 0x8 movs r2, 0xE diff --git a/asm/time_events.s b/asm/time_events.s deleted file mode 100644 index de2d2d165..000000000 --- a/asm/time_events.s +++ /dev/null @@ -1,225 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start GetMirageRnd -GetMirageRnd: @ 8137890 - push {r4,lr} - ldr r0, =0x00004024 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004025 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - orrs r4, r0 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetMirageRnd - - thumb_func_start SetMirageRnd -SetMirageRnd: @ 81378BC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =0x00004024 - lsrs r1, r4, 16 - bl VarSet - ldr r0, =0x00004025 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl VarSet - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetMirageRnd - - thumb_func_start InitMirageRnd -InitMirageRnd: @ 81378E4 - push {r4,lr} - bl Random - adds r4, r0, 0 - bl Random - lsls r4, 16 - lsls r0, 16 - lsrs r0, 16 - orrs r4, r0 - adds r0, r4, 0 - bl SetMirageRnd - pop {r4} - pop {r0} - bx r0 - thumb_func_end InitMirageRnd - - thumb_func_start UpdateMirageRnd -UpdateMirageRnd: @ 8137904 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl GetMirageRnd - adds r1, r0, 0 - cmp r4, 0 - beq _08137928 - ldr r3, =0x41c64e6d - ldr r2, =0x00003039 -_08137918: - adds r0, r1, 0 - muls r0, r3 - adds r1, r0, r2 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - bne _08137918 -_08137928: - adds r0, r1, 0 - bl SetMirageRnd - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateMirageRnd - - thumb_func_start IsMirageIslandPresent -IsMirageIslandPresent: @ 813793C - push {r4-r6,lr} - bl GetMirageRnd - lsrs r6, r0, 16 - movs r5, 0 -_08137946: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _08137978 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldr r1, =0x0000ffff - ands r1, r0 - cmp r1, r6 - bne _08137978 - movs r0, 0x1 - b _08137980 - .pool -_08137978: - adds r5, 0x1 - cmp r5, 0x5 - ble _08137946 - movs r0, 0 -_08137980: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end IsMirageIslandPresent - - thumb_func_start UpdateShoalTideFlag -UpdateShoalTideFlag: @ 8137988 - push {lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r0, 24 - bl is_light_level_1_2_3_5_or_6 - lsls r0, 24 - cmp r0, 0 - beq _081379CE - bl RtcCalcLocalTime - ldr r1, =gUnknown_085B2B44 - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081379C8 - ldr r0, =0x0000089a - bl FlagSet - b _081379CE - .pool -_081379C8: - ldr r0, =0x0000089a - bl FlagClear -_081379CE: - pop {r0} - bx r0 - .pool - thumb_func_end UpdateShoalTideFlag - - thumb_func_start Task_WaitWeather -Task_WaitWeather: @ 81379D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80AC3BC - lsls r0, 24 - cmp r0, 0 - beq _081379F2 - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_081379F2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end Task_WaitWeather - - thumb_func_start WaitWeather -WaitWeather: @ 81379F8 - push {lr} - ldr r0, =Task_WaitWeather - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end WaitWeather - - thumb_func_start InitBirchState -InitBirchState: @ 8137A0C - push {lr} - ldr r0, =0x00004049 - bl GetVarPointer - movs r1, 0 - strh r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end InitBirchState - - thumb_func_start UpdateBirchState -UpdateBirchState: @ 8137A20 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004049 - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0x7 - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateBirchState diff --git a/asm/title_screen.s b/asm/title_screen.s index 54c1b5353..32594424a 100644 --- a/asm/title_screen.s +++ b/asm/title_screen.s @@ -464,7 +464,7 @@ _080AA766: @ void title_screen_vblank_callback() title_screen_vblank_callback: @ 80AA780 push {lr} - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer @@ -779,7 +779,7 @@ _080AAAF0: movs r1, 0xA0 movs r2, 0x4 movs r3, 0x4 - bl sub_80BA384 + bl ScanlineEffect_InitWave ldr r0, =c2_title_screen_2 bl SetMainCallback2 _080AAB1E: diff --git a/asm/trade.s b/asm/trade.s index c546b6e9b..d085ca1e6 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -646,7 +646,7 @@ _080776E2: str r1, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x28 @@ -705,7 +705,7 @@ _08077756: str r0, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x2E @@ -1264,7 +1264,7 @@ _08077CA8: str r1, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x28 @@ -1323,7 +1323,7 @@ _08077D1E: str r0, [sp, 0x8] adds r0, r5, 0 ldr r1, =sub_80D3014 - bl sub_80D2CC4 + bl CreateMonIcon mov r2, r8 ldr r1, [r2] adds r1, 0x2E @@ -4609,7 +4609,7 @@ _080798BC: movs r1, 0x1 movs r2, 0 movs r3, 0 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 adds r0, r5, 0 bl PutWindowTilemap adds r0, r5, 0 @@ -14296,7 +14296,7 @@ sub_807F1A8: @ 807F1A8 movs r1, 0x1 movs r2, 0 movs r3, 0x2 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 adds r0, r5, 0 movs r1, 0x3 bl CopyWindowToVram diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 8b77e8393..96c759611 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -18,7 +18,7 @@ sub_80C2690: @ 80C2690 cmp r0, 0 beq _080C26C0 ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers str r0, [r1] movs r2, 0xF0 lsls r2, 3 @@ -40,7 +40,7 @@ sub_80C26D4: @ 80C26D4 ldrh r3, [r4] movs r0, 0 strh r0, [r4] - ldr r1, =gUnknown_02038C28 + ldr r1, =gScanlineEffectRegBuffers ldr r0, =0x04000006 ldrh r2, [r0] movs r0, 0xFF @@ -3977,9 +3977,9 @@ sub_80C4998: @ 80C4998 movs r0, 0x3 bl HideBg bl ScanlineEffect_Stop - bl dp12_8087EA4 + bl ScanlineEffect_Clear movs r1, 0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers movs r2, 0 movs r3, 0xF0 lsls r3, 3 @@ -4066,7 +4066,7 @@ _080C4A0E: movs r2, 0 cmp r2, r7 bcs _080C4A78 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers _080C4A60: lsls r0, r2, 16 asrs r0, 16 @@ -4091,7 +4091,7 @@ _080C4A78: lsrs r7, r4, 16 cmp r1, r0 bge _080C4AB0 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 adds r4, r3, 0 _080C4A92: @@ -4116,7 +4116,7 @@ _080C4AB0: asrs r0, r1, 16 cmp r0, 0x9F bgt _080C4ACE - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers _080C4ABC: asrs r0, r1, 16 lsls r1, r0, 1 @@ -4392,7 +4392,7 @@ _080C4CB6: movs r2, 0 cmp r2, r7 bcs _080C4D20 - ldr r3, =gUnknown_02038C28 + ldr r3, =gScanlineEffectRegBuffers _080C4D08: lsls r0, r2, 16 asrs r0, 16 @@ -4417,7 +4417,7 @@ _080C4D20: lsrs r7, r4, 16 cmp r1, r0 bge _080C4D56 - ldr r0, =gUnknown_02038C28 + ldr r0, =gScanlineEffectRegBuffers mov r12, r0 adds r4, r3, 0 _080C4D3A: @@ -4441,7 +4441,7 @@ _080C4D56: asrs r0, r1, 16 cmp r0, 0x9F bgt _080C4D74 - ldr r2, =gUnknown_02038C28 + ldr r2, =gScanlineEffectRegBuffers _080C4D62: asrs r0, r1, 16 lsls r1, r0, 1 @@ -8258,7 +8258,7 @@ _080C6E08: str r1, [sp, 0x10] movs r1, 0x1 movs r3, 0x1 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 ldr r0, [sp, 0x4C] mov r10, r4 cmp r0, 0x6 @@ -8410,7 +8410,7 @@ sub_80C6EAC: @ 80C6EAC movs r1, 0x1 movs r2, 0 movs r3, 0x2 - bl AddTextPrinterParametrized2 + bl AddTextPrinterParameterized2 lsrs r5, 1 adds r0, r7, 0 ldr r1, [sp, 0x24] diff --git a/asm/unknown_task.s b/asm/unknown_task.s deleted file mode 100644 index a8672ac8f..000000000 --- a/asm/unknown_task.s +++ /dev/null @@ -1,593 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start ScanlineEffect_Stop -ScanlineEffect_Stop: @ 80B9FB8 - push {r4,lr} - ldr r4, =gUnknown_02039B28 - movs r0, 0 - strb r0, [r4, 0x15] - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldrb r0, [r4, 0x18] - cmp r0, 0xFF - beq _080B9FE2 - bl DestroyTask - movs r0, 0xFF - strb r0, [r4, 0x18] -_080B9FE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ScanlineEffect_Stop - - thumb_func_start dp12_8087EA4 -dp12_8087EA4: @ 80B9FF8 - push {r4,lr} - sub sp, 0x4 - mov r0, sp - movs r4, 0 - strh r4, [r0] - ldr r1, =gUnknown_02038C28 - ldr r2, =0x01000780 - bl CpuSet - ldr r0, =gUnknown_02039B28 - movs r1, 0 - str r1, [r0] - str r1, [r0, 0x4] - str r1, [r0, 0x8] - str r1, [r0, 0xC] - strb r4, [r0, 0x14] - strb r4, [r0, 0x15] - strb r4, [r0, 0x16] - strb r4, [r0, 0x17] - movs r1, 0xFF - strb r1, [r0, 0x18] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp12_8087EA4 - - thumb_func_start sub_80BA038 -sub_80BA038: @ 80BA038 - push {lr} - sub sp, 0xC - str r0, [sp] - str r1, [sp, 0x4] - str r2, [sp, 0x8] - ldr r0, =0xa2600001 - cmp r1, r0 - bne _080BA06C - ldr r0, =gUnknown_02039B28 - ldr r1, =gUnknown_02038C2A - str r1, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - str r1, [r0, 0x4] - ldr r1, =sub_80BA134 - b _080BA07C - .pool -_080BA06C: - ldr r0, =gUnknown_02039B28 - ldr r1, =gUnknown_02038C2C - str r1, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - str r1, [r0, 0x4] - ldr r1, =sub_80BA154 -_080BA07C: - str r1, [r0, 0x10] - adds r1, r0, 0 - ldr r0, [sp, 0x4] - str r0, [r1, 0xC] - ldr r0, [sp] - str r0, [r1, 0x8] - mov r0, sp - ldrb r0, [r0, 0x8] - strb r0, [r1, 0x15] - mov r0, sp - ldrb r0, [r0, 0x9] - strb r0, [r1, 0x16] - strb r0, [r1, 0x17] - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA038 - - thumb_func_start sub_80BA0A8 -sub_80BA0A8: @ 80BA0A8 - push {r4,lr} - ldr r4, =gUnknown_02039B28 - ldrb r0, [r4, 0x15] - cmp r0, 0 - beq _080BA122 - cmp r0, 0x3 - bne _080BA0EC - movs r0, 0 - strb r0, [r4, 0x15] - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldr r1, =gUnknown_02039B44 - movs r0, 0x1 - strb r0, [r1] - b _080BA122 - .pool -_080BA0EC: - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldrb r0, [r4, 0x14] - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - str r0, [r1] - ldr r0, [r4, 0x8] - str r0, [r1, 0x4] - ldr r0, [r4, 0xC] - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r0, [r4, 0x10] - bl _call_via_r0 - ldrb r0, [r4, 0x14] - movs r1, 0x1 - eors r0, r1 - strb r0, [r4, 0x14] -_080BA122: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA0A8 - - thumb_func_start sub_80BA134 -sub_80BA134: @ 80BA134 - ldr r0, =gUnknown_02039B28 - ldr r2, [r0, 0x8] - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - ldr r1, =gUnknown_02038C28 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_80BA134 - - thumb_func_start sub_80BA154 -sub_80BA154: @ 80BA154 - ldr r0, =gUnknown_02039B28 - ldr r2, [r0, 0x8] - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - ldr r1, =gUnknown_02038C28 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - bx lr - .pool - thumb_func_end sub_80BA154 - - thumb_func_start task00_for_dp12 -task00_for_dp12: @ 80BA174 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - movs r6, 0 - ldr r0, =gUnknown_02039B44 - ldrb r0, [r0] - cmp r0, 0 - beq _080BA1A4 - mov r0, r12 - bl DestroyTask - ldr r1, =gUnknown_02039B28 - movs r0, 0xFF - strb r0, [r1, 0x18] - b _080BA324 - .pool -_080BA1A4: - ldr r1, =gTasks - mov r0, r12 - lsls r2, r0, 2 - adds r0, r2, r0 - lsls r0, 3 - adds r3, r0, r1 - movs r4, 0x16 - ldrsh r0, [r3, r4] - mov r10, r1 - mov r9, r2 - cmp r0, 0 - beq _080BA250 - movs r1, 0x14 - ldrsh r0, [r3, r1] - cmp r0, 0xE - bhi _080BA250 - lsls r0, 2 - ldr r1, =_080BA1D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080BA1D8: - .4byte _080BA214 - .4byte _080BA250 - .4byte _080BA21C - .4byte _080BA250 - .4byte _080BA224 - .4byte _080BA250 - .4byte _080BA22C - .4byte _080BA250 - .4byte _080BA234 - .4byte _080BA250 - .4byte _080BA23C - .4byte _080BA250 - .4byte _080BA244 - .4byte _080BA250 - .4byte _080BA24C -_080BA214: - ldr r0, =gBattle_BG0_X - b _080BA24E - .pool -_080BA21C: - ldr r0, =gBattle_BG0_Y - b _080BA24E - .pool -_080BA224: - ldr r0, =gBattle_BG1_X - b _080BA24E - .pool -_080BA22C: - ldr r0, =gBattle_BG1_Y - b _080BA24E - .pool -_080BA234: - ldr r0, =gBattle_BG2_X - b _080BA24E - .pool -_080BA23C: - ldr r0, =gBattle_BG2_Y - b _080BA24E - .pool -_080BA244: - ldr r0, =gBattle_BG3_X - b _080BA24E - .pool -_080BA24C: - ldr r0, =gBattle_BG3_Y -_080BA24E: - ldrh r6, [r0] -_080BA250: - mov r0, r9 - add r0, r12 - lsls r0, 3 - mov r2, r10 - adds r1, r0, r2 - ldrh r2, [r1, 0x10] - movs r3, 0x10 - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _080BA2BC - subs r0, r2, 0x1 - strh r0, [r1, 0x10] - movs r4, 0xE - ldrsh r0, [r1, r4] - movs r3, 0xA0 - lsls r3, 1 - adds r2, r0, r3 - movs r4, 0x8 - ldrsh r3, [r1, r4] - movs r4, 0xA - ldrsh r0, [r1, r4] - cmp r3, r0 - bge _080BA324 - ldr r5, =gUnknown_02038C28 - ldr r0, =gUnknown_02039B28 - mov r8, r0 - adds r7, r1, 0 - lsls r0, r2, 1 - adds r4, r0, r5 -_080BA28A: - lsls r2, r3, 1 - mov r0, r8 - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - adds r2, r0 - adds r2, r5 - ldrh r0, [r4] - adds r0, r6 - strh r0, [r2] - adds r4, 0x2 - adds r3, 0x1 - movs r1, 0xA - ldrsh r0, [r7, r1] - cmp r3, r0 - blt _080BA28A - b _080BA324 - .pool -_080BA2BC: - ldrh r0, [r1, 0x12] - strh r0, [r1, 0x10] - movs r2, 0xE - ldrsh r0, [r1, r2] - movs r3, 0xA0 - lsls r3, 1 - adds r2, r0, r3 - movs r4, 0x8 - ldrsh r3, [r1, r4] - movs r4, 0xA - ldrsh r0, [r1, r4] - cmp r3, r0 - bge _080BA304 - ldr r5, =gUnknown_02038C28 - adds r7, r1, 0 - lsls r0, r2, 1 - adds r4, r0, r5 - ldr r0, =gUnknown_02039B28 - mov r8, r0 -_080BA2E2: - lsls r2, r3, 1 - mov r0, r8 - ldrb r1, [r0, 0x14] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 7 - adds r2, r0 - adds r2, r5 - ldrh r0, [r4] - adds r0, r6 - strh r0, [r2] - adds r4, 0x2 - adds r3, 0x1 - movs r1, 0xA - ldrsh r0, [r7, r1] - cmp r3, r0 - blt _080BA2E2 -_080BA304: - mov r0, r9 - add r0, r12 - lsls r0, 3 - mov r3, r10 - adds r2, r0, r3 - ldrh r0, [r2, 0xE] - adds r0, 0x1 - strh r0, [r2, 0xE] - lsls r0, 16 - asrs r0, 16 - movs r4, 0xC - ldrsh r1, [r2, r4] - cmp r0, r1 - bne _080BA324 - movs r0, 0 - strh r0, [r2, 0xE] -_080BA324: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task00_for_dp12 - - thumb_func_start sub_80BA33C -sub_80BA33C: @ 80BA33C - push {r4-r7,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r4, r2, 24 - movs r1, 0 - movs r2, 0 - ldr r0, =gSineTable - mov r12, r0 -_080BA350: - lsls r0, r1, 1 - adds r3, r0, r6 - lsls r0, r2, 1 - add r0, r12 - movs r7, 0 - ldrsh r0, [r0, r7] - muls r0, r4 - cmp r0, 0 - bge _080BA364 - adds r0, 0xFF -_080BA364: - asrs r0, 8 - strh r0, [r3] - adds r0, r2, r5 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xFF - bls _080BA350 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA33C - - thumb_func_start sub_80BA384 -sub_80BA384: @ 80BA384 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - adds r5, r0, 0 - str r1, [sp, 0x10] - ldr r0, [sp, 0x40] - mov r8, r0 - ldr r1, [sp, 0x44] - mov r9, r1 - ldr r0, [sp, 0x48] - mov r10, r0 - lsls r5, 24 - lsrs r5, 24 - ldr r1, [sp, 0x10] - lsls r1, 24 - str r1, [sp, 0x14] - lsrs r0, r1, 24 - str r0, [sp, 0xC] - lsls r1, r2, 24 - lsrs r1, 24 - str r1, [sp, 0x18] - lsls r2, r3, 24 - lsrs r2, 24 - str r2, [sp, 0x1C] - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - mov r3, r9 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - bl dp12_8087EA4 - ldr r0, =0x04000010 - add r0, r9 - str r0, [sp] - ldr r0, =0xa2600001 - str r0, [sp, 0x4] - mov r1, sp - movs r0, 0x1 - strb r0, [r1, 0x8] - mov r0, sp - movs r1, 0 - strb r1, [r0, 0x9] - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl sub_80BA038 - ldr r0, =task00_for_dp12 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r0 - strh r5, [r4, 0x8] - mov r3, sp - ldrh r3, [r3, 0xC] - strh r3, [r4, 0xA] - movs r0, 0x80 - lsls r0, 1 - ldr r1, [sp, 0x18] - bl __divsi3 - strh r0, [r4, 0xC] - movs r0, 0 - strh r0, [r4, 0xE] - mov r1, r8 - strh r1, [r4, 0x10] - strh r1, [r4, 0x12] - mov r3, r9 - strh r3, [r4, 0x14] - mov r0, r10 - strh r0, [r4, 0x16] - ldr r0, =gUnknown_02039B28 - strb r7, [r0, 0x18] - ldr r0, =gUnknown_02039B44 - movs r1, 0 - strb r1, [r0] - ldr r4, =gUnknown_02038EA8 - ldr r3, [sp, 0xC] - subs r6, r3, r5 - lsls r3, r6, 24 - lsrs r3, 24 - adds r0, r4, 0 - ldr r1, [sp, 0x18] - ldr r2, [sp, 0x1C] - bl sub_80BA33C - ldr r0, [sp, 0xC] - cmp r5, r0 - bge _080BA47E - ldr r1, =0xfffffd80 - adds r2, r4, r1 - lsls r1, r5, 1 - movs r3, 0xF0 - lsls r3, 3 - adds r0, r1, r3 - adds r3, r0, r2 - adds r1, r2 - adds r2, r4, 0 - adds r5, r6, 0 -_080BA46A: - ldrh r0, [r2] - strh r0, [r1] - ldrh r0, [r2] - strh r0, [r3] - adds r2, 0x2 - adds r3, 0x2 - adds r1, 0x2 - subs r5, 0x1 - cmp r5, 0 - bne _080BA46A -_080BA47E: - adds r0, r7, 0 - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BA384 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s index 60c11524a..5047ec65e 100644 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -732,10 +732,10 @@ _08166C28: b _08166D18 .pool _08166C40: - ldr r1, =gUnknown_02039B28 + ldr r1, =gScanlineEffect movs r0, 0x3 strb r0, [r1, 0x15] - bl sub_80BA0A8 + bl ScanlineEffect_InitHBlankDmaTransfer _08166C4A: ldr r1, [r4] adds r1, 0x50 diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index a0c3b39d2..878b48ccb 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1,6 +1,7 @@ +#include "constants/rgb.h" +#include "constants/songs.h" .include "asm/macros/battle_anim_script.inc" .include "include/constants/battle_anim.h" - .include "include/constants/songs.h" .section script_data, "aw", %progbits @@ -684,7 +685,7 @@ Move_FLAME_WHEEL: createsprite gUnknown_0857FE70, 0x2, 0, 24, 0, 0, 6 delay 0x4 createvisualtask sub_80D51AC, 0x2, 1, 5, 0, 8, 1 - createvisualtask sub_80A7B98, 0x3, 1, 31, 12, 1, 1 + createvisualtask sub_80A7B98, 0x3, 1, RGB_RED, 12, 1, 1 playsewithpan SE_W172B, +63 call AnimScript_82D2D18 delay 0x7 @@ -789,7 +790,7 @@ Move_DOUBLE_EDGE: waitplaysewithpan SE_W207, -64, 0x8 createvisualtask sub_80D5830, 0x2, 0, 18, 6, 2, 4 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 16, 16, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 0, 16, 16, RGB_WHITE createsprite gUnknown_0857FE70, 0x2, 0, 20, 0, 0, 4 delay 0x3 waitforvisualfinish @@ -801,7 +802,7 @@ Move_DOUBLE_EDGE: createvisualtask sub_80D6134, 0x2, 8, -256, 1, 0 createvisualtask sub_80D5484, 0x2, 0, 4, 0, 12, 1 createvisualtask sub_80D5484, 0x2, 1, 4, 0, 12, 1 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_WHITE waitforvisualfinish createvisualtask sub_80D6134, 0x2, 8, -256, 0, 1 createvisualtask sub_80D6134, 0x2, 8, -256, 1, 1 @@ -942,7 +943,7 @@ Move_MEGA_PUNCH: loadspritegfx 0x279F monbg ANIM_TARGET delay 0x2 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, RGB_BLACK setalpha 0x80C playsewithpan SE_W025, +63 createsprite gUnknown_08595F48, 0x3, 0, 0, 0, 50 @@ -990,7 +991,7 @@ Move_MEGA_KICK: loadspritegfx 0x279F monbg ANIM_TARGET delay 0x2 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 16, RGB_BLACK setalpha 0x80C playsewithpan SE_W025, +63 createsprite gUnknown_08595F48, 0x3, 0, 0, 1, 50 @@ -1232,7 +1233,7 @@ Move_HIDDEN_POWER: createvisualtask sub_80D6064, 0x5, -7, -7, 11, 0, 0 waitforvisualfinish delay 0x1E - createvisualtask sub_80A7B98, 0x5, 0, 20479, 12, 5, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(31, 31, 19), 12, 5, 1 delay 0x4 createvisualtask sub_80D6064, 0x5, -7, -7, 11, 0, 0 playsewithpan SE_W179, -64 @@ -1705,7 +1706,7 @@ Move_PROTECT: Move_DETECT: loadspritegfx 0x2757 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 9, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 9, RGB_BLACK waitforvisualfinish createvisualtask sub_8116620, 0xA, 2, 1, 0, 9, 0x7FFF delay 0x12 @@ -1713,7 +1714,7 @@ Move_DETECT: createsprite gUnknown_0853EE84, 0xD, 20, -20 waitforvisualfinish delay 0xA - createsprite gUnknown_08597274, 0x2, 1, 2, 9, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 9, 0, RGB_BLACK createvisualtask sub_8116620, 0xA, 2, 2, 9, 0, 0x7FFF waitforvisualfinish end @@ -2118,12 +2119,12 @@ Move_MEAN_LOOK: loadspritegfx 0x27CB monbg ANIM_DEF_PARTNER playsewithpan SE_W060, -64 - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, RGB_BLACK loopsewithpan SE_W109, +63, 0xF, 0x4 waitplaysewithpan SE_W043, +63, 0x55 createsprite gUnknown_085CE104, 0x2 delay 0x78 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_BLACK delay 0x1E clearmonbg ANIM_DEF_PARTNER waitforvisualfinish @@ -2792,7 +2793,7 @@ Move_RAGE: loadspritegfx 0x2767 monbg ANIM_TARGET setalpha 0x80C - createvisualtask sub_80A7B98, 0x3, 0, 31, 10, 0, 2 + createvisualtask sub_80A7B98, 0x3, 0, RGB_RED, 10, 0, 2 createsprite gUnknown_0859368C, 0x2, 0, -20, -28 playsewithpan SE_W207B, -64 delay 0x14 @@ -3068,7 +3069,7 @@ Move_SUPER_FANG: playsewithpan SE_W082, -64 waitforvisualfinish createvisualtask sub_80D5484, 0x2, 0, 3, 0, 48, 1 - createvisualtask sub_80A7B98, 0x2, 0, 1247, 12, 4, 1 + createvisualtask sub_80A7B98, 0x2, 0, RGB(31, 6, 1), 12, 4, 1 waitforvisualfinish delay 0x14 createsprite gUnknown_0857FE28, 0x2, 4, 4 @@ -3137,7 +3138,7 @@ Move_NIGHTMARE: end AnimScript_82CD4CF: - createvisualtask sub_80A7B98, 0x2, 0, 0x7FFF, 10, 2, 1 + createvisualtask sub_80A7B98, 0x2, 0, RGB_WHITE, 10, 2, 1 createvisualtask sub_80D51AC, 0x2, 0, 3, 0, 32, 1 playsewithpan SE_W171, +63 waitforvisualfinish @@ -3220,7 +3221,7 @@ Move_FORESIGHT: delay 0x18 playsewithpan SE_W166, +63 delay 0xA - createvisualtask sub_80A7B98, 0x5, 1, 0x7FFF, 12, 2, 1 + createvisualtask sub_80A7B98, 0x5, 1, RGB_WHITE, 12, 2, 1 playsewithpan SE_W197, +63 waitforvisualfinish blendoff @@ -3418,7 +3419,7 @@ Move_MOONLIGHT: loadspritegfx 0x27D3 loadspritegfx 0x272F setalpha 0x1000 - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 16, RGB_BLACK waitforvisualfinish createsprite gUnknown_08592EBC, 0x2, 120, 56 createvisualtask sub_80A7A74, 0x3, 0, 16, 16, 0, 1 @@ -3517,7 +3518,7 @@ Move_UPROAR: Move_HEAT_WAVE: loadspritegfx 0x2815 - createvisualtask sub_8116848, 0x5, 10261, 0, 6, 6, 31 + createvisualtask sub_8116848, 0x5, 10261, 0, 6, 6, RGB_RED createvisualtask sub_8110BCC, 0x5, 1 createvisualtask sub_810A060, 0x6, 6, 31 panse_1B SE_W257, -64, +63, +2, 0x0 @@ -3555,7 +3556,7 @@ Move_TORMENT: loadspritegfx 0x27E1 createvisualtask sub_815AFF0, 0x2 waitforvisualfinish - createvisualtask sub_80A7B98, 0x2, 1, 31, 10, 1, 1 + createvisualtask sub_80A7B98, 0x2, 1, RGB_RED, 10, 1, 1 createsprite gUnknown_0859368C, 0x82, 1, -20, -28 playsewithpan SE_W207B, +63 delay 0x14 @@ -3625,7 +3626,7 @@ Move_CHARGE: loadspritegfx 0x27E5 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask sub_810AAFC, 0x2, 0, 60, 2, 12 playsewithpan SE_W268, -64 @@ -3649,7 +3650,7 @@ Move_CHARGE: createsprite gUnknown_0859598C, 0x2, 0, -16, -16 playsewithpan SE_W085B, -64 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff end @@ -3688,7 +3689,7 @@ Move_HELPING_HAND: delay 0x14 playsewithpan SE_W227, 0 createvisualtask sub_80D52D0, 0x2, 2, 3, 0, 10, 1 - createvisualtask sub_80A7B98, 0x2, 2, 1023, 12, 1, 1 + createvisualtask sub_80A7B98, 0x2, 2, RGB_YELLOW, 12, 1, 1 end Move_ASSIST: @@ -3750,7 +3751,7 @@ Move_RECYCLE: createsprite gUnknown_085CE9B0, 0x2 loopsewithpan SE_W036, -64, 0x18, 0x3 waitforvisualfinish - createvisualtask sub_80A7B98, 0x5, 0, 0x7FFF, 12, 2, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB_WHITE, 12, 2, 1 playsewithpan SE_W036, -64 waitforvisualfinish blendoff @@ -3780,13 +3781,13 @@ AnimScript_82CE0A7: playsewithpan SE_W233, +63 delay 0x14 createvisualtask sub_80D5C50, 0x2, 0, -24, 0, 24, 10, 24, 3 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, RGB_BLACK delay 0x25 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 1 createsprite gUnknown_08595E98, 0x4, 0, 0, 10, 1, 0 playsewithpan SE_W233B, +63 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3807,7 +3808,7 @@ AnimScript_82CE154: playsewithpan SE_W233, +63 delay 0x14 createvisualtask sub_80D5C50, 0x2, 0, -24, 0, 24, 10, 24, 3 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 6, RGB_BLACK delay 0x25 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 1 createsprite gUnknown_08595E98, 0x4, 0, 0, 10, 1, 0 @@ -3819,7 +3820,7 @@ AnimScript_82CE154: createsprite gUnknown_08595FA8, 0x2, 1, 3, 8, 12 playsewithpan SE_W280, +63 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3845,7 +3846,7 @@ Move_ENDEAVOR: loadspritegfx 0x2797 createvisualtask sub_815DCA4, 0x2, 0, 2 loopsewithpan SE_W039, -64, 0x18, 0x2 - createvisualtask sub_80A7B98, 0x5, 0, 703, 12, 1, 2 + createvisualtask sub_80A7B98, 0x5, 0, RGB(31, 21, 0), 12, 1, 2 delay 0x6 createvisualtask sub_80D6388, 0x5, 0, 1, 8, 1, 0 createsprite gUnknown_08597358, 0x82, 12, -12, 1, 2 @@ -3858,7 +3859,7 @@ Move_ENDEAVOR: Move_ERUPTION: loadspritegfx 0x27D9 - createsprite gUnknown_08597274, 0x2, 31, 2, 0, 4, 31 + createsprite gUnknown_08597274, 0x2, 31, 2, 0, 4, RGB_RED waitforvisualfinish createvisualtask sub_8109460, 0x2 waitplaysewithpan SE_W153, -64, 0x3C @@ -3878,18 +3879,18 @@ Move_ERUPTION: createvisualtask sub_81152DC, 0x5, 4, 8, 60 loopsewithpan SE_W088, +63, 0x10, 0xC delay 0x50 - createsprite gUnknown_08597274, 0x28, 31, 4, 4, 0, 31 + createsprite gUnknown_08597274, 0x28, 31, 4, 4, 0, RGB_RED end Move_SKILL_SWAP: loadspritegfx 0x280B call AnimScript_82D7CD1 createvisualtask sub_810FBF0, 0x3, 1 - createvisualtask sub_80A7B98, 0x5, 1, 0x7FFF, 12, 3, 1 + createvisualtask sub_80A7B98, 0x5, 1, RGB_WHITE, 12, 3, 1 loopsewithpan SE_W179, -64, 0x18, 0x3 delay 0x10 createvisualtask sub_810FBF0, 0x3, 0 - createvisualtask sub_80A7B98, 0x5, 0, 0x7FFF, 12, 3, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB_WHITE, 12, 3, 1 waitforvisualfinish call AnimScript_82D7CDD end @@ -3951,13 +3952,13 @@ Move_TAIL_GLOW: loadspritegfx 0x27E4 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createsprite gUnknown_08596AC8, 0x42, 0 delay 0x12 loopsewithpan SE_W234, -64, 0x10, 0x6 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff delay 0x1 @@ -4193,7 +4194,7 @@ Move_AROMATHERAPY: loadspritegfx 0x27AF loadspritegfx 0x27DB loadspritegfx 0x2741 - createsprite gUnknown_08597274, 0x0, 1, 0, 0, 7, 13293 + createsprite gUnknown_08597274, 0x0, 1, 0, 0, 7, RGB(13, 31, 12) delay 0x1 monbg ANIM_ATTACKER delay 0x1 @@ -4211,7 +4212,7 @@ Move_AROMATHERAPY: waitforvisualfinish clearmonbg ANIM_ATTACKER delay 0x1 - createsprite gUnknown_08597274, 0x0, 1, 0, 7, 0, 13293 + createsprite gUnknown_08597274, 0x0, 1, 0, 7, 0, RGB(13, 31, 12) delay 0x1 playsewithpan SE_W287, -64 createvisualtask sub_815DFCC, 0x2, 1 @@ -4222,7 +4223,7 @@ Move_AROMATHERAPY: createsprite gUnknown_08592B94, 0x10, 12, -5, 0, 0, 32, 60, 1 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x0, 43, 3, 10, 0, 13293 + createsprite gUnknown_08597274, 0x0, 43, 3, 10, 0, RGB(13, 31, 12) createsprite gUnknown_08593868, 0x10, 0, 0, 0, 1 waitforvisualfinish end @@ -4231,7 +4232,7 @@ Move_FAKE_TEARS: loadspritegfx 0x27AB loadspritegfx 0x27E1 loadspritegfx 0x2758 - createvisualtask sub_8116848, 0x5, 10155, 0, 4, 4, 32108 + createvisualtask sub_8116848, 0x5, 10155, 0, 4, 4, RGB(12, 11, 31) waitforvisualfinish createvisualtask sub_815C478, 0x5, 0, 2, 1 loopsewithpan SE_W039, -64, 0xC, 0x4 @@ -4289,7 +4290,7 @@ Move_ODOR_SLEUTH: Move_GRASS_WHISTLE: loadspritegfx 0x2758 - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 13298 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB(18, 31, 12) waitforvisualfinish createvisualtask sub_8102BE8, 0x2 waitforvisualfinish @@ -4320,19 +4321,19 @@ Move_GRASS_WHISTLE: delay 0x4 waitforvisualfinish createvisualtask sub_8102CA0, 0x2 - createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, 13298 + createsprite gUnknown_08597274, 0x2, 1, 4, 4, 0, RGB(18, 31, 12) waitforvisualfinish end Move_TICKLE: loadspritegfx 0x27EA - createsprite gUnknown_08597274, 0x2, 2, 0, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 2, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gUnknown_08593A84, 0x0, -16, -8 createsprite gUnknown_08593A84, 0x0, 16, -8 playsewithpan SE_W197, -64 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 2, 0, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 2, 0, 16, 0, RGB_BLACK waitforvisualfinish delay 0x14 createvisualtask sub_80D5EB8, 0x3, 0, 6, 1280, 3, 0 @@ -4384,11 +4385,11 @@ Move_EXTRASENSORY: call AnimScript_82D7CD1 monbg ANIM_DEF_PARTNER setalpha 0x80C - createvisualtask sub_80A7B98, 0x5, 0, 891, 12, 1, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(27, 27, 0), 12, 1, 1 createvisualtask sub_810FE14, 0x5, 0 playsewithpan SE_W020, +63 waitforvisualfinish - createvisualtask sub_80A7B98, 0x5, 0, 891, 12, 1, 1 + createvisualtask sub_80A7B98, 0x5, 0, RGB(27, 27, 0), 12, 1, 1 createvisualtask sub_810FE14, 0x5, 1 playsewithpan SE_W020, +63 waitforvisualfinish @@ -4607,7 +4608,7 @@ Move_SHOCK_WAVE: loadspritegfx 0x2735 monbg ANIM_ATTACKER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask sub_810AAFC, 0x2, 0, 20, 0, 2 playsewithpan SE_W268, -64 @@ -4725,7 +4726,7 @@ Move_ICE_PUNCH: loadspritegfx 0x279D loadspritegfx 0x2797 loadspritegfx 0x279F - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, RGB_BLACK createvisualtask sub_8116620, 0xA, 4, 2, 0, 9, 32588 delay 0x14 playsewithpan SE_W081, +63 @@ -4750,7 +4751,7 @@ Move_ICE_PUNCH: delay 0x5 createvisualtask sub_8116620, 0xA, 4, 2, 9, 0, 32588 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -4829,7 +4830,7 @@ Move_THUNDER: waitbgfadeout createvisualtask sub_8117660, 0x5, -256, 0, 1, -1 waitbgfadein - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, RGB_BLACK delay 0x10 createvisualtask sub_8115F10, 0x2, 257, 257, 257 playsewithpan SE_W086, +63 @@ -4873,7 +4874,7 @@ Move_THUNDER: delay 0x2 createvisualtask sub_8115F10, 0x2, 257, 257, 257 delay 0x1 - createsprite gUnknown_08597274, 0x82, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x82, 1, 2, 16, 0, RGB_BLACK waitforvisualfinish restorebg waitbgfadeout @@ -4887,7 +4888,7 @@ Move_THUNDER_PUNCH: loadspritegfx 0x2735 monbg ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 0, 16, RGB_BLACK waitforvisualfinish playsewithpan SE_W004, +63 createsprite gUnknown_08595E98, 0x84, 0, 0, 8, 1, 0 @@ -4907,7 +4908,7 @@ Move_THUNDER_PUNCH: createvisualtask sub_80D51AC, 0x2, 1, 0, 3, 15, 1 createsprite gUnknown_08597358, 0x3, 0, 0, 1, 2 delay 0x1 - createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 2, 16, 0, RGB_BLACK delay 0x14 waitforvisualfinish clearmonbg ANIM_TARGET @@ -5413,7 +5414,7 @@ Move_ICE_BEAM: monbgprio_28 ANIM_TARGET setalpha 0x80C loadspritegfx 0x279D - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, 0 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 7, RGB_BLACK waitforvisualfinish createsoundtask sub_8158C58, 183, -64, 63, 4, 4, 0, 10 createsprite gUnknown_08595B2C, 0x2, 20, 12, 0, 12, 20 @@ -5422,7 +5423,7 @@ Move_ICE_BEAM: call AnimScript_82D07C1 call AnimScript_82D07C1 call AnimScript_82D07C1 - createsprite gUnknown_08597274, 0x2, 4, -31, 0, 7, 32384 + createsprite gUnknown_08597274, 0x2, 4, -31, 0, 7, RGB(0, 20, 31) createvisualtask sub_80D52D0, 0x2, 1, 2, 0, 25, 1 call AnimScript_82D07C1 call AnimScript_82D07C1 @@ -5438,9 +5439,9 @@ Move_ICE_BEAM: waitforvisualfinish delay 0x14 call AnimScript_82D7720 - createsprite gUnknown_08597274, 0x2, 4, 5, 7, 0, 32384 + createsprite gUnknown_08597274, 0x2, 4, 5, 7, 0, RGB(0, 20, 31) waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, 0 + createsprite gUnknown_08597274, 0x2, 1, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -5648,7 +5649,7 @@ AnimScript_82D0CB2: Move_POWDER_SNOW: loadspritegfx 0x279D monbg ANIM_DEF_PARTNER - createsprite gUnknown_08597274, 0x2, 31, 1, 0, 3, 0 + createsprite gUnknown_08597274, 0x2, 31, 1, 0, 3, RGB_BLACK waitforvisualfinish panse_1B SE_W016, -64, +63, +2, 0x0 call AnimScript_82D0D03 @@ -5660,7 +5661,7 @@ Move_POWDER_SNOW: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 0x14 - createsprite gUnknown_08597274, 0x2, 31, 1, 3, 0, 0 + createsprite gUnknown_08597274, 0x2, 31, 1, 3, 0, RGB_BLACK end AnimScript_82D0D03: @@ -5778,7 +5779,7 @@ Move_ABSORB: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 2 @@ -5791,7 +5792,7 @@ Move_ABSORB: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5831,7 +5832,7 @@ Move_MEGA_DRAIN: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 8, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 8, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 1 @@ -5844,7 +5845,7 @@ Move_MEGA_DRAIN: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 8, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 8, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5892,7 +5893,7 @@ Move_GIGA_DRAIN: monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 12, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 12, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_W071, +63 createsprite gUnknown_08597358, 0x2, 0, 0, 1, 0 @@ -5905,7 +5906,7 @@ Move_GIGA_DRAIN: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 12, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 12, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -6446,14 +6447,14 @@ Move_WHIRLPOOL: monbgprio_28 ANIM_TARGET setalpha 0x80C delay 0x0 - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_W250, +63 createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 50, 1 call AnimScript_82D1F5B call AnimScript_82D1F5B call AnimScript_82D1F5B delay 0xC - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -7354,7 +7355,7 @@ Move_POISON_TAIL: loadspritegfx 0x2797 loadspritegfx 0x27A6 loopsewithpan SE_W231, -64, 0x1C, 0x2 - createvisualtask sub_81144F8, 0x5, 1, 1, 23768 + createvisualtask sub_81144F8, 0x5, 1, 1, RGB(24, 6, 23) waitforvisualfinish monbg ANIM_TARGET setalpha 0x80C @@ -7783,7 +7784,7 @@ Move_SOFT_BOILED: delay 0x78 delay 0x7 playsewithpan SE_W030, -64 - createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, 31500 + createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, RGB(12, 24, 30) createsprite gUnknown_0859381C, 0x3, 31, 16, 0, 1 delay 0x8 createsprite gUnknown_0859381C, 0x3, 31, 16, 0, 1 @@ -7855,7 +7856,7 @@ Move_FAKE_OUT: createvisualtask sub_80D52D0, 0x2, 1, 4, 0, 5, 1 createvisualtask sub_8106020, 0x3 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, RGB_WHITE end Move_SCARY_FACE: @@ -8270,7 +8271,7 @@ Move_STOCKPILE: call AnimScript_82D4972 call AnimScript_82D4972 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 2, 0, 12, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 2, 0, 12, 0, RGB_WHITE end AnimScript_82D4972: @@ -8585,7 +8586,7 @@ Move_REFRESH: call AnimScript_82D79B4 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, 31500 + createsprite gUnknown_08597274, 0x2, 31, 3, 10, 0, RGB(12, 24, 30) createsprite gUnknown_0859381C, 0x3, 0, 0, 0, 0 end @@ -8622,7 +8623,7 @@ Move_HYPER_VOICE: end AnimScript_82D50FA: - createsprite gUnknown_08597274, 0x2, 31, 3, 8, 0, 1023 + createsprite gUnknown_08597274, 0x2, 31, 3, 8, 0, RGB_YELLOW createvisualtask sub_80D6064, 0x5, -5, -5, 5, 0, 0 createsprite gUnknown_08593880, 0x0, 45, 0, 0, 0, 0, 0, 1 createvisualtask sub_80D52D0, 0x2, 1, 1, 0, 6, 1 @@ -8633,14 +8634,14 @@ AnimScript_82D50FA: Move_SAND_TOMB: loadspritegfx 0x275A - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(19, 17, 0) createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 43, 1 playsewithpan SE_W328, +63 call AnimScript_82D51B7 call AnimScript_82D51B7 call AnimScript_82D51B7 delay 0x16 - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish end @@ -9422,7 +9423,7 @@ Move_OVERHEAT: loadspritegfx 0x2797 monbg ANIM_DEF_PARTNER setalpha 0x120C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 5, 28 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 5, RGB(28, 0, 0) waitforvisualfinish createvisualtask sub_8117C44, 0x5 waitforvisualfinish @@ -9433,7 +9434,7 @@ Move_OVERHEAT: playsewithpan SE_W082, -64 createvisualtask sub_8117CA0, 0x5, 1, 0 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, 1, 0, 13, 28 + createsprite gUnknown_08597274, 0x2, 2, 1, 0, 13, RGB(28, 0, 0) createvisualtask sub_80D51AC, 0x5, 0, 2, 0, 15, 1 waitforvisualfinish playsewithpan SE_W172B, -64 @@ -9479,12 +9480,12 @@ Move_OVERHEAT: playsewithpan SE_W007, +63 createvisualtask sub_8117DD8, 0x5, 1 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, -1, 0, 13, 19026 + createsprite gUnknown_08597274, 0x2, 2, -1, 0, 13, RGB(18, 18, 18) createvisualtask sub_80D51AC, 0x5, 0, 3, 0, 15, 1 waitforvisualfinish createvisualtask sub_8117D3C, 0x5, 0, 1 delay 0x1 - createsprite gUnknown_08597274, 0x2, 1, 1, 5, 0, 28 + createsprite gUnknown_08597274, 0x2, 1, 1, 5, 0, RGB(28, 0, 0) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -9492,7 +9493,7 @@ Move_OVERHEAT: delay 0xF createvisualtask sub_8117D3C, 0x5, 1, 0 delay 0x1 - createsprite gUnknown_08597274, 0x2, 2, 0, 13, 0, 19026 + createsprite gUnknown_08597274, 0x2, 2, 0, 13, 0, RGB(18, 18, 18) waitforvisualfinish createvisualtask sub_8117C70, 0x5 waitforvisualfinish @@ -9643,7 +9644,7 @@ Move_WATER_PULSE: monbg ANIM_TARGET monbgprio_28 ANIM_TARGET playsewithpan SE_W145C, -64 - createsprite gUnknown_08597274, 0x2, 1, 0, 0, 7, 29472 + createsprite gUnknown_08597274, 0x2, 1, 0, 0, 7, RGB(0, 25, 28) delay 0xA createsprite gUnknown_085952F8, 0x42, 100, 100, 8, 1, 20, 40, 0 createsprite gUnknown_085952F8, 0x42, 20, 100, 16, 2, 10, 35, 1 @@ -9663,7 +9664,7 @@ Move_WATER_PULSE: delay 0xD createvisualtask sub_80D51AC, 0x2, 1, 0, 8, 18, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 7, 0, 29472 + createsprite gUnknown_08597274, 0x2, 1, 1, 7, 0, RGB(0, 25, 28) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -10560,13 +10561,13 @@ AnimScript_82D800E: monbgprio_28 ANIM_TARGET setalpha 0x80C delay 0x0 - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_W250, +63 createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 30, 1 call AnimScript_82D1F5B call AnimScript_82D1F5B delay 0xC - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 23968 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish stopsound clearmonbg ANIM_DEF_PARTNER @@ -10591,13 +10592,13 @@ AnimScript_82D8062: AnimScript_82D80BF: loadspritegfx 0x275A - createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 0, 7, RGB(19, 17, 0) createvisualtask sub_80D51AC, 0x5, 1, 0, 2, 30, 1 playsewithpan SE_W328, +63 call AnimScript_82D51B7 call AnimScript_82D51B7 delay 0x16 - createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, 563 + createsprite gUnknown_08597274, 0x0, 4, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish stopsound end @@ -10619,7 +10620,7 @@ Anim_ItemEffect: call AnimScript_82D79B4 waitforvisualfinish playsewithpan SE_REAPOKE, -64 - createsprite gUnknown_08597274, 0x2, 2, 3, 7, 0, 26609 + createsprite gUnknown_08597274, 0x2, 2, 3, 7, 0, RGB(17, 31, 25) createsprite gUnknown_0859381C, 0x3, 0, 0, 0, 0 waitforvisualfinish end @@ -10663,11 +10664,11 @@ Anim_SmokeBallEscape: end Anim_HangedOn: - createsprite gUnknown_08597274, 0x0, 2, 7, 0, 9, 31 + createsprite gUnknown_08597274, 0x0, 2, 7, 0, 9, RGB_RED playsewithpan SE_W082, -64 createvisualtask sub_815DB90, 0x5, 30, 128, 0, 1, 2, 0, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x0, 2, 4, 9, 0, 31 + createsprite gUnknown_08597274, 0x0, 2, 4, 9, 0, RGB_RED waitforvisualfinish delay 0x6 createsprite gUnknown_0857FE58, 0x0, 0, 0, 15 @@ -10769,7 +10770,7 @@ Anim_FutureSightHit: Anim_DoomDesireHit: createvisualtask sub_8117F10, 0x2 loadspritegfx 0x27D6 - createsprite gUnknown_08597274, 0x2, 1, 3, 0, 16, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 0, 16, RGB_WHITE waitforvisualfinish delay 0xA createvisualtask sub_815C0A4, 0x5 @@ -10796,7 +10797,7 @@ Anim_DoomDesireHit: playsewithpan SE_W120, +63 createsprite gUnknown_0859371C, 0x3, 16, 16, 1, 1 waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, 0x7FFF + createsprite gUnknown_08597274, 0x2, 1, 3, 16, 0, RGB_WHITE waitforvisualfinish end @@ -10818,7 +10819,7 @@ Status_Ingrain: loadspritegfx 0x272F monbg ANIM_DEF_PARTNER setalpha 0x80C - createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish delay 0x3 call AnimScript_82D1009 @@ -10826,7 +10827,7 @@ Status_Ingrain: delay 0xF call AnimScript_82D79DF waitforvisualfinish - createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, 13293 + createsprite gUnknown_08597274, 0x2, 1, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff diff --git a/data/coord_event_weather.s b/data/coord_event_weather.s deleted file mode 100644 index c7b995912..000000000 --- a/data/coord_event_weather.s +++ /dev/null @@ -1,21 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_085102E0:: @ 85102E0 - .4byte 0x00000001, sub_809D7BC - .4byte 0x00000002, sub_809D7C8 - .4byte 0x00000003, sub_809D7D4 - .4byte 0x00000004, sub_809D7E0 - .4byte 0x00000005, sub_809D7EC - .4byte 0x00000006, sub_809D7F8 - .4byte 0x00000007, sub_809D804 - .4byte 0x00000008, sub_809D810 - .4byte 0x00000009, sub_809D81C - .4byte 0x0000000a, sub_809D828 - .4byte 0x0000000b, sub_809D834 - .4byte 0x00000014, sub_809D840 - .4byte 0x00000015, sub_809D84C - diff --git a/data/fldeff_cut.s b/data/fldeff_cut.s index 9fea73f9a..ee5a09c37 100644 --- a/data/fldeff_cut.s +++ b/data/fldeff_cut.s @@ -6,7 +6,7 @@ gUnknown_0857C608:: @ 857C608 .byte 0xfe, 0xfe, 0x01, 0x00, 0xff, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x01, 0xfe, 0x03, 0x00, 0x02, 0xfe, 0x03, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0xff, 0x03, 0x00, 0xfe, 0x00, 0x04, 0x00, 0x02, 0x00 - .byte 0x06, 0x00, 0xfe, 0x01, 0x07, 0x00, 0x02, 0x01, 0x09, 0x00, 0xfe, 0x02, 0x07, 0x00, 0xff, 0x02, 0x07, 0x00, 0x00, 0x02, 0x08, 0x00, 0x01, 0x02, 0x09, 0x00, 0x02, 0x02, 0x09, + .byte 0x06, 0x00, 0xfe, 0x01, 0x07, 0x00, 0x02, 0x01, 0x09, 0x00, 0xfe, 0x02, 0x07, 0x00, 0xff, 0x02, 0x07, 0x00, 0x00, 0x02, 0x08, 0x00, 0x01, 0x02, 0x09, 0x00, 0x02, 0x02, 0x09, 0x00 gUnknown_0857C648:: @ 857C648 .2byte 0 diff --git a/data/mystery_event_menu.s b/data/mystery_event_menu.s deleted file mode 100644 index bb8330497..000000000 --- a/data/mystery_event_menu.s +++ /dev/null @@ -1,12 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085EFD64:: @ 85EFD64 - .4byte 0x1F8 - -gUnknown_085EFD68:: @ 85EFD68 - window_template 0, 4, 15, 22, 4, 14, 20 - window_template 0, 7, 6, 16, 4, 14, 0x6C - null_window_template diff --git a/data/naming_screen.s b/data/naming_screen.s deleted file mode 100644 index a23fb96fb..000000000 --- a/data/naming_screen.s +++ /dev/null @@ -1,346 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_0858BBF8:: @ 858BBF8 - .incbin "graphics/naming_screen/pc_icon/0.4bpp" - - .align 2 -gUnknown_0858BCB8:: @ 858BCB8 - .incbin "graphics/naming_screen/pc_icon/1.4bpp" - - .align 2 -gUnknown_0858BD78:: @ 858BD78 - .incbin "graphics/naming_screen/0.gbapal" - .incbin "graphics/naming_screen/1.gbapal" - - .align 2 -gUnknown_0858BDB8:: @ 858BDB8 - .4byte gText_PkmnTransferredSomeonesPC - .4byte gText_PkmnTransferredLanettesPC - .4byte gText_PkmnBoxSomeonesPCFull - .4byte gText_PkmnBoxLanettesPCFull - -gUnknown_0858BDC8:: @ 858BDC8 - .string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!$" - - .align 2 -gUnknown_0858BE00:: @ 858BE00 - .4byte 0x000001e0, 0x000011d9, 0x000021ca, 0x000031ff - - .align 2 -gUnknown_0858BE10:: @ 858BE10 - window_template 0x01, 0x03, 0x0a, 0x13, 0x08, 0x0a, 0x0030 - window_template 0x02, 0x03, 0x0a, 0x13, 0x08, 0x0a, 0x00c8 - window_template 0x03, 0x08, 0x06, 0x11, 0x02, 0x0a, 0x0030 - window_template 0x03, 0x08, 0x04, 0x11, 0x02, 0x0a, 0x0052 - window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0b, 0x0074 - null_window_template - -gUnknown_0858BE40:: @ 858BE40 - .string "abcdef .ghijkl ,mnopqrs tuvwxyz ABCDEF .GHIJKL ,MNOPQRS TUVWXYZ 01234 56789 !?♂♀/- …“”‘’ " - -gUnknown_0858BEA0:: @ 858BEA0 - .byte 0x08, 0x08, 0x06 - -gUnknown_0858BEA3:: @ 858BEA3 - .byte 0x00, 0x0c, 0x18, 0x38, 0x44, 0x50, 0x5c, 0x7b, 0x00, 0x0c, 0x18, 0x38, 0x44, 0x50, 0x5c, 0x7b, 0x00, 0x16, 0x2c, 0x42, 0x58, 0x6e, 0x00, 0x00 - -gUnknown_0858BEBB:: @ 858BEBB - .byte 0x00, 0x02, 0x01 - -gUnknown_0858BEBE:: @ 858BEBE - .byte 0x01, 0x00, 0x02 - -gUnknown_0858BEC1:: @ 858BEC1 - .byte 0x02, 0x01, 0x00 - -gUnknown_0858BEC4:: @ 858BEC4 - .4byte sub_80E37B4 - .4byte sub_80E37DC - .4byte sub_80E3870 - .4byte sub_80E3904 - -gUnknown_0858BED4:: @ 858BED4 - .2byte 0x0000, 0xfffc, 0xfffe, 0xffff - -gUnknown_0858BEDC:: @ 858BEDC - .2byte 0x0002, 0x0003, 0x0002, 0x0001 - -gUnknown_0858BEE4:: @ 858BEE4 - .byte 0x01, 0x02, 0x03, 0x00 - -gUnknown_0858BEE8:: @ 858BEE8 - .4byte sub_80E40AC - .4byte sub_80E4100 - .4byte sub_80E4104 - .4byte sub_80E4178 - -gUnknown_0858BEF8:: @ 858BEF8 - .2byte 0x0001, 0x0003, 0x0002 - -gUnknown_0858BEFE:: @ 858BEFE - .2byte 0x0004, 0x0006, 0x0005 - -gUnknown_0858BF04:: @ 858BF04 - .4byte TaskDummy2 - .4byte sub_80E4384 - .4byte sub_80E43E0 - .4byte sub_80E4420 - .4byte sub_80E447C - -gUnknown_0858BF18:: @ 858BF18 - .4byte sub_80E450C - .4byte sub_80E4558 - .4byte sub_80E4580 - .4byte sub_80E45A4 - -gUnknown_0858BF28:: @ 858BF28 - .4byte sub_80E468C - .4byte sub_80E4692 - .4byte sub_80E46E8 - -gUnknown_0858BF34:: @ 858BF34 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00 - -gUnknown_0858BF3E:: @ 858BF3E - .byte 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - -gUnknown_0858BF48:: @ 858BF48 - .byte 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00 - -gUnknown_0858BF50:: @ 858BF50 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_0858BF58:: @ 858BF58 - .4byte sub_80E4894 - .4byte sub_80E4894 - .4byte sub_80E48E8 - .4byte sub_80E48E8 - .4byte sub_80E4894 - - .align 2 -gUnknown_0858BF6C:: @ 858BF6C - .4byte TaskDummy3 - .4byte sub_80E49BC - - .align 2 -gUnknown_0858BF74:: @ 858BF74 - window_template 0x00, 0x09, 0x08, 0x00, 0x05, 0x04, 0x0000 - -gUnknown_0858BF7C:: @ 858BF7C - .4byte 0x0002010D - -gUnknown_0858BF80:: @ 858BF80 - .4byte 0x0002010E - -gUnknown_0858BF84:: @ 858BF84 - .4byte 0x0002010F - -gUnknown_0858BF88:: @ 858BF88 - .byte 0xee, 0xdd, 0xff, 0x00 - -gUnknown_0858BF8C:: @ 858BF8C - .4byte gUnknown_0858BF80 - .4byte gUnknown_0858BF7C - .4byte gUnknown_0858BF84 - -gUnknown_0858BF98:: @ 858BF98 - .4byte gUnknown_08DD4620 - .4byte gUnknown_08DD46E0 - .4byte gUnknown_08DD47A0 - -gUnknown_0858BFA4:: @ 858BFA4 - .byte 0x0f, 0x01, 0x02 - - .align 2 -gUnknown_0858BFA8:: @ 858BFA8 - .byte 0x00, 0x07, 0x01, 0x00, 0x01, 0x23, 0x00, 0x00 - .4byte gText_YourName - - .align 2 -gUnknown_0858BFB4:: @ 858BFB4 - .byte 0x00, 0x08, 0x02, 0x00, 0x01, 0x13, 0x00, 0x00 - .4byte gText_BoxName - - .align 2 -gUnknown_0858BFC0:: @ 858BFC0 - .byte 0x00, 0x0a, 0x03, 0x01, 0x01, 0x23, 0x00, 0x00 - .4byte gText_PkmnsNickname - - .align 2 -gUnknown_0858BFCC:: @ 858BFCC - .byte 0x01, 0x0f, 0x04, 0x00, 0x01, 0x0b, 0x00, 0x00 - .4byte gText_TellHimTheWords - - .align 2 -gUnknown_0858BFD8:: @ 858BFD8 - .4byte gUnknown_0858BFA8 - .4byte gUnknown_0858BFB4 - .4byte gUnknown_0858BFC0 - .4byte gUnknown_0858BFC0 - .4byte gUnknown_0858BFCC - - .align 2 -gOamData_858BFEC:: @ 858BFEC - .2byte 0x0000, 0x0000, 0x0000, 0x0000 - - .align 2 -gOamData_858BFF4:: @ 858BFF4 - .2byte 0x0000, 0x4000, 0x0000, 0x0000 - - .align 2 -gOamData_858BFFC:: @ 858BFFC - .2byte 0x4000, 0x8000, 0x0000, 0x0000 - - .align 2 -gUnknown_0858C004:: @ 858C004 - .byte 0xec, 0xf0, 0x05, 0x40, 0x0c, 0xf0, 0x40, 0x40, 0xec, 0xf8, 0x55, 0x40, 0x0c, 0xf8, 0x90, 0x40, 0xec, 0x00, 0xa5, 0x40, 0x0c, 0x00, 0xe0, 0x40, 0xec, 0x08, 0xf5, 0x40, 0x0c, 0x08, 0x30, 0x41 - - .align 2 -gUnknown_0858C024:: @ 858C024 - .byte 0xf4, 0xfc, 0x01, 0x40, 0x04, 0xfc, 0x20, 0x40 - - .align 2 -gUnknown_0858C02C:: @ 858C02C - .byte 0xec, 0xf4, 0x05, 0x40, 0x0c, 0xf4, 0x40, 0x40, 0xec, 0xfc, 0x55, 0x40, 0x0c, 0xfc, 0x90, 0x40, 0xec, 0x04, 0xa5, 0x40, 0x0c, 0x04, 0xe0, 0x40 - - .align 2 -gUnknown_0858C044:: @ 858C044 - .byte 0xf8, 0xf4, 0x01, 0xc0, 0xf8, 0xfc, 0x21, 0xc0, 0xf8, 0x04, 0x41, 0xc0 - - .align 2 -gUnknown_0858C050:: @ 858C050 - .byte 0x08, 0x00, 0x00, 0x00 - .4byte gUnknown_0858C004 - - .align 2 -gUnknown_0858C058:: @ 858C058 - .4byte 0x02 - .4byte gUnknown_0858C024 - .4byte 0x02 - .4byte gUnknown_0858C024 - .4byte 0x02 - .4byte gUnknown_0858C024 - - .align 2 -gUnknown_0858C070:: @ 858C070 - .4byte 0x06 - .4byte gUnknown_0858C02C - - .align 2 -gUnknown_0858C078:: @ 858C078 - .4byte 0x03 - .4byte gUnknown_0858C044 - - .align 2 -gUnknown_0858C080:: @ 858C080 - obj_frame_tiles gUnknown_0858BBF8, 0x00c0 - obj_frame_tiles gUnknown_0858BCB8, 0x00c0 - - .align 2 -gSpriteAnim_858C090:: @ 858C090 - .2byte 0x0000, 0x0001, 0xfffe, 0x0000 - - .align 2 -gSpriteAnim_858C098:: @ 858C098 - .2byte 0x0004, 0x0008, 0x0008, 0x0008, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_858C0A4:: @ 858C0A4 - .2byte 0x0000, 0x0002, 0x0001, 0x0002, 0xfffe, 0x0000 - - .align 2 -gSpriteAnimTable_858C0B0:: @ 858C0B0 - .4byte gSpriteAnim_858C090 - - .align 2 -gSpriteAnimTable_858C0B4:: @ 858C0B4 - .4byte gSpriteAnim_858C090 - .4byte gSpriteAnim_858C098 - - .align 2 -gSpriteAnimTable_858C0BC:: @ 858C0BC - .4byte gSpriteAnim_858C0A4 - - .align 2 -gUnknown_0858C0C0:: @ 858C0C0 - spr_template 0x0002, 0x0004, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E4084 - - .align 2 -gUnknown_0858C0D8:: @ 858C0D8 - spr_template 0x0003, 0x0001, gOamData_858BFFC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C0F0:: @ 858C0F0 - spr_template 0x0004, 0x0004, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C108:: @ 858C108 - spr_template 0x0000, 0x0006, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C120:: @ 858C120 - spr_template 0x0001, 0x0007, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C138:: @ 858C138 - spr_template 0x0007, 0x0005, gOamData_858BFF4, gSpriteAnimTable_858C0B4, NULL, gDummySpriteAffineAnimTable, sub_80E3B30 - - .align 2 -gUnknown_0858C150:: @ 858C150 - spr_template 0x000a, 0x0003, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E3C20 - - .align 2 -gUnknown_0858C168:: @ 858C168 - spr_template 0x000b, 0x0003, gOamData_858BFEC, gSpriteAnimTable_858C0B0, NULL, gDummySpriteAffineAnimTable, sub_80E3C6C - - .align 2 -gUnknown_0858C180:: @ 858C180 - spr_template 0xffff, 0x0000, gOamData_858BFEC, gSpriteAnimTable_858C0BC, gUnknown_0858C080, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0858C198:: @ 858C198 - .4byte gUnknown_0862B88D - .4byte gUnknown_0862B8AE - .4byte gUnknown_0862B8CF - .4byte gUnknown_0862B8F0 - .4byte gUnknown_0862B911 - .4byte gUnknown_0862B932 - .4byte gUnknown_0862B953 - .4byte gUnknown_0862B974 - .4byte gUnknown_0862B995 - .4byte gUnknown_0862B9AE - .4byte gUnknown_0862B9C7 - .4byte gUnknown_0862B9E0 - - .align 2 -gUnknown_0858C1C8:: @ 858C1C8 - obj_tiles gNamingScreenRWindow_Gfx+0x280, 0x01e0, 0x0000 - obj_tiles gNamingScreenRWindow_Gfx+0x460, 0x01e0, 0x0001 - obj_tiles gNamingScreenRWindow_Gfx, 0x0280, 0x0002 - obj_tiles gNamingScreenKeyboardButton_Gfx+0x20, 0x0100, 0x0003 - obj_tiles gNamingScreenROptions_Gfx, 0x0060, 0x0004 - obj_tiles gNamingScreenROptions_Gfx+0xA0, 0x0060, 0x0005 - obj_tiles gNamingScreenROptions_Gfx+0x140, 0x0060, 0x0006 - obj_tiles gNamingScreenCursor_Gfx, 0x0080, 0x0007 - obj_tiles gNamingScreenCursor_Gfx+0xA0, 0x0080, 0x0008 - obj_tiles gNamingScreenCursor_Gfx+0x140, 0x0080, 0x0009 - obj_tiles gNamingScreenRightPointingTriangleTiles, 0x0020, 0x000a - obj_tiles gNamingScreenUnderscoreTiles, 0x0020, 0x000b - null_obj_tiles - - .align 2 -gUnknown_0858C230:: @ 858C230 - obj_pal gNamingScreenMenu_Pal, 0x0000 - obj_pal gNamingScreenMenu_Pal+0x20, 0x0001 - obj_pal gNamingScreenMenu_Pal+0x40, 0x0002 - obj_pal gNamingScreenMenu_Pal+0x60, 0x0003 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0004 - obj_pal gNamingScreenMenu_Pal+0xA0, 0x0005 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0006 - obj_pal gNamingScreenMenu_Pal+0x80, 0x0007 - null_obj_pal diff --git a/data/pokemon_animation.s b/data/pokemon_animation.s deleted file mode 100644 index 535c91b2d..000000000 --- a/data/pokemon_animation.s +++ /dev/null @@ -1,240 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_0860A8C8:: @ 860A8C8 - .byte 0x00, 0x13, 0x02, 0x08, 0x12, 0x15, 0x17, 0x12, 0x12, 0x19, 0x02, 0x13, 0x11, 0x02, 0x13, 0x01, 0x0f, 0x15, 0x0f, 0x0a, 0x0a, 0x0f, 0x15, 0x0f, 0x09, 0x16, 0x16, 0x12, 0x10, 0x12, 0x15, 0x09 - .byte 0x12, 0x15, 0x09, 0x13, 0x13, 0x10, 0x01, 0x13, 0x06, 0x11, 0x09, 0x02, 0x02, 0x14, 0x02, 0x08, 0x0a, 0x11, 0x09, 0x09, 0x10, 0x0f, 0x02, 0x14, 0x10, 0x10, 0x15, 0x15, 0x12, 0x09, 0x0e, 0x14 - .byte 0x14, 0x0d, 0x15, 0x09, 0x09, 0x0b, 0x0b, 0x0b, 0x02, 0x02, 0x0e, 0x08, 0x08, 0x17, 0x15, 0x02, 0x13, 0x0f, 0x0f, 0x02, 0x0f, 0x15, 0x13, 0x02, 0x0b, 0x0c, 0x13, 0x0f, 0x01, 0x01, 0x14, 0x09 - .byte 0x13, 0x14, 0x0a, 0x09, 0x15, 0x15, 0x02, 0x10, 0x15, 0x10, 0x02, 0x0f, 0x02, 0x06, 0x06, 0x0e, 0x0e, 0x12, 0x0b, 0x12, 0x13, 0x11, 0x11, 0x11, 0x13, 0x19, 0x14, 0x0f, 0x13, 0x16, 0x17, 0x0e - .byte 0x0e, 0x10, 0x09, 0x19, 0x05, 0x12, 0x19, 0x16, 0x17, 0x01, 0x13, 0x13, 0x13, 0x15, 0x15, 0x13, 0x19, 0x16, 0x17, 0x02, 0x0f, 0x09, 0x0d, 0x12, 0x12, 0x02, 0x09, 0x12, 0x15, 0x17, 0x15, 0x15 - .byte 0x09, 0x12, 0x10, 0x11, 0x0f, 0x0a, 0x11, 0x0a, 0x02, 0x0f, 0x0b, 0x16, 0x12, 0x13, 0x13, 0x13, 0x11, 0x12, 0x14, 0x12, 0x13, 0x16, 0x11, 0x12, 0x13, 0x02, 0x10, 0x11, 0x11, 0x11, 0x10, 0x13 - .byte 0x02, 0x11, 0x0b, 0x02, 0x14, 0x14, 0x12, 0x13, 0x01, 0x14, 0x0b, 0x14, 0x08, 0x09, 0x0f, 0x05, 0x09, 0x15, 0x09, 0x0d, 0x15, 0x13, 0x15, 0x0f, 0x13, 0x09, 0x17, 0x17, 0x0a, 0x08, 0x02, 0x02 - .byte 0x05, 0x0f, 0x02, 0x15, 0x09, 0x09, 0x19, 0x15, 0x0e, 0x01, 0x13, 0x02, 0x0f, 0x07, 0x02, 0x08, 0x17, 0x02, 0x13, 0x16, 0x17, 0x19, 0x0e, 0x09, 0x0e, 0x19, 0x17, 0x18, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x15, 0x09, 0x12, 0x10, 0x17, 0x02, 0x12, 0x19, 0x12, 0x08 - .byte 0x0f, 0x15, 0x0b, 0x08, 0x11, 0x08, 0x0f, 0x02, 0x10, 0x10, 0x13, 0x09, 0x14, 0x0a, 0x01, 0x14, 0x12, 0x15, 0x13, 0x15, 0x07, 0x11, 0x11, 0x03, 0x11, 0x19, 0x19, 0x13, 0x12, 0x01, 0x13, 0x14 - .byte 0x0e, 0x17, 0x01, 0x0b, 0x09, 0x04, 0x0f, 0x15, 0x03, 0x19, 0x04, 0x15, 0x13, 0x01, 0x0f, 0x0e, 0x0e, 0x15, 0x09, 0x0e, 0x17, 0x13, 0x09, 0x09, 0x0a, 0x08, 0x0f, 0x0f, 0x13, 0x13, 0x10, 0x10 - .byte 0x14, 0x12, 0x12, 0x09, 0x14, 0x14, 0x11, 0x11, 0x12, 0x01, 0x01, 0x18, 0x02, 0x10, 0x08, 0x0b, 0x0b, 0x0e, 0x13, 0x09, 0x0d, 0x13, 0x11, 0x11, 0x14, 0x01, 0x01, 0x0b, 0x15, 0x02, 0x15, 0x09 - .byte 0x0e, 0x11, 0x11, 0x11, 0x0c, 0x0b, 0x0f, 0x09, 0x14, 0x14, 0x14, 0x09, 0x09, 0x08, 0x0f, 0x15, 0x09, 0x09, 0x09, 0x09, 0x19, 0x17, 0x0d, 0x01, 0x01, 0x11, 0x14, 0x11 - -gUnknown_0860AA64:: @ 860AA64 - .byte 0x00, 0x05, 0x01, 0x01, 0x00, 0x0f, 0x01, 0x04, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, 0x00, 0xff - -gUnknown_0860AA80:: @ 860AA80 - .byte 0x06, 0x1e, 0xfe, 0x0f, 0x06, 0x1e, 0xff, 0x00 - - .align 2 -gUnknown_0860AA88:: @ 860AA88 - .4byte pokemonanimfunc_00 - .4byte pokemonanimfunc_01 - .4byte pokemonanimfunc_02 - .4byte pokemonanimfunc_03 - .4byte pokemonanimfunc_04 - .4byte pokemonanimfunc_05 - .4byte pokemonanimfunc_06 - .4byte pokemonanimfunc_07 - .4byte pokemonanimfunc_08 - .4byte pokemonanimfunc_09 - .4byte pokemonanimfunc_0A - .4byte pokemonanimfunc_0B - .4byte pokemonanimfunc_0C - .4byte pokemonanimfunc_0D - .4byte pokemonanimfunc_0E - .4byte pokemonanimfunc_0F - .4byte pokemonanimfunc_10 - .4byte pokemonanimfunc_11 - .4byte pokemonanimfunc_12 - .4byte pokemonanimfunc_13 - .4byte pokemonanimfunc_14 - .4byte pokemonanimfunc_15 - .4byte pokemonanimfunc_16 - .4byte pokemonanimfunc_17 - .4byte pokemonanimfunc_18 - .4byte pokemonanimfunc_19 - .4byte pokemonanimfunc_1A - .4byte pokemonanimfunc_1B - .4byte pokemonanimfunc_1C - .4byte pokemonanimfunc_1D - .4byte pokemonanimfunc_1E - .4byte pokemonanimfunc_1F - .4byte pokemonanimfunc_20 - .4byte pokemonanimfunc_21 - .4byte pokemonanimfunc_22 - .4byte pokemonanimfunc_23 - .4byte pokemonanimfunc_24 - .4byte pokemonanimfunc_25 - .4byte pokemonanimfunc_26 - .4byte pokemonanimfunc_27 - .4byte pokemonanimfunc_28 - .4byte pokemonanimfunc_29 - .4byte pokemonanimfunc_2A - .4byte pokemonanimfunc_2B - .4byte pokemonanimfunc_2C - .4byte pokemonanimfunc_2D - .4byte pokemonanimfunc_2E - .4byte pokemonanimfunc_2F - .4byte pokemonanimfunc_30 - .4byte pokemonanimfunc_31 - .4byte pokemonanimfunc_32 - .4byte pokemonanimfunc_33 - .4byte pokemonanimfunc_34 - .4byte pokemonanimfunc_35 - .4byte pokemonanimfunc_36 - .4byte pokemonanimfunc_37 - .4byte pokemonanimfunc_38 - .4byte pokemonanimfunc_39 - .4byte pokemonanimfunc_3A - .4byte pokemonanimfunc_3B - .4byte pokemonanimfunc_3C - .4byte pokemonanimfunc_3D - .4byte pokemonanimfunc_3E - .4byte pokemonanimfunc_3F - .4byte pokemonanimfunc_40 - .4byte pokemonanimfunc_41 - .4byte pokemonanimfunc_42 - .4byte pokemonanimfunc_43 - .4byte pokemonanimfunc_44 - .4byte pokemonanimfunc_45 - .4byte pokemonanimfunc_46 - .4byte pokemonanimfunc_47 - .4byte pokemonanimfunc_48 - .4byte pokemonanimfunc_49 - .4byte pokemonanimfunc_4A - .4byte pokemonanimfunc_4B - .4byte pokemonanimfunc_4C - .4byte pokemonanimfunc_4D - .4byte pokemonanimfunc_4E - .4byte pokemonanimfunc_4F - .4byte pokemonanimfunc_50 - .4byte pokemonanimfunc_51 - .4byte pokemonanimfunc_52 - .4byte pokemonanimfunc_53 - .4byte pokemonanimfunc_54 - .4byte pokemonanimfunc_55 - .4byte pokemonanimfunc_56 - .4byte pokemonanimfunc_57 - .4byte pokemonanimfunc_58 - .4byte pokemonanimfunc_59 - .4byte pokemonanimfunc_5A - .4byte pokemonanimfunc_5B - .4byte pokemonanimfunc_5C - .4byte pokemonanimfunc_5D - .4byte pokemonanimfunc_5E - .4byte pokemonanimfunc_5F - .4byte pokemonanimfunc_60 - .4byte pokemonanimfunc_61 - .4byte pokemonanimfunc_62 - .4byte pokemonanimfunc_63 - .4byte pokemonanimfunc_64 - .4byte pokemonanimfunc_65 - .4byte pokemonanimfunc_66 - .4byte pokemonanimfunc_67 - .4byte pokemonanimfunc_68 - .4byte pokemonanimfunc_69 - .4byte pokemonanimfunc_6A - .4byte pokemonanimfunc_6B - .4byte pokemonanimfunc_6C - .4byte pokemonanimfunc_6D - .4byte pokemonanimfunc_6E - .4byte pokemonanimfunc_6F - .4byte pokemonanimfunc_70 - .4byte pokemonanimfunc_71 - .4byte pokemonanimfunc_72 - .4byte pokemonanimfunc_73 - .4byte pokemonanimfunc_74 - .4byte pokemonanimfunc_75 - .4byte pokemonanimfunc_76 - .4byte pokemonanimfunc_77 - .4byte pokemonanimfunc_78 - .4byte pokemonanimfunc_79 - .4byte pokemonanimfunc_7A - .4byte pokemonanimfunc_7B - .4byte pokemonanimfunc_7C - .4byte pokemonanimfunc_7D - .4byte pokemonanimfunc_7E - .4byte pokemonanimfunc_7F - .4byte pokemonanimfunc_80 - .4byte pokemonanimfunc_81 - .4byte pokemonanimfunc_82 - .4byte pokemonanimfunc_83 - .4byte pokemonanimfunc_84 - .4byte pokemonanimfunc_85 - .4byte pokemonanimfunc_86 - .4byte pokemonanimfunc_87 - .4byte pokemonanimfunc_88 - .4byte pokemonanimfunc_89 - .4byte pokemonanimfunc_8A - .4byte pokemonanimfunc_8B - .4byte pokemonanimfunc_8C - .4byte pokemonanimfunc_8D - .4byte pokemonanimfunc_8E - .4byte pokemonanimfunc_8F - .4byte pokemonanimfunc_90 - .4byte pokemonanimfunc_91 - .4byte pokemonanimfunc_92 - .4byte pokemonanimfunc_93 - .4byte pokemonanimfunc_94 - .4byte pokemonanimfunc_95 - .4byte pokemonanimfunc_96 - -gUnknown_0860ACE4:: @ 860ACE4 - .byte 0x60, 0x5f, 0x02, 0x5e, 0x03, 0x46, 0x6d, 0x3e, 0x6e, 0x6f, 0x70, 0x3f, 0x71, 0x13, 0x72, 0x6c, 0x6b, 0x3a, 0x64, 0x14, 0x4f, 0x5d, 0x0f, 0x4c, 0x61, 0x57, 0x58, 0x67, 0x66, 0x59, 0x74, 0x73 - .byte 0x5a, 0x75, 0x76, 0x5b, 0x77, 0x78, 0x65, 0x63, 0x5c, 0x62, 0x6a, 0x69, 0x68, 0x7b, 0x7a, 0x79, 0x7e, 0x7d, 0x7c, 0x81, 0x80, 0x7f, 0x84, 0x82, 0x83, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b - .byte 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96 - -gUnknown_0860AD2F:: @ 860AD2F - .byte 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01 - - .align 2 -gSpriteAffineAnim_860AD48:: @ 860AD48 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_860AD58:: @ 860AD58 - obj_rot_scal_anim_frame -0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_860AD68:: @ 860AD68 - .4byte gSpriteAffineAnim_860AD48 - .4byte gSpriteAffineAnim_860AD58 - -gUnknown_0860AD70:: @ 860AD70 - .byte 0xff, 0xff, 0x06, 0x02, 0x00, 0x06, 0xfe, 0x02, 0x06, 0x02, 0x00, 0x06, 0xfe, 0xfe, 0x06, 0x02, 0x00, 0x06, 0xfe, 0x02, 0x06, 0x02, 0x00, 0x06, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00 - -gUnknown_0860AD8E:: @ 860AD8E - .byte 0x00, 0x08, 0x08, 0x08, 0xf8, 0x0c, 0xf8, 0x08, 0x0c, 0x08, 0xf8, 0x0c, 0xf8, 0x08, 0x0c, 0x08, 0xf8, 0x0c, 0xf8, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x08, 0xf8, 0x18, 0xf8, 0x08 - .byte 0x18, 0x08, 0xf8, 0x18, 0xf8, 0x08, 0x18, 0x08, 0xf8, 0x18, 0xf8, 0x00, 0x18, 0x00, 0x00, 0x00 - -gUnknown_0860ADBE:: @ 860ADBE - .byte 0x01, 0x01, 0x0c, 0xfe, 0x00, 0x0c, 0x01, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 - -gUnknown_0860ADCC:: @ 860ADCC - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - -gUnknown_0860AE1C:: @ 860AE1C - .byte 0x00, 0x05, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - -gUnknown_0860AE54:: @ 860AE54 - .byte 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00 - .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 - - .align 2 -gUnknown_0860AE7C:: @ 860AE7C - .4byte gUnknown_0860ADCC - .4byte gUnknown_0860AE1C - .4byte gUnknown_0860AE54 - - .align 1 -gUnknown_0860AE88:: @ 860AE88 - .2byte 0x001f, 0x03e0, 0x7c00, 0x0000 diff --git a/data/save.s b/data/save.s deleted file mode 100644 index 23a8d3928..000000000 --- a/data/save.s +++ /dev/null @@ -1,20 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gSaveSectionOffsets:: @ 85CDC00 - .2byte 0, 0xF2C - .2byte 0, 0xF80 - .2byte 0xF80, 0xF80 - .2byte 0x1F00, 0xF80 - .2byte 0x2E80, 0xF08 - .2byte 0, 0xF80 - .2byte 0xF80, 0xF80 - .2byte 0x1F00, 0xF80 - .2byte 0x2E80, 0xF80 - .2byte 0x3E00, 0xF80 - .2byte 0x4D80, 0xF80 - .2byte 0x5D00, 0xF80 - .2byte 0x6C80, 0xF80 - .2byte 0x7C00, 0x7D0 diff --git a/data/link_strings.s b/data/text_input_strings.s similarity index 65% rename from data/link_strings.s rename to data/text_input_strings.s index 345903e0b..7219051a7 100644 --- a/data/link_strings.s +++ b/data/text_input_strings.s @@ -3,55 +3,55 @@ .section .rodata - .align 2 + .align 2 gUnknown_862B810:: @ 862B810 - .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 26}others$" + .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 26}others$" gUnknown_862B832:: @ 862B832 - .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L$" + .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L$" gUnknown_862B84B:: @ 862B84B - .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" + .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" gUnknown_862B86C:: @ 862B86C - .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" + .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" gUnknown_0862B88D:: @ 862B88D - .string "{CLEAR 11}a{CLEAR 6}b{CLEAR 6}c{CLEAR 26}d{CLEAR 6}e{CLEAR 6}f{CLEAR 6} {CLEAR 30}.$" + .string "{CLEAR 11}a{CLEAR 6}b{CLEAR 6}c{CLEAR 26}d{CLEAR 6}e{CLEAR 6}f{CLEAR 6} {CLEAR 30}.$" gUnknown_0862B8AE:: @ 862B8AE - .string "{CLEAR 11}g{CLEAR 6}h{CLEAR 7}i{CLEAR 27}j{CLEAR 7}k{CLEAR 7}l{CLEAR 7} {CLEAR 30},$" + .string "{CLEAR 11}g{CLEAR 6}h{CLEAR 7}i{CLEAR 27}j{CLEAR 7}k{CLEAR 7}l{CLEAR 7} {CLEAR 30},$" gUnknown_0862B8CF:: @ 862B8CF - .string "{CLEAR 11}m{CLEAR 6}n{CLEAR 6}o{CLEAR 26}p{CLEAR 6}q{CLEAR 7}r{CLEAR 6}s{CLEAR 27} $" + .string "{CLEAR 11}m{CLEAR 6}n{CLEAR 6}o{CLEAR 26}p{CLEAR 6}q{CLEAR 7}r{CLEAR 6}s{CLEAR 27} $" gUnknown_0862B8F0:: @ 862B8F0 - .string "{CLEAR 11}t{CLEAR 6}u{CLEAR 6}v{CLEAR 26}w{CLEAR 6}x{CLEAR 6}y{CLEAR 6}z{CLEAR 26} $" + .string "{CLEAR 11}t{CLEAR 6}u{CLEAR 6}v{CLEAR 26}w{CLEAR 6}x{CLEAR 6}y{CLEAR 6}z{CLEAR 26} $" gUnknown_0862B911:: @ 862B911 - .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 6} {CLEAR 30}.$" + .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 6} {CLEAR 30}.$" gUnknown_0862B932:: @ 862B932 - .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L{CLEAR 6} {CLEAR 30},$" + .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L{CLEAR 6} {CLEAR 30},$" gUnknown_0862B953:: @ 862B953 - .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" + .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" gUnknown_0862B974:: @ 862B974 - .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" + .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" gUnknown_0862B995:: @ 862B995 - .string "{CLEAR 11}0{CLEAR 16}1{CLEAR 16}2{CLEAR 16}3{CLEAR 16}4{CLEAR 16} $" + .string "{CLEAR 11}0{CLEAR 16}1{CLEAR 16}2{CLEAR 16}3{CLEAR 16}4{CLEAR 16} $" gUnknown_0862B9AE:: @ 862B9AE - .string "{CLEAR 11}5{CLEAR 16}6{CLEAR 16}7{CLEAR 16}8{CLEAR 16}9{CLEAR 16} $" + .string "{CLEAR 11}5{CLEAR 16}6{CLEAR 16}7{CLEAR 16}8{CLEAR 16}9{CLEAR 16} $" gUnknown_0862B9C7:: @ 862B9C7 - .string "{CLEAR 12}!{CLEAR 17}?{CLEAR 16}♂{CLEAR 16}♀{CLEAR 16}/{CLEAR 17}-$" - + .string "{CLEAR 12}!{CLEAR 17}?{CLEAR 16}♂{CLEAR 16}♀{CLEAR 16}/{CLEAR 17}-$" + gUnknown_0862B9E0:: @ 862B9E0 - .string "{CLEAR 11}…{CLEAR 16}“{CLEAR 16}”{CLEAR 18}‘{CLEAR 19}’{CLEAR 18} $" + .string "{CLEAR 11}…{CLEAR 16}“{CLEAR 16}”{CLEAR 18}‘{CLEAR 19}’{CLEAR 18} $" gUnknown_0862B9F9:: @ 862B9F9 .string "ABCDE$" diff --git a/data/time_events.s b/data/time_events.s deleted file mode 100644 index 7a543fff5..000000000 --- a/data/time_events.s +++ /dev/null @@ -1,7 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085B2B44:: @ 85B2B44 - .byte 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01 diff --git a/graphics/intro/copyright.png b/graphics/intro/copyright.png index c005ff02c..988a07318 100644 Binary files a/graphics/intro/copyright.png and b/graphics/intro/copyright.png differ diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 018f35490..092ab5644 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -300,9 +300,6 @@ $(FONTGFXDIR)/keypad_icons.4bpp: %.4bpp: %.png graphics/title_screen/pokemon_logo.gbapal: %.gbapal: %.pal $(GFX) $< $@ -num_colors 224 -graphics/intro/copyright.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 39 - graphics/link_games/pkmnjump_bg.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 63 diff --git a/include/blend_palette.h b/include/blend_palette.h index 1db3f4eb0..a00847bc3 100644 --- a/include/blend_palette.h +++ b/include/blend_palette.h @@ -1,12 +1,6 @@ #ifndef GUARD_BLEND_PALETTE_H #define GUARD_BLEND_PALETTE_H -// Exported type declarations +void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); -// Exported RAM declarations - -// Exported ROM declarations - -void BlendPalette(u16, u16, u8, u16); - -#endif //GUARD_BLEND_PALETTE_H +#endif // GUARD_BLEND_PALETTE_H diff --git a/include/constants/rgb.h b/include/constants/rgb.h new file mode 100644 index 000000000..2c22df32a --- /dev/null +++ b/include/constants/rgb.h @@ -0,0 +1,15 @@ +#ifndef GUARD_RGB_H +#define GUARD_RGB_H + +#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) + +#define RGB_BLACK RGB(0, 0, 0) +#define RGB_WHITE RGB(31, 31, 31) +#define RGB_RED RGB(31, 0, 0) +#define RGB_GREEN RGB(0, 31, 0) +#define RGB_BLUE RGB(0, 0, 31) +#define RGB_YELLOW RGB(31, 31, 0) +#define RGB_MAGENTA RGB(31, 0, 31) +#define RGB_CYAN RGB(0, 31, 31) + +#endif // GUARD_RGB_H diff --git a/include/constants/weather.h b/include/constants/weather.h new file mode 100644 index 000000000..953cc2753 --- /dev/null +++ b/include/constants/weather.h @@ -0,0 +1,39 @@ +#ifndef GUARD_CONSTANTS_WEATHER_H +#define GUARD_CONSTANTS_WEATHER_H + +#define WEATHER_NONE 0 +#define WEATHER_CLOUDS 1 +#define WEATHER_SUNNY 2 +#define WEATHER_RAIN_LIGHT 3 +#define WEATHER_SNOW 4 +#define WEATHER_RAIN_MED 5 +#define WEATHER_FOG_1 6 +#define WEATHER_ASH 7 +#define WEATHER_SANDSTORM 8 +#define WEATHER_FOG_2 9 +#define WEATHER_FOG_3 10 +#define WEATHER_SHADE 11 +#define WEATHER_DROUGHT 12 +#define WEATHER_RAIN_HEAVY 13 +#define WEATHER_BUBBLES 14 +#define WEATHER_ROUTE119_CYCLE 20 +#define WEATHER_ROUTE123_CYCLE 21 + +// These are used in maps' coord_weather_event entries. +// They are not a one-to-one mapping with the engine's +// internal weather constants above. +#define COORD_EVENT_WEATHER_CLOUDS 1 +#define COORD_EVENT_WEATHER_SUNNY 2 +#define COORD_EVENT_WEATHER_RAIN_LIGHT 3 +#define COORD_EVENT_WEATHER_SNOW 4 +#define COORD_EVENT_WEATHER_RAIN_MED 5 +#define COORD_EVENT_WEATHER_FOG_1 6 +#define COORD_EVENT_WEATHER_FOG_2 7 +#define COORD_EVENT_WEATHER_ASH 8 +#define COORD_EVENT_WEATHER_SANDSTORM 9 +#define COORD_EVENT_WEATHER_SHADE 10 +#define COORD_EVENT_WEATHER_DROUGHT 11 +#define COORD_EVENT_WEATHER_ROUTE119_CYCLE 20 +#define COORD_EVENT_WEATHER_ROUTE123_CYCLE 21 + +#endif // GUARD_CONSTANTS_WEATHER_H diff --git a/include/coord_event_weather.h b/include/coord_event_weather.h new file mode 100644 index 000000000..86fb48793 --- /dev/null +++ b/include/coord_event_weather.h @@ -0,0 +1,6 @@ +#ifndef GUARD_COORD_EVENT_WEATHER_H +#define GUARD_COORD_EVENT_WEATHER_H + +void DoCoordEventWeather(u8); + +#endif // GUARD_COORD_EVENT_WEATHER_H diff --git a/include/field_effect.h b/include/field_effect.h index 1fdcbe22c..7395270f9 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -78,5 +78,6 @@ void FieldEffectStop(struct Sprite *sprite, u8 id); u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer); void sub_80B7FC8(void); void FieldEffectActiveListRemove(u8 id); +void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8); #endif //GUARD_FIELD_EFFECTS_H diff --git a/include/field_map_obj_helpers.h b/include/field_map_obj_helpers.h index ba797ec98..031c7a8ab 100644 --- a/include/field_map_obj_helpers.h +++ b/include/field_map_obj_helpers.h @@ -1,7 +1,31 @@ -#ifndef GUARD_FIELDMAPOBJHELP_H -#define GUARD_FIELDMAPOBJHELP_H +#ifndef GUARD_FIELD_MAP_OBJ_HELPERS_H +#define GUARD_FIELD_MAP_OBJ_HELPERS_H +// Exported type declarations + +// Exported RAM declarations +extern u8 *gUnknown_020375B8; + +// Exported ROM declarations +void sub_8097AC8(struct Sprite *); +void npc_sync_anim_pause_bits(struct MapObject *); +void oamt_npc_ministep_reset(struct Sprite *, u8, u8); +u8 sub_8097F78(struct MapObject *); +bool8 obj_npc_ministep(struct Sprite *sprite); +bool8 sub_80976EC(struct Sprite *sprite); +void sub_80976DC(struct Sprite *, u8); +void sub_809783C(struct Sprite *, u8, u8, u8); +void DoShadowFieldEffect(struct MapObject *); +u8 sub_809785C(struct Sprite *); +u8 sub_80978E4(struct Sprite *); +void obj_anim_image_set_and_seek(struct Sprite *, u8, u8); +bool8 sub_80979BC(struct Sprite *); +void sub_8097750(struct Sprite *); +bool8 sub_8097758(struct Sprite *); +void sub_8097FA4(struct MapObject *); +void sub_8098044(u8); void UnfreezeMapObjects(void); +void FreezeMapObjectsExceptOne(u8 mapObjectId); void sub_8097B78(u8, u8); -#endif +#endif //GUARD_FIELD_MAP_OBJ_HELPERS_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index cc4c65448..af602245b 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -34,5 +34,6 @@ void sub_808BCE8(void); void sub_808D074(u8); void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); +u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); #endif //GUARD_FIELD_PLAYER_AVATAR_H diff --git a/include/field_specials.h b/include/field_specials.h index 1f8fbf147..dd72bdd13 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -2,5 +2,7 @@ #define GUARD_FIELD_SPECIALS_H u8 GetLeadMonIndex(void); +u8 sub_813B260(void); +u16 get_unknown_box_id(void); #endif // GUARD_FIELD_SPECIALS_H diff --git a/include/field_weather.h b/include/field_weather.h index e12107e70..7ad8d21e7 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -1,12 +1,177 @@ #ifndef GUARD_WEATHER_H #define GUARD_WEATHER_H -void fade_screen(u8, s8); +#include "sprite.h" +// Controls how the weather should be changing the screen palettes. +enum { + WEATHER_PAL_STATE_CHANGING_WEATHER, + WEATHER_PAL_STATE_SCREEN_FADING_IN, + WEATHER_PAL_STATE_SCREEN_FADING_OUT, + WEATHER_PAL_STATE_IDLE, +}; + +struct Weather +{ + union + { + struct + { + struct Sprite *rainSprites[24]; + struct Sprite *snowflakeSprites[101]; + struct Sprite *cloudSprites[3]; + } s1; + struct + { + u8 filler0[0xA0]; + struct Sprite *fog1Sprites[20]; + struct Sprite *ashSprites[20]; + struct Sprite *fog2Sprites[20]; + struct Sprite *sandstormSprites1[20]; + struct Sprite *sandstormSprites2[5]; + } s2; + } sprites; + u8 gammaShifts[19][32]; + u8 altGammaShifts[19][32]; + s8 gammaIndex; + s8 gammaTargetIndex; + u8 gammaStepDelay; + u8 gammaStepFrameCounter; + u16 fadeDestColor; + u8 palProcessingState; + u8 fadeScreenCounter; + bool8 readyForInit; + u8 taskId; + u8 unknown_6CA; + u8 unknown_6CB; + u16 initStep; + u16 finishStep; + u8 currWeather; + u8 nextWeather; + u8 weatherGfxLoaded; + bool8 weatherChangeComplete; + u8 weatherPicSpritePalIndex; + u8 altGammaSpritePalIndex; + u16 unknown_6D6; + u8 unknown_6D8; + u8 unknown_6D9; + u8 rainSpriteCount; + u8 unknown_6DB; + u8 unknown_6DC; + u8 rainStrength; + /*0x6DE*/ u8 cloudSpritesCreated; + u8 filler_6DF[1]; + u16 unknown_6E0; + u16 unknown_6E2; + u8 snowflakeSpriteCount; + u8 unknown_6E5; + u16 unknown_6E6; + u16 thunderCounter; + u8 unknown_6EA; + u8 unknown_6EB; + u8 unknown_6EC; + u8 unknown_6ED; + u16 fog1ScrollPosX; + u16 unknown_6F0; + u16 unknown_6F2; + u8 lightenedFogSpritePals[6]; + u8 lightenedFogSpritePalsCount; + u8 fog1SpritesCreated; + u16 unknown_6FC; + u16 unknown_6FE; + u8 ashSpritesCreated; + u8 filler_701[3]; + u32 unknown_704; + u32 unknown_708; + u8 filler_70C[2]; + u16 unknown_70E; + u16 unknown_710; + u16 unknown_712; + u16 unknown_714; + u8 sandstormSprites1Created; + u8 sandstormSprites2Created; + u16 unknown_718; + u16 unknown_71A; + u16 unknown_71C; + u16 unknown_71E; + u16 unknown_720; + u16 unknown_722; + u8 fog2SpritesCreated; + u8 filler_725[1]; + u16 unknown_726; + u16 unknown_728; + u16 unknown_72A; + u16 unknown_72C; + u8 unknown_72E; + u8 filler_72F; + u16 currBlendEVA; + u16 currBlendEVB; + u16 targetBlendEVA; + u16 targetBlendEVB; + u8 blendUpdateCounter; + u8 blendFrameCounter; + u8 blendDelay; + u8 filler_73B[0x3C-0x3B]; + s16 unknown_73C; + s16 unknown_73E; + s16 unknown_740; + s16 unknown_742; + u8 filler_744[0xD-4]; + s8 loadDroughtPalsIndex; + u8 loadDroughtPalsOffset; +}; + +void StartWeather(void); +void ChangeWeather(u8 weather); +void sub_807C988(u8 effect); +void sub_807C9B4(u8 effect); +void Task_WeatherInit(u8); +void Task_WeatherMain(u8); +void sub_807CAE8(void); +void nullsub_38(void); +void SetWeatherScreenFadeOut(void); + +enum +{ + FADE_FROM_BLACK, + FADE_TO_BLACK, + FADE_FROM_WHITE, + FADE_TO_WHITE, +}; + +void FadeScreen(u8, s8); +// ... +void UpdateSpritePaletteWithWeather(u8 tag); +void ApplyWeatherGammaShiftToPal(u8); +// ... +void Weather_SetBlendCoeffs(u8, u8); +// ... +void PlayRainSoundEffect(void); +// ... void SetSav1Weather(u32); u8 GetSav1Weather(void); void sub_80AEDBC(void); +void SetSav1WeatherFromCurrMapHeader(void); +// ... void DoCurrentWeather(void); +void sub_8080750(); + +bool8 IsWeatherNotFadingIn(void); +bool8 IsWeatherChangeComplete(void); +void SetWeather(u32); +void UpdateWeatherPerDay(u16); +void PreservePaletteInWeather(u8 index); +void ResetPreservedPalettesInWeather(void); +extern void ResetDroughtWeatherPaletteLoading(void); +void ResetDroughtWeatherPaletteLoading(void); +bool8 LoadDroughtWeatherPalettes(void); +u8 GetCurrentWeather(void); +void LoadCustomWeatherSpritePalette(const u16 *palette); + + +extern struct Weather gWeather; + +extern struct Weather *const gWeatherPtr; #endif // GUARD_WEATHER_H diff --git a/include/gba/defines.h b/include/gba/defines.h index 41cc84f4a..5c07347ce 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -60,11 +60,6 @@ #define TOTAL_OBJ_TILE_COUNT 1024 -#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) - -#define RGB_BLACK RGB(0, 0, 0) -#define RGB_WHITE RGB(31, 31, 31) - #define WIN_RANGE(a, b) (((a) << 8) | (b)) #endif // GUARD_GBA_DEFINES diff --git a/include/gba/macro.h b/include/gba/macro.h index ad4820bcf..3b35a1946 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -122,6 +122,27 @@ #define DmaFillLarge32(dmaNum, value, dest, size, block) DmaFillLarge(dmaNum, value, dest, size, block, 32) +#define DmaClearLarge(dmaNum, dest, size, block, bit) \ +{ \ + void *_dest = dest; \ + u32 _size = size; \ + while (1) \ + { \ + DmaFill##bit(dmaNum, 0, _dest, (block)); \ + _dest += (block); \ + _size -= (block); \ + if (_size <= (block)) \ + { \ + DmaFill##bit(dmaNum, 0, _dest, _size); \ + break; \ + } \ + } \ +} + +#define DmaClearLarge16(dmaNum, dest, size, block) DmaClearLarge(dmaNum, dest, size, block, 16) + +#define DmaClearLarge32(dmaNum, dest, size, block) DmaClearLarge(dmaNum, dest, size, block, 32) + #define DmaCopyDefvars(dmaNum, src, dest, size, bit) \ { \ const void *_src = src; \ diff --git a/include/global.h b/include/global.h index 8b1925513..7a892c5bd 100644 --- a/include/global.h +++ b/include/global.h @@ -38,6 +38,9 @@ #define POKEMON_NAME_LENGTH 10 #define OT_NAME_LENGTH 7 +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) + #define HEAP_SIZE 0x1C000 extern u8 gStringVar1[]; diff --git a/include/link.h b/include/link.h index cadabebc9..b6f9b86d7 100644 --- a/include/link.h +++ b/include/link.h @@ -195,8 +195,10 @@ extern struct LinkPlayer gLinkPlayers[5]; extern u16 word_3002910[]; extern bool8 gReceivedRemoteLinkPlayers; extern u32 gUnknown_020223C0; +extern bool8 gLinkVSyncDisabled; +extern u32 gLinkStatus; -void Task_DestroySelf(u8); +void Task_DestroySelf(u8 taskId); void OpenLink(void); void CloseLink(void); u16 LinkMain2(const u16 *); diff --git a/include/main.h b/include/main.h index 5caa82cdf..3de34de13 100644 --- a/include/main.h +++ b/include/main.h @@ -66,5 +66,7 @@ void InitFlashTimer(void); void DoSoftReset(void); void ClearPokemonCrySongs(void); void RestoreSerialTimer3IntrHandlers(void); +void StartTimer1(void); +void SeedRngAndSetTrainerId(void); #endif // GUARD_MAIN_H diff --git a/include/map_obj_8097404.h b/include/map_obj_8097404.h deleted file mode 100644 index 0800b15b0..000000000 --- a/include/map_obj_8097404.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Created by scott on 9/7/2017. -// - -#ifndef GUARD_MAP_OBJ_8097404_H -#define GUARD_MAP_OBJ_8097404_H - -// Exported type declarations - -// Exported RAM declarations -extern void *gUnknown_020375B8; - -// Exported ROM declarations -void sub_8097AC8(struct Sprite *); -void npc_sync_anim_pause_bits(struct MapObject *); -void oamt_npc_ministep_reset(struct Sprite *, u8, u8); -u8 sub_8097F78(struct MapObject *); -bool8 obj_npc_ministep(struct Sprite *sprite); -bool8 sub_80976EC(struct Sprite *sprite); -void sub_80976DC(struct Sprite *, u8); -void sub_809783C(struct Sprite *, u8, u8, u8); -void DoShadowFieldEffect(struct MapObject *); -u8 sub_809785C(struct Sprite *); -u8 sub_80978E4(struct Sprite *); -void obj_anim_image_set_and_seek(struct Sprite *, u8, u8); -bool8 sub_80979BC(struct Sprite *); -void sub_8097750(struct Sprite *); -bool8 sub_8097758(struct Sprite *); -void sub_8097FA4(struct MapObject *); -void sub_8098044(u8); -void UnfreezeMapObjects(void); -void sub_80974D0(u8 mapObjectId); - -#endif //GUARD_MAP_OBJ_8097404_H diff --git a/include/menu.h b/include/menu.h index 290c9de9f..b5dfa10ba 100644 --- a/include/menu.h +++ b/include/menu.h @@ -36,7 +36,7 @@ void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, boo s8 ProcessMenuInputNoWrap_(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); -void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str); +void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str); void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); diff --git a/include/mystery_event_menu.h b/include/mystery_event_menu.h new file mode 100644 index 000000000..8801789d9 --- /dev/null +++ b/include/mystery_event_menu.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MYSTERY_EVENT_MENU_H +#define GUARD_MYSTERY_EVENT_MENU_H + +void CB2_InitMysteryEventMenu(void); + +#endif // GUARD_MYSTERY_EVENT_MENU_H diff --git a/include/naming_screen.h b/include/naming_screen.h index 3d69b834f..b04cb19b6 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -1,12 +1,89 @@ #ifndef GUARD_NAMING_SCREEN_H #define GUARD_NAMING_SCREEN_H -#define NAMING_SCREEN_PLAYER 0 -#define NAMING_SCREEN_BOX 1 -#define NAMING_SCREEN_CAUGHT_MON 2 -#define NAMING_SCREEN_3 3 -#define NAMING_SCREEN_WALDA 4 +#include "main.h" -void DoNamingScreen(u8 caseId, u8* dst, u16 monSpecies, u8 monGender, u32 monPersonality, void (*callback)(void)); +#define KBEVENT_NONE 0 +#define KBEVENT_PRESSED_A 5 +#define KBEVENT_PRESSED_B 6 +#define KBEVENT_PRESSED_SELECT 8 +#define KBEVENT_PRESSED_START 9 + +enum +{ + NAMING_SCREEN_PLAYER, + NAMING_SCREEN_BOX, + NAMING_SCREEN_CAUGHT_MON, + NAMING_SCREEN_3, + NAMING_SCREEN_WALDA, +}; + +struct NamingScreenTemplate +{ + u8 copyExistingString; + u8 maxChars; + u8 iconFunction; + u8 addGenderIcon; + u8 initialPage; + u8 unused; + const u8 *title; +}; + +struct NamingScreenData { + /*0x0*/ u8 tilemapBuffer1[0x800]; + /*0x800*/ u8 tilemapBuffer2[0x800]; + /*0x800*/ u8 tilemapBuffer3[0x800]; + /*0x1800*/ u8 textBuffer[0x10]; + /*0x1810*/ u8 tileBuffer[0x600]; + /*0x1E10*/ u8 state; + /*0x1E11*/ u8 windows[5]; + /*0x1E16*/ u16 inputCharBaseXPos; + /*0x1E18*/ u16 bg1vOffset; + /*0x1E1A*/ u16 bg2vOffset; + /*0x1E1C*/ u16 bg1Priority; + /*0x1E1E*/ u16 bg2Priority; + /*0x1E20*/ u8 bgToReveal; + /*0x1E21*/ u8 bgToHide; + /*0x1E22*/ u8 currentPage; + /*0x1E23*/ u8 cursorSpriteId; + /*0x1E24*/ u8 selectBtnFrameSpriteId; + /*0x1E25*/ u8 keyRepeatStartDelayCopy; + /*0x1E28*/ const struct NamingScreenTemplate *template; + /*0x1E2C*/ u8 templateNum; + /*0x1E30*/ u8 *destBuffer; + /*0x1E34*/ u16 monSpecies; + /*0x1E36*/ u16 monGender; + /*0x1E38*/ u32 monPersonality; + /*0x1E3C*/ MainCallback returnCallback; +}; + +enum +{ + PAGE_UPPER, + PAGE_LOWER, + PAGE_OTHERS, +}; + +enum +{ + MAIN_STATE_BEGIN_FADE_IN, + MAIN_STATE_WAIT_FADE_IN, + MAIN_STATE_HANDLE_INPUT, + MAIN_STATE_MOVE_TO_OK_BUTTON, + MAIN_STATE_START_PAGE_SWAP, + MAIN_STATE_WAIT_PAGE_SWAP, + MAIN_STATE_6, + MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE, + MAIN_STATE_BEGIN_FADE_OUT, +}; + +enum +{ + INPUT_STATE_DISABLED, + INPUT_STATE_ENABLED, + INPUT_STATE_2, +}; + +void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback); #endif // GUARD_NAMING_SCREEN_H diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index c4fcf0717..c01cab440 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -6,16 +6,22 @@ extern const u16 gUnknown_0860F074[]; +void sub_81971D0(void); +void sub_8197200(void); void sub_81973A4(void); void sub_81973C4(u8, u8); void sub_819746C(u8 windowId, bool8 copyToVram); void sub_81973FC(u8, u8); -u16 AddTextPrinterParametrized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); +u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); void sub_8197434(u8 a0, u8 a1); void SetStandardWindowBorderStyle(u8 a0, u8 a1); void sub_8197930(void); u8 GetPlayerTextSpeed(void); void sub_81978B0(u16 arg0); +u16 sub_8197224(void); +int sub_8196094(void); +void sub_8196080(u8*); +void AddTextPrinterForMessage(u8); #endif // GUARD_NEW_MENU_HELPERS_H diff --git a/include/overworld.h b/include/overworld.h index 5b9513031..630b0a617 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -69,6 +69,8 @@ void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpNum); void c2_load_new_map(void); void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused); void mapldr_default(void); +u8 get_map_light_from_warp0(void); +bool8 is_light_level_1_2_3_5_or_6(u8 a1); bool32 sub_80875C8(void); bool32 sub_8087634(void); diff --git a/include/pokemon_animation.h b/include/pokemon_animation.h index 42fc10809..c1ab8d817 100644 --- a/include/pokemon_animation.h +++ b/include/pokemon_animation.h @@ -1,7 +1,10 @@ #ifndef GUARD_POKEMON_ANIMATION_H #define GUARD_POKEMON_ANIMATION_H -void LaunchAnimationTaskForFrontSprite(struct Sprite* sprite, u8 frontAnimId); -void LaunchAnimationTaskForBackSprite(struct Sprite* sprite, u8 backAnimId); +u8 GetSpeciesBackAnimSet(u16 species); +void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId); +void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId); +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet); +void SetSpriteCB_MonAnimDummy(struct Sprite *sprite); #endif // GUARD_POKEMON_ANIMATION_H diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index e0a9aa0c5..e7fc81ce4 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -5,9 +5,11 @@ const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); u16 GetUnownLetterByPersonality(u32 personality); u16 sub_80D2E84(u16 speciesId); +void sub_80D2F04(void); void sub_80D2F68(u16 iconId); u8 sub_80D2D78(u16 iconId, void callback(struct Sprite *), u16 x, u16 y, u16 a4, u8 a5); void sub_80D2FF0(u16 iconId); void sub_80D2EF8(struct Sprite *sprite); +u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, int a7); #endif // GUARD_POKEMON_ICON_H diff --git a/include/scanline_effect.h b/include/scanline_effect.h new file mode 100644 index 000000000..54dfe17bd --- /dev/null +++ b/include/scanline_effect.h @@ -0,0 +1,47 @@ +#ifndef GUARD_SCANLINE_EFFECT_H +#define GUARD_SCANLINE_EFFECT_H + +// DMA control value to ransfer a single 16-bit value at HBlank +#define SCANLINE_EFFECT_DMACNT_16BIT (((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_INC | DMA_16BIT | DMA_DEST_RELOAD) << 16) | 1) + +#define SCANLINE_EFFECT_REG_BG0HOFS (REG_ADDR_BG0HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG0VOFS (REG_ADDR_BG0VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG1HOFS (REG_ADDR_BG1HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG1VOFS (REG_ADDR_BG1VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG2HOFS (REG_ADDR_BG2HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG2VOFS (REG_ADDR_BG2VOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG3HOFS (REG_ADDR_BG3HOFS - REG_ADDR_BG0HOFS) +#define SCANLINE_EFFECT_REG_BG3VOFS (REG_ADDR_BG3VOFS - REG_ADDR_BG0HOFS) + +struct ScanlineEffectParams +{ + volatile void *dmaDest; + u32 dmaControl; + u8 initState; + u8 unused9; +}; + +struct ScanlineEffect +{ + void *dmaSrcBuffers[2]; + volatile void *dmaDest; + u32 dmaControl; + void (*setFirstScanlineReg)(void); + u8 srcBuffer; + u8 state; + u8 unused16; + u8 unused17; + u8 waveTaskId; +}; + +extern struct ScanlineEffect gScanlineEffect; + +extern u16 gScanlineEffectRegBuffers[][0x3C0]; + +void ScanlineEffect_Stop(void); +void ScanlineEffect_Clear(void); +void ScanlineEffect_SetParams(struct ScanlineEffectParams); +void ScanlineEffect_InitHBlankDmaTransfer(void); +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 a7); + +#endif // GUARD_SCANLINE_EFFECT_H diff --git a/include/sprite.h b/include/sprite.h index d5c6bc402..b5a1b6ae5 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -233,6 +233,7 @@ extern s16 gSpriteCoordOffsetX; extern s16 gSpriteCoordOffsetY; extern struct Sprite gSprites[]; +extern struct OamMatrix gOamMatrices[]; void ResetSpriteData(void); void AnimateSprites(void); diff --git a/include/strings.h b/include/strings.h index 186a48ff0..11ecf098f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -204,4 +204,15 @@ extern const u8 gText_Frame[]; extern const u8 gText_OptionMenuCancel[]; extern const u8 gText_ButtonMode[]; +extern const u8 gText_MaleSymbol[]; +extern const u8 gText_FemaleSymbol[]; + +// mystery event menu text +extern const u8 gText_EventSafelyLoaded[]; +extern const u8 gText_LoadErrorEndingSession[]; +extern const u8 gText_PressAToLoadEvent[]; +extern const u8 gText_LoadingEvent[]; +extern const u8 gText_DontRemoveCableTurnOff[]; +extern const u8 gText_LinkStandby2[]; + #endif //GUARD_STRINGS_H diff --git a/include/text.h b/include/text.h index 289c7d2b5..b5fc5b58a 100644 --- a/include/text.h +++ b/include/text.h @@ -185,6 +185,13 @@ struct __attribute__((packed)) TextColor u8 shadowColor; }; +struct AlignedTextColor // because sometimes it's necessary +{ + u8 fgColor; + u8 bgColor; + u8 shadowColor; +}; + extern u8 gStringVar1[]; extern u8 gStringVar2[]; extern u8 gStringVar3[]; diff --git a/include/time_events.h b/include/time_events.h new file mode 100644 index 000000000..fd6d29f39 --- /dev/null +++ b/include/time_events.h @@ -0,0 +1,8 @@ +#ifndef GUARD_TIME_EVENTS_H +#define GUARD_TIME_EVENTS_H + +void UpdateMirageRnd(u16); +u8 IsMirageIslandPresent(void); +void UpdateBirchState(u16); + +#endif // GUARD_TIME_EVENTS_H diff --git a/include/unknown_task.h b/include/unknown_task.h deleted file mode 100644 index 906fed3e0..000000000 --- a/include/unknown_task.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GUARD_unknown_task_H -#define GUARD_unknown_task_H - -// Exported type declarations -struct UnknownTaskStruct -{ - volatile void *dest; - u32 control; - u8 unk8; - u8 unk9; -}; - -extern struct UnknownTaskStruct gUnknown_0831AC70; - -// Exported RAM declarations - -// Exported ROM declarations -void ScanlineEffect_Stop(void); -void sub_80BA038(struct UnknownTaskStruct arg0); -void sub_80BA0A8(void); - -#endif // GUARD_unknown_task_H diff --git a/ld_script.txt b/ld_script.txt index 7fad973fb..481076961 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -100,15 +100,15 @@ SECTIONS { asm/field_player_avatar.o(.text); src/field_map_obj.o(.text); asm/field_ground_effect.o(.text); - asm/map_obj_8097404.o(.text); - asm/field_message_box.o(.text); + src/field_map_obj_helpers.o(.text); + src/field_message_box.o(.text); asm/map_obj_lock.o(.text); src/text_window.o(.text); src/script.o(.text); src/scrcmd.o(.text); asm/field_control_avatar.o(.text); src/event_data.o(.text); - asm/coord_event_weather.o(.text); + src/coord_event_weather.o(.text); asm/field_tasks.o(.text); src/clock.o(.text); asm/reset_rtc_screen.o(.text); @@ -129,7 +129,7 @@ SECTIONS { src/trainer_see.o(.text); src/wild_encounter.o(.text); asm/field_effect.o(.text); - asm/unknown_task.o(.text); + src/scanline_effect.o(.text); src/option_menu.o(.text); src/pokedex.o(.text); asm/pokedex.o(.text); @@ -150,7 +150,7 @@ SECTIONS { asm/shop.o(.text); src/berry.o(.text); asm/script_menu.o(.text); - asm/naming_screen.o(.text); + src/naming_screen.o(.text); src/money.o(.text); asm/contest_effect.o(.text); asm/record_mixing.o(.text); @@ -165,7 +165,7 @@ SECTIONS { asm/rotating_gate.o(.text); src/safari_zone.o(.text); asm/contest_link_80FC4F4.o(.text); - asm/item_use.o(.text); + src/item_use.o(.text); asm/battle_anim_80FE840.o(.text); src/bike.o(.text); asm/easy_chat.o(.text); @@ -188,7 +188,7 @@ SECTIONS { src/pokeblock.o(.text); asm/fldeff_flash.o(.text); asm/post_battle_event_funcs.o(.text); - asm/time_events.o(.text); + src/time_events.o(.text); asm/birch_pc.o(.text); src/hof_pc.o(.text); asm/field_specials.o(.text); @@ -233,7 +233,7 @@ SECTIONS { src/lottery_corner.o(.text); src/diploma.o(.text); asm/berry_tag_screen.o(.text); - asm/mystery_event_menu.o(.text); + src/mystery_event_menu.o(.text); src/save_failed_screen.o(.text); src/braille_puzzles.o(.text); src/pokeblock_feed.o(.text); @@ -243,7 +243,7 @@ SECTIONS { src/bard_music.o(.text); src/fldeff_teleport.o(.text); asm/battle_link_817C95C.o(.text); - asm/pokemon_animation.o(.text); + src/pokemon_animation.o(.text); src/recorded_battle.o(.text); src/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_player.o(.text); @@ -412,7 +412,7 @@ SECTIONS { data/map_obj_8097404.o(.rodata); src/text_window.o(.rodata); src/scrcmd.o(.rodata); - data/coord_event_weather.o(.rodata); + src/coord_event_weather.o(.rodata); data/field_tasks.o(.rodata); data/reset_rtc_screen.o(.rodata); src/start_menu.o(.rodata); @@ -445,7 +445,7 @@ SECTIONS { data/shop.o(.rodata); src/berry.o(.rodata); data/script_menu.o(.rodata); - data/naming_screen.o(.rodata); + src/naming_screen.o(.rodata); src/money.o(.rodata); data/contest_effect.o(.rodata); data/record_mixing.o(.rodata); @@ -477,7 +477,7 @@ SECTIONS { src/wallclock.o(.rodata); src/pokeblock.o(.rodata); data/fldeff_flash.o(.rodata); - data/time_events.o(.rodata); + src/time_events.o(.rodata); data/field_specials.o(.rodata); data/battle_records.o(.rodata); data/pokedex_area_screen.o(.rodata); @@ -489,7 +489,7 @@ SECTIONS { src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); data/cable_car.o(.rodata); - data/save.o(.rodata); + src/save.o(.rodata); data/field_effect_helpers.o(.rodata); data/contest_ai.o(.rodata); src/battle_controller_safari.o(.rodata); @@ -510,7 +510,7 @@ SECTIONS { src/diploma.o(.rodata); data/strings.o(.rodata); data/berry_tag_screen.o(.rodata); - data/mystery_event_menu.o(.rodata); + src/mystery_event_menu.o(.rodata); src/save_failed_screen.o(.rodata); data/braille_puzzles.o(.rodata); src/pokeblock_feed.o(.rodata); @@ -519,7 +519,7 @@ SECTIONS { src/evolution_graphics.o(.rodata); src/bard_music.o(.rodata); data/battle_link_817C95C.o(.rodata); - data/pokemon_animation.o(.rodata); + src/pokemon_animation.o(.rodata); src/battle_controller_recorded_opponent.o(.rodata); src/battle_controller_recorded_player.o(.rodata); src/battle_dome_cards.o(.rodata); @@ -545,7 +545,7 @@ SECTIONS { data/trainer_rematch.o(.rodata); data/unk_transition.o(.rodata); src/unk_transition.o(.rodata); - data/link_strings.o(.rodata); + data/text_input_strings.o(.rodata); data/fonts.o(.rodata); src/mystery_event_msg.o(.rodata); data/mystery_event_msg.o(.rodata); diff --git a/src/battle_2.c b/src/battle_2.c index 2d7f860c7..c03d22080 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -4,7 +4,7 @@ #include "main.h" #include "load_save.h" #include "gpu_regs.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "battle_setup.h" #include "battle_scripts.h" #include "pokemon.h" @@ -47,13 +47,6 @@ #include "battle_string_ids.h" #include "data2.h" -struct UnknownStruct6 -{ - u16 unk0[0xA0]; - u8 fillerA0[0x640]; - u16 unk780[0xA0]; -}; - struct UnknownPokemonStruct2 { /*0x00*/ u16 species; @@ -91,8 +84,6 @@ extern void (*gBattleMainFunc)(void); extern void (*gCB2_AfterEvolution)(void); extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? -extern u8 gUnknown_02039B28[]; // possibly a struct? -extern struct UnknownStruct6 gUnknown_02038C28; // todo: identify & document extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; extern u8 gDecompressionBuffer[]; @@ -163,6 +154,7 @@ extern const u8 * const gBattlescriptsForBallThrow[]; extern const u8 * const gBattlescriptsForRunningByItem[]; extern const u8 * const gBattlescriptsForUsingItem[]; extern const u8 * const gBattlescriptsForSafariActions[]; +extern const struct ScanlineEffectParams gUnknown_0831AC70; // strings extern const u8 gText_LinkStandby3[]; @@ -181,7 +173,7 @@ extern const u8 gText_Confusion[]; extern const u8 gText_Love[]; // functions -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); extern void sub_80356D0(void); extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower extern void sub_8166188(void); // battle tower, sets link battle mons level but why? @@ -384,24 +376,21 @@ static void CB2_InitBattleInternal(void) else { gBattle_WIN0V = 0x5051; - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 80; i++) { - gUnknown_02038C28.unk0[i] = 0xF0; - gUnknown_02038C28.unk780[i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0xF0; } for (i = 80; i < 160; i++) { - #ifndef NONMATCHING - asm(""::"r"(i)); // needed to match - #endif // NONMATCHING - - gUnknown_02038C28.unk0[i] = 0xFF10; - gUnknown_02038C28.unk780[i] = 0xFF10; + asm(""::"r"(i)); + gScanlineEffectRegBuffers[0][i] = 0xFF10; + gScanlineEffectRegBuffers[1][i] = 0xFF10; } - sub_80BA038(gUnknown_0831AC70); + ScanlineEffect_SetParams(gUnknown_0831AC70); } ResetPaletteFade(); @@ -1597,7 +1586,7 @@ void BattleMainCB2(void) static void FreeRestoreBattleData(void) { gMain.callback1 = gPreBattleCallback1; - gUnknown_02039B28[0x15] = 3; + gScanlineEffect.state = 3; gMain.inBattle = 0; ZeroEnemyPartyMons(); m4aSongNumStop(0x5A); @@ -1815,7 +1804,7 @@ void VBlankCB_Battle(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } void nullsub_17(void) @@ -1953,18 +1942,18 @@ void sub_8038D64(void) SetGpuReg(REG_OFFSET_WINOUT, 0); gBattle_WIN0H = 0xF0; gBattle_WIN0V = 0x5051; - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 80; i++) { - gUnknown_02038C28.unk0[i] = 0xF0; - gUnknown_02038C28.unk780[i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0xF0; } for (i = 80; i < 160; i++) { asm(""::"r"(i)); // Needed to stop the compiler from optimizing out the loop counter - gUnknown_02038C28.unk0[i] = 0xFF10; - gUnknown_02038C28.unk780[i] = 0xFF10; + gScanlineEffectRegBuffers[0][i] = 0xFF10; + gScanlineEffectRegBuffers[1][i] = 0xFF10; } ResetPaletteFade(); diff --git a/src/battle_interface.c b/src/battle_interface.c index 47e1d7db3..e75104f27 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -20,6 +20,7 @@ #include "international_string_util.h" #include "safari_zone.h" #include "battle_anim.h" +#include "constants/rgb.h" struct TestingBar { @@ -555,13 +556,13 @@ enum PAL_STATUS_BRN }; -static const u16 sStatusIconPalettes[] = +static const u16 sStatusIconColors[] = { - 0x6198, // PAL_STATUS_PSN - 0xEF7, // PAL_STATUS_PAR - 0x4694, // PAL_STATUS_SLP - 0x72D1, // PAL_STATUS_FRZ - 0x29DC // PAL_STATUS_BRN + RGB(24, 12, 24), // PAL_STATUS_PSN + RGB(23, 23, 3), // PAL_STATUS_PAR + RGB(20, 20, 17), // PAL_STATUS_SLP + RGB(17, 22, 28), // PAL_STATUS_FRZ + RGB(28, 14, 10) // PAL_STATUS_BRN }; static const struct WindowTemplate sHealthboxWindowTemplate = {0, 0, 0, 8, 2, 0, 0}; // width = 8, height = 2 @@ -2071,7 +2072,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId) pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16; pltAdder += bank + 12; - FillPalette(sStatusIconPalettes[statusPalId], pltAdder + 0x100, 2); + FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2); CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2); CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96); if (IsDoubleBattle() == TRUE || GetBankSide(bank) == SIDE_OPPONENT) @@ -2575,7 +2576,7 @@ static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, color.bgColor = 1; color.shadowColor = 3; - AddTextPrinterParametrized2(winId, 0, x, y, 0, 0, &color, -1, str); + AddTextPrinterParameterized2(winId, 0, x, y, 0, 0, &color, -1, str); *windowId = winId; return (u8*)(GetWindowAttribute(winId, WINDOW_TILE_DATA)); diff --git a/src/battle_transition.c b/src/battle_transition.c index e003e0fce..0ff8cd903 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -14,7 +14,7 @@ #include "constants/songs.h" #include "constants/trainers.h" #include "field_camera.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "malloc.h" #include "gpu_regs.h" #include "decompress.h" @@ -56,8 +56,6 @@ struct StructRectangularSpiral typedef bool8 (*TransitionStateFunc)(struct Task *task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); -extern u16 gUnknown_020393A8[]; -extern u16 gUnknown_02038C28[][0x3C0]; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -65,7 +63,7 @@ extern const struct OamData gFieldObjectBaseOam_32x32; extern void c2_exit_to_overworld_2_switch(void); extern void sub_80AC3D0(void); -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); // this file's functions static void LaunchBattleTransitionTask(u8 transitionId); @@ -1110,9 +1108,9 @@ static void Phase2Task_Swirl(u8 taskId) static bool8 Phase2_Swirl_Func1(struct Task *task) { sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); - sub_8149F98(gUnknown_020393A8, sTransitionStructPtr->field_14, 0, 2, 0, 160); + sub_8149F98(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_14, 0, 2, 0, 160); SetVBlankCallback(VBlankCB_Phase2_Swirl); SetHBlankCallback(HBlankCB_Phase2_Swirl); @@ -1129,7 +1127,7 @@ static bool8 Phase2_Swirl_Func2(struct Task *task) task->tData1 += 4; task->tData2 += 8; - sub_8149F98(gUnknown_02038C28[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); if (!gPaletteFade.active) { @@ -1145,12 +1143,12 @@ static void VBlankCB_Phase2_Swirl(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Swirl(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; REG_BG2HOFS = var; REG_BG3HOFS = var; @@ -1164,10 +1162,10 @@ static void Phase2Task_Shuffle(u8 taskId) static bool8 Phase2_Shuffle_Func1(struct Task *task) { sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); - memset(gUnknown_020393A8, sTransitionStructPtr->field_16, 0x140); + memset(gScanlineEffectRegBuffers[1], sTransitionStructPtr->field_16, 0x140); SetVBlankCallback(VBlankCB_Phase2_Shuffle); SetHBlankCallback(HBlankCB_Phase2_Shuffle); @@ -1192,7 +1190,7 @@ static bool8 Phase2_Shuffle_Func2(struct Task *task) for (i = 0; i < 160; i++, r4 += 4224) { u16 var = r4 / 256; - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } if (!gPaletteFade.active) @@ -1206,12 +1204,12 @@ static void VBlankCB_Phase2_Shuffle(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Shuffle(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; REG_BG2VOFS = var; REG_BG3VOFS = var; @@ -1257,7 +1255,7 @@ static void sub_814669C(struct Task *task) s32 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); task->tData1 = 16; task->tData2 = 0; @@ -1272,7 +1270,7 @@ static void sub_814669C(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 240; + gScanlineEffectRegBuffers[1][i] = 240; } SetVBlankCallback(VBlankCB0_Phase2_BigPokeball); @@ -1351,7 +1349,7 @@ static bool8 Phase2_BigPokeball_Func2(struct Task *task) dst1[i * 32 + j] = *BigPokeballMap | 0xF000; } } - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return TRUE; @@ -1363,7 +1361,7 @@ static bool8 Phase2_Aqua_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamAqua_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1375,7 +1373,7 @@ static bool8 Phase2_Magma_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamMagma_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1388,7 +1386,7 @@ static bool8 Phase2_Regice_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2B4, 0xF0, 0x20); CpuCopy16(gUnknown_085BC314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1401,7 +1399,7 @@ static bool8 Phase2_Registeel_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2D4, 0xF0, 0x20); CpuCopy16(gUnknown_085BCB14, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1414,7 +1412,7 @@ static bool8 Phase2_Regirock_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2F4, 0xF0, 0x20); CpuCopy16(gUnknown_085BD314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1499,7 +1497,7 @@ static bool8 Phase2_BigPokeball_Func3(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1519,7 +1517,7 @@ static bool8 Phase2_BigPokeball_Func4(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1531,7 +1529,7 @@ static bool8 Phase2_BigPokeball_Func5(struct Task *task) task->tData4 += 8; task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 132, task->tData5 >> 8, 160); if (task->tData5 <= 0) { @@ -1577,7 +1575,7 @@ static bool8 Phase2_BigPokeball_Func6(struct Task *task) if (task->tData1 < 0) task->tData1 = 0; } - sub_814A014(gUnknown_02038C28[0], 120, 80, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 120, 80, task->tData1); if (task->tData1 == 0) { SetVBlankCallback(NULL); @@ -1604,7 +1602,7 @@ static void Transition_BigPokeball_Vblank(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; @@ -1615,13 +1613,13 @@ static void Transition_BigPokeball_Vblank(void) static void VBlankCB0_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); - DmaSet(0, gUnknown_020393A8, ®_BG0HOFS, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BG0HOFS, 0xA2400001); } static void VBlankCB1_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); - DmaSet(0, gUnknown_020393A8, ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_PokeballsTrail(u8 taskId) @@ -1741,7 +1739,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; @@ -1750,7 +1748,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_020393A8[i] = 0xF3F4; + gScanlineEffectRegBuffers[1][i] = 0xF3F4; } SetVBlankCallback(VBlankCB_Phase2_Clockwise_BlackFade); @@ -1767,7 +1765,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], -1, 1, 1); do { - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); sTransitionStructPtr->data[4] += 16; @@ -1795,7 +1793,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) r1 = 120, r3 = sTransitionStructPtr->data[2] + 1; if (sTransitionStructPtr->data[5] >= 80) r1 = sTransitionStructPtr->data[2], r3 = 240; - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); if (var != 0) break; var = sub_814A228(sTransitionStructPtr->data, 1, 1); @@ -1811,7 +1809,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) { while (sTransitionStructPtr->data[3] < sTransitionStructPtr->data[5]) { - gUnknown_02038C28[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + gScanlineEffectRegBuffers[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); } } @@ -1826,7 +1824,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 160, 1, 1); do { - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); sTransitionStructPtr->data[4] -= 16; @@ -1851,12 +1849,12 @@ static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) while (1) { - r1 = (gUnknown_02038C28[0][sTransitionStructPtr->data[3]]) & 0xFF; + r1 = (gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]]) & 0xFF; r2 = sTransitionStructPtr->data[2]; if (sTransitionStructPtr->data[5] <= 80) r2 = 120, r1 = sTransitionStructPtr->data[2]; var4 = (r1) | (r2 << 8); - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = var4; + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = var4; if (var != 0) break; var = sub_814A228(sTransitionStructPtr->data, 1, 1); @@ -1872,7 +1870,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) { while (sTransitionStructPtr->data[3] > sTransitionStructPtr->data[5]) { - gUnknown_02038C28[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); + gScanlineEffectRegBuffers[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); } } @@ -1892,7 +1890,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) r2 = 120, r3 = sTransitionStructPtr->data[2]; if (sTransitionStructPtr->data[2] >= 120) r2 = 0, r3 = 240; - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); @@ -1917,12 +1915,12 @@ static void VBlankCB_Phase2_Clockwise_BlackFade(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - REG_WIN0H = gUnknown_02038C28[1][0]; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + REG_WIN0H = gScanlineEffectRegBuffers[1][0]; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_Ripple(u8 taskId) @@ -1935,11 +1933,11 @@ static bool8 Phase2_Ripple_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); for (i = 0; i < 160; i++) { - gUnknown_020393A8[i] = sTransitionStructPtr->field_16; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; } SetVBlankCallback(VBlankCB_Phase2_Ripple); @@ -1971,7 +1969,7 @@ static bool8 Phase2_Ripple_Func2(struct Task *task) // todo: fix the asm s16 var = r4 >> 8; asm(""); - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } if (++task->tData3 == 81) @@ -1991,12 +1989,12 @@ static void VBlankCB_Phase2_Ripple(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_Ripple(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1VOFS = var; REG_BG2VOFS = var; REG_BG3VOFS = var; @@ -2012,7 +2010,7 @@ static bool8 Phase2_Wave_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; @@ -2021,7 +2019,7 @@ static bool8 Phase2_Wave_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 242; + gScanlineEffectRegBuffers[1][i] = 242; } SetVBlankCallback(VBlankCB_Phase2_Wave); @@ -2037,7 +2035,7 @@ static bool8 Phase2_Wave_Func2(struct Task *task) bool8 nextFunc; sTransitionStructPtr->VBlank_DMA = FALSE; - toStore = gUnknown_02038C28[0]; + toStore = gScanlineEffectRegBuffers[0]; r5 = task->tData2; task->tData2 += 16; task->tData1 += 8; @@ -2073,11 +2071,11 @@ static void VBlankCB_Phase2_Wave(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void Phase2Task_Sydney(u8 taskId) @@ -2120,7 +2118,7 @@ static bool8 Phase2_Mugshot_Func1(struct Task *task) u8 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); Mugshots_CreateOpponentPlayerSprites(task); task->tData1 = 0; @@ -2132,7 +2130,7 @@ static bool8 Phase2_Mugshot_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0xF0F1; + gScanlineEffectRegBuffers[1][i] = 0xF0F1; } SetVBlankCallback(VBlankCB0_Phase2_Mugshots); @@ -2177,7 +2175,7 @@ static bool8 Phase2_Mugshot_Func3(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - toStore = gUnknown_02038C28[0]; + toStore = gScanlineEffectRegBuffers[0]; r5 = task->tData1; task->tData1 += 0x10; @@ -2223,7 +2221,7 @@ static bool8 Phase2_Mugshot_Func4(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - for (i = 0, toStore = gUnknown_02038C28[0]; i < 160; i++, toStore++) + for (i = 0, toStore = gScanlineEffectRegBuffers[0]; i < 160; i++, toStore++) { *toStore = 0xF0; } @@ -2266,8 +2264,8 @@ static bool8 Phase2_Mugshot_Func6(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; SetVBlankCallback(NULL); DmaStop(0); - memset(gUnknown_02038C28[0], 0, 0x140); - memset(gUnknown_02038C28[1], 0, 0x140); + memset(gScanlineEffectRegBuffers[0], 0, 0x140); + memset(gScanlineEffectRegBuffers[1], 0, 0x140); SetGpuReg(REG_OFFSET_WIN0H, 0xF0); SetGpuReg(REG_OFFSET_BLDY, 0); task->tState++; @@ -2300,15 +2298,15 @@ static bool8 Phase2_Mugshot_Func7(struct Task *task) { s16 index1 = 0x50 - i; s16 index2 = 0x50 + i; - if (gUnknown_02038C28[0][index1] <= 15) + if (gScanlineEffectRegBuffers[0][index1] <= 15) { r6 = TRUE; - gUnknown_02038C28[0][index1]++; + gScanlineEffectRegBuffers[0][index1]++; } - if (gUnknown_02038C28[0][index2] <= 15) + if (gScanlineEffectRegBuffers[0][index2] <= 15) { r6 = TRUE; - gUnknown_02038C28[0][index2]++; + gScanlineEffectRegBuffers[0][index2]++; } } } @@ -2336,7 +2334,7 @@ static bool8 Phase2_Mugshot_Func9(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; task->tData3++; - memset(gUnknown_02038C28[0], task->tData3, 0x140); + memset(gScanlineEffectRegBuffers[0], task->tData3, 0x140); if (task->tData3 > 15) task->tState++; @@ -2357,12 +2355,12 @@ static void VBlankCB0_Phase2_Mugshots(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_BG0VOFS = sTransitionStructPtr->BG0VOFS; REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } static void VBlankCB1_Phase2_Mugshots(void) @@ -2370,9 +2368,9 @@ static void VBlankCB1_Phase2_Mugshots(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_BLDCNT = sTransitionStructPtr->BLDCNT; - DmaSet(0, gUnknown_02038C28[1], ®_BLDY, 0xA2400001); + DmaSet(0, gScanlineEffectRegBuffers[1], ®_BLDY, 0xA2400001); } static void HBlankCB_Phase2_Mugshots(void) @@ -2500,7 +2498,7 @@ static bool8 Phase2_Slice_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); task->tData2 = 256; task->tData3 = 1; @@ -2511,8 +2509,8 @@ static bool8 Phase2_Slice_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[1][160 + i] = 0xF0; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[1][160 + i] = 0xF0; } EnableInterrupts(INTR_FLAG_HBLANK); @@ -2541,8 +2539,8 @@ static bool8 Phase2_Slice_Func2(struct Task *task) for (i = 0; i < 160; i++) { - u16 *storeLoc1 = &gUnknown_02038C28[0][i]; - u16 *storeLoc2 = &gUnknown_02038C28[0][i + 160]; + u16 *storeLoc1 = &gScanlineEffectRegBuffers[0][i]; + u16 *storeLoc2 = &gScanlineEffectRegBuffers[0][i + 160]; if (i & 1) { *storeLoc1 = sTransitionStructPtr->field_14 + task->tData1; @@ -2578,15 +2576,15 @@ static void VBlankCB_Phase2_Slice(void) REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); - DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); + DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); } static void HBlankCB_Phase2_Slice(void) { if (REG_VCOUNT < 160) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG1HOFS = var; REG_BG2HOFS = var; REG_BG3HOFS = var; @@ -2603,7 +2601,7 @@ static bool8 Phase2_ShredSplit_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; @@ -2611,13 +2609,13 @@ static bool8 Phase2_ShredSplit_Func1(struct Task *task) for (i = 0; i < 0xA0; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[1][0xA0 + i] = 0xF0; - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_14; - gUnknown_02038C28[0][0xA0 + i] = 0xF0; - gUnknown_02038C28[0][0x140 + i] = 0; - gUnknown_02038C28[0][0x1E0 + i] = 0x100; - gUnknown_02038C28[0][0x280 + i] = 1; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[1][0xA0 + i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_14; + gScanlineEffectRegBuffers[0][0xA0 + i] = 0xF0; + gScanlineEffectRegBuffers[0][0x140 + i] = 0; + gScanlineEffectRegBuffers[0][0x1E0 + i] = 0x100; + gScanlineEffectRegBuffers[0][0x280 + i] = 1; } task->tData4 = 0; @@ -2657,9 +2655,9 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) unkVar = (arr1[j]) + (arr2[k] * -(i) * 2); if (unkVar >= 0 && (unkVar != 79 || j != 1)) { - ptr4 = &gUnknown_02038C28[0][unkVar + 320]; - ptr3 = &gUnknown_02038C28[0][unkVar + 480]; - ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; + ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; if (*ptr4 > 0xEF) { *ptr4 = 0xF0; @@ -2673,8 +2671,8 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gUnknown_02038C28[0][unkVar]; - ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; *ptr2 = sTransitionStructPtr->field_14 + *ptr4; *ptr3 = 0xF0 - *ptr4; @@ -2691,9 +2689,9 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) unkVar = (arr1[j] + 1) + (arr2[k] * -(i) * 2); if (unkVar <= 160 && (unkVar != 80 || j != 1)) { - ptr4 = &gUnknown_02038C28[0][unkVar + 320]; - ptr3 = &gUnknown_02038C28[0][unkVar + 480]; - ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + ptr4 = &gScanlineEffectRegBuffers[0][unkVar + 320]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 480]; + ptr1 = &gScanlineEffectRegBuffers[0][unkVar + 640]; if (*ptr4 > 0xEF) { *ptr4 = 0xF0; @@ -2707,8 +2705,8 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) if (*ptr3 <= 0xFFF) *ptr3 += *ptr1; } - ptr2 = &gUnknown_02038C28[0][unkVar]; - ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + ptr2 = &gScanlineEffectRegBuffers[0][unkVar]; + ptr3 = &gScanlineEffectRegBuffers[0][unkVar + 160]; *ptr2 = sTransitionStructPtr->field_14 - *ptr4; *ptr3 = (*ptr4 << 8) | (0xF1); @@ -2732,7 +2730,7 @@ static bool8 Phase2_ShredSplit_Func2(struct Task *task) // This function never increments the state counter, because the loop condition // is always false, resulting in the game being stuck in an infinite loop. -// It's possible this transition is only partially +// It's possible this transition is only partially // done and the second part was left out. static bool8 Phase2_ShredSplit_Func3(struct Task *task) { @@ -2742,7 +2740,7 @@ static bool8 Phase2_ShredSplit_Func3(struct Task *task) for (i = 0; i < 0xA0; i++) { - if (gUnknown_02038C28[1][i] != 0xF0 && gUnknown_02038C28[1][i] != checkVar2) + if (gScanlineEffectRegBuffers[1][i] != 0xF0 && gScanlineEffectRegBuffers[1][i] != checkVar2) done = FALSE; // a break statement should be put here } @@ -2775,7 +2773,7 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) s32 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; @@ -2784,7 +2782,7 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) for (i = 0; i < 0xA0; i++) { - gUnknown_02038C28[1][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0; } SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); @@ -2814,7 +2812,7 @@ static bool8 Phase2_Blackhole1_Func3(struct Task *task) task->tData1 += (task->tData2 >> 8); if (task->tData1 > 0xA0) task->tData1 = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 == 0xA0) { task->tFuncState = 1; @@ -2840,7 +2838,7 @@ static bool8 Phase2_Blackhole1_Func2(struct Task *task) } task->tData1 += gUnknown_085C8C80[task->tData6]; task->tData6 = (task->tData6 + 1) % 2; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 < 9) { task->tState++; @@ -2866,7 +2864,7 @@ static bool8 Phase2_Blackhole2_Func2(struct Task *task) if (task->tData1 > 0xA0) task->tData1 = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + sub_814A014(gScanlineEffectRegBuffers[0], 0x78, 0x50, task->tData1); if (task->tData1 == 0xA0) { DmaStop(0); @@ -3113,7 +3111,7 @@ static bool8 Phase2_Rayquaza_Func3(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); SetGpuReg(REG_OFFSET_BG0CNT, 0x9A08); sub_8149F58(&dst1, &dst2); @@ -3126,8 +3124,8 @@ static bool8 Phase2_Rayquaza_Func3(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[0][i] = 0; - gUnknown_02038C28[1][i] = 0x100; + gScanlineEffectRegBuffers[0][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0x100; } SetVBlankCallback(VBlankCB_Phase2_Rayquaza); @@ -3212,7 +3210,7 @@ static bool8 Phase2_Rayquaza_Func9(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0; + gScanlineEffectRegBuffers[1][i] = 0; } SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); @@ -3233,11 +3231,11 @@ static void VBlankCB_Phase2_Rayquaza(void) VBlankCB_BattleTransition(); if (sTransitionStructPtr->field_20 == 0) - dmaSrc = gUnknown_02038C28[0]; + dmaSrc = gScanlineEffectRegBuffers[0]; else if (sTransitionStructPtr->field_20 == 1) - dmaSrc = gUnknown_02038C28[1]; + dmaSrc = gScanlineEffectRegBuffers[1]; else - dmaSrc = gUnknown_02038C28[0]; + dmaSrc = gScanlineEffectRegBuffers[0]; DmaSet(0, dmaSrc, ®_BG0VOFS, 0xA2400001); } @@ -3252,7 +3250,7 @@ static bool8 Phase2_WhiteFade_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->BLDCNT = 0xBF; sTransitionStructPtr->BLDY = 0; @@ -3262,8 +3260,8 @@ static bool8 Phase2_WhiteFade_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = 0; - gUnknown_02038C28[1][i + 160] = 0xF0; + gScanlineEffectRegBuffers[1][i] = 0; + gScanlineEffectRegBuffers[1][i + 160] = 0xF0; } EnableInterrupts(INTR_FLAG_HBLANK); @@ -3343,8 +3341,8 @@ static void VBlankCB0_Phase2_WhiteFade(void) REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); - DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 640); + DmaSet(0, &gScanlineEffectRegBuffers[1][160], ®_WIN0H, 0xA2400001); } static void VBlankCB1_Phase2_WhiteFade(void) @@ -3360,7 +3358,7 @@ static void VBlankCB1_Phase2_WhiteFade(void) static void HBlankCB_Phase2_WhiteFade(void) { - REG_BLDY = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BLDY = gScanlineEffectRegBuffers[1][REG_VCOUNT]; } static void sub_8149864(struct Sprite *sprite) @@ -3374,8 +3372,8 @@ static void sub_8149864(struct Sprite *sprite) else { u16 i; - u16* ptr1 = &gUnknown_02038C28[0][sprite->pos1.y]; - u16* ptr2 = &gUnknown_02038C28[0][sprite->pos1.y + 160]; + u16* ptr1 = &gScanlineEffectRegBuffers[0][sprite->pos1.y]; + u16* ptr2 = &gScanlineEffectRegBuffers[0][sprite->pos1.y + 160]; for (i = 0; i < 20; i++) { ptr1[i] = sprite->data[0] >> 8; @@ -3465,7 +3463,7 @@ static bool8 Phase2_Shards_Func1(struct Task *task) u16 i; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); sTransitionStructPtr->WININ = 0x3F; sTransitionStructPtr->WINOUT = 0; @@ -3473,10 +3471,10 @@ static bool8 Phase2_Shards_Func1(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[0][i] = 0xF0; + gScanlineEffectRegBuffers[0][i] = 0xF0; } - CpuSet(gUnknown_02038C28[0], gUnknown_02038C28[1], 0xA0); + CpuSet(gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 0xA0); SetVBlankCallback(VBlankCB_Phase2_Shards); task->tState++; @@ -3505,8 +3503,8 @@ static bool8 Phase2_Shards_Func3(struct Task *task) for (i = 0, nextFunc = FALSE; i < 16; i++) { - s16 r3 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] >> 8; - s16 r4 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] & 0xFF; + s16 r3 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] >> 8; + s16 r4 = gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] & 0xFF; if (task->tData2 == 0) { if (r3 < sTransitionStructPtr->data[2]) @@ -3521,7 +3519,7 @@ static bool8 Phase2_Shards_Func3(struct Task *task) if (r4 <= r3) r4 = r3; } - gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); + gScanlineEffectRegBuffers[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); if (nextFunc) { task->tState++; @@ -3568,12 +3566,12 @@ static void VBlankCB_Phase2_Shards(void) DmaStop(0); VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; - REG_WIN0H = gUnknown_02038C28[1][0]; - DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); + REG_WIN0H = gScanlineEffectRegBuffers[1][0]; + DmaSet(0, gScanlineEffectRegBuffers[1], ®_WIN0H, 0xA2400001); } // sub-task for phase2 @@ -3875,7 +3873,7 @@ static bool8 Phase2_29_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(gUnknown_085C828C, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 0x84, task->tData5, 160); + sub_8149F98(gScanlineEffectRegBuffers[0], 0, task->tData4, 0x84, task->tData5, 160); task->tState++; return TRUE; @@ -3896,7 +3894,7 @@ static bool8 Phase2_30_Func1(struct Task *task) u16 *dst1, *dst2; sub_8149F08(); - dp12_8087EA4(); + ScanlineEffect_Clear(); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); task->tData2 = 0x2000; task->tData1 = 0x7FFF; @@ -3934,7 +3932,7 @@ static bool8 Phase2_30_Func3(struct Task *task) for (i = 0; i < 160; i++) { - gUnknown_02038C28[1][i] = sTransitionStructPtr->field_16; + gScanlineEffectRegBuffers[1][i] = sTransitionStructPtr->field_16; } SetVBlankCallback(VBlankCB_Phase2_30); @@ -3980,7 +3978,7 @@ static bool8 Phase2_30_Func4(struct Task *task) { s16 index = var6 / 256; asm(""); - gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude); + gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude); } if (++task->tData3 == 101) @@ -4004,12 +4002,12 @@ static void VBlankCB_Phase2_30(void) REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; if (sTransitionStructPtr->VBlank_DMA) - DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + DmaCopy16(3, gScanlineEffectRegBuffers[0], gScanlineEffectRegBuffers[1], 320); } static void HBlankCB_Phase2_30(void) { - u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + u16 var = gScanlineEffectRegBuffers[1][REG_VCOUNT]; REG_BG0VOFS = var; } diff --git a/src/berry_blender.c b/src/berry_blender.c index b61bb8e9b..0cf6efd65 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -3602,7 +3602,7 @@ static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s3 FillWindowPixelBuffer(windowId, txtColor.fgColor | (txtColor.fgColor << 4)); } - AddTextPrinterParametrized2(windowId, 1, x, y, letterSpacing, 1, &txtColor, speed, string); + AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, 1, &txtColor, speed, string); } static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed) diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 8a9b0caed..2b576b61b 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -6,7 +6,7 @@ #include "main.h" #include "sprite.h" #include "task.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "window.h" #include "text.h" #include "menu.h" diff --git a/src/coord_event_weather.c b/src/coord_event_weather.c new file mode 100644 index 000000000..60b87fa30 --- /dev/null +++ b/src/coord_event_weather.c @@ -0,0 +1,119 @@ +#include "global.h" +#include "constants/weather.h" +#include "coord_event_weather.h" +#include "field_weather.h" + +struct CoordEventWeather +{ + u8 coordEventWeather; + void (*func)(void); +}; + +static void CoordEventWeather_Clouds(void); +static void CoordEventWeather_Sunny(void); +static void CoordEventWeather_LightRain(void); +static void CoordEventWeather_Snow(void); +static void CoordEventWeather_Thunderstorm(void); +static void CoordEventWeather_Fog(void); +static void CoordEventWeather_DiagonalFog(void); +static void CoordEventWeather_Ash(void); +static void CoordEventWeather_Sandstorm(void); +static void CoordEventWeather_Dark(void); +static void CoordEventWeather_Drought(void); +static void CoordEventWeather_Route119Cycle(void); +static void CoordEventWeather_Route123Cycle(void); + +static const struct CoordEventWeather sCoordEventWeatherFuncs[] = +{ + { COORD_EVENT_WEATHER_CLOUDS, CoordEventWeather_Clouds }, + { COORD_EVENT_WEATHER_SUNNY, CoordEventWeather_Sunny }, + { COORD_EVENT_WEATHER_RAIN_LIGHT, CoordEventWeather_LightRain }, + { COORD_EVENT_WEATHER_SNOW, CoordEventWeather_Snow }, + { COORD_EVENT_WEATHER_RAIN_MED, CoordEventWeather_Thunderstorm }, + { COORD_EVENT_WEATHER_FOG_1, CoordEventWeather_Fog }, + { COORD_EVENT_WEATHER_FOG_2, CoordEventWeather_DiagonalFog }, + { COORD_EVENT_WEATHER_ASH, CoordEventWeather_Ash }, + { COORD_EVENT_WEATHER_SANDSTORM, CoordEventWeather_Sandstorm }, + { COORD_EVENT_WEATHER_SHADE, CoordEventWeather_Dark }, + { COORD_EVENT_WEATHER_DROUGHT, CoordEventWeather_Drought }, + { COORD_EVENT_WEATHER_ROUTE119_CYCLE, CoordEventWeather_Route119Cycle }, + { COORD_EVENT_WEATHER_ROUTE123_CYCLE, CoordEventWeather_Route123Cycle }, +}; + +static void CoordEventWeather_Clouds(void) +{ + SetWeather(WEATHER_CLOUDS); +} + +static void CoordEventWeather_Sunny(void) +{ + SetWeather(WEATHER_SUNNY); +} + +static void CoordEventWeather_LightRain(void) +{ + SetWeather(WEATHER_RAIN_LIGHT); +} + +static void CoordEventWeather_Snow(void) +{ + SetWeather(WEATHER_SNOW); +} + +static void CoordEventWeather_Thunderstorm(void) +{ + SetWeather(WEATHER_RAIN_MED); +} + +static void CoordEventWeather_Fog(void) +{ + SetWeather(WEATHER_FOG_1); +} + +static void CoordEventWeather_DiagonalFog(void) +{ + SetWeather(WEATHER_FOG_2); +} + +static void CoordEventWeather_Ash(void) +{ + SetWeather(WEATHER_ASH); +} + +static void CoordEventWeather_Sandstorm(void) +{ + SetWeather(WEATHER_SANDSTORM); +} + +static void CoordEventWeather_Dark(void) +{ + SetWeather(WEATHER_SHADE); +} + +static void CoordEventWeather_Drought(void) +{ + SetWeather(WEATHER_DROUGHT); +} + +static void CoordEventWeather_Route119Cycle(void) +{ + SetWeather(WEATHER_ROUTE119_CYCLE); +} + +static void CoordEventWeather_Route123Cycle(void) +{ + SetWeather(WEATHER_ROUTE123_CYCLE); +} + +void DoCoordEventWeather(u8 coordEventWeather) +{ + u8 i; + for (i = 0; i < ARRAY_COUNT(sCoordEventWeatherFuncs); i++) + { + if (sCoordEventWeatherFuncs[i].coordEventWeather == coordEventWeather) + { + sCoordEventWeatherFuncs[i].func(); + return; + } + } +} diff --git a/src/decoration.c b/src/decoration.c index 3bff5208e..753854bc0 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -500,7 +500,7 @@ void sub_8126B80(u8 taskId) void sub_8126C08(void) { FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParametrized(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3); + AddTextPrinterParameterized(0, 1, sSecretBasePCMenuItemDescriptions[sSecretBasePCMenuCursorPos], 0, 0, 2, 1, 3); } void SecretBasePC_Decorate(u8 taskId) @@ -529,7 +529,7 @@ void SecretBasePC_PutAway(u8 taskId) { sub_8126A58(0); sub_8197434(0, 0); - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_8129ABC; } @@ -1247,7 +1247,7 @@ void sub_8127F68(u8 taskId) { if (sub_8127F38() == TRUE) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_8128060; } @@ -1661,7 +1661,7 @@ void sub_8128BA0(u8 taskId) void sub_8128BBC(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = c1_overworld_prev_quest; } @@ -2635,7 +2635,7 @@ void sub_812A1A0(u8 taskId) void sub_812A1C0(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_81298EC; } @@ -2654,7 +2654,7 @@ void sub_812A210(u8 taskId) void sub_812A22C(u8 taskId) { - fade_screen(1, 0); + FadeScreen(1, 0); gTasks[taskId].data[2] = 0; gTasks[taskId].func = sub_812A25C; } diff --git a/src/diploma.c b/src/diploma.c index fedc10bd0..89447c5ba 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -3,7 +3,7 @@ #include "palette.h" #include "main.h" #include "gpu_regs.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "task.h" #include "malloc.h" #include "decompress.h" @@ -17,7 +17,7 @@ extern int decompress_and_copy_tile_data_to_vram(u8 bg_id, void *src, int size, extern bool8 free_temp_tile_data_buffers_if_possible(void); extern void sub_80861E8(void); // rom4 extern bool16 sub_80C0944(void); -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, u8 *str); +extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, u8 *str); extern u16 gUnknown_0860F074[]; @@ -215,5 +215,5 @@ static void PrintDiplomaText(u8 *text, u8 var1, u8 var2) .shadowColor = 3, }; - AddTextPrinterParametrized2(0, 1, var1, var2, 0, 0, &color, -1, text); + AddTextPrinterParameterized2(0, 1, var1, var2, 0, 0, &color, -1, text); } diff --git a/src/egg_hatch.c b/src/egg_hatch.c index b3cd88585..e262a8281 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -60,7 +60,7 @@ extern const u8 gText_NickHatchPrompt[]; extern u8 sav1_map_get_name(void); extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8); extern void sub_806A068(u16, u8); -extern void fade_screen(u8, u8); +extern void FadeScreen(u8, u8); extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); extern void ScanlineEffect_Stop(void); @@ -459,7 +459,7 @@ void EggHatch(void) { ScriptContext2_Enable(); CreateTask(Task_EggHatch, 10); - fade_screen(1, 0); + FadeScreen(1, 0); } static void Task_EggHatch(u8 taskID) @@ -860,7 +860,7 @@ static void EggHatchPrintMessage(u8 windowId, u8* string, u8 x, u8 y, u8 speed) sEggHatchData->textColor.fgColor = 0; sEggHatchData->textColor.bgColor = 5; sEggHatchData->textColor.shadowColor = 6; - AddTextPrinterParametrized2(windowId, 1, x, y, 0, 0, &sEggHatchData->textColor, speed, string); + AddTextPrinterParameterized2(windowId, 1, x, y, 0, 0, &sEggHatchData->textColor, speed, string); } u8 GetEggStepsToSubtract(void) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 2ce788f8e..84ac7cc32 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -11,7 +11,7 @@ #include "pokemon.h" #include "string_util.h" #include "battle.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "decompress.h" #include "m4a.h" #include "menu.h" @@ -1364,7 +1364,7 @@ static void VBlankCB_EvolutionScene(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } static void VBlankCB_TradeEvolutionScene(void) @@ -1381,7 +1381,7 @@ static void VBlankCB_TradeEvolutionScene(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } static void sub_813FDEC(u8 taskId) diff --git a/src/field_map_obj.c b/src/field_map_obj.c index df80494b3..906eff4b7 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -14,7 +14,7 @@ #include "rom_818CFC8.h" #include "rom_81BE66C.h" #include "field_ground_effect.h" -#include "map_obj_8097404.h" +#include "field_map_obj_helpers.h" #include "mauville_old_man.h" #include "metatile_behavior.h" #include "field_effect.h" diff --git a/src/field_map_obj_helpers.c b/src/field_map_obj_helpers.c new file mode 100755 index 000000000..1e0e9b66b --- /dev/null +++ b/src/field_map_obj_helpers.c @@ -0,0 +1,844 @@ +#include "global.h" +#include "field_ground_effect.h" +#include "field_map_obj.h" +#include "field_effect.h" +#include "field_map_obj_helpers.h" +#include "malloc.h" +#include "task.h" +#include "util.h" + +typedef void (*SpriteStepFunc)(struct Sprite *sprite, u8 dir); + +extern const struct Coords16 gUnknown_0850DB7C[4]; +extern s16 gUnknown_0850E768[]; +extern SpriteStepFunc *const gUnknown_0850E754[]; +extern const s8 gUnknown_0850E772[]; +extern const s8 gUnknown_0850E7BA[]; +extern const s8 *const gUnknown_0850E834[]; +extern s16 gUnknown_0850E840[]; +extern u8 gUnknown_0850E846[]; +extern s16 gUnknown_0850E84A[]; +extern u8 gUnknown_0850E850[]; + +void sub_8097D68(struct Sprite *sprite); +void sub_8097FE4(u8); + +bool8 FreezeMapObject(struct MapObject *mapObject) +{ + if (mapObject->mapobj_bit_6 || mapObject->mapobj_bit_8) + { + return TRUE; + } + else + { + mapObject->mapobj_bit_8 = 1; + mapObject->mapobj_bit_23 = gSprites[mapObject->spriteId].animPaused; + mapObject->mapobj_bit_24 = gSprites[mapObject->spriteId].affineAnimPaused; + gSprites[mapObject->spriteId].animPaused = 1; + gSprites[mapObject->spriteId].affineAnimPaused = 1; + return FALSE; + } +} + +void FreezeMapObjects(void) +{ + u8 i; + for (i = 0; i < MAP_OBJECTS_COUNT; i++) + if (gMapObjects[i].active && i != gPlayerAvatar.mapObjectId) + FreezeMapObject(&gMapObjects[i]); +} + +void FreezeMapObjectsExceptOne(u8 a1) +{ + u8 i; + for (i = 0; i < MAP_OBJECTS_COUNT; i++) + if (i != a1 && gMapObjects[i].active && i != gPlayerAvatar.mapObjectId) + FreezeMapObject(&gMapObjects[i]); +} + +void npc_sync_anim_pause_bits(struct MapObject *mapObject) +{ + if (mapObject->active && mapObject->mapobj_bit_8) + { + mapObject->mapobj_bit_8 = 0; + gSprites[mapObject->spriteId].animPaused = mapObject->mapobj_bit_23; + gSprites[mapObject->spriteId].affineAnimPaused = mapObject->mapobj_bit_24; + } +} + +void UnfreezeMapObjects(void) +{ + u8 i; + for (i = 0; i < MAP_OBJECTS_COUNT; i++) + if (gMapObjects[i].active) + npc_sync_anim_pause_bits(&gMapObjects[i]); +} + +void little_step(struct Sprite *sprite, u8 dir) +{ + sprite->pos1.x += gUnknown_0850DB7C[dir].x; + sprite->pos1.y += gUnknown_0850DB7C[dir].y; +} + +void double_little_steps(struct Sprite *sprite, u8 dir) +{ + sprite->pos1.x += 2 * (u16) gUnknown_0850DB7C[dir].x; + sprite->pos1.y += 2 * (u16) gUnknown_0850DB7C[dir].y; +} + +void triple_little_steps(struct Sprite *sprite, u8 dir) +{ + sprite->pos1.x += 2 * (u16) gUnknown_0850DB7C[dir].x + (u16) gUnknown_0850DB7C[dir].x; + sprite->pos1.y += 2 * (u16) gUnknown_0850DB7C[dir].y + (u16) gUnknown_0850DB7C[dir].y; +} + +void quad_little_steps(struct Sprite *sprite, u8 dir) +{ + sprite->pos1.x += 4 * (u16) gUnknown_0850DB7C[dir].x; + sprite->pos1.y += 4 * (u16) gUnknown_0850DB7C[dir].y; +} + +void oct_little_steps(struct Sprite *sprite, u8 dir) +{ + sprite->pos1.x += 8 * (u16) gUnknown_0850DB7C[dir].x; + sprite->pos1.y += 8 * (u16) gUnknown_0850DB7C[dir].y; +} + +void oamt_npc_ministep_reset(struct Sprite *sprite, u8 a2, u8 a3) +{ + sprite->data[3] = a2; + sprite->data[4] = a3; + sprite->data[5] = 0; +} + +bool8 obj_npc_ministep(struct Sprite *sprite) +{ + if (sprite->data[5] >= gUnknown_0850E768[sprite->data[4]]) + return FALSE; + + gUnknown_0850E754[sprite->data[4]][sprite->data[5]](sprite, sprite->data[3]); + + sprite->data[5]++; + + if (sprite->data[5] < gUnknown_0850E768[sprite->data[4]]) + return FALSE; + + return TRUE; +} + +void sub_80976DC(struct Sprite *sprite, u8 a2) +{ + sprite->data[3] = a2; + sprite->data[4] = 0; + sprite->data[5] = 0; +} + +bool8 sub_80976EC(struct Sprite *sprite) +{ + if (!(sprite->data[4] & 1)) + { + little_step(sprite, sprite->data[3]); + sprite->data[5]++; + } + + sprite->data[4]++; + + if (sprite->data[5] > 15) + return TRUE; + else + return FALSE; +} + +// new helper added here in the middle. Perhaps Game Freak kept these organized in alphebetical order or some other heirarchy? + +s16 sub_8097728(s16 a1) +{ + return gUnknown_0850E7BA[a1]; +} + +s16 sub_809773C(s16 a1) +{ + return gUnknown_0850E772[a1]; +} + +void sub_8097750(struct Sprite *sprite) +{ + sprite->data[6] = 0; + sprite->data[7] = 0; +} + +bool8 sub_8097758(struct Sprite *sprite) +{ + bool8 result = FALSE; + + switch(sprite->data[7]) + { + case 0: + sprite->pos2.x += sub_809773C(sprite->data[6]); + sprite->pos2.y += sub_8097728(sprite->data[6]); + break; + case 1: + sprite->pos2.x -= sub_809773C(0x47 - sprite->data[6]); + sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); + break; + case 2: + sprite->pos2.x -= sub_809773C(sprite->data[6]); + sprite->pos2.y += sub_8097728(sprite->data[6]); + break; + case 3: + sprite->pos2.x += sub_809773C(0x47 - sprite->data[6]); + sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]); + break; + } + if(++sprite->data[6] == 0x48) + { + sprite->data[6] = 0; + sprite->data[7]++; + } + if(sprite->data[7] == 0x4) + { + sprite->pos2.y = 0; + sprite->pos2.x = 0; + result = TRUE; + } + return result; +} + +s16 sub_8097820(s16 a1, u8 a2) +{ + return gUnknown_0850E834[a2][a1]; +} + +void sub_809783C(struct Sprite *sprite, u8 a2, u8 a3, u8 a4) +{ + sprite->data[3] = a2; + sprite->data[4] = a3; + sprite->data[5] = a4; + sprite->data[6] = 0; +} + +u8 sub_809785C(struct Sprite *sprite) +{ + s16 v5[3]; + u8 v6[3]; + u8 v2; + + memcpy(v5, gUnknown_0850E840, 6); // TODO: get rid of memcpy + memcpy(v6, gUnknown_0850E846, 3); + v2 = 0; + + if (sprite->data[4]) + little_step(sprite, sprite->data[3]); + + sprite->pos2.y = sub_8097820(sprite->data[6] >> v6[sprite->data[4]], sprite->data[5]); + + sprite->data[6]++; + + if (sprite->data[6] == (v5[sprite->data[4]] >> 1)) + v2 = 1; + + if (sprite->data[6] >= v5[sprite->data[4]]) + { + sprite->pos2.y = 0; + v2 = -1; + } + + return v2; +} + +u8 sub_80978E4(struct Sprite *sprite) +{ + s16 v5[3]; + u8 v6[3]; + u8 v2; + + memcpy(v5, gUnknown_0850E84A, 6); + memcpy(v6, gUnknown_0850E850, 3); + v2 = 0; + + if (sprite->data[4] && !(sprite->data[6] & 1)) + little_step(sprite, sprite->data[3]); + + sprite->pos2.y = sub_8097820(sprite->data[6] >> v6[sprite->data[4]], sprite->data[5]); + + sprite->data[6]++; + + if (sprite->data[6] == (v5[sprite->data[4]] >> 1)) + v2 = 1; + + if (sprite->data[6] >= v5[sprite->data[4]]) + { + sprite->pos2.y = 0; + v2 = -1; + } + + return v2; +} + +void SetFieldObjectStepTimer(struct Sprite *sprite, u16 timer) +{ + sprite->data[3] = timer; +} + + +bool8 RunFieldObjectStepTimer(struct Sprite *sprite) +{ + sprite->data[3]--; + + if (sprite->data[3] == 0) + return TRUE; + else + return FALSE; +} + +void obj_anim_image_set_and_seek(struct Sprite *sprite, u8 a2, u8 a3) +{ + sprite->animNum = a2; + sprite->animPaused = 0 ; + SeekSpriteAnim(sprite, a3); +} + +bool8 sub_80979BC(struct Sprite *sprite) +{ + if (sprite->animEnded) + return TRUE; + else + return FALSE; +} + +void sub_80979D4(struct Sprite *sprite, bool8 invisible) +{ + u16 x, y; + s16 x2, y2; + + sprite->invisible = invisible; + + if (sprite->coordOffsetEnabled) + { + x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX; + y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY; + } + else + { + x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX; + y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY; + } + + x2 = x - (sprite->centerToCornerVecX >> 1); + y2 = y - (sprite->centerToCornerVecY >> 1); + + if ((s16)x > 255 || x2 < -16) + sprite->invisible = 1; + if ((s16)y > 175 || y2 < -16) + sprite->invisible = 1; +} + +void sub_8097AC8(struct Sprite *sprite) +{ + sub_8097D68(sprite); + SetObjectSubpriorityByZCoord(sprite->data[1], sprite, 1); + sub_80979D4(sprite, sprite->data[2]); +} + +void sub_8097AF0(void) +{ + int i; + + for(i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + if(sprite->inUse && sprite->callback == sub_8097AC8) + DestroySprite(sprite); + } +} + +int sub_8097B2C(u8 var) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end. +{ + int i; + + for(i = 0; i < MAX_SPRITES; i++) + { + struct Sprite *sprite = &gSprites[i]; + if(sprite->inUse && sprite->callback == sub_8097AC8 && (u8)sprite->data[0] == var) + return i; + } + return MAX_SPRITES; +} + +void sub_8097B78(u8 var1, u8 var2) +{ + u8 spriteId = sub_8097B2C(var1); + + if(spriteId != MAX_SPRITES) + StartSpriteAnim(&gSprites[spriteId], FieldObjectDirectionToImageAnimId(var2)); +} + +void sub_8097BB4(u8 var1, u8 var2) +{ + int spriteId = sub_8097B2C(var1); + + if(spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + const struct MapObjectGraphicsInfo *gfxInfo = GetFieldObjectGraphicsInfo(var2); + u16 tileNum = sprite->oam.tileNum; + + sprite->oam = *gfxInfo->oam; + sprite->oam.tileNum = tileNum; + sprite->oam.paletteNum = gfxInfo->paletteSlot; + sprite->images = gfxInfo->images; + + if(gfxInfo->subspriteTables == NULL) + { + sprite->subspriteTables = NULL; + sprite->subspriteTableNum = 0; + sprite->subspriteMode = 0; + } + else + { + SetSubspriteTables(sprite, gfxInfo->subspriteTables); + sprite->subspriteMode = 2; + } + StartSpriteAnim(sprite, 0); + } +} + +void sub_8097C44(u8 var, bool32 var2) +{ + u8 spriteId = sub_8097B2C(var); + + if(spriteId == MAX_SPRITES) + return; + + if(var2) + gSprites[spriteId].data[2] = 1; + else + gSprites[spriteId].data[2] = 0; +} + +bool32 sub_8097C8C(u8 var) +{ + u8 spriteId = sub_8097B2C(var); + + if(spriteId == MAX_SPRITES) + return FALSE; + + return (gSprites[spriteId].data[2] == TRUE); +} + +void sub_8097CC4(u8 var1, u8 var2) +{ + u8 spriteId = sub_8097B2C(var1); + + if(spriteId != MAX_SPRITES) + { + gSprites[spriteId].data[3] = var2; + gSprites[spriteId].data[4] = 0; + } +} + +void sub_8097CF4(struct Sprite *sprite) +{ + switch(sprite->data[4]) + { + case 0: + sprite->pos2.y = 0; + sprite->data[4]++; + case 1: + sprite->pos2.y -= 8; + if(sprite->pos2.y == -160) + { + sprite->pos2.y = 0; + sprite->data[2] = 1; + sprite->data[3] = 0; + sprite->data[4] = 0; + } + } +} + +void sub_8097D30(struct Sprite *sprite) +{ + switch(sprite->data[4]) + { + case 0: + sprite->pos2.y = -160; + sprite->data[4]++; + case 1: + sprite->pos2.y += 8; + if(sprite->pos2.y == 0) + { + sprite->data[3] = 0; + sprite->data[4] = 0; + } + } +} + +void sub_8097D68(struct Sprite *sprite) +{ + switch(sprite->data[3]) + { + case 1: + sub_8097D30(sprite); + break; + case 2: + sub_8097CF4(sprite); + break; + case 0: + break; + default: + sprite->data[3] = 0; + break; + } +} + +bool32 sub_8097D9C(u8 var) +{ + u8 spriteId = sub_8097B2C(var); + + if(spriteId == MAX_SPRITES) + return FALSE; + + if(gSprites[spriteId].data[3] != FALSE) + return TRUE; + + return FALSE; +} + +u32 oe_exec_and_other_stuff(u8 fieldEffectId, struct MapObject *mapObject) +{ + FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]); + return FieldEffectStart(fieldEffectId); +} + +void DoShadowFieldEffect(struct MapObject *mapObject) +{ + if (!mapObject->mapobj_bit_22) + { + mapObject->mapobj_bit_22 = 1; + oe_exec_and_other_stuff(FLDEFF_SHADOW, mapObject); + } +} + +void DoRippleFieldEffect(struct MapObject *mapObject, struct Sprite *sprite) +{ + const struct MapObjectGraphicsInfo *gfxInfo = GetFieldObjectGraphicsInfo(mapObject->graphicsId); + gFieldEffectArguments[0] = sprite->pos1.x; + gFieldEffectArguments[1] = sprite->pos1.y + (gfxInfo->height >> 1) - 2; + gFieldEffectArguments[2] = 151; + gFieldEffectArguments[3] = 3; + FieldEffectStart(FLDEFF_RIPPLE); +} + +#ifdef NONMATCHING +bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite) +{ + bool32 ableToStore = FALSE; + if (gUnknown_020375B8 == NULL) + { + gUnknown_020375B8 = AllocZeroed(0x14); + gUnknown_020375B8[0] = mapObject->localId; + gUnknown_020375B8[16] = 1; + ableToStore = TRUE; + } + else + { + u8 i; + u8 firstFreeSlot; + bool32 found; + for (firstFreeSlot = 16, found = FALSE, i = 0; i < 16; i++) + { + if (firstFreeSlot == 16 && gUnknown_020375B8[i] == 0) + firstFreeSlot = i; + + if (gUnknown_020375B8[i] == mapObject->localId) + { + found = TRUE; + break; + } + } + + if (!found && firstFreeSlot != 16) + { + gUnknown_020375B8[firstFreeSlot] = mapObject->localId; + gUnknown_020375B8[16]++; + ableToStore = TRUE; // the nonmatching problem is that ableToStore == TRUE isnt being merged with the above ableToStore = TRUE assignment. + } + } + + if (ableToStore == TRUE) + { + mapObject->mapobj_bit_12 = TRUE; + mapObject->mapobj_bit_9 = TRUE; + } + + sprite->data[2] = 1; + return TRUE; +} +#else +__attribute__((naked)) +bool32 sub_8097E50(struct MapObject *mapObject, struct Sprite *sprite) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + adds r4, r0, 0\n\ + mov r8, r1\n\ + movs r0, 0\n\ + mov r12, r0\n\ + ldr r0, =gUnknown_020375B8\n\ + ldr r1, [r0]\n\ + adds r6, r0, 0\n\ + cmp r1, 0\n\ + bne _08097E80\n\ + movs r0, 0x14\n\ + bl AllocZeroed\n\ + str r0, [r6]\n\ + ldrb r1, [r4, 0x8]\n\ + strb r1, [r0]\n\ + ldr r1, [r6]\n\ + movs r0, 0x1\n\ + strb r0, [r1, 0x10]\n\ + b _08097ECC\n\ + .pool\n\ +_08097E80:\n\ + movs r2, 0x10\n\ + movs r5, 0\n\ + movs r1, 0\n\ + adds r3, r6, 0\n\ + b _08097E90\n\ +_08097E8A:\n\ + adds r0, r1, 0x1\n\ + lsls r0, 24\n\ + lsrs r1, r0, 24\n\ +_08097E90:\n\ + cmp r1, 0xF\n\ + bhi _08097EB2\n\ + cmp r2, 0x10\n\ + bne _08097EA4\n\ + ldr r0, [r3]\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _08097EA4\n\ + adds r2, r1, 0\n\ +_08097EA4:\n\ + ldr r0, [r3]\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + ldrb r7, [r4, 0x8]\n\ + cmp r0, r7\n\ + bne _08097E8A\n\ + movs r5, 0x1\n\ +_08097EB2:\n\ + cmp r5, 0\n\ + bne _08097ECE\n\ + cmp r2, 0x10\n\ + beq _08097ECE\n\ + ldr r0, [r6]\n\ + adds r0, r2\n\ + ldrb r1, [r4, 0x8]\n\ + strb r1, [r0]\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1, 0x10]\n\ + adds r0, 0x1\n\ + strb r0, [r1, 0x10]\n\ + movs r0, 0x1\n\ +_08097ECC:\n\ + mov r12, r0\n\ +_08097ECE:\n\ + mov r1, r12\n\ + cmp r1, 0x1\n\ + bne _08097EE0\n\ + ldrb r0, [r4, 0x1]\n\ + movs r1, 0x10\n\ + orrs r0, r1\n\ + movs r1, 0x2\n\ + orrs r0, r1\n\ + strb r0, [r4, 0x1]\n\ +_08097EE0:\n\ + movs r0, 0x1\n\ + mov r7, r8\n\ + strh r0, [r7, 0x32]\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .syntax divided"); +} +#endif + +// this function is very similar to the above one and I don't want to decompile this one until the above is matching. +__attribute__((naked)) +bool32 sub_8097EF0(struct MapObject *mapObject, struct Sprite *sprite) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + adds r6, r0, 0\n\ + mov r8, r1\n\ + movs r0, 0x1\n\ + strh r0, [r1, 0x32]\n\ + ldr r5, =gUnknown_020375B8\n\ + ldr r0, [r5]\n\ + cmp r0, 0\n\ + beq _08097F68\n\ + movs r7, 0\n\ + adds r0, r6, 0\n\ + bl sub_8097F78\n\ + lsls r0, 24\n\ + lsrs r1, r0, 24\n\ + cmp r1, 0x10\n\ + beq _08097F28\n\ + ldr r0, [r5]\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r1, [r5]\n\ + ldrb r0, [r1, 0x10]\n\ + subs r0, 0x1\n\ + strb r0, [r1, 0x10]\n\ + movs r7, 0x1\n\ +_08097F28:\n\ + ldr r0, [r5]\n\ + ldrb r4, [r0, 0x10]\n\ + cmp r4, 0\n\ + bne _08097F36\n\ + bl Free\n\ + str r4, [r5]\n\ +_08097F36:\n\ + cmp r7, 0x1\n\ + bne _08097F68\n\ + ldrb r0, [r6, 0x5]\n\ + bl GetFieldObjectGraphicsInfo\n\ + ldrb r1, [r0, 0xC]\n\ + lsls r1, 25\n\ + lsrs r1, 31\n\ + lsls r1, 4\n\ + ldrb r2, [r6, 0x1]\n\ + movs r0, 0x11\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + movs r1, 0x3\n\ + negs r1, r1\n\ + ands r0, r1\n\ + strb r0, [r6, 0x1]\n\ + mov r2, r8\n\ + adds r2, 0x2C\n\ + ldrb r1, [r2]\n\ + movs r0, 0x41\n\ + negs r0, r0\n\ + ands r0, r1\n\ + strb r0, [r2]\n\ +_08097F68:\n\ + movs r0, 0x1\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n\ + .syntax divided"); +} + +u8 sub_8097F78(struct MapObject *mapObject) +{ + u8 i; + + for(i = 0; i < MAP_OBJECTS_COUNT; i++) + { + if(gUnknown_020375B8[i] == mapObject->localId) + return i; + } + return MAP_OBJECTS_COUNT; +} + +void sub_8097FA4(struct MapObject *mapObject) +{ + u8 taskId = CreateTask(sub_8097FE4, 0xFF); + struct Task *task = &gTasks[taskId]; + + StoreWordInTwoHalfwords(&task->data[0], (u32)mapObject); + mapObject->mapobj_unk_1B = taskId; + task->data[3] = 0xFFFF; +} + +void sub_8097FE4(u8 taskId) +{ + struct MapObject *mapObject; + struct Sprite *sprite; + struct Task *task = &gTasks[taskId]; + + LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&mapObject); // load the map object pointer. + sprite = &gSprites[mapObject->spriteId]; + + if(!(task->data[2] & 0x3)) + sprite->pos2.y += task->data[3]; + + if(!(task->data[2] & 0xF)) + task->data[3] = -task->data[3]; + + task->data[2]++; +} + +void sub_8098044(u8 taskId) +{ + u32 word; + struct Task *task = &gTasks[taskId]; + + LoadWordFromTwoHalfwords(&task->data[0], &word); // huh??? why does it load a word that never gets used??? + DestroyTask(taskId); +} + +void sub_8098074(u8 var1, u8 var2) +{ + u8 i; + + for(i = 0; i < MAP_OBJECTS_COUNT; i++) + { + if(i != var1 && i != var2 && + gMapObjects[i].active && i != gPlayerAvatar.mapObjectId) + FreezeMapObject(&gMapObjects[i]); + } +} + +bool32 sub_80980C0(struct MapObject *mapObject, struct Sprite *sprite) +{ + sprite->pos2.y = 0; + sprite->data[2]++; + return FALSE; +} + +bool32 sub_80980D0(struct MapObject *mapObject, struct Sprite *sprite) +{ + sprite->pos2.y -= 8; + + if(sprite->pos2.y == -160) + sprite->data[2]++; + return FALSE; +} + +bool32 sub_80980F4(struct MapObject *mapObject, struct Sprite *sprite) +{ + sprite->pos2.y = -160; + sprite->data[2]++; + return FALSE; +} + +bool32 sub_8098108(struct MapObject *mapObject, struct Sprite *sprite) +{ + sprite->pos2.y += 8; + + if(!sprite->pos2.y) + sprite->data[2]++; + return FALSE; +} + +// though this function returns TRUE without doing anything, this header is required due to being in an array of functions which needs it. +bool32 sub_8098124(struct MapObject *mapObject, struct Sprite *sprite) +{ + return TRUE; +} diff --git a/src/field_message_box.c b/src/field_message_box.c new file mode 100755 index 000000000..9570040eb --- /dev/null +++ b/src/field_message_box.c @@ -0,0 +1,154 @@ +#include "global.h" +#include "new_menu_helpers.h" +#include "string.h" +#include "string_util.h" +#include "task.h" +#include "text.h" + +EWRAM_DATA u8 gUnknown_020375BC = 0; + +void textbox_fdecode_auto_and_task_add(u8*, int); +void textbox_auto_and_task_add(void); + +void sub_8098128(void) +{ + gUnknown_020375BC = 0; + gTextFlags.flag_0 = 0; + gTextFlags.flag_1 = 0; + gTextFlags.flag_2 = 0; + gTextFlags.flag_3 = 0; +} + +void sub_8098154(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + sub_81973A4(); + task->data[0]++; + break; + case 1: + sub_81973C4(0, 1); + task->data[0]++; + break; + case 2: + if (sub_8197224() != 1) + { + gUnknown_020375BC = 0; + DestroyTask(taskId); + } + } +} + +void task_add_textbox(void) +{ + CreateTask(sub_8098154, 0x50); +} + +void task_del_textbox(void) +{ + u8 taskId = FindTaskIdByFunc(sub_8098154); + if (taskId != 0xFF) + DestroyTask(taskId); +} + +bool8 ShowFieldMessage(u8 *str) +{ + if (gUnknown_020375BC != 0) + return FALSE; + textbox_fdecode_auto_and_task_add(str, 1); + gUnknown_020375BC = 2; + return TRUE; +} + +void sub_8098214(u8 taskId) +{ + if (sub_8196094() == 0) + { + gUnknown_020375BC = 0; + DestroyTask(taskId); + } +} + +bool8 sub_8098238(u8 *str) +{ + if (gUnknown_020375BC != 0) + return FALSE; + StringExpandPlaceholders(gStringVar4, str); + CreateTask(sub_8098214, 0); + sub_8196080(str); + gUnknown_020375BC = 2; + return TRUE; +} + +bool8 ShowFieldAutoScrollMessage(u8 *str) +{ + if (gUnknown_020375BC != 0) + return FALSE; + gUnknown_020375BC = 3; + textbox_fdecode_auto_and_task_add(str, 0); + return TRUE; +} + +bool8 sub_80982A0(u8 *str) +{ + gUnknown_020375BC = 3; + textbox_fdecode_auto_and_task_add(str, 1); + return TRUE; +} + +bool8 sub_80982B8(void) +{ + if (gUnknown_020375BC != 0) + return FALSE; + gUnknown_020375BC = 2; + textbox_auto_and_task_add(); + return TRUE; +} + +void textbox_fdecode_auto_and_task_add(u8* str, int a) +{ + StringExpandPlaceholders(gStringVar4, str); + AddTextPrinterForMessage(a); + task_add_textbox(); +} + +void textbox_auto_and_task_add(void) +{ + AddTextPrinterForMessage(1); + task_add_textbox(); +} + +void HideFieldMessageBox(void) +{ + task_del_textbox(); + sub_8197434(0, 1); + gUnknown_020375BC = 0; +} + +u8 textbox_any_visible(void) +{ + return gUnknown_020375BC; +} + +bool8 IsFieldMessageBoxHidden(void) +{ + if (gUnknown_020375BC == 0) + return TRUE; + return FALSE; +} + +void sub_8098358(void) +{ + task_del_textbox(); + sub_81973FC(0, 1); + gUnknown_020375BC = 0; +} + +void sub_8098374(void) +{ + task_del_textbox(); + gUnknown_020375BC = 0; +} diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 3e70e22fa..e7caf9316 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -20,11 +20,12 @@ #include "string_util.h" #include "m4a.h" #include "international_string_util.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "trig.h" #include "random.h" #include "event_data.h" #include "overworld.h" +#include "new_menu_helpers.h" struct HallofFameMon { @@ -53,7 +54,6 @@ static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL; extern bool8 gHasHallOfFameRecords; extern u32 gUnknown_0203BCD4; -extern u8 gDecompressionBuffer[]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern MainCallback gGameContinueCallback; extern u32 gDamagedSaveSectors; @@ -82,7 +82,6 @@ extern const u8 gContestConfetti_Gfx[]; extern const u8 gContestConfetti_Pal[]; extern void sub_81973C4(u8, u8); -extern u16 AddTextPrinterParametrized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); extern void sub_8175620(void); extern u8 TrySavingData(u8); extern u8 sub_818D3E4(u16 species, u32 trainerId, u32 personality, u8 flags, s16 x, s16 y, u8, u16); @@ -540,7 +539,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) *lastSavedTeam = *sHofMonPtr; sub_81973C4(0, 0); - AddTextPrinterParametrized(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_TrySaveData; } @@ -747,7 +746,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId) FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); HallOfFame_PrintPlayerInfo(1, 2); sub_81973C4(0, 0); - AddTextPrinterParametrized(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; } @@ -1116,7 +1115,7 @@ static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { sub_8198180(gText_UnkCtrlF800Exit, 8, 1); sub_81973C4(0, 0); - AddTextPrinterParametrized(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3); + AddTextPrinterParameterized(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; } diff --git a/src/item_use.c b/src/item_use.c new file mode 100755 index 000000000..8fe705a50 --- /dev/null +++ b/src/item_use.c @@ -0,0 +1,1271 @@ +#include "global.h" +#include "battle.h" +#include "berry.h" +#include "bike.h" +#include "coins.h" +#include "constants/flags.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "constants/vars.h" +#include "data2.h" +#include "event_data.h" +#include "fieldmap.h" +#include "field_map_obj.h" +#include "field_player_avatar.h" +#include "field_screen.h" +#include "field_weather.h" +#include "item.h" +#include "field_map_obj_helpers.h" +#include "mail.h" +#include "metatile_behavior.h" +#include "overworld.h" +#include "palette.h" +#include "pokemon.h" +#include "rom_818CFC8.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "task.h" +#include "text.h" + +extern u16 gSpecialVar_ItemId; +extern void(**gUnknown_0203CE54)(void); +extern void(**gUnknown_0203CF2C)(void); +extern void(*gUnknown_0203A0F4)(u8 taskId); +extern void(*gUnknown_085920D8[])(void); +extern void (*gUnknown_03006328)(u8, u16, TaskFunc); +extern void unknown_ItemMenu_Confirm(u8 taskId); +extern void sub_81C5B14(u8 taskId); +extern u8 gText_DadsAdvice[]; +extern u8 gText_CantDismountBike[]; +extern void sub_8197434(u8 a, u8 b); +extern void sub_80984F4(void); +extern void ItemUseOutOfBattle_TMHM(u8 a); +extern void ItemUseOutOfBattle_EvolutionStone(u8 b); +extern void bag_menu_mail_related(void); +extern void OpenPokeblockCase(u8 a, void(*b)(void)); +extern void overworld_free_bg_tilemaps(void); +extern bool32 sav1_map_is_biking_allowed(void); +extern bool8 IsPlayerFacingSurfableFishableWater(void); +extern bool8 sub_81221AC(void); +extern u8 gText_ItemFinderNothing[]; +extern u8 gText_ItemFinderNearby[]; +extern u8 gText_ItemFinderOnTop[]; +extern u8 gText_CoinCase[]; +extern u8 gText_PowderQty[]; +extern u8 gUnknown_085920E4[]; +extern u8 Route102_EventScript_274482[]; +extern u8 Route102_EventScript_2744C0[]; +extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; +extern u8 gText_BootedUpHM[]; +extern u8 gText_BootedUpTM[]; +extern u8 gText_TMHMContainedVar1[]; +extern u8 gText_PlayerUsedVar2[]; +extern u8 gText_RepelEffectsLingered[]; +extern u8 gText_UsedVar2WildLured[]; +extern u8 gText_UsedVar2WildRepelled[]; +extern u8 gText_BoxFull[]; +extern u8 gText_WontHaveEffect[]; +extern int sub_80247BC(void); +extern struct MapHeader* mapconnection_get_mapheader(struct MapConnection *connection); +extern void SetUpItemUseCallback(u8 taskId); +extern void ItemUseCB_Medicine(u8, u16, TaskFunc); +extern void sub_81B67C8(u8, u16, TaskFunc); +extern void sub_81B79E8(u8, u16, TaskFunc); +extern void dp05_ether(u8, u16, TaskFunc); +extern void dp05_pp_up(u8, u16, TaskFunc); +extern void dp05_rare_candy(u8, u16, TaskFunc); +extern void sub_81B6DC4(u8, u16, TaskFunc); +extern void sub_81B7C74(u8, u16, TaskFunc); +extern u16 ItemIdToBattleMoveId(u16); +extern void bag_menu_yes_no(u8, u8, void(**)(u8 taskId)); +extern void (*gUnknown_085920E8[])(u8 taskId); +extern void sub_81C5924(void); +extern void sub_81C59BC(void); +extern void sub_81AB9A8(u8); +extern void sub_81ABA88(u8); +extern void sub_80B7CC8(void); +extern void flagmods_08054D70(void); +extern u8* sub_806CF78(u16); +extern bool8 ExecuteTableBasedItemEffect_(struct Pokemon*, u16, u8, u8); +extern u8 gBankInMenu; +extern u16 gBattlePartyID[]; +extern void sub_81B89F0(void); +extern u8 GetItemEffectType(u16); + +void MapPostLoadHook_UseItem(void); +extern void sub_80AF6D4(void); +void Task_CallItemUseOnFieldCallback(u8 taskId); +void bag_menu_inits_lists_menu(u8 taskId); +void ItemUseOnFieldCB_Bike(u8 taskId); +void ItemUseOnFieldCB_Rod(u8 taskId); +void ItemUseOnFieldCB_Itemfinder(u8 taskId); +void sub_80FD504(u8 taskId); +void sub_80FD5CC(u8 taskId); +void sub_80FDA94(u8 taskId); +void sub_80FDADC(u8 taskId); +void sub_80FD7C8(u8 taskId); +void sub_80FDC00(u8 taskId); +void sub_80FDD74(u8 taskId); +void sub_80FDE08(u8 taskId); +void sub_80FDE7C(u8 taskId); +void sub_80FDF90(u8 taskId); +void task08_0809AD8C(u8 taskId); +void sub_80FE024(u8 taskId); +void sub_80FE124(u8 taskId); +void sub_80FE164(u8 taskId); + +void DisplayItemMessage(u8 taskId, u8 a, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId)); +void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId)); +void sub_81C6714(u8 taskId); +void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId); +void StartFishing(u8 a); +bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8); +u8 sub_80FD9B0(s16 a, s16 b); +void sub_80FDA24(u8 a); +void sub_80FD8E0(u8 taskId, s16 x, s16 y); +void sub_80FDBEC(void); +bool8 sub_80FDE2C(void); +void ItemUseOutOfBattle_CannotUse(u8 taskId); + +void SetUpItemUseCallback(u8 taskId) +{ + u8 type; + if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY) + type = gTasks[taskId].data[4] - 1; + else + type = ItemId_GetType(gSpecialVar_ItemId) - 1; + if (!InBattlePyramid()) + { + *gUnknown_0203CE54 = gUnknown_085920D8[type]; + unknown_ItemMenu_Confirm(taskId); + } + else + { + *gUnknown_0203CF2C = gUnknown_085920D8[type]; + sub_81C5B14(taskId); + } +} + +void SetUpItemUseOnFieldCallback(u8 taskId) +{ + if (gTasks[taskId].data[3] != 1) + { + gFieldCallback = MapPostLoadHook_UseItem; + SetUpItemUseCallback(taskId); + } + else + gUnknown_0203A0F4(taskId); +} + +void MapPostLoadHook_UseItem(void) +{ + pal_fill_black(); + CreateTask(Task_CallItemUseOnFieldCallback, 8); +} + +void Task_CallItemUseOnFieldCallback(u8 taskId) +{ + if (sub_80ABDFC() == 1) + gUnknown_0203A0F4(taskId); +} + +void DisplayCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField, const u8 *str) +{ + StringExpandPlaceholders(gStringVar4, str); + if (!isUsingRegisteredKeyItemOnField) + { + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, sub_81C6714); + } + else + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); +} + +void DisplayDadsAdviceCannotUseItemMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) +{ + DisplayCannotUseItemMessage(taskId, isUsingRegisteredKeyItemOnField, gText_DadsAdvice); +} + +void DisplayCannotDismountBikeMessage(u8 taskId, bool8 isUsingRegisteredKeyItemOnField) +{ + DisplayCannotUseItemMessage(taskId, isUsingRegisteredKeyItemOnField, gText_CantDismountBike); +} + +void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId) +{ + sub_8197434(0, 1); + DestroyTask(taskId); + sub_80984F4(); + ScriptContext2_Disable(); +} + +u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId) +{ + if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_TMHM) + return 1; + else if (ItemId_GetFieldFunc(itemId) == ItemUseOutOfBattle_EvolutionStone) + return 2; + else + return 0; +} + +void sub_80FD254() +{ + struct MailStruct mail; + mail.itemId = gSpecialVar_ItemId; + ReadMail(&mail, bag_menu_mail_related, 0); +} + +void ItemUseOutOfBattle_Mail(u8 taskId) +{ + *gUnknown_0203CE54 = sub_80FD254; + unknown_ItemMenu_Confirm(taskId); +} + +void ItemUseOutOfBattle_Bike(u8 taskId) +{ + s16* data = gTasks[taskId].data; + s16 coordsY; + s16 coordsX; + u8 behavior; + PlayerGetDestCoords(&coordsX, &coordsY); + behavior = MapGridGetMetatileBehaviorAt(coordsX, coordsY); + if (FlagGet(FLAG_SYS_CYCLING_ROAD) == TRUE || MetatileBehavior_IsVerticalRail(behavior) == TRUE || MetatileBehavior_IsHorizontalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedVerticalRail(behavior) == TRUE || MetatileBehavior_IsIsolatedHorizontalRail(behavior) == TRUE) + DisplayCannotDismountBikeMessage(taskId, data[3]); + else + { + if (sav1_map_is_biking_allowed() == TRUE && IsBikingDisallowedByPlayer() == 0) + { + gUnknown_0203A0F4 = ItemUseOnFieldCB_Bike; + SetUpItemUseOnFieldCallback(taskId); + } + else + DisplayDadsAdviceCannotUseItemMessage(taskId, data[3]); + } +} + +void ItemUseOnFieldCB_Bike(u8 taskId) +{ + if (!ItemId_GetSecondaryId(gSpecialVar_ItemId)) + GetOnOffBike(2); + else + GetOnOffBike(4); + sub_80984F4(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +bool32 CanFish() +{ + s16 x, y; + u16 tileBehavior; + + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + tileBehavior = MapGridGetMetatileBehaviorAt(x, y); + + if (MetatileBehavior_IsWaterfall(tileBehavior)) + return FALSE; + + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) + return FALSE; + + if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + { + if (IsPlayerFacingSurfableFishableWater()) + return TRUE; + } + else + { + if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior) && !MapGridIsImpassableAt(x, y)) + return TRUE; + if (MetatileBehavior_8089510(tileBehavior) == TRUE) + return TRUE; + } + + return FALSE; +} + +void ItemUseOutOfBattle_Rod(u8 taskId) +{ + if (CanFish() == TRUE) + { + gUnknown_0203A0F4 = ItemUseOnFieldCB_Rod; + SetUpItemUseOnFieldCallback(taskId); + } + else + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); +} + +void ItemUseOnFieldCB_Rod(u8 taskId) +{ + StartFishing(ItemId_GetSecondaryId(gSpecialVar_ItemId)); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_Itemfinder(u8 var) +{ + IncrementGameStat(0x27); + gUnknown_0203A0F4 = ItemUseOnFieldCB_Itemfinder; + SetUpItemUseOnFieldCallback(var); +} + +void ItemUseOnFieldCB_Itemfinder(u8 taskId) +{ + if (ItemfinderCheckForHiddenItems(gMapHeader.events, taskId) == TRUE) + gTasks[taskId].func = sub_80FD504; + else + DisplayItemMessageOnField(taskId, gText_ItemFinderNothing, sub_80FD5CC); +} + +void sub_80FD504(u8 taskId) +{ + u8 playerDir; + u8 playerDirToItem; + u8 i; + s16* data = gTasks[taskId].data; + if (!data[3]) + { + if (data[4] == 4) + { + playerDirToItem = sub_80FD9B0(data[0], data[1]); + if (playerDirToItem) + { + sub_80FDA24(gUnknown_085920E4[playerDirToItem - 1]); + gTasks[taskId].func = sub_80FDA94; + } + else + { + playerDir = player_get_direction_lower_nybble(); + for (i = 0; i < 4; i++) + { + if (playerDir == gUnknown_085920E4[i]) + data[5] = (i + 1) & 3; + } + gTasks[taskId].func = sub_80FDADC; + data[3] = 0; + data[2] = 0; + } + return; + } + PlaySE(SE_DAUGI); + data[4]++; + } + data[3] = (data[3] + 1) & 0x1F; +} + +void sub_80FD5CC(u8 taskId) +{ + sub_8197434(0, 1); + sub_80984F4(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId) +{ + int distanceX, distanceY; + s16 x, y, i, newDistanceX, newDistanceY; + PlayerGetDestCoords(&x, &y); + gTasks[taskId].data[2] = FALSE; + for (i = 0; i < events->bgEventCount; i++) + { + if (events->bgEvents[i].kind == 7 && !FlagGet(events->bgEvents[i].bgUnion.hiddenItem.hiddenItemId + 0x1F4)) + { + distanceX = (u16)events->bgEvents[i].x + 7; + newDistanceX = distanceX - x; + distanceY = (u16)events->bgEvents[i].y + 7; + newDistanceY = distanceY - y; + + if ((u16)(newDistanceX + 7) < 15 && (newDistanceY >= -5) && (newDistanceY < 6)) + sub_80FD8E0(taskId, newDistanceX, newDistanceY); + } + } + + sub_80FD7C8(taskId); + if (gTasks[taskId].data[2] == TRUE) + return TRUE; + else + return FALSE; +} + +bool8 sub_80FD6D4(struct MapEvents *events, s16 x, s16 y) +{ + u8 bgEventCount = events->bgEventCount; + struct BgEvent *bgEvent = events->bgEvents; + int i; + + for (i = 0; i < bgEventCount; i++) + { + if (bgEvent[i].kind == 7 && x == (u16)bgEvent[i].x && y == (u16)bgEvent[i].y) // hidden item and coordinates matches x and y passed? + { + if (!FlagGet(bgEvent[i].bgUnion.hiddenItem.hiddenItemId + 0x1F4)) + return TRUE; + else + return FALSE; + } + } + return FALSE; +} + +bool8 sub_80FD730(struct MapConnection *connection, int x, int y) +{ + struct MapHeader *mapHeader; + u16 localX, localY; + u32 localOffset; + s32 localLength; + + mapHeader = mapconnection_get_mapheader(connection); + + switch (connection->direction) + { + // same weird temp variable behavior seen in sub_80FD6D4 + case 2: + localOffset = connection->offset + 7; + localX = x - localOffset; + localLength = mapHeader->mapData->height - 7; + localY = localLength + y; // additions are reversed for some reason + break; + case 1: + localOffset = connection->offset + 7; + localX = x - localOffset; + localLength = gMapHeader.mapData->height + 7; + localY = y - localLength; + break; + case 3: + localLength = mapHeader->mapData->width - 7; + localX = localLength + x; // additions are reversed for some reason + localOffset = connection->offset + 7; + localY = y - localOffset; + break; + case 4: + localLength = gMapHeader.mapData->width + 7; + localX = x - localLength; + localOffset = connection->offset + 7; + localY = y - localOffset; + break; + default: + return FALSE; + } + return sub_80FD6D4(mapHeader->events, localX, localY); +} + +// weird math +#ifdef NONMATCHING +void sub_80FD7C8(u8 taskId) +{ + s16 x, y; + s16 curX, curY; + s16 width = gMapHeader.mapData->width + 7; + s16 height = gMapHeader.mapData->height + 7; + + PlayerGetDestCoords(&x, &y); + + for (curX = x - 7; curX <= x + 7; curX++) + { + for (curY = y - 5; curY <= y + 5; curY++) + { + if (7 > curX + || curX >= width + || 7 > curY + || curY >= height) + { + struct MapConnection *conn = sub_8088A8C(curX, curY); + if (conn && sub_80FD730(conn, curX, curY) == TRUE) + sub_80FD8E0(taskId, curX - x, curY - y); + } + } + } +} +#else +__attribute__((naked)) +void sub_80FD7C8(u8 taskId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x14\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x4]\n\ + ldr r0, =gMapHeader\n\ + ldr r1, [r0]\n\ + ldr r0, [r1]\n\ + adds r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0x8]\n\ + ldr r0, [r1, 0x4]\n\ + adds r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0xC]\n\ + mov r4, sp\n\ + adds r4, 0x2\n\ + mov r0, sp\n\ + adds r1, r4, 0\n\ + bl PlayerGetDestCoords\n\ + mov r0, sp\n\ + ldrh r0, [r0]\n\ + subs r0, 0x7\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + asrs r0, 16\n\ + mov r1, sp\n\ + movs r2, 0\n\ + ldrsh r1, [r1, r2]\n\ + adds r1, 0x7\n\ + cmp r0, r1\n\ + bgt _080FD8CC\n\ +_080FD816:\n\ + mov r5, sp\n\ + ldrh r0, [r5, 0x2]\n\ + subs r0, 0x5\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + lsls r2, r4, 16\n\ + asrs r1, r2, 16\n\ + movs r6, 0x2\n\ + ldrsh r0, [r5, r6]\n\ + adds r0, 0x5\n\ + lsls r3, 16\n\ + mov r8, r3\n\ + cmp r1, r0\n\ + bgt _080FD8B6\n\ + movs r0, 0x7\n\ + str r0, [sp, 0x10]\n\ + mov r1, r8\n\ + asrs r1, 16\n\ + mov r9, r1\n\ + mov r10, r0\n\ +_080FD83E:\n\ + ldr r3, [sp, 0x10]\n\ + cmp r3, r9\n\ + bgt _080FD860\n\ + ldr r5, [sp, 0x8]\n\ + lsls r0, r5, 16\n\ + asrs r0, 16\n\ + cmp r9, r0\n\ + bge _080FD860\n\ + asrs r1, r2, 16\n\ + cmp r10, r1\n\ + bgt _080FD860\n\ + ldr r6, [sp, 0xC]\n\ + lsls r0, r6, 16\n\ + asrs r0, 16\n\ + lsls r7, r4, 16\n\ + cmp r1, r0\n\ + blt _080FD89E\n\ +_080FD860:\n\ + mov r0, r8\n\ + asrs r5, r0, 16\n\ + lsls r4, 16\n\ + asrs r6, r4, 16\n\ + adds r0, r5, 0\n\ + adds r1, r6, 0\n\ + bl sub_8088A8C\n\ + adds r7, r4, 0\n\ + cmp r0, 0\n\ + beq _080FD89E\n\ + adds r1, r5, 0\n\ + adds r2, r6, 0\n\ + bl sub_80FD730\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bne _080FD89E\n\ + mov r0, sp\n\ + ldrh r1, [r0]\n\ + subs r1, r5, r1\n\ + lsls r1, 16\n\ + asrs r1, 16\n\ + ldrh r2, [r0, 0x2]\n\ + subs r2, r6, r2\n\ + lsls r2, 16\n\ + asrs r2, 16\n\ + ldr r0, [sp, 0x4]\n\ + bl sub_80FD8E0\n\ +_080FD89E:\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r0, r7, r1\n\ + lsrs r4, r0, 16\n\ + lsls r2, r4, 16\n\ + asrs r1, r2, 16\n\ + mov r3, sp\n\ + movs r5, 0x2\n\ + ldrsh r0, [r3, r5]\n\ + adds r0, 0x5\n\ + cmp r1, r0\n\ + ble _080FD83E\n\ +_080FD8B6:\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + add r1, r8\n\ + lsrs r3, r1, 16\n\ + asrs r1, 16\n\ + mov r0, sp\n\ + movs r6, 0\n\ + ldrsh r0, [r0, r6]\n\ + adds r0, 0x7\n\ + cmp r1, r0\n\ + ble _080FD816\n\ +_080FD8CC:\n\ + add sp, 0x14\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_80FD8E0(u8 taskId, s16 x, s16 y) +{ + s16 *data = gTasks[taskId].data; + s16 var1, var2, var3, var4; + + if (data[2] == FALSE) + { + data[0] = x; + data[1] = y; + data[2] = TRUE; + } + else + { + // data[0] and data[1] contain the player's coordinates. + // x and y contain the item's coordinates. + if (data[0] < 0) + var1 = data[0] * -1; // item is to the left + else + var1 = data[0]; // item is to the right + + if (data[1] < 0) + var2 = data[1] * -1; // item is to the north + else + var2 = data[1]; // item is to the south + + if (x < 0) + var3 = x * -1; + else + var3 = x; + + if (y < 0) + var4 = y * -1; + else + var4 = y; + + if (var1 + var2 > var3 + var4) + { + data[0] = x; + data[1] = y; + } + else + { + if (var1 + var2 == var3 + var4 && (var2 > var4 || (var2 == var4 && data[1] < y))) + { + data[0] = x; + data[1] = y; + } + } + } +} + +u8 sub_80FD9B0(s16 itemX, s16 itemY) +{ + s16 abX, abY; + + if (itemX == 0 && itemY == 0) + return DIR_NONE; // player is standing on the item. + + // get absolute X distance. + if (itemX < 0) + abX = itemX * -1; + else + abX = itemX; + + // get absolute Y distance. + if (itemY < 0) + abY = itemY * -1; + else + abY = itemY; + + if (abX > abY) + { + if (itemX < 0) + return DIR_EAST; + else + return DIR_NORTH; + } + else + { + if (abX < abY) + { + if (itemY < 0) + return DIR_SOUTH; + else + return DIR_WEST; + } + if (abX == abY) + { + if (itemY < 0) + return DIR_SOUTH; + else + return DIR_WEST; + } + return DIR_NONE; // should never get here. return something so it doesnt crash. + } +} + +void sub_80FDA24(u8 direction) +{ + FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + FieldObjectClearAnim(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + npc_sync_anim_pause_bits(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]); + PlayerTurnInPlace(direction); +} + +void sub_80FDA94(u8 taskId) +{ + if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE) + DisplayItemMessageOnField(taskId, gText_ItemFinderNearby, sub_80FD5CC); +} + +void sub_80FDADC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(&gMapObjects[GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0)]) == TRUE + || data[2] == FALSE) + { + sub_80FDA24(gUnknown_085920E4[data[5]]); + data[2] = 1; + data[5] = (data[5] + 1) & 3; + data[3]++; + + if (data[3] == 4) + DisplayItemMessageOnField(taskId, gText_ItemFinderOnTop, sub_80FD5CC); + } +} + +void ItemUseOutOfBattle_PokeblockCase(u8 taskId) +{ + if (sub_81221AC() == TRUE) + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } + else if (gTasks[taskId].data[3] != TRUE) + { + *gUnknown_0203CE54 = sub_80FDBEC; + unknown_ItemMenu_Confirm(taskId); + } + else + { + gFieldCallback = sub_80AF6D4; + FadeScreen(1, 0); + gTasks[taskId].func = sub_80FDC00; + } +} + +void sub_80FDBEC(void) +{ + OpenPokeblockCase(0, bag_menu_mail_related); +} + +void sub_80FDC00(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + OpenPokeblockCase(0, c2_exit_to_overworld_2_switch); + DestroyTask(taskId); + } +} + +void ItemUseOutOfBattle_CoinCase(u8 taskId) +{ + ConvertIntToDecimalStringN(gStringVar1, GetCoins(), 0, 4); + StringExpandPlaceholders(gStringVar4, gText_CoinCase); + + if (!gTasks[taskId].data[3]) + { + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + } + else + { + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); + } +} + +void ItemUseOutOfBattle_PowderJar(u8 taskId) +{ + ConvertIntToDecimalStringN(gStringVar1, sub_80247BC(), 0, 5); + StringExpandPlaceholders(gStringVar4, gText_PowderQty); + + if (!gTasks[taskId].data[3]) + { + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + } + else + { + DisplayItemMessageOnField(taskId, gStringVar4, CleanUpAfterFailingToUseRegisteredKeyItemOnField); + } +} + +void sub_80FDD10(u8 taskId) +{ + if (IsPlayerFacingPlantedBerryTree() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDD74; + gFieldCallback = MapPostLoadHook_UseItem; + *gUnknown_0203CE54 = c2_exit_to_overworld_2_switch; + unknown_ItemMenu_Confirm(taskId); + } + else + { + ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); + } +} + +void sub_80FDD74(u8 taskId) +{ + RemoveBagItem(gSpecialVar_ItemId, 1); + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Route102_EventScript_274482); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_WailmerPail(u8 taskId) +{ + if (sub_80FDE2C() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDE7C; + SetUpItemUseOnFieldCallback(taskId); + } + else if (TryToWaterBerryTree() == TRUE) + { + gUnknown_0203A0F4 = sub_80FDE08; + SetUpItemUseOnFieldCallback(taskId); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void sub_80FDE08(u8 taskId) +{ + ScriptContext2_Enable(); + ScriptContext1_SetupScript(Route102_EventScript_2744C0); + DestroyTask(taskId); +} + +bool8 sub_80FDE2C(void) +{ + u16 x, y; + u8 z; + u8 objId; + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + z = PlayerGetZCoord(); + objId = GetFieldObjectIdByXYZ(x, y, z); + if (objId == 16 || gMapObjects[objId].graphicsId != 0xE4) + return FALSE; + else + return TRUE; +} + +void sub_80FDE7C(u8 taskId) +{ + ScriptContext2_Enable(); + ScriptContext1_SetupScript(BattleFrontier_OutsideEast_EventScript_242CFC); + DestroyTask(taskId); +} + +void ItemUseOutOfBattle_Medicine(u8 taskId) +{ + gUnknown_03006328 = ItemUseCB_Medicine; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_ReduceEV(u8 taskId) +{ + gUnknown_03006328 = sub_81B67C8; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_SacredAsh(u8 taskId) +{ + gUnknown_03006328 = sub_81B79E8; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_PPRecovery(u8 taskId) +{ + gUnknown_03006328 = dp05_ether; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_PPUp(u8 taskId) +{ + gUnknown_03006328 = dp05_pp_up; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_RareCandy(u8 taskId) +{ + gUnknown_03006328 = dp05_rare_candy; + SetUpItemUseCallback(taskId); +} + +void ItemUseOutOfBattle_TMHM(u8 taskId) +{ + if (gSpecialVar_ItemId >= ITEM_HM01) + DisplayItemMessage(taskId, 1, gText_BootedUpHM, sub_80FDF90); // HM + else + DisplayItemMessage(taskId, 1, gText_BootedUpTM, sub_80FDF90); // TM +} + +void sub_80FDF90(u8 taskId) +{ + PlaySE(SE_PC_LOGIN); + gTasks[taskId].func = task08_0809AD8C; +} + +void task08_0809AD8C(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]); + StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1); + DisplayItemMessage(taskId, 1, gStringVar4, sub_80FE024); + } +} + +void sub_80FE024(u8 taskId) +{ + bag_menu_yes_no(taskId, 6, gUnknown_085920E8); +} + +void sub_80FE03C(u8 taskId) +{ + gUnknown_03006328 = sub_81B6DC4; + SetUpItemUseCallback(taskId); +} + +void sub_80FE058(void) +{ + RemoveBagItem(gSpecialVar_ItemId, 1); + CopyItemName(gSpecialVar_ItemId, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); + if (!InBattlePyramid()) + { + sub_81AB9A8(ItemId_GetPocket(gSpecialVar_ItemId)); + sub_81ABA88(ItemId_GetPocket(gSpecialVar_ItemId)); + } + else + { + sub_81C5924(); + sub_81C59BC(); + } +} + +void ItemUseOutOfBattle_Repel(u8 taskId) +{ + if (VarGet(VAR_REPEL_STEP_COUNT) == 0) + gTasks[taskId].func = sub_80FE124; + else if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gText_RepelEffectsLingered, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_RepelEffectsLingered, sub_81C6714); +} + +void sub_80FE124(u8 taskId) +{ + s16* data = gTasks[taskId].data; + + if (++data[8] > 7) + { + data[8] = 0; + PlaySE(SE_TU_SAA); + gTasks[taskId].func = sub_80FE164; + } +} + +void sub_80FE164(u8 taskId) +{ + if (!IsSEPlaying()) + { + VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId)); + sub_80FE058(); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C6714); + } +} + +void sub_80FE1D0(u8 taskId) +{ + if(++gTasks[taskId].data[8] > 7) + { + PlaySE(SE_BIDORO); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C6714); + } +} + +void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId) +{ + CopyItemName(gSpecialVar_ItemId, gStringVar2); + if (gSpecialVar_ItemId == ITEM_WHITE_FLUTE) + { + FlagSet(FLAG_SYS_ENC_UP_ITEM); + FlagClear(FLAG_SYS_ENC_DOWN_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); + } + else + { + FlagSet(FLAG_SYS_ENC_DOWN_ITEM); + FlagClear(FLAG_SYS_ENC_UP_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildRepelled); + } + gTasks[taskId].data[8] = 0; + gTasks[taskId].func = sub_80FE1D0; +} + +void task08_080A1C44(u8 taskId) +{ + player_avatar_init_params_reset(); + sub_80B7CC8(); + DestroyTask(taskId); +} + +void re_escape_rope(u8 taskId) +{ + flagmods_08054D70(); + sub_80FE058(); + gTasks[taskId].data[0] = 0; + DisplayItemMessageOnField(taskId, gStringVar4, task08_080A1C44); +} + +bool8 sub_80FE314(void) +{ + if (gMapHeader.flags & 2) + return TRUE; + else + return FALSE; +} + +void ItemUseOutOfBattle_EscapeRope(u8 taskId) +{ + if (sub_80FE314() == TRUE) + { + gUnknown_0203A0F4 = re_escape_rope; + SetUpItemUseOnFieldCallback(taskId); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void ItemUseOutOfBattle_EvolutionStone(u8 taskId) +{ + gUnknown_03006328 = sub_81B7C74; + SetUpItemUseCallback(taskId); +} + +void ItemUseInBattle_PokeBall(u8 taskId) +{ + if (IsPlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? + { + RemoveBagItem(gSpecialVar_ItemId, 1); + if (!InBattlePyramid()) + unknown_ItemMenu_Confirm(taskId); + else + sub_81C5B14(taskId); + } + else if (!InBattlePyramid()) + { + DisplayItemMessage(taskId, 1, gText_BoxFull, bag_menu_inits_lists_menu); + } + else + DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, sub_81C6714); +} + +void sub_80FE408(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + if (!InBattlePyramid()) + unknown_ItemMenu_Confirm(taskId); + else + sub_81C5B14(taskId); + } +} + +void sub_80FE440(u8 taskId) +{ + if(++gTasks[taskId].data[8] > 7) + { + PlaySE(SE_KAIFUKU); + RemoveBagItem(gSpecialVar_ItemId, 1); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, sub_806CF78(gSpecialVar_ItemId), sub_80FE408); + else + DisplayItemMessageInBattlePyramid(taskId, sub_806CF78(gSpecialVar_ItemId), sub_80FE408); + } +} + +void ItemUseInBattle_StatIncrease(u8 taskId) +{ + u16 partyId = gBattlePartyID[gBankInMenu]; + + if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) + { + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gText_WontHaveEffect, bag_menu_inits_lists_menu); + else + DisplayItemMessageInBattlePyramid(taskId, gText_WontHaveEffect, sub_81C6714); + } + else + { + gTasks[taskId].func = sub_80FE440; + gTasks[taskId].data[8] = 0; + } +} + +void sub_80FE54C(u8 taskId) +{ + if (!InBattlePyramid()) + { + *gUnknown_0203CE54 = sub_81B89F0; + unknown_ItemMenu_Confirm(taskId); + } + else + { + *gUnknown_0203CF2C = sub_81B89F0; + sub_81C5B14(taskId); + } +} + +void ItemUseInBattle_Medicine(u8 taskId) +{ + gUnknown_03006328 = ItemUseCB_Medicine; + sub_80FE54C(taskId); +} + +void sub_80FE5AC(u8 taskId) +{ + gUnknown_03006328 = sub_81B79E8; + sub_80FE54C(taskId); +} + +void ItemUseInBattle_PPRecovery(u8 taskId) +{ + gUnknown_03006328 = dp05_ether; + sub_80FE54C(taskId); +} + +void ItemUseInBattle_Escape(u8 taskId) +{ + + if((gBattleTypeFlags & BATTLE_TYPE_TRAINER) == FALSE) + { + sub_80FE058(); + if (!InBattlePyramid()) + DisplayItemMessage(taskId, 1, gStringVar4, unknown_ItemMenu_Confirm); + else + DisplayItemMessageInBattlePyramid(taskId, gStringVar4, sub_81C5B14); + } + else + { + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); + } +} + +void ItemUseOutOfBattle_EnigmaBerry(u8 taskId) +{ + switch (GetItemEffectType(gSpecialVar_ItemId) - 1) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_Medicine(taskId); + break; + case 9: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_SacredAsh(taskId); + break; + case 0: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_RareCandy(taskId); + break; + case 18: + case 19: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_PPUp(taskId); + break; + case 20: + gTasks[taskId].data[4] = 1; + ItemUseOutOfBattle_PPRecovery(taskId); + break; + default: + gTasks[taskId].data[4] = 4; + ItemUseOutOfBattle_CannotUse(taskId); + } +} + +void ItemUseInBattle_EnigmaBerry(u8 taskId) +{ + switch (GetItemEffectType(gSpecialVar_ItemId)) + { + case 0: + ItemUseInBattle_StatIncrease(taskId); + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 11: + ItemUseInBattle_Medicine(taskId); + break; + case 21: + ItemUseInBattle_PPRecovery(taskId); + break; + default: + ItemUseOutOfBattle_CannotUse(taskId); + } +} + +void ItemUseOutOfBattle_CannotUse(u8 taskId) +{ + DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); +} diff --git a/src/link.c b/src/link.c index 5a47e2fac..acf2fbe6b 100644 --- a/src/link.c +++ b/src/link.c @@ -17,7 +17,7 @@ #include "gpu_regs.h" #include "palette.h" #include "task.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "menu.h" #include "new_menu_helpers.h" #include "text.h" diff --git a/src/mail.c b/src/mail.c index c3cbe4a3c..ac263ac67 100644 --- a/src/mail.c +++ b/src/mail.c @@ -4,7 +4,7 @@ #include "main.h" #include "overworld.h" #include "task.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "palette.h" #include "text.h" #include "menu.h" diff --git a/src/main.c b/src/main.c index 9f3a815b0..3be6b91c7 100644 --- a/src/main.c +++ b/src/main.c @@ -7,7 +7,7 @@ #include "m4a.h" #include "bg.h" #include "rtc.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "overworld.h" #include "play_time.h" #include "random.h" diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c new file mode 100644 index 000000000..444650be1 --- /dev/null +++ b/src/mystery_event_menu.c @@ -0,0 +1,303 @@ +#include "global.h" +#include "mystery_event_menu.h" +#include "link.h" +#include "main.h" +#include "menu.h" +#include "mystery_event_script.h" +#include "palette.h" +#include "save.h" +#include "constants/songs.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text.h" +#include "bg.h" +#include "window.h" +#include "gpu_regs.h" +#include "text_window.h" +#include "new_menu_helpers.h" +#include "decompress.h" + +// this file's functions +static void CB2_MysteryEventMenu(void); +static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed); + +// EWRAM vars +static EWRAM_DATA u8 sUnknown_0203BCF8 = 0; // set but unused + +// const rom data +static const struct BgTemplate sBgTemplates[] = +{ + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + } +}; + +static const struct WindowTemplate sWindowTemplates[] = +{ + {0, 4, 15, 22, 4, 14, 20}, + {0, 7, 6, 16, 4, 14, 0x6C}, + DUMMY_WIN_TEMPLATE +}; + +// code +static void VBlankCB(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static bool8 CheckLanguageMatch(void) +{ + return (gLinkPlayers[0].language == gLinkPlayers[1].language); +} + +void CB2_InitMysteryEventMenu(void) +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + SetVBlankCallback(VBlankCB); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); + if (InitWindows(sWindowTemplates)) + { + s32 i; + + DeactivateAllTextPrinters(); + for (i = 0; i < 2; i++) + FillWindowPixelBuffer(i, 0); + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + sub_809882C(0, 1u, 0xD0u); + sub_81978B0(0xE0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + CreateTask(Task_DestroySelf, 0); + StopMapMusic(); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + FillPalette(0, 0, 2); + SetMainCallback2(CB2_MysteryEventMenu); + } +} + +static bool8 GetEventLoadMessage(u8 *dest, u32 status) +{ + bool8 retVal = TRUE; + + if (status == 0) + { + StringCopy(dest, gText_EventSafelyLoaded); + retVal = FALSE; + } + + if (status == 2) + retVal = FALSE; + + if (status == 1) + StringCopy(dest, gText_LoadErrorEndingSession); + + return retVal; +} + +static void CB2_MysteryEventMenu(void) +{ + switch (gMain.state) + { + case 0: + SetWindowBorderStyle(0, 1, 1, 0xD); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); + ShowBg(0); + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gMain.state++; + break; + case 1: + if (!gPaletteFade.active) + { + PrintMysteryMenuText(0, gText_LinkStandby2, 1, 2, 1); + gMain.state++; + } + break; + case 2: + if (!IsTextPrinterActive(0)) + { + gMain.state++; + gLinkType = 21761; + OpenLink(); + } + break; + case 3: + if ((gLinkStatus & 0x20) && (gLinkStatus & 0x1C) > 4) + { + PlaySE(SE_PIN); + PrintMysteryMenuText(0, gText_PressAToLoadEvent, 1, 2, 1); + gMain.state++; + } + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + CloseLink(); + gMain.state = 15; + } + break; + case 4: + if (!IsTextPrinterActive(0)) + gMain.state++; + break; + case 5: + if (GetLinkPlayerCount_2() == 2) + { + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + sub_800A620(); + SetWindowBorderStyle(1, 1, 1, 0xD); + PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0); + PutWindowTilemap(1); + CopyWindowToVram(1, 3); + gMain.state++; + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + CloseLink(); + gMain.state = 15; + } + } + else + { + GetEventLoadMessage(gStringVar4, 1); + PrintMysteryMenuText(0, gStringVar4, 1, 2, 1); + gMain.state = 13; + } + break; + case 6: + if (IsLinkConnectionEstablished()) + { + if (gReceivedRemoteLinkPlayers != 0) + { + if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == 3) + { + sub_800AC34(); + GetEventLoadMessage(gStringVar4, 1); + PrintMysteryMenuText(0, gStringVar4, 1, 2, 1); + gMain.state = 13; + } + else if (CheckLanguageMatch()) + { + PrintMysteryMenuText(0, gText_DontRemoveCableTurnOff, 1, 2, 1); + gMain.state++; + } + else + { + CloseLink(); + GetEventLoadMessage(gStringVar4, 1); + PrintMysteryMenuText(0, gStringVar4, 1, 2, 1); + gMain.state = 13; + } + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + CloseLink(); + gMain.state = 15; + } + break; + case 7: + if (!IsTextPrinterActive(0)) + gMain.state++; + break; + case 8: + if (GetBlockReceivedStatus()) + { + ResetBlockReceivedFlags(); + gMain.state++; + } + break; + case 9: + gMain.state++; + break; + case 10: + sub_800AC34(); + gMain.state++; + break; + case 11: + if (gReceivedRemoteLinkPlayers == 0) + { + u16 unkVal = RunMysteryEventScript(gDecompressionBuffer); + CpuFill32(0, gDecompressionBuffer, 0x7D4); + if (!GetEventLoadMessage(gStringVar4, unkVal)) + TrySavingData(NORMAL_SAVE); + gMain.state++; + } + break; + case 12: + PrintMysteryMenuText(0, gStringVar4, 1, 2, 1); + gMain.state++; + break; + case 13: + if (!IsTextPrinterActive(0)) + { + gMain.state++; + sUnknown_0203BCF8 = 0; + } + break; + case 14: + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + gMain.state++; + } + break; + case 15: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gMain.state++; + break; + case 16: + if (!gPaletteFade.active) + DoSoftReset(); + break; + } + + if (gLinkStatus & 0x40 && !IsLinkMaster()) + { + CloseLink(); + GetEventLoadMessage(gStringVar4, 1); + PrintMysteryMenuText(0, gStringVar4, 1, 2, 1); + gMain.state = 13; + } + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed) +{ + struct TextColor textColor; + u8 letterSpacing = 0; + u8 lineSpacing = 1; + textColor.fgColor = 1; + textColor.bgColor = 2; + textColor.shadowColor = 3; + + FillWindowPixelBuffer(windowId, (textColor.fgColor) | (textColor.fgColor << 4)); + AddTextPrinterParameterized2(windowId, 1, x, y, letterSpacing, lineSpacing, &textColor, speed, text); +} diff --git a/src/naming_screen.c b/src/naming_screen.c new file mode 100644 index 000000000..7139b5c90 --- /dev/null +++ b/src/naming_screen.c @@ -0,0 +1,2177 @@ +#include "global.h" +#include "naming_screen.h" +#include "malloc.h" +#include "palette.h" +#include "task.h" +#include "sprite.h" +#include "string_util.h" +#include "new_menu_helpers.h" +#include "window.h" +#include "bg.h" +#include "gpu_regs.h" +#include "pokemon.h" +#include "field_specials.h" +#include "field_player_avatar.h" +#include "field_map_obj.h" +#include "event_data.h" +#include "constants/vars.h" +#include "constants/songs.h" +#include "pokemon_storage_system.h" +#include "sound.h" +#include "trig.h" +#include "field_effect.h" +#include "pokemon_icon.h" +#include "data2.h" +#include "strings.h" +#include "menu.h" +#include "text_window.h" +#include "overworld.h" +#include "constants/map_objects.h" + +EWRAM_DATA static struct NamingScreenData *gNamingScreenData = NULL; +extern u16 gKeyRepeatStartDelay; + +// extern graphics +extern const u16 gNamingScreenMenu_Pal[]; +extern const u8 gNamingScreenMenu_Gfx[]; +extern const u8 gUnknown_08DD4544[]; +extern const u8 gUnknown_08DD4620[]; +extern const u8 gUnknown_08DD46E0[]; +extern const u8 gUnknown_08DD47A0[]; +extern const u8 gNamingScreenRWindow_Gfx[]; +extern const u8 gNamingScreenKeyboardButton_Gfx[]; +extern const u8 gNamingScreenROptions_Gfx[]; +extern const u8 gNamingScreenCursor_Gfx[]; +extern const u8 gNamingScreenRightPointingTriangleTiles[]; +extern const u8 gNamingScreenUnderscoreTiles[]; + +// extern text +extern const u8 gExpandedPlaceholder_Empty[]; +extern const u8 gText_PkmnTransferredSomeonesPC[]; +extern const u8 gText_PkmnTransferredLanettesPC[]; +extern const u8 gText_PkmnBoxSomeonesPCFull[]; +extern const u8 gText_PkmnBoxLanettesPCFull[]; +extern const u8 gText_MoveOkBack[]; +extern const u8 gText_YourName[]; +extern const u8 gText_BoxName[]; +extern const u8 gText_PkmnsNickname[]; +extern const u8 gText_TellHimTheWords[]; +extern const u8 gUnknown_0862B88D[]; +extern const u8 gUnknown_0862B8AE[]; +extern const u8 gUnknown_0862B8CF[]; +extern const u8 gUnknown_0862B8F0[]; +extern const u8 gUnknown_0862B911[]; +extern const u8 gUnknown_0862B932[]; +extern const u8 gUnknown_0862B953[]; +extern const u8 gUnknown_0862B974[]; +extern const u8 gUnknown_0862B995[]; +extern const u8 gUnknown_0862B9AE[]; +extern const u8 gUnknown_0862B9C7[]; +extern const u8 gUnknown_0862B9E0[]; + + +// start of .rodata +static const u8 gSpriteImage_858BBF8[] = INCBIN_U8("graphics/naming_screen/pc_icon/0.4bpp"); +static const u8 gSpriteImage_858BCB8[] = INCBIN_U8("graphics/naming_screen/pc_icon/1.4bpp"); +static const u16 gUnknown_0858BD78[] = INCBIN_U16("graphics/naming_screen/0.gbapal"); +static const u16 gUnknown_0858BD98[] = INCBIN_U16("graphics/naming_screen/1.gbapal"); + +static const u8 *const gUnknown_0858BDB8[] = +{ + gText_PkmnTransferredSomeonesPC, + gText_PkmnTransferredLanettesPC, + gText_PkmnBoxSomeonesPCFull, + gText_PkmnBoxLanettesPCFull +}; + +static const u8 gUnknown_0858BDC8[] = _("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"); + +static const struct BgTemplate gUnknown_0858BE00[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .priority = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 29, + .priority = 1 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 28, + .priority = 2 + }, + { + .bg = 3, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .priority = 3 + } +}; + +static const struct WindowTemplate gUnknown_0858BE10[] = { + { 0x01, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x030 }, + { 0x02, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x0C8 }, + { 0x03, 0x08, 0x06, 0x11, 0x02, 0x0A, 0x030 }, + { 0x03, 0x08, 0x04, 0x11, 0x02, 0x0A, 0x052 }, + { 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0B, 0x074 }, + DUMMY_WIN_TEMPLATE +}; + +static const u8 gUnknown_0858BE40[] = __("abcdef .ghijkl ,mnopqrs tuvwxyz ABCDEF .GHIJKL ,MNOPQRS TUVWXYZ 01234 56789 !?♂♀/- …“”‘’ "); + +static const u8 gUnknown_0858BEA0[] = { 8, 8, 6 }; +static const u8 gUnknown_0858BEA3[] = { 0, 12, 24, 56, 68, 80, 92, 123, 0, 12, 24, 56, 68, 80, 92, 123, 0, 22, 44, 66, 88, 110, 0, 0 }; + +// forward declarations +static const struct NamingScreenTemplate *const sNamingScreenTemplates[]; +static const struct SubspriteTable gUnknown_0858C050[]; +static const struct SubspriteTable gUnknown_0858C058[]; +static const struct SubspriteTable gUnknown_0858C070[]; +static const struct SubspriteTable gUnknown_0858C078[]; +static const struct SpriteTemplate gUnknown_0858C0C0; +static const struct SpriteTemplate gUnknown_0858C0D8; +static const struct SpriteTemplate gUnknown_0858C0F0; +static const struct SpriteTemplate gUnknown_0858C108; +static const struct SpriteTemplate gUnknown_0858C120; +static const struct SpriteTemplate gUnknown_0858C138; +static const struct SpriteTemplate sSpriteTemplate_InputArrow; +static const struct SpriteTemplate sSpriteTemplate_Underscore; +static const struct SpriteTemplate gUnknown_0858C180; +static const u8* const gUnknown_0858C198[][4]; +static const struct SpriteSheet gUnknown_0858C1C8[]; +static const struct SpritePalette gUnknown_0858C230[]; + +static void C2_NamingScreen(void); +static void NamingScreen_Init(void); +static void NamingScreen_InitBGs(void); +static void sub_80E3194(void); +static void sub_80E31B0(u8 taskId); +static bool8 MainState_BeginFadeIn(void); +static bool8 MainState_WaitFadeIn(void); +static bool8 MainState_HandleInput(void); +static bool8 MainState_MoveToOKButton(void); +static bool8 MainState_6(void); +static bool8 MainState_BeginFadeInOut(void); +static bool8 MainState_WaitFadeOutAndExit(void); +static void DisplaySentToPCMessage(void); +static bool8 sub_80E3604(void); +static bool8 MainState_StartPageSwap(void); +static bool8 MainState_WaitPageSwap(void); +static void StartPageSwapAnim(void); +static void Task_HandlePageSwapAnim(u8); +static bool8 IsPageSwapAnimNotInProgress(void); +static void sub_80E3948(u8, u8, u8); +static void Task_80E39BC(u8); +static u16 sub_80E3A74(u8); +static void sub_80E3AE8(u8); +static void sub_80E3B10(struct Task *, u8, u8); +static void sub_80E3CC8(void); +static void CursorInit(void); +static void SetCursorPos(s16, s16); +static void GetCursorPos(s16 *x, s16 *y); +static void MoveCursorToOKButton(void); +static void sub_80E3E3C(u8); +static void sub_80E3E94(u8); +static u8 IsCursorAnimFinished(void); +static u8 GetCurrentPageColumnCount(void); +static void CreatePageSwitcherSprites(void); +static void sub_80E4050(void); +static void sub_80E41B8(u8, struct Sprite *, struct Sprite *); +static void CreateBackOkSprites(void); +static void CreateUnderscoreSprites(void); +static void CreateInputTargetIcon(void); +static u8 HandleKeyboardEvent(void); +static u8 sub_80E45E0(void); +static u8 GetInputEvent(void); +static void SetInputState(u8); +static void sub_80E4964(void); +static u8 GetTextCaretPosition(void); +static void DeleteTextCharacter(void); +static bool8 sub_80E4B54(void); +static void AddTextCharacter(u8); +static void sub_80E4BE4(void); +static void choose_name_or_words_screen_load_bg_tile_patterns(void); +static void sub_80E4CB8(void); +static void choose_name_or_words_screen_apply_bg_pals(void); +static void sub_80E4CF8(u8, const void *); +static void nullsub_10(u8, u8); +static void sub_80E4D10(void); +static void sub_80E4DE4(u8, u8); +static void sub_80E4E5C(void); +static void sub_80E4EF0(void); +static void sub_80E4F58(void); +static void NamingScreen_TurnOffScreen(void); +static void NamingScreen_InitDisplayMode(void); +static void VBlankCB_NamingScreen(void); +static void sub_80E501C(void); +static bool8 sub_80E503C(u8); + +void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback) +{ + gNamingScreenData = Alloc(sizeof(struct NamingScreenData)); + if (!gNamingScreenData) + { + SetMainCallback2(returnCallback); + } + else + { + gNamingScreenData->templateNum = templateNum; + gNamingScreenData->monSpecies = monSpecies; + gNamingScreenData->monGender = monGender; + gNamingScreenData->monPersonality = monPersonality; + gNamingScreenData->destBuffer = destBuffer; + gNamingScreenData->returnCallback = returnCallback; + + if (templateNum == 0) + StartTimer1(); + + SetMainCallback2(C2_NamingScreen); + } +} + +static void C2_NamingScreen(void) +{ + switch (gMain.state) + { + case 0: + NamingScreen_TurnOffScreen(); + NamingScreen_Init(); + gMain.state++; + break; + case 1: + NamingScreen_InitBGs(); + gMain.state++; + break; + case 2: + ResetPaletteFade(); + gMain.state++; + break; + case 3: + ResetSpriteData(); + FreeAllSpritePalettes(); + gMain.state++; + break; + case 4: + ResetTasks(); + gMain.state++; + break; + case 5: + choose_name_or_words_screen_apply_bg_pals(); + gMain.state++; + break; + case 6: + choose_name_or_words_screen_load_bg_tile_patterns(); + gMain.state++; + break; + case 7: + sub_80E3CC8(); + UpdatePaletteFade(); + sub_80E501C(); + gMain.state++; + break; + default: + sub_80E4CB8(); + sub_80E3194(); + break; + } +} + +static void NamingScreen_Init(void) +{ + gNamingScreenData->state = 0; + gNamingScreenData->bg1vOffset = 0; + gNamingScreenData->bg2vOffset = 0; + gNamingScreenData->bg1Priority = BGCNT_PRIORITY(1); + gNamingScreenData->bg2Priority = BGCNT_PRIORITY(2); + gNamingScreenData->bgToReveal = 0; + gNamingScreenData->bgToHide = 1; + gNamingScreenData->template = sNamingScreenTemplates[gNamingScreenData->templateNum]; + gNamingScreenData->currentPage = gNamingScreenData->template->initialPage; + gNamingScreenData->inputCharBaseXPos = (240 - gNamingScreenData->template->maxChars * 8) / 2 + 6; + if (gNamingScreenData->templateNum == 4) + gNamingScreenData->inputCharBaseXPos += 11; + gNamingScreenData->keyRepeatStartDelayCopy = gKeyRepeatStartDelay; + memset(gNamingScreenData->textBuffer, 0xFF, sizeof(gNamingScreenData->textBuffer)); + if (gNamingScreenData->template->copyExistingString != 0) + StringCopy(gNamingScreenData->textBuffer, gNamingScreenData->destBuffer); + gKeyRepeatStartDelay = 16; +} + +static void sub_80E2FA4(void) +{ + u8 i; + for (i = 0; i < MAX_SPRITES; i++) + { + if (gSprites[i].inUse) + gSprites[i].invisible = FALSE; + } + sub_80E3E3C(0); +} + +static void NamingScreen_InitBGs(void) +{ + u8 i; + + DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3, (void *)OAM, OAM_SIZE); + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0858BE00, 4); + + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + + sub_81971D0(); + sub_8197200(); + + for (i = 0; i < 5; i++) + gNamingScreenData->windows[i] = AddWindow(&gUnknown_0858BE10[i]); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0xC, 0x8)); + + SetBgTilemapBuffer(1, gNamingScreenData->tilemapBuffer1); + SetBgTilemapBuffer(2, gNamingScreenData->tilemapBuffer2); + SetBgTilemapBuffer(3, gNamingScreenData->tilemapBuffer3); + + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20); +} + +static void sub_80E3194(void) +{ + CreateTask(sub_80E31B0, 2); + SetMainCallback2(sub_80E4F58); +} + +static void sub_80E31B0(u8 taskId) +{ + switch (gNamingScreenData->state) + { + case 0: + MainState_BeginFadeIn(); + sub_80E2FA4(); + NamingScreen_InitDisplayMode(); + break; + case 1: + MainState_WaitFadeIn(); + break; + case 2: + MainState_HandleInput(); + break; + case 3: + MainState_MoveToOKButton(); + MainState_HandleInput(); + break; + case 4: + MainState_StartPageSwap(); + break; + case 5: + MainState_WaitPageSwap(); + break; + case 6: + MainState_6(); + break; + case 7: + sub_80E3604(); + break; + case 8: + MainState_BeginFadeInOut(); + break; + case 9: + MainState_WaitFadeOutAndExit(); + break; + } +} + +static const u8 gUnknown_0858BEBB[] = { 0, 2, 1 }; +static const u8 gUnknown_0858BEBE[] = { 1, 0, 2 }; +static const u8 gUnknown_0858BEC1[] = { 2, 1, 0 }; + +static u8 sub_80E3244(u8 a1) +{ + return gUnknown_0858BEBB[a1]; +} + +static u8 sub_80E3254(void) +{ + return gUnknown_0858BEBE[gNamingScreenData->currentPage]; +} + +static u8 sub_80E3274(void) +{ + return gUnknown_0858BEC1[gNamingScreenData->currentPage]; +} + +static bool8 MainState_BeginFadeIn(void) +{ + sub_80E4CF8(3, gUnknown_08DD4544); + gNamingScreenData->currentPage = 1; + sub_80E4CF8(2, gUnknown_08DD46E0); + sub_80E4CF8(1, gUnknown_08DD4620); + sub_80E4DE4(gNamingScreenData->windows[1], 0); + sub_80E4DE4(gNamingScreenData->windows[0], 1); + nullsub_10(2, 0); + nullsub_10(1, 1); + sub_80E4D10(); + sub_80E4964(); + sub_80E4EF0(); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + BlendPalettes(-1, 16, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + gNamingScreenData->state++; + return FALSE; +} + +static bool8 MainState_WaitFadeIn(void) +{ + if (!gPaletteFade.active) + { + SetInputState(INPUT_STATE_ENABLED); + sub_80E3E94(1); + gNamingScreenData->state++; + } + return FALSE; +} + +static bool8 MainState_HandleInput(void) +{ + return HandleKeyboardEvent(); +} + +static bool8 MainState_MoveToOKButton(void) +{ + if (IsCursorAnimFinished()) + { + SetInputState(INPUT_STATE_ENABLED); + MoveCursorToOKButton(); + gNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; + } + return FALSE; +} + +static bool8 MainState_6(void) +{ + sub_80E4BE4(); + SetInputState(INPUT_STATE_DISABLED); + sub_80E3E94(0); + sub_80E3948(3, 0, 1); + if (gNamingScreenData->templateNum == NAMING_SCREEN_CAUGHT_MON && + CalculatePlayerPartyCount() >= 6) + { + DisplaySentToPCMessage(); + gNamingScreenData->state = MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE; + return FALSE; + } + else + { + gNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + return TRUE; //Exit the naming screen + } +} + +static bool8 MainState_BeginFadeInOut(void) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + gNamingScreenData->state++; + return FALSE; +} + +static bool8 MainState_WaitFadeOutAndExit(void) +{ + if (!gPaletteFade.active) + { + if (gNamingScreenData->templateNum == NAMING_SCREEN_PLAYER) + SeedRngAndSetTrainerId(); + SetMainCallback2(gNamingScreenData->returnCallback); + DestroyTask(FindTaskIdByFunc(sub_80E31B0)); + FreeAllWindowBuffers(); + FREE_AND_SET_NULL(gNamingScreenData); + } + return FALSE; +} + +static void DisplaySentToPCMessage(void) +{ + u8 stringToDisplay = 0; + + if (!sub_813B260()) + { + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar2, gNamingScreenData->destBuffer); + } + else + { + StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN))); + StringCopy(gStringVar2, gNamingScreenData->destBuffer); + StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id())); + stringToDisplay = 2; + } + + if (FlagGet(FLAG_SYS_PC_LANETTE)) + stringToDisplay++; + + StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]); + sub_81973C4(0, 0); + gTextFlags.flag_0 = TRUE; + AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3); + CopyWindowToVram(0, 3); +} + +static bool8 sub_80E3604(void) +{ + RunTextPrinters(); + + if (!IsTextPrinterActive(0) && (gMain.newKeys & A_BUTTON)) + gNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + + return FALSE; +} + +static bool8 MainState_StartPageSwap(void) +{ + SetInputState(INPUT_STATE_DISABLED); + sub_80E4050(); + StartPageSwapAnim(); + sub_80E3E3C(1); + sub_80E3948(0, 0, 1); + PlaySE(SE_WIN_OPEN); + gNamingScreenData->state = MAIN_STATE_WAIT_PAGE_SWAP; + return FALSE; +} + +static bool8 MainState_WaitPageSwap(void) +{ + s16 cursorX; + s16 cursorY; + bool32 var3; + + if (IsPageSwapAnimNotInProgress()) + { + + GetCursorPos(&cursorX, &cursorY); + var3 = (cursorX == GetCurrentPageColumnCount()); + + gNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; + gNamingScreenData->currentPage++; + gNamingScreenData->currentPage %= 3; + + if (var3) + { + cursorX = GetCurrentPageColumnCount(); + } + else + { + if (cursorX >= GetCurrentPageColumnCount()) + cursorX = GetCurrentPageColumnCount() - 1; + } + + SetCursorPos(cursorX, cursorY); + sub_80E4E5C(); + SetInputState(INPUT_STATE_ENABLED); + sub_80E3E3C(0); + } + return FALSE; +} + +//-------------------------------------------------- +// Page Swap +//-------------------------------------------------- + +#define tState data[0] +#define tFrameCount data[1] + +static bool8 PageSwapAnimState_Init(struct Task *); +static bool8 PageSwapAnimState_1(struct Task *); +static bool8 PageSwapAnimState_2(struct Task *); +static bool8 PageSwapAnimState_Done(struct Task *); + +static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *) = +{ + PageSwapAnimState_Init, + PageSwapAnimState_1, + PageSwapAnimState_2, + PageSwapAnimState_Done, +}; + +static void StartPageSwapAnim(void) +{ + u8 taskId; + + taskId = CreateTask(Task_HandlePageSwapAnim, 0); + Task_HandlePageSwapAnim(taskId); +} + +static void Task_HandlePageSwapAnim(u8 taskId) +{ + while (sPageSwapAnimStateFuncs[gTasks[taskId].tState](&gTasks[taskId]) != 0); +} + +static bool8 IsPageSwapAnimNotInProgress(void) +{ + if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == 0xFF) + return TRUE; + else + return FALSE; +} + +static bool8 PageSwapAnimState_Init(struct Task *task) +{ + gNamingScreenData->bg1vOffset = 0; + gNamingScreenData->bg2vOffset = 0; + task->tState++; + return 0; +} + +static bool8 PageSwapAnimState_1(struct Task *task) +{ + u16 *const arr[] = + { + &gNamingScreenData->bg2vOffset, + &gNamingScreenData->bg1vOffset + }; + + task->tFrameCount += 4; + *arr[gNamingScreenData->bgToReveal] = Sin(task->tFrameCount, 40); + *arr[gNamingScreenData->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); + if (task->tFrameCount >= 64) + { + u8 temp = gNamingScreenData->bg1Priority; //Why u8 and not u16? + + gNamingScreenData->bg1Priority = gNamingScreenData->bg2Priority; + gNamingScreenData->bg2Priority = temp; + task->tState++; + } + return 0; +} + +static bool8 PageSwapAnimState_2(struct Task *task) +{ + u16 *const arr[] = + { + &gNamingScreenData->bg2vOffset, + &gNamingScreenData->bg1vOffset + }; + + task->tFrameCount += 4; + *arr[gNamingScreenData->bgToReveal] = Sin(task->tFrameCount, 40); + *arr[gNamingScreenData->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); + if (task->tFrameCount >= 128) + { + u8 temp = gNamingScreenData->bgToReveal; + + gNamingScreenData->bgToReveal = gNamingScreenData->bgToHide; + gNamingScreenData->bgToHide = temp; + task->tState++; + } + return 0; +} + +static bool8 PageSwapAnimState_Done(struct Task *task) +{ + DestroyTask(FindTaskIdByFunc(Task_HandlePageSwapAnim)); + return 0; +} + +#undef tState +#undef tFrameCount + +//-------------------------------------------------- +// +//-------------------------------------------------- + +static void sub_80E3920(void) +{ + u8 taskId; + + taskId = CreateTask(Task_80E39BC, 3); + gTasks[taskId].data[0] = 3; +} + +static void sub_80E3948(u8 a, u8 b, u8 c) +{ + struct Task *task = &gTasks[FindTaskIdByFunc(Task_80E39BC)]; + + if (a == task->data[0] && c == 0) + { + task->data[1] = b; + task->data[2] = 1; + return; + } + if (a == 3 && task->data[1] == 0 && c == 0) + return; + if (task->data[0] != 3) + sub_80E3AE8(task->data[0]); + sub_80E3B10(task, a, b); +} + +static void Task_80E39BC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + if (task->data[0] == 3 || task->data[2] == 0) + return; + MultiplyInvertedPaletteRGBComponents(sub_80E3A74(task->data[0]), task->data[3], task->data[3], task->data[3]); + if (task->data[5] != 0) + { + task->data[5]--; + if (task->data[5] != 0) + return; + } + task->data[5] = 2; + if (task->data[4] >= 0) + { + if (task->data[3] < 14) + { + task->data[3] += task->data[4]; + task->data[6] += task->data[4]; + } + else + { + task->data[3] = 16; + task->data[6]++; + } + } + else + { + task->data[3] += task->data[4]; + task->data[6] += task->data[4]; + } + + if (task->data[3] == 16 && task->data[6] == 22) + { + task->data[4] = -4; + } + else if (task->data[3] == 0) + { + task->data[2] = task->data[1]; + task->data[4] = 2; + task->data[6] = 0; + } +} + +static u16 sub_80E3A74(u8 a) +{ + const u16 arr[] = + { + IndexOfSpritePaletteTag(4) * 16 + 0x10E, + IndexOfSpritePaletteTag(6) * 16 + 0x10E, + IndexOfSpritePaletteTag(7) * 16 + 0x10E, + IndexOfSpritePaletteTag(7) * 16 + 0x101, + }; + + return arr[a]; +} + +static void sub_80E3AE8(u8 a) +{ + u16 index = sub_80E3A74(a); + + gPlttBufferFaded[index] = gPlttBufferUnfaded[index]; +} + +static void sub_80E3B10(struct Task *task, u8 b, u8 c) +{ + task->data[0] = b; + task->data[1] = c; + task->data[2] = 1; + task->data[3] = 4; + task->data[4] = 2; + task->data[5] = 0; + task->data[6] = 4; +} + +static void sub_80E3B30(struct Sprite *sprite) +{ + if (sprite->animEnded) + StartSpriteAnim(sprite, 0); + sprite->invisible = (sprite->data[4] & 0xFF); + if (sprite->data[0] == GetCurrentPageColumnCount()) + sprite->invisible = TRUE; + if (sprite->invisible || (sprite->data[4] & 0xFF00) == 0 + || sprite->data[0] != sprite->data[2] || sprite->data[1] != sprite->data[3]) + { + sprite->data[5] = 0; + sprite->data[6] = 2; + sprite->data[7] = 2; + } + sprite->data[7]--; + if (sprite->data[7] == 0) + { + sprite->data[5] += sprite->data[6]; + if (sprite->data[5] == 16 || sprite->data[5] == 0) + sprite->data[6] = -sprite->data[6]; + sprite->data[7] = 2; + } + if ((sprite->data[4] & 0xFF00) != 0) + { + s8 gb = sprite->data[5]; + s8 r = sprite->data[5] >> 1; + u16 index = IndexOfSpritePaletteTag(5) * 16 + 0x0101; + + MultiplyInvertedPaletteRGBComponents(index, r, gb, gb); + } +} + +static void sub_80E3C20(struct Sprite *sprite) +{ + const s16 arr[] = {0, -4, -2, -1}; + + if (sprite->data[0] == 0 || --sprite->data[0] == 0) + { + sprite->data[0] = 8; + sprite->data[1] = (sprite->data[1] + 1) & 3; + } + sprite->pos2.x = arr[sprite->data[1]]; +} + +static void sub_80E3C6C(struct Sprite *sprite) +{ + const s16 arr[] = {2, 3, 2, 1}; + u8 var; + + var = GetTextCaretPosition(); + if (var != (u8)sprite->data[0]) + { + sprite->pos2.y = 0; + sprite->data[1] = 0; + sprite->data[2] = 0; + } + else + { + sprite->pos2.y = arr[sprite->data[1]]; + sprite->data[2]++; + if (sprite->data[2] > 8) + { + sprite->data[1] = (sprite->data[1] + 1) & 3; + sprite->data[2] = 0; + } + } +} + +//-------------------------------------------------- +// Cursor +//-------------------------------------------------- + +static void sub_80E3CC8(void) +{ + CursorInit(); + CreatePageSwitcherSprites(); + CreateBackOkSprites(); + CreateUnderscoreSprites(); + CreateInputTargetIcon(); +} + +static void CursorInit(void) +{ + gNamingScreenData->cursorSpriteId = CreateSprite(&gUnknown_0858C138, 38, 88, 1); + sub_80E3E3C(1); + gSprites[gNamingScreenData->cursorSpriteId].oam.priority = 1; + gSprites[gNamingScreenData->cursorSpriteId].oam.objMode = 1; + gSprites[gNamingScreenData->cursorSpriteId].data[6] = 1; + gSprites[gNamingScreenData->cursorSpriteId].data[6] = 2; + SetCursorPos(0, 0); +} + +static void SetCursorPos(s16 x, s16 y) +{ + struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId]; + + if (x < gUnknown_0858BEA0[sub_80E3274()]) + cursorSprite->pos1.x = gUnknown_0858BEA3[x + sub_80E3274() * 8] + 38; + else + cursorSprite->pos1.x = 0; + + cursorSprite->pos1.y = y * 16 + 88; + cursorSprite->data[2] = cursorSprite->data[0]; + cursorSprite->data[3] = cursorSprite->data[1]; + cursorSprite->data[0] = x; + cursorSprite->data[1] = y; +} + +static void GetCursorPos(s16 *x, s16 *y) +{ + struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId]; + + *x = cursorSprite->data[0]; + *y = cursorSprite->data[1]; +} + +static void MoveCursorToOKButton(void) +{ + SetCursorPos(GetCurrentPageColumnCount(), 2); +} + +static void sub_80E3E3C(u8 a) +{ + gSprites[gNamingScreenData->cursorSpriteId].data[4] &= -256; + gSprites[gNamingScreenData->cursorSpriteId].data[4] |= a; + StartSpriteAnim(&gSprites[gNamingScreenData->cursorSpriteId], 0); +} + +static void sub_80E3E94(u8 a) +{ + gSprites[gNamingScreenData->cursorSpriteId].data[4] &= 0xFF; + gSprites[gNamingScreenData->cursorSpriteId].data[4] |= a << 8; +} + +static void sub_80E3ED8(void) +{ + StartSpriteAnim(&gSprites[gNamingScreenData->cursorSpriteId], 1); +} + +static bool8 IsCursorAnimFinished(void) +{ + return gSprites[gNamingScreenData->cursorSpriteId].animEnded; +} + +enum +{ + KEY_ROLE_CHAR, + KEY_ROLE_PAGE, + KEY_ROLE_BACKSPACE, + KEY_ROLE_OK, +}; + +static const u8 sKeyRoles[] = {KEY_ROLE_PAGE, KEY_ROLE_BACKSPACE, KEY_ROLE_OK}; + +static u8 GetKeyRoleAtCursorPos(void) +{ + s16 cursorX; + s16 cursorY; + + GetCursorPos(&cursorX, &cursorY); + if (cursorX < GetCurrentPageColumnCount()) + return KEY_ROLE_CHAR; + else + return sKeyRoles[cursorY]; +} + +static u8 GetCurrentPageColumnCount(void) +{ + return gUnknown_0858BEA0[sub_80E3274()]; +} + +static void CreatePageSwitcherSprites(void) +{ + u8 spriteId1; + u8 spriteId2; + u8 spriteId3; + + spriteId1 = CreateSprite(&gUnknown_0858C0C0, 0xCC, 0x58, 0); + gNamingScreenData->selectBtnFrameSpriteId = spriteId1; + SetSubspriteTables(&gSprites[spriteId1], gUnknown_0858C050); + gSprites[spriteId1].invisible = TRUE; + + spriteId2 = CreateSprite(&gUnknown_0858C0F0, 0xCC, 0x54, 1); + gSprites[spriteId1].data[6] = spriteId2; + SetSubspriteTables(&gSprites[spriteId2], gUnknown_0858C058); + gSprites[spriteId2].invisible = TRUE; + + spriteId3 = CreateSprite(&gUnknown_0858C0D8, 0xCC, 0x53, 2); + gSprites[spriteId3].oam.priority = 1; + gSprites[spriteId1].data[7] = spriteId3; + gSprites[spriteId3].invisible = TRUE; +} + +static void sub_80E4050(void) +{ + struct Sprite *sprite = &gSprites[gNamingScreenData->selectBtnFrameSpriteId]; + + sprite->data[0] = 2; + sprite->data[1] = gNamingScreenData->currentPage; +} + +static u8 sub_80E40AC(struct Sprite *); +static u8 sub_80E4100(struct Sprite *); +static u8 sub_80E4104(struct Sprite *); +static u8 sub_80E4178(struct Sprite *); + +static u8 (*const gUnknown_0858BEE8[])(struct Sprite *) = +{ + sub_80E40AC, + sub_80E4100, + sub_80E4104, + sub_80E4178, +}; + +static void sub_80E4084(struct Sprite *sprite) +{ + while (gUnknown_0858BEE8[sprite->data[0]](sprite) != 0); +} + +static u8 sub_80E40AC(struct Sprite *sprite) +{ + struct Sprite *sprite1 = &gSprites[sprite->data[6]]; + struct Sprite *sprite2 = &gSprites[sprite->data[7]]; + + sub_80E41B8(sub_80E3244(gNamingScreenData->currentPage), sprite1, sprite2); + sprite->data[0]++; + return 0; +} + +static u8 sub_80E4100(struct Sprite *sprite) +{ + return 0; +} + +static u8 sub_80E4104(struct Sprite *sprite) +{ + struct Sprite *r4 = &gSprites[sprite->data[6]]; + struct Sprite *r5 = &gSprites[sprite->data[7]]; + + r4->pos2.y++; + if (r4->pos2.y > 7) + { + sprite->data[0]++; + r4->pos2.y = -4; + r4->invisible = TRUE; + sub_80E41B8(sub_80E3244(((u8)sprite->data[1] + 1) % 3), r4, r5); + } + return 0; +} + +static u8 sub_80E4178(struct Sprite *sprite) +{ + struct Sprite *r2 = &gSprites[sprite->data[6]]; + + r2->invisible = FALSE; + r2->pos2.y++; + if (r2->pos2.y >= 0) + { + r2->pos2.y = 0; + sprite->data[0] = 1; + } + return 0; +} + +static const u16 gUnknown_0858BEF8[] = {1, 3, 2}; +static const u16 gUnknown_0858BEFE[] = {4, 6, 5}; + +static void sub_80E41B8(u8 a, struct Sprite *b, struct Sprite *c) +{ + c->oam.paletteNum = IndexOfSpritePaletteTag(gUnknown_0858BEF8[a]); + b->sheetTileStart = GetSpriteTileStartByTag(gUnknown_0858BEFE[a]); + b->subspriteTableNum = a; +} + +// + +static void CreateBackOkSprites(void) +{ + u8 spriteId; + + spriteId = CreateSprite(&gUnknown_0858C108, 0xCC, 0x74, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C070); + gSprites[spriteId].invisible = TRUE; + + spriteId = CreateSprite(&gUnknown_0858C120, 0xCC, 0x8C, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C070); + gSprites[spriteId].invisible = TRUE; +} + +static void CreateUnderscoreSprites(void) +{ + u8 spriteId; + s16 xPos; + u8 i; + + xPos = gNamingScreenData->inputCharBaseXPos - 5; + spriteId = CreateSprite(&sSpriteTemplate_InputArrow, xPos, 0x38, 0); + gSprites[spriteId].oam.priority = 3; + gSprites[spriteId].invisible = TRUE; + xPos = gNamingScreenData->inputCharBaseXPos; + for (i = 0; i < gNamingScreenData->template->maxChars; i++, xPos += 8) + { + spriteId = CreateSprite(&sSpriteTemplate_Underscore, xPos + 3, 0x3C, 0); + gSprites[spriteId].oam.priority = 3; + gSprites[spriteId].data[0] = i; + gSprites[spriteId].invisible = TRUE; + } +} + +//-------------------------------------------------- +// Icon creation (the thing you're naming or giving input to) +//-------------------------------------------------- + +static void TaskDummy2(void); +static void NamingScreen_CreatePlayerIcon(void); +static void NamingScreen_CreatePCIcon(void); +static void NamingScreen_CreateMonIcon(void); +static void NamingScreen_CreateWandaDadIcon(void); + +static void (*const sIconFunctions[])(void) = +{ + TaskDummy2, + NamingScreen_CreatePlayerIcon, + NamingScreen_CreatePCIcon, + NamingScreen_CreateMonIcon, + NamingScreen_CreateWandaDadIcon, +}; + +static void CreateInputTargetIcon(void) +{ + sIconFunctions[gNamingScreenData->template->iconFunction](); +} + +static void TaskDummy2(void) +{ + +} + +static void NamingScreen_CreatePlayerIcon(void) +{ + u8 rivalGfxId; + u8 spriteId; + + rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, gNamingScreenData->monSpecies); + spriteId = AddPseudoFieldObject(rivalGfxId, SpriteCallbackDummy, 0x38, 0x25, 0); + gSprites[spriteId].oam.priority = 3; + StartSpriteAnim(&gSprites[spriteId], 4); +} + +static void NamingScreen_CreatePCIcon(void) +{ + u8 spriteId; + + spriteId = CreateSprite(&gUnknown_0858C180, 0x38, 0x29, 0); + SetSubspriteTables(&gSprites[spriteId], gUnknown_0858C078); + gSprites[spriteId].oam.priority = 3; +} + +static void NamingScreen_CreateMonIcon(void) +{ + u8 spriteId; + + sub_80D2F04(); + spriteId = CreateMonIcon(gNamingScreenData->monSpecies, SpriteCallbackDummy, 0x38, 0x28, 0, gNamingScreenData->monPersonality, 1); + gSprites[spriteId].oam.priority = 3; +} + +static void NamingScreen_CreateWandaDadIcon(void) +{ + u8 spriteId; + + spriteId = AddPseudoFieldObject(MAP_OBJ_GFX_MAN_1, SpriteCallbackDummy, 0x38, 0x25, 0); + gSprites[spriteId].oam.priority = 3; + StartSpriteAnim(&gSprites[spriteId], 4); +} + +//-------------------------------------------------- +// Keyboard handling +//-------------------------------------------------- + +static bool8 KeyboardKeyHandler_Character(u8); +static bool8 KeyboardKeyHandler_Page(u8); +static bool8 KeyboardKeyHandler_Backspace(u8); +static bool8 KeyboardKeyHandler_OK(u8); + +static bool8 (*const sKeyboardKeyHandlers[])(u8) = +{ + KeyboardKeyHandler_Character, + KeyboardKeyHandler_Page, + KeyboardKeyHandler_Backspace, + KeyboardKeyHandler_OK, +}; + +static bool8 HandleKeyboardEvent(void) +{ + u8 event = GetInputEvent(); + u8 keyRole = GetKeyRoleAtCursorPos(); + + if (event == KBEVENT_PRESSED_SELECT) + { + return sub_80E45E0(); + } + else if (event == KBEVENT_PRESSED_B) + { + DeleteTextCharacter(); + return FALSE; + } + else if (event == KBEVENT_PRESSED_START) + { + MoveCursorToOKButton(); + return FALSE; + } + else + { + return sKeyboardKeyHandlers[keyRole](event); + } +} + +static bool8 KeyboardKeyHandler_Character(u8 event) +{ + sub_80E3948(3, 0, 0); + if (event == KBEVENT_PRESSED_A) + { + bool8 var = sub_80E4B54(); + + sub_80E3ED8(); + if (var) + { + SetInputState(INPUT_STATE_2); + gNamingScreenData->state = MAIN_STATE_MOVE_TO_OK_BUTTON; + } + } + return FALSE; +} + +static bool8 KeyboardKeyHandler_Page(u8 event) +{ + sub_80E3948(0, 1, 0); + if (event == KBEVENT_PRESSED_A) + return sub_80E45E0(); + else + return FALSE; +} + +static bool8 KeyboardKeyHandler_Backspace(u8 event) +{ + sub_80E3948(1, 1, 0); + if (event == KBEVENT_PRESSED_A) + DeleteTextCharacter(); + return FALSE; +} + +static bool8 KeyboardKeyHandler_OK(u8 event) +{ + sub_80E3948(2, 1, 0); + if (event == KBEVENT_PRESSED_A) + { + PlaySE(SE_SELECT); + gNamingScreenData->state = MAIN_STATE_6; + return TRUE; + } + else + return FALSE; +} + +static bool8 sub_80E45E0(void) +{ + gNamingScreenData->state = MAIN_STATE_START_PAGE_SWAP; + return TRUE; +} + +//-------------------------------------------------- +// Input handling +//-------------------------------------------------- + +enum +{ + FNKEY_CASE, + FNKEY_BACK, + FNKEY_OK, +}; + +#define tState data[0] +#define tKeyboardEvent data[1] +#define tKbFunctionKey data[2] + + +static void InputState_Disabled(struct Task *); +static void InputState_Enabled(struct Task *); +static void InputState_2(struct Task *); + +static void (*const sInputStateFuncs[])(struct Task *) = +{ + InputState_Disabled, + InputState_Enabled, + InputState_2, +}; + +static void Task_HandleInput(u8); +static void HandleDpadMovement(struct Task *); + +static void InputInit(void) +{ + CreateTask(Task_HandleInput, 1); +} + +static u8 GetInputEvent(void) +{ + u8 taskId = FindTaskIdByFunc(Task_HandleInput); + + return gTasks[taskId].tKeyboardEvent; +} + +static void SetInputState(u8 state) +{ + u8 taskId = FindTaskIdByFunc(Task_HandleInput); + + gTasks[taskId].tState = state; +} + +static void Task_HandleInput(u8 taskId) +{ + sInputStateFuncs[gTasks[taskId].tState](&gTasks[taskId]); +} + +static void InputState_Disabled(struct Task *task) +{ + task->tKeyboardEvent = 0; +} + +static void InputState_Enabled(struct Task *task) +{ + task->tKeyboardEvent = 0; + + if (gMain.newKeys & A_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_A; + else if (gMain.newKeys & B_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_B; + else if (gMain.newKeys & SELECT_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_SELECT; + else if (gMain.newKeys & START_BUTTON) + task->tKeyboardEvent = KBEVENT_PRESSED_START; + else + HandleDpadMovement(task); +} + +static void InputState_2(struct Task *task) +{ + task->tKeyboardEvent = 0; +} + +static void HandleDpadMovement(struct Task *task) +{ + const s16 sDpadDeltaX[] = + { + 0, //none + 0, //up + 0, //down + -1, //left + 1 //right + }; + + const s16 sDpadDeltaY[] = + { + 0, //none + -1, //up + 1, //down + 0, //left + 0 //right + }; + + const s16 s4RowTo3RowTableY[] = {0, 1, 1, 2}; + const s16 gUnknown_0858BF50[] = {0, 0, 3}; + + s16 cursorX; + s16 cursorY; + u16 dpadDir; + s16 prevCursorX; + + GetCursorPos(&cursorX, &cursorY); + dpadDir = 0; + if (gMain.newAndRepeatedKeys & DPAD_UP) + dpadDir = 1; + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + dpadDir = 2; + if (gMain.newAndRepeatedKeys & DPAD_LEFT) + dpadDir = 3; + if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + dpadDir = 4; + + //Get new cursor position + prevCursorX = cursorX; + cursorX += sDpadDeltaX[dpadDir]; + cursorY += sDpadDeltaY[dpadDir]; + + //Wrap cursor position in the X direction + if (cursorX < 0) + cursorX = GetCurrentPageColumnCount(); + if (cursorX > GetCurrentPageColumnCount()) + cursorX = 0; + + //Handle cursor movement in X direction + if (sDpadDeltaX[dpadDir] != 0) + { + if (cursorX == GetCurrentPageColumnCount()) + { + //We are now on the last column + task->tKbFunctionKey = cursorY; + cursorY = s4RowTo3RowTableY[cursorY]; + } + else if (prevCursorX == GetCurrentPageColumnCount()) + { + if (cursorY == 1) + cursorY = task->tKbFunctionKey; + else + cursorY = gUnknown_0858BF50[cursorY]; + } + } + + if (cursorX == GetCurrentPageColumnCount()) + { + //There are only 3 keys on the last column, unlike the others, + //so wrap Y accordingly + if (cursorY < 0) + cursorY = 2; + if (cursorY > 2) + cursorY = 0; + if (cursorY == 0) + task->tKbFunctionKey = FNKEY_BACK; + else if (cursorY == 2) + task->tKbFunctionKey = FNKEY_OK; + } + else + { + if (cursorY < 0) + cursorY = 3; + if (cursorY > 3) + cursorY = 0; + } + SetCursorPos(cursorX, cursorY); +} + +#undef tState +#undef tKeyboardEvent +#undef tKbFunctionKey + +static void sub_80E4894(void) +{ + FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11); + PrintTextOnWindow(gNamingScreenData->windows[3], 1, gNamingScreenData->template->title, 8, 1, 0, 0); + PutWindowTilemap(gNamingScreenData->windows[3]); +} + +static void sub_80E48E8(void) +{ + u8 buffer[0x20]; + + StringCopy(buffer, gSpeciesNames[gNamingScreenData->monSpecies]); + StringAppendN(buffer, gNamingScreenData->template->title, 15); + FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11); + PrintTextOnWindow(gNamingScreenData->windows[3], 1, buffer, 8, 1, 0, 0); + PutWindowTilemap(gNamingScreenData->windows[3]); +} + +static void (*const gUnknown_0858BF58[])(void) = +{ + sub_80E4894, + sub_80E4894, + sub_80E48E8, + sub_80E48E8, + sub_80E4894, +}; + +static void sub_80E4964(void) +{ + gUnknown_0858BF58[gNamingScreenData->templateNum](); +} + +static void TaskDummy3(void); +static void sub_80E49BC(void); + +static void (*const gUnknown_0858BF6C[])(void) = +{ + TaskDummy3, + sub_80E49BC, +}; + +static void sub_80E498C(void) +{ + gUnknown_0858BF6C[gNamingScreenData->template->addGenderIcon](); +} + +static void TaskDummy3(void) +{ + +} + +static const struct TextColor sGenderColors[2] = +{ + {0, 9, 8}, + {0, 5, 4} +}; + +static void sub_80E49BC(void) +{ + u8 genderSymbol[2]; + bool8 isFemale = FALSE; + + StringCopy(genderSymbol, gText_MaleSymbol); + + if (gNamingScreenData->monGender != MON_GENDERLESS) + { + if (gNamingScreenData->monGender == MON_FEMALE) + { + StringCopy(genderSymbol, gText_FemaleSymbol); + isFemale = TRUE; + } + box_print(gNamingScreenData->windows[2], 1, 0x68, 1, &sGenderColors[isFemale], -1, genderSymbol); + } +} + +static u8 GetCharAtKeyboardPos(s16 a, s16 b) +{ + return gUnknown_0858BE40[a + b * 8 + sub_80E3274() * 32]; +} + + +static u8 GetTextCaretPosition(void) +{ + u8 i; + + for (i = 0; i < gNamingScreenData->template->maxChars; i++) + { + if (gNamingScreenData->textBuffer[i] == EOS) + return i; + } + return gNamingScreenData->template->maxChars - 1; +} + +static u8 GetPreviousTextCaretPosition(void) +{ + s8 i; + + for (i = gNamingScreenData->template->maxChars - 1; i > 0; i--) + { + if (gNamingScreenData->textBuffer[i] != EOS) + return i; + } + return 0; +} + +static void DeleteTextCharacter(void) +{ + u8 index; + u8 var2; + + index = GetPreviousTextCaretPosition(); + gNamingScreenData->textBuffer[index] = 0; + sub_80E4D10(); + CopyBgTilemapBufferToVram(3); + gNamingScreenData->textBuffer[index] = EOS; + var2 = GetKeyRoleAtCursorPos(); + if (var2 == 0 || var2 == 2) + sub_80E3948(1, 0, 1); + PlaySE(SE_BOWA); +} + +static bool8 sub_80E4B54(void) +{ + s16 x; + s16 y; + + GetCursorPos(&x, &y); + AddTextCharacter(GetCharAtKeyboardPos(x, y)); + sub_80E4D10(); + CopyBgTilemapBufferToVram(3); + PlaySE(SE_SELECT); + + if (GetPreviousTextCaretPosition() != gNamingScreenData->template->maxChars - 1) + return FALSE; + else + return TRUE; +} + +static void AddTextCharacter(u8 ch) +{ + u8 index = GetTextCaretPosition(); + + gNamingScreenData->textBuffer[index] = ch; +} + +static void sub_80E4BE4(void) +{ + u8 i; + + for (i = 0; i < gNamingScreenData->template->maxChars; i++) + { + if (gNamingScreenData->textBuffer[i] != CHAR_SPACE && gNamingScreenData->textBuffer[i] != EOS) + { + StringCopyN(gNamingScreenData->destBuffer, gNamingScreenData->textBuffer, gNamingScreenData->template->maxChars + 1); + break; + } + } +} + +static void choose_name_or_words_screen_load_bg_tile_patterns(void) +{ + LZ77UnCompWram(gNamingScreenMenu_Gfx, gNamingScreenData->tileBuffer); + LoadBgTiles(1, gNamingScreenData->tileBuffer, 0x600, 0); + LoadBgTiles(2, gNamingScreenData->tileBuffer, 0x600, 0); + LoadBgTiles(3, gNamingScreenData->tileBuffer, 0x600, 0); + LoadSpriteSheets(gUnknown_0858C1C8); + LoadSpritePalettes(gUnknown_0858C230); +} + +static void sub_80E4CB8(void) +{ + InputInit(); + sub_80E3920(); +} + +static void choose_name_or_words_screen_apply_bg_pals(void) +{ + LoadPalette(gNamingScreenMenu_Pal, 0, 0xC0); + LoadPalette(gUnknown_0858BD78, 0xA0, sizeof(gUnknown_0858BD78)); + LoadPalette(stdpal_get(2), 0xB0, 0x20); +} + +static void sub_80E4CF8(u8 bg, const void *src) +{ + CopyToBgTilemapBuffer(bg, src, 0, 0); +} + +static void nullsub_10(u8 a1, u8 a2) +{ + +} + +static void sub_80E4D10(void) +{ + u8 i; + u8 temp[2]; + u16 unk2; + u8 maxChars = gNamingScreenData->template->maxChars; + u16 unk = gNamingScreenData->inputCharBaseXPos - 0x40; + + FillWindowPixelBuffer(gNamingScreenData->windows[2], 0x11); + + for (i = 0; i < maxChars; i++) + { + temp[0] = gNamingScreenData->textBuffer[i]; + temp[1] = gExpandedPlaceholder_Empty[0]; + unk2 = (sub_80E503C(temp[0]) == 1) ? 2 : 0; + + PrintTextOnWindow(gNamingScreenData->windows[2], 1, temp, i * 8 + unk + unk2, 1, 0xFF, NULL); + } + + sub_80E498C(); + CopyWindowToVram(gNamingScreenData->windows[2], 2); + PutWindowTilemap(gNamingScreenData->windows[2]); +} + +static const struct AlignedTextColor sUnkColor1 = +{ + 13, 1, 2 +}; + +static const struct AlignedTextColor sUnkColor2 = +{ + 14, 1, 2 +}; + +static const struct AlignedTextColor sUnkColor3 = +{ + 15, 1, 2 +}; + +static const u8 sFillValues[3] = +{ + 0xEE, 0xDD, 0xFF +}; + +static const struct AlignedTextColor *const sUnkColors[3] = +{ + &sUnkColor2, + &sUnkColor1, + &sUnkColor3 +}; + +static void sub_80E4DE4(u8 window, u8 a1) +{ + u8 i; + + FillWindowPixelBuffer(window, sFillValues[a1]); + + for (i = 0; i < 4; i++) + { + box_print(window, 1, 0, i * 16 + 1, sUnkColors[a1], 0, gUnknown_0858C198[a1][i]); + } + + PutWindowTilemap(window); +} + +static const u8 *const gUnknown_0858BF98[] = +{ + gUnknown_08DD4620, + gUnknown_08DD46E0, + gUnknown_08DD47A0 +}; + +static void sub_80E4E5C(void) +{ + u8 unk1; + u8 unk2; + u8 unk3; + u8 bg1Priority = GetGpuReg(REG_OFFSET_BG1CNT) & 3; + u8 bg2Priority = GetGpuReg(REG_OFFSET_BG2CNT) & 3; + + if (bg1Priority > bg2Priority) + { + unk1 = 1; + unk2 = 1; + unk3 = gNamingScreenData->windows[0]; + } + else + { + unk1 = 2; + unk2 = 2; + unk3 = gNamingScreenData->windows[1]; + } + + sub_80E4CF8(unk1, gUnknown_0858BF98[gNamingScreenData->currentPage]); + sub_80E4DE4(unk3, sub_80E3254()); + nullsub_10(unk1, sub_80E3254()); + CopyBgTilemapBufferToVram(unk2); +} + +static void sub_80E4EF0(void) +{ + const struct TextColor color[] = { 15, 1, 2 }; + + FillWindowPixelBuffer(gNamingScreenData->windows[4], 0xFF); + box_print(gNamingScreenData->windows[4], 0, 2, 1, color, 0, gText_MoveOkBack); + PutWindowTilemap(gNamingScreenData->windows[4]); + CopyWindowToVram(gNamingScreenData->windows[4], 3); +} + +static void sub_80E4F58(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void NamingScreen_TurnOffScreen(void) +{ + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); +} + +static void NamingScreen_InitDisplayMode(void) +{ + SetVBlankCallback(VBlankCB_NamingScreen); +} + +static void VBlankCB_NamingScreen(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + SetGpuReg(REG_OFFSET_BG1VOFS, gNamingScreenData->bg1vOffset); + SetGpuReg(REG_OFFSET_BG2VOFS, gNamingScreenData->bg2vOffset); + SetGpuReg(REG_OFFSET_BG1CNT, GetGpuReg(REG_OFFSET_BG1CNT) & 0xFFFC); + SetGpuRegBits(REG_OFFSET_BG1CNT, gNamingScreenData->bg1Priority); + SetGpuReg(REG_OFFSET_BG2CNT, GetGpuReg(REG_OFFSET_BG2CNT) & 0xFFFC); + SetGpuRegBits(REG_OFFSET_BG2CNT, gNamingScreenData->bg2Priority); +} + +static void sub_80E501C(void) +{ + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); +} + +static bool8 sub_80E503C(u8 character) +{ + u8 i; + + for (i = 0; gUnknown_0858BDC8[i] != EOS; i++) + { + if (character == gUnknown_0858BDC8[i]) + return FALSE; + } + return FALSE; +} + +static void sub_80E5074(void) +{ + DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E509C(void) +{ + DoNamingScreen(1, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E50C4(void) +{ + DoNamingScreen(2, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +static void sub_80E50EC(void) +{ + DoNamingScreen(3, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194); +} + +//-------------------------------------------------- +// Forward-declared variables +//-------------------------------------------------- + +static const struct NamingScreenTemplate playerNamingScreenTemplate = +{ + .copyExistingString = 0, + .maxChars = 7, + .iconFunction = 1, + .addGenderIcon = 0, + .initialPage = 1, + .unused = 35, + .title = gText_YourName, +}; + +static const struct NamingScreenTemplate pcBoxNamingTemplate = +{ + .copyExistingString = 0, + .maxChars = 8, + .iconFunction = 2, + .addGenderIcon = 0, + .initialPage = 1, + .unused = 19, + .title = gText_BoxName, +}; + +static const struct NamingScreenTemplate monNamingScreenTemplate = +{ + .copyExistingString = 0, + .maxChars = 10, + .iconFunction = 3, + .addGenderIcon = 1, + .initialPage = 1, + .unused = 35, + .title = gText_PkmnsNickname, +}; + +static const struct NamingScreenTemplate wandaWordsScreenTemplate = +{ + .copyExistingString = 1, + .maxChars = 15, + .iconFunction = 4, + .addGenderIcon = 0, + .initialPage = 1, + .unused = 11, + .title = gText_TellHimTheWords, +}; + +static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = +{ + &playerNamingScreenTemplate, + &pcBoxNamingTemplate, + &monNamingScreenTemplate, + &monNamingScreenTemplate, + &wandaWordsScreenTemplate, +}; + +const struct OamData gOamData_858BFEC = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gOamData_858BFF4 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gOamData_858BFFC = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +static const struct Subsprite gUnknown_0858C004[] = +{ + {-20, -16, 1, 1, 0, 1}, + { 12, -16, 0, 0, 4, 1}, + {-20, -8, 1, 1, 5, 1}, + { 12, -8, 0, 0, 9, 1}, + {-20, 0, 1, 1, 10, 1}, + { 12, 0, 0, 0, 14, 1}, + {-20, 8, 1, 1, 15, 1}, + { 12, 8, 0, 0, 19, 1} +}; + +static const struct Subsprite gUnknown_0858C024[] = +{ + {-12, -4, 1, 0, 0, 1}, + { 4, -4, 0, 0, 2, 1} +}; + +static const struct Subsprite gUnknown_0858C02C[] = +{ + {-20, -12, 1, 1, 0, 1}, + { 12, -12, 0, 0, 4, 1}, + {-20, -4, 1, 1, 5, 1}, + { 12, -4, 0, 0, 9, 1}, + {-20, 4, 1, 1, 10, 1}, + { 12, 4, 0, 0, 14, 1} +}; + +static const struct Subsprite gUnknown_0858C044[] = +{ + {-8, -12, 1, 0, 0, 3}, + {-8, -4, 1, 0, 2, 3}, + {-8, 4, 1, 0, 4, 3} +}; + +static const struct SubspriteTable gUnknown_0858C050[] = +{ + {ARRAY_COUNT(gUnknown_0858C004), gUnknown_0858C004} +}; + +static const struct SubspriteTable gUnknown_0858C058[] = +{ + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024}, + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024}, + {ARRAY_COUNT(gUnknown_0858C024), gUnknown_0858C024} +}; + +static const struct SubspriteTable gUnknown_0858C070[] = +{ + {ARRAY_COUNT(gUnknown_0858C02C), gUnknown_0858C02C} +}; + +static const struct SubspriteTable gUnknown_0858C078[] = +{ + {ARRAY_COUNT(gUnknown_0858C044), gUnknown_0858C044} +}; + +static const struct SpriteFrameImage gUnknown_0858C080[] = +{ + {gSpriteImage_858BBF8, sizeof(gSpriteImage_858BBF8)}, + {gSpriteImage_858BCB8, sizeof(gSpriteImage_858BCB8)}, +}; + +static const union AnimCmd gSpriteAnim_858C090[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_858C098[] = +{ + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(8, 8), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_858C0A4[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(1, 2), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0B0[] = +{ + gSpriteAnim_858C090 +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0B4[] = +{ + gSpriteAnim_858C090, + gSpriteAnim_858C098 +}; + +static const union AnimCmd *const gSpriteAnimTable_858C0BC[] = +{ + gSpriteAnim_858C0A4 +}; + +static const struct SpriteTemplate gUnknown_0858C0C0 = +{ + .tileTag = 0x0002, + .paletteTag = 0x0004, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E4084 +}; + +static const struct SpriteTemplate gUnknown_0858C0D8 = +{ + .tileTag = 0x0003, + .paletteTag = 0x0001, + .oam = &gOamData_858BFFC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C0F0 = +{ + .tileTag = 0x0004, + .paletteTag = 0x0004, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C108 = +{ + .tileTag = 0x0000, + .paletteTag = 0x0006, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C120 = +{ + .tileTag = 0x0001, + .paletteTag = 0x0007, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_0858C138 = +{ + .tileTag = 0x0007, + .paletteTag = 0x0005, + .oam = &gOamData_858BFF4, + .anims = gSpriteAnimTable_858C0B4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3B30 +}; + +static const struct SpriteTemplate sSpriteTemplate_InputArrow = +{ + .tileTag = 0x000A, + .paletteTag = 0x0003, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3C20 +}; + +static const struct SpriteTemplate sSpriteTemplate_Underscore = +{ + .tileTag = 0x000B, + .paletteTag = 0x0003, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0B0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80E3C6C +}; + +static const struct SpriteTemplate gUnknown_0858C180 = +{ + .tileTag = 0xFFFF, + .paletteTag = 0x0000, + .oam = &gOamData_858BFEC, + .anims = gSpriteAnimTable_858C0BC, + .images = gUnknown_0858C080, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const u8* const gUnknown_0858C198[][4] = +{ + { + gUnknown_0862B88D, + gUnknown_0862B8AE, + gUnknown_0862B8CF, + gUnknown_0862B8F0 + }, + { + gUnknown_0862B911, + gUnknown_0862B932, + gUnknown_0862B953, + gUnknown_0862B974 + }, + { + gUnknown_0862B995, + gUnknown_0862B9AE, + gUnknown_0862B9C7, + gUnknown_0862B9E0 + }, +}; + +static const struct SpriteSheet gUnknown_0858C1C8[] = +{ + {gNamingScreenRWindow_Gfx + 0x280, 0x1E0, 0x0000}, + {gNamingScreenRWindow_Gfx + 0x460, 0x1E0, 0x0001}, + {gNamingScreenRWindow_Gfx, 0x280, 0x0002}, + {gNamingScreenKeyboardButton_Gfx + 0x20, 0x100, 0x0003}, + {gNamingScreenROptions_Gfx, 0x060, 0x0004}, + {gNamingScreenROptions_Gfx + 0xA0, 0x060, 0x0005}, + {gNamingScreenROptions_Gfx + 0x140, 0x060, 0x0006}, + {gNamingScreenCursor_Gfx, 0x080, 0x0007}, + {gNamingScreenCursor_Gfx + 0xA0, 0x080, 0x0008}, + {gNamingScreenCursor_Gfx + 0x140, 0x080, 0x0009}, + {gNamingScreenRightPointingTriangleTiles, 0x020, 0x000A}, + {gNamingScreenUnderscoreTiles, 0x020, 0x000B}, + {NULL} +}; + +static const struct SpritePalette gUnknown_0858C230[] = +{ + {gNamingScreenMenu_Pal, 0x0000}, + {gNamingScreenMenu_Pal + 0x10, 0x0001}, + {gNamingScreenMenu_Pal + 0x20, 0x0002}, + {gNamingScreenMenu_Pal + 0x30, 0x0003}, + {gNamingScreenMenu_Pal + 0x40, 0x0004}, + {gNamingScreenMenu_Pal + 0x50, 0x0005}, + {gNamingScreenMenu_Pal + 0x40, 0x0006}, + {gNamingScreenMenu_Pal + 0x40, 0x0007}, + {NULL} +}; diff --git a/src/option_menu.c b/src/option_menu.c index 7f92756ab..cbbe14b77 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -2,7 +2,7 @@ #include "option_menu.h" #include "main.h" #include "menu.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "palette.h" #include "sprite.h" #include "task.h" diff --git a/src/palette.c b/src/palette.c index 417981e47..6d709c19c 100644 --- a/src/palette.c +++ b/src/palette.c @@ -4,6 +4,7 @@ #include "decompress.h" #include "gpu_regs.h" #include "task.h" +#include "constants/rgb.h" enum { diff --git a/src/pokeblock.c b/src/pokeblock.c index 573eed52b..472b030e0 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -14,7 +14,7 @@ #include "battle.h" #include "battle_controllers.h" #include "palette.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "list_menu.h" #include "gpu_regs.h" #include "decompress.h" @@ -583,7 +583,7 @@ static void HandleInitWindows(void) static void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x) { - AddTextPrinterParametrized2(windowId, 1, x, 1, 0, 0, &sTextColorInPokeblockMenu, 0, string); + AddTextPrinterParameterized2(windowId, 1, x, 1, 0, 0, &sTextColorInPokeblockMenu, 0, string); } static void PutPokeblockInfoText(void) diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index b26da118c..d899e54f1 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -792,7 +792,7 @@ static void Task_HandleMonAtePokeblock(u8 taskId) StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2); gTextFlags.flag_0 = 1; - AddTextPrinterParametrized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); + AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); gTasks[taskId].func = Task_WaitForAtePokeblockText; } diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 95ec4b6a2..7ffb2f36a 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -74,8 +74,6 @@ extern u8 GetFrontierOpponentClass(u16 trainerId); extern u8 pokemon_order_func(u8 bankPartyId); extern void GetFrontierTrainerName(u8* dest, u16 trainerId); extern void sub_81C488C(u8); -extern void sub_817F578(struct Sprite*, u8 frontAnimId); -extern u8 GetSpeciesBackAnimId(u16 species); static void sub_806E6CC(u8 taskId); @@ -1508,7 +1506,7 @@ static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) { if (--gTasks[taskId].data[3] == 0) { - sub_817F578(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); + StartMonSummaryAnimation(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); sub_81C488C(0xFF); DestroyTask(taskId); } @@ -1523,7 +1521,6 @@ void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u } extern void SpriteCallbackDummy_2(struct Sprite*); -extern void sub_817F60C(struct Sprite*); void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3) { @@ -1580,11 +1577,11 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF gTasks[taskId].data[2] = gMonFrontAnimIdsTable[species - 1]; gTasks[taskId].data[3] = gMonAnimationDelayTable[species - 1]; sub_81C488C(taskId); - sub_817F60C(sprite); + SetSpriteCB_MonAnimDummy(sprite); } else { - sub_817F578(sprite, gMonFrontAnimIdsTable[species - 1]); + StartMonSummaryAnimation(sprite, gMonFrontAnimIdsTable[species - 1]); } } @@ -1603,7 +1600,7 @@ void BattleAnimateBackSprite(struct Sprite* sprite, u16 species) } else { - LaunchAnimationTaskForBackSprite(sprite, GetSpeciesBackAnimId(species)); + LaunchAnimationTaskForBackSprite(sprite, GetSpeciesBackAnimSet(species)); sprite->callback = SpriteCallbackDummy_2; } } diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c new file mode 100644 index 000000000..2bd4e3ef9 --- /dev/null +++ b/src/pokemon_animation.c @@ -0,0 +1,5658 @@ +#include "global.h" +#include "pokemon.h" +#include "sprite.h" +#include "pokemon_animation.h" +#include "trig.h" +#include "task.h" +#include "blend_palette.h" +#include "constants/rgb.h" + +struct UnkAnimStruct +{ + u16 field_0; + s16 field_2; + s16 field_4; + s16 field_6; + s16 field_8; +}; + +extern u16 gBattlePartyID[]; + +// this file's functions +static void pokemonanimfunc_00(struct Sprite *sprite); +static void pokemonanimfunc_01(struct Sprite *sprite); +static void pokemonanimfunc_02(struct Sprite *sprite); +static void pokemonanimfunc_03(struct Sprite *sprite); +static void pokemonanimfunc_04(struct Sprite *sprite); +static void pokemonanimfunc_05(struct Sprite *sprite); +static void pokemonanimfunc_06(struct Sprite *sprite); +static void pokemonanimfunc_07(struct Sprite *sprite); +static void pokemonanimfunc_08(struct Sprite *sprite); +static void pokemonanimfunc_09(struct Sprite *sprite); +static void pokemonanimfunc_0A(struct Sprite *sprite); +static void pokemonanimfunc_0B(struct Sprite *sprite); +static void pokemonanimfunc_0C(struct Sprite *sprite); +static void pokemonanimfunc_0D(struct Sprite *sprite); +static void pokemonanimfunc_0E(struct Sprite *sprite); +static void pokemonanimfunc_0F(struct Sprite *sprite); +static void pokemonanimfunc_10(struct Sprite *sprite); +static void pokemonanimfunc_11(struct Sprite *sprite); +static void pokemonanimfunc_12(struct Sprite *sprite); +static void pokemonanimfunc_13(struct Sprite *sprite); +static void pokemonanimfunc_14(struct Sprite *sprite); +static void pokemonanimfunc_15(struct Sprite *sprite); +static void pokemonanimfunc_16(struct Sprite *sprite); +static void pokemonanimfunc_17(struct Sprite *sprite); +static void pokemonanimfunc_18(struct Sprite *sprite); +static void pokemonanimfunc_19(struct Sprite *sprite); +static void pokemonanimfunc_1A(struct Sprite *sprite); +static void pokemonanimfunc_1B(struct Sprite *sprite); +static void pokemonanimfunc_1C(struct Sprite *sprite); +static void pokemonanimfunc_1D(struct Sprite *sprite); +static void pokemonanimfunc_1E(struct Sprite *sprite); +static void pokemonanimfunc_1F(struct Sprite *sprite); +static void pokemonanimfunc_20(struct Sprite *sprite); +static void pokemonanimfunc_21(struct Sprite *sprite); +static void pokemonanimfunc_22(struct Sprite *sprite); +static void pokemonanimfunc_23(struct Sprite *sprite); +static void pokemonanimfunc_24(struct Sprite *sprite); +static void pokemonanimfunc_25(struct Sprite *sprite); +static void pokemonanimfunc_26(struct Sprite *sprite); +static void pokemonanimfunc_27(struct Sprite *sprite); +static void pokemonanimfunc_28(struct Sprite *sprite); +static void pokemonanimfunc_29(struct Sprite *sprite); +static void pokemonanimfunc_2A(struct Sprite *sprite); +static void pokemonanimfunc_2B(struct Sprite *sprite); +static void pokemonanimfunc_2C(struct Sprite *sprite); +static void pokemonanimfunc_2D(struct Sprite *sprite); +static void pokemonanimfunc_2E(struct Sprite *sprite); +static void pokemonanimfunc_2F(struct Sprite *sprite); +static void pokemonanimfunc_30(struct Sprite *sprite); +static void pokemonanimfunc_31(struct Sprite *sprite); +static void pokemonanimfunc_32(struct Sprite *sprite); +static void pokemonanimfunc_33(struct Sprite *sprite); +static void pokemonanimfunc_34(struct Sprite *sprite); +static void pokemonanimfunc_35(struct Sprite *sprite); +static void pokemonanimfunc_36(struct Sprite *sprite); +static void pokemonanimfunc_37(struct Sprite *sprite); +static void pokemonanimfunc_38(struct Sprite *sprite); +static void pokemonanimfunc_39(struct Sprite *sprite); +static void pokemonanimfunc_3A(struct Sprite *sprite); +static void pokemonanimfunc_3B(struct Sprite *sprite); +static void pokemonanimfunc_3C(struct Sprite *sprite); +static void pokemonanimfunc_3D(struct Sprite *sprite); +static void pokemonanimfunc_3E(struct Sprite *sprite); +static void pokemonanimfunc_3F(struct Sprite *sprite); +static void pokemonanimfunc_40(struct Sprite *sprite); +static void pokemonanimfunc_41(struct Sprite *sprite); +static void pokemonanimfunc_42(struct Sprite *sprite); +static void pokemonanimfunc_43(struct Sprite *sprite); +static void pokemonanimfunc_44(struct Sprite *sprite); +static void pokemonanimfunc_45(struct Sprite *sprite); +static void pokemonanimfunc_46(struct Sprite *sprite); +static void pokemonanimfunc_47(struct Sprite *sprite); +static void pokemonanimfunc_48(struct Sprite *sprite); +static void pokemonanimfunc_49(struct Sprite *sprite); +static void pokemonanimfunc_4A(struct Sprite *sprite); +static void pokemonanimfunc_4B(struct Sprite *sprite); +static void pokemonanimfunc_4C(struct Sprite *sprite); +static void pokemonanimfunc_4D(struct Sprite *sprite); +static void pokemonanimfunc_4E(struct Sprite *sprite); +static void pokemonanimfunc_4F(struct Sprite *sprite); +static void pokemonanimfunc_50(struct Sprite *sprite); +static void pokemonanimfunc_51(struct Sprite *sprite); +static void pokemonanimfunc_52(struct Sprite *sprite); +static void pokemonanimfunc_53(struct Sprite *sprite); +static void pokemonanimfunc_54(struct Sprite *sprite); +static void pokemonanimfunc_55(struct Sprite *sprite); +static void pokemonanimfunc_56(struct Sprite *sprite); +static void pokemonanimfunc_57(struct Sprite *sprite); +static void pokemonanimfunc_58(struct Sprite *sprite); +static void pokemonanimfunc_59(struct Sprite *sprite); +static void pokemonanimfunc_5A(struct Sprite *sprite); +static void pokemonanimfunc_5B(struct Sprite *sprite); +static void pokemonanimfunc_5C(struct Sprite *sprite); +static void pokemonanimfunc_5D(struct Sprite *sprite); +static void pokemonanimfunc_5E(struct Sprite *sprite); +static void pokemonanimfunc_5F(struct Sprite *sprite); +static void pokemonanimfunc_60(struct Sprite *sprite); +static void pokemonanimfunc_61(struct Sprite *sprite); +static void pokemonanimfunc_62(struct Sprite *sprite); +static void pokemonanimfunc_63(struct Sprite *sprite); +static void pokemonanimfunc_64(struct Sprite *sprite); +static void pokemonanimfunc_65(struct Sprite *sprite); +static void pokemonanimfunc_66(struct Sprite *sprite); +static void pokemonanimfunc_67(struct Sprite *sprite); +static void pokemonanimfunc_68(struct Sprite *sprite); +static void pokemonanimfunc_69(struct Sprite *sprite); +static void pokemonanimfunc_6A(struct Sprite *sprite); +static void pokemonanimfunc_6B(struct Sprite *sprite); +static void pokemonanimfunc_6C(struct Sprite *sprite); +static void pokemonanimfunc_6D(struct Sprite *sprite); +static void pokemonanimfunc_6E(struct Sprite *sprite); +static void pokemonanimfunc_6F(struct Sprite *sprite); +static void pokemonanimfunc_70(struct Sprite *sprite); +static void pokemonanimfunc_71(struct Sprite *sprite); +static void pokemonanimfunc_72(struct Sprite *sprite); +static void pokemonanimfunc_73(struct Sprite *sprite); +static void pokemonanimfunc_74(struct Sprite *sprite); +static void pokemonanimfunc_75(struct Sprite *sprite); +static void pokemonanimfunc_76(struct Sprite *sprite); +static void pokemonanimfunc_77(struct Sprite *sprite); +static void pokemonanimfunc_78(struct Sprite *sprite); +static void pokemonanimfunc_79(struct Sprite *sprite); +static void pokemonanimfunc_7A(struct Sprite *sprite); +static void pokemonanimfunc_7B(struct Sprite *sprite); +static void pokemonanimfunc_7C(struct Sprite *sprite); +static void pokemonanimfunc_7D(struct Sprite *sprite); +static void pokemonanimfunc_7E(struct Sprite *sprite); +static void pokemonanimfunc_7F(struct Sprite *sprite); +static void pokemonanimfunc_80(struct Sprite *sprite); +static void pokemonanimfunc_81(struct Sprite *sprite); +static void pokemonanimfunc_82(struct Sprite *sprite); +static void pokemonanimfunc_83(struct Sprite *sprite); +static void pokemonanimfunc_84(struct Sprite *sprite); +static void pokemonanimfunc_85(struct Sprite *sprite); +static void pokemonanimfunc_86(struct Sprite *sprite); +static void pokemonanimfunc_87(struct Sprite *sprite); +static void pokemonanimfunc_88(struct Sprite *sprite); +static void pokemonanimfunc_89(struct Sprite *sprite); +static void pokemonanimfunc_8A(struct Sprite *sprite); +static void pokemonanimfunc_8B(struct Sprite *sprite); +static void pokemonanimfunc_8C(struct Sprite *sprite); +static void pokemonanimfunc_8D(struct Sprite *sprite); +static void pokemonanimfunc_8E(struct Sprite *sprite); +static void pokemonanimfunc_8F(struct Sprite *sprite); +static void pokemonanimfunc_90(struct Sprite *sprite); +static void pokemonanimfunc_91(struct Sprite *sprite); +static void pokemonanimfunc_92(struct Sprite *sprite); +static void pokemonanimfunc_93(struct Sprite *sprite); +static void pokemonanimfunc_94(struct Sprite *sprite); +static void pokemonanimfunc_95(struct Sprite *sprite); +static void pokemonanimfunc_96(struct Sprite *sprite); + +static void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite); + +#define STRUCT_COUNT 4 + +// IWRAM bss +static IWRAM_DATA struct UnkAnimStruct sUnknown_03001240[STRUCT_COUNT]; +static IWRAM_DATA u8 sUnknown_03001270; +static IWRAM_DATA bool32 sUnknown_03001274; + +// const rom data +static const u8 sSpeciesToBackAnimSet[] = +{ + 0x00, // SPECIES_NONE + 0x13, // SPECIES_BULBASAUR + 0x02, // SPECIES_IVYSAUR + 0x08, // SPECIES_VENUSAUR + 0x12, // SPECIES_CHARMANDER + 0x15, // SPECIES_CHARMELEON + 0x17, // SPECIES_CHARIZARD + 0x12, // SPECIES_SQUIRTLE + 0x12, // SPECIES_WARTORTLE + 0x19, // SPECIES_BLASTOISE + 0x02, // SPECIES_CATERPIE + 0x13, // SPECIES_METAPOD + 0x11, // SPECIES_BUTTERFREE + 0x02, // SPECIES_WEEDLE + 0x13, // SPECIES_KAKUNA + 0x01, // SPECIES_BEEDRILL + 0x0f, // SPECIES_PIDGEY + 0x15, // SPECIES_PIDGEOTTO + 0x0f, // SPECIES_PIDGEOT + 0x0a, // SPECIES_RATTATA + 0x0a, // SPECIES_RATICATE + 0x0f, // SPECIES_SPEAROW + 0x15, // SPECIES_FEAROW + 0x0f, // SPECIES_EKANS + 0x09, // SPECIES_ARBOK + 0x16, // SPECIES_PIKACHU + 0x16, // SPECIES_RAICHU + 0x12, // SPECIES_SANDSHREW + 0x10, // SPECIES_SANDSLASH + 0x12, // SPECIES_NIDORAN_F + 0x15, // SPECIES_NIDORINA + 0x09, // SPECIES_NIDOQUEEN + 0x12, // SPECIES_NIDORAN_M + 0x15, // SPECIES_NIDORINO + 0x09, // SPECIES_NIDOKING + 0x13, // SPECIES_CLEFAIRY + 0x13, // SPECIES_CLEFABLE + 0x10, // SPECIES_VULPIX + 0x01, // SPECIES_NINETALES + 0x13, // SPECIES_JIGGLYPUFF + 0x06, // SPECIES_WIGGLYTUFF + 0x11, // SPECIES_ZUBAT + 0x09, // SPECIES_GOLBAT + 0x02, // SPECIES_ODDISH + 0x02, // SPECIES_GLOOM + 0x14, // SPECIES_VILEPLUME + 0x02, // SPECIES_PARAS + 0x08, // SPECIES_PARASECT + 0x0a, // SPECIES_VENONAT + 0x11, // SPECIES_VENOMOTH + 0x09, // SPECIES_DIGLETT + 0x09, // SPECIES_DUGTRIO + 0x10, // SPECIES_MEOWTH + 0x0f, // SPECIES_PERSIAN + 0x02, // SPECIES_PSYDUCK + 0x14, // SPECIES_GOLDUCK + 0x10, // SPECIES_MANKEY + 0x10, // SPECIES_PRIMEAPE + 0x15, // SPECIES_GROWLITHE + 0x15, // SPECIES_ARCANINE + 0x12, // SPECIES_POLIWAG + 0x09, // SPECIES_POLIWHIRL + 0x0e, // SPECIES_POLIWRATH + 0x14, // SPECIES_ABRA + 0x14, // SPECIES_KADABRA + 0x0d, // SPECIES_ALAKAZAM + 0x15, // SPECIES_MACHOP + 0x09, // SPECIES_MACHOKE + 0x09, // SPECIES_MACHAMP + 0x0b, // SPECIES_BELLSPROUT + 0x0b, // SPECIES_WEEPINBELL + 0x0b, // SPECIES_VICTREEBEL + 0x02, // SPECIES_TENTACOOL + 0x02, // SPECIES_TENTACRUEL + 0x0e, // SPECIES_GEODUDE + 0x08, // SPECIES_GRAVELER + 0x08, // SPECIES_GOLEM + 0x17, // SPECIES_PONYTA + 0x15, // SPECIES_RAPIDASH + 0x02, // SPECIES_SLOWPOKE + 0x13, // SPECIES_SLOWBRO + 0x0f, // SPECIES_MAGNEMITE + 0x0f, // SPECIES_MAGNETON + 0x02, // SPECIES_FARFETCHD + 0x0f, // SPECIES_DODUO + 0x15, // SPECIES_DODRIO + 0x13, // SPECIES_SEEL + 0x02, // SPECIES_DEWGONG + 0x0b, // SPECIES_GRIMER + 0x0c, // SPECIES_MUK + 0x13, // SPECIES_SHELLDER + 0x0f, // SPECIES_CLOYSTER + 0x01, // SPECIES_GASTLY + 0x01, // SPECIES_HAUNTER + 0x14, // SPECIES_GENGAR + 0x09, // SPECIES_ONIX + 0x13, // SPECIES_DROWZEE + 0x14, // SPECIES_HYPNO + 0x0a, // SPECIES_KRABBY + 0x09, // SPECIES_KINGLER + 0x15, // SPECIES_VOLTORB + 0x15, // SPECIES_ELECTRODE + 0x02, // SPECIES_EXEGGCUTE + 0x10, // SPECIES_EXEGGUTOR + 0x15, // SPECIES_CUBONE + 0x10, // SPECIES_MAROWAK + 0x02, // SPECIES_HITMONLEE + 0x0f, // SPECIES_HITMONCHAN + 0x02, // SPECIES_LICKITUNG + 0x06, // SPECIES_KOFFING + 0x06, // SPECIES_WEEZING + 0x0e, // SPECIES_RHYHORN + 0x0e, // SPECIES_RHYDON + 0x12, // SPECIES_CHANSEY + 0x0b, // SPECIES_TANGELA + 0x12, // SPECIES_KANGASKHAN + 0x13, // SPECIES_HORSEA + 0x11, // SPECIES_SEADRA + 0x11, // SPECIES_GOLDEEN + 0x11, // SPECIES_SEAKING + 0x13, // SPECIES_STARYU + 0x19, // SPECIES_STARMIE + 0x14, // SPECIES_MR_MIME + 0x0f, // SPECIES_SCYTHER + 0x13, // SPECIES_JYNX + 0x16, // SPECIES_ELECTABUZZ + 0x17, // SPECIES_MAGMAR + 0x0e, // SPECIES_PINSIR + 0x0e, // SPECIES_TAUROS + 0x10, // SPECIES_MAGIKARP + 0x09, // SPECIES_GYARADOS + 0x19, // SPECIES_LAPRAS + 0x05, // SPECIES_DITTO + 0x12, // SPECIES_EEVEE + 0x19, // SPECIES_VAPOREON + 0x16, // SPECIES_JOLTEON + 0x17, // SPECIES_FLAREON + 0x01, // SPECIES_PORYGON + 0x13, // SPECIES_OMANYTE + 0x13, // SPECIES_OMASTAR + 0x13, // SPECIES_KABUTO + 0x15, // SPECIES_KABUTOPS + 0x15, // SPECIES_AERODACTYL + 0x13, // SPECIES_SNORLAX + 0x19, // SPECIES_ARTICUNO + 0x16, // SPECIES_ZAPDOS + 0x17, // SPECIES_MOLTRES + 0x02, // SPECIES_DRATINI + 0x0f, // SPECIES_DRAGONAIR + 0x09, // SPECIES_DRAGONITE + 0x0d, // SPECIES_MEWTWO + 0x12, // SPECIES_MEW + 0x12, // SPECIES_CHIKORITA + 0x02, // SPECIES_BAYLEEF + 0x09, // SPECIES_MEGANIUM + 0x12, // SPECIES_CYNDAQUIL + 0x15, // SPECIES_QUILAVA + 0x17, // SPECIES_TYPHLOSION + 0x15, // SPECIES_TOTODILE + 0x15, // SPECIES_CROCONAW + 0x09, // SPECIES_FERALIGATR + 0x12, // SPECIES_SENTRET + 0x10, // SPECIES_FURRET + 0x11, // SPECIES_HOOTHOOT + 0x0f, // SPECIES_NOCTOWL + 0x0a, // SPECIES_LEDYBA + 0x11, // SPECIES_LEDIAN + 0x0a, // SPECIES_SPINARAK + 0x02, // SPECIES_ARIADOS + 0x0f, // SPECIES_CROBAT + 0x0b, // SPECIES_CHINCHOU + 0x16, // SPECIES_LANTURN + 0x12, // SPECIES_PICHU + 0x13, // SPECIES_CLEFFA + 0x13, // SPECIES_IGGLYBUFF + 0x13, // SPECIES_TOGEPI + 0x11, // SPECIES_TOGETIC + 0x12, // SPECIES_NATU + 0x14, // SPECIES_XATU + 0x12, // SPECIES_MAREEP + 0x13, // SPECIES_FLAAFFY + 0x16, // SPECIES_AMPHAROS + 0x11, // SPECIES_BELLOSSOM + 0x12, // SPECIES_MARILL + 0x13, // SPECIES_AZUMARILL + 0x02, // SPECIES_SUDOWOODO + 0x10, // SPECIES_POLITOED + 0x11, // SPECIES_HOPPIP + 0x11, // SPECIES_SKIPLOOM + 0x11, // SPECIES_JUMPLUFF + 0x10, // SPECIES_AIPOM + 0x13, // SPECIES_SUNKERN + 0x02, // SPECIES_SUNFLORA + 0x11, // SPECIES_YANMA + 0x0b, // SPECIES_WOOPER + 0x02, // SPECIES_QUAGSIRE + 0x14, // SPECIES_ESPEON + 0x14, // SPECIES_UMBREON + 0x12, // SPECIES_MURKROW + 0x13, // SPECIES_SLOWKING + 0x01, // SPECIES_MISDREAVUS + 0x14, // SPECIES_UNOWN + 0x0b, // SPECIES_WOBBUFFET + 0x14, // SPECIES_GIRAFARIG + 0x08, // SPECIES_PINECO + 0x09, // SPECIES_FORRETRESS + 0x0f, // SPECIES_DUNSPARCE + 0x05, // SPECIES_GLIGAR + 0x09, // SPECIES_STEELIX + 0x15, // SPECIES_SNUBBULL + 0x09, // SPECIES_GRANBULL + 0x0d, // SPECIES_QWILFISH + 0x15, // SPECIES_SCIZOR + 0x13, // SPECIES_SHUCKLE + 0x15, // SPECIES_HERACROSS + 0x0f, // SPECIES_SNEASEL + 0x13, // SPECIES_TEDDIURSA + 0x09, // SPECIES_URSARING + 0x17, // SPECIES_SLUGMA + 0x17, // SPECIES_MAGCARGO + 0x0a, // SPECIES_SWINUB + 0x08, // SPECIES_PILOSWINE + 0x02, // SPECIES_CORSOLA + 0x02, // SPECIES_REMORAID + 0x05, // SPECIES_OCTILLERY + 0x0f, // SPECIES_DELIBIRD + 0x02, // SPECIES_MANTINE + 0x15, // SPECIES_SKARMORY + 0x09, // SPECIES_HOUNDOUR + 0x09, // SPECIES_HOUNDOOM + 0x19, // SPECIES_KINGDRA + 0x15, // SPECIES_PHANPY + 0x0e, // SPECIES_DONPHAN + 0x01, // SPECIES_PORYGON2 + 0x13, // SPECIES_STANTLER + 0x02, // SPECIES_SMEARGLE + 0x0f, // SPECIES_TYROGUE + 0x07, // SPECIES_HITMONTOP + 0x02, // SPECIES_SMOOCHUM + 0x08, // SPECIES_ELEKID + 0x17, // SPECIES_MAGBY + 0x02, // SPECIES_MILTANK + 0x13, // SPECIES_BLISSEY + 0x16, // SPECIES_RAIKOU + 0x17, // SPECIES_ENTEI + 0x19, // SPECIES_SUICUNE + 0x0e, // SPECIES_LARVITAR + 0x09, // SPECIES_PUPITAR + 0x0e, // SPECIES_TYRANITAR + 0x19, // SPECIES_LUGIA + 0x17, // SPECIES_HO_OH + 0x18, // SPECIES_CELEBI + 0x00, // SPECIES_OLD_UNOWN_B + 0x00, // SPECIES_OLD_UNOWN_C + 0x00, // SPECIES_OLD_UNOWN_D + 0x00, // SPECIES_OLD_UNOWN_E + 0x00, // SPECIES_OLD_UNOWN_F + 0x00, // SPECIES_OLD_UNOWN_G + 0x00, // SPECIES_OLD_UNOWN_H + 0x00, // SPECIES_OLD_UNOWN_I + 0x00, // SPECIES_OLD_UNOWN_J + 0x00, // SPECIES_OLD_UNOWN_K + 0x00, // SPECIES_OLD_UNOWN_L + 0x00, // SPECIES_OLD_UNOWN_M + 0x00, // SPECIES_OLD_UNOWN_N + 0x00, // SPECIES_OLD_UNOWN_O + 0x00, // SPECIES_OLD_UNOWN_P + 0x00, // SPECIES_OLD_UNOWN_Q + 0x00, // SPECIES_OLD_UNOWN_R + 0x00, // SPECIES_OLD_UNOWN_S + 0x00, // SPECIES_OLD_UNOWN_T + 0x00, // SPECIES_OLD_UNOWN_U + 0x00, // SPECIES_OLD_UNOWN_V + 0x00, // SPECIES_OLD_UNOWN_W + 0x00, // SPECIES_OLD_UNOWN_X + 0x00, // SPECIES_OLD_UNOWN_Y + 0x00, // SPECIES_OLD_UNOWN_Z + 0x10, // SPECIES_TREECKO + 0x15, // SPECIES_GROVYLE + 0x09, // SPECIES_SCEPTILE + 0x12, // SPECIES_TORCHIC + 0x10, // SPECIES_COMBUSKEN + 0x17, // SPECIES_BLAZIKEN + 0x02, // SPECIES_MUDKIP + 0x12, // SPECIES_MARSHTOMP + 0x19, // SPECIES_SWAMPERT + 0x12, // SPECIES_POOCHYENA + 0x08, // SPECIES_MIGHTYENA + 0x0f, // SPECIES_ZIGZAGOON + 0x15, // SPECIES_LINOONE + 0x0b, // SPECIES_WURMPLE + 0x08, // SPECIES_SILCOON + 0x11, // SPECIES_BEAUTIFLY + 0x08, // SPECIES_CASCOON + 0x0f, // SPECIES_DUSTOX + 0x02, // SPECIES_LOTAD + 0x10, // SPECIES_LOMBRE + 0x10, // SPECIES_LUDICOLO + 0x13, // SPECIES_SEEDOT + 0x09, // SPECIES_NUZLEAF + 0x14, // SPECIES_SHIFTRY + 0x0a, // SPECIES_NINCADA + 0x01, // SPECIES_NINJASK + 0x14, // SPECIES_SHEDINJA + 0x12, // SPECIES_TAILLOW + 0x15, // SPECIES_SWELLOW + 0x13, // SPECIES_SHROOMISH + 0x15, // SPECIES_BRELOOM + 0x07, // SPECIES_SPINDA + 0x11, // SPECIES_WINGULL + 0x11, // SPECIES_PELIPPER + 0x03, // SPECIES_SURSKIT + 0x11, // SPECIES_MASQUERAIN + 0x19, // SPECIES_WAILMER + 0x19, // SPECIES_WAILORD + 0x13, // SPECIES_SKITTY + 0x12, // SPECIES_DELCATTY + 0x01, // SPECIES_KECLEON + 0x13, // SPECIES_BALTOY + 0x14, // SPECIES_CLAYDOL + 0x0e, // SPECIES_NOSEPASS + 0x17, // SPECIES_TORKOAL + 0x01, // SPECIES_SABLEYE + 0x0b, // SPECIES_BARBOACH + 0x09, // SPECIES_WHISCASH + 0x04, // SPECIES_LUVDISC + 0x0f, // SPECIES_CORPHISH + 0x15, // SPECIES_CRAWDAUNT + 0x03, // SPECIES_FEEBAS + 0x19, // SPECIES_MILOTIC + 0x04, // SPECIES_CARVANHA + 0x15, // SPECIES_SHARPEDO + 0x13, // SPECIES_TRAPINCH + 0x01, // SPECIES_VIBRAVA + 0x0f, // SPECIES_FLYGON + 0x0e, // SPECIES_MAKUHITA + 0x0e, // SPECIES_HARIYAMA + 0x15, // SPECIES_ELECTRIKE + 0x09, // SPECIES_MANECTRIC + 0x0e, // SPECIES_NUMEL + 0x17, // SPECIES_CAMERUPT + 0x13, // SPECIES_SPHEAL + 0x09, // SPECIES_SEALEO + 0x09, // SPECIES_WALREIN + 0x0a, // SPECIES_CACNEA + 0x08, // SPECIES_CACTURNE + 0x0f, // SPECIES_SNORUNT + 0x0f, // SPECIES_GLALIE + 0x13, // SPECIES_LUNATONE + 0x13, // SPECIES_SOLROCK + 0x10, // SPECIES_AZURILL + 0x10, // SPECIES_SPOINK + 0x14, // SPECIES_GRUMPIG + 0x12, // SPECIES_PLUSLE + 0x12, // SPECIES_MINUN + 0x09, // SPECIES_MAWILE + 0x14, // SPECIES_MEDITITE + 0x14, // SPECIES_MEDICHAM + 0x11, // SPECIES_SWABLU + 0x11, // SPECIES_ALTARIA + 0x12, // SPECIES_WYNAUT + 0x01, // SPECIES_DUSKULL + 0x01, // SPECIES_DUSCLOPS + 0x18, // SPECIES_ROSELIA + 0x02, // SPECIES_SLAKOTH + 0x10, // SPECIES_VIGOROTH + 0x08, // SPECIES_SLAKING + 0x0b, // SPECIES_GULPIN + 0x0b, // SPECIES_SWALOT + 0x0e, // SPECIES_TROPIUS + 0x13, // SPECIES_WHISMUR + 0x09, // SPECIES_LOUDRED + 0x0d, // SPECIES_EXPLOUD + 0x13, // SPECIES_CLAMPERL + 0x11, // SPECIES_HUNTAIL + 0x11, // SPECIES_GOREBYSS + 0x14, // SPECIES_ABSOL + 0x01, // SPECIES_SHUPPET + 0x01, // SPECIES_BANETTE + 0x0b, // SPECIES_SEVIPER + 0x15, // SPECIES_ZANGOOSE + 0x02, // SPECIES_RELICANTH + 0x15, // SPECIES_ARON + 0x09, // SPECIES_LAIRON + 0x0e, // SPECIES_AGGRON + 0x11, // SPECIES_CASTFORM + 0x11, // SPECIES_VOLBEAT + 0x11, // SPECIES_ILLUMISE + 0x0c, // SPECIES_LILEEP + 0x0b, // SPECIES_CRADILY + 0x0f, // SPECIES_ANORITH + 0x09, // SPECIES_ARMALDO + 0x14, // SPECIES_RALTS + 0x14, // SPECIES_KIRLIA + 0x14, // SPECIES_GARDEVOIR + 0x09, // SPECIES_BAGON + 0x09, // SPECIES_SHELGON + 0x08, // SPECIES_SALAMENCE + 0x0f, // SPECIES_BELDUM + 0x15, // SPECIES_METANG + 0x09, // SPECIES_METAGROSS + 0x09, // SPECIES_REGIROCK + 0x09, // SPECIES_REGICE + 0x09, // SPECIES_REGISTEEL + 0x19, // SPECIES_KYOGRE + 0x17, // SPECIES_GROUDON + 0x0d, // SPECIES_RAYQUAZA + 0x01, // SPECIES_LATIAS + 0x01, // SPECIES_LATIOS + 0x11, // SPECIES_JIRACHI + 0x14, // SPECIES_DEOXYS + 0x11, // SPECIES_CHIMECHO +}; + +static const u8 sUnknown_0860AA64[][2] = +{ + {0, 5}, + {1, 1}, + {0, 15}, + {1, 4}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {0, 0xFF} +}; + +static const u8 sUnknown_0860AA80[][2] = +{ + {6, 30}, + {0xFE, 15}, + {6, 30}, + {0xFF, 0} +}; + +static void (* const sMonAnimFunctions[])(struct Sprite *sprite) = +{ + pokemonanimfunc_00, + pokemonanimfunc_01, + pokemonanimfunc_02, + pokemonanimfunc_03, + pokemonanimfunc_04, + pokemonanimfunc_05, + pokemonanimfunc_06, + pokemonanimfunc_07, + pokemonanimfunc_08, + pokemonanimfunc_09, + pokemonanimfunc_0A, + pokemonanimfunc_0B, + pokemonanimfunc_0C, + pokemonanimfunc_0D, + pokemonanimfunc_0E, + pokemonanimfunc_0F, + pokemonanimfunc_10, + pokemonanimfunc_11, + pokemonanimfunc_12, + pokemonanimfunc_13, + pokemonanimfunc_14, + pokemonanimfunc_15, + pokemonanimfunc_16, + pokemonanimfunc_17, + pokemonanimfunc_18, + pokemonanimfunc_19, + pokemonanimfunc_1A, + pokemonanimfunc_1B, + pokemonanimfunc_1C, + pokemonanimfunc_1D, + pokemonanimfunc_1E, + pokemonanimfunc_1F, + pokemonanimfunc_20, + pokemonanimfunc_21, + pokemonanimfunc_22, + pokemonanimfunc_23, + pokemonanimfunc_24, + pokemonanimfunc_25, + pokemonanimfunc_26, + pokemonanimfunc_27, + pokemonanimfunc_28, + pokemonanimfunc_29, + pokemonanimfunc_2A, + pokemonanimfunc_2B, + pokemonanimfunc_2C, + pokemonanimfunc_2D, + pokemonanimfunc_2E, + pokemonanimfunc_2F, + pokemonanimfunc_30, + pokemonanimfunc_31, + pokemonanimfunc_32, + pokemonanimfunc_33, + pokemonanimfunc_34, + pokemonanimfunc_35, + pokemonanimfunc_36, + pokemonanimfunc_37, + pokemonanimfunc_38, + pokemonanimfunc_39, + pokemonanimfunc_3A, + pokemonanimfunc_3B, + pokemonanimfunc_3C, + pokemonanimfunc_3D, + pokemonanimfunc_3E, + pokemonanimfunc_3F, + pokemonanimfunc_40, + pokemonanimfunc_41, + pokemonanimfunc_42, + pokemonanimfunc_43, + pokemonanimfunc_44, + pokemonanimfunc_45, + pokemonanimfunc_46, + pokemonanimfunc_47, + pokemonanimfunc_48, + pokemonanimfunc_49, + pokemonanimfunc_4A, + pokemonanimfunc_4B, + pokemonanimfunc_4C, + pokemonanimfunc_4D, + pokemonanimfunc_4E, + pokemonanimfunc_4F, + pokemonanimfunc_50, + pokemonanimfunc_51, + pokemonanimfunc_52, + pokemonanimfunc_53, + pokemonanimfunc_54, + pokemonanimfunc_55, + pokemonanimfunc_56, + pokemonanimfunc_57, + pokemonanimfunc_58, + pokemonanimfunc_59, + pokemonanimfunc_5A, + pokemonanimfunc_5B, + pokemonanimfunc_5C, + pokemonanimfunc_5D, + pokemonanimfunc_5E, + pokemonanimfunc_5F, + pokemonanimfunc_60, + pokemonanimfunc_61, + pokemonanimfunc_62, + pokemonanimfunc_63, + pokemonanimfunc_64, + pokemonanimfunc_65, + pokemonanimfunc_66, + pokemonanimfunc_67, + pokemonanimfunc_68, + pokemonanimfunc_69, + pokemonanimfunc_6A, + pokemonanimfunc_6B, + pokemonanimfunc_6C, + pokemonanimfunc_6D, + pokemonanimfunc_6E, + pokemonanimfunc_6F, + pokemonanimfunc_70, + pokemonanimfunc_71, + pokemonanimfunc_72, + pokemonanimfunc_73, + pokemonanimfunc_74, + pokemonanimfunc_75, + pokemonanimfunc_76, + pokemonanimfunc_77, + pokemonanimfunc_78, + pokemonanimfunc_79, + pokemonanimfunc_7A, + pokemonanimfunc_7B, + pokemonanimfunc_7C, + pokemonanimfunc_7D, + pokemonanimfunc_7E, + pokemonanimfunc_7F, + pokemonanimfunc_80, + pokemonanimfunc_81, + pokemonanimfunc_82, + pokemonanimfunc_83, + pokemonanimfunc_84, + pokemonanimfunc_85, + pokemonanimfunc_86, + pokemonanimfunc_87, + pokemonanimfunc_88, + pokemonanimfunc_89, + pokemonanimfunc_8A, + pokemonanimfunc_8B, + pokemonanimfunc_8C, + pokemonanimfunc_8D, + pokemonanimfunc_8E, + pokemonanimfunc_8F, + pokemonanimfunc_90, + pokemonanimfunc_91, + pokemonanimfunc_92, + pokemonanimfunc_93, + pokemonanimfunc_94, + pokemonanimfunc_95, + pokemonanimfunc_96 +}; + +// counting from Id 1, because 0 in sSpeciesToBackAnimSet is used for mons with no back animation +static const u8 sBackAnimationIds[] = +{ + 0x60, 0x5f, 0x02, // 1 + 0x5e, 0x03, 0x46, // 2 + 0x6d, 0x3e, 0x6e, // 3 + 0x6f, 0x70, 0x3f, // 4 + 0x71, 0x13, 0x72, // 5 + 0x6c, 0x6b, 0x3a, // 6 + 0x64, 0x14, 0x4f, // 7 + 0x5d, 0x0f, 0x4c, // 8 + 0x61, 0x57, 0x58, // 9 + 0x67, 0x66, 0x59, // 0xA + 0x74, 0x73, 0x5a, // 0xB + 0x75, 0x76, 0x5b, // 0xC + 0x77, 0x78, 0x65, // 0xD + 0x63, 0x5c, 0x62, // 0xE + 0x6a, 0x69, 0x68, // 0xF + 0x7b, 0x7a, 0x79, // 0x10 + 0x7e, 0x7d, 0x7c, // 0x11 + 0x81, 0x80, 0x7f, // 0x12 + 0x84, 0x82, 0x83, // 0x13 + 0x85, 0x86, 0x87, // 0x14 + 0x88, 0x89, 0x8a, // 0x15 + 0x8b, 0x8c, 0x8d, // 0x16 + 0x8e, 0x8f, 0x90, // 0x17 + 0x91, 0x92, 0x93, // 0x18 + 0x94, 0x95, 0x96, // 0x19 +}; + +static const u8 sBackAnimNatureModTable[] = +{ + 0x00, // NATURE_HARDY + 0x02, // NATURE_LONELY + 0x00, // NATURE_BRAVE + 0x00, // NATURE_ADAMANT + 0x00, // NATURE_NAUGHTY + 0x01, // NATURE_BOLD + 0x01, // NATURE_DOCILE + 0x01, // NATURE_RELAXED + 0x00, // NATURE_IMPISH + 0x01, // NATURE_LAX + 0x02, // NATURE_TIMID + 0x00, // NATURE_HASTY + 0x01, // NATURE_SERIOUS + 0x00, // NATURE_JOLLY + 0x00, // NATURE_NAIVE + 0x02, // NATURE_MODEST + 0x02, // NATURE_MILD + 0x02, // NATURE_QUIET + 0x02, // NATURE_BASHFUL + 0x01, // NATURE_RASH + 0x01, // NATURE_CALM + 0x02, // NATURE_GENTLE + 0x01, // NATURE_SASSY + 0x02, // NATURE_CAREFUL + 0x01, // NATURE_QUIRKY +}; + +static const union AffineAnimCmd sSpriteAffineAnim_860AD48[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMDTYPE_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_860AD58[] = +{ + AFFINEANIMCMD_FRAME(-256, 256, 0, 0), + AFFINEANIMCMDTYPE_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_860AD68[] = +{ + sSpriteAffineAnim_860AD48, + sSpriteAffineAnim_860AD58 +}; + +// code +static void MonAnimDummySpriteCallback(struct Sprite *sprite) +{ +} + +static void sub_817F3F0(struct Sprite *sprite, u16 index, s16 amplitudeX, s16 amplitudeY) +{ + s16 xAdder, yAdder; + + amplitudeX *= -1; + amplitudeY *= -1; + + xAdder = Cos(index, amplitudeX) - Sin(index, amplitudeY); + yAdder = Cos(index, amplitudeY) + Sin(index, amplitudeX); + + amplitudeX *= -1; + amplitudeY *= -1; + + sprite->pos2.x = xAdder + amplitudeX; + sprite->pos2.y = yAdder + amplitudeY; +} + +u8 GetSpeciesBackAnimSet(u16 species) +{ + if (sSpeciesToBackAnimSet[species] != 0) + return sSpeciesToBackAnimSet[species] - 1; + else + return 0; +} + +#define tState data[0] +#define tPtrLO data[1] +#define tPtrHI data[2] +#define tAnimId data[3] +#define tSaved0 data[4] +#define tSaved2 data[5] + +static void Task_HandleMonAnimation(u8 taskId) +{ + u32 i; + struct Sprite *sprite = (struct Sprite*)(u32)((gTasks[taskId].tPtrLO << 0x10) | (gTasks[taskId].tPtrHI)); + + if (gTasks[taskId].tState == 0) + { + gTasks[taskId].tSaved0 = sprite->data[0]; + gTasks[taskId].tSaved2 = sprite->data[2]; + sprite->data[1] = 1; + sprite->data[0] = 0; + + for (i = 2; i < ARRAY_COUNT(sprite->data); i++) + sprite->data[i] = 0; + + sprite->callback = sMonAnimFunctions[gTasks[taskId].tAnimId]; + sUnknown_03001274 = FALSE; + + gTasks[taskId].tState++; + } + if (sprite->callback == SpriteCallbackDummy) + { + sprite->data[0] = gTasks[taskId].tSaved0; + sprite->data[2] = gTasks[taskId].tSaved2; + sprite->data[1] = 0; + + DestroyTask(taskId); + } +} + +void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId) +{ + u8 taskId = CreateTask(Task_HandleMonAnimation, 128); + gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10; + gTasks[taskId].tPtrHI = (u32)(sprite); + gTasks[taskId].tAnimId = frontAnimId; +} + +void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId) +{ + sUnknown_03001274 = TRUE; + sprite->callback = sMonAnimFunctions[frontAnimId]; +} + +void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet) +{ + u8 nature, taskId, animId, bank; + + taskId = CreateTask(Task_HandleMonAnimation, 128); + gTasks[taskId].tPtrLO = (u32)(sprite) >> 0x10; + gTasks[taskId].tPtrHI = (u32)(sprite); + + bank = sprite->data[0]; + nature = GetNature(&gPlayerParty[gBattlePartyID[bank]]); + + animId = 3 * backAnimSet + sBackAnimNatureModTable[nature]; + gTasks[taskId].tAnimId = sBackAnimationIds[animId]; +} + +#undef tState +#undef tPtrLO +#undef tPtrHI +#undef tAnimId +#undef tSaved0 +#undef tSaved2 + +void SetSpriteCB_MonAnimDummy(struct Sprite *sprite) +{ + sprite->callback = MonAnimDummySpriteCallback; +} + +static void SetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +{ + u8 matrixNum; + struct ObjAffineSrcData affineSrcData; + struct OamMatrix dest; + + affineSrcData.xScale = xScale; + affineSrcData.yScale = yScale; + affineSrcData.rotation = rotation; + + matrixNum = sprite->oam.matrixNum; + + ObjAffineSet(&affineSrcData, &dest, 1, 2); + gOamMatrices[matrixNum].a = dest.a; + gOamMatrices[matrixNum].b = dest.b; + gOamMatrices[matrixNum].c = dest.c; + gOamMatrices[matrixNum].d = dest.d; +} + +static void HandleStartAffineAnim(struct Sprite *sprite) +{ + sprite->oam.affineMode = 3; + sprite->affineAnims = sSpriteAffineAnimTable_860AD68; + + if (sUnknown_03001274 == TRUE) + InitSpriteAffineAnim(sprite); + + if (!sprite->data[1]) + StartSpriteAffineAnim(sprite, 1); + else + StartSpriteAffineAnim(sprite, 0); + + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); + sprite->affineAnimPaused = 1; +} + +static void HandleSetAffineData(struct Sprite *sprite, s16 xScale, s16 yScale, u16 rotation) +{ + if (!sprite->data[1]) + { + xScale *= -1; + rotation *= -1; + } + + SetAffineData(sprite, xScale, yScale, rotation); +} + +static void sub_817F70C(struct Sprite *sprite) +{ + if (!sprite->data[1]) + sprite->pos2.x *= -1; +} + +static bool32 sub_817F724(u8 id) +{ + if (id >= STRUCT_COUNT) + { + return FALSE; + } + else + { + sUnknown_03001240[id].field_6 = 0; + sUnknown_03001240[id].field_0 = 0; + sUnknown_03001240[id].field_4 = 1; + sUnknown_03001240[id].field_2 = 0; + sUnknown_03001240[id].field_8 = 0; + return TRUE; + } +} + +static u8 sub_817F758(void) +{ + sUnknown_03001270 = (sUnknown_03001270 + 1) % STRUCT_COUNT; + sub_817F724(sUnknown_03001270); + return sUnknown_03001270; +} + +static void sub_817F77C(struct Sprite *sprite) +{ + sprite->oam.affineMode = 1; + CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); + + if (sUnknown_03001274 == TRUE) + { + if (!sprite->data[1]) + sprite->hFlip = 1; + else + sprite->hFlip = 0; + + FreeOamMatrix(sprite->oam.matrixNum); + sprite->oam.matrixNum |= (sprite->hFlip << 3); + sprite->oam.affineMode = 0; + } +} + +static void pokemonanimfunc_01(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 var = (sprite->data[2] * 512 / 40) % 256; + + sprite->data[4] = Sin(var, 32) + 256; + sprite->data[5] = Cos(var, 32) + 256; + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_02(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 6) * sign; + } + + sprite->data[2]++; +} + +static void sub_817F8FC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + sprite->pos2.x = Sin((sprite->data[2] * 384 / sprite->data[0]) % 256, 6); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_03(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +static void sub_817F978(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = -(Sin((sprite->data[2] * 384 / sprite->data[0]) % 256, 6)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_04(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sub_817F978(sprite); + sprite->callback = sub_817F978; +} + +#ifdef NONMATCHING +static void sub_817F9F4(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 384) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s32 divCounter = counter / 128; + + switch (divCounter) + { + case 0: + case 1: + sprite->pos2.y = -(Sin(counter % 128, sprite->data[0] * 2)); + break; + case 2: + case 3: + sprite->pos2.y = -(Sin(counter - 256, sprite->data[0] * 3)); + break; + } + } + + sprite->data[2] += 12; +} + +#else +__attribute__((naked)) +static void sub_817F9F4(struct Sprite *sprite) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + adds r4, r0, 0\n\ + movs r0, 0x32\n\ + ldrsh r1, [r4, r0]\n\ + movs r0, 0xC0\n\ + lsls r0, 1\n\ + cmp r1, r0\n\ + ble _0817FA14\n\ + ldr r0, =SpriteCB_SetDummyOnAnimEnd\n\ + str r0, [r4, 0x1C]\n\ + movs r0, 0\n\ + strh r0, [r4, 0x24]\n\ + b _0817FA5E\n\ + .pool\n\ +_0817FA14:\n\ + adds r0, r1, 0\n\ + cmp r1, 0\n\ + bge _0817FA1C\n\ + adds r0, 0x7F\n\ +_0817FA1C:\n\ + asrs r2, r0, 7\n\ + lsls r0, r2, 16\n\ + asrs r0, 16\n\ + cmp r0, 0\n\ + blt _0817FA60\n\ + cmp r0, 0x1\n\ + ble _0817FA48\n\ + cmp r0, 0x3\n\ + bgt _0817FA60\n\ + ldr r2, =0xffffff00\n\ + adds r1, r2\n\ + lsls r0, r1, 16\n\ + asrs r0, 16\n\ + movs r1, 0x2E\n\ + ldrsh r2, [r4, r1]\n\ + lsls r1, r2, 1\n\ + adds r1, r2\n\ + lsls r1, 16\n\ + b _0817FA56\n\ + .pool\n\ +_0817FA48:\n\ + lsls r0, r2, 7\n\ + subs r0, r1, r0\n\ + lsls r0, 16\n\ + asrs r0, 16\n\ + movs r2, 0x2E\n\ + ldrsh r1, [r4, r2]\n\ + lsls r1, 17\n\ +_0817FA56:\n\ + asrs r1, 16\n\ + bl Sin\n\ + negs r0, r0\n\ +_0817FA5E:\n\ + strh r0, [r4, 0x26]\n\ +_0817FA60:\n\ + ldrh r0, [r4, 0x32]\n\ + adds r0, 0xC\n\ + strh r0, [r4, 0x32]\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +#endif // NONMATCHING + +static void pokemonanimfunc_1E(struct Sprite *sprite) +{ + sprite->data[0] = 4; + sub_817F9F4(sprite); + sprite->callback = sub_817F9F4; +} + +static void pokemonanimfunc_06(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 768) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s16 divCounter = counter / 128; + + switch (divCounter) + { + case 0: + case 1: + sprite->pos2.x = 0; + break; + case 2: + counter = 0; + break; + case 3: + sprite->pos2.x = -(counter % 128 * 8) / 128; + break; + case 4: + sprite->pos2.x = (counter % 128) / 8 - 8; + break; + case 5: + sprite->pos2.x = -(counter % 128 * 8) / 128 + 8; + break; + } + + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; +} + +static void pokemonanimfunc_09(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] * 256 / 40) % 256; + + if (sprite->data[2] % 2 == 0) + { + sprite->data[4] = Sin(index, 32) + 256; + sprite->data[5] = Sin(index, 32) + 256; + } + else + { + sprite->data[4] = Sin(index, 8) + 256; + sprite->data[5] = Sin(index, 8) + 256; + } + + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static const s8 sUnknown_0860AD70[][3] = +{ + {-1, -1, 6}, + {2, 0, 6}, + {-2, 2, 6}, + {2, 0, 6}, + {-2, -2, 6}, + {2, 0, 6}, + {-2, 2, 6}, + {2, 0, 6}, + {-1, -1, 6}, + {0, 0, 0}, +}; + +static void sub_817FC20(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[2] == 0) + sprite->data[3] = 0; + + if (sUnknown_0860AD70[sprite->data[3]][2] == sprite->data[2]) + { + if (sUnknown_0860AD70[sprite->data[3]][2] == 0) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[3]++; + sprite->data[2] = 0; + } + } + + if (sUnknown_0860AD70[sprite->data[3]][2] == 0) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->pos2.x += sUnknown_0860AD70[sprite->data[3]][0]; + sprite->pos2.y += sUnknown_0860AD70[sprite->data[3]][1]; + sprite->data[2]++; + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_0A(struct Sprite *sprite) +{ + sub_817FC20(sprite); + sprite->callback = sub_817FC20; +} + +static void sub_817FCDC(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + sprite->pos2.x = Sin(counter % 256, sprite->data[7]); + } + + sprite->data[2] += sprite->data[0]; +} + +static void pokemonanimfunc_0F(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sprite->data[7] = 3; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +static void sub_817FD44(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin(counter % 256, 3); + } + + sprite->data[2] += sprite->data[0]; +} + +static void pokemonanimfunc_10(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sub_817FD44(sprite); + sprite->callback = sub_817FD44; +} + +static void pokemonanimfunc_11(struct Sprite *sprite) +{ + if (sprite->data[2] > 512) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s8 sign; + s32 index, amplitude; + + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + amplitude = Sin(sprite->data[2] / 4, 8); + index = sprite->data[2] % 256; + + sprite->pos2.y = Sin(index, amplitude) * sign; + sprite->pos2.x = Cos(index, amplitude) * sign; + } + + sprite->data[2] += 9; +} + +static void sub_817FE30(struct Sprite *sprite) +{ + s16 id = sprite->data[0]; + + if (sUnknown_03001240[id].field_0 != 0) + { + sUnknown_03001240[id].field_0--; + } + else + { + if (sprite->data[2] == 0 && sUnknown_03001240[id].field_8 == 0) + { + HandleStartAffineAnim(sprite); + sUnknown_03001240[id].field_8++; + } + + if (sprite->data[2] > sUnknown_03001240[id].field_6) + { + HandleSetAffineData(sprite, 256, 256, 0); + + if (sUnknown_03001240[id].field_4 > 1) + { + sUnknown_03001240[id].field_4--; + sUnknown_03001240[id].field_0 = 10; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + sprite->data[6] = Sin(sprite->data[2] % 256, 4096); + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); + } + + sprite->data[2] += 16; + } +} + +static void pokemonanimfunc_12(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_0 = 0; + sub_817FE30(sprite); + sprite->callback = sub_817FE30; +} + +static void sub_817FF3C(struct Sprite *sprite) +{ + u8 id = sprite->data[0]; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > sUnknown_03001240[id].field_0) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = (65536 / sUnknown_03001240[id].field_8) * sprite->data[2]; + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_1F(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_0 = 60; + sUnknown_03001240[id].field_8 = 20; + sub_817FF3C(sprite); + sprite->callback = sub_817FF3C; +} + +static void sub_817FFF0(struct Sprite *sprite) +{ + u8 id = sprite->data[0]; + + sub_817F70C(sprite); + + if (sprite->data[2] > sUnknown_03001240[id].field_6) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] + 192) % 256; + + sprite->pos2.x = -(Cos(index, sUnknown_03001240[id].field_8 * 2)); + sprite->pos2.y = Sin(index, sUnknown_03001240[id].field_8) + sUnknown_03001240[id].field_8; + } + + sprite->data[2] += sUnknown_03001240[id].field_2; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_14(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_8 = 6; + sUnknown_03001240[id].field_2 = 24; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +static void pokemonanimfunc_15(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB_BLACK); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 16); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_BLACK); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_16(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index2 = (sprite->data[2] * 128) / 40; + + if (sprite->data[2] >= 10 && sprite->data[2] <= 29) + { + sprite->data[7] += 51; + index1 = 0xFF & sprite->data[7]; + } + + if (sprite->data[1] == 0) + sprite->data[4] = (Sin(index2, 40) - 256) + Sin(index1, 16); + else + sprite->data[4] = (256 - Sin(index2, 40)) - Sin(index1, 16); + + sprite->data[5] = Sin(index2, 16) + 256; + SetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_17(struct Sprite *sprite) +{ + s16 posY = 0, index1 = 0, index2 = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 40) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = posY; + } + else + { + index2 = (sprite->data[2] * 128) / 40; + + if (sprite->data[2] >= 10 && sprite->data[2] <= 29) + { + sprite->data[7] += 51; + index1 = 0xFF & sprite->data[7]; + } + + if (sprite->data[1] == 0) + sprite->data[4] = -(Sin(index2, 16)) - 256; + else + sprite->data[4] = Sin(index2, 16) + 256; + + sprite->data[5] = (256 - Sin(index2, 40)) - Sin(index1, 8); + + if (sprite->data[5] != 256) + posY = (256 - sprite->data[5]) / 8; + + sprite->pos2.y = -(posY); + SetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static void sub_818031C(struct Sprite *sprite) +{ + u8 index = sprite->data[2]; + u8 var7 = sprite->data[6]; + u8 var5 = sUnknown_0860AA80[sprite->data[5]][0]; + u8 var6 = sUnknown_0860AA80[sprite->data[5]][1]; + u8 amplitude = 0; + + if (var5 != 0xFE) + amplitude = (var6 - var7) * var5 / var6; + else + amplitude = 0; + + if (var5 == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin(index, amplitude); + + if (var7 == var6) + { + sprite->data[5]++; + sprite->data[6] = 0; + } + else + { + sprite->data[2] += sprite->data[0]; + sprite->data[6]++; + } + } +} + +static void pokemonanimfunc_19(struct Sprite *sprite) +{ + sprite->data[0] = 48; + sub_818031C(sprite); + sprite->callback = sub_818031C; +} + +static void pokemonanimfunc_1A(struct Sprite *sprite) +{ + u8 counter = 0; + + sub_817F70C(sprite); + counter = sprite->data[2]; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 35) + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s16 index = ((counter - 10) * 128) / 20; + + if (counter < 10) + HandleSetAffineData(sprite, 256, 256, counter / 2 * 512); + else if (counter >= 10 && counter <= 29) + sprite->pos2.x = -(Sin(index, 5)); + else + HandleSetAffineData(sprite, 256, 256, (35 - counter) / 2 * 1024); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_1B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 index = (sprite->data[2] * 256) / 100; + sprite->pos2.y = Sin(index, 10); + HandleSetAffineData(sprite, 256, 256, Sin(index, 3276)); + } + + sprite->data[2]++; +} + +static void sub_81804F8(struct Sprite *sprite) +{ + s32 var = 0; + s16 index = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index = (sprite->data[2] * 256) / 100; + var = (sprite->data[2] * 512) / 100; + var &= 0xFF; + sprite->pos2.y = Sin(index, sprite->data[0]); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_1C(struct Sprite *sprite) +{ + sprite->data[0] = 10; + sub_81804F8(sprite); + sprite->callback = sub_81804F8; +} + +static void sub_81805B0(struct Sprite *sprite) +{ + s32 var = 0; + s16 index = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + index = (sprite->data[2] * 256) / 100; + var = (sprite->data[2] * 512) / 100; + var &= 0xFF; + sprite->pos2.y = -(Sin(index / 2, sprite->data[0] * 2)); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_18(struct Sprite *sprite) +{ + sprite->data[0] = 5; + sub_81805B0(sprite); + sprite->callback = sub_81805B0; +} + +static void pokemonanimfunc_1D(struct Sprite *sprite) +{ + s32 var; + s16 index = 0; + + sub_817F70C(sprite); + var = 0; + + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + if (sprite->data[2] > 100) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 toDiv = 100; + + index = (sprite->data[2] * 256) / toDiv; + var = (sprite->data[2] * 512) / toDiv; + var &= 0xFF; + sprite->pos2.x = Sin(index, 8); + HandleSetAffineData(sprite, 256, 256, Sin(var, 3276)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void sub_8180714(struct Sprite *sprite) +{ + s16 posY = 0; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + } + + sub_817F70C(sprite); + + if (sprite->data[2] > sprite->data[0] * 3) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale = Sin(sprite->data[4], 32) + 256; + + if (sprite->data[2] > sprite->data[0] && sprite->data[2] < sprite->data[0] * 2) + sprite->data[3] += (128 / sprite->data[0]); + if (yScale > 256) + posY = (256 - yScale) / 8; + + sprite->pos2.y = -(Sin(sprite->data[3], 10)) - posY; + HandleSetAffineData(sprite, 256 - Sin(sprite->data[4], 32), yScale, 0); + sprite->data[2]++; + sprite->data[4] = (sprite->data[4] + 128 / sprite->data[0]) & 0xFF; + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_00(struct Sprite *sprite) +{ + sprite->data[0] = 16; + sub_8180714(sprite); + sprite->callback = sub_8180714; +} + +static void sub_8180828(struct Sprite *sprite) +{ + s16 posY = 0; + + if (sprite->data[2] > (128 / sprite->data[6]) * sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale = Sin(sprite->data[4], 32) + 256; + + if (yScale > 256) + posY = (256 - yScale) / 8; + + sprite->pos2.y = -(posY); + HandleSetAffineData(sprite, Sin(sprite->data[4], 48) + 256, yScale, 0); + sprite->data[2]++; + sprite->data[4] = (sprite->data[4] + sprite->data[6]) & 0xFF; + } +} + +static void pokemonanimfunc_13(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 3; + sprite->data[6] = 8; + } + + sub_8180828(sprite); +} + +static const s8 sUnknown_0860AD8E[][8][3] = +{ + { + {0, 8, 8}, + {8, -8, 12}, + {-8, 8, 12}, + {8, -8, 12}, + {-8, 8, 12}, + {8, -8, 12}, + {-8, 0, 12}, + {0, 0, 0} + }, + { + {0, 8, 16}, + {8, -8, 24}, + {-8, 8, 24}, + {8, -8, 24}, + {-8, 8, 24}, + {8, -8, 24}, + {-8, 0, 24}, + {0, 0, 0} + }, +}; + +static void sub_8180900(struct Sprite *sprite) +{ + s16 var; + u8 structId; + s8 r9; + s16 r10; + s16 r7; + u32 arrId; + + sub_817F70C(sprite); + structId = sprite->data[0]; + var = sUnknown_03001240[structId].field_6; + r9 = sUnknown_0860AD8E[sUnknown_03001240[structId].field_8][sprite->data[4]][0]; + r10 = sUnknown_0860AD8E[sUnknown_03001240[structId].field_8][sprite->data[4]][1] - r9; + arrId = sUnknown_03001240[structId].field_8; + r7 = sprite->data[3]; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + if (sUnknown_0860AD8E[arrId][sprite->data[4]][2] == 0) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + u16 rotation; + + sprite->pos2.y = -(Sin(r7 * 128 / sUnknown_0860AD8E[arrId][sprite->data[4]][2], 10)); + sprite->pos2.x = (r10 * r7 / sUnknown_0860AD8E[arrId][sprite->data[4]][2]) + r9; + + rotation = -(var * sprite->pos2.x) / 8; + HandleSetAffineData(sprite, 256, 256, rotation); + + if (r7 == sUnknown_0860AD8E[arrId][sprite->data[4]][2]) + { + sprite->data[4]++; + sprite->data[3] = 0; + } + else + { + sprite->data[3]++; + } + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_05(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_6 = 4096; + sUnknown_03001240[id].field_8 = sprite->data[6]; + sub_8180900(sprite); + sprite->callback = sub_8180900; +} + +static void pokemonanimfunc_20(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB(31, 22, 0)); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB(31, 22, 0)); + } + + sprite->data[2] += 2; +} + +static void pokemonanimfunc_21(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB_RED); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_RED); + } + + sprite->data[2] += 2; +} + +static void pokemonanimfunc_22(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB_BLUE); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_BLUE); + } + + sprite->data[2] += 2; +} + +static void pokemonanimfunc_23(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB_YELLOW); + } + + sprite->data[2] += 2; +} + +static void pokemonanimfunc_24(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + + if (sprite->data[2] > 128) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB(24, 0, 24)); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], RGB(24, 0, 24)); + } + + sprite->data[2] += 2; +} + +static void sub_8180CB4(struct Sprite *sprite); +static void sub_8180CE8(struct Sprite *sprite); +static void sub_8180D44(struct Sprite *sprite); +static void sub_8180DC0(struct Sprite *sprite); +static void sub_8180E28(struct Sprite *sprite); + +static void pokemonanimfunc_25(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8180CB4; +} + +static void sub_8180CB4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (++sprite->pos2.x > 7) + { + sprite->pos2.x = 8; + sprite->data[7] = 2; + sprite->callback = sub_8180CE8; + } + sub_817F70C(sprite); +} + +static void sub_8180CE8(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + sprite->pos2.x -= sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x <= 0) + { + s16 subResult; + u8 var = sprite->data[7]; + sprite->data[6] = 0; + subResult = sprite->pos2.x; + + do + { + subResult -= var; + sprite->data[6]++; + var++; + } + while (subResult > -8); + + sprite->data[5] = 1; + sprite->callback = sub_8180D44; + } + + sub_817F70C(sprite); +} + +static void sub_8180D44(struct Sprite *sprite) +{ + u8 rotation; + + sub_817F70C(sprite); + sprite->pos2.x -= sprite->data[7]; + sprite->data[7]++; + rotation = (sprite->data[5] * 6) / sprite->data[6]; + + if (++sprite->data[5] > sprite->data[6]) + sprite->data[5] = sprite->data[6]; + + HandleSetAffineData(sprite, 256, 256, rotation * 256); + + if (sprite->pos2.x < -8) + { + sprite->pos2.x = -8; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = rotation; + sprite->callback = sub_8180DC0; + } + + sub_817F70C(sprite); +} + +static void sub_8180DC0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[3] > 11) + { + sprite->data[2] -= 2; + if (sprite->data[2] < 0) + sprite->data[2] = 0; + + HandleSetAffineData(sprite, 256, 256, sprite->data[2] << 8); + if (sprite->data[2] == 0) + sprite->callback = sub_8180E28; + } + else + { + sprite->pos2.x += sprite->data[4]; + sprite->data[4] *= -1; + sprite->data[3]++; + } + + sub_817F70C(sprite); +} + +static void sub_8180E28(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + sprite->pos2.x += 2; + if (sprite->pos2.x > 0) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +static void sub_8180E78(struct Sprite *sprite); +static void sub_8180ED0(struct Sprite *sprite); +static void sub_8180F2C(struct Sprite *sprite); + +static void pokemonanimfunc_26(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sprite->callback = sub_8180E78; +} + +static void sub_8180E78(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--; + + if (sprite->pos2.x % 2 == 0 && sprite->data[3] <= 0) + sprite->data[3] = 10; + if (sprite->pos2.x > 7) + { + sprite->pos2.x = 8; + sprite->pos2.y = -8; + sprite->data[4] = 0; + sprite->callback = sub_8180ED0; + } + + sub_817F70C(sprite); +} + +static void sub_8180ED0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x = Cos(sprite->data[4], 16) - 8; + sprite->pos2.y = Sin(sprite->data[4], 16) - 8; + + if (sprite->data[4] > 63) + { + sprite->data[2] = 160; + sprite->data[3] = 10; + sprite->callback = sub_8180F2C; + } + sprite->data[4] += 8; + if (sprite->data[4] > 64) + sprite->data[4] = 64; + + sub_817F70C(sprite); +} + +static void sub_8180F2C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + + if (sprite->data[3] > 0) + { + sprite->data[3]--; + } + else + { + u32 rotation; + + sprite->pos2.x = Cos(sprite->data[2], 5) - 4; + sprite->pos2.y = -(Sin(sprite->data[2], 5)) + 4; + sprite->data[2] -= 4; + rotation = sprite->data[2] - 32; + HandleSetAffineData(sprite, 256, 256, rotation * 512); + + if (sprite->data[2] <= 32) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_27(struct Sprite *sprite) +{ + if (sprite->data[3] > 0) + { + sprite->data[3]--; + } + else + { + sprite->data[4] = (sprite->data[4] == 0) ? 1 : 0; + sprite->invisible = sprite->data[4]; + if (++sprite->data[2] > 19) + { + sprite->invisible = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + sprite->data[3] = 2; + } +} + +static void sub_8181024(struct Sprite *sprite); +static void sub_8181068(struct Sprite *sprite); +static void sub_81810C4(struct Sprite *sprite); + +static void pokemonanimfunc_28(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8181024; +} + +static void sub_8181024(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x--; + sprite->pos2.y++; + + if (sprite->pos2.x <= -16) + { + sprite->pos2.x = -16; + sprite->pos2.y = 16; + sprite->callback = sub_8181068; + sprite->data[2] = 160; + } + + sub_817F70C(sprite); +} + +static void sub_8181068(struct Sprite *sprite) +{ + u32 rotation; + + sub_817F70C(sprite); + sprite->data[2] -= 4; + sprite->pos2.x = Cos(sprite->data[2], 22); + sprite->pos2.y = -(Sin(sprite->data[2], 22)); + rotation = sprite->data[2] - 32; + HandleSetAffineData(sprite, 256, 256, rotation * 512); + + if (sprite->data[2] <= 32) + sprite->callback = sub_81810C4; + + sub_817F70C(sprite); +} + +static void sub_81810C4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x--; + sprite->pos2.y++; + + if (sprite->pos2.x <= 0) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +static void sub_8181110(struct Sprite *sprite); +static void sub_8181144(struct Sprite *sprite); +static void sub_81811A4(struct Sprite *sprite); + +static void pokemonanimfunc_29(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_8181110; +} + +static void sub_8181110(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--; + + if (sprite->pos2.x > 15) + { + sprite->data[2] = 0; + sprite->callback = sub_8181144; + } + + sub_817F70C(sprite); +} + +static void sub_8181144(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[2] += 16; + + if (sprite->pos2.x <= -16) + { + sprite->pos2.x = -16; + sprite->pos2.y = 16; + sprite->data[2] = 0; + sprite->callback = sub_81811A4; + } + else + { + sprite->pos2.x -= 2; + sprite->pos2.y += 2; + } + + HandleSetAffineData(sprite, 256, 256, sprite->data[2] << 8); + sub_817F70C(sprite); +} + +static void sub_81811A4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x++; + sprite->pos2.y--;; + + if (sprite->pos2.x >= 0) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +static void sub_8181214(struct Sprite *sprite); + +static void pokemonanimfunc_2A(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_2 = 2; + sub_8181214(sprite); + sprite->callback = sub_8181214; +} + +static void sub_8181214(struct Sprite *sprite) +{ + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) + { + sUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + sprite->data[2]++; + HandleStartAffineAnim(sprite); + sprite->data[7] = sUnknown_03001240[sprite->data[0]].field_2; + sprite->data[3] = -1; + sprite->data[4] = -1; + sprite->data[5] = 0; + sprite->data[6] = 0; + } + + sprite->pos2.x += (sprite->data[7] * 2 * sprite->data[3]); + sprite->pos2.y += (sprite->data[7] * sprite->data[4]); + sprite->data[6] += 8; + if (sprite->pos2.x <= -16 || sprite->pos2.x >= 16) + { + sprite->pos2.x = sprite->data[3] * 16; + sprite->data[3] *= -1; + sprite->data[5]++; + } + else if (sprite->pos2.y <= -16 || sprite->pos2.y >= 16) + { + sprite->pos2.y = sprite->data[4] * 16; + sprite->data[4] *= -1; + sprite->data[5]++; + } + + if (sprite->data[5] > 5 && sprite->pos2.x <= 0) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[5] = 0; + sprite->data[6] = 0; + sUnknown_03001240[sprite->data[0]].field_0 = 10; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + + HandleSetAffineData(sprite, 256, 256, sprite->data[6] << 8); + sub_817F70C(sprite); + } +} + +static void sub_8181370(struct Sprite *sprite); + +static void pokemonanimfunc_2B(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[6] = 0; + sprite->data[7] = 0; + sprite->callback = sub_8181370; +} + +static void sub_8181370(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[6] += 4; + sprite->pos2.x = -(Sin(sprite->data[6], 16)); + sprite->pos2.y = -(Sin((sprite->data[6] * 2) & 0xFF, 8)); + if (sprite->data[6] > 192 && sprite->data[7] == 1) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->data[7]++; + } + else if (sprite->data[6] > 64 && sprite->data[7] == 0) + { + HandleSetAffineData(sprite, -256, 256, 0); + sprite->data[7]++; + } + + if (sprite->data[6] > 255) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + sub_817F70C(sprite); +} + +static void pokemonanimfunc_2C(struct Sprite *sprite) +{ + if (++sprite->data[2] == 1) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[6] = 0; + sprite->data[5] = 0; + sprite->data[4] = 0; + } + + if (sUnknown_0860AA64[sprite->data[6]][1] == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + if (sprite->data[4] == 1) + { + if (sUnknown_0860AA64[sprite->data[6]][0] != 0) + BlendPalette(sprite->data[7], 0x10, 0x10, RGB_YELLOW); + else + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); + + sprite->data[4] = 0; + } + + if (sUnknown_0860AA64[sprite->data[6]][1] == sprite->data[5]) + { + sprite->data[4] = 1; + sprite->data[5] = 0; + sprite->data[6]++; + } + else + { + sprite->data[5]++; + } + } +} + +static void sub_81814D4(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + sub_817F70C(sprite); + if (sprite->data[2] > sUnknown_03001240[sprite->data[0]].field_8) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + s16 index = (sprite->data[2] * 256) / sUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = -(Sin(index, 10)); + HandleSetAffineData(sprite, 256, 256, Sin(index, 3276)); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_2D(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_8 = 50; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +static void sub_81815D4(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + HandleStartAffineAnim(sprite); + + sub_817F70C(sprite); + if (sprite->data[2] > sUnknown_03001240[sprite->data[0]].field_8) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + else + { + s16 index = (sprite->data[2] * 256) / sUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = -(Sin(index, 10)); + HandleSetAffineData(sprite, 256, 256, -(Sin(index, 3276))); + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_2E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_8 = 50; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +static void sub_8181708(struct Sprite *sprite); +static void sub_8181770(struct Sprite *sprite); +static void sub_8181794(struct Sprite *sprite); + +static void pokemonanimfunc_2F(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[6] = -(14 * sprite->centerToCornerVecX / 10); + sprite->data[7] = 128; + sprite->callback = sub_8181708; +} + +static void sub_8181708(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7]--; + sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + + HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); + if (sprite->data[7] <= 120) + { + sprite->data[7] = 120; + sprite->data[3] = 0; + sprite->callback = sub_8181770; + } + + sub_817F70C(sprite); +} + +static void sub_8181770(struct Sprite *sprite) +{ + if (sprite->data[3] == 20) + { + sprite->callback = sub_8181794; + sprite->data[3] = 0; + } + + sprite->data[3]++; +} + +static void sub_8181794(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] += 2; + sprite->pos2.x = Cos(sprite->data[7], sprite->data[6]) + sprite->data[6]; + + sprite->pos2.y = -(Sin(sprite->data[7], sprite->data[6] += 0)); // dummy += 0 is needed to match + + HandleSetAffineData(sprite, 256, 256, (sprite->data[7] - 128) << 8); + if (sprite->data[7] >= 128) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sprite->data[2] = 0; + sub_817F77C(sprite); + sprite->callback = pokemonanimfunc_10; + } + + sub_817F70C(sprite); +} + +static void sub_8181810(struct Sprite *sprite) +{ + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) + { + sUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[4] = 0; + sprite->data[5] = 0; + sprite->data[2] = 1; + } + + if (sprite->data[5] == 0) + { + sprite->data[7] = Sin(sprite->data[4], 256); + sprite->pos2.y = Sin(sprite->data[4], 16); + sprite->data[6] = Sin(sprite->data[4], 32); + HandleSetAffineData(sprite, 256 - sprite->data[6], 256 + sprite->data[7], 0); + if (sprite->data[4] == 128) + { + sprite->data[4] = 0; + sprite->data[5] = 1; + } + } + else if (sprite->data[5] == 1) + { + sprite->data[7] = Sin(sprite->data[4], 32); + sprite->pos2.y = -(Sin(sprite->data[4], 8)); + sprite->data[6] = Sin(sprite->data[4], 128); + HandleSetAffineData(sprite, 256 + sprite->data[6], 256 - sprite->data[7], 0); + if (sprite->data[4] == 128) + { + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_0 = 10; + sprite->data[4] = 0; + sprite->data[5] = 0; + } + else + { + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + } + } + + sprite->data[4] += sUnknown_03001240[sprite->data[0]].field_6; + } +} + +static void pokemonanimfunc_30(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_6 = 4; + sub_8181810(sprite); + sprite->callback = sub_8181810; +} + +static void pokemonanimfunc_31(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + sub_817F70C(sprite); + if (counter > 512) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + switch (sprite->data[2] / 128) + { + case 0: + sprite->pos2.x = -(counter % 128 * 8) / 128; + break; + case 1: + sprite->pos2.x = (counter % 128 / 16) - 8; + break; + case 2: + sprite->pos2.x = (counter % 128 / 16); + break; + case 3: + sprite->pos2.x = -(counter % 128 * 8) / 128 + 8; + break; + } + + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; + sub_817F70C(sprite); +} + +static void sub_8181ABC(struct Sprite *sprite); +static void sub_8181B4C(struct Sprite *sprite); +static void sub_8181C2C(struct Sprite *sprite); + +static void pokemonanimfunc_32(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_8 = -1; + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sub_8181ABC(sprite); + sprite->callback = sub_8181ABC; +} + +static void sub_8181ABC(struct Sprite *sprite) +{ + if (sUnknown_03001240[sprite->data[0]].field_0 != 0) + { + sUnknown_03001240[sprite->data[0]].field_0--; + } + else + { + s32 counter; + + sub_817F70C(sprite); + counter = sprite->data[2]; + if (sprite->data[2] > 128) + { + sprite->data[2] = 0; + sprite->callback = sub_8181B4C; + } + else + { + s32 var = 8 * sUnknown_03001240[sprite->data[0]].field_8; + sprite->pos2.x = var * (counter % 128) / 128; + sprite->pos2.y = -(Sin(counter % 128, 8)); + sprite->data[2] += 12; + } + + sub_817F70C(sprite); + } +} + +static void sub_8181B4C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 48) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.y = 0; + sprite->data[2] = 0; + sprite->callback = sub_8181C2C; + } + else + { + s16 yDelta; + s16 yScale = Sin(sprite->data[4], 64) + 256; + if (sprite->data[2] >= 16 && sprite->data[2] <= 31) + { + sprite->data[3] += 8; + sprite->pos2.x -= sUnknown_03001240[sprite->data[0]].field_8; + } + + yDelta = 0; + if (yScale > 256) + yDelta = (256 - yScale) / 8; + + sprite->pos2.y = -(Sin(sprite->data[3], 20)) - yDelta; + HandleSetAffineData(sprite, 256 - Sin(sprite->data[4], 32), yScale, 0); + sprite->data[2]++; + sprite->data[4] += 8; + sprite->data[4] &= 0xFF; + } + + sub_817F70C(sprite); +} + +static void sub_8181C2C(struct Sprite *sprite) +{ + s32 counter; + + sub_817F70C(sprite); + counter = sprite->data[2]; + if (counter > 128) + { + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sUnknown_03001240[sprite->data[0]].field_0 = 10; + sprite->data[3] = 0; + sprite->data[2] = 0; + sprite->data[4] = 0; + sprite->callback = sub_8181ABC; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + register s32 var asm("r4") = sUnknown_03001240[sprite->data[0]].field_8; + + sprite->pos2.x = (var << 3) * (counter % 128) / 128 - (sUnknown_03001240[sprite->data[0]].field_8 * 8); + sprite->pos2.y = -(Sin(counter % 128, 8)); + } + + sprite->data[2] += 12; + sub_817F70C(sprite); +} + +static void sub_8181CE8(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 254) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + if (sUnknown_03001240[sprite->data[0]].field_4 > 1) + { + sUnknown_03001240[sprite->data[0]].field_4--; + sprite->data[2] = 0; + sprite->data[7] = 0; + } + else + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); + } + else + { + u16 rotation; + + sprite->pos2.x = -(Sin(sprite->data[7], 16)); + rotation = Sin(sprite->data[7], 32); + HandleSetAffineData(sprite, 256, 256, rotation << 8); + sprite->data[7] += sUnknown_03001240[sprite->data[0]].field_6; + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_33(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + sUnknown_03001240[id].field_6 = 4; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +static void pokemonanimfunc_34(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 254) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sub_817F70C(sprite); + } + else + { + u16 rotation; + + sprite->pos2.x = -(Sin(sprite->data[7], 16)); + sprite->pos2.y = -(Sin(sprite->data[7] % 128, 16)); + rotation = Sin(sprite->data[7], 32); + HandleSetAffineData(sprite, 256, 256, rotation << 8); + sprite->data[7] += 8; + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_35(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[7] = 0; + + if (sprite->data[2] == sprite->data[7]) + { + sprite->data[7] = 0; + sprite->data[2]++; + sprite->invisible = 0; + } + else + { + sprite->data[7]++; + sprite->invisible = 1; + } + + if (sprite->data[2] > 10) + { + sprite->invisible = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } +} + +static void sub_8181F14(struct Sprite *sprite); +static void sub_8181F50(struct Sprite *sprite); +static void sub_8181FC0(struct Sprite *sprite); + +static void pokemonanimfunc_36(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->callback = sub_8181F14; +} + +static void sub_8181F14(struct Sprite *sprite) +{ + if (sprite->data[7] > 31) + { + sprite->data[7] = 32; + sprite->data[2] = 0; + sprite->callback = sub_8181F50; + } + else + { + sprite->data[7] += 4; + } + + HandleSetAffineData(sprite, 256, 256, sprite->data[7] << 8); +} + +static void sub_8181F50(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 512) + { + sprite->callback = sub_8181FC0; + sprite->data[6] = 0; + } + else + { + sprite->pos2.x = -(sprite->data[2] * 16) / 512; + sprite->pos2.y = -(Sin(sprite->data[2] % 128, 4)); + sprite->data[2] += 12; + } + + sub_817F70C(sprite); +} + +static void sub_8181FC0(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] -= 2; + if (sprite->data[7] < 0) + { + sprite->data[7] = 0; + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->pos2.x = -(Sin(sprite->data[7] * 2, 16)); + } + + HandleSetAffineData(sprite, 256, 256, sprite->data[7] << 8); + sub_817F70C(sprite); +} + +static void pokemonanimfunc_37(struct Sprite *sprite) +{ + u16 rotation; + + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + sub_817F70C(sprite); + if (sprite->data[7] > 255) + { + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[7] = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[7] += 16; + sprite->pos2.x = -(Sin(sprite->data[7] % 128, 8)); + sprite->pos2.y = -(Sin(sprite->data[7] % 128, 8)); + } + + rotation = Sin(sprite->data[7] % 128, 16); + HandleSetAffineData(sprite, 256, 256, rotation << 8); + sub_817F70C(sprite); +} + +static void sub_81820FC(struct Sprite *sprite); +static void sub_818216C(struct Sprite *sprite); +static void sub_81821CC(struct Sprite *sprite); +static void sub_8182248(struct Sprite *sprite); + +static void pokemonanimfunc_38(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->data[4] = 0; + sprite->callback = sub_81820FC; +} + +static void sub_81820FC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] > 24) + { + if (++sprite->data[4] > 4) + { + sprite->data[4] = 0; + sprite->callback = sub_818216C; + } + } + else + { + sprite->data[7] += 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +static void sub_818216C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] > 32) + { + sprite->data[6] = 1; + sprite->callback = sub_81821CC; + } + else + { + sprite->data[7] += 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +static void sub_81821CC(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->data[7] += (sprite->data[6] * 4); + if (sprite->data[5] > 9) + { + sprite->data[7] = 32; + sprite->callback = sub_8182248; + } + + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + if (sprite->data[7] <= 28 || sprite->data[7] >= 36) + { + sprite->data[6] *= -1; + sprite->data[5]++; + } + + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +static void sub_8182248(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[7] <= 0) + { + sprite->data[7] = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[7] -= 2; + sprite->pos2.x = Sin(sprite->data[7], 8); + sprite->pos2.y = -(Sin(sprite->data[7], 8)); + } + + HandleSetAffineData(sprite, 256, 256, -(sprite->data[7]) << 8); + sub_817F70C(sprite); +} + +static void pokemonanimfunc_39(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + if ((sprite->data[2] % 4) / 2 == 0) + { + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 16) * sign; + sprite->pos2.y = -(sprite->pos2.x); + } + else + { + sprite->pos2.x = -(Sin((sprite->data[2] * 128 / 40) % 256, 16)) * sign; + sprite->pos2.y = sprite->pos2.x; + } + } + + sprite->data[2]++; + sub_817F70C(sprite); +} + +static void pokemonanimfunc_3A(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[5] = 0; + sprite->data[6] = 0; + sprite->data[7] = 0; + sprite->data[2]++; + } + + if (sprite->data[6] > 0) + { + sprite->data[6]--; + if (sprite->data[5] != 3) + { + s16 scale = (8 * sprite->data[6]) / 20; + scale = Sin(sprite->data[7] - scale, 64); + HandleSetAffineData(sprite, 256 - scale, 256 - scale, 0); + } + } + else + { + s16 var; + + if (sprite->data[5] == 3) + { + if (sprite->data[7] > 63) + { + sprite->data[7] = 64; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + var = Cos(sprite->data[7], 64); + } + else + { + var = Sin(sprite->data[7], 64); + if (sprite->data[7] > 63) + { + sprite->data[5] = 3; + sprite->data[6] = 10; + sprite->data[7] = 0; + } + else + { + if (var > 48 && sprite->data[5] == 1) + { + sprite->data[5] = 2; + sprite->data[6] = 20; + } + else if (var > 16 && sprite->data[5] == 0) + { + sprite->data[5] = 1; + sprite->data[6] = 20; + } + } + } + + sprite->data[7] += 2; + HandleSetAffineData(sprite, 256 - var, 256 - var, 0); + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_3B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale; + + sprite->pos2.y = Sin(sprite->data[7] % 256, 8); + sprite->data[7] += 8; + yScale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 256, yScale + 256, 0); + } +} + +static void pokemonanimfunc_3C(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 256) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 yScale; + + sprite->pos2.y = Sin(sprite->data[7], 16); + sprite->data[7] += 4; + yScale = Sin((sprite->data[7] % 64) * 2, 128); + HandleSetAffineData(sprite, 256, yScale + 256, 0); + } +} + +static void sub_81825F8(struct Sprite *sprite); +static void sub_8182648(struct Sprite *sprite); +static void sub_81826F8(struct Sprite *sprite); + +static void pokemonanimfunc_3D(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->callback = sub_81825F8; + sprite->data[7] = 0; +} + +static void sub_81825F8(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 8; + if (sprite->data[7] > 63) + { + sprite->data[7] = 0; + sprite->data[6] = 0; + sprite->callback = sub_8182648; + yScale = Sin(64, 128); // 128 * 1 = 128 + } + else + { + yScale = Sin(sprite->data[7], 128); + } + + HandleSetAffineData(sprite, 256, 256 + yScale, 0); +} + +static void sub_8182648(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 4; + if (sprite->data[7] > 95) + { + yScale = Cos(0, 128); // 128 * (-1) = -128 + sprite->data[7] = 0; + sprite->data[6]++; + } + else + { + s16 sign, index; + + sprite->pos2.y = -(sprite->data[6] * 4) - Sin(sprite->data[7], 8); + if (sprite->data[7] > 63) + { + sign = -1; + index = sprite->data[7] - 64; + } + else + { + sign = 1; + index = 0; + } + + yScale = Cos((index * 2) + sprite->data[7], 128) * sign; + } + + HandleSetAffineData(sprite, 256, 256 + yScale, 0); + if (sprite->data[6] == 3) + { + sprite->data[7] = 0; + sprite->callback = sub_81826F8; + } +} + +static void sub_81826F8(struct Sprite *sprite) +{ + s16 yScale; + + sprite->data[7] += 8; + yScale = Cos(sprite->data[7], 128); + sprite->pos2.y = -(Cos(sprite->data[7], 12)); + if (sprite->data[7] > 63) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + } + + HandleSetAffineData(sprite, 256, 256 + yScale, 0); +} + +static void sub_8182764(struct Sprite *sprite) +{ + if (sprite->data[7] > sprite->data[5]) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 256, 256, 0); + } + else + { + s16 xScale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); + sprite->data[7] += sprite->data[6]; + xScale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 256 + xScale, 256, 0); + } +} + +static void pokemonanimfunc_3E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 8; + } + + sub_8182764(sprite); +} + +static void sub_8182830(struct Sprite *sprite) +{ + if (sprite->data[7] > sprite->data[5]) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 256, 256, 0); + } + else + { + s16 xScale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, sprite->data[4]); + sprite->data[7] += sprite->data[6]; + xScale = Sin((sprite->data[7] % 64) * 2, 128); + HandleSetAffineData(sprite, 256 + xScale, 256, 0); + } +} + +static void pokemonanimfunc_3F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 256; + sprite->data[4] = 16; + } + + sub_8182830(sprite); +} + +static void pokemonanimfunc_40(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 256, 256, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = Sin(sprite->data[7] % 256, 8); + sprite->data[7] += 8; + scale = Sin(sprite->data[7] % 128, 96); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_41(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 256, 256, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = -(Sin((sprite->data[7] % 256) / 2, 16)); + sprite->data[7] += 8; + scale = -(Sin((sprite->data[7] % 256) / 2, 64)); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_42(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + } + + if (sprite->data[7] > 512) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + HandleSetAffineData(sprite, 256, 256, 0); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + s16 scale; + + sprite->pos2.x = -(Sin(sprite->data[7] % 256 , 8)); + sprite->data[7] += 8; + scale = Sin((sprite->data[7] % 256) / 2, 96); + HandleSetAffineData(sprite, 256 + scale, 256 + scale, 0); + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_43(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 caseVar = (sprite->data[2] / 512) % 4; + switch (caseVar) + { + case 0: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = (sprite->data[2] % 512 / 32) - 16; + break; + case 2: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 3: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + } + + sprite->pos2.y = -(Sin(sprite->data[2] % 128, 4)); + sprite->data[2] += 24; + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_44(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + sprite->data[6] = 0; + sprite->data[7] = 64; + sprite->data[2]++; + } + + sprite->data[7] += 8; + if (sprite->data[6] == 4) + { + if (sprite->data[7] > 63) + { + sprite->data[7] = 0; + sprite->data[6]++; + } + } + else + { + if (sprite->data[7] > 127) + { + sprite->data[7] = 0; + sprite->data[6]++; + } + } + + switch (sprite->data[6]) + { + case 1: + sprite->pos2.x = -(Cos(sprite->data[7], 8)); + sprite->pos2.y = Sin(sprite->data[7], 8) - 8; + break; + case 2: + sprite->pos2.x = Sin(sprite->data[7] + 128, 8) + 8; + sprite->pos2.y = -(Cos(sprite->data[7], 8)); + break; + case 3: + sprite->pos2.x = Cos(sprite->data[7], 8); + sprite->pos2.y = Sin(sprite->data[7] + 128, 8) + 8; + break; + case 0: + case 4: + sprite->pos2.x = Sin(sprite->data[7], 8) - 8; + sprite->pos2.y = Cos(sprite->data[7], 8); + break; + default: + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + break; + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_45(struct Sprite *sprite) +{ + sprite->data[0] = 32; + sub_8180714(sprite); + sprite->callback = sub_8180714; +} + +static void pokemonanimfunc_46(struct Sprite *sprite) +{ + sprite->data[0] = 80; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +static void pokemonanimfunc_47(struct Sprite *sprite) +{ + sprite->data[0] = 80; + sub_817F978(sprite); + sprite->callback = sub_817F978; +} + +static void pokemonanimfunc_48(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 2048; + sUnknown_03001240[id].field_8 = sprite->data[6]; + sub_8180900(sprite); + sprite->callback = sub_8180900; +} + +static void pokemonanimfunc_49(struct Sprite *sprite) +{ + sprite->data[6] = 1; + pokemonanimfunc_05(sprite); +} + +static void pokemonanimfunc_4A(struct Sprite *sprite) +{ + sprite->data[6] = 1; + pokemonanimfunc_48(sprite); +} + +static void pokemonanimfunc_4B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + sprite->data[0] = 0; + + if (sprite->data[0] <= 0) + { + sub_817FC20(sprite); + sprite->data[0] = 1; + } + else + { + sprite->data[0]--; + } +} + +static void pokemonanimfunc_4C(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sprite->data[7] = 3; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +static void pokemonanimfunc_4D(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sub_817FD44(sprite); + sprite->callback = sub_817FD44; +} + +static void pokemonanimfunc_4E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 1024; + sUnknown_03001240[id].field_0 = 0; + sUnknown_03001240[id].field_4 = 2; + sub_817FE30(sprite); + sprite->callback = sub_817FE30; +} + +static void pokemonanimfunc_4F(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 512; + sUnknown_03001240[id].field_8 = 3; + sUnknown_03001240[id].field_2 = 12; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +static void pokemonanimfunc_50(struct Sprite *sprite) +{ + sprite->data[0] = 24; + sub_818031C(sprite); + sprite->callback = sub_818031C; +} + +static void pokemonanimfunc_51(struct Sprite *sprite) +{ + sprite->data[0] = 5; + sub_81804F8(sprite); + sprite->callback = sub_81804F8; +} + +static void pokemonanimfunc_52(struct Sprite *sprite) +{ + sprite->data[0] = 3; + sub_817F9F4(sprite); + sprite->callback = sub_817F9F4; +} + +static void pokemonanimfunc_53(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_0 = 60; + sUnknown_03001240[id].field_8 = 30; + sub_817FF3C(sprite); + sprite->callback = sub_817FF3C; +} + +static void pokemonanimfunc_54(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_2 = 1; + sUnknown_03001240[id].field_4 = 2; + sub_8181214(sprite); + sprite->callback = sub_8181214; +} + +static void pokemonanimfunc_55(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_4 = 2; + sub_8181810(sprite); + sprite->callback = sub_8181810; +} + +static void pokemonanimfunc_56(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_8 = 1; + sUnknown_03001240[id].field_4 = 2; + HandleStartAffineAnim(sprite); + sprite->data[3] = 0; + sub_8181ABC(sprite); + sprite->callback = sub_8181ABC; +} + +static void pokemonanimfunc_07(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 2; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +static void pokemonanimfunc_08(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 4; + sUnknown_03001240[id].field_4 = 2; + sub_8181CE8(sprite); + sprite->callback = sub_8181CE8; +} + +static void pokemonanimfunc_0B(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_8 = 100; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +static void pokemonanimfunc_0C(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_8 = 50; + sUnknown_03001240[id].field_4 = 2; + sub_81814D4(sprite); + sprite->callback = sub_81814D4; +} + +static void pokemonanimfunc_0D(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_8 = 100; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +static void pokemonanimfunc_0E(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_8 = 50; + sUnknown_03001240[id].field_4 = 2; + sub_81815D4(sprite); + sprite->callback = sub_81815D4; +} + +static void sub_8183140(struct Sprite *sprite) +{ + s32 counter = sprite->data[2]; + if (counter > 2304) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin((counter + 192) % 256, sprite->data[7]) + sprite->data[7]; + } + + sprite->data[2] += sprite->data[0]; +} + +static void pokemonanimfunc_57(struct Sprite *sprite) +{ + sprite->data[0] = 60; + sprite->data[7] = 3; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +static void pokemonanimfunc_58(struct Sprite *sprite) +{ + sprite->data[0] = 30; + sprite->data[7] = 3; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +static void pokemonanimfunc_59(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 128, 4); + sprite->data[2] += 24; + } + + sub_817F70C(sprite); +} + +static void sub_81832C8(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + + if (sprite->data[5] > sprite->data[6]) + { + sprite->pos2.y = 0; + sprite->data[5] = 0; + HandleSetAffineData(sprite, 256, 256, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale, yScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + if (sprite->data[1] == 0) + xScale = -256 - Sin(index2, 16); + else + xScale = 256 + Sin(index2, 16); + + amplitude = sprite->data[3]; + yScale = 256 - Sin(index2, amplitude) - Sin(index1, amplitude / 5); + SetAffineData(sprite, xScale, yScale, 0); + sprite->data[5]++; + } +} + +static void pokemonanimfunc_5A(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +static void sub_8183418(struct Sprite *sprite) +{ + s16 index1 = 0, index2; + + if (sprite->data[5] > sprite->data[6]) + { + sprite->data[5] = 0; + HandleSetAffineData(sprite, 256, 256, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + amplitude = sprite->data[3]; + + if (sprite->data[1] == 0) + xScale = -256 + Sin(index2, amplitude) + Sin(index1, amplitude / 5 * 2); + else + xScale = 256 - Sin(index2, amplitude) - Sin(index1, amplitude / 5 * 2); + + SetAffineData(sprite, xScale, 256, 0); + sprite->data[5]++; + } +} + +static void pokemonanimfunc_5B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +static void sub_8183574(struct Sprite *sprite) +{ + u8 var6, var7; + u8 var8 = sprite->data[2]; + u8 var9 = sprite->data[6]; + u8 var5 = sUnknown_0860AA80[sprite->data[5]][0]; + u8 var2 = var5; + if (var5 != 0xFF) + var5 = sprite->data[7]; + else + var5 = 0xFF; // needed to match + + var6 = sUnknown_0860AA80[sprite->data[5]][1]; + var7 = 0; + if (var2 != 0xFE) + var7 = (var6 - var9) * var5 / var6; + + if (var5 == 0xFF) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.y = 0; + } + else + { + sprite->pos2.y = Sin((var8 + 192) % 256, var7) + var7; + if (var9 == var6) + { + sprite->data[5]++; + sprite->data[6] = 0; + } + else + { + sprite->data[2] += sprite->data[0]; + sprite->data[6]++; + } + } +} + +static void pokemonanimfunc_5C(struct Sprite *sprite) +{ + sprite->data[0] = 40; + sprite->data[7] = 6; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +static void pokemonanimfunc_5D(struct Sprite *sprite) +{ + sprite->data[0] = 70; + sprite->data[7] = 6; + sub_817FCDC(sprite); + sprite->callback = sub_817FCDC; +} + +static void pokemonanimfunc_5E(struct Sprite *sprite) +{ + sprite->data[0] = 20; + sub_817F8FC(sprite); + sprite->callback = sub_817F8FC; +} + +static void pokemonanimfunc_5F(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 9) * sign; + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_60(struct Sprite *sprite) +{ + if (sprite->data[2] > 40) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + } + else + { + s8 sign; + if (!(sprite->data[2] & 1)) + sign = 1; + else + sign = -1; + + sprite->pos2.x = Sin((sprite->data[2] * 128 / 40) % 256, 12) * sign; + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_61(struct Sprite *sprite) +{ + sprite->data[0] = 70; + sprite->data[7] = 6; + sub_8183140(sprite); + sprite->callback = sub_8183140; +} + +static void pokemonanimfunc_62(struct Sprite *sprite) +{ + sprite->data[0] = 24; + sprite->data[7] = 6; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +static void pokemonanimfunc_63(struct Sprite *sprite) +{ + sprite->data[0] = 56; + sprite->data[7] = 9; + sub_8183574(sprite); + sprite->callback = sub_8183574; +} + +static void pokemonanimfunc_64(struct Sprite *sprite) +{ + u8 id = sprite->data[0] = sub_817F758(); + + sUnknown_03001240[id].field_6 = 1024; + sUnknown_03001240[id].field_8 = 6; + sUnknown_03001240[id].field_2 = 24; + sub_817FFF0(sprite); + sprite->callback = sub_817FFF0; +} + +static void sub_81837DC(struct Sprite *sprite) +{ + s16 index1 = 0, index2 = 0; + if (sprite->data[5] > sprite->data[6]) + { + sprite->pos2.y = 0; + sprite->data[5] = 0; + HandleSetAffineData(sprite, 256, 256, 0); + if (sprite->data[4] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]--; + sprite->data[7] = 0; + } + } + else + { + u8 amplitude, cmpVal1, cmpVal2; + s16 xScale, yScale; + + index2 = (sprite->data[5] * 128) / sprite->data[6]; + cmpVal1 = sprite->data[6] / 4; + cmpVal2 = cmpVal1 * 3; + if (sprite->data[5] >= cmpVal1 && sprite->data[5] < cmpVal2) + { + sprite->data[7] += 51; + index1 = sprite->data[7] & 0xFF; + } + + amplitude = sprite->data[3]; + + if (sprite->data[1] == 0) + xScale = Sin(index2, amplitude) + (Sin(index1, amplitude / 5 * 2) - 256); + else + xScale = 256 - Sin(index1, amplitude / 5 * 2) - Sin(index2, amplitude); + + yScale = 256 - Sin(index1, amplitude / 5) - Sin(index2, amplitude); + SetAffineData(sprite, xScale, yScale, 0); + sprite->data[5]++; + } +} + +static void pokemonanimfunc_65(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 40; + sprite->data[3] = 40; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +static void pokemonanimfunc_66(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 128, 4); + sprite->data[2] += 48; + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_67(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] > 2048) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->data[6] = 0; + } + else + { + s16 divCase = (sprite->data[2] / 512) % 4; + switch (divCase) + { + case 0: + sprite->pos2.x = (sprite->data[2] % 512) / 32; + break; + case 2: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512; + break; + case 1: + sprite->pos2.x = -(sprite->data[2] % 512 * 16) / 512 + 16; + break; + case 3: + sprite->pos2.x = (sprite->data[2] % 512) / 32 - 16; + break; + } + + sprite->pos2.y = Sin(sprite->data[2] % 96, 4); + sprite->data[2] += 64; + } + + sub_817F70C(sprite); +} + +static const s8 sUnknown_0860ADBE[][3] = +{ +// x y timer + {1, 1, 12}, + {-2, 0, 12}, + {1, -1, 12}, + {0, 0, 0} +}; + +static void sub_8183B4C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + sprite->data[3] = 0; + + if (sUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == sprite->data[2]) + { + sprite->data[3]++; + sprite->data[2] = 0; + } + + if (sUnknown_0860ADBE[sprite->data[3]][2] / sprite->data[5] == 0) + { + if (--sprite->data[6] == 0) + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + else + sprite->data[2] = 0; + } + else + { + s32 amplitude = sprite->data[5]; + sprite->pos2.x += (sUnknown_0860ADBE[sprite->data[3]][0] * amplitude); + sprite->pos2.y += (sUnknown_0860ADBE[sprite->data[3]][1] * sprite->data[5]); // what's the point of the var if you're not reusing it? + sprite->data[2]++; + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_68(struct Sprite *sprite) +{ + sprite->data[5] = 1; + sprite->data[6] = 1; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +static void pokemonanimfunc_69(struct Sprite *sprite) +{ + sprite->data[5] = 2; + sprite->data[6] = 1; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +static void pokemonanimfunc_6A(struct Sprite *sprite) +{ + sprite->data[5] = 2; + sprite->data[6] = 2; + sub_8183B4C(sprite); + sprite->callback = sub_8183B4C; +} + +static void sub_8183C6C(struct Sprite *sprite) +{ + if (sprite->data[7] > 255) + { + if (sprite->data[5] <= 1) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + HandleSetAffineData(sprite, 256, 256, 0); + } + else + { + sprite->data[5]--; + sprite->data[7] = 0; + } + } + else + { + s16 scale; + + sprite->data[7] += sprite->data[6]; + if (sprite->data[7] > 256) + sprite->data[7] = 256; + + scale = Sin(sprite->data[7] / 2, 64); + HandleSetAffineData(sprite, 256 - scale, 256 - scale, 0); + } +} + +static void pokemonanimfunc_6B(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 1; + } + + sub_8183C6C(sprite); + sub_817F70C(sprite); +} + +static void pokemonanimfunc_6C(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 2; + } + + sub_8183C6C(sprite); + sub_817F70C(sprite); +} + +static void pokemonanimfunc_6D(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 16; + } + + sub_8182764(sprite); +} + +static void pokemonanimfunc_6E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 4; + sprite->data[5] = 256; + sprite->data[4] = 16; + } + + sub_8182764(sprite); +} + +static void pokemonanimfunc_6F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 16; + } + + sub_8182830(sprite); +} + +static void pokemonanimfunc_70(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[2]++; + sprite->data[7] = 0; + sprite->data[6] = 8; + sprite->data[5] = 512; + sprite->data[4] = 8; + } + + sub_8182830(sprite); +} + +static void pokemonanimfunc_71(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 5; + sprite->data[6] = 8; + } + + sub_8180828(sprite); +} + +static void pokemonanimfunc_72(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 3; + sprite->data[6] = 4; + } + + sub_8180828(sprite); +} + +static void pokemonanimfunc_73(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +static void pokemonanimfunc_74(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[7] = 0; + } + + sub_81832C8(sprite); +} + +static void pokemonanimfunc_75(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +static void pokemonanimfunc_76(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_8183418(sprite); +} + +static void pokemonanimfunc_77(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 2; + sprite->data[6] = 20; + sprite->data[3] = 70; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +static void pokemonanimfunc_78(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + HandleStartAffineAnim(sprite); + sprite->data[4] = 1; + sprite->data[6] = 30; + sprite->data[3] = 60; + sprite->data[5] = 0; + sprite->data[7] = 0; + } + + sub_81837DC(sprite); +} + +static void sub_8183FA8(struct Sprite *sprite) +{ + if (sprite->data[7] > 255) + { + if (sprite->data[6] <= 1) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + sprite->data[7] %= 256; + sprite->data[6]--; + } + } + else + { + sprite->pos2.x = -(Sin(sprite->data[7], sprite->data[5])); + sprite->pos2.y = Sin((sprite->data[7] + 192) % 256, sprite->data[4]); + if (sprite->pos2.y > 0) + sprite->pos2.y *= -1; + + sprite->pos2.y += sprite->data[4]; + sprite->data[7] += sprite->data[3]; + } +} + +static void pokemonanimfunc_79(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 4; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_7A(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 6; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_7B(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 12; + sprite->data[4] = 12; + sprite->data[3] = 8; + } + + sub_8183FA8(sprite); +} + +static void sub_81840C4(struct Sprite *sprite) +{ + if (sprite->data[7] > 256) + { + if (sprite->data[6] <= sprite->data[4]) + { + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[4]++; + sprite->data[7] = 0; + } + + sprite->pos2.x = 0; + sprite->pos2.y = 0; + } + else + { + s16 posX; + + if (sprite->data[7] > 159) + { + if (sprite->data[7] > 256) + sprite->data[7] = 256; + + sprite->pos2.y = -(Sin(sprite->data[7] % 256, 8)); + } + else if (sprite->data[7] > 95) + { + sprite->pos2.y = Sin(96, 6) - Sin((sprite->data[7] - 96) * 2, 4); + } + else + { + sprite->pos2.y = Sin(sprite->data[7], 6); + } + + posX = -(Sin(sprite->data[7] / 2, sprite->data[5])); + if (sprite->data[4] % 2 == 0) + posX *= -1; + + sprite->pos2.x = posX; + sprite->data[7] += sprite->data[3]; + } +} + +static void pokemonanimfunc_7C(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 4; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7D(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 6; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 3; + sprite->data[7] = 0; + sprite->data[5] = 16; + sprite->data[4] = 1; + sprite->data[3] = 8; + } + + sub_81840C4(sprite); +} + +static void pokemonanimfunc_7F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 4; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_80(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 1; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 6; + } + + sub_8183FA8(sprite); +} + +static void pokemonanimfunc_81(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[2] = 1; + sprite->data[6] = 2; + sprite->data[7] = 0; + sprite->data[5] = 4; + sprite->data[4] = 6; + sprite->data[3] = 8; + } + + sub_8183FA8(sprite); +} + +static void sub_8184290(struct Sprite *sprite) +{ + u16 index = Sin((sprite->data[2] * 128) / sprite->data[7], sprite->data[5]); + sprite->data[6] = -(index << 8); + sub_817F3F0(sprite, index, sprite->data[4], 0); + HandleSetAffineData(sprite, 256, 256, sprite->data[6]); +} + +static void pokemonanimfunc_82(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 60; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 1; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_83(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 90; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 1; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_84(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->data[7] = 30; + sprite->data[5] = 8; + sprite->data[4] = -32; + sprite->data[3] = 2; + sprite->data[0] = 0; + } + + if (sprite->data[2] > sprite->data[7]) + { + HandleSetAffineData(sprite, 256, 256, 0); + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->data[0]++; + if (sprite->data[3] <= sprite->data[0]) + { + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + return; + } + else + { + sprite->data[2] = 0; + } + } + else + { + sub_8184290(sprite); + } + + sprite->data[2]++; +} + +static void sub_8184468(struct Sprite *sprite) +{ + if (sprite->data[2] > sprite->data[7]) + { + sprite->pos2.y = 0; + HandleSetAffineData(sprite, 256, 256, 0); + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + u8 posY_unsigned; + s8 posY_signed; + s32 posY; + s16 index = (u16)(sprite->data[2] % sprite->data[6] * 256) / sprite->data[6] % 256; + if (sprite->data[2] % 2 == 0) + { + sprite->data[4] = Sin(index, 32) + 256; + sprite->data[5] = Sin(index, 32) + 256; + posY_unsigned = Sin(index, 32); + posY_signed = posY_unsigned; + } + else + { + sprite->data[4] = Sin(index, 8) + 256; + sprite->data[5] = Sin(index, 8) + 256; + posY_unsigned = Sin(index, 8); + posY_signed = posY_unsigned; + } + + posY = posY_signed; + if (posY < 0) + posY += 7; + sprite->pos2.y = (u32)(posY) >> 3; + HandleSetAffineData(sprite, sprite->data[4], sprite->data[5], 0); + } + + sprite->data[2]++; +} + +static void pokemonanimfunc_85(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 40; + sprite->data[7] = 80; + } + + sub_8184468(sprite); +} + +static void pokemonanimfunc_86(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 40; + sprite->data[7] = 40; + } + + sub_8184468(sprite); +} + +static void pokemonanimfunc_87(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + HandleStartAffineAnim(sprite); + sprite->pos2.y += 2; + sprite->data[6] = 80; + sprite->data[7] = 80; + } + + sub_8184468(sprite); +} + +static void sub_8184610(struct Sprite *sprite); +static void sub_8184640(struct Sprite *sprite); +static void sub_8184678(struct Sprite *sprite); +static void sub_81846B8(struct Sprite *sprite); + +static void sub_81845D4(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x -= sprite->data[2]; + if (sprite->pos2.x <= -sprite->data[6]) + { + sprite->pos2.x = -sprite->data[6]; + sprite->data[7] = 2; + sprite->callback = sub_8184610; + } + + sub_817F70C(sprite); +} + +static void sub_8184610(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x += sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x >= 0) + sprite->callback = sub_8184640; + + sub_817F70C(sprite); +} + +static void sub_8184640(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x += sprite->data[7]; + sprite->data[7]++; + if (sprite->pos2.x > sprite->data[6]) + { + sprite->pos2.x = sprite->data[6]; + sprite->callback = sub_8184678; + } + + sub_817F70C(sprite); +} + +static void sub_8184678(struct Sprite *sprite) +{ + sub_817F70C(sprite); + if (sprite->data[3] >= sprite->data[5]) + { + sprite->callback = sub_81846B8; + } + else + { + sprite->pos2.x += sprite->data[4]; + sprite->data[4] *= -1; + sprite->data[3]++; + } + + sub_817F70C(sprite); +} + +static void sub_81846B8(struct Sprite *sprite) +{ + sub_817F70C(sprite); + sprite->pos2.x -= 2; + if (sprite->pos2.x <= 0) + { + sprite->pos2.x = 0; + sub_817F77C(sprite); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + + sub_817F70C(sprite); +} + +static void pokemonanimfunc_88(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 4; + sprite->data[6] = 12; + sprite->data[5] = 16; + sprite->data[4] = 4; + sprite->data[3] = 0; + sprite->data[2] = 2; + sprite->callback = sub_81845D4; +} + +static void pokemonanimfunc_89(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 2; + sprite->data[6] = 8; + sprite->data[5] = 12; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = 1; + sprite->callback = sub_81845D4; +} + +static void pokemonanimfunc_8A(struct Sprite *sprite) +{ + HandleStartAffineAnim(sprite); + sprite->data[7] = 0; + sprite->data[6] = 6; + sprite->data[5] = 6; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[2] = 1; + sprite->callback = sub_81845D4; +} + +static void sub_8184770(struct Sprite *sprite) +{ + sprite->pos2.x = sprite->data[1]; + if (sprite->data[0] > 1) + { + sprite->data[1] *= -1; + sprite->data[0] = 0; + } + else + { + sprite->data[0]++; + } +} + +struct YellowBlendStruct +{ + u8 field_0; + u8 field_1; +}; + +static const struct YellowBlendStruct sUnknown_0860ADCC[] = +{ + {0, 1}, + {1, 2}, + {0, 15}, + {1, 1}, + {0, 15}, + {1, 1}, + {0, 15}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {1, 1}, + {0, 1}, + {0, 0xFF} +}; + +static const struct YellowBlendStruct sUnknown_0860AE1C[] = +{ + {0, 5}, + {1, 1}, + {0, 15}, + {1, 4}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {1, 2}, + {0, 2}, + {0, 0xFF} +}; + +static const struct YellowBlendStruct sUnknown_0860AE54[] = +{ + {0, 1}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 20}, + {1, 1}, + {0, 1}, + {0, 0xFF} +}; + +static const struct YellowBlendStruct *const sUnknown_0860AE7C[] = +{ + sUnknown_0860ADCC, + sUnknown_0860AE1C, + sUnknown_0860AE54 +}; + +static void BackAnimBlendYellow(struct Sprite *sprite) +{ + const struct YellowBlendStruct *array = sUnknown_0860AE7C[sprite->data[3]]; + sub_8184770(sprite); + if (array[sprite->data[6]].field_1 == 0xFF) + { + sprite->pos2.x = 0; + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + if (sprite->data[4] == 1) + { + if (array[sprite->data[6]].field_0 != 0) + BlendPalette(sprite->data[7], 0x10, 0x10, RGB_YELLOW); + else + BlendPalette(sprite->data[7], 0x10, 0, RGB_YELLOW); + + sprite->data[4] = 0; + } + + if (array[sprite->data[6]].field_1 == sprite->data[5]) + { + sprite->data[4] = 1; + sprite->data[5] = 0; + sprite->data[6]++; + } + else + { + sprite->data[5]++; + } + } +} + +static void pokemonanimfunc_8B(struct Sprite *sprite) +{ + if (++sprite->data[2] == 1) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[6] = 0; + sprite->data[5] = 0; + sprite->data[4] = 0; + sprite->data[3] = 0; + } + + BackAnimBlendYellow(sprite); +} + +static void pokemonanimfunc_8C(struct Sprite *sprite) +{ + if (++sprite->data[2] == 1) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[6] = 0; + sprite->data[5] = 0; + sprite->data[4] = 0; + sprite->data[3] = 1; + } + + BackAnimBlendYellow(sprite); +} + +static void pokemonanimfunc_8D(struct Sprite *sprite) +{ + if (++sprite->data[2] == 1) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[6] = 0; + sprite->data[5] = 0; + sprite->data[4] = 0; + sprite->data[3] = 2; + } + + BackAnimBlendYellow(sprite); +} + +static void BackAnimBlend(struct Sprite *sprite) +{ + static const u16 sColors[] = + { + RGB_RED, RGB_GREEN, RGB_BLUE, RGB_BLACK + }; + + if (sprite->data[2] > 127) + { + BlendPalette(sprite->data[7], 0x10, 0, RGB_RED); + sprite->callback = SpriteCB_SetDummyOnAnimEnd; + } + else + { + sprite->data[6] = Sin(sprite->data[2], 12); + BlendPalette(sprite->data[7], 0x10, sprite->data[6], sColors[sprite->data[1]]); + } +} + +static void sub_8184934(struct Sprite *sprite) +{ + if (sprite->data[3] < sprite->data[4]) + { + sub_817F70C(sprite); + if (sprite->data[5] > sprite->data[0]) + { + if (++sprite->data[3] < sprite->data[4]) + sprite->data[5] = 0; + + sprite->pos2.x = 0; + } + else + { + s8 sign = 1 - (sprite->data[3] % 2 * 2); + sprite->pos2.x = sign * Sin((sprite->data[5] * 384 / sprite->data[0]) % 256, 6); + sprite->data[5]++; + } + + sub_817F70C(sprite); + } +} + +static void pokemonanimfunc_8E(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_8F(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_90(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 0; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_91(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_92(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_93(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 1; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_94(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 10; + sprite->data[5] = 0; + sprite->data[4] = 2; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_95(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 20; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void pokemonanimfunc_96(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; + sprite->data[0] = 80; + sprite->data[5] = 0; + sprite->data[4] = 1; + sprite->data[3] = 0; + sprite->data[1] = 2; + } + + if (sprite->data[2] % 2 == 0) + BackAnimBlend(sprite); + + if (sprite->data[2] >= (128 - sprite->data[0] * sprite->data[4]) / 2) + sub_8184934(sprite); + + sprite->data[2]++; +} + +static void SpriteCB_SetDummyOnAnimEnd(struct Sprite *sprite) +{ + if (sprite->animEnded) + sprite->callback = SpriteCallbackDummy; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 5ec5410ca..4e5c9dca9 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -162,7 +162,7 @@ extern struct BattleMove gBattleMoves[]; extern u32 ChangeBgX(u8 bg, u32 value, u8 op); extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); +extern void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); extern s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth); extern bool8 sub_81A6BF4(); @@ -2557,7 +2557,7 @@ void sub_81C2554() void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f) { - AddTextPrinterParametrized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b); + AddTextPrinterParameterized2(a, 1, c, d, 0, e, &gUnknown_0861CD2C[f], 0, b); } void sub_81C25E8() diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 32c85a5ee..0e1c9dcfe 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -3,7 +3,7 @@ #include "battle.h" #include "palette.h" #include "main.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "text.h" #include "gpu_regs.h" #include "bg.h" @@ -34,7 +34,7 @@ extern struct SpriteTemplate gUnknown_0202499C; extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[]; -extern void dp12_8087EA4(void); +extern void ScanlineEffect_Clear(void); extern void sub_8035658(void); extern bool8 IsDoubleBattle(void); extern u8 GetSubstituteSpriteDefault_Y(u8 bank); @@ -72,7 +72,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) switch (gBattleScripting.reshowMainState) { case 0: - dp12_8087EA4(); + ScanlineEffect_Clear(); sub_8035658(); SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0); SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0); diff --git a/src/save.c b/src/save.c index 023ca6870..8d77e801a 100644 --- a/src/save.c +++ b/src/save.c @@ -4,13 +4,68 @@ #include "constants/game_stat.h" #include "task.h" +// for the chunk declarations +extern struct SaveBlock2 gSaveblock2; +extern struct SaveBlock1 gSaveblock1; +extern struct PokemonStorage gPokemonStorage; + extern struct SaveSectionLocation gRamSaveSectionLocations[0xE]; extern u8 gDecompressionBuffer[]; extern u32 gFlashMemoryPresent; extern u16 gUnknown_03006294; extern bool8 gSoftResetDisabled; -extern const struct SaveSectionOffsets gSaveSectionOffsets[0xE]; +// Divide save blocks into individual chunks to be written to flash sectors + +// Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer +#define SECTOR_DATA_SIZE 3968 +#define SECTOR_FOOTER_SIZE 128 + +/* + * Sector Layout: + * + * Sectors 0 - 13: Save Slot 1 + * Sectors 14 - 27: Save Slot 2 + * Sectors 28 - 29: Hall of Fame + * Sector 30: e-Reader/Mystery Gift Stuff (note: e-Reader is deprecated in Emerald US) + * Sector 31: Recorded Battle + * + * There are two save slots for saving the player's game data. We alternate between + * them each time the game is saved, so that if the current save slot is corrupt, + * we can load the previous one. We also rotate the sectors in each save slot + * so that the same data is not always being written to the same sector. This + * might be done to reduce wear on the flash memory, but I'm not sure, since all + * 14 sectors get written anyway. + */ + +// (u8 *)structure was removed from the first statement of the macro in Emerald. +// This is because malloc is used to allocate addresses so storing the raw +// addresses should not be done in the offsets information. +#define SAVEBLOCK_CHUNK(structure, chunkNum) \ +{ \ + chunkNum * SECTOR_DATA_SIZE, \ + min(sizeof(structure) - chunkNum * SECTOR_DATA_SIZE, SECTOR_DATA_SIZE) \ +} \ + +const struct SaveSectionOffsets gSaveSectionOffsets[] = +{ + SAVEBLOCK_CHUNK(gSaveblock2, 0), + + SAVEBLOCK_CHUNK(gSaveblock1, 0), + SAVEBLOCK_CHUNK(gSaveblock1, 1), + SAVEBLOCK_CHUNK(gSaveblock1, 2), + SAVEBLOCK_CHUNK(gSaveblock1, 3), + + SAVEBLOCK_CHUNK(gPokemonStorage, 0), + SAVEBLOCK_CHUNK(gPokemonStorage, 1), + SAVEBLOCK_CHUNK(gPokemonStorage, 2), + SAVEBLOCK_CHUNK(gPokemonStorage, 3), + SAVEBLOCK_CHUNK(gPokemonStorage, 4), + SAVEBLOCK_CHUNK(gPokemonStorage, 5), + SAVEBLOCK_CHUNK(gPokemonStorage, 6), + SAVEBLOCK_CHUNK(gPokemonStorage, 7), + SAVEBLOCK_CHUNK(gPokemonStorage, 8), +}; extern void DoSaveFailedScreen(u8); // save_failed_screen extern void LoadSerializedGame(void); // load_save diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 8764daa5f..95897e721 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -173,7 +173,7 @@ static void SaveFailedScreenTextPrint(u8 *text, u8 var1, u8 var2) color.fgColor = 0; color.bgColor = 15; color.shadowColor = 3; - AddTextPrinterParametrized2(gSaveFailedWindowIds[TEXT_WIN_ID], 1, var1 * 8, var2 * 8 + 1, 0, 0, &color, 0, text); + AddTextPrinterParameterized2(gSaveFailedWindowIds[TEXT_WIN_ID], 1, var1 * 8, var2 * 8 + 1, 0, 0, &color, 0, text); } void DoSaveFailedScreen(u8 saveType) diff --git a/src/scanline_effect.c b/src/scanline_effect.c new file mode 100644 index 000000000..148e053fc --- /dev/null +++ b/src/scanline_effect.c @@ -0,0 +1,262 @@ +#include "global.h" +#include "data2.h" +#include "task.h" +#include "trig.h" +#include "scanline_effect.h" + +static void CopyValue16Bit(void); +static void CopyValue32Bit(void); + +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; + +// EWRAM vars + +// Per-scanline register values. +// This is double buffered so that it can be safely written to at any time +// without overwriting the buffer that the DMA is currently reading +EWRAM_DATA u16 gScanlineEffectRegBuffers[2][0x3C0] = {0}; + +EWRAM_DATA struct ScanlineEffect gScanlineEffect = {0}; +EWRAM_DATA static bool8 sShouldStopWaveTask = FALSE; + +void ScanlineEffect_Stop(void) +{ + gScanlineEffect.state = 0; + DmaStop(0); + if (gScanlineEffect.waveTaskId != 0xFF) + { + DestroyTask(gScanlineEffect.waveTaskId); + gScanlineEffect.waveTaskId = 0xFF; + } +} + +void ScanlineEffect_Clear(void) +{ + CpuFill16(0, gScanlineEffectRegBuffers, sizeof(gScanlineEffectRegBuffers)); + gScanlineEffect.dmaSrcBuffers[0] = NULL; + gScanlineEffect.dmaSrcBuffers[1] = NULL; + gScanlineEffect.dmaDest = NULL; + gScanlineEffect.dmaControl = 0; + gScanlineEffect.srcBuffer = 0; + gScanlineEffect.state = 0; + gScanlineEffect.unused16 = 0; + gScanlineEffect.unused17 = 0; + gScanlineEffect.waveTaskId = 0xFF; +} + +void ScanlineEffect_SetParams(struct ScanlineEffectParams params) +{ + if (params.dmaControl == SCANLINE_EFFECT_DMACNT_16BIT) // 16-bit + { + // Set the DMA src to the value for the second scanline because the + // first DMA transfer occurs in HBlank *after* the first scanline is drawn + gScanlineEffect.dmaSrcBuffers[0] = (u16 *)gScanlineEffectRegBuffers[0] + 1; + gScanlineEffect.dmaSrcBuffers[1] = (u16 *)gScanlineEffectRegBuffers[1] + 1; + gScanlineEffect.setFirstScanlineReg = CopyValue16Bit; + } + else // assume 32-bit + { + // Set the DMA src to the value for the second scanline because the + // first DMA transfer occurs in HBlank *after* the first scanline is drawn + gScanlineEffect.dmaSrcBuffers[0] = (u32 *)gScanlineEffectRegBuffers[0] + 1; + gScanlineEffect.dmaSrcBuffers[1] = (u32 *)gScanlineEffectRegBuffers[1] + 1; + gScanlineEffect.setFirstScanlineReg = CopyValue32Bit; + } + + gScanlineEffect.dmaControl = params.dmaControl; + gScanlineEffect.dmaDest = params.dmaDest; + gScanlineEffect.state = params.initState; + gScanlineEffect.unused16 = params.unused9; + gScanlineEffect.unused17 = params.unused9; +} + +void ScanlineEffect_InitHBlankDmaTransfer(void) +{ + if (gScanlineEffect.state == 0) + { + return; + } + else if (gScanlineEffect.state == 3) + { + gScanlineEffect.state = 0; + DmaStop(0); + sShouldStopWaveTask = TRUE; + } + else + { + DmaStop(0); + // Set DMA to copy to dest register on each HBlank for the next frame. + // The HBlank DMA transfers do not occurr during VBlank, so the transfer + // will begin on the HBlank after the first scanline + DmaSet(0, gScanlineEffect.dmaSrcBuffers[gScanlineEffect.srcBuffer], gScanlineEffect.dmaDest, gScanlineEffect.dmaControl); + // Manually set the reg for the first scanline + gScanlineEffect.setFirstScanlineReg(); + // Swap current buffer + gScanlineEffect.srcBuffer ^= 1; + } +} + +// These two functions are used to copy the register for the first scanline, +// depending whether it is a 16-bit register or a 32-bit register. + +static void CopyValue16Bit(void) +{ + u16 *dest = (u16 *)gScanlineEffect.dmaDest; + u16 *src = (u16 *)&gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer]; + + *dest = *src; +} + +static void CopyValue32Bit(void) +{ + u32 *dest = (u32 *)gScanlineEffect.dmaDest; + u32 *src = (u32 *)&gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer]; + + *dest = *src; +} + +#define tStartLine data[0] +#define tEndLine data[1] +#define tWaveLength data[2] +#define tSrcBufferOffset data[3] +#define tFramesUntilMove data[4] +#define tDelayInterval data[5] +#define tRegOffset data[6] +#define tApplyBattleBgOffsets data[7] + +static void TaskFunc_UpdateWavePerFrame(u8 taskId) +{ + int value = 0; + int i; + int offset; + + if (sShouldStopWaveTask) + { + DestroyTask(taskId); + gScanlineEffect.waveTaskId = 0xFF; + } + else + { + if (gTasks[taskId].tApplyBattleBgOffsets) + { + switch (gTasks[taskId].tRegOffset) + { + case SCANLINE_EFFECT_REG_BG0HOFS: + value = gBattle_BG0_X; + break; + case SCANLINE_EFFECT_REG_BG0VOFS: + value = gBattle_BG0_Y; + break; + case SCANLINE_EFFECT_REG_BG1HOFS: + value = gBattle_BG1_X; + break; + case SCANLINE_EFFECT_REG_BG1VOFS: + value = gBattle_BG1_Y; + break; + case SCANLINE_EFFECT_REG_BG2HOFS: + value = gBattle_BG2_X; + break; + case SCANLINE_EFFECT_REG_BG2VOFS: + value = gBattle_BG2_Y; + break; + case SCANLINE_EFFECT_REG_BG3HOFS: + value = gBattle_BG3_X; + break; + case SCANLINE_EFFECT_REG_BG3VOFS: + value = gBattle_BG3_Y; + break; + } + } + if (gTasks[taskId].tFramesUntilMove != 0) + { + gTasks[taskId].tFramesUntilMove--; + offset = gTasks[taskId].tSrcBufferOffset + 320; + for (i = gTasks[taskId].tStartLine; i < gTasks[taskId].tEndLine; i++) + { + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gScanlineEffectRegBuffers[0][offset] + value; + offset++; + } + } + else + { + gTasks[taskId].tFramesUntilMove = gTasks[taskId].tDelayInterval; + offset = gTasks[taskId].tSrcBufferOffset + 320; + for (i = gTasks[taskId].tStartLine; i < gTasks[taskId].tEndLine; i++) + { + gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gScanlineEffectRegBuffers[0][offset] + value; + offset++; + } + + // increment src buffer offset + gTasks[taskId].tSrcBufferOffset++; + if (gTasks[taskId].tSrcBufferOffset == gTasks[taskId].tWaveLength) + gTasks[taskId].tSrcBufferOffset = 0; + } + } +} + +static void GenerateWave(u16 *buffer, u8 frequency, u8 amplitude, u8 unused) +{ + u16 i = 0; + u8 theta = 0; + + while (i < 256) + { + buffer[i] = (gSineTable[theta] * amplitude) / 256; + theta += frequency; + i++; + } +} + +// Initializes a background "wave" effect that affects scanlines startLine (inclusive) to endLine (exclusive). +// 'frequency' and 'amplitude' control the frequency and amplitude of the wave. +// 'delayInterval' controls how fast the wave travels up the screen. The wave will shift upwards one scanline every 'delayInterval'+1 frames. +// 'regOffset' is the offset of the video register to modify. +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 applyBattleBgOffsets) +{ + int i; + int offset; + struct ScanlineEffectParams params; + u8 taskId; + + ScanlineEffect_Clear(); + + params.dmaDest = (void *)(REG_ADDR_BG0HOFS + regOffset); + params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + params.initState = 1; + params.unused9 = 0; + ScanlineEffect_SetParams(params); + + taskId = CreateTask(TaskFunc_UpdateWavePerFrame, 0); + + gTasks[taskId].tStartLine = startLine; + gTasks[taskId].tEndLine = endLine; + gTasks[taskId].tWaveLength = 256 / frequency; + gTasks[taskId].tSrcBufferOffset = 0; + gTasks[taskId].tFramesUntilMove = delayInterval; + gTasks[taskId].tDelayInterval = delayInterval; + gTasks[taskId].tRegOffset = regOffset; + gTasks[taskId].tApplyBattleBgOffsets = applyBattleBgOffsets; + + gScanlineEffect.waveTaskId = taskId; + sShouldStopWaveTask = FALSE; + + GenerateWave(&gScanlineEffectRegBuffers[0][320], frequency, amplitude, endLine - startLine); + + offset = 320; + for (i = startLine; i < endLine; i++) + { + gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[0][offset]; + gScanlineEffectRegBuffers[1][i] = gScanlineEffectRegBuffers[0][offset]; + offset++; + } + + return taskId; +} diff --git a/src/scrcmd.c b/src/scrcmd.c index 16a39cd8c..934504c36 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -638,7 +638,7 @@ static bool8 IsPaletteNotActive(void) bool8 ScrCmd_fadescreen(struct ScriptContext *ctx) { - fade_screen(ScriptReadByte(ctx), 0); + FadeScreen(ScriptReadByte(ctx), 0); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } @@ -648,7 +648,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx) u8 mode = ScriptReadByte(ctx); u8 speed = ScriptReadByte(ctx); - fade_screen(mode, speed); + FadeScreen(mode, speed); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } @@ -662,12 +662,12 @@ bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx) case 1: default: CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(mode, 0); + FadeScreen(mode, 0); break; case 0: case 2: CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(mode, 0); + FadeScreen(mode, 0); break; } @@ -726,7 +726,7 @@ bool8 ScrCmd_setweather(struct ScriptContext *ctx) bool8 ScrCmd_resetweather(struct ScriptContext *ctx) { - sub_80AEDBC(); + SetSav1WeatherFromCurrMapHeader(); return FALSE; } diff --git a/src/secret_base.c b/src/secret_base.c index e2cb3b520..f6b393630 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -394,7 +394,7 @@ void sub_80E8FD0(u8 taskId) void sub_80E9068(void) { CreateTask(sub_80E8FD0, 0); - fade_screen(1, 0); + FadeScreen(1, 0); saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); } @@ -451,7 +451,7 @@ void sub_80E916C(u8 taskId) void sub_80E91F8(void) { CreateTask(sub_80E916C, 0); - fade_screen(1, 0); + FadeScreen(1, 0); } bool8 CurrentMapIsSecretBase(void) @@ -651,7 +651,7 @@ void sub_80E96A4(u8 taskId) void sub_80E9728(void) { CreateTask(sub_80E96A4, 0); - fade_screen(1, 0); + FadeScreen(1, 0); } void sub_80E9744(void) diff --git a/src/text.c b/src/text.c index 52ea06f84..4c2b03b71 100644 --- a/src/text.c +++ b/src/text.c @@ -1,6 +1,9 @@ #include "global.h" +#include "battle.h" #include "main.h" +#include "m4a.h" #include "palette.h" +#include "sound.h" #include "string_util.h" #include "window.h" #include "text.h" @@ -14,6 +17,7 @@ extern u16 Font6Func(struct TextPrinter *textPrinter); extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); extern void PlaySE(u16 songNum); extern u8* UnkTextUtil_GetPtrI(u8 a1); +extern int sub_8197964(); EWRAM_DATA struct TextPrinter gTempTextPrinter = {0}; EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {0}; @@ -24,6 +28,7 @@ static u16 gLastTextFgColor; static u16 gLastTextShadowColor; extern struct Main gMain; +extern struct MusicPlayerInfo gMPlayInfo_BGM; const struct FontInfo *gFonts; u8 gUnknown_03002F84; @@ -35,22 +40,22 @@ u8 gGlyphDimensions[0x2]; TextFlags gTextFlags; const u8 gFontHalfRowOffsets[] = { - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x09, 0x0A, 0x0B, 0x09, 0x0C, 0x0D, 0x0E, 0x0C, 0x0F, 0x10, 0x11, 0x0F, 0x09, 0x0A, 0x0B, 0x09, 0x12, 0x13, 0x14, 0x12, 0x15, 0x16, 0x17, 0x15, 0x18, 0x19, 0x1A, 0x18, 0x12, 0x13, 0x14, 0x12, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x1B, 0x1C, 0x1D, 0x1B, 0x1E, 0x1F, 0x20, 0x1E, 0x21, 0x22, 0x23, 0x21, 0x1B, 0x1C, 0x1D, 0x1B, 0x24, 0x25, 0x26, 0x24, 0x27, 0x28, 0x29, 0x27, 0x2A, 0x2B, 0x2C, 0x2A, 0x24, 0x25, 0x26, 0x24, - 0x2D, 0x2E, 0x2F, 0x2D, 0x30, 0x31, 0x32, 0x30, 0x33, 0x34, 0x35, 0x33, 0x2D, 0x2E, 0x2F, 0x2D, + 0x2D, 0x2E, 0x2F, 0x2D, 0x30, 0x31, 0x32, 0x30, 0x33, 0x34, 0x35, 0x33, 0x2D, 0x2E, 0x2F, 0x2D, 0x1B, 0x1C, 0x1D, 0x1B, 0x1E, 0x1F, 0x20, 0x1E, 0x21, 0x22, 0x23, 0x21, 0x1B, 0x1C, 0x1D, 0x1B, 0x36, 0x37, 0x38, 0x36, 0x39, 0x3A, 0x3B, 0x39, 0x3C, 0x3D, 0x3E, 0x3C, 0x36, 0x37, 0x38, 0x36, - 0x3F, 0x40, 0x41, 0x3F, 0x42, 0x43, 0x44, 0x42, 0x45, 0x46, 0x47, 0x45, 0x3F, 0x40, 0x41, 0x3F, + 0x3F, 0x40, 0x41, 0x3F, 0x42, 0x43, 0x44, 0x42, 0x45, 0x46, 0x47, 0x45, 0x3F, 0x40, 0x41, 0x3F, 0x48, 0x49, 0x4A, 0x48, 0x4B, 0x4C, 0x4D, 0x4B, 0x4E, 0x4F, 0x50, 0x4E, 0x48, 0x49, 0x4A, 0x48, 0x36, 0x37, 0x38, 0x36, 0x39, 0x3A, 0x3B, 0x39, 0x3C, 0x3D, 0x3E, 0x3C, 0x36, 0x37, 0x38, 0x36, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00, 0x09, 0x0A, 0x0B, 0x09, 0x0C, 0x0D, 0x0E, 0x0C, 0x0F, 0x10, 0x11, 0x0F, 0x09, 0x0A, 0x0B, 0x09, 0x12, 0x13, 0x14, 0x12, 0x15, 0x16, 0x17, 0x15, 0x18, 0x19, 0x1A, 0x18, 0x12, 0x13, 0x14, 0x12, - 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 + 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00 }; const u8 gDownArrowTiles[] = INCBIN_U8("data/graphics/fonts/down_arrow.4bpp"); @@ -378,460 +383,460 @@ ASM_DIRECT void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor) { asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x24\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - lsl r1, #24\n\ - lsr r1, #24\n\ - lsl r2, #24\n\ - lsr r2, #24\n\ - ldr r3, =gFontHalfRowLookupTable\n\ - ldr r4, =gLastTextBgColor\n\ - strh r1, [r4]\n\ - ldr r4, =gLastTextFgColor\n\ - strh r0, [r4]\n\ - ldr r4, =gLastTextShadowColor\n\ - strh r2, [r4]\n\ - lsl r5, r1, #12\n\ - lsl r6, r0, #12\n\ - lsl r4, r2, #12\n\ - mov r8, r4\n\ - lsl r7, r1, #8\n\ - str r7, [sp]\n\ - lsl r4, r1, #4\n\ - mov r9, r4\n\ - orr r7, r4\n\ - str r7, [sp, #0x4]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #8\n\ - mov r10, r7\n\ - mov r4, r10\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x8]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #8\n\ - mov r12, r7\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0xC]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r0, #4\n\ - mov r9, r7\n\ - ldr r4, [sp]\n\ - orr r4, r7\n\ - str r4, [sp, #0x10]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r10\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x14]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r12\n\ - add r4, r7, #0\n\ - mov r7, r9\n\ - orr r4, r7\n\ - str r4, [sp, #0x18]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - lsl r7, r2, #4\n\ - mov r9, r7\n\ - mov r4, r9\n\ - ldr r7, [sp]\n\ - orr r7, r4\n\ - str r7, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r7, r9\n\ - mov r4, r10\n\ - orr r4, r7\n\ - str r4, [sp, #0x20]\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r4, r5, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - add r4, r6, #0\n\ - orr r4, r7\n\ - strh r4, [r3]\n\ - add r3, #0x2\n\ - mov r4, r8\n\ - orr r7, r4\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - mov r4, r12\n\ - mov r7, r9\n\ - orr r4, r7\n\ - add r7, r4, #0\n\ - orr r7, r1\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x4]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x8]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0xC]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x10]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x14]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x18]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x1C]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - ldr r7, [sp, #0x20]\n\ - orr r7, r0\n\ - add r1, r5, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - add r1, r6, #0\n\ - orr r1, r7\n\ - strh r1, [r3]\n\ - add r3, #0x2\n\ - mov r1, r8\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r4, #0\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r0, [sp, #0x4]\n\ - orr r7, r0\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - orr r7, r1\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x8]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0xC]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x10]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x14]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x18]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x1C]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - ldr r1, [sp, #0x20]\n\ - orr r7, r1\n\ - add r0, r5, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - add r0, r6, #0\n\ - orr r0, r7\n\ - strh r0, [r3]\n\ - add r3, #0x2\n\ - mov r0, r8\n\ - orr r7, r0\n\ - strh r7, [r3]\n\ - add r3, #0x2\n\ - add r7, r2, #0\n\ - orr r7, r4\n\ - orr r5, r7\n\ - strh r5, [r3]\n\ - add r3, #0x2\n\ - orr r6, r7\n\ - strh r6, [r3]\n\ - orr r0, r7\n\ - strh r0, [r3, #0x2]\n\ - add sp, #0x24\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, #0x24\n\ + lsl r0, #24\n\ + lsr r0, #24\n\ + lsl r1, #24\n\ + lsr r1, #24\n\ + lsl r2, #24\n\ + lsr r2, #24\n\ + ldr r3, =gFontHalfRowLookupTable\n\ + ldr r4, =gLastTextBgColor\n\ + strh r1, [r4]\n\ + ldr r4, =gLastTextFgColor\n\ + strh r0, [r4]\n\ + ldr r4, =gLastTextShadowColor\n\ + strh r2, [r4]\n\ + lsl r5, r1, #12\n\ + lsl r6, r0, #12\n\ + lsl r4, r2, #12\n\ + mov r8, r4\n\ + lsl r7, r1, #8\n\ + str r7, [sp]\n\ + lsl r4, r1, #4\n\ + mov r9, r4\n\ + orr r7, r4\n\ + str r7, [sp, #0x4]\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r0, #8\n\ + mov r10, r7\n\ + mov r4, r10\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x8]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r2, #8\n\ + mov r12, r7\n\ + mov r4, r12\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0xC]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r0, #4\n\ + mov r9, r7\n\ + ldr r4, [sp]\n\ + orr r4, r7\n\ + str r4, [sp, #0x10]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r10\n\ + add r4, r7, #0\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x14]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r12\n\ + add r4, r7, #0\n\ + mov r7, r9\n\ + orr r4, r7\n\ + str r4, [sp, #0x18]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + lsl r7, r2, #4\n\ + mov r9, r7\n\ + mov r4, r9\n\ + ldr r7, [sp]\n\ + orr r7, r4\n\ + str r7, [sp, #0x1C]\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r7, r9\n\ + mov r4, r10\n\ + orr r4, r7\n\ + str r4, [sp, #0x20]\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r4, r5, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + add r4, r6, #0\n\ + orr r4, r7\n\ + strh r4, [r3]\n\ + add r3, #0x2\n\ + mov r4, r8\n\ + orr r7, r4\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + mov r4, r12\n\ + mov r7, r9\n\ + orr r4, r7\n\ + add r7, r4, #0\n\ + orr r7, r1\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x4]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x8]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0xC]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x10]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x14]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x18]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x1C]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + ldr r7, [sp, #0x20]\n\ + orr r7, r0\n\ + add r1, r5, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + add r1, r6, #0\n\ + orr r1, r7\n\ + strh r1, [r3]\n\ + add r3, #0x2\n\ + mov r1, r8\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r4, #0\n\ + orr r7, r0\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r0, [sp, #0x4]\n\ + orr r7, r0\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + orr r7, r1\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x8]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0xC]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x10]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x14]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x18]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x1C]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + ldr r1, [sp, #0x20]\n\ + orr r7, r1\n\ + add r0, r5, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + add r0, r6, #0\n\ + orr r0, r7\n\ + strh r0, [r3]\n\ + add r3, #0x2\n\ + mov r0, r8\n\ + orr r7, r0\n\ + strh r7, [r3]\n\ + add r3, #0x2\n\ + add r7, r2, #0\n\ + orr r7, r4\n\ + orr r5, r7\n\ + strh r5, [r3]\n\ + add r3, #0x2\n\ + orr r6, r7\n\ + strh r6, [r3]\n\ + orr r0, r7\n\ + strh r0, [r3, #0x2]\n\ + add sp, #0x24\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } #endif @@ -874,165 +879,165 @@ ASM_DIRECT void DecompressGlyphTile(const u16 *src, u16 *dest) { asm("push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - ldrh r7, [r0]\n\ - ldr r5, =gFontHalfRowLookupTable\n\ - ldr r4, =gFontHalfRowOffsets\n\ - mov r2, #0xFF\n\ - mov r8, r2\n\ - add r2, r7, #0\n\ - mov r3, r8\n\ - and r2, r3\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r3, [r2]\n\ - lsl r3, #16\n\ - lsr r2, r7, #8\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r2, [r2]\n\ - orr r3, r2\n\ - add r6, r1, #0\n\ - stmia r6!, {r3}\n\ - ldrh r7, [r0, #0x2]\n\ - add r0, #0x4\n\ - add r2, r7, #0\n\ - mov r3, r8\n\ - and r2, r3\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r3, [r2]\n\ - lsl r3, #16\n\ - lsr r2, r7, #8\n\ - add r2, r4\n\ - ldrb r2, [r2]\n\ - lsl r2, #1\n\ - add r2, r5\n\ - ldrh r2, [r2]\n\ - orr r3, r2\n\ - str r3, [r1, #0x4]\n\ - add r6, #0x4\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - mov r2, r8\n\ - and r1, r2\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - mov r3, r8\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r0, #0x2\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0]\n\ - add r1, r7, #0\n\ - and r1, r3\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r2, [r1]\n\ - lsl r2, #16\n\ - lsr r1, r7, #8\n\ - add r1, r4\n\ - ldrb r1, [r1]\n\ - lsl r1, #1\n\ - add r1, r5\n\ - ldrh r1, [r1]\n\ - orr r2, r1\n\ - stmia r6!, {r2}\n\ - ldrh r7, [r0, #0x2]\n\ - add r0, r7, #0\n\ - and r0, r3\n\ - add r0, r4\n\ - ldrb r0, [r0]\n\ - lsl r0, #1\n\ - add r0, r5\n\ - ldrh r1, [r0]\n\ - lsl r1, #16\n\ - lsr r0, r7, #8\n\ - add r0, r4\n\ - ldrb r0, [r0]\n\ - lsl r0, #1\n\ - add r0, r5\n\ - ldrh r0, [r0]\n\ - orr r1, r0\n\ - str r1, [r6]\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + mov r7, r8\n\ + push {r7}\n\ + ldrh r7, [r0]\n\ + ldr r5, =gFontHalfRowLookupTable\n\ + ldr r4, =gFontHalfRowOffsets\n\ + mov r2, #0xFF\n\ + mov r8, r2\n\ + add r2, r7, #0\n\ + mov r3, r8\n\ + and r2, r3\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r3, [r2]\n\ + lsl r3, #16\n\ + lsr r2, r7, #8\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r2, [r2]\n\ + orr r3, r2\n\ + add r6, r1, #0\n\ + stmia r6!, {r3}\n\ + ldrh r7, [r0, #0x2]\n\ + add r0, #0x4\n\ + add r2, r7, #0\n\ + mov r3, r8\n\ + and r2, r3\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r3, [r2]\n\ + lsl r3, #16\n\ + lsr r2, r7, #8\n\ + add r2, r4\n\ + ldrb r2, [r2]\n\ + lsl r2, #1\n\ + add r2, r5\n\ + ldrh r2, [r2]\n\ + orr r3, r2\n\ + str r3, [r1, #0x4]\n\ + add r6, #0x4\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + mov r2, r8\n\ + and r1, r2\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + mov r3, r8\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r0, #0x2\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0]\n\ + add r1, r7, #0\n\ + and r1, r3\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r2, [r1]\n\ + lsl r2, #16\n\ + lsr r1, r7, #8\n\ + add r1, r4\n\ + ldrb r1, [r1]\n\ + lsl r1, #1\n\ + add r1, r5\n\ + ldrh r1, [r1]\n\ + orr r2, r1\n\ + stmia r6!, {r2}\n\ + ldrh r7, [r0, #0x2]\n\ + add r0, r7, #0\n\ + and r0, r3\n\ + add r0, r4\n\ + ldrb r0, [r0]\n\ + lsl r0, #1\n\ + add r0, r5\n\ + ldrh r1, [r0]\n\ + lsl r1, #16\n\ + lsr r0, r7, #8\n\ + add r0, r4\n\ + ldrb r0, [r0]\n\ + lsl r0, #1\n\ + add r0, r5\n\ + ldrh r0, [r0]\n\ + orr r1, r0\n\ + str r1, [r6]\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } #endif @@ -1055,703 +1060,703 @@ ASM_DIRECT void CopyGlyphToWindow(struct TextPrinter *x) { asm("push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, #0x8C\n\ - add r3, r0, #0\n\ - ldrb r1, [r3, #0x4]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - ldr r1, =gWindows\n\ - add r1, r0, r1\n\ - add r2, r1, #0\n\ - ldrb r7, [r1, #0x3]\n\ - lsl r0, r7, #3\n\ - ldrb r6, [r3, #0x8]\n\ - sub r4, r0, r6\n\ - ldr r5, =gUnknown_03002F90\n\ - add r0, r5, #0\n\ - add r0, #0x80\n\ - ldrb r0, [r0]\n\ - cmp r4, r0\n\ - ble _08004DD2\n\ - add r4, r0, #0\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, #0x8C\n\ + add r3, r0, #0\n\ + ldrb r1, [r3, #0x4]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + ldr r1, =gWindows\n\ + add r1, r0, r1\n\ + add r2, r1, #0\n\ + ldrb r7, [r1, #0x3]\n\ + lsl r0, r7, #3\n\ + ldrb r6, [r3, #0x8]\n\ + sub r4, r0, r6\n\ + ldr r5, =gUnknown_03002F90\n\ + add r0, r5, #0\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ + cmp r4, r0\n\ + ble _08004DD2\n\ + add r4, r0, #0\n\ _08004DD2:\n\ - ldrb r0, [r1, #0x4]\n\ - lsl r0, #3\n\ - ldrb r3, [r3, #0x9]\n\ - sub r0, r3\n\ - add r1, r5, #0\n\ - add r1, #0x81\n\ - ldrb r1, [r1]\n\ - cmp r0, r1\n\ - ble _08004DE6\n\ - add r0, r1, #0\n\ + ldrb r0, [r1, #0x4]\n\ + lsl r0, #3\n\ + ldrb r3, [r3, #0x9]\n\ + sub r0, r3\n\ + add r1, r5, #0\n\ + add r1, #0x81\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + ble _08004DE6\n\ + add r0, r1, #0\n\ _08004DE6:\n\ - str r6, [sp]\n\ - mov r8, r3\n\ - add r3, r5, #0\n\ - ldr r2, [r2, #0x8]\n\ - mov r9, r2\n\ - lsl r1, r7, #5\n\ - str r1, [sp, #0x4]\n\ - cmp r4, #0x8\n\ - ble _08004DFA\n\ - b _08004F94\n\ + str r6, [sp]\n\ + mov r8, r3\n\ + add r3, r5, #0\n\ + ldr r2, [r2, #0x8]\n\ + mov r9, r2\n\ + lsl r1, r7, #5\n\ + str r1, [sp, #0x4]\n\ + cmp r4, #0x8\n\ + ble _08004DFA\n\ + b _08004F94\n\ _08004DFA:\n\ - cmp r0, #0x8\n\ - bgt _08004E84\n\ - mov r1, r8\n\ - str r3, [sp, #0x8]\n\ - add r2, r6, #0\n\ - add r2, r4\n\ - mov r8, r2\n\ - add r0, r1, r0\n\ - str r0, [sp, #0xC]\n\ - str r6, [sp, #0x10]\n\ - cmp r1, r0\n\ - bcc _08004E14\n\ - b _080052AA\n\ + cmp r0, #0x8\n\ + bgt _08004E84\n\ + mov r1, r8\n\ + str r3, [sp, #0x8]\n\ + add r2, r6, #0\n\ + add r2, r4\n\ + mov r8, r2\n\ + add r0, r1, r0\n\ + str r0, [sp, #0xC]\n\ + str r6, [sp, #0x10]\n\ + cmp r1, r0\n\ + bcc _08004E14\n\ + b _080052AA\n\ _08004E14:\n\ - ldr r3, [sp, #0x8]\n\ - ldm r3!, {r5}\n\ - str r3, [sp, #0x8]\n\ - ldr r4, [sp, #0x10]\n\ - add r0, r1, #0x1\n\ - mov r10, r0\n\ - cmp r4, r8\n\ - bcs _08004E72\n\ - mov r2, #0x7\n\ - mov r12, r2\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, r12\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r3, [sp, #0x8]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x8]\n\ + ldr r4, [sp, #0x10]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _08004E72\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08004E38:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _08004E6A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _08004E6A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004E6A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08004E38\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004E38\n\ _08004E72:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0xC]\n\ - cmp r1, r2\n\ - bcc _08004E14\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0xC]\n\ + cmp r1, r2\n\ + bcc _08004E14\n\ + b _080052AA\n\ + .pool\n\ _08004E84:\n\ - mov r1, r8\n\ - str r3, [sp, #0x14]\n\ - ldr r3, [sp]\n\ - add r3, r4\n\ - mov r12, r3\n\ - add r2, r1, #0\n\ - add r2, #0x8\n\ - str r2, [sp, #0x18]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x1C]\n\ - mov r2, r12\n\ - str r2, [sp, #0x74]\n\ - ldr r3, [sp, #0x18]\n\ - str r3, [sp, #0x88]\n\ - sub r0, #0x8\n\ - str r0, [sp, #0x80]\n\ - cmp r1, r3\n\ - bcs _08004F0E\n\ + mov r1, r8\n\ + str r3, [sp, #0x14]\n\ + ldr r3, [sp]\n\ + add r3, r4\n\ + mov r12, r3\n\ + add r2, r1, #0\n\ + add r2, #0x8\n\ + str r2, [sp, #0x18]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x1C]\n\ + mov r2, r12\n\ + str r2, [sp, #0x74]\n\ + ldr r3, [sp, #0x18]\n\ + str r3, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + cmp r1, r3\n\ + bcs _08004F0E\n\ _08004EA8:\n\ - ldr r0, [sp, #0x14]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x14]\n\ - ldr r4, [sp, #0x1C]\n\ - add r2, r1, #0x1\n\ - mov r8, r2\n\ - cmp r4, r12\n\ - bcs _08004F06\n\ - mov r3, #0x7\n\ - mov r10, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r10\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x14]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x14]\n\ + ldr r4, [sp, #0x1C]\n\ + add r2, r1, #0x1\n\ + mov r8, r2\n\ + cmp r4, r12\n\ + bcs _08004F06\n\ + mov r3, #0x7\n\ + mov r10, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r10\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _08004ECC:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _08004EFE\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r10\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004EFE\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r10\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004EFE:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _08004ECC\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004ECC\n\ _08004F06:\n\ - mov r1, r8\n\ - ldr r2, [sp, #0x18]\n\ - cmp r1, r2\n\ - bcc _08004EA8\n\ + mov r1, r8\n\ + ldr r2, [sp, #0x18]\n\ + cmp r1, r2\n\ + bcc _08004EA8\n\ _08004F0E:\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FD0\n\ - str r3, [sp, #0x20]\n\ - ldr r0, [sp, #0x74]\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x24]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x28]\n\ - cmp r1, r2\n\ - bcc _08004F28\n\ - b _080052AA\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x20]\n\ + ldr r0, [sp, #0x74]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x24]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x28]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ _08004F28:\n\ - ldr r0, [sp, #0x20]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x20]\n\ - ldr r4, [sp, #0x28]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r8\n\ - bcs _08004F86\n\ - mov r3, #0x7\n\ - mov r12, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x20]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x20]\n\ + ldr r4, [sp, #0x28]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08004F86\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _08004F4C:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _08004F7E\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _08004F7E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _08004F7E:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08004F4C\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08004F4C\n\ _08004F86:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x24]\n\ - cmp r1, r2\n\ - bcc _08004F28\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x24]\n\ + cmp r1, r2\n\ + bcc _08004F28\n\ + b _080052AA\n\ + .pool\n\ _08004F94:\n\ - cmp r0, #0x8\n\ - ble _08004F9A\n\ - b _080050A4\n\ + cmp r0, #0x8\n\ + ble _08004F9A\n\ + b _080050A4\n\ _08004F9A:\n\ - mov r1, r8\n\ - str r3, [sp, #0x2C]\n\ - ldr r3, [sp]\n\ - add r3, #0x8\n\ - mov r12, r3\n\ - add r0, r8\n\ - str r0, [sp, #0x30]\n\ - ldr r0, [sp]\n\ - str r0, [sp, #0x34]\n\ - ldr r2, [sp, #0x30]\n\ - str r2, [sp, #0x78]\n\ - str r3, [sp, #0x84]\n\ - sub r4, #0x8\n\ - str r4, [sp, #0x7C]\n\ - cmp r8, r2\n\ - bcs _0800501C\n\ + mov r1, r8\n\ + str r3, [sp, #0x2C]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + add r0, r8\n\ + str r0, [sp, #0x30]\n\ + ldr r0, [sp]\n\ + str r0, [sp, #0x34]\n\ + ldr r2, [sp, #0x30]\n\ + str r2, [sp, #0x78]\n\ + str r3, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800501C\n\ _08004FBA:\n\ - ldr r0, [sp, #0x2C]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x2C]\n\ - ldr r4, [sp, #0x34]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r12\n\ - bcs _08005014\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, #0x7\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x2C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x2C]\n\ + ldr r4, [sp, #0x34]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r12\n\ + bcs _08005014\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, #0x7\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08004FDA:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _0800500C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, #0x7\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800500C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800500C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _08004FDA\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _08004FDA\n\ _08005014:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x30]\n\ - cmp r1, r2\n\ - bcc _08004FBA\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x30]\n\ + cmp r1, r2\n\ + bcc _08004FBA\n\ _0800501C:\n\ - mov r1, r8\n\ - ldr r3, =gUnknown_03002FB0\n\ - str r3, [sp, #0x38]\n\ - ldr r0, [sp, #0x84]\n\ - ldr r2, [sp, #0x7C]\n\ - add r0, r2\n\ - mov r8, r0\n\ - ldr r3, [sp, #0x78]\n\ - str r3, [sp, #0x3C]\n\ - ldr r0, [sp, #0x84]\n\ - str r0, [sp, #0x40]\n\ - cmp r1, r3\n\ - bcc _08005038\n\ - b _080052AA\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x38]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x78]\n\ + str r3, [sp, #0x3C]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x40]\n\ + cmp r1, r3\n\ + bcc _08005038\n\ + b _080052AA\n\ _08005038:\n\ - ldr r2, [sp, #0x38]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x38]\n\ - ldr r4, [sp, #0x40]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r8\n\ - bcs _08005096\n\ - mov r0, #0x7\n\ - mov r12, r0\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x38]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x38]\n\ + ldr r4, [sp, #0x40]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _08005096\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _0800505C:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800508E\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800508E\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800508E:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _0800505C\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800505C\n\ _08005096:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x3C]\n\ - cmp r1, r2\n\ - bcc _08005038\n\ - b _080052AA\n\ - .pool\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x3C]\n\ + cmp r1, r2\n\ + bcc _08005038\n\ + b _080052AA\n\ + .pool\n\ _080050A4:\n\ - mov r1, r8\n\ - str r5, [sp, #0x44]\n\ - ldr r3, [sp]\n\ - add r3, #0x8\n\ - mov r12, r3\n\ - mov r2, r8\n\ - add r2, #0x8\n\ - str r2, [sp, #0x48]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x4C]\n\ - str r2, [sp, #0x88]\n\ - sub r0, #0x8\n\ - str r0, [sp, #0x80]\n\ - mov r0, r12\n\ - str r0, [sp, #0x84]\n\ - sub r4, #0x8\n\ - str r4, [sp, #0x7C]\n\ - cmp r8, r2\n\ - bcs _0800512C\n\ + mov r1, r8\n\ + str r5, [sp, #0x44]\n\ + ldr r3, [sp]\n\ + add r3, #0x8\n\ + mov r12, r3\n\ + mov r2, r8\n\ + add r2, #0x8\n\ + str r2, [sp, #0x48]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x4C]\n\ + str r2, [sp, #0x88]\n\ + sub r0, #0x8\n\ + str r0, [sp, #0x80]\n\ + mov r0, r12\n\ + str r0, [sp, #0x84]\n\ + sub r4, #0x8\n\ + str r4, [sp, #0x7C]\n\ + cmp r8, r2\n\ + bcs _0800512C\n\ _080050CA:\n\ - ldr r2, [sp, #0x44]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x44]\n\ - ldr r4, [sp, #0x4C]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r12\n\ - bcs _08005124\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, #0x7\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x44]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x44]\n\ + ldr r4, [sp, #0x4C]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r12\n\ + bcs _08005124\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, #0x7\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _080050EA:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800511C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, #0x7\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800511C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, #0x7\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800511C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r12\n\ - bcc _080050EA\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r12\n\ + bcc _080050EA\n\ _08005124:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x48]\n\ - cmp r1, r2\n\ - bcc _080050CA\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x48]\n\ + cmp r1, r2\n\ + bcc _080050CA\n\ _0800512C:\n\ - mov r1, r8\n\ - ldr r3, =gUnknown_03002FB0\n\ - str r3, [sp, #0x50]\n\ - ldr r0, [sp, #0x84]\n\ - ldr r2, [sp, #0x7C]\n\ - add r0, r2\n\ - mov r8, r0\n\ - ldr r3, [sp, #0x88]\n\ - str r3, [sp, #0x54]\n\ - ldr r0, [sp, #0x84]\n\ - str r0, [sp, #0x58]\n\ - cmp r1, r3\n\ - bcs _080051AC\n\ + mov r1, r8\n\ + ldr r3, =gUnknown_03002FB0\n\ + str r3, [sp, #0x50]\n\ + ldr r0, [sp, #0x84]\n\ + ldr r2, [sp, #0x7C]\n\ + add r0, r2\n\ + mov r8, r0\n\ + ldr r3, [sp, #0x88]\n\ + str r3, [sp, #0x54]\n\ + ldr r0, [sp, #0x84]\n\ + str r0, [sp, #0x58]\n\ + cmp r1, r3\n\ + bcs _080051AC\n\ _08005146:\n\ - ldr r2, [sp, #0x50]\n\ - ldm r2!, {r5}\n\ - str r2, [sp, #0x50]\n\ - ldr r4, [sp, #0x58]\n\ - add r3, r1, #0x1\n\ - mov r10, r3\n\ - cmp r4, r8\n\ - bcs _080051A4\n\ - mov r0, #0x7\n\ - mov r12, r0\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r2, [sp, #0x50]\n\ + ldm r2!, {r5}\n\ + str r2, [sp, #0x50]\n\ + ldr r4, [sp, #0x58]\n\ + add r3, r1, #0x1\n\ + mov r10, r3\n\ + cmp r4, r8\n\ + bcs _080051A4\n\ + mov r0, #0x7\n\ + mov r12, r0\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _0800516A:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800519C\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800519C\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800519C:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _0800516A\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _0800516A\n\ _080051A4:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x54]\n\ - cmp r1, r2\n\ - bcc _08005146\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x54]\n\ + cmp r1, r2\n\ + bcc _08005146\n\ _080051AC:\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FD0\n\ - str r3, [sp, #0x5C]\n\ - ldr r0, [sp, #0x84]\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x60]\n\ - ldr r3, [sp]\n\ - str r3, [sp, #0x64]\n\ - cmp r1, r2\n\ - bcs _0800522A\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FD0\n\ + str r3, [sp, #0x5C]\n\ + ldr r0, [sp, #0x84]\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x60]\n\ + ldr r3, [sp]\n\ + str r3, [sp, #0x64]\n\ + cmp r1, r2\n\ + bcs _0800522A\n\ _080051C4:\n\ - ldr r0, [sp, #0x5C]\n\ - ldm r0!, {r5}\n\ - str r0, [sp, #0x5C]\n\ - ldr r4, [sp, #0x64]\n\ - add r2, r1, #0x1\n\ - mov r10, r2\n\ - cmp r4, r8\n\ - bcs _08005222\n\ - mov r3, #0x7\n\ - mov r12, r3\n\ - lsr r0, r1, #3\n\ - ldr r3, [sp, #0x4]\n\ - add r2, r0, #0\n\ - mul r2, r3\n\ - add r7, r2, #0\n\ - mov r0, r12\n\ - and r1, r0\n\ - lsl r6, r1, #2\n\ + ldr r0, [sp, #0x5C]\n\ + ldm r0!, {r5}\n\ + str r0, [sp, #0x5C]\n\ + ldr r4, [sp, #0x64]\n\ + add r2, r1, #0x1\n\ + mov r10, r2\n\ + cmp r4, r8\n\ + bcs _08005222\n\ + mov r3, #0x7\n\ + mov r12, r3\n\ + lsr r0, r1, #3\n\ + ldr r3, [sp, #0x4]\n\ + add r2, r0, #0\n\ + mul r2, r3\n\ + add r7, r2, #0\n\ + mov r0, r12\n\ + and r1, r0\n\ + lsl r6, r1, #2\n\ _080051E8:\n\ - add r3, r5, #0\n\ - mov r1, #0xF\n\ - and r3, r1\n\ - cmp r3, #0\n\ - beq _0800521A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r1, #0xF\n\ + and r3, r1\n\ + cmp r3, #0\n\ + beq _0800521A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800521A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _080051E8\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _080051E8\n\ _08005222:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x60]\n\ - cmp r1, r2\n\ - bcc _080051C4\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x60]\n\ + cmp r1, r2\n\ + bcc _080051C4\n\ _0800522A:\n\ - ldr r4, [sp, #0x84]\n\ - ldr r1, [sp, #0x88]\n\ - ldr r3, =gUnknown_03002FF0\n\ - str r3, [sp, #0x68]\n\ - ldr r0, [sp, #0x7C]\n\ - add r0, r4\n\ - mov r8, r0\n\ - ldr r2, [sp, #0x80]\n\ - add r2, r1, r2\n\ - str r2, [sp, #0x6C]\n\ - str r4, [sp, #0x70]\n\ - cmp r1, r2\n\ - bcs _080052AA\n\ + ldr r4, [sp, #0x84]\n\ + ldr r1, [sp, #0x88]\n\ + ldr r3, =gUnknown_03002FF0\n\ + str r3, [sp, #0x68]\n\ + ldr r0, [sp, #0x7C]\n\ + add r0, r4\n\ + mov r8, r0\n\ + ldr r2, [sp, #0x80]\n\ + add r2, r1, r2\n\ + str r2, [sp, #0x6C]\n\ + str r4, [sp, #0x70]\n\ + cmp r1, r2\n\ + bcs _080052AA\n\ _08005244:\n\ - ldr r3, [sp, #0x68]\n\ - ldm r3!, {r5}\n\ - str r3, [sp, #0x68]\n\ - ldr r4, [sp, #0x70]\n\ - add r0, r1, #0x1\n\ - mov r10, r0\n\ - cmp r4, r8\n\ - bcs _080052A2\n\ - mov r2, #0x7\n\ - mov r12, r2\n\ - lsr r0, r1, #3\n\ - ldr r2, [sp, #0x4]\n\ - add r3, r0, #0\n\ - mul r3, r2\n\ - add r7, r3, #0\n\ - mov r3, r12\n\ - and r1, r3\n\ - lsl r6, r1, #2\n\ + ldr r3, [sp, #0x68]\n\ + ldm r3!, {r5}\n\ + str r3, [sp, #0x68]\n\ + ldr r4, [sp, #0x70]\n\ + add r0, r1, #0x1\n\ + mov r10, r0\n\ + cmp r4, r8\n\ + bcs _080052A2\n\ + mov r2, #0x7\n\ + mov r12, r2\n\ + lsr r0, r1, #3\n\ + ldr r2, [sp, #0x4]\n\ + add r3, r0, #0\n\ + mul r3, r2\n\ + add r7, r3, #0\n\ + mov r3, r12\n\ + and r1, r3\n\ + lsl r6, r1, #2\n\ _08005268:\n\ - add r3, r5, #0\n\ - mov r0, #0xF\n\ - and r3, r0\n\ - cmp r3, #0\n\ - beq _0800529A\n\ - lsr r2, r4, #3\n\ - lsl r2, #5\n\ - add r2, r9\n\ - add r0, r4, #0\n\ - mov r1, r12\n\ - and r0, r1\n\ - lsr r0, #1\n\ - add r2, r0\n\ - add r2, r7\n\ - add r2, r6\n\ - mov r1, #0x1\n\ - and r1, r4\n\ - lsl r1, #2\n\ - lsl r3, r1\n\ - mov r0, #0xF0\n\ - asr r0, r1\n\ - ldrb r1, [r2]\n\ - and r0, r1\n\ - orr r3, r0\n\ - strb r3, [r2]\n\ + add r3, r5, #0\n\ + mov r0, #0xF\n\ + and r3, r0\n\ + cmp r3, #0\n\ + beq _0800529A\n\ + lsr r2, r4, #3\n\ + lsl r2, #5\n\ + add r2, r9\n\ + add r0, r4, #0\n\ + mov r1, r12\n\ + and r0, r1\n\ + lsr r0, #1\n\ + add r2, r0\n\ + add r2, r7\n\ + add r2, r6\n\ + mov r1, #0x1\n\ + and r1, r4\n\ + lsl r1, #2\n\ + lsl r3, r1\n\ + mov r0, #0xF0\n\ + asr r0, r1\n\ + ldrb r1, [r2]\n\ + and r0, r1\n\ + orr r3, r0\n\ + strb r3, [r2]\n\ _0800529A:\n\ - lsr r5, #4\n\ - add r4, #0x1\n\ - cmp r4, r8\n\ - bcc _08005268\n\ + lsr r5, #4\n\ + add r4, #0x1\n\ + cmp r4, r8\n\ + bcc _08005268\n\ _080052A2:\n\ - mov r1, r10\n\ - ldr r2, [sp, #0x6C]\n\ - cmp r1, r2\n\ - bcc _08005244\n\ + mov r1, r10\n\ + ldr r2, [sp, #0x6C]\n\ + cmp r1, r2\n\ + bcc _08005244\n\ _080052AA:\n\ - add sp, #0x8C\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool"); + add sp, #0x8C\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); } void ClearTextSpan(struct TextPrinter *textPrinter, u32 width) @@ -2046,733 +2051,1027 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c } } } +#ifdef NONMATCHING +u16 RenderText(struct TextPrinter *textPrinter) +{ + struct TextPrinterSubStruct *r4 = &textPrinter->sub_union.sub; + u16 currChar; + s32 width; -ASM_DIRECT -u16 RenderText(struct TextPrinter *textPrinter) // 80057B4 + switch (textPrinter->state) // _080057C4 + { + case 0: // _080057F0 + if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && r4->font_type_upper) + textPrinter->delayCounter = 0; + + if (textPrinter->delayCounter && textPrinter->text_speed) //_0800580A + { + textPrinter->delayCounter--; + if (gTextFlags.flag_0 && (gMain.newKeys & (A_BUTTON | B_BUTTON))) + { + r4->font_type_upper = 1; + textPrinter->delayCounter = 0; + } + return 3; + } + + if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.flag_2) + textPrinter->delayCounter = 3; + else + textPrinter->delayCounter = textPrinter->text_speed; + + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + + switch (currChar) //_0800588A + { + case 0xF8+6: //_080058B8 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY += (gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing); + return 2; + case 0xF8+5: //_080058DC + textPrinter->subPrinter.current_text_offset++; + return 2; + case 0xF8+4: //_080058E0 + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + switch (currChar) // _080058F0 + { + case 1: // _08005960 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 2: // _08005982 + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 3: // _080059A6 + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 4: // _080059C0 + textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + return 2; + case 5: // _08005A0E + textPrinter->subPrinter.current_text_offset++; + return 2; + case 6: //_08005A12 + r4->font_type = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 7: // _08005A0A + return 2; + case 8: // _08005A2A + textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + textPrinter->state = 6; + return 2; + case 9: // _08005A3A + textPrinter->state = 1; + if (gTextFlags.flag_2) + r4->frames_visible_counter = 0; + return 3; + case 10: // _08005A58 + textPrinter->state = 5; + return 3; + case 11: // _08005A5C + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + currChar |= *textPrinter->subPrinter.current_text_offset << 8; + textPrinter->subPrinter.current_text_offset++; + PlayBGM(currChar); + return 2; + case 16: // _08005A76 + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + currChar |= (*textPrinter->subPrinter.current_text_offset << 8); + textPrinter->subPrinter.current_text_offset++; + PlaySE(currChar); + return 2; + case 13: // _08005A90 + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 14: // _08005A98 + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 15: // _08005AA4 + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | textPrinter->subPrinter.bgColor << 4); + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + return 2; + case 23: // _08005ABE + m4aMPlayStop(&gMPlayInfo_BGM); + return 2; + case 24: // _08005ACC + m4aMPlayContinue(&gMPlayInfo_BGM); + return 2; + case 17: // _08005AD8 + width = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + return 0; + } + return 2; + case 18: // _08005AF2 + textPrinter->subPrinter.currentX = *textPrinter->subPrinter.current_text_offset + textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + return 2; + case 19: // _08005B02 + { + s32 widthHelper = *textPrinter->subPrinter.current_text_offset; + widthHelper += textPrinter->subPrinter.x; + textPrinter->subPrinter.current_text_offset++; + width = widthHelper - textPrinter->subPrinter.currentX; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + return 0; + } + } + return 2; + case 20: // _08005B26 + textPrinter->minLetterSpacing = *textPrinter->subPrinter.current_text_offset++; + return 2; + case 21: // _08005B36 + textPrinter->japanese = 1; + return 2; + case 22: // _08005B3E + textPrinter->japanese = 0; + return 2; + case 12: // _08005B5A + currChar = *textPrinter->subPrinter.current_text_offset | 0x100; + textPrinter->subPrinter.current_text_offset++; + break; + } + break; + + case 0xF8+3: // _08005B48 + textPrinter->state = 2; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+2: // _08005B4C + textPrinter->state = 3; + TextPrinterInitDownArrowCounters(textPrinter); + return 3; + case 0xF8+1: // _08005B5A + currChar = *textPrinter->subPrinter.current_text_offset | 0x100; + textPrinter->subPrinter.current_text_offset++; + break; + case 0xF8+0: // _08005B6C + currChar = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.current_text_offset++; + gUnknown_03002F90[0x80] = DrawKeypadIcon(textPrinter->subPrinter.windowId, currChar, textPrinter->subPrinter.currentX, textPrinter->subPrinter.currentY); + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing; + return 0; + case 0xF8+7: // _08005D6C + return 1; + } + + switch (r4->font_type) // _08005B90 + { + case 0: // _08005BCC + DecompressGlyphFont0(currChar, textPrinter->japanese); + break; + case 1: // _08005BDA + DecompressGlyphFont1(currChar, textPrinter->japanese); + break; + case 2: + case 3: + case 4: + case 5: // _08005BE8 + DecompressGlyphFont2(currChar, textPrinter->japanese); + break; + case 7: // _08005BF6 + DecompressGlyphFont7(currChar, textPrinter->japanese); + break; + case 8: // _08005C04 + DecompressGlyphFont8(currChar, textPrinter->japanese); + break; + case 6: // _08005C10 + break; + } + + CopyGlyphToWindow(textPrinter); // _08005C10 + + if (textPrinter->minLetterSpacing) + { + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + width = textPrinter->minLetterSpacing - gUnknown_03002F90[0x80]; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->subPrinter.currentX += width; + } + } + else // _08005C48 + { + if (textPrinter->japanese) + textPrinter->subPrinter.currentX += (gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing); + else + textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80]; + } + return 0; + case 1: // _08005C78 + if (TextPrinterWait(textPrinter)) + textPrinter->state = 0; + return 3; + case 2: // _08005C8C + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + FillWindowPixelBuffer(textPrinter->subPrinter.windowId, (textPrinter->subPrinter.bgColor << 4) | textPrinter->subPrinter.bgColor); + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + textPrinter->state = 0; + } + return 3; + case 3: // _08005CB8 + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + TextPrinterClearDownArrow(textPrinter); + textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; + textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->state = 4; + } + return 3; + case 4: // _08005CF0 + if (textPrinter->scrollDistance) + { + int scrollSpeed = sub_8197964(); + int speed = gWindowVerticalScrollSpeeds[scrollSpeed]; + if (textPrinter->scrollDistance < speed) + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance = 0; + } + else + { + ScrollWindow(textPrinter->subPrinter.windowId, 0, speed, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor); + textPrinter->scrollDistance -= speed; + } + CopyWindowToVram(textPrinter->subPrinter.windowId, 2); + } + else + { + textPrinter->state = 0; + } + return 3; + case 5: // _08005D48 + if (!IsSEPlaying()) + textPrinter->state = 0; + return 3; + case 6: // _08005D5A + if (textPrinter->delayCounter != 0) + textPrinter->delayCounter--; + else + textPrinter->state = 0; + return 3; + } + + return 1; +} +#else +__attribute__((naked)) +u16 RenderText(struct TextPrinter *textPrinter) { asm("push {r4-r6,lr}\n\ - add r6, r0, #0\n\ - add r4, r6, #0\n\ - add r4, #0x14\n\ - ldrb r0, [r6, #0x1C]\n\ - cmp r0, #0x6\n\ - bls _080057C4\n\ - b _08005D6C\n\ + add r6, r0, #0\n\ + add r4, r6, #0\n\ + add r4, #0x14\n\ + ldrb r0, [r6, #0x1C]\n\ + cmp r0, #0x6\n\ + bls _080057C4\n\ + b _08005D6C\n\ _080057C4:\n\ - lsl r0, #2\n\ - ldr r1, =_080057D4\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_080057D4\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _080057D4:\n\ - .4byte _080057F0\n\ - .4byte _08005C78\n\ - .4byte _08005C8C\n\ - .4byte _08005CB8\n\ - .4byte _08005CF0\n\ - .4byte _08005D48\n\ - .4byte _08005D5A\n\ + .4byte _080057F0\n\ + .4byte _08005C78\n\ + .4byte _08005C8C\n\ + .4byte _08005CB8\n\ + .4byte _08005CF0\n\ + .4byte _08005D48\n\ + .4byte _08005D5A\n\ _080057F0:\n\ - ldr r2, =gMain\n\ - ldrh r1, [r2, #0x2C]\n\ - mov r0, #0x3\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _0800580A\n\ - ldrb r1, [r4]\n\ - mov r0, #0x10\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _0800580A\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1E]\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, #0x2C]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + ldrb r1, [r4]\n\ + mov r0, #0x10\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _0800580A\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ _0800580A:\n\ - ldrb r1, [r6, #0x1E]\n\ - cmp r1, #0\n\ - beq _0800584C\n\ - ldrb r0, [r6, #0x1D]\n\ - cmp r0, #0\n\ - beq _0800584C\n\ - sub r0, r1, #0x1\n\ - strb r0, [r6, #0x1E]\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x1\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005828\n\ - b _08005B56\n\ + ldrb r1, [r6, #0x1E]\n\ + cmp r1, #0\n\ + beq _0800584C\n\ + ldrb r0, [r6, #0x1D]\n\ + cmp r0, #0\n\ + beq _0800584C\n\ + sub r0, r1, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x1\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005828\n\ + b _08005B56\n\ _08005828:\n\ - ldrh r1, [r2, #0x2E]\n\ - mov r0, #0x3\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005834\n\ - b _08005B56\n\ + ldrh r1, [r2, #0x2E]\n\ + mov r0, #0x3\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005834\n\ + b _08005B56\n\ _08005834:\n\ - ldrb r0, [r4]\n\ - mov r1, #0x10\n\ - orr r0, r1\n\ - strb r0, [r4]\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1E]\n\ - b _08005B56\n\ - .pool\n\ + ldrb r0, [r4]\n\ + mov r1, #0x10\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ + .pool\n\ _0800584C:\n\ - ldr r0, =gBattleTypeFlags\n\ - ldr r0, [r0]\n\ - mov r1, #0x80\n\ - lsl r1, #17\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005874\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x4\n\ - and r0, r1\n\ - cmp r0, #0\n\ - beq _08005874\n\ - mov r0, #0x3\n\ - b _08005876\n\ - .pool\n\ + ldr r0, =gBattleTypeFlags\n\ + ldr r0, [r0]\n\ + mov r1, #0x80\n\ + lsl r1, #17\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005874\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + beq _08005874\n\ + mov r0, #0x3\n\ + b _08005876\n\ + .pool\n\ _08005874:\n\ - ldrb r0, [r6, #0x1D]\n\ + ldrb r0, [r6, #0x1D]\n\ _08005876:\n\ - strb r0, [r6, #0x1E]\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - add r0, r3, #0\n\ - sub r0, #0xF8\n\ - cmp r0, #0x7\n\ - bls _0800588A\n\ - b _08005B90\n\ + strb r0, [r6, #0x1E]\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + add r0, r3, #0\n\ + sub r0, #0xF8\n\ + cmp r0, #0x7\n\ + bls _0800588A\n\ + b _08005B90\n\ _0800588A:\n\ - lsl r0, #2\n\ - ldr r1, =_08005898\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_08005898\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005898:\n\ - .4byte _08005B6C\n\ - .4byte _08005B5A\n\ - .4byte _08005B4C\n\ - .4byte _08005B48\n\ - .4byte _080058E0\n\ - .4byte _080058DC\n\ - .4byte _080058B8\n\ - .4byte _08005D6C\n\ + .4byte _08005B6C\n\ + .4byte _08005B5A\n\ + .4byte _08005B4C\n\ + .4byte _08005B48\n\ + .4byte _080058E0\n\ + .4byte _080058DC\n\ + .4byte _080058B8\n\ + .4byte _08005D6C\n\ _080058B8:\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - ldrb r1, [r6, #0x5]\n\ - ldr r0, =gFonts\n\ - ldr r2, [r0]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - add r0, r2\n\ - ldrb r1, [r6, #0xB]\n\ - ldrb r0, [r0, #0x5]\n\ - add r1, r0\n\ - ldrb r0, [r6, #0x9]\n\ - add r0, r1\n\ - b _08005ABA\n\ - .pool\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x9]\n\ + add r0, r1\n\ + b _08005ABA\n\ + .pool\n\ _080058DC:\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _080058E0:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - sub r0, r3, #0x1\n\ - cmp r0, #0x17\n\ - bls _080058F0\n\ - b _08005B90\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + sub r0, r3, #0x1\n\ + cmp r0, #0x17\n\ + bls _080058F0\n\ + b _08005B90\n\ _080058F0:\n\ - lsl r0, #2\n\ - ldr r1, =_08005900\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + lsl r0, #2\n\ + ldr r1, =_08005900\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005900:\n\ - .4byte _08005960\n\ - .4byte _08005982\n\ - .4byte _080059A6\n\ - .4byte _080059C0\n\ - .4byte _08005A0E\n\ - .4byte _08005A12\n\ - .4byte _08005A0A\n\ - .4byte _08005A2A\n\ - .4byte _08005A3A\n\ - .4byte _08005A58\n\ - .4byte _08005A5C\n\ - .4byte _08005B5A\n\ - .4byte _08005A90\n\ - .4byte _08005A98\n\ - .4byte _08005AA4\n\ - .4byte _08005A76\n\ - .4byte _08005AD8\n\ - .4byte _08005AF2\n\ - .4byte _08005B02\n\ - .4byte _08005B26\n\ - .4byte _08005B36\n\ - .4byte _08005B3E\n\ - .4byte _08005ABE\n\ - .4byte _08005ACC\n\ + .4byte _08005960 @0\n\ + .4byte _08005982 @1\n\ + .4byte _080059A6 @2\n\ + .4byte _080059C0 @3\n\ + .4byte _08005A0E @4\n\ + .4byte _08005A12 @5\n\ + .4byte _08005A0A @6\n\ + .4byte _08005A2A @7\n\ + .4byte _08005A3A @8\n\ + .4byte _08005A58 @9\n\ + .4byte _08005A5C @10\n\ + .4byte _08005B5A @11\n\ + .4byte _08005A90 @12\n\ + .4byte _08005A98 @13\n\ + .4byte _08005AA4 @14\n\ + .4byte _08005A76 @15\n\ + .4byte _08005AD8 @16\n\ + .4byte _08005AF2 @17\n\ + .4byte _08005B02 @18\n\ + .4byte _08005B26 @19\n\ + .4byte _08005B36 @20\n\ + .4byte _08005B3E @21\n\ + .4byte _08005ABE @22\n\ + .4byte _08005ACC @23\n\ _08005960:\n\ - ldr r2, [r6]\n\ - ldrb r1, [r2]\n\ - lsl r1, #4\n\ - ldrb r3, [r6, #0xC]\n\ - mov r0, #0xF\n\ - and r0, r3\n\ - orr r0, r1\n\ - strb r0, [r6, #0xC]\n\ - add r2, #0x1\n\ - str r2, [r6]\n\ - lsl r0, #24\n\ - lsr r0, #28\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsr r2, #4\n\ - b _08005A06\n\ + ldr r2, [r6]\n\ + ldrb r1, [r2]\n\ + lsl r1, #4\n\ + ldrb r3, [r6, #0xC]\n\ + mov r0, #0xF\n\ + and r0, r3\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r2, #0x1\n\ + str r2, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ _08005982:\n\ - ldr r1, [r6]\n\ - ldrb r2, [r1]\n\ - mov r0, #0xF\n\ - and r0, r2\n\ - ldrb r3, [r6, #0xD]\n\ - mov r2, #0x10\n\ - neg r2, r2\n\ - and r2, r3\n\ - orr r2, r0\n\ - strb r2, [r6, #0xD]\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, #0xC]\n\ - lsr r0, #4\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsr r2, #4\n\ - b _08005A06\n\ + ldr r1, [r6]\n\ + ldrb r2, [r1]\n\ + mov r0, #0xF\n\ + and r0, r2\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0x10\n\ + neg r2, r2\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsr r2, #4\n\ + b _08005A06\n\ _080059A6:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - lsl r0, #4\n\ - ldrb r3, [r6, #0xD]\n\ - mov r2, #0xF\n\ - and r2, r3\n\ - orr r2, r0\n\ - strb r2, [r6, #0xD]\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, #0xC]\n\ - lsr r0, #4\n\ - b _080059FE\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + lsl r0, #4\n\ + ldrb r3, [r6, #0xD]\n\ + mov r2, #0xF\n\ + and r2, r3\n\ + orr r2, r0\n\ + strb r2, [r6, #0xD]\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r6, #0xC]\n\ + lsr r0, #4\n\ + b _080059FE\n\ _080059C0:\n\ - ldr r3, [r6]\n\ - ldrb r1, [r3]\n\ - lsl r1, #4\n\ - ldrb r4, [r6, #0xC]\n\ - mov r2, #0xF\n\ - add r0, r2, #0\n\ - and r0, r4\n\ - orr r0, r1\n\ - strb r0, [r6, #0xC]\n\ - add r5, r3, #0x1\n\ - str r5, [r6]\n\ - ldrb r3, [r3, #0x1]\n\ - add r1, r2, #0\n\ - and r1, r3\n\ - ldrb r4, [r6, #0xD]\n\ - mov r3, #0x10\n\ - neg r3, r3\n\ - and r3, r4\n\ - orr r3, r1\n\ - strb r3, [r6, #0xD]\n\ - add r4, r5, #0x1\n\ - str r4, [r6]\n\ - ldrb r1, [r5, #0x1]\n\ - lsl r1, #4\n\ - and r2, r3\n\ - orr r2, r1\n\ - strb r2, [r6, #0xD]\n\ - add r4, #0x1\n\ - str r4, [r6]\n\ - lsl r0, #24\n\ - lsr r0, #28\n\ + ldr r3, [r6]\n\ + ldrb r1, [r3]\n\ + lsl r1, #4\n\ + ldrb r4, [r6, #0xC]\n\ + mov r2, #0xF\n\ + add r0, r2, #0\n\ + and r0, r4\n\ + orr r0, r1\n\ + strb r0, [r6, #0xC]\n\ + add r5, r3, #0x1\n\ + str r5, [r6]\n\ + ldrb r3, [r3, #0x1]\n\ + add r1, r2, #0\n\ + and r1, r3\n\ + ldrb r4, [r6, #0xD]\n\ + mov r3, #0x10\n\ + neg r3, r3\n\ + and r3, r4\n\ + orr r3, r1\n\ + strb r3, [r6, #0xD]\n\ + add r4, r5, #0x1\n\ + str r4, [r6]\n\ + ldrb r1, [r5, #0x1]\n\ + lsl r1, #4\n\ + and r2, r3\n\ + orr r2, r1\n\ + strb r2, [r6, #0xD]\n\ + add r4, #0x1\n\ + str r4, [r6]\n\ + lsl r0, #24\n\ + lsr r0, #28\n\ _080059FE:\n\ - lsl r1, r2, #28\n\ - lsr r1, #28\n\ - lsl r2, #24\n\ - lsr r2, #28\n\ + lsl r1, r2, #28\n\ + lsr r1, #28\n\ + lsl r2, #24\n\ + lsr r2, #28\n\ _08005A06:\n\ - bl GenerateFontHalfRowLookupTable\n\ + bl GenerateFontHalfRowLookupTable\n\ _08005A0A:\n\ - mov r0, #0x2\n\ - b _08005D6E\n\ + mov r0, #0x2\n\ + b _08005D6E\n\ _08005A0E:\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _08005A12:\n\ - ldr r0, [r6]\n\ - ldrb r0, [r0]\n\ - mov r1, #0xF\n\ - and r1, r0\n\ - ldrb r2, [r4]\n\ - mov r0, #0x10\n\ - neg r0, r0\n\ - and r0, r2\n\ - orr r0, r1\n\ - strb r0, [r4]\n\ - ldr r0, [r6]\n\ - b _08005B30\n\ + ldr r0, [r6]\n\ + ldrb r0, [r0]\n\ + mov r1, #0xF\n\ + and r1, r0\n\ + ldrb r2, [r4]\n\ + mov r0, #0x10\n\ + neg r0, r0\n\ + and r0, r2\n\ + orr r0, r1\n\ + strb r0, [r4]\n\ + ldr r0, [r6]\n\ + b _08005B30\n\ _08005A2A:\n\ - ldr r0, [r6]\n\ - ldrb r1, [r0]\n\ - strb r1, [r6, #0x1E]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - mov r0, #0x6\n\ - strb r0, [r6, #0x1C]\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r1, [r0]\n\ + strb r1, [r6, #0x1E]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + mov r0, #0x6\n\ + strb r0, [r6, #0x1C]\n\ + b _08005A0A\n\ _08005A3A:\n\ - mov r0, #0x1\n\ - strb r0, [r6, #0x1C]\n\ - ldr r0, =gTextFlags\n\ - ldrb r1, [r0]\n\ - mov r0, #0x4\n\ - and r0, r1\n\ - cmp r0, #0\n\ - bne _08005A4C\n\ - b _08005B56\n\ + mov r0, #0x1\n\ + strb r0, [r6, #0x1C]\n\ + ldr r0, =gTextFlags\n\ + ldrb r1, [r0]\n\ + mov r0, #0x4\n\ + and r0, r1\n\ + cmp r0, #0\n\ + bne _08005A4C\n\ + b _08005B56\n\ _08005A4C:\n\ - mov r0, #0\n\ - strb r0, [r4, #0x2]\n\ - b _08005B56\n\ - .pool\n\ + mov r0, #0\n\ + strb r0, [r4, #0x2]\n\ + b _08005B56\n\ + .pool\n\ _08005A58:\n\ - mov r0, #0x5\n\ - b _08005D56\n\ + mov r0, #0x5\n\ + b _08005D56\n\ _08005A5C:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r1, r0, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, #0x1]\n\ - lsl r0, #8\n\ - orr r3, r0\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - add r0, r3, #0\n\ - bl PlayBGM\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl PlayBGM\n\ + b _08005A0A\n\ _08005A76:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r1, r0, #0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, #0x1]\n\ - lsl r0, #8\n\ - orr r3, r0\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - add r0, r3, #0\n\ - bl PlaySE\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r1, r0, #0x1\n\ + str r1, [r6]\n\ + ldrb r0, [r0, #0x1]\n\ + lsl r0, #8\n\ + orr r3, r0\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + add r0, r3, #0\n\ + bl PlaySE\n\ + b _08005A0A\n\ _08005A90:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, #0x6]\n\ - b _08005AF8\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x6]\n\ + b _08005AF8\n\ _08005A98:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r2, [r6, #0x7]\n\ - add r0, r2\n\ - strb r0, [r6, #0x9]\n\ - b _08005AFC\n\ + ldr r1, [r6]\n\ + ldrb r0, [r1]\n\ + ldrb r2, [r6, #0x7]\n\ + add r0, r2\n\ + strb r0, [r6, #0x9]\n\ + b _08005AFC\n\ _08005AA4:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r2, #28\n\ - lsr r1, r2, #4\n\ - orr r1, r2\n\ - lsr r1, #24\n\ - bl FillWindowPixelBuffer\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - ldrb r0, [r6, #0x7]\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ _08005ABA:\n\ - strb r0, [r6, #0x9]\n\ - b _08005A0A\n\ + strb r0, [r6, #0x9]\n\ + b _08005A0A\n\ _08005ABE:\n\ - ldr r0, =gMPlayInfo_BGM\n\ - bl m4aMPlayStop\n\ - b _08005A0A\n\ - .pool\n\ + ldr r0, =gMPlayInfo_BGM\n\ + bl m4aMPlayStop\n\ + b _08005A0A\n\ + .pool\n\ _08005ACC:\n\ - ldr r0, =gMPlayInfo_BGM\n\ - bl m4aMPlayContinue\n\ - b _08005A0A\n\ - .pool\n\ + ldr r0, =gMPlayInfo_BGM\n\ + bl m4aMPlayContinue\n\ + b _08005A0A\n\ + .pool\n\ _08005AD8:\n\ - ldr r0, [r6]\n\ - ldrb r4, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - cmp r4, #0\n\ - ble _08005A0A\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ + ldr r0, [r6]\n\ + ldrb r4, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + cmp r4, #0\n\ + ble _08005A0A\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ _08005AF2:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r6, #0x6]\n\ - ldrb r3, [r1]\n\ + ldr r1, [r6]\n\ + ldrb r0, [r6, #0x6]\n\ + ldrb r3, [r1]\n\ _08005AF8:\n\ - add r0, r3\n\ - strb r0, [r6, #0x8]\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ _08005AFC:\n\ - add r1, #0x1\n\ - str r1, [r6]\n\ - b _08005A0A\n\ + add r1, #0x1\n\ + str r1, [r6]\n\ + b _08005A0A\n\ _08005B02:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - ldrb r1, [r6, #0x6]\n\ - add r2, r1\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, #0x8]\n\ - sub r4, r2, r0\n\ - cmp r4, #0\n\ - bgt _08005B18\n\ - b _08005A0A\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + ldrb r1, [r6, #0x6]\n\ + add r2, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x8]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + bgt _08005B18\n\ + b _08005A0A\n\ _08005B18:\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ _08005B26:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - add r1, r6, #0\n\ - add r1, #0x20\n\ - strb r2, [r1]\n\ + ldr r0, [r6]\n\ + ldrb r2, [r0]\n\ + add r1, r6, #0\n\ + add r1, #0x20\n\ + strb r2, [r1]\n\ _08005B30:\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - b _08005A0A\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005A0A\n\ _08005B36:\n\ - add r1, r6, #0\n\ - add r1, #0x21\n\ - mov r0, #0x1\n\ - b _08005B44\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0x1\n\ + b _08005B44\n\ _08005B3E:\n\ - add r1, r6, #0\n\ - add r1, #0x21\n\ - mov r0, #0\n\ + add r1, r6, #0\n\ + add r1, #0x21\n\ + mov r0, #0\n\ _08005B44:\n\ - strb r0, [r1]\n\ - b _08005A0A\n\ + strb r0, [r1]\n\ + b _08005A0A\n\ _08005B48:\n\ - mov r0, #0x2\n\ - b _08005B4E\n\ + mov r0, #0x2\n\ + b _08005B4E\n\ _08005B4C:\n\ - mov r0, #0x3\n\ + mov r0, #0x3\n\ _08005B4E:\n\ - strb r0, [r6, #0x1C]\n\ - add r0, r6, #0\n\ - bl TextPrinterInitDownArrowCounters\n\ + strb r0, [r6, #0x1C]\n\ + add r0, r6, #0\n\ + bl TextPrinterInitDownArrowCounters\n\ _08005B56:\n\ - mov r0, #0x3\n\ - b _08005D6E\n\ + mov r0, #0x3\n\ + b _08005D6E\n\ _08005B5A:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - mov r2, #0x80\n\ - lsl r2, #1\n\ - add r1, r2, #0\n\ - orr r3, r1\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - b _08005B90\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + mov r2, #0x80\n\ + lsl r2, #1\n\ + add r1, r2, #0\n\ + orr r3, r1\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + b _08005B90\n\ _08005B6C:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - add r0, #0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, #0x4]\n\ - add r1, r3, #0\n\ - ldrb r2, [r6, #0x8]\n\ - ldrb r3, [r6, #0x9]\n\ - bl DrawKeypadIcon\n\ - ldr r1, =gUnknown_03002F90\n\ - add r1, #0x80\n\ - strb r0, [r1]\n\ - ldrb r3, [r6, #0xA]\n\ - add r0, r3\n\ - b _08005C6A\n\ - .pool\n\ + ldr r0, [r6]\n\ + ldrb r3, [r0]\n\ + add r0, #0x1\n\ + str r0, [r6]\n\ + ldrb r0, [r6, #0x4]\n\ + add r1, r3, #0\n\ + ldrb r2, [r6, #0x8]\n\ + ldrb r3, [r6, #0x9]\n\ + bl DrawKeypadIcon\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + strb r0, [r1]\n\ + ldrb r3, [r6, #0xA]\n\ + add r0, r3\n\ + b _08005C6A\n\ + .pool\n\ _08005B90:\n\ - ldr r0, [r4]\n\ - lsl r0, #28\n\ - lsr r0, #28\n\ - cmp r0, #0x8\n\ - bhi _08005C10\n\ - lsl r0, #2\n\ - ldr r1, =_08005BA8\n\ - add r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .pool\n\ - .align 2, 0\n\ + ldr r0, [r4]\n\ + lsl r0, #28\n\ + lsr r0, #28\n\ + cmp r0, #0x8\n\ + bhi _08005C10\n\ + lsl r0, #2\n\ + ldr r1, =_08005BA8\n\ + add r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ _08005BA8:\n\ - .4byte _08005BCC\n\ - .4byte _08005BDA\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005BE8\n\ - .4byte _08005C10\n\ - .4byte _08005BF6\n\ - .4byte _08005C04\n\ + .4byte _08005BCC\n\ + .4byte _08005BDA\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005BE8\n\ + .4byte _08005C10\n\ + .4byte _08005BF6\n\ + .4byte _08005C04\n\ _08005BCC:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont0\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont0\n\ + b _08005C10\n\ _08005BDA:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont1\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont1\n\ + b _08005C10\n\ _08005BE8:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont2\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont2\n\ + b _08005C10\n\ _08005BF6:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont7\n\ - b _08005C10\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont7\n\ + b _08005C10\n\ _08005C04:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r1, [r0]\n\ - add r0, r3, #0\n\ - bl DecompressGlyphFont8\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r1, [r0]\n\ + add r0, r3, #0\n\ + bl DecompressGlyphFont8\n\ _08005C10:\n\ - add r0, r6, #0\n\ - bl CopyGlyphToWindow\n\ - add r2, r6, #0\n\ - add r2, #0x20\n\ - ldrb r0, [r2]\n\ - cmp r0, #0\n\ - beq _08005C48\n\ - ldr r1, =gUnknown_03002F90\n\ - add r1, #0x80\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, #0x8]\n\ - add r0, r3\n\ - strb r0, [r6, #0x8]\n\ - ldrb r2, [r2]\n\ - ldrb r0, [r1]\n\ - sub r4, r2, r0\n\ - cmp r4, #0\n\ - ble _08005C70\n\ - add r0, r6, #0\n\ - add r1, r4, #0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, #0x8]\n\ - add r0, r4\n\ - b _08005C6E\n\ - .pool\n\ + add r0, r6, #0\n\ + bl CopyGlyphToWindow\n\ + add r2, r6, #0\n\ + add r2, #0x20\n\ + ldrb r0, [r2]\n\ + cmp r0, #0\n\ + beq _08005C48\n\ + ldr r1, =gUnknown_03002F90\n\ + add r1, #0x80\n\ + ldrb r0, [r1]\n\ + ldrb r3, [r6, #0x8]\n\ + add r0, r3\n\ + strb r0, [r6, #0x8]\n\ + ldrb r2, [r2]\n\ + ldrb r0, [r1]\n\ + sub r4, r2, r0\n\ + cmp r4, #0\n\ + ble _08005C70\n\ + add r0, r6, #0\n\ + add r1, r4, #0\n\ + bl ClearTextSpan\n\ + ldrb r0, [r6, #0x8]\n\ + add r0, r4\n\ + b _08005C6E\n\ + .pool\n\ _08005C48:\n\ - add r0, r6, #0\n\ - add r0, #0x21\n\ - ldrb r0, [r0]\n\ - cmp r0, #0\n\ - beq _08005C64\n\ - ldr r0, =gUnknown_03002F90\n\ - add r0, #0x80\n\ - ldrb r1, [r6, #0xA]\n\ - ldrb r0, [r0]\n\ - add r1, r0\n\ - ldrb r0, [r6, #0x8]\n\ - b _08005C6C\n\ - .pool\n\ + add r0, r6, #0\n\ + add r0, #0x21\n\ + ldrb r0, [r0]\n\ + cmp r0, #0\n\ + beq _08005C64\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r1, [r6, #0xA]\n\ + ldrb r0, [r0]\n\ + add r1, r0\n\ + ldrb r0, [r6, #0x8]\n\ + b _08005C6C\n\ + .pool\n\ _08005C64:\n\ - ldr r0, =gUnknown_03002F90\n\ - add r0, #0x80\n\ - ldrb r0, [r0]\n\ + ldr r0, =gUnknown_03002F90\n\ + add r0, #0x80\n\ + ldrb r0, [r0]\n\ _08005C6A:\n\ - ldrb r1, [r6, #0x8]\n\ + ldrb r1, [r6, #0x8]\n\ _08005C6C:\n\ - add r0, r1\n\ + add r0, r1\n\ _08005C6E:\n\ - strb r0, [r6, #0x8]\n\ + strb r0, [r6, #0x8]\n\ _08005C70:\n\ - mov r0, #0\n\ - b _08005D6E\n\ - .pool\n\ + mov r0, #0\n\ + b _08005D6E\n\ + .pool\n\ _08005C78:\n\ - add r0, r6, #0\n\ - bl TextPrinterWait\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005C86\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWait\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C86\n\ + b _08005B56\n\ _08005C86:\n\ - mov r0, #0\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + mov r0, #0\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005C8C:\n\ - add r0, r6, #0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005C9A\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005C9A\n\ + b _08005B56\n\ _08005C9A:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r2, [r6, #0xD]\n\ - lsl r2, #28\n\ - lsr r1, r2, #4\n\ - orr r1, r2\n\ - lsr r1, #24\n\ - bl FillWindowPixelBuffer\n\ - ldrb r0, [r6, #0x6]\n\ - mov r1, #0\n\ - strb r0, [r6, #0x8]\n\ - ldrb r0, [r6, #0x7]\n\ - strb r0, [r6, #0x9]\n\ - strb r1, [r6, #0x1C]\n\ - b _08005B56\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r2, [r6, #0xD]\n\ + lsl r2, #28\n\ + lsr r1, r2, #4\n\ + orr r1, r2\n\ + lsr r1, #24\n\ + bl FillWindowPixelBuffer\n\ + ldrb r0, [r6, #0x6]\n\ + mov r1, #0\n\ + strb r0, [r6, #0x8]\n\ + ldrb r0, [r6, #0x7]\n\ + strb r0, [r6, #0x9]\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ _08005CB8:\n\ - add r0, r6, #0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsl r0, #16\n\ - cmp r0, #0\n\ - bne _08005CC6\n\ - b _08005B56\n\ + add r0, r6, #0\n\ + bl TextPrinterWaitWithDownArrow\n\ + lsl r0, #16\n\ + cmp r0, #0\n\ + bne _08005CC6\n\ + b _08005B56\n\ _08005CC6:\n\ - add r0, r6, #0\n\ - bl TextPrinterClearDownArrow\n\ - ldrb r1, [r6, #0x5]\n\ - ldr r0, =gFonts\n\ - ldr r2, [r0]\n\ - lsl r0, r1, #1\n\ - add r0, r1\n\ - lsl r0, #2\n\ - add r0, r2\n\ - ldrb r1, [r6, #0xB]\n\ - ldrb r0, [r0, #0x5]\n\ - add r1, r0\n\ - strb r1, [r6, #0x1F]\n\ - ldrb r0, [r6, #0x6]\n\ - strb r0, [r6, #0x8]\n\ - mov r0, #0x4\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ - .pool\n\ + add r0, r6, #0\n\ + bl TextPrinterClearDownArrow\n\ + ldrb r1, [r6, #0x5]\n\ + ldr r0, =gFonts\n\ + ldr r2, [r0]\n\ + lsl r0, r1, #1\n\ + add r0, r1\n\ + lsl r0, #2\n\ + add r0, r2\n\ + ldrb r1, [r6, #0xB]\n\ + ldrb r0, [r0, #0x5]\n\ + add r1, r0\n\ + strb r1, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x6]\n\ + strb r0, [r6, #0x8]\n\ + mov r0, #0x4\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ + .pool\n\ _08005CF0:\n\ - ldrb r0, [r6, #0x1F]\n\ - cmp r0, #0\n\ - beq _08005D44\n\ - bl sub_8197964\n\ - ldr r1, =gWindowVerticalScrollSpeeds\n\ - add r0, r1\n\ - ldrb r4, [r0]\n\ - ldrb r2, [r6, #0x1F]\n\ - cmp r2, r4\n\ - bge _08005D20\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r1, [r6, #0xD]\n\ - lsl r1, #28\n\ - lsr r3, r1, #4\n\ - orr r3, r1\n\ - lsr r3, #24\n\ - mov r1, #0\n\ - bl ScrollWindow\n\ - mov r0, #0\n\ - b _08005D38\n\ - .pool\n\ + ldrb r0, [r6, #0x1F]\n\ + cmp r0, #0\n\ + beq _08005D44\n\ + bl sub_8197964\n\ + ldr r1, =gWindowVerticalScrollSpeeds\n\ + add r0, r1\n\ + ldrb r4, [r0]\n\ + ldrb r2, [r6, #0x1F]\n\ + cmp r2, r4\n\ + bge _08005D20\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + bl ScrollWindow\n\ + mov r0, #0\n\ + b _08005D38\n\ + .pool\n\ _08005D20:\n\ - ldrb r0, [r6, #0x4]\n\ - ldrb r1, [r6, #0xD]\n\ - lsl r1, #28\n\ - lsr r3, r1, #4\n\ - orr r3, r1\n\ - lsr r3, #24\n\ - mov r1, #0\n\ - add r2, r4, #0\n\ - bl ScrollWindow\n\ - ldrb r0, [r6, #0x1F]\n\ - sub r0, r4\n\ + ldrb r0, [r6, #0x4]\n\ + ldrb r1, [r6, #0xD]\n\ + lsl r1, #28\n\ + lsr r3, r1, #4\n\ + orr r3, r1\n\ + lsr r3, #24\n\ + mov r1, #0\n\ + add r2, r4, #0\n\ + bl ScrollWindow\n\ + ldrb r0, [r6, #0x1F]\n\ + sub r0, r4\n\ _08005D38:\n\ - strb r0, [r6, #0x1F]\n\ - ldrb r0, [r6, #0x4]\n\ - mov r1, #0x2\n\ - bl CopyWindowToVram\n\ - b _08005B56\n\ + strb r0, [r6, #0x1F]\n\ + ldrb r0, [r6, #0x4]\n\ + mov r1, #0x2\n\ + bl CopyWindowToVram\n\ + b _08005B56\n\ _08005D44:\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D48:\n\ - bl IsSEPlaying\n\ - lsl r0, #24\n\ - lsr r0, #24\n\ - cmp r0, #0\n\ - beq _08005D56\n\ - b _08005B56\n\ + bl IsSEPlaying\n\ + lsl r0, #24\n\ + lsr r0, #24\n\ + cmp r0, #0\n\ + beq _08005D56\n\ + b _08005B56\n\ _08005D56:\n\ - strb r0, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r0, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D5A:\n\ - ldrb r0, [r6, #0x1E]\n\ - add r1, r0, #0\n\ - cmp r1, #0\n\ - beq _08005D68\n\ - sub r0, #0x1\n\ - strb r0, [r6, #0x1E]\n\ - b _08005B56\n\ + ldrb r0, [r6, #0x1E]\n\ + add r1, r0, #0\n\ + cmp r1, #0\n\ + beq _08005D68\n\ + sub r0, #0x1\n\ + strb r0, [r6, #0x1E]\n\ + b _08005B56\n\ _08005D68:\n\ - strb r1, [r6, #0x1C]\n\ - b _08005B56\n\ + strb r1, [r6, #0x1C]\n\ + b _08005B56\n\ _08005D6C:\n\ - mov r0, #0x1\n\ + mov r0, #0x1\n\ _08005D6E:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1"); + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n"); } +#endif u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing) { diff --git a/src/time_events.c b/src/time_events.c new file mode 100644 index 000000000..1f169a5c6 --- /dev/null +++ b/src/time_events.c @@ -0,0 +1,118 @@ +#include "global.h" +#include "time_events.h" +#include "event_data.h" +#include "field_weather.h" +#include "pokemon.h" +#include "random.h" +#include "overworld.h" +#include "rtc.h" +#include "script.h" +#include "task.h" + +static u32 GetMirageRnd(void) +{ + u32 hi = VarGet(VAR_MIRAGE_RND_H); + u32 lo = VarGet(VAR_MIRAGE_RND_L); + return (hi << 16) | lo; +} + +static void SetMirageRnd(u32 rnd) +{ + VarSet(VAR_MIRAGE_RND_H, rnd >> 16); + VarSet(VAR_MIRAGE_RND_L, rnd); +} + +// unused +void InitMirageRnd(void) +{ + SetMirageRnd((Random() << 16) | Random()); +} + +void UpdateMirageRnd(u16 days) +{ + s32 rnd = GetMirageRnd(); + while (days) + { + rnd = 1103515245 * rnd + 12345; + days--; + } + SetMirageRnd(rnd); +} + +bool8 IsMirageIslandPresent(void) +{ + u16 rnd = GetMirageRnd() >> 16; + int i; + + for (i = 0; i < PARTY_SIZE; i++) + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && (GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY) & 0xFFFF) == rnd) + return TRUE; + + return FALSE; +} + +void UpdateShoalTideFlag(void) +{ + static const u8 tide[] = + { + 1, // 00 + 1, // 01 + 1, // 02 + 0, // 03 + 0, // 04 + 0, // 05 + 0, // 06 + 0, // 07 + 0, // 08 + 1, // 09 + 1, // 10 + 1, // 11 + 1, // 12 + 1, // 13 + 1, // 14 + 0, // 15 + 0, // 16 + 0, // 17 + 0, // 18 + 0, // 19 + 0, // 20 + 1, // 21 + 1, // 22 + 1, // 23 + }; + + if (is_light_level_1_2_3_5_or_6(get_map_light_from_warp0())) + { + RtcCalcLocalTime(); + if (tide[gLocalTime.hours]) + FlagSet(FLAG_SYS_SHOAL_TIDE); + else + FlagClear(FLAG_SYS_SHOAL_TIDE); + } +} + +static void Task_WaitWeather(u8 taskId) +{ + if (IsWeatherChangeComplete()) + { + EnableBothScriptContexts(); + DestroyTask(taskId); + } +} + +void WaitWeather(void) +{ + CreateTask(Task_WaitWeather, 80); +} + +void InitBirchState(void) +{ + *GetVarPointer(VAR_BIRCH_STATE) = 0; +} + +void UpdateBirchState(u16 days) +{ + u16 *state = GetVarPointer(VAR_BIRCH_STATE); + *state += days; + *state %= 7; +} diff --git a/src/trainer_see.c b/src/trainer_see.c index 53bc5cbbb..7706da703 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -6,7 +6,7 @@ #include "field_effect.h" #include "field_map_obj.h" #include "field_player_avatar.h" -#include "map_obj_8097404.h" +#include "field_map_obj_helpers.h" #include "pokenav.h" #include "task.h" #include "util.h" @@ -639,7 +639,7 @@ void sub_80B45D0(void) gApproachingTrainerId++; gSpecialVar_Result = 1; UnfreezeMapObjects(); - sub_80974D0(gApproachingTrainers[1].mapObjectId); + FreezeMapObjectsExceptOne(gApproachingTrainers[1].mapObjectId); } else { diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 12f475c93..c8898d08f 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -4,7 +4,7 @@ #include "malloc.h" #include "palette.h" #include "pokenav.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "text.h" #include "bg.h" #include "window.h" @@ -131,7 +131,7 @@ void sub_8166340(void) ProcessSpriteCopyRequests(); TransferPlttBuffer(); sub_81D2108(gUnknown_0203BCAC->field_7C58); - sub_80BA0A8(); + ScanlineEffect_InitHBlankDmaTransfer(); } void sub_816636C(void (*func)(void)) diff --git a/src/wallclock.c b/src/wallclock.c index dbea24b4c..f15bbbc27 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -12,7 +12,7 @@ #include "window.h" #include "text_window.h" #include "menu.h" -#include "unknown_task.h" +#include "scanline_effect.h" #include "task.h" #include "strings.h" #include "sound.h" diff --git a/sym_bss.txt b/sym_bss.txt index a03a95efa..24e6afa3b 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -76,16 +76,8 @@ gUnknown_03001204: @ 3001204 .space 0x4 .include "src/battle_transition.o" - -gUnknown_03001240: @ 3001240 - .space 0x30 - -gUnknown_03001270: @ 3001270 - .space 0x4 - -gUnknown_03001274: @ 3001274 - .space 0x4 - + .include "src/pokemon_animation.o" + gUnknown_03001278: @ 3001278 .space 0x1 diff --git a/sym_ewram.txt b/sym_ewram.txt index e7cbe65eb..5fd9142ee 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -581,9 +581,9 @@ gUnknown_020375B6: @ 20375B6 gUnknown_020375B8: @ 20375B8 .space 0x4 -gUnknown_020375BC: @ 20375BC - .space 0x4 + .include "src/field_message_box.o" + .align 2 gUnknown_020375C0: @ 20375C0 .space 0x4 @@ -652,36 +652,7 @@ gUnknown_02038BC6: @ 2038BC6 gFieldEffectArguments: @ 2038C08 .space 0x20 -gUnknown_02038C28: @ 2038C28 - .space 0x2 - -gUnknown_02038C2A: @ 2038C2A - .space 0x2 - -gUnknown_02038C2C: @ 2038C2C - .space 0x13C - -gUnknown_02038D68: @ 2038D68 - .space 0x140 - -gUnknown_02038EA8: @ 2038EA8 - .space 0x280 - -gUnknown_02039128: @ 2039128 - .space 0x280 - -gUnknown_020393A8: @ 20393A8 - .space 0x140 - -gUnknown_020394E8: @ 20394E8 - .space 0x640 - -gUnknown_02039B28: @ 2039B28 - .space 0x1C - -gUnknown_02039B44: @ 2039B44 - .space 0x4 - + .include "src/scanline_effect.o" .include "src/option_menu.o" .align 2 @@ -884,9 +855,7 @@ gUnknown_02039F8C: @ 2039F8C gUnknown_02039F90: @ 2039F90 .space 0x4 -gUnknown_02039F94: @ 2039F94 - .space 0x4 - + .include "src/naming_screen.o" .include "src/money.o" .align 2 @@ -1240,9 +1209,7 @@ gUnknown_0203BCE8: @ 203BCE8 gUnknown_0203BCF4: @ 203BCF4 .space 0x4 -gUnknown_0203BCF8: @ 203BCF8 - .space 0x4 - + .include "src/mystery_event_menu.o" .include "src/save_failed_screen.o" gBraillePuzzleCallbackFlag: @ 203BD14