Merge remote-tracking branch 'upstream/battle_engine' into battle_engine

This commit is contained in:
Lukien 2021-01-31 22:46:27 -05:00
commit 9704049818
183 changed files with 4596 additions and 2964 deletions

8
.gitattributes vendored
View File

@ -10,6 +10,14 @@ Makefile text eol=lf
*.inc text eol=lf
*.sha1 text eol=lf
*.json text eol=lf
*.sed text eol=lf
*.cpp text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
*.hpp text eol=lf
*.md text eol=lf
*.ps1 text eol=crlf
*.yml text eol=lf
*.png binary
*.bin binary

1
.gitignore vendored
View File

@ -33,3 +33,4 @@ porymap.project.cfg
.vscode/
*.a
.fuse_hidden*
*.sna

View File

@ -63,13 +63,13 @@ ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN)
ifeq ($(MODERN),0)
CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g
ROM := pokeemerald.gba
OBJ_DIR := build/emerald
LIBPATH := -L ../../tools/agbcc/lib
else
CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g
ROM := pokeemerald_modern.gba
OBJ_DIR := build/modern
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"
@ -136,6 +136,9 @@ C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS))
ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s)
ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS))
# get all the data/*.s files EXCEPT the ones with specific rules
REGULAR_DATA_ASM_SRCS := $(filter-out $(DATA_ASM_SUBDIR)/maps.s $(DATA_ASM_SUBDIR)/map_events.s, $(wildcard $(DATA_ASM_SUBDIR)/*.s))
DATA_ASM_SRCS := $(wildcard $(DATA_ASM_SUBDIR)/*.s)
DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DATA_ASM_SRCS))
@ -275,23 +278,32 @@ endif
$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $$(c_asm_dep)
$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(NODEP),1)
$(ASM_BUILDDIR)/%.o: asm_dep :=
else
$(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) -I "" $(ASM_SUBDIR)/$*.s)
endif
# The dep rules have to be explicit or else missing files won't be reported.
# As a side effect, they're evaluated immediately instead of when the rule is invoked.
# It doesn't look like $(shell) can be deferred so there might not be a better way.
$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s $$(asm_dep)
ifeq ($(NODEP),1)
$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(NODEP),1)
$(DATA_ASM_BUILDDIR)/%.o: data_dep :=
else
$(DATA_ASM_BUILDDIR)/%.o: data_dep = $(shell $(SCANINC) -I include -I "" $(DATA_ASM_SUBDIR)/$*.s)
define ASM_DEP
$1: $2 $$(shell $(SCANINC) -I include -I "" $2)
$$(AS) $$(ASFLAGS) -o $$@ $$<
endef
$(foreach src, $(ASM_SRCS), $(eval $(call ASM_DEP,$(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o, $(src)),$(src))))
endif
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s $$(data_dep)
ifeq ($(NODEP),1)
$(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s
$(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@
else
define DATA_ASM_DEP
$1: $2 $$(shell $(SCANINC) -I include -I "" $2)
$$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@
endef
$(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src))))
endif
$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<

View File

@ -72,9 +72,9 @@
special CallBattleTowerFunc
.endm
@ Unknown. Destroys some link task if using wireless link. Wait for link?
.macro tower_unklink
setvar VAR_0x8004, BATTLE_TOWER_FUNC_13
@ Attempts to close link connection. Used when finishing a link multi challenge.
.macro tower_closelink
setvar VAR_0x8004, BATTLE_TOWER_FUNC_TRY_CLOSE_LINK
special CallBattleTowerFunc
.endm

View File

@ -1759,6 +1759,11 @@
.macro destroyabilitypopup
various BS_ABILITY_BATTLER, VARIOUS_DESTROY_ABILITY_POPUP
.endm
.macro gettotemboost ptr:req
various BS_ATTACKER, VARIOUS_TOTEM_BOOST
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req

View File

@ -1784,3 +1784,65 @@
setfieldeffectargument 2, \priority
dofieldeffect FLDEFF_SPARKLE
.endm
@ Set up a totem boost for the next battle.
@ 'battler' is the position of the mon you want to gain a boost. see B_POSITION_xx in include/constants/battle.h.
@ The rest of the arguments are the stat change values to each stat.
@ For example, giving the first opponent +1 to atk and -2 to speed would be: settotemboost B_POSITION_OPPONENT_LEFT, 1, 0, -2
.macro settotemboost battler:req, atk=0,def=0,speed=0,spatk=0,spdef=0,acc=0,evas=0
setvar VAR_0x8000, \battler
setvar VAR_0x8001, \atk
setvar VAR_0x8002, \def
setvar VAR_0x8003, \speed
setvar VAR_0x8004, \spatk
setvar VAR_0x8005, \spdef
setvar VAR_0x8006, \acc
setvar VAR_0x8007, \evas
special SetTotemBoost
.endm
@ useful totem boost macros
.macro totemboost_atk1 battler:req
settotemboost \battler, 1
.endm
.macro totemboost_def1 battler:req
settotemboost \battler, 0, 1
.endm
.macro totemboost_speed1 battler:req
settotemboost \battler, 0, 0, 1
.endm
.macro totemboost_spatk1 battler:req
settotemboost \battler, 0, 0, 0, 1
.endm
.macro totemboost_spdef1 battler:req
settotemboost \battler, 0, 0, 0, 0, 1
.endm
.macro totemboost_acc1 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 1
.endm
.macro totemboost_evas1 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 0, 1
.endm
.macro totemboost_atk2 battler:req
settotemboost \battler, 2
.endm
.macro totemboost_def2 battler:req
settotemboost \battler, 0, 2
.endm
.macro totemboost_speed2 battler:req
settotemboost \battler, 0, 0, 2
.endm
.macro totemboost_spatk2 battler:req
settotemboost \battler, 0, 0, 0, 2
.endm
.macro totemboost_spdef2 battler:req
settotemboost \battler, 0, 0, 0, 0, 2
.endm
.macro totemboost_acc2 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 2
.endm
.macro totemboost_evas2 battler:req
settotemboost \battler, 0, 0, 0, 0, 0, 0, 2
.endm

View File

@ -1,7 +1,11 @@
#!/bin/bash
OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
if [ $(($1)) -ge $((0x8000000)) ]; then
OPTIONS="--adjust-vma=0x8000000 --start-address=$(($1)) --stop-address=$(($1 + $2))"
else
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
fi
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
$OBJDUMP $OPTIONS pokeemerald.gba > pokeemerald.dump
diff -u baserom.dump pokeemerald.dump

View File

@ -79,23 +79,16 @@ struct CoordEvent
struct BgEvent
{
/*0x00*/u16 x;
/*0x02*/u16 y;
/*0x04*/u8 elevation;
/*0x05*/u8 kind;
/*0x08*/union { // carried over from diego's FR/LG work, seems to be the same struct
// in gen 3, "kind" (0x3 in BgEvent struct) determines the method to read the union.
u16 x, y;
u8 elevation;
u8 kind; // The "kind" field determines how to access bgUnion union below.
union {
u8 *script;
// hidden item type
struct {
u16 item;
u16 hiddenItemId; // flag offset to determine flag lookup
u16 hiddenItemId;
} hiddenItem;
// secret base type
u32 secretBaseId;
} bgUnion;
};

View File

@ -2,11 +2,41 @@
.equiv PCM_DMA_BUF_SIZE, 1584
.equiv C_V, 0x40
.equiv TONEDATA_TYPE_CGB, 0x07
.equiv TONEDATA_TYPE_FIX, 0x08
.equiv TONEDATA_TYPE_REV, 0x10
.equiv TONEDATA_TYPE_CMP, 0x20
.equiv TONEDATA_TYPE_SPL, 0x40 @ key split
.equiv TONEDATA_TYPE_RHY, 0x80 @ rhythm
.equiv TONEDATA_P_S_PAN, 0xc0
.equiv SOUND_CHANNEL_SF_START, 0x80
.equiv SOUND_CHANNEL_SF_STOP, 0x40
.equiv SOUND_CHANNEL_SF_SPECIAL, 0x20
.equiv SOUND_CHANNEL_SF_LOOP, 0x10
.equiv SOUND_CHANNEL_SF_IEC, 0x04
.equiv SOUND_CHANNEL_SF_ENV, 0x03
.equiv SOUND_CHANNEL_SF_ENV_ATTACK, 0x03
.equiv SOUND_CHANNEL_SF_ENV_DECAY, 0x02
.equiv SOUND_CHANNEL_SF_ENV_SUSTAIN, 0x01
.equiv SOUND_CHANNEL_SF_ENV_RELEASE, 0x00
.equiv SOUND_CHANNEL_SF_ON, (SOUND_CHANNEL_SF_START | SOUND_CHANNEL_SF_STOP | SOUND_CHANNEL_SF_IEC | SOUND_CHANNEL_SF_ENV)
.equiv CGB_CHANNEL_MO_PIT, 0x02
.equiv CGB_CHANNEL_MO_VOL, 0x01
.equiv WAVE_DATA_FLAG_LOOP, 0xC0
.equiv MPT_FLG_VOLSET, 0x01
.equiv MPT_FLG_VOLCHG, 0x03
.equiv MPT_FLG_PITSET, 0x04
.equiv MPT_FLG_PITCHG, 0x0C
.equiv MPT_FLG_START, 0x40
.equiv MPT_FLG_EXIST, 0x80
.macro struct_begin
.struct 0
.endm
@ -16,6 +46,28 @@
.struct \name + \size
.endm
struct_begin
struct_field o_WaveData_type, 2
struct_field o_WaveData_d1, 1
struct_field o_WaveData_flags, 1
struct_field o_WaveData_freq, 4
struct_field o_WaveData_loopStart, 4
struct_field o_WaveData_size, 4
struct_field o_WaveData_data, 0
struct_field WaveData_size, 0
struct_begin
struct_field o_ToneData_type, 1
struct_field o_ToneData_key, 1
struct_field o_ToneData_length, 1
struct_field o_ToneData_pan_sweep, 1
struct_field o_ToneData_wav, 4
struct_field o_ToneData_attack, 1
struct_field o_ToneData_decay, 1
struct_field o_ToneData_sustain, 1
struct_field o_ToneData_release, 1
struct_field ToneData_size, 0
struct_begin
struct_field o_SoundInfo_ident, 4
struct_field o_SoundInfo_pcmDmaCounter, 1
@ -32,8 +84,8 @@
struct_field o_SoundInfo_pcmFreq, 4
struct_field o_SoundInfo_divFreq, 4
struct_field o_SoundInfo_cgbChans, 4
struct_field o_SoundInfo_func, 4
struct_field o_SoundInfo_intp, 4
struct_field o_SoundInfo_MPlayMainHead, 4
struct_field o_SoundInfo_musicPlayerHead, 4
struct_field o_SoundInfo_CgbSound, 4
struct_field o_SoundInfo_CgbOscOff, 4
struct_field o_SoundInfo_MidiKeyToCgbFreq, 4
@ -46,7 +98,7 @@
struct_field SoundInfo_size, 0
struct_begin
struct_field o_SoundChannel_status, 1
struct_field o_SoundChannel_statusFlags, 1
struct_field o_SoundChannel_type, 1
struct_field o_SoundChannel_rightVolume, 1
struct_field o_SoundChannel_leftVolume, 1
@ -54,29 +106,29 @@
struct_field o_SoundChannel_decay, 1
struct_field o_SoundChannel_sustain, 1
struct_field o_SoundChannel_release, 1
struct_field o_SoundChannel_ky, 1
struct_field o_SoundChannel_ev, 1
struct_field o_SoundChannel_er, 1
struct_field o_SoundChannel_el, 1
struct_field o_SoundChannel_iev, 1
struct_field o_SoundChannel_iel, 1
struct_field o_SoundChannel_d1, 1
struct_field o_SoundChannel_d2, 1
struct_field o_SoundChannel_gt, 1
struct_field o_SoundChannel_mk, 1
struct_field o_SoundChannel_ve, 1
struct_field o_SoundChannel_pr, 1
struct_field o_SoundChannel_rp, 1
struct_field o_SoundChannel_d3, 3
struct_field o_SoundChannel_ct, 4
struct_field o_SoundChannel_key, 1
struct_field o_SoundChannel_envelopeVolume, 1
struct_field o_SoundChannel_envelopeVolumeRight, 1
struct_field o_SoundChannel_envelopeVolumeLeft, 1
struct_field o_SoundChannel_pseudoEchoVolume, 1
struct_field o_SoundChannel_pseudoEchoLength, 1
struct_field o_SoundChannel_dummy1, 1
struct_field o_SoundChannel_dummy2, 1
struct_field o_SoundChannel_gateTime, 1
struct_field o_SoundChannel_midiKey, 1
struct_field o_SoundChannel_velocity, 1
struct_field o_SoundChannel_priority, 1
struct_field o_SoundChannel_rhythmPan, 1
struct_field o_SoundChannel_dummy3, 3
struct_field o_SoundChannel_count, 4
struct_field o_SoundChannel_fw, 4
struct_field o_SoundChannel_freq, 4
struct_field o_SoundChannel_frequency, 4
struct_field o_SoundChannel_wav, 4
struct_field o_SoundChannel_cp, 4
struct_field o_SoundChannel_currentPointer, 4
struct_field o_SoundChannel_track, 4
struct_field o_SoundChannel_pp, 4
struct_field o_SoundChannel_np, 4
struct_field o_SoundChannel_d4, 4
struct_field o_SoundChannel_prevChannelPointer, 4
struct_field o_SoundChannel_nextChannelPointer, 4
struct_field o_SoundChannel_dummy4, 4
struct_field o_SoundChannel_xpi, 2
struct_field o_SoundChannel_xpc, 2
struct_field SoundChannel_size, 0
@ -112,8 +164,8 @@
struct_field o_MusicPlayerTrack_lfoDelay, 1
struct_field o_MusicPlayerTrack_lfoDelayC, 1
struct_field o_MusicPlayerTrack_priority, 1
struct_field o_MusicPlayerTrack_echoVolume, 1
struct_field o_MusicPlayerTrack_echoLength, 1
struct_field o_MusicPlayerTrack_pseudoEchoVolume, 1
struct_field o_MusicPlayerTrack_pseudoEchoLength, 1
struct_field o_MusicPlayerTrack_chan, 4
struct_field o_MusicPlayerTrack_ToneData_type, 1
struct_field o_MusicPlayerTrack_ToneData_key, 1
@ -159,41 +211,41 @@
struct_field MusicPlayerInfo_size, 0
struct_begin
struct_field o_CgbChannel_sf, 1
struct_field o_CgbChannel_ty, 1
struct_field o_CgbChannel_statusFlags, 1
struct_field o_CgbChannel_type, 1
struct_field o_CgbChannel_rightVolume, 1
struct_field o_CgbChannel_leftVolume, 1
struct_field o_CgbChannel_at, 1
struct_field o_CgbChannel_de, 1
struct_field o_CgbChannel_su, 1
struct_field o_CgbChannel_re, 1
struct_field o_CgbChannel_ky, 1
struct_field o_CgbChannel_ev, 1
struct_field o_CgbChannel_eg, 1
struct_field o_CgbChannel_ec, 1
struct_field o_CgbChannel_echoVolume, 1
struct_field o_CgbChannel_echoLength, 1
struct_field o_CgbChannel_d1, 1
struct_field o_CgbChannel_d2, 1
struct_field o_CgbChannel_gt, 1
struct_field o_CgbChannel_mk, 1
struct_field o_CgbChannel_ve, 1
struct_field o_CgbChannel_pr, 1
struct_field o_CgbChannel_rp, 1
struct_field o_CgbChannel_d3, 3
struct_field o_CgbChannel_d5, 1
struct_field o_CgbChannel_sg, 1
struct_field o_CgbChannel_attack, 1
struct_field o_CgbChannel_decay, 1
struct_field o_CgbChannel_sustain, 1
struct_field o_CgbChannel_release, 1
struct_field o_CgbChannel_key, 1
struct_field o_CgbChannel_envelopeVolume, 1
struct_field o_CgbChannel_envelopeGoal, 1
struct_field o_CgbChannel_envelopeCounter, 1
struct_field o_CgbChannel_pseudoEchoVolume, 1
struct_field o_CgbChannel_pseudoEchoLength, 1
struct_field o_CgbChannel_dummy1, 1
struct_field o_CgbChannel_dummy2, 1
struct_field o_CgbChannel_gateTime, 1
struct_field o_CgbChannel_midiKey, 1
struct_field o_CgbChannel_velocity, 1
struct_field o_CgbChannel_priority, 1
struct_field o_CgbChannel_rhythmPan, 1
struct_field o_CgbChannel_dummy3, 3
struct_field o_CgbChannel_dummy5, 1
struct_field o_CgbChannel_sustainGoal, 1
struct_field o_CgbChannel_n4, 1
struct_field o_CgbChannel_pan, 1
struct_field o_CgbChannel_panMask, 1
struct_field o_CgbChannel_mo, 1
struct_field o_CgbChannel_le, 1
struct_field o_CgbChannel_sw, 1
struct_field o_CgbChannel_fr, 4
struct_field o_CgbChannel_wp, 4
struct_field o_CgbChannel_cp, 4
struct_field o_CgbChannel_tp, 4
struct_field o_CgbChannel_pp, 4
struct_field o_CgbChannel_np, 4
struct_field o_CgbChannel_d4, 8
struct_field o_CgbChannel_modify, 1
struct_field o_CgbChannel_length, 1
struct_field o_CgbChannel_sweep, 1
struct_field o_CgbChannel_frequency, 4
struct_field o_CgbChannel_wavePointer, 4
struct_field o_CgbChannel_currentPointer, 4
struct_field o_CgbChannel_track, 4
struct_field o_CgbChannel_prevChannelPointer, 4
struct_field o_CgbChannel_nextChannelPointer, 4
struct_field o_CgbChannel_dummy4, 8
struct_field CgbChannel_size, 0

View File

@ -152,7 +152,7 @@ gBattleAnims_Moves::
.4byte Move_AMNESIA
.4byte Move_KINESIS
.4byte Move_SOFT_BOILED
.4byte Move_HI_JUMP_KICK
.4byte Move_HIGH_JUMP_KICK
.4byte Move_GLARE
.4byte Move_DREAM_EATER
.4byte Move_POISON_GAS
@ -281,7 +281,7 @@ gBattleAnims_Moves::
.4byte Move_MEMENTO
.4byte Move_FACADE
.4byte Move_FOCUS_PUNCH
.4byte Move_SMELLING_SALT
.4byte Move_SMELLING_SALTS
.4byte Move_FOLLOW_ME
.4byte Move_NATURE_POWER
.4byte Move_CHARGE
@ -768,7 +768,15 @@ gBattleAnims_Moves::
.4byte Move_JUNGLE_HEALING
.4byte Move_WICKED_BLOW
.4byte Move_SURGING_STRIKES
.4byte Move_COUNT @ cannot be reached, because last move is Surging Strikes
.4byte Move_THUNDER_CAGE
.4byte Move_DRAGON_ENERGY
.4byte Move_FREEZING_GLARE
.4byte Move_FIERY_WRATH
.4byte Move_THUNDEROUS_KICK
.4byte Move_GLACIAL_LANCE
.4byte Move_ASTRAL_BARRAGE
.4byte Move_EERIE_SPELL
.4byte Move_COUNT @ cannot be reached, because last move is Eerie Spell
.align 2
gBattleAnims_StatusConditions::
@ -817,6 +825,7 @@ gBattleAnims_General::
.4byte General_FormChange
.4byte General_SlideOffScreen
.4byte General_RestoreBg
.4byte General_TotemFlare
.align 2
gBattleAnims_Special::
@ -2365,8 +2374,8 @@ Move_FOCUS_BLAST:
loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT
loadspritegfx ANIM_TAG_METEOR
loadspritegfx ANIM_TAG_FLAT_ROCK
monbg ANIM_TARGET
monbgprio_28 ANIM_TARGET
monbg ANIM_ATK_PARTNER
monbgprio_28 ANIM_ATTACKER
setalpha 12, 8
call SetHighSpeedBg
createsprite gSuperpowerOrbSpriteTemplate, ANIM_TARGET, 2, 0
@ -2376,7 +2385,7 @@ Move_FOCUS_BLAST:
playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET
waitforvisualfinish
call UnsetHighSpeedBg
clearmonbg ANIM_TARGET
clearmonbg ANIM_ATK_PARTNER
blendoff
delay 1
end
@ -2800,28 +2809,42 @@ Move_FIRE_FANG:
end
Move_SHADOW_SNEAK:
loadspritegfx ANIM_TAG_LICK
setalpha 0, 16
delay 1
createvisualtask AnimTask_InitMementoShadow, 2
delay 1
createvisualtask AnimTask_MoveAttackerMementoShadow, 5
playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER
delay 48
playsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER
loadspritegfx ANIM_TAG_IMPACT
loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond
loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour
loadspritegfx ANIM_TAG_POISON_BUBBLE @Poison
loadspritegfx ANIM_TAG_HANDS_AND_FEET
monbg ANIM_ATTACKER
launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x0 0x7 0x0000
waitforvisualfinish
createvisualtask sub_8114470, 2
setalpha 0, 16
delay 1
playsewithpan SE_M_LICK, SOUND_PAN_TARGET
createsprite gLickSpriteTemplate, ANIM_TARGET, 2, 0, 0
createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 16, 1
playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER
launchtask AnimTask_TranslateMonEllipticalRespectSide 0x2 0x5 0x0 0x12 0x6 0x1 0x3
launchtask AnimTask_AttackerFadeToInvisible 0x2 0x1 0x1
waitforvisualfinish
clearmonbg ANIM_ATTACKER
invisible ANIM_ATTACKER
delay 0x1
launchtask AnimTask_DestinyBondWhiteShadow 0x5 0x2 0x0 0x30
delay 0x30
launchtask AnimTask_BlendColorCycle 0x2 0x6 ANIM_PAL_DEF 0x2 0x2 0x0 0xF 0x0
createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xfff6, 0xfff6, 0x0
call ShadowSneakMovement
createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xa, 0x14, 0x0
call ShadowSneakMovement
createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0xfffb, 0xa, 0x0
call ShadowSneakMovement
createsprite gShadowSneakImpactSpriteTemplate, ANIM_TARGET, 2, 0x11, 0xfff4, 0x0
call ShadowSneakMovement
waitforvisualfinish
visible ANIM_ATTACKER
launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x7 0x0 0x0000
waitforvisualfinish
clearmonbg_23 ANIM_TARGET
delay 1
blendoff
delay 1
end
ShadowSneakMovement:
playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET
launchtask AnimTask_ShakeMon 0x2 0x5 ANIM_TARGET 0x3 0x0 0x6 0x1
delay 0x4
return
Move_MUD_BOMB:
loadspritegfx ANIM_TAG_MUD_SAND
@ -14007,6 +14030,30 @@ Move_WICKED_BLOW::
Move_SURGING_STRIKES::
end @to do:
Move_THUNDER_CAGE::
end @to do:
Move_DRAGON_ENERGY::
end @to do:
Move_FREEZING_GLARE::
end @to do:
Move_FIERY_WRATH::
end @to do:
Move_THUNDEROUS_KICK::
end @to do:
Move_GLACIAL_LANCE::
end @to do:
Move_ASTRAL_BARRAGE::
end @to do:
Move_EERIE_SPELL::
end @to do:
@@@@@@@@@@@@@@@@@@@@@@@ GEN 1-3 @@@@@@@@@@@@@@@@@@@@@@@
Move_NONE:
Move_MIRROR_MOVE:
@ -17120,7 +17167,7 @@ Move_FACADE:
loopsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER, 24, 3
end
Move_SMELLING_SALT:
Move_SMELLING_SALTS:
loadspritegfx ANIM_TAG_TAG_HAND
loadspritegfx ANIM_TAG_SMELLINGSALT_EFFECT
createsprite gSmellingSaltsHandSpriteTemplate, ANIM_TARGET, 2, ANIM_TARGET, 0, 2
@ -20067,7 +20114,7 @@ Move_JUMP_KICK:
blendoff
end
Move_HI_JUMP_KICK:
Move_HIGH_JUMP_KICK:
loadspritegfx ANIM_TAG_HANDS_AND_FEET
loadspritegfx ANIM_TAG_IMPACT
monbg ANIM_DEF_PARTNER
@ -23941,6 +23988,7 @@ General_TurnTrap:
jumpargeq 0, TRAP_ANIM_WHIRLPOOL, Status_Whirlpool
jumpargeq 0, TRAP_ANIM_CLAMP, Status_Clamp
jumpargeq 0, TRAP_ANIM_SAND_TOMB, Status_SandTomb
jumpargeq 0, TRAP_ANIM_INFESTATION, Status_Infestation
goto Status_BindWrap
Status_BindWrap:
loadspritegfx ANIM_TAG_TENDRILS
@ -24014,6 +24062,22 @@ Status_SandTomb:
stopsound
end
Status_Infestation:
loadspritegfx ANIM_TAG_HANDS_AND_FEET @black color
loadspritegfx ANIM_TAG_SMALL_BUBBLES @circle particles
monbg ANIM_DEF_PARTNER
monbgprio_28 ANIM_TARGET
createvisualtask AnimTask_BlendBattleAnimPal, 10, ANIM_PAL_DEF, 0x2, 0x0, 0x9, 0x7320
launchtask AnimTask_ShakeMon 0x2 0x5 ANIM_TARGET 0x3 0x0 30 0x1
loopsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER, 0x0, 30
call InfestationVortex
call InfestationVortex
waitforvisualfinish
launchtask AnimTask_BlendBattleAnimPal 0xA 0x5 ANIM_PAL_DEF 0x2 0x9 0x0 0x7320
waitforvisualfinish
clearmonbg ANIM_DEF_PARTNER
end
General_HeldItemEffect:
loadspritegfx ANIM_TAG_THIN_RING
loadspritegfx ANIM_TAG_SPARKLE_2
@ -24337,6 +24401,36 @@ General_RestoreBg:
waitbgfadein
end
General_TotemFlare::
loadspritegfx ANIM_TAG_FOCUS_ENERGY
loadspritegfx ANIM_TAG_WHIP_HIT @green color
loadspritegfx ANIM_TAG_SWEAT_BEAD @blue color
loadspritegfx ANIM_TAG_PAW_PRINT @yellow color
monbg ANIM_ATTACKER
setblends 0x80c
playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER
launchtask AnimTask_BlendColorCycle 0x2 0x6 ANIM_PAL_ATK 0x0 0x6 0x0 0xb 0x1f
call RainbowEndureEffect
call RainbowEndureEffect
call RainbowEndureEffect
call RainbowEndureEffect
call RainbowEndureEffect
waitforvisualfinish
blendoff
clearmonbg ANIM_ATTACKER
end
RainbowEndureEffect:
launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2
delay 0x3
launchtemplate gEndureEnergySpriteTemplate 0x2 0x4 0x0 0xe 0x1c 0x1 @Red Buff
delay 0x3
launchtemplate gGreenEndureEnergySpriteTemplate 0x2 0x4 0x0 0xfffb 0xa 0x2
delay 0x3
launchtemplate gYellowEndureEnergySpriteTemplate 0x2 0x4 0x0 0x1c 0x1a 0x3
delay 0x3
return
SnatchMoveTrySwapFromSubstitute:
createvisualtask AnimTask_IsAttackerBehindSubstitute, 2
jumprettrue SnatchMoveSwapSubstituteForMon

View File

@ -1082,16 +1082,15 @@ BattleScript_EffectFinalGambit:
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
seteffectwithchance
tryfaintmon BS_TARGET, FALSE, NULL
jumpifmovehadnoeffect BattleScript_MoveEnd
dmgtocurrattackerhp
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
seteffectwithchance
tryfaintmon BS_ATTACKER, FALSE, NULL
tryfaintmon BS_TARGET, FALSE, NULL
jumpifmovehadnoeffect BattleScript_MoveEnd
goto BattleScript_MoveEnd
BattleScript_EffectHitSwitchTarget:
@ -2806,6 +2805,10 @@ BattleScript_EffectDoubleHit::
BattleScript_EffectRecoilIfMiss::
attackcanceler
accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
typecalc
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveMissedDoDamage
.endif
goto BattleScript_HitFromAtkString
BattleScript_MoveMissedDoDamage::
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_PrintMoveMissed
@ -2814,19 +2817,33 @@ BattleScript_MoveMissedDoDamage::
pause 0x40
resultmessage
waitmessage 0x40
.if B_CRASH_IF_TARGET_IMMUNE < GEN_4
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_MoveEnd
.endif
printstring STRINGID_PKMNCRASHED
waitmessage 0x40
damagecalc
typecalc
adjustdamage
.if B_CRASH_IF_TARGET_IMMUNE == GEN_4
manipulatedamage DMG_RECOIL_FROM_IMMUNE
.else
manipulatedamage DMG_RECOIL_FROM_MISS
.endif
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
.else
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED
.endif
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER, FALSE, NULL
.if B_CRASH_IF_TARGET_IMMUNE >= GEN_4
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
.else
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED
.endif
goto BattleScript_MoveEnd
BattleScript_EffectMist::
@ -5737,6 +5754,13 @@ BattleScript_PerishSongTakesLife::
tryfaintmon BS_ATTACKER, FALSE, NULL
end2
BattleScript_PerishBodyActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSWILLPERISHIN3TURNS
waitmessage 0x40
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000
return
BattleScript_PerishSongCountGoesDown::
printstring STRINGID_PKMNPERISHCOUNTFELL
waitmessage 0x40
@ -6169,6 +6193,12 @@ BattleScript_AttackerFormChangeEnd3::
call BattleScript_AttackerFormChange
end3
BattleScript_BallFetch::
call BattleScript_AbilityPopUp
printstring STRINGID_FETCHEDPOKEBALL
waitmessage 0x40
end3
BattleScript_TargetFormChange::
pause 0x5
copybyte gBattlerAbility, gBattlerTarget
@ -6193,6 +6223,32 @@ BattleScript_IllusionOff::
waitmessage 0x40
return
BattleScript_CottonDownActivates::
setbyte sFIXED_ABILITY_POPUP, TRUE
call BattleScript_AbilityPopUp
copybyte gEffectBattler, gBattlerTarget
savetarget
setbyte gBattlerTarget, 0x0
BattleScript_CottonDownLoop:
setstatchanger STAT_SPEED, 1, TRUE
jumpifbyteequal gBattlerTarget, gEffectBattler, BattleScript_CottonDownLoopIncrement
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED, BattleScript_CottonDownTargetSpeedCantGoLower
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatDownStringIds
waitmessage 0x40
goto BattleScript_CottonDownLoopIncrement
BattleScript_CottonDownTargetSpeedCantGoLower:
printstring STRINGID_STATSWONTDECREASE
waitmessage 0x40
BattleScript_CottonDownLoopIncrement:
addbyte gBattlerTarget, 0x1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_CottonDownLoop
BattleScript_CottonDownReturn:
restoretarget
destroyabilitypopup
return
BattleScript_AnticipationActivates::
pause 0x5
call BattleScript_AbilityPopUp
@ -6712,6 +6768,15 @@ BattleScript_SandstreamActivates::
call BattleScript_WeatherFormChanges
end3
BattleScript_SandSpitActivates::
pause 0x20
call BattleScript_AbilityPopUp
printstring STRINGID_ASANDSTORMKICKEDUP
waitstate
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL
call BattleScript_WeatherFormChanges
return
BattleScript_ShedSkinActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXCUREDYPROBLEM
@ -6772,12 +6837,12 @@ BattleScript_IntimidateActivatesLoop:
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented
#if B_UPDATED_INTIMIDATE >= GEN_8
.if B_UPDATED_INTIMIDATE >= GEN_8
jumpifability BS_TARGET, ABILITY_INNER_FOCUS, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_SCRAPPY, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_IntimidatePrevented
jumpifability BS_TARGET, ABILITY_OBLIVIOUS, BattleScript_IntimidatePrevented
#endif
.endif
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_IntimidateActivatesLoopIncrement
jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_IntimidateActivatesLoopIncrement
setgraphicalstatchangevalues
@ -7077,22 +7142,33 @@ BattleScript_MummyActivates::
waitmessage 0x40
return
BattleScript_AngryPointActivates::
BattleScript_TargetsStatWasMaxedOut::
call BattleScript_AbilityPopUp
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printstring STRINGID_ANGRYPOINTACTIVATES
printstring STRINGID_TARGETSSTATWASMAXEDOUT
waitmessage 0x40
return
BattleScript_TargetAbilityStatRaise::
BattleScript_BattlerAbilityStatRaiseOnSwitchIn::
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
waitanimation
printstring STRINGID_BATTLERABILITYRAISEDSTAT
waitmessage 0x40
end3
BattleScript_TargetAbilityStatRaiseOnMoveEnd::
call BattleScript_AbilityPopUp
statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
waitanimation
printstring STRINGID_TARGETABILITYSTATRAISE
printstring STRINGID_ABILITYRAISEDSTATDRASTICALLY
waitmessage 0x40
return
@ -7691,6 +7767,25 @@ BattleScript_PrintPlayerForfeitedLinkBattle::
waitmessage 0x40
end2
BattleScript_TotemFlaredToLife::
playanimation BS_ATTACKER, B_ANIM_TOTEM_FLARE, NULL
printstring STRINGID_AURAFLAREDTOLIFE
waitmessage 0x40
goto BattleScript_ApplyTotemVarBoost
BattleScript_TotemVar::
gettotemboost BattleScript_ApplyTotemVarBoost
BattleScript_TotemVarEnd:
end2
BattleScript_ApplyTotemVarBoost:
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TotemVarEnd
setgraphicalstatchangevalues
playanimation BS_SCRIPTING, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
BattleScript_TotemVarPrintStatMsg:
printfromtable gStatUpStringIds
waitmessage 0x40
goto BattleScript_TotemVar @loop until stats bitfield is empty
BattleScript_AnnounceAirLockCloudNine::
call BattleScript_AbilityPopUp
printstring STRINGID_AIRLOCKACTIVATES

View File

@ -443,7 +443,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyMultis:: @ 82421F2
end
BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyLinkMultis:: @ 82421FC
tower_unklink
tower_closelink
warp MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY, 255, 18, 6
waitstate
end

View File

@ -104,7 +104,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 25,
"y": 8,
"elevation": 3,

View File

@ -28,7 +28,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 4,
"y": 4,
"elevation": 3,

View File

@ -247,7 +247,11 @@ MossdeepCity_SpaceCenter_1F_EventScript_Grunt2:: @ 822321F
copyobjectxytoperm LOCALID_STAIR_GRUNT
switch VAR_FACING
case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsWest
case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast @ BUG: This was meant to be case DIR_EAST
#ifdef BUGFIX
case DIR_EAST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast
#else
case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast
#endif
applymovement LOCALID_STAIR_GRUNT, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairs
waitmovement 0
setvar VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 2

View File

@ -78,7 +78,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 39,
"y": 4,
"elevation": 3,

View File

@ -468,7 +468,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 31,
"y": 6,
"elevation": 3,
@ -481,7 +481,7 @@
"flag": "FLAG_HIDE_ROUTE_119_KECLEON_1"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 25,
"y": 15,
"elevation": 3,

View File

@ -403,7 +403,7 @@
"flag": "FLAG_ITEM_ROUTE_120_HYPER_POTION"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 12,
"y": 16,
"elevation": 4,
@ -412,8 +412,8 @@
"movement_range_y": 1,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "Route120_EventScript_InvisibleBridgeKecleon",
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_INVISIBLE"
"script": "Route120_EventScript_BridgeKecleon",
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE"
},
{
"graphics_id": "OBJ_EVENT_GFX_STEVEN",
@ -481,7 +481,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_2",
"graphics_id": "OBJ_EVENT_GFX_KECLEON_BRIDGE_SHADOW",
"x": 12,
"y": 16,
"elevation": 3,
@ -491,10 +491,10 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "0x0",
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_VISIBLE"
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_SHADOW"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 20,
"y": 11,
"elevation": 3,
@ -507,7 +507,7 @@
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_1"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 27,
"y": 2,
"elevation": 3,
@ -520,7 +520,7 @@
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_2"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 4,
"y": 77,
"elevation": 3,
@ -533,7 +533,7 @@
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_3"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 7,
"y": 51,
"elevation": 3,
@ -546,7 +546,7 @@
"flag": "FLAG_HIDE_ROUTE_120_KECLEON_5"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 19,
"y": 48,
"elevation": 3,

View File

@ -1,6 +1,6 @@
.set LOCALID_INVISIBLE_BRIDGE_KECLEON, 30
.set LOCALID_BRIDGE_KECLEON, 30
.set LOCALID_STEVEN, 31
.set LOCALID_VISIBLE_BRIDGE_KECLEON, 36
.set LOCALID_BRIDGE_KECLEON_SHADOW, 36 @ They use a second object which is identical to Kecleon but has a reflection palette tag for the bridge shadow
Route120_MapScripts:: @ 81F53EC
map_script MAP_SCRIPT_ON_RESUME, Route120_OnResume
@ -31,8 +31,8 @@ Route120_EventScript_RemoveBridgeKecleon:: @ 81F5449
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
removeobject LOCALID_INVISIBLE_BRIDGE_KECLEON
removeobject LOCALID_VISIBLE_BRIDGE_KECLEON
removeobject LOCALID_BRIDGE_KECLEON
removeobject LOCALID_BRIDGE_KECLEON_SHADOW
return
Route120_EventScript_RemoveKecleon:: @ 81F5460
@ -61,7 +61,7 @@ Route120_EventScript_SetBridgeClearMetatiles:: @ 81F54A3
return
Route120_EventScript_SetBridgeKecleonMovement:: @ 81F54C8
setobjectmovementtype LOCALID_VISIBLE_BRIDGE_KECLEON, MOVEMENT_TYPE_FACE_RIGHT
setobjectmovementtype LOCALID_BRIDGE_KECLEON_SHADOW, MOVEMENT_TYPE_FACE_RIGHT
return
Route120_OnTransition: @ 81F54CD
@ -205,9 +205,9 @@ Route120_EventScript_StevenBattleKecleon:: @ 81F568B
delay 20
msgbox Route120_Text_StevenUsedDevonScope, MSGBOX_DEFAULT
closemessage
applymovement LOCALID_INVISIBLE_BRIDGE_KECLEON, Common_Movement_WalkInPlaceFastestRight
applymovement LOCALID_BRIDGE_KECLEON, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
applymovement LOCALID_INVISIBLE_BRIDGE_KECLEON, Movement_KecleonAppears
applymovement LOCALID_BRIDGE_KECLEON, Movement_KecleonAppears
waitmovement 0
waitse
playmoncry SPECIES_KECLEON, 2
@ -230,8 +230,8 @@ Route120_EventScript_StevenBattleKecleon:: @ 81F568B
Route120_EventScript_RemoveBridgeKecleonPostBattle:: @ 81F571C
fadescreenswapbuffers FADE_TO_BLACK
removeobject LOCALID_INVISIBLE_BRIDGE_KECLEON
removeobject LOCALID_VISIBLE_BRIDGE_KECLEON
removeobject LOCALID_BRIDGE_KECLEON
removeobject LOCALID_BRIDGE_KECLEON_SHADOW
fadescreenswapbuffers FADE_FROM_BLACK
goto Route120_EventScript_StevenGiveDeconScope
end
@ -276,7 +276,7 @@ Route120_Movement_ApproachKecleonWest: @ 81F57B9
walk_left
step_end
Route120_EventScript_InvisibleBridgeKecleon:: @ 81F57BC
Route120_EventScript_BridgeKecleon:: @ 81F57BC
msgbox Kecleon_Text_SomethingUnseeable, MSGBOX_NPC
end

View File

@ -28,7 +28,7 @@
"flag": "0"
},
{
"graphics_id": "OBJ_EVENT_GFX_KECLEON_1",
"graphics_id": "OBJ_EVENT_GFX_KECLEON",
"x": 2,
"y": 3,
"elevation": 3,

View File

@ -535,3 +535,4 @@ gSpecials:: @ 81DBA64
def_special RemoveRecordsWindow
def_special CloseDeptStoreElevatorWindow
def_special TrySetBattleTowerLinkType
def_special SetTotemBoost

View File

@ -1,7 +1,7 @@
# Bugs and Glitches
These are known bugs and glitches in the original Pokémon Emerald game: code that clearly does not work as intended, or that only works in limited circumstances but has the possibility to fail or crash.
These are known bugs and glitches in the original Pokémon Emerald game: code that clearly does not work as intended, or that only works in limited circumstances but has the possibility to fail or crash. Defining the `BUGFIX` preprocessor variable will fix some of these automatically.
Fixes are written in the `diff` format. If you've used Git before, this should look familiar:
@ -60,7 +60,7 @@ void CB2_InitTitleScreen(void)
SetGpuReg(REG_OFFSET_BLDY, 0);
...
```
This matches with the code of FR/LG and does what GF originally wanted to do.
This matches what FRLG does and obtains the seed differently than RS, independently of the RTC.
## Scrolling through items in the bag causes the image to flicker
@ -95,3 +95,21 @@ Then edit `BagMenu_MoveCursorCallback` in [src/item_menu.c](https://github.com/p
if (a != -2)
...
```
## Pokémon that have an affine transform as part of their entry animation glitch when going in and out of Poké Balls without a screen transition in between
**Fix:** Edit `sub_817F77C` in [src/pokemon_animation.c](https://github.com/pret/pokeemerald/blob/master/src/pokemon_animation.c#L1028):
```diff
...
-#ifdef BUGFIX
else
{
// FIX: Reset these back to normal after they were changed so Poké Ball catch/release
// animations without a screen transition in between don't break
sprite->affineAnimPaused = FALSE;
sprite->affineAnims = gUnknown_082FF694;
}
-#endif // BUGFIX
}
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 681 B

After

Width:  |  Height:  |  Size: 681 B

View File

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 627 B

View File

@ -702,7 +702,11 @@ struct BattleSpriteData
struct MonSpritesGfx
{
void* firstDecompressed; // ptr to the decompressed sprite of the first pokemon
void* sprites[4];
union
{
void* ptr[4];
u8* byte[4];
} sprites;
struct SpriteTemplate templates[4];
struct SpriteFrameImage field_74[4][4];
u8 field_F4[0x80];
@ -711,6 +715,12 @@ struct MonSpritesGfx
u16 *buffer;
};
struct TotemBoost
{
u8 stats; // bitfield for each battle stat that is set if the stat changes
s8 statChanges[NUM_BATTLE_STATS - 1]; // highest bit being set decreases the stat
}; /* size = 8 */
// All battle variables are declared in battle_main.c
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
@ -819,6 +829,7 @@ extern u32 gFieldStatuses;
extern struct FieldTimer gFieldTimers;
extern u8 gBattlerAbility;
extern u16 gPartnerSpriteId;
extern struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT];
extern void (*gPreBattleCallback1)(void);
extern void (*gBattleMainFunc)(void);
@ -829,5 +840,7 @@ extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gMultiUsePlayerCursor;
extern u8 gNumberOfMovesToChoose;
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
extern bool8 gHasFetchedBall;
extern u8 gLastUsedBall;
#endif // GUARD_BATTLE_H

View File

@ -1,8 +1,6 @@
#ifndef GUARD_BATTLE_DEBUG_H
#define GUARD_BATTLE_DEBUG_H
#define USE_BATTLE_DEBUG TRUE
void CB2_BattleDebugMenu(void);
#endif // GUARD_BATTLE_DEBUG_H

View File

@ -286,6 +286,7 @@ extern const u8 gText_BattleWallyName[];
extern const u8 gText_Win[];
extern const u8 gText_Loss[];
extern const u8 gText_Draw[];
extern const u8 gText_StatSharply[];
extern const u8 gText_StatRose[];
extern const u8 gText_PkmnsStatChanged2[];
extern const u8 gText_PkmnGettingPumped[];

View File

@ -249,8 +249,8 @@ extern const u8 BattleScript_SturdiedMsg[];
extern const u8 BattleScript_GravityEnds[];
extern const u8 BattleScript_MoveStatDrain[];
extern const u8 BattleScript_MoveStatDrain_PPLoss[];
extern const u8 BattleScript_TargetAbilityStatRaise[];
extern const u8 BattleScript_AngryPointActivates[];
extern const u8 BattleScript_TargetAbilityStatRaiseOnMoveEnd[];
extern const u8 BattleScript_TargetsStatWasMaxedOut[];
extern const u8 BattleScript_AttackerAbilityStatRaise[];
extern const u8 BattleScript_AttackerAbilityStatRaiseEnd3[];
extern const u8 BattleScript_PoisonHealActivates[];
@ -349,6 +349,13 @@ extern const u8 BattleScript_EmergencyExitNoPopUp[];
extern const u8 BattleScript_EmergencyExitWild[];
extern const u8 BattleScript_EmergencyExitWildNoPopUp[];
extern const u8 BattleScript_CheekPouchActivates[];
extern const u8 BattleScript_TotemVar[];
extern const u8 BattleScript_TotemFlaredToLife[];
extern const u8 BattleScript_AnnounceAirLockCloudNine[];
extern const u8 BattleScript_BattlerAbilityStatRaiseOnSwitchIn[];
extern const u8 BattleScript_CottonDownActivates[];
extern const u8 BattleScript_BallFetch[];
extern const u8 BattleScript_SandSpitActivates[];
extern const u8 BattleScript_PerishBodyActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -83,6 +83,6 @@ u8 GetFrontierEnemyMonLevel(u8 lvlMode);
s32 GetHighestLevelInPlayerParty(void);
u8 FacilityClassToGraphicsId(u8 facilityClass);
bool32 ValidateBattleTowerRecord(u8 recordId); // unused
void sub_8166188(void);
void TrySetLinkBattleTowerEnemyPartyLevel(void);
#endif //GUARD_BATTLE_TOWER_H

View File

@ -15,9 +15,6 @@
// printing system. Use NoCashGBAPrint() and NoCashGBAPrintf() like you
// would normally use AGBPrint() and AGBPrintf().
// NOTE: Don't try to enable assert right now as many pointers
// still exist in defines and WILL likely result in a broken ROM.
#define ENGLISH
#ifdef ENGLISH
@ -26,9 +23,12 @@
#define UNITS_METRIC
#endif
// Uncomment to fix some identified minor bugs
//#define BUGFIX
// Various undefined behavior bugs may or may not prevent compilation with
// newer compilers. So always fix them when using a modern compiler.
#if MODERN
#if MODERN || defined(BUGFIX)
#ifndef UBFIX
#define UBFIX
#endif

View File

@ -526,6 +526,7 @@
#define B_ANIM_FORM_CHANGE 0x1D
#define B_ANIM_SLIDE_OFFSCREEN 0x1E // for Emergency Exit
#define B_ANIM_RESTORE_BG 0x1F // for Terrain Endings
#define B_ANIM_TOTEM_FLARE 0x20 // Totem boosts aura flare
// special animations table
#define B_ANIM_LVL_UP 0x0
@ -559,6 +560,7 @@
#define TRAP_ANIM_WHIRLPOOL 2
#define TRAP_ANIM_CLAMP 3
#define TRAP_ANIM_SAND_TOMB 4
#define TRAP_ANIM_INFESTATION 5
// Weather defines for battle animation scripts.
#define ANIM_WEATHER_NONE 0

View File

@ -111,9 +111,10 @@
#define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
#define B_PP_REDUCED_BY_SPITE GEN_6 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5.
#define B_CAN_SPITE_FAIL GEN_6 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP.
#define B_CRASH_IF_TARGET_IMMUNE GEN_6 // In Gen4+, The user of Jump Kick or Hi Jump Kick will "keep going and crash" if it attacks a target that is immune to the move.
// Ability settings
#define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move.
#define B_ABILITY_WEATHER GEN_6 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move.
#define B_GALE_WINGS GEN_6 // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.
#define B_GHOSTS_ESCAPE GEN_6 // In Gen6+, ghosts can escape even when blocked by abilities such as Shadow Tag.
@ -125,9 +126,11 @@
// Item settings
#define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end.
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
// Flag settings.
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag for toggling the feature.
// Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
#define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water.
#define B_FLAG_FORCE_DOUBLE_WILD 0 // If this flag is set, all land and surfing wild battles will be double battles.
@ -149,23 +152,24 @@
#define B_STEEL_RESISTANCES GEN_6 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark and Ghost moves.
// Animation Settings
#define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle.
#define B_NEW_LEECH_SEED_PARTICLE TRUE // If set to TRUE, it updates Leech Seed's animation particle.
#define B_NEW_HORN_ATTACK_PARTICLE TRUE // If set to TRUE, it updates Horn Attack's horn particle.
#define B_NEW_LEAF_PARTICLE TRUE // If set to TRUE, it updates leaf particle.
#define B_NEW_EMBER_PARTICLES TRUE // If set to TRUE, it updates Ember's fire particle.
#define B_NEW_MEAN_LOOK_PARTICLE TRUE // If set to TRUE, it updates Mean Look's eye particle.
#define B_NEW_TEETH_PARTICLE TRUE // If set to TRUE, it updates Bite/Crunch teeth particle.
#define B_NEW_HANDS_FEET_PARTICLE TRUE // If set to TRUE, it updates chop/kick/punch particles.
#define B_NEW_SPIKES_PARTICLE TRUE // If set to TRUE, it updates Spikes particle.
#define B_NEW_FLY_BUBBLE_PARTICLE TRUE // If set to TRUE, it updates Fly's 'bubble' particle.
#define B_NEW_CURSE_NAIL_PARTICLE TRUE // If set to TRUE, it updates Curse's nail.
#define B_NEW_BATON_PASS_BALL_PARTICLE TRUE // If set to TRUE, it updates Baton Pass' Poké Ball sprite.
#define B_NEW_MORNING_SUN_STAR_PARTICLE TRUE // If set to TRUE, it updates Morning Sun's star particles.
#define B_NEW_IMPACT_PALETTE TRUE // If set to TRUE, it updates the basic 'hit' palette.
#define B_NEW_SURF_PARTICLE_PALETTE TRUE // If set to TRUE, it updates Surf's wave palette.
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.
#define B_NEW_LEECH_SEED_PARTICLE FALSE // If set to TRUE, it updates Leech Seed's animation particle.
#define B_NEW_HORN_ATTACK_PARTICLE FALSE // If set to TRUE, it updates Horn Attack's horn particle.
#define B_NEW_LEAF_PARTICLE FALSE // If set to TRUE, it updates leaf particle.
#define B_NEW_EMBER_PARTICLES FALSE // If set to TRUE, it updates Ember's fire particle.
#define B_NEW_MEAN_LOOK_PARTICLE FALSE // If set to TRUE, it updates Mean Look's eye particle.
#define B_NEW_TEETH_PARTICLE FALSE // If set to TRUE, it updates Bite/Crunch teeth particle.
#define B_NEW_HANDS_FEET_PARTICLE FALSE // If set to TRUE, it updates chop/kick/punch particles.
#define B_NEW_SPIKES_PARTICLE FALSE // If set to TRUE, it updates Spikes particle.
#define B_NEW_FLY_BUBBLE_PARTICLE FALSE // If set to TRUE, it updates Fly's 'bubble' particle.
#define B_NEW_CURSE_NAIL_PARTICLE FALSE // If set to TRUE, it updates Curse's nail.
#define B_NEW_BATON_PASS_BALL_PARTICLE FALSE // If set to TRUE, it updates Baton Pass' Poké Ball sprite.
#define B_NEW_MORNING_SUN_STAR_PARTICLE FALSE // If set to TRUE, it updates Morning Sun's star particles.
#define B_NEW_IMPACT_PALETTE FALSE // If set to TRUE, it updates the basic 'hit' palette.
#define B_NEW_SURF_PARTICLE_PALETTE FALSE // If set to TRUE, it updates Surf's wave palette.
#define HIDE_HEALTHBOXES_DURING_ANIMS TRUE //if TRUE, hides healthboxes during move animations
#define B_TERRAIN_BG_CHANGE TRUE // If TRUE, terrain moves permanently change the default battle background until the effect fades.
#define B_HIDE_HEALTHBOXES_DURING_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
#define B_ENABLE_DEBUG TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H

View File

@ -52,7 +52,7 @@
#define MAX_BATTLE_FRONTIER_POINTS 9999
#define MAX_STREAK 9999
// These sets of facility ids would be redunant if the order was consistent
// These sets of facility ids would be redundant if the order was consistent
// The order is important for this set so that all the non-link records can be continuous
#define RANKING_HALL_BATTLE_TOWER_SINGLES 0
#define RANKING_HALL_BATTLE_TOWER_DOUBLES 1

View File

@ -167,6 +167,7 @@
#define VARIOUS_PARALYZE_TYPE_IMMUNITY 100
#define VARIOUS_JUMP_IF_ABSENT 101
#define VARIOUS_DESTROY_ABILITY_POPUP 102
#define VARIOUS_TOTEM_BOOST 103
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0
@ -177,6 +178,7 @@
#define DMG_CURR_ATTACKER_HP 5
#define DMG_BIG_ROOT 6
#define DMG_1_2_ATTACKER_HP 7
#define DMG_RECOIL_FROM_IMMUNE 8 // Used to calculate recoil for the Gen 4 version of Jump Kick
// Cmd_jumpifcantswitch
#define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80

View File

@ -452,7 +452,7 @@
#define STRINGID_PSYCHICTERRAINENDS 448
#define STRINGID_GRASSYTERRAINENDS 449
#define STRINGID_TARGETABILITYSTATRAISE 450
#define STRINGID_ANGRYPOINTACTIVATES 451
#define STRINGID_TARGETSSTATWASMAXEDOUT 451
#define STRINGID_ATTACKERABILITYSTATRAISE 452
#define STRINGID_POISONHEALHPUP 453
#define STRINGID_BADDREAMSDMG 454
@ -558,8 +558,14 @@
#define STRINGID_AURABREAKENTERS 554
#define STRINGID_COMATOSEENTERS 555
#define STRINGID_SCREENCLEANERENTERS 556
#define STRINGID_FETCHEDPOKEBALL 557
#define STRINGID_BATTLERABILITYRAISEDSTAT 558
#define STRINGID_ASANDSTORMKICKEDUP 559
#define STRINGID_PKMNSWILLPERISHIN3TURNS 560
#define STRINGID_ABILITYRAISEDSTATDRASTICALLY 561
#define STRINGID_AURAFLAREDTOLIFE 562
#define BATTLESTRINGS_COUNT 557
#define BATTLESTRINGS_COUNT 563
//// multichoice message IDs
// switch in ability message

View File

@ -14,7 +14,7 @@
#define BATTLE_TOWER_FUNC_LOAD_PARTNERS 10
#define BATTLE_TOWER_FUNC_PARTNER_MSG 11
#define BATTLE_TOWER_FUNC_LOAD_LINK_OPPONENTS 12
#define BATTLE_TOWER_FUNC_13 13
#define BATTLE_TOWER_FUNC_TRY_CLOSE_LINK 13
#define BATTLE_TOWER_FUNC_SET_PARTNER_GFX 14
#define BATTLE_TOWER_FUNC_SET_INTERVIEW_DATA 15

View File

@ -205,7 +205,7 @@
#define OBJ_EVENT_GFX_REGICE 201
#define OBJ_EVENT_GFX_REGISTEEL 202
#define OBJ_EVENT_GFX_SKITTY 203
#define OBJ_EVENT_GFX_KECLEON_1 204
#define OBJ_EVENT_GFX_KECLEON 204
#define OBJ_EVENT_GFX_KYOGRE_2 205
#define OBJ_EVENT_GFX_GROUDON_2 206
#define OBJ_EVENT_GFX_RAYQUAZA_2 207
@ -213,7 +213,7 @@
#define OBJ_EVENT_GFX_PIKACHU 209
#define OBJ_EVENT_GFX_AZUMARILL 210
#define OBJ_EVENT_GFX_WINGULL 211
#define OBJ_EVENT_GFX_KECLEON_2 212
#define OBJ_EVENT_GFX_KECLEON_BRIDGE_SHADOW 212
#define OBJ_EVENT_GFX_TUBER_M_SWIMMING 213
#define OBJ_EVENT_GFX_AZURILL 214
#define OBJ_EVENT_GFX_MOM 215

View File

@ -1012,7 +1012,7 @@
#define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_STEVEN 0x3C7
#define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_BELDUM_POKEBALL 0x3C8
#define FLAG_HIDE_FORTREE_CITY_KECLEON 0x3C9
#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_INVISIBLE 0x3CA
#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE 0x3CA
#define FLAG_HIDE_LILYCOVE_CITY_RIVAL 0x3CB
#define FLAG_HIDE_ROUTE_120_STEVEN 0x3CC
#define FLAG_HIDE_SOOTOPOLIS_CITY_STEVEN 0x3CD
@ -1023,7 +1023,7 @@
#define FLAG_HIDE_AQUA_HIDEOUT_B1F_ELECTRODE_2 0x3D2
#define FLAG_HIDE_OLDALE_TOWN_RIVAL 0x3D3
#define FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE 0x3D4
#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_VISIBLE 0x3D5
#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_SHADOW 0x3D5
#define FLAG_HIDE_ROUTE_120_KECLEON_1 0x3D6
#define FLAG_HIDE_RUSTURF_TUNNEL_WANDA 0x3D7
#define FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WANDA 0x3D8

View File

@ -2,11 +2,14 @@
#define GUARD_CONSTANTS_ITEM_EFFECTS_H
// field 0 masks
#ifndef ITEM_EXPANSION
#define ITEM0_X_ATTACK 0x0F
#endif
#define ITEM0_DIRE_HIT 0x30 // Works the same way as the move Focus Energy.
#define ITEM0_SACRED_ASH 0x40
#define ITEM0_INFATUATION 0x80
#ifndef ITEM_EXPANSION
// field 1 masks
#define ITEM1_X_SPEED 0x0F
#define ITEM1_X_DEFEND 0xF0
@ -14,6 +17,15 @@
// field 2 masks
#define ITEM2_X_SPATK 0x0F
#define ITEM2_X_ACCURACY 0xF0
#else
// new field 1 masks
#define ITEM1_X_ATTACK 0x1
#define ITEM1_X_DEFENSE 0x2
#define ITEM1_X_SPEED 0x4
#define ITEM1_X_SPATK 0x8
#define ITEM1_X_SPDEF 0x10
#define ITEM1_X_ACCURACY 0x20
#endif
// field 3 masks
#define ITEM3_CONFUSION 0x1

View File

@ -12,7 +12,7 @@
#define MOVE_ICE_PUNCH 8
#define MOVE_THUNDER_PUNCH 9
#define MOVE_SCRATCH 10
#define MOVE_VICE_GRIP 11
#define MOVE_VISE_GRIP 11
#define MOVE_GUILLOTINE 12
#define MOVE_RAZOR_WIND 13
#define MOVE_SWORDS_DANCE 14
@ -137,7 +137,7 @@
#define MOVE_AMNESIA 133
#define MOVE_KINESIS 134
#define MOVE_SOFT_BOILED 135
#define MOVE_HI_JUMP_KICK 136
#define MOVE_HIGH_JUMP_KICK 136
#define MOVE_GLARE 137
#define MOVE_DREAM_EATER 138
#define MOVE_POISON_GAS 139
@ -186,7 +186,7 @@
#define MOVE_PROTECT 182
#define MOVE_MACH_PUNCH 183
#define MOVE_SCARY_FACE 184
#define MOVE_FAINT_ATTACK 185
#define MOVE_FEINT_ATTACK 185
#define MOVE_SWEET_KISS 186
#define MOVE_BELLY_DRUM 187
#define MOVE_SLUDGE_BOMB 188
@ -266,7 +266,7 @@
#define MOVE_MEMENTO 262
#define MOVE_FACADE 263
#define MOVE_FOCUS_PUNCH 264
#define MOVE_SMELLING_SALT 265
#define MOVE_SMELLING_SALTS 265
#define MOVE_FOLLOW_ME 266
#define MOVE_NATURE_POWER 267
#define MOVE_CHARGE 268
@ -772,8 +772,17 @@
#define MOVE_JUNGLE_HEALING 744
#define MOVE_WICKED_BLOW 745
#define MOVE_SURGING_STRIKES 746
// Crown Tundra Moves
#define MOVE_THUNDER_CAGE 747
#define MOVE_DRAGON_ENERGY 748
#define MOVE_FREEZING_GLARE 749
#define MOVE_FIERY_WRATH 750
#define MOVE_THUNDEROUS_KICK 751
#define MOVE_GLACIAL_LANCE 752
#define MOVE_ASTRAL_BARRAGE 753
#define MOVE_EERIE_SPELL 754
#define MOVES_COUNT_GEN8 747
#define MOVES_COUNT_GEN8 755
#define MOVES_COUNT MOVES_COUNT_GEN8

View File

@ -242,10 +242,10 @@
// Battle move flags
#define FLAG_MAKES_CONTACT (1 << 0)
#define FLAG_PROTECT_AFFECTED (1 << 1)
#define FLAG_MAGICCOAT_AFFECTED (1 << 2)
#define FLAG_MAGIC_COAT_AFFECTED (1 << 2)
#define FLAG_SNATCH_AFFECTED (1 << 3)
#define FLAG_MIRROR_MOVE_AFFECTED (1 << 4)
#define FLAG_KINGSROCK_AFFECTED (1 << 5)
#define FLAG_KINGS_ROCK_AFFECTED (1 << 5)
#define FLAG_HIGH_CRIT (1 << 6)
#define FLAG_RECKLESS_BOOST (1 << 7)
#define FLAG_IRON_FIST_BOOST (1 << 8)

View File

@ -417,36 +417,36 @@
#define SPECIES_CHIMECHO 411
#define SPECIES_EGG 412
#define SPECIES_UNOWN_B 413
#define SPECIES_UNOWN_C 414
#define SPECIES_UNOWN_D 415
#define SPECIES_UNOWN_E 416
#define SPECIES_UNOWN_F 417
#define SPECIES_UNOWN_G 418
#define SPECIES_UNOWN_H 419
#define SPECIES_UNOWN_I 420
#define SPECIES_UNOWN_J 421
#define SPECIES_UNOWN_K 422
#define SPECIES_UNOWN_L 423
#define SPECIES_UNOWN_M 424
#define SPECIES_UNOWN_N 425
#define SPECIES_UNOWN_O 426
#define SPECIES_UNOWN_P 427
#define SPECIES_UNOWN_Q 428
#define SPECIES_UNOWN_R 429
#define SPECIES_UNOWN_S 430
#define SPECIES_UNOWN_T 431
#define SPECIES_UNOWN_U 432
#define SPECIES_UNOWN_V 433
#define SPECIES_UNOWN_W 434
#define SPECIES_UNOWN_X 435
#define SPECIES_UNOWN_Y 436
#define SPECIES_UNOWN_Z 437
#define SPECIES_UNOWN_EMARK 438
#define SPECIES_UNOWN_QMARK 439
#define NUM_SPECIES SPECIES_EGG
#define SPECIES_UNOWN_B (NUM_SPECIES + 1)
#define SPECIES_UNOWN_C (SPECIES_UNOWN_B + 1)
#define SPECIES_UNOWN_D (SPECIES_UNOWN_B + 2)
#define SPECIES_UNOWN_E (SPECIES_UNOWN_B + 3)
#define SPECIES_UNOWN_F (SPECIES_UNOWN_B + 4)
#define SPECIES_UNOWN_G (SPECIES_UNOWN_B + 5)
#define SPECIES_UNOWN_H (SPECIES_UNOWN_B + 6)
#define SPECIES_UNOWN_I (SPECIES_UNOWN_B + 7)
#define SPECIES_UNOWN_J (SPECIES_UNOWN_B + 8)
#define SPECIES_UNOWN_K (SPECIES_UNOWN_B + 9)
#define SPECIES_UNOWN_L (SPECIES_UNOWN_B + 10)
#define SPECIES_UNOWN_M (SPECIES_UNOWN_B + 11)
#define SPECIES_UNOWN_N (SPECIES_UNOWN_B + 12)
#define SPECIES_UNOWN_O (SPECIES_UNOWN_B + 13)
#define SPECIES_UNOWN_P (SPECIES_UNOWN_B + 14)
#define SPECIES_UNOWN_Q (SPECIES_UNOWN_B + 15)
#define SPECIES_UNOWN_R (SPECIES_UNOWN_B + 16)
#define SPECIES_UNOWN_S (SPECIES_UNOWN_B + 17)
#define SPECIES_UNOWN_T (SPECIES_UNOWN_B + 18)
#define SPECIES_UNOWN_U (SPECIES_UNOWN_B + 19)
#define SPECIES_UNOWN_V (SPECIES_UNOWN_B + 20)
#define SPECIES_UNOWN_W (SPECIES_UNOWN_B + 21)
#define SPECIES_UNOWN_X (SPECIES_UNOWN_B + 22)
#define SPECIES_UNOWN_Y (SPECIES_UNOWN_B + 23)
#define SPECIES_UNOWN_Z (SPECIES_UNOWN_B + 24)
#define SPECIES_UNOWN_EMARK (SPECIES_UNOWN_B + 25)
#define SPECIES_UNOWN_QMARK (SPECIES_UNOWN_B + 26)
// National Dex Index Defines
#define NATIONAL_DEX_NONE 0
@ -845,31 +845,31 @@
#define NATIONAL_DEX_COUNT NATIONAL_DEX_DEOXYS
#define NATIONAL_DEX_OLD_UNOWN_B 387
#define NATIONAL_DEX_OLD_UNOWN_C 388
#define NATIONAL_DEX_OLD_UNOWN_D 389
#define NATIONAL_DEX_OLD_UNOWN_E 390
#define NATIONAL_DEX_OLD_UNOWN_F 391
#define NATIONAL_DEX_OLD_UNOWN_G 392
#define NATIONAL_DEX_OLD_UNOWN_H 393
#define NATIONAL_DEX_OLD_UNOWN_I 394
#define NATIONAL_DEX_OLD_UNOWN_J 395
#define NATIONAL_DEX_OLD_UNOWN_K 396
#define NATIONAL_DEX_OLD_UNOWN_L 397
#define NATIONAL_DEX_OLD_UNOWN_M 398
#define NATIONAL_DEX_OLD_UNOWN_N 399
#define NATIONAL_DEX_OLD_UNOWN_O 400
#define NATIONAL_DEX_OLD_UNOWN_P 401
#define NATIONAL_DEX_OLD_UNOWN_Q 402
#define NATIONAL_DEX_OLD_UNOWN_R 403
#define NATIONAL_DEX_OLD_UNOWN_S 404
#define NATIONAL_DEX_OLD_UNOWN_T 405
#define NATIONAL_DEX_OLD_UNOWN_U 406
#define NATIONAL_DEX_OLD_UNOWN_V 407
#define NATIONAL_DEX_OLD_UNOWN_W 408
#define NATIONAL_DEX_OLD_UNOWN_X 409
#define NATIONAL_DEX_OLD_UNOWN_Y 410
#define NATIONAL_DEX_OLD_UNOWN_Z 411
#define NATIONAL_DEX_OLD_UNOWN_B (NATIONAL_DEX_COUNT + 1)
#define NATIONAL_DEX_OLD_UNOWN_C (NATIONAL_DEX_OLD_UNOWN_B + 1)
#define NATIONAL_DEX_OLD_UNOWN_D (NATIONAL_DEX_OLD_UNOWN_B + 2)
#define NATIONAL_DEX_OLD_UNOWN_E (NATIONAL_DEX_OLD_UNOWN_B + 3)
#define NATIONAL_DEX_OLD_UNOWN_F (NATIONAL_DEX_OLD_UNOWN_B + 4)
#define NATIONAL_DEX_OLD_UNOWN_G (NATIONAL_DEX_OLD_UNOWN_B + 5)
#define NATIONAL_DEX_OLD_UNOWN_H (NATIONAL_DEX_OLD_UNOWN_B + 6)
#define NATIONAL_DEX_OLD_UNOWN_I (NATIONAL_DEX_OLD_UNOWN_B + 7)
#define NATIONAL_DEX_OLD_UNOWN_J (NATIONAL_DEX_OLD_UNOWN_B + 8)
#define NATIONAL_DEX_OLD_UNOWN_K (NATIONAL_DEX_OLD_UNOWN_B + 9)
#define NATIONAL_DEX_OLD_UNOWN_L (NATIONAL_DEX_OLD_UNOWN_B + 10)
#define NATIONAL_DEX_OLD_UNOWN_M (NATIONAL_DEX_OLD_UNOWN_B + 11)
#define NATIONAL_DEX_OLD_UNOWN_N (NATIONAL_DEX_OLD_UNOWN_B + 12)
#define NATIONAL_DEX_OLD_UNOWN_O (NATIONAL_DEX_OLD_UNOWN_B + 13)
#define NATIONAL_DEX_OLD_UNOWN_P (NATIONAL_DEX_OLD_UNOWN_B + 14)
#define NATIONAL_DEX_OLD_UNOWN_Q (NATIONAL_DEX_OLD_UNOWN_B + 15)
#define NATIONAL_DEX_OLD_UNOWN_R (NATIONAL_DEX_OLD_UNOWN_B + 16)
#define NATIONAL_DEX_OLD_UNOWN_S (NATIONAL_DEX_OLD_UNOWN_B + 17)
#define NATIONAL_DEX_OLD_UNOWN_T (NATIONAL_DEX_OLD_UNOWN_B + 18)
#define NATIONAL_DEX_OLD_UNOWN_U (NATIONAL_DEX_OLD_UNOWN_B + 19)
#define NATIONAL_DEX_OLD_UNOWN_V (NATIONAL_DEX_OLD_UNOWN_B + 20)
#define NATIONAL_DEX_OLD_UNOWN_W (NATIONAL_DEX_OLD_UNOWN_B + 21)
#define NATIONAL_DEX_OLD_UNOWN_X (NATIONAL_DEX_OLD_UNOWN_B + 22)
#define NATIONAL_DEX_OLD_UNOWN_Y (NATIONAL_DEX_OLD_UNOWN_B + 23)
#define NATIONAL_DEX_OLD_UNOWN_Z (NATIONAL_DEX_OLD_UNOWN_B + 24)
// Hoenn Dex Index Defines
@ -1264,30 +1264,30 @@
#define HOENN_DEX_HO_OH 385
#define HOENN_DEX_CELEBI 386
#define HOENN_DEX_OLD_UNOWN_B 387
#define HOENN_DEX_OLD_UNOWN_C 388
#define HOENN_DEX_OLD_UNOWN_D 389
#define HOENN_DEX_OLD_UNOWN_E 390
#define HOENN_DEX_OLD_UNOWN_F 391
#define HOENN_DEX_OLD_UNOWN_G 392
#define HOENN_DEX_OLD_UNOWN_H 393
#define HOENN_DEX_OLD_UNOWN_I 394
#define HOENN_DEX_OLD_UNOWN_J 395
#define HOENN_DEX_OLD_UNOWN_K 396
#define HOENN_DEX_OLD_UNOWN_L 397
#define HOENN_DEX_OLD_UNOWN_M 398
#define HOENN_DEX_OLD_UNOWN_N 399
#define HOENN_DEX_OLD_UNOWN_O 400
#define HOENN_DEX_OLD_UNOWN_P 401
#define HOENN_DEX_OLD_UNOWN_Q 402
#define HOENN_DEX_OLD_UNOWN_R 403
#define HOENN_DEX_OLD_UNOWN_S 404
#define HOENN_DEX_OLD_UNOWN_T 405
#define HOENN_DEX_OLD_UNOWN_U 406
#define HOENN_DEX_OLD_UNOWN_V 407
#define HOENN_DEX_OLD_UNOWN_W 408
#define HOENN_DEX_OLD_UNOWN_X 409
#define HOENN_DEX_OLD_UNOWN_Y 410
#define HOENN_DEX_OLD_UNOWN_Z 411
#define HOENN_DEX_OLD_UNOWN_B (HOENN_DEX_CELEBI + 1)
#define HOENN_DEX_OLD_UNOWN_C (HOENN_DEX_OLD_UNOWN_B + 1)
#define HOENN_DEX_OLD_UNOWN_D (HOENN_DEX_OLD_UNOWN_B + 2)
#define HOENN_DEX_OLD_UNOWN_E (HOENN_DEX_OLD_UNOWN_B + 3)
#define HOENN_DEX_OLD_UNOWN_F (HOENN_DEX_OLD_UNOWN_B + 4)
#define HOENN_DEX_OLD_UNOWN_G (HOENN_DEX_OLD_UNOWN_B + 5)
#define HOENN_DEX_OLD_UNOWN_H (HOENN_DEX_OLD_UNOWN_B + 6)
#define HOENN_DEX_OLD_UNOWN_I (HOENN_DEX_OLD_UNOWN_B + 7)
#define HOENN_DEX_OLD_UNOWN_J (HOENN_DEX_OLD_UNOWN_B + 8)
#define HOENN_DEX_OLD_UNOWN_K (HOENN_DEX_OLD_UNOWN_B + 9)
#define HOENN_DEX_OLD_UNOWN_L (HOENN_DEX_OLD_UNOWN_B + 10)
#define HOENN_DEX_OLD_UNOWN_M (HOENN_DEX_OLD_UNOWN_B + 11)
#define HOENN_DEX_OLD_UNOWN_N (HOENN_DEX_OLD_UNOWN_B + 12)
#define HOENN_DEX_OLD_UNOWN_O (HOENN_DEX_OLD_UNOWN_B + 13)
#define HOENN_DEX_OLD_UNOWN_P (HOENN_DEX_OLD_UNOWN_B + 14)
#define HOENN_DEX_OLD_UNOWN_Q (HOENN_DEX_OLD_UNOWN_B + 15)
#define HOENN_DEX_OLD_UNOWN_R (HOENN_DEX_OLD_UNOWN_B + 16)
#define HOENN_DEX_OLD_UNOWN_S (HOENN_DEX_OLD_UNOWN_B + 17)
#define HOENN_DEX_OLD_UNOWN_T (HOENN_DEX_OLD_UNOWN_B + 18)
#define HOENN_DEX_OLD_UNOWN_U (HOENN_DEX_OLD_UNOWN_B + 19)
#define HOENN_DEX_OLD_UNOWN_V (HOENN_DEX_OLD_UNOWN_B + 20)
#define HOENN_DEX_OLD_UNOWN_W (HOENN_DEX_OLD_UNOWN_B + 21)
#define HOENN_DEX_OLD_UNOWN_X (HOENN_DEX_OLD_UNOWN_B + 22)
#define HOENN_DEX_OLD_UNOWN_Y (HOENN_DEX_OLD_UNOWN_B + 23)
#define HOENN_DEX_OLD_UNOWN_Z (HOENN_DEX_OLD_UNOWN_B + 24)
#endif // GUARD_CONSTANTS_SPECIES_H

View File

@ -67,52 +67,26 @@ struct ToneData
u8 release;
};
#define SOUND_CHANNEL_SF_START 0x80
#define SOUND_CHANNEL_SF_STOP 0x40
#define SOUND_CHANNEL_SF_LOOP 0x10
#define SOUND_CHANNEL_SF_IEC 0x04
#define SOUND_CHANNEL_SF_ENV 0x03
#define SOUND_CHANNEL_SF_ENV_ATTACK 0x03
#define SOUND_CHANNEL_SF_ENV_DECAY 0x02
#define SOUND_CHANNEL_SF_ENV_SUSTAIN 0x01
#define SOUND_CHANNEL_SF_ENV_RELEASE 0x00
#define SOUND_CHANNEL_SF_ON (SOUND_CHANNEL_SF_START | SOUND_CHANNEL_SF_STOP | SOUND_CHANNEL_SF_IEC | SOUND_CHANNEL_SF_ENV)
#define CGB_CHANNEL_MO_PIT 0x02
#define CGB_CHANNEL_MO_VOL 0x01
#define CGB_NRx2_ENV_DIR_DEC 0x00
#define CGB_NRx2_ENV_DIR_INC 0x08
struct CgbChannel
{
u8 sf; // 0x0
u8 ty; // 0x1
u8 rightVolume; // 0x2
u8 leftVolume; // 0x3
u8 at; // 0x4
u8 de; // 0x5
u8 su; // 0x6
u8 re; // 0x7
u8 ky; // 0x8
u8 ev; // 0x9
u8 eg; // 0xA
u8 ec; // 0xB
u8 echoVolume; // 0xC
u8 echoLength; // 0xD
u8 d1; // 0xE
u8 d2; // 0xF
u8 gt; // 0x10
u8 mk; // 0x11
u8 ve; // 0x12
u8 pr; // 0x13
u8 rp; // 0x14
u8 d3[3]; // 0x15, 0x16, 0x17
u8 d5; // 0x18
u8 sg; // 0x19
u8 n4; // 0x1A
u8 pan; // 0x1B
u8 panMask; // 0x1C
u8 mo; // 0x1D
u8 le; // 0x1E
u8 sw; // 0x1F
u32 fr; // 0x20
u32 *wp;
u32 cp;
u32 tp;
u32 pp;
u32 np;
u8 d4[8];
};
struct MusicPlayerTrack;
struct SoundChannel
{
u8 status;
u8 statusFlags;
u8 type;
u8 rightVolume;
u8 leftVolume;
@ -120,29 +94,72 @@ struct SoundChannel
u8 decay;
u8 sustain;
u8 release;
u8 ky;
u8 ev;
u8 er;
u8 el;
u8 echoVolume;
u8 echoLength;
u8 d1;
u8 d2;
u8 gt;
u8 mk;
u8 ve;
u8 pr;
u8 rp;
u8 d3[3];
u32 ct;
u32 fw;
u32 freq;
struct WaveData *wav;
u32 cp;
u8 key;
u8 envelopeVolume;
u8 envelopeGoal;
u8 envelopeCounter;
u8 pseudoEchoVolume;
u8 pseudoEchoLength;
u8 dummy1;
u8 dummy2;
u8 gateTime;
u8 midiKey;
u8 velocity;
u8 priority;
u8 rhythmPan;
u8 dummy3[3];
u8 dummy5;
u8 sustainGoal;
u8 n4; // NR[1-4]4 register (initial, length bit)
u8 pan;
u8 panMask;
u8 modify;
u8 length;
u8 sweep;
u32 frequency;
u32 *wavePointer; // instructs CgbMain to load targeted wave
u32 *currentPointer; // stores the currently loaded wave
struct MusicPlayerTrack *track;
u32 pp;
u32 np;
u32 d4;
void *prevChannelPointer;
void *nextChannelPointer;
u8 dummy4[8];
};
struct MusicPlayerTrack;
struct SoundChannel
{
u8 statusFlags;
u8 type;
u8 rightVolume;
u8 leftVolume;
u8 attack;
u8 decay;
u8 sustain;
u8 release;
u8 key; // midi key as it was translated into final pitch
u8 envelopeVolume;
u8 envelopeVolumeRight;
u8 envelopeVolumeLeft;
u8 pseudoEchoVolume;
u8 pseudoEchoLength;
u8 dummy1;
u8 dummy2;
u8 gateTime;
u8 midiKey; // midi key as it was used in the track data
u8 velocity;
u8 priority;
u8 rhythmPan;
u8 dummy3[3];
u32 count;
u32 fw;
u32 frequency;
struct WaveData *wav;
s8 *currentPointer;
struct MusicPlayerTrack *track;
void *prevChannelPointer;
void *nextChannelPointer;
u32 dummy4;
u16 xpi;
u16 xpc;
};
@ -151,6 +168,16 @@ struct SoundChannel
#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
struct MusicPlayerInfo;
typedef void (*MPlayFunc)();
typedef void (*PlyNoteFunc)(u32, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
typedef void (*CgbSoundFunc)(void);
typedef void (*CgbOscOffFunc)(u8);
typedef u32 (*MidiKeyToCgbFreqFunc)(u8, u8, u8);
typedef void (*ExtVolPitFunc)(void);
typedef void (*MPlayMainFunc)(struct MusicPlayerInfo *);
struct SoundInfo
{
// This field is normally equal to ID_NUMBER but it is set to other
@ -168,7 +195,7 @@ struct SoundInfo
u8 freq;
u8 mode;
u8 c15;
u8 c15; // periodically counts from 14 down to 0 (15 states)
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
u8 maxLines;
u8 gap[3];
@ -176,14 +203,14 @@ struct SoundInfo
s32 pcmFreq;
s32 divFreq;
struct CgbChannel *cgbChans;
u32 func;
u32 intp;
void (*CgbSound)(void);
void (*CgbOscOff)(u8);
u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
u32 MPlayJumpTable;
u32 plynote;
u32 ExtVolPit;
MPlayMainFunc MPlayMainHead;
struct MusicPlayerInfo *musicPlayerHead;
CgbSoundFunc CgbSound;
CgbOscOffFunc CgbOscOff;
MidiKeyToCgbFreqFunc MidiKeyToCgbFreq;
MPlayFunc *MPlayJumpTable;
PlyNoteFunc plynote;
ExtVolPitFunc ExtVolPit;
u8 gap2[16];
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
@ -270,8 +297,8 @@ struct MusicPlayerTrack
u8 lfoDelay;
u8 lfoDelayC;
u8 priority;
u8 echoVolume;
u8 echoLength;
u8 pseudoEchoVolume;
u8 pseudoEchoLength;
struct SoundChannel *chan;
struct ToneData tone;
u8 gap[10];
@ -312,8 +339,8 @@ struct MusicPlayerInfo
struct MusicPlayerTrack *tracks;
struct ToneData *tone;
u32 ident;
u32 func;
u32 intp;
MPlayMainFunc MPlayMainNext;
struct MusicPlayerInfo *musicPlayerNext;
};
struct MusicPlayer
@ -351,7 +378,7 @@ extern struct MusicPlayerTrack gPokemonCryTracks[];
extern char SoundMainRAM[];
extern void *gMPlayJumpTable[];
extern MPlayFunc gMPlayJumpTable[];
typedef void (*XcmdFunc)(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
extern const XcmdFunc gXcmdTable[];
@ -380,7 +407,7 @@ u32 umul3232H32(u32 multiplier, u32 multiplicand);
void SoundMain(void);
void SoundMainBTM(void);
void TrackStop(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track);
void MPlayMain(void);
void MPlayMain(struct MusicPlayerInfo *);
void RealClearChain(void *x);
void MPlayContinue(struct MusicPlayerInfo *mplayInfo);
@ -400,7 +427,7 @@ void CgbOscOff(u8);
void CgbModVol(struct CgbChannel *chan);
u32 MidiKeyToCgbFreq(u8, u8, u8);
void DummyFunc(void);
void MPlayJumpTableCopy(void **mplayJumpTable);
void MPlayJumpTableCopy(MPlayFunc *mplayJumpTable);
void SampleFreqSet(u32 freq);
void m4aSoundVSyncOn(void);
void m4aSoundVSyncOff(void);
@ -448,7 +475,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_note(u32 note_cmd, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
// extended sound command handler functions
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);

View File

@ -195,15 +195,10 @@ struct ObjectEvent
/*0x0C*/ struct Coords16 initialCoords;
/*0x10*/ struct Coords16 currentCoords;
/*0x14*/ struct Coords16 previousCoords;
/*0x18*/ u8 facingDirection:4; // current direction?
/*0x18*/ u8 movementDirection:4;
/*0x19*/ union __attribute__((packed)) {
u8 as_byte;
struct __attribute__((packed)) {
u8 x:4;
u8 y:4;
} ALIGNED(1) as_nybbles;
} ALIGNED(1) range;
/*0x18*/ u16 facingDirection:4; // current direction?
u16 movementDirection:4;
u16 rangeX:4;
u16 rangeY:4;
/*0x1A*/ u8 fieldEffectSpriteId;
/*0x1B*/ u8 warpArrowSpriteId;
/*0x1C*/ u8 movementActionId;
@ -219,8 +214,8 @@ struct ObjectEvent
struct ObjectEventGraphicsInfo
{
/*0x00*/ u16 tileTag;
/*0x02*/ u16 paletteTag1;
/*0x04*/ u16 paletteTag2;
/*0x02*/ u16 paletteTag;
/*0x04*/ u16 reflectionPaletteTag;
/*0x06*/ u16 size;
/*0x08*/ s16 width;
/*0x0A*/ s16 height;

View File

@ -340,11 +340,12 @@ struct BattleDomeTrainer
};
#define DOME_TOURNAMENT_TRAINERS_COUNT 16
#define BATTLE_TOWER_RECORD_COUNT 5
struct BattleFrontier
{
/*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer;
/*0x738*/ struct EmeraldBattleTowerRecord towerRecords[5]; // From record mixing.
/*0x738*/ struct EmeraldBattleTowerRecord towerRecords[BATTLE_TOWER_RECORD_COUNT]; // From record mixing.
/*0xBEB*/ struct BattleTowerInterview towerInterview;
/*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer;
/*0xCA8*/ u8 challengeStatus;

View File

@ -5343,4 +5343,10 @@ extern const u16 gPokenavMessageBox_Pal[];
extern const u32 gPokenavOptions_Gfx[];
extern const u16 gPokenavOptions_Pal[];
// Object event pals
extern const u16 gObjectEventPal_Brendan[];
extern const u16 gObjectEventPal_May[];
extern const u16 gObjectEventPal_RubySapphireBrendan[];
extern const u16 gObjectEventPal_RubySapphireMay[];
#endif //GUARD_GRAPHICS_H

View File

@ -4,6 +4,8 @@
#include "constants/pokemon.h"
#include "sprite.h"
#define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0))
struct PokemonSubstruct0
{
u16 species;
@ -280,7 +282,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
bool8 sub_80688F8(u8 caseId, u8 battlerId);
void SetDeoxysStats(void);
@ -386,7 +388,7 @@ void ClearBattleMonForms(void);
u16 GetBattleBGM(void);
void PlayBattleBGM(void);
void PlayMapChosenOrBattleBGM(u16 songId);
void sub_806E694(u16 songId);
void CreateTask_PlayMapChosenOrBattleBGM(u16 songId);
const u32 *GetMonFrontSpritePal(struct Pokemon *mon);
const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality);
const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon);
@ -421,5 +423,7 @@ bool8 HasTwoFramesAnimation(u16 species);
struct Unknown_806F160_Struct *sub_806F2AC(u8 id, u8 arg1);
void sub_806F47C(u8 id);
u8 *sub_806F4F8(u8 id, u8 arg1);
u16 GetFormSpeciesId(u16 speciesId, u8 formId);
u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId);
#endif // GUARD_POKEMON_H

View File

@ -30,7 +30,7 @@ void sub_818603C(u8 arg0);
u32 GetAiScriptsInRecordedBattle(void);
void sub_8186444(void);
bool8 sub_8186450(void);
void sub_8186468(u8 *dst);
void GetRecordedBattleRecordMixFriendName(u8 *dst);
u8 GetRecordedBattleRecordMixFriendClass(void);
u8 GetRecordedBattleApprenticeId(void);
u8 GetRecordedBattleRecordMixFriendLanguage(void);

View File

@ -773,7 +773,11 @@ static u8 GetAI_ItemType(u16 itemId, const u8 *itemEffect)
return AI_ITEM_HEAL_HP;
else if (itemEffect[3] & ITEM3_STATUS_ALL)
return AI_ITEM_CURE_CONDITION;
#ifdef ITEM_EXPANSION
else if ((itemEffect[0] & ITEM0_DIRE_HIT) || itemEffect[1])
#else
else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
#endif
return AI_ITEM_X_STAT;
else if (itemEffect[3] & ITEM3_GUARD_SPEC)
return AI_ITEM_GUARD_SPECS;
@ -883,6 +887,7 @@ static bool8 ShouldUseItem(void)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
if (gDisableStructs[gActiveBattler].isFirstTurn == 0)
break;
#ifndef ITEM_EXPANSION
if (itemEffects[0] & ITEM0_X_ATTACK)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
if (itemEffects[1] & ITEM1_X_DEFEND)
@ -895,6 +900,22 @@ static bool8 ShouldUseItem(void)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
if (itemEffects[0] & ITEM0_DIRE_HIT)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80;
#else
if (itemEffects[1] & ITEM1_X_ATTACK)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
if (itemEffects[1] & ITEM1_X_DEFENSE)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
if (itemEffects[1] & ITEM1_X_SPEED)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
if (itemEffects[1] & ITEM1_X_SPATK)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
if (itemEffects[1] & ITEM1_X_SPDEF)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x10;
if (itemEffects[1] & ITEM1_X_ACCURACY)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
if (itemEffects[0] & ITEM0_DIRE_HIT)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x40;
#endif
shouldUse = TRUE;
break;
case AI_ITEM_GUARD_SPECS:

View File

@ -1926,6 +1926,39 @@ const struct SpriteTemplate gEndureEnergySpriteTemplate =
.callback = AnimEndureEnergy,
};
const struct SpriteTemplate gBlueEndureEnergySpriteTemplate =
{
.tileTag = ANIM_TAG_FOCUS_ENERGY,
.paletteTag = ANIM_TAG_SWEAT_BEAD,
.oam = &gOamData_AffineOff_ObjNormal_16x32,
.anims = gEndureEnergyAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimEndureEnergy,
};
const struct SpriteTemplate gGreenEndureEnergySpriteTemplate =
{
.tileTag = ANIM_TAG_FOCUS_ENERGY,
.paletteTag = ANIM_TAG_WHIP_HIT,
.oam = &gOamData_AffineOff_ObjNormal_16x32,
.anims = gEndureEnergyAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimEndureEnergy,
};
const struct SpriteTemplate gYellowEndureEnergySpriteTemplate =
{
.tileTag = ANIM_TAG_FOCUS_ENERGY,
.paletteTag = ANIM_TAG_PAW_PRINT,
.oam = &gOamData_AffineOff_ObjNormal_16x32,
.anims = gEndureEnergyAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimEndureEnergy,
};
const union AnimCmd gSharpenSphereAnimCmds[] =
{
ANIMCMD_FRAME(0, 18),

View File

@ -2330,7 +2330,7 @@ void AnimTask_TransformMon(u8 taskId)
else
position = GetBattlerPosition(gBattleAnimAttacker);
src = gMonSpritesGfxPtr->sprites[position] + (gBattleMonForms[gBattleAnimAttacker] << 11);
src = gMonSpritesGfxPtr->sprites.ptr[position] + (gBattleMonForms[gBattleAnimAttacker] << 11);
dest = animBg.bgTiles;
CpuCopy32(src, dest, 0x800);
LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset);

View File

@ -67,6 +67,18 @@ static const union AffineAnimCmd sSquishTargetAffineAnimCmds[] =
};
//// GEN 4
// shadow sneak
const struct SpriteTemplate gShadowSneakImpactSpriteTemplate =
{
.tileTag = ANIM_TAG_IMPACT,
.paletteTag = ANIM_TAG_HANDS_AND_FEET,
.oam = &gOamData_AffineNormal_ObjBlend_32x32,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gAffineAnims_IceCrystalHit,
.callback = AnimIceEffectParticle
};
// power trick
const struct SpriteTemplate gPowerTrickSpriteTemplate =
{

View File

@ -2494,6 +2494,8 @@ void AnimTask_GetTrappedMoveAnimId(u8 taskId)
gBattleAnimArgs[0] = TRAP_ANIM_CLAMP;
else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_SAND_TOMB)
gBattleAnimArgs[0] = TRAP_ANIM_SAND_TOMB;
else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_INFESTATION)
gBattleAnimArgs[0] = TRAP_ANIM_INFESTATION;
else
gBattleAnimArgs[0] = TRAP_ANIM_BIND;

View File

@ -53,7 +53,7 @@ static const s8 sMindRatings[] =
[MOVE_ICE_PUNCH] = 1,
[MOVE_THUNDER_PUNCH] = 1,
[MOVE_SCRATCH] = 1,
[MOVE_VICE_GRIP] = 1,
[MOVE_VISE_GRIP] = 1,
[MOVE_GUILLOTINE] = 1,
[MOVE_RAZOR_WIND] = 1,
[MOVE_SWORDS_DANCE] = 0,
@ -178,7 +178,7 @@ static const s8 sMindRatings[] =
[MOVE_AMNESIA] = 0,
[MOVE_KINESIS] = 0,
[MOVE_SOFT_BOILED] = 0,
[MOVE_HI_JUMP_KICK] = 1,
[MOVE_HIGH_JUMP_KICK] = 1,
[MOVE_GLARE] = 0,
[MOVE_DREAM_EATER] = 1,
[MOVE_POISON_GAS] = 0,
@ -227,7 +227,7 @@ static const s8 sMindRatings[] =
[MOVE_PROTECT] = -1,
[MOVE_MACH_PUNCH] = 1,
[MOVE_SCARY_FACE] = 0,
[MOVE_FAINT_ATTACK] = 1,
[MOVE_FEINT_ATTACK] = 1,
[MOVE_SWEET_KISS] = 0,
[MOVE_BELLY_DRUM] = 0,
[MOVE_SLUDGE_BOMB] = 1,
@ -307,7 +307,7 @@ static const s8 sMindRatings[] =
[MOVE_MEMENTO] = 0,
[MOVE_FACADE] = 1,
[MOVE_FOCUS_PUNCH] = 1,
[MOVE_SMELLING_SALT] = 1,
[MOVE_SMELLING_SALTS] = 1,
[MOVE_FOLLOW_ME] = 0,
[MOVE_NATURE_POWER] = 0,
[MOVE_CHARGE] = 0,

View File

@ -331,7 +331,7 @@ static void HandleInputChooseAction(void)
{
SwapHpBarsWithHpText();
}
else if (USE_BATTLE_DEBUG && gMain.newKeys & SELECT_BUTTON)
else if (B_ENABLE_DEBUG && gMain.newKeys & SELECT_BUTTON)
{
BtlController_EmitTwoReturnValues(1, B_ACTION_DEBUG, 0);
PlayerBufferExecCompleted();

View File

@ -1526,7 +1526,10 @@ static void PlayerPartnerHandleChooseMove(void)
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
BtlController_EmitTwoReturnValues(1, 10, chosenMoveId | (gBattlerTarget << 8));
if (CanMegaEvolve(gActiveBattler)) // If partner can mega evolve, do it.
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8));
else
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattlerTarget << 8));
PlayerPartnerBufferExecCompleted();
}

View File

@ -62,7 +62,6 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
ClearBattleMonForms();
BattleAI_SetupItems();
BattleAI_SetupFlags();
BattleAI_SetupAIData(0xF);
if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE)
{

View File

@ -152,7 +152,7 @@ static const u8 sBattleStyleMovePoints[MOVES_COUNT][NUM_MOVE_POINT_TYPES] =
[MOVE_ICE_PUNCH] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1, [MOVE_POINTS_EFFECT] = 1},
[MOVE_THUNDER_PUNCH] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1, [MOVE_POINTS_EFFECT] = 1},
[MOVE_SCRATCH] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_VICE_GRIP] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_VISE_GRIP] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_GUILLOTINE] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_LOW_PP] = 1},
[MOVE_RAZOR_WIND] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_SWORDS_DANCE] = {[MOVE_POINTS_COMBO] = 1, [MOVE_POINTS_STAT_RAISE] = 1, [MOVE_POINTS_POPULAR] = 1},
@ -277,7 +277,7 @@ static const u8 sBattleStyleMovePoints[MOVES_COUNT][NUM_MOVE_POINT_TYPES] =
[MOVE_AMNESIA] = {[MOVE_POINTS_STAT_RAISE] = 1, [MOVE_POINTS_DEF] = 1},
[MOVE_KINESIS] = {[MOVE_POINTS_STAT_LOWER] = 1},
[MOVE_SOFT_BOILED] = {[MOVE_POINTS_HEAL] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_HI_JUMP_KICK] = {[MOVE_POINTS_DMG] = 1},
[MOVE_HIGH_JUMP_KICK] = {[MOVE_POINTS_DMG] = 1},
[MOVE_GLARE] = {[MOVE_POINTS_STAT_LOWER] = 1},
[MOVE_DREAM_EATER] = {[MOVE_POINTS_COMBO] = 1, [MOVE_POINTS_RARE] = 1, [MOVE_POINTS_HEAL] = 1, [MOVE_POINTS_ACCURATE] = 1, [MOVE_POINTS_STRONG] = 1},
[MOVE_POISON_GAS] = {[MOVE_POINTS_STATUS] = 1},
@ -326,7 +326,7 @@ static const u8 sBattleStyleMovePoints[MOVES_COUNT][NUM_MOVE_POINT_TYPES] =
[MOVE_PROTECT] = {[MOVE_POINTS_DEF] = 1, [MOVE_POINTS_POPULAR] = 1},
[MOVE_MACH_PUNCH] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_SCARY_FACE] = {0},
[MOVE_FAINT_ATTACK] = {[MOVE_POINTS_DMG] = 1},
[MOVE_FEINT_ATTACK] = {[MOVE_POINTS_DMG] = 1},
[MOVE_SWEET_KISS] = {0},
[MOVE_BELLY_DRUM] = {[MOVE_POINTS_COMBO] = 1, [MOVE_POINTS_STAT_RAISE] = 1},
[MOVE_SLUDGE_BOMB] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1, [MOVE_POINTS_STRONG] = 1, [MOVE_POINTS_EFFECT] = 1},
@ -406,7 +406,7 @@ static const u8 sBattleStyleMovePoints[MOVES_COUNT][NUM_MOVE_POINT_TYPES] =
[MOVE_MEMENTO] = {[MOVE_POINTS_RARE] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_FACADE] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_FOCUS_PUNCH] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1, [MOVE_POINTS_STRONG] = 1},
[MOVE_SMELLING_SALT] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_SMELLING_SALTS] = {[MOVE_POINTS_DMG] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_FOLLOW_ME] = {[MOVE_POINTS_RARE] = 1, [MOVE_POINTS_ACCURATE] = 1},
[MOVE_NATURE_POWER] = {[MOVE_POINTS_DMG] = 1},
[MOVE_CHARGE] = {[MOVE_POINTS_COMBO] = 1, [MOVE_POINTS_ACCURATE] = 1},
@ -863,7 +863,9 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 372,
},
// UB: No DUMMY_WIN_TEMPLATE at the array's end.
#ifdef UBFIX
DUMMY_WIN_TEMPLATE,
#endif
};
static const struct ScanlineEffectParams sTourneyTreeScanlineEffectParams =
@ -2526,7 +2528,11 @@ static void CreateDomeOpponentMon(u8 monPartyId, u16 tournamentTrainerId, u8 tou
{
int i;
u8 friendship = MAX_FRIENDSHIP;
u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Should be using (DOME_TRAINERS[tournamentTrainerId].trainerId) instead of (tournamentTrainerId). As a result, all Pokemon have ivs of 3.
#ifdef BUGFIX
u8 fixedIv = GetDomeTrainerMonIvs(DOME_TRAINERS[tournamentTrainerId].trainerId);
#else
u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Using the wrong ID. As a result, all Pokemon have ivs of 3.
#endif
u8 level = SetFacilityPtrsGetLevel();
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[monPartyId],
gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].species,
@ -5954,6 +5960,10 @@ static void DecideRoundWinners(u8 roundId)
else if (tournamentId2 != 0xFF)
{
// BUG: points1 and points2 are not cleared at the beginning of the loop resulting in not fair results.
#ifdef BUGFIX
points1 = 0;
points2 = 0;
#endif
// Calculate points for both trainers.
for (monId1 = 0; monId1 < FRONTIER_PARTY_SIZE; monId1++)

View File

@ -3905,7 +3905,11 @@ static void Swap_ShowSummaryMonSprite(void)
personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
otId = GetMonData(mon, MON_DATA_OT_ID, NULL);
sFactorySwapScreen->unk2C.field0 = CreateMonPicSprite_HandleDeoxys(species, personality, otId, TRUE, 88, 32, 15, 0xFFFF); // BUG: otId and personality should be switched.
#ifdef BUGFIX
sFactorySwapScreen->unk2C.field0 = CreateMonPicSprite_HandleDeoxys(species, otId, personality, TRUE, 88, 32, 15, 0xFFFF);
#else
sFactorySwapScreen->unk2C.field0 = CreateMonPicSprite_HandleDeoxys(species, personality, otId, TRUE, 88, 32, 15, 0xFFFF);
#endif
gSprites[sFactorySwapScreen->unk2C.field0].centerToCornerVecX = 0;
gSprites[sFactorySwapScreen->unk2C.field0].centerToCornerVecY = 0;

View File

@ -6,6 +6,7 @@
#include "constants/battle_anim.h"
#include "battle_interface.h"
#include "main.h"
#include "dma3.h"
#include "malloc.h"
#include "graphics.h"
#include "random.h"
@ -578,7 +579,7 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
if (opponent)
{
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
}
else
@ -586,13 +587,13 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
if (sub_80688F8(1, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
{
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
}
else
{
HandleLoadSpecialPokePic(&gMonBackPicTable[species],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
}
}
@ -641,7 +642,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId)
{
u8 position = GetBattlerPosition(battlerId);
DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
SPECIES_NONE);
LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[frontPicId]);
}
@ -650,7 +651,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battlerId)
{
u8 position = GetBattlerPosition(battlerId);
DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
SPECIES_NONE);
LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data,
0x100 + 16 * battlerId, 0x20);
@ -869,7 +870,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
otId = gContestResources->moveAnim->otId;
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[0],
gMonSpritesGfxPtr->sprites.ptr[0],
targetSpecies,
gContestResources->moveAnim->targetPersonality);
}
@ -888,7 +889,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
targetSpecies,
gTransformedPersonalities[battlerAtk]);
}
@ -898,7 +899,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[position],
gMonSpritesGfxPtr->sprites.ptr[position],
targetSpecies,
gTransformedPersonalities[battlerAtk]);
}
@ -919,7 +920,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
}
else
{
src = gMonSpritesGfxPtr->sprites[position];
src = gMonSpritesGfxPtr->sprites.ptr[position];
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
DmaCopy32(3, src, dst, 0x800);
paletteOffset = 0x100 + battlerAtk * 16;
@ -963,18 +964,15 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
position = GetBattlerPosition(battlerId);
if (IsContest())
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites.ptr[position]);
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites[position]);
LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites.ptr[position]);
else
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites.ptr[position]);
for (i = 1; i < 4; i++)
{
u8 (*ptr)[4][0x800] = gMonSpritesGfxPtr->sprites[position];
ptr++;ptr--; // Needed to match.
DmaCopy32Defvars(3, (*ptr)[0], (*ptr)[i], 0x800);
Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][0x800 * i], 0x800);
}
palOffset = (battlerId * 16) + 0x100;
@ -1214,12 +1212,12 @@ void AllocateMonSpritesGfx(void)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gMonSpritesGfxPtr->sprites[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000);
gMonSpritesGfxPtr->sprites.ptr[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000);
*(gMonSpritesGfxPtr->templates + i) = gUnknown_08329D98[i];
for (j = 0; j < 4; j++)
{
gMonSpritesGfxPtr->field_74[i][j].data = gMonSpritesGfxPtr->sprites[i] + (j * 0x800);
gMonSpritesGfxPtr->field_74[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * 0x800);
gMonSpritesGfxPtr->field_74[i][j].size = 0x800;
}
@ -1241,10 +1239,10 @@ void FreeMonSpritesGfx(void)
FREE_AND_SET_NULL(gMonSpritesGfxPtr->barFontGfx);
FREE_AND_SET_NULL(gMonSpritesGfxPtr->firstDecompressed);
gMonSpritesGfxPtr->sprites[0] = NULL;
gMonSpritesGfxPtr->sprites[1] = NULL;
gMonSpritesGfxPtr->sprites[2] = NULL;
gMonSpritesGfxPtr->sprites[3] = NULL;
gMonSpritesGfxPtr->sprites.ptr[0] = NULL;
gMonSpritesGfxPtr->sprites.ptr[1] = NULL;
gMonSpritesGfxPtr->sprites.ptr[2] = NULL;
gMonSpritesGfxPtr->sprites.ptr[3] = NULL;
FREE_AND_SET_NULL(gMonSpritesGfxPtr);
}

View File

@ -1011,7 +1011,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority)
if (indicatorSpriteId != 0xFF)
gSprites[indicatorSpriteId].oam.priority = priority;
#if HIDE_HEALTHBOXES_DURING_ANIMS
#if B_HIDE_HEALTHBOXES_DURING_ANIMS
if (IsBattlerAlive(i))
TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId);
#endif

View File

@ -586,7 +586,7 @@ void sub_8118FBC(int bgId, u8 arg1, u8 arg2, u8 battlerPosition, u8 arg4, u8 *ar
int i, j;
u8 battler = GetBattlerAtPosition(battlerPosition);
int offset = tilesOffset;
CpuCopy16(gMonSpritesGfxPtr->sprites[battlerPosition] + BG_SCREEN_SIZE * gBattleMonForms[battler], arg5, BG_SCREEN_SIZE);
CpuCopy16(gMonSpritesGfxPtr->sprites.ptr[battlerPosition] + BG_SCREEN_SIZE * gBattleMonForms[battler], arg5, BG_SCREEN_SIZE);
LoadBgTiles(bgId, arg5, 0x1000, tilesOffset);
for (i = arg2; i < arg2 + 8; i++)
{
@ -604,7 +604,7 @@ void unref_sub_8119094(u8 arg0, u8 arg1, u8 battlerPosition, u8 arg3, u8 arg4, u
{
int i, j, offset;
DmaCopy16(3, gMonSpritesGfxPtr->sprites[battlerPosition] + BG_SCREEN_SIZE * arg3, (void *)BG_SCREEN_ADDR(0) + arg5, BG_SCREEN_SIZE);
DmaCopy16(3, gMonSpritesGfxPtr->sprites.ptr[battlerPosition] + BG_SCREEN_SIZE * arg3, (void *)BG_SCREEN_ADDR(0) + arg5, BG_SCREEN_SIZE);
offset = (arg5 >> 5) - (arg7 << 9);
for (i = arg1; i < arg1 + 8; i++)
{

Some files were not shown because too many files have changed in this diff Show More