diff --git a/gflib/sprite.c b/gflib/sprite.c index 637e15a22d..4e83a71752 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -1757,7 +1757,7 @@ bool8 AddSubspritesToOamBuffer(struct Sprite *sprite, struct OamData *destOam, u destOam[i].y = baseY + y; destOam[i].tileNum = tileNum + subspriteTable->subsprites[i].tileOffset; - if (sprite->subspriteMode != SUBSPRITES_IGNORE_PRIORITY) + if (sprite->subspriteMode < SUBSPRITES_IGNORE_PRIORITY) destOam[i].priority = subspriteTable->subsprites[i].priority; } } diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index b9f1aad78d..0397e2409a 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -280,6 +280,11 @@ // during their idle & walking animations #define OW_MON_BOBBING TRUE +// If true, adds a small amount of overhead +// to OW code so that large (48x48, 64x64) OWs +// will display correctly under bridges, etc. +#define LARGE_OW_SUPPORT TRUE + #define SHADOW_SIZE_S 0 #define SHADOW_SIZE_M 1 #define SHADOW_SIZE_L 2 diff --git a/include/event_object_movement.h b/include/event_object_movement.h index f2383272fc..1b4f1e1d9f 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -205,7 +205,7 @@ void UpdateObjectEventsForCameraUpdate(s16 x, s16 y); u8 GetWalkSlowMovementAction(u32); u8 GetJumpMovementAction(u32); u8 ElevationToPriority(u8 elevation); -void ObjectEventUpdateElevation(struct ObjectEvent *objEvent); +void ObjectEventUpdateElevation(struct ObjectEvent *objEvent, struct Sprite *); void SetObjectSubpriorityByElevation(u8 elevation, struct Sprite *, u8 subpriority); void UnfreezeObjectEvent(struct ObjectEvent *); u8 FindLockedObjectEventIndex(struct ObjectEvent *); diff --git a/src/data/object_events/object_event_subsprites.h b/src/data/object_events/object_event_subsprites.h index 8084919927..7a3c90dc4d 100755 --- a/src/data/object_events/object_event_subsprites.h +++ b/src/data/object_events/object_event_subsprites.h @@ -279,6 +279,204 @@ static const struct SubspriteTable sOamTables_32x32[] = { }; static const struct Subsprite sOamTable_48x48[] = { + { + .x = -24, + .y = -24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 0, + .priority = 1 + }, + { + .x = 8, + .y = -24, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 4, + .priority = 1 + }, + { + .x = -24, + .y = -16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 6, + .priority = 1 + }, + { + .x = 8, + .y = -16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 10, + .priority = 1 + }, + { + .x = -24, + .y = -8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 12, + .priority = 2 + }, + { + .x = 8, + .y = -8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 16, + .priority = 2 + }, + { + .x = -24, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 18, + .priority = 2 + }, + { + .x = 8, + .y = 0, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 22, + .priority = 2 + }, + { + .x = -24, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 24, + .priority = 2 + }, + { + .x = 8, + .y = 8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 28, + .priority = 2 + }, + { + .x = -24, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 30, + .priority = 2 + }, + { + .x = 8, + .y = 16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 34, + .priority = 2 + } +}; + +static const struct Subsprite sOamTable_48x48_4[] = { + { + .x = -24, + .y = -24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 0, + .priority = 1 + }, + { + .x = 8, + .y = -24, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 4, + .priority = 1 + }, + { + .x = -24, + .y = -16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 6, + .priority = 1 + }, + { + .x = 8, + .y = -16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 10, + .priority = 1 + }, + { + .x = -24, + .y = -8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 12, + .priority = 1 + }, + { + .x = 8, + .y = -8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 16, + .priority = 1 + }, + { + .x = -24, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 18, + .priority = 1 + }, + { + .x = 8, + .y = 0, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 22, + .priority = 1 + }, + { + .x = -24, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 24, + .priority = 1 + }, + { + .x = 8, + .y = 8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 28, + .priority = 1 + }, + { + .x = -24, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 30, + .priority = 1 + }, + { + .x = 8, + .y = 16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 34, + .priority = 1 + } +}; + +static const struct Subsprite sOamTable_48x48_HotSprings[] = { { .x = -24, .y = -24, @@ -365,7 +563,7 @@ static const struct Subsprite sOamTable_48x48[] = { .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), .tileOffset = 30, - .priority = 2 + .priority = 3 }, { .x = 8, @@ -373,17 +571,215 @@ static const struct Subsprite sOamTable_48x48[] = { .shape = SPRITE_SHAPE(16x8), .size = SPRITE_SIZE(16x8), .tileOffset = 34, + .priority = 3 + } +}; + +static const struct Subsprite sOamTable_48x48_Grass2[] = { + { + .x = -24, + .y = -24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 0, .priority = 2 + }, + { + .x = 8, + .y = -24, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 4, + .priority = 2 + }, + { + .x = -24, + .y = -16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 6, + .priority = 2 + }, + { + .x = 8, + .y = -16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 10, + .priority = 2 + }, + { + .x = -24, + .y = -8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 12, + .priority = 2 + }, + { + .x = 8, + .y = -8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 16, + .priority = 2 + }, + { + .x = -24, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 18, + .priority = 2 + }, + { + .x = 8, + .y = 0, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 22, + .priority = 2 + }, + { + .x = -24, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 24, + .priority = 3 + }, + { + .x = 8, + .y = 8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 28, + .priority = 3 + }, + { + .x = -24, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 30, + .priority = 3 + }, + { + .x = 8, + .y = 16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 34, + .priority = 3 + } +}; + +static const struct Subsprite sOamTable_48x48_Grass1[] = { + { + .x = -24, + .y = -24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 0, + .priority = 1 + }, + { + .x = 8, + .y = -24, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 4, + .priority = 1 + }, + { + .x = -24, + .y = -16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 6, + .priority = 1 + }, + { + .x = 8, + .y = -16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 10, + .priority = 1 + }, + { + .x = -24, + .y = -8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 12, + .priority = 1 + }, + { + .x = 8, + .y = -8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 16, + .priority = 1 + }, + { + .x = -24, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 18, + .priority = 1 + }, + { + .x = 8, + .y = 0, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 22, + .priority = 1 + }, + { + .x = -24, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 24, + .priority = 3 + }, + { + .x = 8, + .y = 8, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 28, + .priority = 3 + }, + { + .x = -24, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 30, + .priority = 3 + }, + { + .x = 8, + .y = 16, + .shape = SPRITE_SHAPE(16x8), + .size = SPRITE_SIZE(16x8), + .tileOffset = 34, + .priority = 3 } }; static const struct SubspriteTable sOamTables_48x48[] = { {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, - {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, - {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, - {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, - {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, - {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48} + {ARRAY_COUNT(sOamTable_48x48), sOamTable_48x48}, // elevation 3 + {ARRAY_COUNT(sOamTable_48x48_4), sOamTable_48x48_4}, // elevation 4 + {ARRAY_COUNT(sOamTable_48x48_HotSprings), sOamTable_48x48_HotSprings}, // hot springs + {ARRAY_COUNT(sOamTable_48x48_Grass2), sOamTable_48x48_Grass2}, // long grass + {ARRAY_COUNT(sOamTable_48x48_Grass1), sOamTable_48x48_Grass1} // long grass priority 1 }; static const struct Subsprite sOamTable_64x32_0[] = { @@ -493,6 +889,263 @@ static const struct SubspriteTable sOamTables_64x64[] = { {ARRAY_COUNT(sOamTable_64x64_3), sOamTable_64x64_3} }; +static const struct Subsprite sOamTable_64x64_Follower[] = { + { + .x = -32, + .y = -32, + .shape = SPRITE_SHAPE(64x32), + .size = SPRITE_SIZE(64x32), + .tileOffset = 0, + .priority = 1 + }, + { + .x = -32, + .y = 0, + .shape = SPRITE_SHAPE(64x32), + .size = SPRITE_SIZE(64x32), + .tileOffset = 32, + .priority = 2 + } +}; + +static const struct Subsprite sOamTable_64x64_HotSprings[] = { + { + .x = -32, + .y = -32, + .shape = SPRITE_SHAPE(64x32), + .size = SPRITE_SIZE(64x32), + .tileOffset = 0, + .priority = 2 + }, + { + .x = -32, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 32, + .priority = 2 + }, + { + .x = 0, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 36, + .priority = 2 + }, + { + .x = -32, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 40, + .priority = 2 + }, + { + .x = 0, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 44, + .priority = 2 + }, + { + .x = -32, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 48, + .priority = 2 + }, + { + .x = 0, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 52, + .priority = 2 + }, + { + .x = -32, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 60, + .priority = 3 + }, +}; + +static const struct Subsprite sOamTable_64x64_Grass2[] = { + { + .x = -32, + .y = -32, + .shape = SPRITE_SHAPE(64x32), + .size = SPRITE_SIZE(64x32), + .tileOffset = 0, + .priority = 2 + }, + { + .x = -32, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 32, + .priority = 2 + }, + { + .x = 0, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 36, + .priority = 2 + }, + { + .x = -32, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 40, + .priority = 2 + }, + { + .x = 0, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 44, + .priority = 2 + }, + { + .x = -32, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 48, + .priority = 3 + }, + { + .x = 0, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 52, + .priority = 3 + }, + { + .x = -32, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 60, + .priority = 3 + }, +}; + +static const struct Subsprite sOamTable_64x64_Grass1[] = { + { + .x = -32, + .y = -32, + .shape = SPRITE_SHAPE(64x32), + .size = SPRITE_SIZE(64x32), + .tileOffset = 0, + .priority = 1 + }, + { + .x = -32, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 32, + .priority = 1 + }, + { + .x = 0, + .y = 0, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 36, + .priority = 1 + }, + { + .x = -32, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 40, + .priority = 1 + }, + { + .x = 0, + .y = 8, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 44, + .priority = 1 + }, + { + .x = -32, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 48, + .priority = 3 + }, + { + .x = 0, + .y = 16, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 52, + .priority = 3 + }, + { + .x = -32, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 56, + .priority = 3 + }, + { + .x = 0, + .y = 24, + .shape = SPRITE_SHAPE(32x8), + .size = SPRITE_SIZE(32x8), + .tileOffset = 60, + .priority = 3 + }, +}; + +// For following pokemon +// Makes the top 32 pixels priority 1, +// so that very tall pokemon's heads +// will appear on top of buildings, etc. +static const struct SubspriteTable sOamTables_64x64_Follower[] = { + {}, // unused + {ARRAY_COUNT(sOamTable_64x64_Follower), sOamTable_64x64_Follower}, // elevation 3 + {ARRAY_COUNT(sOamTable_64x64_1), sOamTable_64x64_1}, // elevation 4 + {ARRAY_COUNT(sOamTable_64x64_HotSprings), sOamTable_64x64_HotSprings}, // hot springs + {ARRAY_COUNT(sOamTable_64x64_Grass2), sOamTable_64x64_Grass2}, // long grass + {ARRAY_COUNT(sOamTable_64x64_Grass1), sOamTable_64x64_Grass1} // long grass priority 1 +}; + static const struct Subsprite sOamTable_96x40_0[] = { { .x = -48, diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 4a0f4f3e58..d96e4ad4e5 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1845,8 +1845,8 @@ void UpdateFollowingPokemon(void) { // Update following pokemon if any u16 species; bool8 shiny; u8 form; - // Avoid spawning large (64x64) follower pokemon inside buildings - if (GetFollowerInfo(&species, &form, &shiny) && !(gMapHeader.mapType == MAP_TYPE_INDOOR && SpeciesToGraphicsInfo(species, 0)->height == 64) && !FlagGet(FLAG_TEMP_HIDE_FOLLOWER)) { + // Avoid spawning large (>32x32) follower pokemon inside buildings + if (GetFollowerInfo(&species, &form, &shiny) && !(gMapHeader.mapType == MAP_TYPE_INDOOR && SpeciesToGraphicsInfo(species, 0)->height > 32) && !FlagGet(FLAG_TEMP_HIDE_FOLLOWER)) { if (objEvent == NULL) { // Spawn follower struct ObjectEventTemplate template = { .localId = OBJ_EVENT_ID_FOLLOWER, @@ -6785,6 +6785,9 @@ bool8 MovementAction_EnterPokeball_Step1(struct ObjectEvent *objectEvent, struct LoadFillColorPalette(RGB_WHITE, OBJ_EVENT_PAL_TAG_WHITE, sprite); sprite->affineAnims = sAffineAnims_PokeballFollower; sprite->oam.affineMode = ST_OAM_AFFINE_NORMAL; + #if LARGE_OW_SUPPORT + sprite->subspriteTableNum = 1; + #endif InitSpriteAffineAnim(sprite); StartSpriteAffineAnim(sprite, sprite->data[6]); } else if (sprite->data[3] == 7) { // Free white palette and change to pokeball, disable affine @@ -8812,7 +8815,14 @@ static void UpdateObjectEventElevationAndPriority(struct ObjectEvent *objEvent, if (objEvent->fixedPriority) return; - ObjectEventUpdateElevation(objEvent); + ObjectEventUpdateElevation(objEvent, sprite); + #if LARGE_OW_SUPPORT + if (objEvent->localId == OBJ_EVENT_ID_FOLLOWER) { + // keep subspriteMode synced with player's + // so that it disappears under bridges when they do + sprite->subspriteMode |= gSprites[gPlayerAvatar.spriteId].subspriteMode & SUBSPRITES_IGNORE_PRIORITY; + } + #endif sprite->subspriteTableNum = sElevationToSubspriteTableNum[objEvent->previousElevation]; sprite->oam.priority = sElevationToPriority[objEvent->previousElevation]; @@ -8829,13 +8839,23 @@ u8 ElevationToPriority(u8 elevation) return sElevationToPriority[elevation]; } -void ObjectEventUpdateElevation(struct ObjectEvent *objEvent) +// Returns current elevation, or 15 for bridges +void ObjectEventUpdateElevation(struct ObjectEvent *objEvent, struct Sprite *sprite) { u8 curElevation = MapGridGetElevationAt(objEvent->currentCoords.x, objEvent->currentCoords.y); u8 prevElevation = MapGridGetElevationAt(objEvent->previousCoords.x, objEvent->previousCoords.y); - if (curElevation == 15 || prevElevation == 15) + if (curElevation == 15 || prevElevation == 15) { + #if LARGE_OW_SUPPORT + // Ignore subsprite priorities under bridges + // so all subsprites will display below it + sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY; + #endif return; + } + #if LARGE_OW_SUPPORT + sprite->subspriteMode = SUBSPRITES_ON; + #endif objEvent->currentElevation = curElevation; diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 968cc3c789..3d4f0ce6bd 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -331,7 +331,11 @@ u32 FldEff_Shadow(void) gSprites[spriteId].data[0] = gFieldEffectArguments[0]; gSprites[spriteId].data[1] = gFieldEffectArguments[1]; gSprites[spriteId].data[2] = gFieldEffectArguments[2]; + #if LARGE_OW_SUPPORT + gSprites[spriteId].data[3] = gShadowVerticalOffsets[graphicsInfo->shadowSize]; + #else gSprites[spriteId].data[3] = (graphicsInfo->height >> 1) - gShadowVerticalOffsets[graphicsInfo->shadowSize]; + #endif } return 0; } @@ -352,7 +356,12 @@ void UpdateShadowFieldEffect(struct Sprite *sprite) linkedSprite = &gSprites[objectEvent->spriteId]; sprite->oam.priority = linkedSprite->oam.priority; sprite->x = linkedSprite->x; + #if LARGE_OW_SUPPORT + // Read 'live' size from linked sprite + sprite->y = linkedSprite->y - linkedSprite->centerToCornerVecY - sprite->data[3]; + #else sprite->y = linkedSprite->y + sprite->data[3]; + #endif sprite->invisible = linkedSprite->invisible; if (!objectEvent->active || !objectEvent->hasShadow || MetatileBehavior_IsPokeGrass(objectEvent->currentMetatileBehavior) diff --git a/src/overworld.c b/src/overworld.c index 61cc0ce1be..937643c5e1 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2974,7 +2974,7 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1 objEvent->previousCoords.y = y; SetSpritePosToMapCoords(x, y, &objEvent->initialCoords.x, &objEvent->initialCoords.y); objEvent->initialCoords.x += 8; - ObjectEventUpdateElevation(objEvent); + ObjectEventUpdateElevation(objEvent, NULL); } static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 dir) @@ -3114,7 +3114,7 @@ static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayer { objEvent->directionSequenceIndex = 16; ShiftObjectEventCoords(objEvent, x, y); - ObjectEventUpdateElevation(objEvent); + ObjectEventUpdateElevation(objEvent, NULL); return TRUE; } }