mirror of
https://github.com/CTR-tools/CTR-ModSDK.git
synced 2025-03-01 09:36:28 +00:00
Merge pull request #159 from mateusfavarin/main
Rewrite CTR_Box_DrawWireBox
This commit is contained in:
commit
15320d73b6
@ -57,12 +57,12 @@ int OXIDE_GarageGetNext(int curr, int dir)
|
||||
// go to next
|
||||
curr += dir;
|
||||
curr &= 0xf;
|
||||
|
||||
|
||||
// repeat search if new character is locked
|
||||
} while(
|
||||
// character has unlock condition
|
||||
(curr >= 8) &&
|
||||
|
||||
|
||||
(
|
||||
// locked
|
||||
(
|
||||
@ -71,7 +71,7 @@ int OXIDE_GarageGetNext(int curr, int dir)
|
||||
) == 0
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
return curr;
|
||||
}
|
||||
#endif
|
||||
@ -112,13 +112,13 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
struct MetaDataCHAR* MDC = &data.MetaDataCharacters[sdata->advCharSelectIndex_curr];
|
||||
int nameIndex = MDC->name_LNG_long;
|
||||
RECT r;
|
||||
|
||||
|
||||
#ifdef USE_OXIDE
|
||||
if(
|
||||
// if Crash selected
|
||||
(sdata->advCharSelectIndex_curr == 0) &&
|
||||
(gGarage.numFramesCurr_GarageMove == 0) &&
|
||||
|
||||
|
||||
// if at least one character unlocked
|
||||
((sdata->gameProgress.unlocks[0] & 0x1FE0) != 0)
|
||||
)
|
||||
@ -137,7 +137,7 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
gGarage.unusedFrameCount =
|
||||
OXIDE_GarageGetNext(
|
||||
gGarage.unusedFrameCount, 1);
|
||||
|
||||
|
||||
MDC = &data.MetaDataCharacters[gGarage.unusedFrameCount];
|
||||
nameIndex = MDC->name_LNG_long;
|
||||
|
||||
@ -170,29 +170,29 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
|
||||
// At this point, there must not be a transition
|
||||
// between drivers, so start drawing the UI
|
||||
|
||||
|
||||
#if 0
|
||||
// count frames in garage?
|
||||
gGarage.unusedFrameCount++;
|
||||
#endif
|
||||
|
||||
|
||||
// animate growth of all three stat bars
|
||||
for (iVar7 = 0; iVar7 < 3; iVar7++)
|
||||
{
|
||||
short* bar = &gGarage.barLen[iVar7];
|
||||
short stat = gGarage.barStat[MDC->engineID*3 + iVar7];
|
||||
|
||||
|
||||
#ifdef USE_16BY9
|
||||
stat = WIDE_34(stat);
|
||||
#endif
|
||||
|
||||
|
||||
// half bar length, half speed per frame, just add 1
|
||||
#if (defined(USE_60FPS) && defined(USE_16BY9))
|
||||
#define BAR_RATE 1
|
||||
#else
|
||||
#define BAR_RATE 3
|
||||
#endif
|
||||
|
||||
|
||||
if (*bar < stat) *bar = *bar + BAR_RATE;
|
||||
if (stat < *bar) *bar = stat;
|
||||
}
|
||||
@ -200,10 +200,10 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
if (
|
||||
// Tiny Tiger
|
||||
(nameIndex == 0x2e) ||
|
||||
|
||||
|
||||
(
|
||||
uVar19 = 0x17f,
|
||||
|
||||
|
||||
// Pura
|
||||
nameIndex == 0x33
|
||||
)
|
||||
@ -233,10 +233,10 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
// 0x248 - Beginner
|
||||
// EngineID == 3
|
||||
iVar7 = 0;
|
||||
|
||||
|
||||
// 0x24A - Advanced
|
||||
if (engineID == 2) iVar7 = 2;
|
||||
|
||||
|
||||
// 0x249 - Intermediate
|
||||
if (engineID < 2) iVar7 = 1;
|
||||
|
||||
@ -258,19 +258,19 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
short* puVar20 = &gGarage.barLen[0];
|
||||
|
||||
do
|
||||
{
|
||||
{
|
||||
r.x = uVar22;
|
||||
r.y = uVar21;
|
||||
r.w = *puVar20;
|
||||
r.h = 7;
|
||||
|
||||
|
||||
// outline color white
|
||||
//local_60 = *(int*)0x800b7780;
|
||||
local_60 = 0xFFFFFF;
|
||||
|
||||
DECOMP_CTR_Box_DrawWireBox(
|
||||
&r, &local_60,
|
||||
gGT->pushBuffer_UI.ptrOT, primMem);
|
||||
&r, MakeColor(255, 255, 255),
|
||||
gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
r.x = uVar22 + 1;
|
||||
r.y = local_30;
|
||||
@ -281,9 +281,9 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
local_60 = local_60 & 0xff000000;
|
||||
|
||||
DECOMP_CTR_Box_DrawWireBox(
|
||||
&r, &local_60,
|
||||
gGT->pushBuffer_UI.ptrOT, primMem);
|
||||
|
||||
&r, MakeColor(0, 0, 0),
|
||||
gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
iVar16 = 0;
|
||||
|
||||
// color data of bars (blue green yellow red)
|
||||
@ -315,7 +315,7 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
// quit if prim mem runs out
|
||||
if (p+2 >= primMem->end)
|
||||
return;
|
||||
|
||||
|
||||
primMem->curr = p + 1;
|
||||
|
||||
// color data
|
||||
@ -340,26 +340,26 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
*(int*)p = (*(int*)ot & 0xffffff) | 0x8000000;
|
||||
*(int*)ot = (int)p & 0xffffff;
|
||||
}
|
||||
|
||||
|
||||
// color index
|
||||
puVar13 = puVar13 + 1;
|
||||
|
||||
|
||||
// segment index
|
||||
iVar16 = iVar16 + 1;
|
||||
|
||||
|
||||
iVar7 = iVar7 + segmentLength;
|
||||
iVar14 = iVar14 + segmentLength;
|
||||
|
||||
|
||||
} while (iVar16 < 6);
|
||||
|
||||
|
||||
// 15 pixels lower Y axis
|
||||
uVar21 = uVar21 + 0xf;
|
||||
local_2c = local_2c + 0xf;
|
||||
local_30 = local_30 + 0xf;
|
||||
|
||||
|
||||
puVar20 = puVar20 + 1;
|
||||
iVar17 = iVar17 + 1;
|
||||
|
||||
|
||||
} while (iVar17 < 3);
|
||||
|
||||
// "Intermediate"
|
||||
@ -378,7 +378,7 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
// we remove the usage cause it's just 0,1,2,3,4,5,6,7,
|
||||
// this array is used in Oxide Fix (Garage_Init+0x80),
|
||||
// so we can adjust the mod to fit the new code
|
||||
|
||||
|
||||
// otherwise would be
|
||||
// lngStrings[metadata[800b85d8[charSelectIndex]].nameLNG]
|
||||
#endif
|
||||
@ -386,13 +386,13 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
char* name = sdata->lngStrings[nameIndex];
|
||||
|
||||
DECOMP_DecalFont_DrawLine(name, 0x100, 0xb4, 1, 0xffff8000);
|
||||
|
||||
|
||||
iVar7 = 0;
|
||||
if ((sdata->frameCounter & FPS_DOUBLE(4)) == 0)
|
||||
{
|
||||
iVar7 = 3;
|
||||
}
|
||||
|
||||
|
||||
iVar17 = DECOMP_DecalFont_GetLineWidth(name, 1) >> 1;
|
||||
|
||||
// Color data
|
||||
@ -410,9 +410,9 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
primMem,
|
||||
gGT->pushBuffer_UI.ptrOT,
|
||||
|
||||
ptrColor[0], ptrColor[1],
|
||||
ptrColor[0], ptrColor[1],
|
||||
ptrColor[2], ptrColor[3],
|
||||
|
||||
|
||||
0, 0x1000, 0x800);
|
||||
|
||||
// Draw arrow pointing Right
|
||||
@ -424,9 +424,9 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
primMem,
|
||||
gGT->pushBuffer_UI.ptrOT,
|
||||
|
||||
ptrColor[0], ptrColor[1],
|
||||
ptrColor[0], ptrColor[1],
|
||||
ptrColor[2], ptrColor[3],
|
||||
|
||||
|
||||
0, 0x1000, 0);
|
||||
|
||||
sVar4 = gGarage.numFramesCurr_GarageMove;
|
||||
@ -492,7 +492,7 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
|
||||
// if false
|
||||
if (gGarage.boolSelected == 0)
|
||||
{
|
||||
{
|
||||
// make it true
|
||||
gGarage.boolSelected = 1;
|
||||
}
|
||||
@ -523,7 +523,7 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if using D-pad
|
||||
else
|
||||
{
|
||||
@ -569,15 +569,15 @@ void DECOMP_CS_Garage_MenuProc(void)
|
||||
Garage_MoveLR(uVar21);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// reset frame counter to max number of frames
|
||||
gGarage.numFramesCurr_GarageMove = gGarage.numFramesMax_GarageMove;
|
||||
|
||||
|
||||
if (gGarage.numFramesCurr_ZoomIn < gGarage.numFramesMax_Zoom)
|
||||
{
|
||||
gGarage.numFramesCurr_ZoomOut = gGarage.numFramesMax_Zoom - gGarage.numFramesCurr_ZoomIn;
|
||||
}
|
||||
|
||||
|
||||
gGarage.boolSelected = 0;
|
||||
gGT->gameMode2 &= ~GARAGE_OSK;
|
||||
}
|
||||
@ -595,7 +595,7 @@ LAB_800b821c:
|
||||
#ifdef USE_60FPS
|
||||
if(gGT->timer & 1)
|
||||
#endif
|
||||
|
||||
|
||||
// decrease zoom frame timer
|
||||
gGarage.numFramesCurr_ZoomIn--;
|
||||
}
|
||||
@ -611,10 +611,10 @@ LAB_800b821c:
|
||||
{
|
||||
// set desiredMenu to OSK (on-screen keyboard)
|
||||
sdata->ptrDesiredMenu = &data.menuSubmitName;
|
||||
|
||||
|
||||
data.characterIDs[0] = sdata->advCharSelectIndex_curr;
|
||||
sdata->advProgress.characterID = data.characterIDs[0];
|
||||
|
||||
|
||||
#ifdef USE_OXIDE
|
||||
if(data.characterIDs[0] == 0)
|
||||
{
|
||||
@ -626,7 +626,7 @@ LAB_800b821c:
|
||||
DECOMP_SubmitName_RestoreName(0);
|
||||
DECOMP_OtherFX_Play(1, 1);
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef USE_60FPS
|
||||
@ -635,7 +635,7 @@ LAB_800b821c:
|
||||
gGarage.delayOneSecond++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef REBUILD_PC
|
||||
if(sdata->ptrDesiredMenu == &data.menuSubmitName)
|
||||
{
|
||||
@ -653,7 +653,7 @@ LAB_800b821c:
|
||||
{
|
||||
gGarage.numFramesCurr_ZoomIn = gGarage.numFramesMax_Zoom;
|
||||
}
|
||||
|
||||
|
||||
if (gGarage.numFramesCurr_ZoomOut != 0)
|
||||
{
|
||||
#ifdef USE_60FPS
|
||||
@ -661,7 +661,7 @@ LAB_800b821c:
|
||||
#endif
|
||||
gGarage.numFramesCurr_ZoomOut--;
|
||||
}
|
||||
|
||||
|
||||
// Pura->Crash
|
||||
if ((sdata->advCharSelectIndex_curr == 0) && (sdata->advCharSelectIndex_prev == 7))
|
||||
sVar4 = 0xf0 - gGarage.numFramesCurr_GarageMove;
|
||||
@ -686,9 +686,9 @@ LAB_800b821c:
|
||||
short pos[3];
|
||||
short rot[3];
|
||||
DECOMP_CAM_Path_Move((int)sVar4, &pos[0], &rot[0], &getPath);
|
||||
|
||||
|
||||
#ifdef USE_60FPS
|
||||
|
||||
|
||||
// if transitioning
|
||||
if(gGarage.numFramesCurr_GarageMove != 0)
|
||||
{
|
||||
@ -698,30 +698,30 @@ LAB_800b821c:
|
||||
// Pura->Crash
|
||||
if ((sdata->advCharSelectIndex_curr == 0) && (sdata->advCharSelectIndex_prev == 7))
|
||||
sVar4 = 0xf0 - (gGarage.numFramesCurr_GarageMove-1);
|
||||
|
||||
|
||||
// Crash->Pura
|
||||
else if ((sdata->advCharSelectIndex_curr == 7) && (sdata->advCharSelectIndex_prev == 0))
|
||||
sVar4 = (gGarage.numFramesCurr_GarageMove-1) + 0xd2;
|
||||
|
||||
|
||||
// Move Right
|
||||
else if (sdata->advCharSelectIndex_prev < sdata->advCharSelectIndex_curr)
|
||||
sVar4 = sdata->advCharSelectIndex_curr * 0x1e - (gGarage.numFramesCurr_GarageMove-1);
|
||||
|
||||
|
||||
// Move Left
|
||||
else
|
||||
sVar4 = sdata->advCharSelectIndex_curr * 0x1e + (gGarage.numFramesCurr_GarageMove-1);
|
||||
|
||||
|
||||
short pos2[3];
|
||||
short rot2[3];
|
||||
DECOMP_CAM_Path_Move((int)sVar4, &pos2[0], &rot2[0], &getPath);
|
||||
|
||||
|
||||
pos[0] = (pos[0] + pos2[0]) / 2;
|
||||
pos[1] = (pos[1] + pos2[1]) / 2;
|
||||
pos[2] = (pos[2] + pos2[2]) / 2;
|
||||
|
||||
|
||||
int diff = rot[1] - rot2[1];
|
||||
if(diff < 0) diff = -diff;
|
||||
|
||||
|
||||
// on the one frame that jumps from
|
||||
// 359 degrees -> 1 degree, just ignore
|
||||
// interpolation. Nobody will notice a one-frame
|
||||
@ -735,14 +735,14 @@ LAB_800b821c:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// set position and rotation to pushBuffer
|
||||
gGT->pushBuffer[0].pos[0] = pos[0];
|
||||
gGT->pushBuffer[0].pos[1] = pos[1];
|
||||
gGT->pushBuffer[0].pos[2] = pos[2];
|
||||
|
||||
|
||||
gGT->pushBuffer[0].rot[0] = rot[0];
|
||||
gGT->pushBuffer[0].rot[1] = rot[1];
|
||||
gGT->pushBuffer[0].rot[2] = rot[2];
|
||||
@ -757,9 +757,9 @@ LAB_800b821c:
|
||||
{
|
||||
iVar7 = iVar7 * (gGarage.fovMax - gGarage.fovMin);
|
||||
}
|
||||
|
||||
|
||||
iVar7 = gGarage.fovMin + iVar7 / gGarage.numFramesMax_Zoom;
|
||||
|
||||
|
||||
gGT->pushBuffer[0].distanceToScreen_CURR = iVar7;
|
||||
gGT->pushBuffer[0].distanceToScreen_PREV = iVar7;
|
||||
}
|
||||
|
@ -37,12 +37,10 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver)
|
||||
box.h = fullHeight;
|
||||
|
||||
struct DB * backDB = gGT->backBuffer;
|
||||
int boxColor = 0;
|
||||
|
||||
DECOMP_CTR_Box_DrawWireBox(
|
||||
&box, &boxColor,
|
||||
gGT->pushBuffer_UI.ptrOT,
|
||||
&backDB->primMem);
|
||||
&box, MakeColor(0, 0, 0),
|
||||
gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
int topY = posY - fullHeight;
|
||||
|
||||
@ -53,20 +51,20 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver)
|
||||
blue: full-saffi
|
||||
purple: saffi */
|
||||
|
||||
PolyCode renderCode = {.quad = 1, .renderCode = RenderCode_Polygon};
|
||||
ColorCode colorCode = MakeColorCode(0xFF, 0, 0, renderCode); // red
|
||||
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, renderCode); // purple
|
||||
colorCode = MakeColorCode(0xFF, 0x0, 0xFF, primCode); // purple
|
||||
}
|
||||
else if (meterLength == fullWidth) {
|
||||
colorCode = MakeColorCode(0, 0, 0xFF, renderCode); // blue
|
||||
colorCode = MakeColorCode(0, 0, 0xFF, primCode); // blue
|
||||
}
|
||||
else if (driver->reserves >= SECONDS(4)) {
|
||||
colorCode = MakeColorCode(0, 0xFF, 0, renderCode); // green
|
||||
colorCode = MakeColorCode(0, 0xFF, 0, primCode); // green
|
||||
}
|
||||
else if (driver->reserves >= SECONDS(2)) {
|
||||
colorCode = MakeColorCode(0xFF, 0xFF, 0, renderCode); // yellow
|
||||
colorCode = MakeColorCode(0xFF, 0xFF, 0, primCode); // yellow
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
@ -87,7 +85,7 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver)
|
||||
AddPrimitive(p, gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
// Gray color for Prim #2
|
||||
colorCode = MakeColorCode(0x80, 0x80, 0x80, renderCode);
|
||||
colorCode = MakeColorCode(0x80, 0x80, 0x80, primCode);
|
||||
meterLength = fullWidth;
|
||||
}
|
||||
}
|
||||
|
@ -1,42 +1,35 @@
|
||||
#include <common.h>
|
||||
|
||||
void DECOMP_CTR_Box_DrawWireBox(RECT *r, u_char *rgb, void *ot, struct PrimMem *primMem)
|
||||
void DECOMP_CTR_Box_DrawWireBox(RECT * r, Color color, void * ot)
|
||||
{
|
||||
LINE_F3 *p;
|
||||
LineF3 * p;
|
||||
GetPrimMem(p);
|
||||
if (p == nullptr) { return; }
|
||||
|
||||
p = primMem->curr;
|
||||
if (p > primMem->endMin100)
|
||||
return;
|
||||
primMem->curr = p + 1;
|
||||
const PrimCode primCode = { .line = { .renderCode = RenderCode_Line, .polyline = 1 } };
|
||||
color.code = primCode;
|
||||
|
||||
// set Poly_LineF3 len, code, and padding
|
||||
setLineF3(p);
|
||||
|
||||
// RGB
|
||||
setRGB0(p, rgb[0], rgb[1], rgb[2]);
|
||||
|
||||
setXY3(p,
|
||||
r->x, r->y, // XY0
|
||||
(r->x + r->w), r->y, // XY1
|
||||
(r->x + r->w), (r->y + r->h)); // XY2
|
||||
|
||||
AddPrim(ot, p);
|
||||
p->colorCode = color;
|
||||
p->v[0].pos.x = r->x;
|
||||
p->v[0].pos.y = r->y;
|
||||
p->v[1].pos.x = r->x + r->w;
|
||||
p->v[1].pos.y = r->y;
|
||||
p->v[2].pos.x = r->x + r->w;
|
||||
p->v[2].pos.y = r->y + r->h;
|
||||
p->end = 0x55555555;
|
||||
|
||||
p = primMem->curr;
|
||||
if (p > primMem->endMin100)
|
||||
return;
|
||||
primMem->curr = p + 1;
|
||||
AddPrimitive(p, ot);
|
||||
GetPrimMem(p);
|
||||
if (p == nullptr) { return; }
|
||||
|
||||
// set Poly_LineF3 len, code, and padding
|
||||
setLineF3(p);
|
||||
|
||||
// RGB
|
||||
setRGB0(p, rgb[0], rgb[1], rgb[2]);
|
||||
|
||||
setXY3(p,
|
||||
r->x, r->y, // XY0
|
||||
r->x, (r->y + r->h), // XY1
|
||||
(r->x + r->w), (r->y + r->h)); // XY2
|
||||
|
||||
AddPrim(ot, p);
|
||||
p->colorCode = color;
|
||||
p->v[0].pos.x = r->x;
|
||||
p->v[0].pos.y = r->y;
|
||||
p->v[1].pos.x = r->x;
|
||||
p->v[1].pos.y = r->y + r->h;
|
||||
p->v[2].pos.x = r->x + r->w;
|
||||
p->v[2].pos.y = r->y + r->h;
|
||||
p->end = 0x55555555;
|
||||
|
||||
AddPrimitive(p, ot);
|
||||
}
|
@ -8,8 +8,8 @@ void DECOMP_CTR_Box_DrawWirePrims(Point p1, Point p2, Color color, void *ot)
|
||||
GetPrimMem(p);
|
||||
if (p == nullptr) { return; }
|
||||
|
||||
const PolyCode polyCode = { .renderCode = RenderCode_Line };
|
||||
color.code = polyCode;
|
||||
const PrimCode primCode = { .line = { .renderCode = RenderCode_Line } };
|
||||
color.code = primCode;
|
||||
p->colorCode = color;
|
||||
p->v[0].pos = p1;
|
||||
p->v[1].pos = p2;
|
||||
|
@ -14,20 +14,19 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
|
||||
}
|
||||
|
||||
RECT box;
|
||||
int boxColor = 0;
|
||||
short topX = posX - barWidth;
|
||||
short topY = posY - barHeight;
|
||||
box.x = topX;
|
||||
box.y = topY;
|
||||
box.w = barWidth;
|
||||
box.h = barHeight;
|
||||
DECOMP_CTR_Box_DrawWireBox(&box, &boxColor, gGT->pushBuffer_UI.ptrOT, &gGT->backBuffer->primMem);
|
||||
DECOMP_CTR_Box_DrawWireBox(&box, MakeColor(0, 0, 0), gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
const PolyCode renderCode = {.quad = 1, .renderCode = RenderCode_Polygon};
|
||||
ColorCode colorCode = MakeColorCode(0xFF, 0, 0, renderCode); // red color, ready to boost
|
||||
const PrimCode primCode = { .poly = { .quad = 1, .renderCode = RenderCode_Polygon } };
|
||||
ColorCode colorCode = MakeColorCode(0xFF, 0, 0, primCode); // red color, ready to boost
|
||||
|
||||
if (driver->const_turboLowRoomWarning * ELAPSED_MS < driver->turbo_MeterRoomLeft) {
|
||||
colorCode = MakeColorCode(0, 0xFF, 0, renderCode); // green color, no boost yet
|
||||
colorCode = MakeColorCode(0, 0xFF, 0, primCode); // green color, no boost yet
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
@ -49,7 +48,7 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
|
||||
p->v[3].pos.x = posX;
|
||||
|
||||
AddPrimitive(p, gGT->pushBuffer_UI.ptrOT);
|
||||
colorCode = MakeColorCode(0x80, 0x80, 0x80, renderCode); // Gray color for background bar
|
||||
colorCode = MakeColorCode(0x80, 0x80, 0x80, primCode); // Gray color for background bar
|
||||
meterLength = barWidth;
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,9 @@ void DECOMP_UI_DrawSpeedNeedle(short posX, short posY, struct Driver * driver)
|
||||
GetPrimMem(p);
|
||||
if (p == nullptr) { return; }
|
||||
|
||||
const PolyCode renderCode = {.gouraud = 1, .renderCode = RenderCode_Polygon};
|
||||
const PrimCode primCode = { .poly = { .gouraud = 1, .renderCode = RenderCode_Polygon } };
|
||||
|
||||
p->v[0].color = MakeColorCode(91, 91, 0,renderCode);
|
||||
p->v[0].color = MakeColorCode(91, 91, 0, primCode);
|
||||
p->v[1].color = MakeColor(50, 43, 1);
|
||||
p->v[2].color = MakeColor(255, 187, 0);
|
||||
|
||||
@ -78,7 +78,7 @@ void DECOMP_UI_DrawSpeedNeedle(short posX, short posY, struct Driver * driver)
|
||||
GetPrimMem(p);
|
||||
if (p == nullptr) { return; }
|
||||
|
||||
p->v[0].color = MakeColorCode(255, 255, 255, renderCode);
|
||||
p->v[0].color = MakeColorCode(255, 255, 255, primCode);
|
||||
p->v[1].color = MakeColor(156, 105, 0);
|
||||
p->v[2].color = MakeColor(255, 255, 0);
|
||||
|
||||
|
@ -46,7 +46,9 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
|
||||
box.x = sVar9;
|
||||
box.y = posY + numbersYOffset;
|
||||
|
||||
DECOMP_CTR_Box_DrawWireBox(&box, &data.colors[21], gGT->pushBuffer_UI.ptrOT, &gGT->backBuffer->primMem);
|
||||
Color color;
|
||||
color.self = data.colors[21][0];
|
||||
DECOMP_CTR_Box_DrawWireBox(&box, color, gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
backDB = gGT->backBuffer;
|
||||
primmemCurr = backDB->primMem.curr;
|
||||
@ -108,7 +110,7 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
|
||||
box2.h = barHeight;
|
||||
box2.x = posX;
|
||||
|
||||
DECOMP_CTR_Box_DrawWireBox(&box2, &data.colors[21], gGT->pushBuffer_UI.ptrOT, &gGT->backBuffer->primMem);
|
||||
DECOMP_CTR_Box_DrawWireBox(&box2, color, gGT->pushBuffer_UI.ptrOT);
|
||||
|
||||
backDB = gGT->backBuffer;
|
||||
primmemCurr = backDB->primMem.curr;
|
||||
|
@ -31,7 +31,7 @@ void DECOMP_CTR_CycleTex_LEV(struct AnimTex* animtex, int timer);
|
||||
void DECOMP_CTR_ErrorScreen(char r, char g, char b);
|
||||
void DECOMP_CTR_CycleTex_Model(struct AnimTex* animtex, int timer);
|
||||
|
||||
void DECOMP_CTR_Box_DrawWireBox(RECT *r, u_char *rgb, void *ot, struct PrimMem *primMem);
|
||||
void DECOMP_CTR_Box_DrawWireBox(RECT * r, Color color, void * ot);
|
||||
void DECOMP_CTR_Box_DrawClearBox(RECT* r, u_int* colorPtr, int transparency, u_long* ot, struct PrimMem* primMem);
|
||||
void DECOMP_CTR_Box_DrawSolidBox(RECT* r, u_int* colorPtr, u_long* otMem, struct PrimMem* primMem);
|
||||
|
||||
|
@ -49,19 +49,39 @@ enum RenderCode
|
||||
RenderCode_Rectangle = 3,
|
||||
};
|
||||
|
||||
typedef union PolyCode
|
||||
typedef union PrimCode
|
||||
{
|
||||
struct
|
||||
union
|
||||
{
|
||||
u8 rawTex : 1; /* raw texture / modulation */
|
||||
u8 semiTransparency : 1; /* semi-transparent / opaque */
|
||||
u8 textured : 1; /* textured / untextured */
|
||||
u8 quad : 1; /* 4 / 3 vertices */
|
||||
u8 gouraud : 1; /* gouraud / flat shading */
|
||||
u8 renderCode : 3; /* 0b001 = Polygon */
|
||||
struct
|
||||
{
|
||||
u8 rawTex : 1; /* raw texture / modulation */
|
||||
u8 semiTransparency : 1; /* semi-transparent / opaque */
|
||||
u8 textured : 1; /* textured / untextured */
|
||||
u8 quad : 1; /* 4 / 3 vertices */
|
||||
u8 gouraud : 1; /* gouraud / flat shading */
|
||||
u8 renderCode : 3; /* enum RenderCode */
|
||||
} poly;
|
||||
struct
|
||||
{
|
||||
u8 unused : 1; /* raw texture / modulation */
|
||||
u8 semiTransparency : 1; /* semi-transparent / opaque */
|
||||
u8 unused2 : 1; /* textured / untextured */
|
||||
u8 polyline : 1; /* polyline / single line */
|
||||
u8 gouraud : 1; /* gouraud / flat shading */
|
||||
u8 renderCode : 3; /* enum RenderCode */
|
||||
} line;
|
||||
struct
|
||||
{
|
||||
u8 rawTex : 1; /* raw texture / modulation */
|
||||
u8 semiTransparency : 1; /* semi-transparent / opaque */
|
||||
u8 textured : 1; /* textured / untextured */
|
||||
u8 rectSize : 2; /* rect size */
|
||||
u8 renderCode : 3; /* enum RenderCode */
|
||||
} rect;
|
||||
};
|
||||
u8 code;
|
||||
} PolyCode;
|
||||
} PrimCode;
|
||||
|
||||
typedef union ColorCode
|
||||
{
|
||||
@ -70,7 +90,7 @@ typedef union ColorCode
|
||||
u8 r;
|
||||
u8 g;
|
||||
u8 b;
|
||||
PolyCode code;
|
||||
PrimCode code;
|
||||
};
|
||||
u32 self;
|
||||
} ColorCode;
|
||||
@ -202,6 +222,14 @@ typedef struct LineF2
|
||||
FVertex v[VertexCount_Line];
|
||||
} LineF2;
|
||||
|
||||
typedef struct LineF3
|
||||
{
|
||||
Tag tag;
|
||||
ColorCode colorCode;
|
||||
FVertex v[VertexCount_Tri];
|
||||
u32 end;
|
||||
} LineF3;
|
||||
|
||||
typedef struct PolyF3
|
||||
{
|
||||
Tag tag;
|
||||
|
Loading…
x
Reference in New Issue
Block a user