Micro clean up in BattleStruct (#8177)
This commit is contained in:
parent
194a8df131
commit
f28abcab6a
@ -7,6 +7,7 @@
|
||||
#include "constants/battle.h"
|
||||
#include "constants/form_change_types.h"
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/moves.h"
|
||||
#include "battle_main.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_util.h"
|
||||
@ -587,7 +588,8 @@ struct BattlerState
|
||||
u32 ateBoost:1;
|
||||
u32 wasAboveHalfHp:1; // For Berserk, Emergency Exit, Wimp Out and Anger Shell.
|
||||
u32 commanderSpecies:11;
|
||||
u32 padding:4;
|
||||
u32 selectionScriptFinished:1;
|
||||
u32 padding:3;
|
||||
// End of Word
|
||||
};
|
||||
|
||||
@ -628,7 +630,6 @@ struct BattleStruct
|
||||
struct BattlerState battlerState[MAX_BATTLERS_COUNT];
|
||||
struct PartyState partyState[NUM_BATTLE_SIDES][PARTY_SIZE];
|
||||
struct EventStates eventState;
|
||||
u16 wrappedMove[MAX_BATTLERS_COUNT];
|
||||
u16 moveTarget[MAX_BATTLERS_COUNT];
|
||||
u32 expShareExpValue;
|
||||
u32 expValue;
|
||||
@ -641,14 +642,12 @@ struct BattleStruct
|
||||
u8 expSentInMons; // As bits for player party mons - not including exp share mons.
|
||||
u8 wildVictorySong;
|
||||
enum Type dynamicMoveType;
|
||||
u8 wrappedBy[MAX_BATTLERS_COUNT];
|
||||
u8 battlerPreventingSwitchout;
|
||||
u8 moneyMultiplier:6;
|
||||
u8 moneyMultiplierItem:1;
|
||||
u8 moneyMultiplierMove:1;
|
||||
u8 savedTurnActionNumber;
|
||||
u8 scriptPartyIdx; // for printing the nickname
|
||||
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
|
||||
u8 battlerPartyIndexes[MAX_BATTLERS_COUNT];
|
||||
u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
|
||||
u8 battlerPartyOrders[MAX_BATTLERS_COUNT][PARTY_SIZE / 2];
|
||||
@ -753,7 +752,6 @@ struct BattleStruct
|
||||
s32 aiDelayTimer; // Counts number of frames AI takes to choose an action.
|
||||
s32 aiDelayFrames; // Number of frames it took to choose an action.
|
||||
s32 aiDelayCycles; // Number of cycles it took to choose an action.
|
||||
u8 stickySyrupdBy[MAX_BATTLERS_COUNT];
|
||||
u8 supremeOverlordCounter[MAX_BATTLERS_COUNT];
|
||||
u8 shellSideArmCategory[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT];
|
||||
u8 speedTieBreaks; // MAX_BATTLERS_COUNT! values.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#ifndef GUARD_CONSTANTS_BATTLE_H
|
||||
#define GUARD_CONSTANTS_BATTLE_H
|
||||
|
||||
#include "constants/moves.h"
|
||||
|
||||
/*
|
||||
* A battler may be in one of four positions on the field. The first bit determines
|
||||
* what side the battler is on, either the player's side or the opponent's side.
|
||||
@ -168,6 +170,8 @@ enum VolatileFlags
|
||||
F(VOLATILE_LOCK_CONFUSE, lockConfusionTurns, (u32, 3)) \
|
||||
F(VOLATILE_MULTIPLETURNS, multipleTurns, (u32, 1)) \
|
||||
F(VOLATILE_WRAPPED, wrapped, (u32, 1)) \
|
||||
F(VOLATILE_WRAPPED_BY, wrappedBy, (enum BattlerId, MAX_BITS(4))) \
|
||||
F(VOLATILE_WRAPPED_MOVE, wrappedMove, (u32, MOVES_COUNT_ALL - 1)) \
|
||||
F(VOLATILE_POWDER, powder, (u32, 1)) \
|
||||
F(VOLATILE_UNUSED, padding, (u32, 1)) \
|
||||
F(VOLATILE_INFATUATION, infatuation, (enum BattlerId, MAX_BITS(4))) \
|
||||
@ -183,13 +187,14 @@ enum VolatileFlags
|
||||
F(VOLATILE_FORESIGHT, foresight, (u32, 1)) \
|
||||
F(VOLATILE_DRAGON_CHEER, dragonCheer, (u32, 1), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_FOCUS_ENERGY, focusEnergy, (u32, 1), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_SEMI_INVULNERABLE, semiInvulnerable, (u32, 5)) \
|
||||
F(VOLATILE_SEMI_INVULNERABLE, semiInvulnerable, (u32, SEMI_INVULNERABLE_COUNT - 1)) \
|
||||
F(VOLATILE_ELECTRIFIED, electrified, (u32, 1)) \
|
||||
F(VOLATILE_MUD_SPORT, mudSport, (u32, 1), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_WATER_SPORT, waterSport, (u32, 1), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_INFINITE_CONFUSION, infiniteConfusion, (u32, 1), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_SALT_CURE, saltCure, (u32, 1)) \
|
||||
F(VOLATILE_SYRUP_BOMB, syrupBomb, (u32, 1)) \
|
||||
F(VOLATILE_STICKY_SYRUPED_BY, stickySyrupedBy, (enum BattlerId, MAX_BITS(4))) \
|
||||
F(VOLATILE_GLAIVE_RUSH, glaiveRush, (u32, 1)) \
|
||||
F(VOLATILE_LEECH_SEED, leechSeed, (enum BattlerId, MAX_BITS(4)), V_BATON_PASSABLE) \
|
||||
F(VOLATILE_LOCK_ON, lockOn, (u32, 2), V_BATON_PASSABLE) \
|
||||
@ -243,6 +248,7 @@ enum SemiInvulnerableState
|
||||
STATE_PHANTOM_FORCE,
|
||||
STATE_SKY_DROP,
|
||||
STATE_COMMANDER,
|
||||
SEMI_INVULNERABLE_COUNT
|
||||
};
|
||||
|
||||
enum SemiInvulnerableExclusion
|
||||
|
||||
@ -3071,17 +3071,16 @@ static u32 GetCurseDamage(u32 battlerId)
|
||||
return damage;
|
||||
}
|
||||
|
||||
static u32 GetTrapDamage(u32 battlerId)
|
||||
static u32 GetTrapDamage(u32 battler)
|
||||
{
|
||||
// ai has no knowledge about turns remaining
|
||||
u32 damage = 0;
|
||||
enum HoldEffect holdEffect = gAiLogicData->holdEffects[gBattleStruct->wrappedBy[battlerId]];
|
||||
if (gBattleMons[battlerId].volatiles.wrapped)
|
||||
if (gBattleMons[battler].volatiles.wrapped)
|
||||
{
|
||||
if (holdEffect == HOLD_EFFECT_BINDING_BAND)
|
||||
damage = GetNonDynamaxMaxHP(battlerId) / (B_BINDING_DAMAGE >= GEN_6 ? 6 : 8);
|
||||
if (gAiLogicData->holdEffects[gBattleMons[battler].volatiles.wrappedBy] == HOLD_EFFECT_BINDING_BAND)
|
||||
damage = GetNonDynamaxMaxHP(battler) / (B_BINDING_DAMAGE >= GEN_6 ? 6 : 8);
|
||||
else
|
||||
damage = GetNonDynamaxMaxHP(battlerId) / (B_BINDING_DAMAGE >= GEN_6 ? 8 : 16);
|
||||
damage = GetNonDynamaxMaxHP(battler) / (B_BINDING_DAMAGE >= GEN_6 ? 8 : 16);
|
||||
|
||||
if (damage == 0)
|
||||
damage = 1;
|
||||
|
||||
@ -634,12 +634,12 @@ static bool32 HandleEndTurnWrap(u32 battler)
|
||||
if (IsAbilityAndRecord(battler, GetBattlerAbility(battler), ABILITY_MAGIC_GUARD))
|
||||
return effect;
|
||||
|
||||
gBattleScripting.animArg1 = gBattleStruct->wrappedMove[battler];
|
||||
gBattleScripting.animArg2 = gBattleStruct->wrappedMove[battler] >> 8;
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[battler]);
|
||||
gBattleScripting.animArg1 = gBattleMons[battler].volatiles.wrappedMove;
|
||||
gBattleScripting.animArg2 = gBattleMons[battler].volatiles.wrappedMove >> 8;
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[battler].volatiles.wrappedMove);
|
||||
BattleScriptExecute(BattleScript_WrapTurnDmg);
|
||||
s32 bindDamage = 0;
|
||||
if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[battler]) == HOLD_EFFECT_BINDING_BAND)
|
||||
if (GetBattlerHoldEffect(gBattleMons[battler].volatiles.wrappedBy) == HOLD_EFFECT_BINDING_BAND)
|
||||
bindDamage = GetNonDynamaxMaxHP(battler) / (B_BINDING_DAMAGE >= GEN_6 ? 6 : 8);
|
||||
else
|
||||
bindDamage = GetNonDynamaxMaxHP(battler) / (B_BINDING_DAMAGE >= GEN_6 ? 8 : 16);
|
||||
@ -648,7 +648,7 @@ static bool32 HandleEndTurnWrap(u32 battler)
|
||||
else // broke free
|
||||
{
|
||||
gBattleMons[battler].volatiles.wrapped = FALSE;
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[battler]);
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[battler].volatiles.wrappedMove);
|
||||
BattleScriptExecute(BattleScript_WrapEnds);
|
||||
}
|
||||
effect = TRUE;
|
||||
|
||||
@ -3189,9 +3189,9 @@ void SwitchInClearSetData(u32 battler, struct Volatiles *volatilesCopy)
|
||||
{
|
||||
if (gBattleMons[i].volatiles.infatuation == INFATUATED_WITH(battler))
|
||||
gBattleMons[i].volatiles.infatuation = 0;
|
||||
if (gBattleMons[i].volatiles.wrapped && gBattleStruct->wrappedBy[i] == battler)
|
||||
if (gBattleMons[i].volatiles.wrapped && gBattleMons[i].volatiles.wrappedBy == battler)
|
||||
gBattleMons[i].volatiles.wrapped = FALSE;
|
||||
if (gBattleMons[i].volatiles.syrupBomb && gBattleStruct->stickySyrupdBy[i] == battler)
|
||||
if (gBattleMons[i].volatiles.syrupBomb && gBattleMons[i].volatiles.stickySyrupedBy == battler)
|
||||
gBattleMons[i].volatiles.syrupBomb = FALSE;
|
||||
if (gDisableStructs[i].octolock && gDisableStructs[i].octolockedBy == battler)
|
||||
gDisableStructs[i].octolock = FALSE;
|
||||
@ -3316,9 +3316,9 @@ const u8* FaintClearSetData(u32 battler)
|
||||
gBattleMons[i].volatiles.escapePrevention = FALSE;
|
||||
if (gBattleMons[i].volatiles.infatuation == INFATUATED_WITH(battler))
|
||||
gBattleMons[i].volatiles.infatuation = 0;
|
||||
if (gBattleMons[i].volatiles.wrapped && gBattleStruct->wrappedBy[i] == battler)
|
||||
if (gBattleMons[i].volatiles.wrapped && gBattleMons[i].volatiles.wrappedBy == battler)
|
||||
gBattleMons[i].volatiles.wrapped = FALSE;
|
||||
if (gBattleMons[i].volatiles.syrupBomb && gBattleStruct->stickySyrupdBy[i] == battler)
|
||||
if (gBattleMons[i].volatiles.syrupBomb && gBattleMons[i].volatiles.stickySyrupedBy == battler)
|
||||
gBattleMons[i].volatiles.syrupBomb = FALSE;
|
||||
if (gDisableStructs[i].octolock && gDisableStructs[i].octolockedBy == battler)
|
||||
gDisableStructs[i].octolock = FALSE;
|
||||
@ -4271,7 +4271,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (AreAllMovesUnusable(battler))
|
||||
{
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_WAIT_ACTION_CONFIRMED_STANDBY;
|
||||
gBattleStruct->moveTarget[battler] = gBattleResources->bufferB[battler][3];
|
||||
return;
|
||||
@ -4313,7 +4313,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
RecordedBattle_ClearBattlerAction(battler, 1);
|
||||
gSelectionBattleScripts[battler] = BattleScript_ActionSelectionItemsCantBeUsed;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4329,7 +4329,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
RecordedBattle_ClearBattlerAction(battler, 1);
|
||||
gSelectionBattleScripts[battler] = BattleScript_ActionSelectionItemsCantBeUsed;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4367,7 +4367,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
gSelectionBattleScripts[battler] = BattleScript_PrintFullBox;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4428,7 +4428,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
gSelectionBattleScripts[battler] = BattleScript_AskIfWantsToForfeitMatch;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT_MAY_RUN;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4436,7 +4436,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
gSelectionBattleScripts[battler] = BattleScript_QuestionForfeitBattle;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT_MAY_RUN;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4453,7 +4453,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
gSelectionBattleScripts[battler] = BattleScript_PrintCantEscapeFromBattle;
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
return;
|
||||
}
|
||||
@ -4495,7 +4495,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
RecordedBattle_ClearBattlerAction(battler, 1);
|
||||
gBattleCommunication[battler] = STATE_SELECTION_SCRIPT;
|
||||
gBattleStruct->selectionScriptFinished[battler] = FALSE;
|
||||
gBattleStruct->battlerState[battler].selectionScriptFinished = FALSE;
|
||||
gBattleResources->bufferB[battler][1] = B_ACTION_USE_MOVE;
|
||||
gBattleStruct->stateIdAfterSelScript[battler] = STATE_WAIT_ACTION_CHOSEN;
|
||||
return;
|
||||
@ -4629,7 +4629,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
break;
|
||||
case STATE_SELECTION_SCRIPT:
|
||||
if (gBattleStruct->selectionScriptFinished[battler])
|
||||
if (gBattleStruct->battlerState[battler].selectionScriptFinished)
|
||||
{
|
||||
gBattleCommunication[battler] = gBattleStruct->stateIdAfterSelScript[battler];
|
||||
}
|
||||
@ -4651,7 +4651,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
break;
|
||||
case STATE_SELECTION_SCRIPT_MAY_RUN:
|
||||
if (gBattleStruct->selectionScriptFinished[battler])
|
||||
if (gBattleStruct->battlerState[battler].selectionScriptFinished)
|
||||
{
|
||||
if (gBattleResources->bufferB[battler][1] == B_ACTION_NOTHING_FAINTED)
|
||||
{
|
||||
|
||||
@ -3135,15 +3135,13 @@ void SetMoveEffect(u32 battler, u32 effectBattler, enum MoveEffect moveEffect, c
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gEffectBattler].volatiles.wrapped = TRUE;
|
||||
if (GetBattlerHoldEffect(gBattlerAttacker) == HOLD_EFFECT_GRIP_CLAW)
|
||||
gDisableStructs[gEffectBattler].wrapTurns = B_BINDING_TURNS >= GEN_5 ? 7 : 5;
|
||||
else
|
||||
gDisableStructs[gEffectBattler].wrapTurns = B_BINDING_TURNS >= GEN_5 ? RandomUniform(RNG_WRAP, 4, 5) : RandomUniform(RNG_WRAP, 2, 5);
|
||||
|
||||
gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove;
|
||||
gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker;
|
||||
|
||||
gBattleMons[gEffectBattler].volatiles.wrapped = TRUE;
|
||||
gBattleMons[gEffectBattler].volatiles.wrappedMove = gCurrentMove;
|
||||
gBattleMons[gEffectBattler].volatiles.wrappedBy = gBattlerAttacker;
|
||||
BattleScriptPush(battleScript);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectWrap;
|
||||
}
|
||||
@ -3493,9 +3491,9 @@ void SetMoveEffect(u32 battler, u32 effectBattler, enum MoveEffect moveEffect, c
|
||||
struct Pokemon *mon = GetBattlerMon(gBattlerAttacker);
|
||||
|
||||
gBattleMons[gEffectBattler].volatiles.syrupBomb = TRUE;
|
||||
gBattleMons[gEffectBattler].volatiles.stickySyrupedBy = gBattlerAttacker;
|
||||
gDisableStructs[gEffectBattler].syrupBombTimer = 3;
|
||||
gDisableStructs[gEffectBattler].syrupBombIsShiny = IsMonShiny(mon);
|
||||
gBattleStruct->stickySyrupdBy[gEffectBattler] = gBattlerAttacker;
|
||||
BattleScriptPush(battleScript);
|
||||
gBattlescriptCurrInstr = BattleScript_SyrupBombActivates;
|
||||
}
|
||||
@ -3905,11 +3903,11 @@ void SetMoveEffect(u32 battler, u32 effectBattler, enum MoveEffect moveEffect, c
|
||||
else
|
||||
gDisableStructs[battler].wrapTurns = (Random() % 2) + 4;
|
||||
// The Wrap effect does not expire when the user switches, so here's some cheese.
|
||||
gBattleStruct->wrappedBy[battler] = gBattlerTarget;
|
||||
gBattleMons[battler].volatiles.wrappedBy = gBattlerTarget;
|
||||
if (moveEffect == MOVE_EFFECT_SANDBLAST_SIDE)
|
||||
gBattleStruct->wrappedMove[battler] = MOVE_SAND_TOMB;
|
||||
gBattleMons[battler].volatiles.wrappedMove = MOVE_SAND_TOMB;
|
||||
else
|
||||
gBattleStruct->wrappedMove[battler] = MOVE_FIRE_SPIN;
|
||||
gBattleMons[battler].volatiles.wrappedMove = MOVE_FIRE_SPIN;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -5390,8 +5388,7 @@ static void Cmd_jumpifabilitypresent(void)
|
||||
static void Cmd_endselectionscript(void)
|
||||
{
|
||||
CMD_ARGS();
|
||||
|
||||
*(gBattlerAttacker + gBattleStruct->selectionScriptFinished) = TRUE;
|
||||
gBattleStruct->battlerState[gBattlerAttacker].selectionScriptFinished = TRUE;
|
||||
}
|
||||
|
||||
static void PlayAnimation(u32 battler, u8 animId, const u16 *argPtr, const u8 *nextInstr)
|
||||
@ -12210,8 +12207,8 @@ static void Cmd_rapidspinfree(void)
|
||||
{
|
||||
gBattleScripting.battler = gBattlerTarget;
|
||||
gBattleMons[gBattlerAttacker].volatiles.wrapped = FALSE;
|
||||
gBattlerTarget = gBattleStruct->wrappedBy[gBattlerAttacker];
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gBattlerAttacker]);
|
||||
gBattlerTarget = gBattleMons[gBattlerAttacker].volatiles.wrappedBy;
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].volatiles.wrappedMove);
|
||||
BattleScriptCall(BattleScript_WrapFree);
|
||||
}
|
||||
else if (gBattleMons[gBattlerAttacker].volatiles.leechSeed)
|
||||
|
||||
@ -61,9 +61,9 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
MOVE_NONE,
|
||||
MOVE_BACKWARD,
|
||||
MOVE_FORWARD,
|
||||
CLOCK_MOVE_NONE,
|
||||
CLOCK_MOVE_BACKWARD,
|
||||
CLOCK_MOVE_FORWARD,
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -806,15 +806,15 @@ static void Task_SetClock_HandleInput(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
gTasks[taskId].tMoveDir = MOVE_NONE;
|
||||
gTasks[taskId].tMoveDir = CLOCK_MOVE_NONE;
|
||||
|
||||
if (JOY_HELD(DPAD_LEFT))
|
||||
gTasks[taskId].tMoveDir = MOVE_BACKWARD;
|
||||
gTasks[taskId].tMoveDir = CLOCK_MOVE_BACKWARD;
|
||||
|
||||
if (JOY_HELD(DPAD_RIGHT))
|
||||
gTasks[taskId].tMoveDir = MOVE_FORWARD;
|
||||
gTasks[taskId].tMoveDir = CLOCK_MOVE_FORWARD;
|
||||
|
||||
if (gTasks[taskId].tMoveDir != MOVE_NONE)
|
||||
if (gTasks[taskId].tMoveDir != CLOCK_MOVE_NONE)
|
||||
{
|
||||
if (gTasks[taskId].tMoveSpeed < 0xFF)
|
||||
gTasks[taskId].tMoveSpeed++;
|
||||
@ -916,13 +916,13 @@ static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed)
|
||||
u8 delta = CalcMinHandDelta(speed);
|
||||
switch (direction)
|
||||
{
|
||||
case MOVE_BACKWARD:
|
||||
case CLOCK_MOVE_BACKWARD:
|
||||
if (angle)
|
||||
angle -= delta;
|
||||
else
|
||||
angle = 360 - delta;
|
||||
break;
|
||||
case MOVE_FORWARD:
|
||||
case CLOCK_MOVE_FORWARD:
|
||||
if (angle < 360 - delta)
|
||||
angle += delta;
|
||||
else
|
||||
@ -936,7 +936,7 @@ static bool32 AdvanceClock(u8 taskId, u8 direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case MOVE_BACKWARD:
|
||||
case CLOCK_MOVE_BACKWARD:
|
||||
if (gTasks[taskId].tMinutes > 0)
|
||||
{
|
||||
gTasks[taskId].tMinutes--;
|
||||
@ -953,7 +953,7 @@ static bool32 AdvanceClock(u8 taskId, u8 direction)
|
||||
UpdateClockPeriod(taskId, direction);
|
||||
}
|
||||
break;
|
||||
case MOVE_FORWARD:
|
||||
case CLOCK_MOVE_FORWARD:
|
||||
if (gTasks[taskId].tMinutes < 59)
|
||||
{
|
||||
gTasks[taskId].tMinutes++;
|
||||
@ -979,7 +979,7 @@ static void UpdateClockPeriod(u8 taskId, u8 direction)
|
||||
u8 hours = gTasks[taskId].tHours;
|
||||
switch (direction)
|
||||
{
|
||||
case MOVE_BACKWARD:
|
||||
case CLOCK_MOVE_BACKWARD:
|
||||
switch (hours)
|
||||
{
|
||||
case 11:
|
||||
@ -990,7 +990,7 @@ static void UpdateClockPeriod(u8 taskId, u8 direction)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MOVE_FORWARD:
|
||||
case CLOCK_MOVE_FORWARD:
|
||||
switch (hours)
|
||||
{
|
||||
case 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user