merge with master

This commit is contained in:
DizzyEggg 2023-02-17 15:43:15 +01:00
commit 66d2f253a1
113 changed files with 7204 additions and 4430 deletions

View File

@ -142,7 +142,8 @@ ROMTESTHYDRA := tools/mgba-rom-test-hydra/mgba-rom-test-hydra$(EXE)
PERL := perl
TOOLDIRS := $(filter-out tools/mgba tools/agbcc tools/binutils,$(wildcard tools/*))
TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc
CHECKTOOLDIRS = tools/patchelf tools/mgba-rom-test-hydra
TOOLBASE = $(TOOLDIRS:tools/%=%)
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
@ -158,7 +159,7 @@ MAKEFLAGS += --no-print-directory
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) libagbsyscall modern tidymodern tidynonmodern check
.PHONY: all rom clean compare tidy tools check-tools mostlyclean clean-tools clean-check-tools $(TOOLDIRS) $(CHECKTOOLDIRS) libagbsyscall modern tidymodern tidynonmodern check
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
@ -176,9 +177,9 @@ endif
ifeq (,$(MAKECMDGOALS))
SCAN_DEPS ?= 1
else
# clean, tidy, tools, mostlyclean, clean-tools, $(TOOLDIRS), tidymodern, tidynonmodern don't even build the ROM
# clean, tidy, tools, check-tools, mostlyclean, clean-tools, clean-check-tools, $(TOOLDIRS), $(CHECKTOOLDIRS), tidymodern, tidynonmodern don't even build the ROM
# libagbsyscall does its own thing
ifeq (,$(filter-out clean tidy tools mostlyclean clean-tools $(TOOLDIRS) tidymodern tidynonmodern libagbsyscall,$(MAKECMDGOALS)))
ifeq (,$(filter-out clean tidy tools mostlyclean clean-tools $(TOOLDIRS) clean-check-tools $(CHECKTOOLDIRS) tidymodern tidynonmodern libagbsyscall,$(MAKECMDGOALS)))
SCAN_DEPS ?= 0
else
SCAN_DEPS ?= 1
@ -229,11 +230,16 @@ all: rom
tools: $(TOOLDIRS)
check-tools: $(CHECKTOOLDIRS)
syms: $(SYM)
$(TOOLDIRS):
@$(MAKE) -C $@
$(CHECKTOOLDIRS):
@$(MAKE) -C $@
rom: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1) rom.sha1
@ -242,11 +248,14 @@ endif
# For contributors to make sure a change didn't affect the contents of the ROM.
compare: all
clean: mostlyclean clean-tools
clean: mostlyclean clean-tools clean-check-tools
clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
clean-check-tools:
@$(foreach tooldir,$(CHECKTOOLDIRS),$(MAKE) clean -C $(tooldir);)
mostlyclean: tidynonmodern tidymodern
rm -f $(SAMPLE_SUBDIR)/*.bin
rm -f $(CRY_SUBDIR)/*.bin
@ -455,11 +464,11 @@ LD_SCRIPT_TEST := ld_script_test.txt
$(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
$(TESTELF): $(OBJ_DIR)/ld_script_test.ld $(OBJS) $(TEST_OBJS) libagbsyscall
$(TESTELF): $(OBJ_DIR)/ld_script_test.ld $(OBJS) $(TEST_OBJS) libagbsyscall check-tools
@echo "cd $(OBJ_DIR) && $(LD) -T ld_script_test.ld -o ../../$@ <objects> <test-objects> <lib>"
@cd $(OBJ_DIR) && $(LD) $(TESTLDFLAGS) -T ld_script_test.ld -o ../../$@ $(OBJS_REL) $(TEST_OBJS_REL) $(LIB)
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
$(PATCHELF) pokeemerald-test.elf gTestRunnerArgv "$(TESTS)\0"
$(PATCHELF) $(TESTELF) gTestRunnerArgv "$(TESTS)\0"
ifeq ($(GITHUB_REPOSITORY_OWNER),rh-hideout)
TEST_SKIP_IS_FAIL := \x01

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,2 @@
gUnusedWindowVar1
gUnusedWindowVar2
gTransparentTileNumber
gUnusedWindowVar3
gWindowBgTilemapBuffers

View File

@ -2644,7 +2644,6 @@ GigaImpactContinuity:
delay 11
createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 26, 0, 0, 5
delay 6
waitbgfadeout
createsprite gBasicHitSplatSpriteTemplate, 4, 4, -10, 0, 1, 0
playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET
delay 1
@ -4333,12 +4332,12 @@ Move_SPACIAL_REND:
waitbgfadein
loopsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET, 3, 5
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, SOUND_PAN_ATTACKER, 0xb0, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, 0xff40, 0xf0, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, SOUND_PAN_ATTACKER, 0xff60, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, 0xff40, 0xff90, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, 0xa0, 0x30, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, 0xff20, 0xffe0, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 5, 0, 10, 0x70, 0xff80, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, 0xff40, 0xf0, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, SOUND_PAN_ATTACKER, 0xff60, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, 0xff40, 0xff90, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, 0xa0, 0x30, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, 0xff20, 0xffe0, 0x28
createsprite gSpacialRendBladesTemplate2, ANIM_TARGET, 1, 0, 10, 0x70, 0xff80, 0x28
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1
waitforvisualfinish
restorebg

View File

@ -250,7 +250,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_GYRO_BALL
.4byte BattleScript_EffectHit @ EFFECT_ECHOED_VOICE
.4byte BattleScript_EffectHit @ EFFECT_PAYBACK
.4byte BattleScript_EffectHit @ EFFECT_ROUND
.4byte BattleScript_EffectRound @ EFFECT_ROUND
.4byte BattleScript_EffectHit @ EFFECT_BRINE
.4byte BattleScript_EffectHit @ EFFECT_VENOSHOCK
.4byte BattleScript_EffectHit @ EFFECT_RETALIATE
@ -416,6 +416,44 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT
.4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE
.4byte BattleScript_EffectTeatime @ EFFECT_TEATIME
.4byte BattleScript_EffectAttackUpUserAlly @ EFFECT_ATTACK_UP_USER_ALLY
BattleScript_EffectAttackUpUserAlly:
jumpifnoally BS_ATTACKER, BattleScript_EffectAttackUp
attackcanceler
attackstring
ppreduce
jumpifstat BS_ATTACKER, CMP_NOT_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_EffectAttackUpUserAlly_Works
jumpifstat BS_ATTACKER_PARTNER, CMP_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_ButItFailed
BattleScript_EffectAttackUpUserAlly_Works:
attackanimation
waitanimation
setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_ALLOW_PTR, BattleScript_EffectAttackUpUserAlly_TryAlly
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_EffectAttackUpUserAllyUser_PrintString
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
BattleScript_EffectAttackUpUserAllyUser_PrintString:
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_EffectAttackUpUserAlly_TryAlly:
setallytonexttarget BattleScript_EffectAttackUpUserAlly_TryAlly_
BattleScript_EffectAttackUpUserAlly_End:
goto BattleScript_MoveEnd
BattleScript_EffectAttackUpUserAlly_TryAlly_:
setstatchanger STAT_ATK, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_EffectAttackUpUserAlly_End
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_EffectAttackUpUserAlly_AllyAnim
pause B_WAIT_TIME_SHORTEST
printstring STRINGID_TARGETSTATWONTGOHIGHER
waitmessage B_WAIT_TIME_LONG
goto BattleScript_EffectAttackUpUserAlly_End
BattleScript_EffectAttackUpUserAlly_AllyAnim:
setgraphicalstatchangevalues
playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_EffectAttackUpUserAlly_End
BattleScript_EffectTeatime::
attackcanceler
@ -1283,8 +1321,12 @@ BattleScript_JungleHealingTryRestoreAlly:
goto BattleScript_MoveEnd
BattleScript_EffectAttackerDefenseDownHit:
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING | HITMARKER_NO_PPDEDUCT, BattleScript_NoMoveEffect
setmoveeffect MOVE_EFFECT_DEF_MINUS_1 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_NoMoveEffect:
setmoveeffect 0
goto BattleScript_EffectHit
BattleScript_EffectRelicSong:
setmoveeffect MOVE_EFFECT_RELIC_SONG | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
@ -3082,6 +3124,10 @@ BattleScript_EffectPlaceholder:
printstring STRINGID_NOTDONEYET
goto BattleScript_MoveEnd
BattleScript_EffectRound:
setmoveeffect MOVE_EFFECT_ROUND
goto BattleScript_EffectHit
BattleScript_EffectHit::
BattleScript_HitFromAtkCanceler::
attackcanceler
@ -3170,12 +3216,12 @@ BattleScript_EffectSleep::
jumpifuproarwakes BattleScript_CantMakeAsleep
jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_InsomniaProtects
jumpifability BS_TARGET, ABILITY_VITAL_SPIRIT, BattleScript_InsomniaProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifability BS_TARGET_SIDE, ABILITY_SWEET_VEIL, BattleScript_SweetVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_ELECTRIC_TERRAIN, BattleScript_ElectricTerrainPrevents
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
@ -3255,15 +3301,15 @@ BattleScript_PastelVeilProtects:
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
BattleScript_LeafGuardProtectsRet::
BattleScript_AbilityProtectsDoesntAffectRet::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
printstring STRINGID_ITDOESNTAFFECT
waitmessage B_WAIT_TIME_LONG
return
BattleScript_LeafGuardProtects:
call BattleScript_LeafGuardProtectsRet
BattleScript_AbilityProtectsDoesntAffect:
call BattleScript_AbilityProtectsDoesntAffectRet
orhalfword gMoveResultFlags, MOVE_RESULT_FAILED
goto BattleScript_MoveEnd
@ -3584,7 +3630,7 @@ BattleScript_MirrorArmorReflect::
call BattleScript_AbilityPopUp
jumpifsubstituteblocks BattleScript_AbilityNoSpecificStatLoss
BattleScript_MirrorArmorReflectStatLoss:
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_MIRROR_ARMOR | STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_MirrorArmorReflectEnd
jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_MirrorArmorReflectAnim
goto BattleScript_MirrorArmorReflectWontFall
BattleScript_MirrorArmorReflectAnim:
@ -3773,12 +3819,12 @@ BattleScript_EffectToxic::
attackstring
ppreduce
jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus BS_TARGET, STATUS1_POISON | STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
@ -4114,12 +4160,12 @@ BattleScript_EffectPoison::
attackstring
ppreduce
jumpifability BS_TARGET, ABILITY_IMMUNITY, BattleScript_ImmunityProtected
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET_SIDE, ABILITY_PASTEL_VEIL, BattleScript_PastelVeilProtects
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifsubstituteblocks BattleScript_ButItFailed
jumpifstatus BS_TARGET, STATUS1_POISON, BattleScript_AlreadyPoisoned
jumpifstatus BS_TARGET, STATUS1_TOXIC_POISON, BattleScript_AlreadyPoisoned
@ -4141,11 +4187,11 @@ BattleScript_EffectParalyze:
attackstring
ppreduce
jumpifability BS_TARGET, ABILITY_LIMBER, BattleScript_LimberProtected
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifsubstituteblocks BattleScript_ButItFailed
typecalc
BattleScript_BattleScript_EffectParalyzeNoTypeCalc:
@ -5577,11 +5623,11 @@ BattleScript_EffectWillOWisp::
jumpiftype BS_TARGET, TYPE_FIRE, BattleScript_NotAffected
jumpifability BS_TARGET, ABILITY_WATER_VEIL, BattleScript_WaterVeilPrevents
jumpifability BS_TARGET, ABILITY_WATER_BUBBLE, BattleScript_WaterVeilPrevents
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_AbilityProtectsDoesntAffect
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_ButItFailed
jumpifterrainaffected BS_TARGET, STATUS_FIELD_MISTY_TERRAIN, BattleScript_MistyTerrainPrevents
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
@ -5673,6 +5719,9 @@ BattleScript_EffectFollowMe::
attackcanceler
attackstring
ppreduce
.if B_UPDATED_MOVE_DATA >= GEN_6
jumpifnotbattletype BATTLE_TYPE_DOUBLE, BattleScript_ButItFailed
.endif
setforcedtarget
attackanimation
waitanimation
@ -5871,10 +5920,10 @@ BattleScript_EffectYawn::
jumpifability BS_TARGET, ABILITY_VITAL_SPIRIT, BattleScript_PrintBattlerAbilityMadeIneffective
jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_PrintBattlerAbilityMadeIneffective
jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_PrintBattlerAbilityMadeIneffective
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_LeafGuardProtects
jumpifability BS_TARGET, ABILITY_PURIFYING_SALT, BattleScript_AbilityProtectsDoesntAffect
jumpifflowerveil BattleScript_FlowerVeilProtects
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardProtects
jumpifshieldsdown BS_TARGET, BattleScript_LeafGuardProtects
jumpifleafguardprotected BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifshieldsdown BS_TARGET, BattleScript_AbilityProtectsDoesntAffect
jumpifsubstituteblocks BattleScript_ButItFailed
jumpifsafeguard BattleScript_SafeguardProtected
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
@ -7634,11 +7683,14 @@ BattleScript_GrudgeTakesPp::
printstring STRINGID_PKMNLOSTPPGRUDGE
waitmessage B_WAIT_TIME_LONG
return
BattleScript_MagicCoatBounce::
attackstring
ppreduce
pause B_WAIT_TIME_SHORT
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0, BattleScript_MagicCoatBounce_Print
call BattleScript_AbilityPopUp
BattleScript_MagicCoatBounce_Print:
printfromtable gMagicCoatBounceStringIds
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_ALLOW_NO_PP

View File

@ -48,21 +48,24 @@ BirthIsland_Exterior_EventScript_Triangle::
special DoDeoxysRockInteraction
waitstate
switch VAR_RESULT
case 0, BirthIsland_Exterior_EventScript_NotSolved1
case 1, BirthIsland_Exterior_EventScript_NotSolved2
case 2, BirthIsland_Exterior_EventScript_Deoxys
case 3, BirthIsland_Exterior_EventScript_NotSolved3
case DEOXYS_ROCK_FAILED, BirthIsland_Exterior_EventScript_Failed
case DEOXYS_ROCK_PROGRESSED, BirthIsland_Exterior_EventScript_Progressed
case DEOXYS_ROCK_SOLVED, BirthIsland_Exterior_EventScript_Deoxys
case DEOXYS_ROCK_COMPLETE, BirthIsland_Exterior_EventScript_Complete
end
BirthIsland_Exterior_EventScript_NotSolved1::
@ The actual rock triangle movement is handled by DoDeoxysRockInteraction.
@ Unless the player has solved the puzzle and needs to encounter Deoxys,
@ there's nothing else the script needs to do.
BirthIsland_Exterior_EventScript_Failed::
release
end
BirthIsland_Exterior_EventScript_NotSolved2::
BirthIsland_Exterior_EventScript_Progressed::
release
end
BirthIsland_Exterior_EventScript_NotSolved3::
BirthIsland_Exterior_EventScript_Complete::
release
end

View File

@ -38,7 +38,7 @@ PetalburgCity_OnFrame:
PetalburgCity_EventScript_WallyTutorial::
lockall
special SavePlayerParty
special PutZigzagoonInPlayerParty
special LoadWallyZigzagoon
applymovement LOCALID_WALLY, PetalburgCity_Movement_WallyTutorialWally
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WallyTutorialPlayer
waitmovement 0

View File

@ -311,7 +311,7 @@ gSpecials::
def_special TryUpdateRusturfTunnelState
def_special IsGrassTypeInParty
def_special DoContestHallWarp
def_special PutZigzagoonInPlayerParty
def_special LoadWallyZigzagoon
def_special IsStarterInParty
def_special CopyCurSecretBaseOwnerName_StrVar1
def_special ScriptCheckFreePokemonStorageSpace

View File

@ -4,11 +4,8 @@
#include "bg.h"
#include "blit.h"
u32 gUnusedWindowVar1;
u32 gUnusedWindowVar2;
// This global is set to 0 and never changed.
u8 gTransparentTileNumber;
u32 gUnusedWindowVar3;
void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS];
extern u32 gWindowTileAutoAllocEnabled;

View File

@ -74,8 +74,5 @@ void CopyWindowToVram8Bit(u8 windowId, u8 mode);
extern struct Window gWindows[];
extern void *gWindowBgTilemapBuffers[];
extern u32 gUnusedWindowVar1;
extern u32 gUnusedWindowVar2;
extern u32 gUnusedWindowVar3;
#endif // GUARD_WINDOW_H

View File

@ -1,3 +1,3 @@
<EFBFBD>$<24>$<24>$<24>$<24>$<24>$<24>$<24>$<24>$<24> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> D!E!F!G!H!I!@!<21>$<24>$<24>$<24>$<24>$<24>$<24>$<24>$<24>$<24> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> њ ћ ќ § ў џ ђ Ј$Ї$І$Ѕ$Є$Ѓ$Ђ$Ё$ $  Ё Ђ Ѓ Є Ѕ І Ї Ј Љ Њ Ћ Ќ ­ Ў Џ
! ! ! !!!!И$З$Ж$Е$Д$Г$В$Б$А$А Б В Г Д Е Ж З И Й К Л М Н О П !!!!!!!Ш$Ч$Ц$Х$Ф$У$Т$С$Р$Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я *!+!,!-!.!/!"!и$з$ж$е$д$г$в$б$а$а б в г д е ж з и й к л м н о п :!;!<!=!>!?!2!ш$ч$ц$х$ф$у$т$с$р$р с т у ф х ц ч ш щ ъ ы ь э ю я J!K!L!M!N!O!B!ш,ч,ц,х,ф,у,т,с,р,р(с(т(у(ф(х(ц(ч(ш(щ(ъ(ы(ь(э(ю(я(J)K)L)M)N)O)B)и,з,ж,е,д,г,в,б,а,а(б(в(г(д(е(ж(з(и(й(к(л(м(н(о(п(:);)<)=)>)?)2)Ш,Ч,Ц,Х,Ф,У,Т,С,Р,Р(С(Т(У(Ф(Х(Ц(Ч(Ш(Щ(Ъ(Ы(Ь(Э(Ю(Я(*)+),)-).)/)")И,З,Ж,Е,Д,Г,В,Б,А,А(Б(В(Г(Д(Е(Ж(З(И(Й(К(Л(М(Н(О(П()))))))Ј,Ї,І,Ѕ,Є,Ѓ,Ђ,Ё, , (Ё(Ђ(Ѓ(Є(Ѕ(І(Ї(Ј(Љ(Њ(Ћ(Ќ(­(Ў(Џ(
) ) ) ))))<29>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(њ(ћ(ќ(§(ў(џ(ђ(<28>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>,<2C>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(<28>(D)E)F)G)H)I)@)
        $$ $$$$$
            $$ $$$$$        ! " # $ % & ' (  ) * + , ,$+$*$)$ ($'$&$%$- . / 0 1 2 3 4 5 6 7 8 9 : ; < = > >$=$<$;$:$9$8$7$6$ ? @ A B C D E E F F$E E D$C$B$A$@$?$G H I J K L M N O P Q E E E E Q$P$O$N$M$L$K$R S T U V W X Y Z [ \ ] ^ _ ` a b E E E E E E E E b$a$`$_$^$ c d e f g h i j k ^(_(`(a(b(E E E E E E E E b,a,`,_,^, c(d(e(f(g(h(i(j(k( K(L(M(N(O(P(Q(E E E E Q,P,O,N,M,L,K,R(S(T( U(V(W(X(Y(Z([(\(](?(@(A(B(C(D(E E F(F,E E D,C,B,A,@,?,G(H(I(J( 6(7(8(9(:(;(<(=(>(>,=,<,;,:,9,8,7,6, %(&('((( )(*(+(,(,,+,*,), (,',&,%,-(.( /(0(1( 2(3(4(5( ((((( ((,, ,,,,, ((( (((( ( !("(#($( ((((( ((,, ,,,,,
( ( ( (( ((

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,259 @@
JASC-PAL
0100
256
0 0 0
255 255 255
222 222 222
222 222 214
198 198 198
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
0 0 0
255 255 255
247 247 247
231 231 231
222 222 222
222 222 214
214 214 214
198 198 198
181 181 181
165 165 165
148 148 148
132 132 132
115 115 115
99 99 99
82 82 82
66 66 66
49 49 49
33 33 33
16 16 16
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
0 0 0

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
199 225 209
248 248 248
197 197 197
139 213 238
89 189 230
7 172 213
7 131 164
7 89 114
246 213 246
238 172 238
255 97 207
197 56 165
123 40 88
0 0 0
0 0 0
0 0 0

View File

@ -191,6 +191,7 @@ struct SpecialStatus
u8 weatherAbilityDone:1;
u8 terrainAbilityDone:1;
u8 emergencyExited:1;
u8 afterYou:1;
};
struct SideTimer
@ -654,6 +655,7 @@ struct BattleStruct
u8 targetsDone[MAX_BATTLERS_COUNT]; // Each battler as a bit.
u16 overwrittenAbilities[MAX_BATTLERS_COUNT]; // abilities overwritten during battle (keep separate from battle history in case of switching)
bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face.
u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party.
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View File

@ -160,7 +160,7 @@ void AnimThrowProjectile(struct Sprite *sprite);
void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId);
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId);
void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite);
void TradeMenuBouncePartySprites(struct Sprite *sprite);
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId);
void DestroySpriteAndFreeResources_(struct Sprite *sprite);
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId);

View File

@ -64,6 +64,35 @@ struct TypePower
u16 effect;
};
enum
{
CANCELLER_FLAGS,
CANCELLER_SKY_DROP,
CANCELLER_ASLEEP,
CANCELLER_FROZEN,
CANCELLER_TRUANT,
CANCELLER_RECHARGE,
CANCELLER_FLINCH,
CANCELLER_DISABLED,
CANCELLER_GRAVITY,
CANCELLER_HEAL_BLOCKED,
CANCELLER_TAUNTED,
CANCELLER_IMPRISONED,
CANCELLER_CONFUSED,
CANCELLER_PARALYSED,
CANCELLER_IN_LOVE,
CANCELLER_BIDE,
CANCELLER_THAW,
CANCELLER_POWDER_MOVE,
CANCELLER_POWDER_STATUS,
CANCELLER_THROAT_CHOP,
CANCELLER_MULTIHIT_MOVES,
CANCELLER_Z_MOVES,
CANCELLER_END,
CANCELLER_PSYCHIC_TERRAIN,
CANCELLER_END2,
};
extern const struct TypePower gNaturalGiftTable[];
void HandleAction_ThrowBall(void);

View File

@ -73,4 +73,7 @@
#define GEN_9 6
#define GEN_LATEST GEN_8
// General settings
#define EXPANSION_INTRO TRUE // If TRUE, a custom RHH intro will play after the vanilla copyright screen.
#endif // GUARD_CONFIG_H

View File

@ -371,8 +371,9 @@
#define MOVE_EFFECT_RELIC_SONG 69
#define MOVE_EFFECT_TRAP_BOTH 70
#define MOVE_EFFECT_DOUBLE_SHOCK 71
#define MOVE_EFFECT_ROUND 72
#define NUM_MOVE_EFFECTS 72
#define NUM_MOVE_EFFECTS 73
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -397,7 +397,8 @@
#define EFFECT_SPECIAL_ATTACK_UP_HIT 391
#define EFFECT_VICTORY_DANCE 392
#define EFFECT_TEATIME 393
#define EFFECT_ATTACK_UP_USER_ALLY 394 // Howl 8th Gen
#define NUM_BATTLE_MOVE_EFFECTS 394
#define NUM_BATTLE_MOVE_EFFECTS 395
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_CONSTANTS_BATTLE_PYRAMID_H
#define GUARD_CONSTANTS_BATTLE_PYRAMID_H
#define TOTAL_ROUNDS 20
#define TOTAL_PYRAMID_ROUNDS 20
#define PICKUP_ITEMS_PER_ROUND 10
#define HINT_EXIT_DIRECTION 0

View File

@ -74,6 +74,7 @@
#define BS_PLAYER2 13 // for Cmd_updatestatusicon
#define BS_OPPONENT2 14
#define BS_ABILITY_BATTLER 15
#define BS_ATTACKER_PARTNER 16
// Cmd_accuracycheck
#define NO_ACC_CALC_CHECK_LOCK_ON 0xFFFF
@ -273,6 +274,7 @@
// Cmd_statbuffchange
#define STAT_CHANGE_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_CHANGE_MIRROR_ARMOR (1 << 1) // Stat change redirection caused by Mirror Armor ability.
#define STAT_CHANGE_NOT_PROTECT_AFFECTED (1 << 5)
#define STAT_CHANGE_UPDATE_MOVE_EFFECT (1 << 6)

View File

@ -80,4 +80,10 @@
#define FANCOUNTER_FINISHED_CONTEST 2
#define FANCOUNTER_USED_BATTLE_TOWER 3
// Return values for DoDeoxysRockInteraction
#define DEOXYS_ROCK_FAILED 0
#define DEOXYS_ROCK_PROGRESSED 1
#define DEOXYS_ROCK_SOLVED 2
#define DEOXYS_ROCK_COMPLETE 3
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H

View File

@ -4,29 +4,19 @@
#define TRADE_PLAYER 0
#define TRADE_PARTNER 1
#define LINK_TRADE_TIMEOUT 300
// In-game Trade IDs
#define INGAME_TRADE_SEEDOT 0
#define INGAME_TRADE_PLUSLE 1
#define INGAME_TRADE_HORSEA 2
#define INGAME_TRADE_MEOWTH 3
// Flag IDs for sending link data
#define INITIATE_TRADE 1
#define CANCEL_TRADE 2
#define WANTS_TO_TRADE 1
#define WANTS_TO_CANCEL 2
#define READY_FINISH_TRADE 1
#define FINISH_TRADE 2
// Return values for CanTradeSelectedMon and CanSpinTradeMon
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_EGG_YET2 5
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_PARTNER_EGG_YET 5
// Return values for CheckValidityOfTradeMons
#define PLAYER_MON_INVALID 0
@ -38,63 +28,6 @@
#define TRADE_PLAYER_NOT_READY 1
#define TRADE_PARTNER_NOT_READY 2
// Indexes for sTradeActionTexts
#define TRADE_TEXT_CANCEL 0
#define TRADE_TEXT_CHOOSE_MON 1
#define TRADE_TEXT_SUMMARY 2
#define TRADE_TEXT_TRADE 3
#define TRADE_TEXT_CANCEL_TRADE 4
#define TRADE_TEXT_JP_QUIT 5
// Checked to confirm DrawTradeMenuParty has reached final state
#define DRAW_PARTY_FINISH 5
// Message indexes for sTradeMessages
#define TRADE_MSG_STANDBY 0
#define TRADE_MSG_CANCELED 1
#define TRADE_MSG_ONLY_MON1 2
#define TRADE_MSG_ONLY_MON2 3
#define TRADE_MSG_WAITING_FOR_FRIEND 4
#define TRADE_MSG_FRIEND_WANTS_TO_TRADE 5
#define TRADE_MSG_MON_CANT_BE_TRADED 6
#define TRADE_MSG_EGG_CANT_BE_TRADED 7
#define TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED 8
// IDs for QueueAction
#define QUEUE_SEND_DATA 0
#define QUEUE_STANDBY 1
#define QUEUE_ONLY_MON1 2
#define QUEUE_ONLY_MON2 3
#define QUEUE_UNUSED1 4
#define QUEUE_UNUSED2 5
#define QUEUE_MON_CANT_BE_TRADED 6
#define QUEUE_EGG_CANT_BE_TRADED 7
#define QUEUE_FRIENDS_MON_CANT_BE_TRADED 8
#define QUEUE_DELAY_MSG 3
#define QUEUE_DELAY_DATA 5
// IDs for CallTradeMenuFunc
#define TRADEMENUFUNC_MAIN_MENU 0
#define TRADEMENUFUNC_SELECTED_MON 1
#define TRADEMENUFUNC_SHOW_MON_SUMMARY 2
#define TRADEMENUFUNC_CONFIRM_OR_CANCEL_TRADE 3
#define TRADEMENUFUNC_CANCEL_TRADE_PROMPT 4
#define TRADEMENUFUNC_UNUSED_5 5
#define TRADEMENUFUNC_BOTH_MONS_SELECTED 6
#define TRADEMENUFUNC_CONFIRM_TRADE_PROMPT 7
#define TRADEMENUFUNC_REDRAW_MAIN_MENU 8
#define TRADEMENUFUNC_LINK_TRADE_FADE_OUT 9
#define TRADEMENUFUNC_LINK_TRADE_WAIT_FADE 10
#define TRADEMENUFUNC_CANCEL_TRADE_1 11
#define TRADEMENUFUNC_CANCEL_TRADE_2 12
#define TRADEMENUFUNC_START_LINK_TRADE 13
#define TRADEMENUFUNC_DELAY_TRADE_CONFIRM 14
#define TRADEMENUFUNC_UNUSED_15 15
#define TRADEMENUFUNC_LINK_TRADE_WAIT_QUEUE 16
#define TRADEMENUFUNC_PARTNER_MON_INVALID 17
#define TRADEMENUFUNC_STANDBY 100
// Message indexes for sUnionRoomTradeMessages
#define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1

View File

@ -0,0 +1,9 @@
#ifndef GUARD_EXPANSION_INTRO_H
#define GUARD_EXPANSION_INTRO_H
#if EXPANSION_INTRO == TRUE
void CB2_ExpansionIntro(void);
void Task_HandleExpansionIntro(u8 taskId);
#endif
#endif /* GUARD_EXPANSION_INTRO_H */

View File

@ -9981,6 +9981,7 @@ extern const u32 gBattleAnimBgTilemap_GigaImpactPlayer[];
extern const u32 gBattleAnimBgTilemap_GigaImpactOpponent[];
extern const u32 gBattleAnimBgTilemap_GigaImpactContest[];
extern const u32 gBattleAnimBgImage_GigaImpact[];
extern const u32 gBattleAnimBgImage_GigaImpactContest[];
extern const u32 gBattleAnimBgPalette_GigaImpact[];
extern const u32 gBattleAnimBgImage_SpacialRend[];
extern const u32 gBattleAnimBgPalette_SpacialRend[];

View File

@ -9,5 +9,8 @@
void CB2_InitCopyrightScreenAfterBootup(void);
void CB2_InitCopyrightScreenAfterTitleScreen(void);
void PanFadeAndZoomScreen(u16, u16, u16, u16);
void MainCB2_Intro(void);
void Task_Scene1_Load(u8);
#endif // GUARD_INTRO_H

View File

@ -83,7 +83,7 @@ struct RfuGameCompatibilityData
u16 hasNews:1;
u16 hasCard:1;
u16 unknown:1; // Never read
u16 isChampion:1;
u16 canLinkNationally:1;
u16 hasNationalDex:1;
u16 gameClear:1;
u16 version:4;

View File

@ -15,6 +15,15 @@ enum {
MAILBOXWIN_COUNT
};
// Window IDs for the move relearner
enum {
RELEARNERWIN_DESC_BATTLE,
RELEARNERWIN_DESC_CONTEST,
RELEARNERWIN_MOVE_LIST,
RELEARNERWIN_MSG,
RELEARNERWIN_YESNO,
};
enum {
TAG_CONDITION_MON = 100,
TAG_CONDITION_BALL,
@ -117,11 +126,11 @@ void DestroyConditionSparkleSprites(struct Sprite **sprites);
void FreeConditionSparkles(struct Sprite **sprites);
// Move relearner
void MoveRelearnerPrintText(u8 *str);
void MoveRelearnerPrintMessage(u8 *str);
bool16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow);
void InitMoveRelearnerWindows(bool8 useContestWindow);
// Level up window
void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr);

View File

@ -5,11 +5,11 @@ extern bool8 gGiftIsFromEReader;
u16 GetMysteryGiftBaseBlock(void);
void CB2_MysteryGiftEReader(void);
void PrintMysteryGiftOrEReaderTopMenu(bool8 isJapanese, bool32 usePickOkCancel);
void PrintMysteryGiftOrEReaderHeader(bool8 isJapanese, bool32 usePickOkCancel);
void MG_DrawCheckerboardPattern(u32 bg);
void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void);
bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str);
void AddTextPrinterToWindow1(const u8 *src);
void MG_AddMessageTextPrinter(const u8 *src);
void CB2_InitEReader(void);
void CB2_InitMysteryGift(void);
void MG_DrawTextBorder(u8 windowId);

View File

@ -294,7 +294,7 @@ struct BattlePokemon
/*0x59*/ u8 metLevel;
};
struct SpeciesInfo
struct SpeciesInfo /*0x24*/
{
/* 0x00 */ u8 baseHP;
/* 0x01 */ u8 baseAttack;
@ -304,25 +304,26 @@ struct SpeciesInfo
/* 0x05 */ u8 baseSpDefense;
/* 0x06 */ u8 types[2];
/* 0x08 */ u8 catchRate;
/* 0x09 */ u16 expYield;
/* 0x0A */ u16 evYield_HP:2;
/* 0x0A */ u16 evYield_Attack:2;
/* 0x0A */ u16 evYield_Defense:2;
/* 0x0A */ u16 evYield_Speed:2;
/* 0x0B */ u16 evYield_SpAttack:2;
/* 0x0B */ u16 evYield_SpDefense:2;
/* 0x0C */ u16 itemCommon;
/* 0x0E */ u16 itemRare;
/* 0x10 */ u8 genderRatio;
/* 0x11 */ u8 eggCycles;
/* 0x12 */ u8 friendship;
/* 0x13 */ u8 growthRate;
/* 0x14 */ u8 eggGroups[2];
/* 0x16 */ u16 abilities[NUM_ABILITY_SLOTS];
/* 0x19 */ u8 safariZoneFleeRate;
/* 0x1A */ u8 bodyColor : 7;
/* 0x09 padding */
/* 0x0A */ u16 expYield; // expYield was changed from u8 to u16 for the new Exp System.
/* 0x0C */ u16 evYield_HP:2;
u16 evYield_Attack:2;
u16 evYield_Defense:2;
u16 evYield_Speed:2;
/* 0x0D */ u16 evYield_SpAttack:2;
u16 evYield_SpDefense:2;
/* 0x0E */ u16 itemCommon;
/* 0x10 */ u16 itemRare;
/* 0x12 */ u8 genderRatio;
/* 0x13 */ u8 eggCycles;
/* 0x14 */ u8 friendship;
/* 0x15 */ u8 growthRate;
/* 0x16 */ u8 eggGroups[2];
/* 0x18 */ u16 abilities[NUM_ABILITY_SLOTS]; // 3 abilities, no longer u8 because we have over 255 abilities now.
/* 0x1E */ u8 safariZoneFleeRate;
/* 0x1F */ u8 bodyColor : 7;
u8 noFlip : 1;
/* 0x1B */ u16 flags;
/* 0x20 */ u16 flags;
};
struct BattleMove

View File

@ -21,7 +21,8 @@ enum {
MAPSECTYPE_ROUTE,
MAPSECTYPE_CITY_CANFLY,
MAPSECTYPE_CITY_CANTFLY,
MAPSECTYPE_BATTLE_FRONTIER
MAPSECTYPE_BATTLE_FRONTIER,
NUM_MAPSEC_TYPES
};
struct RegionMap {

View File

@ -343,6 +343,7 @@ SECTIONS {
src/battle_transition_frontier.o(.text);
src/international_string_util.o(.text);
src/pokemon_debug.o(.text);
src/expansion_intro.o(.text);
} =0
script_data :
@ -709,6 +710,7 @@ SECTIONS {
src/m4a_tables.o(.rodata);
data/sound_data.o(.rodata);
src/pokemon_debug.o(.rodata);
src/expansion_intro.o(.rodata);
} =0
song_data :

View File

@ -1,7 +1,6 @@
MAKEFLAGS += --no-print-directory
TOOLDIRS := $(filter-out tools/mgba tools/agbcc tools/binutils,$(wildcard tools/*))
TOOLDIRS := tools/aif2pcm tools/bin2c tools/gbafix tools/gbagfx tools/jsonproc tools/mapjson tools/mid2agb tools/preproc tools/ramscrgen tools/rsfont tools/scaninc
.PHONY: all $(TOOLDIRS)

View File

@ -2427,6 +2427,13 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break;
}
break;
case EFFECT_HEAL_PULSE: // and floral healing
if (!IsTargetingPartner(battlerAtk, battlerDef)) // Don't heal enemies
{
score -= 10;
break;
}
// fallthrough
case EFFECT_HIT_ENEMY_HEAL_ALLY: // pollen puff
if (IsTargetingPartner(battlerAtk, battlerDef))
{
@ -2436,20 +2443,6 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10;
else if (gBattleMons[battlerDef].hp > gBattleMons[battlerDef].maxHP / 2)
score -= 5;
break;
}
// fallthrough
case EFFECT_HEAL_PULSE: // and floral healing
if (!IsTargetingPartner(battlerAtk, battlerDef)) // Don't heal enemies
{
score -= 10;
}
else
{
if (AtMaxHp(battlerDef))
score -= 10;
else if (gBattleMons[battlerDef].hp > gBattleMons[battlerDef].maxHP / 2)
score -= 5;
}
break;
case EFFECT_ELECTRIFY:
@ -3009,6 +3002,13 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
RETURN_SCORE_PLUS(1);
}
break;
case EFFECT_HEAL_PULSE:
case EFFECT_HIT_ENEMY_HEAL_ALLY:
if (AI_WhoStrikesFirst(battlerAtk, FOE(battlerAtk), move) == AI_IS_FASTER
&& AI_WhoStrikesFirst(battlerAtk, BATTLE_PARTNER(FOE(battlerAtk)), move) == AI_IS_FASTER
&& gBattleMons[battlerAtkPartner].hp < gBattleMons[battlerAtkPartner].maxHP / 2)
RETURN_SCORE_PLUS(1);
break;
} // attacker move effects
} // check partner protecting

View File

@ -1080,7 +1080,7 @@ void UpdateAnimBg3ScreenSize(bool8 largeScreenSize)
}
}
void TradeMenuBouncePartySprites(struct Sprite *sprite)
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite)
{
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;

View File

@ -882,6 +882,7 @@ static void HandleMoveSwitching(void)
if (JOY_NEW(A_BUTTON | SELECT_BUTTON))
{
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]);
PlaySE(SE_SELECT);
if (gMoveSelectionCursor[gActiveBattler] != gMultiUsePlayerCursor)
@ -973,6 +974,7 @@ static void HandleMoveSwitching(void)
MoveSelectionDisplayPpString();
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
GetUsableZMoves(gActiveBattler, moveInfo->moves);
}
else if (JOY_NEW(B_BUTTON | SELECT_BUTTON))
{
@ -2917,7 +2919,7 @@ static void PlayerHandleChoosePokemon(void)
*(&gBattleStruct->battlerPreventingSwitchout) = gBattleResources->bufferA[gActiveBattler][1] >> 4;
*(&gBattleStruct->prevSelectedPartySlot) = gBattleResources->bufferA[gActiveBattler][2];
*(&gBattleStruct->abilityPreventingSwitchout) = (gBattleResources->bufferA[gActiveBattler][3] & 0xFF) | (gBattleResources->bufferA[gActiveBattler][7] << 8);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon;
gBattlerInMenuId = gActiveBattler;
}

View File

@ -73,9 +73,33 @@ struct TourneyTreeLineSection
#define tMode data[2]
#define tPrevTaskId data[3]
#define EFFECTIVENESS_MODE_GOOD 0
#define EFFECTIVENESS_MODE_BAD 1
#define EFFECTIVENESS_MODE_AI_VS_AI 2
enum {
EFFECTIVENESS_MODE_GOOD,
EFFECTIVENESS_MODE_BAD,
EFFECTIVENESS_MODE_AI_VS_AI,
};
// Window IDs for the tourney tree
enum {
TOURNEYWIN_NAMES_LEFT,
TOURNEYWIN_NAMES_RIGHT,
TOURNEYWIN_TITLE,
};
// Window IDs for the trainer (WIN_TRAINER_*) and match (WIN_MATCH_*) info cards.
// All 9 have a duplicate window at WIN + NUM_INFO_CARD_WINDOWS used by the alternate info card
enum {
WIN_TRAINER_NAME,
WIN_TRAINER_MON1_NAME,
WIN_TRAINER_MON2_NAME, // Used implicitly
WIN_TRAINER_MON3_NAME, // Used implicitly
WIN_TRAINER_FLAVOR_TEXT = WIN_TRAINER_MON1_NAME + FRONTIER_PARTY_SIZE, // Trainer's potential, battle style, and stat texts
WIN_MATCH_NUMBER,
WIN_MATCH_TRAINER_NAME_LEFT,
WIN_MATCH_TRAINER_NAME_RIGHT,
WIN_MATCH_WIN_TEXT,
NUM_INFO_CARD_WINDOWS
};
static u8 GetDomeTrainerMonIvs(u16);
static void SwapDomeTrainers(int, int, u16 *);
@ -670,7 +694,7 @@ static const struct BgTemplate sInfoCardBgTemplates[4] =
static const struct WindowTemplate sTourneyTreeWindowTemplates[] =
{
{
[TOURNEYWIN_NAMES_LEFT] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 3,
@ -679,7 +703,7 @@ static const struct WindowTemplate sTourneyTreeWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 16,
},
{
[TOURNEYWIN_NAMES_RIGHT] = {
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 3,
@ -688,7 +712,7 @@ static const struct WindowTemplate sTourneyTreeWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 144,
},
{
[TOURNEYWIN_TITLE] = {
.bg = 0,
.tilemapLeft = 8,
.tilemapTop = 1,
@ -702,7 +726,7 @@ static const struct WindowTemplate sTourneyTreeWindowTemplates[] =
static const struct WindowTemplate sInfoCardWindowTemplates[] =
{
{
[WIN_TRAINER_NAME] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 2,
@ -711,7 +735,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 1,
},
{
[WIN_TRAINER_MON1_NAME] = {
.bg = 0,
.tilemapLeft = 16,
.tilemapTop = 5,
@ -720,7 +744,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 53,
},
{
[WIN_TRAINER_MON2_NAME] = {
.bg = 0,
.tilemapLeft = 19,
.tilemapTop = 7,
@ -729,7 +753,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 69,
},
{
[WIN_TRAINER_MON3_NAME] = {
.bg = 0,
.tilemapLeft = 16,
.tilemapTop = 10,
@ -738,7 +762,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 96,
},
{
[WIN_TRAINER_FLAVOR_TEXT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 12,
@ -747,7 +771,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 112,
},
{
[WIN_MATCH_NUMBER] = {
.bg = 0,
.tilemapLeft = 5,
.tilemapTop = 2,
@ -756,7 +780,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 294,
},
{
[WIN_MATCH_TRAINER_NAME_LEFT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 5,
@ -765,7 +789,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 340,
},
{
[WIN_MATCH_TRAINER_NAME_RIGHT] = {
.bg = 0,
.tilemapLeft = 20,
.tilemapTop = 5,
@ -774,7 +798,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 356,
},
{
[WIN_MATCH_WIN_TEXT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 16,
@ -783,7 +807,9 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 372,
},
{
// Duplicate windows used by the alternate info card
// Same as above but on bg 1 instead of bg 0
[WIN_TRAINER_NAME + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 2,
@ -792,7 +818,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 1,
},
{
[WIN_TRAINER_MON1_NAME + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 16,
.tilemapTop = 5,
@ -801,7 +827,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 53,
},
{
[WIN_TRAINER_MON2_NAME + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 19,
.tilemapTop = 7,
@ -810,7 +836,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 69,
},
{
[WIN_TRAINER_MON3_NAME + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 16,
.tilemapTop = 10,
@ -819,7 +845,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 96,
},
{
[WIN_TRAINER_FLAVOR_TEXT + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 12,
@ -828,7 +854,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 112,
},
{
[WIN_MATCH_NUMBER + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 5,
.tilemapTop = 2,
@ -837,7 +863,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 294,
},
{
[WIN_MATCH_TRAINER_NAME_LEFT + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 5,
@ -846,7 +872,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 340,
},
{
[WIN_MATCH_TRAINER_NAME_RIGHT + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 20,
.tilemapTop = 5,
@ -855,7 +881,7 @@ static const struct WindowTemplate sInfoCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 356,
},
{
[WIN_MATCH_WIN_TEXT + NUM_INFO_CARD_WINDOWS] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 16,
@ -1397,26 +1423,27 @@ static const u8 sCompetitorRangeByMatch[DOME_TOURNAMENT_MATCHES_COUNT][3] =
{ NUM_POSSIBLE_MATCH_TRAINERS(DOME_FINAL) * 0, NUM_POSSIBLE_MATCH_TRAINERS(DOME_FINAL), DOME_FINAL},
};
// 1st value is the windowId (0 for left column, 1 for right column)
// 2nd value is the y coord
#define NAME_ROW_HEIGHT 16
// 1st value is the windowId, 2nd value is the y coord
static const u8 sTrainerNamePositions[DOME_TOURNAMENT_TRAINERS_COUNT][2] =
{
{ 0, 0},
{ 1, 112},
{ 1, 0},
{ 0, 112},
{ 0, 48},
{ 1, 64},
{ 1, 48},
{ 0, 64},
{ 0, 16},
{ 1, 96},
{ 1, 16},
{ 0, 96},
{ 0, 32},
{ 1, 80},
{ 1, 32},
{ 0, 80},
{ TOURNEYWIN_NAMES_LEFT, 0 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 7 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 0 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 7 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 3 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 4 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 3 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 4 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 1 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 6 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 1 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 6 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 2 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 5 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_RIGHT, 2 * NAME_ROW_HEIGHT},
{ TOURNEYWIN_NAMES_LEFT, 5 * NAME_ROW_HEIGHT},
};
// Coords for the pokeballs on the tourney tree that act as buttons to view trainer/match info
@ -2427,7 +2454,7 @@ static void InitDomeTrainers(void)
break;
}
if (sTrainerNamePositions[i][0] != 0)
if (sTrainerNamePositions[i][0] != TOURNEYWIN_NAMES_LEFT)
{
j = 0;
DOME_TRAINERS[j].trainerId = TRAINER_FRONTIER_BRAIN;
@ -3420,11 +3447,11 @@ static void Task_HandleInfoCardInput(u8 taskId)
case MATCHCARD_INPUT_UP ... MATCHCARD_INPUT_RIGHT:
gTasks[taskId].data[5] = i;
if (gTasks[taskId].tUsingAlternateSlot)
windowId = 9;
windowId = NUM_INFO_CARD_WINDOWS;
else
windowId = 0;
for (i = windowId; i < windowId + 9; i++)
for (i = windowId; i < windowId + NUM_INFO_CARD_WINDOWS; i++)
{
CopyWindowToVram(i, COPYWIN_GFX);
FillWindowPixelBuffer(i, PIXEL_FILL(0));
@ -4246,14 +4273,14 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
int trainerId = 0;
u8 nature = 0;
int arrId = 0;
int windowId = 0;
int windowId = WIN_TRAINER_NAME;
int x = 0, y = 0;
u8 palSlot = 0;
s16 *allocatedArray = AllocZeroed(sizeof(s16) * ALLOC_ARRAY_SIZE);
trainerId = DOME_TRAINERS[trainerTourneyId].trainerId;
if (flags & CARD_ALTERNATE_SLOT)
arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = 9, palSlot = 2;
arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = WIN_TRAINER_NAME + NUM_INFO_CARD_WINDOWS, palSlot = 2;
if (flags & MOVE_CARD_RIGHT)
x = DISPLAY_WIDTH + 16;
if (flags & MOVE_CARD_DOWN)
@ -4371,19 +4398,19 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
else
textPrinter.currentChar = gSpeciesNames[gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].species];
textPrinter.windowId = 1 + i + windowId;
textPrinter.windowId = WIN_TRAINER_MON1_NAME + i + windowId;
if (i == 1)
textPrinter.currentX = 7;
else
textPrinter.currentX = 0;
PutWindowTilemap(1 + i + windowId);
CopyWindowToVram(1 + i + windowId, COPYWIN_FULL);
PutWindowTilemap(WIN_TRAINER_MON1_NAME + i + windowId);
CopyWindowToVram(WIN_TRAINER_MON1_NAME + i + windowId, COPYWIN_FULL);
AddTextPrinter(&textPrinter, 0, NULL);
}
PutWindowTilemap(windowId + 4);
CopyWindowToVram(windowId + 4, COPYWIN_FULL);
PutWindowTilemap(windowId + WIN_TRAINER_FLAVOR_TEXT);
CopyWindowToVram(windowId + WIN_TRAINER_FLAVOR_TEXT, COPYWIN_FULL);
// Print text about trainers potential in the tourney
if (trainerId == TRAINER_FRONTIER_BRAIN)
@ -4392,7 +4419,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
textPrinter.currentChar = sBattleDomePotentialTexts[trainerTourneyId];
textPrinter.fontId = FONT_NORMAL;
textPrinter.windowId = windowId + 4;
textPrinter.windowId = windowId + WIN_TRAINER_FLAVOR_TEXT;
textPrinter.currentX = 0;
textPrinter.y = 4;
textPrinter.currentY = 4;
@ -4713,7 +4740,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
u8 palSlot = 0;
if (flags & CARD_ALTERNATE_SLOT)
arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = 9, palSlot = 2;
arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = NUM_INFO_CARD_WINDOWS, palSlot = 2;
if (flags & MOVE_CARD_RIGHT)
x = DISPLAY_WIDTH + 16;
if (flags & MOVE_CARD_DOWN)
@ -4855,10 +4882,10 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
StringExpandPlaceholders(gStringVar4, sBattleDomeWinTexts[winStringId]);
textPrinter.currentChar = gStringVar4;
textPrinter.windowId = windowId + 8;
textPrinter.windowId = windowId + WIN_MATCH_WIN_TEXT;
textPrinter.fontId = FONT_NORMAL;
PutWindowTilemap(windowId + 8);
CopyWindowToVram(windowId + 8, COPYWIN_FULL);
PutWindowTilemap(windowId + WIN_MATCH_WIN_TEXT);
CopyWindowToVram(windowId + WIN_MATCH_WIN_TEXT, COPYWIN_FULL);
textPrinter.currentX = 0;
textPrinter.currentY = textPrinter.y = 0;
AddTextPrinter(&textPrinter, 0, NULL);
@ -4874,11 +4901,11 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
textPrinter.fontId = FONT_SHORT;
textPrinter.letterSpacing = 2;
textPrinter.currentChar = gStringVar1;
textPrinter.windowId = windowId + 6;
textPrinter.windowId = windowId + WIN_MATCH_TRAINER_NAME_LEFT;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 6);
CopyWindowToVram(windowId + 6, COPYWIN_FULL);
PutWindowTilemap(windowId + WIN_MATCH_TRAINER_NAME_LEFT);
CopyWindowToVram(windowId + WIN_MATCH_TRAINER_NAME_LEFT, COPYWIN_FULL);
AddTextPrinter(&textPrinter, 0, NULL);
// Print right trainer's name.
@ -4890,21 +4917,21 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
CopyDomeTrainerName(gStringVar1, trainerIds[1]);
textPrinter.currentChar = gStringVar1;
textPrinter.windowId = windowId + 7;
textPrinter.windowId = windowId + WIN_MATCH_TRAINER_NAME_RIGHT;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 7);
CopyWindowToVram(windowId + 7, COPYWIN_FULL);
PutWindowTilemap(windowId + WIN_MATCH_TRAINER_NAME_RIGHT);
CopyWindowToVram(windowId + WIN_MATCH_TRAINER_NAME_RIGHT, COPYWIN_FULL);
AddTextPrinter(&textPrinter, 0, NULL);
// Print match number.
textPrinter.letterSpacing = 0;
textPrinter.currentChar = sBattleDomeMatchNumberTexts[matchNo];
textPrinter.windowId = windowId + 5;
textPrinter.windowId = windowId + WIN_MATCH_NUMBER;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0xA0, textPrinter.letterSpacing);
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 5);
CopyWindowToVram(windowId + 5, COPYWIN_FULL);
PutWindowTilemap(windowId + WIN_MATCH_NUMBER);
CopyWindowToVram(windowId + WIN_MATCH_NUMBER, COPYWIN_FULL);
AddTextPrinter(&textPrinter, 0, NULL);
}
@ -5338,7 +5365,7 @@ static void Task_ShowTourneyTree(u8 taskId)
case 4:
textPrinter.fontId = FONT_SHORT;
textPrinter.currentChar = gText_BattleTourney;
textPrinter.windowId = 2;
textPrinter.windowId = TOURNEYWIN_TITLE;
textPrinter.x = 0;
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
@ -5424,7 +5451,7 @@ static void Task_ShowTourneyTree(u8 taskId)
}
}
if (sTrainerNamePositions[i][0] == 0)
if (sTrainerNamePositions[i][0] == TOURNEYWIN_NAMES_LEFT)
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
else
textPrinter.currentX = 3;
@ -5436,12 +5463,12 @@ static void Task_ShowTourneyTree(u8 taskId)
gTasks[taskId].tState++;
break;
case 5:
PutWindowTilemap(0);
PutWindowTilemap(1);
PutWindowTilemap(2);
CopyWindowToVram(0, COPYWIN_FULL);
CopyWindowToVram(1, COPYWIN_FULL);
CopyWindowToVram(2, COPYWIN_FULL);
PutWindowTilemap(TOURNEYWIN_NAMES_LEFT);
PutWindowTilemap(TOURNEYWIN_NAMES_RIGHT);
PutWindowTilemap(TOURNEYWIN_TITLE);
CopyWindowToVram(TOURNEYWIN_NAMES_LEFT, COPYWIN_FULL);
CopyWindowToVram(TOURNEYWIN_NAMES_RIGHT, COPYWIN_FULL);
CopyWindowToVram(TOURNEYWIN_TITLE, COPYWIN_FULL);
SetHBlankCallback(HblankCb_TourneyTree);
SetVBlankCallback(VblankCb_TourneyTree);
if (r4 == 2)
@ -5538,7 +5565,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId)
if (DOME_TRAINERS[i].eliminatedAt == gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1
&& DOME_TRAINERS[i].isEliminated)
{
if (sTrainerNamePositions[i][0] == 0)
if (sTrainerNamePositions[i][0] == TOURNEYWIN_NAMES_LEFT)
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
else
textPrinter.currentX = 3;

View File

@ -557,6 +557,9 @@ static void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battlerId, bool32 op
if (illusionMon != NULL)
mon = illusionMon;
if (GetMonData(mon, MON_DATA_IS_EGG)) // Don't load GFX of egg pokemon.
return;
monsPersonality = GetMonData(mon, MON_DATA_PERSONALITY);
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
{

View File

@ -3655,7 +3655,7 @@ static void TryDoEventsBeforeFirstTurn(void)
{
for (i = 0; i < gBattlersCount; i++)
{
if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE)
if (gBattleMons[i].hp == 0 || gBattleMons[i].species == SPECIES_NONE || GetMonData(GetBattlerPartyData(i), MON_DATA_IS_EGG))
gAbsentBattlerFlags |= gBitTable[i];
}
}

View File

@ -2083,288 +2083,236 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_DYNAMIC_COLOR_6,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.bgColor = 15,
.shadowColor = 6,
},
[B_WIN_ACTION_PROMPT] = {
.fillValue = PIXEL_FILL(0xF),
.fontId = FONT_NORMAL,
.x = 1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_DYNAMIC_COLOR_6,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.bgColor = 15,
.shadowColor = 6,
},
[B_WIN_ACTION_MENU] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_1] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_2] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_3] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_4] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_PP] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_2,
.fgColor = 12,
.bgColor = 14,
.shadowColor = 11,
},
[B_WIN_DUMMY] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_PP_REMAINING] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 2,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_2,
.fgColor = 12,
.bgColor = 14,
.shadowColor = 11,
},
[B_WIN_MOVE_TYPE] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_SWITCH_PROMPT] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_YESNO] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_LEVEL_UP_BOX] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_LEVEL_UP_BANNER] = {
.fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL,
.x = 32,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_DARK_GRAY,
.fgColor = 1,
.shadowColor = 2,
},
[B_WIN_VS_PLAYER] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_OPPONENT] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_MULTI_PLAYER_1] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_MULTI_PLAYER_2] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_MULTI_PLAYER_3] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_MULTI_PLAYER_4] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_VS_OUTCOME_DRAW] = {
.fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.shadowColor = 6,
},
[B_WIN_VS_OUTCOME_LEFT] = {
.fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.shadowColor = 6,
},
[B_WIN_VS_OUTCOME_RIGHT] = {
.fillValue = PIXEL_FILL(0x0),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.shadowColor = 6,
},
};
@ -2375,276 +2323,229 @@ static const struct BattleWindowText sTextOnWindowsInfo_Arena[] =
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_DYNAMIC_COLOR_6,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.bgColor = 15,
.shadowColor = 6,
},
[B_WIN_ACTION_PROMPT] = {
.fillValue = PIXEL_FILL(0xF),
.fontId = FONT_NORMAL,
.x = 1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_DYNAMIC_COLOR_6,
.shadowColor = TEXT_COLOR_GREEN,
.fgColor = 1,
.bgColor = 15,
.shadowColor = 6,
},
[B_WIN_ACTION_MENU] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_1] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_2] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_3] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_MOVE_NAME_4] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_PP] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_2,
.fgColor = 12,
.bgColor = 14,
.shadowColor = 11,
},
[B_WIN_DUMMY] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_PP_REMAINING] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 2,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_3,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_2,
.fgColor = 12,
.bgColor = 14,
.shadowColor = 11,
},
[B_WIN_MOVE_TYPE] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_SWITCH_PROMPT] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NARROW,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_YESNO] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_LEVEL_UP_BOX] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[B_WIN_LEVEL_UP_BANNER] = {
.fillValue = PIXEL_FILL(0),
.fontId = FONT_NORMAL,
.x = 32,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_COLOR_TRANSPARENT,
.shadowColor = TEXT_COLOR_DARK_GRAY,
.fgColor = 1,
.shadowColor = 2,
},
[ARENA_WIN_PLAYER_NAME] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_COLOR_WHITE,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 1,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_VS] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_OPPONENT_NAME] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_MIND] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_SKILL] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_BODY] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_JUDGMENT_TITLE] = {
.fillValue = PIXEL_FILL(0xE),
.fontId = FONT_NORMAL,
.x = -1,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 0,
.fgColor = TEXT_DYNAMIC_COLOR_4,
.bgColor = TEXT_DYNAMIC_COLOR_5,
.shadowColor = TEXT_DYNAMIC_COLOR_6,
.fgColor = 13,
.bgColor = 14,
.shadowColor = 15,
},
[ARENA_WIN_JUDGMENT_TEXT] = {
.fillValue = PIXEL_FILL(0x1),
.fontId = FONT_NORMAL,
.x = 0,
.y = 1,
.letterSpacing = 0,
.lineSpacing = 0,
.speed = 1,
.fgColor = TEXT_COLOR_DARK_GRAY,
.bgColor = TEXT_COLOR_WHITE,
.shadowColor = TEXT_COLOR_LIGHT_GRAY,
.fgColor = 2,
.bgColor = 1,
.shadowColor = 3,
},
};
@ -3913,8 +3814,13 @@ void SetPpNumbersPaletteInMoveSelection(void)
{
struct ChooseMoveStruct *chooseMoveStruct = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]);
const u16 *palPtr = gPPTextPalette;
u8 var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]],
u8 var;
if (!gBattleStruct->zmove.viewing)
var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]],
chooseMoveStruct->maxPp[gMoveSelectionCursor[gActiveBattler]]);
else
var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]], gBattleMoves[gMoveSelectionCursor[gActiveBattler]].pp);
gPlttBufferUnfaded[92] = palPtr[(var * 2) + 0];
gPlttBufferUnfaded[91] = palPtr[(var * 2) + 1];

View File

@ -284,7 +284,7 @@ static const u8 sFloorTemplateOffsets[FRONTIER_STAGES_PER_CHALLENGE] =
0, 4, 9, 14, 19, 24, 29
};
static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
static const u16 sPickupItemsLvl50[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
@ -308,7 +308,7 @@ static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{ITEM_HYPER_POTION, ITEM_X_DEFENSE, ITEM_LUM_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_QUICK_CLAW, ITEM_KINGS_ROCK, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
};
static const u16 sPickupItemsLvlOpen[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
static const u16 sPickupItemsLvlOpen[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
{
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
@ -977,10 +977,10 @@ static void SetPickupItem(void)
u8 id;
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS;
u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
if (round >= TOTAL_ROUNDS)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
id = GetPyramidFloorTemplateId();
itemIndex = (gSpecialVar_LastTalked - sPyramidFloorTemplates[id].numTrainers) - 1;
@ -1345,10 +1345,10 @@ void GenerateBattlePyramidWildMon(void)
const struct PyramidWildMon *wildMons;
u32 id;
u32 lvl = gSaveBlock2Ptr->frontier.lvlMode;
u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS;
u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
if (round >= TOTAL_ROUNDS)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
if (lvl != FRONTIER_LVL_50)
wildMons = sOpenLevelWildMonPointers[round];
@ -1961,8 +1961,8 @@ u16 GetBattlePyramidPickupItemId(void)
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE);
if (round >= TOTAL_ROUNDS)
round = TOTAL_ROUNDS - 1;
if (round >= TOTAL_PYRAMID_ROUNDS)
round = TOTAL_PYRAMID_ROUNDS - 1;
rand = Random() % 100;

File diff suppressed because it is too large Load Diff

View File

@ -259,7 +259,7 @@ bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move)
void HandleAction_UseMove(void)
{
u32 i, side, moveType, var = 4;
u16 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
u16 moveTarget;
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
if (gBattleStruct->absentBattlerFlags & gBitTable[gBattlerAttacker] || !IsBattlerAlive(gBattlerAttacker))
@ -324,6 +324,8 @@ void HandleAction_UseMove(void)
gCurrentMove = gBattleStruct->zmove.toBeUsed[gBattlerAttacker];
}
moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
if (gBattleMons[gBattlerAttacker].hp != 0)
{
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
@ -346,7 +348,7 @@ void HandleAction_UseMove(void)
}
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& gSideTimers[side].followmeTimer == 0
&& (gBattleMoves[gCurrentMove].power != 0 || moveTarget != MOVE_TARGET_USER)
&& (gBattleMoves[gCurrentMove].power != 0 || (moveTarget != MOVE_TARGET_USER && moveTarget != MOVE_TARGET_ALL_BATTLERS))
&& ((GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_LIGHTNING_ROD && moveType == TYPE_ELECTRIC)
|| (GetBattlerAbility(*(gBattleStruct->moveTarget + gBattlerAttacker)) != ABILITY_STORM_DRAIN && moveType == TYPE_WATER)))
{
@ -907,9 +909,8 @@ void HandleAction_NothingIsFainted(void)
void HandleAction_ActionFinished(void)
{
#if B_RECALC_TURN_AFTER_ACTIONS >= GEN_8
u8 i, j;
u8 battler1 = 0;
u8 battler2 = 0;
u32 i, j;
bool32 afterYouActive = gSpecialStatuses[gBattlerByTurnOrder[gCurrentTurnActionNumber + 1]].afterYou;
#endif
*(gBattleStruct->monToSwitchIntoId + gBattlerByTurnOrder[gCurrentTurnActionNumber]) = PARTY_SIZE;
gCurrentTurnActionNumber++;
@ -936,25 +937,32 @@ void HandleAction_ActionFinished(void)
gBattleResources->battleScriptsStack->size = 0;
#if B_RECALC_TURN_AFTER_ACTIONS >= GEN_8
// i starts at `gCurrentTurnActionNumber` because we don't want to recalculate turn order for mon that have already
// taken action. It's been previously increased, which we want in order to not recalculate the turn of the mon that just finished its action
for (i = gCurrentTurnActionNumber; i < gBattlersCount - 1; i++)
if (!afterYouActive)
{
for (j = i + 1; j < gBattlersCount; j++)
// i starts at `gCurrentTurnActionNumber` because we don't want to recalculate turn order for mon that have already
// taken action. It's been previously increased, which we want in order to not recalculate the turn of the mon that just finished its action
for (i = gCurrentTurnActionNumber; i < gBattlersCount - 1; i++)
{
u8 battler1 = gBattlerByTurnOrder[i];
u8 battler2 = gBattlerByTurnOrder[j];
// We recalculate order only for action of the same priority. If any action other than switch/move has been taken, they should
// have been executed before. The only recalculation needed is for moves/switch. Mega evolution is handled in src/battle_main.c/TryChangeOrder
if((gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE))
for (j = i + 1; j < gBattlersCount; j++)
{
if (GetWhoStrikesFirst(battler1, battler2, FALSE))
SwapTurnOrder(i, j);
}
else if ((gActionsByTurnOrder[i] == B_ACTION_SWITCH && gActionsByTurnOrder[j] == B_ACTION_SWITCH))
{
if (GetWhoStrikesFirst(battler1, battler2, TRUE)) // If the actions chosen are switching, we recalc order but ignoring the moves
SwapTurnOrder(i, j);
u8 battler1 = gBattlerByTurnOrder[i];
u8 battler2 = gBattlerByTurnOrder[j];
if (gProtectStructs[battler1].quash || gProtectStructs[battler2].quash)
continue;
// We recalculate order only for action of the same priority. If any action other than switch/move has been taken, they should
// have been executed before. The only recalculation needed is for moves/switch. Mega evolution is handled in src/battle_main.c/TryChangeOrder
if((gActionsByTurnOrder[i] == B_ACTION_USE_MOVE && gActionsByTurnOrder[j] == B_ACTION_USE_MOVE))
{
if (GetWhoStrikesFirst(battler1, battler2, FALSE))
SwapTurnOrder(i, j);
}
else if ((gActionsByTurnOrder[i] == B_ACTION_SWITCH && gActionsByTurnOrder[j] == B_ACTION_SWITCH))
{
if (GetWhoStrikesFirst(battler1, battler2, TRUE)) // If the actions chosen are switching, we recalc order but ignoring the moves
SwapTurnOrder(i, j);
}
}
}
}
@ -1279,6 +1287,9 @@ u8 GetBattlerForBattleScript(u8 caseId)
case BS_ATTACKER:
ret = gBattlerAttacker;
break;
case BS_ATTACKER_PARTNER:
ret = BATTLE_PARTNER(gBattlerAttacker);
break;
case BS_EFFECT_BATTLER:
ret = gEffectBattler;
break;
@ -2141,7 +2152,9 @@ u8 DoFieldEndTurnEffects(void)
s32 j;
for (j = i + 1; j < gBattlersCount; j++)
{
if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE))
if (!gProtectStructs[i].quash
&& !gProtectStructs[j].quash
&& GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE))
SwapTurnOrder(i, j);
}
}
@ -3397,35 +3410,6 @@ void TryClearRageAndFuryCutter(void)
}
}
enum
{
CANCELLER_FLAGS,
CANCELLER_SKY_DROP,
CANCELLER_ASLEEP,
CANCELLER_FROZEN,
CANCELLER_TRUANT,
CANCELLER_RECHARGE,
CANCELLER_FLINCH,
CANCELLER_DISABLED,
CANCELLER_GRAVITY,
CANCELLER_HEAL_BLOCKED,
CANCELLER_TAUNTED,
CANCELLER_IMPRISONED,
CANCELLER_CONFUSED,
CANCELLER_PARALYSED,
CANCELLER_IN_LOVE,
CANCELLER_BIDE,
CANCELLER_THAW,
CANCELLER_POWDER_MOVE,
CANCELLER_POWDER_STATUS,
CANCELLER_THROAT_CHOP,
CANCELLER_MULTIHIT_MOVES,
CANCELLER_Z_MOVES,
CANCELLER_END,
CANCELLER_PSYCHIC_TERRAIN,
CANCELLER_END2,
};
u8 AtkCanceller_UnableToUseMove(void)
{
u8 effect = 0;
@ -3740,7 +3724,10 @@ u8 AtkCanceller_UnableToUseMove(void)
if (effect != 0)
gBattlescriptCurrInstr = BattleScript_PowderMoveNoEffect;
}
gBattleStruct->atkCancellerTracker++;
if (gProtectStructs[gBattlerAttacker].usesBouncedMove) // Edge case for bouncing a powder move against a grass type pokemon.
gBattleStruct->atkCancellerTracker = CANCELLER_END;
else
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_POWDER_STATUS:
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_POWDER)
@ -8689,8 +8676,14 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower *= 2;
break;
case EFFECT_ROUND:
if (gChosenMoveByBattler[BATTLE_PARTNER(battlerAtk)] == MOVE_ROUND && !(gAbsentBattlerFlags & gBitTable[BATTLE_PARTNER(battlerAtk)]))
basePower *= 2;
for (i = 0; i < gBattlersCount; i++)
{
if (i != battlerAtk && IsBattlerAlive(i) && gLastMoves[i] == MOVE_ROUND)
{
basePower *= 2;
break;
}
}
break;
case EFFECT_FUSION_COMBO:
if (gBattleMoves[gLastUsedMove].effect == EFFECT_FUSION_COMBO && move != gLastUsedMove)

View File

@ -50,7 +50,7 @@ static u16 GetSignatureZMove(u16 move, u16 species, u16 item);
static u16 GetTypeBasedZMove(u16 move, u8 battler);
static void ZMoveSelectionDisplayPpNumber(void);
static void ZMoveSelectionDisplayPower(u16 move, u16 zMove);
static void ShowZMoveTriggerSprite(void);
static void ShowZMoveTriggerSprite(u8 battleId);
static bool32 AreStatsMaxed(u8 battlerId, u8 n);
static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove);
static void ZMoveSelectionDisplayMoveType(u16 zMove);
@ -258,7 +258,7 @@ bool32 TryChangeZIndicator(u8 battlerId, u8 moveIndex)
if (gBattleStruct->zmove.viable && !viableZMove)
HideZMoveTriggerSprite(); // Was a viable z move, now is not -> slide out
else if (!gBattleStruct->zmove.viable && viableZMove)
ShowZMoveTriggerSprite(); // Was not a viable z move, now is -> slide back in
ShowZMoveTriggerSprite(battlerId); // Was not a viable z move, now is -> slide back in
}
#define SINGLES_Z_TRIGGER_POS_X_OPTIMAL (29)
@ -368,11 +368,11 @@ void HideZMoveTriggerSprite(void)
gBattleStruct->zmove.viable = FALSE;
}
static void ShowZMoveTriggerSprite(void)
static void ShowZMoveTriggerSprite(u8 battlerId)
{
struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
gBattleStruct->zmove.viable = TRUE;
CreateZMoveTriggerSprite(sprite->tBattler, TRUE);
CreateZMoveTriggerSprite(battlerId, TRUE);
}
void DestroyZMoveTriggerSprite(void)

View File

@ -106,6 +106,13 @@ enum {
// Last berry that an NPC can put in
#define NUM_NPC_BERRIES ITEM_TO_BERRY(ITEM_ASPEAR_BERRY)
enum {
// Windows 0-3 are used implicitly in several loops over BLENDER_MAX_PLAYERS
// i.e. window 0 is for player 1, window 1 for player 2, etc.
WIN_MSG = BLENDER_MAX_PLAYERS,
WIN_RESULTS,
};
struct BlenderBerry
{
u16 itemId;
@ -200,7 +207,7 @@ static void SpriteCB_ScoreSymbolBest(struct Sprite *);
static void InitLocalPlayers(u8);
static void CB2_LoadBerryBlender(void);
static void UpdateBlenderCenter(void);
static bool32 Blender_PrintText(s16 *, const u8 *, s32 );
static bool32 PrintMessage(s16 *, const u8 *, s32 );
static void StartBlender(void);
static void CB2_StartBlenderLink(void);
static void CB2_StartBlenderLocal(void);
@ -332,7 +339,7 @@ static const struct BgTemplate sBgTemplates[3] =
static const struct WindowTemplate sWindowTemplates[] =
{
{
{ // Player 1
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 6,
@ -341,7 +348,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 0x28,
},
{
{ // Player 2
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 6,
@ -350,7 +357,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 0x36,
},
{
{ // Player 3
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 12,
@ -359,7 +366,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 0x44,
},
{
{ // Player 4
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 12,
@ -368,7 +375,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 0x52,
},
{
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -377,7 +384,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 0x60,
},
{
[WIN_RESULTS] = {
.bg = 0,
.tilemapLeft = 5,
.tilemapTop = 3,
@ -1107,7 +1114,7 @@ static void CB2_LoadBerryBlender(void)
sBerryBlender->mainState++;
break;
case 4:
if (Blender_PrintText(&sBerryBlender->textState, sText_BerryBlenderStart, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, sText_BerryBlenderStart, GetPlayerTextSpeedDelay()))
sBerryBlender->mainState++;
break;
case 5:
@ -1337,7 +1344,7 @@ static void CB2_StartBlenderLink(void)
}
break;
case 5:
Blender_PrintText(&sBerryBlender->textState, sText_CommunicationStandby, 0);
PrintMessage(&sBerryBlender->textState, sText_CommunicationStandby, 0);
sBerryBlender->mainState = 8;
sBerryBlender->framesToWait = 0;
break;
@ -1363,7 +1370,7 @@ static void CB2_StartBlenderLink(void)
if (++sBerryBlender->framesToWait > 20)
{
// Wait for partners' berries
ClearDialogWindowAndFrameToTransparent(4, TRUE);
ClearDialogWindowAndFrameToTransparent(WIN_MSG, TRUE);
if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{
for (i = 0; i < GetLinkPlayerCount(); i++)
@ -2276,9 +2283,9 @@ static u32 CalculatePokeblockColor(struct BlenderBerry* berries, s16 *_flavors,
j++;
}
// If all flavors are 0, or at least 3 were negative/0
// If all 5 flavors are 0, or if 4-5 flavors were negative,
// or if players used the same berry, color is black
if (j == 5 || negativeFlavors > 3)
if (j == FLAVOR_COUNT || negativeFlavors > 3)
return PBLOCK_CLR_BLACK;
for (i = 0; i < numPlayers; i++)
@ -2664,7 +2671,7 @@ static void CB2_EndBlenderGame(void)
}
break;
case 7:
if (Blender_PrintText(&sBerryBlender->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeedDelay()))
sBerryBlender->gameEndState++;
break;
case 9:
@ -2748,7 +2755,7 @@ static void CB2_EndBlenderGame(void)
sBerryBlender->gameEndState++;
break;
case 13:
if (Blender_PrintText(&sBerryBlender->textState, sText_CommunicationStandby, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, sText_CommunicationStandby, GetPlayerTextSpeedDelay()))
{
SetMainCallback2(CB2_CheckPlayAgainLink);
sBerryBlender->gameEndState = 0;
@ -2858,7 +2865,7 @@ static void CB2_CheckPlayAgainLink(void)
StringAppend(gStringVar4, sText_HasNoBerriesToPut);
break;
case 3:
if (Blender_PrintText(&sBerryBlender->textState, gStringVar4, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, gStringVar4, GetPlayerTextSpeedDelay()))
{
sBerryBlender->framesToWait = 0;
sBerryBlender->gameEndState++;
@ -2869,7 +2876,7 @@ static void CB2_CheckPlayAgainLink(void)
sBerryBlender->gameEndState = 5;
break;
case 5:
Blender_PrintText(&sBerryBlender->textState, gText_SavingDontTurnOff2, 0);
PrintMessage(&sBerryBlender->textState, gText_SavingDontTurnOff2, 0);
SetLinkStandbyCallback();
sBerryBlender->gameEndState++;
break;
@ -2965,7 +2972,7 @@ static void CB2_CheckPlayAgainLocal(void)
StringCopy(gStringVar4, sText_RunOutOfBerriesForBlending);
break;
case 3:
if (Blender_PrintText(&sBerryBlender->textState, gStringVar4, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, gStringVar4, GetPlayerTextSpeedDelay()))
sBerryBlender->gameEndState = 9;
break;
case 9:
@ -3495,7 +3502,7 @@ static bool8 PrintBlendingResults(void)
u8 *txtPtr;
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sText_BlendingResults, 0xA8);
Blender_AddTextPrinter(5, sText_BlendingResults, xPos, 1, TEXT_SKIP_DRAW, 0);
Blender_AddTextPrinter(WIN_RESULTS, sText_BlendingResults, xPos, 1, TEXT_SKIP_DRAW, 0);
if (sBerryBlender->numPlayers == BLENDER_MAX_PLAYERS)
yPos = 17;
@ -3510,15 +3517,15 @@ static bool8 PrintBlendingResults(void)
StringAppend(sBerryBlender->stringVar, sText_Dot);
StringAppend(sBerryBlender->stringVar, gText_Space);
StringAppend(sBerryBlender->stringVar, gLinkPlayers[place].name);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 8, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 8, yPos, TEXT_SKIP_DRAW, 3);
StringCopy(sBerryBlender->stringVar, sBerryBlender->blendedBerries[place].name);
ConvertInternationalString(sBerryBlender->stringVar, gLinkPlayers[place].language);
StringAppend(sBerryBlender->stringVar, sText_SpaceBerry);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 0x54, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 0x54, yPos, TEXT_SKIP_DRAW, 3);
}
Blender_AddTextPrinter(5, sText_MaximumSpeed, 0, 0x51, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sText_MaximumSpeed, 0, 0x51, TEXT_SKIP_DRAW, 3);
ConvertIntToDecimalStringN(sBerryBlender->stringVar, sBerryBlender->maxRPM / 100, STR_CONV_MODE_RIGHT_ALIGN, 3);
StringAppend(sBerryBlender->stringVar, sText_Dot);
@ -3527,8 +3534,8 @@ static bool8 PrintBlendingResults(void)
StringAppend(sBerryBlender->stringVar, sText_RPM);
xPos = GetStringRightAlignXOffset(FONT_NORMAL, sBerryBlender->stringVar, 0xA8);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, xPos, 0x51, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(5, sText_Time, 0, 0x61, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, xPos, 0x51, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sText_Time, 0, 0x61, TEXT_SKIP_DRAW, 3);
seconds = (sBerryBlender->gameFrameTime / 60) % 60;
minutes = (sBerryBlender->gameFrameTime / (60 * 60));
@ -3540,12 +3547,12 @@ static bool8 PrintBlendingResults(void)
StringAppend(sBerryBlender->stringVar, sText_Sec);
xPos = GetStringRightAlignXOffset(FONT_NORMAL, sBerryBlender->stringVar, 0xA8);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, xPos, 0x61, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, xPos, 0x61, TEXT_SKIP_DRAW, 3);
sBerryBlender->framesToWait = 0;
sBerryBlender->mainState++;
CopyWindowToVram(5, COPYWIN_GFX);
CopyWindowToVram(WIN_RESULTS, COPYWIN_GFX);
}
break;
case 4:
@ -3553,7 +3560,7 @@ static bool8 PrintBlendingResults(void)
sBerryBlender->mainState++;
break;
case 5:
ClearStdWindowAndFrameToTransparent(5, TRUE);
ClearStdWindowAndFrameToTransparent(WIN_RESULTS, TRUE);
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
@ -3581,7 +3588,7 @@ static bool8 PrintBlendingResults(void)
sBerryBlender->mainState++;
break;
case 6:
if (Blender_PrintText(&sBerryBlender->textState, sBerryBlender->stringVar, GetPlayerTextSpeedDelay()))
if (PrintMessage(&sBerryBlender->textState, sBerryBlender->stringVar, GetPlayerTextSpeedDelay()))
{
TryUpdateBerryBlenderRecord();
return TRUE;
@ -3692,9 +3699,9 @@ static bool8 PrintBlendingRanking(void)
}
break;
case 3:
DrawStdFrameWithCustomTileAndPalette(5, FALSE, 1, 0xD);
DrawStdFrameWithCustomTileAndPalette(WIN_RESULTS, FALSE, 1, 0xD);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sText_Ranking, 168);
Blender_AddTextPrinter(5, sText_Ranking, xPos, 1, TEXT_SKIP_DRAW, 0);
Blender_AddTextPrinter(WIN_RESULTS, sText_Ranking, xPos, 1, TEXT_SKIP_DRAW, 0);
sBerryBlender->scoreIconIds[SCORE_BEST] = CreateSprite(&sSpriteTemplate_ScoreSymbols, 128, 52, 0);
StartSpriteAnim(&gSprites[sBerryBlender->scoreIconIds[SCORE_BEST]], SCOREANIM_BEST_STATIC);
@ -3718,20 +3725,20 @@ static bool8 PrintBlendingRanking(void)
StringAppend(sBerryBlender->stringVar, sText_Dot);
StringAppend(sBerryBlender->stringVar, gText_Space);
StringAppend(sBerryBlender->stringVar, gLinkPlayers[place].name);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 0, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 0, yPos, TEXT_SKIP_DRAW, 3);
ConvertIntToDecimalStringN(sBerryBlender->stringVar, sBerryBlender->scores[place][SCORE_BEST], STR_CONV_MODE_RIGHT_ALIGN, 3);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 78, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 78, yPos, TEXT_SKIP_DRAW, 3);
ConvertIntToDecimalStringN(sBerryBlender->stringVar, sBerryBlender->scores[place][SCORE_GOOD], STR_CONV_MODE_RIGHT_ALIGN, 3);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 78 + 32, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 78 + 32, yPos, TEXT_SKIP_DRAW, 3);
ConvertIntToDecimalStringN(sBerryBlender->stringVar, sBerryBlender->scores[place][SCORE_MISS], STR_CONV_MODE_RIGHT_ALIGN, 3);
Blender_AddTextPrinter(5, sBerryBlender->stringVar, 78 + 64, yPos, TEXT_SKIP_DRAW, 3);
Blender_AddTextPrinter(WIN_RESULTS, sBerryBlender->stringVar, 78 + 64, yPos, TEXT_SKIP_DRAW, 3);
}
PutWindowTilemap(5);
CopyWindowToVram(5, COPYWIN_FULL);
PutWindowTilemap(WIN_RESULTS);
CopyWindowToVram(WIN_RESULTS, COPYWIN_FULL);
sBerryBlender->framesToWait = 0;
sBerryBlender->mainState++;
@ -3875,26 +3882,24 @@ static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s3
}
if (caseId != 3)
{
FillWindowPixelBuffer(windowId, PIXEL_FILL(txtColor[0]));
}
AddTextPrinterParameterized4(windowId, FONT_NORMAL, x, y, letterSpacing, 1, txtColor, speed, string);
}
static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed)
static bool32 PrintMessage(s16 *textState, const u8 *string, s32 textSpeed)
{
switch (*textState)
{
case 0:
DrawDialogFrameWithCustomTileAndPalette(4, FALSE, 0x14, 0xF);
Blender_AddTextPrinter(4, string, 0, 1, textSpeed, 0);
PutWindowTilemap(4);
CopyWindowToVram(4, COPYWIN_FULL);
DrawDialogFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x14, 0xF);
Blender_AddTextPrinter(WIN_MSG, string, 0, 1, textSpeed, 0);
PutWindowTilemap(WIN_MSG);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
(*textState)++;
break;
case 1:
if (!IsTextPrinterActive(4))
if (!IsTextPrinterActive(WIN_MSG))
{
*textState = 0;
return TRUE;

View File

@ -14,6 +14,13 @@
#include "m4a.h"
#include "constants/rgb.h"
enum {
WIN_TITLE, // "Berry Program Update" header on the first screen
WIN_MSG_BODY,
WIN_GAME_NAMES, // The labels under the GBA graphics on the link screen
WIN_TURN_OFF_TITLE, // "Ruby/Sapphire" at the top of the "turn off the power" screen
};
struct {
u8 state;
u8 curScene;
@ -71,7 +78,7 @@ static const struct BgTemplate sBerryFixBgTemplates[] = {
};
static const struct WindowTemplate sBerryFixWindowTemplates[] = {
{
[WIN_TITLE] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 4,
@ -80,7 +87,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = {
.paletteNum = 15,
.baseBlock = 1
},
{
[WIN_MSG_BODY] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 11,
@ -89,7 +96,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = {
.paletteNum = 15,
.baseBlock = 53
},
{
[WIN_GAME_NAMES] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 8,
@ -98,7 +105,7 @@ static const struct WindowTemplate sBerryFixWindowTemplates[] = {
.paletteNum = 15,
.baseBlock = 277
},
{
[WIN_TURN_OFF_TITLE] = {
.bg = 0,
.tilemapLeft = 8,
.tilemapTop = 0,
@ -217,11 +224,11 @@ static void BerryFix_Main(void)
sBerryFix->state = MAINSTATE_BEGIN;
break;
case MAINSTATE_BEGIN:
if (TryScene(SCENE_BEGIN) && (JOY_NEW(A_BUTTON)))
if (TryScene(SCENE_BEGIN) && JOY_NEW(A_BUTTON))
sBerryFix->state = MAINSTATE_CONNECT;
break;
case MAINSTATE_CONNECT:
if (TryScene(SCENE_ENSURE_CONNECT) && (JOY_NEW(A_BUTTON)))
if (TryScene(SCENE_ENSURE_CONNECT) && JOY_NEW(A_BUTTON))
sBerryFix->state = MAINSTATE_INIT_MULTIBOOT;
break;
case MAINSTATE_INIT_MULTIBOOT:
@ -299,29 +306,29 @@ static void BerryFix_GpuSet(void)
DmaCopy32(3, sBerryFixPalColors, BG_PLTT + 0x1E0, sizeof(sBerryFixPalColors));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(3, PIXEL_FILL(0));
FillWindowPixelBuffer(0, PIXEL_FILL(10));
FillWindowPixelBuffer(WIN_GAME_NAMES, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TURN_OFF_TITLE, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(10));
width = GetStringWidth(FONT_SMALL, sText_Emerald, 0);
left = (120 - width) / 2;
AddTextPrinterParameterized3(2, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_Emerald);
AddTextPrinterParameterized3(WIN_GAME_NAMES, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_Emerald);
width = GetStringWidth(FONT_SMALL, sText_RubySapphire, 0);
left = (120 - width) / 2 + 120;
AddTextPrinterParameterized3(2, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_RubySapphire);
AddTextPrinterParameterized3(WIN_GAME_NAMES, FONT_SMALL, left, 3, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_RubySapphire);
width = GetStringWidth(FONT_SMALL, sText_RubySapphire, 0);
left = (112 - width) / 2;
AddTextPrinterParameterized3(3, FONT_SMALL, left, 0, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_RubySapphire);
AddTextPrinterParameterized3(WIN_TURN_OFF_TITLE, FONT_SMALL, left, 0, sGameTitleTextColors, TEXT_SKIP_DRAW, sText_RubySapphire);
width = GetStringWidth(FONT_NORMAL, sText_BerryProgramUpdate, 0);
left = (208 - width) / 2;
AddTextPrinterParameterized3(0, FONT_NORMAL, left, 2, sBerryProgramTextColors, TEXT_SKIP_DRAW, sText_BerryProgramUpdate);
AddTextPrinterParameterized3(WIN_TITLE, FONT_NORMAL, left, 2, sBerryProgramTextColors, TEXT_SKIP_DRAW, sText_BerryProgramUpdate);
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(3, COPYWIN_GFX);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(WIN_GAME_NAMES, COPYWIN_GFX);
CopyWindowToVram(WIN_TURN_OFF_TITLE, COPYWIN_GFX);
CopyWindowToVram(WIN_TITLE, COPYWIN_GFX);
}
static int BerryFix_TrySetScene(int scene)
@ -345,23 +352,23 @@ static int BerryFix_TrySetScene(int scene)
static void BerryFix_SetScene(int scene)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
FillWindowPixelBuffer(1, PIXEL_FILL(10));
AddTextPrinterParameterized3(1, FONT_NORMAL, 0, 0, sBerryProgramTextColors, TEXT_SKIP_DRAW, sBerryProgramTexts[scene]);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_GFX);
FillWindowPixelBuffer(WIN_MSG_BODY, PIXEL_FILL(10));
AddTextPrinterParameterized3(WIN_MSG_BODY, FONT_NORMAL, 0, 0, sBerryProgramTextColors, TEXT_SKIP_DRAW, sBerryProgramTexts[scene]);
PutWindowTilemap(WIN_MSG_BODY);
CopyWindowToVram(WIN_MSG_BODY, COPYWIN_GFX);
switch (scene)
{
case SCENE_ENSURE_CONNECT:
case SCENE_TRANSMITTING:
case SCENE_FOLLOW_INSTRUCT:
case SCENE_TRANSMIT_FAILED:
PutWindowTilemap(2);
PutWindowTilemap(WIN_GAME_NAMES);
break;
case SCENE_TURN_OFF_POWER:
PutWindowTilemap(3);
PutWindowTilemap(WIN_TURN_OFF_TITLE);
break;
case SCENE_BEGIN:
PutWindowTilemap(0);
PutWindowTilemap(WIN_TITLE);
break;
}
CopyBgTilemapBufferToVram(0);

View File

@ -102,7 +102,7 @@ static const u8 sTextColors[2][3] =
static const struct WindowTemplate sWindowTemplates[] =
{
{ // WIN_BERRY_NAME
[WIN_BERRY_NAME] = {
.bg = 1,
.tilemapLeft = 11,
.tilemapTop = 4,
@ -111,7 +111,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 69,
},
{ // WIN_SIZE_FIRM
[WIN_SIZE_FIRM] = {
.bg = 1,
.tilemapLeft = 11,
.tilemapTop = 7,
@ -120,7 +120,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 85,
},
{ // WIN_DESC
[WIN_DESC] = {
.bg = 1,
.tilemapLeft = 4,
.tilemapTop = 14,
@ -129,7 +129,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 157,
},
{ // WIN_BERRY_TAG
[WIN_BERRY_TAG] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 0,
@ -599,7 +599,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
switch (data[0])
{
case 0x30:
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0));
break;
case 0x40:
PrintBerryNumberAndName();
@ -609,7 +609,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
CreateBerrySprite();
break;
case 0x60:
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0));
break;
case 0x70:
PrintBerrySize();
@ -621,7 +621,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
SetFlavorCirclesVisiblity();
break;
case 0xA0:
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0));
break;
case 0xB0:
PrintBerryDescription1();
@ -636,7 +636,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
switch (data[0])
{
case 0x30:
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_DESC, PIXEL_FILL(0));
break;
case 0x40:
PrintBerryDescription2();
@ -648,7 +648,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
SetFlavorCirclesVisiblity();
break;
case 0x70:
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_SIZE_FIRM, PIXEL_FILL(0));
break;
case 0x80:
PrintBerryFirmness();
@ -661,7 +661,7 @@ static void Task_DisplayAnotherBerry(u8 taskId)
CreateBerrySprite();
break;
case 0xB0:
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_BERRY_NAME, PIXEL_FILL(0));
break;
case 0xC0:
PrintBerryNumberAndName();

View File

@ -5456,7 +5456,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
u8 speed;
printerTemplate.currentChar = currChar;
printerTemplate.windowId = 4;
printerTemplate.windowId = WIN_GENERAL_TEXT;
printerTemplate.fontId = FONT_NORMAL;
printerTemplate.x = 0;
printerTemplate.y = 1;
@ -5482,7 +5482,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
AddTextPrinter(&printerTemplate, speed, 0);
}
PutWindowTilemap(4);
PutWindowTilemap(WIN_GENERAL_TEXT);
Contest_SetBgCopyFlags(0);
}

View File

@ -319,9 +319,10 @@ static const struct BgTemplate sBgTemplates[] =
}
};
static const struct WindowTemplate sWindowTemplates[] =
// Window IDs are implicitly shared with contestant IDs in LoadContestMonName
static const struct WindowTemplate sWindowTemplates[CONTESTANT_COUNT + 1] =
{
{
{ // Contestant 1
.bg = 1,
.tilemapLeft = 7,
.tilemapTop = 4,
@ -330,7 +331,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 770
},
{
{ // Contestant 2
.bg = 1,
.tilemapLeft = 7,
.tilemapTop = 7,
@ -339,7 +340,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 794
},
{
{ // Contestant 3
.bg = 1,
.tilemapLeft = 7,
.tilemapTop = 10,
@ -348,7 +349,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 818
},
{
{ // Contestant 4
.bg = 1,
.tilemapLeft = 7,
.tilemapTop = 13,
@ -357,7 +358,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 842
},
DUMMY_WIN_TEMPLATE,
DUMMY_WIN_TEMPLATE
};
static const struct OamData sOamData_WirelessIndicatorWindow =

View File

@ -1937,7 +1937,7 @@ const struct BattleAnimBackground gBattleAnimBackgroundTable[] =
[BG_MAGMA_STORM] = {gBattleAnimBgImage_InAir, gBattleAnimBgPalette_MagmaStorm, gBattleAnimBgTilemap_InAir},
[BG_GIGA_IMPACT_OPPONENT] = {gBattleAnimBgImage_GigaImpact, gBattleAnimBgPalette_GigaImpact, gBattleAnimBgTilemap_GigaImpactOpponent},
[BG_GIGA_IMPACT_PLAYER] = {gBattleAnimBgImage_GigaImpact, gBattleAnimBgPalette_GigaImpact, gBattleAnimBgTilemap_GigaImpactPlayer},
[BG_GIGA_IMPACT_CONTEST] = {gBattleAnimBgImage_GigaImpact, gBattleAnimBgPalette_GigaImpact, gBattleAnimBgTilemap_GigaImpactContest},
[BG_GIGA_IMPACT_CONTEST] = {gBattleAnimBgImage_GigaImpactContest, gBattleAnimBgPalette_GigaImpact, gBattleAnimBgTilemap_GigaImpactContest},
[BG_TRICK_ROOM] = {gBattleAnimBgImage_TrickRoom, gBattleAnimBgPalette_TrickRoom, gBattleAnimBgTilemap_TrickRoom},
[BG_ROCK_WRECKER] = {gBattleAnimBgImage_Hurricane, gBattleAnimBgPalette_RockWrecker, gBattleAnimBgTilemap_Hurricane},
[BG_SPACIAL_REND_ON_OPPONENT] = {gBattleAnimBgImage_SpacialRend, gBattleAnimBgPalette_SpacialRend, gBattleAnimBgTilemap_GigaImpactOpponent},

View File

@ -1038,7 +1038,7 @@ static const struct PyramidWildMon sOpenLevelWildMons_Round20[] =
}
};
static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_ROUNDS] =
static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_PYRAMID_ROUNDS] =
{
sOpenLevelWildMons_Round1,
sOpenLevelWildMons_Round2,

View File

@ -6073,10 +6073,11 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
{
#if B_UPDATED_MOVE_DATA >= GEN_8
.flags = FLAG_SNATCH_AFFECTED | FLAG_SOUND,
.effect = EFFECT_ATTACK_UP_USER_ALLY,
#else
.flags = FLAG_SNATCH_AFFECTED,
.effect = EFFECT_ATTACK_UP,
#endif
.effect = EFFECT_ATTACK_UP,
.power = 0,
.type = TYPE_NORMAL,
.accuracy = 0,
@ -8914,7 +8915,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.type = TYPE_NORMAL,
.accuracy = 100,
.pp = 15,
.secondaryEffectChance = 0,
.secondaryEffectChance = 100,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND,
@ -11554,7 +11555,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.accuracy = 100,
.pp = 5,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_SELECTED,
.target = MOVE_TARGET_BOTH,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SOUND,
.split = SPLIT_SPECIAL,

View File

@ -2,102 +2,104 @@
#include "global.h"
#include "contest.h"
#define CONTEST_OPPONENT_JIMMY 0
#define CONTEST_OPPONENT_EDITH 1
#define CONTEST_OPPONENT_EVAN 2
#define CONTEST_OPPONENT_KELSEY 3
#define CONTEST_OPPONENT_MADISON 4
#define CONTEST_OPPONENT_RAYMOND 5
#define CONTEST_OPPONENT_GRANT 6
#define CONTEST_OPPONENT_PAIGE 7
#define CONTEST_OPPONENT_ALEC 8
#define CONTEST_OPPONENT_SYDNEY 9
#define CONTEST_OPPONENT_MORRIS 10
#define CONTEST_OPPONENT_MARIAH 11
#define CONTEST_OPPONENT_RUSSELL 12
#define CONTEST_OPPONENT_MELANIE 13
#define CONTEST_OPPONENT_CHANCE 14
#define CONTEST_OPPONENT_AGATHA 15
#define CONTEST_OPPONENT_BEAU 16
#define CONTEST_OPPONENT_KAY 17
#define CONTEST_OPPONENT_CALE 18
#define CONTEST_OPPONENT_CAITLIN 19
#define CONTEST_OPPONENT_COLBY 20
#define CONTEST_OPPONENT_KYLIE 21
#define CONTEST_OPPONENT_LIAM 22
#define CONTEST_OPPONENT_MILO 23
#define CONTEST_OPPONENT_KARINA 24
#define CONTEST_OPPONENT_BOBBY 25
#define CONTEST_OPPONENT_CLAIRE 26
#define CONTEST_OPPONENT_WILLIE 27
#define CONTEST_OPPONENT_CASSIDY 28
#define CONTEST_OPPONENT_MORGAN 29
#define CONTEST_OPPONENT_SUMMER 30
#define CONTEST_OPPONENT_MILES 31
#define CONTEST_OPPONENT_AUDREY 32
#define CONTEST_OPPONENT_AVERY 33
#define CONTEST_OPPONENT_ARIANA 34
#define CONTEST_OPPONENT_ASHTON 35
#define CONTEST_OPPONENT_SANDRA 36
#define CONTEST_OPPONENT_CARSON 37
#define CONTEST_OPPONENT_KATRINA 38
#define CONTEST_OPPONENT_LUKE 39
#define CONTEST_OPPONENT_RAUL 40
#define CONTEST_OPPONENT_JADA 41
#define CONTEST_OPPONENT_ZEEK 42
#define CONTEST_OPPONENT_DIEGO 43
#define CONTEST_OPPONENT_ALIYAH 44
#define CONTEST_OPPONENT_NATALIA 45
#define CONTEST_OPPONENT_DEVIN 46
#define CONTEST_OPPONENT_TYLOR 47
#define CONTEST_OPPONENT_RONNIE 48
#define CONTEST_OPPONENT_CLAUDIA 49
#define CONTEST_OPPONENT_ELIAS 50
#define CONTEST_OPPONENT_JADE 51
#define CONTEST_OPPONENT_FRANCIS 52
#define CONTEST_OPPONENT_ALISHA 53
#define CONTEST_OPPONENT_SAUL 54
#define CONTEST_OPPONENT_FELICIA 55
#define CONTEST_OPPONENT_EMILIO 56
#define CONTEST_OPPONENT_KARLA 57
#define CONTEST_OPPONENT_DARRYL 58
#define CONTEST_OPPONENT_SELENA 59
#define CONTEST_OPPONENT_NOEL 60
#define CONTEST_OPPONENT_LACEY 61
#define CONTEST_OPPONENT_CORBIN 62
#define CONTEST_OPPONENT_GRACIE 63
#define CONTEST_OPPONENT_COLTIN 64
#define CONTEST_OPPONENT_ELLIE 65
#define CONTEST_OPPONENT_MARCUS 66
#define CONTEST_OPPONENT_KIARA 67
#define CONTEST_OPPONENT_BRYCE 68
#define CONTEST_OPPONENT_JAMIE 69
#define CONTEST_OPPONENT_JORGE 70
#define CONTEST_OPPONENT_DEVON 71
#define CONTEST_OPPONENT_JUSTINA 72
#define CONTEST_OPPONENT_RALPH 73
#define CONTEST_OPPONENT_ROSA 74
#define CONTEST_OPPONENT_KEATON 75
#define CONTEST_OPPONENT_MAYRA 76
#define CONTEST_OPPONENT_LAMAR 77
#define CONTEST_OPPONENT_AUBREY 78
#define CONTEST_OPPONENT_NIGEL 79
#define CONTEST_OPPONENT_CAMILLE 80
#define CONTEST_OPPONENT_DEON 81
#define CONTEST_OPPONENT_JANELLE 82
#define CONTEST_OPPONENT_HEATH 83
#define CONTEST_OPPONENT_SASHA 84
#define CONTEST_OPPONENT_FRANKIE 85
#define CONTEST_OPPONENT_HELEN 86
#define CONTEST_OPPONENT_CAMILE 87
#define CONTEST_OPPONENT_MARTIN 88
#define CONTEST_OPPONENT_SERGIO 89
#define CONTEST_OPPONENT_KAILEY 90
#define CONTEST_OPPONENT_PERLA 91
#define CONTEST_OPPONENT_CLARA 92
#define CONTEST_OPPONENT_JAKOB 93
#define CONTEST_OPPONENT_TREY 94
#define CONTEST_OPPONENT_LANE 95
enum {
CONTEST_OPPONENT_JIMMY,
CONTEST_OPPONENT_EDITH,
CONTEST_OPPONENT_EVAN,
CONTEST_OPPONENT_KELSEY,
CONTEST_OPPONENT_MADISON,
CONTEST_OPPONENT_RAYMOND,
CONTEST_OPPONENT_GRANT,
CONTEST_OPPONENT_PAIGE,
CONTEST_OPPONENT_ALEC,
CONTEST_OPPONENT_SYDNEY,
CONTEST_OPPONENT_MORRIS,
CONTEST_OPPONENT_MARIAH,
CONTEST_OPPONENT_RUSSELL,
CONTEST_OPPONENT_MELANIE,
CONTEST_OPPONENT_CHANCE,
CONTEST_OPPONENT_AGATHA,
CONTEST_OPPONENT_BEAU,
CONTEST_OPPONENT_KAY,
CONTEST_OPPONENT_CALE,
CONTEST_OPPONENT_CAITLIN,
CONTEST_OPPONENT_COLBY,
CONTEST_OPPONENT_KYLIE,
CONTEST_OPPONENT_LIAM,
CONTEST_OPPONENT_MILO,
CONTEST_OPPONENT_KARINA,
CONTEST_OPPONENT_BOBBY,
CONTEST_OPPONENT_CLAIRE,
CONTEST_OPPONENT_WILLIE,
CONTEST_OPPONENT_CASSIDY,
CONTEST_OPPONENT_MORGAN,
CONTEST_OPPONENT_SUMMER,
CONTEST_OPPONENT_MILES,
CONTEST_OPPONENT_AUDREY,
CONTEST_OPPONENT_AVERY,
CONTEST_OPPONENT_ARIANA,
CONTEST_OPPONENT_ASHTON,
CONTEST_OPPONENT_SANDRA,
CONTEST_OPPONENT_CARSON,
CONTEST_OPPONENT_KATRINA,
CONTEST_OPPONENT_LUKE,
CONTEST_OPPONENT_RAUL,
CONTEST_OPPONENT_JADA,
CONTEST_OPPONENT_ZEEK,
CONTEST_OPPONENT_DIEGO,
CONTEST_OPPONENT_ALIYAH,
CONTEST_OPPONENT_NATALIA,
CONTEST_OPPONENT_DEVIN,
CONTEST_OPPONENT_TYLOR,
CONTEST_OPPONENT_RONNIE,
CONTEST_OPPONENT_CLAUDIA,
CONTEST_OPPONENT_ELIAS,
CONTEST_OPPONENT_JADE,
CONTEST_OPPONENT_FRANCIS,
CONTEST_OPPONENT_ALISHA,
CONTEST_OPPONENT_SAUL,
CONTEST_OPPONENT_FELICIA,
CONTEST_OPPONENT_EMILIO,
CONTEST_OPPONENT_KARLA,
CONTEST_OPPONENT_DARRYL,
CONTEST_OPPONENT_SELENA,
CONTEST_OPPONENT_NOEL,
CONTEST_OPPONENT_LACEY,
CONTEST_OPPONENT_CORBIN,
CONTEST_OPPONENT_GRACIE,
CONTEST_OPPONENT_COLTIN,
CONTEST_OPPONENT_ELLIE,
CONTEST_OPPONENT_MARCUS,
CONTEST_OPPONENT_KIARA,
CONTEST_OPPONENT_BRYCE,
CONTEST_OPPONENT_JAMIE,
CONTEST_OPPONENT_JORGE,
CONTEST_OPPONENT_DEVON,
CONTEST_OPPONENT_JUSTINA,
CONTEST_OPPONENT_RALPH,
CONTEST_OPPONENT_ROSA,
CONTEST_OPPONENT_KEATON,
CONTEST_OPPONENT_MAYRA,
CONTEST_OPPONENT_LAMAR,
CONTEST_OPPONENT_AUBREY,
CONTEST_OPPONENT_NIGEL,
CONTEST_OPPONENT_CAMILLE,
CONTEST_OPPONENT_DEON,
CONTEST_OPPONENT_JANELLE,
CONTEST_OPPONENT_HEATH,
CONTEST_OPPONENT_SASHA,
CONTEST_OPPONENT_FRANKIE,
CONTEST_OPPONENT_HELEN,
CONTEST_OPPONENT_CAMILE,
CONTEST_OPPONENT_MARTIN,
CONTEST_OPPONENT_SERGIO,
CONTEST_OPPONENT_KAILEY,
CONTEST_OPPONENT_PERLA,
CONTEST_OPPONENT_CLARA,
CONTEST_OPPONENT_JAKOB,
CONTEST_OPPONENT_TREY,
CONTEST_OPPONENT_LANE
};
// All contest opponents have a common set of AI flags (which contains all of the actually
// useful AI scripts, as well as some dummys) and a random combination of 2-3 dummy flags.

View File

@ -122,7 +122,7 @@ static const u8 sFontColorTable[][3] =
static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
{
{
{ // Party mon 1
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 3,
@ -131,7 +131,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 3,
.baseBlock = 0x63,
},
{
{ // Party mon 2
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 1,
@ -140,7 +140,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 4,
.baseBlock = 0xA9,
},
{
{ // Party mon 3
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 4,
@ -149,7 +149,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 5,
.baseBlock = 0xDF,
},
{
{ // Party mon 4
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 7,
@ -158,7 +158,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 6,
.baseBlock = 0x115,
},
{
{ // Party mon 5
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 10,
@ -167,7 +167,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 7,
.baseBlock = 0x14B,
},
{
{ // Party mon 6
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 13,
@ -176,7 +176,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
.paletteNum = 8,
.baseBlock = 0x181,
},
{
[WIN_MSG] = {
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 15,
@ -190,7 +190,7 @@ static const struct WindowTemplate sSinglePartyMenuWindowTemplate[] =
static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
{
{
{ // Party mon 1
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -199,7 +199,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 3,
.baseBlock = 0x63,
},
{
{ // Party mon 2
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 8,
@ -208,7 +208,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 4,
.baseBlock = 0xA9,
},
{
{ // Party mon 3
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 1,
@ -217,7 +217,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 5,
.baseBlock = 0xEF,
},
{
{ // Party mon 4
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 5,
@ -226,7 +226,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 6,
.baseBlock = 0x125,
},
{
{ // Party mon 5
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 9,
@ -235,7 +235,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 7,
.baseBlock = 0x15B,
},
{
{ // Party mon 6
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 13,
@ -244,7 +244,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
.paletteNum = 8,
.baseBlock = 0x191,
},
{
[WIN_MSG] = {
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 15,
@ -258,7 +258,7 @@ static const struct WindowTemplate sDoublePartyMenuWindowTemplate[] =
static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
{
{
{ // Party mon 1
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -267,7 +267,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 3,
.baseBlock = 0x63,
},
{
{ // Party mon 2
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 8,
@ -276,7 +276,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 4,
.baseBlock = 0xA9,
},
{
{ // Party mon 3
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 2,
@ -285,7 +285,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 5,
.baseBlock = 0xEF,
},
{
{ // Party mon 4
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 5,
@ -294,7 +294,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 6,
.baseBlock = 0x125,
},
{
{ // Party mon 5
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 9,
@ -303,7 +303,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 7,
.baseBlock = 0x15B,
},
{
{ // Party mon 6
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 12,
@ -312,7 +312,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
.paletteNum = 8,
.baseBlock = 0x191,
},
{
[WIN_MSG] = {
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 15,
@ -326,7 +326,7 @@ static const struct WindowTemplate sMultiPartyMenuWindowTemplate[] =
static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
{
{
{ // Party mon 1
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 2,
@ -335,7 +335,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 3,
.baseBlock = 0x63,
},
{
{ // Party mon 2
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 3,
@ -344,7 +344,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 5,
.baseBlock = 0xA9,
},
{
{ // Party mon 3
.bg = 0,
.tilemapLeft = 12,
.tilemapTop = 6,
@ -353,7 +353,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 6,
.baseBlock = 0xDF,
},
{
{ // Party mon 4
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 11,
@ -362,7 +362,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 4,
.baseBlock = 0x115,
},
{
{ // Party mon 5
.bg = 2,
.tilemapLeft = 12,
.tilemapTop = 12,
@ -371,7 +371,7 @@ static const struct WindowTemplate sShowcaseMultiPartyMenuWindowTemplate[] =
.paletteNum = 7,
.baseBlock = 0x16B,
},
{
{ // Party mon 6
.bg = 2,
.tilemapLeft = 12,
.tilemapTop = 15,

View File

@ -55,7 +55,7 @@ static const u8 sText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for ba
static const u8 sText_WaitingForYourFriend[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}Waiting for your friend\nto finish…");
static const u8 sText_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON.");
static const struct OamData sTradeOamData_32x16 =
static const struct OamData sOamData_MenuText =
{
.shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16),
@ -167,17 +167,17 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText =
{
.tileTag = GFXTAG_MENU_TEXT,
.paletteTag = PALTAG_MENU_TEXT,
.oam = &sTradeOamData_32x16,
.oam = &sOamData_MenuText,
.anims = sAnims_MenuText,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_TradeScreenText =
static const u16 sMenuText_Pal[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_MenuText =
{
.data = sTradeScreenTextPalette,
.data = sMenuText_Pal,
.tag = PALTAG_MENU_TEXT
};
@ -193,7 +193,7 @@ static const struct SpritePalette sSpritePalette_TradeScreenText =
// 1st array is the current positions
// 2nd array is directions of input
// 3rd array is the next positions to go to (unoccupied spaces are skipped over)
static const u8 sTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE] =
static const u8 sCursorMoveDestinations[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE] =
{
{
{4, 2, 12, 12, 0, 0}, // UP
@ -275,86 +275,67 @@ static const u8 sTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE]
}
};
#define COL0_X 1
#define COL1_X 8
#define COL2_X 16
#define COL3_X 23
#define ROW0_Y 5
#define ROW1_Y 10
#define ROW2_Y 15
#define ROW3_Y 18
static const u8 sTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] =
{
// Your party
{1, 5 },
{8, 5 },
{1, 10},
{8, 10},
{1, 15},
{8, 15},
// Friend's party
{16, 5 },
{23, 5 },
{16, 10},
{23, 10},
{16, 15},
{23, 15},
{23, 18} // CANCEL
// Player's party
{COL0_X, ROW0_Y},
{COL1_X, ROW0_Y},
{COL0_X, ROW1_Y},
{COL1_X, ROW1_Y},
{COL0_X, ROW2_Y},
{COL1_X, ROW2_Y},
// Partners's party
{COL2_X, ROW0_Y},
{COL3_X, ROW0_Y},
{COL2_X, ROW1_Y},
{COL3_X, ROW1_Y},
{COL2_X, ROW2_Y},
{COL3_X, ROW2_Y},
// Cancel
{COL3_X, ROW3_Y}
};
static const u8 sTradeMonLevelCoords[][2][2] =
{
// Your party
{
{5, 4},
{12, 4},
},
{
{5, 9},
{12, 9},
},
{
{5, 14},
static const u8 sTradeMonLevelCoords[PARTY_SIZE * 2][2] = {
[TRADE_PLAYER] =
{ 5, 4},
{12, 4},
{ 5, 9},
{12, 9},
{ 5, 14},
{12, 14},
},
// Friend's party
{
{20, 4},
{27, 4},
},
{
{20, 9},
{27, 9},
},
{
[TRADE_PARTNER * PARTY_SIZE] =
{20, 4},
{27, 4},
{20, 9},
{27, 9},
{20, 14},
{27, 14},
},
};
static const u8 sTradeMonBoxCoords[][2][2] =
{
// Your party
{
{1, 3},
{8, 3},
},
{
{1, 8},
{8, 8},
},
{
{1, 13},
{8, 13},
},
// Friend's party
{
{16, 3},
{23, 3},
},
{
{16, 8},
{23, 8},
},
{
static const u8 sTradeMonBoxCoords[PARTY_SIZE * 2][2] = {
[TRADE_PLAYER] =
{ 1, 3},
{ 8, 3},
{ 1, 8},
{ 8, 8},
{ 1, 13},
{ 8, 13},
[TRADE_PARTNER * PARTY_SIZE] =
{16, 3},
{23, 3},
{16, 8},
{23, 8},
{16, 13},
{23, 13},
},
};
static const u8 sUnusedCoords[][2] =
@ -379,14 +360,14 @@ static const u8 sUnusedCoords[][2] =
{23, 12}
};
static const u8 *const sTradeActionTexts[] =
static const u8 *const sActionTexts[] =
{
[TRADE_TEXT_CANCEL] = sText_Cancel,
[TRADE_TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TRADE_TEXT_SUMMARY] = sText_Summary,
[TRADE_TEXT_TRADE] = sText_Trade,
[TRADE_TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TRADE_TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
[TEXT_CANCEL] = sText_Cancel,
[TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TEXT_SUMMARY] = sText_Summary,
[TEXT_TRADE] = sText_Trade,
[TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
};
static const struct MenuAction sSelectTradeMonActions[] =
@ -395,17 +376,17 @@ static const struct MenuAction sSelectTradeMonActions[] =
{sText_Trade2, Task_DrawSelectionTrade}
};
static const u8 *const sTradeMessages[] =
static const u8 *const sMessages[] =
{
[TRADE_MSG_STANDBY] = sText_CommunicationStandby,
[TRADE_MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[TRADE_MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[TRADE_MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[TRADE_MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[TRADE_MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[TRADE_MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[TRADE_MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
[MSG_STANDBY] = sText_CommunicationStandby,
[MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
};
static const u8 sTradeTextColors[] =
@ -415,7 +396,7 @@ static const u8 sTradeTextColors[] =
TEXT_COLOR_DARK_GRAY //shadow color
};
static const struct BgTemplate sTradeMenuBgTemplates[] =
static const struct BgTemplate sBgTemplates[] =
{
{
.bg = 0,
@ -455,7 +436,7 @@ static const struct BgTemplate sTradeMenuBgTemplates[] =
},
};
static const struct WindowTemplate sTradeMenuWindowTemplates[] =
static const struct WindowTemplate sWindowTemplates[] =
{
{
.bg = 0,
@ -633,8 +614,8 @@ static const struct WindowTemplate sTradeYesNoWindowTemplate =
.baseBlock = 582
};
static const u8 sJPText_Shedinja[] = _("ヌケニン");
static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
static const u8 sText_ShedinjaJP[] = _("ヌケニン");
static const u8 sSelectedMonLevelGenderCoords[3][2] =
{
[TRADE_PLAYER] = {4, 3},
[TRADE_PARTNER] = {19, 3}
@ -643,8 +624,8 @@ static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
static const u16 sPokeball_Pal[] = INCBIN_U16("graphics/trade/pokeball.gbapal");
static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/trade/pokeball.4bpp");
static const u8 sPokeballSymbol_Gfx[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); // unused
static const u16 sCrossingHighlightCable_Tilemap[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin");
static const u16 sTradeTilemap_PokeBallSymbol[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
static const u16 sCableCloseup_Map[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin");
static const u16 sPokeballSymbol_Map[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
static const u16 sUnusedPal1[] = INCBIN_U16("graphics/trade/unused1.gbapal");
static const u16 sGba_Pal[] = INCBIN_U16("graphics/trade/gba.gbapal");
static const u16 sUnusedPal2[] = INCBIN_U16("graphics/trade/unused2.gbapal");
@ -657,11 +638,11 @@ static const u8 sGbaScreen_Gfx[] = INCBIN_U8("graphics/trade/gba_screen.4bpp");
const u16 gTradePlatform_Tilemap[] = INCBIN_U16("graphics/trade/platform.bin");
static const u8 sGbaAffine_Gfx[] = INCBIN_U8("graphics/trade/gba_affine.8bpp"); // Only the gfx for when the GBA is zooming in/out
static const u8 sEmptyGfx[64] = {};
static const u8 sGbaCable_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin");
static const u8 sGbaWireless_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin");
static const u16 sGbaWireless_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaCable_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
static const u32 sCrossingHighlightWireless_Tilemap[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz");
static const u8 sGbaAffineMapCable[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin");
static const u8 sGbaAffineMapWireless[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin");
static const u16 sGbaMapWireless[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaMapCable[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
static const u32 sWirelessCloseup_Map[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz");
static const u16 sWirelessSignalSend_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_send.gbapal");
static const u16 sWirelessSignalRecv_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_receive.gbapal");
static const u16 sWirelessSignalNone_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_none.gbapal");
@ -749,7 +730,7 @@ static const union AffineAnimCmd *const sAffineAnims_Pokeball[] =
static const struct SpriteSheet sPokeBallSpriteSheet =
{
.data = sPokeball_Gfx,
.size = 0x600,
.size = sizeof(sPokeball_Gfx),
.tag = GFXTAG_POKEBALL
};
@ -805,7 +786,7 @@ static const union AffineAnimCmd *const sAffineAnims_LinkMonGlow[] =
static const struct SpriteSheet sSpriteSheet_LinkMonGlow =
{
.data = sLinkMonGlow_Gfx,
.size = 0x200,
.size = sizeof(sLinkMonGlow_Gfx),
.tag = GFXTAG_LINK_MON_GLOW
};
@ -962,7 +943,7 @@ static const union AnimCmd *const sAnims_GbaScreen_Short[] =
static const struct SpriteSheet sSpriteSheet_GbaScreen =
{
.data = sGbaScreen_Gfx,
.size = 0x1000,
.size = sizeof(sGbaScreen_Gfx),
.tag = GFXTAG_GBA_SCREEN
};
@ -1185,7 +1166,7 @@ static const s8 sTradeBallVerticalVelocityTable[] =
0, 0, 0, 1, 0, 1, 1, 2, 3
};
static const u8 sWirelessSignalTiming[][2] =
static const u8 sWirelessSignalAnimParams[][2] =
{
{ 0, 1},
{ 1, 1},

View File

@ -226,18 +226,23 @@ static void DoQuizQuestionEasyChatScreen(void);
static void DoQuizSetAnswerEasyChatScreen(void);
static void DoQuizSetQuestionEasyChatScreen(void);
#define PALTAG_TRIANGLE_CURSOR 0
#define PALTAG_RECTANGLE_CURSOR 1
#define PALTAG_MISC_UI 2
#define PALTAG_RS_INTERVIEW_FRAME 3
enum {
PALTAG_TRIANGLE_CURSOR,
PALTAG_RECTANGLE_CURSOR,
PALTAG_MISC_UI,
PALTAG_RS_INTERVIEW_FRAME,
};
enum {
GFXTAG_TRIANGLE_CURSOR,
GFXTAG_RECTANGLE_CURSOR,
GFXTAG_SCROLL_INDICATOR,
GFXTAG_START_SELECT_BUTTONS,
GFXTAG_MODE_WINDOW,
GFXTAG_RS_INTERVIEW_FRAME,
GFXTAG_BUTTON_WINDOW,
};
#define GFXTAG_TRIANGLE_CURSOR 0
#define GFXTAG_RECTANGLE_CURSOR 1
#define GFXTAG_SCROLL_INDICATOR 2
#define GFXTAG_START_SELECT_BUTTONS 3
#define GFXTAG_MODE_WINDOW 4
#define GFXTAG_RS_INTERVIEW_FRAME 5
#define GFXTAG_BUTTON_WINDOW 6
// State values for sEasyChatScreen->inputState
// Control which input handler to use in HandleEasyChatInput
@ -376,6 +381,13 @@ enum {
WINANIM_KEYBOARD_SWITCH_IN,
};
// Window IDs
enum {
WIN_TITLE,
WIN_MSG,
WIN_INPUT_SELECT, // Word groups, word list, and keyboard
};
// Values for text frame tilemap
#define FRAME_OFFSET_ORANGE 0x1000 // Orange frame, for phrase text
#define FRAME_OFFSET_GREEN 0x4000 // Green frame, for keyboard/word select
@ -814,7 +826,7 @@ static const struct BgTemplate sEasyChatBgTemplates[] = {
};
static const struct WindowTemplate sEasyChatWindowTemplates[] = {
{
[WIN_TITLE] = {
.bg = 1,
.tilemapLeft = 6,
.tilemapTop = 0,
@ -823,7 +835,7 @@ static const struct WindowTemplate sEasyChatWindowTemplates[] = {
.paletteNum = 10,
.baseBlock = 0x10,
},
{
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 15,
@ -832,7 +844,7 @@ static const struct WindowTemplate sEasyChatWindowTemplates[] = {
.paletteNum = 15,
.baseBlock = 0xA,
},
{
[WIN_INPUT_SELECT] = {
.bg = 2,
.tilemapLeft = 1,
.tilemapTop = 0,
@ -3934,10 +3946,10 @@ static void PrintTitle(void)
return;
xOffset = GetStringCenterAlignXOffset(FONT_NORMAL, titleText, 144);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
PrintEasyChatTextWithColors(0, FONT_NORMAL, titleText, xOffset, 1, TEXT_SKIP_DRAW, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(0));
PrintEasyChatTextWithColors(WIN_TITLE, FONT_NORMAL, titleText, xOffset, 1, TEXT_SKIP_DRAW, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
PutWindowTilemap(WIN_TITLE);
CopyWindowToVram(WIN_TITLE, COPYWIN_FULL);
}
static void PrintEasyChatText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
@ -3957,10 +3969,10 @@ static void PrintEasyChatTextWithColors(u8 windowId, u8 fontId, const u8 *str, u
static void PrintInitialInstructions(void)
{
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
LoadUserWindowBorderGfx(1, 1, BG_PLTT_ID(14));
DrawTextBorderOuter(1, 1, 14);
LoadUserWindowBorderGfx(WIN_MSG, 1, BG_PLTT_ID(14));
DrawTextBorderOuter(WIN_MSG, 1, 14);
PrintEasyChatStdMessage(MSG_INSTRUCTIONS);
PutWindowTilemap(1);
PutWindowTilemap(WIN_MSG);
CopyBgTilemapBufferToVram(0);
}
@ -4004,14 +4016,14 @@ static void PrintEasyChatStdMessage(u8 msgId)
break;
}
FillWindowPixelBuffer(1, PIXEL_FILL(1));
FillWindowPixelBuffer(WIN_MSG, PIXEL_FILL(1));
if (text1)
PrintEasyChatText(1, FONT_NORMAL, text1, 0, 1, TEXT_SKIP_DRAW, 0);
PrintEasyChatText(WIN_MSG, FONT_NORMAL, text1, 0, 1, TEXT_SKIP_DRAW, 0);
if (text2)
PrintEasyChatText(1, FONT_NORMAL, text2, 0, 17, TEXT_SKIP_DRAW, 0);
PrintEasyChatText(WIN_MSG, FONT_NORMAL, text2, 0, 17, TEXT_SKIP_DRAW, 0);
CopyWindowToVram(1, COPYWIN_FULL);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
}
static void CreateEasyChatYesNoMenu(u8 initialCursorPos)
@ -4198,14 +4210,14 @@ static void AdjustBgTilemapForFooter(void)
static void DrawLowerWindow(void)
{
PutWindowTilemap(2);
CopyBgTilemapBufferToVram(2);
PutWindowTilemap(WIN_INPUT_SELECT);
CopyBgTilemapBufferToVram(WIN_INPUT_SELECT);
}
static void InitLowerWindowText(u32 whichText)
{
ResetLowerWindowScroll();
FillWindowPixelBuffer(2, PIXEL_FILL(1));
FillWindowPixelBuffer(WIN_INPUT_SELECT, PIXEL_FILL(1));
switch (whichText)
{
case TEXT_GROUPS:
@ -4219,7 +4231,7 @@ static void InitLowerWindowText(u32 whichText)
break;
}
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
}
static void PrintKeyboardText(void)
@ -4248,7 +4260,7 @@ static void PrintKeyboardGroupNames(void)
return;
}
PrintEasyChatText(2, FONT_NORMAL, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SKIP_DRAW, NULL);
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, GetEasyChatWordGroupName(groupId), x * 84 + 10, y, TEXT_SKIP_DRAW, NULL);
}
y += 16;
@ -4260,7 +4272,7 @@ static void PrintKeyboardAlphabet(void)
u32 i;
for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardAlphabet); i++)
PrintEasyChatText(2, FONT_NORMAL, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SKIP_DRAW, NULL);
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, sEasyChatKeyboardAlphabet[i], 10, 97 + i * 16, TEXT_SKIP_DRAW, NULL);
}
static void PrintInitialWordSelectText(void)
@ -4331,16 +4343,16 @@ static void PrintWordSelectText(u8 scrollOffset, u8 numRows)
{
CopyEasyChatWordPadded(sScreenControl->wordSelectPrintBuffer, easyChatWord, 0);
if (!DummyWordCheck(easyChatWord))
PrintEasyChatText(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, NULL);
PrintEasyChatText(WIN_INPUT_SELECT, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, NULL);
else // Never reached
PrintEasyChatTextWithColors(2, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY);
PrintEasyChatTextWithColors(WIN_INPUT_SELECT, FONT_NORMAL, sScreenControl->wordSelectPrintBuffer, (j * 13 + 3) * 8, y, TEXT_SKIP_DRAW, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_LIGHT_GRAY);
}
}
y += 16;
}
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
}
static void EraseWordSelectRows(u8 scrollOffset, u8 numRows)
@ -4364,15 +4376,15 @@ static void EraseWordSelectRows(u8 scrollOffset, u8 numRows)
var1 = 0;
}
FillWindowPixelRect(2, PIXEL_FILL(1), 0, y, 224, var2);
FillWindowPixelRect(WIN_INPUT_SELECT, PIXEL_FILL(1), 0, y, 224, var2);
if (var1)
FillWindowPixelRect(2, PIXEL_FILL(1), 0, 0, 224, var1);
FillWindowPixelRect(WIN_INPUT_SELECT, PIXEL_FILL(1), 0, 0, 224, var1);
}
static void ClearWordSelectWindow(void)
{
FillWindowPixelBuffer(2, PIXEL_FILL(1));
CopyWindowToVram(2, COPYWIN_GFX);
FillWindowPixelBuffer(WIN_INPUT_SELECT, PIXEL_FILL(1));
CopyWindowToVram(WIN_INPUT_SELECT, COPYWIN_GFX);
}
static void InitLowerWindowAnim(int winAnimType)

View File

@ -343,7 +343,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_MSG_SELECT_CONNECT:
if (PrintMysteryGiftMenuMessage(&data->textState, gJPText_SelectConnectFromEReaderMenu))
{
AddTextPrinterToWindow1(gJPText_SelectConnectWithGBA);
MG_AddMessageTextPrinter(gJPText_SelectConnectWithGBA);
ResetTimer(&data->timer);
data->state = ER_STATE_MSG_SELECT_CONNECT_WAIT;
}
@ -397,7 +397,7 @@ static void Task_EReader(u8 taskId)
data->state = ER_STATE_MSG_SELECT_CONNECT;
break;
case ER_STATE_CONNECTING:
AddTextPrinterToWindow1(gJPText_Connecting);
MG_AddMessageTextPrinter(gJPText_Connecting);
// XXX: This (u32 *) cast is discarding the const qualifier from gMultiBootProgram_EReader_Start
EReader_Load(&gEReaderData, gMultiBootProgram_EReader_End - gMultiBootProgram_EReader_Start, (u32 *)gMultiBootProgram_EReader_Start);
data->state = ER_STATE_TRANSFER;
@ -416,7 +416,7 @@ static void Task_EReader(u8 taskId)
else if (data->status == TRANSFER_SUCCESS)
{
ResetTimer(&data->timer);
AddTextPrinterToWindow1(gJPText_PleaseWaitAMoment);
MG_AddMessageTextPrinter(gJPText_PleaseWaitAMoment);
data->state = ER_STATE_TRANSFER_SUCCESS;
}
else // TRANSFER_CANCELED
@ -430,7 +430,7 @@ static void Task_EReader(u8 taskId)
break;
case ER_STATE_LOAD_CARD_START:
OpenEReaderLink();
AddTextPrinterToWindow1(gJPText_AllowEReaderToLoadCard);
MG_AddMessageTextPrinter(gJPText_AllowEReaderToLoadCard);
data->state = ER_STATE_LOAD_CARD;
break;
case ER_STATE_LOAD_CARD:
@ -439,7 +439,7 @@ static void Task_EReader(u8 taskId)
case RECV_ACTIVE:
break;
case RECV_SUCCESS:
AddTextPrinterToWindow1(gJPText_Connecting);
MG_AddMessageTextPrinter(gJPText_Connecting);
data->state = ER_STATE_WAIT_RECV_CARD;
break;
case RECV_CANCELED:
@ -487,7 +487,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_SAVE:
if (TryWriteTrainerHill((struct EReaderTrainerHillSet *)&gDecompressionBuffer))
{
AddTextPrinterToWindow1(gJPText_ConnectionComplete);
MG_AddMessageTextPrinter(gJPText_ConnectionComplete);
ResetTimer(&data->timer);
data->state = ER_STATE_SUCCESS_MSG;
}
@ -499,7 +499,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_SUCCESS_MSG:
if (UpdateTimer(&data->timer, 120))
{
AddTextPrinterToWindow1(gJPText_NewTrainerHasComeToHoenn);
MG_AddMessageTextPrinter(gJPText_NewTrainerHasComeToHoenn);
PlayFanfare(MUS_OBTAIN_ITEM);
data->state = ER_STATE_SUCCESS_END;
}

417
src/expansion_intro.c Normal file
View File

@ -0,0 +1,417 @@
#include "global.h"
#include "bg.h"
#include "decompress.h"
#include "palette.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "gpu_regs.h"
#include "trig.h"
#include "main.h"
#include "intro.h"
#include "m4a.h"
#include "expansion_intro.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#if EXPANSION_INTRO == TRUE
#define TAG_DIZZY 20000
#define TAG_PORYGON 20001
#define PAL_TAG_DIZZY 20000
#define PAL_TAG_PORYGON 20001
#define DIZZY_POS_X 300
#define DIZZY_POS_Y 138
#define DIZZY_COLLISION_POS_X 172
#define PORY_POS_X -32
#define PORY_POS_Y 115
#define PORYGON_COLLISION_POS_X 140
#define PORYGON_WAIT_TIME 99
#define DIZZY_ANIM_SPEED 4
#define DIZZY_STARS_SPEED 12
enum
{
EXPANSION_INTRO_BG2,
EXPANSION_INTRO_BG3
};
enum
{
ANIM_PORY_IDLE,
ANIM_PORY_HIT,
ANIM_PORY_GO_UP
};
enum
{
ANIM_DIZZY_WALKING,
ANIM_DIZZY_DIZZY
};
static const u32 sBgTiles_PoweredBy[] = INCBIN_U32("graphics/expansion_intro/powered_by.4bpp.lz");
static const u32 sBgTiles_RhhCredits[] = INCBIN_U32("graphics/expansion_intro/rhh_credits.8bpp.lz");
static const u32 sBgMap_PoweredBy[] = INCBIN_U32("graphics/expansion_intro/powered_by.bin.lz");
static const u32 sBgMap_RhhCredits[] = INCBIN_U32("graphics/expansion_intro/rhh_credits.bin.lz");
static const u32 sBgPal_Credits[] = INCBIN_U32("graphics/expansion_intro/credits.gbapal.lz");
static const u32 sSpriteTiles_DizzyEgg[] = INCBIN_U32("graphics/expansion_intro/sprites/dizzy_egg.4bpp.lz");
static const u32 sSpriteTiles_Porygon[] = INCBIN_U32("graphics/expansion_intro/sprites/porygon.4bpp.lz");
static const u16 sSpritePal_DizzyEgg[] = INCBIN_U16("graphics/expansion_intro/sprites/dizzy_egg.gbapal");
static const u16 sSpritePal_Porygon[] = INCBIN_U16("graphics/expansion_intro/sprites/porygon.gbapal");
static const u16 sSpritePal_PorygonShiny[] = INCBIN_U16("graphics/expansion_intro/sprites/shiny.gbapal");
static void SpriteCallback_DizzyWalking(struct Sprite* sprite);
static void SpriteCallback_PorygonFlying(struct Sprite* sprite);
static void Task_ExpansionIntro_HandleBlend(u8 taskId);
static void VBlankCB_ExpansionIntro(void);
static void ExpansionIntro_InitBgs();
static void ExpansionIntro_StartBlend();
static void ExpansionIntro_LoadGraphics();
static void ExpansionIntro_CreateSprites();
static const union AnimCmd sAnimCmd_DizzyWalking[] =
{
ANIMCMD_FRAME(32, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(16, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(0, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(16, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(32, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(48, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(64, DIZZY_ANIM_SPEED),
ANIMCMD_FRAME(48, DIZZY_ANIM_SPEED),
ANIMCMD_JUMP(0),
};
static const union AnimCmd sAnimCmd_DizzyisDizzy[] =
{
ANIMCMD_FRAME(80, DIZZY_STARS_SPEED),
ANIMCMD_FRAME(96, DIZZY_STARS_SPEED),
ANIMCMD_FRAME(112, DIZZY_STARS_SPEED),
ANIMCMD_FRAME(96, DIZZY_STARS_SPEED),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const sAnimCmdTable_DizzyEgg[] =
{
[ANIM_DIZZY_WALKING] = sAnimCmd_DizzyWalking,
[ANIM_DIZZY_DIZZY] = sAnimCmd_DizzyisDizzy,
};
static const union AnimCmd sAnimCmd_PorygonIdle[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END,
};
static const union AnimCmd sAnimCmd_PorygonHitted[] =
{
ANIMCMD_FRAME(64, 0),
ANIMCMD_END,
};
static const union AnimCmd sAnimCmd_PorygonGoUp[] =
{
ANIMCMD_FRAME(64, 20),
ANIMCMD_FRAME(128, 10),
ANIMCMD_END,
};
static const union AnimCmd *const sAnimCmdTable_Porygon[] =
{
[ANIM_PORY_IDLE] = sAnimCmd_PorygonIdle,
[ANIM_PORY_HIT] = sAnimCmd_PorygonHitted,
[ANIM_PORY_GO_UP] = sAnimCmd_PorygonGoUp,
};
static const union AffineAnimCmd sAffineAnimCmd_PorygonScale[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd *const sAffineAnimCmdTable_Porygon[] =
{
sAffineAnimCmd_PorygonScale,
};
static const struct CompressedSpriteSheet sSpriteSheet_DizzyEgg =
{
.data = sSpriteTiles_DizzyEgg,
.size = 0x1000,
.tag = TAG_DIZZY,
};
static const struct CompressedSpriteSheet sSpriteSheet_Porygon =
{
.data = sSpriteTiles_Porygon,
.size = 0x2800,
.tag = PAL_TAG_PORYGON,
};
static const struct SpritePalette sSpritePalette_DizzyEgg =
{
.data = sSpritePal_DizzyEgg,
.tag = PAL_TAG_DIZZY,
};
static const struct SpritePalette sSpritePalette_Porygon =
{
.data = sSpritePal_Porygon,
.tag = PAL_TAG_PORYGON,
};
static const struct OamData sOamData_DizzyEgg =
{
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.size = SPRITE_SIZE(32x32),
.priority = 0,
};
static const struct OamData sOamData_Porygon =
{
.affineMode = ST_OAM_AFFINE_NORMAL,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.size = SPRITE_SIZE(64x64),
.priority = 0,
};
static const struct SpriteTemplate sSpriteTemplate_DizzyEgg =
{
.tileTag = TAG_DIZZY,
.paletteTag = PAL_TAG_DIZZY,
.oam = &sOamData_DizzyEgg,
.anims = sAnimCmdTable_DizzyEgg,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallback_DizzyWalking,
};
static const struct SpriteTemplate sSpriteTemplate_Porygon =
{
.tileTag = TAG_PORYGON,
.paletteTag = PAL_TAG_PORYGON,
.oam = &sOamData_Porygon,
.anims = sAnimCmdTable_Porygon,
.images = NULL,
.affineAnims = sAffineAnimCmdTable_Porygon,
.callback = SpriteCallback_PorygonFlying,
};
static const struct BgTemplate sBgTemplates_RhhCopyrightScreen[] =
{
[EXPANSION_INTRO_BG2] = {
.bg = 2,
.charBaseIndex = 1,
.mapBaseIndex = 20,
.screenSize = 2,
.paletteMode = 1
},
[EXPANSION_INTRO_BG3] = {
.bg = 3,
.mapBaseIndex = 22,
.screenSize = 2
},
};
void CB2_ExpansionIntro(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
#define tState gTasks[taskId].data[0]
#define tFrameCounter gTasks[taskId].data[1]
void Task_HandleExpansionIntro(u8 taskId)
{
switch (tState)
{
case 0:
SetVBlankCallback(VBlankCB_ExpansionIntro);
ExpansionIntro_InitBgs();
ExpansionIntro_LoadGraphics();
CpuFastFill16(RGB_BLACK, gPlttBufferFaded, 32);
ShowBg(3);
BeginNormalPaletteFade(1, 0, 16, 0, RGB_BLACK);
ExpansionIntro_StartBlend();
ExpansionIntro_CreateSprites();
tState++;
break;
case 1:
if (!gPaletteFade.active)
tState++;
break;
case 2:
if (tFrameCounter == 208)
{
tState++;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
}
else if (gMain.newKeys != 0)
{
CpuFill16(0, gPlttBufferFaded, sizeof(gPlttBufferFaded));
if (IsCryPlaying())
StopCry();
m4aSongNumStop(SE_BIKE_HOP);
m4aSongNumStop(SE_M_DOUBLE_SLAP);
tState++;
}
else
{
tFrameCounter++;
}
break;
case 3:
if (!gPaletteFade.active)
{
ResetSpriteData();
FreeAllSpritePalettes();
DestroyTask(taskId);
CreateTask(Task_Scene1_Load, 0);
SetMainCallback2(MainCB2_Intro);
}
break;
}
}
#undef tState
static void VBlankCB_ExpansionIntro(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static void ExpansionIntro_InitBgs(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates_RhhCopyrightScreen, ARRAY_COUNT(sBgTemplates_RhhCopyrightScreen));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_DARKEN);
SetGpuReg(REG_OFFSET_BLDY, 0x1F);
HideBg(0);
HideBg(1);
HideBg(2);
HideBg(3);
}
static void ExpansionIntro_LoadGraphics(void)
{
LZ77UnCompVram(sBgTiles_PoweredBy, (void*) BG_CHAR_ADDR(sBgTemplates_RhhCopyrightScreen[EXPANSION_INTRO_BG3].charBaseIndex));
LZ77UnCompVram(sBgMap_PoweredBy, (u16*) BG_SCREEN_ADDR(sBgTemplates_RhhCopyrightScreen[EXPANSION_INTRO_BG3].mapBaseIndex));
LZ77UnCompVram(sBgTiles_RhhCredits, (void*) BG_CHAR_ADDR(sBgTemplates_RhhCopyrightScreen[EXPANSION_INTRO_BG2].charBaseIndex));
LZ77UnCompVram(sBgMap_RhhCredits, (u16*) BG_SCREEN_ADDR(sBgTemplates_RhhCopyrightScreen[EXPANSION_INTRO_BG2].mapBaseIndex));
LoadCompressedPalette(sBgPal_Credits, 0x00, 0x60);
LoadCompressedSpriteSheet(&sSpriteSheet_DizzyEgg);
LoadCompressedSpriteSheet(&sSpriteSheet_Porygon);
LoadSpritePalette(&sSpritePalette_DizzyEgg);
LoadSpritePalette(&sSpritePalette_Porygon);
}
static void ExpansionIntro_CreateSprites(void)
{
u32 dizzyId, poryId;
dizzyId = CreateSprite(&sSpriteTemplate_DizzyEgg, 0, DIZZY_POS_Y, 0);
gSprites[dizzyId].x2 = DIZZY_POS_X;
poryId = CreateSprite(&sSpriteTemplate_Porygon, 0, PORY_POS_Y, 0);
gSprites[poryId].x2 = PORY_POS_X;
}
static void ExpansionIntro_StartBlend(void)
{
ShowBg(2);
CreateTask(Task_ExpansionIntro_HandleBlend, 0);
}
static void Task_ExpansionIntro_HandleBlend(u8 taskId)
{
if (GetGpuReg(REG_OFFSET_BLDY) != 0)
{
SetGpuReg(REG_OFFSET_BLDY, GetGpuReg(REG_OFFSET_BLDY) - 1);
}
else
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
DestroyTask(taskId);
}
}
#define sTimer data[0]
static void SpriteCallback_DizzyWalking(struct Sprite* sprite)
{
sprite->x2--;
if (sprite->x2 <= DIZZY_COLLISION_POS_X)
{
StartSpriteAnim(sprite, ANIM_DIZZY_DIZZY);
sprite->callback = SpriteCallbackDummy;
}
if (sprite->sTimer % 16 == 0 && sprite->sTimer / 16 > 2)
PlaySE(SE_BIKE_HOP);
sprite->sTimer++;
}
static void SpriteCallback_PorygonHit(struct Sprite* sprite)
{
sprite->x2-=2;
sprite ->y2 = Sin2(180 + sprite->sTimer * 4) / 128;
if (sprite->sTimer >= 48)
{
StartSpriteAnim(sprite, ANIM_PORY_GO_UP);
sprite->callback = SpriteCallbackDummy;
}
if (sprite->sTimer % 8 == 0)
{
if (sprite->sTimer % 16 == 0)
LoadPalette(sSpritePal_PorygonShiny, 0x10 * (16 + sprite->oam.paletteNum), 0x20);
else
LoadPalette(sSpritePal_Porygon, 0x10 * (16 + sprite->oam.paletteNum), 0x20);
}
sprite->sTimer++;
}
static void SpriteCallback_PorygonFlying(struct Sprite* sprite)
{
if (sprite->sTimer >= PORYGON_WAIT_TIME)
{
sprite->x2 += 6;
if (sprite->sTimer % 32 >= 16)
sprite->y2--;
else
sprite->y2++;
if (sprite->x2 >= PORYGON_COLLISION_POS_X)
{
StartSpriteAnim(sprite, ANIM_PORY_HIT);
sprite->callback = SpriteCallback_PorygonHit;
sprite->sTimer = 0;
PlaySE(SE_M_DOUBLE_SLAP);
PlayCryInternal(SPECIES_PORYGON, 0, 120, 10, 0);
}
}
sprite->sTimer++;
}
#undef sTimer
#endif //EXPANSION_INTRO

View File

@ -3831,26 +3831,38 @@ static void SpriteCB_DeoxysRockFragment(struct Sprite *sprite)
DestroySprite(sprite);
}
// Task data for Task_MoveDeoxysRock
#define tState data[0]
#define tSpriteId data[1]
#define tTargetX data[2]
#define tTargetY data[3]
#define tCurX data[4]
#define tCurY data[5]
#define tVelocityX data[6]
#define tVelocityY data[7]
#define tMoveSteps data[8]
#define tObjEventId data[9]
bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
{
u8 objectEventIdBuffer;
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer))
u8 objectEventId;
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventId))
{
struct ObjectEvent *object;
int xPos, yPos;
u8 taskId;
object = &gObjectEvents[objectEventIdBuffer];
object = &gObjectEvents[objectEventId];
xPos = object->currentCoords.x - MAP_OFFSET;
yPos = object->currentCoords.y - MAP_OFFSET;
xPos = (gFieldEffectArguments[3] - xPos) * 16;
yPos = (gFieldEffectArguments[4] - yPos) * 16;
ShiftObjectEventCoords(object, gFieldEffectArguments[3] + MAP_OFFSET, gFieldEffectArguments[4] + MAP_OFFSET);
taskId = CreateTask(Task_MoveDeoxysRock, 80);
gTasks[taskId].data[1] = object->spriteId;
gTasks[taskId].data[2] = gSprites[object->spriteId].x + xPos;
gTasks[taskId].data[3] = gSprites[object->spriteId].y + yPos;
gTasks[taskId].data[8] = gFieldEffectArguments[5];
gTasks[taskId].data[9] = objectEventIdBuffer;
gTasks[taskId].tSpriteId = object->spriteId;
gTasks[taskId].tTargetX = gSprites[object->spriteId].x + xPos;
gTasks[taskId].tTargetY = gSprites[object->spriteId].y + yPos;
gTasks[taskId].tMoveSteps = gFieldEffectArguments[5];
gTasks[taskId].tObjEventId = objectEventId;
}
return FALSE;
}
@ -3858,29 +3870,30 @@ bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
static void Task_MoveDeoxysRock(u8 taskId)
{
s16 *data = gTasks[taskId].data;
struct Sprite *sprite = &gSprites[data[1]];
switch (data[0])
struct Sprite *sprite = &gSprites[tSpriteId];
switch (tState)
{
case 0:
data[4] = sprite->x << 4;
data[5] = sprite->y << 4;
data[6] = SAFE_DIV(data[2] * 16 - data[4], data[8]);
data[7] = SAFE_DIV(data[3] * 16 - data[5], data[8]);
data[0]++;
tCurX = sprite->x << 4;
tCurY = sprite->y << 4;
tVelocityX = SAFE_DIV(tTargetX * 16 - tCurX, tMoveSteps);
tVelocityY = SAFE_DIV(tTargetY * 16 - tCurY, tMoveSteps);
tState++;
// fallthrough
case 1:
if (data[8] != 0)
if (tMoveSteps != 0)
{
data[8]--;
data[4] += data[6];
data[5] += data[7];
sprite->x = data[4] >> 4;
sprite->y = data[5] >> 4;
tMoveSteps--;
tCurX += tVelocityX;
tCurY += tVelocityY;
sprite->x = tCurX >> 4;
sprite->y = tCurY >> 4;
}
else
{
struct ObjectEvent *object = &gObjectEvents[data[9]];
sprite->x = data[2];
sprite->y = data[3];
struct ObjectEvent *object = &gObjectEvents[tObjEventId];
sprite->x = tTargetX;
sprite->y = tTargetY;
ShiftStillObjectEventCoords(object);
object->triggerGroundEffectsOnStop = TRUE;
FieldEffectActiveListRemove(FLDEFF_MOVE_DEOXYS_ROCK);
@ -3890,3 +3903,13 @@ static void Task_MoveDeoxysRock(u8 taskId)
}
}
#undef tState
#undef tSpriteId
#undef tTargetX
#undef tTargetY
#undef tCurX
#undef tCurY
#undef tVelocityX
#undef tVelocityY
#undef tMoveSteps
#undef tObjEventId

View File

@ -23,9 +23,15 @@
* For the fly map, and utility functions all of the maps use, see region_map.c
*/
// Static type declarations
enum {
WIN_MAPSEC_NAME,
WIN_TITLE,
};
// Static RAM declarations
enum {
TAG_PLAYER_ICON,
TAG_CURSOR,
};
static EWRAM_DATA struct {
MainCallback callback;
@ -34,16 +40,12 @@ static EWRAM_DATA struct {
u16 state;
} *sFieldRegionMapHandler = NULL;
// Static ROM declarations
static void MCB2_InitRegionMapRegisters(void);
static void VBCB_FieldUpdateRegionMap(void);
static void MCB2_FieldUpdateRegionMap(void);
static void FieldUpdateRegionMap(void);
static void PrintRegionMapSecName(void);
// .rodata
static const struct BgTemplate sFieldRegionMapBgTemplates[] = {
{
.bg = 0,
@ -66,7 +68,7 @@ static const struct BgTemplate sFieldRegionMapBgTemplates[] = {
static const struct WindowTemplate sFieldRegionMapWindowTemplates[] =
{
{
[WIN_MAPSEC_NAME] = {
.bg = 0,
.tilemapLeft = 17,
.tilemapTop = 17,
@ -75,7 +77,7 @@ static const struct WindowTemplate sFieldRegionMapWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 1
},
{
[WIN_TITLE] = {
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 1,
@ -87,8 +89,6 @@ static const struct WindowTemplate sFieldRegionMapWindowTemplates[] =
DUMMY_WIN_TEMPLATE
};
// .text
void FieldInitRegionMap(MainCallback callback)
{
SetVBlankCallback(NULL);
@ -145,16 +145,16 @@ static void FieldUpdateRegionMap(void)
{
case 0:
InitRegionMap(&sFieldRegionMapHandler->regionMap, FALSE);
CreateRegionMapPlayerIcon(0, 0);
CreateRegionMapCursor(1, 1);
CreateRegionMapPlayerIcon(TAG_PLAYER_ICON, TAG_PLAYER_ICON);
CreateRegionMapCursor(TAG_CURSOR, TAG_CURSOR);
sFieldRegionMapHandler->state++;
break;
case 1:
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 0x27, 0xd);
DrawStdFrameWithCustomTileAndPalette(WIN_TITLE, FALSE, 0x27, 0xd);
offset = GetStringCenterAlignXOffset(FONT_NORMAL, gText_Hoenn, 0x38);
AddTextPrinterParameterized(1, FONT_NORMAL, gText_Hoenn, offset, 1, 0, NULL);
AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, gText_Hoenn, offset, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x27, 0xd);
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 0x27, 0xd);
PrintRegionMapSecName();
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
sFieldRegionMapHandler->state++;
@ -203,13 +203,13 @@ static void PrintRegionMapSecName(void)
{
if (sFieldRegionMapHandler->regionMap.mapSecType != MAPSECTYPE_NONE)
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, FONT_NORMAL, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_MAPSEC_NAME, FONT_NORMAL, sFieldRegionMapHandler->regionMap.mapSecName, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(WIN_MAPSEC_NAME);
}
else
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
CopyWindowToVram(WIN_MAPSEC_NAME, COPYWIN_FULL);
}
}

View File

@ -46,6 +46,7 @@
#include "wallclock.h"
#include "window.h"
#include "constants/battle_frontier.h"
#include "constants/battle_pyramid.h"
#include "constants/battle_tower.h"
#include "constants/decorations.h"
#include "constants/event_objects.h"
@ -67,6 +68,15 @@
#include "palette.h"
#include "battle_util.h"
#define TAG_ITEM_ICON 5500
#define GFXTAG_MULTICHOICE_SCROLL_ARROWS 2000
#define PALTAG_MULTICHOICE_SCROLL_ARROWS 100
#define ELEVATOR_WINDOW_WIDTH 3
#define ELEVATOR_WINDOW_HEIGHT 3
#define ELEVATOR_LIGHT_STAGES 3
EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
EWRAM_DATA u8 gBikeCollisions = 0;
static EWRAM_DATA u32 sBikeCyclingTimer = 0;
@ -95,8 +105,8 @@ static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8);
static void Task_PetalburgGymSlideOpenRoomDoors(u8);
static void PetalburgGymSetDoorMetatiles(u8, u16);
static void Task_PCTurnOnEffect(u8);
static void PCTurnOnEffect_0(struct Task *);
static void PCTurnOnEffect_1(s16, s8, s8);
static void PCTurnOnEffect(struct Task *);
static void PCTurnOnEffect_SetMetatile(s16, s8, s8);
static void PCTurnOffEffect(void);
static void Task_LotteryCornerComputerEffect(u8);
static void LotteryCornerComputerEffect(struct Task *);
@ -969,34 +979,44 @@ static bool8 IsPlayerInFrontOfPC(void)
|| tileInFront == METATILE_Building_PC_Off);
}
// Task data for Task_PCTurnOnEffect and Task_LotteryCornerComputerEffect
#define tPaused data[0] // Never set
#define tTaskId data[1]
#define tFlickerCount data[2]
#define tTimer data[3]
#define tIsScreenOn data[4]
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
void DoPCTurnOnEffect(void)
{
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE && IsPlayerInFrontOfPC() == TRUE)
{
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = taskId;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[4] = 0;
gTasks[taskId].tPaused = FALSE;
gTasks[taskId].tTaskId = taskId;
gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tIsScreenOn = FALSE;
}
}
static void Task_PCTurnOnEffect(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->data[0] == 0)
PCTurnOnEffect_0(task);
if (!task->tPaused)
PCTurnOnEffect(task);
}
static void PCTurnOnEffect_0(struct Task *task)
static void PCTurnOnEffect(struct Task *task)
{
u8 playerDirection;
s8 dx = 0;
s8 dy = 0;
if (task->data[3] == 6)
if (task->tTimer == 6)
{
task->data[3] = 0;
task->tTimer = 0;
// Get where the PC should be, depending on where the player is looking.
playerDirection = GetPlayerFacingDirection();
switch (playerDirection)
{
@ -1013,39 +1033,47 @@ static void PCTurnOnEffect_0(struct Task *task)
dy = -1;
break;
}
PCTurnOnEffect_1(task->data[4], dx, dy);
// Update map
PCTurnOnEffect_SetMetatile(task->tIsScreenOn, dx, dy);
DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5)
DestroyTask(task->data[1]);
// Screen flickers 5 times. Odd number and starting with the
// screen off means the animation ends with the screen on.
task->tIsScreenOn ^= 1;
if (++task->tFlickerCount == 5)
DestroyTask(task->tTaskId);
}
task->data[3]++;
task->tTimer++;
}
static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
static void PCTurnOnEffect_SetMetatile(s16 isScreenOn, s8 dx, s8 dy)
{
u16 tileId = 0;
if (isPcTurnedOn)
u16 metatileId = 0;
if (isScreenOn)
{
// Screen is on, set it off
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off;
metatileId = METATILE_Building_PC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
}
else
{
// Screen is off, set it on
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_On;
metatileId = METATILE_Building_PC_On;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_On;
metatileId = METATILE_BrendansMaysHouse_BrendanPC_On;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_On;
metatileId = METATILE_BrendansMaysHouse_MayPC_On;
}
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
}
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
void DoPCTurnOffEffect(void)
{
PCTurnOffEffect();
@ -1055,7 +1083,9 @@ static void PCTurnOffEffect(void)
{
s8 dx = 0;
s8 dy = 0;
u16 tileId = 0;
u16 metatileId = 0;
// Get where the PC should be, depending on where the player is looking.
u8 playerDirection = GetPlayerFacingDirection();
if (IsPlayerInFrontOfPC() == FALSE)
@ -1075,13 +1105,15 @@ static void PCTurnOffEffect(void)
dy = -1;
break;
}
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
tileId = METATILE_Building_PC_Off;
metatileId = METATILE_Building_PC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
DrawWholeMapView();
}
@ -1090,42 +1122,47 @@ void DoLotteryCornerComputerEffect(void)
if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE)
{
u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = taskId;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[4] = 0;
gTasks[taskId].tPaused = FALSE;
gTasks[taskId].tTaskId = taskId;
gTasks[taskId].tFlickerCount = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tIsScreenOn = FALSE;
}
}
static void Task_LotteryCornerComputerEffect(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->data[0] == 0)
if (!task->tPaused)
LotteryCornerComputerEffect(task);
}
static void LotteryCornerComputerEffect(struct Task *task)
{
if (task->data[3] == 6)
if (task->tTimer == 6)
{
task->data[3] = 0;
if (task->data[4] != 0)
task->tTimer = 0;
if (task->tIsScreenOn)
{
// Screen is on, set it off
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
}
else
{
// Screen is off, set it on
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK);
}
DrawWholeMapView();
task->data[4] ^= 1;
if ((++task->data[2]) == 5)
DestroyTask(task->data[1]);
// Screen flickers 5 times. Odd number and starting with the
// screen off means the animation ends with the screen on.
task->tIsScreenOn ^= 1;
if (++task->tFlickerCount == 5)
DestroyTask(task->tTaskId);
}
task->data[3]++;
task->tTimer++;
}
void EndLotteryCornerComputerEffect(void)
@ -1135,6 +1172,12 @@ void EndLotteryCornerComputerEffect(void)
DrawWholeMapView();
}
#undef tPaused
#undef tTaskId
#undef tFlickerCount
#undef tTimer
#undef tIsScreenOn
void SetTrickHouseNuggetFlag(void)
{
u16 *specVar = &gSpecialVar_0x8004;
@ -1219,7 +1262,7 @@ void SpawnCameraObject(void)
OBJ_EVENT_ID_CAMERA,
gSaveBlock1Ptr->pos.x + MAP_OFFSET,
gSaveBlock1Ptr->pos.y + MAP_OFFSET,
3);
3); // elevation
gObjectEvents[obj].invisible = TRUE;
CameraObjectSetFollowedSpriteId(gObjectEvents[obj].spriteId);
}
@ -1384,7 +1427,7 @@ void SetShoalItemFlag(u16 unused)
FlagSet(FLAG_SYS_SHOAL_ITEM);
}
void PutZigzagoonInPlayerParty(void)
void LoadWallyZigzagoon(void)
{
u16 monData;
CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);
@ -1424,20 +1467,21 @@ bool8 IsPokerusInParty(void)
return TRUE;
}
#define horizontalPan data[0]
#define delayCounter data[1]
#define numShakes data[2]
#define delay data[3]
#define verticalPan data[4]
// Task data for Task_ShakeCamera
#define tHorizontalPan data[0]
#define tDelayCounter data[1]
#define tNumShakes data[2]
#define tDelay data[3]
#define tVerticalPan data[4]
void ShakeCamera(void)
{
u8 taskId = CreateTask(Task_ShakeCamera, 9);
gTasks[taskId].horizontalPan = gSpecialVar_0x8005;
gTasks[taskId].delayCounter = 0;
gTasks[taskId].numShakes = gSpecialVar_0x8006;
gTasks[taskId].delay = gSpecialVar_0x8007;
gTasks[taskId].verticalPan = gSpecialVar_0x8004;
gTasks[taskId].tHorizontalPan = gSpecialVar_0x8005;
gTasks[taskId].tDelayCounter = 0;
gTasks[taskId].tNumShakes = gSpecialVar_0x8006;
gTasks[taskId].tDelay = gSpecialVar_0x8007;
gTasks[taskId].tVerticalPan = gSpecialVar_0x8004;
SetCameraPanningCallback(NULL);
PlaySE(SE_M_STRENGTH);
}
@ -1446,15 +1490,15 @@ static void Task_ShakeCamera(u8 taskId)
{
s16 *data = gTasks[taskId].data;
delayCounter++;
if (delayCounter % delay == 0)
tDelayCounter++;
if (tDelayCounter % tDelay == 0)
{
delayCounter = 0;
numShakes--;
horizontalPan = -horizontalPan;
verticalPan = -verticalPan;
SetCameraPanning(horizontalPan, verticalPan);
if (numShakes == 0)
tDelayCounter = 0;
tNumShakes--;
tHorizontalPan = -tHorizontalPan;
tVerticalPan = -tVerticalPan;
SetCameraPanning(tHorizontalPan, tVerticalPan);
if (tNumShakes == 0)
{
StopCameraShake(taskId);
InstallCameraPanAheadCallback();
@ -1468,11 +1512,11 @@ static void StopCameraShake(u8 taskId)
ScriptContext_Enable();
}
#undef horizontalPan
#undef delayCounter
#undef numShakes
#undef delay
#undef verticalPan
#undef tHorizontalPan
#undef tDelayCounter
#undef tNumShakes
#undef tDelay
#undef tVerticalPan
bool8 FoundBlackGlasses(void)
{
@ -1497,7 +1541,8 @@ u8 GetLeadMonIndex(void)
u8 partyCount = CalculatePlayerPartyCount();
for (i = 0; i < partyCount; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0)
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_NONE)
return i;
}
return 0;
@ -1637,7 +1682,7 @@ void OffsetCameraForBattle(void)
SetCameraPanning(8, 0);
}
const struct WindowTemplate gElevatorFloor_WindowTemplate =
static const struct WindowTemplate sWindowTemplate_ElevatorFloor =
{
.bg = 0,
.tilemapLeft = 21,
@ -1648,7 +1693,7 @@ const struct WindowTemplate gElevatorFloor_WindowTemplate =
.baseBlock = 8,
};
const u8 *const gDeptStoreFloorNames[] =
static const u8 *const sDeptStoreFloorNames[] =
{
[DEPT_STORE_FLOORNUM_B4F] = gText_B4F,
[DEPT_STORE_FLOORNUM_B3F] = gText_B3F,
@ -1668,7 +1713,7 @@ const u8 *const gDeptStoreFloorNames[] =
[DEPT_STORE_FLOORNUM_ROOFTOP] = gText_Rooftop
};
static const u16 sElevatorWindowTiles_Ascending[][3] =
static const u16 sElevatorWindowTiles_Ascending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
{
{
METATILE_BattleFrontier_Elevator_Top0,
@ -1687,7 +1732,7 @@ static const u16 sElevatorWindowTiles_Ascending[][3] =
},
};
static const u16 sElevatorWindowTiles_Descending[][3] =
static const u16 sElevatorWindowTiles_Descending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
{
{
METATILE_BattleFrontier_Elevator_Top0,
@ -1771,53 +1816,66 @@ u16 GetDeptStoreDefaultFloorChoice(void)
return sLilycoveDeptStore_DefaultFloorChoice;
}
// Task data for Task_MoveElevator
#define tTimer data[1]
#define tMoveCounter data[2]
#define tVerticalPan data[4]
#define tTotalMoves data[5]
#define tDescending data[6]
// The maximum considered difference between floors.
// Elevator trips with a larger difference are treated the same
// (i.e. traveling 9 floors and 200 floors would take the same amount of time).
#define MAX_ELEVATOR_TRIP 9
// gSpecialVar_0x8005 here is expected to be the current floor number, and
// gSpecialVar_0x8006 is expected to be the destination floor number.
void MoveElevator(void)
{
static const u8 sElevatorTripLength[] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 };
static const u8 sElevatorTripLength[MAX_ELEVATOR_TRIP] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 };
s16 *data = gTasks[CreateTask(Task_MoveElevator, 9)].data;
u16 floorDelta;
data[1] = 0;
data[2] = 0;
data[4] = 1;
tTimer = 0;
tMoveCounter = 0;
tVerticalPan = 1;
// descending
if (gSpecialVar_0x8005 > gSpecialVar_0x8006)
{
floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006;
data[6] = TRUE;
tDescending = TRUE;
}
else
{
floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005;
data[6] = FALSE;
tDescending = FALSE;
}
if (floorDelta > 8)
floorDelta = 8;
if (floorDelta > MAX_ELEVATOR_TRIP - 1)
floorDelta = MAX_ELEVATOR_TRIP - 1;
data[5] = sElevatorTripLength[floorDelta];
tTotalMoves = sElevatorTripLength[floorDelta];
SetCameraPanningCallback(NULL);
MoveElevatorWindowLights(floorDelta, data[6]);
MoveElevatorWindowLights(floorDelta, tDescending);
PlaySE(SE_ELEVATOR);
}
static void Task_MoveElevator(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[1]++;
if (data[1] % 3 == 0)
tTimer++;
if (tTimer % 3 == 0)
{
data[1] = 0;
data[2]++;
data[4] = -data[4];
SetCameraPanning(0, data[4]);
tTimer = 0;
tMoveCounter++;
tVerticalPan = -tVerticalPan;
SetCameraPanning(0, tVerticalPan);
// arrived at floor
if (data[2] == data[5])
if (tMoveCounter == tTotalMoves)
{
// Arrived at floor
PlaySE(SE_DING_DONG);
DestroyTask(taskId);
ScriptContext_Enable();
@ -1826,18 +1884,24 @@ static void Task_MoveElevator(u8 taskId)
}
}
#undef tTimer
#undef tMoveCounter
#undef tVerticalPan
#undef tTotalMoves
#undef tDescending
void ShowDeptStoreElevatorFloorSelect(void)
{
int xPos;
sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate);
sTutorMoveAndElevatorWindowId = AddWindow(&sWindowTemplate_ElevatorFloor);
SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, FALSE);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SKIP_DRAW, NULL);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], 64);
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
PutWindowTilemap(sTutorMoveAndElevatorWindowId);
CopyWindowToVram(sTutorMoveAndElevatorWindowId, COPYWIN_FULL);
@ -1849,17 +1913,23 @@ void CloseDeptStoreElevatorWindow(void)
RemoveWindow(sTutorMoveAndElevatorWindowId);
}
// Task data for Task_MoveElevatorWindowLights
#define tMoveCounter data[0]
#define tTimer data[1]
#define tDescending data[2]
#define tTotalMoves data[3]
static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending)
{
static const u8 sElevatorLightCycles[] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 };
static const u8 sElevatorLightCycles[MAX_ELEVATOR_TRIP] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 };
if (FuncIsActiveTask(Task_MoveElevatorWindowLights) != TRUE)
{
u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = descending;
gTasks[taskId].data[3] = sElevatorLightCycles[floorDelta];
gTasks[taskId].tMoveCounter = 0;
gTasks[taskId].tTimer = 0;
gTasks[taskId].tDescending = descending;
gTasks[taskId].tTotalMoves = sElevatorLightCycles[floorDelta];
}
}
@ -1868,36 +1938,41 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
u8 x, y;
s16 *data = gTasks[taskId].data;
if (data[1] == 6)
if (tTimer == 6)
{
data[0]++;
tMoveCounter++;
// ascending
if (data[2] == FALSE)
if (!tDescending)
{
for (y = 0; y < 3; y++)
// Ascending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{
for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
}
}
// descending
else
{
for (y = 0; y < 3; y++)
// Descending
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
{
for (x = 0; x < 3; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
}
}
DrawWholeMapView();
data[1] = 0;
if (data[0] == data[3])
tTimer = 0;
if (tMoveCounter == tTotalMoves)
DestroyTask(taskId);
}
data[1]++;
tTimer++;
}
#undef tMoveCounter
#undef tTimer
#undef tDescending
#undef tTotalMoves
void BufferVarsForIVRater(void)
{
u8 i;
@ -1959,13 +2034,13 @@ bool8 UsedPokemonCenterWarp(void)
MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F,
MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F,
MAP_UNION_ROOM,
0xFFFF
MAP_UNDEFINED
};
int i;
u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
{
if (sPokemonCenters[i] == map)
return TRUE;
@ -2663,21 +2738,21 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
.secondY = 0,
.fullyUpThreshold = 0,
.fullyDownThreshold = 0,
.tileTag = 2000,
.palTag = 100,
.tileTag = GFXTAG_MULTICHOICE_SCROLL_ARROWS,
.palTag = PALTAG_MULTICHOICE_SCROLL_ARROWS,
.palNum = 0
};
struct Task *task = &gTasks[taskId];
struct ScrollArrowsTemplate template = sScrollableMultichoice_ScrollArrowsTemplate;
if (task->tMaxItemsOnScreen != task->data[1])
if (task->tMaxItemsOnScreen != task->tNumItems)
{
template.firstX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
template.firstY = 8;
template.secondX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
template.secondY = task->tHeight * 8 + 10;
template.fullyUpThreshold = 0;
template.fullyDownThreshold = task->data[1] - task->tMaxItemsOnScreen;
template.fullyDownThreshold = task->tNumItems - task->tMaxItemsOnScreen;
task->tScrollArrowId = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset);
}
}
@ -2685,10 +2760,8 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (task->tMaxItemsOnScreen != task->data[1])
{
if (task->tMaxItemsOnScreen != task->tNumItems)
RemoveScrollIndicatorArrowPair(task->tScrollArrowId);
}
}
// Removed for Emerald (replaced by ShowScrollableMultichoice)
@ -2912,8 +2985,6 @@ void CloseFrontierExchangeCornerItemIconWindow(void)
RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId);
}
#define TAG_ITEM_ICON 5500
static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{
#include "data/battle_frontier/battle_frontier_exchange_corner.h"
@ -3125,12 +3196,14 @@ void ScrollableMultichoice_ClosePersistentMenu(void)
#undef tListTaskId
#undef tTaskId
#define DEOXYS_ROCK_LEVELS 11
void DoDeoxysRockInteraction(void)
{
CreateTask(Task_DeoxysRockInteraction, 8);
}
static const u16 sDeoxysRockPalettes[][16] = {
static const u16 sDeoxysRockPalettes[DEOXYS_ROCK_LEVELS][16] = {
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_1.gbapal"),
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_2.gbapal"),
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_3.gbapal"),
@ -3144,7 +3217,7 @@ static const u16 sDeoxysRockPalettes[][16] = {
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_11.gbapal"),
};
static const u8 sDeoxysRockCoords[][2] = {
static const u8 sDeoxysRockCoords[DEOXYS_ROCK_LEVELS][2] = {
{ 15, 12 },
{ 11, 14 },
{ 15, 8 },
@ -3160,11 +3233,11 @@ static const u8 sDeoxysRockCoords[][2] = {
static void Task_DeoxysRockInteraction(u8 taskId)
{
static const u8 sStoneMaxStepCounts[] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
static const u8 sStoneMaxStepCounts[DEOXYS_ROCK_LEVELS - 1] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE)
{
gSpecialVar_Result = 3;
gSpecialVar_Result = DEOXYS_ROCK_COMPLETE;
ScriptContext_Enable();
DestroyTask(taskId);
}
@ -3179,13 +3252,13 @@ static void Task_DeoxysRockInteraction(u8 taskId)
// Player failed to take the shortest path to the stone, so it resets.
ChangeDeoxysRockLevel(0);
VarSet(VAR_DEOXYS_ROCK_LEVEL, 0);
gSpecialVar_Result = 0;
gSpecialVar_Result = DEOXYS_ROCK_FAILED;
DestroyTask(taskId);
}
else if (rockLevel == 10)
else if (rockLevel == DEOXYS_ROCK_LEVELS - 1)
{
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
gSpecialVar_Result = 2;
gSpecialVar_Result = DEOXYS_ROCK_SOLVED;
ScriptContext_Enable();
DestroyTask(taskId);
}
@ -3194,7 +3267,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
rockLevel++;
ChangeDeoxysRockLevel(rockLevel);
VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel);
gSpecialVar_Result = 1;
gSpecialVar_Result = DEOXYS_ROCK_PROGRESSED;
DestroyTask(taskId);
}
}
@ -3207,9 +3280,9 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
if (rockLevel == 0)
PlaySE(SE_M_CONFUSE_RAY);
PlaySE(SE_M_CONFUSE_RAY); // Failure sound
else
PlaySE(SE_RG_DEOXYS_MOVE);
PlaySE(SE_RG_DEOXYS_MOVE); // Success sound
CreateTask(WaitForDeoxysRockMovement, 8);
gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK;
@ -3218,6 +3291,8 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0];
gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1];
// Set number of movement steps.
// Resetting for failure is slow, successful movement is fast.
if (rockLevel == 0)
gFieldEffectArguments[5] = 60;
else
@ -3735,8 +3810,9 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
void GetBattlePyramidHint(void)
{
gSpecialVar_Result = gSpecialVar_0x8004 / 7;
gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20;
// gSpecialVar_0x8004 here is expected to be the current Battle Pyramid win streak.
gSpecialVar_Result = gSpecialVar_0x8004 / FRONTIER_STAGES_PER_CHALLENGE;
gSpecialVar_Result -= (gSpecialVar_Result / TOTAL_PYRAMID_ROUNDS) * TOTAL_PYRAMID_ROUNDS;
}
// Used to avoid a potential softlock if the player respawns on Dewford with no way off
@ -3771,13 +3847,13 @@ bool8 InPokemonCenter(void)
MAP_TRADE_CENTER,
MAP_RECORD_CORNER,
MAP_BATTLE_COLOSSEUM_4P,
0xFFFF
MAP_UNDEFINED
};
int i;
u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum;
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
{
if (sPokemonCenters[i] == map)
return TRUE;

View File

@ -30,6 +30,17 @@
#include "constants/region_map_sections.h"
#include "constants/songs.h"
// gFrontierPassBg_Pal has 8*16 colors, but they attempt to load 13*16 colors.
// As a result it goes out of bounds and interprets 160 bytes of whatever comes
// after gFrontierPassBg_Pal (by default, gFrontierPassBg_Gfx) as a palette.
// Nothing uses these colors (except the Trainer Card, which correctly writes them)
// so in practice this bug has no effect on the game.
#ifdef BUGFIX
#define NUM_BG_PAL_SLOTS 8
#else
#define NUM_BG_PAL_SLOTS 13
#endif
// All windows displayed in the frontier pass.
enum
{
@ -768,7 +779,7 @@ static bool32 InitFrontierPass(void)
CopyBgTilemapBufferToVram(2);
break;
case 8:
LoadPalette(gFrontierPassBg_Pal[0], 0, 13 * PLTT_SIZE_4BPP);
LoadPalette(gFrontierPassBg_Pal, 0, NUM_BG_PAL_SLOTS * PLTT_SIZE_4BPP);
LoadPalette(gFrontierPassBg_Pal[1 + sPassData->trainerStars], BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
DrawFrontierPassBg();
@ -1412,7 +1423,7 @@ static bool32 InitFrontierMap(void)
case 5:
if (FreeTempTileDataBuffersIfPossible())
return FALSE;
LoadPalette(gFrontierPassBg_Pal[0], BG_PLTT_ID(0), 13 * PLTT_SIZE_4BPP);
LoadPalette(gFrontierPassBg_Pal, BG_PLTT_ID(0), NUM_BG_PAL_SLOTS * PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
CopyToBgTilemapBuffer(2, sMapScreen_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2);

View File

@ -1381,6 +1381,7 @@ const u32 gBattleAnimBgTilemap_GigaImpactPlayer[] = INCBIN_U32("graphics/battle_
const u32 gBattleAnimBgTilemap_GigaImpactOpponent[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_opponent.bin.lz");
const u32 gBattleAnimBgTilemap_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_contest.bin.lz");
const u32 gBattleAnimBgImage_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.4bpp.lz");
const u32 gBattleAnimBgImage_GigaImpactContest[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact_contest.4bpp.lz");
const u32 gBattleAnimBgPalette_GigaImpact[] = INCBIN_U32("graphics/battle_anims/backgrounds/giga_impact.gbapal.lz");
const u32 gBattleAnimBgImage_SpacialRend[] = INCBIN_U32("graphics/battle_anims/backgrounds/spacial_rend.4bpp.lz");
@ -2012,7 +2013,6 @@ const u16 gTitleScreenPressStartPal[] = INCBIN_U16("graphics/title_screen/p
const u32 gTitleScreenPressStartGfx[] = INCBIN_U32("graphics/title_screen/press_start.4bpp.lz");
const u32 gTitleScreenPokemonLogoTilemap[] = INCBIN_U32("graphics/title_screen/pokemon_logo.bin.lz");
// size in LoadPalette calls is reported as 0xD0 << 1, which is 0x1A0, but palette is only 0x100 bytes long so it loads garbage as well
const u16 gFrontierPassBg_Pal[][16] = INCBIN_U16("graphics/frontier_pass/bg.gbapal");
const u32 gFrontierPassBg_Gfx[] = INCBIN_U32("graphics/frontier_pass/bg.4bpp.lz");
const u32 gFrontierPassMapAndCard_Gfx[] = INCBIN_U32("graphics/frontier_pass/map_and_card.8bpp.lz");

View File

@ -23,6 +23,7 @@
#include "sound.h"
#include "util.h"
#include "title_screen.h"
#include "expansion_intro.h"
#include "constants/rgb.h"
#include "constants/battle_anim.h"
@ -37,7 +38,6 @@
*/
// Scene 1 main tasks
static void Task_Scene1_Load(u8);
static void Task_Scene1_FadeIn(u8);
static void Task_Scene1_WaterDrops(u8);
static void Task_Scene1_PanUp(u8);
@ -1033,7 +1033,7 @@ static void VBlankCB_Intro(void)
ScanlineEffect_InitHBlankDmaTransfer();
}
static void MainCB2_Intro(void)
void MainCB2_Intro(void)
{
RunTasks();
AnimateSprites();
@ -1112,8 +1112,13 @@ static u8 SetUpCopyrightScreen(void)
case 141:
if (UpdatePaletteFade())
break;
#if EXPANSION_INTRO == TRUE
SetMainCallback2(CB2_ExpansionIntro);
CreateTask(Task_HandleExpansionIntro, 0);
#else
CreateTask(Task_Scene1_Load, 0);
SetMainCallback2(MainCB2_Intro);
#endif
if (gMultibootProgramStruct.gcmb_field_2 != 0)
{
if (gMultibootProgramStruct.gcmb_field_2 == 2)
@ -1160,7 +1165,7 @@ void CB2_InitCopyrightScreenAfterTitleScreen(void)
#define sBigDropSpriteId data[0]
static void Task_Scene1_Load(u8 taskId)
void Task_Scene1_Load(u8 taskId)
{
SetVBlankCallback(NULL);
sIntroCharacterGender = Random() & 1;

View File

@ -15,18 +15,14 @@
#include "constants/items.h"
#include "constants/hold_effects.h"
// this file's functions
static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count);
static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count);
// EWRAM variables
EWRAM_DATA struct BagPocket gBagPockets[POCKETS_COUNT] = {0};
// rodata
#include "data/text/item_descriptions.h"
#include "data/items.h"
// code
static u16 GetBagItemQuantity(u16 *quantity)
{
return gSaveBlock2Ptr->encryptionKey ^ *quantity;

View File

@ -28,6 +28,13 @@
#include "constants/rgb.h"
#include "constants/trade.h"
// Window IDs for the link error screens
enum {
WIN_LINK_ERROR_TOP,
WIN_LINK_ERROR_MID,
WIN_LINK_ERROR_BOTTOM,
};
struct BlockTransfer
{
u16 pos;
@ -193,8 +200,9 @@ static const struct BgTemplate sLinkErrorBgTemplates[] = {
.priority = 1
}
};
static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
{
[WIN_LINK_ERROR_TOP] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
@ -202,7 +210,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.height = 5,
.paletteNum = 15,
.baseBlock = 0x002
}, {
},
[WIN_LINK_ERROR_MID] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 6,
@ -210,7 +219,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.height = 7,
.paletteNum = 15,
.baseBlock = 0x098
}, {
},
[WIN_LINK_ERROR_BOTTOM] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@ -1641,26 +1651,26 @@ static void ErrorMsg_MoveCloserToPartner(void)
CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
LoadPalette(sWirelessLinkDisplayPal, 0, 0x20);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);
AddTextPrinterParameterized3(2, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner);
PutWindowTilemap(0);
PutWindowTilemap(2);
CopyWindowToVram(0, COPYWIN_NONE); // Does nothing
CopyWindowToVram(2, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_LINK_ERROR_TOP, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0));
AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);
AddTextPrinterParameterized3(WIN_LINK_ERROR_BOTTOM, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner);
PutWindowTilemap(WIN_LINK_ERROR_TOP);
PutWindowTilemap(WIN_LINK_ERROR_BOTTOM);
CopyWindowToVram(WIN_LINK_ERROR_TOP, COPYWIN_NONE); // Does nothing
CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL);
}
static void ErrorMsg_CheckConnections(void)
{
LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(1, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections);
PutWindowTilemap(1);
PutWindowTilemap(2);
CopyWindowToVram(1, COPYWIN_NONE); // Does nothing
CopyWindowToVram(2, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_LINK_ERROR_MID, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0));
AddTextPrinterParameterized3(WIN_LINK_ERROR_MID, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections);
PutWindowTilemap(WIN_LINK_ERROR_MID);
PutWindowTilemap(WIN_LINK_ERROR_BOTTOM);
CopyWindowToVram(WIN_LINK_ERROR_MID, COPYWIN_NONE); // Does nothing
CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL);
}
static void CB2_PrintErrorMessage(void)
@ -1691,9 +1701,9 @@ static void CB2_PrintErrorMessage(void)
break;
case 130:
if (gWirelessCommType == 2)
AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnTitleScreen);
AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnTitleScreen);
else if (gWirelessCommType == 1)
AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter);
AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter);
break;
}
if (gMain.state == 160)

View File

@ -677,7 +677,7 @@ void InitHostRfuGameData(struct RfuGameData *data, u8 activity, bool32 startedAc
data->compatibility.hasNews = FALSE;
data->compatibility.hasCard = FALSE;
data->compatibility.unknown = FALSE;
data->compatibility.isChampion = FlagGet(FLAG_IS_CHAMPION);
data->compatibility.canLinkNationally = FlagGet(FLAG_IS_CHAMPION);
data->compatibility.hasNationalDex = IsNationalPokedexEnabled();
data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}

View File

@ -503,7 +503,9 @@ static const u8 *const sFemalePresetNames[] = {
gText_DefaultNameHalie
};
// .text
// The number of male vs. female names is assumed to be the same.
// If they aren't, the smaller of the two sizes will be used and any extra names will be ignored.
#define NUM_PRESET_NAMES min(ARRAY_COUNT(sMalePresetNames), ARRAY_COUNT(sFemalePresetNames))
enum
{
@ -1597,7 +1599,7 @@ static void Task_NewGameBirchSpeech_StartNamingScreen(u8 taskId)
{
FreeAllWindowBuffers();
FreeAndDestroyMonPicSprite(gTasks[taskId].tLotadSpriteId);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20);
NewGameBirchSpeech_SetDefaultPlayerName(Random() % NUM_PRESET_NAMES);
DestroyTask(taskId);
DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_NewGameBirchSpeech_ReturnFromNamingScreen);
}

View File

@ -106,10 +106,9 @@ static const u8 sConditionToLineLength[MAX_CONDITION + 1] =
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35
};
static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
{
{
[RELEARNERWIN_DESC_BATTLE] = {
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -118,7 +117,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0xA
},
{
[RELEARNERWIN_DESC_CONTEST] = {
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -127,7 +126,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0xCA
},
{
[RELEARNERWIN_MOVE_LIST] = {
.bg = 1,
.tilemapLeft = 19,
.tilemapTop = 1,
@ -136,7 +135,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x18A
},
{
[RELEARNERWIN_MSG] = {
.bg = 1,
.tilemapLeft = 4,
.tilemapTop = 15,
@ -145,7 +144,8 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x202
},
{
// Unused. Identical to sMoveRelearnerYesNoMenuTemplate
[RELEARNERWIN_YESNO] = {
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 8,
@ -176,7 +176,7 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
.itemPrintFunc = NULL,
.totalItems = 0,
.maxShowed = 0,
.windowId = 2,
.windowId = RELEARNERWIN_MOVE_LIST,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -702,7 +702,7 @@ void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions)
// Move relearner
//----------------
void InitMoveRelearnerWindows(bool8 useContextWindow)
void InitMoveRelearnerWindows(bool8 useContestWindow)
{
u8 i;
@ -714,20 +714,20 @@ void InitMoveRelearnerWindows(bool8 useContextWindow)
for (i = 0; i < ARRAY_COUNT(sMoveRelearnerWindowTemplates) - 1; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(1));
if (!useContextWindow)
if (!useContestWindow)
{
PutWindowTilemap(0);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x1, 0xE);
PutWindowTilemap(RELEARNERWIN_DESC_BATTLE);
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_DESC_BATTLE, FALSE, 0x1, 0xE);
}
else
{
PutWindowTilemap(1);
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 1, 0xE);
PutWindowTilemap(RELEARNERWIN_DESC_CONTEST);
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_DESC_CONTEST, FALSE, 1, 0xE);
}
PutWindowTilemap(2);
PutWindowTilemap(3);
DrawStdFrameWithCustomTileAndPalette(2, FALSE, 1, 0xE);
DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 0xE);
PutWindowTilemap(RELEARNERWIN_MOVE_LIST);
PutWindowTilemap(RELEARNERWIN_MSG);
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_MOVE_LIST, FALSE, 1, 0xE);
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_MSG, FALSE, 1, 0xE);
MoveRelearnerDummy();
ScheduleBgCopyTilemapToVram(1);
}
@ -758,33 +758,34 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
u8 buffer[32];
const u8 *str;
FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillWindowPixelBuffer(RELEARNERWIN_DESC_BATTLE, PIXEL_FILL(1));
str = gText_MoveRelearnerBattleMoves;
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 128);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
str = gText_MoveRelearnerPP;
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x29, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 4, 41, TEXT_SKIP_DRAW, NULL);
str = gText_MoveRelearnerPower;
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 106);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 25, TEXT_SKIP_DRAW, NULL);
str = gText_MoveRelearnerAccuracy;
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 106);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 41, TEXT_SKIP_DRAW, NULL);
if (chosenMove == LIST_CANCEL)
{
CopyWindowToVram(0, COPYWIN_GFX);
// On "Cancel", skip printing move data
CopyWindowToVram(RELEARNERWIN_DESC_BATTLE, COPYWIN_GFX);
return;
}
move = &gBattleMoves[chosenMove];
str = gTypeNames[move->type];
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 4, 25, TEXT_SKIP_DRAW, NULL);
x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0);
ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2);
AddTextPrinterParameterized(0, FONT_NORMAL, buffer, x, 0x29, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, buffer, x, 41, TEXT_SKIP_DRAW, NULL);
if (move->power < 2)
{
@ -795,7 +796,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3);
str = buffer;
}
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x19, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 106, 25, TEXT_SKIP_DRAW, NULL);
if (move->accuracy == 0)
{
@ -806,14 +807,14 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3);
str = buffer;
}
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 106, 41, TEXT_SKIP_DRAW, NULL);
if (move->effect != EFFECT_PLACEHOLDER)
str = gMoveDescriptionPointers[chosenMove - 1];
else
str = gNotDoneYetDescription;
AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NARROW, str, 0, 65, 0, NULL);
}
static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
@ -823,33 +824,33 @@ static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
const struct ContestMove *move;
MoveRelearnerShowHideHearts(chosenMove);
FillWindowPixelBuffer(1, PIXEL_FILL(1));
FillWindowPixelBuffer(RELEARNERWIN_DESC_CONTEST, PIXEL_FILL(1));
str = gText_MoveRelearnerContestMovesTitle;
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 128);
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
str = gText_MoveRelearnerAppeal;
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 92);
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 25, TEXT_SKIP_DRAW, NULL);
str = gText_MoveRelearnerJam;
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 92);
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 41, TEXT_SKIP_DRAW, NULL);
if (chosenMove == MENU_NOTHING_CHOSEN)
{
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(RELEARNERWIN_DESC_CONTEST, COPYWIN_GFX);
return;
}
move = &gContestMoves[chosenMove];
str = gContestMoveTypeTextPointers[move->contestCategory];
AddTextPrinterParameterized(1, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, 4, 25, TEXT_SKIP_DRAW, NULL);
str = gContestEffectDescriptionPointers[move->effect];
AddTextPrinterParameterized(1, FONT_NARROW, str, 0, 0x41, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NARROW, str, 0, 65, TEXT_SKIP_DRAW, NULL);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(RELEARNERWIN_DESC_CONTEST, COPYWIN_GFX);
}
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list)
@ -860,20 +861,20 @@ static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct List
MoveRelearnerMenuLoadContestMoveDescription(itemIndex);
}
void MoveRelearnerPrintText(u8 *str)
void MoveRelearnerPrintMessage(u8 *str)
{
u8 speed;
FillWindowPixelBuffer(3, PIXEL_FILL(1));
FillWindowPixelBuffer(RELEARNERWIN_MSG, PIXEL_FILL(1));
gTextFlags.canABSpeedUpPrint = TRUE;
speed = GetPlayerTextSpeedDelay();
AddTextPrinterParameterized2(3, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3);
AddTextPrinterParameterized2(RELEARNERWIN_MSG, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3);
}
bool16 MoveRelearnerRunTextPrinters(void)
{
RunTextPrinters();
return IsTextPrinterActive(3);
return IsTextPrinterActive(RELEARNERWIN_MSG);
}
void MoveRelearnerCreateYesNoMenu(void)

View File

@ -142,7 +142,7 @@ static s32 mini_strlen(const char *s)
return len;
}
static s32 mini_itoa(u32 value, u32 radix, s32 uppercase, bool32 unsig, char *buffer)
static s32 mini_itoa(s32 value, u32 radix, s32 uppercase, bool32 unsig, char *buffer)
{
char *pbuffer = buffer;
s32 negative = 0;

View File

@ -465,10 +465,10 @@ static void CB2_MoveRelearnerMain(void)
UpdatePaletteFade();
}
static void FormatAndPrintText(const u8 *src)
static void PrintMessageWithPlaceholders(const u8 *src)
{
StringExpandPlaceholders(gStringVar4, src);
MoveRelearnerPrintText(gStringVar4);
MoveRelearnerPrintMessage(gStringVar4);
}
// See the state machine doc at the top of the file.
@ -522,7 +522,7 @@ static void DoMoveRelearnerMain(void)
{
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != MON_HAS_MAX_MOVES)
{
FormatAndPrintText(gText_MoveRelearnerPkmnLearnedMove);
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnLearnedMove);
gSpecialVar_0x8004 = TRUE;
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
}
@ -574,7 +574,7 @@ static void DoMoveRelearnerMain(void)
}
break;
case MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT:
FormatAndPrintText(gText_MoveRelearnerPkmnTryingToLearnMove);
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnTryingToLearnMove);
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_WAIT_FOR_TRYING_TO_LEARN:
@ -590,7 +590,7 @@ static void DoMoveRelearnerMain(void)
if (selection == 0)
{
FormatAndPrintText(gText_MoveRelearnerWhichMoveToForget);
PrintMessageWithPlaceholders(gText_MoveRelearnerWhichMoveToForget);
sMoveRelearnerStruct->state = MENU_STATE_PRINT_WHICH_MOVE_PROMPT;
}
else if (selection == MENU_B_PRESSED || selection == 1)
@ -601,7 +601,7 @@ static void DoMoveRelearnerMain(void)
break;
case MENU_STATE_PRINT_STOP_TEACHING:
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
FormatAndPrintText(gText_MoveRelearnerStopTryingToTeachMove);
PrintMessageWithPlaceholders(gText_MoveRelearnerStopTryingToTeachMove);
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_WAIT_FOR_STOP_TEACHING:
@ -637,7 +637,7 @@ static void DoMoveRelearnerMain(void)
case MENU_STATE_CHOOSE_SETUP_STATE:
if (!MoveRelearnerRunTextPrinters())
{
FillWindowPixelBuffer(3, 0x11);
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
@ -694,7 +694,7 @@ static void DoMoveRelearnerMain(void)
ShowTeachMoveText(TRUE);
}
RemoveScrollArrows();
CopyWindowToVram(3, COPYWIN_GFX);
CopyWindowToVram(RELEARNERWIN_MSG, COPYWIN_GFX);
break;
case MENU_STATE_TRY_OVERWRITE_MOVE:
if (!gPaletteFade.active)
@ -711,7 +711,7 @@ static void DoMoveRelearnerMain(void)
RemoveMonPPBonus(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->moveSlot);
SetMonMoveSlot(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove(), sMoveRelearnerStruct->moveSlot);
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
FormatAndPrintText(gText_MoveRelearnerAndPoof);
PrintMessageWithPlaceholders(gText_MoveRelearnerAndPoof);
sMoveRelearnerStruct->state = MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE;
gSpecialVar_0x8004 = TRUE;
}
@ -720,7 +720,7 @@ static void DoMoveRelearnerMain(void)
case MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE:
if (!MoveRelearnerRunTextPrinters())
{
FormatAndPrintText(gText_MoveRelearnerPkmnForgotMoveAndLearnedNew);
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnForgotMoveAndLearnedNew);
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
PlayFanfare(MUS_LEVEL_UP);
}
@ -765,15 +765,13 @@ static void HideHeartSpritesAndShowTeachMoveText(bool8 onlyHideSprites)
s32 i;
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
if (!onlyHideSprites)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, 0x11);
AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
AddTextPrinterParameterized(RELEARNERWIN_MSG, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
}
}
@ -786,21 +784,19 @@ static void HandleInput(bool8 showContest)
{
case LIST_NOTHING_CHOSEN:
if (!(JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
{
break;
}
PlaySE(SE_SELECT);
if (showContest == FALSE)
{
PutWindowTilemap(1);
PutWindowTilemap(RELEARNERWIN_DESC_CONTEST);
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
sMoveRelearnerMenuSate.showContestInfo = TRUE;
}
else
{
PutWindowTilemap(0);
PutWindowTilemap(RELEARNERWIN_DESC_BATTLE);
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
sMoveRelearnerMenuSate.showContestInfo = FALSE;
}
@ -813,7 +809,7 @@ static void HandleInput(bool8 showContest)
RemoveScrollArrows();
sMoveRelearnerStruct->state = MENU_STATE_PRINT_GIVE_UP_PROMPT;
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerGiveUp);
MoveRelearnerPrintText(gStringVar4);
MoveRelearnerPrintMessage(gStringVar4);
break;
default:
PlaySE(SE_SELECT);
@ -821,7 +817,7 @@ static void HandleInput(bool8 showContest)
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEACH_MOVE_PROMPT;
StringCopy(gStringVar2, gMoveNames[itemId]);
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerTeachMoveConfirm);
MoveRelearnerPrintText(gStringVar4);
MoveRelearnerPrintMessage(gStringVar4);
break;
}
}
@ -842,8 +838,8 @@ static void ShowTeachMoveText(bool8 shouldDoNothingInstead)
if (shouldDoNothingInstead == FALSE)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, 0x11);
AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
AddTextPrinterParameterized(RELEARNERWIN_MSG, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
}
}
@ -857,9 +853,7 @@ static void CreateUISprites(void)
// These are the appeal hearts.
for (i = 0; i < 8; i++)
{
sMoveRelearnerStruct->heartSpriteIds[i] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0);
}
// These are the jam harts.
// The animation is used to toggle between full/empty heart sprites.
@ -870,17 +864,13 @@ static void CreateUISprites(void)
}
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
}
static void AddScrollArrows(void)
{
if (sMoveRelearnerStruct->moveDisplayArrowTask == TASK_NONE)
{
sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset);
}
if (sMoveRelearnerStruct->moveListScrollArrowTask == TASK_NONE)
{
@ -934,49 +924,35 @@ void MoveRelearnerShowHideHearts(s32 moveId)
if (!sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL)
{
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
}
else
{
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].appeal / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 1);
}
else
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 0);
}
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = FALSE;
}
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].jam / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 3);
}
else
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 2);
}
gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]].invisible = FALSE;
}
}

View File

@ -20,6 +20,11 @@
#include "decompress.h"
#include "constants/rgb.h"
enum {
WIN_MSG,
WIN_LOADING,
};
static void CB2_MysteryEventMenu(void);
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed);
@ -40,7 +45,7 @@ static const struct BgTemplate sBgTemplates[] =
static const struct WindowTemplate sWindowTemplates[] =
{
{
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 4,
.tilemapTop = 15,
@ -49,7 +54,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 20
},
{
[WIN_LOADING] = {
.bg = 0,
.tilemapLeft = 7,
.tilemapTop = 6,
@ -87,7 +92,7 @@ void CB2_InitMysteryEventMenu(void)
s32 i;
DeactivateAllTextPrinters();
for (i = 0; i < 2; i++)
for (i = 0; i < (int)ARRAY_COUNT(sWindowTemplates) - 1; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
@ -131,9 +136,9 @@ static void CB2_MysteryEventMenu(void)
switch (gMain.state)
{
case 0:
DrawStdFrameWithCustomTileAndPalette(0, TRUE, 1, 0xD);
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawStdFrameWithCustomTileAndPalette(WIN_MSG, TRUE, 1, 0xD);
PutWindowTilemap(WIN_MSG);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
ShowBg(0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
gMain.state++;
@ -141,12 +146,12 @@ static void CB2_MysteryEventMenu(void)
case 1:
if (!gPaletteFade.active)
{
PrintMysteryMenuText(0, gText_LinkStandby2, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gText_LinkStandby2, 1, 2, 1);
gMain.state++;
}
break;
case 2:
if (!IsTextPrinterActive(0))
if (!IsTextPrinterActive(WIN_MSG))
{
gMain.state++;
gLinkType = LINKTYPE_MYSTERY_EVENT;
@ -154,10 +159,10 @@ static void CB2_MysteryEventMenu(void)
}
break;
case 3:
if ((gLinkStatus & 0x20) && (gLinkStatus & 0x1C) > 4)
if ((gLinkStatus & LINK_STAT_MASTER) && (gLinkStatus & LINK_STAT_PLAYER_COUNT) > 4)
{
PlaySE(SE_PIN);
PrintMysteryMenuText(0, gText_PressAToLoadEvent, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gText_PressAToLoadEvent, 1, 2, 1);
gMain.state++;
}
if (JOY_NEW(B_BUTTON))
@ -168,7 +173,7 @@ static void CB2_MysteryEventMenu(void)
}
break;
case 4:
if (!IsTextPrinterActive(0))
if (!IsTextPrinterActive(WIN_MSG))
gMain.state++;
break;
case 5:
@ -178,10 +183,10 @@ static void CB2_MysteryEventMenu(void)
{
PlaySE(SE_SELECT);
CheckShouldAdvanceLinkState();
DrawStdFrameWithCustomTileAndPalette(1, TRUE, 1, 0xD);
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_FULL);
DrawStdFrameWithCustomTileAndPalette(WIN_LOADING, TRUE, 1, 0xD);
PrintMysteryMenuText(WIN_LOADING, gText_LoadingEvent, 1, 2, 0);
PutWindowTilemap(WIN_LOADING);
CopyWindowToVram(WIN_LOADING, COPYWIN_FULL);
gMain.state++;
}
else if (JOY_NEW(B_BUTTON))
@ -194,7 +199,7 @@ static void CB2_MysteryEventMenu(void)
else
{
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
break;
@ -207,19 +212,19 @@ static void CB2_MysteryEventMenu(void)
{
SetCloseLinkCallback();
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
else if (CheckLanguageMatch())
{
PrintMysteryMenuText(0, gText_DontRemoveCableTurnOff, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gText_DontRemoveCableTurnOff, 1, 2, 1);
gMain.state++;
}
else
{
CloseLink();
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
gMain.state = 13;
}
}
@ -232,7 +237,7 @@ static void CB2_MysteryEventMenu(void)
}
break;
case 7:
if (!IsTextPrinterActive(0))
if (!IsTextPrinterActive(WIN_MSG))
gMain.state++;
break;
case 8:
@ -260,11 +265,11 @@ static void CB2_MysteryEventMenu(void)
}
break;
case 12:
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
gMain.state++;
break;
case 13:
if (!IsTextPrinterActive(0))
if (!IsTextPrinterActive(WIN_MSG))
{
gMain.state++;
sUnused = 0;
@ -287,11 +292,11 @@ static void CB2_MysteryEventMenu(void)
break;
}
if (gLinkStatus & 0x40 && !IsLinkMaster())
if (gLinkStatus & LINK_STAT_CONN_ESTABLISHED && !IsLinkMaster())
{
CloseLink();
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
gMain.state = 13;
}

View File

@ -32,6 +32,12 @@
#include "wonder_news.h"
#include "constants/cable_club.h"
enum {
WIN_HEADER,
WIN_MSG,
WIN_UNK, // Cleared, but nothing is ever apparently rendered on it
};
#define LIST_MENU_TILE_NUM 10
#define LIST_MENU_PAL_NUM BG_PLTT_ID(14)
@ -98,7 +104,7 @@ static const struct BgTemplate sBGTemplates[] = {
};
static const struct WindowTemplate sMainWindows[] = {
{
[WIN_HEADER] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
@ -106,7 +112,8 @@ static const struct WindowTemplate sMainWindows[] = {
.height = 2,
.paletteNum = 12,
.baseBlock = 0x0013
}, {
},
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 15,
@ -114,7 +121,8 @@ static const struct WindowTemplate sMainWindows[] = {
.height = 4,
.paletteNum = 12,
.baseBlock = 0x004f
}, {
},
[WIN_UNK] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 15,
@ -224,7 +232,7 @@ static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = {
.itemPrintFunc = NULL,
.totalItems = 3,
.maxShowed = 3,
.windowId = 0,
.windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -269,7 +277,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSendToss = {
.itemPrintFunc = NULL,
.totalItems = 4,
.maxShowed = 4,
.windowId = 0,
.windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -290,7 +298,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveToss = {
.itemPrintFunc = NULL,
.totalItems = 3,
.maxShowed = 3,
.windowId = 0,
.windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -311,7 +319,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSend = {
.itemPrintFunc = NULL,
.totalItems = 3,
.maxShowed = 3,
.windowId = 0,
.windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -332,7 +340,7 @@ static const struct ListMenuTemplate sListMenu_Receive = {
.itemPrintFunc = NULL,
.totalItems = 2,
.maxShowed = 2,
.windowId = 0,
.windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -354,9 +362,9 @@ static const u8 *const sUnusedMenuTexts[] = {
gText_ReturnToTitle
};
ALIGNED(2) static const u8 sTextColors_TopMenu[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sTextColors_TopMenu_Copy[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sMG_Ereader_TextColor_2[] = { TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY };
ALIGNED(2) static const u8 sTextColors_Header[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sTextColors_Header_Copy[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sMG_Ereader_TextColor_2[] = { TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY };
static void VBlankCB_MysteryGiftEReader(void)
{
@ -420,7 +428,7 @@ static bool32 HandleMysteryGiftOrEReaderSetup(s32 isEReader)
FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 17);
FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 17);
MG_DrawCheckerboardPattern(3);
PrintMysteryGiftOrEReaderTopMenu(isEReader, FALSE);
PrintMysteryGiftOrEReaderHeader(isEReader, FALSE);
gMain.state++;
break;
case 2:
@ -474,26 +482,27 @@ void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void)
SetMainCallback2(CB2_InitTitleScreen);
}
void PrintMysteryGiftOrEReaderTopMenu(bool8 isEReader, bool32 useCancel)
// Print the text window at the top of the screen with the title and control instructions
void PrintMysteryGiftOrEReaderHeader(bool8 isEReader, bool32 useCancel)
{
const u8 *header;
const u8 *title;
const u8 *options;
FillWindowPixelBuffer(0, 0);
FillWindowPixelBuffer(WIN_HEADER, 0);
if (!isEReader)
{
header = gText_MysteryGift;
title = gText_MysteryGift;
options = !useCancel ? gText_PickOKExit : gText_PickOKCancel;
}
else
{
header = gJPText_MysteryGift;
title = gJPText_MysteryGift;
options = gJPText_DecideStop;
}
AddTextPrinterParameterized4(0, FONT_NORMAL, 4, 1, 0, 0, sTextColors_TopMenu, TEXT_SKIP_DRAW, header);
AddTextPrinterParameterized4(0, FONT_SMALL, GetStringRightAlignXOffset(FONT_SMALL, options, 0xDE), 1, 0, 0, sTextColors_TopMenu, TEXT_SKIP_DRAW, options);
CopyWindowToVram(0, COPYWIN_GFX);
PutWindowTilemap(0);
AddTextPrinterParameterized4(WIN_HEADER, FONT_NORMAL, 4, 1, 0, 0, sTextColors_Header, TEXT_SKIP_DRAW, title);
AddTextPrinterParameterized4(WIN_HEADER, FONT_SMALL, GetStringRightAlignXOffset(FONT_SMALL, options, 0xDE), 1, 0, 0, sTextColors_Header, TEXT_SKIP_DRAW, options);
CopyWindowToVram(WIN_HEADER, COPYWIN_GFX);
PutWindowTilemap(WIN_HEADER);
}
void MG_DrawTextBorder(u8 windowId)
@ -533,21 +542,21 @@ static void ClearScreenInBg0(bool32 ignoreTopTwoRows)
CopyBgTilemapBufferToVram(0);
}
void AddTextPrinterToWindow1(const u8 *str)
void MG_AddMessageTextPrinter(const u8 *str)
{
StringExpandPlaceholders(gStringVar4, str);
FillWindowPixelBuffer(1, 0x11);
AddTextPrinterParameterized4(1, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(1, 0x001, 0xF);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_MSG, 0x11);
AddTextPrinterParameterized4(WIN_MSG, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(WIN_MSG, 0x001, 0xF);
PutWindowTilemap(WIN_MSG);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
}
static void ClearTextWindow(void)
static void ClearMessage(void)
{
rbox_fill_rectangle(1);
ClearWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_MAP);
rbox_fill_rectangle(WIN_MSG);
ClearWindowTilemap(WIN_MSG);
CopyWindowToVram(WIN_MSG, COPYWIN_MAP);
}
#define DOWN_ARROW_X 208
@ -558,18 +567,18 @@ bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str)
switch (*textState)
{
case 0:
AddTextPrinterToWindow1(str);
MG_AddMessageTextPrinter(str);
(*textState)++;
break;
case 1:
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
if (({JOY_NEW(A_BUTTON | B_BUTTON);}))
DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
if (JOY_NEW(A_BUTTON | B_BUTTON))
(*textState)++;
break;
case 2:
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
*textState = 0;
ClearTextWindow();
ClearMessage();
return TRUE;
case 0xFF:
*textState = 2;
@ -580,12 +589,12 @@ bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str)
static void HideDownArrow(void)
{
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
}
static void ShowDownArrow(void)
{
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
}
// Unused
@ -609,12 +618,12 @@ static bool32 HideDownArrowAndWaitButton(u8 *textState)
static bool32 PrintStringAndWait2Seconds(u8 *counter, const u8 *str)
{
if (*counter == 0)
AddTextPrinterToWindow1(str);
MG_AddMessageTextPrinter(str);
if (++(*counter) > 120)
{
*counter = 0;
ClearTextWindow();
ClearMessage();
return TRUE;
}
else
@ -648,8 +657,8 @@ static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 * unused1, u8 whic
response = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, LIST_MENU_TILE_NUM, LIST_MENU_PAL_NUM);
if (response != LIST_NOTHING_CHOSEN)
{
ClearWindowTilemap(2);
CopyWindowToVram(2, COPYWIN_MAP);
ClearWindowTilemap(WIN_UNK);
CopyWindowToVram(WIN_UNK, COPYWIN_MAP);
}
return response;
}
@ -865,7 +874,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 *state)
switch (*state)
{
case 0:
AddTextPrinterToWindow1(gText_DataWillBeSaved);
MG_AddMessageTextPrinter(gText_DataWillBeSaved);
(*state)++;
break;
case 1:
@ -873,7 +882,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 *state)
(*state)++;
break;
case 2:
AddTextPrinterToWindow1(gText_SaveCompletedPressA);
MG_AddMessageTextPrinter(gText_SaveCompletedPressA);
(*state)++;
break;
case 3:
@ -882,7 +891,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 *state)
break;
case 4:
*state = 0;
ClearTextWindow();
ClearMessage();
return TRUE;
}
@ -967,7 +976,7 @@ static bool32 PrintSuccessMessage(u8 *state, const u8 *msg, u16 * timer)
{
case 0:
if (msg != NULL)
AddTextPrinterToWindow1(msg);
MG_AddMessageTextPrinter(msg);
PlayFanfare(MUS_OBTAIN_ITEM);
*timer = 0;
(*state)++;
@ -980,7 +989,7 @@ static bool32 PrintSuccessMessage(u8 *state, const u8 *msg, u16 * timer)
if (IsFanfareTaskInactive())
{
*state = 0;
ClearTextWindow();
ClearMessage();
return TRUE;
}
break;
@ -1161,7 +1170,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveCardNewOneInput))
{
data->state = MG_STATE_SOURCE_PROMPT;
PrintMysteryGiftOrEReaderTopMenu(FALSE, TRUE);
PrintMysteryGiftOrEReaderHeader(FALSE, TRUE);
}
}
else
@ -1169,16 +1178,16 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveNewsNewOneInput))
{
data->state = MG_STATE_SOURCE_PROMPT;
PrintMysteryGiftOrEReaderTopMenu(FALSE, TRUE);
PrintMysteryGiftOrEReaderHeader(FALSE, TRUE);
}
}
break;
}
case MG_STATE_SOURCE_PROMPT:
if (!data->isWonderNews)
AddTextPrinterToWindow1(gText_WhereShouldCardBeAccessed);
MG_AddMessageTextPrinter(gText_WhereShouldCardBeAccessed);
else
AddTextPrinterToWindow1(gText_WhereShouldNewsBeAccessed);
MG_AddMessageTextPrinter(gText_WhereShouldNewsBeAccessed);
data->state = MG_STATE_SOURCE_PROMPT_INPUT;
break;
case MG_STATE_SOURCE_PROMPT_INPUT:
@ -1186,17 +1195,17 @@ static void Task_MysteryGift(u8 taskId)
switch (MysteryGift_HandleThreeOptionMenu(&data->textState, &data->var, TRUE))
{
case 0: // "Wireless Communication"
ClearTextWindow();
ClearMessage();
data->state = MG_STATE_CLIENT_LINK_START;
data->sourceIsFriend = FALSE;
break;
case 1: // "Friend"
ClearTextWindow();
ClearMessage();
data->state = MG_STATE_CLIENT_LINK_START;
data->sourceIsFriend = TRUE;
break;
case LIST_CANCEL:
ClearTextWindow();
ClearMessage();
if (ValidateCardOrNews(data->isWonderNews))
{
data->state = MG_STATE_LOAD_GIFT;
@ -1204,7 +1213,7 @@ static void Task_MysteryGift(u8 taskId)
else
{
data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE);
PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
}
break;
}
@ -1246,7 +1255,7 @@ static void Task_MysteryGift(u8 taskId)
}
break;
case MG_STATE_CLIENT_COMMUNICATING:
AddTextPrinterToWindow1(gText_Communicating);
MG_AddMessageTextPrinter(gText_Communicating);
data->state = MG_STATE_CLIENT_LINK;
break;
case MG_STATE_CLIENT_LINK:
@ -1379,7 +1388,7 @@ static void Task_MysteryGift(u8 taskId)
{
// Did not receive card/news, return to main menu
data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE);
PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
}
else
{
@ -1500,7 +1509,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintThrownAway(&data->textState, data->isWonderNews))
{
data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE);
PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
}
break;
case MG_STATE_GIFT_INPUT_EXIT:
@ -1546,12 +1555,12 @@ static void Task_MysteryGift(u8 taskId)
if (!data->isWonderNews)
{
AddTextPrinterToWindow1(gText_SendingWonderCard);
MG_AddMessageTextPrinter(gText_SendingWonderCard);
MysterGiftServer_CreateForCard();
}
else
{
AddTextPrinterToWindow1(gText_SendingWonderNews);
MG_AddMessageTextPrinter(gText_SendingWonderNews);
MysterGiftServer_CreateForNews();
}
data->state = MG_STATE_SERVER_LINK;
@ -1586,7 +1595,7 @@ static void Task_MysteryGift(u8 taskId)
else
{
data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE);
PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
}
}
break;
@ -1595,7 +1604,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_CommunicationError))
{
data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE);
PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
}
break;
case MG_STATE_EXIT:

View File

@ -310,7 +310,7 @@ s32 WonderCard_Exit(bool32 useCancel)
FreeMonIconPalettes();
break;
case 5:
PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, useCancel);
PrintMysteryGiftOrEReaderHeader(gGiftIsFromEReader, useCancel);
CopyBgTilemapBufferToVram(0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
break;
@ -785,7 +785,7 @@ s32 WonderNews_Exit(bool32 useCancel)
}
break;
case 5:
PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, useCancel);
PrintMysteryGiftOrEReaderHeader(gGiftIsFromEReader, useCancel);
MG_DrawCheckerboardPattern(3);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(3);

View File

@ -161,14 +161,18 @@ enum {
#define MENU_DIR_RIGHT 2
#define MENU_DIR_LEFT -2
enum
{
enum {
CAN_LEARN_MOVE,
CANNOT_LEARN_MOVE,
ALREADY_KNOWS_MOVE,
CANNOT_LEARN_MOVE_IS_EGG
};
enum {
// Window ids 0-5 are implicitly assigned to each party pokemon in InitPartyMenuBoxes
WIN_MSG = PARTY_SIZE,
};
struct PartyMenuBoxInfoRects
{
void (*blitFunc)(u8, u8, u8, u8, u8, bool8);
@ -321,7 +325,7 @@ static void UpdateCurrentPartySelection(s8 *, s8);
static void UpdatePartySelectionSingleLayout(s8 *, s8);
static void UpdatePartySelectionDoubleLayout(s8 *, s8);
static s8 GetNewSlotDoubleLayout(s8, s8);
static void PartyMenuPrintText(const u8 *);
static void PrintMessage(const u8 *);
static void Task_PrintAndWaitForText(u8);
static bool16 IsMonAllowedInPokemonJump(struct Pokemon *);
static bool16 IsMonAllowedInDodrioBerryPicking(struct Pokemon *);
@ -1702,7 +1706,7 @@ u8 DisplayPartyMenuMessage(const u8 *str, bool8 keepOpen)
{
u8 taskId;
PartyMenuPrintText(str);
PrintMessage(str);
taskId = CreateTask(Task_PrintAndWaitForText, 1);
gTasks[taskId].tKeepOpen = keepOpen;
return taskId;
@ -1710,12 +1714,12 @@ u8 DisplayPartyMenuMessage(const u8 *str, bool8 keepOpen)
static void Task_PrintAndWaitForText(u8 taskId)
{
if (RunTextPrintersRetIsActive(6) != TRUE)
if (RunTextPrintersRetIsActive(WIN_MSG) != TRUE)
{
if (gTasks[taskId].tKeepOpen == FALSE)
{
ClearStdWindowAndFrameToTransparent(6, FALSE);
ClearWindowTilemap(6);
ClearStdWindowAndFrameToTransparent(WIN_MSG, FALSE);
ClearWindowTilemap(WIN_MSG);
}
DestroyTask(taskId);
}
@ -1741,8 +1745,8 @@ static void Task_ReturnToChooseMonAfterText(u8 taskId)
{
if (IsPartyMenuTextPrinterActive() != TRUE)
{
ClearStdWindowAndFrameToTransparent(6, FALSE);
ClearWindowTilemap(6);
ClearStdWindowAndFrameToTransparent(WIN_MSG, FALSE);
ClearWindowTilemap(WIN_MSG);
if (MenuHelpers_IsLinkActive() == TRUE)
{
gTasks[taskId].func = Task_WaitForLinkAndReturnToChooseMon;
@ -2550,11 +2554,11 @@ static u8 DisplaySelectionWindow(u8 windowType)
return sPartyMenuInternal->windowId[0];
}
static void PartyMenuPrintText(const u8 *text)
static void PrintMessage(const u8 *text)
{
DrawStdFrameWithCustomTileAndPalette(6, FALSE, 0x4F, 13);
DrawStdFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x4F, 13);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(6, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
AddTextPrinterParameterized2(WIN_MSG, FONT_NORMAL, text, GetPlayerTextSpeedDelay(), 0, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
}
static void PartyMenuDisplayYesNoMenu(void)

View File

@ -765,7 +765,7 @@ static void DrawPokeblockInfo(s32 pkblId)
struct Pokeblock *pokeblock;
u16 rectTilemapSrc[2];
FillWindowPixelBuffer(7, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_FEEL, PIXEL_FILL(0));
if (pkblId != LIST_CANCEL)
{
@ -802,7 +802,7 @@ static void DrawPokeblockInfo(s32 pkblId)
for (i = 0; i < FLAVOR_COUNT; i++)
CopyToBgTilemapBufferRect(2, rectTilemapSrc, (i / 3 * 6) + 1, (i % 3 * 2) + 13, 1, 2);
CopyWindowToVram(7, COPYWIN_GFX);
CopyWindowToVram(WIN_FEEL, COPYWIN_GFX);
}
ScheduleBgCopyTilemapToVram(0);

View File

@ -53,6 +53,13 @@ enum {
TAG_FLY_ICON,
};
// Window IDs for the fly map
enum {
WIN_MAPSEC_NAME,
WIN_MAPSEC_NAME_TALL, // For fly destinations with subtitles (just Ever Grande)
WIN_FLY_TO_WHERE,
};
struct MultiNameFlyDest
{
const u8 *const *name;
@ -378,7 +385,7 @@ static const struct BgTemplate sFlyMapBgTemplates[] =
static const struct WindowTemplate sFlyMapWindowTemplates[] =
{
{
[WIN_MAPSEC_NAME] = {
.bg = 0,
.tilemapLeft = 17,
.tilemapTop = 17,
@ -387,7 +394,7 @@ static const struct WindowTemplate sFlyMapWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x01
},
{
[WIN_MAPSEC_NAME_TALL] = {
.bg = 0,
.tilemapLeft = 17,
.tilemapTop = 15,
@ -396,7 +403,7 @@ static const struct WindowTemplate sFlyMapWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x19
},
{
[WIN_FLY_TO_WHERE] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 18,
@ -1394,7 +1401,7 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag)
}
LoadSpriteSheet(&sheet);
LoadSpritePalette(&palette);
spriteId = CreateSprite(&template, 0x38, 0x48, 0);
spriteId = CreateSprite(&template, 56, 72, 0);
if (spriteId != MAX_SPRITES)
{
sRegionMap->cursorSprite = &gSprites[spriteId];
@ -1703,9 +1710,9 @@ void CB2_OpenFlyMap(void)
break;
case 7:
LoadPalette(sRegionMapFramePal, BG_PLTT_ID(1), sizeof(sRegionMapFramePal));
PutWindowTilemap(2);
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL);
PutWindowTilemap(WIN_FLY_TO_WHERE);
FillWindowPixelBuffer(WIN_FLY_TO_WHERE, PIXEL_FILL(0));
AddTextPrinterParameterized(WIN_FLY_TO_WHERE, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
gMain.state++;
break;
@ -1758,7 +1765,7 @@ static void DrawFlyDestTextWindow(void)
bool32 namePrinted;
const u8 *name;
if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType <= MAPSECTYPE_BATTLE_FRONTIER)
if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_MAPSEC_TYPES)
{
namePrinted = FALSE;
for (i = 0; i < ARRAY_COUNT(sMultiNameFlyDestinations); i++)
@ -1769,11 +1776,11 @@ static void DrawFlyDestTextWindow(void)
{
StringLength(sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec]);
namePrinted = TRUE;
ClearStdWindowAndFrameToTransparent(0, FALSE);
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 101, 13);
AddTextPrinterParameterized(1, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME, FALSE);
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME_TALL, FALSE, 101, 13);
AddTextPrinterParameterized(WIN_MAPSEC_NAME_TALL, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec];
AddTextPrinterParameterized(1, FONT_NORMAL, name, GetStringRightAlignXOffset(FONT_NORMAL, name, 96), 17, 0, NULL);
AddTextPrinterParameterized(WIN_MAPSEC_NAME_TALL, FONT_NORMAL, name, GetStringRightAlignXOffset(FONT_NORMAL, name, 96), 17, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
sDrawFlyDestTextWindow = TRUE;
}
@ -1784,15 +1791,15 @@ static void DrawFlyDestTextWindow(void)
{
if (sDrawFlyDestTextWindow == TRUE)
{
ClearStdWindowAndFrameToTransparent(1, FALSE);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME_TALL, FALSE);
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 101, 13);
}
else
{
// Window is already drawn, just empty it
FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
}
AddTextPrinterParameterized(0, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
AddTextPrinterParameterized(WIN_MAPSEC_NAME, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
sDrawFlyDestTextWindow = FALSE;
}
@ -1802,11 +1809,11 @@ static void DrawFlyDestTextWindow(void)
// Selection is on MAPSECTYPE_NONE, draw empty fly destination text window
if (sDrawFlyDestTextWindow == TRUE)
{
ClearStdWindowAndFrameToTransparent(1, FALSE);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME_TALL, FALSE);
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 101, 13);
}
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, COPYWIN_GFX);
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
CopyWindowToVram(WIN_MAPSEC_NAME, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0);
sDrawFlyDestTextWindow = FALSE;
}

View File

@ -49,6 +49,11 @@ enum {
SELECTION_NONE
};
enum {
WIN_TIME,
WIN_MSG,
};
struct ResetRtcInputMap
{
/*0x0*/ u8 dataIndex;
@ -79,7 +84,7 @@ static const struct BgTemplate sBgTemplates[] =
static const struct WindowTemplate sWindowTemplates[] =
{
{
[WIN_TIME] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -88,7 +93,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x155
},
{
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -562,8 +567,8 @@ static void VBlankCB(void)
static void ShowMessage(const u8 *str)
{
DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF);
AddTextPrinterParameterized(1, FONT_NORMAL, str, 0, 1, 0, NULL);
DrawDialogFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x200, 0xF);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, str, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
}
@ -576,11 +581,11 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
switch (tState)
{
case 0:
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x214, 0xE);
DrawStdFrameWithCustomTileAndPalette(WIN_TIME, FALSE, 0x214, 0xE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_PresentTime, 0, 1, TEXT_SKIP_DRAW, 0);
AddTextPrinterParameterized(WIN_TIME, FONT_NORMAL, gText_PresentTime, 0, 1, TEXT_SKIP_DRAW, 0);
PrintTime(
0,
WIN_TIME,
0,
17,
gLocalTime.days,
@ -588,9 +593,9 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
gLocalTime.minutes,
gLocalTime.seconds);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_PreviousTime, 0, 33, TEXT_SKIP_DRAW, 0);
AddTextPrinterParameterized(WIN_TIME, FONT_NORMAL, gText_PreviousTime, 0, 33, TEXT_SKIP_DRAW, 0);
PrintTime(
0,
WIN_TIME,
0,
49,
gSaveBlock2Ptr->lastBerryTreeUpdate.days,
@ -599,7 +604,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
gSaveBlock2Ptr->lastBerryTreeUpdate.seconds);
ShowMessage(gText_ResetRTCConfirmCancel);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(WIN_TIME, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0);
tState++;
case 1:
@ -666,7 +671,7 @@ static void Task_ResetRtcScreen(u8 taskId)
// Wait for A or B press on prompt first
if (gTasks[tSubTaskId].isActive != TRUE)
{
ClearStdWindowAndFrameToTransparent(0, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_TIME, FALSE);
ShowMessage(gText_PleaseResetTime);
gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate;
tSubTaskId = CreateTask(Task_ResetRtc_Init, 80);

View File

@ -258,6 +258,8 @@ static void CreateBattlerSprite(u8 battler)
{
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
return;
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, BATTLER_COORD_X_2), posY, GetBattlerSpriteSubpriority(battler));
@ -311,7 +313,7 @@ static void CreateHealthboxSprite(u8 battler)
}
else if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
{
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0 || GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_IS_EGG))
SetHealthboxSpriteInvisible(healthboxSpriteId);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,12 @@
#include "constants/trainers.h"
#include "constants/union_room.h"
enum {
WIN_MSG,
WIN_CARD_TEXT,
WIN_TRAINER_PIC,
};
struct TrainerCardData
{
u8 mainState;
@ -226,7 +232,7 @@ static const struct BgTemplate sTrainerCardBgTemplates[4] =
static const struct WindowTemplate sTrainerCardWindowTemplates[] =
{
{
[WIN_MSG] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -235,7 +241,7 @@ static const struct WindowTemplate sTrainerCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x253,
},
{
[WIN_CARD_TEXT] = {
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -244,7 +250,7 @@ static const struct WindowTemplate sTrainerCardWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x1,
},
{
[WIN_TRAINER_PIC] = {
.bg = 3,
.tilemapLeft = 19,
.tilemapTop = 5,
@ -376,7 +382,7 @@ static void Task_TrainerCard(u8 taskId)
case 0:
if (!IsDma3ManagerBusyWithBgCopy())
{
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_CARD_TEXT, PIXEL_FILL(0));
sData->mainState++;
}
break;
@ -385,13 +391,13 @@ static void Task_TrainerCard(u8 taskId)
sData->mainState++;
break;
case 2:
DrawTrainerCardWindow(1);
DrawTrainerCardWindow(WIN_CARD_TEXT);
sData->mainState++;
break;
case 3:
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TRAINER_PIC, PIXEL_FILL(0));
CreateTrainerCardTrainerPic();
DrawTrainerCardWindow(2);
DrawTrainerCardWindow(WIN_TRAINER_PIC);
sData->mainState++;
break;
case 4:
@ -411,7 +417,7 @@ static void Task_TrainerCard(u8 taskId)
if (gWirelessCommType == 1 && gReceivedRemoteLinkPlayers == TRUE)
{
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(230, 150);
CreateWirelessStatusIndicatorSprite(DISPLAY_WIDTH - 10, DISPLAY_HEIGHT - 10);
}
BlendPalettes(PALETTES_ALL, 16, sData->blendColor);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, sData->blendColor);
@ -434,7 +440,7 @@ static void Task_TrainerCard(u8 taskId)
if (!gReceivedRemoteLinkPlayers && sData->timeColonNeedDraw)
{
PrintTimeOnCard();
DrawTrainerCardWindow(1);
DrawTrainerCardWindow(WIN_CARD_TEXT);
sData->timeColonNeedDraw = FALSE;
}
if (JOY_NEW(A_BUTTON))
@ -497,9 +503,9 @@ static void Task_TrainerCard(u8 taskId)
break;
case STATE_WAIT_LINK_PARTNER:
SetCloseLinkCallback();
DrawDialogueFrame(0, TRUE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_WaitingTrainerFinishReading, 0, 1, 255, 0);
CopyWindowToVram(0, COPYWIN_FULL);
DrawDialogueFrame(WIN_MSG, TRUE);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_WaitingTrainerFinishReading, 0, 1, 255, 0);
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
sData->mainState = STATE_CLOSE_CARD_LINK;
break;
case STATE_CLOSE_CARD_LINK:
@ -1002,9 +1008,9 @@ static void PrintNameOnCardFront(void)
StringCopy(txtPtr, sData->trainerCard.playerName);
ConvertInternationalString(txtPtr, sData->language);
if (sData->cardType == CARD_TYPE_FRLG)
AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 28, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 20, 28, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
else
AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 33, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 16, 33, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
}
static void PrintIdOnCard(void)
@ -1026,7 +1032,7 @@ static void PrintIdOnCard(void)
top = 9;
}
AddTextPrinterParameterized3(1, FONT_NORMAL, xPos, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, xPos, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, buffer);
}
static void PrintMoneyOnCard(void)
@ -1035,9 +1041,9 @@ static void PrintMoneyOnCard(void)
u8 top;
if (!sData->isHoenn)
AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 56, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardMoney);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 20, 56, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardMoney);
else
AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 57, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardMoney);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 16, 57, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardMoney);
ConvertIntToDecimalStringN(gStringVar1, sData->trainerCard.money, STR_CONV_MODE_LEFT_ALIGN, 6);
StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1);
@ -1051,7 +1057,7 @@ static void PrintMoneyOnCard(void)
xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 128);
top = 57;
}
AddTextPrinterParameterized3(1, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
}
static u16 GetCaughtMonsCount(void)
@ -1069,9 +1075,9 @@ static void PrintPokedexOnCard(void)
if (FlagGet(FLAG_SYS_POKEDEX_GET))
{
if (!sData->isHoenn)
AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 72, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardPokedex);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 20, 72, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardPokedex);
else
AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 73, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardPokedex);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 16, 73, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardPokedex);
StringCopy(ConvertIntToDecimalStringN(gStringVar4, sData->trainerCard.caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3), gText_EmptyString6);
if (!sData->isHoenn)
{
@ -1083,7 +1089,7 @@ static void PrintPokedexOnCard(void)
xOffset = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 128);
top = 73;
}
AddTextPrinterParameterized3(1, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, xOffset, top, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
}
}
@ -1097,9 +1103,9 @@ static void PrintTimeOnCard(void)
u32 x, y, totalWidth;
if (!sData->isHoenn)
AddTextPrinterParameterized3(1, FONT_NORMAL, 20, 88, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardTime);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 20, 88, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardTime);
else
AddTextPrinterParameterized3(1, FONT_NORMAL, 16, 89, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardTime);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 16, 89, sTrainerCardTextColors, TEXT_SKIP_DRAW, gText_TrainerCardTime);
if (sData->isLink)
{
@ -1131,14 +1137,14 @@ static void PrintTimeOnCard(void)
totalWidth = width + 30;
x -= totalWidth;
FillWindowPixelRect(1, PIXEL_FILL(0), x, y, totalWidth, 15);
FillWindowPixelRect(WIN_CARD_TEXT, PIXEL_FILL(0), x, y, totalWidth, 15);
ConvertIntToDecimalStringN(gStringVar4, hours, STR_CONV_MODE_RIGHT_ALIGN, 3);
AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
x += 18;
AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTimeColonTextColors[sData->timeColonInvisible], TEXT_SKIP_DRAW, gText_Colon2);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, x, y, sTimeColonTextColors[sData->timeColonInvisible], TEXT_SKIP_DRAW, gText_Colon2);
x += width;
ConvertIntToDecimalStringN(gStringVar4, minutes, STR_CONV_MODE_LEADING_ZEROS, 2);
AddTextPrinterParameterized3(1, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, x, y, sTrainerCardTextColors, TEXT_SKIP_DRAW, gStringVar4);
}
static void PrintProfilePhraseOnCard(void)
@ -1148,10 +1154,10 @@ static void PrintProfilePhraseOnCard(void)
if (sData->isLink)
{
AddTextPrinterParameterized3(1, FONT_NORMAL, 8, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[0]);
AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[0], 0) + 14, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[1]);
AddTextPrinterParameterized3(1, FONT_NORMAL, 8, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[2]);
AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[2], 0) + 14, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[3]);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 8, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[0]);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[0], 0) + 14, yOffsetsLine1[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[1]);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 8, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[2]);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, GetStringWidth(FONT_NORMAL, sData->easyChatProfile[2], 0) + 14, yOffsetsLine2[sData->isHoenn], sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->easyChatProfile[3]);
}
}
@ -1169,9 +1175,9 @@ static void BufferNameForCardBack(void)
static void PrintNameOnCardBack(void)
{
if (!sData->isHoenn)
AddTextPrinterParameterized3(1, FONT_NORMAL, 136, 9, sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->textPlayersCard);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, 136, 9, sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->textPlayersCard);
else
AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, sData->textPlayersCard, 216), 9, sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->textPlayersCard);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, sData->textPlayersCard, 216), 9, sTrainerCardTextColors, TEXT_SKIP_DRAW, sData->textPlayersCard);
}
static const u8 sText_HofTime[] = _("{STR_VAR_1}:{STR_VAR_2}:{STR_VAR_3}");
@ -1192,8 +1198,8 @@ static void PrintStatOnBackOfCard(u8 top, const u8 *statName, u8 *stat, const u8
static const u8 xOffsets[] = {8, 16};
static const u8 widths[] = {216, 216};
AddTextPrinterParameterized3(1, FONT_NORMAL, xOffsets[sData->isHoenn], top * 16 + 33, sTrainerCardTextColors, TEXT_SKIP_DRAW, statName);
AddTextPrinterParameterized3(1, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, stat, widths[sData->isHoenn]), top * 16 + 33, color, TEXT_SKIP_DRAW, stat);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, xOffsets[sData->isHoenn], top * 16 + 33, sTrainerCardTextColors, TEXT_SKIP_DRAW, statName);
AddTextPrinterParameterized3(WIN_CARD_TEXT, FONT_NORMAL, GetStringRightAlignXOffset(FONT_NORMAL, stat, widths[sData->isHoenn]), top * 16 + 33, color, TEXT_SKIP_DRAW, stat);
}
static void PrintHofDebutTimeOnCard(void)
@ -1672,7 +1678,7 @@ static bool8 Task_DrawFlippedCardSide(struct Task *task)
switch (sData->flipDrawState)
{
case 0:
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_CARD_TEXT, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20);
break;
case 1:
@ -1691,13 +1697,13 @@ static bool8 Task_DrawFlippedCardSide(struct Task *task)
if (!sData->onBack)
DrawCardFrontOrBack(sData->backTilemap);
else
DrawTrainerCardWindow(1);
DrawTrainerCardWindow(WIN_CARD_TEXT);
break;
case 3:
if (!sData->onBack)
DrawCardBackStats();
else
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TRAINER_PIC, PIXEL_FILL(0));
break;
case 4:
if (sData->onBack)
@ -1722,12 +1728,12 @@ static bool8 Task_SetCardFlipped(struct Task *task)
// If on back of card, draw front of card because its being flipped
if (sData->onBack)
{
DrawTrainerCardWindow(2);
DrawTrainerCardWindow(WIN_TRAINER_PIC);
DrawCardScreenBackground(sData->bgTilemap);
DrawCardFrontOrBack(sData->frontTilemap);
DrawStarsAndBadgesOnCard();
}
DrawTrainerCardWindow(1);
DrawTrainerCardWindow(WIN_CARD_TEXT);
sData->onBack ^= 1;
task->tFlipState++;
sData->allowDMACopy = TRUE;
@ -1882,7 +1888,7 @@ static void CreateTrainerCardTrainerPic(void)
sTrainerPicOffset[sData->isHoenn][sData->trainerCard.gender][0],
sTrainerPicOffset[sData->isHoenn][sData->trainerCard.gender][1],
8,
2);
WIN_TRAINER_PIC);
}
else
{
@ -1891,6 +1897,6 @@ static void CreateTrainerCardTrainerPic(void)
sTrainerPicOffset[sData->isHoenn][sData->trainerCard.gender][0],
sTrainerPicOffset[sData->isHoenn][sData->trainerCard.gender][1],
8,
2);
WIN_TRAINER_PIC);
}
}

View File

@ -692,8 +692,8 @@ void TryPrepareSecondApproachingTrainer(void)
#define sLocalId data[0]
#define sMapNum data[1]
#define sMapGroup data[2]
#define sData3 data[3]
#define sData4 data[4]
#define sYVelocity data[3]
#define sYOffset data[4]
#define sFldEffId data[7]
u8 FldEff_ExclamationMarkIcon(void)
@ -739,7 +739,7 @@ static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnim
sprite->sLocalId = gFieldEffectArguments[0];
sprite->sMapNum = gFieldEffectArguments[1];
sprite->sMapGroup = gFieldEffectArguments[2];
sprite->sData3 = -5;
sprite->sYVelocity = -5;
sprite->sFldEffId = fldEffId;
StartSpriteAnim(sprite, spriteAnimNum);
@ -757,23 +757,23 @@ static void SpriteCB_TrainerIcons(struct Sprite *sprite)
else
{
struct Sprite *objEventSprite = &gSprites[gObjectEvents[objEventId].spriteId];
sprite->sData4 += sprite->sData3;
sprite->sYOffset += sprite->sYVelocity;
sprite->x = objEventSprite->x;
sprite->y = objEventSprite->y - 16;
sprite->x2 = objEventSprite->x2;
sprite->y2 = objEventSprite->y2 + sprite->sData4;
if (sprite->sData4)
sprite->sData3++;
sprite->y2 = objEventSprite->y2 + sprite->sYOffset;
if (sprite->sYOffset)
sprite->sYVelocity++;
else
sprite->sData3 = 0;
sprite->sYVelocity = 0;
}
}
#undef sLocalId
#undef sMapNum
#undef sMapGroup
#undef sData3
#undef sData4
#undef sYVelocity
#undef sYOffset
#undef sFldEffId
u8 GetCurrentApproachingTrainerObjectEventId(void)

View File

@ -1271,7 +1271,7 @@ static u32 IsTryingToTradeAcrossVersionTooSoon(struct WirelessLink_Group *data,
{
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP))
return UR_TRADE_PLAYER_NOT_READY;
else if (partner->rfu.data.compatibility.isChampion)
else if (partner->rfu.data.compatibility.canLinkNationally)
return UR_TRADE_READY;
}
else
@ -1927,7 +1927,7 @@ static void Task_SendMysteryGift(u8 taskId)
data->state = 3;
break;
case 3:
AddTextPrinterToWindow1(gStringVar4);
MG_AddMessageTextPrinter(gStringVar4);
data->state = 4;
break;
case 4:
@ -2001,7 +2001,7 @@ static void Task_SendMysteryGift(u8 taskId)
}
break;
case 9:
AddTextPrinterToWindow1(gStringVar4);
MG_AddMessageTextPrinter(gStringVar4);
data->state = 10;
break;
case 10:
@ -2104,7 +2104,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
data->state = 1;
break;
case 1:
AddTextPrinterToWindow1(sText_ChooseTrainer);
MG_AddMessageTextPrinter(sText_ChooseTrainer);
data->state = 2;
break;
case 2:
@ -2176,7 +2176,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
}
break;
case 4:
AddTextPrinterToWindow1(sText_AwaitingPlayersResponse);
MG_AddMessageTextPrinter(sText_AwaitingPlayersResponse);
CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]);
data->state = 5;
break;
@ -2195,7 +2195,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
data->state = 8;
break;
case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_PlayerSentBackOK);
MG_AddMessageTextPrinter(sText_PlayerSentBackOK);
RfuSetStatus(RFU_STATUS_OK, 0);
break;
}
@ -2223,7 +2223,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
break;
case 7:
DestroyWirelessStatusIndicatorSprite();
AddTextPrinterToWindow1(sText_PleaseStartOver);
MG_AddMessageTextPrinter(sText_PleaseStartOver);
DestroyTask(taskId);
LinkRfu_Shutdown();
gSpecialVar_Result = LINKUP_FAILED;
@ -2272,7 +2272,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
data->state = 1;
break;
case 1:
AddTextPrinterToWindow1(sText_SearchingForWirelessSystemWait);
MG_AddMessageTextPrinter(sText_SearchingForWirelessSystemWait);
data->state = 2;
break;
case 2:
@ -2341,7 +2341,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
}
break;
case 4:
AddTextPrinterToWindow1(sText_AwaitingResponseFromWirelessSystem);
MG_AddMessageTextPrinter(sText_AwaitingResponseFromWirelessSystem);
CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]);
data->state = 5;
break;
@ -2360,7 +2360,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
data->state = 8;
break;
case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_WirelessLinkEstablished);
MG_AddMessageTextPrinter(sText_WirelessLinkEstablished);
RfuSetStatus(RFU_STATUS_OK, 0);
break;
}

View File

@ -116,6 +116,13 @@ enum {
// Shared by all above
#define PALTAG_INTERFACE 0
enum {
WIN_CHAT_HISTORY,
WIN_TEXT_ENTRY,
WIN_KEYBOARD,
WIN_SWAP_MENU,
};
struct UnionRoomChat
{
u32 filler1;
@ -560,7 +567,7 @@ static const struct BgTemplate sBgTemplates[] = {
};
static const struct WindowTemplate sWinTemplates[] = {
{
[WIN_CHAT_HISTORY] = {
.bg = 3,
.tilemapLeft = 8,
.tilemapTop = 1,
@ -568,7 +575,8 @@ static const struct WindowTemplate sWinTemplates[] = {
.height = 19,
.paletteNum = 15,
.baseBlock = 0x0001,
}, {
},
[WIN_TEXT_ENTRY] = {
.bg = 1,
.tilemapLeft = 9,
.tilemapTop = 18,
@ -576,7 +584,8 @@ static const struct WindowTemplate sWinTemplates[] = {
.height = 2,
.paletteNum = 12,
.baseBlock = 0x007a,
}, {
},
[WIN_KEYBOARD] = {
.bg = 1,
.tilemapLeft = 0,
.tilemapTop = 2,
@ -584,7 +593,8 @@ static const struct WindowTemplate sWinTemplates[] = {
.height = 15,
.paletteNum = 7,
.baseBlock = 0x0020,
}, {
},
[WIN_SWAP_MENU] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 2,
@ -2280,7 +2290,7 @@ static bool32 Display_ShowKeyboardSwapMenu(u8 *state)
{
case 0:
ShowKeyboardSwapMenu();
CopyWindowToVram(3, COPYWIN_FULL);
CopyWindowToVram(WIN_SWAP_MENU, COPYWIN_FULL);
break;
case 1:
return IsDma3ManagerBusyWithBgCopy();
@ -2296,7 +2306,7 @@ static bool32 Display_HideKeyboardSwapMenu(u8 *state)
{
case 0:
HideKeyboardSwapMenu();
CopyWindowToVram(3, COPYWIN_FULL);
CopyWindowToVram(WIN_SWAP_MENU, COPYWIN_FULL);
break;
case 1:
return IsDma3ManagerBusyWithBgCopy();
@ -2316,7 +2326,7 @@ static bool32 Display_SwitchPages(u8 *state)
return TRUE;
PrintCurrentKeyboardPage();
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(WIN_KEYBOARD, COPYWIN_GFX);
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
@ -2393,7 +2403,7 @@ static bool32 Display_UpdateMessageBuffer(u8 *state)
FillTextEntryWindow(x, width, 0);
str = GetMessageEntryBuffer();
DrawTextEntryMessage(0, str, 3, 1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
@ -2422,7 +2432,7 @@ static bool32 Display_AskRegisterText(u8 *state)
length = StringLength_Multibyte(str);
FillTextEntryWindow(x, length, PIXEL_FILL(6));
DrawTextEntryMessage(x, str, 0, 4, 5);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
@ -2463,7 +2473,7 @@ static bool32 Display_CancelRegister(u8 *state)
length = StringLength_Multibyte(str);
FillTextEntryWindow(x, length, PIXEL_FILL(0));
DrawTextEntryMessage(x, str, 3, 1, 2);
CopyWindowToVram(1, COPYWIN_GFX);
CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
@ -2501,7 +2511,7 @@ static bool32 Display_ReturnToKeyboard(u8 *state)
{
case 0:
PrintCurrentKeyboardPage();
CopyWindowToVram(2, COPYWIN_GFX);
CopyWindowToVram(WIN_KEYBOARD, COPYWIN_GFX);
(*state)++;
break;
case 1:
@ -2527,7 +2537,7 @@ static bool32 Display_ScrollChat(u8 *state)
str = GetLastReceivedMessage();
colorIdx = GetReceivedPlayerIndex();
PrintChatMessage(row, str, colorIdx);
CopyWindowToVram(0, COPYWIN_GFX);
CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_GFX);
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
@ -2546,8 +2556,8 @@ static bool32 Display_ScrollChat(u8 *state)
}
// fall through
case 2:
ScrollWindow(0, 0, 5, PIXEL_FILL(1));
CopyWindowToVram(0, COPYWIN_GFX);
ScrollWindow(WIN_CHAT_HISTORY, 0, 5, PIXEL_FILL(1));
CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_GFX);
sDisplay->scrollCount++;
(*state)++;
// fall through
@ -2864,7 +2874,7 @@ static void DestroyStdMessageWindow(void)
static void FillTextEntryWindow(u16 x, u16 width, u8 fillValue)
{
FillWindowPixelRect(1, fillValue, x * 8, 1, width * 8, 14);
FillWindowPixelRect(WIN_TEXT_ENTRY, fillValue, x * 8, 1, width * 8, 14);
}
static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shadowColor)
@ -2881,7 +2891,7 @@ static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shad
strBuffer[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING;
strBuffer[2] = 8;
StringCopy(&strBuffer[3], str);
AddTextPrinterParameterized3(1, FONT_SHORT, x * 8, 1, color, TEXT_SKIP_DRAW, strBuffer);
AddTextPrinterParameterized3(WIN_TEXT_ENTRY, FONT_SHORT, x * 8, 1, color, TEXT_SKIP_DRAW, strBuffer);
}
static void PrintCurrentKeyboardPage(void)
@ -2894,7 +2904,7 @@ static void PrintCurrentKeyboardPage(void)
u8 str[45];
u8 *str2;
FillWindowPixelBuffer(2, PIXEL_FILL(15));
FillWindowPixelBuffer(WIN_KEYBOARD, PIXEL_FILL(15));
page = GetCurrentKeyboardPage();
color[0] = TEXT_COLOR_TRANSPARENT;
color[1] = TEXT_DYNAMIC_COLOR_5;
@ -2916,7 +2926,7 @@ static void PrintCurrentKeyboardPage(void)
return;
StringCopy(&str[3], sUnionRoomKeyboardText[page][i]);
AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str);
AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str);
}
}
else
@ -2927,7 +2937,7 @@ static void PrintCurrentKeyboardPage(void)
str2 = GetRegisteredTextByRow(i);
if (GetStringWidth(FONT_SMALL, str2, 0) <= 40)
{
AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str2);
AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str2);
}
else
{
@ -2938,8 +2948,8 @@ static void PrintCurrentKeyboardPage(void)
StringCopyN_Multibyte(str, str2, length);
} while (GetStringWidth(FONT_SMALL, str, 0) > 35);
AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str);
AddTextPrinterParameterized3(2, FONT_SMALL, left + 35, top, color, TEXT_SKIP_DRAW, sText_Ellipsis);
AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str);
AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left + 35, top, color, TEXT_SKIP_DRAW, sText_Ellipsis);
}
}
}
@ -2989,17 +2999,17 @@ static bool32 SlideKeyboardPageIn(void)
static void ShowKeyboardSwapMenu(void)
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
DrawTextBorderOuter(3, 1, 13);
PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts);
InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage());
PutWindowTilemap(3);
FillWindowPixelBuffer(WIN_SWAP_MENU, PIXEL_FILL(1));
DrawTextBorderOuter(WIN_SWAP_MENU, 1, 13);
PrintMenuActionTextsAtPos(WIN_SWAP_MENU, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts);
InitMenuNormal(WIN_SWAP_MENU, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage());
PutWindowTilemap(WIN_SWAP_MENU);
}
static void HideKeyboardSwapMenu(void)
{
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(3);
ClearStdWindowAndFrameToTransparent(WIN_SWAP_MENU, FALSE);
ClearWindowTilemap(WIN_SWAP_MENU);
}
static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx)
@ -3009,8 +3019,8 @@ static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx)
color[0] = TEXT_COLOR_WHITE;
color[1] = colorIdx * 2 + 2;
color[2] = colorIdx * 2 + 3;
FillWindowPixelRect(0, PIXEL_FILL(1), 0, row * 15, 168, 15);
AddTextPrinterParameterized3(0, FONT_SHORT, 0, row * 15 + 1, color, TEXT_SKIP_DRAW, str);
FillWindowPixelRect(WIN_CHAT_HISTORY, PIXEL_FILL(1), 0, row * 15, 168, 15);
AddTextPrinterParameterized3(WIN_CHAT_HISTORY, FONT_SHORT, 0, row * 15 + 1, color, TEXT_SKIP_DRAW, str);
}
static void ResetGpuBgState(void)
@ -3087,16 +3097,16 @@ static void LoadChatUnkPalette(void)
static void LoadChatMessagesWindow(void)
{
LoadPalette(sUnk_Palette2, BG_PLTT_ID(15), sizeof(sUnk_Palette2));
PutWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, COPYWIN_FULL);
PutWindowTilemap(WIN_CHAT_HISTORY);
FillWindowPixelBuffer(WIN_CHAT_HISTORY, PIXEL_FILL(1));
CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_FULL);
}
static void LoadKeyboardWindow(void)
{
PutWindowTilemap(2);
PutWindowTilemap(WIN_KEYBOARD);
PrintCurrentKeyboardPage();
CopyWindowToVram(2, COPYWIN_FULL);
CopyWindowToVram(WIN_KEYBOARD, COPYWIN_FULL);
}
static void LoadTextEntryWindow(void)
@ -3107,18 +3117,18 @@ static void LoadTextEntryWindow(void)
unused[1] = 0xFF;
for (i = 0; i < MAX_MESSAGE_LENGTH; i++)
BlitBitmapToWindow(1, sDisplay->unk2128, i * 8, 0, 8, 16);
BlitBitmapToWindow(WIN_TEXT_ENTRY, sDisplay->unk2128, i * 8, 0, 8, 16);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_TEXT_ENTRY, PIXEL_FILL(0));
PutWindowTilemap(WIN_TEXT_ENTRY);
CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_FULL);
}
static void LoadKeyboardSwapWindow(void)
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
LoadUserWindowBorderGfx(3, 1, BG_PLTT_ID(13));
LoadUserWindowBorderGfx_(3, 0xA, BG_PLTT_ID(2));
FillWindowPixelBuffer(WIN_SWAP_MENU, PIXEL_FILL(1));
LoadUserWindowBorderGfx(WIN_SWAP_MENU, 1, BG_PLTT_ID(13));
LoadUserWindowBorderGfx_(WIN_SWAP_MENU, 0xA, BG_PLTT_ID(2));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(14), PLTT_SIZE_4BPP);
}

View File

@ -55,25 +55,28 @@ static void SpriteCB_AMIndicator(struct Sprite *sprite);
#define PALTAG_WALL_CLOCK_MALE 0x1000
#define PALTAG_WALL_CLOCK_FEMALE 0x1001
enum
{
enum {
PERIOD_AM,
PERIOD_PM,
};
enum
{
enum {
MOVE_NONE,
MOVE_BACKWARD,
MOVE_FORWARD,
};
enum {
WIN_MSG,
WIN_BUTTON_LABEL,
};
static const u32 sHand_Gfx[] = INCBIN_U32("graphics/wallclock/hand.4bpp.lz");
static const u16 sTextPrompt_Pal[] = INCBIN_U16("graphics/wallclock/text_prompt.gbapal"); // for "Cancel" or "Confirm"
static const struct WindowTemplate sWindowTemplates[] =
{
{
[WIN_MSG] = {
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 17,
@ -82,7 +85,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 14,
.baseBlock = 512
},
{
[WIN_BUTTON_LABEL] = {
.bg = 2,
.tilemapLeft = 24,
.tilemapTop = 16,
@ -717,8 +720,8 @@ void CB2_StartWallClock(void)
WallClockInit();
AddTextPrinterParameterized(1, FONT_NORMAL, gText_Confirm3, 0, 1, 0, NULL);
PutWindowTilemap(1);
AddTextPrinterParameterized(WIN_BUTTON_LABEL, FONT_NORMAL, gText_Confirm3, 0, 1, 0, NULL);
PutWindowTilemap(WIN_BUTTON_LABEL);
ScheduleBgCopyTilemapToVram(2);
}
@ -765,8 +768,8 @@ void CB2_ViewWallClock(void)
WallClockInit();
AddTextPrinterParameterized(1, FONT_NORMAL, gText_Cancel4, 0, 1, 0, NULL);
PutWindowTilemap(1);
AddTextPrinterParameterized(WIN_BUTTON_LABEL, FONT_NORMAL, gText_Cancel4, 0, 1, 0, NULL);
PutWindowTilemap(WIN_BUTTON_LABEL);
ScheduleBgCopyTilemapToVram(2);
}
@ -829,9 +832,9 @@ static void Task_SetClock_HandleInput(u8 taskId)
static void Task_SetClock_AskConfirm(u8 taskId)
{
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x250, 0x0d);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
PutWindowTilemap(0);
DrawStdFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x250, 0x0d);
AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, gText_IsThisTheCorrectTime, 0, 1, 0, NULL);
PutWindowTilemap(WIN_MSG);
ScheduleBgCopyTilemapToVram(0);
CreateYesNoMenu(&sWindowTemplate_ConfirmYesNo, 0x250, 0x0d, 1);
gTasks[taskId].func = Task_SetClock_HandleConfirmInput;
@ -848,8 +851,8 @@ static void Task_SetClock_HandleConfirmInput(u8 taskId)
case 1: // NO
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(0, FALSE);
ClearWindowTilemap(0);
ClearStdWindowAndFrameToTransparent(WIN_MSG, FALSE);
ClearWindowTilemap(WIN_MSG);
gTasks[taskId].func = Task_SetClock_HandleInput;
break;
}

View File

@ -28,12 +28,21 @@ enum {
COLORMODE_WHITE_DGRAY,
};
#define GROUPTYPE_TRADE 0
#define GROUPTYPE_BATTLE 1
#define GROUPTYPE_UNION 2
#define GROUPTYPE_TOTAL 3
#define GROUPTYPE_NONE -1
#define NUM_GROUPTYPES 4
enum {
WIN_TITLE,
WIN_GROUP_NAMES,
WIN_GROUP_COUNTS,
};
enum {
GROUPTYPE_TRADE,
GROUPTYPE_BATTLE,
GROUPTYPE_UNION,
GROUPTYPE_TOTAL,
NUM_GROUPTYPES
};
#define GROUPTYPE_NONE 0xFF
struct WirelessCommunicationStatusScreen
{
@ -88,7 +97,7 @@ static const struct BgTemplate sBgTemplates[] = {
};
static const struct WindowTemplate sWindowTemplates[] = {
{
[WIN_TITLE] = {
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 0,
@ -96,7 +105,8 @@ static const struct WindowTemplate sWindowTemplates[] = {
.height = 3,
.paletteNum = 15,
.baseBlock = 0x0001
}, {
},
[WIN_GROUP_NAMES] = {
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 4,
@ -104,7 +114,8 @@ static const struct WindowTemplate sWindowTemplates[] = {
.height = 15,
.paletteNum = 15,
.baseBlock = 0x0049
}, {
},
[WIN_GROUP_COUNTS] = {
.bg = 0,
.tilemapLeft = 24,
.tilemapTop = 4,
@ -126,7 +137,6 @@ static const u8 *const sHeaderTexts[NUM_GROUPTYPES + 1] = {
// Activity, group type, number of players
// 0 players means the number of players can change and should be counted dynamically
// GROUPTYPE_TOTAL have no unique group and are simply counted in the total of "people communicating"
// UB: GROUPTYPE_NONE (-1) can potentially be used as an index into a u8[4] in CountPlayersInGroupAndGetActivity
static const u8 sActivityGroupInfo[][3] = {
{ACTIVITY_BATTLE_SINGLE, GROUPTYPE_BATTLE, 2},
{ACTIVITY_BATTLE_DOUBLE, GROUPTYPE_BATTLE, 2},
@ -254,24 +264,24 @@ static void CyclePalette(s16 * counter, s16 * palIdx)
static void PrintHeaderTexts(void)
{
s32 i;
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_GROUP_NAMES, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_GROUP_COUNTS, PIXEL_FILL(0));
// Print title
WCSS_AddTextPrinterParameterized(0, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
WCSS_AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
// Print label for each group (excluding total)
for (i = 0; i < NUM_GROUPTYPES - 1; i++)
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
WCSS_AddTextPrinterParameterized(WIN_GROUP_NAMES, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
// Print label for total
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED);
WCSS_AddTextPrinterParameterized(WIN_GROUP_NAMES, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED);
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_GFX);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_GFX);
PutWindowTilemap(WIN_TITLE);
CopyWindowToVram(WIN_TITLE, COPYWIN_GFX);
PutWindowTilemap(WIN_GROUP_NAMES);
CopyWindowToVram(WIN_GROUP_NAMES, COPYWIN_GFX);
}
#define tState data[0]
@ -299,17 +309,17 @@ static void Task_WirelessCommunicationScreen(u8 taskId)
case 3:
if (UpdateCommunicationCounts(sStatusScreen->groupCounts, sStatusScreen->prevGroupCounts, sStatusScreen->activities, sStatusScreen->rfuTaskId))
{
FillWindowPixelBuffer(2, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_GROUP_COUNTS, PIXEL_FILL(0));
for (i = 0; i < NUM_GROUPTYPES; i++)
{
ConvertIntToDecimalStringN(gStringVar4, sStatusScreen->groupCounts[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
if (i != GROUPTYPE_TOTAL)
WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY);
WCSS_AddTextPrinterParameterized(WIN_GROUP_COUNTS, FONT_NORMAL, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY);
else
WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 98, COLORMODE_RED);
WCSS_AddTextPrinterParameterized(WIN_GROUP_COUNTS, FONT_NORMAL, gStringVar4, 12, 98, COLORMODE_RED);
}
PutWindowTilemap(2);
CopyWindowToVram(2, COPYWIN_FULL);
PutWindowTilemap(WIN_GROUP_COUNTS);
CopyWindowToVram(WIN_GROUP_COUNTS, COPYWIN_FULL);
}
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
@ -382,6 +392,13 @@ static u32 CountPlayersInGroupAndGetActivity(struct RfuPlayer * player, u32 * gr
for (i = 0; i < ARRAY_COUNT(sActivityGroupInfo); i++)
{
#ifdef UBFIX
// GROUPTYPE_NONE is 0xFF, and shouldn't be used as an index into groupCounts.
// In theory the only activity with this group type (ACTIVITY_SEARCH) wouldn't
// satisfy the condition below, but not necessarily.
if (group_type(i) == GROUPTYPE_NONE)
continue;
#endif
if (activity == group_activity(i) && player->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
if (group_players(i) == 0)

16
test/ability_cloud_nine.c Normal file
View File

@ -0,0 +1,16 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Cloud Nine prevents weather effects")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_SANDSTORM].effect == EFFECT_SANDSTORM);
PLAYER(SPECIES_PSYDUCK) { Ability(ABILITY_CLOUD_NINE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SANDSTORM); }
TURN {}
} SCENE {
NONE_OF { HP_BAR(player); }
}
}

View File

@ -0,0 +1,37 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Compound Eyes raises accuracy")
{
PASSES_RANDOMLY(91, 100);
GIVEN {
ASSUME(gBattleMoves[MOVE_THUNDER].accuracy == 70);
PLAYER(SPECIES_BUTTERFREE) { Ability(ABILITY_COMPOUND_EYES); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_THUNDER); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER, player);
HP_BAR(opponent);
}
}
// This fails even though the ability works correctly. The failure is due to
// a statistical anomaly in the test system where FISSURE hits 3 times more often
// than we expect.
SINGLE_BATTLE_TEST("Compound Eyes does not affect OHKO moves")
{
KNOWN_FAILING;
PASSES_RANDOMLY(30, 100);
GIVEN {
ASSUME(gBattleMoves[MOVE_FISSURE].accuracy == 30);
ASSUME(gBattleMoves[MOVE_FISSURE].effect == EFFECT_OHKO);
PLAYER(SPECIES_BUTTERFREE) { Ability(ABILITY_TINTED_LENS); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_FISSURE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FISSURE, player);
HP_BAR(opponent, hp: 0);
}
}

54
test/ability_damp.c Normal file
View File

@ -0,0 +1,54 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from enemies")
{
u32 move;
PARAMETRIZE { move = MOVE_EXPLOSION; }
PARAMETRIZE { move = MOVE_SELF_DESTRUCT; }
PARAMETRIZE { move = MOVE_MIND_BLOWN; }
PARAMETRIZE { move = MOVE_MISTY_EXPLOSION; }
GIVEN {
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DAMP);
NONE_OF { HP_BAR(player); HP_BAR(opponent); }
}
}
SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from self")
{
u32 move;
PARAMETRIZE { move = MOVE_EXPLOSION; }
PARAMETRIZE { move = MOVE_SELF_DESTRUCT; }
PARAMETRIZE { move = MOVE_MIND_BLOWN; }
PARAMETRIZE { move = MOVE_MISTY_EXPLOSION; }
GIVEN {
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DAMP);
NONE_OF { HP_BAR(player); HP_BAR(opponent); }
}
}
SINGLE_BATTLE_TEST("Damp prevents damage from aftermath")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT);
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
OPPONENT(SPECIES_VOLTORB) { Ability(ABILITY_AFTERMATH); HP(1); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); }
} SCENE {
ABILITY_POPUP(opponent, ABILITY_AFTERMATH);
ABILITY_POPUP(player, ABILITY_DAMP);
NONE_OF { HP_BAR(player); }
}
}

24
test/ability_drizzle.c Normal file
View File

@ -0,0 +1,24 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Drizzle summons rain", s16 damage)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_DRIZZLE; }
PARAMETRIZE { ability = ABILITY_DAMP; }
GIVEN {
PLAYER(SPECIES_POLITOED) { Ability(ability); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_BUBBLE); }
} SCENE {
if (ability == ABILITY_DRIZZLE) {
ABILITY_POPUP(player, ABILITY_DRIZZLE);
MESSAGE("Politoed's Drizzle made it rain!");
}
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[1].damage, Q_4_12(1.5), results[0].damage);
}
}

59
test/ability_insomnia.c Normal file
View File

@ -0,0 +1,59 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Insomnia prevents sleep")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_SPORE].effect == EFFECT_SLEEP);
PLAYER(SPECIES_DROWZEE) { Ability(ABILITY_INSOMNIA); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SPORE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_INSOMNIA);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPORE, opponent);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player);
STATUS_ICON(player, sleep: TRUE);
}
}
}
SINGLE_BATTLE_TEST("Insomnia prevents yawn")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_YAWN].effect == EFFECT_YAWN);
PLAYER(SPECIES_DROWZEE) { Ability(ABILITY_INSOMNIA); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SPORE); }
TURN { }
TURN { }
} SCENE {
ABILITY_POPUP(player, ABILITY_INSOMNIA);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_YAWN, opponent);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player);
STATUS_ICON(player, sleep: TRUE);
}
}
}
SINGLE_BATTLE_TEST("Insomnia prevents rest")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_REST].effect == EFFECT_REST);
PLAYER(SPECIES_DROWZEE) { Ability(ABILITY_INSOMNIA); HP(1); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_REST); }
} SCENE {
ABILITY_POPUP(player, ABILITY_INSOMNIA);
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_REST, player);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player);
STATUS_ICON(player, sleep: TRUE);
HP_BAR(player);
}
}
}

50
test/ability_intimidate.c Normal file
View File

@ -0,0 +1,50 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
}
SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after switch out", s16 damage)
{
u32 ability;
PARAMETRIZE { ability = ABILITY_INTIMIDATE; }
PARAMETRIZE { ability = ABILITY_RECKLESS; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_STARAPTOR) { Ability(ability); };
} WHEN {
TURN { SWITCH(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
if (ability == ABILITY_INTIMIDATE)
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage);
}
}
SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after KO", s16 damage)
{
u32 ability;
KNOWN_FAILING;
PARAMETRIZE { ability = ABILITY_INTIMIDATE; }
PARAMETRIZE { ability = ABILITY_RECKLESS; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(2); };
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); };
OPPONENT(SPECIES_STARAPTOR) { Ability(ABILITY_INTIMIDATE); Speed(1); };
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
if (ability == ABILITY_INTIMIDATE)
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage);
}
}

16
test/ability_limber.c Normal file
View File

@ -0,0 +1,16 @@
#include "global.h"
#include "test_battle.h"
SINGLE_BATTLE_TEST("Limber prevents paralysis")
{
GIVEN {
PLAYER(SPECIES_PERSIAN) { Ability(ABILITY_LIMBER); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_THUNDER_SHOCK); }
} SCENE {
HP_BAR(player);
NONE_OF { ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_PRZ, player); }
NONE_OF { STATUS_ICON(player, paralysis: TRUE); }
}
}

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