From 4763b2d85f050ea49245f7d283e29e239766da02 Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 17 Sep 2023 12:13:23 -0400 Subject: [PATCH 1/8] add information for macOS users I included details of what I needed to do to get this to compile on macOS --- INSTALL.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index a76d0acc75..946e792464 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -294,7 +294,11 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for ``` The command with gba-dev will ask for the selection of packages to install. Just press Enter to install all of them, followed by entering Y to proceed with the installation. +
+ Note for users with trouble running 'sudo dkp-pacman -Sy'... +> Using a VPN may help accesing devkitpro servers. +
4. After the tools are installed, devkitARM must now be made accessible from anywhere by the system. To do so, run the following commands: ```bash @@ -389,6 +393,13 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for > scanning them which might improve performance while building. +
+ Note for macOS users... + +> If make fails, try following +> [these instructions](https://support.apple.com/en-us/HT211861) to open Terminal using Rosetta. +
+ 1. If pokeemerald is not already downloaded (some users may prefer to download pokeemerald via a git client like GitHub Desktop), run: ```bash From c4e664b4717ab1d3fc0b770e1dfe533028bca334 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 21 Sep 2023 13:08:15 -0400 Subject: [PATCH 2/8] Update INSTALL.md --- INSTALL.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 946e792464..a6feb94dd0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -270,6 +270,11 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for > This guide installs libpng via Homebrew as it is the easiest method, however advanced users can install libpng through other means if they so desire. +
+ Note for Apple Silicon (M1) Mac users... + +> Currently, Homebrew and libng must be installed via Rosetta on Apple Silicon Macs. Before continuing, create a [Terminal shell profile with Rosetta](https://www.astroworldcreations.com/blog/apple-silicon-and-legacy-command-line-software). Be sure to run the commands corresponding to Apple Silicon (M1). +
1. Open the Terminal. 2. If Homebrew is not installed, then install [Homebrew](https://brew.sh/) by following the instructions on the website. @@ -393,13 +398,6 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for > scanning them which might improve performance while building. -
- Note for macOS users... - -> If make fails, try following -> [these instructions](https://support.apple.com/en-us/HT211861) to open Terminal using Rosetta. -
- 1. If pokeemerald is not already downloaded (some users may prefer to download pokeemerald via a git client like GitHub Desktop), run: ```bash From 1f3fde5dd2347dcaa8fb1dd6ce27e51d175320fd Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 21 Sep 2023 13:10:14 -0400 Subject: [PATCH 3/8] Update INSTALL.md --- INSTALL.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index a6feb94dd0..b1005ae80c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -281,7 +281,8 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for 3. Run the following command to install libpng. ```bash - brew install libpng + brew install libpng # Intel Macs + /usr/local/bin/brew install libpng # Apple Silicon (M1) Macs ``` libpng is now installed. From 9891b212a7861400b2e7a8d186ebe268559f93c3 Mon Sep 17 00:00:00 2001 From: Jack Date: Thu, 21 Sep 2023 13:13:01 -0400 Subject: [PATCH 4/8] added the devkit* install instructions --- INSTALL.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index b1005ae80c..bf03f3b9ef 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -309,11 +309,14 @@ If this works, then proceed to [Installation](#installation). Otherwise, ask for ```bash export DEVKITPRO=/opt/devkitpro - echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc + echo "export DEVKITPRO=$DEVKITPRO" >> ~/.bashrc # Intel Macs + echo "export DEVKITPRO=$DEVKITPRO" >> ~/.zshrc # Apple Silicon (M1) Macs export DEVKITARM=$DEVKITPRO/devkitARM - echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc + echo "export DEVKITARM=$DEVKITARM" >> ~/.bashrc # Intel Macs + echo "export DEVKITARM=$DEVKITARM" >> ~/.zshrc # Apple Silicon (M1) Macs - echo "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi" >> ~/.bash_profile + echo "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi" >> ~/.bash_profile # Intel Macs + echo "if [ -f ~/.zshrc ]; then . ~/.zshrc; fi" >> ~/.zprofile # Apple Silicon (M1) Macs ``` ### Choosing where to store pokeemerald (macOS) From 22be29e80e4384199203c73d811a5f90f1fc5f67 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 24 Oct 2023 12:42:43 -0400 Subject: [PATCH 5/8] soft exp cap --- include/event_data.h | 5 ++ src/battle_script_commands.c | 89 +++++++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/include/event_data.h b/include/event_data.h index b1fa694601..93b265e16c 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -1,6 +1,8 @@ #ifndef GUARD_EVENT_DATA_H #define GUARD_EVENT_DATA_H +#define NUM_SOFT_CAPS 8 + void InitEventData(void); void ClearTempFieldEventData(void); void ClearDailyFlags(void); @@ -46,4 +48,7 @@ extern u16 gSpecialVar_MonBoxId; extern u16 gSpecialVar_MonBoxPos; extern u16 gSpecialVar_Unused_0x8014; +extern const u16 sLevelCapFlags[NUM_SOFT_CAPS]; +extern const u16 sLevelCaps[NUM_SOFT_CAPS]; + #endif // GUARD_EVENT_DATA_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9d2c2cb715..2b8ade6522 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -326,6 +326,24 @@ static void Cmd_finishaction(void); static void Cmd_finishturn(void); static void Cmd_trainerslideout(void); +const u16 sLevelCapFlags[NUM_SOFT_CAPS] = +{ + FLAG_BADGE01_GET, FLAG_BADGE02_GET, FLAG_BADGE03_GET, FLAG_BADGE04_GET, + FLAG_BADGE05_GET, FLAG_BADGE06_GET, FLAG_BADGE07_GET, FLAG_BADGE08_GET, +}; + +const u16 sLevelCaps[NUM_SOFT_CAPS] = { 10, 20, 30, 40, 50, 60, 70, 80 }; +const double sLevelCapReduction[7] = { .5, .33, .25, .20, .15, .10, .05 }; +const double sRelativePartyScaling[27] = +{ + 3.00, 2.75, 2.50, 2.33, 2.25, + 2.00, 1.80, 1.70, 1.60, 1.50, + 1.40, 1.30, 1.20, 1.10, 1.00, + 0.90, 0.80, 0.75, 0.66, 0.50, + 0.40, 0.33, 0.25, 0.20, 0.15, + 0.10, 0.05, +}; + void (* const gBattleScriptingCommandsTable[])(void) = { Cmd_attackcanceler, //0x0 @@ -3219,6 +3237,72 @@ static void Cmd_jumpiftype(void) gBattlescriptCurrInstr += 7; } +u8 GetTeamLevel(void) +{ + u8 i; + u16 partyLevel = 0; + u16 threshold = 0; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE) + partyLevel += gPlayerParty[i].level; + else + break; + } + partyLevel /= i; + + threshold = partyLevel * .8; + partyLevel = 0; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE) + { + if (gPlayerParty[i].level >= threshold) + partyLevel += gPlayerParty[i].level; + } + else + break; + } + partyLevel /= i; + + return partyLevel; +} + +double GetPkmnExpMultiplier(u8 level) +{ + u8 i; + double lvlCapMultiplier = 1.0; + u8 levelDiff; + s8 avgDiff; + + // multiply the usual exp yield by the soft cap multiplier + for (i = 0; i < NUM_SOFT_CAPS; i++) + { + if (!FlagGet(sLevelCapFlags[i]) && level >= sLevelCaps[i]) + { + levelDiff = level - sLevelCaps[i]; + if (levelDiff > 6) + levelDiff = 6; + lvlCapMultiplier = sLevelCapReduction[levelDiff]; + break; + } + } + + // multiply the usual exp yield by the party level multiplier + avgDiff = level - GetTeamLevel(); + + if (avgDiff >= 12) + avgDiff = 12; + else if (avgDiff <= -14) + avgDiff = -14; + + avgDiff += 14; + + return lvlCapMultiplier * sRelativePartyScaling[avgDiff]; +} + static void Cmd_getexp(void) { u16 item; @@ -3333,13 +3417,14 @@ static void Cmd_getexp(void) if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP)) { + double expMultiplier = GetPkmnExpMultiplier(gPlayerParty[gBattleStruct->expGetterMonId].level); if (gBattleStruct->sentInPokes & 1) - gBattleMoveDamage = *exp; + gBattleMoveDamage = *exp * expMultiplier * 1.2; else gBattleMoveDamage = 0; if (holdEffect == HOLD_EFFECT_EXP_SHARE) - gBattleMoveDamage += gExpShareExp; + gBattleMoveDamage += gExpShareExp * expMultiplier; if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) From 4f7d5b6f22f91a2b85e97145a5a987ba676875e7 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 25 Oct 2023 09:01:23 -0400 Subject: [PATCH 6/8] update level caps --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2b8ade6522..08c6c3ea56 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -332,7 +332,7 @@ const u16 sLevelCapFlags[NUM_SOFT_CAPS] = FLAG_BADGE05_GET, FLAG_BADGE06_GET, FLAG_BADGE07_GET, FLAG_BADGE08_GET, }; -const u16 sLevelCaps[NUM_SOFT_CAPS] = { 10, 20, 30, 40, 50, 60, 70, 80 }; +const u16 sLevelCaps[NUM_SOFT_CAPS] = { 20, 25, 30, 35, 40, 50, 60, 70 }; const double sLevelCapReduction[7] = { .5, .33, .25, .20, .15, .10, .05 }; const double sRelativePartyScaling[27] = { From f37858fc478ff1b17f8633d6cf7b2b065af3dc06 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 25 Oct 2023 09:02:04 -0400 Subject: [PATCH 7/8] Revert "update level caps" This reverts commit 4f7d5b6f22f91a2b85e97145a5a987ba676875e7. --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 08c6c3ea56..2b8ade6522 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -332,7 +332,7 @@ const u16 sLevelCapFlags[NUM_SOFT_CAPS] = FLAG_BADGE05_GET, FLAG_BADGE06_GET, FLAG_BADGE07_GET, FLAG_BADGE08_GET, }; -const u16 sLevelCaps[NUM_SOFT_CAPS] = { 20, 25, 30, 35, 40, 50, 60, 70 }; +const u16 sLevelCaps[NUM_SOFT_CAPS] = { 10, 20, 30, 40, 50, 60, 70, 80 }; const double sLevelCapReduction[7] = { .5, .33, .25, .20, .15, .10, .05 }; const double sRelativePartyScaling[27] = { From ed65084cf34001034da0bede86056bceedd1fb77 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 25 Oct 2023 09:02:10 -0400 Subject: [PATCH 8/8] Revert "soft exp cap" This reverts commit 22be29e80e4384199203c73d811a5f90f1fc5f67. --- include/event_data.h | 5 -- src/battle_script_commands.c | 89 +----------------------------------- 2 files changed, 2 insertions(+), 92 deletions(-) diff --git a/include/event_data.h b/include/event_data.h index 93b265e16c..b1fa694601 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -1,8 +1,6 @@ #ifndef GUARD_EVENT_DATA_H #define GUARD_EVENT_DATA_H -#define NUM_SOFT_CAPS 8 - void InitEventData(void); void ClearTempFieldEventData(void); void ClearDailyFlags(void); @@ -48,7 +46,4 @@ extern u16 gSpecialVar_MonBoxId; extern u16 gSpecialVar_MonBoxPos; extern u16 gSpecialVar_Unused_0x8014; -extern const u16 sLevelCapFlags[NUM_SOFT_CAPS]; -extern const u16 sLevelCaps[NUM_SOFT_CAPS]; - #endif // GUARD_EVENT_DATA_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2b8ade6522..9d2c2cb715 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -326,24 +326,6 @@ static void Cmd_finishaction(void); static void Cmd_finishturn(void); static void Cmd_trainerslideout(void); -const u16 sLevelCapFlags[NUM_SOFT_CAPS] = -{ - FLAG_BADGE01_GET, FLAG_BADGE02_GET, FLAG_BADGE03_GET, FLAG_BADGE04_GET, - FLAG_BADGE05_GET, FLAG_BADGE06_GET, FLAG_BADGE07_GET, FLAG_BADGE08_GET, -}; - -const u16 sLevelCaps[NUM_SOFT_CAPS] = { 10, 20, 30, 40, 50, 60, 70, 80 }; -const double sLevelCapReduction[7] = { .5, .33, .25, .20, .15, .10, .05 }; -const double sRelativePartyScaling[27] = -{ - 3.00, 2.75, 2.50, 2.33, 2.25, - 2.00, 1.80, 1.70, 1.60, 1.50, - 1.40, 1.30, 1.20, 1.10, 1.00, - 0.90, 0.80, 0.75, 0.66, 0.50, - 0.40, 0.33, 0.25, 0.20, 0.15, - 0.10, 0.05, -}; - void (* const gBattleScriptingCommandsTable[])(void) = { Cmd_attackcanceler, //0x0 @@ -3237,72 +3219,6 @@ static void Cmd_jumpiftype(void) gBattlescriptCurrInstr += 7; } -u8 GetTeamLevel(void) -{ - u8 i; - u16 partyLevel = 0; - u16 threshold = 0; - - for (i = 0; i < PARTY_SIZE; i++) - { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE) - partyLevel += gPlayerParty[i].level; - else - break; - } - partyLevel /= i; - - threshold = partyLevel * .8; - partyLevel = 0; - - for (i = 0; i < PARTY_SIZE; i++) - { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE) - { - if (gPlayerParty[i].level >= threshold) - partyLevel += gPlayerParty[i].level; - } - else - break; - } - partyLevel /= i; - - return partyLevel; -} - -double GetPkmnExpMultiplier(u8 level) -{ - u8 i; - double lvlCapMultiplier = 1.0; - u8 levelDiff; - s8 avgDiff; - - // multiply the usual exp yield by the soft cap multiplier - for (i = 0; i < NUM_SOFT_CAPS; i++) - { - if (!FlagGet(sLevelCapFlags[i]) && level >= sLevelCaps[i]) - { - levelDiff = level - sLevelCaps[i]; - if (levelDiff > 6) - levelDiff = 6; - lvlCapMultiplier = sLevelCapReduction[levelDiff]; - break; - } - } - - // multiply the usual exp yield by the party level multiplier - avgDiff = level - GetTeamLevel(); - - if (avgDiff >= 12) - avgDiff = 12; - else if (avgDiff <= -14) - avgDiff = -14; - - avgDiff += 14; - - return lvlCapMultiplier * sRelativePartyScaling[avgDiff]; -} - static void Cmd_getexp(void) { u16 item; @@ -3417,14 +3333,13 @@ static void Cmd_getexp(void) if (GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_HP)) { - double expMultiplier = GetPkmnExpMultiplier(gPlayerParty[gBattleStruct->expGetterMonId].level); if (gBattleStruct->sentInPokes & 1) - gBattleMoveDamage = *exp * expMultiplier * 1.2; + gBattleMoveDamage = *exp; else gBattleMoveDamage = 0; if (holdEffect == HOLD_EFFECT_EXP_SHARE) - gBattleMoveDamage += gExpShareExp * expMultiplier; + gBattleMoveDamage += gExpShareExp; if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)