From 783149bd3ffbd53dcb70004d278a9c029620145d Mon Sep 17 00:00:00 2001 From: Ariel Antonitis Date: Tue, 20 Jul 2021 19:35:37 -0400 Subject: [PATCH] Fixed bug where moving truck had a shadow. --- include/constants/event_objects.h | 3 ++- src/data/object_events/object_event_graphics_info.h | 2 +- src/field_effect_helpers.c | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index f90d0c61cb..062fb47d5b 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -270,7 +270,8 @@ #define SHADOW_SIZE_S 0 #define SHADOW_SIZE_M 1 #define SHADOW_SIZE_L 2 -#define SHADOW_SIZE_XL 3 +#define SHADOW_SIZE_XL 3 // unused; repurposed to mean no shadow +#define SHADOW_SIZE_NONE 3 #define F_INANIMATE (1 << 6) #define F_DISABLE_REFLECTION_PALETTE_LOAD (1 << 7) diff --git a/src/data/object_events/object_event_graphics_info.h b/src/data/object_events/object_event_graphics_info.h index dc96762604..97d685c9ff 100755 --- a/src/data/object_events/object_event_graphics_info.h +++ b/src/data/object_events/object_event_graphics_info.h @@ -92,7 +92,7 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_MayMachBike = {0xF const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_MayAcroBike = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, OBJ_EVENT_PAL_TAG_BRIDGE_REFLECTION, 512, 32, 32, 0, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_BIKE_TIRE, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_AcroBike, sPicTable_MayAcroBike, gDummySpriteAffineAnimTable}; const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_MaySurfing = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 0, SHADOW_SIZE_M, FALSE, TRUE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_Surfing, sPicTable_MaySurfing, gDummySpriteAffineAnimTable}; const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_MayFieldMove = {0xFFFF, OBJ_EVENT_PAL_TAG_MAY, OBJ_EVENT_PAL_TAG_BRIDGE_REFLECTION, 512, 32, 32, 0, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_FieldMove, sPicTable_MayFieldMove, gDummySpriteAffineAnimTable}; -const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Truck = {0xFFFF, OBJ_EVENT_PAL_TAG_TRUCK, OBJ_EVENT_PAL_TAG_NONE, 1152, 48, 48, 10, SHADOW_SIZE_M, TRUE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_32x32, sOamTables_48x48, sAnimTable_Inanimate, sPicTable_Truck, gDummySpriteAffineAnimTable}; +const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Truck = {0xFFFF, OBJ_EVENT_PAL_TAG_TRUCK, OBJ_EVENT_PAL_TAG_NONE, 1152, 48, 48, 10, SHADOW_SIZE_NONE, TRUE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_32x32, sOamTables_48x48, sAnimTable_Inanimate, sPicTable_Truck, gDummySpriteAffineAnimTable}; const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_VigorothCarryingBox = {0xFFFF, OBJ_EVENT_PAL_TAG_VIGOROTH, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_Standard, sPicTable_VigorothCarryingBox, gDummySpriteAffineAnimTable}; const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_VigorothFacingAway = {0xFFFF, OBJ_EVENT_PAL_TAG_VIGOROTH, OBJ_EVENT_PAL_TAG_NONE, 512, 32, 32, 10, SHADOW_SIZE_M, FALSE, FALSE, TRACKS_FOOT, &gObjectEventBaseOam_32x32, sOamTables_32x32, sAnimTable_Standard, sPicTable_VigorothFacingAway, gDummySpriteAffineAnimTable}; const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BirchsBag = {0xFFFF, OBJ_EVENT_PAL_TAG_NPC_2, OBJ_EVENT_PAL_TAG_NONE, 128, 16, 16, 3, SHADOW_SIZE_S, TRUE, FALSE, TRACKS_NONE, &gObjectEventBaseOam_16x16, sOamTables_16x16, sAnimTable_Inanimate, sPicTable_BirchsBag, gDummySpriteAffineAnimTable}; diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index db58cb9a77..c96f611f2a 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -11,6 +11,7 @@ #include "sound.h" #include "sprite.h" #include "trig.h" +#include "constants/event_objects.h" #include "constants/field_effects.h" #include "constants/songs.h" @@ -313,6 +314,8 @@ u32 FldEff_Shadow(void) } objectEventId = GetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]); graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[objectEventId].graphicsId); + if (graphicsInfo->shadowSize == SHADOW_SIZE_NONE) // don't create a shadow at all + return 0; spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[sShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94); if (spriteId != MAX_SPRITES) {