Alchemy
Loading...
Searching...
No Matches

BattleWork Struct Reference

The battle's own work: its enemies, units and their objects, the turn's actions, the spoils, the background palette, the plan and the events. More...

#include <battle_work.h>

Data Fields

s32 enemyGroup
 the encounter's enemy formation
s16 spriteSlots [6]
 the unit in each enemy sprite slot, 0 when free
u16 enemyClasses [6]
 The enemy classes met so far, for their name letters, and the first class to fall (firstDefeated).
u32 summonMasks [6]
 Name letters in use by each class in enemyClasses, a bit per letter.
s8 summonChannels [6]
 The letter each class in enemyClasses gave out last; -1 for none yet.
u8 unk03a [2]
 not named by TBS code
u16 firstDefeated
 The enemyClasses index of the first class to fall; 6 for none.
u16 defeatState
 DEFEAT_ONE, DEFEAT_SEVERAL or DEFEAT_BY_PARTY_MEMBER.
u8 summonCount
 classes listed in enemyClasses, at most 5
u8 partyStatus
 PARTY_STATUS_SUMMONS or PARTY_STATUS_NO_SUMMONS.
u8 battleType
 FORMATION_SHUFFLED or FORMATION_INTERLEAVED.
u8 challengeFlag
 bits: 1 a party unit was challenged; nonzero, the party cannot run
u8 twoSided
 1 in a link battle
u8 encounterMode
 BATTLE_ENCOUNTER_: who strikes first.
u8 escapeFailures
 Failed attempts to run; each adds 2000 to the base chance of 5000.
u8 unk047
 not named by TBS code
u8 ownerSlots [8]
 For each party unit, its slot as a link opponent's enemy, minus FIRST_ENEMY_UNIT; 0xff for none.
u8 linkSide
 this console's multiplayer id
u8 linkMisses
 frames the link has been down
u8 linkPaused
 set when the link drops or the console's id changes
u8 unk053
 not named by TBS code
s32 promptSlot
 resource entry of the advance arrow's tiles; -1 for none
s16 partyUnits [7]
 ends with BATTLE_UNIT_LIST_END
s16 enemyIds [BATTLE_ENEMY_CAPACITY+1]
 ends with BATTLE_UNIT_LIST_END
struct BattleObj slots [14]
u8 placement [14]
 Each unit's index in slots, enemies from 8; 0xff for none.
u8 unk2ea [2]
 not named by TBS code
struct BattleActionRecord actions [BATTLE_ACTION_CAPACITY]
 The actions chosen for the turn.
u8 unk42c [0x104]
 not named by TBS code
struct BattleSpoils spoils
u16 palette [128]
 the backdrop's colours, before scaling
s32 brightness
 the backdrop's brightness, 16.16, 0x10000 full
u16 background
 the battle background's id
u8 unk64a [4]
 not named by TBS code
u16 highlightStep
 index into gBattleFx_HighlightBlendRamp
u16 highlightMode
 nonzero while the units are highlighted
u8 unk652 [2]
 not named by TBS code
struct BattlePlan plan
struct BattleEventState events
s32 debugValue
 A value Runtime_AdjustDebugValueWithButtons edits with the d-pad while Start is held.

Detailed Description

The battle's own work: its enemies, units and their objects, the turn's actions, the spoils, the background palette, the plan and the events.

It lives in the HEAP_SLOT_BATTLE work slot.

Definition at line 71 of file battle_work.h.

Field Documentation

◆ enemyGroup

s32 BattleWork::enemyGroup

the encounter's enemy formation

Definition at line 72 of file battle_work.h.

Referenced by Battle_RunEncounter(), and BattleTargetExec().

◆ spriteSlots

s16 BattleWork::spriteSlots[6]

the unit in each enemy sprite slot, 0 when free

Definition at line 73 of file battle_work.h.

Referenced by BattleMotion_ReleaseObjectSlotByValue(), EnemyCheck(), and SummonSlot_RegisterActorSprites().

◆ enemyClasses

u16 BattleWork::enemyClasses[6]

The enemy classes met so far, for their name letters, and the first class to fall (firstDefeated).

Definition at line 76 of file battle_work.h.

Referenced by Battle_RunEncounter(), BattleEnemy_ClaimNameLetter(), BattleEnemy_RecordDefeat(), and BattleEnemy_ReleaseNameLetter().

◆ summonMasks

u32 BattleWork::summonMasks[6]

Name letters in use by each class in enemyClasses, a bit per letter.

Definition at line 78 of file battle_work.h.

Referenced by BattleEnemy_ClaimNameLetter(), and BattleEnemy_ReleaseNameLetter().

◆ summonChannels

s8 BattleWork::summonChannels[6]

The letter each class in enemyClasses gave out last; -1 for none yet.

Definition at line 80 of file battle_work.h.

Referenced by BattleEnemy_ClaimNameLetter().

◆ unk03a

u8 BattleWork::unk03a[2]

not named by TBS code

Definition at line 81 of file battle_work.h.

◆ firstDefeated

u16 BattleWork::firstDefeated

The enemyClasses index of the first class to fall; 6 for none.

Definition at line 83 of file battle_work.h.

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

◆ defeatState

u16 BattleWork::defeatState

DEFEAT_ONE, DEFEAT_SEVERAL or DEFEAT_BY_PARTY_MEMBER.

Definition at line 84 of file battle_work.h.

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

◆ summonCount

u8 BattleWork::summonCount

classes listed in enemyClasses, at most 5

Definition at line 85 of file battle_work.h.

Referenced by BattleEnemy_ClaimNameLetter(), BattleEnemy_ReleaseNameLetter(), and BattleFormation_BuildEnemyList().

◆ partyStatus

◆ battleType

u8 BattleWork::battleType

FORMATION_SHUFFLED or FORMATION_INTERLEAVED.

Definition at line 87 of file battle_work.h.

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

◆ challengeFlag

u8 BattleWork::challengeFlag

bits: 1 a party unit was challenged; nonzero, the party cannot run

Definition at line 89 of file battle_work.h.

Referenced by BattleTargetExec(), and UiText_ShowLocalizedMessageAndWait().

◆ twoSided

◆ encounterMode

u8 BattleWork::encounterMode

◆ escapeFailures

u8 BattleWork::escapeFailures

Failed attempts to run; each adds 2000 to the base chance of 5000.

Definition at line 93 of file battle_work.h.

Referenced by BattleEscape_CheckSuccess().

◆ unk047

u8 BattleWork::unk047

not named by TBS code

Definition at line 94 of file battle_work.h.

◆ ownerSlots

u8 BattleWork::ownerSlots[8]

For each party unit, its slot as a link opponent's enemy, minus FIRST_ENEMY_UNIT; 0xff for none.

Definition at line 97 of file battle_work.h.

Referenced by BattleParty_AssignMemberSlots(), BattlePresentation_AppendLinkedActions(), and LinkBattle_SendParty().

◆ linkSide

◆ linkMisses

u8 BattleWork::linkMisses

frames the link has been down

Definition at line 99 of file battle_work.h.

Referenced by BattlePresentation_UpdateCamera().

◆ linkPaused

◆ unk053

u8 BattleWork::unk053

not named by TBS code

Definition at line 101 of file battle_work.h.

◆ promptSlot

s32 BattleWork::promptSlot

resource entry of the advance arrow's tiles; -1 for none

Definition at line 102 of file battle_work.h.

Referenced by Battle_RunEncounter(), and BattleEvent_Playback().

◆ partyUnits

◆ enemyIds

◆ slots

struct BattleObj BattleWork::slots[14]

◆ placement

u8 BattleWork::placement[14]

Each unit's index in slots, enemies from 8; 0xff for none.

Definition at line 107 of file battle_work.h.

Referenced by BattleObjGet(), and BattleUnit_RefreshPlacement().

◆ unk2ea

u8 BattleWork::unk2ea[2]

not named by TBS code

Definition at line 108 of file battle_work.h.

◆ actions

struct BattleActionRecord BattleWork::actions[BATTLE_ACTION_CAPACITY]

The actions chosen for the turn.

Definition at line 110 of file battle_work.h.

Referenced by Battle_RunEncounter(), BattleActor_RemoveFromLists(), BattlePres_RunItem(), BattlePresentation_BuildActions(), and BattleTargetExec().

◆ unk42c

u8 BattleWork::unk42c[0x104]

not named by TBS code

Definition at line 111 of file battle_work.h.

◆ spoils

struct BattleSpoils BattleWork::spoils

◆ palette

◆ brightness

s32 BattleWork::brightness

◆ background

◆ unk64a

u8 BattleWork::unk64a[4]

not named by TBS code

Definition at line 116 of file battle_work.h.

◆ highlightStep

u16 BattleWork::highlightStep

index into gBattleFx_HighlightBlendRamp

Definition at line 117 of file battle_work.h.

Referenced by BattlePres_SetActorModes(), and Graphics_AdvancePaletteCycle().

◆ highlightMode

u16 BattleWork::highlightMode

nonzero while the units are highlighted

Definition at line 118 of file battle_work.h.

Referenced by BattlePres_SetActorModes(), and Graphics_AdvancePaletteCycle().

◆ unk652

u8 BattleWork::unk652[2]

not named by TBS code

Definition at line 119 of file battle_work.h.

◆ plan

◆ events

◆ debugValue

s32 BattleWork::debugValue

A value Runtime_AdjustDebugValueWithButtons edits with the d-pad while Start is held.

Definition at line 124 of file battle_work.h.

Referenced by Runtime_AdjustDebugValueWithButtons().