battle link partner controller is done

This commit is contained in:
DizzyEggg 2017-10-23 16:38:11 +02:00
parent 356eb34e32
commit 1f3a867a0b
11 changed files with 1632 additions and 5702 deletions

View file

@ -4054,7 +4054,7 @@ _08066796:
.pool
_080667A8:
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
ldr r6, =gLinkPlayers
lsls r1, r0, 3
subs r1, r0
@ -4065,7 +4065,7 @@ _080667A8:
cmp r0, 0x4
beq _080667D8
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
@ -4077,7 +4077,7 @@ _080667A8:
bne _080667F4
_080667D8:
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
@ -4089,7 +4089,7 @@ _080667D8:
.pool
_080667F4:
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
@ -4100,7 +4100,7 @@ _080667F4:
cmp r0, 0x2
beq _08066822
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
@ -4111,7 +4111,7 @@ _080667F4:
bne _08066838
_08066822:
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
@ -4122,7 +4122,7 @@ _08066822:
b _08066924
_08066838:
ldrb r0, [r5]
bl sub_806D864
bl GetBankMultiplayerId
b _0806693A
_08066840:
movs r7, 0xB0

File diff suppressed because it is too large Load diff

View file

@ -629,7 +629,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
bool8 IsTradedMon(struct Pokemon *mon);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
s32 sub_806D864(u16 a1);
s32 GetBankMultiplayerId(u16 a1);
bool16 sub_806D82C(u8 id);
u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
void sub_8068AA4(void); // sets stats for deoxys

View file

@ -191,7 +191,6 @@ SECTIONS {
asm/fldeff_strength.o(.text);
asm/battle_transition.o(.text);
src/battle_controller_link_partner.o(.text);
asm/battle_controller_linkpartner.o(.text);
src/battle_message.o(.text);
asm/cable_car.o(.text);
asm/math_util.o(.text);

File diff suppressed because it is too large Load diff

View file

@ -1716,7 +1716,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void)
paletteNum = AllocSpritePalette(0xD6F9);
if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
trainerPicId = gLinkPlayers[sub_806D864(gActiveBank)].gender;
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender;
else
trainerPicId = gSaveBlock2Ptr->playerGender;

View file

@ -1226,9 +1226,9 @@ void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4)
void EmitCmd23(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_23;
gBattleBuffersTransferData[1] = 23;
gBattleBuffersTransferData[2] = 23;
gBattleBuffersTransferData[3] = 23;
gBattleBuffersTransferData[1] = CONTROLLER_23;
gBattleBuffersTransferData[2] = CONTROLLER_23;
gBattleBuffersTransferData[3] = CONTROLLER_23;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -1289,7 +1289,7 @@ void EmitDataTransfer(u8 bufferId, u16 size, void *data)
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER;
gBattleBuffersTransferData[1] = 29;
gBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER;
gBattleBuffersTransferData[2] = size;
gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
@ -1421,9 +1421,9 @@ void EmitHitAnimation(u8 bufferId)
void EmitCmd42(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_42;
gBattleBuffersTransferData[1] = 42;
gBattleBuffersTransferData[2] = 42;
gBattleBuffersTransferData[3] = 42;
gBattleBuffersTransferData[1] = CONTROLLER_42;
gBattleBuffersTransferData[2] = CONTROLLER_42;
gBattleBuffersTransferData[3] = CONTROLLER_42;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -1448,9 +1448,9 @@ void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM)
void EmitFaintingCry(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[1] = 45;
gBattleBuffersTransferData[2] = 45;
gBattleBuffersTransferData[3] = 45;
gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -1464,9 +1464,9 @@ void EmitIntroSlide(u8 bufferId, u8 terrainId)
void EmitIntroTrainerBallThrow(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[1] = 47;
gBattleBuffersTransferData[2] = 47;
gBattleBuffersTransferData[3] = 47;
gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -1477,7 +1477,7 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8
gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
gBattleBuffersTransferData[1] = arg2 & 0x7F;
gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7;
gBattleBuffersTransferData[3] = 48;
gBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++)
gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4);
@ -1486,18 +1486,18 @@ void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8
void EmitCmd49(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_49;
gBattleBuffersTransferData[1] = 49;
gBattleBuffersTransferData[2] = 49;
gBattleBuffersTransferData[3] = 49;
gBattleBuffersTransferData[1] = CONTROLLER_49;
gBattleBuffersTransferData[2] = CONTROLLER_49;
gBattleBuffersTransferData[3] = CONTROLLER_49;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd50(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_50;
gBattleBuffersTransferData[1] = 50;
gBattleBuffersTransferData[2] = 50;
gBattleBuffersTransferData[3] = 50;
gBattleBuffersTransferData[1] = CONTROLLER_50;
gBattleBuffersTransferData[2] = CONTROLLER_50;
gBattleBuffersTransferData[3] = CONTROLLER_50;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -1505,8 +1505,8 @@ void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible)
{
gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY;
gBattleBuffersTransferData[1] = isInvisible;
gBattleBuffersTransferData[2] = 51;
gBattleBuffersTransferData[3] = 51;
gBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY;
gBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}

View file

@ -1858,16 +1858,16 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gLinkPlayers[multiplayerID].name;
break;
case B_TXT_1F: // link partner name?
toCpy = gLinkPlayers[sub_806D864(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
toCpy = gLinkPlayers[GetBankMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
break;
case B_TXT_20: // link opponent 1 name?
toCpy = gLinkPlayers[sub_806D864(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
toCpy = gLinkPlayers[GetBankMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
break;
case B_TXT_21: // link opponent 2 name?
toCpy = gLinkPlayers[sub_806D864(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
toCpy = gLinkPlayers[GetBankMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
break;
case B_TXT_22: // link scripting active name
toCpy = gLinkPlayers[sub_806D864(gBattleScripting.bank)].name;
toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.bank)].name;
break;
case B_TXT_PLAYER_NAME: // player name
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)

View file

@ -5463,7 +5463,7 @@ static void atk4F_jump_if_cannot_switch(void)
party = gPlayerParty;
val = 0;
if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE)
if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE)
val = 3;
}
else
@ -5485,7 +5485,7 @@ static void atk4F_jump_if_cannot_switch(void)
val = 0;
if (sub_806D82C(sub_806D864(gActiveBank)) == TRUE)
if (sub_806D82C(GetBankMultiplayerId(gActiveBank)) == TRUE)
val = 3;
}
@ -7933,7 +7933,7 @@ static void atk8F_forcerandomswitch(void)
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_x2000000))
{
if (sub_806D82C(sub_806D864(gBankTarget)) == 1)
if (sub_806D82C(GetBankMultiplayerId(gBankTarget)) == 1)
{
firstMonId = 3;
lastMonId = 6;

View file

@ -1729,7 +1729,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2)
if (GetBankSide(bank) == SIDE_PLAYER)
{
party = gPlayerParty;
r7 = sub_806D864(bank);
r7 = GetBankMultiplayerId(bank);
r6 = sub_806D82C(r7);
}
else
@ -1748,7 +1748,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2)
}
else
{
r7 = sub_806D864(bank);
r7 = GetBankMultiplayerId(bank);
if (GetBankSide(bank) == SIDE_PLAYER)
party = gPlayerParty;
else

View file

@ -618,7 +618,7 @@ bool16 sub_806D82C(u8 id)
return retVal;
}
s32 sub_806D864(u16 a1)
s32 GetBankMultiplayerId(u16 a1)
{
s32 id;
for (id = 0; id < MAX_LINK_PLAYERS; id++)
@ -1477,7 +1477,7 @@ const u8* GetTrainerPartnerName(void)
else
{
u8 id = GetMultiplayerId();
return gLinkPlayers[sub_806D864(gLinkPlayers[id].lp_field_18 ^ 2)].name;
return gLinkPlayers[GetBankMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name;
}
}