Distinguish 'virtual object' names from object events

This commit is contained in:
GriffinR 2021-11-17 23:28:43 -05:00
parent 1b35f9adad
commit b5b5d95de6
13 changed files with 205 additions and 187 deletions

View File

@ -1016,7 +1016,7 @@
@ Converts STR_VAR_1, STR_VAR_2, or STR_VAR_3 to its corresponding index into sScriptStringVars (0, 1, or 2).
@ If given anything else it will output it directly.
@ Note: because the STR_VAR_# arguments given to this macro are not part of a processed string they are not
@ Note: Because the STR_VAR_# arguments given to this macro are not part of a processed string they are not
@ replaced with their charmap values, they are just passed as the literal characters "STR_VAR_#".
.macro stringvar id:req
.if \id == STR_VAR_1
@ -1237,9 +1237,10 @@
.byte \level
.endm
.macro messageautoscroll pointer:req
@ Automatically scrolls through the message without player input and at a fixed speed.
.macro messageautoscroll text:req
.byte 0x9b
.4byte \pointer
.4byte \text
.endm
@ Executes the specified field effect animation (FLDEFF_*).
@ -1334,19 +1335,23 @@
map \map
.endm
.macro createvobject sprite:req, byte2:req, x:req, y:req, elevation, direction
@ Creates a sprite with object graphics. Used when creating large groups of static NPCs that exceed
@ the object event limit (e.g. Contest / Battle Dome audiences and Union Room group members).
@ The specified id can be used to refer to the sprite again later with turnvobject.
.macro createvobject graphicsId:req, id:req, x:req, y:req, elevation=3, direction=DIR_SOUTH
.byte 0xaa
.byte \sprite
.byte \byte2
.byte \graphicsId
.byte \id
.2byte \x
.2byte \y
.byte \elevation
.byte \direction
.endm
.macro turnvobject index:req, direction:req
@ Turns a sprite created with createvobject.
.macro turnvobject id:req, direction:req
.byte 0xab
.byte \index
.byte \id
.byte \direction
.endm
@ -1515,7 +1520,7 @@
.byte 0xc5
.endm
@ Writes the name of the specified (box) PC box to the specified buffer.
@ Writes the name of the specified PC box to the specified buffer.
.macro bufferboxname stringVarId:req, box:req
.byte 0xc6
stringvar \stringVarId
@ -1627,10 +1632,13 @@
formatwarp \map, \a, \b, \c
.endm
@ Sets the selected object to the id of the currently approaching trainer.
.macro selectapproachingtrainer
.byte 0xd8
.endm
@ Freezes all objects immediately except the player and the approaching trainers.
@ The player and trainers are frozen once their movement is finished.
.macro lockfortrainer
.byte 0xd9
.endm
@ -1640,9 +1648,11 @@
.byte 0xda
.endm
.macro messageinstant pointer:req
@ Prints and draws the message all at once rather than character by character.
@ Does not wait for player input to continue.
.macro messageinstant text:req
.byte 0xdb
.4byte \pointer
.4byte \text
.endm
.macro fadescreenswapbuffers mode:req

View File

@ -529,76 +529,76 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_AddRound1Audience::
return
BattleFrontier_BattleDomeBattleRoom_EventScript_AddRound2Audience::
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 0
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1
return
BattleFrontier_BattleDomeBattleRoom_EventScript_AddSemifinalAudience::
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_2, 7, 9, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LASS, 10, 12, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_GENTLEMAN, 15, 2, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 16, 3, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_2, 17, 4, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_EXPERT_F, 20, 9, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 23, 13, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_HEX_MANIAC, 28, 5, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MART_EMPLOYEE, 30, 6, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_5, 31, 8, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0
createvobject OBJ_EVENT_GFX_WOMAN_2, 7, 9, 0
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0
createvobject OBJ_EVENT_GFX_LASS, 10, 12, 0
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 0
createvobject OBJ_EVENT_GFX_GENTLEMAN, 15, 2, 1
createvobject OBJ_EVENT_GFX_NINJA_BOY, 16, 3, 1
createvobject OBJ_EVENT_GFX_WOMAN_2, 17, 4, 1
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1
createvobject OBJ_EVENT_GFX_EXPERT_F, 20, 9, 1
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 23, 13, 1
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2
createvobject OBJ_EVENT_GFX_HEX_MANIAC, 28, 5, 2
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1
createvobject OBJ_EVENT_GFX_MART_EMPLOYEE, 30, 6, 2
createvobject OBJ_EVENT_GFX_WOMAN_5, 31, 8, 2
return
BattleFrontier_BattleDomeBattleRoom_EventScript_AddFinalAudience::
createvobject OBJ_EVENT_GFX_NINJA_BOY, 0, 2, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_BEAUTY, 2, 15, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MAN_5, 3, 5, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 5, 7, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_2, 7, 9, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_3, 8, 10, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LASS, 10, 12, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_BEAUTY, 12, 14, 0, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_HIKER, 14, 12, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_GENTLEMAN, 15, 2, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 16, 3, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_2, 17, 4, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_3, 18, 6, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_EXPERT_F, 20, 9, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MAN_2, 21, 10, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 23, 13, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_GENTLEMAN, 24, 14, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_FAT_MAN, 27, 3, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_HEX_MANIAC, 28, 5, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_MART_EMPLOYEE, 30, 6, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_WOMAN_5, 31, 8, 2, 3, DIR_SOUTH
createvobject OBJ_EVENT_GFX_NINJA_BOY, 0, 2, 0
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 1, 3, 0
createvobject OBJ_EVENT_GFX_BEAUTY, 2, 15, 0
createvobject OBJ_EVENT_GFX_MAN_5, 3, 5, 0
createvobject OBJ_EVENT_GFX_EXPERT_F, 4, 6, 0
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 5, 7, 0
createvobject OBJ_EVENT_GFX_NINJA_BOY, 6, 8, 0
createvobject OBJ_EVENT_GFX_WOMAN_2, 7, 9, 0
createvobject OBJ_EVENT_GFX_WOMAN_3, 8, 10, 0
createvobject OBJ_EVENT_GFX_LITTLE_GIRL, 9, 11, 0
createvobject OBJ_EVENT_GFX_LASS, 10, 12, 0
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 11, 13, 0
createvobject OBJ_EVENT_GFX_BEAUTY, 12, 14, 0
createvobject OBJ_EVENT_GFX_MAN_5, 13, 15, 2
createvobject OBJ_EVENT_GFX_HIKER, 14, 12, 2
createvobject OBJ_EVENT_GFX_GENTLEMAN, 15, 2, 1
createvobject OBJ_EVENT_GFX_NINJA_BOY, 16, 3, 1
createvobject OBJ_EVENT_GFX_WOMAN_2, 17, 4, 1
createvobject OBJ_EVENT_GFX_WOMAN_3, 18, 6, 1
createvobject OBJ_EVENT_GFX_BEAUTY, 19, 7, 1
createvobject OBJ_EVENT_GFX_EXPERT_F, 20, 9, 1
createvobject OBJ_EVENT_GFX_MAN_2, 21, 10, 1
createvobject OBJ_EVENT_GFX_WOMAN_5, 22, 11, 1
createvobject OBJ_EVENT_GFX_SCIENTIST_1, 23, 13, 1
createvobject OBJ_EVENT_GFX_GENTLEMAN, 24, 14, 1
createvobject OBJ_EVENT_GFX_LITTLE_BOY, 25, 15, 1
createvobject OBJ_EVENT_GFX_YOUNGSTER, 26, 2, 2
createvobject OBJ_EVENT_GFX_FAT_MAN, 27, 3, 2
createvobject OBJ_EVENT_GFX_HEX_MANIAC, 28, 5, 2
createvobject OBJ_EVENT_GFX_SCHOOL_KID_M, 29, 5, 1
createvobject OBJ_EVENT_GFX_MART_EMPLOYEE, 30, 6, 2
createvobject OBJ_EVENT_GFX_WOMAN_5, 31, 8, 2
return
BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisible:

View File

@ -96,8 +96,7 @@ void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16);
void ObjectEventClearHeldMovement(struct ObjectEvent *);
void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
void TrySpawnObjectEvents(s16, s16);
u8 CreateObjectSprite(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
u8 AddPseudoObjectEvent(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 TrySpawnObjectEvent(u8, u8, u8);
u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *);
@ -180,7 +179,6 @@ void SetAndStartSpriteAnim(struct Sprite *, u8, u8);
bool8 SpriteAnimEnded(struct Sprite *);
void UnfreezeObjectEvents(void);
void FreezeObjectEventsExceptOne(u8 objectEventId);
void TurnObjectEventSprite(u8, u8);
void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2);
void FreezeObjectEvents(void);
bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent);
@ -414,10 +412,13 @@ u8 MovementType_RunInPlace_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step2(struct ObjectEvent *, struct Sprite *);
void SetObjectEventSpriteInvisibility(u8 objectEventId, bool32 invisible);
bool32 IsObjectEventSpriteInvisible(u8 objectEventId);
void SetObjectEventSpriteGraphics(u8 objectEventId, u8 graphicsId);
void SetObjectEventSpriteAnim(u8 objectEventId, u8 animNum);
bool32 IsObjectEventSpriteAnimating(u8 objectEventId);
u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 z, u8 direction);
void TurnVirtualObject(u8 virtualObjId, u8 direction);
void SetVirtualObjectGraphics(u8 virtualObjId, u8 graphicsId);
void SetVirtualObjectInvisibility(u8 virtualObjId, bool32 invisible);
bool32 IsVirtualObjectInvisible(u8 virtualObjId);
void SetVirtualObjectSpriteAnim(u8 virtualObjId, u8 animNum);
bool32 IsVirtualObjectAnimating(u8 virtualObjId);
#endif //GUARD_EVENT_OBJECT_MOVEMENT_H

View File

@ -826,7 +826,7 @@ static void CreateCableCarSprites(void)
case FALSE:
default:
// Create player sprite
spriteId = AddPseudoObjectEvent(playerGraphicsIds[gSaveBlock2Ptr->playerGender], SpriteCB_Player, 200, 73, 102);
spriteId = CreateObjectGraphicsSprite(playerGraphicsIds[gSaveBlock2Ptr->playerGender], SpriteCB_Player, 200, 73, 102);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].oam.priority = 2;
@ -854,7 +854,7 @@ static void CreateCableCarSprites(void)
case TRUE:
CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->groundTilemap + 0x24, 24, 26, 12, 3, 17);
// Create player sprite
spriteId = AddPseudoObjectEvent(playerGraphicsIds[gSaveBlock2Ptr->playerGender], SpriteCB_Player, 128, 39, 102);
spriteId = CreateObjectGraphicsSprite(playerGraphicsIds[gSaveBlock2Ptr->playerGender], SpriteCB_Player, 128, 39, 102);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].oam.priority = 2;
@ -891,7 +891,7 @@ static void CreateCableCarSprites(void)
if ((rval % 64) == 0)
{
// Unclear if this was intentional, but the - 1 in the below ARRAY_COUNT means the Zigzagoon is never used
spriteId = AddPseudoObjectEvent(hikerGraphicsIds[rval % (ARRAY_COUNT(hikerGraphicsIds) - 1)], hikerCallbacks[GOING_DOWN], hikerCoords[GOING_DOWN][0], hikerCoords[GOING_DOWN][1], 106);
spriteId = CreateObjectGraphicsSprite(hikerGraphicsIds[rval % (ARRAY_COUNT(hikerGraphicsIds) - 1)], hikerCallbacks[GOING_DOWN], hikerCoords[GOING_DOWN][0], hikerCoords[GOING_DOWN][1], 106);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].oam.priority = 2;

View File

@ -1395,9 +1395,9 @@ static void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecoration
x -= 8;
if (gSaveBlock2Ptr->playerGender == MALE)
sDecor_CameraSpriteObjectIdx2 = AddPseudoObjectEvent(OBJ_EVENT_GFX_BRENDAN_DECORATING, SpriteCallbackDummy, x, 72, 0);
sDecor_CameraSpriteObjectIdx2 = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_BRENDAN_DECORATING, SpriteCallbackDummy, x, 72, 0);
else
sDecor_CameraSpriteObjectIdx2 = AddPseudoObjectEvent(OBJ_EVENT_GFX_MAY_DECORATING, SpriteCallbackDummy, x, 72, 0);
sDecor_CameraSpriteObjectIdx2 = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAY_DECORATING, SpriteCallbackDummy, x, 72, 0);
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);
@ -2027,7 +2027,7 @@ static u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphics
ClearPlaceDecorationGraphicsDataBuffer(data);
data->decoration = &gDecorations[decor];
if (data->decoration->permission == DECORPERM_SPRITE)
return AddPseudoObjectEvent(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
return CreateObjectGraphicsSprite(data->decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
FreeSpritePaletteByTag(PLACE_DECORATION_SELECTOR_TAG);
SetDecorSelectionMetatiles(data);
@ -2106,7 +2106,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u
}
else
{
spriteId = AddPseudoObjectEvent(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
spriteId = CreateObjectGraphicsSprite(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1);
}
return spriteId;
}
@ -2285,9 +2285,9 @@ static void SetUpPuttingAwayDecorationPlayerAvatar(void)
LoadPlayerSpritePalette();
gFieldCamera.spriteId = CreateSprite(&sPuttingAwayCursorSpriteTemplate, 120, 80, 0);
if (gSaveBlock2Ptr->playerGender == MALE)
sDecor_CameraSpriteObjectIdx2 = AddPseudoObjectEvent(OBJ_EVENT_GFX_BRENDAN_DECORATING, SpriteCallbackDummy, 136, 72, 0);
sDecor_CameraSpriteObjectIdx2 = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_BRENDAN_DECORATING, SpriteCallbackDummy, 136, 72, 0);
else
sDecor_CameraSpriteObjectIdx2 = AddPseudoObjectEvent(OBJ_EVENT_GFX_MAY_DECORATING, SpriteCallbackDummy, 136, 72, 0);
sDecor_CameraSpriteObjectIdx2 = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAY_DECORATING, SpriteCallbackDummy, 136, 72, 0);
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);

View File

@ -5011,7 +5011,7 @@ static void TryAddInterviewObjectEvents(void)
return;
// Add object for reporter/interviewing fan (facing left)
spriteId = AddPseudoObjectEvent(graphicsId, SpriteCallbackDummy, 76, 40, 0);
spriteId = CreateObjectGraphicsSprite(graphicsId, SpriteCallbackDummy, 76, 40, 0);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].oam.priority = 0;
@ -5019,7 +5019,7 @@ static void TryAddInterviewObjectEvents(void)
}
// Add object for player (facing right)
spriteId = AddPseudoObjectEvent(
spriteId = CreateObjectGraphicsSprite(
gSaveBlock2Ptr->playerGender == MALE ? OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL : OBJ_EVENT_GFX_RIVAL_MAY_NORMAL,
SpriteCallbackDummy,
52,

View File

@ -114,7 +114,7 @@ static void DoRippleFieldEffect(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnSpawn(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnBeginStep(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnFinishStep(struct ObjectEvent*, struct Sprite*);
static void UpdateObjectEventSpritePosition(struct Sprite*);
static void VirtualObject_UpdateAnim(struct Sprite*);
static void ApplyLevitateMovement(u8);
static bool8 MovementType_Disguise_Callback(struct ObjectEvent *, struct Sprite *);
static bool8 MovementType_Buried_Callback(struct ObjectEvent *, struct Sprite *);
@ -126,7 +126,7 @@ static void SetObjectEventDynamicGraphicsId(struct ObjectEvent *);
static void RemoveObjectEventInternal(struct ObjectEvent *);
static u16 GetObjectEventFlagIdByObjectEventId(u8);
static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
static void MakeObjectTemplateFromObjectEventTemplate(struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
static void LoadObjectEventPalette(u16);
@ -148,7 +148,7 @@ static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *,
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
static void InitSpriteForFigure8Anim(struct Sprite *sprite);
static bool8 AnimateSpriteInFigure8(struct Sprite *sprite);
static void UpdateObjectEventSprite(struct Sprite *);
static void SpriteCB_VirtualObject(struct Sprite *);
static void DoShadowFieldEffect(struct ObjectEvent *);
static void SetJumpSpriteData(struct Sprite *, u8, u8, u8);
static void SetWalkSlowSpriteData(struct Sprite *sprite, u8 direction);
@ -1442,7 +1442,7 @@ static u8 TrySpawnObjectEventTemplate(struct ObjectEventTemplate *objectEventTem
const struct SubspriteTable *subspriteTables = NULL;
graphicsInfo = GetObjectEventGraphicsInfo(objectEventTemplate->graphicsId);
MakeObjectTemplateFromObjectEventTemplate(objectEventTemplate, &spriteTemplate, &subspriteTables);
MakeSpriteTemplateFromObjectEventTemplate(objectEventTemplate, &spriteTemplate, &subspriteTables);
spriteFrameImage.size = graphicsInfo->size;
spriteTemplate.images = &spriteFrameImage;
objectEventId = TrySetupObjectEventSprite(objectEventTemplate, &spriteTemplate, mapNum, mapGroup, cameraX, cameraY);
@ -1498,7 +1498,7 @@ u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup)
return TrySpawnObjectEventTemplate(objectEventTemplate, mapNum, mapGroup, cameraX, cameraY);
}
static void MakeObjectTemplateFromObjectEventGraphicsInfo(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
static void CopyObjectGraphicsInfoToSpriteTemplate(u16 graphicsId, void (*callback)(struct Sprite *), struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
{
const struct ObjectEventGraphicsInfo *graphicsInfo = GetObjectEventGraphicsInfo(graphicsId);
@ -1512,17 +1512,18 @@ static void MakeObjectTemplateFromObjectEventGraphicsInfo(u16 graphicsId, void (
*subspriteTables = graphicsInfo->subspriteTables;
}
static void MakeObjectTemplateFromObjectEventGraphicsInfoWithCallbackIndex(u16 graphicsId, u16 callbackIndex, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
static void CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(u16 graphicsId, u16 movementType, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
{
MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, sMovementTypeCallbacks[callbackIndex], spriteTemplate, subspriteTables);
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, sMovementTypeCallbacks[movementType], spriteTemplate, subspriteTables);
}
static void MakeObjectTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
{
MakeObjectTemplateFromObjectEventGraphicsInfoWithCallbackIndex(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
}
u8 AddPseudoObjectEvent(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority)
// Used to create a sprite using a graphicsId associated with object events.
u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority)
{
struct SpriteTemplate *spriteTemplate;
const struct SubspriteTable *subspriteTables;
@ -1530,7 +1531,7 @@ u8 AddPseudoObjectEvent(u16 graphicsId, void (*callback)(struct Sprite *), s16 x
u8 spriteId;
spriteTemplate = malloc(sizeof(struct SpriteTemplate));
MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, callback, spriteTemplate, &subspriteTables);
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, callback, spriteTemplate, &subspriteTables);
if (spriteTemplate->paletteTag != TAG_NONE)
LoadObjectEventPalette(spriteTemplate->paletteTag);
@ -1546,9 +1547,15 @@ u8 AddPseudoObjectEvent(u16 graphicsId, void (*callback)(struct Sprite *), s16 x
return spriteId;
}
// Used to create sprite object events instead of a full object event
// Used when resources are limiting, e.g. for the audience in contests or group members in Union Room
u8 CreateObjectSprite(u8 graphicsId, u8 objectEventId, s16 x, s16 y, u8 z, u8 direction)
#define sVirtualObjId data[0]
#define sVirtualObjElev data[1]
// "Virtual Objects" are a class of sprites used instead of a full object event.
// Used when more objects are needed than the object event limit (for Contest / Battle Dome audiences and group members in Union Room).
// A unique id is given as an argument and stored in the sprite data to allow referring back to the same virtual object.
// They can be turned (and, in the case of the Union Room, animated teleporting in and out) but do not have movement types
// or any of the other data normally associated with object events.
u8 CreateVirtualObject(u8 graphicsId, u8 virtualObjId, s16 x, s16 y, u8 z, u8 direction)
{
u8 spriteId;
struct Sprite *sprite;
@ -1557,7 +1564,7 @@ u8 CreateObjectSprite(u8 graphicsId, u8 objectEventId, s16 x, s16 y, u8 z, u8 di
const struct ObjectEventGraphicsInfo *graphicsInfo;
graphicsInfo = GetObjectEventGraphicsInfo(graphicsId);
MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, UpdateObjectEventSprite, &spriteTemplate, &subspriteTables);
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, SpriteCB_VirtualObject, &spriteTemplate, &subspriteTables);
*(u16 *)&spriteTemplate.paletteTag = TAG_NONE;
x += MAP_OFFSET;
y += MAP_OFFSET;
@ -1574,8 +1581,8 @@ u8 CreateObjectSprite(u8 graphicsId, u8 objectEventId, s16 x, s16 y, u8 z, u8 di
sprite->oam.paletteNum -= 16;
sprite->coordOffsetEnabled = TRUE;
sprite->sObjEventId = objectEventId;
sprite->data[1] = z;
sprite->sVirtualObjId = virtualObjId;
sprite->sVirtualObjElev = z;
if (graphicsInfo->paletteSlot == 10)
LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag, graphicsInfo->paletteSlot);
else if (graphicsInfo->paletteSlot >= 16)
@ -1697,7 +1704,7 @@ static void SpawnObjectEventOnReturnToField(u8 objectEventId, s16 x, s16 y)
subspriteTables = NULL;
graphicsInfo = GetObjectEventGraphicsInfo(objectEvent->graphicsId);
spriteFrameImage.size = graphicsInfo->size;
MakeObjectTemplateFromObjectEventGraphicsInfoWithCallbackIndex(objectEvent->graphicsId, objectEvent->movementType, &spriteTemplate, &subspriteTables);
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEvent->graphicsId, objectEvent->movementType, &spriteTemplate, &subspriteTables);
spriteTemplate.images = &spriteFrameImage;
*(u16 *)&spriteTemplate.paletteTag = TAG_NONE;
@ -8510,50 +8517,50 @@ void UpdateObjectEventSpriteInvisibility(struct Sprite *sprite, bool8 invisible)
#define sAnimNum data[3]
#define sAnimState data[4]
static void UpdateObjectEventSprite(struct Sprite *sprite)
static void SpriteCB_VirtualObject(struct Sprite *sprite)
{
UpdateObjectEventSpritePosition(sprite);
SetObjectSubpriorityByZCoord(sprite->data[1], sprite, 1);
VirtualObject_UpdateAnim(sprite);
SetObjectSubpriorityByZCoord(sprite->sVirtualObjElev, sprite, 1);
UpdateObjectEventSpriteInvisibility(sprite, sprite->sInvisible);
}
// Unused
static void DestroyObjectEventSprites(void)
static void DestroyVirtualObjects(void)
{
int i;
for (i = 0; i < MAX_SPRITES; i++)
{
struct Sprite *sprite = &gSprites[i];
if(sprite->inUse && sprite->callback == UpdateObjectEventSprite)
if(sprite->inUse && sprite->callback == SpriteCB_VirtualObject)
DestroySprite(sprite);
}
}
static int GetObjectEventSpriteId(u8 objectEventId) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end.
static int GetVirtualObjectSpriteId(u8 virtualObjId)
{
int i;
for (i = 0; i < MAX_SPRITES; i++)
{
struct Sprite *sprite = &gSprites[i];
if (sprite->inUse && sprite->callback == UpdateObjectEventSprite && (u8)sprite->sObjEventId == objectEventId)
if (sprite->inUse && sprite->callback == SpriteCB_VirtualObject && (u8)sprite->sVirtualObjId == virtualObjId)
return i;
}
return MAX_SPRITES;
}
void TurnObjectEventSprite(u8 objectEventId, u8 direction)
void TurnVirtualObject(u8 virtualObjId, u8 direction)
{
u8 spriteId = GetObjectEventSpriteId(objectEventId);
u8 spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId != MAX_SPRITES)
StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(direction));
}
void SetObjectEventSpriteGraphics(u8 objectEventId, u8 graphicsId)
void SetVirtualObjectGraphics(u8 virtualObjId, u8 graphicsId)
{
int spriteId = GetObjectEventSpriteId(objectEventId);
int spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId != MAX_SPRITES)
{
@ -8581,9 +8588,9 @@ void SetObjectEventSpriteGraphics(u8 objectEventId, u8 graphicsId)
}
}
void SetObjectEventSpriteInvisibility(u8 objectEventId, bool32 invisible)
void SetVirtualObjectInvisibility(u8 virtualObjId, bool32 invisible)
{
u8 spriteId = GetObjectEventSpriteId(objectEventId);
u8 spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId == MAX_SPRITES)
return;
@ -8594,9 +8601,9 @@ void SetObjectEventSpriteInvisibility(u8 objectEventId, bool32 invisible)
gSprites[spriteId].sInvisible = FALSE;
}
bool32 IsObjectEventSpriteInvisible(u8 objectEventId)
bool32 IsVirtualObjectInvisible(u8 virtualObjId)
{
u8 spriteId = GetObjectEventSpriteId(objectEventId);
u8 spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId == MAX_SPRITES)
return FALSE;
@ -8604,9 +8611,9 @@ bool32 IsObjectEventSpriteInvisible(u8 objectEventId)
return (gSprites[spriteId].sInvisible == TRUE);
}
void SetObjectEventSpriteAnim(u8 objectEventId, u8 animNum)
void SetVirtualObjectSpriteAnim(u8 virtualObjId, u8 animNum)
{
u8 spriteId = GetObjectEventSpriteId(objectEventId);
u8 spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId != MAX_SPRITES)
{
@ -8619,18 +8626,18 @@ static void MoveUnionRoomObjectUp(struct Sprite *sprite)
{
switch(sprite->sAnimState)
{
case 0:
case 0:
sprite->y2 = 0;
sprite->sAnimState++;
case 1:
sprite->y2 -= 8;
if (sprite->y2 == -DISPLAY_HEIGHT)
{
sprite->y2 = 0;
sprite->sAnimState++;
case 1:
sprite->y2 -= 8;
if (sprite->y2 == -DISPLAY_HEIGHT)
{
sprite->y2 = 0;
sprite->sInvisible = TRUE;
sprite->sAnimNum = 0;
sprite->sAnimState = 0;
}
sprite->sInvisible = TRUE;
sprite->sAnimNum = 0;
sprite->sAnimState = 0;
}
}
}
@ -8638,40 +8645,40 @@ static void MoveUnionRoomObjectDown(struct Sprite *sprite)
{
switch(sprite->sAnimState)
{
case 0:
sprite->y2 = -DISPLAY_HEIGHT;
sprite->sAnimState++;
case 1:
sprite->y2 += 8;
if(sprite->y2 == 0)
{
sprite->sAnimNum = 0;
sprite->sAnimState = 0;
}
case 0:
sprite->y2 = -DISPLAY_HEIGHT;
sprite->sAnimState++;
case 1:
sprite->y2 += 8;
if(sprite->y2 == 0)
{
sprite->sAnimNum = 0;
sprite->sAnimState = 0;
}
}
}
static void UpdateObjectEventSpritePosition(struct Sprite *sprite)
static void VirtualObject_UpdateAnim(struct Sprite *sprite)
{
switch(sprite->sAnimNum)
{
case UNION_ROOM_SPAWN_IN:
MoveUnionRoomObjectDown(sprite);
break;
case UNION_ROOM_SPAWN_OUT:
MoveUnionRoomObjectUp(sprite);
break;
case 0:
break;
default:
sprite->sAnimNum = 0;
break;
case UNION_ROOM_SPAWN_IN:
MoveUnionRoomObjectDown(sprite);
break;
case UNION_ROOM_SPAWN_OUT:
MoveUnionRoomObjectUp(sprite);
break;
case 0:
break;
default:
sprite->sAnimNum = 0;
break;
}
}
bool32 IsObjectEventSpriteAnimating(u8 objectEventId)
bool32 IsVirtualObjectAnimating(u8 virtualObjId)
{
u8 spriteId = GetObjectEventSpriteId(objectEventId);
u8 spriteId = GetVirtualObjectSpriteId(virtualObjId);
if (spriteId == MAX_SPRITES)
return FALSE;

View File

@ -325,7 +325,7 @@ void Task_HandlePorthole(u8 taskId)
static void ShowSSTidalWhileSailing(void)
{
u8 spriteId = AddPseudoObjectEvent(OBJ_EVENT_GFX_SS_TIDAL, SpriteCallbackDummy, 112, 80, 0);
u8 spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_SS_TIDAL, SpriteCallbackDummy, 112, 80, 0);
gSprites[spriteId].coordOffsetEnabled = FALSE;

View File

@ -1409,7 +1409,7 @@ static void NamingScreen_CreatePlayerIcon(void)
u8 spriteId;
rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, sNamingScreen->monSpecies);
spriteId = AddPseudoObjectEvent(rivalGfxId, SpriteCallbackDummy, 56, 37, 0);
spriteId = CreateObjectGraphicsSprite(rivalGfxId, SpriteCallbackDummy, 56, 37, 0);
gSprites[spriteId].oam.priority = 3;
StartSpriteAnim(&gSprites[spriteId], 4);
}
@ -1436,7 +1436,7 @@ static void NamingScreen_CreateWaldaDadIcon(void)
{
u8 spriteId;
spriteId = AddPseudoObjectEvent(OBJ_EVENT_GFX_MAN_1, SpriteCallbackDummy, 56, 37, 0);
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAN_1, SpriteCallbackDummy, 56, 37, 0);
gSprites[spriteId].oam.priority = 3;
StartSpriteAnim(&gSprites[spriteId], 4);
}

View File

@ -3180,14 +3180,14 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
{
case VERSION_FIRE_RED:
case VERSION_LEAF_GREEN:
objEvent->spriteId = AddPseudoObjectEvent(GetFRLGAvatarGraphicsIdByGender(linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
objEvent->spriteId = CreateObjectGraphicsSprite(GetFRLGAvatarGraphicsIdByGender(linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
break;
case VERSION_RUBY:
case VERSION_SAPPHIRE:
objEvent->spriteId = AddPseudoObjectEvent(GetRSAvatarGraphicsIdByGender(linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
objEvent->spriteId = CreateObjectGraphicsSprite(GetRSAvatarGraphicsIdByGender(linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
break;
case VERSION_EMERALD:
objEvent->spriteId = AddPseudoObjectEvent(GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
objEvent->spriteId = CreateObjectGraphicsSprite(GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, linkGender(objEvent)), SpriteCB_LinkPlayer, 0, 0, 0);
break;
}

View File

@ -1180,22 +1180,22 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx)
bool8 ScrCmd_createvobject(struct ScriptContext *ctx)
{
u8 graphicsId = ScriptReadByte(ctx);
u8 objectEventId = ScriptReadByte(ctx);
u8 virtualObjId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u32 y = VarGet(ScriptReadHalfword(ctx));
u8 elevation = ScriptReadByte(ctx);
u8 direction = ScriptReadByte(ctx);
CreateObjectSprite(graphicsId, objectEventId, x, y, elevation, direction);
CreateVirtualObject(graphicsId, virtualObjId, x, y, elevation, direction);
return FALSE;
}
bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
{
u8 objectEventId = ScriptReadByte(ctx);
u8 virtualObjId = ScriptReadByte(ctx);
u8 direction = ScriptReadByte(ctx);
TurnObjectEventSprite(objectEventId, direction);
TurnVirtualObject(virtualObjId, direction);
return FALSE;
}

View File

@ -847,7 +847,7 @@ static void BuyMenuDrawObjectEvents(void)
graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[sShopData->viewportObjects[i][OBJ_EVENT_ID]].graphicsId);
spriteId = AddPseudoObjectEvent(
spriteId = CreateObjectGraphicsSprite(
gObjectEvents[sShopData->viewportObjects[i][OBJ_EVENT_ID]].graphicsId,
SpriteCallbackDummy,
(u16)sShopData->viewportObjects[i][X_COORD] * 16 + 8,

View File

@ -400,12 +400,12 @@ void CreateUnionRoomPlayerSprites(u8 * spriteIds, s32 leaderId)
for (memberId = 0; memberId < MAX_RFU_PLAYERS; memberId++)
{
s32 id = UR_PLAYER_SPRITE_ID(leaderId, memberId);
spriteIds[id] = CreateObjectSprite(OBJ_EVENT_GFX_MAN_4,
spriteIds[id] = CreateVirtualObject(OBJ_EVENT_GFX_MAN_4,
id - UR_SPRITE_START_ID,
sUnionRoomPlayerCoords[leaderId][0] + sUnionRoomGroupOffsets[memberId][0],
sUnionRoomPlayerCoords[leaderId][1] + sUnionRoomGroupOffsets[memberId][1],
3, 1);
SetObjectEventSpriteInvisibility(id - UR_SPRITE_START_ID, TRUE);
SetVirtualObjectInvisibility(id - UR_SPRITE_START_ID, TRUE);
}
}
@ -443,7 +443,7 @@ static u8 GetNewFacingDirectionForUnionRoomPlayer(u32 memberId, u32 leaderId, st
static bool32 IsUnionRoomPlayerInvisible(u32 leaderId, u32 memberId)
{
return IsObjectEventSpriteInvisible(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID);
return IsVirtualObjectInvisible(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID);
}
static void SpawnGroupMember(u32 leaderId, u32 memberId, u8 graphicsId, struct RfuGameData * gameData)
@ -452,10 +452,10 @@ static void SpawnGroupMember(u32 leaderId, u32 memberId, u8 graphicsId, struct R
s32 id = UR_PLAYER_SPRITE_ID(leaderId, memberId);
if (IsUnionRoomPlayerInvisible(leaderId, memberId) == TRUE)
{
SetObjectEventSpriteInvisibility(id - UR_SPRITE_START_ID, FALSE);
SetObjectEventSpriteAnim(id - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_IN);
SetVirtualObjectInvisibility(id - UR_SPRITE_START_ID, FALSE);
SetVirtualObjectSpriteAnim(id - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_IN);
}
SetObjectEventSpriteGraphics(id - UR_SPRITE_START_ID, graphicsId);
SetVirtualObjectGraphics(id - UR_SPRITE_START_ID, graphicsId);
SetUnionRoomObjectFacingDirection(memberId, leaderId, GetNewFacingDirectionForUnionRoomPlayer(memberId, leaderId, gameData));
GetUnionRoomPlayerCoords(leaderId, memberId, &x, &y);
MapGridSetMetatileImpassabilityAt(x, y, TRUE);
@ -464,7 +464,7 @@ static void SpawnGroupMember(u32 leaderId, u32 memberId, u8 graphicsId, struct R
static void DespawnGroupMember(u32 leaderId, u32 memberId)
{
s32 x, y;
SetObjectEventSpriteAnim(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_OUT);
SetVirtualObjectSpriteAnim(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_OUT);
GetUnionRoomPlayerCoords(leaderId, memberId, &x, &y);
MapGridSetMetatileImpassabilityAt(x, y, FALSE);
}
@ -476,7 +476,7 @@ static void AssembleGroup(u32 leaderId, struct RfuGameData * gameData)
PlayerGetDestCoords(&x, &y);
player_get_pos_including_state_based_drift(&x2, &y2);
if (IsObjectEventSpriteInvisible(UR_PLAYER_SPRITE_ID(leaderId, 0) - UR_SPRITE_START_ID) == TRUE)
if (IsVirtualObjectInvisible(UR_PLAYER_SPRITE_ID(leaderId, 0) - UR_SPRITE_START_ID) == TRUE)
{
if (IsUnionRoomPlayerAt(leaderId, 0, x, y) == TRUE || IsUnionRoomPlayerAt(leaderId, 0, x2, y2) == TRUE)
return;
@ -576,9 +576,9 @@ bool32 TryInteractWithUnionRoomMember(struct RfuPlayerList *list, s16 *memberIdP
continue;
// Has a group member spawned at this position?
if (IsObjectEventSpriteInvisible(id - UR_SPRITE_START_ID))
if (IsVirtualObjectInvisible(id - UR_SPRITE_START_ID))
continue;
if (IsObjectEventSpriteAnimating(id - UR_SPRITE_START_ID))
if (IsVirtualObjectAnimating(id - UR_SPRITE_START_ID))
continue;
if (leaders[i].groupScheduledAnim != UNION_ROOM_SPAWN_IN)
continue;
@ -595,9 +595,9 @@ bool32 TryInteractWithUnionRoomMember(struct RfuPlayerList *list, s16 *memberIdP
static void SetUnionRoomObjectFacingDirection(s32 memberId, s32 leaderId, u8 newDirection)
{
TurnObjectEventSprite(MAX_RFU_PLAYERS * leaderId - UR_SPRITE_START_ID + memberId, newDirection);
TurnVirtualObject(MAX_RFU_PLAYERS * leaderId - UR_SPRITE_START_ID + memberId, newDirection);
// should be line below, but order is swapped here
// TurnObjectEventSprite(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID, newDirection);
// TurnVirtualObject(UR_PLAYER_SPRITE_ID(leaderId, memberId) - UR_SPRITE_START_ID, newDirection);
}
void UpdateUnionRoomMemberFacing(u32 memberId, u32 leaderId, struct RfuPlayerList *list)