Merge remote-tracking branch '_pret/master' into RHH/pr/upcoming/pret_20231210

# Conflicts:
#	Makefile
#	data/battle_scripts_1.s
#	gflib/malloc.c
#	gflib/malloc.h
#	include/battle.h
#	ld_script.ld
#	ld_script_modern.ld
#	src/battle_ai_script_commands.c
#	src/battle_main.c
#	src/battle_script_commands.c
#	src/battle_util.c
#	src/data/pokemon/species_info.h
#	src/pokemon.c
This commit is contained in:
Eduardo Quezada 2023-12-08 17:01:26 -03:00
commit 1fc712f153
32 changed files with 1097 additions and 1097 deletions

1
.gitignore vendored
View file

@ -21,7 +21,6 @@ sound/**/*.bin
sound/songs/midi/*.s sound/songs/midi/*.s
tools/agbcc tools/agbcc
*.map *.map
*.ld
*.bat *.bat
*.dump *.dump
*.sa* *.sa*

View file

@ -146,8 +146,6 @@ ifneq ($(MODERN),1)
CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef
endif endif
LDFLAGS = -Map ../../$(MAP)
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GFX := tools/gbagfx/gbagfx$(EXE) GFX := tools/gbagfx/gbagfx$(EXE)
AIF := tools/aif2pcm/aif2pcm$(EXE) AIF := tools/aif2pcm/aif2pcm$(EXE)
@ -280,8 +278,7 @@ clean-check-tools:
@$(foreach tooldir,$(CHECKTOOLDIRS),$(MAKE) clean -C $(tooldir);) @$(foreach tooldir,$(CHECKTOOLDIRS),$(MAKE) clean -C $(tooldir);)
mostlyclean: tidynonmodern tidymodern tidycheck mostlyclean: tidynonmodern tidymodern tidycheck
rm -f $(SAMPLE_SUBDIR)/*.bin find sound -iname '*.bin' -exec rm {} +
rm -f $(CRY_SUBDIR)/*.bin
rm -f $(MID_SUBDIR)/*.s rm -f $(MID_SUBDIR)/*.s
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} + find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
@ -466,19 +463,20 @@ endef
$(foreach src, $(TEST_SRCS), $(eval $(call TEST_DEP,$(patsubst $(TEST_SUBDIR)/%.c,$(TEST_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(TEST_SUBDIR)/%.c,%,$(src))))) $(foreach src, $(TEST_SRCS), $(eval $(call TEST_DEP,$(patsubst $(TEST_SUBDIR)/%.c,$(TEST_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(TEST_SUBDIR)/%.c,%,$(src)))))
ifeq ($(MODERN),0) ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.txt LD_SCRIPT := ld_script.ld
LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld LD_SCRIPT_DEPS := $(OBJ_DIR)/sym_bss.ld $(OBJ_DIR)/sym_common.ld $(OBJ_DIR)/sym_ewram.ld
else else
LD_SCRIPT := ld_script_modern.txt LD_SCRIPT := ld_script_modern.ld
LD_SCRIPT_DEPS := LD_SCRIPT_DEPS :=
endif endif
$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld
LDFLAGS = -Map ../../$(MAP)
$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall
@echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ <objects> <lib>" @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ <objects> <lib>"
@cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld --print-memory-usage -o ../../$@ $(OBJS_REL) $(LIB) | cat
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
$(ROM): $(ELF) $(ROM): $(ELF)
@ -489,7 +487,7 @@ agbcc: all
modern: all modern: all
LD_SCRIPT_TEST := ld_script_test.txt LD_SCRIPT_TEST := ld_script_test.ld
$(OBJ_DIR)/ld_script_test.ld: $(LD_SCRIPT_TEST) $(LD_SCRIPT_DEPS) $(OBJ_DIR)/ld_script_test.ld: $(LD_SCRIPT_TEST) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT_TEST) > ld_script_test.ld cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT_TEST) > ld_script_test.ld

View file

@ -1209,7 +1209,7 @@ BattleScript_EffectClangorousSoul:
attackstring attackstring
ppreduce ppreduce
cutonethirdhpraisestats BattleScript_ButItFailed cutonethirdhpraisestats BattleScript_ButItFailed
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_SKIP_DMG_TRACK | HITMARKER_PASSIVE_DAMAGE | HITMARKER_IGNORE_DISGUISE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_BIDE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_IGNORE_DISGUISE
attackanimation attackanimation
waitanimation waitanimation
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
@ -6843,7 +6843,7 @@ BattleScript_DamagingWeatherHeal:
printstring STRINGID_ICEBODYHPGAIN printstring STRINGID_ICEBODYHPGAIN
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_DamagingWeatherHpChange: BattleScript_DamagingWeatherHpChange:
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER tryfaintmon BS_ATTACKER
@ -6853,7 +6853,7 @@ BattleScript_DamagingWeatherLoopIncrement::
addbyte gBattleCommunication, 1 addbyte gBattleCommunication, 1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop
BattleScript_DamagingWeatherContinuesEnd:: BattleScript_DamagingWeatherContinuesEnd::
bicword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE bicword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE
call BattleScript_ActivateWeatherAbilities call BattleScript_ActivateWeatherAbilities
end2 end2
@ -7390,7 +7390,7 @@ BattleScript_EarthEaterActivates::
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
tryhealquarterhealth BS_TARGET, BattleScript_EarthEaterRet tryhealquarterhealth BS_TARGET, BattleScript_EarthEaterRet
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_TARGET healthbarupdate BS_TARGET
datahpupdate BS_TARGET datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH printstring STRINGID_PKMNREGAINEDHEALTH
@ -7967,7 +7967,7 @@ BattleScript_CudChewActivates::
call BattleScript_AbilityPopUp call BattleScript_AbilityPopUp
setbyte sBERRY_OVERRIDE, 1 @ override the requirements for eating berries setbyte sBERRY_OVERRIDE, 1 @ override the requirements for eating berries
consumeberry BS_TARGET, FALSE consumeberry BS_TARGET, FALSE
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
setbyte sBERRY_OVERRIDE, 0 setbyte sBERRY_OVERRIDE, 0
@ -9114,14 +9114,14 @@ BattleScript_GrassyTerrainLoop:
printstring STRINGID_GRASSYTERRAINHEALS printstring STRINGID_GRASSYTERRAINHEALS
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_GrassyTerrainHpChange: BattleScript_GrassyTerrainHpChange:
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
BattleScript_GrassyTerrainLoopIncrement:: BattleScript_GrassyTerrainLoopIncrement::
addbyte gBattleCommunication, 1 addbyte gBattleCommunication, 1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_GrassyTerrainLoop jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_GrassyTerrainLoop
BattleScript_GrassyTerrainLoopEnd:: BattleScript_GrassyTerrainLoopEnd::
bicword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE bicword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
jumpifword CMP_COMMON_BITS, gFieldStatuses, STATUS_FIELD_TERRAIN_PERMANENT, BattleScript_GrassyTerrainHealEnd jumpifword CMP_COMMON_BITS, gFieldStatuses, STATUS_FIELD_TERRAIN_PERMANENT, BattleScript_GrassyTerrainHealEnd
BattleScript_GrassyTerrainHealEnd: BattleScript_GrassyTerrainHealEnd:
end2 end2
@ -9399,7 +9399,7 @@ BattleScript_KingsShieldEffect::
return return
BattleScript_BanefulBunkerEffect:: BattleScript_BanefulBunkerEffect::
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_PASSIVE_DAMAGE
bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT
seteffectsecondary seteffectsecondary
setmoveeffect 0 setmoveeffect 0
@ -9677,7 +9677,7 @@ BattleScript_ItemHealHP_RemoveItemRet_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_PKMNSITEMRESTOREDHEALTH printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_SCRIPTING healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING datahpupdate BS_SCRIPTING
removeitem BS_SCRIPTING removeitem BS_SCRIPTING
@ -9692,7 +9692,7 @@ BattleScript_ItemHealHP_RemoveItemEnd2_Anim:
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_PKMNSITEMRESTOREDHEALTH printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
removeitem BS_ATTACKER removeitem BS_ATTACKER
@ -9748,7 +9748,7 @@ BattleScript_ItemHealHP_Ret::
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_PKMNSITEMRESTOREDHPALITTLE printstring STRINGID_PKMNSITEMRESTOREDHPALITTLE
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
return return
@ -9803,7 +9803,7 @@ BattleScript_BerryConfuseHealEnd2_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_PKMNSITEMRESTOREDHEALTH printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_SCRIPTING healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING datahpupdate BS_SCRIPTING
printstring STRINGID_FORXCOMMAYZ printstring STRINGID_FORXCOMMAYZ
@ -9822,7 +9822,7 @@ BattleScript_BerryConfuseHealRet_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT
printstring STRINGID_PKMNSITEMRESTOREDHEALTH printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_SCRIPTING healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING datahpupdate BS_SCRIPTING
printstring STRINGID_FORXCOMMAYZ printstring STRINGID_FORXCOMMAYZ
@ -10560,7 +10560,7 @@ BattleScript_DamageNonTypesLoop::
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
effectivenesssound effectivenesssound
hitanimation BS_ATTACKER hitanimation BS_ATTACKER
orword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE orword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER datahpupdate BS_ATTACKER
tryfaintmon BS_ATTACKER tryfaintmon BS_ATTACKER
@ -10570,7 +10570,7 @@ BattleScript_DamageNonTypesLoopIncrement::
addbyte gBattleCommunication, 1 addbyte gBattleCommunication, 1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamageNonTypesLoop jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamageNonTypesLoop
BattleScript_DamageNonTypesContinuesEnd:: BattleScript_DamageNonTypesContinuesEnd::
bicword gHitMarker, HITMARKER_SKIP_DMG_TRACK | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE bicword gHitMarker, HITMARKER_IGNORE_BIDE | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_GRUDGE
end2 end2
BattleScript_EffectTryReducePP:: BattleScript_EffectTryReducePP::

View file

@ -7,6 +7,8 @@
static void *sHeapStart; static void *sHeapStart;
static u32 sHeapSize; static u32 sHeapSize;
EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0};
void PutMemBlockHeader(void *block, struct MemBlock *prev, struct MemBlock *next, u32 size) void PutMemBlockHeader(void *block, struct MemBlock *prev, struct MemBlock *next, u32 size)
{ {
struct MemBlock *header = (struct MemBlock *)block; struct MemBlock *header = (struct MemBlock *)block;

View file

@ -1,7 +1,6 @@
#ifndef GUARD_ALLOC_H #ifndef GUARD_ALLOC_H
#define GUARD_ALLOC_H #define GUARD_ALLOC_H
#define HEAP_SIZE 0x1C000
#define FREE_AND_SET_NULL(ptr) \ #define FREE_AND_SET_NULL(ptr) \
{ \ { \
@ -42,7 +41,8 @@ struct MemBlock
u8 data[0]; u8 data[0];
}; };
extern u8 gHeap[]; #define HEAP_SIZE 0x1C000
extern u8 gHeap[HEAP_SIZE];
#if TESTING || !defined(NDEBUG) #if TESTING || !defined(NDEBUG)

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 111 B

View file

Before

Width:  |  Height:  |  Size: 112 B

After

Width:  |  Height:  |  Size: 112 B

View file

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

View file

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 99 B

1
graphics/unused/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
redyellowgreen_frame.bin

View file

@ -20,7 +20,7 @@ JPCONTESTGFXDIR := graphics/contest/japanese
POKEDEXGFXDIR := graphics/pokedex POKEDEXGFXDIR := graphics/pokedex
STARTERGFXDIR := graphics/starter_choose STARTERGFXDIR := graphics/starter_choose
NAMINGGFXDIR := graphics/naming_screen NAMINGGFXDIR := graphics/naming_screen
SPINDAGFXDIR := graphics/spinda_spots SPINDAGFXDIR := graphics/pokemon/spinda/spots
types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark fairy types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark fairy
contest_types := cool beauty cute smart tough contest_types := cool beauty cute smart tough
@ -253,10 +253,10 @@ $(FONTGFXDIR)/short.fwjpnfont: $(FONTGFXDIR)/japanese_short.png
$(FONTGFXDIR)/braille.fwjpnfont: $(FONTGFXDIR)/braille.png $(FONTGFXDIR)/braille.fwjpnfont: $(FONTGFXDIR)/braille.png
$(GFX) $< $@ $(GFX) $< $@
$(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male_font.png $(FONTGFXDIR)/frlg_male.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_male.png
$(GFX) $< $@ $(GFX) $< $@
$(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female_font.png $(FONTGFXDIR)/frlg_female.fwjpnfont: $(FONTGFXDIR)/japanese_frlg_female.png
$(GFX) $< $@ $(GFX) $< $@

View file

@ -44,6 +44,9 @@
#define BATTLE_BUFFER_LINK_SIZE 0x1000 #define BATTLE_BUFFER_LINK_SIZE 0x1000
// Special indicator value for shellBellDmg in SpecialStatus
#define IGNORE_SHELL_BELL 0xFFFF
struct ResourceFlags struct ResourceFlags
{ {
u32 flags[MAX_BATTLERS_COUNT]; u32 flags[MAX_BATTLERS_COUNT];
@ -166,7 +169,7 @@ struct ProtectStruct
struct SpecialStatus struct SpecialStatus
{ {
s32 dmg; s32 shellBellDmg;
s32 physicalDmg; s32 physicalDmg;
s32 specialDmg; s32 specialDmg;
u8 physicalBattlerId; u8 physicalBattlerId;
@ -739,9 +742,9 @@ struct BattleStruct
// The assert below is to ensure palaceFlags is large enough to store these flags without overlap. // The assert below is to ensure palaceFlags is large enough to store these flags without overlap.
STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLERS_COUNT + MAX_MON_MOVES, PalaceFlagsTooSmall) STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLERS_COUNT + MAX_MON_MOVES, PalaceFlagsTooSmall)
#define F_DYNAMIC_TYPE_1 (1 << 6) #define DYNAMIC_TYPE_MASK ((1 << 6) - 1)
#define F_DYNAMIC_TYPE_2 (1 << 7) #define F_DYNAMIC_TYPE_IGNORE_PHYSICALITY (1 << 6) // If set, the dynamic type's physicality won't be used for certain move effects.
#define DYNAMIC_TYPE_MASK (F_DYNAMIC_TYPE_1 - 1) #define F_DYNAMIC_TYPE_SET (1 << 7) // Set for all dynamic types to distinguish a dynamic type of Normal (0) from no dynamic type.
#define GET_MOVE_TYPE(move, typeArg) \ #define GET_MOVE_TYPE(move, typeArg) \
{ \ { \
@ -991,7 +994,7 @@ extern u16 gChosenMove;
extern u16 gCalledMove; extern u16 gCalledMove;
extern s32 gBattleMoveDamage; extern s32 gBattleMoveDamage;
extern s32 gHpDealt; extern s32 gHpDealt;
extern s32 gTakenDmg[MAX_BATTLERS_COUNT]; extern s32 gBideDmg[MAX_BATTLERS_COUNT];
extern u16 gLastUsedItem; extern u16 gLastUsedItem;
extern u16 gLastUsedAbility; extern u16 gLastUsedAbility;
extern u8 gBattlerAttacker; extern u8 gBattlerAttacker;
@ -1017,7 +1020,7 @@ extern u8 gLastHitBy[MAX_BATTLERS_COUNT];
extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT]; extern u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT];
extern u16 gMoveResultFlags; extern u16 gMoveResultFlags;
extern u32 gHitMarker; extern u32 gHitMarker;
extern u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT]; extern u8 gBideTarget[MAX_BATTLERS_COUNT];
extern u8 gUnusedFirstBattleVar2; extern u8 gUnusedFirstBattleVar2;
extern u32 gSideStatuses[NUM_BATTLE_SIDES]; extern u32 gSideStatuses[NUM_BATTLE_SIDES];
extern struct SideTimer gSideTimers[NUM_BATTLE_SIDES]; extern struct SideTimer gSideTimers[NUM_BATTLE_SIDES];

View file

@ -191,7 +191,7 @@
#define STATUS4_GLAIVE_RUSH (1 << 6) #define STATUS4_GLAIVE_RUSH (1 << 6)
#define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked. #define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked.
#define HITMARKER_SKIP_DMG_TRACK (1 << 5) #define HITMARKER_IGNORE_BIDE (1 << 5)
#define HITMARKER_DESTINYBOND (1 << 6) #define HITMARKER_DESTINYBOND (1 << 6)
#define HITMARKER_NO_ANIMATIONS (1 << 7) // set from battleSceneOff. Never changed during battle #define HITMARKER_NO_ANIMATIONS (1 << 7) // set from battleSceneOff. Never changed during battle
#define HITMARKER_IGNORE_SUBSTITUTE (1 << 8) #define HITMARKER_IGNORE_SUBSTITUTE (1 << 8)
@ -199,7 +199,7 @@
#define HITMARKER_ATTACKSTRING_PRINTED (1 << 10) #define HITMARKER_ATTACKSTRING_PRINTED (1 << 10)
#define HITMARKER_NO_PPDEDUCT (1 << 11) #define HITMARKER_NO_PPDEDUCT (1 << 11)
#define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12) #define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12)
#define HITMARKER_IGNORE_SAFEGUARD (1 << 13) #define HITMARKER_STATUS_ABILITY_EFFECT (1 << 13)
#define HITMARKER_SYNCHRONISE_EFFECT (1 << 14) #define HITMARKER_SYNCHRONISE_EFFECT (1 << 14)
#define HITMARKER_RUN (1 << 15) #define HITMARKER_RUN (1 << 15)
#define HITMARKER_IGNORE_DISGUISE (1 << 16) #define HITMARKER_IGNORE_DISGUISE (1 << 16)

View file

@ -25,24 +25,24 @@
#define NUMBER_OF_MON_TYPES 19 #define NUMBER_OF_MON_TYPES 19
// Pokemon egg groups // Pokemon egg groups
#define EGG_GROUP_NONE 0 #define EGG_GROUP_NONE 0
#define EGG_GROUP_MONSTER 1 #define EGG_GROUP_MONSTER 1
#define EGG_GROUP_WATER_1 2 #define EGG_GROUP_WATER_1 2
#define EGG_GROUP_BUG 3 #define EGG_GROUP_BUG 3
#define EGG_GROUP_FLYING 4 #define EGG_GROUP_FLYING 4
#define EGG_GROUP_FIELD 5 #define EGG_GROUP_FIELD 5
#define EGG_GROUP_FAIRY 6 #define EGG_GROUP_FAIRY 6
#define EGG_GROUP_GRASS 7 #define EGG_GROUP_GRASS 7
#define EGG_GROUP_HUMAN_LIKE 8 #define EGG_GROUP_HUMAN_LIKE 8
#define EGG_GROUP_WATER_3 9 #define EGG_GROUP_WATER_3 9
#define EGG_GROUP_MINERAL 10 #define EGG_GROUP_MINERAL 10
#define EGG_GROUP_AMORPHOUS 11 #define EGG_GROUP_AMORPHOUS 11
#define EGG_GROUP_WATER_2 12 #define EGG_GROUP_WATER_2 12
#define EGG_GROUP_DITTO 13 #define EGG_GROUP_DITTO 13
#define EGG_GROUP_DRAGON 14 #define EGG_GROUP_DRAGON 14
#define EGG_GROUP_UNDISCOVERED 15 #define EGG_GROUP_NO_EGGS_DISCOVERED 15
#define EGG_GROUPS_PER_MON 2 #define EGG_GROUPS_PER_MON 2
// Pokemon natures // Pokemon natures
#define NATURE_HARDY 0 #define NATURE_HARDY 0

View file

@ -596,7 +596,7 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg); void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
void CopyMon(void *dest, void *src, size_t size); void CopyMon(void *dest, void *src, size_t size);
u8 GiveMonToPlayer(struct Pokemon *mon); u8 GiveMonToPlayer(struct Pokemon *mon);
u8 SendMonToPC(struct Pokemon* mon); u8 CopyMonToPC(struct Pokemon *mon);
u8 CalculatePlayerPartyCount(void); u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void); u8 CalculateEnemyPartyCount(void);
u8 GetMonsStateToDoubles(void); u8 GetMonsStateToDoubles(void);

View file

@ -4,16 +4,18 @@ gNumMusicPlayers = 4;
gMaxLines = 0; gMaxLines = 0;
gInitialMainCB2 = CB2_InitCopyrightScreenAfterBootup; gInitialMainCB2 = CB2_InitCopyrightScreenAfterBootup;
SECTIONS { MEMORY
. = 0x2000000; {
EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K
IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M
}
ewram (NOLOAD) : SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
gHeap = .;
. = 0x1C000;
INCLUDE "sym_ewram.ld" INCLUDE "sym_ewram.ld"
src/*.o(ewram_data); src/*.o(ewram_data);
gflib/*.o(ewram_data); gflib/*.o(ewram_data);
@ -21,12 +23,9 @@ SECTIONS {
*libc.a:impure.o(.data); *libc.a:impure.o(.data);
*libc.a:locale.o(.data); *libc.a:locale.o(.data);
*libc.a:mallocr.o(.data); *libc.a:mallocr.o(.data);
. = 0x40000; } > EWRAM
}
. = 0x3000000; iwram 0x3000000 (NOLOAD) :
iwram (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
/* .bss starts at 0x3000000 */ /* .bss starts at 0x3000000 */
@ -43,8 +42,9 @@ SECTIONS {
*libc.a:sbrkr.o(COMMON); *libc.a:sbrkr.o(COMMON);
end = .; end = .;
. = 0x8000; . = 0x8000;
} } > IWRAM
/* BEGIN ROM DATA */
. = 0x8000000; . = 0x8000000;
.text : .text :
@ -345,7 +345,7 @@ SECTIONS {
src/international_string_util.o(.text); src/international_string_util.o(.text);
src/pokemon_debug.o(.text); src/pokemon_debug.o(.text);
src/expansion_intro.o(.text); src/expansion_intro.o(.text);
} =0 } > ROM =0
script_data : script_data :
ALIGN(4) ALIGN(4)
@ -357,7 +357,7 @@ SECTIONS {
data/battle_scripts_2.o(script_data); data/battle_scripts_2.o(script_data);
data/contest_ai_scripts.o(script_data); data/contest_ai_scripts.o(script_data);
data/mystery_event_script_cmd_table.o(script_data); data/mystery_event_script_cmd_table.o(script_data);
} =0 } > ROM =0
lib_text : lib_text :
ALIGN(4) ALIGN(4)
@ -441,7 +441,7 @@ SECTIONS {
*libc.a:libcfunc.o(.text); *libc.a:libcfunc.o(.text);
*libc.a:lseekr.o(.text); *libc.a:lseekr.o(.text);
*libc.a:readr.o(.text); *libc.a:readr.o(.text);
} =0 } > ROM =0
.rodata : .rodata :
ALIGN(4) ALIGN(4)
@ -712,7 +712,7 @@ SECTIONS {
data/sound_data.o(.rodata); data/sound_data.o(.rodata);
src/pokemon_debug.o(.rodata); src/pokemon_debug.o(.rodata);
src/expansion_intro.o(.rodata); src/expansion_intro.o(.rodata);
} =0 } > ROM =0
song_data : song_data :
ALIGN(4) ALIGN(4)
@ -1247,7 +1247,7 @@ SECTIONS {
sound/songs/midi/ph_nurse_blend.o(.rodata); sound/songs/midi/ph_nurse_blend.o(.rodata);
sound/songs/midi/ph_nurse_held.o(.rodata); sound/songs/midi/ph_nurse_held.o(.rodata);
sound/songs/midi/ph_nurse_solo.o(.rodata); sound/songs/midi/ph_nurse_solo.o(.rodata);
} =0 } > ROM =0
lib_rodata : lib_rodata :
SUBALIGN(4) SUBALIGN(4)
@ -1300,7 +1300,7 @@ SECTIONS {
*libc.a:lseekr.o(.rodata); *libc.a:lseekr.o(.rodata);
*libc.a:readr.o(.rodata); *libc.a:readr.o(.rodata);
src/libisagbprn.o(.rodata); src/libisagbprn.o(.rodata);
} =0 } > ROM =0
multiboot_data : multiboot_data :
ALIGN(4) ALIGN(4)
@ -1308,13 +1308,13 @@ SECTIONS {
data/multiboot_ereader.o(.rodata); data/multiboot_ereader.o(.rodata);
data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata);
data/multiboot_pokemon_colosseum.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata);
} =0 } > ROM =0
gfx_data : gfx_data :
ALIGN(4) ALIGN(4)
{ {
src/graphics.o(.rodata); src/graphics.o(.rodata);
} =0 } > ROM =0
extra : extra :
ALIGN(4) ALIGN(4)
@ -1324,7 +1324,7 @@ SECTIONS {
src/*.o(.rodata); src/*.o(.rodata);
gflib/*.o(.rodata); gflib/*.o(.rodata);
data/*.o(.rodata); data/*.o(.rodata);
} = 0 } > ROM = 0
__rom_end = .; __rom_end = .;

View file

@ -4,46 +4,40 @@ gNumMusicPlayers = 4;
gMaxLines = 0; gMaxLines = 0;
gInitialMainCB2 = CB2_InitCopyrightScreenAfterBootup; gInitialMainCB2 = CB2_InitCopyrightScreenAfterBootup;
SECTIONS { MEMORY
. = 0x2000000; {
EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K
IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M
}
ewram (NOLOAD) : SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
gHeap = .;
. = 0x1C000;
src/*.o(ewram_data); src/*.o(ewram_data);
gflib/*.o(ewram_data); gflib/*.o(ewram_data);
. = 0x40000; } > EWRAM
}
. = 0x3000000; iwram 0x3000000 (NOLOAD) :
iwram (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
/* .bss starts at 0x3000000 */
src/*.o(.bss); src/*.o(.bss);
gflib/*.o(.bss); gflib/*.o(.bss);
data/*.o(.bss); data/*.o(.bss);
*libc.a:*.o(.bss*); *libc.a:*.o(.bss*);
*libnosys.a:*.o(.bss*); *libnosys.a:*.o(.bss*);
/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code); src/m4a.o(.bss.code);
/* COMMON starts at 0x30022A8 */
src/*.o(COMMON); src/*.o(COMMON);
gflib/*.o(COMMON); gflib/*.o(COMMON);
*libc.a:*.o(COMMON); *libc.a:*.o(COMMON);
*libnosys.a:*.o(COMMON); *libnosys.a:*.o(COMMON);
end = .; } > IWRAM
. = 0x8000;
}
/* BEGIN ROM DATA */
. = 0x8000000; . = 0x8000000;
.text : .text :
@ -57,13 +51,13 @@ SECTIONS {
gflib/*.o(.text*); gflib/*.o(.text*);
src/*.o(.text*); src/*.o(.text*);
asm/*.o(.text*); asm/*.o(.text*);
} =0 } > ROM =0
script_data : script_data :
ALIGN(4) ALIGN(4)
{ {
data/*.o(script_data); data/*.o(script_data);
} =0 } > ROM =0
lib_text : lib_text :
ALIGN(4) ALIGN(4)
@ -84,7 +78,7 @@ SECTIONS {
*libc.a:*.o(.text*); *libc.a:*.o(.text*);
*libnosys.a:*.o(.text*); *libnosys.a:*.o(.text*);
src/libisagbprn.o(.text); src/libisagbprn.o(.text);
} =0 } > ROM =0
.rodata : .rodata :
ALIGN(4) ALIGN(4)
@ -92,13 +86,13 @@ SECTIONS {
src/*.o(.rodata*); src/*.o(.rodata*);
gflib/*.o(.rodata*); gflib/*.o(.rodata*);
data/*.o(.rodata*); data/*.o(.rodata*);
} =0 } > ROM =0
song_data : song_data :
ALIGN(4) ALIGN(4)
{ {
sound/songs/*.o(.rodata); sound/songs/*.o(.rodata);
} =0 } > ROM =0
lib_rodata : lib_rodata :
SUBALIGN(4) SUBALIGN(4)
@ -115,7 +109,7 @@ SECTIONS {
*libc.a:*.o(.rodata*); *libc.a:*.o(.rodata*);
*libc.a:*.o(.data*); *libc.a:*.o(.data*);
src/libisagbprn.o(.rodata); src/libisagbprn.o(.rodata);
} =0 } > ROM =0
multiboot_data : multiboot_data :
ALIGN(4) ALIGN(4)
@ -123,13 +117,13 @@ SECTIONS {
data/multiboot_ereader.o(.rodata); data/multiboot_ereader.o(.rodata);
data/multiboot_berry_glitch_fix.o(.rodata); data/multiboot_berry_glitch_fix.o(.rodata);
data/multiboot_pokemon_colosseum.o(.rodata); data/multiboot_pokemon_colosseum.o(.rodata);
} =0 } > ROM =0
gfx_data : gfx_data :
ALIGN(4) ALIGN(4)
{ {
src/graphics.o(.rodata); src/graphics.o(.rodata);
} =0 } > ROM =0
__rom_end = .; __rom_end = .;

View file

@ -4,29 +4,25 @@ gNumMusicPlayers = 4;
gMaxLines = 0; gMaxLines = 0;
gInitialMainCB2 = CB2_TestRunner; gInitialMainCB2 = CB2_TestRunner;
SECTIONS { MEMORY
. = 0x2000000; {
EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K
IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K
ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M
}
ewram (NOLOAD) : SECTIONS {
ewram 0x2000000 (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
gHeap = .;
. = 0x1C000;
src/*.o(ewram_data); src/*.o(ewram_data);
gflib/*.o(ewram_data); gflib/*.o(ewram_data);
test/*.o(ewram_data); test/*.o(ewram_data);
} > EWRAM
. = 0x40000; iwram 0x3000000 (NOLOAD) :
}
. = 0x3000000;
iwram (NOLOAD) :
ALIGN(4) ALIGN(4)
{ {
/* .bss starts at 0x3000000 */
src/*.o(.bss); src/*.o(.bss);
gflib/*.o(.bss); gflib/*.o(.bss);
data/*.o(.bss); data/*.o(.bss);
@ -35,26 +31,22 @@ SECTIONS {
*libgcc.a:*.o(.bss*); *libgcc.a:*.o(.bss*);
*libnosys.a:*.o(.bss*); *libnosys.a:*.o(.bss*);
/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code); src/m4a.o(.bss.code);
/* COMMON starts at 0x30022A8 */
src/*.o(COMMON); src/*.o(COMMON);
gflib/*.o(COMMON); gflib/*.o(COMMON);
data/*.o(COMMON); data/*.o(COMMON);
test/*.o(COMMON); test/*.o(COMMON);
*libc.a:sbrkr.o(COMMON); *libc.a:sbrkr.o(COMMON);
end = .;
/* .persistent starts at 0x3007F00 */ /* .persistent starts at 0x3007F00 */
/* WARNING: This is the end of the IRQ stack, if there's too /* WARNING: This is the end of the IRQ stack, if there's too
* much data it WILL be overwritten. */ * much data it WILL be overwritten. */
. = 0x7F00; . = 0x7F00;
test/*.o(.persistent); test/*.o(.persistent);
} > IWRAM
. = 0x8000; /* BEGIN ROM DATA */
}
. = 0x8000000; . = 0x8000000;
.text : .text :
@ -65,13 +57,13 @@ SECTIONS {
src/rom_header_rhh.o(.text.*); src/rom_header_rhh.o(.text.*);
src/*.o(.text); src/*.o(.text);
gflib/*.o(.text); gflib/*.o(.text);
} =0 } > ROM =0
script_data : script_data :
ALIGN(4) ALIGN(4)
{ {
data/*.o(script_data); data/*.o(script_data);
} =0 } > ROM =0
lib_text : lib_text :
ALIGN(4) ALIGN(4)
@ -80,7 +72,7 @@ SECTIONS {
*libgcc.a:*.o(.text*); *libgcc.a:*.o(.text*);
*libc.a:*.o(.text*); *libc.a:*.o(.text*);
*libnosys.a:*.o(.text*); *libnosys.a:*.o(.text*);
} =0 } > ROM =0
.rodata : .rodata :
ALIGN(4) ALIGN(4)
@ -88,13 +80,13 @@ SECTIONS {
src/*.o(.rodata*); src/*.o(.rodata*);
gflib/*.o(.rodata*); gflib/*.o(.rodata*);
data/*.o(.rodata*); data/*.o(.rodata*);
} =0 } > ROM =0
song_data : song_data :
ALIGN(4) ALIGN(4)
{ {
sound/songs/*.o(.rodata); sound/songs/*.o(.rodata);
} =0 } > ROM =0
lib_rodata : lib_rodata :
SUBALIGN(4) SUBALIGN(4)
@ -103,7 +95,7 @@ SECTIONS {
*libc.a:*.o(.rodata*); *libc.a:*.o(.rodata*);
*libc.a:*.o(.data*); *libc.a:*.o(.data*);
src/libisagbprn.o(.rodata); src/libisagbprn.o(.rodata);
} =0 } > ROM =0
tests : tests :
ALIGN(4) ALIGN(4)
@ -113,7 +105,7 @@ SECTIONS {
__stop_tests = .; __stop_tests = .;
test/*.o(.text); test/*.o(.text);
test/*.o(.rodata*); test/*.o(.rodata*);
} =0 } > ROM =0
__rom_end = .; __rom_end = .;

View file

@ -157,7 +157,7 @@ EWRAM_DATA u16 gChosenMove = 0;
EWRAM_DATA u16 gCalledMove = 0; EWRAM_DATA u16 gCalledMove = 0;
EWRAM_DATA s32 gBattleMoveDamage = 0; EWRAM_DATA s32 gBattleMoveDamage = 0;
EWRAM_DATA s32 gHpDealt = 0; EWRAM_DATA s32 gHpDealt = 0;
EWRAM_DATA s32 gTakenDmg[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA s32 gBideDmg[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gLastUsedItem = 0; EWRAM_DATA u16 gLastUsedItem = 0;
EWRAM_DATA u16 gLastUsedAbility = 0; EWRAM_DATA u16 gLastUsedAbility = 0;
EWRAM_DATA u8 gBattlerAttacker = 0; EWRAM_DATA u8 gBattlerAttacker = 0;
@ -183,7 +183,7 @@ EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gMoveResultFlags = 0; EWRAM_DATA u16 gMoveResultFlags = 0;
EWRAM_DATA u32 gHitMarker = 0; EWRAM_DATA u32 gHitMarker = 0;
EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gBideTarget[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read EWRAM_DATA u8 gUnusedFirstBattleVar2 = 0; // Never read
EWRAM_DATA u32 gSideStatuses[NUM_BATTLE_SIDES] = {0}; EWRAM_DATA u32 gSideStatuses[NUM_BATTLE_SIDES] = {0};
EWRAM_DATA struct SideTimer gSideTimers[NUM_BATTLE_SIDES] = {0}; EWRAM_DATA struct SideTimer gSideTimers[NUM_BATTLE_SIDES] = {0};
@ -5574,15 +5574,15 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
if (gBattleWeather & B_WEATHER_RAIN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA) if (gBattleWeather & B_WEATHER_RAIN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA)
gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_SET;
else if (gBattleWeather & B_WEATHER_SANDSTORM) else if (gBattleWeather & B_WEATHER_SANDSTORM)
gBattleStruct->dynamicMoveType = TYPE_ROCK | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_ROCK | F_DYNAMIC_TYPE_SET;
else if (gBattleWeather & B_WEATHER_SUN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA) else if (gBattleWeather & B_WEATHER_SUN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA)
gBattleStruct->dynamicMoveType = TYPE_FIRE | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_FIRE | F_DYNAMIC_TYPE_SET;
else if (gBattleWeather & (B_WEATHER_HAIL |B_WEATHER_SNOW)) else if (gBattleWeather & (B_WEATHER_HAIL |B_WEATHER_SNOW))
gBattleStruct->dynamicMoveType = TYPE_ICE | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_ICE | F_DYNAMIC_TYPE_SET;
else else
gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_SET;
} }
} }
else if (gBattleMoves[move].effect == EFFECT_HIDDEN_POWER) else if (gBattleMoves[move].effect == EFFECT_HIDDEN_POWER)
@ -5599,32 +5599,32 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
gBattleStruct->dynamicMoveType = ((NUMBER_OF_MON_TYPES - 4) * typeBits) / 63 + 1; gBattleStruct->dynamicMoveType = ((NUMBER_OF_MON_TYPES - 4) * typeBits) / 63 + 1;
if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY) if (gBattleStruct->dynamicMoveType >= TYPE_MYSTERY)
gBattleStruct->dynamicMoveType++; gBattleStruct->dynamicMoveType++;
gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_1 | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType |= F_DYNAMIC_TYPE_IGNORE_PHYSICALITY | F_DYNAMIC_TYPE_SET;
} }
else if (gBattleMoves[move].effect == EFFECT_CHANGE_TYPE_ON_ITEM) else if (gBattleMoves[move].effect == EFFECT_CHANGE_TYPE_ON_ITEM)
{ {
if (holdEffect == gBattleMoves[move].argument) if (holdEffect == gBattleMoves[move].argument)
gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_SET;
} }
else if (gBattleMoves[move].effect == EFFECT_IVY_CUDGEL && holdEffect == HOLD_EFFECT_MASK) else if (gBattleMoves[move].effect == EFFECT_IVY_CUDGEL && holdEffect == HOLD_EFFECT_MASK)
{ {
gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_SET;
} }
else if (gBattleMoves[move].effect == EFFECT_REVELATION_DANCE) else if (gBattleMoves[move].effect == EFFECT_REVELATION_DANCE)
{ {
if (gBattleMons[battlerAtk].type1 != TYPE_MYSTERY) if (gBattleMons[battlerAtk].type1 != TYPE_MYSTERY)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | F_DYNAMIC_TYPE_SET;
else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY) else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET;
else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY) else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | F_DYNAMIC_TYPE_SET;
} }
else if (gBattleMoves[move].effect == EFFECT_RAGING_BULL else if (gBattleMoves[move].effect == EFFECT_RAGING_BULL
&& (gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_COMBAT_BREED && (gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_COMBAT_BREED
|| gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_BLAZE_BREED || gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_BLAZE_BREED
|| gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_AQUA_BREED)) || gBattleMons[battlerAtk].species == SPECIES_TAUROS_PALDEAN_AQUA_BREED))
{ {
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | F_DYNAMIC_TYPE_SET;
} }
else if (gBattleMoves[move].effect == EFFECT_NATURAL_GIFT) else if (gBattleMoves[move].effect == EFFECT_NATURAL_GIFT)
{ {
@ -5636,15 +5636,15 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_TERRAIN_ANY)) if (IsBattlerTerrainAffected(battlerAtk, STATUS_FIELD_TERRAIN_ANY))
{ {
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN) if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_SET;
else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN) else if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN)
gBattleStruct->dynamicMoveType = TYPE_GRASS | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_GRASS | F_DYNAMIC_TYPE_SET;
else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN) else if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN)
gBattleStruct->dynamicMoveType = TYPE_FAIRY | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_FAIRY | F_DYNAMIC_TYPE_SET;
else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN) else if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN)
gBattleStruct->dynamicMoveType = TYPE_PSYCHIC | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_PSYCHIC | F_DYNAMIC_TYPE_SET;
else //failsafe else //failsafe
gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_SET;
} }
} }
@ -5662,7 +5662,7 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
) )
) )
{ {
gBattleStruct->dynamicMoveType = ateType | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = ateType | F_DYNAMIC_TYPE_SET;
if (!IsDynamaxed(battlerAtk)) if (!IsDynamaxed(battlerAtk))
gBattleStruct->ateBoost[battlerAtk] = 1; gBattleStruct->ateBoost[battlerAtk] = 1;
} }
@ -5671,23 +5671,23 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
&& gBattleMoves[move].effect != EFFECT_WEATHER_BALL && gBattleMoves[move].effect != EFFECT_WEATHER_BALL
&& attackerAbility == ABILITY_NORMALIZE) && attackerAbility == ABILITY_NORMALIZE)
{ {
gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_NORMAL | F_DYNAMIC_TYPE_SET;
if (!IsDynamaxed(battlerAtk)) if (!IsDynamaxed(battlerAtk))
gBattleStruct->ateBoost[battlerAtk] = 1; gBattleStruct->ateBoost[battlerAtk] = 1;
} }
else if (gBattleMoves[move].soundMove && attackerAbility == ABILITY_LIQUID_VOICE) else if (gBattleMoves[move].soundMove && attackerAbility == ABILITY_LIQUID_VOICE)
{ {
gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_WATER | F_DYNAMIC_TYPE_SET;
} }
else if (move == MOVE_AURA_WHEEL && gBattleMons[battlerAtk].species == SPECIES_MORPEKO_HANGRY) else if (move == MOVE_AURA_WHEEL && gBattleMons[battlerAtk].species == SPECIES_MORPEKO_HANGRY)
{ {
gBattleStruct->dynamicMoveType = TYPE_DARK | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_DARK | F_DYNAMIC_TYPE_SET;
} }
GET_MOVE_TYPE(move, moveType); GET_MOVE_TYPE(move, moveType);
if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL) if ((gFieldStatuses & STATUS_FIELD_ION_DELUGE && moveType == TYPE_NORMAL)
|| gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED) || gStatuses4[battlerAtk] & STATUS4_ELECTRIFIED)
gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_2; gBattleStruct->dynamicMoveType = TYPE_ELECTRIC | F_DYNAMIC_TYPE_SET;
// Check if a gem should activate. // Check if a gem should activate.
GET_MOVE_TYPE(move, moveType); GET_MOVE_TYPE(move, moveType);

View file

@ -2252,6 +2252,7 @@ static void Cmd_healthbarupdate(void)
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }
// Update the active battler's HP and various HP trackers (Substitute, Bide, etc.)
static void Cmd_datahpupdate(void) static void Cmd_datahpupdate(void)
{ {
CMD_ARGS(u8 battler); CMD_ARGS(u8 battler);
@ -2268,15 +2269,15 @@ static void Cmd_datahpupdate(void)
{ {
if (gDisableStructs[battler].substituteHP >= gBattleMoveDamage) if (gDisableStructs[battler].substituteHP >= gBattleMoveDamage)
{ {
if (gSpecialStatuses[battler].dmg == 0) if (gSpecialStatuses[battler].shellBellDmg == 0)
gSpecialStatuses[battler].dmg = gBattleMoveDamage; gSpecialStatuses[battler].shellBellDmg = gBattleMoveDamage;
gDisableStructs[battler].substituteHP -= gBattleMoveDamage; gDisableStructs[battler].substituteHP -= gBattleMoveDamage;
gHpDealt = gBattleMoveDamage; gHpDealt = gBattleMoveDamage;
} }
else else
{ {
if (gSpecialStatuses[battler].dmg == 0) if (gSpecialStatuses[battler].shellBellDmg == 0)
gSpecialStatuses[battler].dmg = gDisableStructs[battler].substituteHP; gSpecialStatuses[battler].shellBellDmg = gDisableStructs[battler].substituteHP;
gHpDealt = gDisableStructs[battler].substituteHP; gHpDealt = gDisableStructs[battler].substituteHP;
gDisableStructs[battler].substituteHP = 0; gDisableStructs[battler].substituteHP = 0;
} }
@ -2299,28 +2300,29 @@ static void Cmd_datahpupdate(void)
else else
{ {
gHitMarker &= ~HITMARKER_IGNORE_SUBSTITUTE; gHitMarker &= ~HITMARKER_IGNORE_SUBSTITUTE;
if (gBattleMoveDamage < 0) // hp goes up if (gBattleMoveDamage < 0)
{ {
gBattleMons[battler].hp -= gBattleMoveDamage; // Negative damage is HP gain
gBattleMons[battler].hp += -gBattleMoveDamage;
if (gBattleMons[battler].hp > gBattleMons[battler].maxHP) if (gBattleMons[battler].hp > gBattleMons[battler].maxHP)
gBattleMons[battler].hp = gBattleMons[battler].maxHP; gBattleMons[battler].hp = gBattleMons[battler].maxHP;
} }
else // hp goes down else
{ {
if (gHitMarker & HITMARKER_SKIP_DMG_TRACK) if (gHitMarker & HITMARKER_IGNORE_BIDE)
{ {
gHitMarker &= ~HITMARKER_SKIP_DMG_TRACK; gHitMarker &= ~HITMARKER_IGNORE_BIDE;
} }
else else
{ {
gTakenDmg[battler] += gBattleMoveDamage; gBideDmg[battler] += gBattleMoveDamage;
if (cmd->battler == BS_TARGET) if (cmd->battler == BS_TARGET)
gTakenDmgByBattler[battler] = gBattlerAttacker; gBideTarget[battler] = gBattlerAttacker;
else else
gTakenDmgByBattler[battler] = gBattlerTarget; gBideTarget[battler] = gBattlerTarget;
} }
// Deal damage to the battler
if (gBattleMons[battler].hp > gBattleMoveDamage) if (gBattleMons[battler].hp > gBattleMoveDamage)
{ {
gBattleMons[battler].hp -= gBattleMoveDamage; gBattleMons[battler].hp -= gBattleMoveDamage;
@ -2332,9 +2334,13 @@ static void Cmd_datahpupdate(void)
gBattleMons[battler].hp = 0; gBattleMons[battler].hp = 0;
} }
if (!gSpecialStatuses[battler].dmg && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) // Record damage for Shell Bell
gSpecialStatuses[battler].dmg = gHpDealt; if (gSpecialStatuses[battler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE))
gSpecialStatuses[battler].shellBellDmg = gHpDealt;
// Note: While physicalDmg/specialDmg below are only distinguished between for Counter/Mirror Coat, they are
// used in combination as general damage trackers for other purposes. specialDmg is additionally used
// to help determine if a fire move should defrost the target.
if (IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && gCurrentMove != MOVE_PAIN_SPLIT) if (IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE) && gCurrentMove != MOVE_PAIN_SPLIT)
{ {
gProtectStructs[battler].physicalDmg = gHpDealt; gProtectStructs[battler].physicalDmg = gHpDealt;
@ -2352,6 +2358,7 @@ static void Cmd_datahpupdate(void)
} }
else if (!IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) else if (!IS_MOVE_PHYSICAL(gCurrentMove) && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE))
{ {
// Record special damage/attacker for Mirror Coat
gProtectStructs[battler].specialDmg = gHpDealt; gProtectStructs[battler].specialDmg = gHpDealt;
gSpecialStatuses[battler].specialDmg = gHpDealt; gSpecialStatuses[battler].specialDmg = gHpDealt;
if (cmd->battler == BS_TARGET) if (cmd->battler == BS_TARGET)
@ -2367,15 +2374,18 @@ static void Cmd_datahpupdate(void)
} }
} }
gHitMarker &= ~HITMARKER_PASSIVE_DAMAGE; gHitMarker &= ~HITMARKER_PASSIVE_DAMAGE;
// Send updated HP
BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[battler].hp), &gBattleMons[battler].hp); BtlController_EmitSetMonData(battler, BUFFER_A, REQUEST_HP_BATTLE, 0, sizeof(gBattleMons[battler].hp), &gBattleMons[battler].hp);
MarkBattlerForControllerExec(battler); MarkBattlerForControllerExec(battler);
} }
} }
else else
{ {
// MOVE_RESULT_NO_EFFECT was set
battler = GetBattlerForBattleScript(cmd->battler); battler = GetBattlerForBattleScript(cmd->battler);
if (gSpecialStatuses[battler].dmg == 0) if (gSpecialStatuses[battler].shellBellDmg == 0)
gSpecialStatuses[battler].dmg = 0xFFFF; gSpecialStatuses[battler].shellBellDmg = IGNORE_SHELL_BELL;
} }
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }
@ -2767,7 +2777,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
if ((battlerAbility == ABILITY_SHIELD_DUST if ((battlerAbility == ABILITY_SHIELD_DUST
|| GetBattlerHoldEffect(gEffectBattler, TRUE) == HOLD_EFFECT_COVERT_CLOAK) || GetBattlerHoldEffect(gEffectBattler, TRUE) == HOLD_EFFECT_COVERT_CLOAK)
&& !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& !primary && !primary
&& (gBattleScripting.moveEffect <= MOVE_EFFECT_TRI_ATTACK || gBattleScripting.moveEffect >= MOVE_EFFECT_SMACK_DOWN)) // Exclude stat lowering effects && (gBattleScripting.moveEffect <= MOVE_EFFECT_TRI_ATTACK || gBattleScripting.moveEffect >= MOVE_EFFECT_SMACK_DOWN)) // Exclude stat lowering effects
{ {
@ -2778,7 +2788,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
INCREMENT_RESET_RETURN INCREMENT_RESET_RETURN
} }
if (gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SAFEGUARD && !(gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION) && !primary && gBattleScripting.moveEffect <= MOVE_EFFECT_CONFUSION)
INCREMENT_RESET_RETURN INCREMENT_RESET_RETURN
@ -2828,10 +2838,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention; gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT;
} }
else else
{ {
@ -2840,7 +2850,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
RESET_RETURN RESET_RETURN
} }
if (!CanPoisonType(gBattleScripting.battler, gEffectBattler) if (!CanPoisonType(gBattleScripting.battler, gEffectBattler)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2866,10 +2876,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_BRNPrevention; gBattlescriptCurrInstr = BattleScript_BRNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT;
} }
else else
{ {
@ -2878,7 +2888,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
RESET_RETURN RESET_RETURN
} }
if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE) if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_FIRE)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2913,10 +2923,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PRLZPrevention; gBattlescriptCurrInstr = BattleScript_PRLZPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT;
} }
else else
{ {
@ -2928,7 +2938,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
break; break;
} }
if (!CanParalyzeType(gBattleScripting.battler, gEffectBattler) if (!CanParalyzeType(gBattleScripting.battler, gEffectBattler)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -2954,10 +2964,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_PSNPrevention; gBattlescriptCurrInstr = BattleScript_PSNPrevention;
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABILITY_PREVENTS_ABILITY_STATUS;
gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT;
} }
else else
{ {
@ -2966,7 +2976,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
RESET_RETURN RESET_RETURN
} }
if (!CanPoisonType(gBattleScripting.battler, gEffectBattler) if (!CanPoisonType(gBattleScripting.battler, gEffectBattler)
&& (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
&& (primary == TRUE || certain == MOVE_EFFECT_CERTAIN)) && (primary == TRUE || certain == MOVE_EFFECT_CERTAIN))
{ {
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -3018,10 +3028,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1); BtlController_EmitSetMonData(gEffectBattler, BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gEffectBattler].status1), &gBattleMons[gEffectBattler].status1);
MarkBattlerForControllerExec(gEffectBattler); MarkBattlerForControllerExec(gEffectBattler);
if (gHitMarker & HITMARKER_IGNORE_SAFEGUARD) if (gHitMarker & HITMARKER_STATUS_ABILITY_EFFECT)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUSED_BY_ABILITY;
gHitMarker &= ~HITMARKER_IGNORE_SAFEGUARD; gHitMarker &= ~HITMARKER_STATUS_ABILITY_EFFECT;
} }
else else
{ {
@ -8251,7 +8261,7 @@ static bool32 IsAbilityRodAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY))
moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -8268,7 +8278,7 @@ static bool32 IsAbilityMotorAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY))
moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -8285,7 +8295,7 @@ static bool32 IsAbilityAbsorbAffected(void)
if (gBattleStruct->dynamicMoveType == 0) if (gBattleStruct->dynamicMoveType == 0)
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_1)) else if (!(gBattleStruct->dynamicMoveType & F_DYNAMIC_TYPE_IGNORE_PHYSICALITY))
moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; moveType = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK;
else else
moveType = gBattleMoves[gCurrentMove].type; moveType = gBattleMoves[gCurrentMove].type;
@ -11585,7 +11595,7 @@ static void Cmd_setbide(void)
gBattleMons[gBattlerAttacker].status2 |= STATUS2_MULTIPLETURNS; gBattleMons[gBattlerAttacker].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gBattlerAttacker] = gCurrentMove; gLockedMoves[gBattlerAttacker] = gCurrentMove;
gTakenDmg[gBattlerAttacker] = 0; gBideDmg[gBattlerAttacker] = 0;
gBattleMons[gBattlerAttacker].status2 |= STATUS2_BIDE_TURN(2); gBattleMons[gBattlerAttacker].status2 |= STATUS2_BIDE_TURN(2);
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
@ -12570,7 +12580,7 @@ static void Cmd_painsplitdmgcalc(void)
storeLoc[3] = (painSplitHp & 0xFF000000) >> 24; storeLoc[3] = (painSplitHp & 0xFF000000) >> 24;
gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff; gBattleMoveDamage = gBattleMons[gBattlerAttacker].hp - hpDiff;
gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; gSpecialStatuses[gBattlerTarget].shellBellDmg = IGNORE_SHELL_BELL;
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }

View file

@ -831,7 +831,7 @@ void HandleAction_NothingIsFainted(void)
gCurrentTurnActionNumber++; gCurrentTurnActionNumber++;
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_PASSIVE_DAMAGE | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_PASSIVE_DAMAGE
| HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_NEVER_SET); | HITMARKER_CHARGING | HITMARKER_NEVER_SET);
} }
@ -845,7 +845,7 @@ void HandleAction_ActionFinished(void)
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber]; gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
SpecialStatusesClear(); SpecialStatusesClear();
gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED gHitMarker &= ~(HITMARKER_DESTINYBOND | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_ATTACKSTRING_PRINTED
| HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_PASSIVE_DAMAGE | HITMARKER_NO_PPDEDUCT | HITMARKER_STATUS_ABILITY_EFFECT | HITMARKER_PASSIVE_DAMAGE
| HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT | HITMARKER_OBEYS | HITMARKER_WAKE_UP_CLEAR | HITMARKER_SYNCHRONISE_EFFECT
| HITMARKER_CHARGING | HITMARKER_NEVER_SET | HITMARKER_IGNORE_DISGUISE); | HITMARKER_CHARGING | HITMARKER_NEVER_SET | HITMARKER_IGNORE_DISGUISE);
@ -2605,7 +2605,7 @@ u8 DoBattlerEndTurnEffects(void)
{ {
u32 battler, ability, i, effect = 0; u32 battler, ability, i, effect = 0;
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE);
while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= ENDTURN_BATTLER_COUNT) while (gBattleStruct->turnEffectsBattlerId < gBattlersCount && gBattleStruct->turnEffectsTracker <= ENDTURN_BATTLER_COUNT)
{ {
battler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; battler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId];
@ -3185,7 +3185,7 @@ u8 DoBattlerEndTurnEffects(void)
return effect; return effect;
} }
gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE);
return 0; return 0;
} }
@ -3193,7 +3193,7 @@ bool32 HandleWishPerishSongOnTurnEnd(void)
{ {
u32 battler; u32 battler;
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE);
switch (gBattleStruct->wishPerishSongState) switch (gBattleStruct->wishPerishSongState)
{ {
case 0: case 0:
@ -3220,7 +3220,7 @@ bool32 HandleWishPerishSongOnTurnEnd(void)
gBattlerTarget = battler; gBattlerTarget = battler;
gBattlerAttacker = gWishFutureKnock.futureSightAttacker[battler]; gBattlerAttacker = gWishFutureKnock.futureSightAttacker[battler];
gSpecialStatuses[gBattlerTarget].dmg = 0xFFFF; gSpecialStatuses[gBattlerTarget].shellBellDmg = IGNORE_SHELL_BELL;
gCurrentMove = gWishFutureKnock.futureSightMove[battler]; gCurrentMove = gWishFutureKnock.futureSightMove[battler];
SetTypeBeforeUsingMove(gCurrentMove, battler); SetTypeBeforeUsingMove(gCurrentMove, battler);
BattleScriptExecute(BattleScript_MonTookFutureAttack); BattleScriptExecute(BattleScript_MonTookFutureAttack);
@ -3285,7 +3285,7 @@ bool32 HandleWishPerishSongOnTurnEnd(void)
break; break;
} }
gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_IGNORE_BIDE);
return FALSE; return FALSE;
} }
@ -3672,11 +3672,11 @@ u8 AtkCanceller_UnableToUseMove(u32 moveType)
{ {
// This is removed in FRLG and Emerald for some reason // This is removed in FRLG and Emerald for some reason
//gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_MULTIPLETURNS; //gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_MULTIPLETURNS;
if (gTakenDmg[gBattlerAttacker]) if (gBideDmg[gBattlerAttacker])
{ {
gCurrentMove = MOVE_BIDE; gCurrentMove = MOVE_BIDE;
gBattleScripting.bideDmg = gTakenDmg[gBattlerAttacker] * 2; gBattleScripting.bideDmg = gBideDmg[gBattlerAttacker] * 2;
gBattlerTarget = gTakenDmgByBattler[gBattlerAttacker]; gBattlerTarget = gBideTarget[gBattlerAttacker];
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
gBattlerTarget = GetMoveTarget(MOVE_BIDE, MOVE_TARGET_SELECTED + 1); gBattlerTarget = GetMoveTarget(MOVE_BIDE, MOVE_TARGET_SELECTED + 1);
gBattlescriptCurrInstr = BattleScript_BideAttack; gBattlescriptCurrInstr = BattleScript_BideAttack;
@ -5433,7 +5433,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_GooeyActivates; gBattlescriptCurrInstr = BattleScript_GooeyActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
break; break;
@ -5483,7 +5483,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
&& gBattleMons[gBattlerTarget].hp == 0 && gBattleMons[gBattlerTarget].hp == 0
&& IsBattlerAlive(gBattlerAttacker)) && IsBattlerAlive(gBattlerAttacker))
{ {
gBattleMoveDamage = gSpecialStatuses[gBattlerTarget].dmg; gBattleMoveDamage = gSpecialStatuses[gBattlerTarget].shellBellDmg;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AftermathDmg; gBattlescriptCurrInstr = BattleScript_AftermathDmg;
effect++; effect++;
@ -5512,7 +5512,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
} }
@ -5531,7 +5531,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
break; break;
@ -5548,7 +5548,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS; gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
break; break;
@ -5564,7 +5564,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN; gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
break; break;
@ -5784,7 +5784,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
break; break;
@ -5974,7 +5974,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
} }
@ -5995,7 +5995,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE); PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_SYNCHRONIZE);
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gBattlescriptCurrInstr = BattleScript_SynchronizeActivates;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; gHitMarker |= HITMARKER_STATUS_ABILITY_EFFECT;
effect++; effect++;
} }
} }
@ -7757,10 +7757,10 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
gLastUsedItem = atkItem; gLastUsedItem = atkItem;
gPotentialItemEffectBattler = gBattlerAttacker; gPotentialItemEffectBattler = gBattlerAttacker;
gBattleScripting.battler = gBattlerAttacker; gBattleScripting.battler = gBattlerAttacker;
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkHoldEffectParam) * -1; gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].shellBellDmg / atkHoldEffectParam) * -1;
if (gBattleMoveDamage == 0) if (gBattleMoveDamage == 0)
gBattleMoveDamage = -1; gBattleMoveDamage = -1;
gSpecialStatuses[gBattlerTarget].dmg = 0; gSpecialStatuses[gBattlerTarget].shellBellDmg = 0;
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret;
effect = ITEM_HP_CHANGE; effect = ITEM_HP_CHANGE;

File diff suppressed because it is too large Load diff

View file

@ -1310,7 +1310,7 @@ u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
} }
// check unbreedable egg group // check unbreedable egg group
if (eggGroups[0][0] == EGG_GROUP_UNDISCOVERED || eggGroups[1][0] == EGG_GROUP_UNDISCOVERED) if (eggGroups[0][0] == EGG_GROUP_NO_EGGS_DISCOVERED || eggGroups[1][0] == EGG_GROUP_NO_EGGS_DISCOVERED)
return PARENTS_INCOMPATIBLE; return PARENTS_INCOMPATIBLE;
// two Ditto can't breed // two Ditto can't breed
if (eggGroups[0][0] == EGG_GROUP_DITTO && eggGroups[1][0] == EGG_GROUP_DITTO) if (eggGroups[0][0] == EGG_GROUP_DITTO && eggGroups[1][0] == EGG_GROUP_DITTO)

View file

@ -3659,7 +3659,7 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu
} }
if (i >= PARTY_SIZE) if (i >= PARTY_SIZE)
sentToPc = SendMonToPC(&mon); sentToPc = CopyMonToPC(&mon);
else else
{ {
sentToPc = MON_GIVEN_TO_PARTY; sentToPc = MON_GIVEN_TO_PARTY;

View file

@ -192,7 +192,7 @@ static const u8 sText_Stats_eggGroup_AMORPHOUS[] = _("AMORPHOUS");
static const u8 sText_Stats_eggGroup_WATER_2[] = _("WATER {CIRCLE_2}"); static const u8 sText_Stats_eggGroup_WATER_2[] = _("WATER {CIRCLE_2}");
static const u8 sText_Stats_eggGroup_DITTO[] = _("DITTO"); static const u8 sText_Stats_eggGroup_DITTO[] = _("DITTO");
static const u8 sText_Stats_eggGroup_DRAGON[] = _("DRAGON"); static const u8 sText_Stats_eggGroup_DRAGON[] = _("DRAGON");
static const u8 sText_Stats_eggGroup_UNDISCOVERED[] = _("---"); static const u8 sText_Stats_eggGroup_NO_EGGS_DISCOVERED[] = _("---");
static const u8 sText_Dex_SEEN[] = _("SEEN"); static const u8 sText_Dex_SEEN[] = _("SEEN");
static const u8 sText_Dex_OWN[] = _("OWN"); static const u8 sText_Dex_OWN[] = _("OWN");
@ -5885,7 +5885,7 @@ static void PrintStatsScreen_Left(u8 taskId)
base_i++; base_i++;
//Egg cycles //Egg cycles
if (sPokedexView->sPokemonStats.eggGroup1 == EGG_GROUP_UNDISCOVERED || sPokedexView->sPokemonStats.eggGroup2 == EGG_GROUP_UNDISCOVERED) //Species without eggs (legendaries etc) if (sPokedexView->sPokemonStats.eggGroup1 == EGG_GROUP_NO_EGGS_DISCOVERED || sPokedexView->sPokemonStats.eggGroup2 == EGG_GROUP_NO_EGGS_DISCOVERED) //Species without eggs (legendaries etc)
{ {
PrintStatsScreenTextSmall(WIN_STATS_LEFT, sText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, sText_Stats_EggCycles, base_x, base_y + base_y_offset*base_i);
PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i); PrintStatsScreenTextSmall(WIN_STATS_LEFT, gText_ThreeDashes, 78, base_y + base_y_offset*base_i);
@ -5962,8 +5962,8 @@ static void PrintStatsScreen_Left(u8 taskId)
case EGG_GROUP_DRAGON : case EGG_GROUP_DRAGON :
StringCopy(gStringVar1, sText_Stats_eggGroup_DRAGON); StringCopy(gStringVar1, sText_Stats_eggGroup_DRAGON);
break; break;
case EGG_GROUP_UNDISCOVERED: case EGG_GROUP_NO_EGGS_DISCOVERED:
StringCopy(gStringVar1, sText_Stats_eggGroup_UNDISCOVERED); StringCopy(gStringVar1, sText_Stats_eggGroup_NO_EGGS_DISCOVERED);
break; break;
} }
//Egg group 2 //Egg group 2
@ -6013,8 +6013,8 @@ static void PrintStatsScreen_Left(u8 taskId)
case EGG_GROUP_DRAGON : case EGG_GROUP_DRAGON :
StringCopy(gStringVar2, sText_Stats_eggGroup_DRAGON); StringCopy(gStringVar2, sText_Stats_eggGroup_DRAGON);
break; break;
case EGG_GROUP_UNDISCOVERED: case EGG_GROUP_NO_EGGS_DISCOVERED:
StringCopy(gStringVar2, sText_Stats_eggGroup_UNDISCOVERED); StringCopy(gStringVar2, sText_Stats_eggGroup_NO_EGGS_DISCOVERED);
break; break;
} }
StringExpandPlaceholders(gStringVar3, sText_Stats_eggGroup_Groups); StringExpandPlaceholders(gStringVar3, sText_Stats_eggGroup_Groups);

View file

@ -352,10 +352,10 @@ static const u16 sHoennToNationalOrder[HOENN_DEX_COUNT - 1] =
const struct SpindaSpot gSpindaSpotGraphics[] = const struct SpindaSpot gSpindaSpotGraphics[] =
{ {
{.x = 16, .y = 7, .image = INCBIN_U16("graphics/spinda_spots/spot_0.1bpp")}, {.x = 16, .y = 7, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_0.1bpp")},
{.x = 40, .y = 8, .image = INCBIN_U16("graphics/spinda_spots/spot_1.1bpp")}, {.x = 40, .y = 8, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_1.1bpp")},
{.x = 22, .y = 25, .image = INCBIN_U16("graphics/spinda_spots/spot_2.1bpp")}, {.x = 22, .y = 25, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_2.1bpp")},
{.x = 34, .y = 26, .image = INCBIN_U16("graphics/spinda_spots/spot_3.1bpp")} {.x = 34, .y = 26, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_3.1bpp")}
}; };
#include "data/pokemon/item_effects.h" #include "data/pokemon/item_effects.h"
@ -2729,14 +2729,14 @@ u8 GiveMonToPlayer(struct Pokemon *mon)
} }
if (i >= PARTY_SIZE) if (i >= PARTY_SIZE)
return SendMonToPC(mon); return CopyMonToPC(mon);
CopyMon(&gPlayerParty[i], mon, sizeof(*mon)); CopyMon(&gPlayerParty[i], mon, sizeof(*mon));
gPlayerPartyCount = i + 1; gPlayerPartyCount = i + 1;
return MON_GIVEN_TO_PARTY; return MON_GIVEN_TO_PARTY;
} }
u8 SendMonToPC(struct Pokemon* mon) u8 CopyMonToPC(struct Pokemon *mon)
{ {
s32 boxNo, boxPos; s32 boxNo, boxPos;

View file

@ -67,7 +67,7 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u
struct Pokemon mon; struct Pokemon mon;
u16 targetSpecies; u16 targetSpecies;
if (OW_SYNCHRONIZE_NATURE >= GEN_6 && (gSpeciesInfo[species].eggGroups[0] == EGG_GROUP_UNDISCOVERED || OW_SYNCHRONIZE_NATURE == GEN_7)) if (OW_SYNCHRONIZE_NATURE >= GEN_6 && (gSpeciesInfo[species].eggGroups[0] == EGG_GROUP_NO_EGGS_DISCOVERED || OW_SYNCHRONIZE_NATURE == GEN_7))
CreateMonWithNature(&mon, species, level, USE_RANDOM_IVS, PickWildMonNature()); CreateMonWithNature(&mon, species, level, USE_RANDOM_IVS, PickWildMonNature());
else else
CreateMon(&mon, species, level, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0); CreateMon(&mon, species, level, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);

View file

@ -157,7 +157,7 @@ struct InGameTrade {
u32 personality; u32 personality;
u16 heldItem; u16 heldItem;
u8 mailNum; u8 mailNum;
u8 otName[11]; u8 otName[TRAINER_NAME_LENGTH + 1];
u8 otGender; u8 otGender;
u8 sheen; u8 sheen;
u16 requestedSpecies; u16 requestedSpecies;

View file

@ -1,3 +1,4 @@
.include "gflib/malloc.o"
.include "src/decompress.o" .include "src/decompress.o"
.include "src/main.o" .include "src/main.o"
.include "gflib/window.o" .include "gflib/window.o"