src/field/field_engine_actors.c
The party's sprites, placing a scene's actors, and the actor slots. More…
Included by field_engine.c.
Macros
| Name | Description | |
|---|---|---|
#define | PLACEMENT_SPRITE_MAX 9989 | A placement row's sprite: 0 to 7 is a party member, who keeps that actor id; one up to this takes the next free slot, and one above it, which no table names, takes the slot of the row before. |
#define | LOOKUP_ID_COUNT 192 | The ids fdActorLookup answers: more than the ACTOR_ID_COUNT slots, so one past them reads the field state's members after the slots. |
#define | PARTY_SPRITE_LAST (PIERS + 1) | The last sprite the tests below take as a party member's: one past PIERS, though only Isaac's and Garet's sprites are ever swapped. |
#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 (ACTOR_ID_COUNT - ACTOR_FIRST_PLACED) | Placed actors' slots. |
#define | SPRITE_CACHE_FLAGS (offsetof(SPR, slot) + 1) | The byte of SPR after its slot, whose bit 0 is retainCacheEntry. |
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { ACTOR_DJINNI_FLAG_COUNT } |
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdPartyGetCharacterSprite (Sint32 character) | Returns the sprite of character, which is the character itself except that FLAG_CHILDHOOD gives Isaac and Garet SPRITE_ISAAC_CHILD and SPRITE_GARET_CHILD, and FLAG_ISAAC_WEARS_TUNIC gives grown Isaac sprite SPRITE_ISAAC_TUNIC. |
Sint32 | fdPartyGetCharacterSpriteForChildhood (Sint32 character, Sint32 childhood) | Returns the sprite of character as fdPartyGetCharacterSprite would with FLAG_CHILDHOOD set to childhood (as recorded in a save file's summary). |
void | fdScriptSpawnActorPlacements (ACTOR_PLACE *entry, Sint32 slot) | Creates the actors of a scene's actor placement table (ended by sprite -1), and records the table among the scene's tables. |
void | fdActorReleaseAtIndex (Sint32 actorIndex) | Releases the actor in slot actorIndex, if there is one, and empties the slot. |
void | fdActorResetForLeader (ACTOR_PLACE *table) | Creates a scene's actors on entering it: the party leader where the main routine's state puts it, then the scene's actor placement table from actor slot 8, and the camera that follows the leader. |
Sint32 | fdActorFindLastActiveId (void) | Returns the slot after the last placed actor (8 when there is none), or -1 when the last slot is occupied. |
void * | fdActorGetSlotAddress (Uint32 actorIndex) | Unused: returns the address of actor slot index in the field state. |
void | fdAssignViewFlags (ACTOR_PLACE *entry) | Gives each actor placement with condition 0 a condition saying whether it lies within the map's view bounds, so that only those inside appear. |
void | fdActorClearOutOfBounds (void) | Releases the placed actors far from the view's centre: more than 160 pixels to either side, 200 pixels north or 100 pixels south. |
void | fdActorRespawn (void) | Releases every placed actor and places the scene's actors again from its first actor placement table after the leader's. |
void | fdActorClearAll (void) | Empties all the actor slots, without releasing the actors. |
void * | fdActorLookup (Uint32 actorIndex) | Returns the actor in slot actorIndex (below LOOKUP_ID_COUNT), or NULL. |
void | fdActorSnapshot (void) | Saves up to 32 actors (only the party's 8 on the World Map) into ActorSnapshotWork, with each one's slot, animation, sprite flags and priority, so that fdActorRestore can put them back. |
void | fdActorRestore (void) | Puts back the actors fdActorSnapshot saved, and moves the camera to the party leader's height. |
Description
The party's sprites, placing a scene's actors, and the actor slots. Part of
field_engine.c.
Macros in detail
PLACEMENT_SPRITE_MAX
#define PLACEMENT_SPRITE_MAX 9989
A placement row's sprite: 0 to 7 is a party member, who keeps that actor id; one up to this takes the next free slot, and one above it, which no table names, takes the slot of the row before.
Referenced by fdScriptSpawnActorPlacements().
Definition at line 15 of file field_engine_actors.c.
LOOKUP_ID_COUNT
#define LOOKUP_ID_COUNT 192
The ids fdActorLookup answers: more than the ACTOR_ID_COUNT slots, so one
past them reads the field state's members after the slots.
Referenced by fdActorLookup().
Definition at line 19 of file field_engine_actors.c.
PARTY_SPRITE_LAST
#define PARTY_SPRITE_LAST (PIERS + 1)
The last sprite the tests below take as a party member's: one past PIERS, though only Isaac's and Garet's sprites are ever swapped.
Referenced by fdPartyGetCharacterSprite() and fdPartyGetCharacterSpriteForChildhood().
Definition at line 23 of file field_engine_actors.c.
FLAG_IN_VIEW
#define FLAG_IN_VIEW 0x164
kept clear, so a placement using it appears
Referenced by fdAssignViewFlags().
Definition at line 352 of file field_engine_actors.c.
FLAG_OUT_OF_VIEW
#define FLAG_OUT_OF_VIEW 0x165
kept set, so a placement using it does not
Referenced by fdAssignViewFlags().
Definition at line 353 of file field_engine_actors.c.
PLACED_MAX
#define PLACED_MAX (ACTOR_ID_COUNT - ACTOR_FIRST_PLACED)
Placed actors' slots.
Referenced by fdActorClearOutOfBounds() and fdActorRespawn().
Definition at line 356 of file field_engine_actors.c.
SPRITE_CACHE_FLAGS
#define SPRITE_CACHE_FLAGS (offsetof(SPR, slot) + 1)
The byte of SPR after its slot, whose bit 0 is retainCacheEntry.
Referenced by fdActorClearOutOfBounds().
Definition at line 389 of file field_engine_actors.c.
Enumerations in detail
anonymous enum
enum { ACTOR_DJINNI_FLAG_COUNT }
| Enumerator | Value | Description |
|---|---|---|
ACTOR_DJINNI_FLAG_COUNT | ELEMENT_COUNT * 20 | 20 flags per element: the Djinn's caught flags are 0x30 to 0x7f. |
Definition at line 6 of file field_engine_actors.c.
Functions in detail
fdPartyGetCharacterSprite
Sint32 fdPartyGetCharacterSprite(Sint32 character)
Returns the sprite of character, which is the character itself except that
FLAG_CHILDHOOD gives Isaac and Garet SPRITE_ISAAC_CHILD and
SPRITE_GARET_CHILD, and FLAG_ISAAC_WEARS_TUNIC gives grown Isaac sprite
SPRITE_ISAAC_TUNIC.
References gmFlagGetStub() and Sint32.
Referenced by fdScriptSpawnActorPlacements().
Definition at line 29 of file field_engine_actors.c.
fdPartyGetCharacterSpriteForChildhood
Sint32 fdPartyGetCharacterSpriteForChildhood(Sint32 character, Sint32 childhood)
Returns the sprite of character as fdPartyGetCharacterSprite would with
FLAG_CHILDHOOD set to childhood (as recorded in a save file's summary).
References Sint32.
Definition at line 58 of file field_engine_actors.c.
fdScriptSpawnActorPlacements
void fdScriptSpawnActorPlacements(ACTOR_PLACE *entry, Sint32 slot)
Creates the actors of a scene's actor placement table (ended by sprite -1), and records the table among the scene's tables.
References fdActorAddSpriteAnimationStub(), fdActorCreateStub(), fdActorLookup(), fdActorSelectAnimationStub(), fdActorSetMovementType(), fdActorSetPosAndResetMotionStub(), fdGameFlagIsConditionActive(), fdMapGridGetTerrainHeightStub(), fdPartyGetCharacterSprite(), gmFlagGetStub(), Sint32, state, syMulFX(), syRandom() and syVRAMCacheFreeEntry().
Referenced by fdActorResetForLeader(), fdActorRespawn() and fdScriptAppendActorPlacements().
Definition at line 79 of file field_engine_actors.c.
fdActorReleaseAtIndex
void fdActorReleaseAtIndex(Sint32 actorIndex)
Releases the actor in slot actorIndex, if there is one, and empties the slot.
References fdActorLookup(), fdActorReleaseStub(), memcpy(), Sint32 and state.
Definition at line 212 of file field_engine_actors.c.
fdActorResetForLeader
void fdActorResetForLeader(ACTOR_PLACE *table)
Creates a scene's actors on entering it: the party leader where the main routine's state puts it, then the scene's actor placement table from actor slot 8, and the camera that follows the leader.
References fdActorClearAll(), fdActorCreateStub(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorStartCameraStub(), fdMapGridGetTerrainHeightStub(), fdScriptSpawnActorPlacements(), fdSpriteAddAnimationStub(), FieldDefaultActorPlacements, MainRoutineStateWork, Sint32 and state.
Referenced by fdEngineRun() and fdScriptRunActorUpdateAndWait().
Definition at line 240 of file field_engine_actors.c.
fdActorFindLastActiveId
Sint32 fdActorFindLastActiveId(void)
Returns the slot after the last placed actor (8 when there is none), or -1 when the last slot is occupied.
Referenced by fdActorRespawn() and fdScriptAppendActorPlacements().
Definition at line 318 of file field_engine_actors.c.
fdActorGetSlotAddress
void *fdActorGetSlotAddress(Uint32 actorIndex)
Unused: returns the address of actor slot index in the field state.
Definition at line 343 of file field_engine_actors.c.
fdAssignViewFlags
void fdAssignViewFlags(ACTOR_PLACE *entry)
Gives each actor placement with condition 0 a condition saying whether it lies within the map's view bounds, so that only those inside appear.
References gmFlagClearStub(), gmFlagSetStub() and Sint32.
Referenced by scGetActorPlacements().
Definition at line 360 of file field_engine_actors.c.
fdActorClearOutOfBounds
void fdActorClearOutOfBounds(void)
Releases 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.
References fdActorReleaseStub(), Sint32 and state.
Referenced by fdDjinnJoinParty() and fdUsePsynergy().
Definition at line 393 of file field_engine_actors.c.
fdActorRespawn
void fdActorRespawn(void)
Releases every placed actor and places the scene's actors again from its first actor placement table after the leader's.
References fdActorFindLastActiveId(), fdActorReleaseStub(), fdScriptSpawnActorPlacements(), Sint32 and state.
Referenced by fdDjinnJoinParty() and fdUsePsynergy().
Definition at line 457 of file field_engine_actors.c.
fdActorClearAll
void fdActorClearAll(void)
Empties all the actor slots, without releasing the actors.
Referenced by fdActorResetForLeader().
Definition at line 486 of file field_engine_actors.c.
fdActorLookup
void *fdActorLookup(Uint32 actorIndex)
Returns the actor in slot actorIndex (below LOOKUP_ID_COUNT), or NULL.
References memcpy().
Referenced by fdActorCenterOnColumn(), fdActorClearDestinationAndStand(), fdActorConfigureSpriteColor(), fdActorFaceActorById(), fdActorFaceDirectionById(), fdActorGetById(), fdActorGetCueMetatileAheadOfCurrent(), fdActorGetScreenPos(), fdActorJump(), fdActorLaunchFromLeader(), fdActorMoveToAndWaitById(), fdActorReleaseAtIndex(), fdActorReleaseById(), fdActorRestore(), fdActorSetAnimationById(), fdActorSetAnimationSpeedById(), fdActorSetDestinationById(), fdActorSetDestinationOffsetById(), fdActorSetHorizontalPosWithTerrain(), fdActorSetMovementTypeAndWaitById(), fdActorSetMovementTypeById(), fdActorSetOthersPaused(), fdActorSetPosWithTerrain(), fdActorSetSpeedParams(), fdActorSetSpritePriority(), fdActorShowEmoteById(), fdActorSnapshot(), fdActorStartRepeatedMotion(), fdActorStop(), fdActorTurnToFaceEachOther(), fdActorWaitForAnimationChange(), fdActorWaitForAnimationEnd(), fdActorWaitForMoveById(), fdActorWaitForScriptEndById(), fdActorWalkByAndWaitById(), fdActorWalkByById(), fdActorWalkToAndWaitById(), fdActorWalkToById(), fdActorWatchAndSetScript(), fdActorWatchAndStartScript(), fdCameraFollowActor(), fdCameraMoveToActorById(), fdDjinnRestoreActorAfterBattle(), fdEffectBlinkAvoidCaster(), fdEffectSetAttached(), fdEffectSpawnRevealMarkers(), fdEffectStartGroundMask(), fdEntrancePlayArrival(), fdEntrancePlayArrivalAnimation(), fdExitPrepareAnimation() and 43 more.
Definition at line 501 of file field_engine_actors.c.
fdActorSnapshot
void fdActorSnapshot(void)
Saves up to 32 actors (only the party's 8 on the World Map) into
ActorSnapshotWork, with each one's slot, animation, sprite flags and
priority, so that fdActorRestore can put them back.
References ActorSnapshotWork, fdActorLookup(), Sint32, state and syDMAXCopy().
Referenced by fdEngineRun(), scStuccoRoomsCOfferLuckyDice(), scStuccoRoomsCOfferLuckyWheels() and scVenusLighthouseAerieEruptBeacon().
Definition at line 524 of file field_engine_actors.c.
fdActorRestore
void fdActorRestore(void)
Puts back the actors fdActorSnapshot saved, and moves the camera to the party
leader's height.
References ActorSnapshotWork, fdActorLookup(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorStartIdleStub(), MainRoutineStateWork, Sint32, state and syDMAXCopy().
Referenced by fdEngineRun() and scVenusLighthouseAerieRestorePartyOnBrokenAerie().
Definition at line 581 of file field_engine_actors.c.