From ac1738e11dcfc0a574f90b4f4905c2533630eb50 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 11 Feb 2020 13:54:23 -0500 Subject: [PATCH] Move smokescreen data to src --- data/smokescreen.s | 64 ------------------- include/graphics.h | 5 ++ ld_script.txt | 2 +- src/smokescreen.c | 150 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 152 insertions(+), 69 deletions(-) delete mode 100644 data/smokescreen.s diff --git a/data/smokescreen.s b/data/smokescreen.s deleted file mode 100644 index 3cd16ee13..000000000 --- a/data/smokescreen.s +++ /dev/null @@ -1,64 +0,0 @@ -@ data used in battle_7.s and smokescreen.s, can't split because they're interleaved - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_0831C604:: @ 831C604 - .byte 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x02, 0x00 - .byte 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x02, 0x01 - .byte 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01 - .byte 0x00, 0x00, 0x00, 0x00 - - .align 2 -gSmokescreenImpactSpriteSheet:: @ 831C620 - obj_tiles gSmokescreenImpactTiles, 0x0180, 0xd6eb - - .align 2 -gSmokescreenlImpactSpritePalette:: @ 831C628 - obj_pal gSmokescreenImpactPalette, 0xd6eb - - .align 2 -gUnknown_0831C630:: @ 831C630 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_0831C638:: @ 831C638 - .2byte 0x0000, 0x0004, 0x0004, 0x0004, 0x0008, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_0831C648:: @ 831C648 - .2byte 0x0000, 0x0044, 0x0004, 0x0044, 0x0008, 0x0044, 0xffff, 0x0000 - - .align 2 -gUnknown_0831C658:: @ 831C658 - .2byte 0x0000, 0x0084, 0x0004, 0x0084, 0x0008, 0x0084, 0xffff, 0x0000 - - .align 2 -gUnknown_0831C668:: @ 831C668 - .2byte 0x0000, 0x00c4, 0x0004, 0x00c4, 0x0008, 0x00c4, 0xffff, 0x0000 - - .align 2 -gUnknown_0831C678:: @ 831C678 - .4byte gUnknown_0831C638 - .4byte gUnknown_0831C648 - .4byte gUnknown_0831C658 - .4byte gUnknown_0831C668 - - .align 2 -gSmokescreenImpactSpriteTemplate:: @ 831C688 - spr_template 0xd6eb, 0xd6eb, gUnknown_0831C630, gUnknown_0831C678, NULL, gDummySpriteAffineAnimTable, SpriteCB_DestroySprite - - .align 2 -gSpriteSheet_EnemyShadow:: @ 831C6A0 - obj_tiles gEnemyMonShadow_Gfx, 0x0080, 0xd759 - - .align 2 -gUnknown_0831C6A8:: @ 831C6A8 - .byte 0x00, 0x40, 0x00, 0x40, 0x00, 0x0c, 0x00, 0x00 - - .align 2 -gSpriteTemplate_EnemyShadow:: @ 831C6B0 - spr_template 0xd759, 0xd6ff, gUnknown_0831C6A8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCB_SetInvisible diff --git a/include/graphics.h b/include/graphics.h index b0bb0a729..bf3fcb763 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4142,6 +4142,9 @@ extern const u32 gBattleWindowTextPalette[]; extern const u32 gContest2Pal[]; +extern const u32 gSmokescreenImpactTiles[]; +extern const u32 gSmokescreenImpactPalette[]; + extern const u32 gBattleAnimSpriteGfx_Bone[]; extern const u32 gBattleAnimSpriteGfx_Spark[]; extern const u32 gBattleAnimSpriteGfx_Pencil[]; @@ -4800,6 +4803,8 @@ extern const u32 gBattleAnimBgImage_Surf[]; extern const u32 gBattleAnimBgPalette_Surf[]; extern const u32 gBattleAnimBackgroundImageMuddyWater_Pal[]; +extern const u32 gEnemyMonShadow_Gfx[]; + extern const u32 gBattleAnimFogTilemap[]; extern const u32 gUsePokeblockGraph_Gfx[]; diff --git a/ld_script.txt b/ld_script.txt index 880b85b0a..6cfe5eebd 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -468,7 +468,7 @@ SECTIONS { src/battle_util.o(.rodata); src/battle_script_commands.o(.rodata); src/battle_controller_player.o(.rodata); - data/smokescreen.o(.rodata); + src/smokescreen.o(.rodata); src/battle_controller_opponent.o(.rodata); src/battle_ai_switch_items.o(.rodata); src/battle_controller_link_opponent.o(.rodata); diff --git a/src/smokescreen.c b/src/smokescreen.c index 1ee0c658c..7d83251bc 100644 --- a/src/smokescreen.c +++ b/src/smokescreen.c @@ -1,14 +1,156 @@ #include "global.h" +#include "battle_gfx_sfx_util.h" #include "data.h" #include "decompress.h" +#include "graphics.h" #include "sprite.h" #include "util.h" +#include "constants/pokemon.h" static void SmokescreenImpact_Callback(struct Sprite *); +static void SpriteCB_DestroySprite(struct Sprite *sprite); -extern const struct CompressedSpriteSheet gSmokescreenImpactSpriteSheet; -extern const struct CompressedSpritePalette gSmokescreenlImpactSpritePalette; -extern const struct SpriteTemplate gSmokescreenImpactSpriteTemplate; +// The below data for smokescreen starts and ends with some data that belongs to battle_gfx_sfx_util.c + +const u8 gUnknown_0831C604[] = +{ + [NATURE_HARDY] = 0, + [NATURE_LONELY] = 0, + [NATURE_BRAVE] = 1, + [NATURE_ADAMANT] = 0, + [NATURE_NAUGHTY] = 1, + [NATURE_BOLD] = 1, + [NATURE_DOCILE] = 2, + [NATURE_RELAXED] = 0, + [NATURE_IMPISH] = 0, + [NATURE_LAX] = 0, + [NATURE_TIMID] = 1, + [NATURE_HASTY] = 1, + [NATURE_SERIOUS] = 1, + [NATURE_JOLLY] = 0, + [NATURE_NAIVE] = 2, + [NATURE_MODEST] = 1, + [NATURE_MILD] = 0, + [NATURE_QUIET] = 1, + [NATURE_BASHFUL] = 1, + [NATURE_RASH] = 0, + [NATURE_CALM] = 0, + [NATURE_GENTLE] = 0, + [NATURE_SASSY] = 1, + [NATURE_CAREFUL] = 1, + [NATURE_QUIRKY] = 0, +}; + +static const struct CompressedSpriteSheet gSmokescreenImpactSpriteSheet = +{ + .data = gSmokescreenImpactTiles, .size = 0x180, .tag = 55019 +}; + +static const struct CompressedSpritePalette gSmokescreenlImpactSpritePalette = +{ + .data = gSmokescreenImpactPalette, .tag = 55019 +}; + +static const struct OamData gUnknown_0831C630 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(16x16), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd gUnknown_0831C638[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(4, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_END +}; + +static const union AnimCmd gUnknown_0831C648[] = +{ + ANIMCMD_FRAME(0, 4, .hFlip = TRUE), + ANIMCMD_FRAME(4, 4, .hFlip = TRUE), + ANIMCMD_FRAME(8, 4, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd gUnknown_0831C658[] = +{ + ANIMCMD_FRAME(0, 4, .vFlip = TRUE), + ANIMCMD_FRAME(4, 4, .vFlip = TRUE), + ANIMCMD_FRAME(8, 4, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd gUnknown_0831C668[] = +{ + ANIMCMD_FRAME(0, 4, .hFlip = TRUE, .vFlip = TRUE), + ANIMCMD_FRAME(4, 4, .hFlip = TRUE, .vFlip = TRUE), + ANIMCMD_FRAME(8, 4, .hFlip = TRUE, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd *const gUnknown_0831C678[] = +{ + gUnknown_0831C638, + gUnknown_0831C648, + gUnknown_0831C658, + gUnknown_0831C668, +}; + +static const struct SpriteTemplate gSmokescreenImpactSpriteTemplate = +{ + .tileTag = 55019, + .paletteTag = 55019, + .oam = &gUnknown_0831C630, + .anims = gUnknown_0831C678, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_DestroySprite +}; + +const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow = +{ + .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = 55129 +}; + +static const struct OamData gUnknown_0831C6A8 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(32x8), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(32x8), + .tileNum = 0, + .priority = 3, + .paletteNum = 0, + .affineParam = 0 +}; + +const struct SpriteTemplate gSpriteTemplate_EnemyShadow = +{ + .tileTag = 55129, + .paletteTag = 55039, + .oam = &gUnknown_0831C6A8, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_SetInvisible +}; u8 SmokescreenImpact(s16 x, s16 y, u8 a3) { @@ -65,7 +207,7 @@ static void SmokescreenImpact_Callback(struct Sprite *sprite) } } -void SpriteCB_DestroySprite(struct Sprite *sprite) +static void SpriteCB_DestroySprite(struct Sprite *sprite) { if (sprite->animEnded) {