More and more battle tower

This commit is contained in:
DizzyEggg 2018-10-22 19:22:57 +02:00
parent 0ab27e44b1
commit b330bdba51
10 changed files with 821 additions and 2329 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10934,7 +10934,7 @@ sub_801B1E8: @ 801B1E8
ldr r0, [r0]
ldr r1, =0x00000bec
adds r0, r1
bl sub_816534C
bl ClearEReaderTrainer
pop {r0}
bx r0
.pool

View File

@ -33,7 +33,7 @@ gTowerMaleTrainerGfxIds:: @ 85DCF0E
gTowerFemaleTrainerGfxIds:: @ 85DCF2C
.byte 0x14, 0x35, 0x22, 0x28, 0x14, 0x2d, 0x2f, 0x0e, 0x12, 0x16, 0x39, 0x34, 0x34, 0x0e, 0x22, 0x34, 0x20, 0x14, 0x20, 0x2f
gUnknown_085DCF40:: @ 85DCF40
sRubyFacilityClassToEmerald:: @ 85DCF40
.byte 0x00, 0x0b, 0x01, 0x01, 0x02, 0x06, 0x03, 0x0d, 0x04, 0x0e, 0x05, 0x0f, 0x06, 0x10, 0x07, 0x11, 0x08, 0x03, 0x09, 0x12, 0x0a, 0x0c, 0x0b, 0x13, 0x0c, 0x14, 0x0d, 0x15, 0x0e, 0x17, 0x0f, 0x07
.byte 0x10, 0x0a, 0x11, 0x19, 0x12, 0x1a, 0x13, 0x1b, 0x14, 0x1d, 0x15, 0x1e, 0x16, 0x1f, 0x17, 0x20, 0x18, 0x21, 0x19, 0x22, 0x1a, 0x23, 0x1b, 0x24, 0x1c, 0x25, 0x1d, 0x26, 0x1e, 0x27, 0x1f, 0x28
.byte 0x20, 0x29, 0x21, 0x2a, 0x22, 0x09, 0x23, 0x16, 0x24, 0x2b, 0x25, 0x2c, 0x26, 0x2d, 0x27, 0x2e, 0x28, 0x2f, 0x29, 0x30, 0x2a, 0x31, 0x2b, 0x32, 0x2c, 0x33, 0x2d, 0x34, 0x2e, 0x04, 0x2f, 0x35
@ -640,7 +640,7 @@ gUnknown_085DD690:: @ 85DD690
.4byte gUnknown_085DD0F0
.4byte gUnknown_085DD104
gUnknown_085DD6D0:: @ 85DD6D0
sStevenMons:: @ 85DD6D0
.byte 0x8f, 0x01, 0x1f, 0x2a, 0x02
gUnknown_085DD6D5:: @ 85DD6D5
@ -685,7 +685,7 @@ gUnknown_085DF96C:: @ 85DF96C
.4byte sub_81620F4
.4byte ChooseNextBattleTowerTrainer
.4byte sub_81621C0
.4byte sub_816502C
.4byte AwardBattleTowerRibbons
.4byte SaveBattleTowerProgress
.4byte sub_8163914
.4byte nullsub_61

View File

@ -15,7 +15,7 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_227E68:: @ 8227E68
lockall
applymovement 255, SootopolisCity_MysteryEventsHouse_B1F_Movement_227EF3
waitmovement 0
special sub_8165360
special CopyEReaderTrainerGreeting
msgbox gStringVar4, 4
closemessage
setvar VAR_0x8004, SPECIAL_BATTLE_EREADER

View File

@ -246,7 +246,7 @@ gSpecials:: @ 81DBA64
def_special sub_8161F74
def_special CallBattleDomeFunction
def_special sub_8195960
def_special sub_8165360
def_special CopyEReaderTrainerGreeting
def_special DoSpecialTrainerBattle
def_special sub_81A5238
def_special sub_81A5E74

View File

@ -7,15 +7,14 @@
struct RSBattleTowerRecord
{
/*0x00*/ u8 battleTowerLevelType; // 0 = level 50, 1 = level 100
/*0x01*/ u8 trainerClass;
/*0x00*/ u8 lvlMode; // 0 = level 50, 1 = level 100
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ u16 greeting[6];
/*0x1C*/ struct UnknownPokemonStruct party[3];
/*0xA0*/ u32 checksum;
/*0xA4*/ u16 unk_11c8;
};
union BattleTowerRecord
@ -54,12 +53,14 @@ extern const struct FacilityMon *gFacilityTrainerMons;
u16 GetCurrentBattleTowerWinStreak(u8, u8);
void sub_81659DC(struct RSBattleTowerRecord *a0, struct RSBattleTowerRecord *a1);
bool32 sub_816587C(union BattleTowerRecord *, union BattleTowerRecord *);
bool32 RubyBattleTowerRecordToEmerald(struct RSBattleTowerRecord *src, struct EmeraldBattleTowerRecord *dst);
void CalcEmeraldBattleTowerChecksum(struct EmeraldBattleTowerRecord *);
void PutNewBattleTowerRecord(union BattleTowerRecord *);
void PutNewBattleTowerRecord(struct EmeraldBattleTowerRecord *newRecordEm);
void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId);
void FrontierSpeechToString(const u16 *words);
void GetFrontierTrainerName(u8 *dest, u16 trainerIdx);
void GetEreaderTrainerName(u8 *dest);
void FillFrontierTrainerParty(u8 monsCount);
void FillFrontierTrainersParties(u8 monsCount);
#endif //GUARD_BATTLE_TOWER_H

View File

@ -288,7 +288,7 @@ struct Apprentice
u8 lvlMode:2; // + 1
u8 field_1;
u8 number;
struct ApprenticeMon monData[3];
struct ApprenticeMon party[3];
u16 easyChatWords[6];
u8 playerId[4];
u8 playerName[PLAYER_NAME_LENGTH];
@ -383,8 +383,8 @@ struct BattleFrontier
/*0x738*/ struct EmeraldBattleTowerRecord towerRecords[5]; // From record mixing.
/*0xBD4*/ u16 field_BD4;
/*0xBD6*/ u16 field_BD6;
/*0xBD8*/ u8 field_BD8[11];
/*0xBE3*/ u8 field_BE3[8];
/*0xBD8*/ u8 field_BD8[PLAYER_NAME_LENGTH + 1];
/*0xBE3*/ u8 field_BE0[POKEMON_NAME_LENGTH + 1];
/*0xBEB*/ u8 field_BEB;
/*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer;
/*0xCA8*/ u8 field_CA8;
@ -395,15 +395,12 @@ struct BattleFrontier
/*0xCA9*/ u8 field_CA9_d:1; // 0x20
/*0xCA9*/ u8 field_CA9_e:1; // 0x40
/*0xCA9*/ u8 field_CA9_f:1; // 0x80
/*0xCAA*/ u16 field_CAA[3];
/*0xCAA*/ u16 selectedPartyMons[3];
/*0xCB0*/ u16 field_CB0;
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
/*0xCB4*/ u16 battledTrainerIds[17];
u16 field_CD6;
u16 field_CD8;
u16 field_CDA;
/*0xCB4*/ u16 field_CB4[20];
/*0xCDC*/ u32 field_CDC;
/*0xCE0*/ u16 field_CE0[4][2];
/*0xCE0*/ u16 winStreaks[4][2];
/*0xCF0*/ u16 field_CF0[2];
/*0xCF4*/ u16 field_CF4[2];
/*0xCF8*/ u16 field_CF8[2];

View File

@ -31,6 +31,7 @@
#include "string_util.h"
#include "overworld.h"
#include "field_weather.h"
#include "battle_tower.h"
#include "gym_leader_rematch.h"
#include "constants/map_types.h"
#include "constants/battle_frontier.h"
@ -67,8 +68,6 @@ extern u16 sub_81D6180(u8 localId);
extern bool8 GetBattlePyramidTrainerFlag(u8 eventObjId);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjId);
extern bool8 sub_81D5C18(void);
extern void sub_816306C(u8 a0);
extern void sub_8163048(u8 a0);
extern void sub_81A9B04(void);
extern void sub_81D639C(void);
extern void sub_81D6384(void);
@ -885,8 +884,8 @@ u8 sub_80B100C(s32 arg0)
return sUnknown_0854FE98[Random() % ARRAY_COUNT(sUnknown_0854FE98)];
}
var = gSaveBlock2Ptr->frontier.battledTrainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ gSaveBlock2Ptr->frontier.battledTrainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
var = gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
return sUnknown_0854FE98[var % ARRAY_COUNT(sUnknown_0854FE98)];
}
@ -1264,7 +1263,7 @@ void BattleSetup_StartTrainerBattle(void)
if (gNoOfApproachingTrainers == 2)
{
sub_816306C(1);
FillFrontierTrainersParties(1);
ZeroMonData(&gEnemyParty[1]);
ZeroMonData(&gEnemyParty[2]);
ZeroMonData(&gEnemyParty[4]);
@ -1272,7 +1271,7 @@ void BattleSetup_StartTrainerBattle(void)
}
else
{
sub_8163048(1);
FillFrontierTrainerParty(1);
ZeroMonData(&gEnemyParty[1]);
ZeroMonData(&gEnemyParty[2]);
}

File diff suppressed because it is too large Load Diff

View File

@ -69,6 +69,7 @@ struct PlayerRecordsRS
struct EasyChatPair easyChatPairs[5];
struct RecordMixingDayCareMail dayCareMail;
struct RSBattleTowerRecord battleTowerRecord;
u16 giftItem;
u16 filler11C8[0x32];
};
@ -81,7 +82,7 @@ struct PlayerRecordsEmerald
/* 0x1084 */ struct EasyChatPair easyChatPairs[5];
/* 0x10ac */ struct RecordMixingDayCareMail dayCareMail;
/* 0x1124 */ struct EmeraldBattleTowerRecord battleTowerRecord;
/* 0x1210 */ u16 unk_1210;
/* 0x1210 */ u16 giftItem;
/* 0x1214 */ LilycoveLady lilycoveLady;
/* 0x1254 */ struct Apprentice apprentice[2];
/* 0x12dc */ struct UnkRecordMixingStruct2 unk_12dc;
@ -132,7 +133,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t, u8);
static void ReceiveLilycoveLadyData(LilycoveLady *, size_t, u8);
static void sub_80E7B2C(const u8 *);
static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *, size_t, u8, TVShow *);
static void sub_80E7F68(u16 *item, u8 which);
static void ReceiveGiftItem(u16 *item, u8 which);
static void sub_80E7FF8(u8 taskId);
static void sub_80E8110(struct Apprentice *arg0, struct Apprentice *arg1);
static void ReceiveApprenticeData(struct Apprentice *arg0, size_t arg1, u32 arg2);
@ -215,7 +216,7 @@ static void PrepareUnknownExchangePacket(struct PlayerRecordsRS *dest)
sub_81659DC(sBattleTowerSave, &dest->battleTowerRecord);
if (GetMultiplayerId() == 0)
dest->battleTowerRecord.unk_11c8 = GetRecordMixingGift();
dest->giftItem = GetRecordMixingGift();
}
static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
@ -234,7 +235,7 @@ static void PrepareExchangePacketForRubySapphire(struct PlayerRecordsRS *dest)
SanitizeRubyBattleTowerRecord(&dest->battleTowerRecord);
if (GetMultiplayerId() == 0)
dest->battleTowerRecord.unk_11c8 = GetRecordMixingGift();
dest->giftItem = GetRecordMixingGift();
}
static void PrepareExchangePacket(void)
@ -263,7 +264,7 @@ static void PrepareExchangePacket(void)
SanitizeEmeraldBattleTowerRecord(&sSentRecord->emerald.battleTowerRecord);
if (GetMultiplayerId() == 0)
sSentRecord->emerald.unk_1210 = GetRecordMixingGift();
sSentRecord->emerald.giftItem = GetRecordMixingGift();
sub_80E8110(sSentRecord->emerald.apprentice, gUnknown_03001154);
sub_80E8260(&sSentRecord->emerald.unk_12dc);
@ -283,7 +284,7 @@ static void ReceiveExchangePacket(u32 which)
ReceivePokeNewsData(sReceivedRecords->ruby.pokeNews, sizeof(struct PlayerRecordsRS), which);
ReceiveOldManData(&sReceivedRecords->ruby.oldMan, sizeof(struct PlayerRecordsRS), which);
ReceiveEasyChatPairsData(sReceivedRecords->ruby.easyChatPairs, sizeof(struct PlayerRecordsRS), which);
sub_80E7F68(&sReceivedRecords->ruby.battleTowerRecord.unk_11c8, which);
ReceiveGiftItem(&sReceivedRecords->ruby.giftItem, which);
}
else
{
@ -296,7 +297,7 @@ static void ReceiveExchangePacket(u32 which)
ReceiveEasyChatPairsData(sReceivedRecords->emerald.easyChatPairs, sizeof(struct PlayerRecordsEmerald), which);
ReceiveDaycareMailData(&sReceivedRecords->emerald.dayCareMail, sizeof(struct PlayerRecordsEmerald), which, sReceivedRecords->emerald.tvShows);
ReceiveBattleTowerData(&sReceivedRecords->emerald.battleTowerRecord, sizeof(struct PlayerRecordsEmerald), which);
sub_80E7F68(&sReceivedRecords->emerald.unk_1210, which);
ReceiveGiftItem(&sReceivedRecords->emerald.giftItem, which);
ReceiveLilycoveLadyData(&sReceivedRecords->emerald.lilycoveLady, sizeof(struct PlayerRecordsEmerald), which);
ReceiveApprenticeData(sReceivedRecords->emerald.apprentice, sizeof(struct PlayerRecordsEmerald), (u8) which);
sub_80E89AC(&sReceivedRecords->emerald.unk_12dc, sizeof(struct PlayerRecordsEmerald), (u8) which);
@ -667,7 +668,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u
ShufflePlayerIndices(mixIndices);
if (Link_AnyPartnersPlayingRubyOrSapphire())
{
if (sub_816587C((void *)battleTowerRecord + recordSize * mixIndices[which], (void *)battleTowerRecord + recordSize * which) == TRUE)
if (RubyBattleTowerRecordToEmerald((void *)battleTowerRecord + recordSize * mixIndices[which], (void *)battleTowerRecord + recordSize * which) == TRUE)
{
dest = (void *)battleTowerRecord + recordSize * which;
dest->language = gLinkPlayers[mixIndices[which]].language;
@ -676,7 +677,7 @@ static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u
}
else
{
memcpy((void *)battleTowerRecord + recordSize * which, (void *)battleTowerRecord + recordSize * mixIndices[which], sizeof(union BattleTowerRecord));
memcpy((void *)battleTowerRecord + recordSize * which, (void *)battleTowerRecord + recordSize * mixIndices[which], sizeof(struct EmeraldBattleTowerRecord));
dest = (void *)battleTowerRecord + recordSize * which;
for (i = 0; i < 4; i ++)
{
@ -1460,7 +1461,7 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
}
#endif // NONMATCHING
static void sub_80E7F68(u16 *item, u8 which)
static void ReceiveGiftItem(u16 *item, u8 which)
{
if (which != 0 && *item != ITEM_NONE && GetPocketByItemId(*item) == POCKET_KEY_ITEMS)
{