Skip to content

Commit e7993a2

Browse files
committed
Use marioPartyEntry when spawning followers
This also requires partyRun to be called to make sure that the follower is moving. Partners will be moving by default, and partyRun only makes partners/followers run if they're not already moving, so calling partyRun when spawning a partner will not cause issues.
1 parent d4e0778 commit e7993a2

File tree

11 files changed

+32
-34
lines changed

11 files changed

+32
-34
lines changed

ttyd-tools/rel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ MACHDEP = -mno-sdata -mgcn -DGEKKO -mcpu=750 -meabi -mhard-float
5454
CFLAGS = -nostdlib -ffreestanding -ffunction-sections -fdata-sections -g -Os -Wall -Werror $(MACHDEP) $(INCLUDE)
5555
CXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++17 $(CFLAGS)
5656

57-
FUNCWRAPS = -Wl,--wrap,sprintf -Wl,--wrap,strcmp -Wl,--wrap,strncmp -Wl,--wrap,strcpy -Wl,--wrap,strncpy -Wl,--wrap,strcat -Wl,--wrap,strlen -Wl,--wrap,memcpy -Wl,--wrap,memset -Wl,--wrap,sysMsec2Frame -Wl,--wrap,keyGetButton -Wl,--wrap,keyGetButtonTrg -Wl,--wrap,seqGetSeq -Wl,--wrap,seqGetNextSeq -Wl,--wrap,swByteGet -Wl,--wrap,swByteSet -Wl,--wrap,swClear -Wl,--wrap,swSet -Wl,--wrap,marioStGetSystemLevel -Wl,--wrap,marioStSystemLevel -Wl,--wrap,marioGetPartyId -Wl,--wrap,marioGetExtraPartyId -Wl,--wrap,marioPartyEntry -Wl,--wrap,marioGetPtr -Wl,--wrap,pouchGetPtr -Wl,--wrap,btlGetScreenPoint -Wl,--wrap,evtGetWork -Wl,--wrap,eventStgNum -Wl,--wrap,eventStgDtPtr -Wl,--wrap,winGetPtr -Wl,--wrap,winOpenEnable -Wl,--wrap,CARDClose -Wl,--wrap,DCFlushRange -Wl,--wrap,ICInvalidateRange -Wl,--wrap,__udivdi3 -Wl,--wrap,__umoddi3
57+
FUNCWRAPS = -Wl,--wrap,sprintf -Wl,--wrap,strcmp -Wl,--wrap,strncmp -Wl,--wrap,strcpy -Wl,--wrap,strncpy -Wl,--wrap,strcat -Wl,--wrap,strlen -Wl,--wrap,memcpy -Wl,--wrap,memset -Wl,--wrap,sysMsec2Frame -Wl,--wrap,keyGetButton -Wl,--wrap,keyGetButtonTrg -Wl,--wrap,seqGetSeq -Wl,--wrap,seqGetNextSeq -Wl,--wrap,swByteGet -Wl,--wrap,swByteSet -Wl,--wrap,swClear -Wl,--wrap,swSet -Wl,--wrap,marioStGetSystemLevel -Wl,--wrap,marioStSystemLevel -Wl,--wrap,marioGetPartyId -Wl,--wrap,marioGetExtraPartyId -Wl,--wrap,marioGetPtr -Wl,--wrap,partyGetPtr -Wl,--wrap,pouchGetPtr -Wl,--wrap,btlGetScreenPoint -Wl,--wrap,evtGetWork -Wl,--wrap,eventStgNum -Wl,--wrap,eventStgDtPtr -Wl,--wrap,winGetPtr -Wl,--wrap,winOpenEnable -Wl,--wrap,CARDClose -Wl,--wrap,DCFlushRange -Wl,--wrap,ICInvalidateRange -Wl,--wrap,__udivdi3 -Wl,--wrap,__umoddi3
5858

5959
LDFLAGS = -r -e _prolog -u _prolog -u _epilog -u _unresolved -Wl,--gc-sections -nostdlib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map $(FUNCWRAPS)
6060

ttyd-tools/rel/include/commonfunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void removePartnerFromOverworld();
3737
void removeFollowerFromOverworld();
3838
uint32_t getCurrentYoshiColorId();
3939
void setNewYoshiColorId(uint32_t colorId);
40-
void spawnFollower(ttyd::party::PartyMembers followerId);
40+
void spawnPartnerOrFollower(ttyd::party::PartyMembers partyId);
4141
bool checkIfBadgeEquipped(int16_t badge);
4242
bool checkIfHaveItem(int16_t item);
4343
void recheckJumpAndHammerLevels();

ttyd-tools/rel/include/ttyd.eu.lst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@
905905
// 800BF954:partyEntryHello
906906
// 800BF9A4:partySetForceMove
907907
// 800BF9EC:partyStop
908-
// 800BFA10:partyRun
908+
800BFA10:partyRun
909909
// 800BFA40:partyCtrlOn
910910
// 800BFA78:partyCtrlOff
911911
// 800BFAB0:partyChgPaper

ttyd-tools/rel/include/ttyd.jp.lst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@
903903
// 800BC89C:partyEntryHello
904904
// 800BC8EC:partySetForceMove
905905
// 800BC934:partyStop
906-
// 800BC958:partyRun
906+
800BC958:partyRun
907907
// 800BC988:partyCtrlOn
908908
// 800BC9C0:partyCtrlOff
909909
// 800BC9F8:partyChgPaper

ttyd-tools/rel/include/ttyd.us.lst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@
903903
// 800BEC20:partyEntryHello
904904
// 800BEC70:partySetForceMove
905905
// 800BECB8:partyStop
906-
// 800BECDC:partyRun
906+
800BECDC:partyRun
907907
// 800BED0C:partyCtrlOn
908908
// 800BED44:partyCtrlOff
909909
// 800BED7C:partyChgPaper

ttyd-tools/rel/include/ttyd/party.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int32_t partyKill2(int32_t partyId);
8181
// partyEntryHello
8282
// partySetForceMove
8383
// partyStop
84-
// partyRun
84+
void partyRun(void *partyPtr);
8585
// partyCtrlOn
8686
// partyCtrlOff
8787
// partyChgPaper

ttyd-tools/rel/source/commonfunctions.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -241,21 +241,19 @@ void setNewYoshiColorId(uint32_t colorId)
241241
ttyd::mario_pouch::pouchSetPartyColor(YoshiPartnerId, colorId);
242242
}
243243

244-
void spawnFollower(ttyd::party::PartyMembers followerId)
244+
void spawnPartnerOrFollower(ttyd::party::PartyMembers partyId)
245245
{
246-
// If a follower is out, remove them
247-
removeFollowerFromOverworld();
246+
// Spawn the partner/follower
247+
int32_t PartySlotId = ttyd::mario_party::marioPartyEntry(partyId);
248248

249-
// Spawn the new follower
250-
int32_t ReturnCode = ttyd::party::partyEntry2Hello(followerId);
251-
252-
// Set specific bytes
253-
if (ReturnCode >= 0)
249+
// Make sure the partner/follower spawned properly
250+
if (PartySlotId < 0)
254251
{
255-
ttyd::mario::Player *player = ttyd::mario::marioGetPtr();
256-
player->wFollowerFlags[1] = static_cast<uint8_t>(ReturnCode);
257-
player->prevFollowerId[1] = followerId;
252+
return;
258253
}
254+
255+
// Make sure the partner/follower is moving
256+
ttyd::party::partyRun(ttyd::party::partyGetPtr(PartySlotId));
259257
}
260258

261259
bool checkIfBadgeEquipped(int16_t badge)

ttyd-tools/rel/source/global.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace mod {
55

6-
const char *VersionNumber = "v3.0.39";
6+
const char *VersionNumber = "v3.0.40";
77

88
const char *RootLines[] =
99
{

ttyd-tools/rel/source/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ void *fixEvtMapBlendSetFlagPartnerCrash(void *partnerPtr)
171171
if (PreviousPartnerOut != ttyd::party::PartyMembers::kNone)
172172
{
173173
// A partner was previously out, so bring them back out
174-
ttyd::mario_party::marioPartyHello(PreviousPartnerOut);
174+
spawnPartnerOrFollower(PreviousPartnerOut);
175175
}
176176
else
177177
{
178178
// No partner was previously out, so bring out Goombella
179-
ttyd::mario_party::marioPartyHello(ttyd::party::PartyMembers::kGoombella);
179+
spawnPartnerOrFollower(ttyd::party::PartyMembers::kGoombella);
180180
}
181181

182182
return getPartnerPointer();
@@ -199,12 +199,12 @@ void *fixEvtMapBlendSetFlagFollowerCrash(void *followerPtr)
199199
if (PreviousFollowerOut != ttyd::party::PartyMembers::kNone)
200200
{
201201
// A follower was previously out, so bring them back out
202-
spawnFollower(PreviousFollowerOut);
202+
spawnPartnerOrFollower(PreviousFollowerOut);
203203
}
204204
else
205205
{
206206
// No follower was previously out, so bring out Gus
207-
spawnFollower(ttyd::party::PartyMembers::kGus);
207+
spawnPartnerOrFollower(ttyd::party::PartyMembers::kGus);
208208
}
209209

210210
return getFollowerPointer();

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void partnerMenuRemoveOrBringOut(void *partnerEnabledAddress)
228228
PartnerEnabledAddress + 1) = true;
229229

230230
// Bring the partner out
231-
ttyd::mario_party::marioPartyEntry(getSelectedOptionPartnerValue());
231+
spawnPartnerOrFollower(getSelectedOptionPartnerValue());
232232

233233
// Restore the value of the enabled bool
234234
*reinterpret_cast<bool *>(
@@ -1797,10 +1797,10 @@ uint32_t followersOptionsButtonControls()
17971797
}
17981798

17991799
// Get the follower id to use
1800-
uint8_t NewFollower = MenuVar.SecondaryMenuOption + 8; // Start at the egg
1800+
uint32_t NewFollower = MenuVar.SecondaryMenuOption + 8; // Start at the egg
18011801

18021802
// Spawn the new follower
1803-
spawnFollower(static_cast<ttyd::party::PartyMembers>(NewFollower));
1803+
spawnPartnerOrFollower(static_cast<ttyd::party::PartyMembers>(NewFollower));
18041804

18051805
closeSecondaryMenu();
18061806

@@ -3638,14 +3638,14 @@ void *initStageEvents()
36383638
ttyd::party::PartyMembers PartnerId = TargetEvent->partyId[0];
36393639
if (PartnerId != ttyd::party::PartyMembers::kNone)
36403640
{
3641-
ttyd::mario_party::marioPartyEntry(PartnerId);
3641+
spawnPartnerOrFollower(PartnerId);
36423642
}
36433643

36443644
// Spawn the follower for the current event
36453645
ttyd::party::PartyMembers FollowerId = TargetEvent->partyId[1];
36463646
if (FollowerId != ttyd::party::PartyMembers::kNone)
36473647
{
3648-
ttyd::mario_party::marioPartyEntry(FollowerId);
3648+
spawnPartnerOrFollower(FollowerId);
36493649
}
36503650

36513651
// Perform a full recovery for Mario and the partners

0 commit comments

Comments
 (0)