Skip to content

Commit dfd824c

Browse files
committed
Bug Fix + Minor Adjustments
Fixed the Speed Up Mario code setting incorrect speed values for Tube Mode and Peach. Made some minor adjustments to the codes that display guard/superguard timings. Increased the font size of the backtrace screen text in all versions.
1 parent ded5d42 commit dfd824c

File tree

6 files changed

+56
-31
lines changed

6 files changed

+56
-31
lines changed

ttyd-tools/rel/include/global.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ struct DisplayActionCommandTiming
452452
{
453453
int32_t (*Trampoline)(void *, void *);
454454
uint16_t DisplayTimer;
455-
int8_t TypeToDraw;
455+
uint8_t TypeToDraw;
456456
int8_t Last_A_Frame;
457457
int8_t Last_B_Frame;
458458
};
@@ -528,8 +528,8 @@ extern char *NextBero;
528528
extern char *NextMap;
529529
extern char *NextArea;
530530
extern ItemData *ItemDataTable;
531-
extern int8_t *GuardFrames;
532-
extern int8_t *SuperguardFrames;
531+
extern uint8_t *GuardFrames;
532+
extern uint8_t *SuperguardFrames;
533533
extern uint32_t PauseMenuStartAddress;
534534
extern uint32_t wp_fadedrv_Address;
535535
extern uint32_t _mapEntAddress;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ bool marioChkKey();
176176
// marioItemGetChk
177177
// marioItemGetDisable
178178
// marioEntry
179-
// marioSetSpec
179+
void marioSetSpec();
180180
// marioSetFamicomMode
181181
void marioSetCharMode(uint32_t mode);
182182
int8_t marioGetColor();

ttyd-tools/rel/source/codes.cpp

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,26 @@ void setTimeStopTextStorage()
280280

281281
void speedUpMario()
282282
{
283-
if (!Cheat[SPEED_UP_MARIO].Active)
283+
ttyd::mario::Player *player = ttyd::mario::marioGetPtr();
284+
const uint16_t TubeMode = 22;
285+
286+
if (!Cheat[SPEED_UP_MARIO].Active || ChangingCheatButtonCombo)
284287
{
288+
// Check to see if Mario is currently in Tube Mode or not
289+
if (player->currentMotionId == TubeMode)
290+
{
291+
// marioSetSpec does not set the values for Tube Mode
292+
player->unk_184 = 1;
293+
player->unk_188 = 3;
294+
}
295+
else
296+
{
297+
// Set the values to their default for the current character
298+
ttyd::mario::marioSetSpec();
299+
}
285300
return;
286301
}
287302

288-
ttyd::mario::Player *player = ttyd::mario::marioGetPtr();
289-
290303
if (checkButtonComboEveryFrame(Cheat[SPEED_UP_MARIO].ButtonCombo))
291304
{
292305
player->wPlayerBaseSpeed = 16;
@@ -295,8 +308,18 @@ void speedUpMario()
295308
}
296309
else
297310
{
298-
player->unk_184 = 1;
299-
player->unk_188 = 2.25;
311+
// Check to see if Mario is currently in Tube Mode or not
312+
if (player->currentMotionId == TubeMode)
313+
{
314+
// marioSetSpec does not set the values for Tube Mode
315+
player->unk_184 = 1;
316+
player->unk_188 = 3;
317+
}
318+
else
319+
{
320+
// Set the values to their default for the current character
321+
ttyd::mario::marioSetSpec();
322+
}
300323
}
301324
}
302325

@@ -895,9 +918,9 @@ void actionCommandsTimingsInit()
895918
}
896919

897920
// Reset the values checked when drawing the text
921+
DisplayActionCommands.TypeToDraw = 0;
898922
DisplayActionCommands.Last_A_Frame = -1;
899923
DisplayActionCommands.Last_B_Frame = -1;
900-
DisplayActionCommands.TypeToDraw = -1;
901924

902925
int32_t Last_A_Frame = -1;
903926
int32_t Last_B_Frame = -1;
@@ -921,9 +944,9 @@ void actionCommandsTimingsInit()
921944
const int32_t DefenseResult = DisplayActionCommands.Trampoline(
922945
battle_unit, attack_params);
923946

924-
const int32_t SuccessfulTiming = 0;
925-
const int32_t PressedTooManyButtons = 1;
926-
const int32_t PressedTooEarly = 2;
947+
const uint32_t SuccessfulTiming = 1;
948+
const uint32_t PressedTooManyButtons = 2;
949+
const uint32_t PressedTooEarly = 3;
927950

928951
if (DefenseResult == 4)
929952
{

ttyd-tools/rel/source/draw.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,21 +2611,21 @@ void drawActionCommandsTiming()
26112611
int32_t temp_Last_A_Frame = DisplayActionCommands.Last_A_Frame;
26122612
int32_t temp_Last_B_Frame = DisplayActionCommands.Last_B_Frame;
26132613

2614-
int32_t TypeToDraw = DisplayActionCommands.TypeToDraw;
2614+
uint32_t TypeToDraw = DisplayActionCommands.TypeToDraw;
26152615
const char *TextToDraw;
26162616
char *tempDisplayBuffer = DisplayBuffer;
26172617

2618-
const int32_t SuccessfulTiming = 0;
2619-
const int32_t PressedTooManyButtons = 1;
2620-
const int32_t PressedTooEarly = 2;
2618+
const uint32_t SuccessfulTiming = 1;
2619+
const uint32_t PressedTooManyButtons = 2;
2620+
const uint32_t PressedTooEarly = 3;
26212621

26222622
// Check to see which text should be displayed
26232623
switch (TypeToDraw)
26242624
{
26252625
case SuccessfulTiming:
26262626
{
2627-
int32_t CurrentDifficultyFrames;
2628-
int32_t FramePressed;
2627+
uint32_t CurrentDifficultyFrames;
2628+
uint32_t FramePressed;
26292629
char Button;
26302630

26312631
if (temp_Last_A_Frame > -1)
@@ -2657,8 +2657,8 @@ void drawActionCommandsTiming()
26572657
}
26582658
case PressedTooEarly:
26592659
{
2660-
int32_t CurrentDifficultyFrames;
2661-
int32_t FramesEarly;
2660+
uint32_t CurrentDifficultyFrames;
2661+
uint32_t FramesEarly;
26622662
char Button;
26632663

26642664
if (temp_Last_A_Frame > -1)
@@ -2742,7 +2742,7 @@ void drawTitleScreenInfo()
27422742
PosX += 113;
27432743
PosY -= 14;
27442744

2745-
const char *String = "Practice Codes v3.0.8\nCreated by Zephiles";
2745+
const char *String = "Practice Codes v3.0.9\nCreated by Zephiles";
27462746
drawText(String, PosX, PosY, Alpha, TextColor, Scale);
27472747
}
27482748

ttyd-tools/rel/source/global.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ char *NextBero = reinterpret_cast<char *>(r13 + 0x1688);
807807
char *NextMap = reinterpret_cast<char *>(r13 + 0x16A8);
808808
char *NextArea = reinterpret_cast<char *>(r13 + 0x16C8);
809809
ItemData *ItemDataTable = reinterpret_cast<ItemData *>(0x803108A8);
810-
int8_t *GuardFrames = reinterpret_cast<int8_t *>(0x802EE018);
811-
int8_t *SuperguardFrames = reinterpret_cast<int8_t *>(0x802EE020);
810+
uint8_t *GuardFrames = reinterpret_cast<uint8_t *>(0x802EE018);
811+
uint8_t *SuperguardFrames = reinterpret_cast<uint8_t *>(0x802EE020);
812812
uint32_t PauseMenuStartAddress = r13 + 0x1D10;
813813
uint32_t wp_fadedrv_Address = r13 + 0x1700;
814814
uint32_t _mapEntAddress = r13 + 0x1740;
@@ -823,8 +823,8 @@ char *NextBero = reinterpret_cast<char *>(r13 + 0x1128);
823823
char *NextMap = reinterpret_cast<char *>(r13 + 0x1148);
824824
char *NextArea = reinterpret_cast<char *>(r13 + 0x1168);
825825
ItemData *ItemDataTable = reinterpret_cast<ItemData *>(0x8030EE58);
826-
int8_t *GuardFrames = reinterpret_cast<int8_t *>(0x802EDA48);
827-
int8_t *SuperguardFrames = reinterpret_cast<int8_t *>(0x802EDA50);
826+
uint8_t *GuardFrames = reinterpret_cast<uint8_t *>(0x802EDA48);
827+
uint8_t *SuperguardFrames = reinterpret_cast<uint8_t *>(0x802EDA50);
828828
uint32_t PauseMenuStartAddress = r13 + 0x17B0;
829829
uint32_t wp_fadedrv_Address = r13 + 0x11A0;
830830
uint32_t _mapEntAddress = r13 + 0x11E0;
@@ -839,8 +839,8 @@ char *NextBero = reinterpret_cast<char *>(r13 + 0x1768);
839839
char *NextMap = reinterpret_cast<char *>(r13 + 0x1788);
840840
char *NextArea = reinterpret_cast<char *>(r13 + 0x17A8);
841841
ItemData *ItemDataTable = reinterpret_cast<ItemData *>(0x8031C638);
842-
int8_t *GuardFrames = reinterpret_cast<int8_t *>(0x802F9C78);
843-
int8_t *SuperguardFrames = reinterpret_cast<int8_t *>(0x802F9C80);
842+
uint8_t *GuardFrames = reinterpret_cast<uint8_t *>(0x802F9C78);
843+
uint8_t *SuperguardFrames = reinterpret_cast<uint8_t *>(0x802F9C80);
844844
uint32_t PauseMenuStartAddress = r13 + 0x1DF0;
845845
uint32_t wp_fadedrv_Address = r13 + 0x17E0;
846846
uint32_t _mapEntAddress = r13 + 0x1820;

ttyd-tools/rel/source/main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ void initAssemblyOverwrites()
487487
void *FixBlooperCrash2Address = reinterpret_cast<void *>(0x8010A79C);
488488
void *FixMarioKeyOnAddress = reinterpret_cast<void *>(0x8005B370);
489489
void *PreventTextboxSelectionAddress = reinterpret_cast<void *>(0x800CE01C);
490+
void *BacktraceScreenFontSizeAddress = reinterpret_cast<void *>(0x80422618);
490491
void *FixRoomProblemsAddress = reinterpret_cast<void *>(0x800086F0);
491492
#elif defined TTYD_EU
492493
void *PreventPreBattleSoftlockAddress = reinterpret_cast<void *>(0x800466B4);
@@ -562,9 +563,10 @@ void initAssemblyOverwrites()
562563

563564
*reinterpret_cast<uint32_t *>(msgWindowMrAddress) = 0x38830001; // addi r4,r3,1
564565

566+
*reinterpret_cast<float *>(BacktraceScreenFontSizeAddress) = 0.66;
567+
565568
#ifndef TTYD_JP
566-
// The backtrace screen does not need to be modified in JP
567-
*reinterpret_cast<float *>(BacktraceScreenFontSizeAddress) = 0.65;
569+
// This part of the backtrace screen does not need to be modified in JP
568570
*reinterpret_cast<uint32_t *>(BacktraceScreenPPCHaltBranchAddress) = 0x3B400000; // li r26,0
569571
*reinterpret_cast<uint32_t *>(BacktraceScreenEndBranchAddress) = 0x4BFFFDD4; // b -0x22C
570572
#endif
@@ -592,13 +594,13 @@ void Mod::run()
592594
loadMarioAndPartnerPositions();
593595
setTextStorage();
594596
setTimeStopTextStorage();
595-
speedUpMario();
596597
lockMarioHPToMax();
597598
levitate();
598599
}
599600

600601
// Run each cheat function that isn't button-based
601602
saveAnywhere(); // Needs to always run due to the script taking more than one frame
603+
speedUpMario(); // Needs to always run due to Mario's base speed constantly being set
602604
reloadRoom(); // Needs to always run due to the extra code that always does some failsafe checking
603605
bobberyEarly();
604606
checkIfAreaFlagsShouldBeCleared();

0 commit comments

Comments
 (0)