Skip to content

Commit

Permalink
Merge branch '_RHH/master' into _RHH/upcoming
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Dec 31, 2024
2 parents 51cfb96 + e127559 commit 004efd1
Show file tree
Hide file tree
Showing 18 changed files with 250 additions and 84 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ $(C_BUILDDIR)/pokedex_plus_hgss.o: CFLAGS := -mthumb -mthumb-interwork -O2 -mabi
# Annoyingly we can't turn this on just for src/data/trainers.h
$(C_BUILDDIR)/data.o: CFLAGS += -fno-show-column -fno-diagnostics-show-caret

$(TEST_BUILDDIR)/%.o: CFLAGS := -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -Wno-pointer-to-int-cast -Werror -Wall -Wno-strict-aliasing -Wno-attribute-alias -Woverride-init

# Dependency rules (for the *.c & *.s sources to .o files)
# Have to be explicit or else missing files won't be reported.

Expand Down
89 changes: 42 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# pokeemerald-expansion

### Important: DO NOT use GitHub's "Download Zip" option. Using this option will not download the commit history required to update your expansion version or merge other feature branches. Instead, please read [this guide](https://github.com/Pawkkie/Team-Aquas-Asset-Repo/wiki/The-Basics-of-GitHub) to learn how to fork the repository and clone locally from there.
pokeemerald-expansion is ***a romhack base*** based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. ***It is NOT a playable romhack,*** but it has multiple features available to romhackers so that they can create their own games, so it's not meant to be played on its own.

## What is pokeemerald-expansion?

pokeemerald-expansion is a decomp hack base project based off pret's [pokeemerald](https://github.com/pret/pokeemerald) decompilation project. It's recommended that any new projects that plan on using it, to clone this repository instead of pret's vanilla repository, as we regurlarly incorporate pret's documentation changes. This is ***NOT*** a standalone romhack, and as such, most features will be unavailable and/or unbalanced if played as is.
## Should I use this or vanilla pokeemerald for my hack?
The main advantage of using vanilla pokeemerald as a base is being able to link with other official GBA Pokémon games for battles and trading, pokeemerald-expansion can battle and trade with itself out of the box. If you don't mind losing full vanilla compatiblitity, we recommend using pokeemerald-expansion. Otherwise, use pret's pokeemerald. You'll still receive documentation improvements from pret, as we regurlarly incorporate pret's documentation changes.

## Using pokeemerald-expansion

Expand All @@ -14,8 +13,46 @@ You can phrase it as the following:
Based off RHH's pokeemerald-expansion 1.10.0 https://github.com/rh-hideout/pokeemerald-expansion/
```

#### Important: DO NOT use GitHub's "Download Zip" option. Using this option will not download the commit history required to update your expansion version or merge other feature branches. Instead, please read [this guide](https://github.com/Pawkkie/Team-Aquas-Asset-Repo/wiki/The-Basics-of-GitHub) to learn how to fork the repository and clone locally from there.

Please follow the instructions in `INSTALL.md` to get pokeemerald-expansion set up on your machine.

### If I already have a project based on regular pokeemerald, can I use pokeemerald-expansion?
Yes! Keep in mind that we keep up with pret's documentation of pokeemerald, which means that if your project a bit old, you might get merge conflicts that you need to solve manually.
- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`.
- Once you have your remote set up, run the command `git pull RHH master`.

With this, you'll get the latest version of pokeemerald-expansion, plus a couple of bugfixes that haven't yet been released into the next patch version :)

## Documentation
[Please click here to visit our documentation page.](https://rh-hideout.github.io/pokeemerald-expansion/)

## **How do I update my version of pokeemerald-expansion?**
- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`.
- Check your current version.
- You can check in the debug menu's `Utilities -> Expansion Version` option.
- If the option is not available, you possibly have version 1.6.2 or older. In that case, please check the [changelogs](docs/CHANGELOG.md) to determine your version based on the features available on your repository.
- ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on. Check the [online documentation site](https://rh-hideout.github.io/pokeemerald-expansion/CHANGELOG.html) to see the latest versions of each step.)
- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.9.3, use `git pull RHH expansion/1.9.3`).
- ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on)
- Alternatively, you can update to unreleased versions of the expansion.
- ***master (stable):*** It contains unreleased **bugfixes** that will come in the next patch version. To merge, use `git pull RHH master`.
- ***upcoming (unstable, with potential bugs):*** It contains unreleased **features** that will come in the next minor version. To merge, use `git pull RHH upcoming`.

### Please consider crediting the entire [list of contributors](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits) in your project, as they have all worked hard to develop this project :)

## Who maintains the project?
The project was originally started by DizzyEgg alongside other contributors. Now it is maintained by a team in the ROM Hacking Hideout's community called the "Expansion Senate". ROM Hacking Hideout (RHH for short) is a Discord-based ROM hacking community specialized in Pokémon romhacks. A lot of the discussion in regards of the development of the project happens there.

[Click here to join the RHH Discord Server!](https://discord.gg/6CzjAG6GZk)

## There's a bug in the project. How do I let you guys know?
Please submit any issues with the project [here](https://github.com/rh-hideout/pokeemerald-expansion/issues) and make sure that the issue wasn't reported by someone else by searching using the filters. You may also join the Discord server to try getting more in-depth support from the team and other members of the server.

## Can I contribute even if I'm not a member of ROM Hacking Hideout?
Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers in due time.
Also, *please follow the Pull Request template and feel free to discuss how the reviews are being handled. **Communication is key!*** Don't feel discouraged if we take a bit to review your PR, we'll get to it.

## What features are included?
- ***IMPORTANT*❗❗ Read through these to learn what features you can toggle**:
- [Battle configurations](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/config/battle.h)
Expand Down Expand Up @@ -160,46 +197,4 @@ Please follow the instructions in `INSTALL.md` to get pokeemerald-expansion set
- All bugfixes from pret included.
- Fixed overworld snow effect.

There are some mechanics, moves and abilities that are missing and being developed. Check [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones) to see which ones.


### [Documentation on features can be found here](https://github.com/rh-hideout/pokeemerald-expansion/wiki)

## If I already have a project based on regular pokeemerald, can I use pokeemerald-expansion?
Yes! Keep in mind that we keep up with pret's documentation of pokeemerald, which means that if your project a bit old, you might get merge conflicts that you need to solve manually.
- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`.
- Once you have your remote set up, run the command `git pull RHH master`.

With this, you'll get the latest version of pokeemerald-expansion, plus a couple of bugfixes that haven't been released into the next patch version :)

## **How do I update my version of pokeemerald-expansion?**
- If you haven't set up a remote, run the command `git remote add RHH https://github.com/rh-hideout/pokeemerald-expansion`.
- Check your current version.
- You can check in the debug menu's `Utilities -> Expansion Version` option.
- If the option is not available, you possibly have version 1.6.2 or older. In that case, please check the [changelogs](CHANGELOG.md) to determine your version based on the features available on your repository.
- Once you have your remote set up, run the command `git pull RHH expansion/X.Y.Z`, replacing X, Y and Z with the digits of the respective version you want to update to (eg, to update to 1.10.0, use `git pull RHH expansion/1.10.0`).
- ***Important:*** If you are several versions behind, we recommend updating one minor version at a time, skipping directly to the latest patch version (eg, 1.5.3 -> 1.6.2 -> 1.7.4 and so on)
- Alternatively, you can update to unreleased versions of the expansion.
- ***master (stable):*** It contains unreleased **bugfixes** that will come in the next patch version. To merge, use `git pull RHH master`.
- ***upcoming (unstable, with potential bugs):*** It contains unreleased **features** that will come in the next minor version. To merge, use `git pull RHH upcoming`.

### Please consider crediting the entire [list of contributors](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits) in your project, as they have all worked hard to develop this project :)

## There's a bug in the project. How do I let you guys know?
Please submit any issues with the project [here](https://github.com/rh-hideout/pokeemerald-expansion/issues). Make sure that the issue wasn't reported by someone else by searching using the filters.

## Can I contribute even if I'm not a member of ROM Hacking Hideout?

Yes! Contributions are welcome via Pull Requests and they will be reviewed by maintainers. Don't feel discouraged if we take a bit to review your PR, we'll get to it.

## Who maintains the project?

The project was originally started by DizzyEgg alongside other contributors.

The project has now gotten larger and DizzyEgg is now maintaining the project as part of the ROM Hacking Hideout community. Some members of this community are taking on larger roles to help maintain the project.

## What is the ROM Hacking Hideout?

A Discord-based ROM hacking community that has many members who hack using the disassembly and decompilation projects for Pokémon. Quite a few contributors to the original feature branches by DizzyEgg were members of ROM Hacking Hideout. You can call it RHH for short!

[Click here to join the RHH Discord Server!](https://discord.gg/6CzjAG6GZk)
There are some mechanics, moves and abilities that are missing and being developed. Check [the project's milestones](https://github.com/rh-hideout/pokeemerald-expansion/milestones) and our [issues page](https://github.com/rh-hideout/pokeemerald-expansion/issues) to see which ones.
37 changes: 15 additions & 22 deletions data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -350,34 +350,27 @@ gBattleAnimMove_MetalBurst::
waitforvisualfinish
end

@Credits: Skeli
gBattleAnimMove_UTurn::
loadspritegfx ANIM_TAG_ROUND_SHADOW
loadspritegfx ANIM_TAG_SMALL_BUBBLES
loadspritegfx ANIM_TAG_RAZOR_LEAF
loadspritegfx ANIM_TAG_IMPACT
monbg ANIM_DEF_PARTNER
setalpha 12, 8
playsewithpan SE_M_FLY, SOUND_PAN_ATTACKER
createsprite gFlyBallUpSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 13, 336
playsewithpan SE_M_DOUBLE_TEAM, SOUND_PAN_ATTACKER
createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER
jumpretfalse UTurnVisible
createsprite gFlyBallAttackSpriteTemplate, ANIM_ATTACKER, 2, 20, TRUE
UTurnContinue:
delay 20
createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 1, 0
createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1
playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET
waitforvisualfinish
clearmonbg ANIM_DEF_PARTNER
createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER
jumpretfalse UTurnLast
splitbgprio ANIM_TARGET
setalpha 8, 8
invisible ANIM_ATTACKER
UTurnLast:
blendoff
playsewithpan SE_M_JUMP_KICK, SOUND_PAN_ATTACKER
createsprite gUTurnBallSpriteTemplate, ANIM_TARGET, 2, 0, 0, 21
waitforvisualfinish
playsewithpan SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER
createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0x0, 0x0, 1, 2
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1
createsprite gUTurnBallBackSpriteTemplate, ANIM_ATTACKER, 3, 4, 0, -16, 36
waitforvisualfinish
visible ANIM_ATTACKER
clearmonbg ANIM_TARGET
blendoff
end
UTurnVisible:
createsprite gFlyBallAttackSpriteTemplate, ANIM_ATTACKER, 2, 20, FALSE
goto UTurnContinue

gBattleAnimMove_CloseCombat::
loadspritegfx ANIM_TAG_IMPACT
Expand Down
2 changes: 1 addition & 1 deletion include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ s32 CalculateMoveDamageVars(struct DamageCalculationData *damageCalcData, u32 fi
uq4_12_t CalcTypeEffectivenessMultiplier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, u32 defAbility, bool32 recordAbilities);
uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef);
uq4_12_t GetTypeModifier(u32 atkType, u32 defType);
uq4_12_t GetTypeEffectiveness(struct Pokemon *mon, u8 moveType);
uq4_12_t GetOverworldTypeEffectiveness(struct Pokemon *mon, u8 moveType);
s32 GetStealthHazardDamage(u8 hazardType, u32 battler);
s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 maxHp);
bool32 CanMegaEvolve(u32 battler);
Expand Down
1 change: 1 addition & 0 deletions include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
// In Gen3, Effect Spore has a 10% chance to sleep, poison or paralyze, with an equal chance.
// In Gen4, it's 30%. In Gen5+ it has 11% to sleep, 9% chance to poison and 10% chance to paralyze.
#define B_PICKUP_WILD GEN_LATEST // In Gen9+, Pickup allows its user to pickup its own used item at the end of the turn in wild battles.
#define B_MAGIC_GUARD GEN_LATEST // In Gen4+, Magic Guard ignores immobilization caused by paralysis

// Item settings
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore HP activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
Expand Down
2 changes: 1 addition & 1 deletion include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
#define MOVE_EFFECT_SALT_CURE 87
#define MOVE_EFFECT_EERIE_SPELL 88

#define NUM_MOVE_EFFECTS 88
#define NUM_MOVE_EFFECTS 89

#define MOVE_EFFECT_AFFECTS_USER 0x2000
#define MOVE_EFFECT_CERTAIN 0x4000
Expand Down
10 changes: 10 additions & 0 deletions include/constants/generational_changes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef GUARD_CONSTANTS_GENERATIONAL_CHANGES_H
#define GUARD_CONSTANTS_GENERATIONAL_CHANGES_H

enum GenConfigTag
{
GEN_CONFIG_GALE_WINGS,
GEN_CONFIG_COUNT
};

#endif // GUARD_CONSTANTS_GENERATIONAL_CHANGES_H
41 changes: 41 additions & 0 deletions include/generational_changes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef GUARD_GENERATIONAL_CHANGES_H
#define GUARD_GENERATIONAL_CHANGES_H

#include "constants/generational_changes.h"
#include "config/battle.h"

static const u8 sGenerationalChanges[GEN_CONFIG_COUNT] =
{
[GEN_CONFIG_GALE_WINGS] = B_GALE_WINGS,
};

#if TESTING
extern u8 *gGenerationalChangesTestOverride;
#endif

static inline u32 GetGenConfig(enum GenConfigTag configTag)
{
if (configTag >= GEN_CONFIG_COUNT) return GEN_LATEST;
#if TESTING
if (gGenerationalChangesTestOverride == NULL) return sGenerationalChanges[configTag];
return gGenerationalChangesTestOverride[configTag];
#else
return sGenerationalChanges[configTag];
#endif
}

static inline void SetGenConfig(enum GenConfigTag configTag, u32 value)
{
#if TESTING
if (configTag >= GEN_CONFIG_COUNT) return;
if (gGenerationalChangesTestOverride == NULL) return;
gGenerationalChangesTestOverride[configTag] = value;
#endif
}

#if TESTING
void TestInitConfigData(void);
void TestFreeConfigData(void);
#endif

#endif // GUARD_GENERATIONAL_CHANGES_H
13 changes: 13 additions & 0 deletions include/test/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@
* GIVEN {
* FLAG_SET(FLAG_SYS_EXAMPLE_FLAG);
*
* WITH_CONFIG(configTag, value)
* Runs the test with a specified config override. `configTag` must be
* of `enum GenConfigTag`
* Example:
* GIVEN {
* WITH_CONFIG(GEN_CONFIG_GALE_WINGS, GEN_6);
* }
* The `value` may be inferred from a local variable, e.g. set by
* PARAMETRIZE.
*
* PLAYER(species) and OPPONENT(species)
* Adds the species to the player's or opponent's party respectively.
* The Pokémon can be further customized with the following functions:
Expand Down Expand Up @@ -488,6 +498,7 @@
#include "battle.h"
#include "battle_anim.h"
#include "data.h"
#include "generational_changes.h"
#include "item.h"
#include "random.h"
#include "recorded_battle.h"
Expand Down Expand Up @@ -822,6 +833,7 @@ struct moveWithPP {
#define AI_LOG AILogScores(__LINE__)

#define FLAG_SET(flagId) SetFlagForTest(__LINE__, flagId)
#define WITH_CONFIG(configTag, value) TestSetConfig(__LINE__, configTag, value)

#define PLAYER(species) for (OpenPokemon(__LINE__, B_SIDE_PLAYER, species); gBattleTestRunnerState->data.currentMon; ClosePokemon(__LINE__))
#define OPPONENT(species) for (OpenPokemon(__LINE__, B_SIDE_OPPONENT, species); gBattleTestRunnerState->data.currentMon; ClosePokemon(__LINE__))
Expand Down Expand Up @@ -855,6 +867,7 @@ struct moveWithPP {
#define Shadow(isShadow) Shadow_(__LINE__, shadow)

void SetFlagForTest(u32 sourceLine, u16 flagId);
void TestSetConfig(u32 sourceLine, enum GenConfigTag configTag, u32 value);
void ClearFlagAfterTest(void);
void OpenPokemon(u32 sourceLine, u32 side, u32 species);
void ClosePokemon(u32 sourceLine);
Expand Down
23 changes: 23 additions & 0 deletions src/battle_anim_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -4380,6 +4380,29 @@ const struct SpriteTemplate gSpriteTemplate_FlipTurnBack = {
.callback = AnimAbsorptionOrb
};

// U-Turn
const struct SpriteTemplate gUTurnBallSpriteTemplate =
{
.tileTag = ANIM_TAG_SMALL_BUBBLES,
.paletteTag = ANIM_TAG_RAZOR_LEAF,
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gAffineAnims_ShadowBall,
.callback = AnimShadowBall,
};

const struct SpriteTemplate gUTurnBallBackSpriteTemplate =
{
.tileTag = ANIM_TAG_SMALL_BUBBLES,
.paletteTag = ANIM_TAG_RAZOR_LEAF,
.oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gAffineAnims_ShadowBall,
.callback = AnimAbsorptionOrb,
};

// wicked blow
static const union AffineAnimCmd sSpriteAffineAnim_DrainPunchFist[] = {
AFFINEANIMCMD_FRAME(256, 256, 0, 1), //Double sprite size
Expand Down
3 changes: 2 additions & 1 deletion src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "event_data.h"
#include "evolution_scene.h"
#include "field_weather.h"
#include "generational_changes.h"
#include "graphics.h"
#include "gpu_regs.h"
#include "international_string_util.h"
Expand Down Expand Up @@ -4867,7 +4868,7 @@ s8 GetMovePriority(u32 battler, u16 move)
return gMovesInfo[MOVE_MAX_GUARD].priority;

if (ability == ABILITY_GALE_WINGS
&& (B_GALE_WINGS < GEN_7 || IsBattlerAtMaxHp(battler))
&& (GetGenConfig(GEN_CONFIG_GALE_WINGS) < GEN_7 || IsBattlerAtMaxHp(battler))
&& gMovesInfo[move].type == TYPE_FLYING)
{
priority++;
Expand Down
Loading

0 comments on commit 004efd1

Please sign in to comment.