Alchemy
Loading...
Searching...
No Matches

battle_internal.h File Reference

What every part of the battle object shares: its includes, in their original order, and the names two or more parts use. More...

Go to the source code of this file.

Macros

#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   ((u16 *)&BG_PLTT_COLOR(6, 0))
 The battle background's colours: BG palettes 6 to 13, filled from BattleWork.palette, darkened or not.
#define CURTAIN_TILE(n)
 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   (BGCNT_PRIORITY(3) | BGCNT_256_COLORS | BGCNT_SCREEN_BASE(31))
 BG1 during a battle: 256 colours, priority 3, its map in screen block 31.
#define VALUE_UNIT_NAME   1
#define VALUE_ITEM_NAME   2
#define VALUE_CLASS_NAME   3
#define VALUE_ABILITY_NAME   4
#define VALUE_NUMBER   5
#define FIRST_ENEMY_UNIT   128
 Unit ids from 128 are the enemies'; in a link battle the opponent's party takes the first three.
#define LINK_PARTY_SIZE   3
#define PARTY_BATTLE_SIZE   4
 The party fights four at a time, three in a link battle; six enemies at most, three in a link battle.
#define ENEMY_BATTLE_SIZE   6
#define ABILITY_ATTACK   1
 the ability "Attack"
#define ALLY_MAX   7
 the last party member's unit id
#define ENEMY_CLASS_FIRST   8
 An enemy's class id is its row of enemies.tsv plus 8 (Enemy_GetDefinition); class ids 0 to 7 are the party's.
#define ENEMY_DEFEATED_FLAG(classId)
 The game flag of an enemy class the party has defeated, set by BattleEnemy_RecordDefeat outside the monster battles; the monster battles choose only formations of defeated enemies (BattleFormation_AverageLevel).
#define UNIT_NAME_LENGTH   14
 The length of a unit's name, its terminator excluded.
#define SIO_MULTI_PLAYER_ID()
 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
 gLinkStatus: both consoles are connected.
#define LINK_MAX_MISSED_FRAMES   24
 The frames a link battle tolerates without a connection before it gives up.
#define DJINN_RECOVERY_PARTY   0
 The Djinn recovery list's two tables (Djinn_GetRecoveryTableFar): the party's and the link opponent's.
#define DJINN_RECOVERY_OPPONENT   1
#define DJINN_RECOVERY_AFTER_BATTLE   -1
 DjinnRecoveryEntry.turns of a Djinni waiting for the battle to end.
#define DJINN_PER_ELEMENT   20
#define FORMATION_SHUFFLED   0
 BattleWork.battleType, from the enemy formation (BattleFormation_BuildEnemyList): the random formations stand left to right in the order they were drawn, any other is laid out from the centre.
#define FORMATION_INTERLEAVED   1
#define SPRITE_WITH_SECOND_PART_A   476
 The two battle sprites whose next sprite is loaded with them (into a second free place), the pass after them loading animation + 1.
#define SPRITE_WITH_SECOND_PART_B   483
#define EQUIP_WEAPON   1
 The inventory's weapon slot, for Inventory_FindEquippedFar.
#define RECORDS_NONE   0
#define RECORDS_SINGLE   1
#define RECORDS_TABLE   2
#define RECORDS_KIND_MASK   15
#define RECORDS_TABLE_SIZE   4
#define POISON_NORMAL   1
 BattleUnit.poison: the poison takes a tenth of the maximum HP at the end of each turn, deadly poison a fifth.
#define POISON_DEADLY   2
#define GUARD_DEFEND   1
 BattleUnit.guardLevel: Defend and Granite halve the damage, Total Defense and Flash cut it to a tenth.
#define GUARD_TOTAL_DEFENSE   2
#define STAGING_KIND_MASK   0xfff
#define STAGING_VARIANT_MASK   0x3000
#define STAGING_VARIANT_SHIFT   12
#define STAGING_BY_ID_RANGE   0x4000
 BattleFx_DispatchByIdRangeFar.
#define STAGING_SCENE   0x8000
 BattleFx_RunSceneEffectFar, actor's view.
#define STAGING_ON_DOWNED   0x10000
 shown on downed targets too (revivals)
#define STAGING_OTHER_SIDE   0x20000
 played from the other side
#define STAGING_VIEW_ACROSS   0x40000
 More of BattlePlan.presentationFlags: the camera takes the other side's view (an enemy's cast a view of its own), or turns right round.
#define STAGING_VIEW_REVERSED   0x80000
#define ITEM_USE_CONSUMED   1
 one is used up
#define ITEM_USE_MAY_BREAK   2
 breaks one time in eight
#define ITEM_USE_EMPTIES   4
 Hermes' Water leaves an Empty Bottle.
#define TARGET_MODE_NONE   0
#define TARGET_MODE_FOES   1
#define TARGET_MODE_ALLIES   2
#define TARGET_MODE_SELF   4
#define TARGET_NONE_ENEMY   0x100
 BattleActionRecord.target of an action that needs none: a held unit's lost turn (the enemies' and the party's), and an enemy's attack in auto battle, which picks a party place.
#define TARGET_NONE_PARTY   0x180
#define YAW_PARTY_TURN   0x2000
 The camera's yaw while a party member acts, and while an enemy does.
#define YAW_ENEMY_TURN   -0x2000
#define BLEND_SPRITES_OVER_ALL   (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)
 REG_BLDCNT: blend the semi-transparent sprites (OBJ mode 1) over every layer, to fade them.
#define KEY_ADVANCE   (KEY_A | KEY_B | KEYS_SHOULDERS)
 The keys that take the player on past a message: A, B, L and R.

Enumerations

enum  BattlePlanStaging {
  PLAN_SHOW_MESSAGES = 1 , PLAN_SHOW_ATTACK = 2 , PLAN_SHOW_CAST = 3 , PLAN_SHOW_ITEM = 4 ,
  PLAN_SHOW_SUMMON = 5 , PLAN_SHOW_DJINNI = 6 , PLAN_SHOW_FLEE = 7 , PLAN_SHOW_ENEMY_CAST = 8 ,
  PLAN_SHOW_FULL_SCREEN = 9
}
 BattlePlan.outcome: how BattlePresentation_DispatchAction shows the action, set by BattleCommand_BuildPlan from the ability (gBattle_ActionStatus where it gives one). More...

Detailed 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.

Definition in file battle_internal.h.

Macro Definition Documentation

◆ BATTLE_WININ

#define BATTLE_WININ
Value:
#define WININ_WIN0_BG1
Definition io_reg.h:87
#define WININ_WIN0_CLR
Definition io_reg.h:91
#define WININ_WIN1_BG0
Definition io_reg.h:93
#define WININ_WIN1_CLR
Definition io_reg.h:98
#define WININ_WIN0_BG0
Definition io_reg.h:86
#define WININ_WIN0_OBJ
Definition io_reg.h:90
#define WININ_WIN1_OBJ
Definition io_reg.h:97
#define WININ_WIN1_BG2
Definition io_reg.h:95
#define WININ_WIN0_BG2
Definition io_reg.h:88

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.

Definition at line 101 of file battle_internal.h.

Referenced by BattlePres_RunAttack(), and BattlePres_RunEntryTransition().

◆ BATTLE_WINOUT

#define BATTLE_WINOUT   (WINOUT_WIN01_BG0 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_ALL)

Definition at line 105 of file battle_internal.h.

Referenced by BattlePres_RunAttack(), and BattlePres_RunEntryTransition().

◆ BATTLE_BG_PALETTE

#define BATTLE_BG_PALETTE   ((u16 *)&BG_PLTT_COLOR(6, 0))

The battle background's colours: BG palettes 6 to 13, filled from BattleWork.palette, darkened or not.

Definition at line 109 of file battle_internal.h.

Referenced by BattleBackground_Load(), BattleFx_PlayUnitElementEffect(), BattlePresentation_ConfigurePaletteFade(), and BattlePresentation_SetPaletteLevel().

◆ CURTAIN_TILE

#define CURTAIN_TILE ( n)
Value:
(BG_CHAR_BLOCK(1) + (128 + (n)) * TILE_SIZE_4BPP)
#define BG_CHAR_BLOCK(n)
Definition io_reg.h:166
#define TILE_SIZE_4BPP
Definition io_reg.h:168

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.

Definition at line 113 of file battle_internal.h.

Referenced by BattlePres_RunEntryTransition(), and BattlePresentation_UploadTileVariant().

◆ BATTLE_BG1CNT

#define BATTLE_BG1CNT   (BGCNT_PRIORITY(3) | BGCNT_256_COLORS | BGCNT_SCREEN_BASE(31))

BG1 during a battle: 256 colours, priority 3, its map in screen block 31.

Definition at line 116 of file battle_internal.h.

Referenced by BattleBackground_Load(), BattlePres_RunEntryTransition(), and BattlePresentation_ConfigurePaletteFade().

◆ VALUE_UNIT_NAME

◆ VALUE_ITEM_NAME

◆ VALUE_CLASS_NAME

#define VALUE_CLASS_NAME   3

Definition at line 124 of file battle_internal.h.

Referenced by Battle_AwardSpoils(), and DebugBattle_ViewMessages().

◆ VALUE_ABILITY_NAME

#define VALUE_ABILITY_NAME   4

◆ VALUE_NUMBER

◆ FIRST_ENEMY_UNIT

◆ LINK_PARTY_SIZE

◆ PARTY_BATTLE_SIZE

#define PARTY_BATTLE_SIZE   4

The party fights four at a time, three in a link battle; six enemies at most, three in a link battle.

Definition at line 135 of file battle_internal.h.

Referenced by BattleParty_PrepareActiveOwners().

◆ ENEMY_BATTLE_SIZE

◆ ABILITY_ATTACK

#define ABILITY_ATTACK   1

the ability "Attack"

Definition at line 138 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), and BattleCommand_SelectAutomatic().

◆ ALLY_MAX

#define ALLY_MAX   7

the last party member's unit id

Definition at line 139 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), BattleCommand_SelectAutomatic(), and Field_UsePsynergy().

◆ ENEMY_CLASS_FIRST

#define ENEMY_CLASS_FIRST   8

An enemy's class id is its row of enemies.tsv plus 8 (Enemy_GetDefinition); class ids 0 to 7 are the party's.

A formation lists its members by row.

Definition at line 143 of file battle_internal.h.

Referenced by BattleFormation_AverageLevel(), BattleFormation_BuildEnemyList(), and BattleGroupRandom().

◆ ENEMY_DEFEATED_FLAG

#define ENEMY_DEFEATED_FLAG ( classId)
Value:
((classId) + 0x600)

The game flag of an enemy class the party has defeated, set by BattleEnemy_RecordDefeat outside the monster battles; the monster battles choose only formations of defeated enemies (BattleFormation_AverageLevel).

Definition at line 148 of file battle_internal.h.

Referenced by BattleEnemy_RecordDefeat(), BattleFormation_AverageLevel(), and BattleFormation_SelectLevelMatchedCandidate().

◆ UNIT_NAME_LENGTH

#define UNIT_NAME_LENGTH   14

The length of a unit's name, its terminator excluded.

Definition at line 151 of file battle_internal.h.

Referenced by DebugBattle_ViewMessages(), and LinkBattle_ReceiveParty().

◆ SIO_MULTI_PLAYER_ID

#define SIO_MULTI_PLAYER_ID ( )
Value:
#define REG_SIOCNT
Definition io_reg.h:180

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.

Definition at line 155 of file battle_internal.h.

Referenced by Battle_RunEncounter(), and BattlePresentation_UpdateCamera().

◆ LINK_BOTH_CONNECTED

#define LINK_BOTH_CONNECTED   3

◆ LINK_MAX_MISSED_FRAMES

#define LINK_MAX_MISSED_FRAMES   24

The frames a link battle tolerates without a connection before it gives up.

Definition at line 162 of file battle_internal.h.

Referenced by Battle_RunEncounter(), BattlePres_SyncTurn(), BattlePres_WaitSync(), BattlePresentation_AppendLinkedActions(), and BattlePresentation_UpdateCamera().

◆ DJINN_RECOVERY_PARTY

#define DJINN_RECOVERY_PARTY   0

The Djinn recovery list's two tables (Djinn_GetRecoveryTableFar): the party's and the link opponent's.

Definition at line 166 of file battle_internal.h.

Referenced by Battle_RunEncounter(), BattleParty_ReconcileDjinnRecovery(), BattleSummon_UpdateAvailability(), and LinkBattle_SendParty().

◆ DJINN_RECOVERY_OPPONENT

#define DJINN_RECOVERY_OPPONENT   1

◆ DJINN_RECOVERY_AFTER_BATTLE

#define DJINN_RECOVERY_AFTER_BATTLE   -1

DjinnRecoveryEntry.turns of a Djinni waiting for the battle to end.

Definition at line 170 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), BattleParty_CountStandbyDjinn(), and BattleParty_ReconcileDjinnRecovery().

◆ DJINN_PER_ELEMENT

#define DJINN_PER_ELEMENT   20

◆ FORMATION_SHUFFLED

#define FORMATION_SHUFFLED   0

BattleWork.battleType, from the enemy formation (BattleFormation_BuildEnemyList): the random formations stand left to right in the order they were drawn, any other is laid out from the centre.

Definition at line 177 of file battle_internal.h.

Referenced by Battle_RunEncounter(), BattleFormation_BuildEnemyList(), and BattleParty_CollectUnitList().

◆ FORMATION_INTERLEAVED

#define FORMATION_INTERLEAVED   1

◆ SPRITE_WITH_SECOND_PART_A

#define SPRITE_WITH_SECOND_PART_A   476

The two battle sprites whose next sprite is loaded with them (into a second free place), the pass after them loading animation + 1.

Definition at line 182 of file battle_internal.h.

Referenced by BattleActor_SpawnObjectsForList(), and SummonSlot_RegisterActorSprites().

◆ SPRITE_WITH_SECOND_PART_B

#define SPRITE_WITH_SECOND_PART_B   483

◆ EQUIP_WEAPON

#define EQUIP_WEAPON   1

The inventory's weapon slot, for Inventory_FindEquippedFar.

Definition at line 186 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), BattleObjMake(), and BattleUnit_LookupWeaponValueByClass().

◆ RECORDS_NONE

#define RECORDS_NONE   0

◆ RECORDS_SINGLE

◆ RECORDS_TABLE

◆ RECORDS_KIND_MASK

◆ RECORDS_TABLE_SIZE

#define RECORDS_TABLE_SIZE   4

◆ POISON_NORMAL

#define POISON_NORMAL   1

BattleUnit.poison: the poison takes a tenth of the maximum HP at the end of each turn, deadly poison a fifth.

Definition at line 198 of file battle_internal.h.

Referenced by BattleTargetExec(), and BattleUnit_BuildStatusFlags().

◆ POISON_DEADLY

#define POISON_DEADLY   2

Definition at line 199 of file battle_internal.h.

Referenced by BattleTargetExec(), and BattleUnit_BuildStatusFlags().

◆ GUARD_DEFEND

#define GUARD_DEFEND   1

BattleUnit.guardLevel: Defend and Granite halve the damage, Total Defense and Flash cut it to a tenth.

Definition at line 203 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), BattlePresentation_BuildActions(), and BattleTargetExec().

◆ GUARD_TOTAL_DEFENSE

#define GUARD_TOTAL_DEFENSE   2

Definition at line 204 of file battle_internal.h.

Referenced by BattlePresentation_BuildActions(), and BattleTargetExec().

◆ STAGING_KIND_MASK

#define STAGING_KIND_MASK   0xfff

Definition at line 224 of file battle_internal.h.

Referenced by BattlePres_BuildTargetList().

◆ STAGING_VARIANT_MASK

#define STAGING_VARIANT_MASK   0x3000

Definition at line 225 of file battle_internal.h.

Referenced by BattlePres_BuildTargetList().

◆ STAGING_VARIANT_SHIFT

#define STAGING_VARIANT_SHIFT   12

Definition at line 226 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), and BattlePres_BuildTargetList().

◆ STAGING_BY_ID_RANGE

#define STAGING_BY_ID_RANGE   0x4000

◆ STAGING_SCENE

#define STAGING_SCENE   0x8000

BattleFx_RunSceneEffectFar, actor's view.

Definition at line 228 of file battle_internal.h.

Referenced by BattlePresentation_RunUnitTransition().

◆ STAGING_ON_DOWNED

#define STAGING_ON_DOWNED   0x10000

shown on downed targets too (revivals)

Definition at line 229 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), and BattlePres_BuildTargetList().

◆ STAGING_OTHER_SIDE

#define STAGING_OTHER_SIDE   0x20000

played from the other side

Definition at line 230 of file battle_internal.h.

Referenced by BattlePresentation_RunUnitTransition().

◆ STAGING_VIEW_ACROSS

#define STAGING_VIEW_ACROSS   0x40000

More of BattlePlan.presentationFlags: the camera takes the other side's view (an enemy's cast a view of its own), or turns right round.

Definition at line 234 of file battle_internal.h.

Referenced by BattlePres_RunPsynergyCast().

◆ STAGING_VIEW_REVERSED

#define STAGING_VIEW_REVERSED   0x80000

Definition at line 235 of file battle_internal.h.

Referenced by BattlePres_RunPsynergyCast().

◆ ITEM_USE_CONSUMED

#define ITEM_USE_CONSUMED   1

one is used up

Definition at line 238 of file battle_internal.h.

Referenced by BattleCommand_SelectAutomatic(), BattlePres_RunItem(), and GomaCaveEntrance_GiveShamansRod().

◆ ITEM_USE_MAY_BREAK

#define ITEM_USE_MAY_BREAK   2

breaks one time in eight

Definition at line 239 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), BattlePres_RunItem(), and Shop_RepairItem().

◆ ITEM_USE_EMPTIES

#define ITEM_USE_EMPTIES   4

Hermes' Water leaves an Empty Bottle.

Definition at line 240 of file battle_internal.h.

Referenced by BattlePres_RunItem().

◆ TARGET_MODE_NONE

#define TARGET_MODE_NONE   0

Definition at line 243 of file battle_internal.h.

Referenced by BattleCommand_BuildPlan(), and BattleTarget_SelectForAction().

◆ TARGET_MODE_FOES

#define TARGET_MODE_FOES   1

◆ TARGET_MODE_ALLIES

#define TARGET_MODE_ALLIES   2

◆ TARGET_MODE_SELF

#define TARGET_MODE_SELF   4

◆ TARGET_NONE_ENEMY

#define TARGET_NONE_ENEMY   0x100

BattleActionRecord.target of an action that needs none: a held unit's lost turn (the enemies' and the party's), and an enemy's attack in auto battle, which picks a party place.

Definition at line 251 of file battle_internal.h.

Referenced by BattlePres_BuildOpponentEntries().

◆ TARGET_NONE_PARTY

#define TARGET_NONE_PARTY   0x180

Definition at line 252 of file battle_internal.h.

Referenced by BattlePres_BuildUnitEntries().

◆ YAW_PARTY_TURN

◆ YAW_ENEMY_TURN

◆ BLEND_SPRITES_OVER_ALL

#define BLEND_SPRITES_OVER_ALL   (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)

REG_BLDCNT: blend the semi-transparent sprites (OBJ mode 1) over every layer, to fade them.

Definition at line 260 of file battle_internal.h.

Referenced by BattlePres_RunEntryTransition(), BattlePresentation_RunPairedUnitTransition(), and BattlePresentation_RunUnitTransition().

◆ 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.

Definition at line 263 of file battle_internal.h.

Referenced by BattleEvent_Playback(), BattlePresentation_WaitForAdvance(), and BattlePresentation_WaitForPromptAt().

Enumeration Type Documentation

◆ BattlePlanStaging

BattlePlan.outcome: how BattlePresentation_DispatchAction shows the action, set by BattleCommand_BuildPlan from the ability (gBattle_ActionStatus where it gives one).

Enumerator
PLAN_SHOW_MESSAGES 

no animation: each target's events only

PLAN_SHOW_ATTACK 

the actor runs up and strikes

PLAN_SHOW_CAST 

Psynergy, and Venus, Mercury, Mars, Jupiter.

PLAN_SHOW_ITEM 

an item

PLAN_SHOW_SUMMON 

the larger summons, the actor hidden

PLAN_SHOW_DJINNI 

a Djinni with no attack (Granite, Quartz...)

PLAN_SHOW_FLEE 

a unit runs

PLAN_SHOW_ENEMY_CAST 

an enemy's Psynergy

PLAN_SHOW_FULL_SCREEN 

Gaia, Rockfall, Procne and their kin.

Definition at line 209 of file battle_internal.h.