src/battle/battle_internal.h
What every part of the battle object shares: its includes, in their original order, and the names two or more parts use. More…
#include "ability_ids.h"#include "debug/debug.h"#include "enemy_ids.h"#include "flags.h"#include "item_ids.h"#include "macros.h"#include "resource_ids.h"#include "battle/ability_staging.h"#include "battle/battle_actor.h"#include "battle/battle_camera.h"#include "battle/battle_effect_state.h"#include "battle/battle_random.h"#include "battle/battle_side.h"#include "battle/blitter.h"#include "battle/debug_parameter_set.h"#include "battle/first_strike.h"#include "battle/formations.h"#include "battle/range_falloff.h"#include "battle/weapon_kind.h"#include "battle_effect/stubs.h"#include "field/engine_stubs.h"#include "field/script.h"#include "field/map_grid.h"#include "field/stubs.h"#include "game/inventory.h"#include "game/stubs.h"#include "graphics/graphics.h"#include "sound/sound_driver_symbols.h"#include "window/battle_status.h"#include "window/stubs.h"#include "text/msg_ids.h"
Included by battle.c, battle_ability.c, battle_action.c, battle_auto_battle.c, battle_background.c, battle_debug.c, battle_element_glow.c, battle_enemy_ai.c, battle_formation.c, battle_link.c, battle_motion.c, battle_objects.c, battle_placement.c, battle_playback.c, battle_playback_queue.c, battle_run.c, battle_setup.c, battle_spoils.c, battle_sprite.c, battle_sprite_slots.c, battle_staging.c, battle_targeting.c, battle_transition.c, battle_turn.c and battle_turn_end.c.
Macros
| Name | Description | |
|---|---|---|
#define | BATTLE_WININ | The battle's windows: window 0 shows BG0 to BG2, sprites and blending, window 1 BG0, BG2, sprites and blending, and outside them only BG0 and blending. |
#define | BATTLE_WINOUT (WINOUT_WIN01_BG0 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_ALL) | |
#define | BATTLE_BG_PALETTE ((Uint16 *)&BG_PLTT_COLOR(6, 0)) | The battle background's colours: BG palettes 6 to 13, filled from BATTLE_STATE.palette, darkened or not. |
#define | CURTAIN_TILE (n) (BG_CHAR_BLOCK(1) + (128 + (n)) * TILE_SIZE_4BPP) | The opening curtain's tiles: 4-bit tiles 128 to 136 of character block 1, which BG1 shows from its map in screen block 12. |
#define | BATTLE_BG1CNT | BG1 during a battle: 256 colours, priority 3, its map in screen block BATTLE_BG1_SCREEN_BLOCK. |
#define | LINK_PARTY_SIZE 3 | In a link battle each console sends LINK_PARTY_SIZE places, at most three party members (btLinkBattleSendParty), and the opponent's take the first three enemy ids from FIRST_ENEMY_UNIT. |
#define | BATTLE_OBJECT_NONE 255 | BATTLE_STATE.objectIndex of a unit with no place on the battlefield: btUnitRefreshPlacement fills the list with it, and btObjectGet returns NULL for it. |
#define | DEFEAT_ONE 0 | BATTLE_STATE.defeatState: whether the last enemy fell alone, or with others before it, or a party member's action ended the battle with a single defeat. |
#define | DEFEAT_SEVERAL 1 | |
#define | DEFEAT_BY_PARTY_MEMBER 3 | |
#define | ENEMY_DEFEATED_FLAG (classId) ((classId) + 0x600) | The game flag of an enemy the party has defeated, set by btEnemyRecordDefeat outside the monster battles; the monster battles choose only formations of defeated enemies (btFormationAverageLevel). |
#define | ENEMY_LETTER_FIRST_TOO 0x8000 | btEnemyClaimNameLetter returns the letter in ENEMY_LETTER_MASK, with ENEMY_LETTER_FIRST_TOO set for the second enemy of a class: its callers then give the first one its letter too (btEnemyLetterFirstOfKind) before passing the letter to gmBattleUnitSetStub. |
#define | ENEMY_LETTER_MASK 0x7fff | |
#define | UNIT_NAME_LENGTH 14 | The length of a unit's name, its terminator excluded. |
#define | SIO_MULTI_PLAYER_ID () ((REG_SIOCNT << 26) >> 30) | This console's number in a link session (SIOCNT bits 4 and 5, which the hardware sets in multi-player mode): 0 for the parent, 1 for the child. |
#define | LINK_BOTH_CONNECTED 3 | LinkStatusWork: both consoles are connected. |
#define | EQUIP_WEAPON 1 | The inventory's weapon slot, for gmInventoryFindEquippedStub. |
#define | ACTOR_SPRITE_GROUP_SIZE 4 | A group's sprite word (ACTOR_SPRITE_GROUP) points to a table of four sprites. |
#define | ACTION_REPORTED -1 | btActionRunBuild's results besides 0, which stages the action. |
#define | ACTION_NOTHING_TO_SHOW -2 | nothing to stage or show |
#define | STAGING_HIDE_ACTOR 1 | btStagingRunFullScreen's mode: a summon hides its user too. |
#define | DEFEAT_HP_CHANGE 0xc0000000 | An HP change that defeats any unit: the Grim Reaper's call deals it, and the debug defeat. |
#define | TARGET_PICK_SIDE_EMPTY -2 | btAIChooseTarget's results when it picks no one: the side it may target lists no one, or no one there is worth the ability. |
#define | TARGET_PICK_NONE -1 | |
#define | TARGET_NONE_ENEMY PLACE_PARTY | BATTLE_ACTION.target of a held unit's lost action (COMMAND_NONE, from btBuildEnemyActions and btBuildPartyActions): as a place code, place 0 of the other side, the party's for an enemy and the enemies' for a party member. |
#define | TARGET_NONE_PARTY PLACE_ENEMY | |
#define | YAW_PARTY_ACTION (DEGtoANG(45)) | The camera's yaw while a party member acts, and while an enemy does, in 1/65536 turns: an eighth of a turn either side of 0. |
#define | YAW_ENEMY_ACTION (-(DEGtoANG(45))) | |
#define | YAW_BEHIND_ENEMIES (TRIG_TURN * 5 / 16) | The camera's yaw from behind the enemies, which an enemy's staged effect and cast take in place of YAW_ENEMY_ACTION. |
#define | BLEND_SPRITES_OVER_ALL (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL) | REG_BLDCNT: blend the semi-transparent sprites (SPRITE_SEMI_TRANSPARENT) over every layer, to fade them. |
#define | BATTLE_EFFECT_RUN (args, battleEffect) | Runs a battle effect by its ability's effect word (Ability.battleEffect): with EFFECT_BY_ID_RANGE from the second range of kinds (btEffectRunByIdRangeStub), otherwise from the handler table. |
#define | KEY_ADVANCE (KEY_A | KEY_B | KEYS_SHOULDERS) | The keys that take the player on past a message: A, B, L and R. |
#define | STAT_STAGE_MIN -4 | A stat stage changes the stat by an eighth of it (gmUnitCalculate), from half at the lowest to one and a half at the highest. |
#define | STAT_STAGE_MAX 4 | |
#define | PSY_SEAL_BIND_MASK 7 | UNIT.psySeal's low three bits, Bind's turns left; Luff's seal above them loses PSY_SEAL_LUFF_TURN a turn. |
#define | PSY_SEAL_LUFF_TURN 8 | |
#define | PSY_SEAL_BIND 7 | UNIT.psySeal as a seal starts: Bind's lasts seven turns and may end sooner; Luff's lasts two and never ends early. |
#define | PSY_SEAL_LUFF (2 * PSY_SEAL_LUFF_TURN) |
Enumerations
| Name | Description | |
|---|---|---|
enum | BATTLE_CAST_KIND { CAST_PSYNERGY, CAST_DJINNI, CAST_ENEMY } | btStagingRunPsynergyCast's mode: what is cast, which decides the glow. |
Description
What every part of the battle object shares: its includes, in their original
order, and the names two or more parts use. battle.c includes it before the
parts, and each part includes it too, so that a part read on its own still
resolves. It places no bytes.
Macros in detail
BATTLE_WININ
#define BATTLE_WININ
The battle's windows: window 0 shows BG0 to BG2, sprites and blending, window 1 BG0, BG2, sprites and blending, and outside them only BG0 and blending.
Referenced by btStagingRunAttack() and btTransitionRun().
Definition at line 43 of file battle_internal.h.
BATTLE_WINOUT
#define BATTLE_WINOUT (WINOUT_WIN01_BG0 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_ALL)
Referenced by btStagingRunAttack() and btTransitionRun().
Definition at line 47 of file battle_internal.h.
BATTLE_BG_PALETTE
#define BATTLE_BG_PALETTE ((Uint16 *)&BG_PLTT_COLOR(6, 0))
The battle background's colours: BG palettes 6 to 13, filled from
BATTLE_STATE.palette, darkened or not.
Referenced by btBackgroundLoad(), btBackgroundSetMode(), btBackgroundSetPaletteLevel(), btElementGlowPlay() and btStagingRunItem().
Definition at line 51 of file battle_internal.h.
CURTAIN_TILE
#define CURTAIN_TILE(n) (BG_CHAR_BLOCK(1) + (128 + (n)) * TILE_SIZE_4BPP)
The opening curtain's tiles: 4-bit tiles 128 to 136 of character block 1, which BG1 shows from its map in screen block 12.
Referenced by btTransitionRun() and btTransitionUploadTileVariant().
Definition at line 55 of file battle_internal.h.
BATTLE_BG1CNT
#define BATTLE_BG1CNT
BG1 during a battle: 256 colours, priority 3, its map in screen block
BATTLE_BG1_SCREEN_BLOCK.
Referenced by btBackgroundLoad(), btBackgroundSetMode() and btTransitionRun().
Definition at line 59 of file battle_internal.h.
LINK_PARTY_SIZE
#define LINK_PARTY_SIZE 3
In a link battle each console sends LINK_PARTY_SIZE places, at most three
party members (btLinkBattleSendParty), and the opponent's take the first
three enemy ids from FIRST_ENEMY_UNIT.
Referenced by btEnemyList(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btPartyPrepareMembers() and btUnitListLiving().
Definition at line 66 of file battle_internal.h.
BATTLE_OBJECT_NONE
#define BATTLE_OBJECT_NONE 255
BATTLE_STATE.objectIndex of a unit with no place on the battlefield:
btUnitRefreshPlacement fills the list with it, and btObjectGet returns NULL
for it.
Referenced by btObjectGet() and btUnitRefreshPlacement().
Definition at line 71 of file battle_internal.h.
DEFEAT_ONE
#define DEFEAT_ONE 0
BATTLE_STATE.defeatState: whether the last enemy fell alone, or with others
before it, or a party member's action ended the battle with a single defeat.
The messages are "has been downed!" and "'s party goes down!", MsgDowned plus
the state; DEFEAT_BY_PARTY_MEMBER shows neither.
Referenced by btFormationBuildEnemyList().
Definition at line 77 of file battle_internal.h.
DEFEAT_SEVERAL
#define DEFEAT_SEVERAL 1
Referenced by btEnemyRecordDefeat() and btRun().
Definition at line 78 of file battle_internal.h.
DEFEAT_BY_PARTY_MEMBER
#define DEFEAT_BY_PARTY_MEMBER 3
Referenced by btRun().
Definition at line 79 of file battle_internal.h.
ENEMY_DEFEATED_FLAG
#define ENEMY_DEFEATED_FLAG(classId) ((classId) + 0x600)
The game flag of an enemy the party has defeated, set by btEnemyRecordDefeat
outside the monster battles; the monster battles choose only formations of
defeated enemies (btFormationAverageLevel).
Referenced by btEnemyRecordDefeat(), btFormationAverageLevel() and btFormationSelectLevelMatchedCandidate().
Definition at line 84 of file battle_internal.h.
ENEMY_LETTER_FIRST_TOO
#define ENEMY_LETTER_FIRST_TOO 0x8000
btEnemyClaimNameLetter returns the letter in ENEMY_LETTER_MASK, with
ENEMY_LETTER_FIRST_TOO set for the second enemy of a class: its callers then
give the first one its letter too (btEnemyLetterFirstOfKind) before passing
the letter to gmBattleUnitSetStub.
Referenced by btAbilityApplyToTarget(), btEnemyClaimNameLetter() and btFormationBuildEnemyList().
Definition at line 90 of file battle_internal.h.
ENEMY_LETTER_MASK
#define ENEMY_LETTER_MASK 0x7fff
Referenced by btAbilityApplyToTarget() and btFormationBuildEnemyList().
Definition at line 91 of file battle_internal.h.
UNIT_NAME_LENGTH
#define UNIT_NAME_LENGTH 14
The length of a unit's name, its terminator excluded.
Referenced by btDebugBattleViewMessages() and btLinkBattleReceiveParty().
Definition at line 94 of file battle_internal.h.
SIO_MULTI_PLAYER_ID
#define SIO_MULTI_PLAYER_ID() ((REG_SIOCNT << 26) >> 30)
This console's number in a link session (SIOCNT bits 4 and 5, which the hardware sets in multi-player mode): 0 for the parent, 1 for the child.
Referenced by btCameraUpdate() and btRun().
Definition at line 98 of file battle_internal.h.
LINK_BOTH_CONNECTED
#define LINK_BOTH_CONNECTED 3
LinkStatusWork: both consoles are connected.
Referenced by btAppendLinkedActions(), btCameraUpdate(), btLinkBattleSyncTurn(), btLinkBattleWaitSync() and btRun().
Definition at line 101 of file battle_internal.h.
EQUIP_WEAPON
#define EQUIP_WEAPON 1
The inventory's weapon slot, for gmInventoryFindEquippedStub.
Referenced by btActionRunBuild(), btObjectMake() and btUnitGetWeaponSprite().
Definition at line 104 of file battle_internal.h.
ACTOR_SPRITE_GROUP_SIZE
#define ACTOR_SPRITE_GROUP_SIZE 4
A group's sprite word (ACTOR_SPRITE_GROUP) points to a table of four sprites.
Referenced by btActorDetachSpriteScripts(), btHighlightSetSpriteMode(), btObjectSpawnObjectsForList() and btObjectUpdateSpritePriorities().
Definition at line 107 of file battle_internal.h.
ACTION_REPORTED
#define ACTION_REPORTED -1
btActionRunBuild's results besides 0, which stages the action.
the action failed and its message is shown
Referenced by btActionRunBuild() and btStagingDispatchAction().
Definition at line 110 of file battle_internal.h.
ACTION_NOTHING_TO_SHOW
#define ACTION_NOTHING_TO_SHOW -2
nothing to stage or show
Referenced by btActionRunBuild().
Definition at line 111 of file battle_internal.h.
STAGING_HIDE_ACTOR
#define STAGING_HIDE_ACTOR 1
btStagingRunFullScreen's mode: a summon hides its user too.
Referenced by btStagingDispatchAction() and btStagingRunFullScreen().
Definition at line 114 of file battle_internal.h.
DEFEAT_HP_CHANGE
#define DEFEAT_HP_CHANGE 0xc0000000
An HP change that defeats any unit: the Grim Reaper's call deals it, and the debug defeat.
Referenced by btActionRunBuild() and btUnitProcessActionEnd().
Definition at line 126 of file battle_internal.h.
TARGET_PICK_SIDE_EMPTY
#define TARGET_PICK_SIDE_EMPTY -2
btAIChooseTarget's results when it picks no one: the side it may target lists
no one, or no one there is worth the ability.
Referenced by btAIChooseAction() and btAIChooseTarget().
Definition at line 130 of file battle_internal.h.
TARGET_PICK_NONE
#define TARGET_PICK_NONE -1
Referenced by btAIChooseAction() and btAIChooseTarget().
Definition at line 131 of file battle_internal.h.
TARGET_NONE_ENEMY
#define TARGET_NONE_ENEMY PLACE_PARTY
BATTLE_ACTION.target of a held unit's lost action (COMMAND_NONE, from
btBuildEnemyActions and btBuildPartyActions): as a place code, place 0 of the
other side, the party's for an enemy and the enemies' for a party member.
Referenced by btBuildEnemyActions().
Definition at line 136 of file battle_internal.h.
TARGET_NONE_PARTY
#define TARGET_NONE_PARTY PLACE_ENEMY
Referenced by btBuildPartyActions().
Definition at line 137 of file battle_internal.h.
YAW_PARTY_ACTION
#define YAW_PARTY_ACTION (DEGtoANG(45))
The camera's yaw while a party member acts, and while an enemy does, in
1/65536 turns: an eighth of a turn either side of 0. The camera event eases
toward it (btCameraUpdate).
Referenced by btAutoBattleRunAction(), btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btAutoBattleRunPsynergy(), btCameraSetRange(), btGatherActions(), btRun(), btStagingDispatchAction(), btStagingRunAttack(), btStagingRunFlee(), btStagingRunFullScreen(), btStagingRunItem(), btStagingRunPlainAttack() and btStagingRunPsynergyCast().
Definition at line 142 of file battle_internal.h.
YAW_ENEMY_ACTION
#define YAW_ENEMY_ACTION (-(DEGtoANG(45)))
Referenced by btAutoBattleRunAction(), btAutoBattleRunAttackOrItem(), btStagingRunFullScreen(), btStagingRunItem() and btStagingRunPsynergyCast().
Definition at line 143 of file battle_internal.h.
YAW_BEHIND_ENEMIES
#define YAW_BEHIND_ENEMIES (TRIG_TURN * 5 / 16)
The camera's yaw from behind the enemies, which an enemy's staged effect and
cast take in place of YAW_ENEMY_ACTION.
Referenced by btAutoBattleRunPsynergy(), btStagingRunFullScreen() and btStagingRunPsynergyCast().
Definition at line 147 of file battle_internal.h.
BLEND_SPRITES_OVER_ALL
#define BLEND_SPRITES_OVER_ALL (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)
REG_BLDCNT: blend the semi-transparent sprites (SPRITE_SEMI_TRANSPARENT) over
every layer, to fade them.
Referenced by btAutoBattleRunPsynergy(), btStagingRunFullScreen() and btTransitionRun().
Definition at line 151 of file battle_internal.h.
BATTLE_EFFECT_RUN
#define BATTLE_EFFECT_RUN(args, battleEffect)
Runs a battle effect by its ability's effect word (Ability.battleEffect):
with EFFECT_BY_ID_RANGE from the second range of kinds
(btEffectRunByIdRangeStub), otherwise from the handler table.
Referenced by btAutoBattleRunAttackOrItem(), btStagingRunAttack(), btStagingRunFullScreen(), btStagingRunItem() and btStagingRunPsynergyCast().
Definition at line 156 of file battle_internal.h.
KEY_ADVANCE
#define KEY_ADVANCE (KEY_A | KEY_B | KEYS_SHOULDERS)
The keys that take the player on past a message: A, B, L and R.
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt() and btPlaybackRun().
Definition at line 161 of file battle_internal.h.
STAT_STAGE_MIN
#define STAT_STAGE_MIN -4
A stat stage changes the stat by an eighth of it (gmUnitCalculate), from half
at the lowest to one and a half at the highest.
Referenced by btAbilityApplyToTarget().
Definition at line 165 of file battle_internal.h.
STAT_STAGE_MAX
#define STAT_STAGE_MAX 4
Definition at line 166 of file battle_internal.h.
PSY_SEAL_BIND_MASK
#define PSY_SEAL_BIND_MASK 7
UNIT.psySeal's low three bits, Bind's turns left; Luff's seal above them
loses PSY_SEAL_LUFF_TURN a turn.
Referenced by btUnitCountDownPsynergySeal().
Definition at line 170 of file battle_internal.h.
PSY_SEAL_LUFF_TURN
#define PSY_SEAL_LUFF_TURN 8
Referenced by btUnitCountDownPsynergySeal().
Definition at line 171 of file battle_internal.h.
PSY_SEAL_BIND
#define PSY_SEAL_BIND 7
UNIT.psySeal as a seal starts: Bind's lasts seven turns and may end sooner;
Luff's lasts two and never ends early.
Referenced by btAbilityApplyToTarget().
Definition at line 174 of file battle_internal.h.
PSY_SEAL_LUFF
#define PSY_SEAL_LUFF (2 * PSY_SEAL_LUFF_TURN)
Referenced by btAbilityApplyToTarget().
Definition at line 175 of file battle_internal.h.
Enumerations in detail
BATTLE_CAST_KIND
enum BATTLE_CAST_KIND
btStagingRunPsynergyCast's mode: what is cast, which decides the glow.
| Enumerator | Value | Description |
|---|---|---|
CAST_PSYNERGY | 0 | the star field gathers on the caster |
CAST_DJINNI | 1 | no glow; the effect plays its prelude |
CAST_ENEMY | 2 | the element's streaks |
Definition at line 117 of file battle_internal.h.