Skip to content

Commit

Permalink
Whiteout Changes
Browse files Browse the repository at this point in the history
- The screen actually fades to white on whiteout now.
- Added "trainer win" speeches to everyone (hopefully).
- Fixed some bugs in Rustboro.
  • Loading branch information
tustin2121 committed Aug 10, 2019
1 parent d65550a commit b85bf34
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 6 deletions.
24 changes: 23 additions & 1 deletion data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,15 @@ BattleScript_LocalBattleLost::
jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, 0x400, BattleScript_LocalBattleLostEnd
BattleScript_LocalBattleLostPrintWhiteOut::
printstring STRINGID_PLAYERWHITEOUT
waitmessage 0x40
@ waitmessage 0x40
@ Trihard Emerald
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalNormalBattleLostPrintWhiteOut
trainerslidein BS_ATTACKER
waitstate
BattleScript_LocalNormalBattleLostPrintWhiteOut:
printstring STRINGID_TRAINER1WINTEXT
@ waitmessage 0x40
@ TriHard End
printstring STRINGID_PLAYERWHITEOUT2
waitmessage 0x40
BattleScript_LocalBattleLostEnd::
Expand All @@ -3040,6 +3048,20 @@ BattleScript_LocalBattleLostDoTrainer2WinText::
BattleScript_LocalBattleLostEnd_::
end2

BattleScript_LocalNormalBattleLostPrintTrainersWinText::
printstring STRINGID_PLAYERWHITEOUT
waitmessage 0x40
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostPrintWhiteOut
trainerslidein BS_ATTACKER
waitstate
printstring STRINGID_TRAINER1WINTEXT
waitmessage 0x40
BattleScript_LocalNormalBattleLostEnd_::
printstring STRINGID_PLAYERWHITEOUT2
waitmessage 0x40
end2


BattleScript_82DAA0B::
returnopponentmon1toball BS_ATTACKER
waitstate
Expand Down
4 changes: 2 additions & 2 deletions data/maps/RustboroCity/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ RustboroCity_Text_AquaGirl_Boy:
.string "Do it again, and I deck ya one.$"
RustboroCity_Text_AquaGirl_Girl:
.string "Gotta say, girl. I was ready to turn\n"
.string "around a deck a guy wanting to get\l"
.string "around and deck a guy wanting to get\l"
.string "handsey with me.\p"
.string "Yeah, you know what I mean. That\n"
.string "face your making is mood.$"
.string "face you're making is mood.$"
RustboroCity_EventScript_AquaGirlB:
msgbox RustboroCity_Text_AquaGirlB, MSGBOX_NPC
end
Expand Down
12 changes: 12 additions & 0 deletions include/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2741,6 +2741,18 @@ extern const u8 gText_TrainerCloseBy[];

extern const u8 gText_The[];

extern const u8 gText_Whiteout_WildMon[];
extern const u8 gText_Whiteout_GoodTrainer[];
extern const u8 gText_Whiteout_YoungTrainer[];
extern const u8 gText_Whiteout_NinjaTrainer[];
extern const u8 gText_Whiteout_Interview[];
extern const u8 gText_Whiteout_Embarrasment[];
extern const u8 gText_Whiteout_BadTrainer[];
extern const u8 gText_Whiteout_AquaTrainer[];
extern const u8 gText_Whiteout_AquaAdmin[];
extern const u8 gText_Whiteout_RivalHero[];
extern const u8 gText_Whiteout_RivalBirch[];

extern const u8 gText_Sunday[];
extern const u8 gText_Monday[];
extern const u8 gText_Tuesday[];
Expand Down
5 changes: 4 additions & 1 deletion src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5192,7 +5192,10 @@ static void HandleEndTurn_FinishBattle(void)
sub_8186444();
Restore1HPDeathPreventedMons();
RemoveDeadMonFromParty(TRUE);
BeginFastPaletteFade(3);
if (gBattleOutcome == B_OUTCOME_LOST || gBattleOutcome == B_OUTCOME_DREW)
BeginFastPaletteFade(1);
else
BeginFastPaletteFade(3);
FadeOutMapMusic(5);
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
gCB2_AfterEvolution = BattleMainCB2;
Expand Down
4 changes: 4 additions & 0 deletions src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,10 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
CopyTrainerHillTrainerText(3, gTrainerBattleOpponent_A);
toCpy = gStringVar4;
}
else
{
toCpy = GetTrainerWonSpeech();
}
break;
case B_TXT_26: // ?
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, *(&gBattleStruct->field_52))
Expand Down
64 changes: 62 additions & 2 deletions src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,55 @@ static void CreateBattleStartTask(u8 transition, u16 song)
#undef tState
#undef tTransition

void BattleSetup_SetupVictoryLines(void)
{
if (gTrainerBattleOpponent_A == TRAINER_NONE) return;
switch (gTrainers[gTrainerBattleOpponent_A].trainerClass)
{
case TRAINER_CLASS_MAGMA_ADMIN:
case TRAINER_CLASS_MAGMA_LEADER:
case TRAINER_CLASS_TEAM_MAGMA:
sTrainerVictorySpeech = (u8*)gText_Whiteout_BadTrainer;
break;
case TRAINER_CLASS_TEAM_AQUA:
sTrainerVictorySpeech = (u8*)gText_Whiteout_AquaTrainer;
break;
case TRAINER_CLASS_AQUA_ADMIN:
sTrainerVictorySpeech = (u8*)gText_Whiteout_AquaAdmin;
break;
case TRAINER_CLASS_CHAMPION:
case TRAINER_CLASS_ELITE_FOUR:
sTrainerVictorySpeech = (u8*)gText_Whiteout_Embarrasment;
break;
case TRAINER_CLASS_YOUNGSTER:
case TRAINER_CLASS_SCHOOL_KID:
case TRAINER_CLASS_TWINS:
case TRAINER_CLASS_TUBER_F:
case TRAINER_CLASS_TUBER_M:
sTrainerVictorySpeech = (u8*)gText_Whiteout_YoungTrainer;
break;
case TRAINER_CLASS_NINJA_BOY:
sTrainerVictorySpeech = (u8*)gText_Whiteout_NinjaTrainer;
break;
case TRAINER_CLASS_INTERVIEWER:
sTrainerVictorySpeech = (u8*)gText_Whiteout_Interview;
break;
case TRAINER_CLASS_PKMN_TRAINER_3:
if (gTrainers[gTrainerBattleOpponent_A].trainerPic == TRAINER_PIC_WALLY)
{
sTrainerVictorySpeech = (u8*)gText_Whiteout_RivalHero;
}
else
{
sTrainerVictorySpeech = (u8*)gText_Whiteout_RivalBirch;
}
break;
default:
sTrainerVictorySpeech = (u8*)gText_Whiteout_GoodTrainer;
break;
}
}

void BattleSetup_StartWildBattle(void)
{
if (GetSafariZoneFlag())
Expand Down Expand Up @@ -1312,6 +1361,8 @@ void BattleSetup_StartTrainerBattle(void)

SetHillTrainerFlag();
}

BattleSetup_SetupVictoryLines();

sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers;
gNoOfApproachingTrainers = 0;
Expand Down Expand Up @@ -1374,6 +1425,7 @@ void BattleSetup_StartRematchBattle(void)
{
gBattleTypeFlags = BATTLE_TYPE_TRAINER;
gMain.savedCallback = CB2_EndRematchBattle;
BattleSetup_SetupVictoryLines();
DoTrainerBattle();
ScriptContext1_Stop();
}
Expand Down Expand Up @@ -1521,7 +1573,7 @@ static const u8 *GetIntroSpeechOfApproachingTrainer(void)
const u8 *GetTrainerALoseText(void)
{
const u8 *string;

if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
string = GetSecretBaseTrainerLoseText();
else
Expand All @@ -1539,7 +1591,15 @@ const u8 *GetTrainerBLoseText(void)

const u8 *GetTrainerWonSpeech(void)
{
return ReturnEmptyStringIfNull(sTrainerVictorySpeech);
const u8 *string;

if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) == 0)
string = gText_Whiteout_WildMon;
else
string = sTrainerVictorySpeech;

StringExpandPlaceholders(gStringVar4, ReturnEmptyStringIfNull(string));
return gStringVar4;
}

static const u8 *GetTrainerCantBattleSpeech(void)
Expand Down
12 changes: 12 additions & 0 deletions src/strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,18 @@ const u8 gText_PokeBalls[] = _("POKé BALLS");
const u8 gText_Berry[] = _("BERRY");
const u8 gText_Berries[] = _("BERRIES");

const u8 gText_Whiteout_WildMon[] = _("The wild Pokémon lunged for {PLAYER}!");
const u8 gText_Whiteout_GoodTrainer[] = _("Good battle!\pHey, are you alright?");
const u8 gText_Whiteout_YoungTrainer[] = _("Yay I won! You lost! Ha ha!\p{PLAYER} curled up into a ball in embarrassment.");
const u8 gText_Whiteout_NinjaTrainer[] = _("You fell to the ninja! Whacha!");
const u8 gText_Whiteout_Interview[] = _("Gabby: Do you have any final words before\nthis goes to air to millions?\p{PLAYER} curled up into a ball in embarrassment.");
const u8 gText_Whiteout_Embarrasment[] = _("The crowds go wild.\p{PLAYER} curled up into a ball in embarrassment.");
const u8 gText_Whiteout_BadTrainer[] = _("Now, finish {PLAYER_them} off!\pThe foe Pokémon lunged for {PLAYER}!");
const u8 gText_Whiteout_AquaTrainer[] = _("I guess I won this scrap!\pYou alright? You don't look so good.");
const u8 gText_Whiteout_AquaAdmin[] = _("As usual for one of our grunts…");
const u8 gText_Whiteout_RivalHero[] = _("{RIVAL_HERO}: Serves you right…");
const u8 gText_Whiteout_RivalBirch[] = _("{RIVAL_BIRCH}: Ah, good…\nSee how it feels for once?");

const u8 gText_Num1[] = _("one");
const u8 gText_Num2[] = _("two");
const u8 gText_Num3[] = _("three");
Expand Down

0 comments on commit b85bf34

Please sign in to comment.