Fix out of bounds access for fighting anims

This commit is contained in:
GriffinR 2021-03-08 14:32:20 -05:00
parent ba1e006a64
commit 6274acfe5f

View file

@ -51,51 +51,43 @@ const struct SpriteTemplate gUnusedSpriteTemplate_08595E14 =
.callback = AnimUnused_080B08A0, .callback = AnimUnused_080B08A0,
}; };
static const union AnimCmd sAnim_HandOrFoot[] = static const union AnimCmd sAnim_Fist[] =
{ {
ANIMCMD_FRAME(0, 1), ANIMCMD_FRAME(0, 1),
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd sAnim_SlidingKick_0[] = static const union AnimCmd sAnim_FootWide[] =
{ {
ANIMCMD_FRAME(16, 1), ANIMCMD_FRAME(16, 1),
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd sAnim_SlidingKick_1[] = static const union AnimCmd sAnim_FootTall[] =
{ {
ANIMCMD_FRAME(32, 1), ANIMCMD_FRAME(32, 1),
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd sAnim_CrossChopHand_0[] = static const union AnimCmd sAnim_HandLeft[] =
{ {
ANIMCMD_FRAME(48, 1), ANIMCMD_FRAME(48, 1),
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd sAnim_CrossChopHand_1[] = static const union AnimCmd sAnim_HandRight[] =
{ {
ANIMCMD_FRAME(48, 1, .hFlip = TRUE), ANIMCMD_FRAME(48, 1, .hFlip = TRUE),
ANIMCMD_END, ANIMCMD_END,
}; };
static const union AnimCmd *const sAnims_HandOrFoot[] = static const union AnimCmd *const sAnims_HandsAndFeet[] =
{ {
sAnim_HandOrFoot, sAnim_Fist,
}; sAnim_FootWide,
sAnim_FootTall,
static const union AnimCmd *const sAnims_SlidingKick[] = sAnim_HandLeft,
{ sAnim_HandRight,
sAnim_SlidingKick_0,
sAnim_SlidingKick_1,
};
static const union AnimCmd *const sAnims_CrossChopHand[] =
{
sAnim_CrossChopHand_0,
sAnim_CrossChopHand_1,
}; };
const struct SpriteTemplate gKarateChopSpriteTemplate = const struct SpriteTemplate gKarateChopSpriteTemplate =
@ -103,7 +95,7 @@ const struct SpriteTemplate gKarateChopSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSlideHandOrFootToTarget, .callback = AnimSlideHandOrFootToTarget,
@ -114,7 +106,7 @@ const struct SpriteTemplate gJumpKickSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimJumpKick, .callback = AnimJumpKick,
@ -125,7 +117,7 @@ const struct SpriteTemplate gFistFootSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimBasicFistOrFoot, .callback = AnimBasicFistOrFoot,
@ -136,7 +128,7 @@ const struct SpriteTemplate gFistFootRandomPosSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimFistOrFootRandomPos, .callback = AnimFistOrFootRandomPos,
@ -147,7 +139,7 @@ const struct SpriteTemplate gCrossChopHandSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_CrossChopHand, .anims = &sAnims_HandsAndFeet[3],
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimCrossChopHand, .callback = AnimCrossChopHand,
@ -158,7 +150,7 @@ const struct SpriteTemplate gSlidingKickSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_SlidingKick, .anims = &sAnims_HandsAndFeet[1],
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSlidingKick, .callback = AnimSlidingKick,
@ -182,7 +174,7 @@ const struct SpriteTemplate gSpinningHandOrFootSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineDouble_ObjNormal_32x32, .oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = sAffineAnims_SpinningHandOrFoot, .affineAnims = sAffineAnims_SpinningHandOrFoot,
.callback = AnimSpinningKickOrPunch, .callback = AnimSpinningKickOrPunch,
@ -205,7 +197,7 @@ const struct SpriteTemplate gMegaPunchKickSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineDouble_ObjNormal_32x32, .oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = sAffineAnims_MegaPunchKick, .affineAnims = sAffineAnims_MegaPunchKick,
.callback = AnimSpinningKickOrPunch, .callback = AnimSpinningKickOrPunch,
@ -216,7 +208,7 @@ const struct SpriteTemplate gStompFootSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_SlidingKick, .anims = &sAnims_HandsAndFeet[1],
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimStompFoot, .callback = AnimStompFoot,
@ -307,7 +299,7 @@ const struct SpriteTemplate gArmThrustHandSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineOff_ObjNormal_32x32, .oam = &gOamData_AffineOff_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimArmThrustHit, .callback = AnimArmThrustHit,
@ -411,7 +403,7 @@ const struct SpriteTemplate gFocusPunchFistSpriteTemplate =
.tileTag = ANIM_TAG_HANDS_AND_FEET, .tileTag = ANIM_TAG_HANDS_AND_FEET,
.paletteTag = ANIM_TAG_HANDS_AND_FEET, .paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineDouble_ObjNormal_32x32, .oam = &gOamData_AffineDouble_ObjNormal_32x32,
.anims = sAnims_HandOrFoot, .anims = sAnims_HandsAndFeet,
.images = NULL, .images = NULL,
.affineAnims = sAffineAnims_FocusPunchFist, .affineAnims = sAffineAnims_FocusPunchFist,
.callback = AnimFocusPunchFist, .callback = AnimFocusPunchFist,