mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 05:43:51 +01:00
review battle code clean up change
This commit is contained in:
parent
ff6a0316c1
commit
4c19790ff1
@ -15,7 +15,7 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "battle_setup.h"
|
#include "battle_setup.h"
|
||||||
|
|
||||||
#define BANK_RECORD_SIZE 664
|
#define BATTLER_RECORD_SIZE 664
|
||||||
#define ILLEGAL_BATTLE_TYPES ((BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_FIRST_BATTLE \
|
#define ILLEGAL_BATTLE_TYPES ((BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_FIRST_BATTLE \
|
||||||
| BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_ROAMER | BATTLE_TYPE_EREADER_TRAINER \
|
| BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_ROAMER | BATTLE_TYPE_EREADER_TRAINER \
|
||||||
| BATTLE_TYPE_KYOGRE_GROUDON | BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_REGI \
|
| BATTLE_TYPE_KYOGRE_GROUDON | BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_REGI \
|
||||||
@ -67,13 +67,13 @@ struct RecordedBattleSave
|
|||||||
u16 field_50E[6];
|
u16 field_50E[6];
|
||||||
u8 field_51A;
|
u8 field_51A;
|
||||||
u8 field_51B;
|
u8 field_51B;
|
||||||
u8 battleRecord[MAX_BATTLERS_COUNT][BANK_RECORD_SIZE];
|
u8 battleRecord[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE];
|
||||||
u32 checksum;
|
u32 checksum;
|
||||||
};
|
};
|
||||||
|
|
||||||
EWRAM_DATA u32 gRecordedBattleRngSeed = 0;
|
EWRAM_DATA u32 gRecordedBattleRngSeed = 0;
|
||||||
EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0;
|
EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0;
|
||||||
EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BANK_RECORD_SIZE] = {0};
|
EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0};
|
||||||
EWRAM_DATA static u16 sRecordedBytesNo[MAX_BATTLERS_COUNT] = {0};
|
EWRAM_DATA static u16 sRecordedBytesNo[MAX_BATTLERS_COUNT] = {0};
|
||||||
EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
|
EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
|
||||||
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
|
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
|
||||||
@ -123,7 +123,7 @@ void sub_8184DA4(u8 arg0)
|
|||||||
|
|
||||||
if (arg0 == 1)
|
if (arg0 == 1)
|
||||||
{
|
{
|
||||||
for (j = 0; j < BANK_RECORD_SIZE; j++)
|
for (j = 0; j < BATTLER_RECORD_SIZE; j++)
|
||||||
{
|
{
|
||||||
sBattleRecords[i][j] |= 0xFF;
|
sBattleRecords[i][j] |= 0xFF;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ void sub_8184E58(void)
|
|||||||
|
|
||||||
void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action)
|
void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action)
|
||||||
{
|
{
|
||||||
if (sRecordedBytesNo[battlerId] < BANK_RECORD_SIZE && sUnknown_0203C7AC != 2)
|
if (sRecordedBytesNo[battlerId] < BATTLER_RECORD_SIZE && sUnknown_0203C7AC != 2)
|
||||||
{
|
{
|
||||||
sBattleRecords[battlerId][sRecordedBytesNo[battlerId]++] = action;
|
sBattleRecords[battlerId][sRecordedBytesNo[battlerId]++] = action;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear)
|
|||||||
u8 RecordedBattle_GetBattlerAction(u8 battlerId)
|
u8 RecordedBattle_GetBattlerAction(u8 battlerId)
|
||||||
{
|
{
|
||||||
// trying to read past array or invalid action byte, battle is over
|
// trying to read past array or invalid action byte, battle is over
|
||||||
if (sRecordedBytesNo[battlerId] >= BANK_RECORD_SIZE || sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == 0xFF)
|
if (sRecordedBytesNo[battlerId] >= BATTLER_RECORD_SIZE || sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] == 0xFF)
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah
|
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED; // hah
|
||||||
ResetPaletteFadeControl();
|
ResetPaletteFadeControl();
|
||||||
@ -1380,7 +1380,7 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
|
|||||||
|
|
||||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < BANK_RECORD_SIZE; j++)
|
for (j = 0; j < BATTLER_RECORD_SIZE; j++)
|
||||||
{
|
{
|
||||||
sBattleRecords[i][j] = src->battleRecord[i][j];
|
sBattleRecords[i][j] = src->battleRecord[i][j];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user