Merge pull request #1393 from ultima-soul/master_sync

Turn Master Branch into a Combined Branch
This commit is contained in:
MandL27 2021-02-03 22:56:42 -05:00 committed by GitHub
commit 4679860d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9203 changed files with 274586 additions and 72842 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))
@ -215,6 +218,8 @@ include songs.mk
%.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@
%.rl: % ; $(GFX) $< $@
$(CRY_SUBDIR)/uncomp_%.bin: $(CRY_SUBDIR)/uncomp_%.aif ; $(AIF) $< $@
$(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress
sound/%.bin: sound/%.aif ; $(AIF) $< $@
@ -275,23 +280,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

@ -227,15 +227,15 @@
.byte \battler
.endm
.macro if_equal_ param0:req, param1:req
.macro if_equal_u32 param0:req, param1:req
.byte 0x26
.byte \param0
.4byte \param0
.4byte \param1
.endm
.macro if_not_equal_ param0:req, param1:req
.macro if_not_equal_u32 param0:req, param1:req
.byte 0x27
.byte \param0
.4byte \param0
.4byte \param1
.endm
@ -245,10 +245,10 @@
.4byte \param1
.endm
.macro if_user_doesnt_go param0:req, param1:req
.macro if_cant_use_belch battler:req, ptr:req
.byte 0x29
.byte \param0
.4byte \param1
.byte \battler
.4byte \ptr
.endm
.macro nullsub_2A
@ -315,13 +315,13 @@
.macro if_effect param0:req, param1:req
.byte 0x37
.byte \param0
.2byte \param0
.4byte \param1
.endm
.macro if_not_effect param0:req, param1:req
.byte 0x38
.byte \param0
.2byte \param0
.4byte \param1
.endm
@ -467,24 +467,32 @@
.byte \battler
.endm
.macro nullsub_52
.macro if_move_flag flag jumpptr
.byte 0x52
.4byte \flag
.4byte \jumpptr
.endm
.macro nullsub_53
.macro if_field_status flag jumpptr
.byte 0x53
.4byte \flag
.4byte \jumpptr
.endm
.macro nullsub_54
.macro get_move_accuracy
.byte 0x54
.endm
.macro nullsub_55
.macro call_if_eq value, ptr
.byte 0x55
.2byte \value
.4byte \ptr
.endm
.macro nullsub_56
.byte 0x56
.macro call_if_move_flag flag ptr
.byte 0x52
.4byte \flag
.4byte \ptr
.endm
.macro nullsub_57
@ -551,7 +559,158 @@
.4byte \param2
.endm
.macro get_ally_chosen_move
.byte 0x63
.endm
.macro if_has_no_attacking_moves battler:req, param1:req
.byte 0x64
.byte \battler
.4byte \param1
.endm
.macro get_hazards_count battler:req, effect:req
.byte 0x65
.byte \battler
.2byte \effect
.endm
.macro if_doesnt_hold_berry battler:req, ptr:req
.byte 0x66
.byte \battler
.4byte \ptr
.endm
.macro if_share_type battler1:req, battler2:req, ptr:req
.byte 0x67
.byte \battler1
.byte \battler2
.4byte \ptr
.endm
.macro if_cant_use_last_resort battler:req, ptr:req
.byte 0x68
.byte \battler
.4byte \ptr
.endm
.macro if_has_move_with_split battler:req, split:req, ptr:req
.byte 0x69
.byte \battler
.byte \split
.4byte \ptr
.endm
.macro if_has_no_move_with_split battler:req, split:req, ptr:req
.byte 0x6A
.byte \battler
.byte \split
.4byte \ptr
.endm
.macro if_physical_moves_unusable attacker:req, target:req, ptr:req
.byte 0x6B
.byte \attacker
.byte \target
.4byte \ptr
.endm
.macro if_ai_can_go_down ptr:req
.byte 0x6C
.4byte \ptr
.endm
.macro if_has_move_with_type battler:req, type:req, ptr:req
.byte 0x6D
.byte \battler
.byte \type
.4byte \ptr
.endm
.macro if_no_move_used battler:req, ptr:req
.byte 0x6E
.byte \battler
.4byte \ptr
.endm
.macro if_has_move_with_flag battler:req, flag:req, ptr:req
.byte 0x6F
.byte \battler
.4byte \flag
.4byte \ptr
.endm
.macro if_battler_absent battler:req, ptr:req
.byte 0x70
.byte \battler
.4byte \ptr
.endm
.macro if_grounded battler:req, ptr:req
.byte 0x71
.byte \battler
.4byte \ptr
.endm
.macro get_best_dmg_hp_percent
.byte 0x72
.endm
.macro get_curr_dmg_hp_percent
.byte 0x73
.endm
.macro get_move_split_from_result
.byte 0x74
.endm
.macro get_considered_move_split
.byte 0x75
.endm
.macro get_considered_move_target
.byte 0x76
.endm
.macro compare_speeds battler1:req, battler2:req
.byte 0x77
.byte \battler1
.byte \battler2
.endm
.macro is_wakeup_turn battler:req
.byte 0x78
.byte \battler
.endm
.macro if_has_move_with_accuracy_lt battler:req, value:req, ptr:req
.byte 0x79
.byte \battler
.byte \value
.4byte \ptr
.endm
@ useful script macros
.macro if_has_physical_move battler:req, ptr:req
if_has_move_with_split \battler, SPLIT_PHYSICAL, \ptr
.endm
.macro if_has_no_physical_move battler:req, ptr:req
if_has_no_move_with_split \battler, SPLIT_PHYSICAL, \ptr
.endm
.macro if_has_special_move battler:req, ptr:req
if_has_move_with_split \battler, SPLIT_SPECIAL, \ptr
.endm
.macro if_has_no_special_move battler:req, ptr:req
if_has_no_move_with_split \battler, SPLIT_SPECIAL, \ptr
.endm
.macro if_holds_no_item battler, ptr:req
if_holds_item \battler, 0, \ptr
.endm
.macro get_curr_move_type
get_type AI_TYPE_MOVE
.endm
@ -617,3 +776,8 @@
.macro if_any_move_encored battler:req, ptr:req
if_any_move_disabled_or_encored \battler, 1, \ptr
.endm
.macro call_if_always_hit ptr:req
get_move_accuracy
call_if_eq 0, \ptr
.endm

View File

@ -283,3 +283,48 @@
.macro jumpretfalse ptr:req
jumpreteq FALSE, \ptr
.endm
.macro jumpifdoublebattle ptr:req
createvisualtask AnimTask_IsDoubleBattle, 0
jumprettrue \ptr
.endm
@ keep CFRU macros cause I'm lazy. todo: update to createsprite and createvisualtask, respectively
.macro launchtemplate launchtemplatePtr launchtemplatePriority launchtemplateArgsNo launchtemplatearg0 launchtemplatearg1 launchtemplatearg2 launchtemplatearg3 launchtemplatearg4 launchtemplatearg5 launchtemplatearg6 launchtemplatearg7 launchtemplatearg8
.byte 0x2
.word \launchtemplatePtr
.byte \launchtemplatePriority
.byte \launchtemplateArgsNo
.hword \launchtemplatearg0
.hword \launchtemplatearg1
.hword \launchtemplatearg2
.hword \launchtemplatearg3
.hword \launchtemplatearg4
.hword \launchtemplatearg5
.hword \launchtemplatearg6
.hword \launchtemplatearg7
.hword \launchtemplatearg8
.endm
.macro launchtask launchtaskPtr launchtaskPriority launchtaskArgsNo launchtaskarg0 launchtaskarg1 launchtaskarg2 launchtaskarg3 launchtaskarg4 launchtaskarg5 launchtaskarg6 launchtaskarg7 launchtaskarg8
.byte 0x3
.word \launchtaskPtr
.byte \launchtaskPriority
.byte \launchtaskArgsNo
.hword \launchtaskarg0
.hword \launchtaskarg1
.hword \launchtaskarg2
.hword \launchtaskarg3
.hword \launchtaskarg4
.hword \launchtaskarg5
.hword \launchtaskarg6
.hword \launchtaskarg7
.hword \launchtaskarg8
.endm
.macro setblends setblends_value
.byte 0xC
.hword \setblends_value
.endm

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
@ -89,3 +89,77 @@
setvar VAR_0x8004, BATTLE_TOWER_FUNC_SET_INTERVIEW_DATA
special CallBattleTowerFunc
.endm
@Custom multi-battle commands
.macro choose_mons
fadescreen 1
special ChooseHalfPartyForBattle @ choose 3 mons for battle
waitstate
.endm
.macro multi_do type:req, partnerId:req, partnerPicId:req
special ReducePlayerPartyToSelectedMons
setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SET_DATA
setvar VAR_0x8005, FRONTIER_DATA_SELECTED_MON_ORDER
special CallFrontierUtilFunc @ saves the mon order, so the non-selected mons get restored afterwards
setvar VAR_0x8004, SPECIAL_BATTLE_MULTI
setvar VAR_0x8005, \type | MULTI_BATTLE_CHOOSE_MONS
setvar VAR_0x8006, \partnerId
setvar VAR_0x8007, \partnerPicId
special DoSpecialTrainerBattle
waitstate
setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_PARTY
special CallFrontierUtilFunc
special LoadPlayerParty
.endm
.macro multi_2_vs_2 trainer1Id:req, trainer1LoseText:req, trainer2Id:req, trainer2LoseText:req, partnerId:req, partnerPicId:req
special SavePlayerParty
trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons
trainerbattle TRAINER_BATTLE_SET_TRAINER_B, \trainer2Id, 0, NULL, \trainer2LoseText @ set second trainer mons
multi_do MULTI_BATTLE_2_VS_2, \partnerId, \partnerPicId
.endm
.macro multi_2_vs_1 trainer1Id:req, trainer1LoseText:req, partnerId:req, partnerPicId:req
special SavePlayerParty
trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons
multi_do MULTI_BATTLE_2_VS_1, \partnerId, \partnerPicId
.endm
@ Wild mons need to be assigned to gEnemyParty 0 and 3 slots, other slots need to be cleared out.
.macro multi_wild partnerId:req, partnerPicId:req
special SavePlayerParty
multi_do MULTI_BATTLE_2_VS_WILD, \partnerId, \partnerPicId
.endm
.macro multi_do_fixed type:req, partnerId:req, partnerPicId:req
setvar VAR_0x8004, SPECIAL_BATTLE_MULTI
setvar VAR_0x8005, \type
setvar VAR_0x8006, \partnerId
setvar VAR_0x8007, \partnerPicId
special DoSpecialTrainerBattle
waitstate
setvar VAR_0x8004, FRONTIER_UTIL_FUNC_SAVE_PARTY
special CallFrontierUtilFunc
special LoadPlayerParty
.endm
.macro multi_fixed_2_vs_2 trainer1Id:req, trainer1LoseText:req, trainer2Id:req, trainer2LoseText:req, partnerId:req, partnerPicId:req
special SavePlayerParty
trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons
trainerbattle TRAINER_BATTLE_SET_TRAINER_B, \trainer2Id, 0, NULL, \trainer2LoseText @ set second trainer mons
multi_do_fixed MULTI_BATTLE_2_VS_2, \partnerId, \partnerPicId
.endm
.macro multi_fixed_2_vs_1 trainer1Id:req, trainer1LoseText:req, partnerId:req, partnerPicId:req
special SavePlayerParty
trainerbattle TRAINER_BATTLE_SET_TRAINER_A, \trainer1Id, 0, NULL, \trainer1LoseText @ set first trainer mons
multi_do_fixed MULTI_BATTLE_2_VS_1, \partnerId, \partnerPicId
.endm
@ Wild mons need to be assigned to gEnemyParty 0 and 3 slots, other slots need to be cleared out.
.macro multi_fixed_wild partnerId:req, partnerPicId:req
special SavePlayerParty
multi_do_fixed MULTI_BATTLE_2_VS_WILD, \partnerId, \partnerPicId
.endm

View File

@ -29,11 +29,11 @@
.byte 0x6
.endm
.macro adjustnormaldamage
.macro adjustdamage
.byte 0x7
.endm
.macro adjustnormaldamage2
.macro multihitresultmessage
.byte 0x8
.endm
@ -143,14 +143,14 @@
.macro jumpifability param0:req, ability:req, ptr:req
.byte 0x1e
.byte \param0
.byte \ability
.2byte \ability
.4byte \ptr
.endm
.macro jumpifsideaffecting battler:req, sidestatus:req, ptr:req
.byte 0x1f
.byte \battler
.2byte \sidestatus
.4byte \sidestatus
.4byte \ptr
.endm
@ -171,13 +171,22 @@
.4byte \ptr
.endm
.macro jumpiftype battler:req, type:req, ptr:req
.macro jumpbasedontype battler:req, type:req, case:req, ptr:req
.byte 0x22
.byte \battler
.byte \type
.byte \case
.4byte \ptr
.endm
.macro jumpiftype battler:req, type:req, ptr:req
jumpbasedontype \battler, \type, 1, \ptr
.endm
.macro jumpifnottype battler:req, type:req, ptr:req
jumpbasedontype \battler, \type, 0, \ptr
.endm
.macro getexp battler:req
.byte 0x23
.byte \battler
@ -356,16 +365,13 @@
.4byte \ptr
.endm
.macro jumpiftype2 battler:req, type:req, ptr:req
.macro setroost
.byte 0x42
.byte \battler
.byte \type
.4byte \ptr
.endm
.macro jumpifabilitypresent ability:req, ptr:req
.byte 0x43
.byte \ability
.2byte \ability
.4byte \ptr
.endm
@ -403,41 +409,42 @@
.byte \param0
.byte \param1
.endm
@ Help macros for 5 uses of moveend command
@ All cases
.macro moveendall
setbyte sMOVEEND_STATE, 0
moveend 0, 0
.endm
@ Chosen case
.macro moveendcase case:req
setbyte sMOVEEND_STATE, \case
moveend 1, 0
.endm
@ All cases from (inclusive)
.macro moveendfrom from:req
setbyte sMOVEEND_STATE, \from
moveend 0, 0
.endm
@ All cases from 0 to (not inclusive)
.macro moveendto to:req
setbyte sMOVEEND_STATE, 0
moveend 2, \to
.endm
@ Cases from (inclusive) to (not inclusive)
.macro moveendfromto from:req, to:req
setbyte sMOVEEND_STATE, \from
moveend 2, \to
.endm
.macro typecalc2
.macro sethealblock ptr
.byte 0x4a
.4byte \ptr
.endm
.macro returnatktoball
@ -593,8 +600,9 @@
.byte 0x68
.endm
.macro adjustsetdamage
.macro setgravity ptr
.byte 0x69
.4byte \ptr
.endm
.macro removeitem battler:req
@ -623,7 +631,7 @@
.byte \battler
.endm
.macro recordlastability battler:req
.macro recordability battler:req
.byte 0x70
.byte \battler
.endm
@ -711,8 +719,9 @@
.4byte \ptr
.endm
.macro nop
.macro setmiracleeye ptr
.byte 0x83
.4byte \ptr
.endm
.macro jumpifcantmakeasleep param0:req
@ -720,8 +729,9 @@
.4byte \param0
.endm
.macro stockpile
.macro stockpile id:req
.byte 0x85
.byte \id
.endm
.macro stockpiletobasedamage param0:req
@ -734,13 +744,13 @@
.4byte \param0
.endm
.macro negativedamage
.macro setdrainedhp
.byte 0x88
.endm
.macro statbuffchange flags:req, jumpptr:req
.byte 0x89
.byte \flags
.2byte \flags
.4byte \jumpptr
.endm
@ -895,8 +905,9 @@
.byte 0xab
.endm
.macro remaininghptopower
.macro settailwind ptr:req
.byte 0xac
.4byte \ptr
.endm
.macro tryspiteppreduce param0:req
@ -927,7 +938,7 @@
.4byte \param0
.endm
.macro rolloutdamagecalculation
.macro handlerollout
.byte 0xb3
.endm
@ -937,12 +948,13 @@
.4byte \ptr
.endm
.macro furycuttercalc
.macro handlefurycutter
.byte 0xb5
.endm
.macro happinesstodamagecalculation
.macro setembargo ptr
.byte 0xb6
.4byte \ptr
.endm
.macro presentdamagecalculation
@ -989,8 +1001,9 @@
.4byte \param0
.endm
.macro hiddenpowercalc
.macro setstickyweb ptr
.byte 0xc1
.4byte \ptr
.endm
.macro selectfirstvalidtarget
@ -1082,13 +1095,14 @@
.4byte \param1
.endm
.macro trysetroots param0:req
.macro settoxicspikes ptr:req
.byte 0xd5
.4byte \param0
.4byte \ptr
.endm
.macro doubledamagedealtifdamaged
.macro setgastroacid ptr
.byte 0xd6
.4byte \ptr
.endm
.macro setyawn param0:req
@ -1101,7 +1115,7 @@
.4byte \param0
.endm
.macro scaledamagebyhealthratio
.macro setroom
.byte 0xd9
.endm
@ -1115,13 +1129,15 @@
.4byte \param0
.endm
.macro trysetgrudge param0:req
.macro setstealthrock ptr:req
.byte 0xdc
.4byte \param0
.4byte \ptr
.endm
.macro weightdamagecalculation
.macro setuserstatus3 flags ptr
.byte 0xdd
.4byte \flags
.4byte \ptr
.endm
.macro assistattackselect param0:req
@ -1176,8 +1192,9 @@
.4byte \param0
.endm
.macro setweatherballtype
.macro jumpifsubstituteblocks ptr
.byte 0xe9
.4byte \ptr
.endm
.macro tryrecycleitem param0:req
@ -1245,165 +1262,559 @@
.byte 0xf8
.byte \param0
.endm
.macro settelekinesis ptr:req
.byte 0xf9
.4byte \ptr
.endm
.macro swapstatstages stat:req
.byte 0xfa
.byte \stat
.endm
.macro averagestats stat:req
.byte 0xfb
.byte \stat
.endm
.macro jumpifoppositegenders ptr:req
.byte 0xfc
.4byte \ptr
.endm
.macro trygetbaddreamstarget ptr:req
.byte 0xfd
.4byte \ptr
.endm
.macro tryworryseed ptr:req
.byte 0xfe
.4byte \ptr
.endm
.macro metalburstdamagecalculator ptr:req
.byte 0xff
.4byte \ptr
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
.endm
.macro setmagiccoattarget battler:req
various \battler, VARIOUS_SET_MAGIC_COAT_TARGET
.endm
.macro getifcantrunfrombattle battler:req
various \battler, VARIOUS_IS_RUNNING_IMPOSSIBLE
.endm
.macro getmovetarget battler:req
various \battler, VARIOUS_GET_MOVE_TARGET
.endm
.macro getbattlerfainted battler:req
various \battler, VARIOUS_GET_BATTLER_FAINTED
.endm
.macro resetintimidatetracebits battler:req
various \battler, VARIOUS_RESET_INTIMIDATE_TRACE_BITS
.endm
.macro updatechoicemoveonlvlup battler:req
various \battler, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP
.endm
.macro various7 battler:req
various \battler, 7
.endm
.macro palaceflavortext battler:req
various \battler, VARIOUS_PALACE_FLAVOR_TEXT
.endm
.macro arenajudgmentwindow
various BS_ATTACKER, VARIOUS_ARENA_JUDGMENT_WINDOW
.endm
.macro arenaopponentmonlost
various BS_ATTACKER, VARIOUS_ARENA_OPPONENT_MON_LOST
.endm
.macro arenaplayermonlost
various BS_ATTACKER, VARIOUS_ARENA_PLAYER_MON_LOST
.endm
.macro arenabothmonlost
various BS_ATTACKER, VARIOUS_ARENA_BOTH_MONS_LOST
.endm
.macro forfeityesnobox battler:req
various \battler, VARIOUS_EMIT_YESNOBOX
.endm
.macro various14 battler:req
various \battler, 14
.endm
.macro various15 battler:req
various \battler, 15
.endm
.macro arenajudmengtstring id:req
various \id, VARIOUS_ARENA_JUDGMENT_STRING
.endm
.macro arenawaitmessage id:req
various \id, VARIOUS_ARENA_WAIT_STRING
.endm
.macro waitcry battler:req
various \battler, VARIOUS_WAIT_CRY
.endm
.macro returnopponentmon1toball battler:req
various \battler, VARIOUS_RETURN_OPPONENT_MON1
.endm
.macro returnopponentmon2toball battler:req
various \battler, VARIOUS_RETURN_OPPONENT_MON2
.endm
.macro volumedown
various BS_ATTACKER, VARIOUS_VOLUME_DOWN
.endm
.macro volumeup
various BS_ATTACKER, VARIOUS_VOLUME_UP
.endm
.macro setalreadystatusedmoveattempt battler:req
various \battler, 23
.endm
.macro various24 battler:req
various \battler, 24
.endm
.macro setoutcomeonteleport battler:req
various \battler, VARIOUS_SET_TELEPORT_OUTCOME
.endm
.macro playtrainerdefeatbgm battler:req
various \battler, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC
.endm
.macro stattextbuffer battler:req
various \battler, VARIOUS_STAT_TEXT_BUFFER
.endm
.macro switchinabilities battler:req
various \battler, VARIOUS_SWITCHIN_ABILITIES
.endm
.macro savetarget
various BS_TARGET, VARIOUS_SAVE_TARGET
.endm
.macro restoretarget
various BS_TARGET, VARIOUS_RESTORE_TARGET
.endm
.macro instanthpdrop battler:req
various \battler, VARIOUS_INSTANT_HP_DROP
.endm
.macro clearstatus battler:req
various \battler, VARIOUS_CLEAR_STATUS
.endm
.macro restorepp battler:req
various \battler, VARIOUS_RESTORE_PP
.endm
.macro tryactivatemoxie battler:req
various \battler, VARIOUS_TRY_ACTIVATE_MOXIE
.endm
.macro tryactivatebeastboost battler:req
various \battler, VARIOUS_TRY_ACTIVATE_BEAST_BOOST
.endm
.macro tryactivatereceiver battler:req
various \battler, VARIOUS_TRY_ACTIVATE_RECEIVER
.endm
.macro tryactivatesoulheart
various BS_ATTACKER, VARIOUS_TRY_ACTIVATE_SOULHEART
.endm
.macro tryactivatefellstinger battler:req
various \battler, VARIOUS_TRY_ACTIVATE_FELL_STINGER
.endm
.macro playmoveanimation battler:req, move:req
various \battler, VARIOUS_PLAY_MOVE_ANIMATION
.2byte \move
.endm
.macro setluckychant battler:req, ptr:req
various \battler VARIOUS_SET_LUCKY_CHANT
.4byte \ptr
.endm
.macro suckerpunchcheck ptr:req
various BS_ATTACKER, VARIOUS_SUCKER_PUNCH_CHECK
.4byte \ptr
.endm
.macro setabilitysimple battler:req, ptr:req
various \battler VARIOUS_SET_SIMPLE_BEAM
.4byte \ptr
.endm
.macro tryentrainment ptr:req
various BS_ATTACKER, VARIOUS_TRY_ENTRAINMENT
.4byte \ptr
.endm
.macro setlastusedability battler:req
various \battler, VARIOUS_SET_LAST_USED_ABILITY
.endm
.macro tryhealpulse battler:req, ptr:req
various \battler, VARIOUS_TRY_HEAL_PULSE
.4byte \ptr
.endm
.macro tryquash ptr:req
various BS_ATTACKER, VARIOUS_TRY_QUASH
.4byte \ptr
.endm
.macro tryafteryou ptr:req
various BS_ATTACKER, VARIOUS_AFTER_YOU
.4byte \ptr
.endm
.macro trybestow ptr:req
various BS_ATTACKER, VARIOUS_BESTOW
.4byte \ptr
.endm
.macro invertstatstages battler:req
various \battler, VARIOUS_INVERT_STAT_STAGES
.endm
.macro setterrain ptr:req
various BS_ATTACKER, VARIOUS_SET_TERRAIN
.4byte \ptr
.endm
.macro trymefirst ptr:req
various BS_ATTACKER, VARIOUS_TRY_ME_FIRST
.4byte \ptr
.endm
.macro jumpifbattleend ptr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_BATTLE_END
.4byte \ptr
.endm
.macro tryelectrify ptr:req
various BS_ATTACKER, VARIOUS_TRY_ELECTRIFY
.4byte \ptr
.endm
.macro tryreflecttype ptr:req
various BS_ATTACKER, VARIOUS_TRY_REFLECT_TYPE
.4byte \ptr
.endm
.macro trysoak ptr:req
various BS_ATTACKER, VARIOUS_TRY_SOAK
.4byte \ptr
.endm
.macro handlemegaevo battler:req, case:req
various \battler, VARIOUS_HANDLE_MEGA_EVO
.byte \case
.endm
.macro handleformchange battler:req, case:req
various \battler, VARIOUS_HANDLE_FORM_CHANGE
.byte \case
.endm
.macro jumpifcantuselastresort battler:req, ptr:req
various \battler, VARIOUS_TRY_LAST_RESORT
.4byte \ptr
.endm
.macro argumentstatuseffect
various BS_ATTACKER, VARIOUS_ARGUMENT_STATUS_EFFECT
.endm
.macro tryhitswitchtarget ptr:req
various BS_ATTACKER, VARIOUS_TRY_HIT_SWITCH_TARGET
.4byte \ptr
.endm
.macro tryautotomize battler:req, ptr:req
various \battler, VARIOUS_TRY_AUTOTOMIZE
.4byte \ptr
.endm
.macro jumpifcantusesynchronoise ptr:req
various BS_ATTACKER, VARIOUS_TRY_SYNCHRONOISE
.4byte \ptr
.endm
.macro trycopycat ptr:req
various BS_ATTACKER, VARIOUS_TRY_COPYCAT
.4byte \ptr
.endm
.macro showabilitypopup battler:req
various \battler, VARIOUS_ABILITY_POPUP
.endm
.macro defogclear battler:req, clear:req, ptr:req
various \battler, VARIOUS_DEFOG
.byte \clear
.4byte \ptr
.endm
.macro jumpiftargetally ptr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_TARGET_ALLY
.4byte \ptr
.endm
.macro trypsychoshift ptr:req
various BS_ATTACKER, VARIOUS_PSYCHO_SHIFT
.4byte \ptr
.endm
.macro curestatus battler:req
various \battler, VARIOUS_CURE_STATUS
.endm
.macro powertrick battler:req
various \battler, VARIOUS_POWER_TRICK
.endm
.macro argumenttomoveeffect
various BS_ATTACKER, VARIOUS_ARGUMENT_TO_MOVE_EFFECT
.endm
.macro jumpifnotgrounded battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_NOT_GROUNDED
.4byte \ptr
.endm
.macro handletrainerslidemsg battler:req, field:req
various \battler, VARIOUS_HANDLE_TRAINER_SLIDE_MSG
.byte \field
.endm
.macro trytrainerslidefirstdownmsg battler:req
various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF
.endm
.macro trytrainerslidelastonmsg battler:req
various \battler, VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON
.endm
.macro setauroraveil battler:req
various \battler, VARIOUS_SET_AURORA_VEIL
.endm
.macro trysetthirdtype battler:req, ptr:req
various \battler, VARIOUS_TRY_THIRD_TYPE
.4byte \ptr
.endm
.macro tryaccupressure battler:req, ptr:req
various \battler, VARIOUS_ACUPRESSURE
.4byte \ptr
.endm
.macro setpowder battler:req
various \battler, VARIOUS_SET_POWDER
.endm
.macro spectralthiefprintstats
various BS_ATTACKER, VARIOUS_SPECTRAL_THIEF
.endm
.macro bringdownairbornebattler battler:req
various \battler, VARIOUS_GRAVITY_ON_AIRBORNE_MONS
.endm
.macro checkgrassyterrainheal battler:req, ptr:req
various \battler, VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS
.4byte \ptr
.endm
.macro jumpifnotberry battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_NOT_BERRY
.4byte \ptr
.endm
.macro jumpifroarfails ptr:req
various BS_ATTACKER, VARIOUS_JUMP_IF_ROAR_FAILS
.4byte \ptr
.endm
.macro tryinstruct ptr:req
various BS_ATTACKER, VARIOUS_TRY_INSTRUCT
.4byte \ptr
.endm
.macro settracedability battler:req
various \battler, VARIOUS_TRACE_ABILITY
.endm
.macro updatenick battler:req
various \battler, VARIOUS_UPDATE_NICK
.endm
.macro tryillusionoff battler:req
various \battler, VARIOUS_TRY_ILLUSION_OFF
.endm
.macro spriteignore0hp val:req
various BS_ATTACKER, VARIOUS_SET_SPRITEIGNORE0HP
.byte \val
.endm
.macro getstatvalue battler:req, statId:req
various \battler, VARIOUS_GET_STAT_VALUE
.byte \statId
.endm
.macro jumpiffullhp battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_FULL_HP
.4byte \ptr
.endm
.macro losetype battler:req, type:req
various \battler, VARIOUS_LOSE_TYPE
.byte \type
.endm
.macro tryfriskmsg battler:req
various \battler, VARIOUS_TRY_FRISK
.endm
.macro jumpifshieldsdown battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_SHIELDS_DOWN_PROTECTED
.4byte \ptr
.endm
.macro trypoisontype attacker:req, target:req, ptr:req
various \attacker, VARIOUS_POISON_TYPE_IMMUNITY
.byte \target
.4byte \ptr
.endm
.macro tryparalyzetype attacker:req, target:req, ptr:req
various \attacker, VARIOUS_PARALYZE_TYPE_IMMUNITY
.byte \target
.4byte \ptr
.endm
.macro trysetfairylock ptr:req
various BS_ATTACKER, VARIOUS_TRY_FAIRY_LOCK
.4byte \ptr
.endm
.macro jumpifnoally battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_NO_ALLY
.4byte \ptr
.endm
.macro jumpifnoholdeffect battler:req, holdEffet:req, ptr:req
various \battler, VARIOUS_JUMP_IF_NO_HOLD_EFFECT
.byte \holdEffet
.4byte \ptr
.endm
.macro infatuatewithbattler battler1:req, battler2:req
various \battler1, VARIOUS_INFATUATE_WITH_BATTLER
.byte \battler2
.endm
.macro setlastuseditem battler:req
various \battler, VARIOUS_SET_LAST_USED_ITEM
.endm
.macro jumpifabsent battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_ABSENT
.4byte \ptr
.endm
.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
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
.endm
.macro setmoveeffect effect:req
setbyte cEFFECT_CHOOSER \effect
sethword sMOVE_EFFECT \effect
sethword sSAVED_MOVE_EFFECT \effect
.endm
.macro chosenstatus1animation battler:req, status:req
chosenstatusanimation \battler, 0x0, \status
.endm
.macro chosenstatus2animation battler:req, status:req
chosenstatusanimation \battler, 0x1, \status
.endm
.macro sethword dst:req, value:req
setbyte \dst, (\value) & 0xFF
setbyte \dst + 1, ((\value) >> 8) & 0xFF
.endm
.macro setword dst:req, value:req
setbyte \dst, (\value) & 0xFF
setbyte \dst + 1, ((\value) >> 8) & 0xFF
setbyte \dst + 2, ((\value) >> 16) & 0xFF
setbyte \dst + 3, ((\value) >> 24) & 0xFF
.endm
.macro copybyte dst:req, src:req
copyarray \dst, \src, 0x1
.endm
.macro copyhword dst:req, src:req
copyarray \dst, \src, 0x2
.endm
.macro copyword dst:req, src:req
copyarray \dst, \src, 0x4
.endm
.macro jumpifbytenotequal byte1:req, byte2:req, jumpptr:req
jumpifarraynotequal \byte1, \byte2, 0x1, \jumpptr
.endm
.macro jumpifbyteequal byte1:req, byte2:req, jumpptr:req
jumpifarrayequal \byte1, \byte2, 0x1, \jumpptr
.endm
.macro jumpifmove move:req, jumpptr:req
jumpifhalfword CMP_EQUAL, gCurrentMove, \move, \jumpptr
.endm
@ -1411,23 +1822,71 @@
.macro jumpifnotmove move:req, jumpptr:req
jumpifhalfword CMP_NOT_EQUAL, gCurrentMove, \move, \jumpptr
.endm
.macro jumpifstatus3 battler:req, status:req, jumpptr:req
.macro jumpifnotchosenmove move:req, jumpptr:req
jumpifhalfword CMP_NOT_EQUAL, gChosenMove, \move, \jumpptr
.endm
.macro jumpifstatus3 battler, status:req, jumpptr:req
jumpifstatus3condition \battler, \status, 0x0, \jumpptr
.endm
.macro jumpifnostatus3 battler:req, status:req, jumpptr:req
jumpifstatus3condition \battler, \status, 0x1, \jumpptr
.endm
.macro jumpifmovehadnoeffect jumpptr:req
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_NO_EFFECT, \jumpptr
.endm
.macro jumpifbattletype flags:req, jumpptr:req
jumpifword CMP_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
.endm
.macro jumpifnotbattletype flags:req, jumpptr:req
jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr
.endm
.macro dmg_1_8_targethp
manipulatedamage DMG_1_8_TARGET_HP
.endm
.macro dmgtomaxattackerhp
manipulatedamage DMG_FULL_ATTACKER_HP
.endm
.macro dmgtocurrattackerhp
manipulatedamage DMG_CURR_ATTACKER_HP
.endm
.macro dmg_1_2_attackerhp
manipulatedamage DMG_1_2_ATTACKER_HP
.endm
.macro jumpifflowerveil jumpptr:req
jumpifnottype BS_TARGET, TYPE_GRASS, 1f
jumpifability BS_TARGET_SIDE, ABILITY_FLOWER_VEIL, \jumpptr
1:
.endm
.macro setallytonexttarget jumpptr:req
jumpifbyte CMP_GREATER_THAN, gBattlerTarget, 0x1, 1f
addbyte gBattlerTarget, 0x2
goto \jumpptr
1:
subbyte gBattlerTarget, 0x2
goto \jumpptr
.endm
.macro jumpifleafguard jumpptr:req
jumpifhalfword CMP_NO_COMMON_BITS, gBattleWeather, WEATHER_SUN_ANY, 1f
jumpifability BS_TARGET, ABILITY_LEAF_GUARD, \jumpptr
1:
.endm
.macro jumpifsafeguard jumpptr:req
jumpifability BS_ATTACKER, ABILITY_INFILTRATOR, 1f
jumpifsideaffecting BS_TARGET, SIDE_STATUS_SAFEGUARD, \jumpptr
1:
.endm

View File

@ -1327,13 +1327,19 @@
.2byte \count
.endm
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect
@ normal wild battles. You start the prepared battle with dowildbattle.
.macro setwildbattle species:req, level:req, item:req
@ Prepares to start a wild battle against a species at Level level holding item.
@ If species2 is something other than SPECIES_NONE, then the battle is a double battle with another pokemon
@ with species species2 at Level level2 holding item2.
@ Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
@ If the player only has one pokemon, a scripted double battle will be buggy.
.macro setwildbattle species:req, level:req, item:req, species2=SPECIES_NONE, level2=0, item2=ITEM_NONE
.byte 0xb6
.2byte \species
.byte \level
.2byte \item
.2byte \species2
.byte \level2
.2byte \item2
.endm
@ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
@ -1778,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

@ -150,3 +150,15 @@
.4byte \sample
.byte 0xff, 0, 0xff, 0
.endm
.macro cry_uncomp sample @ not compressed
.byte 0x0, 60, 0, 0
.4byte \sample
.byte 0xff, 0, 0xff, 0
.endm
.macro cry2_uncomp sample @ not compressed
.byte 0x10, 60, 0, 0
.4byte \sample
.byte 0xff, 0, 0xff, 0
.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

@ -400,6 +400,15 @@ B_TRAINER2_WIN_TEXT = FD 31
B_PARTNER_CLASS = FD 32
B_PARTNER_NAME = FD 33
B_BUFF3 = FD 34
B_ATK_TRAINER_NAME = FD 35
B_ATK_TRAINER_CLASS = FD 36
B_ATK_TEAM1 = FD 37
B_ATK_TEAM2 = FD 38
B_DEF_NAME = FD 39
B_DEF_TEAM1 = FD 3A
B_DEF_TEAM2 = FD 3B
B_ACTIVE_NAME = FD 3C
B_ACTIVE_NAME2 = FD 3D @ no Illusion check
@ indicates the end of a town/city name (before " TOWN" or " CITY")
NAME_END = FC 00

View File

@ -1 +1 @@
gUnknown_030062E8
gFactorySelect_CurrentOptionFunc

View File

@ -1,12 +1,43 @@
.equiv ID_NUMBER, 0x68736d53
.equiv PCM_DMA_BUF_SIZE, 1584
.equiv MAX_DIRECTSOUND_CHANNELS, 12
.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 +47,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 +85,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
@ -41,12 +94,12 @@
struct_field o_SoundInfo_plynote, 4
struct_field o_SoundInfo_ExtVolPit, 4
struct_field o_SoundInfo_gap2, 16
struct_field o_SoundInfo_chans, 768
struct_field o_SoundInfo_chans, MAX_DIRECTSOUND_CHANNELS * 64
struct_field o_SoundInfo_pcmBuffer, PCM_DMA_BUF_SIZE * 2
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 +107,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 +165,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 +212,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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
#include "constants/battle_script_commands.h"
#include "constants/battle_anim.h"
#include "constants/battle_string_ids.h"
#include "constants/battle_config.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/game_stat.h"
@ -25,6 +26,21 @@ gBattlescriptsForBallThrow:: @ 82DBD08
.4byte BattleScript_BallThrow @ ITEM_REPEAT_BALL
.4byte BattleScript_BallThrow @ ITEM_TIMER_BALL
.4byte BattleScript_BallThrow @ ITEM_LUXURY_BALL
.4byte BattleScript_BallThrow @ ITEM_DUSK_BALL
.4byte BattleScript_BallThrow @ ITEM_HEAL_BALL
.4byte BattleScript_BallThrow @ ITEM_QUICK_BALL
.4byte BattleScript_BallThrow @ ITEM_CHERISH_BALL
.4byte BattleScript_BallThrow @ ITEM_FAST_BALL
.4byte BattleScript_BallThrow @ ITEM_LEVEL_BALL
.4byte BattleScript_BallThrow @ ITEM_LURE_BALL
.4byte BattleScript_BallThrow @ ITEM_HEAVY_BALL
.4byte BattleScript_BallThrow @ ITEM_LOVE_BALL
.4byte BattleScript_BallThrow @ ITEM_FRIEND_BALL
.4byte BattleScript_BallThrow @ ITEM_MOON_BALL
.4byte BattleScript_BallThrow @ ITEM_SPORT_BALL
.4byte BattleScript_BallThrow @ ITEM_PARK_BALL
.4byte BattleScript_BallThrow @ ITEM_DREAM_BALL
.4byte BattleScript_BallThrow @ ITEM_BEAST_BALL
.4byte BattleScript_BallThrow @ ITEM_PREMIER_BALL
.align 2
@ -62,10 +78,16 @@ BattleScript_SafariBallThrow::
handleballthrow
BattleScript_SuccessBallThrow::
setbyte sMON_CAUGHT, TRUE
jumpifhalfword CMP_EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_PrintCaughtMonInfo
incrementgamestat GAME_STAT_POKEMON_CAPTURES
BattleScript_PrintCaughtMonInfo::
printstring STRINGID_GOTCHAPKMNCAUGHT
jumpifbyte CMP_NOT_EQUAL, sEXP_CATCH, TRUE, BattleScript_TryPrintCaughtMonInfo
setbyte sGIVEEXP_STATE, 0x0
getexp BS_TARGET
sethword gBattle_BG2_X, 0x0
BattleScript_TryPrintCaughtMonInfo:
trysetcaughtmondexflags BattleScript_TryNicknameCaughtMon
printstring STRINGID_PKMNDATAADDEDTODEX
waitstate
@ -121,6 +143,7 @@ BattleScript_OpponentUsesHealItem::
playse SE_USE_ITEM
printstring STRINGID_TRAINER1USEDITEM
waitmessage 0x40
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
useitemonopponent
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER
@ -205,3 +228,17 @@ BattleScript_ActionWallyThrow:
printstring STRINGID_YOUTHROWABALLNOWRIGHT
waitmessage 0x40
end2
BattleScript_TrainerSlideMsgRet::
handletrainerslidemsg BS_SCRIPTING, 0
trainerslidein 1
handletrainerslidemsg BS_SCRIPTING, 1
waitstate
trainerslideout 1
handletrainerslidemsg BS_SCRIPTING, 2
waitstate
return
BattleScript_TrainerSlideMsgEnd2::
call BattleScript_TrainerSlideMsgRet
end2

View File

@ -168,7 +168,7 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_SwapMons:: @ 8259DF2
fadescreen FADE_TO_BLACK
factory_swapmons
waitstate
compare VAR_RESULT, 1
compare VAR_RESULT, TRUE @ Did player keep current pokemon
goto_if_eq BattleFrontier_BattleFactoryPreBattleRoom_EventScript_EnterBattleRoom
factory_setswapped
msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_YourSwapIsComplete, MSGBOX_DEFAULT

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

@ -3,5 +3,5 @@ CaveOfOrigin_1F_MapScripts:: @ 8235768
.byte 0
CaveOfOrigin_1F_OnTransition: @ 823576E
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers
end

View File

@ -3,5 +3,5 @@ CaveOfOrigin_UnusedRubySapphireMap1_MapScripts:: @ 8235778
.byte 0
CaveOfOrigin_UnusedRubySapphireMap1_OnTransition: @ 823577E
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers
end

View File

@ -3,6 +3,6 @@ CaveOfOrigin_UnusedRubySapphireMap2_MapScripts:: @ 8235788
.byte 0
CaveOfOrigin_UnusedRubySapphireMap2_OnTransition: @ 823578E
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers
end

View File

@ -3,6 +3,6 @@ CaveOfOrigin_UnusedRubySapphireMap3_MapScripts:: @ 8235798
.byte 0
CaveOfOrigin_UnusedRubySapphireMap3_OnTransition: @ 823579E
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars
call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers
end

View File

@ -19,10 +19,10 @@ FallarborTown_Mart_Pokemart: @ 81FFCD8
.2byte ITEM_PARALYZE_HEAL
.2byte ITEM_ESCAPE_ROPE
.2byte ITEM_SUPER_REPEL
.2byte ITEM_X_SPECIAL
.2byte ITEM_X_SP_ATK
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_DIRE_HIT
.2byte ITEM_GUARD_SPEC
.2byte ITEM_NONE

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

@ -35,9 +35,9 @@ LilycoveCity_DepartmentStore_3F_EventScript_ClerkRight:: @ 821FC8C
.align 2
LilycoveCity_DepartmentStore_3F_Pokemart_StatBoosters: @ 821FCA4
.2byte ITEM_X_SPEED
.2byte ITEM_X_SPECIAL
.2byte ITEM_X_SP_ATK
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_DIRE_HIT
.2byte ITEM_GUARD_SPEC
.2byte ITEM_X_ACCURACY

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

@ -21,7 +21,7 @@ MauvilleCity_Mart_Pokemart: @ 8211100
.2byte ITEM_AWAKENING
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_GUARD_SPEC
.2byte ITEM_DIRE_HIT
.2byte ITEM_X_ACCURACY

View File

@ -21,7 +21,7 @@ MossdeepCity_Mart_Pokemart: @ 82223E0
.2byte ITEM_REVIVE
.2byte ITEM_MAX_REPEL
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_NONE
release
end

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

@ -23,7 +23,7 @@ PetalburgCity_Mart_Pokemart_Basic: @ 8207D8C
.2byte ITEM_REPEL
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_ORANGE_MAIL
.2byte ITEM_NONE
release
@ -48,7 +48,7 @@ PetalburgCity_Mart_Pokemart_Expanded: @ 8207DB8
.2byte ITEM_REPEL
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_ORANGE_MAIL
.2byte ITEM_NONE
release

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

@ -26,7 +26,7 @@ RustboroCity_Mart_Pokemart_Basic: @ 8214F30
.2byte ITEM_REPEL
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_NONE
release
end
@ -50,7 +50,7 @@ RustboroCity_Mart_Pokemart_Expanded: @ 8214F58
.2byte ITEM_REPEL
.2byte ITEM_X_SPEED
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_NONE
release
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

@ -19,7 +19,7 @@ SootopolisCity_Mart_Pokemart: @ 82267AC
.2byte ITEM_REVIVE
.2byte ITEM_MAX_REPEL
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_SHADOW_MAIL
.2byte ITEM_NONE
release

View File

@ -266,9 +266,9 @@ TrainerHill_Entrance_Pokemart_Basic: @ 82683E8
.2byte ITEM_PARALYZE_HEAL
.2byte ITEM_AWAKENING
.2byte ITEM_X_SPEED
.2byte ITEM_X_SPECIAL
.2byte ITEM_X_SP_ATK
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_DIRE_HIT
.2byte ITEM_GUARD_SPEC
.2byte ITEM_X_ACCURACY
@ -290,9 +290,9 @@ TrainerHill_Entrance_Pokemart_Expanded: @ 8268414
.2byte ITEM_FULL_HEAL
.2byte ITEM_REVIVE
.2byte ITEM_X_SPEED
.2byte ITEM_X_SPECIAL
.2byte ITEM_X_SP_ATK
.2byte ITEM_X_ATTACK
.2byte ITEM_X_DEFEND
.2byte ITEM_X_DEFENSE
.2byte ITEM_DIRE_HIT
.2byte ITEM_GUARD_SPEC
.2byte ITEM_X_ACCURACY

View File

@ -22,7 +22,7 @@ VerdanturfTown_Mart_Pokemart: @ 82025A0
.2byte ITEM_BURN_HEAL
.2byte ITEM_ICE_HEAL
.2byte ITEM_REPEL
.2byte ITEM_X_SPECIAL
.2byte ITEM_X_SP_ATK
.2byte ITEM_FLUFFY_TAIL
.2byte ITEM_NONE
release

View File

@ -209,7 +209,7 @@ gScriptCmdTable:: @ 81DB67C
.4byte ScrCmd_checkmonobedience @ 0xce
.4byte ScrCmd_gotoram @ 0xcf
.4byte ScrCmd_nop1 @ 0xd0
.4byte ScrCmd_warpD1 @ 0xd1
.4byte ScrCmd_warpspinenter @ 0xd1
.4byte ScrCmd_setmonmetlocation @ 0xd2
.4byte ScrCmd_moverotatingtileobjects @ 0xd3
.4byte ScrCmd_turnrotatingtileobjects @ 0xd4

View File

@ -36,7 +36,7 @@ CaveOfOrigin_EventScript_Shake:: @ 82722A7
releaseall
end
CaveOfOrigin_EventScript_SetTempVars:: @ 82722C1
CaveOfOrigin_EventScript_DisableTriggers:: @ 82722C1
setvar VAR_TEMP_1, 1
setvar VAR_TEMP_2, 1
setvar VAR_TEMP_3, 1

View File

@ -127,7 +127,7 @@ Route115_EventScript_ItemPPUp:: @ 8290E6B
end
Route116_EventScript_ItemXSpecial:: @ 8290E78
finditem ITEM_X_SPECIAL
finditem ITEM_X_SP_ATK
end
Route116_EventScript_ItemEther:: @ 8290E85
@ -315,7 +315,7 @@ MauvilleCity_EventScript_ItemXSpeed:: @ 82910CE
end
RustboroCity_EventScript_ItemXDefend:: @ 82910DB
finditem ITEM_X_DEFEND
finditem ITEM_X_DEFENSE
end
LilycoveCity_EventScript_ItemMaxRepel:: @ 82910E8

View File

@ -65,7 +65,7 @@ EventScript_PkmnCenterNurse_ReturnPkmn:: @ 82719E2
goto_if_eq EventScript_PkmnCenterNurse_ReturnPkmn2
message gText_RestoredPkmnToFullHealth
waitmessage
applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow
applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow
waitmovement 0
message gText_WeHopeToSeeYouAgain
return
@ -73,7 +73,7 @@ EventScript_PkmnCenterNurse_ReturnPkmn:: @ 82719E2
EventScript_PkmnCenterNurse_ReturnPkmn2:: @ 8271A03
message gText_ThankYouForWaiting
waitmessage
applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow
applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow
waitmovement 0
message gText_WeHopeToSeeYouAgain2
return
@ -84,7 +84,7 @@ EventScript_PkmnCenterNurse_PlayerWaitingInUnionRoom:: @ 8271A19
setflag FLAG_NURSE_UNION_ROOM_REMINDER
message CableClub_Text_PlayerIsWaiting
waitmessage
applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow
applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow
waitmovement 0
message gText_WeHopeToSeeYouAgain
return
@ -129,7 +129,7 @@ EventScript_PkmnCenterNurse_GoldCardHealPkmn:: @ 8271AC5
goto EventScript_PkmnCenterNurse_HealPkmn
end
EventScript_PkmnCenterNurse_Bow: @ 8271AD0
Movement_PkmnCenterNurse_Bow: @ 8271AD0
nurse_joy_bow
delay_4
step_end

View File

@ -6,16 +6,15 @@ EventScript_MixRecordsPrompt:: @ 8271D5E
compare VAR_RESULT, YES
goto_if_eq EventScript_MixRecords
compare VAR_RESULT, NO
goto_if_eq EventScript_DeclineMixRecords
goto EventScript_DeclineMixRecords
goto_if_eq EventScript_EndMixRecords
goto EventScript_EndMixRecords
EventScript_MixRecords:: @ 8271D83
special RecordMixingPlayerSpotTriggered
waitstate
lock
faceplayer
EventScript_DeclineMixRecords:: @ 8271D89
EventScript_EndMixRecords:: @ 8271D89
message Text_WeHopeToSeeYouAgain
waitmessage
waitbuttonpress

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` and `UBFIX` preprocessor variables will fix some of these automatically. `UBFIX` will already be defined for MODERN builds.
Fixes are written in the `diff` format. If you've used Git before, this should look familiar:
@ -13,55 +13,9 @@ Fixes are written in the `diff` format. If you've used Git before, this should l
## Contents
- [RNG does not get seeded](#rng-does-not-get-seeded)
- [Scrolling through items in the bag causes the image to flicker](#scrolling-through-items-in-the-bag-causes-the-image-to-flicker)
## RNG does not get seeded
**Fix:** Add the following function to [src/main.c](https://github.com/pret/pokeemerald/blob/master/src/main.c):
```diff
+static void SeedRngWithRtc(void)
+{
+ u32 seed = RtcGetMinuteCount();
+ seed = (seed >> 16) ^ (seed & 0xFFFF);
+ SeedRng(seed);
+}
```
And edit `AgbMain`:
```diff
...
RtcInit();
CheckForFlashMemory();
InitMainCallbacks();
InitMapMusic();
+ SeedRngWithRtc();
ClearDma3Requests();
...
```
This restores the code of Ruby/Sapphire.
**Alternate Fix:** Edit the following function in [src/title_screen.c](https://github.com/pret/pokeemerald/blob/master/src/title_screen.c):
```diff
void CB2_InitTitleScreen(void)
{
switch (gMain.state)
{
default:
case 0:
SetVBlankCallback(NULL);
+ StartTimer1();
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
...
```
This matches with the code of FR/LG and does what GF originally wanted to do.
## Scrolling through items in the bag causes the image to flicker
**Fix:** Add the following function to [src/item_menu_icons.c](https://github.com/pret/pokeemerald/blob/master/src/item_menu_icons.c):
@ -89,9 +43,9 @@ Then edit `BagMenu_MoveCursorCallback` in [src/item_menu.c](https://github.com/p
```diff
...
{
- RemoveBagItemIconSprite(1 ^ gBagMenu->unk81B_1);
+ HideBagItemIconSprite(gBagMenu->unk81B_1 ^ 1);
+ RemoveBagItemIconSprite(gBagMenu->unk81B_1);
if (a != -2)
- RemoveBagItemIconSprite(1 ^ gBagMenu->itemIconSlot);
+ HideBagItemIconSprite(gBagMenu->itemIconSlot ^ 1);
+ RemoveBagItemIconSprite(gBagMenu->itemIconSlot);
if (itemIndex != LIST_CANCEL)
...
```

View File

@ -2,7 +2,7 @@
static void *sHeapStart;
static u32 sHeapSize;
static u32 malloc_c_unused_0300000c; // needed to align dma3_manager.o(.bss)
static u32 sFiller; // needed to align dma3_manager.o(.bss)
#define MALLOC_SYSTEM_ID 0xA3A3

View File

@ -1320,6 +1320,11 @@ void ApplyAffineAnimFrameRelativeAndUpdateMatrix(u8 matrixNum, struct AffineAnim
s16 ConvertScaleParam(s16 scale)
{
s32 val = 0x10000;
// UB: possible division by zero
#ifdef UBFIX
if (scale == 0)
return 0;
#endif //UBFIX
return val / scale;
}

View File

@ -165,7 +165,6 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
{
int i;
u16 j;
u8 *ptr;
if (!gFonts)
return FALSE;
@ -1235,7 +1234,6 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
bool8 isJapanese;
int minGlyphWidth;
u32 (*func)(u16 glyphId, bool32 isJapanese);
s32 result;
int localLetterSpacing;
u32 lineWidth;
const u8 *bufferPointer;

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
131 131 131
123 123 123
115 115 115
106 106 106
98 98 98
82 82 82
65 65 65
49 49 49
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 214 0
255 197 0
255 173 0
255 165 0
148 90 222
255 107 0
255 132 0
255 148 0
255 156 41
0 0 0
0 90 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 214 0
255 197 0
255 173 0
255 165 0
148 90 222
255 107 0
255 132 0
255 148 0
255 156 41
0 0 0
0 90 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
172 222 230
164 213 230
148 205 222
131 205 222
123 197 213
115 189 205
98 180 197
90 180 197
82 172 189
74 164 180
65 156 180
57 131 156
49 115 131
41 82 106
24 74 82

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
246 205 82
238 205 74
238 205 57
246 222 123
238 205 57
238 197 49
230 189 24
246 213 82
255 222 131
255 213 115
255 213 106
255 213 90
246 213 82
255 230 156
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
255 0 0
131 230 255
106 213 255
98 205 255
57 156 180
8 115 123
180 189 172
156 180 164
115 164 131
74 131 106
49 106 65
0 106 74
0 90 49
0 82 24
0 65 0
0 32 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 8 8
255 255 255
222 246 246
189 230 230
156 213 213
131 205 205
115 189 189
90 172 172
65 156 156
49 139 139
32 123 123
16 98 98
0 74 74
0 49 49
0 32 32
0 16 16

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 255
246 189 49
246 172 41
238 156 32
222 131 24
205 115 8
197 65 0
180 57 0
172 90 65
156 74 49
148 65 24
139 74 49
123 65 32
98 49 32
82 32 16
74 24 8

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
131 131 131
123 123 123
115 115 115
106 106 106
98 98 98
82 82 82
65 65 65
49 49 49
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 164 255
255 106 139
255 131 222
255 139 230
255 164 238
255 189 255
255 205 255
246 230 255
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
238 24 32
255 246 205
246 246 222
246 238 189
238 238 213
238 238 205
238 230 197
230 230 180
230 222 164
230 222 172
222 213 139
213 205 123
213 205 115
205 197 106
197 189 106
57 49 65

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 255 0
255 156 0
255 98 0
255 49 0
246 57 16
238 65 16
180 65 24
123 49 24
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
104 168 168
88 144 160
72 112 160
64 64 120
56 80 152
64 80 144
72 64 104
72 56 96
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 98 74
255 90 65
255 82 57
255 139 123
255 74 49
255 65 41
255 57 32
255 106 90
255 148 139
255 131 123
255 123 115
255 115 106
255 106 98
255 164 164
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
180 172 148
159 156 129
137 140 110
115 123 90
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
41 49 49
106 139 189
246 131 180
255 0 255
255 16 98
238 98 164
230 65 131
222 0 57
222 24 90
205 41 74
205 32 82
189 0 49
172 16 65
156 0 41
148 16 49
131 8 32

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 255 255
255 0 255
255 16 98
246 131 180
238 98 164
230 65 131
222 0 57
222 24 90
205 32 82
205 41 74
189 0 49
172 16 65
156 0 41
148 16 49
131 8 32

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
238 24 32
230 255 238
172 255 205
222 255 230
205 255 222
180 255 205
172 255 197
213 255 230
197 255 213
164 255 197
189 255 213
213 255 222
156 246 189
148 246 180
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
205 98 255
197 90 255
197 82 255
213 148 255
197 72 255
197 64 255
189 56 255
205 106 255
222 156 255
205 139 255
205 131 255
205 123 255
205 115 255
230 180 255
0 0 0

Binary file not shown.

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
197 255 255
139 222 246
115 213 255
106 205 255
98 197 255
90 180 246
74 164 238
65 156 238
49 148 230
41 139 230
41 115 213
32 131 222
32 98 205
32 90 197
41 74 180

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

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