fix merge conflicts
This commit is contained in:
@@ -204,9 +204,6 @@ extern const u8 BattleScript_ActionSwitch[];
|
||||
extern const u8 BattleScript_PrintFailedToRunString[];
|
||||
|
||||
// functions
|
||||
extern void HandleLinkBattleSetup(void); // rom_3
|
||||
extern void SetUpBattleVarsAndBirchZigzagoon(void); // rom_3
|
||||
extern void sub_8032768(void); // rom_3
|
||||
extern void dp12_8087EA4(void);
|
||||
extern void sub_80356D0(void);
|
||||
extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower
|
||||
@@ -4083,7 +4080,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS
|
||||
|| gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE)
|
||||
{
|
||||
Emit_x32(0);
|
||||
EmitCmd50(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
return;
|
||||
}
|
||||
@@ -4111,7 +4108,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 3);
|
||||
}
|
||||
Emit_x32(0);
|
||||
EmitCmd50(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void)
|
||||
&& gDisableStructs[gActiveBank].perishSong1 == 0)
|
||||
{
|
||||
*(gBattleStruct->field_294 + gActiveBank) = 6;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
{
|
||||
// we found a mon
|
||||
*(gBattleStruct->field_294 + gActiveBank) = i;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
||||
{
|
||||
// we found a mon
|
||||
*(gBattleStruct->field_294 + gActiveBank) = i;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->field_294 + gActiveBank) = 6;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->field_294 + gActiveBank) = 6;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
if (Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->field_294 + gActiveBank) = 6;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
|
||||
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0)
|
||||
{
|
||||
*(gBattleStruct->field_294 + gActiveBank) = i;
|
||||
EmitCmd_x21(1, 2, 0);
|
||||
EmitCmd33(1, 2, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void)
|
||||
}
|
||||
}
|
||||
|
||||
EmitCmd_x21(1, 0, (gActiveBank ^ BIT_SIDE) << 8);
|
||||
EmitCmd33(1, 0, (gActiveBank ^ BIT_SIDE) << 8);
|
||||
}
|
||||
|
||||
#define TYPE_FORESIGHT 0xFE
|
||||
@@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void)
|
||||
|
||||
if (shouldUse)
|
||||
{
|
||||
EmitCmd_x21(1, 1, 0);
|
||||
EmitCmd33(1, 1, 0);
|
||||
*(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item;
|
||||
gBattleResources->battleHistory->trainerItems[i] = 0;
|
||||
return shouldUse;
|
||||
|
||||
1551
src/battle_controllers.c
Normal file
1551
src/battle_controllers.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -349,7 +349,7 @@ static void atk51_switch_handle_order(void);
|
||||
static void atk52_switch_in_effects(void);
|
||||
static void atk53_trainer_slide(void);
|
||||
static void atk54_effectiveness_sound(void);
|
||||
static void atk55_play_sound(void);
|
||||
static void atk55_play_fanfare(void);
|
||||
static void atk56_fainting_cry(void);
|
||||
static void atk57(void);
|
||||
static void atk58_return_to_ball(void);
|
||||
@@ -601,7 +601,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
||||
atk52_switch_in_effects,
|
||||
atk53_trainer_slide,
|
||||
atk54_effectiveness_sound,
|
||||
atk55_play_sound,
|
||||
atk55_play_fanfare,
|
||||
atk56_fainting_cry,
|
||||
atk57,
|
||||
atk58_return_to_ball,
|
||||
@@ -5308,7 +5308,7 @@ static void atk4B_return_atk_to_ball(void)
|
||||
gActiveBank = gBankAttacker;
|
||||
if (!(gHitMarker & HITMARKER_FAINTED(gActiveBank)))
|
||||
{
|
||||
EmitReturnPokeToBall(0, 0);
|
||||
EmitReturnMonToBall(0, 0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
gBattlescriptCurrInstr++;
|
||||
@@ -5627,7 +5627,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -5649,7 +5649,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -5670,7 +5670,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -5692,7 +5692,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -5755,7 +5755,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -5771,7 +5771,7 @@ static void atk50_openpartyscreen(void)
|
||||
{
|
||||
gAbsentBankFlags |= gBitTable[gActiveBank];
|
||||
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
|
||||
Emit_x2A(0);
|
||||
EmitCmd42(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
else if (!gSpecialStatuses[gActiveBank].flag40)
|
||||
@@ -6031,10 +6031,10 @@ static void atk54_effectiveness_sound(void)
|
||||
gBattlescriptCurrInstr += 3;
|
||||
}
|
||||
|
||||
static void atk55_play_sound(void)
|
||||
static void atk55_play_fanfare(void)
|
||||
{
|
||||
gActiveBank = gBankAttacker;
|
||||
EmitPlaySound(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), 0);
|
||||
EmitPlayFanfareOrBGM(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), FALSE);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
@@ -6052,7 +6052,7 @@ static void atk56_fainting_cry(void)
|
||||
static void atk57(void)
|
||||
{
|
||||
gActiveBank = GetBankByIdentity(0);
|
||||
Emit_x37(0, gBattleOutcome);
|
||||
EmitCmd55(0, gBattleOutcome);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
|
||||
gBattlescriptCurrInstr += 1;
|
||||
@@ -6061,7 +6061,7 @@ static void atk57(void)
|
||||
static void atk58_return_to_ball(void)
|
||||
{
|
||||
gActiveBank = GetBattleBank(gBattlescriptCurrInstr[1]);
|
||||
EmitReturnPokeToBall(0, 1);
|
||||
EmitReturnMonToBall(0, 1);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
|
||||
gBattlescriptCurrInstr += 2;
|
||||
@@ -7137,7 +7137,7 @@ static void atk76_various(void)
|
||||
gDisableStructs[1].truantUnknownBit = 1;
|
||||
break;
|
||||
case 13:
|
||||
EmitCmd13(0);
|
||||
EmitCmd19(0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
break;
|
||||
case 14:
|
||||
@@ -7162,7 +7162,7 @@ static void atk76_various(void)
|
||||
gActiveBank = 1;
|
||||
if (gBattleMons[gActiveBank].hp != 0)
|
||||
{
|
||||
EmitReturnPokeToBall(0, 0);
|
||||
EmitReturnMonToBall(0, 0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
break;
|
||||
@@ -7172,7 +7172,7 @@ static void atk76_various(void)
|
||||
gActiveBank = 3;
|
||||
if (gBattleMons[gActiveBank].hp != 0)
|
||||
{
|
||||
EmitReturnPokeToBall(0, 0);
|
||||
EmitReturnMonToBall(0, 0);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
}
|
||||
}
|
||||
@@ -7197,7 +7197,7 @@ static void atk76_various(void)
|
||||
gBattleOutcome = BATTLE_OPPONENT_TELEPORTED;
|
||||
break;
|
||||
case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC:
|
||||
EmitPlaySound(0, BGM_KACHI1, 1);
|
||||
EmitPlayFanfareOrBGM(0, BGM_KACHI1, TRUE);
|
||||
MarkBufferBankForExecution(gActiveBank);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include "text_window.h"
|
||||
#include "string_util.h"
|
||||
#include "menu.h"
|
||||
#include "international_string_util.h"
|
||||
|
||||
#define MAX_COINS 9999
|
||||
|
||||
EWRAM_DATA u8 sCoinsWindowId = 0;
|
||||
|
||||
extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth);
|
||||
extern void sub_819746C(u8 windowId, bool8 copyToVram);
|
||||
|
||||
extern const u8 gText_Coins[];
|
||||
|
||||
57
src/international_string_util.c
Normal file
57
src/international_string_util.c
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "global.h"
|
||||
#include "international_string_util.h"
|
||||
#include "text.h"
|
||||
|
||||
extern s32 convert_pixel_width_to_tile_width(s32 a0); // script menu
|
||||
|
||||
s32 GetStringCenterAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth)
|
||||
{
|
||||
return GetStringCenterAlignXOffsetWithLetterSpacing(fontId, str, totalWidth, 0);
|
||||
}
|
||||
|
||||
s32 GetStringRightAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth)
|
||||
{
|
||||
return GetStringWidthDifference(fontId, str, totalWidth, 0);
|
||||
}
|
||||
|
||||
s32 GetStringCenterAlignXOffsetWithLetterSpacing(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing)
|
||||
{
|
||||
return GetStringWidthDifference(fontId, str, totalWidth, letterSpacing) / 2;
|
||||
}
|
||||
|
||||
s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing)
|
||||
{
|
||||
s32 stringWidth = GetStringWidth(fontId, str, letterSpacing);
|
||||
if (totalWidth > stringWidth)
|
||||
return totalWidth - stringWidth;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1)
|
||||
{
|
||||
s32 i, var;
|
||||
|
||||
for (var = 0, i = 0; i < arg1; i++)
|
||||
{
|
||||
s32 stringWidth = GetStringWidth(1, str[i * 2], 0);
|
||||
if (stringWidth > var)
|
||||
var = stringWidth;
|
||||
}
|
||||
|
||||
return convert_pixel_width_to_tile_width(var);
|
||||
}
|
||||
|
||||
s32 sub_81DB3D8(const u8 **str, u8* arg1, s32 arg2)
|
||||
{
|
||||
s32 i, var;
|
||||
|
||||
for (var = 0, i = 0; i < arg2; i++)
|
||||
{
|
||||
s32 stringWidth = GetStringWidth(1, str[arg1[i] * 2], 0);
|
||||
if (stringWidth > var)
|
||||
var = stringWidth;
|
||||
}
|
||||
|
||||
return convert_pixel_width_to_tile_width(var);
|
||||
}
|
||||
Reference in New Issue
Block a user