Skip to content

Commit

Permalink
optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Oct 15, 2024
1 parent 175e073 commit 91cc423
Showing 1 changed file with 12 additions and 52 deletions.
64 changes: 12 additions & 52 deletions decompile/General/UI/UI_RenderFrame_Racing.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,62 +438,22 @@ void DECOMP_UI_RenderFrame_Racing()
wumpaModel_Pos[0] = hudStructPtr[0xD].x + 0x20;
wumpaModel_Pos[1] = hudStructPtr[0xD].y;

// if you do not have life limit (battle)
if ((gameMode1 & LIFE_LIMIT) == 0)
{
// This is only with point limit,
// points can add or subtract

// Get what should be added to your score
partTimeVariable1 = playerStruct->BattleHUD.scoreDelta;

// Can't add 0, so it's +1 or -1

// if you are losing points
if (partTimeVariable1 < 0)
{
// print a minus sign with your change in score

// -%d
fmt = &sdata->s_subtractInt[0];

// Make a negative number positive
partTimeVariable1 = -partTimeVariable1;

}

else
{
// print a plus sign with your change in score

// +%ld
fmt = &sdata->s_additionLongInt[0];
}
}

// if you do have life limit (battle)
else
{
// Life can only go down, not up

// Get your change in score
partTimeVariable1 = playerStruct->BattleHUD.scoreDelta;

// Print a minus sign in front of the number of lives you lose

// -%ld
fmt = &sdata->s_subtractLongInt[0];
}
partTimeVariable1 = playerStruct->BattleHUD.scoreDelta;

// make the string that flies from the center of your screen to the corner
sprintf((char *)&LetterCTR_Pos[0], fmt, partTimeVariable1);
string[0] = '+';
if(partTimeVariable1 < 0)
string[0] = '-';

string[1] = '0' + partTimeVariable1;
string[2] = 0;

DECOMP_UI_Lerp2D_HUD
(
&wumpaModel_Pos[0], (int)playerStruct->BattleHUD.startX,
&wumpaModel_Pos[0],
(int)playerStruct->BattleHUD.startX,
(int)playerStruct->BattleHUD.startY,
(int)(((u_int)hudStructPtr[0xD].x + 0x20) * 0x10000) >> 0x10,
(int)(((u_int)hudStructPtr[0xD].y + 8) * 0x10000) >> 0x10,
(int)(hudStructPtr[0xD].x + 0x20),
(int)(hudStructPtr[0xD].y + 8),
playerStruct->BattleHUD.cooldown,
FPS_DOUBLE(5)
);
Expand All @@ -502,7 +462,7 @@ void DECOMP_UI_RenderFrame_Racing()
playerStruct->BattleHUD.cooldown--;

// print the string that shows the change in your score
DECOMP_DecalFont_DrawLine((char *)&LetterCTR_Pos[0], (int)wumpaModel_Pos[0], (int)wumpaModel_Pos[1], FONT_SMALL, RED);
DECOMP_DecalFont_DrawLine((char *)&string[0], (int)wumpaModel_Pos[0], (int)wumpaModel_Pos[1], FONT_SMALL, RED);
}
}

Expand Down

0 comments on commit 91cc423

Please sign in to comment.