-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from mateusfavarin/main
New reserve bar, fix checkpoints not resetting properly, fix engine revving
- Loading branch information
Showing
9 changed files
with
234 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +0,0 @@ | ||
#include <common.h> | ||
|
||
#ifdef USE_ONLINE | ||
void StatsUpgrade() | ||
{ | ||
/* | ||
Stat 9 is acceleration, | ||
Stats 11 and 12 speed related | ||
*/ | ||
for (int i = 9; i < 13; i++) | ||
{ | ||
for (int j = 0; j < 4; j++) | ||
{ | ||
data.metaPhys[i].value[j] = data.metaPhys[i].value[4]; // copy MAX | ||
} | ||
} | ||
} | ||
#endif | ||
|
||
#ifdef USE_BOOSTBAR | ||
void DrawBoostBar(short posX, short posY, struct Driver* driver) | ||
{ | ||
struct GameTracker * gGT = sdata->gGT; | ||
|
||
short fullHeight = 3; | ||
int fullWidth = WIDE_34(49); | ||
|
||
short meterLength = ((driver->reserves * 0xE)/0x960); | ||
if ((meterLength > fullWidth) || (driver->reserves < 0)) { meterLength = fullWidth; } | ||
|
||
RECT box; | ||
box.x = posX - fullWidth; | ||
box.y = posY - fullHeight; | ||
box.w = fullWidth; | ||
box.h = fullHeight; | ||
|
||
struct DB * backDB = gGT->backBuffer; | ||
|
||
DECOMP_CTR_Box_DrawWireBox( | ||
&box, MakeColor(0, 0, 0), | ||
gGT->pushBuffer_UI.ptrOT); | ||
|
||
int topY = posY - fullHeight; | ||
|
||
/* === BoostBar === | ||
red: 0-2s | ||
yellow: 2s-4s | ||
green: 4s-full | ||
blue: full-saffi | ||
purple: saffi */ | ||
|
||
PrimCode primCode = { .poly = { .quad = 1, .renderCode = RenderCode_Polygon } }; | ||
ColorCode colorCode = MakeColorCode(0xFF, 0, 0, primCode); // red | ||
|
||
if (driver->reserves < 0) { | ||
colorCode = MakeColorCode(0xFF, 0x0, 0xFF, primCode); // purple | ||
} | ||
else if (meterLength == fullWidth) { | ||
colorCode = MakeColorCode(0, 0, 0xFF, primCode); // blue | ||
} | ||
else if (driver->reserves >= SECONDS(4)) { | ||
colorCode = MakeColorCode(0, 0xFF, 0, primCode); // green | ||
} | ||
else if (driver->reserves >= SECONDS(2)) { | ||
colorCode = MakeColorCode(0xFF, 0xFF, 0, primCode); // yellow | ||
} | ||
|
||
for (int i = 0; i < 2; i++) | ||
{ | ||
PolyF4 * p; | ||
GetPrimMem(p); | ||
if (p == nullptr) { return; } | ||
|
||
p->colorCode = colorCode; | ||
p->v[0].pos.x = posX - meterLength; | ||
p->v[0].pos.y = topY; | ||
p->v[1].pos.x = posX; | ||
p->v[1].pos.y = topY; | ||
p->v[2].pos.x = posX - meterLength; | ||
p->v[2].pos.y = posY; | ||
p->v[3].pos.x = posX; | ||
p->v[3].pos.y = posY; | ||
AddPrimitive(p, gGT->pushBuffer_UI.ptrOT); | ||
|
||
// Gray color for Prim #2 | ||
colorCode = MakeColorCode(0x80, 0x80, 0x80, primCode); | ||
meterLength = fullWidth; | ||
} | ||
} | ||
#endif | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifdef USE_BOOSTBAR | ||
#ifdef USE_ONLINE | ||
|
||
Color HsvToRgb(int h, int s, int v) | ||
{ | ||
Color rgb; | ||
h = h & 0xFF; // modulo 256 | ||
int region, remainder, p, q, t; | ||
|
||
if (s == 0) | ||
{ | ||
rgb.r = v; | ||
rgb.g = v; | ||
rgb.b = v; | ||
return rgb; | ||
} | ||
|
||
region = h / 43; | ||
remainder = (h - (region * 43)) * 6; | ||
|
||
p = (v * (255 - s)) >> 8; | ||
q = (v * (255 - ((s * remainder) >> 8))) >> 8; | ||
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; | ||
|
||
switch (region) | ||
{ | ||
case 0: | ||
rgb.r = v; rgb.g = t; rgb.b = p; | ||
break; | ||
case 1: | ||
rgb.r = q; rgb.g = v; rgb.b = p; | ||
break; | ||
case 2: | ||
rgb.r = p; rgb.g = v; rgb.b = t; | ||
break; | ||
case 3: | ||
rgb.r = p; rgb.g = q; rgb.b = v; | ||
break; | ||
case 4: | ||
rgb.r = t; rgb.g = p; rgb.b = v; | ||
break; | ||
default: | ||
rgb.r = v; rgb.g = p; rgb.b = q; | ||
break; | ||
} | ||
|
||
return rgb; | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.