Battle objects made and placed on the battlefield. More...
Go to the source code of this file.
Macros | |
| #define | SPRITE_ISAAC_MACHETE 480 |
| Isaac and Garet hold a Machete with sprites of their own. | |
| #define | SPRITE_GARET_MACHETE 482 |
| #define | SCALE_ONE 0x10000 |
| BattleObj.scale and MotionObject scales are 16.16 fixed point. | |
| #define | BATTLE_OBJ_NO_EFFECT 0x1fe |
| BattleObj.effect while no effect is attached. | |
| #define | IS_PLACEHOLDER_ID(id) |
| BattleWork.enemyIds of an enemy that left the battle, and of a place held for one: unit ids 254 and 255 in the list. | |
Functions | |
| void | BattleObjMake (struct BattleObj *actor, s32 unitId, s32 x, s32 y) |
| Creates the battle object of unit at (x, y) on the battlefield, in pixels: its sprite (an enemy's from its class, sharing the slot it already holds; a party member's battle sprite), palette, size and weapon sprite, turned to face the centre, and starts its motion script (gBattlePres_ActorObjectScript). | |
| void | BattlePlacement_GetStepPair (s32 partyPlace, s32 *x, s32 *y) |
| Reads the battlefield position of party place index from gBattlePlacement_StepPairs, in pixels. | |
| void | Summon_LayoutPositions (u16 *actorIds, s32 count, s32 *xPositions, s32 *zPositions) |
| Lays out count enemies in a column 80 pixels left of the centre, spaced by their size (38 pixels around a large enemy, 27 around a small one, 25 around an empty place, closer when there are more than four) and centred on the line. | |
| s32 | EnemySlotGet (void) |
| Returns the id of the first free enemy unit, or -1 when all six are taken. | |
| s32 | EnemyUpdate (void) |
| Lays the enemies out again and moves each one's object anchor to its new place. | |
| void | BattleUnit_RefreshPlacement (void) |
| Places every unit at the start of a battle: numbers the places (party members 0 up in their order, enemies 8 to 13) and creates each unit's object at its spot. | |
| s32 | BattlePlacement_ContainsId (s16 *list, s32 place) |
| Returns 1 if the unit at place is in list. | |
Battle objects made and placed on the battlefield.
Part of battle.c, the battle object, compiled only through it.
Definition in file placement.c.
| #define SPRITE_ISAAC_MACHETE 480 |
Isaac and Garet hold a Machete with sprites of their own.
Definition at line 8 of file placement.c.
Referenced by BattleObjMake().
| #define SPRITE_GARET_MACHETE 482 |
Definition at line 9 of file placement.c.
Referenced by BattleObjMake().
| #define SCALE_ONE 0x10000 |
BattleObj.scale and MotionObject scales are 16.16 fixed point.
Definition at line 12 of file placement.c.
Referenced by BattleObjMake().
| #define BATTLE_OBJ_NO_EFFECT 0x1fe |
BattleObj.effect while no effect is attached.
Definition at line 15 of file placement.c.
Referenced by BattleObjMake().
| #define IS_PLACEHOLDER_ID | ( | id | ) |
BattleWork.enemyIds of an enemy that left the battle, and of a place held for one: unit ids 254 and 255 in the list.
Definition at line 282 of file placement.c.
Referenced by Summon_LayoutPositions().
Creates the battle object of unit at (x, y) on the battlefield, in pixels: its sprite (an enemy's from its class, sharing the slot it already holds; a party member's battle sprite), palette, size and weapon sprite, turned to face the centre, and starts its motion script (gBattlePres_ActorObjectScript).
Called by BattleUnit_RefreshPlacement and by BattleTargetExec for an enemy that joins. Fills in actor, creates a field object for it and, for an enemy, claims its sprite slots.
Definition at line 24 of file placement.c.
Referenced by BattleObjMake(), BattleTargetExec(), and BattleUnit_RefreshPlacement().
Reads the battlefield position of party place index from gBattlePlacement_StepPairs, in pixels.
Nothing in the source calls it; BattleUnit_RefreshPlacement reads the table directly.
Definition at line 274 of file placement.c.
Referenced by BattlePlacement_GetStepPair().
Lays out count enemies in a column 80 pixels left of the centre, spaced by their size (38 pixels around a large enemy, 27 around a small one, 25 around an empty place, closer when there are more than four) and centred on the line.
Two large classes stand nearer, 50 pixels left. Called by BattleUnit_RefreshPlacement and EnemyUpdate; writes only xPositions and zPositions.
Definition at line 290 of file placement.c.
Referenced by BattleUnit_RefreshPlacement(), EnemyUpdate(), and Summon_LayoutPositions().
| s32 EnemySlotGet | ( | void | ) |
Returns the id of the first free enemy unit, or -1 when all six are taken.
Called by BattleTargetExec when an enemy calls for help.
Definition at line 328 of file placement.c.
Referenced by BattleTargetExec(), and EnemySlotGet().
| s32 EnemyUpdate | ( | void | ) |
Lays the enemies out again and moves each one's object anchor to its new place.
Called by BattleTargetExec after an enemy joins. Writes the anchorX and anchorZ of every enemy's battle object.
Definition at line 348 of file placement.c.
Referenced by BattleTargetExec(), and EnemyUpdate().
| void BattleUnit_RefreshPlacement | ( | void | ) |
Places every unit at the start of a battle: numbers the places (party members 0 up in their order, enemies 8 to 13) and creates each unit's object at its spot.
Called by Battle_RunEncounter once the unit lists are filled. Writes gBattleWork->placement and every unit's battle object.
Definition at line 379 of file placement.c.
Referenced by Battle_RunEncounter(), and BattleUnit_RefreshPlacement().
Returns 1 if the unit at place is in list.
Called by BattleActor_SpawnObjectsForList to find the objects to release.
| list | unit ids, ended by BATTLE_UNIT_LIST_END, 14 at most |
| place | 0 to 7 a party unit id, 8 to 13 the enemies |
Definition at line 436 of file placement.c.
Referenced by BattleActor_SpawnObjectsForList(), and BattlePlacement_ContainsId().