Alchemy
Loading...
Searching...
No Matches

actors.c File Reference

The party's sprites, placing a scene's actors, and the actor table. More...

Go to the source code of this file.

Macros

#define MAP_CELLS   ((struct MapCell *)Ram_MapCellBuffer)
#define FLAG_IN_VIEW   0x164
 kept clear, so a placement using it appears
#define FLAG_OUT_OF_VIEW   0x165
 kept set, so a placement using it does not
#define PLACED_MAX   58
 actor slots 8 to 65

Enumerations

enum  { ACTOR_DJINNI_FLAG_COUNT = NUM_ELEMENTS * 20 , ACTOR_TUNIC_ANIMATION = 226 }

Functions

s32 Party_RemapCharacterIdByFlags (s32 character)
 Returns the sprite of character, which is the character itself except that FLAG_CHILDHOOD gives characters 0 and 1 sprites 0x12 and 0x13, and FLAG_ISAAC_WEARS_TUNIC gives grown Isaac sprite 0x11.
s32 Party_RemapCharacterIdIfEnabled (s32 character, s32 childhood)
 Returns the sprite of character as Party_RemapCharacterIdByFlags would with FLAG_CHILDHOOD set to childhood (as recorded in a save file's summary).
void Event_SpawnObjectTable (struct ScenePlacement *entry, s32 slot)
 Creates the actors of a scene's placement table (ended by sprite -1), and records the table among the scene's tables.
void ObjectTable_DestroyAtIndex (s32 actorIndex)
 Destroys the actor in slot actorIndex, if there is one, and empties the slot.
void ObjectTable_ResetForObject (struct ScenePlacement *table)
 Creates a scene's actors on entering it: the party leader where the game state puts it, then the scene's placement table from actor slot 8, and the camera that follows the leader.
s32 ObjectTable_FindLastActiveId (void)
 Returns the slot after the last placed actor (8 when there is none), or -1 when slot 65 is occupied.
UNUSED void * ObjectTable_GetSlotAddress (u32 actorIndex)
 Returns the address of actor slot index in the event work.
void Scene_AssignViewFlags (struct ScenePlacement *entry)
 Gives each placement with condition 0 a condition saying whether it lies within the map's view bounds, so that only those inside appear.
void BattleEffect_ClearOutOfBoundsObjects (void)
 Destroys the placed actors far from the view's centre: more than 160 pixels to either side, 200 pixels north or 100 pixels south.
void BattleEffect_ClearAllObjects (void)
 Destroys every placed actor and places the scene's actors again from its first placement table after the leader's.
void ObjectTable_ClearAll (void)
 Empties all 66 actor slots, without destroying the actors.
void * ObjectTable_Get (u32 actorIndex)
 Returns the actor in slot index (0 to 65), or NULL.
void ObjectTable_Snapshot (void)
 Saves up to 32 actors (only the party's 8 on the world map) into gObjectSnapshots, with each one's slot, animation, sprite flags and priority, so that ObjectTable_Restore can put them back.
void ObjectTable_Restore (void)
 Puts back the actors ObjectTable_Snapshot saved, and moves the camera to the party leader's height.

Variables

const struct ScenePlacement gField_DefaultPlacements [2]

Detailed Description

The party's sprites, placing a scene's actors, and the actor table.

Part of object.c, the field object, compiled only through it.

Definition in file actors.c.

Macro Definition Documentation

◆ MAP_CELLS

#define MAP_CELLS   ((struct MapCell *)Ram_MapCellBuffer)

Definition at line 60 of file actors.c.

◆ FLAG_IN_VIEW

#define FLAG_IN_VIEW   0x164

kept clear, so a placement using it appears

Definition at line 314 of file actors.c.

Referenced by Scene_AssignViewFlags().

◆ FLAG_OUT_OF_VIEW

#define FLAG_OUT_OF_VIEW   0x165

kept set, so a placement using it does not

Definition at line 315 of file actors.c.

Referenced by Scene_AssignViewFlags().

◆ PLACED_MAX

#define PLACED_MAX   58

actor slots 8 to 65

Definition at line 317 of file actors.c.

Referenced by BattleEffect_ClearAllObjects(), and BattleEffect_ClearOutOfBoundsObjects().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ACTOR_DJINNI_FLAG_COUNT 

20 flags per element

ACTOR_TUNIC_ANIMATION 

Definition at line 7 of file actors.c.

Function Documentation

◆ Party_RemapCharacterIdByFlags()

s32 Party_RemapCharacterIdByFlags ( s32 character)

Returns the sprite of character, which is the character itself except that FLAG_CHILDHOOD gives characters 0 and 1 sprites 0x12 and 0x13, and FLAG_ISAAC_WEARS_TUNIC gives grown Isaac sprite 0x11.

Called by Event_SpawnObjectTable for every placement, and by PsynergyMenu_InitializeEntryObjects (through Party_RemapCharacterIdByFlagsFar) for the party's figures.

Definition at line 19 of file actors.c.

Referenced by Event_SpawnObjectTable(), and Party_RemapCharacterIdByFlags().

◆ Party_RemapCharacterIdIfEnabled()

s32 Party_RemapCharacterIdIfEnabled ( s32 character,
s32 childhood )

Returns the sprite of character as Party_RemapCharacterIdByFlags would with FLAG_CHILDHOOD set to childhood (as recorded in a save file's summary).

Called by SaveMenu_ShowPartySprites through Party_RemapCharacterIdIfEnabledFar. Save summaries omit the tunic flag, so this never gives sprite 0x11.

Definition at line 45 of file actors.c.

Referenced by Party_RemapCharacterIdIfEnabled().

◆ Event_SpawnObjectTable()

void Event_SpawnObjectTable ( struct ScenePlacement * entry,
s32 slot )

Creates the actors of a scene's placement table (ended by sprite -1), and records the table among the scene's tables.

Sprites 0 to 7 are the party's characters and take their own actor slot; other placements take the actor slots from slot on, one each, up to slot 65. A placement whose condition does not hold is skipped, as is a Djinni hidden after a lost battle outside the world map. An existing actor is moved back to its place unless the party keeps its position.

Called by ObjectTable_ResetForObject (the leader, then the scene's table), BattleEffect_ClearAllObjects and Event_CallWithLastActiveObjectId. Records the table in work->tables and each actor in work->actors.

Definition at line 75 of file actors.c.

Referenced by BattleEffect_ClearAllObjects(), Event_CallWithLastActiveObjectId(), Event_SpawnObjectTable(), and ObjectTable_ResetForObject().

◆ ObjectTable_DestroyAtIndex()

void ObjectTable_DestroyAtIndex ( s32 actorIndex)

Destroys the actor in slot actorIndex, if there is one, and empties the slot.

No caller names it; its far-call veneer has no exported name.

Definition at line 186 of file actors.c.

Referenced by ObjectTable_DestroyAtIndex().

◆ ObjectTable_ResetForObject()

void ObjectTable_ResetForObject ( struct ScenePlacement * table)

Creates a scene's actors on entering it: the party leader where the game state puts it, then the scene's placement table from actor slot 8, and the camera that follows the leader.

A leader entering above ground where its cell and the cell north of it are climbing spots (collision code 0xfd) is raised by the ground height of the cell north of it less 32 pixels, and starts climbing (movement mode 1).

Called by Field_RunScene on entering a scene, and by Event_RunObjectHookAndWait. Empties every actor slot and table first; sets work->camera, the map's origin and gGameState.movementMode.

Definition at line 217 of file actors.c.

Referenced by Event_RunObjectHookAndWait(), Field_RunScene(), and ObjectTable_ResetForObject().

◆ ObjectTable_FindLastActiveId()

s32 ObjectTable_FindLastActiveId ( void )

Returns the slot after the last placed actor (8 when there is none), or -1 when slot 65 is occupied.

Earlier holes are not reused by this append scan.

Called by BattleEffect_ClearAllObjects and Event_CallWithLastActiveObjectId to choose where Event_SpawnObjectTable starts.

Definition at line 285 of file actors.c.

Referenced by BattleEffect_ClearAllObjects(), Event_CallWithLastActiveObjectId(), and ObjectTable_FindLastActiveId().

◆ ObjectTable_GetSlotAddress()

UNUSED void * ObjectTable_GetSlotAddress ( u32 actorIndex)

Returns the address of actor slot index in the event work.

Definition at line 307 of file actors.c.

Referenced by ObjectTable_GetSlotAddress().

◆ Scene_AssignViewFlags()

void Scene_AssignViewFlags ( struct ScenePlacement * entry)

Gives each placement with condition 0 a condition saying whether it lies within the map's view bounds, so that only those inside appear.

Called by scene overlays through Scene_AssignViewFlagsFar, which they import under four local names (FieldScene_PrepareActors the most used). Writes the placements' condition, and clears FLAG_IN_VIEW and sets FLAG_OUT_OF_VIEW.

Definition at line 325 of file actors.c.

Referenced by Scene_AssignViewFlags().

◆ BattleEffect_ClearOutOfBoundsObjects()

void BattleEffect_ClearOutOfBoundsObjects ( void )

Destroys the placed actors far from the view's centre: more than 160 pixels to either side, 200 pixels north or 100 pixels south.

Actors at (0, 0) stay.

Called on the world map before an effect plays, by Field_UsePsynergy and Djinn_JoinParty; empties the slots it frees. BattleEffect_ClearAllObjects brings the actors back afterwards.

Definition at line 357 of file actors.c.

Referenced by BattleEffect_ClearOutOfBoundsObjects(), Djinn_JoinParty(), and Field_UsePsynergy().

◆ BattleEffect_ClearAllObjects()

void BattleEffect_ClearAllObjects ( void )

Destroys every placed actor and places the scene's actors again from its first placement table after the leader's.

Called on the world map after an effect, by Field_UsePsynergy and Djinn_JoinParty. Clears work->tables 1 to 3 before the table is spawned again.

Definition at line 417 of file actors.c.

Referenced by BattleEffect_ClearAllObjects(), Djinn_JoinParty(), and Field_UsePsynergy().

◆ ObjectTable_ClearAll()

void ObjectTable_ClearAll ( void )

Empties all 66 actor slots, without destroying the actors.

Called by ObjectTable_ResetForObject.

Definition at line 443 of file actors.c.

Referenced by ObjectTable_ClearAll(), and ObjectTable_ResetForObject().

◆ ObjectTable_Get()

void * ObjectTable_Get ( u32 actorIndex)

Returns the actor in slot index (0 to 65), or NULL.

Indices up to 191 read past the actor slots into the rest of the event work; larger ones give NULL.

The field's actor lookup: called across the object folder and, through ObjectTable_GetFar (Engine_ActorLookup), by scene overlays.

Definition at line 462 of file actors.c.

Referenced by Actor_WaitForAnimationEnd(), BattleEffect_PauseObject(), BattleFx_ConfigureLinkedObject(), BattleFx_FindMatchingEvent(), BattleFx_GetAnimationValue(), BattleFx_ResumeObject(), BattleFx_SetupObjectPair(), BattleFx_SpawnLinked(), BattleFx_StartEffectObject22(), BattleFx_StartFadeOverlay(), Camera_FollowActor(), DisplayTransition_UpdateScanlineTable(), EffectRuntime_RunRisingObjectSequence(), Event_RunObjectHookAndWait(), Event_ShowSpeakerMessage(), Event_SpawnObjectTable(), Field_FindItemEvent(), Field_FindNearbyPsynergyTarget(), Field_FindNearbyTalkTarget(), Field_RequestBattleFromEncounterTable(), Field_RequestDjinnBattle(), Field_RunPsynergyEvents(), Field_UpdateObjectVisibilityBounds(), Field_UsePsynergy(), FieldEffect_SpawnNearbyMarkers(), FieldEffect_WatchLeaderDistance(), FieldFx_BlinkAvoidCaster(), FieldFx_CheckCloakTile(), FieldFx_EndCloak(), FieldFx_RunReveal(), FieldFx_StartCloak(), FieldObject_PlaceSceneActors(), ItemDisplay_RaiseAboveLeader(), Leader_StopMoving(), Map_UpdateWorldMapMarkers(), Marker_MoveLeaderAway(), Motion_LaunchFromFocusedObject(), Object_GetById(), Object_GetScreenPosition(), Object_GetTriggerTileAheadOfCurrent(), Object_LinkObjectAndSetCallback(), Object_LinkPair(), Object_PlaceCurrentWithinCameraBounds(), Object_RefreshSelectorById(), Object_ResetTargetAndSetMode1(), Object_SetActionById(), Object_SetActionCallbackAndRefreshById(), Object_SetModeById(), Object_SetTargetAndCallback(), ObjectEffect_EndContextEffect(), ObjectEffect_PrepareContextEffect(), ObjectEffect_RunPendingFlagEvent(), ObjectGroup_ConfigureChildValue(), ObjectGroup_SetActionForOthers(), ObjectMotion_ArmCallback(), ObjectMotion_CenterOnColumn(), ObjectMotion_CommitCurrentPositionAndActivate(), ObjectMotion_CommitPositionAndActivate(), ObjectMotion_EnableActionAndResetMotion(), ObjectMotion_EnableActionAndSetCallback(), ObjectMotion_Launch(), ObjectMotion_OffsetPositionAndReset(), ObjectMotion_OffsetPositionAndResetMotion(), ObjectMotion_ResetAndSetPosition(), ObjectMotion_ResetAndSetPositionInMode2(), ObjectMotion_SetActionVariant(), ObjectMotion_SetAngleToward(), ObjectMotion_SetHorizontalPositionWithTerrain(), ObjectMotion_SetPositionAndCommit(), ObjectMotion_SetPositionAndReset(), ObjectMotion_SetPositionWithTerrain(), ObjectMotion_SetSpeedParameters(), ObjectMotion_SetVariantCallback(), ObjectMotion_WaitForAnimationChange(), ObjectTable_DestroyAtIndex(), ObjectTable_DestroyById(), ObjectTable_Get(), ObjectTable_Restore(), ObjectTable_Snapshot(), Scene_FindEvent(), and UiText_OpenMessageAtObject().

◆ ObjectTable_Snapshot()

void ObjectTable_Snapshot ( void )

Saves up to 32 actors (only the party's 8 on the world map) into gObjectSnapshots, with each one's slot, animation, sprite flags and priority, so that ObjectTable_Restore can put them back.

Called by Field_RunScene before a random battle, by the save menu through SaveState_CaptureObjectTableFar, and by two scenes (Tolbi's spring and the Venus Lighthouse aerie).

Definition at line 488 of file actors.c.

Referenced by Field_RunScene(), ObjectTable_Snapshot(), TolbiSpring_OfferLuckyDice(), TolbiSpring_OfferLuckyWheels(), and VenusLighthouseAerie_EruptBeacon().

◆ ObjectTable_Restore()

void ObjectTable_Restore ( void )

Puts back the actors ObjectTable_Snapshot saved, and moves the camera to the party leader's height.

Called by Field_RunScene when the party keeps its position (FLAG_KEEP_PARTY_POSITION), and by the Venus Lighthouse aerie scene through ObjectTable_RestoreFar. Only actors whose slots are filled again are restored; the leader is set idle.

Definition at line 545 of file actors.c.

Referenced by Field_RunScene(), and ObjectTable_Restore().

Variable Documentation

◆ gField_DefaultPlacements

const struct ScenePlacement gField_DefaultPlacements[2]
extern