Improved saving & loading object events.
This commit is contained in:
parent
95b98efc30
commit
5047f1280e
3 changed files with 3 additions and 3 deletions
|
@ -195,7 +195,6 @@ struct ObjectEvent
|
|||
u32 fixedPriority:1;
|
||||
u32 hideReflection:1;
|
||||
u32 shiny:1; // OW mon shininess
|
||||
u32 expanded:1; // 0 for vanilla, 1 for expanded OWs
|
||||
/*0x04*/ u16 graphicsId; // 11 bits for species; high 5 bits for form
|
||||
/*0x06*/ u8 movementType;
|
||||
/*0x07*/ u8 trainerType;
|
||||
|
|
|
@ -1317,7 +1317,6 @@ static u8 InitObjectEventStateFromTemplate(const struct ObjectEventTemplate *tem
|
|||
y = template->y + MAP_OFFSET;
|
||||
objectEvent->active = TRUE;
|
||||
objectEvent->triggerGroundEffectsOnMove = TRUE;
|
||||
objectEvent->expanded = TRUE;
|
||||
objectEvent->graphicsId = PackGraphicsId(template);
|
||||
if (objectEvent->graphicsId >= OBJ_EVENT_GFX_MON_BASE) {
|
||||
if (template->script && template->script[0] == 0x7d)
|
||||
|
|
|
@ -190,6 +190,7 @@ void SaveObjectEvents(void)
|
|||
// since the lower graphicsIds will be in the same place as vanilla
|
||||
graphicsId = gObjectEvents[i].graphicsId;
|
||||
gSaveBlock1Ptr->objectEvents[i].graphicsId = (graphicsId >> 8) | (graphicsId << 8);
|
||||
gSaveBlock1Ptr->objectEvents[i].spriteId = 127; // magic number
|
||||
// To avoid crash on vanilla, save follower as inactive
|
||||
if (gObjectEvents[i].localId == OBJ_EVENT_ID_FOLLOWER)
|
||||
gSaveBlock1Ptr->objectEvents[i].active = FALSE;
|
||||
|
@ -208,8 +209,9 @@ void LoadObjectEvents(void)
|
|||
// since the lower graphicsIds will be in the same place as vanilla
|
||||
graphicsId = gObjectEvents[i].graphicsId;
|
||||
gObjectEvents[i].graphicsId = (graphicsId >> 8) | (graphicsId << 8);
|
||||
if (!gObjectEvents[i].expanded)
|
||||
if (gObjectEvents[i].spriteId != 127)
|
||||
gObjectEvents[i].graphicsId &= 0xFF;
|
||||
gObjectEvents[i].spriteId = 0;
|
||||
// Try to restore saved inactive follower
|
||||
if (gObjectEvents[i].localId == OBJ_EVENT_ID_FOLLOWER &&
|
||||
!gObjectEvents[i].active &&
|
||||
|
|
Loading…
Reference in a new issue