diff --git a/Makefile b/Makefile index 7868a6e1e..22f9cb452 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,11 @@ TOOLCHAIN := $(DEVKITARM) ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) include $(TOOLCHAIN)/base_tools else -PREFIX := $(TOOLCHAIN)/bin/arm-none-eabi- +export PATH := $(TOOLCHAIN)/bin:$(PATH) +PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy -CC := $(PREFIX)gcc -AS := $(PREFIX)as +export CC := $(PREFIX)gcc +export AS := $(PREFIX)as endif export CPP := $(PREFIX)cpp export LD := $(PREFIX)ld @@ -42,7 +43,7 @@ MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR) ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) -GCC_VER := $(shell $(CC) -dumpversion) +GCC_VER = $(shell $(CC) -dumpversion) ifeq ($(MODERN),0) CC1 := tools/agbcc/bin/agbcc$(EXE) @@ -51,7 +52,7 @@ ROM := pokeemerald.gba OBJ_DIR := build/emerald LIBPATH := -L ../../tools/agbcc/lib else -CC1 := $(shell $(PREFIX)gcc --print-prog-name=cc1) -quiet +CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast ROM := pokeemerald_modern.gba OBJ_DIR := build/modern @@ -78,6 +79,12 @@ FIX := tools/gbafix/gbafix$(EXE) MAPJSON := tools/mapjson/mapjson$(EXE) JSONPROC := tools/jsonproc/jsonproc$(EXE) +TOOLDIRS := $(filter-out tools/agbcc tools/binutils,$(wildcard tools/*)) +TOOLBASE = $(TOOLDIRS:tools/%=%) +TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE)) + +MAKEFLAGS += --no-print-directory + # Clear the default suffixes .SUFFIXES: # Don't delete intermediate files @@ -88,7 +95,17 @@ JSONPROC := tools/jsonproc/jsonproc$(EXE) # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: rom clean compare tidy tools mostlyclean clean-tools +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) + +infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) + +# Build tools when building the rom +# Disable dependency scanning for clean/tidy/tools +ifeq (,$(filter-out all compare,$(MAKECMDGOALS))) +$(call infoshell, $(MAKE) tools) +else +NODEP := 1 +endif C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c) C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) @@ -112,18 +129,14 @@ SUBDIRS := $(sort $(dir $(OBJS))) AUTO_GEN_TARGETS := -TOOLDIRS := $(filter-out tools/agbcc tools/binutils,$(wildcard tools/*)) -TOOLBASE = $(TOOLDIRS:tools/%=%) -TOOLS = $(foreach tool,$(TOOLBASE),tools/%(tool)/$(tool)$(EXE)) - $(shell mkdir -p $(SUBDIRS)) -all: tools rom +all: rom -tools: $(TOOLS) +tools: $(TOOLDIRS) -$(TOOLS): - @$(foreach tooldir,$(TOOLDIRS),$(MAKE) -C $(tooldir);) +$(TOOLDIRS): + @$(MAKE) -C $@ rom: $(ROM) diff --git a/asm/pokenav_unk_6.s b/asm/pokenav_unk_6.s deleted file mode 100644 index f5e017816..000000000 --- a/asm/pokenav_unk_6.s +++ /dev/null @@ -1,1752 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - -@ File centered around AllocSubstruct(0xB) - - thumb_func_start sub_81CCFD8 -sub_81CCFD8: @ 81CCFD8 - push {r4,lr} - ldr r1, =0x0000678c - movs r0, 0xB - bl AllocSubstruct - adds r4, r0, 0 - cmp r4, 0 - beq _081CD01C - ldr r1, =0x00006428 - adds r0, r4, r1 - bl sub_81D1ED4 - bl sub_81CD970 - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - ldr r0, =0x00006304 - adds r1, r4, r0 - ldr r0, =sub_81CD08C - str r0, [r1] - movs r0, 0x1 - b _081CD01E - .pool -_081CD01C: - movs r0, 0 -_081CD01E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CCFD8 - - thumb_func_start sub_81CD024 -sub_81CD024: @ 81CD024 - push {r4,lr} - ldr r1, =0x0000678c - movs r0, 0xB - bl AllocSubstruct - adds r4, r0, 0 - cmp r4, 0 - beq _081CD068 - ldr r1, =0x00006428 - adds r0, r4, r1 - bl sub_81D1ED4 - bl sub_81CD9F8 - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - ldr r0, =0x00006304 - adds r1, r4, r0 - ldr r0, =sub_81CD08C - str r0, [r1] - movs r0, 0x1 - b _081CD06A - .pool -_081CD068: - movs r0, 0 -_081CD06A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CD024 - - thumb_func_start sub_81CD070 -sub_81CD070: @ 81CD070 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r2, =0x00006304 - adds r1, r0, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD070 - - thumb_func_start sub_81CD08C -sub_81CD08C: @ 81CD08C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r5, r0, 0 - adds r0, r4, 0 - bl sub_81CD1E4 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _081CD100 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081CD0D0 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081CD100 - movs r1, 0xC6 - lsls r1, 7 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081CD0F0 - ldrh r1, [r5, 0x2] - ldrh r0, [r5] - subs r0, 0x1 - cmp r1, r0 - bne _081CD100 -_081CD0D0: - movs r0, 0x5 - bl PlaySE - ldr r0, =0x00006304 - adds r1, r4, r0 - ldr r0, =sub_81CD19C - str r0, [r1] - movs r2, 0x2 - b _081CD100 - .pool -_081CD0F0: - movs r0, 0x5 - bl PlaySE - movs r2, 0x5 - ldr r0, =0x00006304 - adds r1, r4, r0 - ldr r0, =sub_81CD110 - str r0, [r1] -_081CD100: - adds r0, r2, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD08C - - thumb_func_start sub_81CD110 -sub_81CD110: @ 81CD110 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - movs r4, 0 - bl sub_811FBA4 - lsls r0, 24 - cmp r0, 0 - bne _081CD18A - bl sub_81CEF14 - ldr r1, =0x00006786 - adds r5, r6, r1 - movs r1, 0 - ldrsb r1, [r5, r1] - ldr r2, =0x00006783 - adds r4, r6, r2 - adds r1, r4, r1 - strb r0, [r1] - movs r0, 0x12 - bl GetSubstructPtr - ldrh r1, [r0, 0x2] - lsls r1, 2 - adds r0, r1 - ldrb r2, [r0, 0x4] - ldrb r3, [r0, 0x5] - movs r0, 0 - ldrsb r0, [r5, r0] - adds r4, r0 - ldrb r1, [r4] - mov r0, sp - strb r1, [r0] - cmp r2, 0xE - bne _081CD174 - movs r0, 0x64 - muls r0, r3 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x8 - mov r2, sp - bl SetMonData - b _081CD180 - .pool -_081CD174: - adds r0, r2, 0 - adds r1, r3, 0 - movs r2, 0x8 - mov r3, sp - bl SetBoxMonDataAt -_081CD180: - ldr r0, =0x00006304 - adds r1, r6, r0 - ldr r0, =sub_81CD08C - str r0, [r1] - movs r4, 0x6 -_081CD18A: - adds r0, r4, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD110 - - thumb_func_start sub_81CD19C -sub_81CD19C: @ 81CD19C - push {lr} - movs r1, 0xC6 - lsls r1, 7 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081CD1B4 - ldr r0, =0x000186aa - b _081CD1B6 - .pool -_081CD1B4: - ldr r0, =0x000186a2 -_081CD1B6: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD19C - - thumb_func_start sub_81CD1C0 -sub_81CD1C0: @ 81CD1C0 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - movs r1, 0xC6 - lsls r1, 7 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081CD1DA - movs r0, 0x12 - bl FreePokenavSubstruct -_081CD1DA: - movs r0, 0xB - bl FreePokenavSubstruct - pop {r0} - bx r0 - thumb_func_end sub_81CD1C0 - - thumb_func_start sub_81CD1E4 -sub_81CD1E4: @ 81CD1E4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r2, r0, 0 - movs r3, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081CD220 - movs r1, 0xC6 - lsls r1, 7 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081CD210 - ldrh r0, [r2, 0x2] - cmp r0, 0 - beq _081CD24E -_081CD210: - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - b _081CD246 - .pool -_081CD220: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081CD24E - movs r1, 0xC6 - lsls r1, 7 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081CD23E - ldrh r1, [r2, 0x2] - ldrh r0, [r2] - subs r0, 0x1 - cmp r1, r0 - bge _081CD24E -_081CD23E: - movs r0, 0x5 - bl PlaySE - movs r0, 0 -_081CD246: - bl sub_81CD258 - lsls r0, 24 - lsrs r3, r0, 24 -_081CD24E: - adds r0, r3, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CD1E4 - - thumb_func_start sub_81CD258 -sub_81CD258: @ 81CD258 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r0, 0xB - bl GetSubstructPtr - adds r4, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r5, r0, 0 - mov r0, r8 - cmp r0, 0 - beq _081CD284 - ldr r1, =0x00006788 - adds r0, r4, r1 - b _081CD288 - .pool -_081CD284: - ldr r2, =0x00006787 - adds r0, r4, r2 -_081CD288: - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 16 - lsrs r0, 16 - adds r7, r0, 0 - ldr r1, =0x00006428 - adds r0, r4, r1 - ldr r2, =0x00006786 - adds r1, r4, r2 - movs r2, 0 - ldrsb r2, [r1, r2] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 2 - ldr r3, =0x0000643c - adds r1, r3 - adds r1, r4, r1 - lsls r2, r7, 2 - adds r2, r7 - lsls r2, 2 - adds r2, r3 - adds r2, r4, r2 - bl sub_81D1F84 - ldrh r6, [r5, 0x2] - bl sub_81CDD5C - cmp r0, 0 - beq _081CD2D8 - ldrh r1, [r5] - b _081CD2DC - .pool -_081CD2D8: - ldrh r1, [r5] - subs r1, 0x1 -_081CD2DC: - eors r1, r6 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - adds r6, r0, 0 - mov r0, r8 - cmp r0, 0 - beq _081CD332 - ldr r1, =0x00006787 - adds r2, r4, r1 - ldrb r0, [r2] - adds r1, 0x1 - adds r3, r4, r1 - strb r0, [r3] - ldr r0, =0x00006786 - adds r1, r4, r0 - ldrb r0, [r1] - strb r0, [r2] - strb r7, [r1] - ldrb r1, [r3] - ldr r2, =0x00006789 - adds r0, r4, r2 - strb r1, [r0] - ldrh r0, [r5, 0x2] - cmp r0, 0 - bne _081CD312 - ldrh r0, [r5] -_081CD312: - subs r1, r0, 0x1 - strh r1, [r5, 0x2] - lsls r0, r1, 16 - cmp r0, 0 - beq _081CD32C - subs r1, 0x1 - b _081CD384 - .pool -_081CD32C: - ldrh r0, [r5] - subs r1, r0, 0x1 - b _081CD384 -_081CD332: - ldr r0, =0x00006788 - adds r2, r4, r0 - ldrb r0, [r2] - ldr r1, =0x00006787 - adds r3, r4, r1 - strb r0, [r3] - ldr r0, =0x00006786 - adds r1, r4, r0 - ldrb r0, [r1] - strb r0, [r2] - strb r7, [r1] - ldrb r1, [r3] - ldr r2, =0x00006789 - adds r0, r4, r2 - strb r1, [r0] - ldrh r1, [r5, 0x2] - ldrh r0, [r5] - subs r0, 0x1 - cmp r1, r0 - bge _081CD370 - adds r0, r1, 0x1 - b _081CD372 - .pool -_081CD370: - movs r0, 0 -_081CD372: - strh r0, [r5, 0x2] - ldrh r1, [r5, 0x2] - ldrh r0, [r5] - subs r0, 0x1 - cmp r1, r0 - bge _081CD382 - adds r1, 0x1 - b _081CD384 -_081CD382: - movs r1, 0 -_081CD384: - ldr r2, =0x00006302 - adds r0, r4, r2 - strh r1, [r0] - ldrh r4, [r5, 0x2] - bl sub_81CDD5C - cmp r0, 0 - beq _081CD39C - ldrh r1, [r5] - b _081CD3A0 - .pool -_081CD39C: - ldrh r1, [r5] - subs r1, 0x1 -_081CD3A0: - eors r1, r4 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - cmp r6, 0 - bne _081CD3B0 - movs r0, 0x3 - b _081CD3BA -_081CD3B0: - cmp r0, 0 - beq _081CD3B8 - movs r0, 0x1 - b _081CD3BA -_081CD3B8: - movs r0, 0x4 -_081CD3BA: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81CD258 - - thumb_func_start sub_81CD3C4 -sub_81CD3C4: @ 81CD3C4 - push {r4,lr} - movs r0, 0xB - bl GetSubstructPtr - adds r4, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r2, r0, 0 - ldr r1, =0x0000678a - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0x9 - bls _081CD3E2 - b _081CD530 -_081CD3E2: - lsls r0, 2 - ldr r1, =_081CD3F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081CD3F4: - .4byte _081CD41C - .4byte _081CD428 - .4byte _081CD434 - .4byte _081CD440 - .4byte _081CD490 - .4byte _081CD4A8 - .4byte _081CD4C0 - .4byte _081CD4D8 - .4byte _081CD4F0 - .4byte _081CD508 -_081CD41C: - movs r1, 0x2 - ldrsh r0, [r2, r1] - movs r1, 0 - bl sub_81CD824 - b _081CD530 -_081CD428: - movs r1, 0x2 - ldrsh r0, [r2, r1] - movs r1, 0 - bl sub_81CDA1C - b _081CD530 -_081CD434: - movs r1, 0x2 - ldrsh r0, [r2, r1] - movs r1, 0 - bl sub_81CDB98 - b _081CD530 -_081CD440: - ldrh r0, [r2] - cmp r0, 0x1 - bne _081CD468 - ldr r2, =0x00006786 - adds r0, r4, r2 - movs r1, 0 - strb r1, [r0] - adds r2, 0x1 - adds r0, r4, r2 - strb r1, [r0] - adds r2, 0x1 - adds r0, r4, r2 - strb r1, [r0] - adds r2, 0x2 - adds r0, r4, r2 - strb r1, [r0] - movs r0, 0x1 - b _081CD53C - .pool -_081CD468: - ldr r0, =0x00006786 - adds r1, r4, r0 - movs r0, 0 - strb r0, [r1] - ldr r2, =0x00006787 - adds r1, r4, r2 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =0x00006788 - adds r1, r4, r0 - movs r0, 0x2 - strb r0, [r1] - b _081CD530 - .pool -_081CD490: - ldrh r0, [r2, 0x2] - adds r0, 0x1 - ldrh r2, [r2] - cmp r0, r2 - blt _081CD49C - movs r0, 0 -_081CD49C: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - bl sub_81CD824 - b _081CD530 -_081CD4A8: - ldrh r0, [r2, 0x2] - adds r0, 0x1 - ldrh r2, [r2] - cmp r0, r2 - blt _081CD4B4 - movs r0, 0 -_081CD4B4: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - bl sub_81CDA1C - b _081CD530 -_081CD4C0: - ldrh r0, [r2, 0x2] - adds r0, 0x1 - ldrh r2, [r2] - cmp r0, r2 - blt _081CD4CC - movs r0, 0 -_081CD4CC: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - bl sub_81CDB98 - b _081CD530 -_081CD4D8: - ldrh r0, [r2, 0x2] - subs r0, 0x1 - cmp r0, 0 - bge _081CD4E4 - ldrh r0, [r2] - subs r0, 0x1 -_081CD4E4: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x2 - bl sub_81CD824 - b _081CD530 -_081CD4F0: - ldrh r0, [r2, 0x2] - subs r0, 0x1 - cmp r0, 0 - bge _081CD4FC - ldrh r0, [r2] - subs r0, 0x1 -_081CD4FC: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x2 - bl sub_81CDA1C - b _081CD530 -_081CD508: - ldrh r0, [r2, 0x2] - subs r0, 0x1 - cmp r0, 0 - bge _081CD514 - ldrh r0, [r2] - subs r0, 0x1 -_081CD514: - lsls r0, 16 - asrs r0, 16 - movs r1, 0x2 - bl sub_81CDB98 - ldr r2, =0x0000678a - adds r1, r4, r2 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _081CD53C - .pool -_081CD530: - ldr r0, =0x0000678a - adds r1, r4, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 -_081CD53C: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD3C4 - - thumb_func_start sub_81CD548 -sub_81CD548: @ 81CD548 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r0, 0xB - bl GetSubstructPtr - adds r1, r0, 0 - cmp r4, 0x1 - beq _081CD588 - cmp r4, 0x1 - bgt _081CD566 - cmp r4, 0 - beq _081CD56C - b _081CD5C4 -_081CD566: - cmp r5, 0x2 - beq _081CD5A4 - b _081CD5C4 -_081CD56C: - ldr r2, =0x00006302 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - ldr r2, =0x00006789 - adds r1, r2 - ldrb r1, [r1] - bl sub_81CD824 - b _081CD5C4 - .pool -_081CD588: - ldr r2, =0x00006302 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - ldr r2, =0x00006789 - adds r1, r2 - ldrb r1, [r1] - bl sub_81CDA1C - b _081CD5C4 - .pool -_081CD5A4: - ldr r2, =0x00006302 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - ldr r2, =0x00006789 - adds r1, r2 - ldrb r1, [r1] - bl sub_81CDB98 - movs r0, 0x1 - b _081CD5C6 - .pool -_081CD5C4: - movs r0, 0 -_081CD5C6: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81CD548 - - thumb_func_start sub_81CD5CC -sub_81CD5CC: @ 81CD5CC - push {r4,lr} - adds r4, r0, 0 - lsls r2, 16 - lsrs r2, 16 - b _081CD5E4 -_081CD5D6: - strb r3, [r4] - adds r1, 0x1 - adds r4, 0x1 - lsls r0, r2, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 -_081CD5E4: - ldrb r3, [r1] - adds r0, r3, 0 - cmp r0, 0xFF - bne _081CD5D6 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - ble _081CD612 - movs r3, 0 -_081CD5FE: - strb r3, [r4] - adds r4, 0x1 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - bgt _081CD5FE -_081CD612: - movs r0, 0xFF - strb r0, [r4] - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD5CC - - thumb_func_start sub_81CD624 -sub_81CD624: @ 81CD624 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r5, r0, 0 - adds r4, r1, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r2, 24 - lsrs r2, 24 - mov r10, r2 - movs r0, 0x12 - bl GetSubstructPtr - lsls r4, 2 - adds r0, r4 - ldrb r4, [r0, 0x4] - mov r8, r4 - ldrb r6, [r0, 0x5] - mov r9, r6 - movs r0, 0xFC - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x4 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x8 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x9 - strb r0, [r5] - adds r5, 0x1 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2D - movs r3, 0 - bl GetBoxOrPartyMonData - cmp r0, 0 - beq _081CD690 - ldr r1, =gText_EggNickname - adds r0, r5, 0 - movs r2, 0 - movs r3, 0xC - bl StringCopyPadded - b _081CD80E - .pool -_081CD690: - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2 - adds r3, r5, 0 - bl GetBoxOrPartyMonData - adds r0, r5, 0 - bl StringGetEnd10 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0xB - movs r3, 0 - bl GetBoxOrPartyMonData - lsls r0, 16 - lsrs r7, r0, 16 - cmp r4, 0xE - bne _081CD6E0 - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r6, r0, 24 - b _081CD6FE - .pool -_081CD6E0: - mov r0, r8 - mov r1, r9 - bl GetBoxedMonPtr - adds r4, r0, 0 - bl GetBoxMonGender - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r4, 0 - bl GetLevelFromBoxMonExp - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 -_081CD6FE: - cmp r7, 0x1D - beq _081CD706 - cmp r7, 0x20 - bne _081CD71C -_081CD706: - movs r0, 0xB - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r5, 0 - bl StringCompare - cmp r0, 0 - bne _081CD71C - movs r6, 0xFF -_081CD71C: - adds r3, r5, 0 - b _081CD726 - .pool -_081CD724: - adds r3, 0x1 -_081CD726: - ldrb r0, [r3] - cmp r0, 0xFF - bne _081CD724 - movs r1, 0xFC - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x12 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x3C - strb r0, [r3] - adds r3, 0x1 - cmp r6, 0 - beq _081CD74A - cmp r6, 0xFE - beq _081CD76E - movs r0, 0x77 - b _081CD790 -_081CD74A: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB5 - b _081CD790 -_081CD76E: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x6 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x7 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB6 -_081CD790: - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xFC - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x8 - strb r0, [r3] - adds r3, 0x1 - movs r5, 0 - strb r5, [r3] - adds r3, 0x1 - movs r0, 0x9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xBA - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xF9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - adds r4, r3, 0 - adds r0, r4, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r3, r0, 0 - subs r4, r3, r4 - lsls r4, 16 - lsrs r4, 16 - strb r5, [r3] - adds r3, 0x1 - mov r0, r10 - cmp r0, 0 - bne _081CD808 - movs r0, 0x3 - subs r0, r4 - lsls r0, 16 - ldr r1, =0xffff0000 - adds r0, r1 - lsrs r4, r0, 16 - ldr r0, =0x0000ffff - cmp r4, r0 - beq _081CD808 - movs r2, 0 - adds r1, r0, 0 -_081CD7FA: - strb r2, [r3] - adds r3, 0x1 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, r1 - bne _081CD7FA -_081CD808: - movs r0, 0xFF - strb r0, [r3] - adds r0, r3, 0 -_081CD80E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CD624 - - thumb_func_start sub_81CD824 -sub_81CD824: @ 81CD824 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 24 - lsrs r6, r1, 24 - movs r0, 0xB - bl GetSubstructPtr - adds r5, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r7, r0, 0 - mov r1, r8 - lsls r0, r1, 16 - asrs r4, r0, 16 - bl sub_81CDD5C - cmp r0, 0 - beq _081CD85A - ldrh r2, [r7] - cmp r4, r2 - bne _081CD862 - b _081CD900 -_081CD85A: - ldrh r0, [r7] - subs r0, 0x1 - cmp r4, r0 - beq _081CD900 -_081CD862: - lsls r0, r6, 6 - ldr r1, =0x00006368 - adds r0, r1 - adds r0, r5, r0 - mov r2, r8 - lsls r4, r2, 16 - lsrs r1, r4, 16 - movs r2, 0 - bl sub_81CD624 - asrs r4, 14 - adds r4, r7, r4 - ldrb r3, [r4, 0x4] - lsls r0, r6, 1 - adds r0, r6 - lsls r4, r0, 3 - ldr r1, =0x00006320 - adds r0, r5, r1 - adds r0, r4 - movs r2, 0 - movs r1, 0xFC - strb r1, [r0] - ldr r1, =0x00006321 - adds r0, r5, r1 - adds r0, r4 - movs r1, 0x4 - strb r1, [r0] - ldr r1, =0x00006322 - adds r0, r5, r1 - adds r0, r4 - movs r1, 0x8 - strb r1, [r0] - ldr r1, =0x00006323 - adds r0, r5, r1 - adds r0, r4 - strb r2, [r0] - ldr r2, =0x00006324 - adds r0, r5, r2 - adds r0, r4 - movs r1, 0x9 - strb r1, [r0] - cmp r3, 0xE - bne _081CD8E4 - adds r0, r4, r5 - ldr r1, =0x00006325 - adds r0, r1 - ldr r1, =gText_InParty - b _081CD8F4 - .pool -_081CD8E4: - adds r4, r5 - ldr r2, =0x00006325 - adds r4, r2 - adds r0, r3, 0 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 -_081CD8F4: - movs r2, 0x8 - bl sub_81CD5CC - b _081CD95C - .pool -_081CD900: - movs r1, 0 - lsls r4, r6, 6 - lsls r0, r6, 1 - mov r8, r0 - adds r3, r4, 0 - ldr r0, =0x00006368 - adds r2, r5, r0 - movs r7, 0 -_081CD910: - adds r0, r1, r3 - adds r0, r2, r0 - strb r7, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xB - bls _081CD910 - adds r1, r4 - ldr r2, =0x00006368 - adds r0, r5, r2 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - movs r1, 0 - mov r2, r8 - adds r0, r2, r6 - lsls r3, r0, 3 - ldr r0, =0x00006320 - adds r2, r5, r0 - movs r4, 0 -_081CD93A: - adds r0, r1, r3 - adds r0, r2, r0 - strb r4, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x7 - bls _081CD93A - mov r2, r8 - adds r0, r2, r6 - lsls r0, 3 - adds r0, r1, r0 - ldr r2, =0x00006320 - adds r1, r5, r2 - adds r1, r0 - movs r0, 0xFF - strb r0, [r1] -_081CD95C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CD824 - - thumb_func_start sub_81CD970 -sub_81CD970: @ 81CD970 - push {r4-r7,lr} - movs r0, 0xB - bl GetSubstructPtr - adds r7, r0, 0 - ldr r1, =0x000006ac - movs r0, 0x12 - bl AllocSubstruct - adds r6, r0, 0 - movs r0, 0xC6 - lsls r0, 7 - adds r1, r7, r0 - movs r0, 0 - strb r0, [r1] - movs r4, 0 - movs r5, 0 - b _081CD9C4 - .pool -_081CD998: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2D - bl GetMonData - adds r2, r0, 0 - cmp r2, 0 - bne _081CD9BE - lsls r1, r5, 2 - adds r1, r6, r1 - movs r0, 0xE - strb r0, [r1, 0x4] - strb r4, [r1, 0x5] - strh r2, [r1, 0x6] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_081CD9BE: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_081CD9C4: - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bcc _081CD998 - lsls r0, r5, 2 - adds r0, r6, r0 - movs r1, 0 - strb r1, [r0, 0x4] - strb r1, [r0, 0x5] - movs r2, 0 - strh r1, [r0, 0x6] - strh r1, [r6, 0x2] - adds r0, r5, 0x1 - strh r0, [r6] - ldr r1, =0x0000678a - adds r0, r7, r1 - strb r2, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CD970 - - thumb_func_start sub_81CD9F8 -sub_81CD9F8: @ 81CD9F8 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - movs r1, 0xC6 - lsls r1, 7 - adds r2, r0, r1 - movs r3, 0 - movs r1, 0x1 - strb r1, [r2] - ldr r1, =0x0000678a - adds r0, r1 - strb r3, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CD9F8 - - thumb_func_start sub_81CDA1C -sub_81CDA1C: @ 81CDA1C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - movs r0, 0xB - bl GetSubstructPtr - mov r8, r0 - movs r0, 0x12 - bl GetSubstructPtr - adds r4, r0, 0 - lsls r0, r6, 16 - asrs r5, r0, 16 - bl sub_81CDD5C - cmp r0, 0 - beq _081CDA52 - ldrh r0, [r4] - cmp r5, r0 - bne _081CDA5A - b _081CDB48 -_081CDA52: - ldrh r0, [r4] - subs r0, 0x1 - cmp r5, r0 - beq _081CDB48 -_081CDA5A: - lsls r0, r6, 16 - asrs r0, 14 - adds r0, r4, r0 - ldrb r6, [r0, 0x4] - ldrb r7, [r0, 0x5] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x16 - movs r3, 0 - bl GetBoxOrPartyMonData - mov r1, r9 - lsls r5, r1, 2 - adds r4, r5, r1 - ldr r1, =0x00006428 - add r1, r8 - adds r1, r4 - strb r0, [r1] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x2F - movs r3, 0 - bl GetBoxOrPartyMonData - ldr r1, =0x00006429 - add r1, r8 - adds r1, r4 - strb r0, [r1] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x21 - movs r3, 0 - bl GetBoxOrPartyMonData - ldr r1, =0x0000642a - add r1, r8 - adds r1, r4 - strb r0, [r1] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x18 - movs r3, 0 - bl GetBoxOrPartyMonData - ldr r1, =0x0000642b - add r1, r8 - adds r1, r4 - strb r0, [r1] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x17 - movs r3, 0 - bl GetBoxOrPartyMonData - ldr r1, =0x0000642c - add r1, r8 - adds r1, r4 - strb r0, [r1] - movs r0, 0xCF - lsls r0, 7 - add r0, r8 - mov r2, r9 - adds r4, r0, r2 - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x30 - movs r3, 0 - bl GetBoxOrPartyMonData - cmp r0, 0xFF - beq _081CDB10 - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x30 - movs r3, 0 - bl GetBoxOrPartyMonData - movs r1, 0x1D - bl __udivsi3 - b _081CDB12 - .pool -_081CDB10: - movs r0, 0x9 -_081CDB12: - strb r0, [r4] - adds r0, r6, 0 - adds r1, r7, 0 - movs r2, 0x8 - movs r3, 0 - bl GetBoxOrPartyMonData - ldr r1, =0x00006783 - add r1, r8 - add r1, r9 - strb r0, [r1] - mov r0, r9 - adds r1, r5, r0 - ldr r2, =0x00006428 - adds r0, r1, r2 - add r0, r8 - lsls r1, 2 - adds r2, 0x14 - adds r1, r2 - add r1, r8 - bl sub_81D2754 - b _081CDB80 - .pool -_081CDB48: - movs r2, 0 - mov r0, r9 - lsls r5, r0, 2 - add r5, r9 - ldr r4, =0x00006428 - add r4, r8 - lsls r3, r5, 2 - mov r9, r2 - ldr r7, =0x0000643c - movs r6, 0x9B -_081CDB5C: - adds r0, r2, r5 - adds r0, r4, r0 - mov r1, r9 - strb r1, [r0] - lsls r0, r2, 2 - adds r0, r3 - add r0, r8 - adds r1, r0, r7 - strh r6, [r1] - ldr r1, =0x0000643e - adds r0, r1 - movs r1, 0x5B - strh r1, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x4 - bls _081CDB5C -_081CDB80: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CDA1C - - thumb_func_start sub_81CDB98 -sub_81CDB98: @ 81CDB98 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - movs r0, 0xB - bl GetSubstructPtr - adds r7, r0, 0 - movs r0, 0x12 - bl GetSubstructPtr - adds r4, r0, 0 - lsls r0, r6, 16 - asrs r5, r0, 16 - bl sub_81CDD5C - cmp r0, 0 - beq _081CDBCC - ldrh r0, [r4] - b _081CDBD0 -_081CDBCC: - ldrh r0, [r4] - subs r0, 0x1 -_081CDBD0: - cmp r5, r0 - beq _081CDC3E - lsls r0, r6, 16 - asrs r0, 14 - adds r0, r4, r0 - ldrb r5, [r0, 0x4] - ldrb r6, [r0, 0x5] - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x41 - movs r3, 0 - bl GetBoxOrPartyMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0 - bl GetBoxOrPartyMonData - mov r8, r0 - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0 - bl GetBoxOrPartyMonData - adds r5, r0, 0 - lsls r0, r4, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - mov r2, r9 - lsls r1, r2, 13 - movs r2, 0xC0 - lsls r2, 2 - adds r1, r2 - adds r1, r7, r1 - movs r2, 0x1 - str r2, [sp] - adds r2, r4, 0 - adds r3, r5, 0 - bl LoadSpecialPokePic - adds r0, r4, 0 - mov r1, r8 - adds r2, r5, 0 - bl GetFrontSpritePalFromSpeciesAndPersonality - mov r2, r9 - lsls r1, r2, 7 - adds r1, r7, r1 - bl LZ77UnCompWram -_081CDC3E: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CDB98 - - thumb_func_start sub_81CDC50 -sub_81CDC50: @ 81CDC50 - push {lr} - movs r0, 0x12 - bl GetSubstructPtr - ldrh r0, [r0] - pop {r1} - bx r1 - thumb_func_end sub_81CDC50 - - thumb_func_start sub_81CDC60 -sub_81CDC60: @ 81CDC60 - push {lr} - movs r0, 0x12 - bl GetSubstructPtr - ldrh r0, [r0, 0x2] - pop {r1} - bx r1 - thumb_func_end sub_81CDC60 - - thumb_func_start sub_81CDC70 -sub_81CDC70: @ 81CDC70 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r1, =0x00006428 - adds r0, r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDC70 - - thumb_func_start sub_81CDC84 -sub_81CDC84: @ 81CDC84 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r1, =0x00006786 - adds r0, r1 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDC84 - - thumb_func_start sub_81CDC9C -sub_81CDC9C: @ 81CDC9C - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r1, =0x00006302 - adds r0, r1 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDC9C - - thumb_func_start sub_81CDCB4 -sub_81CDCB4: @ 81CDCB4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xB - bl GetSubstructPtr - lsls r4, 13 - movs r1, 0xC0 - lsls r1, 2 - adds r4, r1 - adds r0, r4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CDCB4 - - thumb_func_start sub_81CDCD4 -sub_81CDCD4: @ 81CDCD4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xB - bl GetSubstructPtr - lsls r4, 7 - adds r0, r4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CDCD4 - - thumb_func_start sub_81CDCEC -sub_81CDCEC: @ 81CDCEC - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r1, =0x00006789 - adds r0, r1 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDCEC - - thumb_func_start sub_81CDD04 -sub_81CDD04: @ 81CDD04 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xB - bl GetSubstructPtr - lsls r4, 6 - ldr r1, =0x00006368 - adds r4, r1 - adds r0, r4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDD04 - - thumb_func_start sub_81CDD24 -sub_81CDD24: @ 81CDD24 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xB - bl GetSubstructPtr - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - ldr r2, =0x00006320 - adds r1, r2 - adds r0, r1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDD24 - - thumb_func_start sub_81CDD48 -sub_81CDD48: @ 81CDD48 - push {lr} - movs r0, 0x12 - bl GetSubstructPtr - ldrh r1, [r0, 0x2] - lsls r1, 2 - adds r0, r1 - ldrh r0, [r0, 0x6] - pop {r1} - bx r1 - thumb_func_end sub_81CDD48 - - thumb_func_start sub_81CDD5C -sub_81CDD5C: @ 81CDD5C - push {lr} - movs r0, 0xB - bl GetSubstructPtr - movs r1, 0xC6 - lsls r1, 7 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081CDD74 - movs r0, 0 - b _081CDD76 -_081CDD74: - movs r0, 0x1 -_081CDD76: - pop {r1} - bx r1 - thumb_func_end sub_81CDD5C - - thumb_func_start sub_81CDD7C -sub_81CDD7C: @ 81CDD7C - push {lr} - movs r0, 0xB - bl GetSubstructPtr - adds r2, r0, 0 - movs r1, 0xC6 - lsls r1, 7 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _081CDD96 - movs r0, 0 - b _081CDDA6 -_081CDD96: - ldr r3, =0x00006786 - adds r0, r2, r3 - movs r1, 0 - ldrsb r1, [r0, r1] - subs r3, 0x3 - adds r0, r2, r3 - adds r0, r1 - ldrb r0, [r0] -_081CDDA6: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDD7C - - thumb_func_start sub_81CDDB0 -sub_81CDDB0: @ 81CDDB0 - push {lr} - movs r0, 0xB - bl GetSubstructPtr - ldr r2, =0x00006786 - adds r1, r0, r2 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - subs r2, 0x6 - adds r0, r2 - adds r0, r1 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDDB0 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokenav_unk_7.s b/asm/pokenav_unk_7.s deleted file mode 100644 index 6c363c01f..000000000 --- a/asm/pokenav_unk_7.s +++ /dev/null @@ -1,2001 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - -@ File centered around AllocSubstruct(0xC) - - thumb_func_start sub_81CDDD4 -sub_81CDDD4: @ 81CDDD4 - push {r4,lr} - ldr r1, =0x000038ac - movs r0, 0xC - bl AllocSubstruct - adds r4, r0, 0 - cmp r4, 0 - beq _081CDE24 - ldr r0, =0x00001816 - adds r1, r4, r0 - movs r0, 0xFF - strb r0, [r1] - ldr r0, =sub_81CDE94 - movs r1, 0x1 - bl CreateLoopedTask - str r0, [r4] - ldr r0, =0x00001810 - adds r1, r4, r0 - ldr r0, =sub_81CDE80 - str r0, [r1] - ldr r0, =0x00002908 - adds r1, r4, r0 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _081CDE26 - .pool -_081CDE24: - movs r0, 0 -_081CDE26: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CDDD4 - - thumb_func_start sub_81CDE2C -sub_81CDE2C: @ 81CDE2C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r5, r0, 0 - ldr r0, =gUnknown_08623384 - lsls r4, 2 - adds r4, r0 - ldr r0, [r4] - movs r1, 0x1 - bl CreateLoopedTask - str r0, [r5] - ldr r0, =0x00001810 - adds r5, r0 - ldr r0, =sub_81CDE80 - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CDE2C - - thumb_func_start sub_81CDE64 -sub_81CDE64: @ 81CDE64 - push {lr} - movs r0, 0xC - bl GetSubstructPtr - ldr r1, =0x00001810 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CDE64 - - thumb_func_start sub_81CDE80 -sub_81CDE80: @ 81CDE80 - push {lr} - movs r0, 0xC - bl GetSubstructPtr - ldr r0, [r0] - bl IsLoopedTaskActive - pop {r1} - bx r1 - thumb_func_end sub_81CDE80 - - thumb_func_start sub_81CDE94 -sub_81CDE94: @ 81CDE94 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r5, r0, 0 - cmp r4, 0x14 - bls _081CDEA8 - b _081CE2C4 -_081CDEA8: - lsls r0, r4, 2 - ldr r1, =_081CDEB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081CDEB8: - .4byte _081CDF0C - .4byte _081CDF18 - .4byte _081CDF94 - .4byte _081CDFB8 - .4byte _081CE030 - .4byte _081CE074 - .4byte _081CE0B0 - .4byte _081CE118 - .4byte _081CE120 - .4byte _081CE126 - .4byte _081CE136 - .4byte _081CE146 - .4byte _081CE156 - .4byte _081CE16C - .4byte _081CE1C8 - .4byte _081CE1EC - .4byte _081CE218 - .4byte _081CE23C - .4byte _081CE24A - .4byte _081CE25A - .4byte _081CE262 -_081CDF0C: - bl sub_81CD3C4 - cmp r0, 0x1 - beq _081CDF16 - b _081CE2C0 -_081CDF16: - b _081CDFB0 -_081CDF18: - ldr r0, =gUnknown_08623358 - movs r1, 0x3 - bl InitBgTemplates - 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 - ldr r1, =0x00007940 - movs r0, 0 - bl SetGpuReg - ldr r1, =0x00000844 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x0000040b - movs r0, 0x52 - bl SetGpuReg - ldr r1, =gPokenavCondition_Gfx - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - b _081CDFA8 - .pool -_081CDF94: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081CDFA2 - b _081CE2C0 -_081CDFA2: - ldr r1, =gUnknown_08623228 - str r0, [sp] - movs r0, 0x2 -_081CDFA8: - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram -_081CDFB0: - movs r0, 0 - b _081CE2C6 - .pool -_081CDFB8: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _081CDFC4 - b _081CE2C0 -_081CDFC4: - ldr r0, =gPokenavCondition_Tilemap - adds r4, r5, 0x4 - adds r1, r4, 0 - bl LZ77UnCompVram - movs r0, 0x3 - adds r1, r4, 0 - bl SetBgTilemapBuffer - bl sub_81CDD5C - cmp r0, 0x1 - bne _081CDFF2 - ldr r1, =gPokenavOptions_Tilemap - movs r0, 0x9 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x5 - bl CopyToBgTilemapBufferRect -_081CDFF2: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r0, =gPokenavCondition_Pal - movs r1, 0x10 - movs r2, 0x20 - bl CopyPaletteIntoBufferUnfaded - ldr r0, =gUnknown_08623208 - movs r1, 0xF0 - movs r2, 0x20 - bl CopyPaletteIntoBufferUnfaded - ldr r0, =0x00001814 - adds r1, r5, r0 - ldr r0, =0x0000ffb0 - strh r0, [r1] - b _081CDFB0 - .pool -_081CE030: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _081CE03C - b _081CE2C0 -_081CE03C: - ldr r0, =gUnknown_0862323C - ldr r1, =0x00001004 - adds r4, r5, r1 - adds r1, r4, 0 - bl LZ77UnCompVram - movs r0, 0x2 - adds r1, r4, 0 - bl SetBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_086231E8 - movs r1, 0x30 - movs r2, 0x20 - bl CopyPaletteIntoBufferUnfaded - movs r0, 0x2 - bl sub_81D21DC - b _081CDFB0 - .pool -_081CE074: - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_8199DF0 - movs r0, 0x1 - movs r1, 0x11 - movs r2, 0x1 - movs r3, 0x1 - bl sub_8199DF0 - movs r0, 0 - str r0, [sp, 0x8] - ldr r2, =0x00000804 - adds r4, r5, r2 - ldr r2, =0x05000200 - add r0, sp, 0x8 - adds r1, r4, 0 - bl CpuSet - movs r0, 0x1 - adds r1, r4, 0 - bl SetBgTilemapBuffer - b _081CDFB0 - .pool -_081CE0B0: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _081CE0BC - b _081CE2C0 -_081CE0BC: - ldr r0, =gUnknown_08623364 - bl AddWindow - movs r2, 0xC1 - lsls r2, 5 - adds r1, r5, r2 - strb r0, [r1] - bl sub_81CDD5C - cmp r0, 0x1 - bne _081CE0F6 - ldr r0, =gUnknown_0862336C - bl AddWindow - ldr r2, =0x00001821 - adds r1, r5, r2 - strb r0, [r1] - ldr r0, =gUnknown_08623374 - bl AddWindow - ldr r2, =0x00001822 - adds r1, r5, r2 - strb r0, [r1] - ldr r0, =gUnknown_0862337C - bl AddWindow - ldr r2, =0x00001823 - adds r1, r5, r2 - strb r0, [r1] -_081CE0F6: - bl DeactivateAllTextPrinters - b _081CDFB0 - .pool -_081CE118: - movs r0, 0 - bl sub_81CED30 - b _081CDFB0 -_081CE120: - bl sub_81CE9E4 - b _081CDFB0 -_081CE126: - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE130 - b _081CDFB0 -_081CE130: - bl sub_81CE934 - b _081CDFB0 -_081CE136: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0 - b _081CE164 -_081CE146: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x1 - b _081CE164 -_081CE156: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x2 -_081CE164: - movs r2, 0x1 - bl sub_81CE754 - b _081CDFB0 -_081CE16C: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x3 - movs r2, 0x1 - bl sub_81CE754 - cmp r0, 0x1 - beq _081CE186 - b _081CE2C0 -_081CE186: - movs r1, 0xC1 - lsls r1, 5 - adds r0, r5, r1 - ldrb r0, [r0] - bl PutWindowTilemap - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE19C - b _081CDFB0 -_081CE19C: - ldr r2, =0x00001821 - adds r0, r5, r2 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r1, =0x00001822 - adds r0, r5, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r2, =0x00001823 - adds r0, r5, r2 - ldrb r0, [r0] - bl PutWindowTilemap - b _081CDFB0 - .pool -_081CE1C8: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl HideBg - movs r0, 0x3 - bl ShowBg - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE1E4 - b _081CDFB0 -_081CE1E4: - movs r0, 0x4 - bl sub_81C7BA4 - b _081CDFB0 -_081CE1EC: - movs r0, 0x1 - bl sub_81C7AC0 - bl sub_81CDD5C - cmp r0, 0 - beq _081CE1FC - b _081CDFB0 -_081CE1FC: - movs r0, 0x6 - bl LoadLeftHeaderGfxForIndex - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - bl sub_81C7FA0 - movs r0, 0x6 - movs r1, 0x1 - movs r2, 0 - bl sub_81C7FA0 - b _081CDFB0 -_081CE218: - bl IsPaletteFadeActive - cmp r0, 0 - bne _081CE2C0 - bl sub_81CDD5C - cmp r0, 0 - bne _081CE230 - bl sub_81C8010 - cmp r0, 0 - bne _081CE2C0 -_081CE230: - ldr r0, =sub_81CEE44 - bl SetVBlankCallback_ - b _081CDFB0 - .pool -_081CE23C: - bl sub_81CEE90 - bl sub_81CDC70 - bl sub_81D20AC - b _081CDFB0 -_081CE24A: - bl sub_81CDC70 - bl sub_81D20BC - lsls r0, 24 - cmp r0, 0 - bne _081CE2C0 - b _081CDFB0 -_081CE25A: - movs r0, 0x1 - bl sub_81CEE74 - b _081CDFB0 -_081CE262: - bl sub_81CDC70 - ldr r2, =0x00001814 - adds r1, r5, r2 - bl sub_81D3178 - lsls r0, 24 - cmp r0, 0 - bne _081CE2C0 - ldr r0, =0x000028e0 - adds r6, r5, r0 - adds r0, r6, 0 - bl sub_81D3464 - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE298 - bl sub_81CDC60 - adds r4, r0, 0 - bl sub_81CDC50 - lsls r4, 16 - lsls r0, 16 - cmp r4, r0 - beq _081CE2C4 -_081CE298: - ldr r1, =0x00001816 - adds r0, r5, r1 - ldrb r4, [r0] - bl sub_81CDDB0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81D3480 - b _081CE2C4 - .pool -_081CE2C0: - movs r0, 0x2 - b _081CE2C6 -_081CE2C4: - movs r0, 0x4 -_081CE2C6: - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81CDE94 - - thumb_func_start sub_81CE2D0 -sub_81CE2D0: @ 81CE2D0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r5, r0, 0 - cmp r4, 0x1 - beq _081CE308 - cmp r4, 0x1 - bgt _081CE2EA - cmp r4, 0 - beq _081CE2F4 - b _081CE374 -_081CE2EA: - cmp r4, 0x2 - beq _081CE328 - cmp r4, 0x3 - beq _081CE33E - b _081CE374 -_081CE2F4: - bl sub_81CEEC8 - ldr r1, =0x000028e0 - adds r0, r5, r1 - bl sub_81D3520 - movs r0, 0x1 - b _081CE376 - .pool -_081CE308: - bl sub_81CDC70 - ldr r2, =0x00001814 - adds r1, r5, r2 - bl sub_81D31A4 - lsls r0, 24 - cmp r0, 0 - bne _081CE34E - movs r0, 0 - bl sub_81CEE74 - movs r0, 0x1 - b _081CE376 - .pool -_081CE328: - movs r0, 0 - bl sub_81C7AC0 - bl sub_81CDD5C - cmp r0, 0 - bne _081CE33A - bl sub_81C78A0 -_081CE33A: - movs r0, 0 - b _081CE376 -_081CE33E: - bl IsPaletteFadeActive - cmp r0, 0 - bne _081CE34E - bl MainMenuLoopedTaskIsBusy - cmp r0, 0 - beq _081CE352 -_081CE34E: - movs r0, 0x2 - b _081CE376 -_081CE352: - ldr r1, =0x000028e0 - adds r0, r5, r1 - bl sub_81D354C - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - movs r0, 0x3 - bl HideBg - movs r0, 0x1 - b _081CE376 - .pool -_081CE374: - movs r0, 0x4 -_081CE376: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81CE2D0 - - thumb_func_start sub_81CE37C -sub_81CE37C: @ 81CE37C - push {r4-r6,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r6, r0, 0 - bl sub_81CDC70 - adds r2, r0, 0 - cmp r4, 0x9 - bls _081CE394 - b _081CE4D0 -_081CE394: - lsls r0, r4, 2 - ldr r1, =_081CE3A4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081CE3A4: - .4byte _081CE3CC - .4byte _081CE3D0 - .4byte _081CE3DA - .4byte _081CE3F0 - .4byte _081CE3F8 - .4byte _081CE418 - .4byte _081CE428 - .4byte _081CE438 - .4byte _081CE44E - .4byte _081CE468 -_081CE3CC: - movs r0, 0 - b _081CE3D2 -_081CE3D0: - movs r0, 0x1 -_081CE3D2: - bl sub_81CD548 -_081CE3D6: - movs r0, 0x1 - b _081CE4D2 -_081CE3DA: - movs r0, 0x2 - bl sub_81CD548 - ldr r1, =0x000028e0 - adds r0, r6, r1 - bl sub_81D3520 - b _081CE3D6 - .pool -_081CE3F0: - adds r0, r2, 0 - bl sub_81D2074 - b _081CE3D6 -_081CE3F8: - ldr r1, =0x00001814 - adds r0, r6, r1 - bl sub_81D3150 - lsls r0, 24 - cmp r0, 0 - bne _081CE4CC - bl sub_81CDC84 - lsls r0, 24 - lsrs r0, 24 - bl sub_81CED30 - b _081CE3D6 - .pool -_081CE418: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0 - b _081CE446 -_081CE428: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x1 - b _081CE446 -_081CE438: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x2 -_081CE446: - movs r2, 0 - bl sub_81CE754 - b _081CE3D6 -_081CE44E: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x3 - movs r2, 0 - bl sub_81CE754 - cmp r0, 0x1 - beq _081CE3D6 - b _081CE4CC -_081CE468: - bl sub_81CDC70 - adds r2, r0, 0 - ldr r0, =0x00001814 - adds r1, r6, r0 - adds r0, r2, 0 - bl sub_81D3178 - lsls r0, 24 - cmp r0, 0 - bne _081CE4CC - ldr r1, =0x000028e0 - adds r0, r6, r1 - bl sub_81D3464 - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE4A0 - bl sub_81CDC60 - adds r4, r0, 0 - bl sub_81CDC50 - lsls r4, 16 - lsls r0, 16 - cmp r4, r0 - beq _081CE3D6 -_081CE4A0: - ldr r0, =0x000028e0 - adds r5, r6, r0 - ldr r1, =0x00001816 - adds r0, r6, r1 - ldrb r4, [r0] - bl sub_81CDDB0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81D3480 - b _081CE3D6 - .pool -_081CE4CC: - movs r0, 0x2 - b _081CE4D2 -_081CE4D0: - movs r0, 0x4 -_081CE4D2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81CE37C - - thumb_func_start sub_81CE4D8 -sub_81CE4D8: @ 81CE4D8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r5, r0, 0 - cmp r4, 0x8 - bhi _081CE5DC - lsls r0, r4, 2 - ldr r1, =_081CE4F8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081CE4F8: - .4byte _081CE51C - .4byte _081CE520 - .4byte _081CE524 - .4byte _081CE52E - .4byte _081CE53E - .4byte _081CE54E - .4byte _081CE55E - .4byte _081CE576 - .4byte _081CE592 -_081CE51C: - movs r0, 0 - b _081CE526 -_081CE520: - movs r0, 0x1 - b _081CE526 -_081CE524: - movs r0, 0x2 -_081CE526: - bl sub_81CD548 - movs r0, 0x1 - b _081CE5DE -_081CE52E: - bl sub_81CDC84 - lsls r0, 24 - lsrs r0, 24 - bl sub_81CED30 - movs r0, 0x1 - b _081CE5DE -_081CE53E: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0 - b _081CE56C -_081CE54E: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x1 - b _081CE56C -_081CE55E: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x2 -_081CE56C: - movs r2, 0 - bl sub_81CE754 - movs r0, 0x1 - b _081CE5DE -_081CE576: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x3 - movs r2, 0 - bl sub_81CE754 - cmp r0, 0x1 - bne _081CE5D8 - movs r0, 0x1 - b _081CE5DE -_081CE592: - bl sub_81CDC70 - ldr r2, =0x00001814 - adds r1, r5, r2 - bl sub_81D3178 - lsls r0, 24 - cmp r0, 0 - bne _081CE5D8 - ldr r0, =0x000028e0 - adds r4, r5, r0 - adds r0, r4, 0 - bl sub_81D3464 - ldr r1, =0x00001816 - adds r0, r5, r1 - ldrb r5, [r0] - bl sub_81CDDB0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D3480 - movs r0, 0x1 - b _081CE5DE - .pool -_081CE5D8: - movs r0, 0x2 - b _081CE5DE -_081CE5DC: - movs r0, 0x4 -_081CE5DE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81CE4D8 - - thumb_func_start sub_81CE5E4 -sub_81CE5E4: @ 81CE5E4 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - adds r5, r0, 0 - cmp r4, 0x7 - bhi _081CE6B2 - lsls r0, r4, 2 - ldr r1, =_081CE604 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081CE604: - .4byte _081CE624 - .4byte _081CE628 - .4byte _081CE632 - .4byte _081CE648 - .4byte _081CE660 - .4byte _081CE670 - .4byte _081CE680 - .4byte _081CE696 -_081CE624: - movs r0, 0 - b _081CE62A -_081CE628: - movs r0, 0x1 -_081CE62A: - bl sub_81CD548 -_081CE62E: - movs r0, 0x1 - b _081CE6B4 -_081CE632: - movs r0, 0x2 - bl sub_81CD548 - ldr r1, =0x000028e0 - adds r0, r5, r1 - bl sub_81D3520 - b _081CE62E - .pool -_081CE648: - bl sub_81CDC70 - ldr r2, =0x00001814 - adds r1, r5, r2 - bl sub_81D31A4 - lsls r0, 24 - cmp r0, 0 - beq _081CE62E - b _081CE6AE - .pool -_081CE660: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0 - b _081CE68E -_081CE670: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x1 - b _081CE68E -_081CE680: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x2 -_081CE68E: - movs r2, 0 - bl sub_81CE754 - b _081CE62E -_081CE696: - bl sub_81CDC84 - adds r1, r0, 0 - lsls r1, 24 - asrs r1, 8 - lsrs r1, 16 - movs r0, 0x3 - movs r2, 0 - bl sub_81CE754 - cmp r0, 0x1 - beq _081CE62E -_081CE6AE: - movs r0, 0x2 - b _081CE6B4 -_081CE6B2: - movs r0, 0x4 -_081CE6B4: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81CE5E4 - - thumb_func_start sub_81CE6BC -sub_81CE6BC: @ 81CE6BC - push {lr} - cmp r0, 0x1 - beq _081CE6E6 - cmp r0, 0x1 - bgt _081CE6CC - cmp r0, 0 - beq _081CE6D2 - b _081CE6FA -_081CE6CC: - cmp r0, 0x2 - beq _081CE6EE - b _081CE6FA -_081CE6D2: - bl sub_81CDD7C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0xB0 - movs r2, 0x20 - bl sub_811FAA4 -_081CE6E2: - movs r0, 0x1 - b _081CE6FC -_081CE6E6: - movs r0, 0x5 - bl sub_81C7BA4 - b _081CE6E2 -_081CE6EE: - bl IsDma3ManagerBusyWithBgCopy_ - cmp r0, 0x1 - bne _081CE6E2 - movs r0, 0x2 - b _081CE6FC -_081CE6FA: - movs r0, 0x4 -_081CE6FC: - pop {r1} - bx r1 - thumb_func_end sub_81CE6BC - - thumb_func_start sub_81CE700 -sub_81CE700: @ 81CE700 - push {lr} - cmp r0, 0x1 - beq _081CE71E - cmp r0, 0x1 - bgt _081CE710 - cmp r0, 0 - beq _081CE716 - b _081CE732 -_081CE710: - cmp r0, 0x2 - beq _081CE726 - b _081CE732 -_081CE716: - bl sub_811FAF8 -_081CE71A: - movs r0, 0x1 - b _081CE734 -_081CE71E: - movs r0, 0x4 - bl sub_81C7BA4 - b _081CE71A -_081CE726: - bl IsDma3ManagerBusyWithBgCopy_ - cmp r0, 0x1 - bne _081CE71A - movs r0, 0x2 - b _081CE734 -_081CE732: - movs r0, 0x4 -_081CE734: - pop {r1} - bx r1 - thumb_func_end sub_81CE700 - - thumb_func_start sub_81CE738 -sub_81CE738: @ 81CE738 - push {lr} - lsls r1, 16 - lsrs r1, 16 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r1, =gText_Number2 - bl StringCopy - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CE738 - - thumb_func_start sub_81CE754 -sub_81CE754: @ 81CE754 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r4, r0, 24 - adds r7, r4, 0 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - lsls r2, 24 - lsrs r5, r2, 24 - movs r0, 0xC - bl GetSubstructPtr - adds r6, r0, 0 - cmp r4, 0x1 - beq _081CE7B8 - cmp r4, 0x1 - bgt _081CE782 - cmp r4, 0 - beq _081CE78E - b _081CE924 -_081CE782: - cmp r4, 0x2 - beq _081CE800 - cmp r4, 0x3 - bne _081CE78C - b _081CE89C -_081CE78C: - b _081CE924 -_081CE78E: - movs r1, 0xC1 - lsls r1, 5 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE7A6 - b _081CE924 -_081CE7A6: - ldr r1, =0x00001821 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - b _081CE924 - .pool -_081CE7B8: - bl sub_81CDC60 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81CDC50 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r4, r0 - bne _081CE7DA - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CE7DA - b _081CE924 -_081CE7DA: - mov r1, r8 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_81CDD04 - adds r2, r0, 0 - movs r1, 0xC1 - lsls r1, 5 - adds r0, r6, r1 - ldrb r0, [r0] - str r7, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - b _081CE924 -_081CE800: - bl sub_81CDD5C - adds r7, r0, 0 - cmp r7, 0x1 - beq _081CE80C - b _081CE924 -_081CE80C: - mov r1, r8 - lsls r0, r1, 24 - lsrs r0, 24 - bl sub_81CDD24 - adds r2, r0, 0 - movs r1, 0xC1 - lsls r1, 5 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0x11 - str r1, [sp] - movs r4, 0 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - add r1, sp, 0xC - movs r0, 0xFC - strb r0, [r1] - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x8 - strb r0, [r1, 0x2] - adds r0, r1, 0 - strb r4, [r0, 0x3] - movs r0, 0x9 - strb r0, [r1, 0x4] - mov r5, sp - adds r5, 0x11 - ldr r1, =gText_Number2 - adds r0, r5, 0 - bl StringCopy - ldr r0, =0x00001821 - adds r6, r0 - ldrb r0, [r6] - str r7, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - movs r3, 0x4 - bl AddTextPrinterParameterized - bl sub_81CDD48 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldrb r0, [r6] - str r7, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - movs r3, 0x1C - bl AddTextPrinterParameterized - b _081CE924 - .pool -_081CE89C: - ldr r1, =0x00002908 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081CE8B0 - cmp r0, 0x1 - beq _081CE8EC - b _081CE924 - .pool -_081CE8B0: - cmp r5, 0 - beq _081CE8C4 - movs r1, 0xC1 - lsls r1, 5 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - b _081CE8D2 -_081CE8C4: - movs r1, 0xC1 - lsls r1, 5 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram -_081CE8D2: - bl sub_81CDD5C - cmp r0, 0x1 - bne _081CE910 - ldr r0, =0x00002908 - adds r1, r6, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081CE924 - .pool -_081CE8EC: - cmp r5, 0 - beq _081CE904 - ldr r1, =0x00001821 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - b _081CE910 - .pool -_081CE904: - ldr r1, =0x00001821 - adds r0, r6, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram -_081CE910: - ldr r0, =0x00002908 - adds r1, r6, r0 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _081CE926 - .pool -_081CE924: - movs r0, 0 -_081CE926: - add sp, 0x2C - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81CE754 - - thumb_func_start sub_81CE934 -sub_81CE934: @ 81CE934 - push {r4,lr} - movs r0, 0xC - bl GetSubstructPtr - adds r4, r0, 0 - ldr r1, =0x00001822 - adds r0, r4, r1 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =0x00001823 - adds r4, r0 - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CE934 - - thumb_func_start sub_81CE964 -sub_81CE964: @ 81CE964 - push {r4,r5,lr} - adds r5, r0, 0 - movs r0, 0x2E - ldrsh r4, [r5, r0] - bl sub_81CDC60 - lsls r0, 16 - lsrs r0, 16 - cmp r4, r0 - bne _081CE982 - adds r0, r5, 0 - movs r1, 0 - bl StartSpriteAnim - b _081CE98A -_081CE982: - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAnim -_081CE98A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81CE964 - - thumb_func_start sub_81CE990 -sub_81CE990: @ 81CE990 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_81CDC60 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81CDC50 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r4, r0 - bne _081CE9B0 - movs r0, 0x65 - b _081CE9B2 -_081CE9B0: - movs r0, 0x66 -_081CE9B2: - bl IndexOfSpritePaletteTag - lsls r0, 4 - ldrb r2, [r5, 0x5] - movs r1, 0xF - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81CE990 - - thumb_func_start sub_81CE9C8 -sub_81CE9C8: @ 81CE9C8 - push {r4,lr} - adds r4, r0, 0 - bl sub_81CDD7C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81CE9C8 - - thumb_func_start sub_81CE9E4 -sub_81CE9E4: @ 81CE9E4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x58 - movs r0, 0xC - bl GetSubstructPtr - adds r6, r0, 0 - add r4, sp, 0x20 - add r5, sp, 0x38 - mov r0, sp - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_81D321C - bl sub_81CDD5C - adds r7, r4, 0 - mov r10, r5 - cmp r0, 0x1 - bne _081CEA78 - ldr r1, =0x00001824 - adds r0, r6, r1 - movs r2, 0x6A - strh r2, [r0] - ldr r3, =0x00001826 - adds r1, r6, r3 - strh r2, [r1] - bl sub_811F90C - bl sub_811FA90 - ldr r2, =gUnknown_08623338 - movs r0, 0x69 - movs r1, 0x69 - bl sub_811FF94 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - movs r1, 0xC0 - strh r1, [r0, 0x20] - movs r1, 0x20 - strh r1, [r0, 0x22] - ldr r1, =sub_81CE9C8 - str r1, [r0, 0x1C] - ldr r2, =0x000028dc - adds r1, r6, r2 - str r0, [r1] - movs r0, 0x69 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_81C7990 - add r3, sp, 0x50 - mov r8, r3 - b _081CEBC6 - .pool -_081CEA78: - mov r0, sp - bl LoadSpriteSheets - mov r0, r10 - bl Pokenav_AllocAndLoadPalettes - movs r4, 0 - add r0, sp, 0x50 - mov r8, r0 - b _081CEAE8 -_081CEA8C: - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 18 - movs r1, 0x80 - lsls r1, 12 - adds r2, r1 - asrs r2, 16 - adds r0, r7, 0 - movs r1, 0xE2 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x40 - beq _081CEAD8 - ldr r2, =0x00001806 - adds r0, r6, r2 - adds r0, r4 - strb r3, [r0] - ldr r2, =gSprites - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - adds r1, r0, r2 - strh r4, [r1, 0x2E] - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_81CE964 - str r1, [r0] - b _081CEAE2 - .pool -_081CEAD8: - ldr r3, =0x00001806 - adds r0, r6, r3 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] -_081CEAE2: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_081CEAE8: - bl sub_81CDC50 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r4, r0 - blt _081CEA8C - movs r0, 0x67 - strh r0, [r7] - ldr r0, =SpriteCallbackDummy - str r0, [r7, 0x14] - cmp r4, 0x5 - bhi _081CEB5C - ldr r0, =0x00001806 - adds r5, r6, r0 - ldr r1, =gSprites - mov r9, r1 -_081CEB0A: - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 18 - movs r3, 0x80 - lsls r3, 12 - adds r2, r3 - asrs r2, 16 - adds r0, r7, 0 - movs r1, 0xE6 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x40 - beq _081CEB4C - adds r0, r5, r4 - strb r3, [r0] - lsls r1, r3, 4 - adds r1, r3 - lsls r1, 2 - add r1, r9 - ldrb r2, [r1, 0x3] - movs r0, 0x3F - ands r0, r2 - strb r0, [r1, 0x3] - b _081CEB52 - .pool -_081CEB4C: - adds r1, r5, r4 - movs r0, 0xFF - strb r0, [r1] -_081CEB52: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x5 - bls _081CEB0A -_081CEB5C: - movs r0, 0x66 - strh r0, [r7] - ldr r0, =sub_81CE990 - str r0, [r7, 0x14] - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 18 - movs r0, 0x80 - lsls r0, 12 - adds r2, r0 - asrs r2, 16 - adds r0, r7, 0 - movs r1, 0xDE - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x40 - beq _081CEBBC - ldr r1, =0x00001806 - adds r0, r6, r1 - adds r0, r4 - strb r3, [r0] - ldr r0, =gSprites - lsls r2, r3, 4 - adds r2, r3 - lsls r2, 2 - adds r2, r0 - ldrb r3, [r2, 0x1] - movs r1, 0x3F - adds r0, r1, 0 - ands r0, r3 - movs r3, 0x40 - orrs r0, r3 - strb r0, [r2, 0x1] - ldrb r0, [r2, 0x3] - ands r1, r0 - movs r0, 0x80 - orrs r1, r0 - strb r1, [r2, 0x3] - b _081CEBC6 - .pool -_081CEBBC: - ldr r2, =0x00001806 - adds r0, r6, r2 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] -_081CEBC6: - mov r0, r8 - mov r1, r10 - bl sub_81D32B0 - mov r0, r8 - bl LoadSpriteSheet - movs r0, 0 - mov r3, r10 - str r0, [r3, 0x8] - mov r0, r10 - bl Pokenav_AllocAndLoadPalettes - add sp, 0x58 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CE9E4 - - thumb_func_start sub_81CEBF4 -sub_81CEBF4: @ 81CEBF4 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_81CDD5C - cmp r0, 0x1 - bne _081CEC28 - ldr r1, =0x000028dc - adds r0, r5, r1 - ldr r0, [r0] - bl DestroySprite - movs r0, 0x6A - bl FreeSpriteTilesByTag - movs r0, 0x69 - bl FreeSpriteTilesByTag - movs r0, 0x6A - bl FreeSpritePaletteByTag - movs r0, 0x69 - bl FreeSpritePaletteByTag - b _081CEC68 - .pool -_081CEC28: - movs r4, 0 -_081CEC2A: - ldr r1, =0x00001806 - adds r0, r5, r1 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _081CEC2A - movs r0, 0x65 - bl FreeSpriteTilesByTag - movs r0, 0x66 - bl FreeSpriteTilesByTag - movs r0, 0x67 - bl FreeSpriteTilesByTag - movs r0, 0x65 - bl FreeSpritePaletteByTag - movs r0, 0x66 - bl FreeSpritePaletteByTag -_081CEC68: - ldr r0, =0x00001816 - adds r1, r5, r0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _081CEC8E - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - movs r0, 0x64 - bl FreeSpriteTilesByTag - movs r0, 0x64 - bl FreeSpritePaletteByTag -_081CEC8E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CEBF4 - - thumb_func_start sub_81CECA0 -sub_81CECA0: @ 81CECA0 - push {r4,lr} - movs r0, 0xC - bl GetSubstructPtr - adds r4, r0, 0 - movs r1, 0xC1 - lsls r1, 5 - adds r0, r4, r1 - ldrb r0, [r0] - bl RemoveWindow - bl sub_81CDD5C - cmp r0, 0x1 - bne _081CECEC - ldr r1, =0x00001821 - adds r0, r4, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r1, =0x00001822 - adds r0, r4, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r1, =0x00001823 - adds r0, r4, r1 - ldrb r0, [r0] - bl RemoveWindow - b _081CECF0 - .pool -_081CECEC: - bl sub_81C7FDC -_081CECF0: - movs r1, 0x8A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - adds r0, r4, 0 - bl sub_81CEBF4 - bl sub_81CEE68 - movs r0, 0xC - bl FreePokenavSubstruct - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81CECA0 - - thumb_func_start sub_81CED10 -sub_81CED10: @ 81CED10 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0xC - bl GetSubstructPtr - ldr r1, =0x00001814 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x26 - strh r0, [r4, 0x20] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CED10 - - thumb_func_start sub_81CED30 -sub_81CED30: @ 81CED30 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x28 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0xC - bl GetSubstructPtr - mov r8, r0 - ldr r7, =0x00001816 - add r7, r8 - ldrb r0, [r7] - cmp r0, 0xFF - bne _081CEDFC - add r5, sp, 0x18 - add r4, sp, 0x20 - adds r0, r5, 0 - mov r1, sp - adds r2, r4, 0 - bl sub_81D31D0 - adds r0, r6, 0 - bl sub_81CDCB4 - str r0, [sp, 0x18] - adds r0, r6, 0 - bl sub_81CDCD4 - str r0, [sp, 0x20] - adds r0, r4, 0 - bl LoadSpritePalette - lsls r0, 24 - lsrs r0, 24 - ldr r4, =0x00001818 - add r4, r8 - strh r0, [r4] - adds r0, r5, 0 - bl LoadSpriteSheet - ldr r5, =0x0000181a - add r5, r8 - strh r0, [r5] - mov r0, sp - movs r1, 0x26 - movs r2, 0x68 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - strb r0, [r7] - cmp r0, 0x40 - bne _081CEDBC - movs r0, 0x64 - bl FreeSpriteTilesByTag - movs r0, 0x64 - bl FreeSpritePaletteByTag - movs r0, 0xFF - strb r0, [r7] - b _081CEE26 - .pool -_081CEDBC: - strb r0, [r7] - ldr r2, =gSprites - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_81CED10 - str r1, [r0] - ldr r1, =0x0000181c - add r1, r8 - ldrh r0, [r5] - lsls r0, 5 - ldr r2, =0x06010000 - adds r0, r2 - str r0, [r1] - ldrh r0, [r4] - lsls r0, 4 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - strh r0, [r4] - b _081CEE26 - .pool -_081CEDFC: - adds r0, r6, 0 - bl sub_81CDCB4 - ldr r1, =0x0000181c - add r1, r8 - ldr r2, [r1] - ldr r1, =0x040000d4 - str r0, [r1] - str r2, [r1, 0x4] - ldr r0, =0x80000400 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r0, r6, 0 - bl sub_81CDCD4 - ldr r1, =0x00001818 - add r1, r8 - ldrh r1, [r1] - movs r2, 0x20 - bl LoadPalette -_081CEE26: - add sp, 0x28 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CED30 - - thumb_func_start sub_81CEE44 -sub_81CEE44: @ 81CEE44 - push {r4,lr} - bl sub_81CDC70 - adds r4, r0, 0 - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - adds r0, r4, 0 - bl sub_81D2108 - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81CEE44 - - thumb_func_start sub_81CEE68 -sub_81CEE68: @ 81CEE68 - push {lr} - bl SetPokenavVBlankCallback - pop {r0} - bx r0 - thumb_func_end sub_81CEE68 - - thumb_func_start sub_81CEE74 -sub_81CEE74: @ 81CEE74 - push {lr} - lsls r0, 24 - cmp r0, 0 - beq _081CEE84 - movs r0, 0x2 - bl ShowBg - b _081CEE8A -_081CEE84: - movs r0, 0x2 - bl HideBg -_081CEE8A: - pop {r0} - bx r0 - thumb_func_end sub_81CEE74 - - thumb_func_start sub_81CEE90 -sub_81CEE90: @ 81CEE90 - push {r4,lr} - bl sub_81CDC70 - adds r4, r0, 0 - bl sub_81CDC84 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_030012BC - strb r0, [r1] - adds r1, r4, 0 - adds r1, 0x50 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 2 - adds r2, 0x14 - adds r2, r4, r2 - adds r0, r4, 0 - bl sub_81D1F84 - adds r0, r4, 0 - bl sub_81D2074 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81CEE90 - - thumb_func_start sub_81CEEC8 -sub_81CEEC8: @ 81CEEC8 - push {r4,r5,lr} - bl sub_81CDC70 - adds r5, r0, 0 - bl sub_81CDD5C - cmp r0, 0 - bne _081CEEF0 - bl sub_81CDC60 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81CDC50 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x1 - cmp r4, r0 - beq _081CEF0C -_081CEEF0: - bl sub_81CDC84 - lsls r0, 24 - asrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, 0x14 - adds r1, r5, r1 - adds r2, r5, 0 - adds r2, 0x50 - adds r0, r5, 0 - bl sub_81D1F84 -_081CEF0C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81CEEC8 - - thumb_func_start sub_81CEF14 -sub_81CEF14: @ 81CEF14 - push {r4,lr} - movs r0, 0xC - bl GetSubstructPtr - adds r4, r0, 0 - bl sub_81CDD5C - cmp r0, 0x1 - beq _081CEF2A - movs r0, 0 - b _081CEF30 -_081CEF2A: - ldr r1, =0x00001828 - adds r0, r4, r1 - ldrb r0, [r0] -_081CEF30: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CEF14 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokenav_unk_8.s b/asm/pokenav_unk_8.s index 5bba161bb..6fcf21374 100644 --- a/asm/pokenav_unk_8.s +++ b/asm/pokenav_unk_8.s @@ -5,219 +5,7 @@ @ File centered around AllocSubstruct(7) - thumb_func_start sub_81CEF3C -sub_81CEF3C: @ 81CEF3C - push {r4,lr} - movs r0, 0x7 - movs r1, 0x24 - bl AllocSubstruct - adds r4, r0, 0 - cmp r4, 0 - beq _081CEF90 - ldr r1, =0x000006ac - movs r0, 0x12 - bl AllocSubstruct - str r0, [r4, 0x20] - cmp r0, 0 - beq _081CEF90 - ldr r0, =sub_81CF010 - str r0, [r4] - ldr r0, =sub_81CF11C - movs r1, 0x1 - bl CreateLoopedTask - str r0, [r4, 0x4] - movs r0, 0 - str r0, [r4, 0x18] - bl sub_81C76AC - ldr r1, =gUnknown_086233A0 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r4, 0x14] - movs r0, 0x1 - b _081CEF92 - .pool -_081CEF90: - movs r0, 0 -_081CEF92: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CEF3C - thumb_func_start sub_81CEF98 -sub_81CEF98: @ 81CEF98 - push {r4,lr} - movs r0, 0x7 - movs r1, 0x24 - bl AllocSubstruct - adds r4, r0, 0 - cmp r4, 0 - beq _081CEFD4 - movs r0, 0x12 - bl GetSubstructPtr - str r0, [r4, 0x20] - ldr r0, =sub_81CF030 - str r0, [r4] - movs r0, 0x1 - str r0, [r4, 0x18] - bl sub_81C76AC - ldr r1, =gUnknown_086233A0 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r4, 0x14] - movs r0, 0x1 - b _081CEFD6 - .pool -_081CEFD4: - movs r0, 0 -_081CEFD6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81CEF98 - - thumb_func_start sub_81CEFDC -sub_81CEFDC: @ 81CEFDC - push {lr} - movs r0, 0x7 - bl GetSubstructPtr - ldr r1, [r0] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end sub_81CEFDC - - thumb_func_start sub_81CEFF0 -sub_81CEFF0: @ 81CEFF0 - push {lr} - movs r0, 0x7 - bl GetSubstructPtr - ldr r0, [r0, 0x1C] - cmp r0, 0 - bne _081CF004 - movs r0, 0x12 - bl FreePokenavSubstruct -_081CF004: - movs r0, 0x7 - bl FreePokenavSubstruct - pop {r0} - bx r0 - thumb_func_end sub_81CEFF0 - - thumb_func_start sub_81CF010 -sub_81CF010: @ 81CF010 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x4] - bl IsLoopedTaskActive - cmp r0, 0 - bne _081CF022 - ldr r0, =sub_81CF030 - str r0, [r4] -_081CF022: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CF010 - - thumb_func_start sub_81CF030 -sub_81CF030: @ 81CF030 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r2, =gMain - ldrh r1, [r2, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081CF048 - movs r0, 0x1 - b _081CF0A6 - .pool -_081CF048: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081CF054 - movs r0, 0x2 - b _081CF0A6 -_081CF054: - ldrh r1, [r2, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _081CF062 - movs r0, 0x3 - b _081CF0A6 -_081CF062: - movs r0, 0x10 - ands r0, r1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _081CF072 - movs r0, 0x4 - b _081CF0A6 -_081CF072: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081CF088 - str r2, [r4, 0x1C] - ldr r0, =sub_81CF0B0 - str r0, [r4] - movs r0, 0x5 - b _081CF0A6 - .pool -_081CF088: - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _081CF096 - movs r0, 0 - b _081CF0A6 -_081CF096: - bl GetSelectedMatchCall - ldr r1, [r4, 0x20] - strh r0, [r1, 0x2] - str r5, [r4, 0x1C] - ldr r0, =sub_81CF0B8 - str r0, [r4] - movs r0, 0x6 -_081CF0A6: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81CF030 - - thumb_func_start sub_81CF0B0 -sub_81CF0B0: @ 81CF0B0 - ldr r0, =0x000186a3 - bx lr - .pool - thumb_func_end sub_81CF0B0 - - thumb_func_start sub_81CF0B8 -sub_81CF0B8: @ 81CF0B8 - ldr r0, =0x000186a9 - bx lr - .pool - thumb_func_end sub_81CF0B8 - - thumb_func_start sub_81CF0C0 -sub_81CF0C0: @ 81CF0C0 - push {lr} - movs r0, 0x7 - bl GetSubstructPtr - ldr r0, [r0, 0x18] - pop {r1} - bx r1 - thumb_func_end sub_81CF0C0 thumb_func_start sub_81CF0D0 sub_81CF0D0: @ 81CF0D0 diff --git a/include/battle_message.h b/include/battle_message.h index 5d811fe69..88ccbb90f 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -154,7 +154,7 @@ { \ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \ textVar[1] = B_BUFF_MOVE; \ - textVar[2] = move; \ + textVar[2] = (move & 0xFF); \ textVar[3] = (move & 0xFF00) >> 8; \ textVar[4] = B_BUFF_EOS; \ } diff --git a/include/graphics.h b/include/graphics.h index 50bb5774e..d77e8e4c7 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4006,6 +4006,12 @@ extern const u32 gBerryPic_Enigma[]; extern const u32 gBerryPalette_Enigma[]; //pokenav +extern const u16 gPokenavCondition_Pal[]; +extern const u32 gPokenavCondition_Gfx[]; +extern const u32 gPokenavCondition_Tilemap[]; +extern const u16 gPokenavOptions_Tilemap[]; +extern const u32 gPokenavOptions_Gfx[]; +extern const u16 gPokenavOptions_Pal[]; extern const u8 gPokenavConditionMarker_Gfx[]; extern const u16 gPokenavConditionMarker_Pal[]; extern const u16 gPokenavLeftHeader_Pal[]; diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 014ee2585..14a246468 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -34,6 +34,7 @@ void sub_81D1EC0(void); void sub_81D1D04(u8 a0); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); +void sub_81D21DC(u8 bg); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0); bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0); diff --git a/include/pokemon.h b/include/pokemon.h index 090a21f18..07bcff2e3 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -563,7 +563,7 @@ void PlayBattleBGM(void); void PlayMapChosenOrBattleBGM(u16 songId); void sub_806E694(u16 songId); const u32 *GetMonFrontSpritePal(struct Pokemon *mon); -const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality); +const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality); const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon); const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality); bool32 IsHMMove2(u16 move); diff --git a/include/pokenav.h b/include/pokenav.h index 203d14015..d254858ac 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -3,9 +3,22 @@ #include "bg.h" #include "main.h" +#include "pokemon_storage_system.h" typedef u32 (*LoopedTask)(s32 state); +struct PokenavSub18 +{ + u16 unk0; + u16 unk2; + struct + { + u8 boxId; + u8 monId; + u16 unk6; + } unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE]; +}; + // Return values of LoopedTask functions. #define LT_INC_AND_PAUSE 0 #define LT_INC_AND_CONTINUE 1 @@ -43,7 +56,7 @@ enum // pokenav.c void sub_81C7694(u32); -u16 sub_81C76AC(void); +u32 sub_81C76AC(void); void CB2_InitPokeNav(void); u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority); @@ -184,4 +197,22 @@ void sub_81CC62C(int); u32 sub_81CC65C(void); void sub_81CC670(void); -#endif //GUARD_POKENAV_H +// pokenav_unk_6.c +bool32 sub_81CD3C4(void); +bool32 sub_81CDD5C(void); +struct UnknownStruct_81D1ED4 *sub_81CDC70(void); +u16 sub_81CDC60(void); +u16 sub_81CDC50(void); +u8 sub_81CDDB0(void); +bool32 sub_81CD548(u8 arg0); +u8 sub_81CDD7C(void); +u8 *sub_81CDD04(u8 id); +u8 *sub_81CDD24(u8 id); +u16 sub_81CDD48(void); +void *sub_81CDCB4(u8 id); +void *sub_81CDCD4(u8 id); + +// pokenav_unk_7.c +u8 sub_81CEF14(void); + +#endif // GUARD_POKENAV_H diff --git a/include/strings.h b/include/strings.h index 41310668d..5d8d2eb79 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1022,6 +1022,7 @@ extern const u8 gText_PokenavMatchCall_CheckTrainerButtons[]; extern const u8 gText_PokenavRibbons_MonListButtons[]; extern const u8 gText_PokenavRibbons_RibbonListButtons[]; extern const u8 gText_PokenavRibbons_RibbonCheckButtons[]; +extern const u8 gText_Number2[]; extern const u8 gUnknown_085EAD37[]; extern const u8 gUnknown_085EAD41[]; diff --git a/ld_script.txt b/ld_script.txt index d6d904a5d..0b416109d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -316,8 +316,9 @@ SECTIONS { src/pokenav_unk_3.o(.text*); src/pokenav_unk_4.o(.text*); src/pokenav_unk_5.o(.text*); - asm/pokenav_unk_6.o(.text*); - asm/pokenav_unk_7.o(.text*); + src/pokenav_unk_6.o(.text*); + src/pokenav_unk_7.o(.text*); + src/pokenav_unk_8.o(.text*); asm/pokenav_unk_8.o(.text*); asm/pokenav_unk_9.o(.text*); asm/pokenav_unk_10.o(.text*); diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index c6058204d..a667daecf 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -2037,7 +2037,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority gMonSpritesGfxPtr->field_17C = AllocZeroed(0x2000); if (!isBackpic) { - LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->field_17C, @@ -2053,7 +2053,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority } else { - LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20); if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0) LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->field_17C, diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d6b1b6dee..c98713fc3 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -534,7 +534,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE) lzPaletteData = GetMonFrontSpritePal(mon); else - lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); LZDecompressWram(lzPaletteData, gDecompressionBuffer); LoadPalette(gDecompressionBuffer, paletteOffset, 0x20); @@ -597,7 +597,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE) lzPaletteData = GetMonFrontSpritePal(mon); else - lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality); LZDecompressWram(lzPaletteData, gDecompressionBuffer); LoadPalette(gDecompressionBuffer, paletteOffset, 0x20); @@ -918,7 +918,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); DmaCopy32(3, src, dst, 0x800); paletteOffset = 0x100 + battlerAtk * 16; - lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); LZDecompressWram(lzPaletteData, gDecompressionBuffer); LoadPalette(gDecompressionBuffer, paletteOffset, 32); diff --git a/src/bg.c b/src/bg.c index 43570f5eb..1678f4023 100644 --- a/src/bg.c +++ b/src/bg.c @@ -220,7 +220,7 @@ static void ShowBgInternal(u8 bg) (sGpuBgConfigs.configs[bg].wraparound << 13) | (sGpuBgConfigs.configs[bg].screenSize << 14); - SetGpuReg((bg << 1) + 0x8, value); + SetGpuReg((bg << 1) + REG_OFFSET_BG0CNT, value); sGpuBgConfigs.bgVisibilityAndMode |= 1 << (bg + 8); sGpuBgConfigs.bgVisibilityAndMode &= DISPCNT_ALL_BG_AND_MODE_BITS; diff --git a/src/contest.c b/src/contest.c index 869300a92..662a27060 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2973,7 +2973,7 @@ static u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index) else HandleLoadSpecialPokePic_DontHandleDeoxys(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality); - LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20); + LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20); SetMultiuseSpriteTemplateToPokemon(species, 0); spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30); diff --git a/src/contest_painting.c b/src/contest_painting.c index b7fd3cce7..820505b6e 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -362,7 +362,7 @@ static void VBlankCB_ContestPainting(void) void sub_81302E8(u16 species, u8 arg1) { - const void *pal = GetFrontSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality); + const void *pal = GetMonSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality); LZDecompressVram(pal, gContestPaintingMonPalette); if (!arg1) { diff --git a/src/gpu_regs.c b/src/gpu_regs.c index e5ff4fe8f..3bcc4fd93 100644 --- a/src/gpu_regs.c +++ b/src/gpu_regs.c @@ -10,9 +10,9 @@ static u8 sGpuRegBuffer[GPU_REG_BUF_SIZE]; static u8 sGpuRegWaitingList[GPU_REG_BUF_SIZE]; -static bool8 sGpuRegBufferLocked; -static bool8 sShouldSyncRegIE; -static u16 sRegIE; +static volatile bool8 sGpuRegBufferLocked; +static volatile bool8 sShouldSyncRegIE; +static vu16 sRegIE; static void CopyBufferedValueToGpuReg(u8 regOffset); static void SyncRegIE(void); diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 34dd1fe2b..d33d53707 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1290,7 +1290,7 @@ void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL); LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE); - LZ77UnCompWram(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst); + LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst); } } diff --git a/src/pokedex.c b/src/pokedex.c index 2588e2b73..da3f06bf1 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -3855,7 +3855,7 @@ void blockset_load_palette_to_gpu(u8 taskId) otId = ((u16)gTasks[taskId].data[13] << 16) | (u16)gTasks[taskId].data[12]; personality = ((u16)gTasks[taskId].data[15] << 16) | (u16)gTasks[taskId].data[14]; paletteNum = gSprites[gTasks[taskId].data[3]].oam.paletteNum; - lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality); + lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality); LoadCompressedPalette(lzPaletteData, 0x100 | paletteNum * 16, 32); DestroyTask(taskId); } diff --git a/src/pokemon.c b/src/pokemon.c index 6ad47d346..2485caa50 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6321,10 +6321,10 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon) u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality); + return GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality); } -const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality) +const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality) { u32 shinyValue; diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 61f899801..5272b3292 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -2248,7 +2248,7 @@ void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon spriteSheet.size = 0x800; LoadSpriteSheet(&spriteSheet); - spritePalette.data = GetFrontSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality); + spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality); spritePalette.tag = multiplayerId; LoadCompressedSpritePalette(&spritePalette); diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index c5cd71d15..59ec8f4f1 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -6827,7 +6827,7 @@ static void SetCursorMonData(void *pokemon, u8 mode) sPSSData->cursorMonLevel = GetLevelFromBoxMonExp(boxMon); sPSSData->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS); sPSSData->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); - sPSSData->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, otId, sPSSData->cursorMonPersonality); + sPSSData->cursorMonPalette = GetMonSpritePalFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, otId, sPSSData->cursorMonPersonality); gender = GetGenderFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); sPSSData->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM); } diff --git a/src/pokenav.c b/src/pokenav.c index be3826bed..132e4123b 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -318,7 +318,7 @@ void Task_RunLoopedTask_LinkMode(u8 taskId) if (sub_8087598()) return; - + task = (LoopedTask)GetWordTaskArg(taskId, 1); state = &gTasks[taskId].data[0]; action = task(*state); @@ -605,7 +605,7 @@ void sub_81C7694(u32 a0) gPokenavResources->fieldA = value; } -u16 sub_81C76AC(void) +u32 sub_81C76AC(void) { return gPokenavResources->fieldA; } diff --git a/src/pokenav_unk_6.c b/src/pokenav_unk_6.c new file mode 100644 index 000000000..638884d3f --- /dev/null +++ b/src/pokenav_unk_6.c @@ -0,0 +1,625 @@ +#include "global.h" +#include "data.h" +#include "decompress.h" +#include "main.h" +#include "menu_specialized.h" +#include "mon_markings.h" +#include "pokenav.h" +#include "pokemon.h" +#include "pokemon_storage_system.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "text.h" +#include "constants/songs.h" +#include "constants/species.h" + +struct PokenavSub11 +{ + u32 monPal[3][0x20]; + u8 fill[0x180]; + u32 monPicGfx[3][0x800]; + u8 unk6300; + s16 unk6302; + u32 (*unk6304)(struct PokenavSub11 *); + u8 fill2[0x6320 - 0x6308]; + u8 unk6320[3][24]; + u8 unk6368[3][64]; + struct UnknownStruct_81D1ED4 unk6428; + u8 unk6780[3]; + u8 unk6783[3]; + s8 unk6786; + s8 unk6787; + s8 unk6788; + s8 unk6789; + u8 unk678A; +}; + +void sub_81CD970(void); +void sub_81CD9F8(void); +u32 sub_81CD08C(struct PokenavSub11 *structPtr); +u32 sub_81CD19C(struct PokenavSub11 *structPtr); +u32 sub_81CD110(struct PokenavSub11 *structPtr); +u8 sub_81CD1E4(struct PokenavSub11 *structPtr); +u8 sub_81CD258(u8 arg0); +void sub_81CD824(s16 arg0, u8 arg1); +void sub_81CDA1C(s16 arg0, u8 arg1); +void sub_81CDB98(s16 arg0, u8 arg1); + +// code +bool32 sub_81CCFD8(void) +{ + struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11)); + + if (structPtr == NULL) + return FALSE; + + sub_81D1ED4(&structPtr->unk6428); + sub_81CD970(); + gKeyRepeatStartDelay = 20; + structPtr->unk6304 = sub_81CD08C; + return TRUE; +} + +bool32 sub_81CD024(void) +{ + struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11)); + + if (structPtr == NULL) + return FALSE; + + sub_81D1ED4(&structPtr->unk6428); + sub_81CD9F8(); + gKeyRepeatStartDelay = 20; + structPtr->unk6304 = sub_81CD08C; + return TRUE; +} + +u32 sub_81CD070(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + + return structPtr->unk6304(structPtr); +} + +u32 sub_81CD08C(struct PokenavSub11 *structPtr) +{ + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + u32 ret = sub_81CD1E4(structPtr); + + if (ret == 0) + { + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + structPtr->unk6304 = sub_81CD19C; + ret = 2; + } + else if (gMain.newKeys & A_BUTTON) + { + if (structPtr->unk6300 == 0) + { + if (unkPtr->unk2 == unkPtr->unk0 - 1) + { + PlaySE(SE_SELECT); + structPtr->unk6304 = sub_81CD19C; + ret = 2; + } + } + else + { + PlaySE(SE_SELECT); + ret = 5; + structPtr->unk6304 = sub_81CD110; + } + } + } + + return ret; +} + +u32 sub_81CD110(struct PokenavSub11 *structPtr) +{ + struct PokenavSub18 *unkPtr; + u8 markings; + u32 ret = 0, boxId, monId; + + if (!sub_811FBA4()) + { + structPtr->unk6783[structPtr->unk6786] = sub_81CEF14(); + unkPtr = GetSubstructPtr(18); + boxId = unkPtr->unk4[unkPtr->unk2].boxId; + monId = unkPtr->unk4[unkPtr->unk2].monId; + markings = structPtr->unk6783[structPtr->unk6786]; + + if (boxId == TOTAL_BOXES_COUNT) + SetMonData(&gPlayerParty[monId], MON_DATA_MARKINGS, &markings); + else + SetBoxMonDataAt(boxId, monId, MON_DATA_MARKINGS, &markings); + + structPtr->unk6304 = sub_81CD08C; + ret = 6; + } + + return ret; +} + +u32 sub_81CD19C(struct PokenavSub11 *structPtr) +{ + if (structPtr->unk6300 == 0) + return 0x186A2; + else + return 0x186AA; +} + +void sub_81CD1C0(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + if (structPtr->unk6300 == 0) + FreePokenavSubstruct(18); + + FreePokenavSubstruct(11); +} + +u8 sub_81CD1E4(struct PokenavSub11 *structPtr) +{ + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + u8 ret = 0; + + if (gMain.heldKeys & DPAD_UP) + { + if (structPtr->unk6300 == 0 || unkPtr->unk2 != 0) + { + PlaySE(SE_SELECT); + ret = sub_81CD258(1); + } + } + else if (gMain.heldKeys & DPAD_DOWN) + { + if (structPtr->unk6300 == 0 || unkPtr->unk2 < unkPtr->unk0 - 1) + { + PlaySE(SE_SELECT); + ret = sub_81CD258(0); + } + } + + return ret; +} + +u8 sub_81CD258(u8 arg0) +{ + u16 r7; + bool8 r6, r0; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + r7 = (arg0) ? structPtr->unk6788 : structPtr->unk6787; + sub_81D1F84(&structPtr->unk6428, structPtr->unk6428.unk14[structPtr->unk6786], structPtr->unk6428.unk14[r7]); + r6 = (unkPtr->unk2 != ((sub_81CDD5C() != 0) ? unkPtr->unk0 : unkPtr->unk0 - 1)); + if (arg0) + { + structPtr->unk6788 = structPtr->unk6787; + structPtr->unk6787 = structPtr->unk6786; + structPtr->unk6786 = r7; + structPtr->unk6789 = structPtr->unk6788; + + unkPtr->unk2 = (unkPtr->unk2 == 0) ? unkPtr->unk0 - 1 : unkPtr->unk2 - 1; + structPtr->unk6302 = (unkPtr->unk2 != 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1; + } + else + { + structPtr->unk6787 = structPtr->unk6788; + structPtr->unk6788 = structPtr->unk6786; + structPtr->unk6786 = r7; + structPtr->unk6789 = structPtr->unk6787; + + unkPtr->unk2 = (unkPtr->unk2 < unkPtr->unk0 - 1) ? unkPtr->unk2 + 1 : 0; + structPtr->unk6302 = (unkPtr->unk2 < unkPtr->unk0 - 1) ? unkPtr->unk2 + 1 : 0; + } + + r0 = (unkPtr->unk2 != ((sub_81CDD5C() != 0) ? unkPtr->unk0 : unkPtr->unk0 - 1)); + + if (!r6) + return 3; + else if (!r0) + return 4; + else + return 1; +} + +bool32 sub_81CD3C4(void) +{ + s32 var; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + switch (structPtr->unk678A) + { + case 0: + sub_81CD824(unkPtr->unk2, 0); + break; + case 1: + sub_81CDA1C(unkPtr->unk2, 0); + break; + case 2: + sub_81CDB98(unkPtr->unk2, 0); + break; + case 3: + if (unkPtr->unk0 == 1) + { + structPtr->unk6786 = 0; + structPtr->unk6787 = 0; + structPtr->unk6788 = 0; + structPtr->unk678A = 0; + return TRUE; + } + else + { + structPtr->unk6786 = 0; + structPtr->unk6787 = 1; + structPtr->unk6788 = 2; + } + break; + // These were probably ternaries just like cases 7-9, but couldn't match it any other way. + case 4: + var = unkPtr->unk2 + 1; + if (var >= unkPtr->unk0) + var = 0; + sub_81CD824(var, 1); + break; + case 5: + var = unkPtr->unk2 + 1; + if (var >= unkPtr->unk0) + var = 0; + sub_81CDA1C(var, 1); + break; + case 6: + var = unkPtr->unk2 + 1; + if (var >= unkPtr->unk0) + var = 0; + sub_81CDB98(var, 1); + break; + case 7: + sub_81CD824((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2); + break; + case 8: + sub_81CDA1C((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2); + break; + case 9: + sub_81CDB98((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2); + structPtr->unk678A = 0; + return TRUE; + } + + structPtr->unk678A++; + return FALSE; +} + +bool32 sub_81CD548(u8 arg0) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + + switch (arg0) + { + case 0: + sub_81CD824(structPtr->unk6302, structPtr->unk6789); + break; + case 1: + sub_81CDA1C(structPtr->unk6302, structPtr->unk6789); + break; + case 2: + sub_81CDB98(structPtr->unk6302, structPtr->unk6789); + return TRUE; + } + + return FALSE; +} + +u8 *sub_81CD5CC(u8 *dst, const u8 *src, s16 n) +{ + while (*src != EOS) + *dst++ = *src++, n--; + + while (n-- > 0) + *dst++ = CHAR_SPACE; + + *dst = EOS; + return dst; +} + +u8 *sub_81CD624(u8 *str, u16 id, bool8 arg3) +{ + u16 boxId, monId, gender, species, level, lvlDigits; + struct BoxPokemon *boxMon; + u8 *txtPtr, *str_; + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + boxId = unkPtr->unk4[id].boxId; + monId = unkPtr->unk4[id].monId; + *(str++) = EXT_CTRL_CODE_BEGIN; + *(str++) = 4; + *(str++) = 8; + *(str++) = 0; + *(str++) = 9; + + if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL)) + return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, 12); + + GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, str); + StringGetEnd10(str); + species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL); + if (boxId == TOTAL_BOXES_COUNT) + { + level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + gender = GetMonGender(&gPlayerParty[monId]); + } + else + { + boxMon = GetBoxedMonPtr(boxId, monId); + gender = GetBoxMonGender(boxMon); + level = GetLevelFromBoxMonExp(boxMon); + } + + if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(str, gSpeciesNames[species])) + gender = MON_GENDERLESS; + + str_ = str; // For some reason, a variable is needed to match. + while (*str_ != EOS) + *(str_++); + + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = 0x12; + *(str_++) = 0x3C; + switch (gender) + { + default: + *(str_++) = 0x77; + break; + case MON_MALE: + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = EXT_CTRL_CODE_COLOR; + *(str_++) = 4; + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = 3; + *(str_++) = 5; + *(str_++) = CHAR_MALE; + break; + case MON_FEMALE: + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = EXT_CTRL_CODE_COLOR; + *(str_++) = 6; + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = 3; + *(str_++) = 7; + *(str_++) = CHAR_FEMALE; + break; + } + + *(str_++) = EXT_CTRL_CODE_BEGIN; + *(str_++) = 4; + *(str_++) = 8; + *(str_++) = 0; + *(str_++) = 9; + *(str_++) = CHAR_SLASH; + *(str_++) = CHAR_SPECIAL_F9; + *(str_++) = 5; + txtPtr = str_; + str_ = ConvertIntToDecimalStringN(str_, level, STR_CONV_MODE_LEFT_ALIGN, 3); + lvlDigits = str_ - txtPtr; + *(str_++) = CHAR_SPACE; + if (!arg3) + { + lvlDigits = 3 - lvlDigits; + while (lvlDigits-- != 0) + *(str_++) = CHAR_SPACE; + } + + *str_ = EOS; + return str_; +} + +void sub_81CD824(s16 arg0, u8 arg1) +{ + u16 boxId, i; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + if (arg0 != (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1)) + { + sub_81CD624(structPtr->unk6368[arg1], arg0, FALSE); + boxId = unkPtr->unk4[arg0].boxId; + structPtr->unk6320[arg1][0] = EXT_CTRL_CODE_BEGIN; + structPtr->unk6320[arg1][1] = 4; + structPtr->unk6320[arg1][2] = 8; + structPtr->unk6320[arg1][3] = 0; + structPtr->unk6320[arg1][4] = 9; + if (boxId == TOTAL_BOXES_COUNT) + sub_81CD5CC(&structPtr->unk6320[arg1][5], gText_InParty, 8); + else + sub_81CD5CC(&structPtr->unk6320[arg1][5], GetBoxNamePtr(boxId), 8); + } + else + { + for (i = 0; i < 12; i++) + structPtr->unk6368[arg1][i] = CHAR_SPACE; + structPtr->unk6368[arg1][i] = EOS; + + for (i = 0; i < 8; i++) + structPtr->unk6320[arg1][i] = CHAR_SPACE; + structPtr->unk6320[arg1][i] = EOS; + } +} + +void sub_81CD970(void) +{ + u16 i, count; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = AllocSubstruct(18, sizeof(struct PokenavSub18)); + + structPtr->unk6300 = 0; + for (i = 0, count = 0; i < CalculatePlayerPartyCount(); i++) + { + if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) + { + unkPtr->unk4[count].boxId = TOTAL_BOXES_COUNT; + unkPtr->unk4[count].monId = i; + unkPtr->unk4[count].unk6 = 0; + count++; + } + } + + unkPtr->unk4[count].boxId = 0; + unkPtr->unk4[count].monId = 0; + unkPtr->unk4[count].unk6 = 0; + unkPtr->unk2 = 0; + unkPtr->unk0 = count + 1; + structPtr->unk678A = 0; +} + +void sub_81CD9F8(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + structPtr->unk6300 = 1; + structPtr->unk678A = 0; +} + +void sub_81CDA1C(s16 arg0, u8 arg1) +{ + u16 boxId, monId, i; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + if (arg0 != (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1)) + { + boxId = unkPtr->unk4[arg0].boxId; + monId = unkPtr->unk4[arg0].monId; + structPtr->unk6428.unk0[arg1][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL); + structPtr->unk6428.unk0[arg1][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL); + structPtr->unk6428.unk0[arg1][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL); + structPtr->unk6428.unk0[arg1][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL); + structPtr->unk6428.unk0[arg1][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL); + structPtr->unk6780[arg1] = (GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) != 255) + ? GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) / 29u + : 9; + structPtr->unk6783[arg1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL); + sub_81D2754(structPtr->unk6428.unk0[arg1], structPtr->unk6428.unk14[arg1]); + } + else + { + for (i = 0; i < 5; i++) + { + structPtr->unk6428.unk0[arg1][i] = 0; + structPtr->unk6428.unk14[arg1][i].unk0 = 155; + structPtr->unk6428.unk14[arg1][i].unk2 = 91; + } + } +} + +void sub_81CDB98(s16 arg0, u8 arg1) +{ + u16 boxId, monId, species; + u32 personality, tid; + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + + if (arg0 == (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1)) + return; + + boxId = unkPtr->unk4[arg0].boxId; + monId = unkPtr->unk4[arg0].monId; + species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL); + tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL); + personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL); + LoadSpecialPokePic(&gMonFrontPicTable[species], structPtr->monPicGfx[arg1], species, personality, TRUE); + LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, tid, personality), structPtr->monPal[arg1]); +} + +u16 sub_81CDC50(void) +{ + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + return unkPtr->unk0; +} + +u16 sub_81CDC60(void) +{ + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + return unkPtr->unk2; +} + +struct UnknownStruct_81D1ED4 *sub_81CDC70(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return &structPtr->unk6428; +} + +u8 sub_81CDC84(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6786; +} + +u8 sub_81CDC9C(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6302; +} + +void *sub_81CDCB4(u8 id) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->monPicGfx[id]; +} + +void *sub_81CDCD4(u8 id) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->monPal[id]; +} + +u8 sub_81CDCEC(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6789; +} + +u8 *sub_81CDD04(u8 id) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6368[id]; +} + +u8 *sub_81CDD24(u8 id) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6320[id]; +} + +u16 sub_81CDD48(void) +{ + struct PokenavSub18 *unkPtr = GetSubstructPtr(18); + return unkPtr->unk4[unkPtr->unk2].unk6; +} + +bool32 sub_81CDD5C(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + if (structPtr->unk6300 == 1) + return TRUE; + else + return FALSE; +} + +u8 sub_81CDD7C(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + if (structPtr->unk6300 == 1) + return structPtr->unk6783[structPtr->unk6786]; + else + return 0; +} + +u8 sub_81CDDB0(void) +{ + struct PokenavSub11 *structPtr = GetSubstructPtr(11); + return structPtr->unk6780[structPtr->unk6786]; +} diff --git a/src/pokenav_unk_7.c b/src/pokenav_unk_7.c index d7b4b4f49..97bdd8b3b 100644 --- a/src/pokenav_unk_7.c +++ b/src/pokenav_unk_7.c @@ -2,6 +2,18 @@ #include "bg.h" #include "window.h" #include "pokenav.h" +#include "decompress.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "menu.h" +#include "menu_specialized.h" +#include "mon_markings.h" +#include "palette.h" +#include "pokenav.h" +#include "scanline_effect.h" +#include "string_util.h" +#include "strings.h" +#include "text.h" u32 sub_81CE37C(s32); u32 sub_81CE2D0(s32); @@ -103,3 +115,772 @@ const LoopedTask gUnknown_08623384[] = sub_81CE6BC, sub_81CE700 }; + +static u8 gUnknown_030012BC; + +struct Pokenav7Struct +{ + u32 loopedTaskId; + u8 tilemapBuffers[3][BG_SCREEN_SIZE]; + u8 filler[2]; + u8 unk1806[10]; + u32 (*unk1810)(void); + s16 unk1814; + u8 unk1816; + u16 unk1818; + u16 unk181A; + void *unk181C; + u8 unk1820; + u8 unk1821; + u8 unk1822; + u8 unk1823; + struct PokemonMarkMenu monMarks; + struct Sprite *unk28dc; + struct Sprite *unk28e0[10]; + u8 unk2908; + u8 filler2[0x38ac - 0x2909]; +}; + +extern s8 sub_81CDC84(void); // This function's declaration here is different than its definition in pokenav_unk_6. u8/s8 + +u32 sub_81CDE94(s32 state); +u32 sub_81CDE80(void); +void sub_81CED30(u8 var); +void sub_81CE9E4(void); +void sub_81CE934(void); +bool32 sub_81CE754(u8 a0, u16 a1, bool8 a2); +void sub_81CEE44(void); +void sub_81CEE90(void); +void sub_81CEEC8(void); +void sub_81CEE68(void); +void sub_81CEE74(bool8 showBg); + +// code +bool32 sub_81CDDD4(void) +{ + struct Pokenav7Struct *structPtr = AllocSubstruct(0xC, sizeof(struct Pokenav7Struct)); + + if (structPtr == NULL) + return FALSE; + + structPtr->unk1816 = 0xFF; + structPtr->loopedTaskId = CreateLoopedTask(sub_81CDE94, 1); + structPtr->unk1810 = sub_81CDE80; + structPtr->unk2908 = 0; + return TRUE; +} + +void sub_81CDE2C(int id) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + structPtr->loopedTaskId = CreateLoopedTask(gUnknown_08623384[id], 1); + structPtr->unk1810 = sub_81CDE80; +} + +u32 sub_81CDE64(void) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + return structPtr->unk1810(); +} + +u32 sub_81CDE80(void) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + return IsLoopedTaskActive(structPtr->loopedTaskId); +} + +u32 sub_81CDE94(s32 state) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + switch (state) + { + case 0: + if (sub_81CD3C4() != TRUE) + return 2; + return 0; + case 1: + InitBgTemplates(gUnknown_08623358, ARRAY_COUNT(gUnknown_08623358)); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4)); + decompress_and_copy_tile_data_to_vram(3, gPokenavCondition_Gfx, 0, 0, 0); + return 0; + case 2: + if (free_temp_tile_data_buffers_if_possible()) + return 2; + decompress_and_copy_tile_data_to_vram(2, gUnknown_08623228, 0, 0, 0); + return 0; + case 3: + if (free_temp_tile_data_buffers_if_possible()) + return 2; + + LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]); + SetBgTilemapBuffer(3, structPtr->tilemapBuffers[0]); + if (sub_81CDD5C() == TRUE) + CopyToBgTilemapBufferRect(3, gPokenavOptions_Tilemap, 0, 5, 9, 4); + + CopyBgTilemapBufferToVram(3); + CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20); + CopyPaletteIntoBufferUnfaded(gUnknown_08623208, 0xF0, 0x20); + structPtr->unk1814 = -80; + return 0; + case 4: + if (free_temp_tile_data_buffers_if_possible()) + return 2; + + LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]); + SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]); + CopyBgTilemapBufferToVram(2); + CopyPaletteIntoBufferUnfaded(gUnknown_086231E8, 0x30, 0x20); + sub_81D21DC(2); + return 0; + case 5: + sub_8199DF0(1, 0, 0, 1); + sub_8199DF0(1, 17, 1, 1); + CpuFill32(0, structPtr->tilemapBuffers[1], BG_SCREEN_SIZE); + SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]); + return 0; + case 6: + if (free_temp_tile_data_buffers_if_possible()) + return 2; + + structPtr->unk1820 = AddWindow(&gUnknown_08623364); + if (sub_81CDD5C() == TRUE) + { + structPtr->unk1821 = AddWindow(&gUnknown_0862336C); + structPtr->unk1822 = AddWindow(&gUnknown_08623374); + structPtr->unk1823 = AddWindow(&gUnknown_0862337C); + } + DeactivateAllTextPrinters(); + return 0; + case 7: + sub_81CED30(0); + return 0; + case 8: + sub_81CE9E4(); + return 0; + case 9: + if (sub_81CDD5C() == TRUE) + sub_81CE934(); + return 0; + case 10: + sub_81CE754(0, sub_81CDC84(), TRUE); + return 0; + case 11: + sub_81CE754(1, sub_81CDC84(), TRUE); + return 0; + case 12: + sub_81CE754(2, sub_81CDC84(), TRUE); + return 0; + case 13: + if (sub_81CE754(3, sub_81CDC84(), TRUE) != TRUE) + return 2; + PutWindowTilemap(structPtr->unk1820); + if (sub_81CDD5C() == TRUE) + { + PutWindowTilemap(structPtr->unk1821); + PutWindowTilemap(structPtr->unk1822); + PutWindowTilemap(structPtr->unk1823); + } + return 0; + case 14: + ShowBg(1); + HideBg(2); + ShowBg(3); + if (sub_81CDD5C() == TRUE) + sub_81C7BA4(4); + return 0; + case 15: + sub_81C7AC0(1); + if (!sub_81CDD5C()) + { + LoadLeftHeaderGfxForIndex(6); + sub_81C7FA0(1, TRUE, 0); + sub_81C7FA0(6, TRUE, 0); + } + return 0; + case 16: + if (IsPaletteFadeActive()) + return 2; + if (!sub_81CDD5C() && sub_81C8010()) + return 2; + SetVBlankCallback_(sub_81CEE44); + return 0; + case 17: + sub_81CEE90(); + sub_81D20AC(sub_81CDC70()); + return 0; + case 18: + if (sub_81D20BC(sub_81CDC70())) + return 2; + return 0; + case 19: + sub_81CEE74(TRUE); + return 0; + case 20: + if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814)) + { + sub_81D3464(structPtr->unk28e0); + if (sub_81CDD5C() == TRUE || sub_81CDC60() != sub_81CDC50()) + sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0()); + + return 4; + } + return 2; + } + + return 4; +} + +u32 sub_81CE2D0(s32 state) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + switch (state) + { + case 0: + sub_81CEEC8(); + sub_81D3520(structPtr->unk28e0); + return 1; + case 1: + if (sub_81D31A4(sub_81CDC70(), &structPtr->unk1814)) + return 2; + sub_81CEE74(FALSE); + return 1; + case 2: + sub_81C7AC0(0); + if (!sub_81CDD5C()) + sub_81C78A0(); + return 0; + case 3: + if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy()) + return 2; + sub_81D354C(structPtr->unk28e0); + HideBg(1); + HideBg(2); + HideBg(3); + return 1; + } + + return 4; +} + +u32 sub_81CE37C(s32 state) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + struct UnknownStruct_81D1ED4 *unkPtr = sub_81CDC70(); + + switch (state) + { + case 0: + sub_81CD548(0); + return 1; + case 1: + sub_81CD548(1); + return 1; + case 2: + sub_81CD548(2); + sub_81D3520(structPtr->unk28e0); + return 1; + case 3: + sub_81D2074(unkPtr); + return 1; + case 4: + if (!sub_81D3150(&structPtr->unk1814)) + { + sub_81CED30(sub_81CDC84()); + return 1; + } + return 2; + case 5: + sub_81CE754(0, sub_81CDC84(), FALSE); + return 1; + case 6: + sub_81CE754(1, sub_81CDC84(), FALSE); + return 1; + case 7: + sub_81CE754(2, sub_81CDC84(), FALSE); + return 1; + case 8: + if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE) + return 1; + return 2; + case 9: + unkPtr = sub_81CDC70(); + if (!sub_81D3178(unkPtr, &structPtr->unk1814)) + { + sub_81D3464(structPtr->unk28e0); + if (sub_81CDD5C() != TRUE && sub_81CDC60() == sub_81CDC50()) + return 1; + + sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0()); + return 1; + } + return 2; + } + + return 4; +} + +u32 sub_81CE4D8(s32 state) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + switch (state) + { + case 0: + sub_81CD548(0); + return 1; + case 1: + sub_81CD548(1); + return 1; + case 2: + sub_81CD548(2); + return 1; + case 3: + sub_81CED30(sub_81CDC84()); + return 1; + case 4: + sub_81CE754(0, sub_81CDC84(), FALSE); + return 1; + case 5: + sub_81CE754(1, sub_81CDC84(), FALSE); + return 1; + case 6: + sub_81CE754(2, sub_81CDC84(), FALSE); + return 1; + case 7: + if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE) + return 1; + return 2; + case 8: + if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814)) + { + sub_81D3464(structPtr->unk28e0); + sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0()); + return 1; + } + return 2; + } + + return 4; +} + +u32 sub_81CE5E4(s32 state) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + switch (state) + { + case 0: + sub_81CD548(0); + return 1; + case 1: + sub_81CD548(1); + return 1; + case 2: + sub_81CD548(2); + sub_81D3520(structPtr->unk28e0); + return 1; + case 3: + if (!sub_81D31A4(sub_81CDC70(), &structPtr->unk1814)) + return 1; + return 2; + case 4: + sub_81CE754(0, sub_81CDC84(), FALSE); + return 1; + case 5: + sub_81CE754(1, sub_81CDC84(), FALSE); + return 1; + case 6: + sub_81CE754(2, sub_81CDC84(), FALSE); + return 1; + case 7: + if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE) + return 1; + return 2; + } + + return 4; +} + +u32 sub_81CE6BC(s32 state) +{ + switch (state) + { + case 0: + sub_811FAA4(sub_81CDD7C(), 0xb0, 0x20); + return 1; + case 1: + sub_81C7BA4(5); + return 1; + case 2: + if (IsDma3ManagerBusyWithBgCopy_() == TRUE) + return 2; + return 1; + } + + return 4; +} + +u32 sub_81CE700(s32 state) +{ + switch (state) + { + case 0: + sub_811FAF8(); + return 1; + case 1: + sub_81C7BA4(4); + return 1; + case 2: + if (IsDma3ManagerBusyWithBgCopy_() == TRUE) + return 2; + return 1; + } + + return 4; +} + +u8 *sub_81CE738(u8 *dst, u16 num) +{ + u8 *txtPtr = ConvertIntToDecimalStringN(dst, num, STR_CONV_MODE_RIGHT_ALIGN, 4); + txtPtr = StringCopy(txtPtr, gText_Number2); + + return txtPtr; +} + +bool32 sub_81CE754(u8 a0, u16 a1, bool8 a2) +{ + u8 text[32]; + const u8 *str; + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + switch (a0) + { + case 0: + FillWindowPixelBuffer(structPtr->unk1820, 0); + if (sub_81CDD5C() == TRUE) + FillWindowPixelBuffer(structPtr->unk1821, 0); + break; + case 1: + if (sub_81CDC60() != sub_81CDC50() - 1 || sub_81CDD5C() == TRUE) + { + str = sub_81CDD04(a1); + AddTextPrinterParameterized(structPtr->unk1820, 1, str, 0, 1, 0, NULL); + } + break; + case 2: + if (sub_81CDD5C() == TRUE) + { + str = sub_81CDD24(a1); + AddTextPrinterParameterized(structPtr->unk1820, 1, str, 0, 17, 0, NULL); + text[0] = EXT_CTRL_CODE_BEGIN; + text[1] = 4; + text[2] = 8; + text[3] = 0; + text[4] = 9; + StringCopy(text + 5, gText_Number2); + AddTextPrinterParameterized(structPtr->unk1821, 1, text, 4, 1, 0, NULL); + ConvertIntToDecimalStringN(text + 5, sub_81CDD48(), STR_CONV_MODE_RIGHT_ALIGN, 4); + AddTextPrinterParameterized(structPtr->unk1821, 1, text, 28, 1, 0, NULL); + } + break; + case 3: + switch (structPtr->unk2908) + { + case 0: + if (a2) + CopyWindowToVram(structPtr->unk1820, 3); + else + CopyWindowToVram(structPtr->unk1820, 2); + + if (sub_81CDD5C() == TRUE) + { + structPtr->unk2908++; + return FALSE; + } + else + { + structPtr->unk2908 = 0; + return TRUE; + } + case 1: + if (a2) + CopyWindowToVram(structPtr->unk1821, 3); + else + CopyWindowToVram(structPtr->unk1821, 2); + + structPtr->unk2908 = 0; + return TRUE; + } + } + + return FALSE; +} + +void sub_81CE934(void) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + CopyWindowToVram(structPtr->unk1822, 3); + CopyWindowToVram(structPtr->unk1823, 3); +} + +void sub_81CE964(struct Sprite *sprite) +{ + if (sprite->data[0] == sub_81CDC60()) + StartSpriteAnim(sprite, 0); + else + StartSpriteAnim(sprite, 1); +} + +void sub_81CE990(struct Sprite *sprite) +{ + if (sub_81CDC60() == sub_81CDC50() - 1) + sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x65); + else + sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x66); +} + +void sub_81CE9C8(struct Sprite *sprite) +{ + StartSpriteAnim(sprite, sub_81CDD7C()); +} + +void sub_81CE9E4(void) +{ + struct SpriteSheet sprSheets[4]; + struct SpriteTemplate sprTemplate; + struct SpritePalette sprPals[3]; + struct SpriteSheet sprSheet; + struct Sprite *sprite; + u16 i, spriteId; + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + sub_81D321C(sprSheets, &sprTemplate, sprPals); + if (sub_81CDD5C() == TRUE) + { + structPtr->monMarks.baseTileTag = 0x6A; + structPtr->monMarks.basePaletteTag = 0x6A; + sub_811F90C(&structPtr->monMarks); + sub_811FA90(); + sprite = sub_811FF94(0x69, 0x69, gUnknown_08623338); + sprite->oam.priority = 3; + sprite->pos1.x = 192; + sprite->pos1.y = 32; + sprite->callback = sub_81CE9C8; + structPtr->unk28dc = sprite; + sub_81C7990(IndexOfSpritePaletteTag(0x69), 0); + } + else + { + LoadSpriteSheets(sprSheets); + Pokenav_AllocAndLoadPalettes(sprPals); + for (i = 0; i < sub_81CDC50() - 1; i++) + { + spriteId = CreateSprite(&sprTemplate, 226, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) + { + structPtr->unk1806[i] = spriteId; + gSprites[spriteId].data[0] = i; + gSprites[spriteId].callback = sub_81CE964; + } + else + { + structPtr->unk1806[i] = 0xFF; + } + } + + sprTemplate.tileTag = 0x67; + sprTemplate.callback = SpriteCallbackDummy; + for (; i < 6; i++) + { + spriteId = CreateSprite(&sprTemplate, 230, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) + { + structPtr->unk1806[i] = spriteId; + gSprites[spriteId].oam.size = 0; + } + else + { + structPtr->unk1806[i] = 0xFF; + } + } + + sprTemplate.tileTag = 0x66; + sprTemplate.callback = sub_81CE990; + spriteId = CreateSprite(&sprTemplate, 222, (i * 20) + 8, 0); + if (spriteId != MAX_SPRITES) + { + structPtr->unk1806[i] = spriteId; + gSprites[spriteId].oam.shape = 1; + gSprites[spriteId].oam.size = 2; + } + else + { + structPtr->unk1806[i] = 0xFF; + } + } + + sub_81D32B0(&sprSheet, &sprPals[0]); + LoadSpriteSheet(&sprSheet); + sprPals[1].data = NULL; + Pokenav_AllocAndLoadPalettes(sprPals); +} + +void sub_81CEBF4(struct Pokenav7Struct *structPtr) +{ + u8 i; + + if (sub_81CDD5C() == TRUE) + { + DestroySprite(structPtr->unk28dc); + FreeSpriteTilesByTag(0x6A); + FreeSpriteTilesByTag(0x69); + FreeSpritePaletteByTag(0x6A); + FreeSpritePaletteByTag(0x69); + } + else + { + for (i = 0; i < 7; i++) + DestroySprite(&gSprites[structPtr->unk1806[i]]); + + FreeSpriteTilesByTag(0x65); + FreeSpriteTilesByTag(0x66); + FreeSpriteTilesByTag(0x67); + FreeSpritePaletteByTag(0x65); + FreeSpritePaletteByTag(0x66); + } + + if (structPtr->unk1816 != 0xFF) + { + DestroySprite(&gSprites[structPtr->unk1816]); + FreeSpriteTilesByTag(0x64); + FreeSpritePaletteByTag(0x64); + } +} + +void sub_81CECA0(void) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + RemoveWindow(structPtr->unk1820); + if (sub_81CDD5C() == TRUE) + { + RemoveWindow(structPtr->unk1821); + RemoveWindow(structPtr->unk1822); + RemoveWindow(structPtr->unk1823); + } + else + { + sub_81C7FDC(); + } + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + sub_81CEBF4(structPtr); + sub_81CEE68(); + FreePokenavSubstruct(0xC); +} + +void sub_81CED10(struct Sprite *sprite) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + sprite->pos1.x = structPtr->unk1814 + 38; +} + +void sub_81CED30(u8 var) +{ + struct SpriteTemplate sprTemplate; + struct SpriteSheet sprSheet; + struct SpritePalette sprPal; + u8 spriteId; + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + if (structPtr->unk1816 == 0xFF) + { + sub_81D31D0(&sprSheet, &sprTemplate, &sprPal); + sprSheet.data = sub_81CDCB4(var); + sprPal.data = sub_81CDCD4(var); + structPtr->unk1818 = LoadSpritePalette(&sprPal); + structPtr->unk181A = LoadSpriteSheet(&sprSheet); + spriteId = CreateSprite(&sprTemplate, 38, 104, 0); + structPtr->unk1816 = spriteId; + if (spriteId == MAX_SPRITES) + { + FreeSpriteTilesByTag(0x64); + FreeSpritePaletteByTag(0x64); + structPtr->unk1816 = 0xFF; + } + else + { + structPtr->unk1816 = spriteId; + gSprites[structPtr->unk1816].callback = sub_81CED10; + structPtr->unk181C = (void*)(VRAM) + 0x10000 + (structPtr->unk181A * 32); + structPtr->unk1818 = (structPtr->unk1818 * 16) + 0x100; + } + } + else + { + DmaCopy16Defvars(3, sub_81CDCB4(var), structPtr->unk181C, 0x800); + LoadPalette(sub_81CDCD4(var), structPtr->unk1818, 0x20); + } +} + +void sub_81CEE44(void) +{ + struct UnknownStruct_81D1ED4 *unk = sub_81CDC70(); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_81D2108(unk); + ScanlineEffect_InitHBlankDmaTransfer(); +} + +void sub_81CEE68(void) +{ + SetPokenavVBlankCallback(); +} + +void sub_81CEE74(bool8 showBg) +{ + if (showBg) + ShowBg(2); + else + HideBg(2); +} + +void sub_81CEE90(void) +{ + struct UnknownStruct_81D1ED4 *unk = sub_81CDC70(); + u8 id = sub_81CDC84(); + + gUnknown_030012BC = id; + sub_81D1F84(unk, unk->unk14[3], unk->unk14[id]); + sub_81D2074(unk); +} + +void sub_81CEEC8(void) +{ + struct UnknownStruct_81D1ED4 *unk = sub_81CDC70(); + + if (sub_81CDD5C() || sub_81CDC60() != sub_81CDC50() - 1) + sub_81D1F84(unk, unk->unk14[sub_81CDC84()], unk->unk14[3]); +} + +u8 sub_81CEF14(void) +{ + struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC); + + if (sub_81CDD5C() == 1) + return structPtr->monMarks.markings; + else + return 0; +} diff --git a/src/pokenav_unk_8.c b/src/pokenav_unk_8.c index 8d83fd401..bcafc14d0 100644 --- a/src/pokenav_unk_8.c +++ b/src/pokenav_unk_8.c @@ -76,3 +76,114 @@ const struct WindowTemplate gUnknown_086235B4 = const u8 gUnknown_086235BC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}"); const u8 gUnknown_086235C8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}"); const u8 gUnknown_086235D4[] = _("{UNK_SPACER}"); + +struct PokenavSub7 +{ + u32 (*unk0)(struct PokenavSub7 *); + u32 loopedTaskId; + u8 fill1[12]; + u32 unk14; + u32 unk18; + u32 unk1C; + struct PokenavSub18 *unkPtr; +}; + +u32 sub_81CF010(struct PokenavSub7 *structPtr); +u32 sub_81CF030(struct PokenavSub7 *structPtr); +u32 sub_81CF0B8(struct PokenavSub7 *structPtr); +u32 sub_81CF0B0(struct PokenavSub7 *structPtr); +u32 sub_81CF11C(s32 state); + +bool32 sub_81CEF3C(void) +{ + struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7)); + if (structPtr == NULL) + return FALSE; + + structPtr->unkPtr = AllocSubstruct(18, sizeof(struct PokenavSub18)); + if (structPtr->unkPtr == NULL) + return FALSE; + + structPtr->unk0 = sub_81CF010; + structPtr->loopedTaskId = CreateLoopedTask(sub_81CF11C, 1); + structPtr->unk18 = 0; + structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()]; + return TRUE; +} + +bool32 sub_81CEF98(void) +{ + struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7)); + if (structPtr == NULL) + return FALSE; + + structPtr->unkPtr = GetSubstructPtr(18); + structPtr->unk0 = sub_81CF030; + structPtr->unk18 = 1; + structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()]; + return TRUE; +} + +u32 sub_81CEFDC(void) +{ + struct PokenavSub7 *structPtr = GetSubstructPtr(7); + return structPtr->unk0(structPtr); +} + +void sub_81CEFF0(void) +{ + struct PokenavSub7 *structPtr = GetSubstructPtr(7); + if (structPtr->unk1C == 0) + FreePokenavSubstruct(18); + FreePokenavSubstruct(7); +} + +bool32 sub_81CF010(struct PokenavSub7 *structPtr) +{ + if (!IsLoopedTaskActive(structPtr->loopedTaskId)) + structPtr->unk0 = sub_81CF030; + return FALSE; +} + +u32 sub_81CF030(struct PokenavSub7 *structPtr) +{ + if (gMain.newAndRepeatedKeys & DPAD_UP) + return 1; + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + return 2; + else if (gMain.newKeys & DPAD_LEFT) + return 3; + else if (gMain.newKeys & DPAD_RIGHT) + return 4; + else if (gMain.newKeys & B_BUTTON) + { + structPtr->unk1C = 0; + structPtr->unk0 = sub_81CF0B0; + return 5; + } + else if (gMain.newKeys & A_BUTTON) + { + structPtr->unkPtr->unk2 = GetSelectedMatchCall(); + structPtr->unk1C = 1; + structPtr->unk0 = sub_81CF0B8; + return 6; + } + else + return 0; +} + +u32 sub_81CF0B0(struct PokenavSub7 *structPtr) +{ + return 0x186A3; +} + +u32 sub_81CF0B8(struct PokenavSub7 *structPtr) +{ + return 0x186A9; +} + +u32 sub_81CF0C0(void) +{ + struct PokenavSub7 *structPtr = GetSubstructPtr(7); + return structPtr->unk18; +} diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index 6824e8747..047783a85 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -104,7 +104,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 if (paletteTag == 0xFFFF) { sCreatingSpriteTemplate.paletteTag = 0xFFFF; - LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20); + LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20); } else { @@ -130,7 +130,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 static void LoadPicPaletteBySlot(u16 species, u32 otId, u32 personality, u8 paletteSlot, bool8 isTrainer) { if (!isTrainer) - LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20); + LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20); else LoadCompressedPalette(gTrainerFrontPicPaletteTable[species].data, paletteSlot * 0x10, 0x20); } diff --git a/tools/aif2pcm/Makefile b/tools/aif2pcm/Makefile index e5cb6ad31..af7d19fe9 100644 --- a/tools/aif2pcm/Makefile +++ b/tools/aif2pcm/Makefile @@ -6,7 +6,10 @@ LIBS = -lm SRCS = main.c extended.c -.PHONY: clean +.PHONY: all clean + +all: aif2pcm + @: aif2pcm: $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) diff --git a/tools/bin2c/Makefile b/tools/bin2c/Makefile index 73f78980e..ab11e1b61 100644 --- a/tools/bin2c/Makefile +++ b/tools/bin2c/Makefile @@ -2,10 +2,13 @@ CC = gcc CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -.PHONY: clean +.PHONY: all clean SRCS = bin2c.c +all: bin2c + @: + bin2c: $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/gbafix/Makefile b/tools/gbafix/Makefile index f12c8cc4f..5b410da08 100644 --- a/tools/gbafix/Makefile +++ b/tools/gbafix/Makefile @@ -1,8 +1,11 @@ CC = gcc -.PHONY: clean +.PHONY: all clean SRCS = gbafix.c +all: gbafix + @: + gbafix: $(SRCS) $(CC) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/jsonproc/Makefile b/tools/jsonproc/Makefile index 69093a216..721da1025 100755 --- a/tools/jsonproc/Makefile +++ b/tools/jsonproc/Makefile @@ -8,7 +8,10 @@ SRCS := jsonproc.cpp HEADERS := jsonproc.h inja.hpp nlohmann/json.hpp -.PHONY: clean +.PHONY: all clean + +all: jsonproc + @: jsonproc: $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/mapjson/Makefile b/tools/mapjson/Makefile index d09acad50..9a49be506 100644 --- a/tools/mapjson/Makefile +++ b/tools/mapjson/Makefile @@ -6,7 +6,10 @@ SRCS := json11.cpp mapjson.cpp HEADERS := mapjson.h -.PHONY: clean +.PHONY: all clean + +all: mapjson + @: mapjson: $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/preproc/Makefile b/tools/preproc/Makefile index 3d3275819..63dedda1f 100644 --- a/tools/preproc/Makefile +++ b/tools/preproc/Makefile @@ -8,7 +8,10 @@ SRCS := asm_file.cpp c_file.cpp charmap.cpp preproc.cpp string_parser.cpp \ HEADERS := asm_file.h c_file.h char_util.h charmap.h preproc.h string_parser.h \ utf8.h -.PHONY: clean +.PHONY: all clean + +all: preproc + @: preproc: $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/ramscrgen/Makefile b/tools/ramscrgen/Makefile index 9aa309aa1..858db1a77 100644 --- a/tools/ramscrgen/Makefile +++ b/tools/ramscrgen/Makefile @@ -6,7 +6,10 @@ SRCS := main.cpp sym_file.cpp elf.cpp HEADERS := ramscrgen.h sym_file.h elf.h char_util.h -.PHONY: clean +.PHONY: all clean + +all: ramscrgen + @: ramscrgen: $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) diff --git a/tools/rsfont/Makefile b/tools/rsfont/Makefile index 582be7b88..abe1cab51 100644 --- a/tools/rsfont/Makefile +++ b/tools/rsfont/Makefile @@ -6,7 +6,10 @@ LIBS = -lpng -lz SRCS = main.c convert_png.c util.c font.c -.PHONY: clean +.PHONY: all clean + +all: rsfont + @: rsfont: $(SRCS) convert_png.h gfx.h global.h util.h font.h $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) diff --git a/tools/scaninc/Makefile b/tools/scaninc/Makefile index 53c9d0060..1516f159c 100644 --- a/tools/scaninc/Makefile +++ b/tools/scaninc/Makefile @@ -6,7 +6,10 @@ SRCS = scaninc.cpp c_file.cpp asm_file.cpp source_file.cpp HEADERS := scaninc.h asm_file.h c_file.h source_file.h -.PHONY: clean +.PHONY: all clean + +all: scaninc + @: scaninc: $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS)