Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-expansion into dev_gen9_abilities

This commit is contained in:
LOuroboros 2022-12-20 07:11:36 -03:00
commit 6153b8e904
20 changed files with 3684 additions and 9177 deletions

View File

@ -1,5 +1,11 @@
#!/usr/bin/perl #!/usr/bin/perl
# Usage:
# calcrom.pl <mapfile> [--data]
#
# mapfile: path to .map file output by LD
# data: set to output % breakdown of data
use IPC::Cmd qw[ run ]; use IPC::Cmd qw[ run ];
use Getopt::Long; use Getopt::Long;
@ -65,12 +71,13 @@ my $base_cmd = "nm $elffname | awk '{print \$3}' | grep '^[^_].\\{4\\}' | uniq";
# This looks for Unknown_, Unknown_, or sub_, followed by an address. Note that # This looks for Unknown_, Unknown_, or sub_, followed by an address. Note that
# it matches even if stuff precedes the unknown, like sUnknown/gUnknown. # it matches even if stuff precedes the unknown, like sUnknown/gUnknown.
my $undoc_cmd = "grep '[Uu]nknown_[0-9a-fA-F]\\{5,7\\}\\|sub_[0-9a-fA-F]\\{5,7\\}'"; my $undoc_regex = "'[Uu]nknown_[0-9a-fA-F]\\{5,7\\}\\|sub_[0-9a-fA-F]\\{5,7\\}'";
# This looks for every symbol with an address at the end of it. Some things are # This looks for every symbol with an address at the end of it. Some things are
# given a name based on their type / location, but still have an unknown purpose. # given a name based on their type / location, but still have an unknown purpose.
# For example, FooMap_EventScript_FFFFFFF. # For example, FooMap_EventScript_FFFFFFF.
my $partial_doc_cmd = "grep '_[0-28][0-9a-fA-F]\\{5,7\\}'"; # The above may be double counted here, and will need to be filtered out.
my $partial_doc_regex = "'_[0-28][0-9a-fA-F]\\{5,7\\}'";
my $count_cmd = "wc -l"; my $count_cmd = "wc -l";
@ -87,7 +94,7 @@ my $total_syms_as_string;
my $undocumented_as_string; my $undocumented_as_string;
(run ( (run (
command => "$base_cmd | $undoc_cmd | $count_cmd", command => "$base_cmd | grep $undoc_regex | $count_cmd",
buffer => \$undocumented_as_string, buffer => \$undocumented_as_string,
timeout => 60 timeout => 60
)) ))
@ -95,7 +102,7 @@ my $undocumented_as_string;
my $partial_documented_as_string; my $partial_documented_as_string;
(run ( (run (
command => "$base_cmd | $partial_doc_cmd | $count_cmd", command => "$base_cmd | grep $partial_doc_regex | grep -v $undoc_regex | $count_cmd",
buffer => \$partial_documented_as_string, buffer => \$partial_documented_as_string,
timeout => 60 timeout => 60
)) ))
@ -112,7 +119,7 @@ my $undocumented = $undocumented_as_string + 0;
$partial_documented_as_string =~ s/^\s+|\s+$//g; $partial_documented_as_string =~ s/^\s+|\s+$//g;
my $partial_documented = $partial_documented_as_string + 0; my $partial_documented = $partial_documented_as_string + 0;
(($partial_documented != 0) or (($partial_documented == 0) and ($partial_documented_as_string eq "0"))) (($partial_documented != 0) or (($partial_documented == 0) and ($partial_documented_as_string eq "0")))
or die "ERROR: Cannot convert string to num: '$partial_documented_as_string'"; or die "ERROR: Cannot convert string to num: '$partial_documented_as_string'";
$total_syms_as_string =~ s/^\s+|\s+$//g; $total_syms_as_string =~ s/^\s+|\s+$//g;
my $total_syms = $total_syms_as_string + 0; my $total_syms = $total_syms_as_string + 0;
@ -126,9 +133,6 @@ my $total = $src + $asm;
my $srcPct = sprintf("%.4f", 100 * $src / $total); my $srcPct = sprintf("%.4f", 100 * $src / $total);
my $asmPct = sprintf("%.4f", 100 * $asm / $total); my $asmPct = sprintf("%.4f", 100 * $asm / $total);
# partial_documented is double-counting the unknown_* and sub_* symbols.
$partial_documented = $partial_documented - $undocumented;
my $documented = $total_syms - ($undocumented + $partial_documented); my $documented = $total_syms - ($undocumented + $partial_documented);
my $docPct = sprintf("%.4f", 100 * $documented / $total_syms); my $docPct = sprintf("%.4f", 100 * $documented / $total_syms);
my $partialPct = sprintf("%.4f", 100 * $partial_documented / $total_syms); my $partialPct = sprintf("%.4f", 100 * $partial_documented / $total_syms);

View File

@ -2000,6 +2000,11 @@
.4byte \ptr .4byte \ptr
.endm .endm
.macro swapstats stat:req
various BS_ATTACKER, VARIOUS_SWAP_STATS
.byte \stat
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7 setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7

View File

@ -2732,10 +2732,10 @@ BattleScript_EffectSpeedSwap:
attackstring attackstring
ppreduce ppreduce
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
swapstatstages STAT_SPEED swapstats STAT_SPEED
attackanimation attackanimation
waitanimation waitanimation
printstring STRINGID_PKMNSWITCHEDSTATCHANGES printstring STRINGID_ATTACKERSWITCHEDSTATWITHTARGET
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd goto BattleScript_MoveEnd

View File

@ -109,40 +109,6 @@ $(TILESETGFXDIR)/secondary/pacifidlog/tiles.4bpp: %.4bpp: %.png
$(TILESETGFXDIR)/secondary/sootopolis/tiles.4bpp: %.4bpp: %.png $(TILESETGFXDIR)/secondary/sootopolis/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 328 -Wnum_tiles $(GFX) $< $@ -num_tiles 328 -Wnum_tiles
SOOTOPOLISANIMDIR := $(TILESETGFXDIR)/secondary/sootopolis/anim
$(SOOTOPOLISANIMDIR)/stormy_water/0.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/0_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/0_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/1.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/1_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/1_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/2.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/2_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/2_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/3.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/3_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/3_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/4.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/4_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/4_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/5.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/5_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/5_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/6.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/6_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/6_groudon.4bpp
@cat $^ >$@
$(SOOTOPOLISANIMDIR)/stormy_water/7.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/7_kyogre.4bpp \
$(SOOTOPOLISANIMDIR)/stormy_water/7_groudon.4bpp
@cat $^ >$@
$(TILESETGFXDIR)/secondary/battle_frontier_outside_west/tiles.4bpp: %.4bpp: %.png $(TILESETGFXDIR)/secondary/battle_frontier_outside_west/tiles.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 508 -Wnum_tiles $(GFX) $< $@ -num_tiles 508 -Wnum_tiles

View File

@ -579,7 +579,7 @@ struct BattleStruct
u16 synchronizeMoveEffect; u16 synchronizeMoveEffect;
bool8 anyMonHasTransformed; bool8 anyMonHasTransformed;
void (*savedCallback)(void); void (*savedCallback)(void);
u16 usedHeldItems[PARTY_SIZE][2]; // For each party member and side. For harvest, recycle u16 usedHeldItems[PARTY_SIZE][NUM_BATTLE_SIDES]; // For each party member and side. For harvest, recycle
u16 chosenItem[MAX_BATTLERS_COUNT]; u16 chosenItem[MAX_BATTLERS_COUNT];
u8 AI_itemType[2]; u8 AI_itemType[2];
u8 AI_itemFlags[2]; u8 AI_itemFlags[2];

View File

@ -299,80 +299,80 @@
#define ENUM_WEATHER_STRONG_WINDS 7 #define ENUM_WEATHER_STRONG_WINDS 7
// Move Effects // Move Effects
#define MOVE_EFFECT_SLEEP 0x1 #define MOVE_EFFECT_SLEEP 1
#define MOVE_EFFECT_POISON 0x2 #define MOVE_EFFECT_POISON 2
#define MOVE_EFFECT_BURN 0x3 #define MOVE_EFFECT_BURN 3
#define MOVE_EFFECT_FREEZE 0x4 #define MOVE_EFFECT_FREEZE 4
#define MOVE_EFFECT_PARALYSIS 0x5 #define MOVE_EFFECT_PARALYSIS 5
#define MOVE_EFFECT_TOXIC 0x6 #define MOVE_EFFECT_TOXIC 6
#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_TOXIC // All above move effects apply primary status #define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_TOXIC // All above move effects apply primary status
#define MOVE_EFFECT_CONFUSION 0x7 #define MOVE_EFFECT_CONFUSION 7
#define MOVE_EFFECT_FLINCH 0x8 #define MOVE_EFFECT_FLINCH 8
#define MOVE_EFFECT_TRI_ATTACK 0x9 #define MOVE_EFFECT_TRI_ATTACK 9
#define MOVE_EFFECT_UPROAR 0xA #define MOVE_EFFECT_UPROAR 10
#define MOVE_EFFECT_PAYDAY 0xB #define MOVE_EFFECT_PAYDAY 11
#define MOVE_EFFECT_CHARGING 0xC #define MOVE_EFFECT_CHARGING 12
#define MOVE_EFFECT_WRAP 0xD #define MOVE_EFFECT_WRAP 13
#define MOVE_EFFECT_BURN_UP 0xE // MOVE_EFFECT_BURN_UP replaces unused MOVE_EFFECT_RECOIL_25 so that stat change animations don't break #define MOVE_EFFECT_BURN_UP 14 // MOVE_EFFECT_BURN_UP replaces unused MOVE_EFFECT_RECOIL_25 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_1 0xF #define MOVE_EFFECT_ATK_PLUS_1 15
#define MOVE_EFFECT_DEF_PLUS_1 0x10 #define MOVE_EFFECT_DEF_PLUS_1 16
#define MOVE_EFFECT_SPD_PLUS_1 0x11 #define MOVE_EFFECT_SPD_PLUS_1 17
#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12 #define MOVE_EFFECT_SP_ATK_PLUS_1 18
#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13 #define MOVE_EFFECT_SP_DEF_PLUS_1 19
#define MOVE_EFFECT_ACC_PLUS_1 0x14 #define MOVE_EFFECT_ACC_PLUS_1 20
#define MOVE_EFFECT_EVS_PLUS_1 0x15 #define MOVE_EFFECT_EVS_PLUS_1 21
#define MOVE_EFFECT_ATK_MINUS_1 0x16 #define MOVE_EFFECT_ATK_MINUS_1 22
#define MOVE_EFFECT_DEF_MINUS_1 0x17 #define MOVE_EFFECT_DEF_MINUS_1 23
#define MOVE_EFFECT_SPD_MINUS_1 0x18 #define MOVE_EFFECT_SPD_MINUS_1 24
#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19 #define MOVE_EFFECT_SP_ATK_MINUS_1 25
#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A #define MOVE_EFFECT_SP_DEF_MINUS_1 26
#define MOVE_EFFECT_ACC_MINUS_1 0x1B #define MOVE_EFFECT_ACC_MINUS_1 27
#define MOVE_EFFECT_EVS_MINUS_1 0x1C #define MOVE_EFFECT_EVS_MINUS_1 28
#define MOVE_EFFECT_RECHARGE 0x1D #define MOVE_EFFECT_RECHARGE 29
#define MOVE_EFFECT_RAGE 0x1E #define MOVE_EFFECT_RAGE 30
#define MOVE_EFFECT_STEAL_ITEM 0x1F #define MOVE_EFFECT_STEAL_ITEM 31
#define MOVE_EFFECT_PREVENT_ESCAPE 0x20 #define MOVE_EFFECT_PREVENT_ESCAPE 32
#define MOVE_EFFECT_NIGHTMARE 0x21 #define MOVE_EFFECT_NIGHTMARE 33
#define MOVE_EFFECT_ALL_STATS_UP 0x22 #define MOVE_EFFECT_ALL_STATS_UP 34
#define MOVE_EFFECT_RAPIDSPIN 0x23 #define MOVE_EFFECT_RAPIDSPIN 35
#define MOVE_EFFECT_REMOVE_STATUS 0x24 #define MOVE_EFFECT_REMOVE_STATUS 36
#define MOVE_EFFECT_ATK_DEF_DOWN 0x25 #define MOVE_EFFECT_ATK_DEF_DOWN 37
#define MOVE_EFFECT_SCALE_SHOT 0x26 // MOVE_EFFECT_SCALE_SHOT replaces unused MOVE_EFFECT_RECOIL_33 so that stat change animations don't break #define MOVE_EFFECT_SCALE_SHOT 38 // MOVE_EFFECT_SCALE_SHOT replaces unused MOVE_EFFECT_RECOIL_33 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_2 0x27 #define MOVE_EFFECT_ATK_PLUS_2 39
#define MOVE_EFFECT_DEF_PLUS_2 0x28 #define MOVE_EFFECT_DEF_PLUS_2 40
#define MOVE_EFFECT_SPD_PLUS_2 0x29 #define MOVE_EFFECT_SPD_PLUS_2 41
#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A #define MOVE_EFFECT_SP_ATK_PLUS_2 42
#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B #define MOVE_EFFECT_SP_DEF_PLUS_2 43
#define MOVE_EFFECT_ACC_PLUS_2 0x2C #define MOVE_EFFECT_ACC_PLUS_2 44
#define MOVE_EFFECT_EVS_PLUS_2 0x2D #define MOVE_EFFECT_EVS_PLUS_2 45
#define MOVE_EFFECT_ATK_MINUS_2 0x2E #define MOVE_EFFECT_ATK_MINUS_2 46
#define MOVE_EFFECT_DEF_MINUS_2 0x2F #define MOVE_EFFECT_DEF_MINUS_2 47
#define MOVE_EFFECT_SPD_MINUS_2 0x30 #define MOVE_EFFECT_SPD_MINUS_2 48
#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31 #define MOVE_EFFECT_SP_ATK_MINUS_2 49
#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32 #define MOVE_EFFECT_SP_DEF_MINUS_2 50
#define MOVE_EFFECT_ACC_MINUS_2 0x33 #define MOVE_EFFECT_ACC_MINUS_2 51
#define MOVE_EFFECT_EVS_MINUS_2 0x34 #define MOVE_EFFECT_EVS_MINUS_2 52
#define MOVE_EFFECT_THRASH 0x35 #define MOVE_EFFECT_THRASH 53
#define MOVE_EFFECT_KNOCK_OFF 0x36 #define MOVE_EFFECT_KNOCK_OFF 54
#define MOVE_EFFECT_DEF_SPDEF_DOWN 0x37 #define MOVE_EFFECT_DEF_SPDEF_DOWN 55
#define MOVE_EFFECT_CLEAR_SMOG 0x38 #define MOVE_EFFECT_CLEAR_SMOG 56
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x39 #define MOVE_EFFECT_SP_ATK_TWO_DOWN 57
#define MOVE_EFFECT_SMACK_DOWN 0x3A #define MOVE_EFFECT_SMACK_DOWN 58
#define MOVE_EFFECT_FLAME_BURST 0x3B #define MOVE_EFFECT_FLAME_BURST 59
#define MOVE_EFFECT_FEINT 0x3C #define MOVE_EFFECT_FEINT 60
#define MOVE_EFFECT_SPECTRAL_THIEF 0x3D #define MOVE_EFFECT_SPECTRAL_THIEF 61
#define MOVE_EFFECT_V_CREATE 0x3E #define MOVE_EFFECT_V_CREATE 62
#define MOVE_EFFECT_HAPPY_HOUR 0x3F #define MOVE_EFFECT_HAPPY_HOUR 63
#define MOVE_EFFECT_CORE_ENFORCER 0x40 #define MOVE_EFFECT_CORE_ENFORCER 64
#define MOVE_EFFECT_THROAT_CHOP 0x41 #define MOVE_EFFECT_THROAT_CHOP 65
#define MOVE_EFFECT_INCINERATE 0x42 #define MOVE_EFFECT_INCINERATE 66
#define MOVE_EFFECT_BUG_BITE 0x43 #define MOVE_EFFECT_BUG_BITE 67
#define MOVE_EFFECT_RECOIL_HP_25 0x44 #define MOVE_EFFECT_RECOIL_HP_25 68
#define MOVE_EFFECT_RELIC_SONG 0x45 #define MOVE_EFFECT_RELIC_SONG 69
#define MOVE_EFFECT_TRAP_BOTH 0x46 #define MOVE_EFFECT_TRAP_BOTH 70
#define MOVE_EFFECT_DOUBLE_SHOCK 0x47 #define MOVE_EFFECT_DOUBLE_SHOCK 71
#define NUM_MOVE_EFFECTS 0x48 #define NUM_MOVE_EFFECTS 72
#define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000 #define MOVE_EFFECT_CERTAIN 0x8000

View File

@ -246,6 +246,7 @@
#define VARIOUS_CAN_TELEPORT 155 #define VARIOUS_CAN_TELEPORT 155
#define VARIOUS_GET_BATTLER_SIDE 156 #define VARIOUS_GET_BATTLER_SIDE 156
#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157 #define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157
#define VARIOUS_SWAP_STATS 158
// Cmd_manipulatedamage // Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0 #define DMG_CHANGE_SIGN 0

View File

@ -631,14 +631,15 @@
#define STRINGID_ATTACKERMELTEDTHEICE 629 #define STRINGID_ATTACKERMELTEDTHEICE 629
#define STRINGID_TARGETTOUGHEDITOUT 630 #define STRINGID_TARGETTOUGHEDITOUT 630
#define STRINGID_ATTACKERLOSTELECTRICTYPE 631 #define STRINGID_ATTACKERLOSTELECTRICTYPE 631
#define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 632 #define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 632
#define STRINGID_SUNLIGHTACTIVATEDABILITY 633 #define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 633
#define STRINGID_STATWASHEIGHTENED 634 #define STRINGID_SUNLIGHTACTIVATEDABILITY 634
#define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 635 #define STRINGID_STATWASHEIGHTENED 635
#define STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT 636 #define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 636
#define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 637 #define STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT 637
#define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 638
#define BATTLESTRINGS_COUNT 638 #define BATTLESTRINGS_COUNT 639
// This is the string id that gBattleStringsTable starts with. // This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table, // String ids before this (e.g. STRINGID_INTROMSG) are not in the table,

View File

@ -9,6 +9,8 @@
#define NUM_PALS_TOTAL 13 #define NUM_PALS_TOTAL 13
#define MAX_MAP_DATA_SIZE 10240 #define MAX_MAP_DATA_SIZE 10240
#define NUM_TILES_PER_METATILE 8
// Map coordinates are offset by 7 when using the map // Map coordinates are offset by 7 when using the map
// buffer because it needs to load sufficient border // buffer because it needs to load sufficient border
// metatiles to fill the player's view (the player has // metatiles to fill the player's view (the player has

View File

@ -11,6 +11,7 @@
#ifdef NDEBUG #ifdef NDEBUG
#define DebugPrintf(pBuf, ...) #define DebugPrintf(pBuf, ...)
#define DebugPrintfLevel(level, pBuf, ...)
#define MgbaOpen() #define MgbaOpen()
#define MgbaClose() #define MgbaClose()
#define AGBPrintInit() #define AGBPrintInit()
@ -29,18 +30,21 @@ void AGBPrintInit(void);
#if (LOG_HANDLER == LOG_HANDLER_MGBA_PRINT) #if (LOG_HANDLER == LOG_HANDLER_MGBA_PRINT)
#define DebugPrintf(pBuf, ...) MgbaPrintf(MGBA_LOG_INFO, pBuf, __VA_ARGS__) #define DebugPrintf(pBuf, ...) MgbaPrintf(MGBA_LOG_INFO, pBuf, ## __VA_ARGS__)
#define DebugAssert(pFile, nLine, pExpression, nStopProgram) MgbaAssert(pFile, nLine, pExpression, nStopProgram) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) MgbaAssert(pFile, nLine, pExpression, nStopProgram)
#define DebugPrintfLevel(level, pBuf, ...) MgbaPrintf(level, pBuf, ## __VA_ARGS__)
#elif (LOG_HANDLER == LOG_HANDLER_NOCASH_PRINT) #elif (LOG_HANDLER == LOG_HANDLER_NOCASH_PRINT)
#define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, __VA_ARGS__) #define DebugPrintf(pBuf, ...) NoCashGBAPrintf(pBuf, ## __VA_ARGS__)
#define DebugAssert(pFile, nLine, pExpression, nStopProgram) NoCashGBAAssert(pFile, nLine, pExpression, nStopProgram) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) NoCashGBAAssert(pFile, nLine, pExpression, nStopProgram)
#define DebugPrintfLevel(level, pBuf, ...) NoCashGBAPrintf(pBuf, ## __VA_ARGS__)
#else // Default to AGBPrint #else // Default to AGBPrint
#define DebugPrintf(pBuf, ...) AGBPrintf(const char *pBuf, ...) #define DebugPrintf(pBuf, ...) AGBPrintf(pBuf, ## __VA_ARGS__)
#define DebugAssert(pFile, nLine, pExpression, nStopProgram) AGBAssert(pFile, nLine, pExpression, nStopProgram) #define DebugAssert(pFile, nLine, pExpression, nStopProgram) AGBAssert(pFile, nLine, pExpression, nStopProgram)
#define DebugPrintfLevel(level, pBuf, ...) AGBPrintf(pBuf, ## __VA_ARGS__)
#endif #endif
#endif #endif

View File

@ -3042,8 +3042,8 @@ static void BattleStartClearSetData(void)
for (i = 0; i < PARTY_SIZE; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
gBattleStruct->usedHeldItems[i][0] = 0; gBattleStruct->usedHeldItems[i][B_SIDE_PLAYER] = 0;
gBattleStruct->usedHeldItems[i][1] = 0; gBattleStruct->usedHeldItems[i][B_SIDE_OPPONENT] = 0;
gBattleStruct->itemStolen[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); gBattleStruct->itemStolen[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
gPartyCriticalHits[i] = 0; gPartyCriticalHits[i] = 0;
} }
@ -4853,10 +4853,10 @@ static void TurnValuesCleanUp(bool8 var0)
gSpecialStatuses[gActiveBattler].parentalBondState = PARENTAL_BOND_OFF; gSpecialStatuses[gActiveBattler].parentalBondState = PARENTAL_BOND_OFF;
} }
gSideStatuses[0] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); gSideStatuses[B_SIDE_PLAYER] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);
gSideStatuses[1] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); gSideStatuses[B_SIDE_OPPONENT] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);
gSideTimers[0].followmeTimer = 0; gSideTimers[B_SIDE_PLAYER].followmeTimer = 0;
gSideTimers[1].followmeTimer = 0; gSideTimers[B_SIDE_OPPONENT].followmeTimer = 0;
} }
void SpecialStatusesClear(void) void SpecialStatusesClear(void)

View File

@ -760,6 +760,7 @@ static const u8 sText_AttackerHealedItsBurn[] = _("{B_ATK_NAME_WITH_PREFIX} heal
static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melted the ice with\nits fiery determination!"); static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melted the ice with\nits fiery determination!");
static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!");
static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} used up all\nof its electricity!"); static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} used up all\nof its electricity!");
static const u8 sText_AttackerSwitchedStatWithTarget[] = _("{B_ATK_NAME_WITH_PREFIX} switched {B_BUFF1}\nwith its target!");
static const u8 sText_BeingHitChargedPkmnWithPower[] = _("Being hit by {B_CURRENT_MOVE}\ncharged {B_ATK_NAME_WITH_PREFIX} with power!"); static const u8 sText_BeingHitChargedPkmnWithPower[] = _("Being hit by {B_CURRENT_MOVE}\ncharged {B_ATK_NAME_WITH_PREFIX} with power!");
static const u8 sText_SunlightActivatedAbility[] = _("The harsh sunlight activated\n{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}!"); static const u8 sText_SunlightActivatedAbility[] = _("The harsh sunlight activated\n{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}!");
static const u8 sText_StatWasHeightened[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1} was heightened!"); static const u8 sText_StatWasHeightened[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1} was heightened!");
@ -775,6 +776,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_STATWASHEIGHTENED - BATTLESTRINGS_TABLE_START] = sText_StatWasHeightened, [STRINGID_STATWASHEIGHTENED - BATTLESTRINGS_TABLE_START] = sText_StatWasHeightened,
[STRINGID_SUNLIGHTACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_SunlightActivatedAbility, [STRINGID_SUNLIGHTACTIVATEDABILITY - BATTLESTRINGS_TABLE_START] = sText_SunlightActivatedAbility,
[STRINGID_BEINGHITCHARGEDPKMNWITHPOWER - BATTLESTRINGS_TABLE_START] = sText_BeingHitChargedPkmnWithPower, [STRINGID_BEINGHITCHARGEDPKMNWITHPOWER - BATTLESTRINGS_TABLE_START] = sText_BeingHitChargedPkmnWithPower,
[STRINGID_ATTACKERSWITCHEDSTATWITHTARGET - BATTLESTRINGS_TABLE_START] = sText_AttackerSwitchedStatWithTarget,
[STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut, [STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut,
[STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce, [STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce,
[STRINGID_ATTACKERHEALEDITSBURN - BATTLESTRINGS_TABLE_START] = sText_AttackerHealedItsBurn, [STRINGID_ATTACKERHEALEDITSBURN - BATTLESTRINGS_TABLE_START] = sText_AttackerHealedItsBurn,

View File

@ -3497,16 +3497,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
gProtectStructs[gBattlerTarget].kingsShielded = FALSE; gProtectStructs[gBattlerTarget].kingsShielded = FALSE;
gProtectStructs[gBattlerTarget].banefulBunkered = FALSE; gProtectStructs[gBattlerTarget].banefulBunkered = FALSE;
gProtectStructs[gBattlerTarget].obstructed = FALSE; gProtectStructs[gBattlerTarget].obstructed = FALSE;
if (gCurrentMove == MOVE_FEINT) BattleScriptPush(gBattlescriptCurrInstr + 1);
{ if (gCurrentMove == MOVE_HYPERSPACE_FURY)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectFeint;
}
else if (gCurrentMove == MOVE_HYPERSPACE_FURY)
{
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_HyperspaceFuryRemoveProtect; gBattlescriptCurrInstr = BattleScript_HyperspaceFuryRemoveProtect;
} else
gBattlescriptCurrInstr = BattleScript_MoveEffectFeint;
} }
break; break;
case MOVE_EFFECT_SPECTRAL_THIEF: case MOVE_EFFECT_SPECTRAL_THIEF:
@ -10075,6 +10070,35 @@ static void Cmd_various(void)
return; return;
} }
break; break;
case VARIOUS_SWAP_STATS:
{
u8 statId = T1_READ_8(gBattlescriptCurrInstr + 3);
u16 temp;
switch (statId)
{
case STAT_HP:
SWAP(gBattleMons[gBattlerAttacker].hp, gBattleMons[gBattlerTarget].hp, temp);
break;
case STAT_ATK:
SWAP(gBattleMons[gBattlerAttacker].attack, gBattleMons[gBattlerTarget].attack, temp);
break;
case STAT_DEF:
SWAP(gBattleMons[gBattlerAttacker].defense, gBattleMons[gBattlerTarget].defense, temp);
break;
case STAT_SPEED:
SWAP(gBattleMons[gBattlerAttacker].speed, gBattleMons[gBattlerTarget].speed, temp);
break;
case STAT_SPATK:
SWAP(gBattleMons[gBattlerAttacker].spAttack, gBattleMons[gBattlerTarget].spAttack, temp);
break;
case STAT_SPDEF:
SWAP(gBattleMons[gBattlerAttacker].spDefense, gBattleMons[gBattlerTarget].spDefense, temp);
break;
}
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
}
break;
} // End of switch (gBattlescriptCurrInstr[2]) } // End of switch (gBattlescriptCurrInstr[2])
gBattlescriptCurrInstr += 3; gBattlescriptCurrInstr += 3;
@ -10678,9 +10702,6 @@ static u16 ReverseStatChangeMoveEffect(u16 moveEffect)
} }
} }
#define STAT_CHANGE_WORKED 0
#define STAT_CHANGE_DIDNT_WORK 1
static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr) static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr)
{ {
bool32 certain = FALSE; bool32 certain = FALSE;

View File

@ -3235,8 +3235,7 @@ u8 DoBattlerEndTurnEffects(void)
gBattleStruct->turnEffectsTracker++; gBattleStruct->turnEffectsTracker++;
break; break;
case ENDTURN_PLASMA_FISTS: case ENDTURN_PLASMA_FISTS:
for (i = 0; i < gBattlersCount; i++) gStatuses4[gActiveBattler] &= ~STATUS4_PLASMA_FISTS;
gStatuses4[i] &= ~STATUS4_PLASMA_FISTS;
gBattleStruct->turnEffectsTracker++; gBattleStruct->turnEffectsTracker++;
break; break;
case ENDTURN_CUD_CHEW: case ENDTURN_CUD_CHEW:

File diff suppressed because it is too large Load Diff

View File

@ -1977,7 +1977,7 @@ static void SetDecorSelectionMetatiles(struct PlaceDecorationGraphicsDataBuffer
shape = data->decoration->shape; shape = data->decoration->shape;
for (i = 0; i < sDecorTilemaps[shape].size; i++) for (i = 0; i < sDecorTilemaps[shape].size; i++)
{ {
data->tiles[sDecorTilemaps[shape].tiles[i]] = GetMetatile(data->decoration->tiles[sDecorTilemaps[shape].y[i]] * 8 + sDecorTilemaps[shape].x[i]); data->tiles[sDecorTilemaps[shape].tiles[i]] = GetMetatile(data->decoration->tiles[sDecorTilemaps[shape].y[i]] * NUM_TILES_PER_METATILE + sDecorTilemaps[shape].x[i]);
} }
} }
@ -2037,7 +2037,7 @@ static u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphics
SetDecorSelectionMetatiles(data); SetDecorSelectionMetatiles(data);
SetDecorSelectionBoxOamAttributes(data->decoration->shape); SetDecorSelectionBoxOamAttributes(data->decoration->shape);
SetDecorSelectionBoxTiles(data); SetDecorSelectionBoxTiles(data);
CopyPalette(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * 8) + 7] >> 12); CopyPalette(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * NUM_TILES_PER_METATILE) + 7] >> 12);
LoadSpritePalette(&sSpritePal_PlaceDecoration); LoadSpritePalette(&sSpritePal_PlaceDecoration);
return CreateSprite(&sDecorationSelectorSpriteTemplate, 0, 0, 0); return CreateSprite(&sDecorationSelectorSpriteTemplate, 0, 0, 0);
} }
@ -2093,7 +2093,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u
SetDecorSelectionMetatiles(&sPlaceDecorationGraphicsDataBuffer); SetDecorSelectionMetatiles(&sPlaceDecorationGraphicsDataBuffer);
SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape); SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape);
SetDecorSelectionBoxTiles(&sPlaceDecorationGraphicsDataBuffer); SetDecorSelectionBoxTiles(&sPlaceDecorationGraphicsDataBuffer);
CopyPalette(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * 8) + 7] >> 12); CopyPalette(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * NUM_TILES_PER_METATILE) + 7] >> 12);
sheet.data = sPlaceDecorationGraphicsDataBuffer.image; sheet.data = sPlaceDecorationGraphicsDataBuffer.image;
sheet.size = sDecorShapeSizes[sPlaceDecorationGraphicsDataBuffer.decoration->shape] * TILE_SIZE_4BPP; sheet.size = sDecorShapeSizes[sPlaceDecorationGraphicsDataBuffer.decoration->shape] * TILE_SIZE_4BPP;
sheet.tag = tilesTag; sheet.tag = tilesTag;

View File

@ -237,7 +237,7 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x,
metatiles = mapLayout->secondaryTileset->metatiles; metatiles = mapLayout->secondaryTileset->metatiles;
metatileId -= NUM_METATILES_IN_PRIMARY; metatileId -= NUM_METATILES_IN_PRIMARY;
} }
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset); DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * NUM_TILES_PER_METATILE, offset);
} }
static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset) static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset)

View File

@ -808,9 +808,9 @@ static void BuyMenuDrawMapBg(void)
metatileLayerType = METATILE_LAYER_TYPE_COVERED; metatileLayerType = METATILE_LAYER_TYPE_COVERED;
if (metatile < NUM_METATILES_IN_PRIMARY) if (metatile < NUM_METATILES_IN_PRIMARY)
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType); BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * NUM_TILES_PER_METATILE, metatileLayerType);
else else
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType); BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * NUM_TILES_PER_METATILE), metatileLayerType);
} }
} }
} }

View File

@ -484,14 +484,14 @@ const u16 *const gTilesetAnims_BikeShop_BlinkingLights[] = {
gTilesetAnims_BikeShop_BlinkingLights_Frame1 gTilesetAnims_BikeShop_BlinkingLights_Frame1
}; };
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame0[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/0.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame0[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/0_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/0_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame1[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/1.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame1[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/1_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/1_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame2[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/2.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame2[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/2_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/2_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame3[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/3.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame3[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/3_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/3_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame4[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/4.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame4[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/4_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/4_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame5[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/5.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame5[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/5_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/5_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame6[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/6.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame6[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/6_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/6_groudon.4bpp");
const u16 gTilesetAnims_Sootopolis_StormyWater_Frame7[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/7.4bpp"); const u16 gTilesetAnims_Sootopolis_StormyWater_Frame7[] = INCBIN_U16("data/tilesets/secondary/sootopolis/anim/stormy_water/7_kyogre.4bpp", "data/tilesets/secondary/sootopolis/anim/stormy_water/7_groudon.4bpp");
const u16 tileset_anims_space_8[16] = {}; const u16 tileset_anims_space_8[16] = {};
const u16 gTilesetAnims_Unused1_Frame0[] = INCBIN_U16("data/tilesets/secondary/unused_1/0.4bpp"); const u16 gTilesetAnims_Unused1_Frame0[] = INCBIN_U16("data/tilesets/secondary/unused_1/0.4bpp");

View File

@ -1104,7 +1104,7 @@ bool8 TryDoDoubleWildBattle(void)
return TRUE; return TRUE;
#endif #endif
#if B_DOUBLE_WILD_CHANCE != 0 #if B_DOUBLE_WILD_CHANCE != 0
else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE) else if ((Random() % 100) + 1 <= B_DOUBLE_WILD_CHANCE)
return TRUE; return TRUE;
#endif #endif
return FALSE; return FALSE;