(bmreliance) cleanup

This commit is contained in:
Stan H 2019-04-11 17:51:58 +02:00
parent 7e7633e3cd
commit f41450a8e3
6 changed files with 32 additions and 30 deletions

View File

@ -259,15 +259,3 @@ gUnknown_0859B996: @ 0x0859B996
.global gUnknown_0859B99E
gUnknown_0859B99E: @ 0x0859B99E
.incbin "baserom.gba", 0x59B99E, 0xA
.global gUnknown_0859B9A8
gUnknown_0859B9A8: @ 0x0859B9A8
.incbin "baserom.gba", 0x59B9A8, 0x10
.global gUnknown_0859B9B8
gUnknown_0859B9B8: @ 0x0859B9B8
.incbin "baserom.gba", 0x59B9B8, 0x80
.global gUnknown_0859BA38
gUnknown_0859BA38: @ 0x0859BA38
.incbin "baserom.gba", 0x59BA38, 0x58

9
data/data_59B9B8.s Normal file
View File

@ -0,0 +1,9 @@
.section .data
.global gUnknown_0859B9B8
gUnknown_0859B9B8: @ 0x0859B9B8
.incbin "baserom.gba", 0x59B9B8, 0x80
.global gUnknown_0859BA38
gUnknown_0859BA38: @ 0x0859BA38
.incbin "baserom.gba", 0x59BA38, 0x58

View File

@ -56,16 +56,11 @@ int GetUnitSupporterInitialExp(struct Unit* unit, int num);
int GetUnitSupporterNum(struct Unit* unit, u8 charId);
void ClearUnitSupports(struct Unit* unit);
void ProcessTurnSupportExp(void);
const struct SupportBonuses* GetAffinityBonuses(int affinity);
void ApplyAffinitySupportBonuses(struct SupportBonuses* bonuses, int affinity, int level);
void InitSupportBonuses(struct SupportBonuses* bonuses);
int GetUnitSupportBonuses(struct Unit* unit, struct SupportBonuses* bonuses);
int GetUnitAffinityIcon(struct Unit* unit);
int GetCharacterAffinityIcon(int characterId);
int GetSupportLevelUiChar(int level);
char* GetAffinityName(int affinity);
void SetSupportLevelGained(u8 charA, u8 charB);
s8 HasUnitGainedSupportLevel(struct Unit* unit, int num);
char* GetAffinityName(int affinity); // unused?
s8 HaveCharactersMaxSupport(u8 charA, u8 charB);
void SwapUnitStats(struct Unit* unitA, struct Unit* unitB);

View File

@ -1526,7 +1526,6 @@ extern const struct ProcCmd gUnknown_0859A548[]; // this is GENS/Camera Movement
// extern ??? gUnknown_0859B98E
// extern ??? gUnknown_0859B996
// extern ??? gUnknown_0859B99E
// extern ??? gUnknown_0859B9A8
// extern ??? gUnknown_0859B9B8
// extern ??? gUnknown_0859BA38
// extern ??? gUnknown_0859BC64
@ -3032,7 +3031,7 @@ extern const u8 gUnknown_088ADF39[]; // Slayer effectiveness list
// extern ??? gUnknown_088AF880
// extern ??? gUnknown_088AFB5A
// extern ??? gUnknown_088AFBD8
// extern ??? gUnknown_088B05F8
extern const struct SupportBonuses gUnknown_088B05F8[];
// extern ??? gUnknown_088B08F0
// extern ??? gUnknown_088B39EC
// extern ??? gUnknown_088B3AD8

View File

@ -228,6 +228,8 @@ SECTIONS
. = ALIGN(4); src/bmunit.o(.data);
. = ALIGN(4); src/bmmap.o(.data);
. = ALIGN(4); data/data_59A9D8.o(.data);
. = ALIGN(4); src/bmreliance.o(.data);
. = ALIGN(4); data/data_59B9B8.o(.data);
. = ALIGN(4); src/bmbattle.o(.data);
. = ALIGN(4); src/bmtrade.o(.data);
. = ALIGN(4); data/data_59BC64.o(.data);

View File

@ -4,11 +4,20 @@
#include "bmreliance.h"
extern const int gUnknown_0859B9A8[4];
CONST_DATA
static int sSupportMaxExpLookup[] = {
[SUPPORT_LEVEL_NONE] = SUPPORT_EXP_C-1,
[SUPPORT_LEVEL_C] = SUPPORT_EXP_B-1,
[SUPPORT_LEVEL_B] = SUPPORT_EXP_A-1,
[SUPPORT_LEVEL_A] = SUPPORT_EXP_A
};
extern const struct SupportBonuses gUnknown_088B05F8[];
static const struct SupportBonuses* GetAffinityBonuses(int affinity);
static void ApplyAffinitySupportBonuses(struct SupportBonuses* bonuses, int affinity, int level);
static void InitSupportBonuses(struct SupportBonuses* bonuses);
s8 HasUnitGainedSupportLevel(struct Unit* unit, int num);
static void SetSupportLevelGained(u8 charA, u8 charB);
static s8 HasUnitGainedSupportLevel(struct Unit* unit, int num);
int GetUnitSupporterCount(struct Unit* unit)
{
@ -82,7 +91,7 @@ void UnitGainSupportExp(struct Unit* unit, int num)
{
int gain = UNIT_SUPPORT_DATA(unit)->supportExpGrowth[num];
int currentExp = unit->supports[num];
int maxExp = gUnknown_0859B9A8[GetUnitSupportLevel(unit, num)];
int maxExp = sSupportMaxExpLookup[GetUnitSupportLevel(unit, num)];
if (currentExp + gain > maxExp)
gain = maxExp - currentExp;
@ -120,7 +129,7 @@ s8 CanUnitSupportNow(struct Unit* unit, int num)
return FALSE;
exp = unit->supports[num];
maxExp = gUnknown_0859B9A8[GetUnitSupportLevel(unit, num)];
maxExp = sSupportMaxExpLookup[GetUnitSupportLevel(unit, num)];
if (exp == SUPPORT_EXP_A)
return FALSE;
@ -227,7 +236,7 @@ void ProcessTurnSupportExp(void)
}
}
const struct SupportBonuses* GetAffinityBonuses(int affinity)
static const struct SupportBonuses* GetAffinityBonuses(int affinity)
{
const struct SupportBonuses* it;
@ -240,7 +249,7 @@ const struct SupportBonuses* GetAffinityBonuses(int affinity)
// return NULL; // BUG?
}
void ApplyAffinitySupportBonuses(struct SupportBonuses* bonuses, int affinity, int level)
static void ApplyAffinitySupportBonuses(struct SupportBonuses* bonuses, int affinity, int level)
{
const struct SupportBonuses* added = GetAffinityBonuses(affinity);
@ -252,7 +261,7 @@ void ApplyAffinitySupportBonuses(struct SupportBonuses* bonuses, int affinity, i
bonuses->bonusDodge += level * added->bonusDodge;
}
void InitSupportBonuses(struct SupportBonuses* bonuses)
static void InitSupportBonuses(struct SupportBonuses* bonuses)
{
bonuses->bonusAttack = 0;
bonuses->bonusDefense = 0;
@ -352,7 +361,7 @@ char* GetAffinityName(int affinity)
return GetStringFromIndex(textIdLookup[affinity]);
}
void SetSupportLevelGained(u8 charA, u8 charB)
static void SetSupportLevelGained(u8 charA, u8 charB)
{
struct Unit* unit = GetUnitFromCharId(charA);
int num = GetUnitSupporterNum(unit, charB);
@ -365,7 +374,7 @@ void SetSupportLevelGained(u8 charA, u8 charB)
unit->supportBits |= (1 << num);
}
s8 HasUnitGainedSupportLevel(struct Unit* unit, int num)
static s8 HasUnitGainedSupportLevel(struct Unit* unit, int num)
{
s8 result = unit->supportBits & (1 << num);
return result ? TRUE : FALSE;