From 13c2f91b11a9ae773fd22b045f37b85c6e1ed984 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 23:51:39 -0500 Subject: [PATCH] Moved last contest data into C --- data/contest.s | 58 -------------------- ld_script.txt | 1 - src/contest.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 134 insertions(+), 65 deletions(-) delete mode 100644 data/contest.s diff --git a/data/contest.s b/data/contest.s deleted file mode 100644 index c04c31577..000000000 --- a/data/contest.s +++ /dev/null @@ -1,58 +0,0 @@ -#include "constants/species.h" -#include "constants/moves.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - - .align 2 -gUnknown_08589904:: @ 8589904 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80e8 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80e9 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80ea - obj_tiles gBlankGfxCompressed, 0x1000, 0x80eb - - .align 2 -gUnknown_08589924:: @ 8589924 Yup this is super dangerous but that's how it is here - obj_pal gHeap + 0x1A0A4, 0x80e8 - obj_pal gHeap + 0x1A0C4, 0x80e9 - obj_pal gHeap + 0x1A0E4, 0x80ea - obj_pal gHeap + 0x1A104, 0x80eb - - .align 2 -gOamData_8589944:: @ 8589944 - .2byte 0x0700 - .2byte 0xC000 - .2byte 0x0000 - - .align 2 -gSpriteAffineAnim_858994C:: @ 858994C - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_858995C:: @ 858995C - obj_rot_scal_anim_frame 0x3, 0x3, 0, 15 - obj_rot_scal_anim_frame 0xFFFD, 0xFFFD, 0, 15 - obj_rot_scal_anim_frame 0x3, 0x3, 0, 15 - obj_rot_scal_anim_frame 0xFFFD, 0xFFFD, 0, 15 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8589984:: @ 8589984 - .4byte gSpriteAffineAnim_858994C - .4byte gSpriteAffineAnim_858995C - - .align 2 -gSpriteTemplate_858998C:: @ 858998C - spr_template 0x80e8, 0x80e8, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80e9, 0x80e9, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80ea, 0x80ea, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80eb, 0x80eb, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - - .align 2 -gContestExcitementTable:: @ 85899EC - .2byte 0x0001, 0xffff, 0x0000, 0x0001, 0xffff, 0x00ff, 0x0001, 0xffff, 0x00ff, 0x0001, 0xff00, 0x00ff, 0x0001, 0x0000 - - diff --git a/ld_script.txt b/ld_script.txt index b87bb34f3..5293c7e23 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -462,7 +462,6 @@ SECTIONS { src/battle_anim_80D51AC.o(.rodata); src/item.o(.rodata); src/contest.o(.rodata); - data/contest.o(.rodata); src/shop.o(.rodata); src/fldeff_escalator.o(.rodata); src/berry.o(.rodata); diff --git a/src/contest.c b/src/contest.c index bebe344b9..da3075e65 100644 --- a/src/contest.c +++ b/src/contest.c @@ -247,10 +247,6 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const struct SpriteTemplate gSpriteTemplate_8587AD0; extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; extern void (*const gContestEffectFuncs[])(void); -extern const s8 gContestExcitementTable[][5]; -extern const struct CompressedSpriteSheet gUnknown_08589904[]; -extern const struct SpritePalette gUnknown_08589924[]; -extern const struct SpriteTemplate gSpriteTemplate_858998C[]; static const u8 gUnknown_08587A6C[] = { @@ -722,6 +718,138 @@ const struct WindowTemplate gUnknown_08587F44[] = #include "data/contest_opponents.h" +static const struct CompressedSpriteSheet sUnknown_08589904[] = +{ + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80E8 + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80E9 + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80EA + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80EB + } +}; + +// Yup this is super dangerous but that's how it is here +static const struct SpritePalette sUnknown_08589924[] = +{ + { + .data = (u16*)(gHeap + 0x1A0A4), + .tag = 0x80E8 + }, + { + .data = (u16*)(gHeap + 0x1A0C4), + .tag = 0x80E9 + }, + { + .data = (u16*)(gHeap + 0x1A0E4), + .tag = 0x80EA + }, + { + .data = (u16*)(gHeap + 0x1A104), + .tag = 0x80EB + } +}; + +const struct OamData gOamData_8589944 = +{ + .y = 0, + .affineMode = 3, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +const union AffineAnimCmd gSpriteAffineAnim_858994C[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gSpriteAffineAnim_858995C[] = +{ + AFFINEANIMCMD_FRAME(3, 3, 0, 15), + AFFINEANIMCMD_FRAME(-3, -3, 0, 15), + AFFINEANIMCMD_FRAME(3, 3, 0, 15), + AFFINEANIMCMD_FRAME(-3, -3, 0, 15), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8589984[] = +{ + gSpriteAffineAnim_858994C, + gSpriteAffineAnim_858995C +}; + +const struct SpriteTemplate gSpriteTemplate_858998C[] = +{ + { + .tileTag = 0x80E8, + .paletteTag = 0x80E8, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80E9, + .paletteTag = 0x80E9, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80EA, + .paletteTag = 0x80EA, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80EB, + .paletteTag = 0x80EB, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + } +}; + +const s8 gContestExcitementTable[][5] = +{ + { 1, 0, -1, -1, 0}, + { 0, 1, 0, -1, -1}, + {-1, 0, 1, 0, -1}, + {-1, -1, 0, 1, 0}, + { 0, -1, -1, 0, 1} +}; + static void TaskDummy1(u8 taskId) { } @@ -3763,8 +3891,8 @@ static u8 sub_80DC9EC(u8 a) u8 spriteId1, spriteId2; u8 x = gUnknown_02039F26[a] * 40 + 32; - LoadCompressedSpriteSheet(&gUnknown_08589904[a]); - LoadSpritePalette(&gUnknown_08589924[a]); + LoadCompressedSpriteSheet(&sUnknown_08589904[a]); + LoadSpritePalette(&sUnknown_08589924[a]); spriteId1 = CreateSprite(&gSpriteTemplate_858998C[a], 184, x, 29); spriteId2 = CreateSprite(&gSpriteTemplate_858998C[a], 248, x, 29); gSprites[spriteId2].oam.tileNum += 64;