make union room compile i guess

This commit is contained in:
DizzyEggg 2018-07-22 12:49:49 +02:00
parent 377280ac3b
commit c9d486a5d3
12 changed files with 1967 additions and 113 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ LilycoveCity_ContestLobby_MapWarps: @ 853178C
warp_def 21, 1, 0, 1, LILYCOVE_CITY_CONTEST_HALL warp_def 21, 1, 0, 1, LILYCOVE_CITY_CONTEST_HALL
LilycoveCity_ContestLobby_MapBGEvents: @ 85317AC LilycoveCity_ContestLobby_MapBGEvents: @ 85317AC
bg_event 23, 5, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_294055 bg_event 23, 5, 0, 0, 0, EventScript_PblockLink
bg_event 23, 9, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_293E1E bg_event 23, 9, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_293E1E
bg_event 23, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A753 bg_event 23, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A753
bg_event 25, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A75A bg_event 25, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A75A
@ -41,7 +41,7 @@ LilycoveCity_ContestLobby_MapBGEvents: @ 85317AC
bg_event 3, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A73E bg_event 3, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A73E
bg_event 5, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A745 bg_event 5, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A745
bg_event 7, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A74C bg_event 7, 1, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A74C
bg_event 27, 5, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_293C3E bg_event 27, 5, 0, 0, 0, EventScript_Pblock1_Ask
bg_event 27, 9, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_293D4D bg_event 27, 9, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_293D4D
bg_event 18, 3, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A784 bg_event 18, 3, 0, 0, 0, LilycoveCity_ContestLobby_EventScript_21A784

View File

@ -245,7 +245,7 @@ LilycoveCity_ContestLobby_Text_293BB4: @ 8293BB4
.string "But, I dont have any to spare today.\n" .string "But, I dont have any to spare today.\n"
.string "Sorry about that.$" .string "Sorry about that.$"
EventScript_Pblock1_Ask: @ 8293C3E EventScript_Pblock1_Ask:: @ 8293C3E
lockall lockall
checkflag FLAG_0x340 checkflag FLAG_0x340
goto_if 0, LilycoveCity_ContestLobby_EventScript_293EFB goto_if 0, LilycoveCity_ContestLobby_EventScript_293EFB
@ -332,7 +332,7 @@ EventScript_Pblock1_NoPokeblock: @ 8293D43
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_293D4D: @ 8293D4D LilycoveCity_ContestLobby_EventScript_293D4D:: @ 8293D4D
lockall lockall
setvar VAR_0x8009, 2 setvar VAR_0x8009, 2
applymovement 10, LilycoveCity_ContestLobby_Movement_2725A2 applymovement 10, LilycoveCity_ContestLobby_Movement_2725A2
@ -396,7 +396,7 @@ LilycoveCity_ContestLobby_EventScript_293E14: @ 8293E14
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_293E1E: @ 8293E1E LilycoveCity_ContestLobby_EventScript_293E1E:: @ 8293E1E
lockall lockall
setvar VAR_0x8008, 15 setvar VAR_0x8008, 15
setvar VAR_0x8009, 3 setvar VAR_0x8009, 3
@ -513,19 +513,19 @@ LilycoveCity_ContestLobby_EventScript_293F98: @ 8293F98
releaseall releaseall
end end
LilycoveCity_ContestLobby_EventScript_293FA2: @ 8293FA2 LilycoveCity_ContestLobby_EventScript_293FA2:: @ 8293FA2
msgbox LilycoveCity_ContestLobby_Text_2937F9, 2 msgbox LilycoveCity_ContestLobby_Text_2937F9, 2
end end
LilycoveCity_ContestLobby_EventScript_293FAB: @ 8293FAB LilycoveCity_ContestLobby_EventScript_293FAB:: @ 8293FAB
msgbox LilycoveCity_ContestLobby_Text_293842, 2 msgbox LilycoveCity_ContestLobby_Text_293842, 2
end end
LilycoveCity_ContestLobby_EventScript_293FB4: @ 8293FB4 LilycoveCity_ContestLobby_EventScript_293FB4:: @ 8293FB4
msgbox LilycoveCity_ContestLobby_Text_29388F, 2 msgbox LilycoveCity_ContestLobby_Text_29388F, 2
end end
LilycoveCity_ContestLobby_EventScript_293FBD: @ 8293FBD LilycoveCity_ContestLobby_EventScript_293FBD:: @ 8293FBD
setvar VAR_0x8008, 15 setvar VAR_0x8008, 15
goto LilycoveCity_ContestLobby_EventScript_293FC8 goto LilycoveCity_ContestLobby_EventScript_293FC8
end end
@ -576,7 +576,7 @@ LilycoveCity_ContestLobby_Movement_294053: @ 8294053
step_28 step_28
step_end step_end
EventScript_PblockLink: @ 8294055 EventScript_PblockLink:: @ 8294055
lockall lockall
specialvar VAR_RESULT, PlayerHasBerries specialvar VAR_RESULT, PlayerHasBerries
compare VAR_RESULT, 0 compare VAR_RESULT, 0

View File

@ -81,7 +81,7 @@ struct UnkLinkRfuStruct_02022B14Substruct
u8 playerTrainerId[2]; u8 playerTrainerId[2];
}; };
struct UnkLinkRfuStruct_02022B14 struct __attribute__((packed)) UnkLinkRfuStruct_02022B14
{ {
struct UnkLinkRfuStruct_02022B14Substruct unk_00; struct UnkLinkRfuStruct_02022B14Substruct unk_00;
u8 unk_04[4]; u8 unk_04[4];

View File

@ -278,7 +278,7 @@ static void sub_8035C4C(void)
{ {
if (gBattleOutcome == B_OUTCOME_WON) if (gBattleOutcome == B_OUTCOME_WON)
{ {
switch (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18) switch (gLinkPlayers[gBattleScripting.multiplayerId].id)
{ {
case 0: case 0:
BattleHandleAddTextPrinter(gText_Win, 0x16); BattleHandleAddTextPrinter(gText_Win, 0x16);
@ -300,7 +300,7 @@ static void sub_8035C4C(void)
} }
else else
{ {
switch (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18) switch (gLinkPlayers[gBattleScripting.multiplayerId].id)
{ {
case 0: case 0:
BattleHandleAddTextPrinter(gText_Win, 0x17); BattleHandleAddTextPrinter(gText_Win, 0x17);
@ -323,7 +323,7 @@ static void sub_8035C4C(void)
} }
else if (gBattleOutcome == B_OUTCOME_WON) else if (gBattleOutcome == B_OUTCOME_WON)
{ {
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 != 0) if (gLinkPlayers[gBattleScripting.multiplayerId].id != 0)
{ {
BattleHandleAddTextPrinter(gText_Win, 0x17); BattleHandleAddTextPrinter(gText_Win, 0x17);
BattleHandleAddTextPrinter(gText_Loss, 0x16); BattleHandleAddTextPrinter(gText_Loss, 0x16);
@ -336,7 +336,7 @@ static void sub_8035C4C(void)
} }
else else
{ {
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 != 0) if (gLinkPlayers[gBattleScripting.multiplayerId].id != 0)
{ {
BattleHandleAddTextPrinter(gText_Win, 0x16); BattleHandleAddTextPrinter(gText_Win, 0x16);
BattleHandleAddTextPrinter(gText_Loss, 0x17); BattleHandleAddTextPrinter(gText_Loss, 0x17);
@ -365,23 +365,23 @@ void sub_8035D74(u8 taskId)
name = gLinkPlayers[i].name; name = gLinkPlayers[i].name;
linkPlayer = &gLinkPlayers[i]; linkPlayer = &gLinkPlayers[i];
switch (linkPlayer->lp_field_18) switch (linkPlayer->id)
{ {
case 0: case 0:
BattleHandleAddTextPrinter(name, 0x11); BattleHandleAddTextPrinter(name, 0x11);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 1, 2, 4); sub_8035AE4(taskId, linkPlayer->id, 1, 2, 4);
break; break;
case 1: case 1:
BattleHandleAddTextPrinter(name, 0x12); BattleHandleAddTextPrinter(name, 0x12);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 2, 2, 4); sub_8035AE4(taskId, linkPlayer->id, 2, 2, 4);
break; break;
case 2: case 2:
BattleHandleAddTextPrinter(name, 0x13); BattleHandleAddTextPrinter(name, 0x13);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 1, 2, 8); sub_8035AE4(taskId, linkPlayer->id, 1, 2, 8);
break; break;
case 3: case 3:
BattleHandleAddTextPrinter(name, 0x14); BattleHandleAddTextPrinter(name, 0x14);
sub_8035AE4(taskId, linkPlayer->lp_field_18, 2, 2, 8); sub_8035AE4(taskId, linkPlayer->id, 2, 2, 8);
break; break;
} }
} }
@ -392,7 +392,7 @@ void sub_8035D74(u8 taskId)
u8 opponentId = playerId ^ BIT_SIDE; u8 opponentId = playerId ^ BIT_SIDE;
u8 opponentId_copy = opponentId; u8 opponentId_copy = opponentId;
if (gLinkPlayers[playerId].lp_field_18 != 0) if (gLinkPlayers[playerId].id != 0)
opponentId = playerId, playerId = opponentId_copy; opponentId = playerId, playerId = opponentId_copy;
name = gLinkPlayers[playerId].name; name = gLinkPlayers[playerId].name;

View File

@ -264,67 +264,67 @@ static void InitSinglePlayerBtlControllers(void)
for (var = gUnknown_0203C7B4, i = 0; i < MAX_BATTLERS_COUNT; i++) for (var = gUnknown_0203C7B4, i = 0; i < MAX_BATTLERS_COUNT; i++)
{ {
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
sub_81B8D64(gLinkPlayers[i].lp_field_18, 0); sub_81B8D64(gLinkPlayers[i].id, 0);
break; break;
case 1: case 1:
case 2: case 2:
sub_81B8D64(gLinkPlayers[i].lp_field_18, 1); sub_81B8D64(gLinkPlayers[i].id, 1);
break; break;
} }
if (i == var) if (i == var)
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToRecordedPlayer;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_PLAYER_LEFT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_PLAYER_RIGHT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }
else if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[var].lp_field_18 & 1)) else if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[var].id & 1))
|| ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[var].lp_field_18 & 1))) || ((gLinkPlayers[i].id & 1) && (gLinkPlayers[var].id & 1)))
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToRecordedPlayer;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_PLAYER_LEFT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_PLAYER_RIGHT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }
else else
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToRecordedOpponent;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_LEFT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_OPPONENT_LEFT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_RIGHT; gBattlerPositions[gLinkPlayers[i].id] = B_POSITION_OPPONENT_RIGHT;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }
@ -506,69 +506,69 @@ static void InitLinkBtlControllers(void)
for (i = 0; i < MAX_BATTLERS_COUNT; i++) for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{ {
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
sub_81B8D64(gLinkPlayers[i].lp_field_18, 0); sub_81B8D64(gLinkPlayers[i].id, 0);
break; break;
case 1: case 1:
case 2: case 2:
sub_81B8D64(gLinkPlayers[i].lp_field_18, 1); sub_81B8D64(gLinkPlayers[i].id, 1);
break; break;
} }
if (i == multiplayerId) if (i == multiplayerId)
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToPlayer;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0; gBattlerPositions[gLinkPlayers[i].id] = 0;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2; gBattlerPositions[gLinkPlayers[i].id] = 2;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }
else else
{ {
if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[multiplayerId].lp_field_18 & 1)) if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[multiplayerId].id & 1))
|| ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[multiplayerId].lp_field_18 & 1))) || ((gLinkPlayers[i].id & 1) && (gLinkPlayers[multiplayerId].id & 1)))
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToLinkPartner;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0; gBattlerPositions[gLinkPlayers[i].id] = 0;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2; gBattlerPositions[gLinkPlayers[i].id] = 2;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }
else else
{ {
gBattlerControllerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent; gBattlerControllerFuncs[gLinkPlayers[i].id] = SetControllerToLinkOpponent;
switch (gLinkPlayers[i].lp_field_18) switch (gLinkPlayers[i].id)
{ {
case 0: case 0:
case 3: case 3:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 1; gBattlerPositions[gLinkPlayers[i].id] = 1;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 0; gBattlerPartyIndexes[gLinkPlayers[i].id] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 3; gBattlerPositions[gLinkPlayers[i].id] = 3;
gBattlerPartyIndexes[gLinkPlayers[i].lp_field_18] = 3; gBattlerPartyIndexes[gLinkPlayers[i].id] = 3;
break; break;
} }
} }

View File

@ -821,7 +821,7 @@ static void SetAllPlayersBerryData(void)
for (i = 0; i < numPlayers; i++) for (i = 0; i < numPlayers; i++)
{ {
src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2);
r4 = gLinkPlayers[i].lp_field_18; r4 = gLinkPlayers[i].id;
for (j = 0; j < BERRY_NAME_COUNT - 1; j++) for (j = 0; j < BERRY_NAME_COUNT - 1; j++)
gEnigmaBerries[r4].name[j] = src->name[j]; gEnigmaBerries[r4].name[j] = src->name[j];
@ -958,8 +958,8 @@ static void CB2_HandleStartBattle(void)
if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00) if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
{ {
gLinkPlayers[0].lp_field_18 = 0; gLinkPlayers[0].id = 0;
gLinkPlayers[1].lp_field_18 = 1; gLinkPlayers[1].id = 1;
} }
SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32); SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32);
@ -1146,10 +1146,10 @@ static void CB2_HandleStartMultiPartnerBattle(void)
{ {
u8 language; u8 language;
gLinkPlayers[0].lp_field_18 = 0; gLinkPlayers[0].id = 0;
gLinkPlayers[1].lp_field_18 = 2; gLinkPlayers[1].id = 2;
gLinkPlayers[2].lp_field_18 = 1; gLinkPlayers[2].id = 1;
gLinkPlayers[3].lp_field_18 = 3; gLinkPlayers[3].id = 3;
GetFrontierTrainerName(gLinkPlayers[2].name, gTrainerBattleOpponent_A); GetFrontierTrainerName(gLinkPlayers[2].name, gTrainerBattleOpponent_A);
GetFrontierTrainerName(gLinkPlayers[3].name, gTrainerBattleOpponent_B); GetFrontierTrainerName(gLinkPlayers[3].name, gTrainerBattleOpponent_B);
sub_8165B88(&language, gTrainerBattleOpponent_A); sub_8165B88(&language, gTrainerBattleOpponent_A);
@ -1207,7 +1207,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
if ((GetBlockReceivedStatus() & 3) == 3) if ((GetBlockReceivedStatus() & 3) == 3)
{ {
ResetBlockReceivedFlags(); ResetBlockReceivedFlags();
if (gLinkPlayers[playerMultiplayerId].lp_field_18 != 0) if (gLinkPlayers[playerMultiplayerId].id != 0)
{ {
memcpy(gPlayerParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); memcpy(gPlayerParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + 3, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2); memcpy(gPlayerParty + 3, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
@ -1231,7 +1231,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
if ((GetBlockReceivedStatus() & 3) == 3) if ((GetBlockReceivedStatus() & 3) == 3)
{ {
ResetBlockReceivedFlags(); ResetBlockReceivedFlags();
if (gLinkPlayers[playerMultiplayerId].lp_field_18 != 0) if (gLinkPlayers[playerMultiplayerId].id != 0)
{ {
memcpy(gPlayerParty + 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon)); memcpy(gPlayerParty + 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon));
memcpy(gPlayerParty + 5, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon)); memcpy(gPlayerParty + 5, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon));
@ -1422,8 +1422,8 @@ static void CB2_PreInitMultiBattle(void)
if (numPlayers == 4) if (numPlayers == 4)
{ {
if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplierId].lp_field_18 & 1)) if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[playerMultiplierId].id & 1))
|| (gLinkPlayers[i].lp_field_18 & 1 && gLinkPlayers[playerMultiplierId].lp_field_18 & 1)) || (gLinkPlayers[i].id & 1 && gLinkPlayers[playerMultiplierId].id & 1))
{ {
memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * 3); memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * 3);
} }
@ -1583,7 +1583,7 @@ static void CB2_HandleStartMultiBattle(void)
for (id = 0; id < MAX_LINK_PLAYERS; id++) for (id = 0; id < MAX_LINK_PLAYERS; id++)
{ {
sub_8185F90(gBlockRecvBuffer[id][1]); sub_8185F90(gBlockRecvBuffer[id][1]);
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
gTasks[var].data[3] |= gBlockRecvBuffer[id][1] & 0x3F; gTasks[var].data[3] |= gBlockRecvBuffer[id][1] & 0x3F;
@ -1620,7 +1620,7 @@ static void CB2_HandleStartMultiBattle(void)
{ {
if (id == playerMultiplayerId) if (id == playerMultiplayerId)
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -1634,10 +1634,10 @@ static void CB2_HandleStartMultiBattle(void)
} }
else else
{ {
if ((!(gLinkPlayers[id].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplayerId].lp_field_18 & 1)) if ((!(gLinkPlayers[id].id & 1) && !(gLinkPlayers[playerMultiplayerId].id & 1))
|| ((gLinkPlayers[id].lp_field_18 & 1) && (gLinkPlayers[playerMultiplayerId].lp_field_18 & 1))) || ((gLinkPlayers[id].id & 1) && (gLinkPlayers[playerMultiplayerId].id & 1)))
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -1651,7 +1651,7 @@ static void CB2_HandleStartMultiBattle(void)
} }
else else
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -1683,7 +1683,7 @@ static void CB2_HandleStartMultiBattle(void)
{ {
if (id == playerMultiplayerId) if (id == playerMultiplayerId)
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -1697,10 +1697,10 @@ static void CB2_HandleStartMultiBattle(void)
} }
else else
{ {
if ((!(gLinkPlayers[id].lp_field_18 & 1) && !(gLinkPlayers[playerMultiplayerId].lp_field_18 & 1)) if ((!(gLinkPlayers[id].id & 1) && !(gLinkPlayers[playerMultiplayerId].id & 1))
|| ((gLinkPlayers[id].lp_field_18 & 1) && (gLinkPlayers[playerMultiplayerId].lp_field_18 & 1))) || ((gLinkPlayers[id].id & 1) && (gLinkPlayers[playerMultiplayerId].id & 1)))
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -1714,7 +1714,7 @@ static void CB2_HandleStartMultiBattle(void)
} }
else else
{ {
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -2088,7 +2088,7 @@ static void sub_8038B94(u8 taskId)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
switch (gLinkPlayers[r2].lp_field_18) switch (gLinkPlayers[r2].id)
{ {
case 0: case 0:
case 2: case 2:

View File

@ -1843,25 +1843,25 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
toCpy = text; toCpy = text;
break; break;
case B_TXT_LINK_PLAYER_MON1_NAME: // link first player poke name case B_TXT_LINK_PLAYER_MON1_NAME: // link first player poke name
GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18]], GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].id]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_LINK_OPPONENT_MON1_NAME: // link first opponent poke name case B_TXT_LINK_OPPONENT_MON1_NAME: // link first opponent poke name
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 1]], GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].id ^ 1]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_LINK_PLAYER_MON2_NAME: // link second player poke name case B_TXT_LINK_PLAYER_MON2_NAME: // link second player poke name
GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 2]], GetMonData(&gPlayerParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].id ^ 2]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_LINK_OPPONENT_MON2_NAME: // link second opponent poke name case B_TXT_LINK_OPPONENT_MON2_NAME: // link second opponent poke name
GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].lp_field_18 ^ 3]], GetMonData(&gEnemyParty[gBattlerPartyIndexes[gLinkPlayers[multiplayerID].id ^ 3]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
@ -1927,7 +1927,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
} }
else else
{ {
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gPotentialItemEffectBattler) if (gLinkPlayers[gBattleScripting.multiplayerId].id == gPotentialItemEffectBattler)
{ {
StringCopy(text, gEnigmaBerries[gPotentialItemEffectBattler].name); StringCopy(text, gEnigmaBerries[gPotentialItemEffectBattler].name);
StringAppend(text, sText_BerrySuffix); StringAppend(text, sText_BerrySuffix);
@ -2022,13 +2022,13 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
toCpy = gLinkPlayers[multiplayerID].name; toCpy = gLinkPlayers[multiplayerID].name;
break; break;
case B_TXT_1F: // link partner name? case B_TXT_1F: // link partner name?
toCpy = gLinkPlayers[GetBattlerMultiplayerId(2 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; toCpy = gLinkPlayers[GetBattlerMultiplayerId(2 ^ gLinkPlayers[multiplayerID].id)].name;
break; break;
case B_TXT_20: // link opponent 1 name? case B_TXT_20: // link opponent 1 name?
toCpy = gLinkPlayers[GetBattlerMultiplayerId(1 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; toCpy = gLinkPlayers[GetBattlerMultiplayerId(1 ^ gLinkPlayers[multiplayerID].id)].name;
break; break;
case B_TXT_21: // link opponent 2 name? case B_TXT_21: // link opponent 2 name?
toCpy = gLinkPlayers[GetBattlerMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name; toCpy = gLinkPlayers[GetBattlerMultiplayerId(3 ^ gLinkPlayers[multiplayerID].id)].name;
break; break;
case B_TXT_22: // link scripting active name case B_TXT_22: // link scripting active name
toCpy = gLinkPlayers[GetBattlerMultiplayerId(gBattleScripting.battler)].name; toCpy = gLinkPlayers[GetBattlerMultiplayerId(gBattleScripting.battler)].name;
@ -2296,7 +2296,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
{ {
if (hword == ITEM_ENIGMA_BERRY) if (hword == ITEM_ENIGMA_BERRY)
{ {
if (gLinkPlayers[gBattleScripting.multiplayerId].lp_field_18 == gPotentialItemEffectBattler) if (gLinkPlayers[gBattleScripting.multiplayerId].id == gPotentialItemEffectBattler)
{ {
StringCopy(dst, gEnigmaBerries[gPotentialItemEffectBattler].name); StringCopy(dst, gEnigmaBerries[gPotentialItemEffectBattler].name);
StringAppend(dst, sText_BerrySuffix); StringAppend(dst, sText_BerrySuffix);

View File

@ -304,7 +304,7 @@ void LinkTestScreen(void)
void sub_8009628(u8 a0) void sub_8009628(u8 a0)
{ {
gLocalLinkPlayer.lp_field_18 = a0; gLocalLinkPlayer.id = a0;
} }
static void InitLocalLinkPlayer(void) static void InitLocalLinkPlayer(void)

View File

@ -1752,7 +1752,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId)
return FALSE; return FALSE;
if (!gMain.inBattle) if (!gMain.inBattle)
return FALSE; return FALSE;
if (gLinkPlayers[GetMultiplayerId()].lp_field_18 == battlerId) if (gLinkPlayers[GetMultiplayerId()].id == battlerId)
return FALSE; return FALSE;
break; break;
case 2: case 2:
@ -1774,7 +1774,7 @@ bool8 sub_80688F8(u8 caseId, u8 battlerId)
return FALSE; return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if (gLinkPlayers[GetMultiplayerId()].lp_field_18 == battlerId) if (gLinkPlayers[GetMultiplayerId()].id == battlerId)
return FALSE; return FALSE;
} }
else else
@ -4805,7 +4805,7 @@ void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies)
bool8 sub_806D7EC(void) bool8 sub_806D7EC(void)
{ {
bool8 retVal = FALSE; bool8 retVal = FALSE;
switch (gLinkPlayers[GetMultiplayerId()].lp_field_18) switch (gLinkPlayers[GetMultiplayerId()].id)
{ {
case 0: case 0:
case 3: case 3:
@ -4822,7 +4822,7 @@ bool8 sub_806D7EC(void)
bool16 sub_806D82C(u8 id) bool16 sub_806D82C(u8 id)
{ {
bool16 retVal = FALSE; bool16 retVal = FALSE;
switch (gLinkPlayers[id].lp_field_18) switch (gLinkPlayers[id].id)
{ {
case 0: case 0:
case 3: case 3:
@ -4840,7 +4840,7 @@ s32 GetBattlerMultiplayerId(u16 a1)
{ {
s32 id; s32 id;
for (id = 0; id < MAX_LINK_PLAYERS; id++) for (id = 0; id < MAX_LINK_PLAYERS; id++)
if (gLinkPlayers[id].lp_field_18 == a1) if (gLinkPlayers[id].id == a1)
break; break;
return id; return id;
} }
@ -5691,7 +5691,7 @@ const u8 *GetTrainerPartnerName(void)
else else
{ {
u8 id = GetMultiplayerId(); u8 id = GetMultiplayerId();
return gLinkPlayers[GetBattlerMultiplayerId(gLinkPlayers[id].lp_field_18 ^ 2)].name; return gLinkPlayers[GetBattlerMultiplayerId(gLinkPlayers[id].id ^ 2)].name;
} }
} }
@ -5821,7 +5821,7 @@ u8 sub_806EF08(u8 arg0)
s32 i; s32 i;
s32 var = 0; s32 var = 0;
u8 multiplayerId = GetMultiplayerId(); u8 multiplayerId = GetMultiplayerId();
switch (gLinkPlayers[multiplayerId].lp_field_18) switch (gLinkPlayers[multiplayerId].id)
{ {
case 0: case 0:
case 2: case 2:
@ -5834,7 +5834,7 @@ u8 sub_806EF08(u8 arg0)
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gLinkPlayers[i].lp_field_18 == (s16)(var)) if (gLinkPlayers[i].id == (s16)(var))
break; break;
} }
return i; return i;
@ -5844,7 +5844,7 @@ u8 sub_806EF84(u8 arg0, u8 arg1)
{ {
s32 i; s32 i;
s32 var = 0; s32 var = 0;
switch (gLinkPlayers[arg1].lp_field_18) switch (gLinkPlayers[arg1].id)
{ {
case 0: case 0:
case 2: case 2:
@ -5857,7 +5857,7 @@ u8 sub_806EF84(u8 arg0, u8 arg1)
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (gLinkPlayers[i].lp_field_18 == (s16)(var)) if (gLinkPlayers[i].id == (s16)(var))
break; break;
} }
return i; return i;

View File

@ -159,7 +159,7 @@ void sub_8184E58(void)
{ {
sRecordedBattle_Players[i].trainerId = gLinkPlayers[i].trainerId; sRecordedBattle_Players[i].trainerId = gLinkPlayers[i].trainerId;
sRecordedBattle_Players[i].gender = gLinkPlayers[i].gender; sRecordedBattle_Players[i].gender = gLinkPlayers[i].gender;
sRecordedBattle_Players[i].battlerId = gLinkPlayers[i].lp_field_18; sRecordedBattle_Players[i].battlerId = gLinkPlayers[i].id;
sRecordedBattle_Players[i].language = gLinkPlayers[i].language; sRecordedBattle_Players[i].language = gLinkPlayers[i].language;
if (i < linkPlayersCount) if (i < linkPlayersCount)
@ -1340,7 +1340,7 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
} }
gLinkPlayers[i].gender = src->playersGender[i]; gLinkPlayers[i].gender = src->playersGender[i];
gLinkPlayers[i].language = src->playersLanguage[i]; gLinkPlayers[i].language = src->playersLanguage[i];
gLinkPlayers[i].lp_field_18 = src->playersBattlers[i]; gLinkPlayers[i].id = src->playersBattlers[i];
gLinkPlayers[i].trainerId = src->playersTrainerId[i]; gLinkPlayers[i].trainerId = src->playersTrainerId[i];
if (var) if (var)
@ -1453,7 +1453,7 @@ u8 GetActiveBattlerLinkPlayerGender(void)
for (i = 0; i < MAX_LINK_PLAYERS; i++) for (i = 0; i < MAX_LINK_PLAYERS; i++)
{ {
if (gLinkPlayers[i].lp_field_18 == gActiveBattler) if (gLinkPlayers[i].id == gActiveBattler)
break; break;
} }

View File

@ -38,6 +38,7 @@ extern void HealPlayerParty(void);
struct UnkStruct_Shared struct UnkStruct_Shared
{ {
struct UnkLinkRfuStruct_02022B14 field_0; struct UnkLinkRfuStruct_02022B14 field_0;
u8 needingPadding[3];
u8 playerName[PLAYER_NAME_LENGTH]; u8 playerName[PLAYER_NAME_LENGTH];
}; };
@ -2508,6 +2509,8 @@ void sub_80156C8(struct UnkStruct_URoom *data)
memcpy(data->field_0, &gDecompressionBuffer[0x3F00], 0x100); memcpy(data->field_0, &gDecompressionBuffer[0x3F00], 0x100);
} }
// Cannot match, please fix later.
/*
void sub_80156E0(u8 taskId) void sub_80156E0(u8 taskId)
{ {
u32 id = 0; u32 id = 0;
@ -3257,3 +3260,5 @@ void var_800D_set_xB(void)
if (InUnionRoom() == TRUE) if (InUnionRoom() == TRUE)
gSpecialVar_Result = 11; gSpecialVar_Result = 11;
} }
*/