Merge branch 'followers' into lighting
This commit is contained in:
commit
22c1d94ab9
@ -376,26 +376,14 @@ FollowerDance:
|
||||
lock_facing_direction
|
||||
jump_in_place_up
|
||||
unlock_facing_direction
|
||||
walk_in_place_faster_up
|
||||
walk_in_place_faster_left
|
||||
walk_in_place_faster_down
|
||||
walk_in_place_faster_right
|
||||
walk_in_place_faster_up
|
||||
walk_in_place_faster_left
|
||||
walk_in_place_faster_down
|
||||
walk_in_place_faster_right
|
||||
walk_in_place_faster_up
|
||||
walk_in_place_faster_left
|
||||
walk_in_place_faster_down
|
||||
walk_in_place_faster_right
|
||||
walk_in_place_faster_up
|
||||
walk_in_place_faster_left
|
||||
walk_in_place_faster_down
|
||||
walk_in_place_faster_right
|
||||
walk_in_place_faster_up
|
||||
walk_in_place_faster_left
|
||||
walk_in_place_faster_down
|
||||
walk_in_place_faster_right
|
||||
walk_in_place_fast_up
|
||||
walk_in_place_fast_left
|
||||
walk_in_place_fast_down
|
||||
walk_in_place_fast_right
|
||||
walk_in_place_fast_up
|
||||
walk_in_place_fast_left
|
||||
walk_in_place_fast_down
|
||||
walk_in_place_fast_right
|
||||
jump_in_place_up
|
||||
jump_in_place_down
|
||||
jump_in_place_up
|
||||
|
||||
@ -1392,6 +1392,7 @@ static bool8 GetAvailableObjectEventId(u16 localId, u8 mapNum, u8 mapGroup, u8 *
|
||||
static void RemoveObjectEvent(struct ObjectEvent *objectEvent)
|
||||
{
|
||||
objectEvent->active = FALSE;
|
||||
objectEvent->extra.asU16 = 0; // zero potential species info
|
||||
RemoveObjectEventInternal(objectEvent);
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "gba/flash_internal.h"
|
||||
#include "decoration_inventory.h"
|
||||
#include "agb_flash.h"
|
||||
#include "constants/event_objects.h"
|
||||
|
||||
static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
|
||||
|
||||
@ -181,16 +182,26 @@ void SaveObjectEvents(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) {
|
||||
gSaveBlock1Ptr->objectEvents[i] = gObjectEvents[i];
|
||||
// To avoid crash on vanilla, save follower as inactive
|
||||
if (gObjectEvents[i].localId == OBJ_EVENT_ID_FOLLOWER)
|
||||
gSaveBlock1Ptr->objectEvents[i].active = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadObjectEvents(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) {
|
||||
gObjectEvents[i] = gSaveBlock1Ptr->objectEvents[i];
|
||||
// Try to restore saved inactive follower
|
||||
if (gObjectEvents[i].localId == OBJ_EVENT_ID_FOLLOWER &&
|
||||
!gObjectEvents[i].active &&
|
||||
gObjectEvents[i].extra.asU16)
|
||||
gObjectEvents[i].active = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void CopyPartyAndObjectsToSave(void)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
#include "field_camera.h"
|
||||
#include "field_effect.h"
|
||||
#include "fieldmap.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "menu.h"
|
||||
@ -150,10 +151,13 @@ static const union AnimCmd *const sAnims_FallingFossil[] =
|
||||
sAnim_FallingFossil,
|
||||
};
|
||||
|
||||
// Duplicate of event_object_movement
|
||||
#define OBJ_EVENT_PAL_TAG_NPC_1 0x1103
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_FallingFossil =
|
||||
{
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = TAG_NONE,
|
||||
.paletteTag = OBJ_EVENT_PAL_TAG_NPC_1,
|
||||
.oam = &sOamData_FallingFossil,
|
||||
.anims = sAnims_FallingFossil,
|
||||
.images = NULL,
|
||||
@ -689,6 +693,7 @@ static void Task_FossilFallAndSink(u8 taskId)
|
||||
{
|
||||
struct SpriteTemplate fossilTemplate = sSpriteTemplate_FallingFossil;
|
||||
fossilTemplate.images = sFallingFossil->frameImage;
|
||||
LoadObjectEventPalette(sSpriteTemplate_FallingFossil.paletteTag);
|
||||
sFallingFossil->spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
|
||||
gSprites[sFallingFossil->spriteId].centerToCornerVecX = 0;
|
||||
gSprites[sFallingFossil->spriteId].data[0] = gSprites[sFallingFossil->spriteId].x;
|
||||
@ -714,6 +719,9 @@ static void Task_FossilFallAndSink(u8 taskId)
|
||||
// Wait for fossil to finish falling / disintegrating
|
||||
if (gSprites[sFallingFossil->spriteId].callback != SpriteCallbackDummy)
|
||||
return;
|
||||
gSprites[sFallingFossil->spriteId].inUse = FALSE;
|
||||
FieldEffectFreePaletteIfUnused(gSprites[sFallingFossil->spriteId].oam.paletteNum);
|
||||
gSprites[sFallingFossil->spriteId].inUse = TRUE;
|
||||
DestroySprite(&gSprites[sFallingFossil->spriteId]);
|
||||
FREE_AND_SET_NULL(sFallingFossil->disintegrateRand);;
|
||||
FREE_AND_SET_NULL(sFallingFossil->frameImage);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user