diff options
37 files changed, 2551 insertions, 1038 deletions
@@ -24,6 +24,7 @@ MID2AGB := tools/mid2agb/mid2agb$(EXE) PREPROC := tools/preproc/preproc$(EXE) SCANINC := tools/scaninc/scaninc$(EXE) RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE) +GBAFIX := tools/gbafix/gbafix$(EXE) ASFLAGS := -mcpu=arm7tdmi -I include --defsym $(GAME_VERSION)=1 --defsym REVISION=$(GAME_REVISION) --defsym $(GAME_LANGUAGE)=1 --defsym DEBUG=$(DEBUG) CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Wunused -Werror -O2 -fhex-asm @@ -116,6 +117,7 @@ clean: tidy $(MAKE) clean -C tools/rsfont $(MAKE) clean -C tools/aif2pcm $(MAKE) clean -C tools/ramscrgen + $(MAKE) clean -C tools/gbafix tools: @$(MAKE) -C tools/gbagfx @@ -126,6 +128,7 @@ tools: @$(MAKE) -C tools/aif2pcm @$(MAKE) -C tools/ramscrgen @$(MAKE) -C tools/mid2agb + @$(MAKE) -C tools/gbafix tidy: $(RM) $(ALL_BUILDS:%=poke%{.gba,.elf,.map}) @@ -133,6 +136,7 @@ tidy: $(ROM): %.gba: %.elf $(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@ + $(GBAFIX) $@ -p -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(GAME_REVISION) --silent %.elf: $(LD_SCRIPT) $(ALL_OBJECTS) cd $(BUILD_DIR) && $(LD) -T ld_script.ld -Map ../../$(MAP) ../../$(LIBGCC) ../../$(LIBC) -o ../../$@ diff --git a/asm/rom_header.inc b/asm/rom_header.inc deleted file mode 100644 index a852a9f23..000000000 --- a/asm/rom_header.inc +++ /dev/null @@ -1,77 +0,0 @@ - .global RomHeaderNintendoLogo -RomHeaderNintendoLogo: - .byte 0x24,0xff,0xae,0x51,0x69,0x9a,0xa2,0x21 - .byte 0x3d,0x84,0x82,0x0a,0x84,0xe4,0x09,0xad - .byte 0x11,0x24,0x8b,0x98,0xc0,0x81,0x7f,0x21 - .byte 0xa3,0x52,0xbe,0x19,0x93,0x09,0xce,0x20 - .byte 0x10,0x46,0x4a,0x4a,0xf8,0x27,0x31,0xec - .byte 0x58,0xc7,0xe8,0x33,0x82,0xe3,0xce,0xbf - .byte 0x85,0xf4,0xdf,0x94,0xce,0x4b,0x09,0xc1 - .byte 0x94,0x56,0x8a,0xc0,0x13,0x72,0xa7,0xfc - .byte 0x9f,0x84,0x4d,0x73,0xa3,0xca,0x9a,0x61 - .byte 0x58,0x97,0xa3,0x27,0xfc,0x03,0x98,0x76 - .byte 0x23,0x1d,0xc7,0x61,0x03,0x04,0xae,0x56 - .byte 0xbf,0x38,0x84,0x00,0x40,0xa7,0x0e,0xfd - .byte 0xff,0x52,0xfe,0x03,0x6f,0x95,0x30,0xf1 - .byte 0x97,0xfb,0xc0,0x85,0x60,0xd6,0x80,0x25 - .byte 0xa9,0x63,0xbe,0x03,0x01,0x4e,0x38,0xe2 - .byte 0xf9,0xa2,0x34,0xff,0xbb,0x3e,0x03,0x44 - .byte 0x78,0x00,0x90,0xcb,0x88,0x11,0x3a,0x94 - .byte 0x65,0xc0,0x7c,0x63,0x87,0xf0,0x3c,0xaf - .byte 0xd6,0x25,0xe4,0x8b,0x38,0x0a,0xac,0x72 - .byte 0x21,0xd4,0xf8,0x07 - -RomHeaderGameTitle: - .ifdef SAPPHIRE - .ascii "POKEMON SAPP" - .else - .ascii "POKEMON RUBY" - .endif - -RomHeaderGameCode: - .ifdef SAPPHIRE - .ascii "AXP" - .else - .ascii "AXV" - .endif - .ifdef ENGLISH - .ascii "E" - .else - .ascii "D" - .endif - -RomHeaderMakerCode: - .ascii "01" - -RomHeaderMagic: - .byte 0x96 - -RomHeaderMainUnitCode: - .byte 0 - -RomHeaderDeviceType: - .byte 0 - -RomHeaderReserved1: - .space 7 - -RomHeaderSoftwareVersion: - .byte REVISION - -RomHeaderChecksum: - .ifdef ENGLISH - .ifdef SAPPHIRE - .byte 0x55 - REVISION - .else - .byte 0x41 - REVISION - .endif - .else - .ifdef SAPPHIRE - .byte 0x56 - .else - .byte 0x42 - .endif - .endif - -RomHeaderReserved2: - .space 2 diff --git a/build_tools.sh b/build_tools.sh index 26f1f35b3..7236072d4 100755 --- a/build_tools.sh +++ b/build_tools.sh @@ -6,3 +6,4 @@ make -C tools/bin2c make -C tools/rsfont make -C tools/aif2pcm make -C tools/ramscrgen +make -C tools/gbafix diff --git a/build_tools_mac.sh b/build_tools_mac.sh index 126f9f023..f9b758850 100755 --- a/build_tools_mac.sh +++ b/build_tools_mac.sh @@ -6,3 +6,4 @@ make -C tools/bin2c CXX=clang++ make -C tools/rsfont CXX=clang++ make -C tools/aif2pcm CXX=clang++ make -C tools/ramscrgen CXX=clang++ +make -C tools/gbafix CXX=clang++ diff --git a/clean_tools.sh b/clean_tools.sh index 7062a2124..380089a49 100755 --- a/clean_tools.sh +++ b/clean_tools.sh @@ -6,3 +6,4 @@ make -C tools/bin2c clean make -C tools/rsfont clean make -C tools/aif2pcm clean make -C tools/ramscrgen clean +make -C tools/gbafix clean @@ -7,12 +7,19 @@ GAME_LANGUAGE ?= ENGLISH DEBUG ?= 0 COMPARE ?= 1 +# For gbafix +MAKER_CODE := 01 + # Version ifeq ($(GAME_VERSION), RUBY) BUILD_NAME := ruby + TITLE := POKEMON RUBY + GAME_CODE := AXV else ifeq ($(GAME_VERSION), SAPPHIRE) BUILD_NAME := sapphire + TITLE := POKEMON SAPP + GAME_CODE := AXP else $(error unknown version $(GAME_VERSION)) endif @@ -36,9 +43,11 @@ endif # Language ifeq ($(GAME_LANGUAGE), ENGLISH) BUILD_NAME := $(BUILD_NAME) + GAME_CODE := $(GAME_CODE)E else ifeq ($(GAME_LANGUAGE), GERMAN) BUILD_NAME := $(BUILD_NAME)_de + GAME_CODE := $(GAME_CODE)D else $(error unknown language $(GAME_LANGUAGE)) endif diff --git a/data/battle_anim_812C144.s b/data/battle_anim_812C144.s deleted file mode 100644 index dc0ebf9e3..000000000 --- a/data/battle_anim_812C144.s +++ /dev/null @@ -1,643 +0,0 @@ - .include "include/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gSpriteAnim_8402164:: @ 8402164 - obj_image_anim_frame 0, 4 - obj_image_anim_frame 16, 4 - obj_image_anim_frame 32, 4 - obj_image_anim_frame 48, 4 - obj_image_anim_frame 64, 4 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_840217C:: @ 840217C - .4byte gSpriteAnim_8402164 - - .align 2 -gBattleAnimSpriteTemplate_8402180:: @ 8402180 - spr_template 10137, 10137, gOamData_837E054, gSpriteAnimTable_840217C, NULL, gDummySpriteAffineAnimTable, sub_80793C4 - - .align 2 -gBattleAnimSpriteTemplate_8402198:: @ 8402198 - spr_template 10016, 10016, gOamData_837DF54, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812C144 - - .align 2 -gBattleAnimSpriteTemplate_84021B0:: @ 84021B0 - spr_template 10017, 10017, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80794A8 - - .align 2 -gSpriteAnim_84021C8:: @ 84021C8 - obj_image_anim_frame 0, 40 - obj_image_anim_frame 16, 8 - obj_image_anim_frame 32, 40 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_84021D8:: @ 84021D8 - .4byte gSpriteAnim_84021C8 - - .align 2 -gBattleAnimSpriteTemplate_84021DC:: @ 84021DC - spr_template 10190, 10190, gOamData_837DF34, gSpriteAnimTable_84021D8, NULL, gDummySpriteAffineAnimTable, sub_80793C4 - - .align 2 -gBattleAnimSpriteTemplate_84021F4:: @ 84021F4 - spr_template 10191, 10191, gOamData_837E05C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812C220 - - .align 2 -gBattleAnimSpriteTemplate_840220C:: @ 840220C - spr_template 10189, 10189, gOamData_837DF94, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812C2BC - - .align 2 -gSpriteAffineAnim_8402224:: @ 8402224 - obj_rot_scal_anim_frame 0x180, 0x180, 0, 0 - obj_rot_scal_anim_frame 0xFFE0, 0x18, 0, 5 - obj_rot_scal_anim_frame 0x18, 0xFFE0, 0, 5 - obj_rot_scal_anim_jump 1 - - .align 2 -gSpriteAffineAnim_8402244:: @ 8402244 - obj_rot_scal_anim_frame 0x30, 0x30, 0, 0 - obj_rot_scal_anim_frame 0x20, 0x20, 0, 6 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_840225C:: @ 840225C - .4byte gSpriteAffineAnim_8402224 - .4byte gSpriteAffineAnim_8402244 - - .align 2 -gBattleAnimSpriteTemplate_8402264:: @ 8402264 - spr_template 10187, 10187, gOamData_837E11C, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_840225C, sub_812C358 - - .align 2 -gBattleAnimSpriteTemplate_840227C:: @ 840227C - spr_template 10152, 10152, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812C720 - - .align 2 -gSpriteAnim_8402294:: @ 8402294 - obj_image_anim_frame 0, 3 - obj_image_anim_frame 16, 3 - obj_image_anim_frame 32, 3 - obj_image_anim_frame 48, 3 - obj_image_anim_frame 64, 3 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_84022AC:: @ 84022AC - .4byte gSpriteAnim_8402294 - - .align 2 -gBattleAnimSpriteTemplate_84022B0:: @ 84022B0 - spr_template 10027, 10027, gOamData_837DF34, gSpriteAnimTable_84022AC, NULL, gDummySpriteAffineAnimTable, sub_812C80C - - .align 2 -gSpriteAnim_84022C8:: @ 84022C8 - obj_image_anim_frame 0, 3 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_84022D0:: @ 84022D0 - .4byte gSpriteAnim_84022C8 - - .align 2 -gSpriteAffineAnim_84022D4:: @ 84022D4 - obj_rot_scal_anim_frame 0xFFF9, 0xFFF9, -3, 16 - obj_rot_scal_anim_frame 0x7, 0x7, 3, 16 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnimTable_84022EC:: @ 84022EC - .4byte gSpriteAffineAnim_84022D4 - - .align 2 -gBattleAnimSpriteTemplate_84022F0:: @ 84022F0 - spr_template 10228, 10228, gOamData_837DF94, gSpriteAnimTable_84022D0, NULL, gSpriteAffineAnimTable_84022EC, sub_812C848 - - .align 2 -gSpriteAnim_8402308:: @ 8402308 - obj_image_anim_frame 0, 8 - obj_image_anim_frame 16, 16 - obj_image_anim_frame 32, 4 - obj_image_anim_frame 48, 4 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_840231C:: @ 840231C - .4byte gSpriteAnim_8402308 - - .align 2 -gSpriteAffineAnim_8402320:: @ 8402320 - obj_rot_scal_anim_frame 0x200, 0x200, 0, 0 - obj_rot_scal_anim_frame 0xFFE0, 0xFFE0, 0, 8 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8402338:: @ 8402338 - .4byte gSpriteAffineAnim_8402320 - - .align 2 -gBattleAnimSpriteTemplate_840233C:: @ 840233C - spr_template 10192, 10192, gOamData_837DFF4, gSpriteAnimTable_840231C, NULL, gSpriteAffineAnimTable_8402338, sub_812C908 - - .align 2 -gSpriteAffineAnim_8402354:: @ 8402354 - obj_rot_scal_anim_frame 0x0, 0x180, 0, 0 - obj_rot_scal_anim_frame 0x10, 0x0, 0, 20 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_840236C:: @ 840236C - obj_rot_scal_anim_frame 0x140, 0x180, 0, 0 - obj_rot_scal_anim_frame 0xFFF0, 0x0, 0, 19 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8402384:: @ 8402384 - .4byte gSpriteAffineAnim_8402354 - .4byte gSpriteAffineAnim_840236C - - .align 2 -gBattleAnimSpriteTemplate_840238C:: @ 840238C - spr_template 10227, 10227, gOamData_837DFFC, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8402384, sub_812C990 - - .align 2 -gBattleAnimSpriteTemplate_84023A4:: @ 84023A4 - spr_template 10247, 10247, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812CAFC - - .align 2 -gBattleAnimSpriteTemplate_84023BC:: @ 84023BC - spr_template 10247, 10247, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812CC28 - - .align 2 -gSpriteAnim_84023D4:: @ 84023D4 - obj_image_anim_frame 0, 2 - obj_image_anim_frame 8, 2 - obj_image_anim_frame 16, 2 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnimTable_84023E4:: @ 84023E4 - .4byte gSpriteAnim_84023D4 - - .align 2 -gBattleAnimSpriteTemplate_84023E8:: @ 84023E8 - spr_template 10229, 10229, gOamData_837DF54, gSpriteAnimTable_84023E4, NULL, gDummySpriteAffineAnimTable, sub_812CCE8 - - .align 2 -gUnknown_08402400:: @ 8402400 - obj_rot_scal_anim_frame -12, 8, 0, 4 - obj_rot_scal_anim_frame 20, -20, 0, 4 - obj_rot_scal_anim_frame -8, 12, 0, 4 - obj_rot_scal_anim_end 0 - - .align 2 -gSpriteAnim_8402420:: @ 8402420 - obj_image_anim_frame 0, 8 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_8402428:: @ 8402428 - .4byte gSpriteAnim_8402420 - - .align 2 -gSpriteAffineAnim_840242C:: @ 840242C - obj_rot_scal_anim_frame 0x0, 0x0, 5, 40 - obj_rot_scal_anim_frame 0x0, 0x0, 10, 10 - obj_rot_scal_anim_frame 0x0, 0x0, 15, 10 - obj_rot_scal_anim_frame 0x0, 0x0, 20, 40 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnimTable_8402454:: @ 8402454 - .4byte gSpriteAffineAnim_840242C - - .align 2 -gBattleAnimSpriteTemplate_8402458:: @ 8402458 - spr_template 10230, 10230, gOamData_837DFFC, gSpriteAnimTable_8402428, NULL, gSpriteAffineAnimTable_8402454, sub_812D294 - - .align 2 -gSpriteAnim_8402470:: @ 8402470 - obj_image_anim_frame 0, 3 - obj_image_anim_frame 16, 3 - obj_image_anim_frame 32, 3 - obj_image_anim_frame 48, 3 - obj_image_anim_frame 32, 3, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 16, 3, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 0, 3, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_loop 1 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_8402494:: @ 8402494 - .4byte gSpriteAnim_8402470 - - .align 2 -gBattleAnimSpriteTemplate_8402498:: @ 8402498 - spr_template 10234, 10234, gOamData_837DF34, gSpriteAnimTable_8402494, NULL, gDummySpriteAffineAnimTable, sub_80793C4 - - .align 2 -gUnknown_084024B0:: @ 84024B0 - obj_rot_scal_anim_frame -12, 20, 0, 8 - obj_rot_scal_anim_frame 12, -20, 0, 8 - obj_rot_scal_anim_loop 2 - obj_rot_scal_anim_end 0 - - .align 2 -gBattleAnimSpriteTemplate_84024D0:: @ 84024D0 - spr_template 10226, 10226, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812D3AC - - .align 2 -gBattleAnimSpriteTemplate_84024E8:: @ 84024E8 - spr_template 10233, 10233, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812D4B4 - - .align 2 -gSpriteTemplate_8402500:: @ 8402500 - spr_template 10233, 10233, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812D588 - - .align 2 -gUnknown_08402518:: @ 8402518 - obj_rot_scal_anim_frame 8, -8, 0, 12 - obj_rot_scal_anim_frame -16, 16, 0, 12 - obj_rot_scal_anim_frame 8, -8, 0, 12 - obj_rot_scal_anim_loop 1 - obj_rot_scal_anim_end 0 - - .align 2 -gUnknown_08402540:: @ 8402540 - obj_rot_scal_anim_frame 0, 6, 0, 20 - obj_rot_scal_anim_frame 0, 0, 0, 20 - obj_rot_scal_anim_frame 0, -18, 0, 6 - obj_rot_scal_anim_frame -18, -18, 0, 3 - obj_rot_scal_anim_frame 0, 0, 0, 15 - obj_rot_scal_anim_frame 4, 4, 0, 13 - obj_rot_scal_anim_end 0 - - .align 2 -gBattleAnimSpriteTemplate_8402578:: @ 8402578 - spr_template 10236, 10236, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812D724 - - .align 2 -gUnknown_08402590:: @ 8402590 - obj_rot_scal_anim_frame 0, 6, 0, 20 - obj_rot_scal_anim_frame 0, 0, 0, 20 - obj_rot_scal_anim_frame 7, -30, 0, 6 - obj_rot_scal_anim_frame 0, 0, 0, 20 - obj_rot_scal_anim_frame -2, 3, 0, 20 - obj_rot_scal_anim_end 0 - - .align 2 -gUnknown_084025C0:: @ 84025C0 - .byte 0xE8, 0x18, 0xFC, 0x00 @ last could be align padding - - .align 2 -gSpriteAnim_84025C4:: @ 84025C4 - obj_image_anim_frame 0, 6 - obj_image_anim_frame 4, 6 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_84025D0:: @ 84025D0 - obj_image_anim_frame 8, 6 - obj_image_anim_end - - .align 2 -gSpriteAnim_84025D8:: @ 84025D8 - obj_image_anim_frame 12, 6 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_84025E0:: @ 84025E0 - .4byte gSpriteAnim_84025C4 - .4byte gSpriteAnim_84025D0 - .4byte gSpriteAnim_84025D8 - - .align 2 -gBattleAnimSpriteTemplate_84025EC:: @ 84025EC - spr_template 10241, 10241, gOamData_837DF2C, gSpriteAnimTable_84025E0, NULL, gDummySpriteAffineAnimTable, sub_812DEAC - - .align 2 -gUnknown_08402604:: @ 8402604 - .byte 0x78, 0x50, 0x28, 0x00 @ last could be align padding - - .align 2 -gUnknown_08402608:: @ 8402608 - .byte 0, 0, 0, 0, 50 - - .align 2 -gUnknown_08402610:: @ 8402610 - obj_rot_scal_anim_frame 0, -15, 0, 7 - obj_rot_scal_anim_frame 0, 15, 0, 7 - obj_rot_scal_anim_loop 2 - obj_rot_scal_anim_end 0 - - .align 2 -gBattleAnimSpriteTemplate_8402630:: @ 8402630 - spr_template 10087, 10087, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812E4F0 - - .align 2 -gSpriteAnim_8402648:: @ 8402648 - obj_image_anim_frame 0, 8 - obj_image_anim_frame 1, 8 - obj_image_anim_frame 2, 8 - obj_image_anim_frame 3, 8 - obj_image_anim_frame 3, 8, OBJ_IMAGE_ANIM_V_FLIP - obj_image_anim_frame 2, 8, OBJ_IMAGE_ANIM_V_FLIP - obj_image_anim_frame 0, 8, OBJ_IMAGE_ANIM_V_FLIP - obj_image_anim_frame 1, 8, OBJ_IMAGE_ANIM_V_FLIP - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_840266C:: @ 840266C - obj_image_anim_frame 0, 8, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 1, 8, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 2, 8, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 3, 8, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 3, 8, OBJ_IMAGE_ANIM_V_FLIP | OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 2, 8, OBJ_IMAGE_ANIM_V_FLIP | OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 0, 8, OBJ_IMAGE_ANIM_V_FLIP | OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 1, 8, OBJ_IMAGE_ANIM_V_FLIP | OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_8402690:: @ 8402690 - obj_image_anim_frame 0, 8 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_8402698:: @ 8402698 - .4byte gSpriteAnim_8402648 - .4byte gSpriteAnim_840266C - .4byte gSpriteAnim_8402690 - - .align 2 -gBattleAnimSpriteTemplate_84026A4:: @ 84026A4 - spr_template 10238, 10238, gOamData_837DF24, gSpriteAnimTable_8402698, NULL, gDummySpriteAffineAnimTable, sub_812E7A0 - - .align 2 -@ probably unknown palette - .incbin "graphics/unknown/unknown_4026BC.gbapal" - - .align 2 -gSpriteAnim_84026DC:: @ 84026DC - obj_image_anim_frame 0, 5 - obj_image_anim_frame 4, 9 - obj_image_anim_frame 8, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_84026EC:: @ 84026EC - .4byte gSpriteAnim_84026DC - - .align 2 -gBattleAnimSpriteTemplate_84026F0:: @ 84026F0 - spr_template 10239, 10239, gOamData_837DF2C, gSpriteAnimTable_84026EC, NULL, gDummySpriteAffineAnimTable, sub_812EA4C - - .align 2 -gBattleAnimSpriteTemplate_8402708:: @ 8402708 - spr_template 10240, 10240, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812EC78 - - .align 2 -gBattleAnimSpriteTemplate_8402720:: @ 8402720 - spr_template 10227, 10227, gOamData_837DFFC, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8402384, sub_812ED84 - - .align 2 -gBattleAnimSpriteTemplate_8402738:: @ 8402738 - spr_template 10236, 10236, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812EEA4 - - .align 2 -gUnknown_08402750:: @ 8402750 - obj_rot_scal_anim_frame 16, 0, 0, 4 - obj_rot_scal_anim_frame 0, -3, 0, 16 - obj_rot_scal_anim_frame 4, 0, 0, 4 - obj_rot_scal_anim_frame 0, 0, 0, 24 - obj_rot_scal_anim_frame -5, 3, 0, 16 - obj_rot_scal_anim_end 0 - - .align 2 -gSpriteAffineAnim_8402780:: @ 8402780 - obj_rot_scal_anim_frame 0x80, 0x80, 0, 0 - obj_rot_scal_anim_frame 0xFFF8, 0xFFF8, 0, 8 - obj_rot_scal_anim_frame 0x8, 0x8, 0, 8 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnim_84027A0:: @ 84027A0 - obj_rot_scal_anim_frame 0xC0, 0xC0, 0, 0 - obj_rot_scal_anim_frame 0x8, 0x8, 0, 8 - obj_rot_scal_anim_frame 0xFFF8, 0xFFF8, 0, 8 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnim_84027C0:: @ 84027C0 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0x8, 0x8, 0, 8 - obj_rot_scal_anim_frame 0xFFF8, 0xFFF8, 0, 8 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnimTable_84027E0:: @ 84027E0 - .4byte gSpriteAffineAnim_8402780 - .4byte gSpriteAffineAnim_84027A0 - .4byte gSpriteAffineAnim_84027C0 - - .align 2 -gBattleAnimSpriteTemplate_84027EC:: @ 84027EC - spr_template 10242, 10242, gOamData_837DF94, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_84027E0, sub_812F88C - - .align 2 -gSpriteAffineAnim_8402804:: @ 8402804 - obj_rot_scal_anim_frame 0x80, 0x80, 0, 0 - obj_rot_scal_anim_frame 0xFFFC, 0xFFFA, 0, 16 - obj_rot_scal_anim_frame 0x4, 0x6, 0, 16 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnim_8402824:: @ 8402824 - obj_rot_scal_anim_frame 0xC0, 0xC0, 0, 0 - obj_rot_scal_anim_frame 0x4, 0x6, 0, 16 - obj_rot_scal_anim_frame 0xFFFC, 0xFFFA, 0, 16 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnim_8402844:: @ 8402844 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0x4, 0x6, 0, 16 - obj_rot_scal_anim_frame 0xFFFC, 0xFFFA, 0, 16 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnim_8402864:: @ 8402864 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0x8, 0xA, 0, 30 - obj_rot_scal_anim_frame 0xFFF8, 0xFFF6, 0, 16 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnimTable_8402884:: @ 8402884 - .4byte gSpriteAffineAnim_8402804 - .4byte gSpriteAffineAnim_8402824 - .4byte gSpriteAffineAnim_8402844 - .4byte gSpriteAffineAnim_8402864 - - .align 2 -gBattleAnimSpriteTemplate_8402894:: @ 8402894 - spr_template 10242, 10242, gOamData_837DFF4, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8402884, sub_812F948 - - .align 2 -gUnknown_084028AC:: @ 84028AC - obj_rot_scal_anim_frame -16, 16, 0, 6 - obj_rot_scal_anim_frame 16, -16, 0, 12 - obj_rot_scal_anim_frame -16, 16, 0, 6 - obj_rot_scal_anim_end 0 - - .align 2 -gSpriteTemplate_84028CC:: @ 84028CC - spr_template 10243, 10243, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_812FF94 - - .align 2 -gUnknown_084028E4:: @ 84028E4 - .incbin "graphics/battle_anims/sprites/effect.gbapal" - - .align 2 -gSpriteAnim_8402914:: @ 8402914 - obj_image_anim_frame 0, 3 - obj_image_anim_frame 16, 3 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_8402920:: @ 8402920 - obj_image_anim_frame 32, 3 - obj_image_anim_frame 48, 3 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnimTable_840292C:: @ 840292C - .4byte gSpriteAnim_8402914 - .4byte gSpriteAnim_8402920 - - .align 2 -gBattleAnimSpriteTemplate_8402934:: @ 8402934 - spr_template 10053, 10053, gOamData_837DF34, gSpriteAnimTable_840292C, NULL, gDummySpriteAffineAnimTable, sub_81300F4 - - .align 2 -gSpriteTemplate_840294C:: @ 840294C - spr_template 10248, 10248, gOamData_837DF24, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_81304DC - - .align 2 -gBattleAnimSpriteTemplate_8402964:: @ 8402964 - spr_template 10252, 10252, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_813051C - - .align 2 -gSpriteAffineAnim_840297C:: @ 840297C - obj_rot_scal_anim_frame 0x0, 0x0, -4, 24 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_840298C:: @ 840298C - obj_rot_scal_anim_frame 0x100, 0x100, -64, 0 - obj_rot_scal_anim_frame 0x0, 0x0, 4, 24 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_84029A4:: @ 84029A4 - .4byte gSpriteAffineAnim_840297C - .4byte gSpriteAffineAnim_840298C - - .align 2 -gSpriteTemplate_84029AC:: @ 84029AC - spr_template 10254, 10254, gOamData_837DF94, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_84029A4, SpriteCallbackDummy - - .align 2 -gBattleAnimSpriteTemplate_84029C4:: @ 84029C4 - spr_template 10247, 10247, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_81307B0 - - .align 2 -gUnknown_084029DC:: @ 84029DC - obj_rot_scal_anim_frame 0, -16, 0, 6 - obj_rot_scal_anim_frame 0, 16, 0, 6 - obj_rot_scal_anim_end 0 - - .align 2 -gBattleAnimSpriteTemplate_84029F4:: @ 84029F4 - spr_template 10255, 10255, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8130A2C - - .align 2 -gBattleAnimSpriteTemplate_8402A0C:: @ 8402A0C - spr_template 10247, 10247, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8130AEC - - .align 2 -gBattleAnimSpriteTemplate_8402A24:: @ 8402A24 - spr_template 10258, 10258, gOamData_837E054, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8130F5C - - .align 2 -gBattleAnimSpriteTemplate_8402A3C:: @ 8402A3C - spr_template 10233, 10233, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8131264 - - .align 2 -gSpriteTemplate_8402A54:: @ 8402A54 - spr_template 10233, 10233, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D1FDC - - .align 2 -gBattleAnimSpriteTemplate_8402A6C:: @ 8402A6C - spr_template 10250, 10250, gOamData_837DF3C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8131564 - - .align 2 -gSpriteTemplate_8402A84:: @ 8402A84 - spr_template 10224, 10224, gOamData_837DF34, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8131EB8 - - .align 2 -gSpriteAnim_8402A9C:: @ 8402A9C - obj_image_anim_frame 0, 4 - obj_image_anim_frame 64, 4 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_8402AA8:: @ 8402AA8 - .4byte gSpriteAnim_8402A9C - - .align 2 -gSpriteAffineAnim_8402AAC:: @ 8402AAC - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0x0, 0x0, -4, 8 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_8402AC4:: @ 8402AC4 - obj_rot_scal_anim_frame 0xFF00, 0x100, 0, 0 - obj_rot_scal_anim_frame 0x0, 0x0, 4, 8 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8402ADC:: @ 8402ADC - .4byte gSpriteAffineAnim_8402AAC - .4byte gSpriteAffineAnim_8402AC4 - - .align 2 -gBattleAnimSpriteTemplate_8402AE4:: @ 8402AE4 - spr_template 10277, 10277, gOamData_837DF9C, gSpriteAnimTable_8402AA8, NULL, gSpriteAffineAnimTable_8402ADC, sub_8132370 - - .align 2 -gSpriteAffineAnim_8402AFC:: @ 8402AFC - obj_rot_scal_anim_frame 0x0, 0x0, -4, 64 - obj_rot_scal_anim_jump 0 - - .align 2 -gSpriteAffineAnimTable_8402B0C:: @ 8402B0C - .4byte gSpriteAffineAnim_8402AFC - - .align 2 -gBattleAnimSpriteTemplate_8402B10:: @ 8402B10 - spr_template 10278, 10278, gOamData_837E0BC, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8402B0C, sub_81323E0 - - .align 2 -gUnknown_08402B28:: @ 8402B28 - obj_rot_scal_anim_frame 0, 16, 0, 4 - obj_rot_scal_anim_frame -2, 0, 0, 8 - obj_rot_scal_anim_frame 0, 4, 0, 4 - obj_rot_scal_anim_frame 0, 0, 0, 24 - obj_rot_scal_anim_frame 1, -5, 0, 16 - obj_rot_scal_anim_end 0 diff --git a/data/battle_anim_813F0F4.s b/data/battle_anim_813F0F4.s deleted file mode 100644 index b043929c3..000000000 --- a/data/battle_anim_813F0F4.s +++ /dev/null @@ -1,150 +0,0 @@ - .include "include/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gBallOpenParticleSpritesheets:: @ 840B258 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55020 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55021 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55022 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55023 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55024 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55025 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55026 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55027 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55028 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55029 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55030 - obj_tiles gBattleAnimSpriteSheet_Particles, 0x100, 55031 - - .align 2 -gBallOpenParticlePalettes:: @ 840B2B8 - obj_pal gBattleAnimSpritePalette_136, 55020 - obj_pal gBattleAnimSpritePalette_136, 55021 - obj_pal gBattleAnimSpritePalette_136, 55022 - obj_pal gBattleAnimSpritePalette_136, 55023 - obj_pal gBattleAnimSpritePalette_136, 55024 - obj_pal gBattleAnimSpritePalette_136, 55025 - obj_pal gBattleAnimSpritePalette_136, 55026 - obj_pal gBattleAnimSpritePalette_136, 55027 - obj_pal gBattleAnimSpritePalette_136, 55028 - obj_pal gBattleAnimSpritePalette_136, 55029 - obj_pal gBattleAnimSpritePalette_136, 55030 - obj_pal gBattleAnimSpritePalette_136, 55031 - - .align 2 -gSpriteAnim_840B318:: @ 840B318 - obj_image_anim_frame 0, 1 - obj_image_anim_frame 1, 1 - obj_image_anim_frame 2, 1 - obj_image_anim_frame 0, 1, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 2, 1 - obj_image_anim_frame 1, 1 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_840B334:: @ 840B334 - obj_image_anim_frame 3, 1 - obj_image_anim_end - - .align 2 -gSpriteAnim_840B33C:: @ 840B33C - obj_image_anim_frame 4, 1 - obj_image_anim_end - - .align 2 -gSpriteAnim_840B344:: @ 840B344 - obj_image_anim_frame 5, 1 - obj_image_anim_end - - .align 2 -gSpriteAnim_840B34C:: @ 840B34C - obj_image_anim_frame 6, 4 - obj_image_anim_frame 7, 4 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_840B358:: @ 840B358 - obj_image_anim_frame 7, 4 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_840B360:: @ 840B360 - .4byte gSpriteAnim_840B318 - .4byte gSpriteAnim_840B334 - .4byte gSpriteAnim_840B33C - .4byte gSpriteAnim_840B344 - .4byte gSpriteAnim_840B34C - .4byte gSpriteAnim_840B358 - -gBallOpenParticleAnimNums:: @ 840B378 - .byte 0 - .byte 0 - .byte 0 - .byte 5 - .byte 1 - .byte 2 - .byte 2 - .byte 3 - .byte 5 - .byte 5 - .byte 4 - .byte 4 - - .align 2 -gBallOpenParticleAnimationFuncs:: @ 840B384 - .4byte PokeBallOpenParticleAnimation - .4byte GreatBallOpenParticleAnimation - .4byte SafariBallOpenParticleAnimation - .4byte UltraBallOpenParticleAnimation - .4byte MasterBallOpenParticleAnimation - .4byte SafariBallOpenParticleAnimation - .4byte DiveBallOpenParticleAnimation - .4byte UltraBallOpenParticleAnimation - .4byte RepeatBallOpenParticleAnimation - .4byte TimerBallOpenParticleAnimation - .4byte GreatBallOpenParticleAnimation - .4byte PremierBallOpenParticleAnimation - - .align 2 -gSpriteTemplates_840B3B4:: @ 840B3B4 - spr_template 55020, 55020, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55021, 55021, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55022, 55022, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55023, 55023, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55024, 55024, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55025, 55025, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55026, 55026, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55027, 55027, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55028, 55028, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55029, 55029, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55030, 55030, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 55031, 55031, gOamData_837DF24, gSpriteAnimTable_840B360, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 1 -gUnknown_0840B4D4:: @ 840B4D4 - .2byte 0x7ADF - .2byte 0x7AF0 - .2byte 0x53D7 - .2byte 0x3FFF - .2byte 0x7297 - .2byte 0x67F5 - .2byte 0x7B2C - .2byte 0x2B7E - .2byte 0x431F - .2byte 0x7BDD - .2byte 0x2A3F - .2byte 0x293F - .2byte 0x0 - .2byte 0x201 - .2byte 0x403 - .2byte 0x101 - .2byte 0x100 - .2byte 0x503 - .2byte 0x506 - .2byte 0x4 - - .align 2 -gBattleAnimSpriteTemplate_840B4FC:: @ 840B4FC - spr_template 10269, 10269, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8141C30 diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 42bfad289..6e3355ff0 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2980,7 +2980,7 @@ Move_FLASH: @ 81CB713 end Move_SPLASH: @ 81CB720 - createvisualtask sub_80D074C, 2, 0, 3 + createvisualtask AnimTask_Splash, 2, 0, 3 delay 8 loopsewithpan SE_W039, 192, 38, 3 waitforvisualfinish @@ -3059,7 +3059,7 @@ Move_SKETCH: @ 81CB87B createsprite gBattleAnimSpriteTemplate_83D77E0, 130 waitforvisualfinish clearmonbg ANIM_BANK_TARGET - createvisualtask sub_80D074C, 2, 0, 2 + createvisualtask AnimTask_Splash, 2, 0, 2 loopsewithpan SE_W039, 192, 38, 2 end @@ -3450,26 +3450,26 @@ Move_UPROAR: @ 81CBEFC Move_HEAT_WAVE: @ 81CBFC6 loadspritegfx 10261 - createvisualtask sub_80E2C60, 5, 10261, 0, 6, 6, 31 + createvisualtask AnimTask_BlendSpriteColor, 5, 10261, 0, 6, 6, rgb(31, 0, 0) createvisualtask do_boulder_dust, 5, 1 - createvisualtask sub_80D6080, 6, 6, 31 + createvisualtask AnimTask_BlendInterfaceColor, 6, 6, 31 panse_1B SE_W257, 192, 63, 2, 0 delay 4 createvisualtask sub_80D5DDC, 5 delay 12 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 10, 2304, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 10, 2304, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 90, 2048, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 90, 2048, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 50, 2560, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 50, 2560, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 20, 2304, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 20, 2304, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 70, 1984, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 70, 1984, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 0, 2816, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 0, 2816, 96, 1 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 60, 2560, 96, 1 + createsprite gFlyingDirtSpriteTemplate, 40, 60, 2560, 96, 1 end Move_HAIL: @ 81CC076 @@ -3911,9 +3911,9 @@ Move_LUSTER_PURGE: @ 81CC95B createsprite gBattleAnimSpriteTemplate_83DA9E0, 41, 0, 0, 0, 0 delay 20 createvisualtask sub_80E2A7C, 5, 5, 2, 0, 16, -1 - createvisualtask sub_80E2C60, 5, 10267, 2, 0, 16, -1 + createvisualtask AnimTask_BlendSpriteColor, 5, 10267, 2, 0, 16, 0xFFFF waitforvisualfinish - createvisualtask sub_80E2C60, 5, 10135, 0, 12, 12, 23552 + createvisualtask AnimTask_BlendSpriteColor, 5, 10135, 0, 12, 12, rgb(0, 0, 23) waitforvisualfinish createsprite gBattleAnimSpriteTemplate_83DB4F0, 131, 1, 2 createvisualtask sub_812B30C, 5, 215, 63 @@ -4005,7 +4005,7 @@ Move_TEETER_DANCE: @ 81CCBD1 Move_MUD_SPORT: @ 81CCC3C loadspritegfx 10074 - createvisualtask sub_80D074C, 2, 0, 6 + createvisualtask AnimTask_Splash, 2, 0, 6 delay 24 createsprite gMudSportDirtSpriteTemplate, 130, 0, -4, -16 createsprite gMudSportDirtSpriteTemplate, 130, 0, 4, -12 @@ -4167,7 +4167,7 @@ Move_FAKE_TEARS: @ 81CD10D loadspritegfx 10155 loadspritegfx 10209 loadspritegfx 10072 - createvisualtask sub_80E2C60, 5, 10155, 0, 4, 4, 32108 + createvisualtask AnimTask_BlendSpriteColor, 5, 10155, 0, 4, 4, rgb(12, 11, 31) waitforvisualfinish createvisualtask sub_812E568, 5, 0, 2, 1 loopsewithpan SE_W039, 192, 12, 4 @@ -6340,19 +6340,19 @@ Move_SANDSTORM: @ 81D0304 playsewithpan SE_W201, 0 createvisualtask do_boulder_dust, 5, 0 delay 16 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 10, 2304, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 10, 2304, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 90, 2048, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 90, 2048, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 50, 2560, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 50, 2560, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 20, 2304, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 20, 2304, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 70, 1984, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 70, 1984, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 0, 2816, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 0, 2816, 96, 0 delay 10 - createsprite gBattleAnimSpriteTemplate_83DACE8, 40, 60, 2560, 96, 0 + createsprite gFlyingDirtSpriteTemplate, 40, 60, 2560, 96, 0 end Move_WHIRLPOOL: @ 81D038C @@ -6856,20 +6856,20 @@ Move_ANCIENT_POWER: @ 81D0EE5 monbg ANIM_BANK_DEF_PARTNER setalpha 12, 8 createsprite gBattleAnimSpriteTemplate_83DB428, 2, 4, 1, 10, 1 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 20, 32, -48, 50, 2 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 0, 32, -38, 25, 5 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 32, 32, -28, 40, 3 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, -20, 32, -48, 50, 2 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 20, 32, -28, 60, 1 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 0, 32, -28, 30, 4 + createsprite gAncientPowerRockSpriteTemplate, 2, 20, 32, -48, 50, 2 + createsprite gAncientPowerRockSpriteTemplate, 2, 0, 32, -38, 25, 5 + createsprite gAncientPowerRockSpriteTemplate, 2, 32, 32, -28, 40, 3 + createsprite gAncientPowerRockSpriteTemplate, 2, -20, 32, -48, 50, 2 + createsprite gAncientPowerRockSpriteTemplate, 2, 20, 32, -28, 60, 1 + createsprite gAncientPowerRockSpriteTemplate, 2, 0, 32, -28, 30, 4 createvisualtask AnimTask_ShakeMon2, 2, ANIM_BANK_ATTACKER, 1, 0, 30, 1 playsewithpan SE_W082, 192 delay 10 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 15, 32, -48, 25, 5 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, -10, 32, -42, 30, 4 + createsprite gAncientPowerRockSpriteTemplate, 2, 15, 32, -48, 25, 5 + createsprite gAncientPowerRockSpriteTemplate, 2, -10, 32, -42, 30, 4 delay 10 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, 0, 32, -42, 25, 5 - createsprite gBattleAnimSpriteTemplate_83DAD60, 2, -25, 32, -48, 30, 4 + createsprite gAncientPowerRockSpriteTemplate, 2, 0, 32, -42, 25, 5 + createsprite gAncientPowerRockSpriteTemplate, 2, -25, 32, -48, 30, 4 waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, 2, 0, 16, 0, 0, 4 delay 3 @@ -7334,7 +7334,7 @@ Move_SHADOW_BALL: @ 81D1AEF waitbgfadein delay 15 createsoundtask sub_812B058, 168, -64, 63, 5, 5, 0, 5 - createsprite gBattleAnimSpriteTemplate_83DAEA8, 130, 16, 16, 8 + createsprite gShadowBallSpriteTemplate, 130, 16, 16, 8 waitforvisualfinish playsewithpan SE_W028, 63 createvisualtask AnimTask_ShakeMon2, 2, ANIM_BANK_TARGET, 4, 0, 8, 1 @@ -9551,7 +9551,7 @@ Move_DOOM_DESIRE: @ 81D52CB blendoff end -Unknown_81D532F: @ 81D532F +Move_DOOM_DESIRE_Activate: @ 81D532F loadspritegfx 10198 createsprite gSimplePaletteBlendSpriteTemplate, 2, 1, 3, 0, 16, rgb(31, 31, 31) waitforvisualfinish diff --git a/include/rom_8077ABC.h b/include/rom_8077ABC.h index 55c0f46c2..ab192f4ac 100644 --- a/include/rom_8077ABC.h +++ b/include/rom_8077ABC.h @@ -71,7 +71,7 @@ void sub_807A8D4(struct Sprite *sprite); void sub_807A960(struct Sprite *sprite); void sub_8078A34(struct Sprite *sprite); void InitAnimSpritePos(struct Sprite *sprite, u8); -void sub_8078764(struct Sprite *sprite, u8); +void sub_8078764(struct Sprite *sprite, bool8); void StartAnimLinearTranslation(struct Sprite *sprite); void sub_8078D60(struct Sprite *sprite); void InitAnimArcTranslation(struct Sprite *sprite); diff --git a/ld_script.txt b/ld_script.txt index 2a029366f..52fc65c42 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -734,7 +734,7 @@ SECTIONS { src/field_effect_helpers.o(.rodata); src/contest_ai.o(.rodata); src/battle/battle_controller_safari.o(.rodata); - data/battle_anim_812C144.o(.rodata); + src/battle/battle_anim_812C144.o(.rodata); src/move_tutor_menu.o(.rodata); src/decoration_inventory.o(.rodata); src/roamer.o(.rodata); @@ -743,7 +743,7 @@ SECTIONS { src/battle/battle_controller_wally.o(.rodata); src/player_pc.o(.rodata); src/intro.o(.rodata); - data/battle_anim_813F0F4.o(.rodata); + src/battle/battle_anim_813F0F4.o(.rodata); src/hall_of_fame.o(.rodata); src/credits.o(.rodata); src/lottery_corner.o(.rodata); diff --git a/src/battle/anim/current.c b/src/battle/anim/current.c index fb7bc4e1c..ea73b0116 100644 --- a/src/battle/anim/current.c +++ b/src/battle/anim/current.c @@ -463,7 +463,7 @@ static void sub_80D672C(struct Sprite *sprite) void sub_80D679C(struct Sprite *sprite) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->oam.tileNum += gBattleAnimArgs[3] * 4; if (gBattleAnimArgs[3] == 1) diff --git a/src/battle/anim/fight.c b/src/battle/anim/fight.c index 1a534aec7..505356a57 100644 --- a/src/battle/anim/fight.c +++ b/src/battle/anim/fight.c @@ -480,7 +480,7 @@ void AnimBasicFistOrFoot(struct Sprite *sprite) if (gBattleAnimArgs[3] == 0) InitAnimSpritePos(sprite, 1); else - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[2]; sprite->callback = WaitAnimForDuration; @@ -553,7 +553,7 @@ static void sub_80D927C(struct Sprite *sprite) void sub_80D92D0(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = 30; if (gBattleAnimArgs[2] == 0) @@ -593,7 +593,7 @@ void sub_80D9378(struct Sprite *sprite) if ((gAnimBankAttacker ^ 2) == gAnimBankTarget && GetBattlerPosition(gAnimBankTarget) < 2) gBattleAnimArgs[0] *= -1; - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; @@ -634,7 +634,7 @@ static void sub_80D9404(struct Sprite *sprite) // arg 3: spin duration void AnimSpinningKickOrPunch(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); StartSpriteAnim(sprite, gBattleAnimArgs[2]); sprite->data[0] = gBattleAnimArgs[3]; @@ -658,7 +658,7 @@ static void AnimSpinningKickOrPunchFinish(struct Sprite *sprite) // arg 2: initial wait duration void AnimStompFoot(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[2]; sprite->callback = AnimStompFootStep; @@ -689,7 +689,7 @@ void sub_80D9540(struct Sprite *sprite) { if (sprite->data[0] == 0) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[1] = gBattleAnimArgs[2]; sprite->data[2] = gBattleAnimArgs[3]; sprite->data[0]++; @@ -986,7 +986,7 @@ void sub_80D9BD4(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) InitAnimSpritePos(sprite, 0); else - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); if (IsContest()) { diff --git a/src/battle/anim/flying.c b/src/battle/anim/flying.c index 5c2f3a357..646c80c53 100644 --- a/src/battle/anim/flying.c +++ b/src/battle/anim/flying.c @@ -371,7 +371,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83DA65C = void sub_80DA034(struct Sprite *sprite) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->pos1.y += 20; sprite->data[1] = 0xBF; sprite->callback = sub_80DA05C; @@ -2178,7 +2178,7 @@ void sub_80DB000(struct Sprite *sprite) } else { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); } if ((!gBattleAnimArgs[2] && !GetBattlerSide(gAnimBankAttacker)) diff --git a/src/battle/anim/ghost.c b/src/battle/anim/ghost.c index c11cea5a0..cba7b2b82 100644 --- a/src/battle/anim/ghost.c +++ b/src/battle/anim/ghost.c @@ -24,8 +24,8 @@ static void sub_80DDD58(struct Sprite *sprite); static void sub_80DDD78(struct Sprite *); static void sub_80DDE7C(u8 taskId); static void sub_80DDED0(u8 taskId); -static void sub_80DDF40(struct Sprite *sprite); -static void sub_80DDFE8(struct Sprite *); +static void InitAnimShadowBall(struct Sprite *sprite); +static void AnimShadowBallStep(struct Sprite *); static void sub_80DE0FC(struct Sprite *sprite); static void sub_80DE114(struct Sprite *); static void sub_80DE2DC(u8 taskId); @@ -94,7 +94,7 @@ const union AffineAnimCmd *const gSpriteAffineAnimTable_83DAEA4[] = gSpriteAffineAnim_83DAE94, }; -const struct SpriteTemplate gBattleAnimSpriteTemplate_83DAEA8 = +const struct SpriteTemplate gShadowBallSpriteTemplate = { .tileTag = 10176, .paletteTag = 10176, @@ -102,7 +102,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83DAEA8 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gSpriteAffineAnimTable_83DAEA4, - .callback = sub_80DDF40, + .callback = InitAnimShadowBall, }; const union AnimCmd gSpriteAnim_83DAEC0[] = @@ -320,7 +320,7 @@ static void sub_80DDCC8(struct Sprite *sprite) static void sub_80DDD58(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->callback = sub_80DDD78; sub_80DDD78(sprite); } @@ -399,7 +399,12 @@ static void sub_80DDED0(u8 taskId) } } -static void sub_80DDF40(struct Sprite *sprite) +// Spins a sprite towards the target, pausing in the middle. +// Used in Shadow Ball. +// arg 0: duration step 1 (attacker -> center) +// arg 1: duration step 2 (spin center) +// arg 2: duration step 3 (center -> target) +static void InitAnimShadowBall(struct Sprite *sprite) { u16 r5, r6; r5 = sprite->pos1.x; @@ -414,10 +419,10 @@ static void sub_80DDF40(struct Sprite *sprite) sprite->data[5] = sprite->pos1.y << 4; sprite->data[6] = (((s16)r5 - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1); sprite->data[7] = (((s16)r6 - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1); - sprite->callback = sub_80DDFE8; + sprite->callback = AnimShadowBallStep; } -static void sub_80DDFE8(struct Sprite *sprite) +static void AnimShadowBallStep(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -463,7 +468,7 @@ static void sub_80DDFE8(struct Sprite *sprite) static void sub_80DE0FC(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->callback = sub_80DE114; } diff --git a/src/battle/anim/ground.c b/src/battle/anim/ground.c index cf73ead2f..407abeddc 100644 --- a/src/battle/anim/ground.c +++ b/src/battle/anim/ground.c @@ -196,7 +196,7 @@ static void AnimBonemerangProjectileEnd(struct Sprite *sprite) // arg 4: duration static void AnimBoneHitProjectile(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) gBattleAnimArgs[2] = -gBattleAnimArgs[2]; diff --git a/src/battle/anim/heal.c b/src/battle/anim/heal.c index c2bce0e77..e0b8f9b9e 100644 --- a/src/battle/anim/heal.c +++ b/src/battle/anim/heal.c @@ -41,7 +41,7 @@ void sub_80CBAA4(struct Sprite* sprite) { if (sprite->data[0] == 0) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->data[1] = gBattleAnimArgs[2]; } diff --git a/src/battle/anim/hop_2.c b/src/battle/anim/hop_2.c index ab239f3c4..108b06c60 100644 --- a/src/battle/anim/hop_2.c +++ b/src/battle/anim/hop_2.c @@ -35,7 +35,7 @@ void sub_80CBAE8(struct Sprite* sprite) { s16 p1; s16 p2; - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); p1 = GetBattlerSpriteCoord(gAnimBankAttacker, 0); p2 = GetBattlerSpriteCoord(gAnimBankAttacker, 1); if ((gAnimBankTarget ^ 2) == gAnimBankAttacker) diff --git a/src/battle/anim/ice.c b/src/battle/anim/ice.c index 0ff236523..e2288e704 100644 --- a/src/battle/anim/ice.c +++ b/src/battle/anim/ice.c @@ -851,7 +851,7 @@ static void AnimIceEffectParticle(struct Sprite *sprite) { if (gBattleAnimArgs[2] == 0) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); } else { @@ -1087,7 +1087,7 @@ static void AnimWaveFromCenterOfTarget(struct Sprite *sprite) { if (gBattleAnimArgs[2] == 0) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); } else { @@ -1144,7 +1144,7 @@ static void InitSwirlingFogAnim(struct Sprite *sprite) { if (gBattleAnimArgs[5] == 0) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); } else { @@ -2282,7 +2282,7 @@ static void InitIceBallParticle(struct Sprite *sprite) s16 randA, randB; sprite->oam.tileNum += 8; - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); randA = (Random() & 0xFF) + 256; randB = Random() & 0x1FF; diff --git a/src/battle/anim/normal.c b/src/battle/anim/normal.c index 7564c529c..54524f2ef 100644 --- a/src/battle/anim/normal.c +++ b/src/battle/anim/normal.c @@ -69,8 +69,8 @@ static void sub_80E260C(void); static void sub_80E255C(struct Sprite *sprite); static void sub_80E2710(u8 taskId); static void sub_80E29FC(struct Sprite *sprite); -static void sub_80E2C8C(u8 taskId, u32 selectedPalettes); -static void sub_80E2CD0(u8 taskId); +static void AnimTask_BlendSpriteColor_Step1(u8 taskId, u32 selectedPalettes); +static void AnimTask_BlendSpriteColor_Step2(u8 taskId); static void sub_80E2DB8(u8 taskId); static void sub_80E2E10(u8 taskId); static void sub_80E2EE8(struct Sprite *sprite); @@ -854,7 +854,7 @@ static void sub_80E27A0(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) InitAnimSpritePos(sprite, 1); else - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->callback = sub_80785E4; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); @@ -866,7 +866,7 @@ static void sub_80E27E8(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) InitAnimSpritePos(sprite, 1); else - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[4]; sprite->callback = sub_80785E4; @@ -890,7 +890,7 @@ static void sub_80E2870(struct Sprite *sprite) if (gBattleAnimArgs[0] == 0) InitAnimSpritePos(sprite, 0); else - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->pos2.x += (Random() % 48) - 24; sprite->pos2.y += (Random() % 24) - 12; @@ -916,7 +916,7 @@ static void sub_80E2978(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) InitAnimSpritePos(sprite, 1); else - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[3]; StoreSpriteCallbackInData(sprite, DestroyAnimSprite); @@ -929,7 +929,7 @@ static void sub_80E29C0(struct Sprite *sprite) if (gBattleAnimArgs[2] == 0) InitAnimSpritePos(sprite, 1); else - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->callback = sub_80E29FC; } @@ -950,7 +950,7 @@ void sub_80E2A38(u8 taskId) (gBattleAnimArgs[0] >> 9) & 1, (gBattleAnimArgs[0] >> 10) & 1); - sub_80E2C8C(taskId, selectedPalettes); + AnimTask_BlendSpriteColor_Step1(taskId, selectedPalettes); } void sub_80E2A7C(u8 taskId) @@ -1001,7 +1001,7 @@ void sub_80E2A7C(u8 taskId) } } - sub_80E2C8C(taskId, selectedPalettes); + AnimTask_BlendSpriteColor_Step1(taskId, selectedPalettes); } void sub_80E2B74(u8 taskId) @@ -1042,16 +1042,22 @@ void sub_80E2B74(u8 taskId) break; } - sub_80E2C8C(taskId, selectedPalettes); + AnimTask_BlendSpriteColor_Step1(taskId, selectedPalettes); } -void sub_80E2C60(u8 taskId) +// Used to add a color mask to a Sprite. +// arg 0: spriteId +// arg 1: ??? unknown +// arg 2: ??? unknown +// arg 3: coefficient +// arg 4: color code +void AnimTask_BlendSpriteColor(u8 taskId) { u8 paletteIndex = IndexOfSpritePaletteTag(gBattleAnimArgs[0]); - sub_80E2C8C(taskId, 1 << (paletteIndex + 16)); + AnimTask_BlendSpriteColor_Step1(taskId, 1 << (paletteIndex + 16)); } -static void sub_80E2C8C(u8 taskId, u32 selectedPalettes) +static void AnimTask_BlendSpriteColor_Step1(u8 taskId, u32 selectedPalettes) { gTasks[taskId].data[0] = selectedPalettes; gTasks[taskId].data[1] = selectedPalettes >> 16; @@ -1060,11 +1066,11 @@ static void sub_80E2C8C(u8 taskId, u32 selectedPalettes) gTasks[taskId].data[4] = gBattleAnimArgs[3]; gTasks[taskId].data[5] = gBattleAnimArgs[4]; gTasks[taskId].data[10] = gBattleAnimArgs[2]; - gTasks[taskId].func = sub_80E2CD0; + gTasks[taskId].func = AnimTask_BlendSpriteColor_Step2; gTasks[taskId].func(taskId); } -static void sub_80E2CD0(u8 taskId) +static void AnimTask_BlendSpriteColor_Step2(u8 taskId) { u32 selectedPalettes; u16 singlePaletteMask = 0; @@ -1577,7 +1583,7 @@ void sub_80E3A08(u8 taskId) for (j = 5; j != 0; j--) gBattleAnimArgs[j] = gBattleAnimArgs[j - 1]; - sub_80E2C8C(taskId, selectedPalettes); + AnimTask_BlendSpriteColor_Step1(taskId, selectedPalettes); } void sub_80E3A58(u8 taskId) diff --git a/src/battle/anim/orbit.c b/src/battle/anim/orbit.c index f938a2707..5d82b2842 100644 --- a/src/battle/anim/orbit.c +++ b/src/battle/anim/orbit.c @@ -89,7 +89,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83D6440 = void sub_80CABF8(struct Sprite* sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); StartSpriteAnim(sprite, gBattleAnimArgs[4]); if (gBattleAnimArgs[4] == 1) { diff --git a/src/battle/anim/orbs.c b/src/battle/anim/orbs.c index b97f0c246..d4886d1f8 100644 --- a/src/battle/anim/orbs.c +++ b/src/battle/anim/orbs.c @@ -267,7 +267,7 @@ void sub_80CA928(u8 taskId) void sub_80CA9A8(struct Sprite* sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[3]; sprite->data[2] = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->data[4] = GetBattlerSpriteCoord(gAnimBankAttacker, 3); diff --git a/src/battle/anim/psychic.c b/src/battle/anim/psychic.c index 704fa0306..ef263b971 100644 --- a/src/battle/anim/psychic.c +++ b/src/battle/anim/psychic.c @@ -562,9 +562,9 @@ void sub_80DBA4C(struct Sprite *sprite) if (sprite->data[0] == 0) { int arg3 = gBattleAnimArgs[3]; - u8 var0 = 0; + bool8 var0 = FALSE; if (arg3 == 0) - var0 = 1; + var0 = TRUE; if (!IsContest() && IsDoubleBattle()) { diff --git a/src/battle/anim/rock.c b/src/battle/anim/rock.c index 7738e4d0c..fa53df5b8 100644 --- a/src/battle/anim/rock.c +++ b/src/battle/anim/rock.c @@ -28,8 +28,8 @@ extern void AnimMoveTwisterParticle(struct Sprite *sprite); void sub_80DCE9C(struct Sprite *sprite); void sub_80DCF60(struct Sprite *sprite); void sub_80DCFE4(struct Sprite *sprite); -void sub_80DD3AC(struct Sprite *sprite); -void sub_80DD490(struct Sprite *sprite); +void AnimDirtParticleAcrossScreen(struct Sprite *sprite); +void AnimRaiseSprite(struct Sprite *sprite); void sub_80DD87C(struct Sprite *sprite); void sub_80DD8E8(struct Sprite *sprite); void sub_80DD978(struct Sprite *sprite); @@ -136,7 +136,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83DACD0 = .callback = sub_80DCFE4, }; -const struct SpriteTemplate gBattleAnimSpriteTemplate_83DACE8 = +const struct SpriteTemplate gFlyingDirtSpriteTemplate = { .tileTag = 10261, .paletteTag = 10261, @@ -144,7 +144,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83DACE8 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80DD3AC, + .callback = AnimDirtParticleAcrossScreen, }; const struct Subsprite gSubspriteTable_83DAD00[] = @@ -212,7 +212,7 @@ const union AnimCmd *const gSpriteAnimTable_83DAD58[] = gSpriteAnim_83DAD40, }; -const struct SpriteTemplate gBattleAnimSpriteTemplate_83DAD60 = +const struct SpriteTemplate gAncientPowerRockSpriteTemplate = { .tileTag = 10058, .paletteTag = 10058, @@ -220,7 +220,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83DAD60 = .anims = gSpriteAnimTable_83DAD48, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80DD490, + .callback = AnimRaiseSprite, }; const struct SpriteTemplate gSpriteTemplate_83DAD78 = @@ -387,7 +387,7 @@ void sub_80DCFE4(struct Sprite *sprite) if (gBattleAnimArgs[6] == 0) InitAnimSpritePos(sprite, 0); else - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->data[0] = gBattleAnimArgs[3]; sprite->data[1] = gBattleAnimArgs[2]; @@ -510,7 +510,13 @@ static void sub_80DD190(u8 taskId) } } -void sub_80DD3AC(struct Sprite *sprite) +// Animates the sprites that fly diagonally across the screen +// in Sandstorm and Heat Wave. +// arg 0: initial y pixel offset +// arg 1: projectile speed +// arg 2: y pixel drop +// arg 3: ??? unknown (possibly a color bit) +void AnimDirtParticleAcrossScreen(struct Sprite *sprite) { if (sprite->data[0] == 0) { @@ -555,7 +561,13 @@ void sub_80DD3AC(struct Sprite *sprite) } } -void sub_80DD490(struct Sprite *sprite) +// Animates the rising rocks in Ancient Power. +// arg 0: initial x pixel offset +// arg 1: initial y pixel offset +// arg 2: terminal y offset +// arg 3: duration +// arg 4: sprite size [1,5] +void AnimRaiseSprite(struct Sprite *sprite) { StartSpriteAnim(sprite, gBattleAnimArgs[4]); InitAnimSpritePos(sprite, 0); diff --git a/src/battle/anim/splash.c b/src/battle/anim/splash.c index c01748953..7e3d08554 100644 --- a/src/battle/anim/splash.c +++ b/src/battle/anim/splash.c @@ -8,7 +8,7 @@ extern s16 gBattleAnimArgs[]; extern u8 gAnimBankAttacker; extern u8 gAnimBankTarget; -static void sub_80D07AC(u8 taskId); +static void AnimTask_SplashStep(u8 taskId); // splash (splash effect of hopping up and down) // Used in Splash, Mud Sport, and Sketch. @@ -21,7 +21,10 @@ const union AffineAnimCmd gSpriteAffineAnim_83D76F4[] = AFFINEANIMCMD_END, }; -void sub_80D074C(u8 taskId) +// Task to facilitate expanding and hopping effect seen in Splash. +// arg 0: anim battler +// arg 1: num hops +void AnimTask_Splash(u8 taskId) { struct Task* task = &gTasks[taskId]; if (gBattleAnimArgs[1] == 0) @@ -37,11 +40,11 @@ void sub_80D074C(u8 taskId) task->data[3] = 0; task->data[4] = 0; sub_80798F4(task, spriteId, &gSpriteAffineAnim_83D76F4); - task->func = sub_80D07AC; + task->func = AnimTask_SplashStep; } } -void sub_80D07AC(u8 taskId) +void AnimTask_SplashStep(u8 taskId) { struct Task* task = &gTasks[taskId]; switch (task->data[1]) diff --git a/src/battle/anim/tendrils.c b/src/battle/anim/tendrils.c index 55e2c21bb..cee45b648 100644 --- a/src/battle/anim/tendrils.c +++ b/src/battle/anim/tendrils.c @@ -70,7 +70,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83D65A0 = void sub_80CB25C(struct Sprite* sprite) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->affineAnimPaused = 1; StartSpriteAffineAnim(sprite, gBattleAnimArgs[2]); sprite->data[6] = gBattleAnimArgs[2]; diff --git a/src/battle/anim/tile.c b/src/battle/anim/tile.c index 12cfd53b3..0442321d6 100644 --- a/src/battle/anim/tile.c +++ b/src/battle/anim/tile.c @@ -157,7 +157,7 @@ void sub_80CE108(u8 taskId) void sub_80CE17C(struct Sprite* sprite) { - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->animPaused = 1; sprite->data[0] = gBattleAnimArgs[2]; sprite->callback = sub_80CE1AC; diff --git a/src/battle/anim/water.c b/src/battle/anim/water.c index 1c354d916..487624224 100644 --- a/src/battle/anim/water.c +++ b/src/battle/anim/water.c @@ -192,7 +192,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_83D9438 = void sub_80D37FC(struct Sprite *sprite) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[4]; sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2]; @@ -206,7 +206,7 @@ void sub_80D3838(struct Sprite *sprite) { if (gBattleAnimArgs[3] != 0) { - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); } else { diff --git a/src/battle/anim/wisp_fire.c b/src/battle/anim/wisp_fire.c index c96a3a86f..a8ced992a 100644 --- a/src/battle/anim/wisp_fire.c +++ b/src/battle/anim/wisp_fire.c @@ -186,7 +186,10 @@ static void sub_80D5E4C(u8 taskId) } } -void sub_80D6080(u8 taskId) +// Used to add a color mask to the battle interface / HUD in Heat Wave. +// arg 0: opacity +// arg 1: color code +void AnimTask_BlendInterfaceColor(u8 taskId) { struct Struct_sub_8078914 unk; sub_8078914(&unk); diff --git a/src/battle/battle_anim_812C144.c b/src/battle/battle_anim_812C144.c index 6edc56549..4614f9aa9 100644 --- a/src/battle/battle_anim_812C144.c +++ b/src/battle/battle_anim_812C144.c @@ -31,35 +31,17 @@ extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern const struct SpriteTemplate gBattleAnimSpriteTemplate_83D7220; -extern const struct SpriteTemplate gSpriteTemplate_8402500; -extern const struct SpriteTemplate gSpriteTemplate_84028CC; -extern const struct SpriteTemplate gSpriteTemplate_840294C; -extern const struct SpriteTemplate gSpriteTemplate_84029AC; extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7C18[]; extern const union AffineAnimCmd *const gSpriteAffineAnimTable_81E7BEC[]; -extern const union AffineAnimCmd gUnknown_08402400[]; -extern const union AffineAnimCmd gUnknown_084024B0[]; -extern const union AffineAnimCmd gUnknown_08402518[]; -extern const union AffineAnimCmd gUnknown_08402540[]; -extern const union AffineAnimCmd gUnknown_08402590[]; -extern const union AffineAnimCmd gUnknown_08402610[]; -extern const union AffineAnimCmd gUnknown_08402750[]; -extern const union AffineAnimCmd gUnknown_084028AC[]; -extern const union AffineAnimCmd gUnknown_084029DC[]; extern const u32 gUnknown_08D2AA98[]; extern const u32 gUnknown_08D2A9E0[]; extern const u16 gUnknown_08D2AA80[]; -extern const s8 gUnknown_084025C0[]; -extern const s8 gUnknown_08402604[]; -extern const u8 gUnknown_08402608[]; -extern const struct SpriteTemplate gBattleAnimSpriteTemplate_84025EC; extern const u8 gUnknown_08D2E014[]; extern const u8 gUnknown_08D2E170[]; extern const u16 gUnknown_08D2E150[]; extern u8 gBattleMonForms[]; extern u8 gBankSpriteIds[]; extern u16 gBattlerPartyIndexes[]; -extern s16 gUnknown_084028E4[]; extern u8 sub_8046234(s16 x, s16 y, u8 a3); extern void sub_80DA48C(struct Sprite *); @@ -116,9 +98,1082 @@ static void sub_8131408(u8 taskId); static void sub_81315C8(struct Sprite *sprite); static void sub_8131810(u8 taskId); static void sub_8131838(struct Sprite *sprite); +static void sub_812C144(struct Sprite *sprite); +static void sub_812C220(struct Sprite *sprite); +static void sub_812C2BC(struct Sprite *sprite); +static void sub_812C358(struct Sprite *sprite); +static void sub_812C720(struct Sprite *sprite); +static void sub_812C80C(struct Sprite *sprite); +static void sub_812C848(struct Sprite *sprite); +static void sub_812C908(struct Sprite *sprite); +static void sub_812C990(struct Sprite *sprite); +static void sub_812CAFC(struct Sprite *sprite); +static void sub_812CC28(struct Sprite *sprite); +static void sub_812CCE8(struct Sprite *sprite); +static void sub_812D294(struct Sprite *sprite); +static void sub_812D3AC(struct Sprite *sprite); +static void sub_812D4B4(struct Sprite *sprite); +static void sub_812D588(struct Sprite *sprite); +static void sub_812DEAC(struct Sprite *sprite); +static void sub_812D724(struct Sprite *sprite); +static void sub_812E4F0(struct Sprite *sprite); +static void sub_812E7A0(struct Sprite *sprite); +static void sub_812EA4C(struct Sprite *sprite); +static void sub_812EC78(struct Sprite *sprite); +static void sub_812ED84(struct Sprite *sprite); +static void sub_812EEA4(struct Sprite *sprite); +static void sub_812F88C(struct Sprite *sprite); +static void sub_812F948(struct Sprite *sprite); +static void sub_812FF94(struct Sprite *sprite); +static void sub_81300F4(struct Sprite *sprite); +static void sub_81304DC(struct Sprite *sprite); +static void sub_813051C(struct Sprite *sprite); +static void sub_81307B0(struct Sprite *sprite); +static void sub_8130A2C(struct Sprite *sprite); +static void sub_8130AEC(struct Sprite *sprite); +static void sub_8130F5C(struct Sprite *sprite); +static void sub_8131264(struct Sprite *sprite); +extern void sub_80D1FDC(struct Sprite *sprite);// kiss_fountain.c +static void sub_8131564(struct Sprite *sprite); + +/*static*/ void sub_8131EB8(struct Sprite *sprite);// rest not yet decompiled +/*static*/ void sub_8132370(struct Sprite *sprite); +/*static*/ void sub_81323E0(struct Sprite *sprite); + +const union AnimCmd gSpriteAnim_8402164[] = +{ + ANIMCMD_FRAME(0 , 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_FRAME(64, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_840217C[] = +{ + gSpriteAnim_8402164, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402180 = +{ + .tileTag = 10137, + .paletteTag = 10137, + .oam = &gOamData_837E054, + .anims = gSpriteAnimTable_840217C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80793C4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402198 = +{ + .tileTag = 10016, + .paletteTag = 10016, + .oam = &gOamData_837DF54, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812C144, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84021B0 = +{ + .tileTag = 10017, + .paletteTag = 10017, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80794A8, +}; + +const union AnimCmd gSpriteAnim_84021C8[] = +{ + ANIMCMD_FRAME(0, 40), + ANIMCMD_FRAME(16, 8), + ANIMCMD_FRAME(32, 40), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_84021D8[] = +{ + gSpriteAnim_84021C8, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84021DC = +{ + .tileTag = 10190, + .paletteTag = 10190, + .oam = &gOamData_837DF34, + .anims = gSpriteAnimTable_84021D8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80793C4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84021F4 = +{ + .tileTag = 10191, + .paletteTag = 10191, + .oam = &gOamData_837E05C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812C220, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_840220C = +{ + .tileTag = 10189, + .paletteTag = 10189, + .oam = &gOamData_837DF94, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812C2BC, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402224[] = +{ + AFFINEANIMCMD_FRAME(0x180, 0x180, 0, 0), + AFFINEANIMCMD_FRAME(0xFFE0, 0x18, 0, 5), + AFFINEANIMCMD_FRAME(0x18, 0xFFE0, 0, 5), + AFFINEANIMCMD_JUMP(1), +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402244[] = +{ + AFFINEANIMCMD_FRAME(0x30, 0x30, 0, 0), + AFFINEANIMCMD_FRAME(0x20, 0x20, 0, 6), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_840225C[] = +{ + gSpriteAffineAnim_8402224, + gSpriteAffineAnim_8402244, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402264 = +{ + .tileTag = 10187, + .paletteTag = 10187, + .oam = &gOamData_837E11C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_840225C, + .callback = sub_812C358, +}; +const struct SpriteTemplate gBattleAnimSpriteTemplate_840227C = +{ + .tileTag = 10152, + .paletteTag = 10152, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812C720, +}; -void sub_812C144(struct Sprite *sprite) +const union AnimCmd gSpriteAnim_8402294[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(48, 3), + ANIMCMD_FRAME(64, 3), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_84022AC[] = +{ + gSpriteAnim_8402294, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84022B0 = +{ + .tileTag = 10027, + .paletteTag = 10027, + .oam = &gOamData_837DF34, + .anims = gSpriteAnimTable_84022AC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812C80C, +}; + +const union AnimCmd gSpriteAnim_84022C8[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_84022D0[] = +{ + gSpriteAnim_84022C8, +}; + +const union AffineAnimCmd gSpriteAffineAnim_84022D4[] = +{ + AFFINEANIMCMD_FRAME(0xFFF9, 0xFFF9, -3, 16), + AFFINEANIMCMD_FRAME(0x7, 0x7, 3, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_84022EC[] = +{ + gSpriteAffineAnim_84022D4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84022F0 = +{ + .tileTag = 10228, + .paletteTag = 10228, + .oam = &gOamData_837DF94, + .anims = gSpriteAnimTable_84022D0, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_84022EC, + .callback = sub_812C848, +}; + +const union AnimCmd gSpriteAnim_8402308[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(16, 16), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_840231C[] = +{ + gSpriteAnim_8402308, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402320[] = +{ + AFFINEANIMCMD_FRAME(0x200, 0x200, 0, 0), + AFFINEANIMCMD_FRAME(0xFFE0, 0xFFE0, 0, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402338[] = +{ + gSpriteAffineAnim_8402320, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_840233C = +{ + .tileTag = 10192, + .paletteTag = 10192, + .oam = &gOamData_837DFF4, + .anims = gSpriteAnimTable_840231C, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402338, + .callback = sub_812C908, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402354[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x180, 0, 0), + AFFINEANIMCMD_FRAME(0x10, 0x0, 0, 20), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gSpriteAffineAnim_840236C[] = +{ + AFFINEANIMCMD_FRAME(0x140, 0x180, 0, 0), + AFFINEANIMCMD_FRAME(0xFFF0, 0x0, 0, 19), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402384[] = +{ + gSpriteAffineAnim_8402354, + gSpriteAffineAnim_840236C, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_840238C = +{ + .tileTag = 10227, + .paletteTag = 10227, + .oam = &gOamData_837DFFC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402384, + .callback = sub_812C990, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84023A4 = +{ + .tileTag = 10247, + .paletteTag = 10247, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812CAFC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84023BC = +{ + .tileTag = 10247, + .paletteTag = 10247, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812CC28, +}; + +const union AnimCmd gSpriteAnim_84023D4[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(8, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gSpriteAnimTable_84023E4[] = +{ + gSpriteAnim_84023D4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84023E8 = +{ + .tileTag = 10229, + .paletteTag = 10229, + .oam = &gOamData_837DF54, + .anims = gSpriteAnimTable_84023E4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812CCE8, +}; + +const union AffineAnimCmd gUnknown_08402400[] = +{ + AFFINEANIMCMD_FRAME(-12, 8, 0, 4), + AFFINEANIMCMD_FRAME(20, -20, 0, 4), + AFFINEANIMCMD_FRAME(-8, 12, 0, 4), + AFFINEANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_8402420[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_8402428[] = +{ + gSpriteAnim_8402420, +}; + +const union AffineAnimCmd gSpriteAffineAnim_840242C[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, 5, 40), + AFFINEANIMCMD_FRAME(0x0, 0x0, 10, 10), + AFFINEANIMCMD_FRAME(0x0, 0x0, 15, 10), + AFFINEANIMCMD_FRAME(0x0, 0x0, 20, 40), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402454[] = +{ + gSpriteAffineAnim_840242C, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402458 = +{ + .tileTag = 10230, + .paletteTag = 10230, + .oam = &gOamData_837DFFC, + .anims = gSpriteAnimTable_8402428, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402454, + .callback = sub_812D294, +}; + +const union AnimCmd gSpriteAnim_8402470[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(48, 3), + ANIMCMD_FRAME(32, 3, .hFlip = TRUE), + ANIMCMD_FRAME(16, 3, .hFlip = TRUE), + ANIMCMD_FRAME(0, 3, .hFlip = TRUE), + ANIMCMD_LOOP(1), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_8402494[] = +{ + gSpriteAnim_8402470, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402498 = +{ + .tileTag = 10234, + .paletteTag = 10234, + .oam = &gOamData_837DF34, + .anims = gSpriteAnimTable_8402494, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80793C4, +}; + +const union AffineAnimCmd gUnknown_084024B0[] = +{ + AFFINEANIMCMD_FRAME(-12, 20, 0, 8), + AFFINEANIMCMD_FRAME(12, -20, 0, 8), + AFFINEANIMCMD_LOOP(2), + AFFINEANIMCMD_END, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84024D0 = +{ + .tileTag = 10226, + .paletteTag = 10226, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812D3AC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84024E8 = +{ + .tileTag = 10233, + .paletteTag = 10233, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812D4B4, +}; + +const struct SpriteTemplate gSpriteTemplate_8402500 = +{ + .tileTag = 10233, + .paletteTag = 10233, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812D588, +}; + +const union AffineAnimCmd gUnknown_08402518[] = +{ + AFFINEANIMCMD_FRAME(8, -8, 0, 12), + AFFINEANIMCMD_FRAME(-16, 16, 0, 12), + AFFINEANIMCMD_FRAME(8, -8, 0, 12), + AFFINEANIMCMD_LOOP(1), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gUnknown_08402540[] = +{ + AFFINEANIMCMD_FRAME(0, 6, 0, 20), + AFFINEANIMCMD_FRAME(0, 0, 0, 20), + AFFINEANIMCMD_FRAME(0, -18, 0, 6), + AFFINEANIMCMD_FRAME(-18, -18, 0, 3), + AFFINEANIMCMD_FRAME(0, 0, 0, 15), + AFFINEANIMCMD_FRAME(4, 4, 0, 13), + AFFINEANIMCMD_END, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402578 = +{ + .tileTag = 10236, + .paletteTag = 10236, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812D724, +}; + +const union AffineAnimCmd gUnknown_08402590[] = +{ + AFFINEANIMCMD_FRAME(0, 6, 0, 20), + AFFINEANIMCMD_FRAME(0, 0, 0, 20), + AFFINEANIMCMD_FRAME(7, -30, 0, 6), + AFFINEANIMCMD_FRAME(0, 0, 0, 20), + AFFINEANIMCMD_FRAME(-2, 3, 0, 20), + AFFINEANIMCMD_END, +}; + +const s8 gUnknown_084025C0[] = +{ + 0xE8, + 0x18, + 0xFC, + 0x00, +}; + +const union AnimCmd gSpriteAnim_84025C4[] = +{ + ANIMCMD_FRAME(0, 6), + ANIMCMD_FRAME(4, 6), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_84025D0[] = +{ + ANIMCMD_FRAME(8, 6), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_84025D8[] = +{ + ANIMCMD_FRAME(12, 6), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_84025E0[] = +{ + gSpriteAnim_84025C4, + gSpriteAnim_84025D0, + gSpriteAnim_84025D8, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84025EC = +{ + .tileTag = 10241, + .paletteTag = 10241, + .oam = &gOamData_837DF2C, + .anims = gSpriteAnimTable_84025E0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812DEAC, +}; + +const s8 gUnknown_08402604[] = +{ + 0x78, + 0x50, + 0x28, + 0x00, +}; + +const u8 gUnknown_08402608[] = +{ + 0, + 0, + 0, + 0, + 50, +}; + +const union AffineAnimCmd gUnknown_08402610[] = +{ + AFFINEANIMCMD_FRAME(0, -15, 0, 7), + AFFINEANIMCMD_FRAME(0, 15, 0, 7), + AFFINEANIMCMD_LOOP(2), + AFFINEANIMCMD_END, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402630 = +{ + .tileTag = 10087, + .paletteTag = 10087, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812E4F0, +}; + +const union AnimCmd gSpriteAnim_8402648[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(1, 8), + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(3, 8), + ANIMCMD_FRAME(3, 8, .vFlip = TRUE), + ANIMCMD_FRAME(2, 8, .vFlip = TRUE), + ANIMCMD_FRAME(0, 8, .vFlip = TRUE), + ANIMCMD_FRAME(1, 8, .vFlip = TRUE), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_840266C[] = +{ + ANIMCMD_FRAME(0, 8, .hFlip = TRUE), + ANIMCMD_FRAME(1, 8, .hFlip = TRUE), + ANIMCMD_FRAME(2, 8, .hFlip = TRUE), + ANIMCMD_FRAME(3, 8, .hFlip = TRUE), + ANIMCMD_FRAME(3, 8, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(2, 8, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(0, 8, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(1, 8, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_8402690[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_8402698[] = +{ + gSpriteAnim_8402648, + gSpriteAnim_840266C, + gSpriteAnim_8402690, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84026A4 = +{ + .tileTag = 10238, + .paletteTag = 10238, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_8402698, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812E7A0, +}; + +const u16 gUnknown_4026BC[] = INCBIN_U16("graphics/unknown/unknown_4026BC.gbapal"); + +const union AnimCmd gSpriteAnim_84026DC[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(4, 9), + ANIMCMD_FRAME(8, 5), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_84026EC[] = +{ + gSpriteAnim_84026DC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84026F0 = +{ + .tileTag = 10239, + .paletteTag = 10239, + .oam = &gOamData_837DF2C, + .anims = gSpriteAnimTable_84026EC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812EA4C, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402708 = +{ + .tileTag = 10240, + .paletteTag = 10240, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812EC78, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402720 = +{ + .tileTag = 10227, + .paletteTag = 10227, + .oam = &gOamData_837DFFC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402384, + .callback = sub_812ED84, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402738 = +{ + .tileTag = 10236, + .paletteTag = 10236, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812EEA4, +}; + +const union AffineAnimCmd gUnknown_08402750[] = +{ + AFFINEANIMCMD_FRAME(16, 0, 0, 4), + AFFINEANIMCMD_FRAME(0, -3, 0, 16), + AFFINEANIMCMD_FRAME(4, 0, 0, 4), + AFFINEANIMCMD_FRAME(0, 0, 0, 24), + AFFINEANIMCMD_FRAME(-5, 3, 0, 16), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402780[] = +{ + AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), + AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 0, 8), + AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 8), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd gSpriteAffineAnim_84027A0[] = +{ + AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0), + AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 8), + AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 0, 8), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd gSpriteAffineAnim_84027C0[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x8, 0x8, 0, 8), + AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF8, 0, 8), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_84027E0[] = +{ + gSpriteAffineAnim_8402780, + gSpriteAffineAnim_84027A0, + gSpriteAffineAnim_84027C0, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84027EC = +{ + .tileTag = 10242, + .paletteTag = 10242, + .oam = &gOamData_837DF94, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_84027E0, + .callback = sub_812F88C, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402804[] = +{ + AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), + AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFA, 0, 16), + AFFINEANIMCMD_FRAME(0x4, 0x6, 0, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402824[] = +{ + AFFINEANIMCMD_FRAME(0xC0, 0xC0, 0, 0), + AFFINEANIMCMD_FRAME(0x4, 0x6, 0, 16), + AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFA, 0, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402844[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x4, 0x6, 0, 16), + AFFINEANIMCMD_FRAME(0xFFFC, 0xFFFA, 0, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402864[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x8, 0xA, 0, 30), + AFFINEANIMCMD_FRAME(0xFFF8, 0xFFF6, 0, 16), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402884[] = +{ + gSpriteAffineAnim_8402804, + gSpriteAffineAnim_8402824, + gSpriteAffineAnim_8402844, + gSpriteAffineAnim_8402864, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402894 = +{ + .tileTag = 10242, + .paletteTag = 10242, + .oam = &gOamData_837DFF4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402884, + .callback = sub_812F948, +}; + +const union AffineAnimCmd gUnknown_084028AC[] = +{ + AFFINEANIMCMD_FRAME(-16, 16, 0, 6), + AFFINEANIMCMD_FRAME(16, -16, 0, 12), + AFFINEANIMCMD_FRAME(-16, 16, 0, 6), + AFFINEANIMCMD_END, +}; + +const struct SpriteTemplate gSpriteTemplate_84028CC = +{ + .tileTag = 10243, + .paletteTag = 10243, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_812FF94, +}; + +const u16 gUnknown_084028E4[] = INCBIN_U16("graphics/battle_anims/sprites/effect.gbapal"); + +const union AnimCmd gSpriteAnim_8402914[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_8402920[] = +{ + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(48, 3), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd *const gSpriteAnimTable_840292C[] = +{ + gSpriteAnim_8402914, + gSpriteAnim_8402920, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402934 = +{ + .tileTag = 10053, + .paletteTag = 10053, + .oam = &gOamData_837DF34, + .anims = gSpriteAnimTable_840292C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81300F4, +}; + +const struct SpriteTemplate gSpriteTemplate_840294C = +{ + .tileTag = 10248, + .paletteTag = 10248, + .oam = &gOamData_837DF24, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81304DC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402964 = +{ + .tileTag = 10252, + .paletteTag = 10252, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_813051C, +}; + +const union AffineAnimCmd gSpriteAffineAnim_840297C[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 24), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gSpriteAffineAnim_840298C[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, -64, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 4, 24), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_84029A4[] = +{ + gSpriteAffineAnim_840297C, + gSpriteAffineAnim_840298C, +}; + +const struct SpriteTemplate gSpriteTemplate_84029AC = +{ + .tileTag = 10254, + .paletteTag = 10254, + .oam = &gOamData_837DF94, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_84029A4, + .callback = SpriteCallbackDummy, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84029C4 = +{ + .tileTag = 10247, + .paletteTag = 10247, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_81307B0, +}; + +const union AffineAnimCmd gUnknown_084029DC[] = +{ + AFFINEANIMCMD_FRAME(0, -16, 0, 6), + AFFINEANIMCMD_FRAME(0, 16, 0, 6), + AFFINEANIMCMD_END,//0 +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_84029F4 = +{ + .tileTag = 10255, + .paletteTag = 10255, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8130A2C, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402A0C = +{ + .tileTag = 10247, + .paletteTag = 10247, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8130AEC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402A24 = +{ + .tileTag = 10258, + .paletteTag = 10258, + .oam = &gOamData_837E054, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8130F5C, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402A3C = +{ + .tileTag = 10233, + .paletteTag = 10233, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8131264, +}; + +const struct SpriteTemplate gSpriteTemplate_8402A54 = +{ + .tileTag = 10233, + .paletteTag = 10233, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80D1FDC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402A6C = +{ + .tileTag = 10250, + .paletteTag = 10250, + .oam = &gOamData_837DF3C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8131564, +}; + +const struct SpriteTemplate gSpriteTemplate_8402A84 = +{ + .tileTag = 10224, + .paletteTag = 10224, + .oam = &gOamData_837DF34, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8131EB8, +}; + +const union AnimCmd gSpriteAnim_8402A9C[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(64, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_8402AA8[] = +{ + gSpriteAnim_8402A9C, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402AAC[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402AC4[] = +{ + AFFINEANIMCMD_FRAME(0xFF00, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 4, 8), + AFFINEANIMCMD_END, +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402ADC[] = +{ + gSpriteAffineAnim_8402AAC, + gSpriteAffineAnim_8402AC4, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402AE4 = +{ + .tileTag = 10277, + .paletteTag = 10277, + .oam = &gOamData_837DF9C, + .anims = gSpriteAnimTable_8402AA8, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402ADC, + .callback = sub_8132370, +}; + +const union AffineAnimCmd gSpriteAffineAnim_8402AFC[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, -4, 64), + AFFINEANIMCMD_JUMP(0), +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8402B0C[] = +{ + gSpriteAffineAnim_8402AFC, +}; + +const struct SpriteTemplate gBattleAnimSpriteTemplate_8402B10 = +{ + .tileTag = 10278, + .paletteTag = 10278, + .oam = &gOamData_837E0BC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8402B0C, + .callback = sub_81323E0, +}; + +const union AffineAnimCmd gUnknown_08402B28[] = +{ + AFFINEANIMCMD_FRAME(0, 16, 0, 4), + AFFINEANIMCMD_FRAME(-2, 0, 0, 8), + AFFINEANIMCMD_FRAME(0, 4, 0, 4), + AFFINEANIMCMD_FRAME(0, 0, 0, 24), + AFFINEANIMCMD_FRAME(1, -5, 0, 16), + AFFINEANIMCMD_END, +}; + +static void sub_812C144(struct Sprite *sprite) { sprite->pos1.x += gBattleAnimArgs[0]; sprite->pos1.y += gBattleAnimArgs[1]; @@ -157,7 +1212,7 @@ void sub_812C1D0(u8 taskId) } -void sub_812C220(struct Sprite *sprite) +static void sub_812C220(struct Sprite *sprite) { sprite->data[0] = 90; sprite->callback = WaitAnimForDuration; @@ -184,13 +1239,13 @@ static void sub_812C2A4(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812C2BC(struct Sprite *sprite) +static void sub_812C2BC(struct Sprite *sprite) { u16 rotation; u8 x = GetBattlerSpriteCoord(gAnimBankTarget, 2); u8 y = GetBattlerSpriteCoord(gAnimBankTarget, 3); - sub_8078764(sprite, 1); + sub_8078764(sprite, TRUE); rotation = ArcTan2Neg(sprite->pos1.x - x, sprite->pos1.y - y); rotation += 0x6000; @@ -206,7 +1261,7 @@ void sub_812C2BC(struct Sprite *sprite) StoreSpriteCallbackInData(sprite, DestroyAnimSprite); } -void sub_812C358(struct Sprite *sprite) +static void sub_812C358(struct Sprite *sprite) { REG_BLDCNT = 0x3F40; REG_BLDALPHA = 0x1000; @@ -366,7 +1421,7 @@ static void sub_812C64C(u8 taskId) DestroyTask(taskId); } -void sub_812C720(struct Sprite *sprite) +static void sub_812C720(struct Sprite *sprite) { u16 x; u16 y; @@ -406,7 +1461,7 @@ static void sub_812C7C8(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812C80C(struct Sprite *sprite) +static void sub_812C80C(struct Sprite *sprite) { sub_8078650(sprite); sub_807867C(sprite, gBattleAnimArgs[0]); @@ -416,7 +1471,7 @@ void sub_812C80C(struct Sprite *sprite) } // This is likely fakematching due to some strange type casting behavior. -void sub_812C848(struct Sprite *sprite) +static void sub_812C848(struct Sprite *sprite) { int var0; int var1; @@ -459,7 +1514,7 @@ void sub_812C848(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812C908(struct Sprite *sprite) +static void sub_812C908(struct Sprite *sprite) { if (sprite->animEnded) DestroyAnimSprite(sprite); @@ -485,7 +1540,7 @@ void sub_812C960(u8 taskId) DestroyAnimVisualTask(taskId); } -void sub_812C990(struct Sprite *sprite) +static void sub_812C990(struct Sprite *sprite) { REG_WINOUT = 0x1F3F; REG_DISPCNT |= DISPCNT_OBJWIN_ON; @@ -494,7 +1549,7 @@ void sub_812C990(struct Sprite *sprite) REG_WIN0H = 0; REG_WIN0V = 0; - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->oam.objMode = ST_OAM_OBJ_WINDOW; sprite->invisible = 1; @@ -550,7 +1605,7 @@ static void sub_812CAD0(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812CAFC(struct Sprite *sprite) +static void sub_812CAFC(struct Sprite *sprite) { if (gBattleAnimArgs[3] == 0) { @@ -611,7 +1666,7 @@ static void sub_812CBB4(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812CC28(struct Sprite *sprite) +static void sub_812CC28(struct Sprite *sprite) { sprite->oam.objMode = ST_OAM_OBJ_WINDOW; sprite->data[3] = 255; @@ -644,7 +1699,7 @@ void sub_812CCA8(u8 taskId) DestroyAnimVisualTask(taskId); } -void sub_812CCE8(struct Sprite *sprite) +static void sub_812CCE8(struct Sprite *sprite) { int var0; if (gBattleAnimArgs[0] == 0) @@ -955,7 +2010,7 @@ static void sub_812D254(struct Sprite *sprite) } } -void sub_812D294(struct Sprite *sprite) +static void sub_812D294(struct Sprite *sprite) { if (sprite->data[0] == 0) InitAnimSpritePos(sprite, 0); @@ -1002,7 +2057,7 @@ void sub_812D350(u8 taskId) } } -void sub_812D3AC(struct Sprite *sprite) +static void sub_812D3AC(struct Sprite *sprite) { u8 spriteId = GetAnimBattlerSpriteId(0); @@ -1045,7 +2100,7 @@ void sub_812D3AC(struct Sprite *sprite) } } -void sub_812D4B4(struct Sprite *sprite) +static void sub_812D4B4(struct Sprite *sprite) { if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER) sprite->pos1.x = -16; @@ -1083,7 +2138,7 @@ static void sub_812D4EC(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812D588(struct Sprite *sprite) +static void sub_812D588(struct Sprite *sprite) { u8 rand; s8 y; @@ -1158,7 +2213,7 @@ void sub_812D6CC(u8 taskId) } } -void sub_812D724(struct Sprite *sprite) +static void sub_812D724(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -1414,7 +2469,7 @@ void sub_812DB84(u8 taskId) } } -void sub_812DEAC(struct Sprite *sprite) +static void sub_812DEAC(struct Sprite *sprite) { s16 var0; u8 spriteId1; @@ -1635,7 +2690,7 @@ void sub_812E498(u8 taskId) } } -void sub_812E4F0(struct Sprite *sprite) +static void sub_812E4F0(struct Sprite *sprite) { if (sprite->data[0] == 0) { @@ -1752,7 +2807,7 @@ static void sub_812E638(u8 taskId) } } -void sub_812E7A0(struct Sprite *sprite) +static void sub_812E7A0(struct Sprite *sprite) { if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER) { @@ -1883,7 +2938,7 @@ static void sub_812E8B4(u8 taskId) } } -void sub_812EA4C(struct Sprite *sprite) +static void sub_812EA4C(struct Sprite *sprite) { if (sprite->data[0] == 0) { @@ -1974,7 +3029,7 @@ void sub_812EB10(u8 taskId) } } -void sub_812EC78(struct Sprite *sprite) +static void sub_812EC78(struct Sprite *sprite) { u8 tileOffset; int rand1; @@ -2027,7 +3082,7 @@ static void sub_812ED24(struct Sprite *sprite) DestroyAnimSprite(sprite); } -void sub_812ED84(struct Sprite *sprite) +static void sub_812ED84(struct Sprite *sprite) { REG_WINOUT = 0x1F3F; REG_DISPCNT |= DISPCNT_OBJWIN_ON; @@ -2037,7 +3092,7 @@ void sub_812ED84(struct Sprite *sprite) REG_WIN0V = 0; sprite->data[0] = gBattleAnimArgs[2]; - sub_8078764(sprite, 0); + sub_8078764(sprite, FALSE); sprite->oam.objMode = ST_OAM_OBJ_WINDOW; sprite->invisible = 1; sprite->callback = sub_812EE00; @@ -2074,7 +3129,7 @@ static void sub_812EE00(struct Sprite *sprite) } } -void sub_812EEA4(struct Sprite *sprite) +static void sub_812EEA4(struct Sprite *sprite) { sprite->pos1.x = GetBattlerSpriteCoord(gAnimBankAttacker, 2); sprite->pos1.y = GetBattlerSpriteCoord(gAnimBankAttacker, 3); @@ -2757,7 +3812,7 @@ void sub_812F86C(struct Sprite *sprite) sprite->pos1.y = sprite->data[5] >> 4; } -void sub_812F88C(struct Sprite *sprite) +static void sub_812F88C(struct Sprite *sprite) { s16 x = sprite->pos1.x; s16 y = sprite->pos1.y; @@ -2790,7 +3845,7 @@ static void sub_812F8DC(struct Sprite *sprite) } } -void sub_812F948(struct Sprite *sprite) +static void sub_812F948(struct Sprite *sprite) { sprite->data[0] = gBattleAnimArgs[3]; StartSpriteAffineAnim(sprite, gBattleAnimArgs[0]); @@ -3039,7 +4094,7 @@ static void sub_812FEB8(u8 taskId, bool8 arg1) } } -void sub_812FF94(struct Sprite *sprite) +static void sub_812FF94(struct Sprite *sprite) { sprite->pos1.x += sprite->data[1]; sprite->pos1.y += sprite->data[2]; @@ -3094,7 +4149,7 @@ void sub_81300A4(u8 taskId) gUnknown_08D2E150); } -void sub_81300F4(struct Sprite *sprite) +static void sub_81300F4(struct Sprite *sprite) { if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_OPPONENT) gBattleAnimArgs[0] = -gBattleAnimArgs[0]; @@ -3259,7 +4314,7 @@ static void sub_8130424(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5 *y = y2 >> 8; } -void sub_81304DC(struct Sprite *sprite) +static void sub_81304DC(struct Sprite *sprite) { if (++sprite->data[0] > 36) { @@ -3268,7 +4323,7 @@ void sub_81304DC(struct Sprite *sprite) } } -void sub_813051C(struct Sprite *sprite) +static void sub_813051C(struct Sprite *sprite) { sprite->pos1.x = gBattleAnimArgs[0]; sprite->pos1.y = gBattleAnimArgs[1]; @@ -3349,7 +4404,7 @@ static void sub_81306A4(u8 taskId) } } -void sub_81307B0(struct Sprite *sprite) +static void sub_81307B0(struct Sprite *sprite) { u8 battler; @@ -3465,7 +4520,7 @@ static void sub_8130970(u8 taskId) } } -void sub_8130A2C(struct Sprite *sprite) +static void sub_8130A2C(struct Sprite *sprite) { if (gBattleAnimArgs[0] == 0) { @@ -3500,7 +4555,7 @@ static void sub_8130A94(struct Sprite *sprite) } } -void sub_8130AEC(struct Sprite *sprite) +static void sub_8130AEC(struct Sprite *sprite) { if (gBattleAnimArgs[0] == 0) { @@ -3715,7 +4770,7 @@ static void sub_8130DBC(u8 taskId) } } -void sub_8130F5C(struct Sprite *sprite) +static void sub_8130F5C(struct Sprite *sprite) { if (gBattleAnimArgs[0] == 0) { @@ -3855,7 +4910,7 @@ static void sub_81311E4(struct Sprite *sprite) sprite->data[5]++; } -void sub_8131264(struct Sprite *sprite) +static void sub_8131264(struct Sprite *sprite) { GetBattlerSpriteCoord(gAnimBankTarget, 2); // unused local variable GetBattlerSpriteCoord(gAnimBankTarget, 3); // unused local variable @@ -3973,7 +5028,7 @@ static void sub_8131408(u8 taskId) } } -void sub_8131564(struct Sprite *sprite) +static void sub_8131564(struct Sprite *sprite) { s16 y2; diff --git a/src/battle/battle_anim_813F0F4.c b/src/battle/battle_anim_813F0F4.c index f112c59aa..312cdf8c9 100755 --- a/src/battle/battle_anim_813F0F4.c +++ b/src/battle/battle_anim_813F0F4.c @@ -36,14 +36,9 @@ extern u8 gEffectBank; extern const u8 gUnknown_08D2EE48[]; extern const u8 gUnknown_08D2EDFC[]; extern const u16 gUnknown_08D2E150[]; -extern const struct CompressedSpritePalette gBallOpenParticlePalettes[]; extern const struct SpriteTemplate gSpriteTemplates_840B3B4[]; extern const struct SpriteTemplate gSpriteTemplate_8402500; extern const struct SpriteTemplate gBattleAnimSpriteTemplate_84024E8; -extern const u8 gBallOpenParticleAnimNums[]; -extern const struct CompressedSpriteSheet gBallOpenParticleSpritesheets[]; -extern const TaskFunc gBallOpenParticleAnimationFuncs[]; -extern const u16 gUnknown_0840B4D4[]; extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; @@ -86,6 +81,284 @@ static void sub_8141CBC(struct Sprite *sprite); static void sub_8141CF4(struct Sprite *sprite); static void sub_8141D20(struct Sprite *sprite); +extern const u8 gBattleAnimSpriteSheet_Particles[]; +const struct CompressedSpriteSheet gBallOpenParticleSpritesheets[] = +{ + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EC}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6ED}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EE}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6EF}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F0}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F1}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F2}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F3}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F4}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F5}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F6}, + {gBattleAnimSpriteSheet_Particles, 0x100, 0xD6F7}, +}; + +extern const u8 gBattleAnimSpritePalette_136[]; +const struct CompressedSpritePalette gBallOpenParticlePalettes[] = +{ + {gBattleAnimSpritePalette_136, 0xD6EC}, + {gBattleAnimSpritePalette_136, 0xD6ED}, + {gBattleAnimSpritePalette_136, 0xD6EE}, + {gBattleAnimSpritePalette_136, 0xD6EF}, + {gBattleAnimSpritePalette_136, 0xD6F0}, + {gBattleAnimSpritePalette_136, 0xD6F1}, + {gBattleAnimSpritePalette_136, 0xD6F2}, + {gBattleAnimSpritePalette_136, 0xD6F3}, + {gBattleAnimSpritePalette_136, 0xD6F4}, + {gBattleAnimSpritePalette_136, 0xD6F5}, + {gBattleAnimSpritePalette_136, 0xD6F6}, + {gBattleAnimSpritePalette_136, 0xD6F7}, +}; + +const union AnimCmd gSpriteAnim_840B318[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_FRAME(1, 1), + ANIMCMD_FRAME(2, 1), + ANIMCMD_FRAME(0, 1, .hFlip = TRUE), + ANIMCMD_FRAME(2, 1), + ANIMCMD_FRAME(1, 1), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_840B334[] = +{ + ANIMCMD_FRAME(3, 1), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_840B33C[] = +{ + ANIMCMD_FRAME(4, 1), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_840B344[] = +{ + ANIMCMD_FRAME(5, 1), + ANIMCMD_END, +}; + +const union AnimCmd gSpriteAnim_840B34C[] = +{ + ANIMCMD_FRAME(6, 4), + ANIMCMD_FRAME(7, 4), + ANIMCMD_JUMP(0), +}; + +const union AnimCmd gSpriteAnim_840B358[] = +{ + ANIMCMD_FRAME(7, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gSpriteAnimTable_840B360[] = +{ + gSpriteAnim_840B318, + gSpriteAnim_840B334, + gSpriteAnim_840B33C, + gSpriteAnim_840B344, + gSpriteAnim_840B34C, + gSpriteAnim_840B358, +}; + +const u8 gBallOpenParticleAnimNums[] = +{ + 0, + 0, + 0, + 5, + 1, + 2, + 2, + 3, + 5, + 5, + 4, + 4, +}; + +void PokeBallOpenParticleAnimation(u8); +void GreatBallOpenParticleAnimation(u8); +void SafariBallOpenParticleAnimation(u8); +void UltraBallOpenParticleAnimation(u8); +void MasterBallOpenParticleAnimation(u8); +void SafariBallOpenParticleAnimation(u8); +void DiveBallOpenParticleAnimation(u8); +void UltraBallOpenParticleAnimation(u8); +void RepeatBallOpenParticleAnimation(u8); +void TimerBallOpenParticleAnimation(u8); +void GreatBallOpenParticleAnimation(u8); +void PremierBallOpenParticleAnimation(u8); + +const TaskFunc gBallOpenParticleAnimationFuncs[] = +{ + PokeBallOpenParticleAnimation, + GreatBallOpenParticleAnimation, + SafariBallOpenParticleAnimation, + UltraBallOpenParticleAnimation, + MasterBallOpenParticleAnimation, + SafariBallOpenParticleAnimation, + DiveBallOpenParticleAnimation, + UltraBallOpenParticleAnimation, + RepeatBallOpenParticleAnimation, + TimerBallOpenParticleAnimation, + GreatBallOpenParticleAnimation, + PremierBallOpenParticleAnimation, +}; + +const struct SpriteTemplate gSpriteTemplates_840B3B4[] = +{ + { + .tileTag = 55020, + .paletteTag = 55020, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55021, + .paletteTag = 55021, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55022, + .paletteTag = 55022, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55023, + .paletteTag = 55023, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55024, + .paletteTag = 55024, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55025, + .paletteTag = 55025, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55026, + .paletteTag = 55026, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55027, + .paletteTag = 55027, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55028, + .paletteTag = 55028, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55029, + .paletteTag = 55029, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55030, + .paletteTag = 55030, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 55031, + .paletteTag = 55031, + .oam = &gOamData_837DF24, + .anims = gSpriteAnimTable_840B360, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, +}; + +const u16 gUnknown_0840B4D4[] = +{ + 0x7ADF, + 0x7AF0, + 0x53D7, + 0x3FFF, + 0x7297, + 0x67F5, + 0x7B2C, + 0x2B7E, + 0x431F, + 0x7BDD, + 0x2A3F, + 0x293F, + 0x0000, + 0x0201, + 0x0403, + 0x0101, + 0x0100, + 0x0503, + 0x0506, + 0x0004, +}; + +static void sub_8141C30(struct Sprite *sprite); +const struct SpriteTemplate gBattleAnimSpriteTemplate_840B4FC = +{ + .tileTag = 10269, + .paletteTag = 10269, + .oam = &gOamData_837DF2C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8141C30, +}; void unref_sub_813F0F4(u8 taskId) { @@ -1826,7 +2099,7 @@ void sub_8141C08(u8 taskId) DestroyAnimVisualTask(taskId); } -void sub_8141C30(struct Sprite *sprite) +static void sub_8141C30(struct Sprite *sprite) { InitAnimSpritePos(sprite, 0); sprite->data[0] = 30; diff --git a/src/crt0.s b/src/crt0.s index 049392be9..15698972d 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -13,7 +13,41 @@ Start: @ 8000000 b Init - .include "asm/rom_header.inc" + # These will be set by gbafix + + .global RomHeaderNintendoLogo +RomHeaderNintendoLogo: + .space 0x9c + +RomHeaderGameTitle: + .space 12 + +RomHeaderGameCode: + .4byte 0 + +RomHeaderMakerCode: + .2byte 0 + +RomHeaderMagic: + .byte 0x96 + +RomHeaderMainUnitCode: + .byte 0 + +RomHeaderDeviceType: + .byte 0 + +RomHeaderReserved1: + .space 7 + +RomHeaderSoftwareVersion: + .byte 0 + +RomHeaderChecksum: + .byte 0 + +RomHeaderReserved2: + .space 2 @ 80000C0 .word 0 diff --git a/src/rom_8077ABC.c b/src/rom_8077ABC.c index e81d02251..8e8e6ef8a 100644 --- a/src/rom_8077ABC.c +++ b/src/rom_8077ABC.c @@ -1445,16 +1445,17 @@ void sub_8079518(struct Sprite *sprite) void sub_8079534(struct Sprite *sprite) { - u8 r4, slot, r7; + bool8 r4; + u8 slot, r7; if (!gBattleAnimArgs[6]) { - r4 = 1; + r4 = TRUE; r7 = 3; } else { - r4 = 0; + r4 = FALSE; r7 = 1; } if (!gBattleAnimArgs[5]) diff --git a/tools/gbafix/.gitignore b/tools/gbafix/.gitignore new file mode 100644 index 000000000..3cebf8ae8 --- /dev/null +++ b/tools/gbafix/.gitignore @@ -0,0 +1,2 @@ +gbafix +README diff --git a/tools/gbafix/COPYING b/tools/gbafix/COPYING new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/tools/gbafix/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/tools/gbafix/Makefile b/tools/gbafix/Makefile new file mode 100644 index 000000000..f12c8cc4f --- /dev/null +++ b/tools/gbafix/Makefile @@ -0,0 +1,10 @@ +CC = gcc +.PHONY: clean + +SRCS = gbafix.c + +gbafix: $(SRCS) + $(CC) $(SRCS) -o $@ $(LDFLAGS) + +clean: + $(RM) gbafix gbafix.exe diff --git a/tools/gbafix/gbafix.c b/tools/gbafix/gbafix.c new file mode 100644 index 000000000..d5e2f62ab --- /dev/null +++ b/tools/gbafix/gbafix.c @@ -0,0 +1,289 @@ +/* + "$Id: gbafix.c,v 1.2 2008-07-30 17:12:51 wntrmute Exp $" + + DevkitPro GBA ROM fix utility + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. + + Please report all bugs and problems through the bug tracker at + "http://sourceforge.net/tracker/?group_id=114505&atid=668551". + + "$Header: /lvm/shared/ds/ds/cvs/devkitpro-cvsbackup/tools/gba/gbatools/gbafix.c,v 1.2 2008-07-30 17:12:51 wntrmute Exp $" + +*/ +//--------------------------------------------------------------------------------- +// gbafix.c +//--------------------------------------------------------------------------------- +/* + Gameboy Advance ROM fixer (by Dark Fader / BlackThunder / WinterMute / Diegoisawesome) + Validates header of GBA roms. + + History + ------- + v1.06 - added output silencing, (Diegoisawesome) + v1.05 - added debug offset argument, (Diegoisawesome) + v1.04 - converted to plain C, (WinterMute) + v1.03 - header.fixed, header.device_type + v1.02 - redefined the options (rgbfix style), checksum=0 + v1.01 - fix in parameters + v1.00 - logo, complement +*/ + +#pragma pack(1) + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> + +#define VER "1.06" +#define ARGV argv[arg] +#define VALUE (ARGV+2) +#define NUMBER strtoul(VALUE, NULL, 0) + +typedef struct +{ + uint32_t start_code; // B instruction + uint8_t logo[0xA0-0x04]; // logo data + uint8_t title[0xC]; // game title name + uint32_t game_code; // + uint16_t maker_code; // + uint8_t fixed; // 0x96 + uint8_t unit_code; // 0x00 + uint8_t device_type; // 0x00 + uint8_t unused[7]; // + uint8_t game_version; // 0x00 + uint8_t complement; // 800000A0..800000BC + uint16_t checksum; // 0x0000 +} Header; + + +Header header; + +unsigned short checksum_without_header = 0; + +const Header good_header = +{ + // start_code + 0xEA00002E, + // logo + { 0x24,0xFF,0xAE,0x51,0x69,0x9A,0xA2,0x21,0x3D,0x84,0x82,0x0A,0x84,0xE4,0x09,0xAD, + 0x11,0x24,0x8B,0x98,0xC0,0x81,0x7F,0x21,0xA3,0x52,0xBE,0x19,0x93,0x09,0xCE,0x20, + 0x10,0x46,0x4A,0x4A,0xF8,0x27,0x31,0xEC,0x58,0xC7,0xE8,0x33,0x82,0xE3,0xCE,0xBF, + 0x85,0xF4,0xDF,0x94,0xCE,0x4B,0x09,0xC1,0x94,0x56,0x8A,0xC0,0x13,0x72,0xA7,0xFC, + 0x9F,0x84,0x4D,0x73,0xA3,0xCA,0x9A,0x61,0x58,0x97,0xA3,0x27,0xFC,0x03,0x98,0x76, + 0x23,0x1D,0xC7,0x61,0x03,0x04,0xAE,0x56,0xBF,0x38,0x84,0x00,0x40,0xA7,0x0E,0xFD, + 0xFF,0x52,0xFE,0x03,0x6F,0x95,0x30,0xF1,0x97,0xFB,0xC0,0x85,0x60,0xD6,0x80,0x25, + 0xA9,0x63,0xBE,0x03,0x01,0x4E,0x38,0xE2,0xF9,0xA2,0x34,0xFF,0xBB,0x3E,0x03,0x44, + 0x78,0x00,0x90,0xCB,0x88,0x11,0x3A,0x94,0x65,0xC0,0x7C,0x63,0x87,0xF0,0x3C,0xAF, + 0xD6,0x25,0xE4,0x8B,0x38,0x0A,0xAC,0x72,0x21,0xD4,0xF8,0x07 } , + // title + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + // game code + 0x00000000, + // maker code + 0x3130, + // fixed + 0x96, + // unit_code + 0x00, + // device type + 0x00, + // unused + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + // game version + 0x00, + // complement + 0x00, + // checksum + 0x0000 +}; + +//--------------------------------------------------------------------------------- +char HeaderComplement() +/*--------------------------------------------------------------------------------- + Calculate Header complement check +---------------------------------------------------------------------------------*/ +{ + int n; + char c = 0; + char *p = (char *)&header + 0xA0; + for (n=0; n<0xBD-0xA0; n++) + { + c += *p++; + } + return -(0x19+c); +} + + +//--------------------------------------------------------------------------------- +int main(int argc, char *argv[]) +//--------------------------------------------------------------------------------- +{ + int arg; + char *argfile = 0; + FILE *infile; + int silent = 0; + + int size,bit; + + // show syntax + if (argc <= 1) + { + printf("GBA ROM fixer v"VER" by Dark Fader / BlackThunder / WinterMute / Diegoisawesome \n"); + printf("Syntax: gbafix <rom.gba> [-p] [-t[title]] [-c<game_code>] [-m<maker_code>] [-r<version>] [-d<debug>] [--silent]\n"); + printf("\n"); + printf("parameters:\n"); + printf(" -p Pad to next exact power of 2. No minimum size!\n"); + printf(" -t[<title>] Patch title. Stripped filename if none given.\n"); + printf(" -c<game_code> Patch game code (four characters)\n"); + printf(" -m<maker_code> Patch maker code (two characters)\n"); + printf(" -r<version> Patch game version (number)\n"); + printf(" -d<debug> Enable debugging handler and set debug entry point (0 or 1)\n"); + printf(" --silent Silence non-error output\n"); + return -1; + } + + // get filename + for (arg=1; arg<argc; arg++) + { + if ((ARGV[0] != '-')) { argfile=ARGV; } + if (strncmp("--silent", &ARGV[0], 7) == 0) { silent = 1; } + } + + // check filename + if (!argfile) + { + fprintf(stderr, "Filename needed!\n"); + return -1; + } + + // read file + infile = fopen(argfile, "r+b"); + if (!infile) { fprintf(stderr, "Error opening input file!\n"); return -1; } + fseek(infile, 0, SEEK_SET); + fread(&header, sizeof(header), 1, infile); + + // fix some data + memcpy(header.logo, good_header.logo, sizeof(header.logo)); + memcpy(&header.fixed, &good_header.fixed, sizeof(header.fixed)); + memcpy(&header.device_type, &good_header.device_type, sizeof(header.device_type)); + + // parse command line + for (arg=1; arg<argc; arg++) + { + if ((ARGV[0] == '-')) + { + switch (ARGV[1]) + { + case 'p': // pad + { + fseek(infile, 0, SEEK_END); + size = ftell(infile); + for (bit=31; bit>=0; bit--) if (size & (1<<bit)) break; + if (size != (1<<bit)) + { + int todo = (1<<(bit+1)) - size; + while (todo--) fputc(0xFF, infile); + } + fseek(infile, 0, SEEK_SET); + break; + } + + case 't': // title + { + char title[256]; + memset(title, 0, sizeof(title)); + if (VALUE[0]) + { + strncpy(title, VALUE, sizeof(header.title)); + } + else + { + // use filename + char s[256], *begin=s, *t; strcpy(s, argfile); + t = strrchr(s, '\\'); if (t) begin = t+1; + t = strrchr(s, '/'); if (t) begin = t+1; + t = strrchr(s, '.'); if (t) *t = 0; + strncpy(title, begin, sizeof(header.title)); + if (!silent) printf("%s\n",begin); + } + memcpy(header.title, title, sizeof(header.title)); // copy + break; + } + + case 'c': // game code + { + //if (!VALUE[0]) { fprintf(stderr, "Need value for %s\n", ARGV); break; } + //header.game_code = NUMBER; + header.game_code = VALUE[0] | VALUE[1]<<8 | VALUE[2]<<16 | VALUE[3]<<24; + break; + } + + case 'm': // maker code + { + //if (!VALUE[0]) { fprintf(stderr, "Need value for %s\n", ARGV); break; } + //header.maker_code = (unsigned short)NUMBER; + header.maker_code = VALUE[0] | VALUE[1]<<8; + break; + } + + case 'v': // ignored, compatability with other gbafix + { + break; + } + + case 'r': // version + { + if (!VALUE[0]) { fprintf(stderr, "Need value for %s\n", ARGV); break; } + header.game_version = (unsigned char)NUMBER; + break; + } + + case 'd': // debug + { + if (!VALUE[0]) { fprintf(stderr, "Need value for %s\n", ARGV); break; } + header.logo[0x9C-0x04] = 0xA5; // debug enable + header.device_type = (unsigned char)((NUMBER & 1) << 7); // debug handler entry point + break; + } + case '-': // long arguments + { + if (strncmp("silent", &ARGV[2], 6) == 0) { continue; } + break; + } + default: + { + printf("Invalid option: %s\n", ARGV); + } + } + } + } + + // update complement check & total checksum + header.complement = 0; + header.checksum = 0; // must be 0 + header.complement = HeaderComplement(); + //header.checksum = checksum_without_header + HeaderChecksum(); + + fseek(infile, 0, SEEK_SET); + fwrite(&header, sizeof(header), 1, infile); + fclose(infile); + + if (!silent) printf("ROM fixed!\n"); + + return 0; +} |