Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
battle.c File Reference

FIGHTSTG's battle state (FIGHTSTG_action, FIGHTSTG_battle and FIGHTSTG_battleFuncs) and the events of the partner's special techniques. More...

Include dependency graph for battle.c:

Go to the source code of this file.

Functions

void FIGHTSTG_startRestriction (s32 tech)
 Restricts the partner with technique tech: sets FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE by the technique's effect, and queues the restriction's end (by its effectPower) or pushes back the one already queued.
 
void FIGHTSTG_queuePartnerTech (s32 tech)
 Queues the partner's technique tech, to run as its command.
 
void FIGHTSTG_queueBlast (void)
 Queues the partner's digivolution for the battle (event 18), now.
 
void FIGHTSTG_queueBlastEnd (s32 kind)
 Queues the end of the partner's digivolution for the battle (event 19), after delay kind + 3.
 
void FIGHTSTG_queueKnockOut (u8 side)
 Queues the fall of side's active fighter (event 20), first.
 
void FIGHTSTG_queueSpecialEnd (void)
 Queues the end of the partner's special state (event 21): the USA version pushes back the one already queued.
 
void FIGHTSTG_queueDigidevolve (void)
 Queues the partner's digidevolution, first.
 
void FIGHTSTG_queueLastEnemy (void)
 Queues the coming in of the last battle's third enemy, first.
 
void FIGHTSTG_weakenEnemy (void)
 Weakens the enemy in BATTLE_KIND_FINAL_LAST: halves its boosts of stats 1 and 2 and queues the end (event 24) in 3000.
 
void FIGHTSTG_endEnemyWeakness (void)
 Ends the enemy's weakness now: its queued event 24 runs next.
 

Variables

s32 FIGHTSTG_techEvents []
 the event types of FIGHTSTG_startRestriction, by whether the technique's effect is TECH_EFFECT_NO_DIGIVOLVE
 
BattleAction FIGHTSTG_action
 the command being carried out
 
Battle FIGHTSTG_battle
 the battle: its fighters, speed and drawing functions
 
FighterCache FIGHTSTG_fighterCache
 the fighters' data, loaded one at a time
 
BattleFuncs FIGHTSTG_battleFuncs
 the battle's stats and the functions that compute with them
 

Detailed Description

FIGHTSTG's battle state (FIGHTSTG_action, FIGHTSTG_battle and FIGHTSTG_battleFuncs) and the events of the partner's special techniques.

Definition in file battle.c.

Function Documentation

◆ FIGHTSTG_startRestriction()

void FIGHTSTG_startRestriction ( s32  tech)

Restricts the partner with technique tech: sets FIGHTER_NO_SWITCH or FIGHTER_NO_DIGIVOLVE by the technique's effect, and queues the restriction's end (by its effectPower) or pushes back the one already queued.

< FIGHTER_NO_SWITCH for a while

< FIGHTER_NO_DIGIVOLVE for a while

< can't switch out or run away (TECH_EFFECT_NO_SWITCH)

< can't digivolve or use a switch-in technique (TECH_EFFECT_NO_DIGIVOLVE)

Definition at line 43 of file battle.c.

Referenced by applyStatusEvent(), and useSupportTech().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queuePartnerTech()

void FIGHTSTG_queuePartnerTech ( s32  tech)

Queues the partner's technique tech, to run as its command.

< a technique of the partner's, run as its command

Definition at line 80 of file battle.c.

Referenced by dealTechDamage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueBlast()

void FIGHTSTG_queueBlast ( void  )

Queues the partner's digivolution for the battle (event 18), now.

< the partner's digivolution for the battle

Definition at line 90 of file battle.c.

Referenced by WFIGHTMN_chargeGauge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueBlastEnd()

void FIGHTSTG_queueBlastEnd ( s32  kind)

Queues the end of the partner's digivolution for the battle (event 19), after delay kind + 3.

Definition at line 98 of file battle.c.

Referenced by WFIGHTMN_blast().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueKnockOut()

void FIGHTSTG_queueKnockOut ( u8  side)

Queues the fall of side's active fighter (event 20), first.

Definition at line 107 of file battle.c.

Referenced by damageEnemy(), dealTechDamage(), drainEnemy(), FIGHTSTG_updateEnemyAttack(), showCounterResult(), showFirstTechResult(), showOtherAttackResult(), takeFirstTechDamage(), and WFIGHTMN_takeDamage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueSpecialEnd()

void FIGHTSTG_queueSpecialEnd ( void  )

Queues the end of the partner's special state (event 21): the USA version pushes back the one already queued.

< the end of the partner's special state

Definition at line 117 of file battle.c.

Referenced by announceKnockOut(), startSpecial(), and WFIGHTMN_tag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueDigidevolve()

void FIGHTSTG_queueDigidevolve ( void  )

Queues the partner's digidevolution, first.

Definition at line 143 of file battle.c.

Referenced by useSupportTech().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_queueLastEnemy()

void FIGHTSTG_queueLastEnemy ( void  )

Queues the coming in of the last battle's third enemy, first.

< the last battle's third enemy comes in

Definition at line 152 of file battle.c.

Referenced by FIGHTSTG_updateOneHpTurn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_weakenEnemy()

void FIGHTSTG_weakenEnemy ( void  )

Weakens the enemy in BATTLE_KIND_FINAL_LAST: halves its boosts of stats 1 and 2 and queues the end (event 24) in 3000.

< the end of the enemy's weakness (BATTLE_KIND_FINAL_LAST)

Definition at line 160 of file battle.c.

Referenced by WFIGHTMN_countHit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FIGHTSTG_endEnemyWeakness()

void FIGHTSTG_endEnemyWeakness ( void  )

Ends the enemy's weakness now: its queued event 24 runs next.

< the end of the enemy's weakness (BATTLE_KIND_FINAL_LAST)

Definition at line 173 of file battle.c.

Referenced by FIGHTSTG_updateEnemyAttack(), and WFIGHTMN_endWeakness().

Here is the caller graph for this function:

Variable Documentation

◆ FIGHTSTG_techEvents

s32 FIGHTSTG_techEvents[]
Initial value:
= {
16 , 16 + 1,
}

the event types of FIGHTSTG_startRestriction, by whether the technique's effect is TECH_EFFECT_NO_DIGIVOLVE

and of FIGHTSTG_startRestriction

Definition at line 7 of file battle.c.

Referenced by FIGHTSTG_startRestriction().

◆ FIGHTSTG_action

◆ FIGHTSTG_battle

Battle FIGHTSTG_battle
Initial value:
= {
0, 0, { { 0 }, { { { 0 } } }, { 0, 0 }, 0, 0, 0, 0, 0 }, { 0, 0 },
}
void FIGHTSTG_drawBlendedQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
A Gouraud-shaded quad on a layer, blended.
Definition draw.c:69
void FIGHTSTG_drawQuad(s32 layerId, s32 depth, DVECTOR *xy, CVECTOR *colors)
A Gouraud-shaded quad on a layer.
Definition draw.c:64
void FIGHTSTG_projectPoint(Layer *layer, SVECTOR *pos, ShortVec3 *out)
Projects pos to the screen: its x and y, and its depth in the layer's ordering table.
Definition draw.c:8
void FIGHTSTG_countFrames(void)
How many frames the battle moves on this frame by its speed mode: as many as went by,...
Definition speed.c:7
void FIGHTSTG_setSpeed(s32 mode)
Sets the battle's speed mode and counts this frame again.
Definition speed.c:35

the battle: its fighters, speed and drawing functions

Shared between the overlay's objects.

Definition at line 16 of file battle.c.

Referenced by addFighters(), announceEnemyTech(), announceFirstTech(), announceKnockOut(), applyStatusEvent(), boostAttack(), boostDefense(), boostElement(), boostFieldElement(), boostFighterStat(), boostRandomElement(), boostSideStat(), boostSpeed(), bringSecondEnemy(), confirmSwitchIn(), confuseFighters(), cureStatus(), cureStatusTech(), damageEnemy(), damagePlayer(), drainEnemy(), drainMp(), drainMp(), endBattleOnKnockOut(), FIGHTSTG_changeBoost(), FIGHTSTG_computeCounterDamage(), FIGHTSTG_computeDamage(), FIGHTSTG_computeHeal(), FIGHTSTG_computeMagicDamage(), FIGHTSTG_computeStats(), FIGHTSTG_countFrames(), FIGHTSTG_createTechWindows(), FIGHTSTG_cureStatus(), FIGHTSTG_drainMp(), FIGHTSTG_drawHud(), FIGHTSTG_drawSpriteAnim(), FIGHTSTG_findFighters(), FIGHTSTG_getActiveFighter(), FIGHTSTG_getDamage(), FIGHTSTG_getElementBoost(), FIGHTSTG_getEnemyAction(), FIGHTSTG_getEventDelay(), FIGHTSTG_getGaugeGain(), FIGHTSTG_getHeal(), FIGHTSTG_getPairDigimon(), FIGHTSTG_getTechCost(), FIGHTSTG_inflictConfusion(), FIGHTSTG_inflictParalysis(), FIGHTSTG_inflictPoison(), FIGHTSTG_inflictSleep(), FIGHTSTG_lowerAttack(), FIGHTSTG_lowerDefense(), FIGHTSTG_pickEnemySwitch(), FIGHTSTG_queueAutoRecoverEnd(), FIGHTSTG_queueBlastEnd(), FIGHTSTG_queueDigidevolve(), FIGHTSTG_queueKnockOut(), FIGHTSTG_queuePartnerTech(), FIGHTSTG_queueRunAway(), FIGHTSTG_queueSpecialEnd(), FIGHTSTG_raiseAllStatus(), FIGHTSTG_raiseEachStatus(), FIGHTSTG_raiseOneStatus(), FIGHTSTG_reviveFighter(), FIGHTSTG_rollCounter(), FIGHTSTG_rollCritical(), FIGHTSTG_rollDedigivolve(), FIGHTSTG_rollDrain(), FIGHTSTG_rollHit(), FIGHTSTG_rollMagicCritical(), FIGHTSTG_rollMagicHit(), FIGHTSTG_rollMultiHit(), FIGHTSTG_rollPoison(), FIGHTSTG_rollSleep(), FIGHTSTG_rollStatusRaise(), FIGHTSTG_rollSteal(), FIGHTSTG_runItemScript(), FIGHTSTG_setConfusedName(), FIGHTSTG_setMessageName(), FIGHTSTG_setSpeed(), FIGHTSTG_showCommands(), FIGHTSTG_showDigivolveNames(), FIGHTSTG_showFighterNames(), FIGHTSTG_showFightersMessage(), FIGHTSTG_showMessage(), FIGHTSTG_showSwitchFighters(), FIGHTSTG_showSwitchInChoices(), FIGHTSTG_showTechPage(), FIGHTSTG_startAction(), FIGHTSTG_startEndBattle(), FIGHTSTG_startRestriction(), FIGHTSTG_stepMotion(), FIGHTSTG_testConfusion(), FIGHTSTG_testEnemyCondition(), FIGHTSTG_testParalysis(), FIGHTSTG_testRunAway(), FIGHTSTG_testWakeUp(), FIGHTSTG_tryConfusion(), FIGHTSTG_tryDrain(), FIGHTSTG_tryParalysis(), FIGHTSTG_tryPoison(), FIGHTSTG_trySleep(), FIGHTSTG_trySteal(), FIGHTSTG_updateActionEvents(), FIGHTSTG_updateBattleSound(), FIGHTSTG_updateCameraTurn(), FIGHTSTG_updateCommandMenu(), FIGHTSTG_updateCounterattack(), FIGHTSTG_updateDigivolveMenu(), FIGHTSTG_updateEnemyAttack(), FIGHTSTG_updateEnemyTurn(), FIGHTSTG_updateFace(), FIGHTSTG_updateFirstTech(), FIGHTSTG_updateHpTweens(), FIGHTSTG_updateHud(), FIGHTSTG_updateItem(), FIGHTSTG_updateJump(), FIGHTSTG_updateMove(), FIGHTSTG_updateOneHpTurn(), FIGHTSTG_updateRoot(), FIGHTSTG_updateSpriteAnim(), FIGHTSTG_updateSwitchMenu(), FIGHTSTG_updateTechAction(), FIGHTSTG_updateTechMenu(), FIGHTSTG_weakenEnemy(), fillGauge(), findPairTech(), fleeWhenWeak(), healEnemy(), healPartner(), healWithTech(), lowerEnemySpeed(), lowerEnemyStat(), playCounterTech(), queueFirstTurns(), restoreHalfHpMp(), restoreSide(), reviveParty(), reviveSide(), rollStatus(), runDigivolveMenu(), setBattleKind(), setUpDrain(), setUpItemTech(), showCounterResult(), showEnemyName(), showLoweredStat(), showOtherAttackResult(), showRunAway(), startTechScript(), stealEnemyItem(), switchConfusionMusic(), useEnemyTech(), useItemTech(), wakeCounteredUp(), wakePlayerUp(), wakeUpOrCounter(), weakenEnemyDefense(), WFIGHTMN_blast(), WFIGHTMN_bringLastEnemy(), WFIGHTMN_cancelBlast(), WFIGHTMN_chargeGauge(), WFIGHTMN_clearField(), WFIGHTMN_countHit(), WFIGHTMN_cureStatus(), WFIGHTMN_digidevolve(), WFIGHTMN_digivolve(), WFIGHTMN_endBattle(), WFIGHTMN_endBlast(), WFIGHTMN_endBoost(), WFIGHTMN_endRestriction(), WFIGHTMN_endSpecial(), WFIGHTMN_endWeakness(), WFIGHTMN_initFighters(), WFIGHTMN_knockOut(), WFIGHTMN_limitDamage(), WFIGHTMN_markFought(), WFIGHTMN_pairTech(), WFIGHTMN_recordTech(), WFIGHTMN_recover(), WFIGHTMN_restoreEnemy(), WFIGHTMN_runCommand(), WFIGHTMN_runTurn(), WFIGHTMN_setIdleMotion(), WFIGHTMN_start(), WFIGHTMN_startTech(), WFIGHTMN_tag(), WFIGHTMN_takeDamage(), and WFIGHTTS_battleTest().

◆ FIGHTSTG_fighterCache

FighterCache FIGHTSTG_fighterCache
Initial value:
= {
}
void FIGHTSTG_cacheFighter(s32 index)
Loads entry index of the fighters file into FIGHTSTG_fighterCache: its id and kind,...
FaceRect * FIGHTSTG_getFighterFace(s32 id)
Fighter id's face parts (FaceRect), in the fighters file.
FighterInfo * FIGHTSTG_getFighterInfo(s32 id)
the match depends on reaching the cache through the symbol until a fighter is found,...
void FIGHTSTG_getFighterRange(u32 enemy, s32 *min, s32 *max)
The first and last entries of the fighters file that are enemies (enemy set) or partners.

the fighters' data, loaded one at a time

Shared between the overlay's objects.

Definition at line 21 of file battle.c.

Referenced by FIGHTSTG_addFighterModel(), FIGHTSTG_cacheFighter(), FIGHTSTG_createFace(), FIGHTSTG_faceModel(), FIGHTSTG_getEnemyView(), FIGHTSTG_getFighterInfo(), FIGHTSTG_getFighterView(), FIGHTSTG_loadCamera(), FIGHTSTG_runScriptModel(), FIGHTSTG_updateBattleScript(), FIGHTSTG_updateDigimonChange(), FIGHTSTG_updateEntrance(), fillEffectLists(), runCameraList(), WFIGHTTS_fighterList(), and WFIGHTTS_motionList().

◆ FIGHTSTG_battleFuncs

BattleFuncs FIGHTSTG_battleFuncs
Initial value:
= {
{ { 0 }, { 0 } },
}
BattleStats * FIGHTSTG_computeStats(u8 side, s32 which, s32 index)
Works out a side's stats into its BattleStats: the partner's totals with the fighter's boosts,...
Definition stats.c:42
void FIGHTSTG_changeBoost(u8 side, s32 index, s32 stat, s32 percent)
Changes a fighter's stat boost by percent 128ths of the stat without it, between minus half the stat ...
Definition boosts.c:14
s32 FIGHTSTG_getGaugeGain(s32 damage)
What the partner's damage adds to the gauge: the square of its percent of the max HP over 20,...
Definition boosts.c:46
s32 FIGHTSTG_getTechCost(u8 side, s32 id)
A technique's MP cost; accessories 0x143 and 0x144 cut the player's, to no less than 1.
Definition boosts.c:74
s32 FIGHTSTG_getHeal(u8 side, s32 index, s32 big)
The HP a fighter regains: 8 to 16 128ths of its max HP when big, 4 to 8 otherwise.
Definition damage.c:306
s32 FIGHTSTG_getDamage(s32 *args)
getDamage: the damage of an event (args: the side, the fighter and the base damage) to the fighter if...
Definition damage.c:196
s32 FIGHTSTG_computeDamage(u8 side, s32 id)
A technique's power from the user's attack against the target's defense (an enemy's scaled by its unk...
Definition damage.c:89
s32 FIGHTSTG_computeMagicDamage(u8 side, s32 id)
A magic technique's damage: its power by the user's spirit against the target's (half to twice as muc...
Definition damage.c:122
s32 FIGHTSTG_computeHeal(u8 side, s32 id)
The HP a healing technique restores: 64 times its power, and an eighth of it per point of the user's ...
Definition damage.c:272
s32 FIGHTSTG_computeCounterDamage(u8 side, s32 id, s32 value)
The damage of a counterattack on value: the partner's first skill deals it as one hit (the triple hit...
Definition damage.c:232
s32 FIGHTSTG_testWakeUp(u8 side, s32 value)
FIGHTSTG_battleFuncs.testWakeUp: whether a hit of value wakes side's fighter up, likelier the bigger ...
Definition rolls.c:510
s32 FIGHTSTG_rollCounter(s32 side, s32 damage)
FIGHTSTG_battleFuncs.rollCounter: a random test, likelier the bigger damage is next to the player's f...
Definition rolls.c:437
s32 FIGHTSTG_rollSleep(u8 side, s32 id)
Whether a hit puts the target to sleep, like rollPoison with the technique's chance (BATTLE_BLOCK_SLE...
Definition rolls.c:288
s32 FIGHTSTG_rollNoSwitch(s32 actor, s32 id)
Whether TECH_EFFECT_NO_SWITCH works: the technique's chance.
Definition rolls.c:425
s32 FIGHTSTG_rollMagicHit(u8 side, s32 id)
Whether a magic hit lands: the technique's accuracy with the wisdom and level differences; the player...
Definition rolls.c:165
s32 FIGHTSTG_rollDrain(u8 side, s32 id)
Whether a hit drains HP: the technique's chance, or the accessory's for a technique without an effect...
Definition rolls.c:367
s32 FIGHTSTG_rollNoDigivolve(s32 actor, s32 id)
Whether TECH_EFFECT_NO_DIGIVOLVE works: the technique's chance.
Definition rolls.c:430
s32 FIGHTSTG_rollDedigivolve(s32 actor, s32 id)
Whether a technique turns the player's fighter back: never when it is one of the partners' own Digimo...
Definition rolls.c:400
s32 FIGHTSTG_testParalysis(u8 side)
FIGHTSTG_battleFuncs.testParalysis: whether side's paralysis costs it the turn, a random test of its ...
Definition rolls.c:560
s32 FIGHTSTG_rollSteal(u8 side, s32 id)
Whether the player steals the enemy's item: its itemChance in 1024 by the speed ratio (at most twice)...
Definition rolls.c:325
s32 FIGHTSTG_rollHit(u8 side, s32 id)
Whether a physical hit lands: the technique's accuracy with the speed and level differences and the a...
Definition rolls.c:123
s32 FIGHTSTG_rollParalysis(u8 side, s32 id)
Whether a hit paralyzes, like rollPoison (BATTLE_BLOCK_PARALYSIS keeps the player from it)
Definition rolls.c:276
s32 FIGHTSTG_rollPoison(u8 side, s32 id)
The poison a hit inflicts, or 0: the technique's or the accessory's chance and an eighth of the user'...
Definition rolls.c:195
s32 FIGHTSTG_testRunAway(u8 side)
FIGHTSTG_battleFuncs.testRunAway: a random test for side running away, from both sides' stats; the pl...
Definition rolls.c:451
s32 FIGHTSTG_rollStatusRaise(s32 actor, s32 id)
Whether a status raise works: the technique's chance and an eighth of what the enemy's wisdom has ove...
Definition rolls.c:413
s32 FIGHTSTG_testConfusion(u8 side)
FIGHTSTG_battleFuncs.testConfusion: a random test of side's confusion against its resists 9 and 3.
Definition rolls.c:536
s32 FIGHTSTG_rollKnockOut(u8 side, s32 id)
Whether a hit knocks the target out, like rollPoison (BATTLE_BLOCK_KNOCK_OUT keeps the player from it...
Definition rolls.c:319
s32 FIGHTSTG_rollConfusion(u8 side, s32 id)
Whether a hit confuses, like rollPoison (BATTLE_BLOCK_CONFUSION keeps the player from it)
Definition rolls.c:282

the battle's stats and the functions that compute with them

Definition at line 25 of file battle.c.

Referenced by boostAttack(), boostDefense(), boostFieldElement(), boostFighterStat(), boostSideStat(), boostSpeed(), FIGHTSTG_adjustDamage(), FIGHTSTG_computeCounterDamage(), FIGHTSTG_computeDamage(), FIGHTSTG_computeHeal(), FIGHTSTG_computeMagicDamage(), FIGHTSTG_computeStats(), FIGHTSTG_getDamage(), FIGHTSTG_getEventDelay(), FIGHTSTG_lowerAttack(), FIGHTSTG_lowerDefense(), FIGHTSTG_raiseAllStatus(), FIGHTSTG_raiseEachStatus(), FIGHTSTG_raiseOneStatus(), FIGHTSTG_reviveFighter(), FIGHTSTG_rollCritical(), FIGHTSTG_rollDrain(), FIGHTSTG_rollHit(), FIGHTSTG_rollMagicCritical(), FIGHTSTG_rollMagicHit(), FIGHTSTG_rollMultiHit(), FIGHTSTG_rollPoison(), FIGHTSTG_rollSleep(), FIGHTSTG_rollStatusRaise(), FIGHTSTG_rollSteal(), FIGHTSTG_showTechPage(), FIGHTSTG_startAction(), FIGHTSTG_startDoubleMagic(), FIGHTSTG_startEndBattle(), FIGHTSTG_testConfusion(), FIGHTSTG_testParalysis(), FIGHTSTG_testRunAway(), FIGHTSTG_testWakeUp(), FIGHTSTG_tryConfusion(), FIGHTSTG_tryDrain(), FIGHTSTG_tryKnockOut(), FIGHTSTG_tryNoSwitch(), FIGHTSTG_tryParalysis(), FIGHTSTG_tryPoison(), FIGHTSTG_trySleep(), FIGHTSTG_trySteal(), FIGHTSTG_updateConfusedMenu(), FIGHTSTG_updateCounterattack(), FIGHTSTG_updateEnemyAttack(), FIGHTSTG_updateEnemyTurn(), FIGHTSTG_updateFirstTech(), FIGHTSTG_updateTechMenu(), getHealDamage(), healEnemy(), healWithTech(), lowerEnemySpeed(), lowerEnemyStat(), playCounterTech(), queueFirstTurns(), rollStatus(), setUpItemTech(), useSupportTech(), wakeUpOrCounter(), weakenEnemyDefense(), WFIGHTMN_chargeGauge(), WFIGHTMN_recover(), WFIGHTMN_runAway(), WFIGHTMN_runCommand(), WFIGHTMN_startTech(), and WFIGHTMN_takeDamage().