Document battle arena

This commit is contained in:
DizzyEggg 2018-11-11 18:33:16 +01:00
parent 81410fee17
commit a4235c9ff8
15 changed files with 614 additions and 567 deletions

View File

@ -1251,20 +1251,20 @@
various \battler, 8
.endm
.macro various9 battler
various \battler, 9
.macro arenajudgmentwindow
various BS_ATTACKER, VARIOUS_ARENA_JUDGMENT_WINDOW
.endm
.macro various10 battler
various \battler, 10
.macro arenaopponentmonlost
various BS_ATTACKER, VARIOUS_ARENA_OPPONENT_MON_LOST
.endm
.macro various11 battler
various \battler, 11
.macro arenaplayermonlost
various BS_ATTACKER, VARIOUS_ARENA_PLAYER_MON_LOST
.endm
.macro various12 battler
various \battler, 12
.macro arenabothmonlost
various BS_ATTACKER, VARIOUS_ARENA_BOTH_MONS_LOST
.endm
.macro forfeityesnobox battler
@ -1279,12 +1279,12 @@
various \battler, 15
.endm
.macro various16 battler
various \battler, 16
.macro arenajudmengtstring id
various \id, VARIOUS_ARENA_JUDGMENT_STRING
.endm
.macro various17 battler
various \battler, 17
.macro arenawaitmessage id
various \id, VARIOUS_ARENA_WAIT_STRING
.endm
.macro waitcry battler
@ -1307,7 +1307,7 @@
various BS_ATTACKER, VARIOUS_VOLUME_UP
.endm
.macro various23 battler
.macro setalreadystatusedmoveattempt battler
various \battler, 23
.endm

View File

@ -1,357 +0,0 @@
.align 2
gBattleArenaMoveMindRatings:: @ 8611DC0
.byte 0 @ -
.byte 1 @ Pound
.byte 1 @ Karate Chop
.byte 1 @ Double Slap
.byte 1 @ Comet Punch
.byte 1 @ Mega Punch
.byte 1 @ Pay Day
.byte 1 @ Fire Punch
.byte 1 @ Ice Punch
.byte 1 @ Thunder Punch
.byte 1 @ Scratch
.byte 1 @ Vice Grip
.byte 1 @ Guillotine
.byte 1 @ Razor Wind
.byte 0 @ Swords Dance
.byte 1 @ Cut
.byte 1 @ Gust
.byte 1 @ Wing Attack
.byte 0 @ Whirlwind
.byte 1 @ Fly
.byte 1 @ Bind
.byte 1 @ Slam
.byte 1 @ Vine Whip
.byte 1 @ Stomp
.byte 1 @ Double Kick
.byte 1 @ Mega Kick
.byte 1 @ Jump Kick
.byte 1 @ Rolling Kick
.byte 0 @ Sand-Attack
.byte 1 @ Headbutt
.byte 1 @ Horn Attack
.byte 1 @ Fury Attack
.byte 1 @ Horn Drill
.byte 1 @ Tackle
.byte 1 @ Body Slam
.byte 1 @ Wrap
.byte 1 @ Take Down
.byte 1 @ Thrash
.byte 1 @ Double-Edge
.byte 0 @ Tail Whip
.byte 1 @ Poison Sting
.byte 1 @ Twineedle
.byte 1 @ Pin Missile
.byte 0 @ Leer
.byte 1 @ Bite
.byte 0 @ Growl
.byte 0 @ Roar
.byte 0 @ Sing
.byte 0 @ Supersonic
.byte 1 @ Sonic Boom
.byte 0 @ Disable
.byte 1 @ Acid
.byte 1 @ Ember
.byte 1 @ Flamethrower
.byte 0 @ Mist
.byte 1 @ Water Gun
.byte 1 @ Hydro Pump
.byte 1 @ Surf
.byte 1 @ Ice Beam
.byte 1 @ Blizzard
.byte 1 @ Psybeam
.byte 1 @ Bubble Beam
.byte 1 @ Aurora Beam
.byte 1 @ Hyper Beam
.byte 1 @ Peck
.byte 1 @ Drill Peck
.byte 1 @ Submission
.byte 1 @ Low Kick
.byte 0 @ Counter
.byte 1 @ Seismic Toss
.byte 1 @ Strength
.byte 1 @ Absorb
.byte 1 @ Mega Drain
.byte 0 @ Leech Seed
.byte 0 @ Growth
.byte 1 @ Razor Leaf
.byte 1 @ Solar Beam
.byte 0 @ Poison Powder
.byte 0 @ Stun Spore
.byte 0 @ Sleep Powder
.byte 1 @ Petal Dance
.byte 0 @ String Shot
.byte 1 @ Dragon Rage
.byte 1 @ Fire Spin
.byte 1 @ Thunder Shock
.byte 1 @ Thunderbolt
.byte 0 @ Thunder Wave
.byte 1 @ Thunder
.byte 1 @ Rock Throw
.byte 1 @ Earthquake
.byte 1 @ Fissure
.byte 1 @ Dig
.byte 0 @ Toxic
.byte 1 @ Confusion
.byte 1 @ Psychic
.byte 0 @ Hypnosis
.byte 0 @ Meditate
.byte 0 @ Agility
.byte 1 @ Quick Attack
.byte 1 @ Rage
.byte 0 @ Teleport
.byte 1 @ Night Shade
.byte 0 @ Mimic
.byte 0 @ Screech
.byte 0 @ Double Team
.byte 0 @ Recover
.byte 0 @ Harden
.byte 0 @ Minimize
.byte 0 @ Smokescreen
.byte 0 @ Confuse Ray
.byte 0 @ Withdraw
.byte 0 @ Defense Curl
.byte 0 @ Barrier
.byte 0 @ Light Screen
.byte 0 @ Haze
.byte 0 @ Reflect
.byte 0 @ Focus Energy
.byte 0 @ Bide
.byte 0 @ Metronome
.byte 0 @ Mirror Move
.byte 1 @ Self-Destruct
.byte 1 @ Egg Bomb
.byte 1 @ Lick
.byte 1 @ Smog
.byte 1 @ Sludge
.byte 1 @ Bone Club
.byte 1 @ Fire Blast
.byte 1 @ Waterfall
.byte 1 @ Clamp
.byte 1 @ Swift
.byte 1 @ Skull Bash
.byte 1 @ Spike Cannon
.byte 1 @ Constrict
.byte 0 @ Amnesia
.byte 0 @ Kinesis
.byte 0 @ Soft-Boiled
.byte 1 @ Hi Jump Kick
.byte 0 @ Glare
.byte 1 @ Dream Eater
.byte 0 @ Poison Gas
.byte 1 @ Barrage
.byte 1 @ Leech Life
.byte 0 @ Lovely Kiss
.byte 1 @ Sky Attack
.byte 0 @ Transform
.byte 1 @ Bubble
.byte 1 @ Dizzy Punch
.byte 0 @ Spore
.byte 0 @ Flash
.byte 1 @ Psywave
.byte 0 @ Splash
.byte 0 @ Acid Armor
.byte 1 @ Crabhammer
.byte 1 @ Explosion
.byte 1 @ Fury Swipes
.byte 1 @ Bonemerang
.byte 0 @ Rest
.byte 1 @ Rock Slide
.byte 1 @ Hyper Fang
.byte 0 @ Sharpen
.byte 0 @ Conversion
.byte 1 @ Tri Attack
.byte 1 @ Super Fang
.byte 1 @ Slash
.byte 0 @ Substitute
.byte 1 @ Struggle
.byte 0 @ Sketch
.byte 1 @ Triple Kick
.byte 1 @ Thief
.byte 0 @ Spider Web
.byte 0 @ Mind Reader
.byte 0 @ Nightmare
.byte 1 @ Flame Wheel
.byte 1 @ Snore
.byte 0 @ Curse
.byte 1 @ Flail
.byte 0 @ Conversion 2
.byte 1 @ Aeroblast
.byte 0 @ Cotton Spore
.byte 1 @ Reversal
.byte 0 @ Spite
.byte 1 @ Powder Snow
.byte -1 @ Protect
.byte 1 @ Mach Punch
.byte 0 @ Scary Face
.byte 1 @ Faint Attack
.byte 0 @ Sweet Kiss
.byte 0 @ Belly Drum
.byte 1 @ Sludge Bomb
.byte 1 @ Mud-Slap
.byte 1 @ Octazooka
.byte 0 @ Spikes
.byte 1 @ Zap Cannon
.byte 0 @ Foresight
.byte 0 @ Destiny Bond
.byte 0 @ Perish Song
.byte 1 @ Icy Wind
.byte -1 @ Detect
.byte 1 @ Bone Rush
.byte 0 @ Lock-On
.byte 1 @ Outrage
.byte 0 @ Sandstorm
.byte 1 @ Giga Drain
.byte -1 @ Endure
.byte 0 @ Charm
.byte 1 @ Rollout
.byte 1 @ False Swipe
.byte 0 @ Swagger
.byte 0 @ Milk Drink
.byte 1 @ Spark
.byte 1 @ Fury Cutter
.byte 1 @ Steel Wing
.byte 0 @ Mean Look
.byte 0 @ Attract
.byte 0 @ Sleep Talk
.byte 0 @ Heal Bell
.byte 1 @ Return
.byte 1 @ Present
.byte 1 @ Frustration
.byte 0 @ Safeguard
.byte 0 @ Pain Split
.byte 1 @ Sacred Fire
.byte 1 @ Magnitude
.byte 1 @ Dynamic Punch
.byte 1 @ Megahorn
.byte 1 @ Dragon Breath
.byte 0 @ Baton Pass
.byte 0 @ Encore
.byte 1 @ Pursuit
.byte 1 @ Rapid Spin
.byte 0 @ Sweet Scent
.byte 1 @ Iron Tail
.byte 1 @ Metal Claw
.byte 1 @ Vital Throw
.byte 0 @ Morning Sun
.byte 0 @ Synthesis
.byte 0 @ Moonlight
.byte 1 @ Hidden Power
.byte 1 @ Cross Chop
.byte 1 @ Twister
.byte 0 @ Rain Dance
.byte 0 @ Sunny Day
.byte 1 @ Crunch
.byte 0 @ Mirror Coat
.byte 0 @ Psych Up
.byte 1 @ Extreme Speed
.byte 1 @ Ancient Power
.byte 1 @ Shadow Ball
.byte 1 @ Future Sight
.byte 1 @ Rock Smash
.byte 1 @ Whirlpool
.byte 1 @ Beat Up
.byte -1 @ Fake Out
.byte 1 @ Uproar
.byte 0 @ Stockpile
.byte 1 @ Spit Up
.byte 0 @ Swallow
.byte 1 @ Heat Wave
.byte 0 @ Hail
.byte 0 @ Torment
.byte 0 @ Flatter
.byte 0 @ Will-O-Wisp
.byte 0 @ Memento
.byte 1 @ Facade
.byte 1 @ Focus Punch
.byte 1 @ Smelling Salt
.byte 0 @ Follow Me
.byte 0 @ Nature Power
.byte 0 @ Charge
.byte 0 @ Taunt
.byte 0 @ Helping Hand
.byte 0 @ Trick
.byte 0 @ Role Play
.byte 0 @ Wish
.byte 0 @ Assist
.byte 0 @ Ingrain
.byte 1 @ Superpower
.byte 0 @ Magic Coat
.byte 0 @ Recycle
.byte 1 @ Revenge
.byte 1 @ Brick Break
.byte 0 @ Yawn
.byte 1 @ Knock Off
.byte 1 @ Endeavor
.byte 1 @ Eruption
.byte 0 @ Skill Swap
.byte 0 @ Imprison
.byte 0 @ Refresh
.byte 0 @ Grudge
.byte 0 @ Snatch
.byte 1 @ Secret Power
.byte 1 @ Dive
.byte 1 @ Arm Thrust
.byte 0 @ Camouflage
.byte 0 @ Tail Glow
.byte 1 @ Luster Purge
.byte 1 @ Mist Ball
.byte 0 @ Feather Dance
.byte 0 @ Teeter Dance
.byte 1 @ Blaze Kick
.byte 0 @ Mud Sport
.byte 1 @ Ice Ball
.byte 1 @ Needle Arm
.byte 0 @ Slack Off
.byte 1 @ Hyper Voice
.byte 1 @ Poison Fang
.byte 1 @ Crush Claw
.byte 1 @ Blast Burn
.byte 1 @ Hydro Cannon
.byte 1 @ Meteor Mash
.byte 1 @ Astonish
.byte 1 @ Weather Ball
.byte 0 @ Aromatherapy
.byte 0 @ Fake Tears
.byte 1 @ Air Cutter
.byte 1 @ Overheat
.byte 0 @ Odor Sleuth
.byte 1 @ Rock Tomb
.byte 1 @ Silver Wind
.byte 0 @ Metal Sound
.byte 0 @ Grass Whistle
.byte 0 @ Tickle
.byte 0 @ Cosmic Power
.byte 1 @ Water Spout
.byte 1 @ Signal Beam
.byte 1 @ Shadow Punch
.byte 1 @ Extrasensory
.byte 1 @ Sky Uppercut
.byte 1 @ Sand Tomb
.byte 1 @ Sheer Cold
.byte 1 @ Muddy Water
.byte 1 @ Bullet Seed
.byte 1 @ Aerial Ace
.byte 1 @ Icicle Spear
.byte 0 @ Iron Defense
.byte 0 @ Block
.byte 0 @ Howl
.byte 1 @ Dragon Claw
.byte 1 @ Frenzy Plant
.byte 0 @ Bulk Up
.byte 1 @ Bounce
.byte 1 @ Mud Shot
.byte 1 @ Poison Tail
.byte 1 @ Covet
.byte 1 @ Volt Tackle
.byte 1 @ Magical Leaf
.byte 0 @ Water Sport
.byte 0 @ Calm Mind
.byte 1 @ Leaf Blade
.byte 0 @ Dragon Dance
.byte 1 @ Rock Blast
.byte 1 @ Shock Wave
.byte 1 @ Water Pulse
.byte 1 @ Doom Desire
.byte 1 @ Psycho Boost

View File

@ -102,37 +102,3 @@ gUnknown_08611DB0:: @ 8611DB0
gUnknown_08611DB8:: @ 8611DB8
.4byte gUnknown_08611D5C
.4byte gUnknown_08611D94
@ 8611DC0
.include "data/battle_frontier/battle_arena_move_mind_ratings.inc"
.align 2
gUnknown_08611F24:: @ 8611F24
.byte 0x00, 0x00, 0x00, 0x40, 0x00, 0xf0, 0x00, 0x00
.align 2
gUnknown_08611F2C:: @ 8611F2C
.2byte 0x0000, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_08611F34:: @ 8611F34
.2byte 0x0004, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_08611F3C:: @ 8611F3C
.2byte 0x0008, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_08611F44:: @ 8611F44
.2byte 0x000c, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_08611F4C:: @ 8611F4C
.4byte gUnknown_08611F2C
.4byte gUnknown_08611F34
.4byte gUnknown_08611F3C
.4byte gUnknown_08611F44
.align 2
gUnknown_08611F5C:: @ 8611F5C
spr_template 0x03e8, 0xffff, gUnknown_08611F24, gUnknown_08611F4C, NULL, gDummySpriteAffineAnimTable, sub_81A5698

View File

@ -318,7 +318,7 @@ BattleScript_EffectSleep::
goto BattleScript_MoveEnd
BattleScript_AlreadyAsleep::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNALREADYASLEEP
waitmessage 0x40
@ -731,7 +731,7 @@ BattleScript_EffectToxic::
goto BattleScript_MoveEnd
BattleScript_AlreadyPoisoned::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x40
printstring STRINGID_PKMNALREADYPOISONED
waitmessage 0x40
@ -779,7 +779,7 @@ BattleScript_RestCantSleep::
goto BattleScript_MoveEnd
BattleScript_RestIsAlreadyAsleep::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNALREADYASLEEP2
waitmessage 0x40
@ -944,7 +944,7 @@ BattleScript_EffectConfuse::
goto BattleScript_MoveEnd
BattleScript_AlreadyConfused::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNALREADYCONFUSED
waitmessage 0x40
@ -1051,7 +1051,7 @@ BattleScript_EffectParalyze::
goto BattleScript_MoveEnd
BattleScript_AlreadyParalyzed::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNISALREADYPARALYZED
waitmessage 0x40
@ -1128,7 +1128,7 @@ BattleScript_SubstituteString::
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_AlreadyHasSubstitute::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNHASSUBSTITUTE
waitmessage 0x40
@ -2226,7 +2226,7 @@ BattleScript_WaterVeilPrevents::
goto BattleScript_MoveEnd
BattleScript_AlreadyBurned::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNALREADYHASBURN
waitmessage 0x40
@ -2643,7 +2643,7 @@ BattleScript_TeeterDanceSubstitutePrevents::
goto BattleScript_TeeterDanceDoMoveEndIncrement
BattleScript_TeeterDanceAlreadyConfused::
various23 BS_ATTACKER
setalreadystatusedmoveattempt BS_ATTACKER
pause 0x20
printstring STRINGID_PKMNALREADYCONFUSED
waitmessage 0x40
@ -4487,54 +4487,54 @@ BattleScript_ArenaTurnBeginning::
pause 0x8
playse SE_HANTEI1
various14 BS_ATTACKER
various16 8
various17 8
arenajudmengtstring 8
arenawaitmessage 8
pause 0x40
various15 BS_ATTACKER
volumeup
end2
BattleScript_82DB8E0::
BattleScript_82DB8E0:: @ Unused battlescript
playse SE_PINPON
various14 BS_ATTACKER
various16 BS_TARGET
various17 BS_TARGET
arenajudmengtstring BS_TARGET
arenawaitmessage BS_TARGET
pause 0x40
various15 BS_ATTACKER
end2
BattleScript_82DB8F3::
makevisible 11
BattleScript_ArenaDoJudgment::
makevisible BS_PLAYER1
waitstate
makevisible BS_OPPONENT1
waitstate
volumedown
playse 0x109
playse SE_HANTEI1
pause 0x8
playse 0x109
playse SE_HANTEI1
pause 0x40
various14 BS_ATTACKER
various16 BS_ATTACKER
various17 BS_ATTACKER
arenajudmengtstring 1
arenawaitmessage 1
pause 0x40
setbyte gBattleCommunication, 0x0
various9 BS_ATTACKER
arenajudgmentwindow
pause 0x40
various9 BS_ATTACKER
various16 BS_EFFECT_BATTLER
various17 BS_EFFECT_BATTLER
various9 BS_ATTACKER
various16 BS_FAINTED
various17 BS_FAINTED
various9 BS_ATTACKER
various16 0x4
various17 0x4
various9 BS_ATTACKER
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x3, BattleScript_82DB973
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x4, BattleScript_82DB992
various16 0x5
various17 0x5
various9 BS_ATTACKER
arenajudgmentwindow
arenajudmengtstring 2
arenawaitmessage 2
arenajudgmentwindow
arenajudmengtstring 3
arenawaitmessage 3
arenajudgmentwindow
arenajudmengtstring 4
arenawaitmessage 4
arenajudgmentwindow
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x3, BattleScript_ArenaJudgmentPlayerLoses
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x4, BattleScript_ArenaJudgmentDraw
arenajudmengtstring 5
arenawaitmessage 5
arenajudgmentwindow
various15 BS_ATTACKER
printstring STRINGID_DEFEATEDOPPONENTBYREFEREE
waitmessage 0x40
@ -4542,39 +4542,39 @@ BattleScript_82DB8F3::
waitcry BS_ATTACKER
dofaintanimation BS_OPPONENT1
cleareffectsonfaint BS_OPPONENT1
various10 BS_ATTACKER
arenaopponentmonlost
end2
BattleScript_82DB973::
various16 0x6
various17 0x6
various9 BS_ATTACKER
BattleScript_ArenaJudgmentPlayerLoses:
arenajudmengtstring 6
arenawaitmessage 6
arenajudgmentwindow
various15 BS_ATTACKER
printstring STRINGID_LOSTTOOPPONENTBYREFEREE
waitmessage 0x40
playfaintcry 11
playfaintcry BS_PLAYER1
waitcry BS_ATTACKER
dofaintanimation 11
cleareffectsonfaint 11
various11 BS_ATTACKER
dofaintanimation BS_PLAYER1
cleareffectsonfaint BS_PLAYER1
arenaplayermonlost
end2
BattleScript_82DB992::
various16 BS_BATTLER_0
various17 BS_BATTLER_0
various9 BS_ATTACKER
BattleScript_ArenaJudgmentDraw:
arenajudmengtstring 7
arenawaitmessage 7
arenajudgmentwindow
various15 BS_ATTACKER
printstring STRINGID_TIEDOPPONENTBYREFEREE
waitmessage 0x40
playfaintcry 11
playfaintcry BS_PLAYER1
waitcry BS_ATTACKER
dofaintanimation 11
cleareffectsonfaint 11
dofaintanimation BS_PLAYER1
cleareffectsonfaint BS_PLAYER1
playfaintcry BS_OPPONENT1
waitcry BS_ATTACKER
dofaintanimation BS_OPPONENT1
cleareffectsonfaint BS_OPPONENT1
various12 BS_ATTACKER
arenabothmonlost
end2
BattleScript_AskIfWantsToForfeitMatch::

View File

@ -498,12 +498,12 @@ struct BattleStruct
struct BattleTv tv;
u8 notSureWhatFieldLol[0x28];
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
s8 field_298[2];
s8 field_29A[2];
u16 field_29C[2];
u8 field_2A0;
u8 field_2A1;
u8 field_2A2;
s8 arenaMindPoints[2];
s8 arenaSkillPoints[2];
u16 arenaStartHp[2];
u8 arenaLostPlayerMons; // Bits for party member, lost as in referee's decision, not by fainting.
u8 arenaLostOpponentMons;
u8 alreadyStatusedMoveAttempt; // As bits for battlers; For example when using Thunder Wave on an already paralyzed pokemon.
};
#define GET_MOVE_TYPE(move, typeArg) \

14
include/battle_arena.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef GUARD_BATTLE_ARENA_H
#define GUARD_BATTLE_ARENA_H
void CallBattleArenaFunction(void);
u8 BattleArena_ShowJudgmentWindow(u8 *state);
void BattleArena_InitPoints(void);
void BattleArena_AddMindPoints(u8 battler);
void BattleArena_AddSkillPoints(u8 battler);
void BattleArena_DeductMindPoints(u8 battler, u16 stringId);
void sub_81A586C(u8 battler);
void sub_81A5BF8(void);
void sub_81A5D44(void);
#endif //GUARD_BATTLE_ARENA_H

View File

@ -206,7 +206,7 @@ extern const u8 BattleScript_BerryFocusEnergyEnd2[];
extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[];
extern const u8 BattleScript_ArenaTurnBeginning[];
extern const u8 BattleScript_82DB881[];
extern const u8 BattleScript_82DB8F3[];
extern const u8 BattleScript_ArenaDoJudgment[];
extern const u8 BattleScript_82DAA0B[];
extern const u8 BattleScript_AskIfWantsToForfeitMatch[];
extern const u8 BattleScript_PrintPlayerForfeited[];

View File

@ -68,12 +68,19 @@
#define VARIOUS_GET_MOVE_TARGET 3
#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
#define VARIOUS_ARENA_JUDGMENT_WINDOW 9
#define VARIOUS_ARENA_OPPONENT_MON_LOST 10
#define VARIOUS_ARENA_PLAYER_MON_LOST 11
#define VARIOUS_ARENA_BOTH_MONS_LOST 12
#define VARIOUS_EMIT_YESNOBOX 13
#define VARIOUS_ARENA_JUDGMENT_STRING 16
#define VARIOUS_ARENA_WAIT_STRING 17
#define VARIOUS_WAIT_CRY 18
#define VARIOUS_RETURN_OPPONENT_MON1 19
#define VARIOUS_RETURN_OPPONENT_MON2 20
#define VARIOUS_VOLUME_DOWN 21
#define VARIOUS_VOLUME_UP 22
#define VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT 23
#define VARIOUS_SET_TELEPORT_OUTCOME 25
#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "battle_arena.h"
#include "event_data.h"
#include "palette.h"
#include "gpu_regs.h"
@ -19,14 +20,13 @@
#include "constants/songs.h"
#include "constants/battle_string_ids.h"
#include "constants/battle_frontier.h"
#include "constants/moves.h"
extern u16 gBattle_WIN0H;
extern u16 gBattle_WIN0V;
extern const u32 gUnknown_08D854E8[];
extern const u16 gUnknown_08D855E8[];
extern const struct SpriteTemplate gUnknown_08611F5C;
extern const s8 gBattleArenaMoveMindRatings[];
// This file's functions.
static void sub_81A58B4(void);
@ -36,16 +36,436 @@ static void sub_81A5AC4(void);
static void sub_81A5B08(void);
static void sub_81A5B88(void);
static void sub_81A5BE0(void);
static void sub_81A5558(u8 x, u8 y, u8 arg2, u8 battler);
static void SpriteCb_JudgmentIcon(struct Sprite *sprite);
static void ShowJudgmentSprite(u8 x, u8 y, u8 arg2, u8 battler);
// Const rom data.
static const s8 sMindRatings[] =
{
[MOVE_NONE] = 0,
[MOVE_POUND] = 1,
[MOVE_KARATE_CHOP] = 1,
[MOVE_DOUBLE_SLAP] = 1,
[MOVE_COMET_PUNCH] = 1,
[MOVE_MEGA_PUNCH] = 1,
[MOVE_PAY_DAY] = 1,
[MOVE_FIRE_PUNCH] = 1,
[MOVE_ICE_PUNCH] = 1,
[MOVE_THUNDER_PUNCH] = 1,
[MOVE_SCRATCH] = 1,
[MOVE_VICE_GRIP] = 1,
[MOVE_GUILLOTINE] = 1,
[MOVE_RAZOR_WIND] = 1,
[MOVE_SWORDS_DANCE] = 0,
[MOVE_CUT] = 1,
[MOVE_GUST] = 1,
[MOVE_WING_ATTACK] = 1,
[MOVE_WHIRLWIND] = 0,
[MOVE_FLY] = 1,
[MOVE_BIND] = 1,
[MOVE_SLAM] = 1,
[MOVE_VINE_WHIP] = 1,
[MOVE_STOMP] = 1,
[MOVE_DOUBLE_KICK] = 1,
[MOVE_MEGA_KICK] = 1,
[MOVE_JUMP_KICK] = 1,
[MOVE_ROLLING_KICK] = 1,
[MOVE_SAND_ATTACK] = 0,
[MOVE_HEADBUTT] = 1,
[MOVE_HORN_ATTACK] = 1,
[MOVE_FURY_ATTACK] = 1,
[MOVE_HORN_DRILL] = 1,
[MOVE_TACKLE] = 1,
[MOVE_BODY_SLAM] = 1,
[MOVE_WRAP] = 1,
[MOVE_TAKE_DOWN] = 1,
[MOVE_THRASH] = 1,
[MOVE_DOUBLE_EDGE] = 1,
[MOVE_TAIL_WHIP] = 0,
[MOVE_POISON_STING] = 1,
[MOVE_TWINEEDLE] = 1,
[MOVE_PIN_MISSILE] = 1,
[MOVE_LEER] = 0,
[MOVE_BITE] = 1,
[MOVE_GROWL] = 0,
[MOVE_ROAR] = 0,
[MOVE_SING] = 0,
[MOVE_SUPERSONIC] = 0,
[MOVE_SONIC_BOOM] = 1,
[MOVE_DISABLE] = 0,
[MOVE_ACID] = 1,
[MOVE_EMBER] = 1,
[MOVE_FLAMETHROWER] = 1,
[MOVE_MIST] = 0,
[MOVE_WATER_GUN] = 1,
[MOVE_HYDRO_PUMP] = 1,
[MOVE_SURF] = 1,
[MOVE_ICE_BEAM] = 1,
[MOVE_BLIZZARD] = 1,
[MOVE_PSYBEAM] = 1,
[MOVE_BUBBLE_BEAM] = 1,
[MOVE_AURORA_BEAM] = 1,
[MOVE_HYPER_BEAM] = 1,
[MOVE_PECK] = 1,
[MOVE_DRILL_PECK] = 1,
[MOVE_SUBMISSION] = 1,
[MOVE_LOW_KICK] = 1,
[MOVE_COUNTER] = 0,
[MOVE_SEISMIC_TOSS] = 1,
[MOVE_STRENGTH] = 1,
[MOVE_ABSORB] = 1,
[MOVE_MEGA_DRAIN] = 1,
[MOVE_LEECH_SEED] = 0,
[MOVE_GROWTH] = 0,
[MOVE_RAZOR_LEAF] = 1,
[MOVE_SOLAR_BEAM] = 1,
[MOVE_POISON_POWDER] = 0,
[MOVE_STUN_SPORE] = 0,
[MOVE_SLEEP_POWDER] = 0,
[MOVE_PETAL_DANCE] = 1,
[MOVE_STRING_SHOT] = 0,
[MOVE_DRAGON_RAGE] = 1,
[MOVE_FIRE_SPIN] = 1,
[MOVE_THUNDER_SHOCK] = 1,
[MOVE_THUNDERBOLT] = 1,
[MOVE_THUNDER_WAVE] = 0,
[MOVE_THUNDER] = 1,
[MOVE_ROCK_THROW] = 1,
[MOVE_EARTHQUAKE] = 1,
[MOVE_FISSURE] = 1,
[MOVE_DIG] = 1,
[MOVE_TOXIC] = 0,
[MOVE_CONFUSION] = 1,
[MOVE_PSYCHIC] = 1,
[MOVE_HYPNOSIS] = 0,
[MOVE_MEDITATE] = 0,
[MOVE_AGILITY] = 0,
[MOVE_QUICK_ATTACK] = 1,
[MOVE_RAGE] = 1,
[MOVE_TELEPORT] = 0,
[MOVE_NIGHT_SHADE] = 1,
[MOVE_MIMIC] = 0,
[MOVE_SCREECH] = 0,
[MOVE_DOUBLE_TEAM] = 0,
[MOVE_RECOVER] = 0,
[MOVE_HARDEN] = 0,
[MOVE_MINIMIZE] = 0,
[MOVE_SMOKESCREEN] = 0,
[MOVE_CONFUSE_RAY] = 0,
[MOVE_WITHDRAW] = 0,
[MOVE_DEFENSE_CURL] = 0,
[MOVE_BARRIER] = 0,
[MOVE_LIGHT_SCREEN] = 0,
[MOVE_HAZE] = 0,
[MOVE_REFLECT] = 0,
[MOVE_FOCUS_ENERGY] = 0,
[MOVE_BIDE] = 0,
[MOVE_METRONOME] = 0,
[MOVE_MIRROR_MOVE] = 0,
[MOVE_SELF_DESTRUCT] = 1,
[MOVE_EGG_BOMB] = 1,
[MOVE_LICK] = 1,
[MOVE_SMOG] = 1,
[MOVE_SLUDGE] = 1,
[MOVE_BONE_CLUB] = 1,
[MOVE_FIRE_BLAST] = 1,
[MOVE_WATERFALL] = 1,
[MOVE_CLAMP] = 1,
[MOVE_SWIFT] = 1,
[MOVE_SKULL_BASH] = 1,
[MOVE_SPIKE_CANNON] = 1,
[MOVE_CONSTRICT] = 1,
[MOVE_AMNESIA] = 0,
[MOVE_KINESIS] = 0,
[MOVE_SOFT_BOILED] = 0,
[MOVE_HI_JUMP_KICK] = 1,
[MOVE_GLARE] = 0,
[MOVE_DREAM_EATER] = 1,
[MOVE_POISON_GAS] = 0,
[MOVE_BARRAGE] = 1,
[MOVE_LEECH_LIFE] = 1,
[MOVE_LOVELY_KISS] = 0,
[MOVE_SKY_ATTACK] = 1,
[MOVE_TRANSFORM] = 0,
[MOVE_BUBBLE] = 1,
[MOVE_DIZZY_PUNCH] = 1,
[MOVE_SPORE] = 0,
[MOVE_FLASH] = 0,
[MOVE_PSYWAVE] = 1,
[MOVE_SPLASH] = 0,
[MOVE_ACID_ARMOR] = 0,
[MOVE_CRABHAMMER] = 1,
[MOVE_EXPLOSION] = 1,
[MOVE_FURY_SWIPES] = 1,
[MOVE_BONEMERANG] = 1,
[MOVE_REST] = 0,
[MOVE_ROCK_SLIDE] = 1,
[MOVE_HYPER_FANG] = 1,
[MOVE_SHARPEN] = 0,
[MOVE_CONVERSION] = 0,
[MOVE_TRI_ATTACK] = 1,
[MOVE_SUPER_FANG] = 1,
[MOVE_SLASH] = 1,
[MOVE_SUBSTITUTE] = 0,
[MOVE_STRUGGLE] = 1,
[MOVE_SKETCH] = 0,
[MOVE_TRIPLE_KICK] = 1,
[MOVE_THIEF] = 1,
[MOVE_SPIDER_WEB] = 0,
[MOVE_MIND_READER] = 0,
[MOVE_NIGHTMARE] = 0,
[MOVE_FLAME_WHEEL] = 1,
[MOVE_SNORE] = 1,
[MOVE_CURSE] = 0,
[MOVE_FLAIL] = 1,
[MOVE_CONVERSION_2] = 0,
[MOVE_AEROBLAST] = 1,
[MOVE_COTTON_SPORE] = 0,
[MOVE_REVERSAL] = 1,
[MOVE_SPITE] = 0,
[MOVE_POWDER_SNOW] = 1,
[MOVE_PROTECT] = -1,
[MOVE_MACH_PUNCH] = 1,
[MOVE_SCARY_FACE] = 0,
[MOVE_FAINT_ATTACK] = 1,
[MOVE_SWEET_KISS] = 0,
[MOVE_BELLY_DRUM] = 0,
[MOVE_SLUDGE_BOMB] = 1,
[MOVE_MUD_SLAP] = 1,
[MOVE_OCTAZOOKA] = 1,
[MOVE_SPIKES] = 0,
[MOVE_ZAP_CANNON] = 1,
[MOVE_FORESIGHT] = 0,
[MOVE_DESTINY_BOND] = 0,
[MOVE_PERISH_SONG] = 0,
[MOVE_ICY_WIND] = 1,
[MOVE_DETECT] = -1,
[MOVE_BONE_RUSH] = 1,
[MOVE_LOCK_ON] = 0,
[MOVE_OUTRAGE] = 1,
[MOVE_SANDSTORM] = 0,
[MOVE_GIGA_DRAIN] = 1,
[MOVE_ENDURE] = -1,
[MOVE_CHARM] = 0,
[MOVE_ROLLOUT] = 1,
[MOVE_FALSE_SWIPE] = 1,
[MOVE_SWAGGER] = 0,
[MOVE_MILK_DRINK] = 0,
[MOVE_SPARK] = 1,
[MOVE_FURY_CUTTER] = 1,
[MOVE_STEEL_WING] = 1,
[MOVE_MEAN_LOOK] = 0,
[MOVE_ATTRACT] = 0,
[MOVE_SLEEP_TALK] = 0,
[MOVE_HEAL_BELL] = 0,
[MOVE_RETURN] = 1,
[MOVE_PRESENT] = 1,
[MOVE_FRUSTRATION] = 1,
[MOVE_SAFEGUARD] = 0,
[MOVE_PAIN_SPLIT] = 0,
[MOVE_SACRED_FIRE] = 1,
[MOVE_MAGNITUDE] = 1,
[MOVE_DYNAMIC_PUNCH] = 1,
[MOVE_MEGAHORN] = 1,
[MOVE_DRAGON_BREATH] = 1,
[MOVE_BATON_PASS] = 0,
[MOVE_ENCORE] = 0,
[MOVE_PURSUIT] = 1,
[MOVE_RAPID_SPIN] = 1,
[MOVE_SWEET_SCENT] = 0,
[MOVE_IRON_TAIL] = 1,
[MOVE_METAL_CLAW] = 1,
[MOVE_VITAL_THROW] = 1,
[MOVE_MORNING_SUN] = 0,
[MOVE_SYNTHESIS] = 0,
[MOVE_MOONLIGHT] = 0,
[MOVE_HIDDEN_POWER] = 1,
[MOVE_CROSS_CHOP] = 1,
[MOVE_TWISTER] = 1,
[MOVE_RAIN_DANCE] = 0,
[MOVE_SUNNY_DAY] = 0,
[MOVE_CRUNCH] = 1,
[MOVE_MIRROR_COAT] = 0,
[MOVE_PSYCH_UP] = 0,
[MOVE_EXTREME_SPEED] = 1,
[MOVE_ANCIENT_POWER] = 1,
[MOVE_SHADOW_BALL] = 1,
[MOVE_FUTURE_SIGHT] = 1,
[MOVE_ROCK_SMASH] = 1,
[MOVE_WHIRLPOOL] = 1,
[MOVE_BEAT_UP] = 1,
[MOVE_FAKE_OUT] = -1,
[MOVE_UPROAR] = 1,
[MOVE_STOCKPILE] = 0,
[MOVE_SPIT_UP] = 1,
[MOVE_SWALLOW] = 0,
[MOVE_HEAT_WAVE] = 1,
[MOVE_HAIL] = 0,
[MOVE_TORMENT] = 0,
[MOVE_FLATTER] = 0,
[MOVE_WILL_O_WISP] = 0,
[MOVE_MEMENTO] = 0,
[MOVE_FACADE] = 1,
[MOVE_FOCUS_PUNCH] = 1,
[MOVE_SMELLING_SALT] = 1,
[MOVE_FOLLOW_ME] = 0,
[MOVE_NATURE_POWER] = 0,
[MOVE_CHARGE] = 0,
[MOVE_TAUNT] = 0,
[MOVE_HELPING_HAND] = 0,
[MOVE_TRICK] = 0,
[MOVE_ROLE_PLAY] = 0,
[MOVE_WISH] = 0,
[MOVE_ASSIST] = 0,
[MOVE_INGRAIN] = 0,
[MOVE_SUPERPOWER] = 1,
[MOVE_MAGIC_COAT] = 0,
[MOVE_RECYCLE] = 0,
[MOVE_REVENGE] = 1,
[MOVE_BRICK_BREAK] = 1,
[MOVE_YAWN] = 0,
[MOVE_KNOCK_OFF] = 1,
[MOVE_ENDEAVOR] = 1,
[MOVE_ERUPTION] = 1,
[MOVE_SKILL_SWAP] = 0,
[MOVE_IMPRISON] = 0,
[MOVE_REFRESH] = 0,
[MOVE_GRUDGE] = 0,
[MOVE_SNATCH] = 0,
[MOVE_SECRET_POWER] = 1,
[MOVE_DIVE] = 1,
[MOVE_ARM_THRUST] = 1,
[MOVE_CAMOUFLAGE] = 0,
[MOVE_TAIL_GLOW] = 0,
[MOVE_LUSTER_PURGE] = 1,
[MOVE_MIST_BALL] = 1,
[MOVE_FEATHER_DANCE] = 0,
[MOVE_TEETER_DANCE] = 0,
[MOVE_BLAZE_KICK] = 1,
[MOVE_MUD_SPORT] = 0,
[MOVE_ICE_BALL] = 1,
[MOVE_NEEDLE_ARM] = 1,
[MOVE_SLACK_OFF] = 0,
[MOVE_HYPER_VOICE] = 1,
[MOVE_POISON_FANG] = 1,
[MOVE_CRUSH_CLAW] = 1,
[MOVE_BLAST_BURN] = 1,
[MOVE_HYDRO_CANNON] = 1,
[MOVE_METEOR_MASH] = 1,
[MOVE_ASTONISH] = 1,
[MOVE_WEATHER_BALL] = 1,
[MOVE_AROMATHERAPY] = 0,
[MOVE_FAKE_TEARS] = 0,
[MOVE_AIR_CUTTER] = 1,
[MOVE_OVERHEAT] = 1,
[MOVE_ODOR_SLEUTH] = 0,
[MOVE_ROCK_TOMB] = 1,
[MOVE_SILVER_WIND] = 1,
[MOVE_METAL_SOUND] = 0,
[MOVE_GRASS_WHISTLE] = 0,
[MOVE_TICKLE] = 0,
[MOVE_COSMIC_POWER] = 0,
[MOVE_WATER_SPOUT] = 1,
[MOVE_SIGNAL_BEAM] = 1,
[MOVE_SHADOW_PUNCH] = 1,
[MOVE_EXTRASENSORY] = 1,
[MOVE_SKY_UPPERCUT] = 1,
[MOVE_SAND_TOMB] = 1,
[MOVE_SHEER_COLD] = 1,
[MOVE_MUDDY_WATER] = 1,
[MOVE_BULLET_SEED] = 1,
[MOVE_AERIAL_ACE] = 1,
[MOVE_ICICLE_SPEAR] = 1,
[MOVE_IRON_DEFENSE] = 0,
[MOVE_BLOCK] = 0,
[MOVE_HOWL] = 0,
[MOVE_DRAGON_CLAW] = 1,
[MOVE_FRENZY_PLANT] = 1,
[MOVE_BULK_UP] = 0,
[MOVE_BOUNCE] = 1,
[MOVE_MUD_SHOT] = 1,
[MOVE_POISON_TAIL] = 1,
[MOVE_COVET] = 1,
[MOVE_VOLT_TACKLE] = 1,
[MOVE_MAGICAL_LEAF] = 1,
[MOVE_WATER_SPORT] = 0,
[MOVE_CALM_MIND] = 0,
[MOVE_LEAF_BLADE] = 1,
[MOVE_DRAGON_DANCE] = 0,
[MOVE_ROCK_BLAST] = 1,
[MOVE_SHOCK_WAVE] = 1,
[MOVE_WATER_PULSE] = 1,
[MOVE_DOOM_DESIRE] = 1,
[MOVE_PSYCHO_BOOST] = 1,
};
static const struct OamData sOamData_8611F24 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 15,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_8611F2C[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8611F34[] =
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8611F3C[] =
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8611F44[] =
{
ANIMCMD_FRAME(12, 1),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_8611F4C[] =
{
sSpriteAnim_8611F2C,
sSpriteAnim_8611F34,
sSpriteAnim_8611F3C,
sSpriteAnim_8611F44
};
static const struct SpriteTemplate sSpriteTemplate_JudgmentIcon =
{
.tileTag = 0x3E8,
.paletteTag = 0xFFFF,
.oam = &sOamData_8611F24,
.anims = sSpriteAnimTable_8611F4C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCb_JudgmentIcon,
};
static const struct CompressedSpriteSheet gUnknown_08611F74[] =
{
{gUnknown_08D854E8, 0x200, 0x3E8},
{0}
};
static void (* const gUnknown_08611F84[])(void) =
static void (* const sArenaFunctions[])(void) =
{
sub_81A58B4,
sub_81A5964,
@ -69,10 +489,10 @@ static const u16 gUnknown_08611FAC[9] =
// code
void CallBattleArenaFunction(void)
{
gUnknown_08611F84[gSpecialVar_0x8004]();
sArenaFunctions[gSpecialVar_0x8004]();
}
u8 sub_81A5258(u8 *state)
u8 BattleArena_ShowJudgmentWindow(u8 *state)
{
s32 i;
u8 ret = 0;
@ -120,7 +540,7 @@ u8 sub_81A5258(u8 *state)
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
for (i = 0; i < 8; i++)
{
u8 spriteId = CreateSprite(&gUnknown_08611F5C, 0x40 + (i * 0x10), 84, 0);
u8 spriteId = CreateSprite(&sSpriteTemplate_JudgmentIcon, 0x40 + (i * 0x10), 84, 0);
StartSpriteAnim(&gSprites[spriteId], 3);
}
ret = 1;
@ -129,8 +549,8 @@ u8 sub_81A5258(u8 *state)
break;
case 4:
PlaySE(SE_HANTEI1);
sub_81A5558(80, 40, 0, 0);
sub_81A5558(160, 40, 0, 1);
ShowJudgmentSprite(80, 40, 0, 0);
ShowJudgmentSprite(160, 40, 0, 1);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, 21);
(*state)++;
@ -138,8 +558,8 @@ u8 sub_81A5258(u8 *state)
break;
case 5:
PlaySE(SE_HANTEI1);
sub_81A5558(80, 56, 1, 0);
sub_81A5558(160, 56, 1, 1);
ShowJudgmentSprite(80, 56, 1, 0);
ShowJudgmentSprite(160, 56, 1, 1);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, 21);
(*state)++;
@ -147,8 +567,8 @@ u8 sub_81A5258(u8 *state)
break;
case 6:
PlaySE(SE_HANTEI1);
sub_81A5558(80, 72, 2, 0);
sub_81A5558(160, 72, 2, 1);
ShowJudgmentSprite(80, 72, 2, 0);
ShowJudgmentSprite(160, 72, 2, 1);
BattleStringExpandPlaceholdersToDisplayedString(gText_Judgement);
BattlePutTextOnWindow(gDisplayedStringBattle, 21);
(*state)++;
@ -197,32 +617,32 @@ u8 sub_81A5258(u8 *state)
return ret;
}
static void sub_81A5558(u8 x, u8 y, u8 arg2, u8 battler)
static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler)
{
s32 animNum = 0;
s32 r6 = 0;
s32 r1 = 0;
s8 *ptr1 = gBattleStruct->field_298;
s8 *ptr2 = gBattleStruct->field_29A;
u16 *ptr3 = gBattleStruct->field_29C;
s32 pointsPlayer = 0;
s32 pointsOpponent = 0;
s8 *mindPoints = gBattleStruct->arenaMindPoints;
s8 *skillPoints = gBattleStruct->arenaSkillPoints;
u16 *hpAtStart = gBattleStruct->arenaStartHp;
switch (arg2)
switch (category)
{
case 0:
r6 = ptr1[battler];
r1 = ptr1[BATTLE_OPPOSITE(battler)];
pointsPlayer = mindPoints[battler];
pointsOpponent = mindPoints[BATTLE_OPPOSITE(battler)];
break;
case 1:
r6 = ptr2[battler];
r1 = ptr2[BATTLE_OPPOSITE(battler)];
pointsPlayer = skillPoints[battler];
pointsOpponent = skillPoints[BATTLE_OPPOSITE(battler)];
break;
case 2:
r6 = (gBattleMons[battler].hp * 100) / ptr3[battler];
r1 = (gBattleMons[BATTLE_OPPOSITE(battler)].hp * 100) / ptr3[BATTLE_OPPOSITE(battler)];
pointsPlayer = (gBattleMons[battler].hp * 100) / hpAtStart[battler];
pointsOpponent = (gBattleMons[BATTLE_OPPOSITE(battler)].hp * 100) / hpAtStart[BATTLE_OPPOSITE(battler)];
break;
}
if (r6 > r1)
if (pointsPlayer > pointsOpponent)
{
animNum = 2;
if (battler != 0)
@ -230,7 +650,7 @@ static void sub_81A5558(u8 x, u8 y, u8 arg2, u8 battler)
else
gBattleTextBuff1[0] += 2;
}
else if (r6 == r1)
else if (pointsPlayer == pointsOpponent)
{
animNum = 1;
if (battler != 0)
@ -243,76 +663,76 @@ static void sub_81A5558(u8 x, u8 y, u8 arg2, u8 battler)
animNum = 0;
}
r6 = CreateSprite(&gUnknown_08611F5C, x, y, 0);
StartSpriteAnim(&gSprites[r6], animNum);
pointsPlayer = CreateSprite(&sSpriteTemplate_JudgmentIcon, x, y, 0);
StartSpriteAnim(&gSprites[pointsPlayer], animNum);
}
void sub_81A5698(struct Sprite *sprite)
static void SpriteCb_JudgmentIcon(struct Sprite *sprite)
{
if (gBattleCommunication[0] > 8)
DestroySprite(sprite);
}
void sub_81A56B4(void)
void BattleArena_InitPoints(void)
{
s8 *ptr1 = gBattleStruct->field_298;
s8 *ptr2 = gBattleStruct->field_29A;
u16 *ptr3 = gBattleStruct->field_29C;
s8 *mindPoints = gBattleStruct->arenaMindPoints;
s8 *skillPoints = gBattleStruct->arenaSkillPoints;
u16 *hpAtStart = gBattleStruct->arenaStartHp;
ptr1[0] = 0;
ptr1[1] = 0;
ptr2[0] = 0;
ptr2[1] = 0;
ptr3[0] = gBattleMons[0].hp;
ptr3[1] = gBattleMons[1].hp;
mindPoints[0] = 0;
mindPoints[1] = 0;
skillPoints[0] = 0;
skillPoints[1] = 0;
hpAtStart[0] = gBattleMons[0].hp;
hpAtStart[1] = gBattleMons[1].hp;
}
void sub_81A56E8(u8 battler)
void BattleArena_AddMindPoints(u8 battler)
{
s8 *ptr1 = gBattleStruct->field_298;
s8 *mindPoints = gBattleStruct->arenaMindPoints;
ptr1[battler] += gBattleArenaMoveMindRatings[gCurrentMove];
mindPoints[battler] += sMindRatings[gCurrentMove];
}
void sub_81A5718(u8 battler)
void BattleArena_AddSkillPoints(u8 battler)
{
s8 *ptr2 = gBattleStruct->field_29A;
s8 *skillPoints = gBattleStruct->arenaSkillPoints;
if (gHitMarker & HITMARKER_OBEYS)
{
u8 *ptr4 = &gBattleStruct->field_2A2;
if (*ptr4 & gBitTable[battler])
u8 *failedMoveBits = &gBattleStruct->alreadyStatusedMoveAttempt;
if (*failedMoveBits & gBitTable[battler])
{
*ptr4 &= ~(gBitTable[battler]);
ptr2[battler] -= 2;
*failedMoveBits &= ~(gBitTable[battler]);
skillPoints[battler] -= 2;
}
else if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
{
if (!(gMoveResultFlags & MOVE_RESULT_MISSED) || gBattleCommunication[6] != 1)
ptr2[battler] -= 2;
skillPoints[battler] -= 2;
}
else if (gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE && gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE)
{
ptr2[battler] += 1;
skillPoints[battler] += 1;
}
else if (gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE)
{
ptr2[battler] += 2;
skillPoints[battler] += 2;
}
else if (gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE)
{
ptr2[battler] -= 1;
skillPoints[battler] -= 1;
}
else if (!gProtectStructs[battler].protected)
{
ptr2[battler] += 1;
skillPoints[battler] += 1;
}
}
}
void sub_81A57E4(u8 battler, u16 stringId)
void BattleArena_DeductMindPoints(u8 battler, u16 stringId)
{
s8 *ptr2 = gBattleStruct->field_29A;
s8 *skillPoints = gBattleStruct->arenaSkillPoints;
switch (stringId)
{
@ -335,18 +755,18 @@ void sub_81A57E4(u8 battler, u16 stringId)
case STRINGID_PKMNANCHORSITSELFWITH:
case STRINGID_PKMNPREVENTSSTATLOSSWITH:
case STRINGID_PKMNSTAYEDAWAKEUSING:
ptr2[battler] -= 3;
skillPoints[battler] -= 3;
break;
}
}
void sub_81A586C(u8 battler)
void sub_81A586C(u8 battler) // Unused.
{
u16 *ptr3 = gBattleStruct->field_29C;
u16 *hpAtStart = gBattleStruct->arenaStartHp;
ptr3[battler] = gBattleMons[battler].hp;
if (ptr3[BATTLE_OPPOSITE(battler)] > gBattleMons[BATTLE_OPPOSITE(battler)].hp)
ptr3[BATTLE_OPPOSITE(battler)] = gBattleMons[BATTLE_OPPOSITE(battler)].hp;
hpAtStart[battler] = gBattleMons[battler].hp;
if (hpAtStart[BATTLE_OPPOSITE(battler)] > gBattleMons[BATTLE_OPPOSITE(battler)].hp)
hpAtStart[BATTLE_OPPOSITE(battler)] = gBattleMons[BATTLE_OPPOSITE(battler)].hp;
}
static void sub_81A58B4(void)

View File

@ -29,6 +29,9 @@
#include "pokeball.h"
#include "data2.h"
#include "battle_setup.h"
#include "battle_arena.h"
#include "battle_tower.h"
#include "frontier_util.h"
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
@ -38,11 +41,7 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern u8 GetFrontierBrainTrainerPicIndex(void);
extern u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
extern u8 GetEreaderTrainerFrontSpriteId(void);
// this file's functions
static void OpponentHandleGetMonData(void);
@ -1513,7 +1512,7 @@ static void OpponentHandlePrintString(void)
BufferStringBattle(*stringId);
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_81A57E4(gActiveBattler, *stringId);
BattleArena_DeductMindPoints(gActiveBattler, *stringId);
}
static void OpponentHandlePrintSelectionString(void)

View File

@ -32,6 +32,7 @@
#include "recorded_battle.h"
#include "party_menu.h"
#include "battle_dome.h"
#include "battle_arena.h"
extern u8 gUnknown_0203CEE8;
extern u8 gUnknown_0203CEE9;
@ -46,7 +47,6 @@ extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_81AABB0(void);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern void sub_81851A8(u8 *);
// this file's functions
@ -2537,7 +2537,7 @@ static void PlayerHandlePrintString(void)
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
BattleTv_SetDataBasedOnString(*stringId);
sub_81A57E4(gActiveBattler, *stringId);
BattleArena_DeductMindPoints(gActiveBattler, *stringId);
}
static void PlayerHandlePrintSelectionString(void)
@ -2600,9 +2600,11 @@ static void HandleChooseMoveAfterDma3(void)
}
}
// arenaMindPoints is used here as a placeholder for a timer.
static void PlayerChooseMoveInBattlePalace(void)
{
if (--*(gBattleStruct->field_298 + gActiveBattler) == 0)
if (--*(gBattleStruct->arenaMindPoints + gActiveBattler) == 0)
{
gBattlePalaceMoveSelectionRngValue = gRngValue;
BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace());
@ -2614,7 +2616,7 @@ static void PlayerHandleChooseMove(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
*(gBattleStruct->field_298 + gActiveBattler) = 8;
*(gBattleStruct->arenaMindPoints + gActiveBattler) = 8;
gBattlerControllerFuncs[gActiveBattler] = PlayerChooseMoveInBattlePalace;
}
else

View File

@ -1610,7 +1610,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
{
gSprites[ballIconSpritesIds[i]].oam.tileNum += 3;
}
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->field_2A0 & gBitTable[j]) // hmm...?
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->arenaLostPlayerMons & gBitTable[j])
{
gSprites[ballIconSpritesIds[i]].oam.tileNum += 3;
}
@ -1659,7 +1659,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo,
{
gSprites[ballIconSpritesIds[5 - var]].oam.tileNum += 3;
}
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->field_2A1 & gBitTable[j]) // hmm...?
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->arenaLostOpponentMons & gBitTable[j]) // hmm...?
{
gSprites[ballIconSpritesIds[5 - var]].oam.tileNum += 3;
}

View File

@ -53,6 +53,7 @@
#include "pokeball.h"
#include "party_menu.h"
#include "battle_tower.h"
#include "battle_arena.h"
struct UnknownPokemonStruct4
{
@ -109,9 +110,7 @@ extern const u8 gText_Love[];
// functions
extern void sub_81B9150(void);
extern void sub_80B3AF8(u8 taskId); // cable club
extern void sub_81A56B4(void); // battle frontier 2
extern u8 sub_81A9E28(void); // battle frontier 2
extern void sub_81A56E8(u8 battlerId); // battle frontier 2
extern void sub_81B8FB0(u8, u8); // party menu
extern u8 pokemon_order_func(u8); // party menu
extern bool8 InBattlePyramid(void);
@ -3085,8 +3084,8 @@ static void BattleStartClearSetData(void)
gBattleResults.shinyWildMon = IsMonShiny(&gEnemyParty[0]);
gBattleStruct->field_2A0 = 0;
gBattleStruct->field_2A1 = 0;
gBattleStruct->arenaLostPlayerMons = 0;
gBattleStruct->arenaLostOpponentMons = 0;
}
void SwitchInClearSetData(void)
@ -3423,7 +3422,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
}
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
sub_81A56B4();
BattleArena_InitPoints();
}
gBattleMainFunc = BattleIntroDrawPartySummaryScreens;
}
@ -5479,7 +5478,7 @@ static void HandleAction_UseMove(void)
}
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
sub_81A56E8(gBattlerAttacker);
BattleArena_AddMindPoints(gBattlerAttacker);
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}

View File

@ -43,6 +43,7 @@
#include "battle_setup.h"
#include "overworld.h"
#include "party_menu.h"
#include "battle_arena.h"
extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
@ -54,17 +55,13 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const u8* const gBattleScriptsForMoveEffects[];
// functions
extern void sub_81A5718(u8 battlerId); // battle frontier 2
extern void sub_81A56B4(void); // battle frontier 2
extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen
extern u8 sub_81C1B94(void); // pokemon summary screen
extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s
extern void sub_81D3640(u8 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s
extern void sub_81D3784(u8 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s
extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu
extern u8 sub_81A5258(u8* arg0); // battle frontier 2
extern void sub_81A5BF8(void); // battle frontier 2
extern void sub_81A5D44(void); // battle frontier 2
extern u8 BattleArena_ShowJudgmentWindow(u8* arg0); // battle frontier 2
extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu
extern bool8 sub_81B1250(void); // ?
extern bool8 InBattlePike(void);
@ -3549,7 +3546,7 @@ static void atk24(void)
for (i = 0; i < 6; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->field_2A0 & gBitTable[i])))
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i])))
{
HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP);
}
@ -3562,7 +3559,7 @@ static void atk24(void)
for (HP_count = 0, i = 0; i < 6; i++)
{
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->field_2A1 & gBitTable[i])))
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
{
HP_count += GetMonData(&gEnemyParty[i], MON_DATA_HP);
}
@ -4243,7 +4240,7 @@ static void atk3C_return(void)
static void atk3D_end(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
sub_81A5718(gBattlerAttacker);
BattleArena_AddSkillPoints(gBattlerAttacker);
gMoveResultFlags = 0;
gActiveBattler = 0;
@ -5000,7 +4997,7 @@ static void atk4E_switchinanim(void)
gBattlescriptCurrInstr += 3;
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
sub_81A56B4();
BattleArena_InitPoints();
}
static void atk4F_jumpifcantswitch(void)
@ -6697,34 +6694,34 @@ static void atk76_various(void)
gBattleCommunication[MULTISTRING_CHOOSER] = sUnknown_0831C4F8[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)];
}
break;
case 9:
i = sub_81A5258(gBattleCommunication);
case VARIOUS_ARENA_JUDGMENT_WINDOW:
i = BattleArena_ShowJudgmentWindow(&gBattleCommunication[0]);
if (i == 0)
return;
gBattleCommunication[1] = i;
break;
case 10:
case VARIOUS_ARENA_OPPONENT_MON_LOST:
gBattleMons[1].hp = 0;
gHitMarker |= HITMARKER_FAINTED(1);
gBattleStruct->field_2A1 |= gBitTable[gBattlerPartyIndexes[1]];
gBattleStruct->arenaLostOpponentMons |= gBitTable[gBattlerPartyIndexes[1]];
gDisableStructs[1].truantUnknownBit = 1;
break;
case 11:
case VARIOUS_ARENA_PLAYER_MON_LOST:
gBattleMons[0].hp = 0;
gHitMarker |= HITMARKER_FAINTED(0);
gHitMarker |= HITMARKER_x400000;
gBattleStruct->field_2A0 |= gBitTable[gBattlerPartyIndexes[0]];
gBattleStruct->arenaLostPlayerMons |= gBitTable[gBattlerPartyIndexes[0]];
gDisableStructs[0].truantUnknownBit = 1;
break;
case 12:
case VARIOUS_ARENA_BOTH_MONS_LOST:
gBattleMons[0].hp = 0;
gBattleMons[1].hp = 0;
gHitMarker |= HITMARKER_FAINTED(0);
gHitMarker |= HITMARKER_FAINTED(1);
gHitMarker |= HITMARKER_x400000;
gBattleStruct->field_2A0 |= gBitTable[gBattlerPartyIndexes[0]];
gBattleStruct->field_2A1 |= gBitTable[gBattlerPartyIndexes[1]];
gBattleStruct->arenaLostPlayerMons |= gBitTable[gBattlerPartyIndexes[0]];
gBattleStruct->arenaLostOpponentMons |= gBitTable[gBattlerPartyIndexes[1]];
gDisableStructs[0].truantUnknownBit = 1;
gDisableStructs[1].truantUnknownBit = 1;
break;
@ -6738,11 +6735,11 @@ static void atk76_various(void)
case 15:
sub_81A5D44();
break;
case 16:
case VARIOUS_ARENA_JUDGMENT_STRING:
BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]);
BattlePutTextOnWindow(gDisplayedStringBattle, 0x16);
break;
case 17:
case VARIOUS_ARENA_WAIT_STRING:
if (IsTextPrinterActive(0x16))
return;
break;
@ -6775,8 +6772,8 @@ static void atk76_various(void)
case VARIOUS_VOLUME_UP:
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
break;
case 23:
gBattleStruct->field_2A2 |= gBitTable[gActiveBattler];
case VARIOUS_SET_ALREADY_STATUS_MOVE_ATTEMPT:
gBattleStruct->alreadyStatusedMoveAttempt |= gBitTable[gActiveBattler];
break;
case 24:
if (sub_805725C(gActiveBattler))

View File

@ -1200,8 +1200,8 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
for (i = 0; i < 2; i++)
CancelMultiTurnMoves(i);
gBattlescriptCurrInstr = BattleScript_82DB8F3;
BattleScriptExecute(BattleScript_82DB8F3);
gBattlescriptCurrInstr = BattleScript_ArenaDoJudgment;
BattleScriptExecute(BattleScript_ArenaDoJudgment);
gBattleStruct->wishPerishSongState++;
return TRUE;
}