Skip to content

Commit

Permalink
Merge branch 'battle_engine' of https://github.com/rh-hideout/pokeeme…
Browse files Browse the repository at this point in the history
…rald-expansion into teleport
  • Loading branch information
LOuroboros committed Jul 3, 2022
2 parents 195a290 + 02a62e2 commit 8f728dc
Show file tree
Hide file tree
Showing 93 changed files with 1,270 additions and 1,566 deletions.
19 changes: 10 additions & 9 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,6 @@ Replace `<output of nproc>` with the number that the `nproc` command returned.

`nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)).

## Debug info

To build **pokeemerald.elf** with enhanced debug info:
```bash
make DINFO=1
```

## devkitARM's C compiler

This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run:
Expand Down Expand Up @@ -534,7 +527,7 @@ devkitARM is now installed.

devkitARM is now installed.

## Installing devkitARM on Arch Linux
### Installing devkitARM on Arch Linux

1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages.
2. Install `gba-dev`: run the following command as root.
Expand All @@ -552,7 +545,7 @@ devkitARM is now installed.
devkitARM is now installed.
## Other toolchains
### Other toolchains
To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`.
```bash
Expand All @@ -564,6 +557,14 @@ make TOOLCHAIN="/usr/local/arm-none-eabi"
```
To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present.
### Building with debug info under a modern toolchain
To build **pokeemerald.elf** with debug symbols under a modern toolchain:
```bash
make modern DINFO=1
```
Note that this is not necessary for a non-modern build since those are built with debug symbols by default.
# Useful additional tools
* [porymap](https://github.com/huderlem/porymap) for viewing and editing maps
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ LIBPATH := -L ../../tools/agbcc/lib
LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
else
CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
ROM := $(MODERN_ROM_NAME)
OBJ_DIR := $(MODERN_OBJ_DIR_NAME)
LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))"
Expand Down
8 changes: 4 additions & 4 deletions asm/macros/trainer_hill.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
special CallTrainerHillFunction
.endm

@ Set the challenge mode to HILL_TAG_* (Normal, Variety, Unique, or Expert)
.macro trainerhill_settag tag:req
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_TAG
copyvar VAR_0x8005, \tag
@ Set the challenge mode to HILL_MODE_* (Normal, Variety, Unique, or Expert)
.macro trainerhill_setmode mode:req
setvar VAR_0x8004, TRAINER_HILL_FUNC_SET_MODE
copyvar VAR_0x8005, \mode
special CallTrainerHillFunction
.endm
37 changes: 36 additions & 1 deletion data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -14193,7 +14193,42 @@ Move_LASH_OUT::
end @to do:

Move_POLTERGEIST::
end @to do:
loadspritegfx ANIM_TAG_EYE_SPARKLE
loadspritegfx ANIM_TAG_WHITE_SHADOW @Destiny Bond
loadspritegfx ANIM_TAG_QUICK_GUARD_HAND @Black Colour
loadspritegfx ANIM_TAG_IMPACT
loadspritegfx ANIM_TAG_POLTERGEIST
fadetobg BG_NIGHTMARE
waitbgfadein
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 0, 16, RGB_BLACK
waitforvisualfinish
createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8
createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8
playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER
waitforvisualfinish
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 16, 0, RGB_BLACK
playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER
delay 0x1
launchtask AnimTask_DestinyBondWhiteShadow 0x5 0x2 0x0 0x24
delay 0x30
playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_TARGET
createvisualtask AnimTask_PoltergeistItem, 2
waitforvisualfinish
setalpha 12, 8
launchtemplate gBasicHitSplatSpriteTemplate 0x2 0x4 0x0 0x0 0x1 0x1
launchtask AnimTask_ShakeMon 0x5 0x5 0x1 0x0 0x5 0x5 0x1
launchtemplate gComplexPaletteBlendSpriteTemplate 0x2 0x7 0x7 0x5 0x1 0x0 0xa 0x0 0x0
playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET
waitforvisualfinish
launchtask AnimTask_NightmareClone 0x2 0x0
launchtask AnimTask_ShakeMon 0x2 0x5 0x1 0x3 0x0 0x28 0x1
playsewithpan SE_M_NIGHTMARE, SOUND_PAN_TARGET
waitforvisualfinish
restorebg
waitbgfadein
clearmonbg 0x3
blendoff
end

Move_CORROSIVE_GAS::
end @to do:
Expand Down
100 changes: 96 additions & 4 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,51 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_RISING_VOLTAGE
.4byte BattleScript_EffectHit @ EFFECT_BEAK_BLAST
.4byte BattleScript_EffectCourtChange @ EFFECT_COURT_CHANGE
.4byte BattleScript_EffectSteelBeam @ EFFECT_STEEL_BEAM

BattleScript_EffectSteelBeam::
attackcanceler
attackstring
ppreduce
accuracycheck BattleScript_SteelBeamMiss, ACC_CURR_MOVE
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_SteelBeamAfterSelfDamage
call BattleScript_SteelBeamSelfDamage
BattleScript_SteelBeamAfterSelfDamage::
waitstate
tryfaintmon BS_ATTACKER
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
BattleScript_SteelBeamMiss::
pause B_WAIT_TIME_SHORT
effectivenesssound
resultmessage
waitmessage B_WAIT_TIME_LONG
jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_MoveEnd
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED
call BattleScript_SteelBeamSelfDamage
orhalfword gMoveResultFlags, MOVE_RESULT_MISSED
goto BattleScript_SteelBeamAfterSelfDamage

BattleScript_SteelBeamSelfDamage::
dmg_1_2_attackerhp
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
return

BattleScript_EffectCourtChange::
attackcanceler
Expand Down Expand Up @@ -1272,6 +1317,7 @@ BattleScript_StrengthSapTryHp:
attackanimation
waitanimation
BattleScript_StrengthSapHp:
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveEnd
jumpiffullhp BS_ATTACKER, BattleScript_MoveEnd
manipulatedamage DMG_BIG_ROOT
healthbarupdate BS_ATTACKER
Expand Down Expand Up @@ -2106,7 +2152,9 @@ BattleScript_GrowthDoMoveAnim::
waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPATK, 0
.if B_GROWTH_UNDER_SUN >= GEN_5
jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthAtk2
.endif
setstatchanger STAT_ATK, 1, FALSE
goto BattleScript_GrowthAtk
BattleScript_GrowthAtk2:
Expand All @@ -2117,7 +2165,9 @@ BattleScript_GrowthAtk:
printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG
BattleScript_GrowthTrySpAtk::
.if B_GROWTH_UNDER_SUN >= GEN_5
jumpifweatheraffected BS_ATTACKER, B_WEATHER_SUN, BattleScript_GrowthSpAtk2
.endif
setstatchanger STAT_SPATK, 1, FALSE
goto BattleScript_GrowthSpAtk
BattleScript_GrowthSpAtk2:
Expand Down Expand Up @@ -2340,7 +2390,7 @@ BattleScript_EffectPsychicTerrain:
waitanimation
printfromtable gTerrainStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_SCRIPTING, B_ANIM_RESTORE_BG
playanimation BS_ATTACKER, B_ANIM_RESTORE_BG
call BattleScript_TerrainSeedLoop
jumpifabilitypresent ABILITY_MIMICRY, BattleScript_ApplyMimicry
goto BattleScript_MoveEnd
Expand Down Expand Up @@ -2409,6 +2459,8 @@ BattleScript_EffectHealPulse:
attackcanceler
attackstring
ppreduce
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveUsedHealBlockPrevents @ stops pollen puff
jumpifstatus3 BS_TARGET, STATUS3_HEAL_BLOCK, BattleScript_MoveUsedHealBlockPrevents
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
jumpifsubstituteblocks BattleScript_ButItFailed
tryhealpulse BS_TARGET, BattleScript_AlreadyAtFullHp
Expand Down Expand Up @@ -3103,6 +3155,7 @@ BattleScript_EffectAbsorb::
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock
setdrainedhp
manipulatedamage DMG_BIG_ROOT
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE
Expand All @@ -3122,6 +3175,7 @@ BattleScript_AbsorbUpdateHp::
waitmessage B_WAIT_TIME_LONG
BattleScript_AbsorbTryFainting::
tryfaintmon BS_ATTACKER
BattleScript_AbsorbHealBlock::
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd

Expand Down Expand Up @@ -3228,6 +3282,7 @@ BattleScript_DreamEaterWorked:
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_DreamEaterTryFaintEnd
setdrainedhp
manipulatedamage DMG_BIG_ROOT
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
Expand Down Expand Up @@ -4533,7 +4588,11 @@ BattleScript_NightmareWorked::
BattleScript_EffectMinimize::
attackcanceler
setminimize
.if B_MINIMIZE_EVASION >= GEN_5
setstatchanger STAT_EVASION, 2, FALSE
.else
setstatchanger STAT_EVASION, 1, FALSE
.endif
goto BattleScript_EffectStatUpAfterAtkCanceler

BattleScript_EffectCurse::
Expand Down Expand Up @@ -6235,12 +6294,30 @@ BattleScript_LocalBattleLost::
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd
jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, TRAINER_SECRET_BASE, BattleScript_LocalBattleLostEnd
BattleScript_LocalBattleLostPrintWhiteOut::
.if B_WHITEOUT_MONEY >= GEN_4
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostEnd
printstring STRINGID_PLAYERWHITEOUT
waitmessage B_WAIT_TIME_LONG
getmoneyreward
printstring STRINGID_PLAYERWHITEOUT2
waitmessage B_WAIT_TIME_LONG
end2
BattleScript_LocalBattleLostEnd::
printstring STRINGID_PLAYERLOSTTOENEMYTRAINER
waitmessage B_WAIT_TIME_LONG
getmoneyreward
printstring STRINGID_PLAYERPAIDPRIZEMONEY
waitmessage B_WAIT_TIME_LONG
end2
.else
printstring STRINGID_PLAYERWHITEOUT
waitmessage B_WAIT_TIME_LONG
printstring STRINGID_PLAYERWHITEOUT2
waitmessage B_WAIT_TIME_LONG
BattleScript_LocalBattleLostEnd::
end2
.endif

BattleScript_CheckDomeDrew::
jumpifbyte CMP_EQUAL, gBattleOutcome, B_OUTCOME_DREW, BattleScript_LocalBattleLostEnd_
BattleScript_LocalBattleLostPrintTrainersWinText::
Expand Down Expand Up @@ -6482,9 +6559,11 @@ BattleScript_LearnMoveReturn::
BattleScript_RainContinuesOrEnds::
printfromtable gRainContinuesStringIds
waitmessage B_WAIT_TIME_LONG
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainEnds
playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES
BattleScript_RainContinuesOrEndsEnd::
end2
BattleScript_RainEnds::
call BattleScript_WeatherFormChanges
end2

BattleScript_DamagingWeatherContinues::
Expand Down Expand Up @@ -6523,6 +6602,7 @@ BattleScript_DamagingWeatherContinuesEnd::
BattleScript_SandStormHailEnds::
printfromtable gSandStormHailEndStringIds
waitmessage B_WAIT_TIME_LONG
call BattleScript_WeatherFormChanges
end2

BattleScript_SunlightContinues::
Expand All @@ -6534,6 +6614,7 @@ BattleScript_SunlightContinues::
BattleScript_SunlightFaded::
printstring STRINGID_SUNLIGHTFADED
waitmessage B_WAIT_TIME_LONG
call BattleScript_WeatherFormChanges
end2

BattleScript_OverworldWeatherStarts::
Expand Down Expand Up @@ -7955,7 +8036,7 @@ BattleScript_DrizzleActivates::
call BattleScript_WeatherFormChanges
end3

BattleScript_DefiantActivates::
BattleScript_AbilityRaisesDefenderStat::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
statbuffchange 0, NULL
Expand Down Expand Up @@ -8235,8 +8316,10 @@ BattleScript_DesolateLandEvaporatesWaterTypeMoves::
attackstring
pause B_WAIT_TIME_SHORT
ppreduce
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd
printstring STRINGID_MOVEEVAPORATEDINTHEHARSHSUNLIGHT
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_STRING_PRINTED
goto BattleScript_MoveEnd

BattleScript_PrimordialSeaActivates::
Expand All @@ -8253,8 +8336,10 @@ BattleScript_PrimordialSeaFizzlesOutFireTypeMoves::
attackstring
pause B_WAIT_TIME_SHORT
ppreduce
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_STRING_PRINTED, BattleScript_MoveEnd
printstring STRINGID_MOVEFIZZLEDOUTINTHEHEAVYRAIN
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_STRING_PRINTED
goto BattleScript_MoveEnd

BattleScript_DeltaStreamActivates::
Expand Down Expand Up @@ -8465,6 +8550,13 @@ BattleScript_ObliviousPreventsAttraction::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_FlinchPrevention::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXPREVENTSFLINCHING
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_OwnTempoPrevents::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
Expand Down
2 changes: 1 addition & 1 deletion data/maps/TrainerHill_Entrance/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ TrainerHill_Entrance_EventScript_ChooseChallenge::
switch VAR_RESULT
case 4, TrainerHill_Entrance_EventScript_CancelEntry
case MULTI_B_PRESSED, TrainerHill_Entrance_EventScript_CancelEntry
trainerhill_settag VAR_RESULT
trainerhill_setmode VAR_RESULT
setvar VAR_TRAINER_HILL_IS_ACTIVE, 1
setvar VAR_TEMP_5, 0
special HealPlayerParty
Expand Down
19 changes: 19 additions & 0 deletions graphics/battle_anims/sprites/new/poltergeist.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
246 246 246
246 246 246
213 197 230
213 197 230
180 148 213
180 148 213
180 148 213
148 98 197
115 65 164
82 32 131
82 32 131
82 32 131
0 0 0
0 0 0
0 0 0
Binary file not shown.
1 change: 1 addition & 0 deletions graphics/trainer_hill/maps_expert/floor_0/metatiles.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1;;;9989:;;;1;;;;;,99:;;;;;1;;;;isMMMM�MMMMis@;UUUU�UUUU1AiA���ٚ����Asi;�ۛsss���1si;͛ssDss��1si;�ۛsss���1siA���ۛ����As@;�������1Ai;MMgg���ggMM1si;UU�������UU1si;9999:;;9999:sissssssssssssss
Binary file not shown.
1 change: 1 addition & 0 deletions graphics/trainer_hill/maps_expert/floor_1/metatiles.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1;;;9989:;;;�FFFFFFFFFFFFFx�F�|���}�|�{�z��F}FFFFFFFFFFFF�F�~���}�~������FFFFFFFFFFFFF��F�}�|�{�z�|����F�FFFFFFFFFFFF�F�|�}�~���}�~��FFFFFFFFFFFFF��֖�����֖���֛֖�������֖��������������֖���֖�������֖�����֖�����֖���֛
1 change: 1 addition & 0 deletions graphics/trainer_hill/maps_expert/floor_2/collision.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
����>�>}~=x�=x}~y>�>��
1 change: 1 addition & 0 deletions graphics/trainer_hill/maps_expert/floor_2/metatiles.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Binary file not shown.
1 change: 1 addition & 0 deletions graphics/trainer_hill/maps_expert/floor_3/metatiles.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1;;;9999:;;;�������F��������������F������������FF�FF���������F66�66F�������F�FF�FF�F�����F6F���ۛF6F����F6�����ۛ6F��������֖��ۛ�����F6�����ۛ6F����F6F���ۛF6F�����F�FF�FF�F�������F66�66F���������FF�FF������������F��������������F�������
Loading

0 comments on commit 8f728dc

Please sign in to comment.