diff --git a/decompile/General/AltMods/Mods1.c b/decompile/General/AltMods/Mods1.c index 12e35d5ee..f84d5fe78 100644 --- a/decompile/General/AltMods/Mods1.c +++ b/decompile/General/AltMods/Mods1.c @@ -5,8 +5,9 @@ #include "OnlineCTR/menu.c" #include "OnlineCTR/states.c" #include "OnlineCTR/thread.c" -#include "OnlineCTR/zMirrorMode.c" -#include "OnlineCTR/speedometerData.c" +#include "OnlineCTR/debugcam.c" +#include "OnlineCTR/lapData.c" +#include "OnlineCTR/names3d.c" #endif #endif diff --git a/decompile/General/AltMods/Mods2.c b/decompile/General/AltMods/Mods2.c index bafd78e24..5803c5270 100644 --- a/decompile/General/AltMods/Mods2.c +++ b/decompile/General/AltMods/Mods2.c @@ -1,10 +1,5 @@ // used for 16x9 (part 1) // used for oxide -#ifdef USE_ONLINE -#include "OnlineCTR/debugcam.c" -#include "OnlineCTR/lapData.c" -#endif - #ifdef USE_16BY9 void ui16by9_ViewProj(struct PushBuffer* pb) { diff --git a/decompile/General/AltMods/Mods4.c b/decompile/General/AltMods/Mods4.c index dca69c764..7e9293ad1 100644 --- a/decompile/General/AltMods/Mods4.c +++ b/decompile/General/AltMods/Mods4.c @@ -1,9 +1,7 @@ #include #ifdef USE_ONLINE -#include "OnlineCTR/names3d.c" - -void statsUpgrade() +void StatsUpgrade() { /* Stat 9 is acceleration, @@ -25,7 +23,7 @@ void DrawBoostBar(short posX, short posY, struct Driver* driver) struct GameTracker * gGT = sdata->gGT; short fullHeight = 3; - int fullWidth = WIDE_PICK(0x31, 0x25); + int fullWidth = WIDE_34(49); short meterLength = ((driver->reserves * 0xE)/0x960); if ((meterLength > fullWidth) || (driver->reserves < 0)) { meterLength = fullWidth; } diff --git a/decompile/General/AltMods/ModsMain.c b/decompile/General/AltMods/ModsMain.c index 939574f79..cb3b29201 100644 --- a/decompile/General/AltMods/ModsMain.c +++ b/decompile/General/AltMods/ModsMain.c @@ -33,7 +33,7 @@ void ModsMain() #ifdef USE_ONLINE void octr_entryHook(); octr_entryHook(); - void statsUpgrade(); statsUpgrade(); + void StatsUpgrade(); StatsUpgrade(); #endif // PC port has unlimited byte budget diff --git a/decompile/General/AltMods/OnlineCTR/speedometerData.c b/decompile/General/AltMods/OnlineCTR/speedometerData.c deleted file mode 100644 index 4846177f5..000000000 --- a/decompile/General/AltMods/OnlineCTR/speedometerData.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -#define SPEEDO_GREEN MakeColor(0, 0xb5, 0) -#define SPEEDO_YELLOW MakeColor(0xdb, 0xb5, 0) -#define SPEEDO_RED MakeColor(0xdb, 0, 0) -#define SPEEDO_PINK MakeColor(0xd8, 0, 0xcb) -#define SPEEDO_PURPLE MakeColor(0xa4, 0x21, 0xff) -#define SPEEDO_BLUE MakeColor(0x18, 0x18, 0xf3) -const Color DrawSpeedBG_Colors[11] = -{ - SPEEDO_GREEN, SPEEDO_GREEN, - SPEEDO_GREEN, SPEEDO_YELLOW, - SPEEDO_RED, SPEEDO_RED, - SPEEDO_RED, SPEEDO_PINK, - SPEEDO_PURPLE, SPEEDO_PURPLE, - SPEEDO_BLUE, -}; - -const Point speedometerData[2][22] = -{ - { - { .x = WIDE_34(-65), .y = 16 }, { .x = WIDE_34(-54), .y = 13 }, - { .x = WIDE_34(-70), .y = 0 }, { .x = WIDE_34(-58), .y = 0 }, - { .x = WIDE_34(-65), .y = -16 }, { .x = WIDE_34(-54), .y = -13 }, - { .x = WIDE_34(-50), .y = -29 }, { .x = WIDE_34(-42), .y = -24 }, - { .x = WIDE_34(-25), .y = -39 }, { .x = WIDE_34(-21), .y = -32 }, - { .x = WIDE_34(0), .y = -42 }, { .x = WIDE_34(0), .y = -35 }, - { .x = WIDE_34(25), .y = -39 }, { .x = WIDE_34(21), .y = -32 }, - { .x = WIDE_34(50), .y = -29 }, { .x = WIDE_34(42), .y = -24 }, - { .x = WIDE_34(65), .y = -16 }, { .x = WIDE_34(54), .y = -13 }, - { .x = WIDE_34(70), .y = 0 }, { .x = WIDE_34(58), .y = 0 }, - { .x = WIDE_34(65), .y = 16 }, { .x = WIDE_34(54), .y = 13 }, - }, - { - { .x = WIDE_34(-65), .y = 16 }, { .x = WIDE_34(-48), .y = 11 }, - { .x = WIDE_34(-70), .y = 0 }, { .x = WIDE_34(-51), .y = 0 }, - { .x = WIDE_34(-65), .y = -16 }, { .x = WIDE_34(-48), .y = -11 }, - { .x = WIDE_34(-50), .y = -29 }, { .x = WIDE_34(-37), .y = -21 }, - { .x = WIDE_34(-25), .y = -39 }, { .x = WIDE_34(-18), .y = -29 }, - { .x = WIDE_34(0), .y = -42 }, { .x = WIDE_34(0), .y = -31 }, - { .x = WIDE_34(25), .y = -39 }, { .x = WIDE_34(18), .y = -29 }, - { .x = WIDE_34(50), .y = -29 }, { .x = WIDE_34(37), .y = -21 }, - { .x = WIDE_34(65), .y = -16 }, { .x = WIDE_34(48), .y = -11 }, - { .x = WIDE_34(70), .y = 0 }, { .x = WIDE_34(51), .y = 0 }, - { .x = WIDE_34(65), .y = 16 }, { .x = WIDE_34(48), .y = 11 }, - }, - }; \ No newline at end of file diff --git a/decompile/General/DebugFont/DebugFont_DrawNumbers.c b/decompile/General/DebugFont/DebugFont_DrawNumbers.c index 99df8c128..dd73810c4 100644 --- a/decompile/General/DebugFont/DebugFont_DrawNumbers.c +++ b/decompile/General/DebugFont/DebugFont_DrawNumbers.c @@ -2,7 +2,48 @@ void DECOMP_DebugFont_DrawNumbers(int index, int screenPosX, int screenPosY) { - unsigned short uVar1; + PolyFT4 * p; + GetPrimMem(p); + if (p == nullptr) { return; } + + const int fontWidth = WIDE_34(7); + const int fontHeight = 7; + + const PrimCode primCode = { .poly = { .renderCode = RenderCode_Polygon, .quad = 1, .textured = 1, .semiTransparency = 1 } }; + p->colorCode = MakeColorCode(0, 0, 0, primCode); + + s16 topX = screenPosX; + s16 bottomX = topX + fontWidth; + s16 topY = screenPosY; + s16 bottomY = topY + fontHeight; + p->v[0].pos.x = topX; + p->v[0].pos.y = topY; + p->v[1].pos.x = bottomX; + p->v[1].pos.y = topY; + p->v[2].pos.x = topX; + p->v[2].pos.y = bottomY; + p->v[3].pos.x = bottomX; + p->v[3].pos.y = bottomY; + + /* Each character is 7x7 pixels, + '0' is 6th character on 2nd row */ + u8 topU = sdata->debugFont.u + 7 * 5 + index * 7; + u8 bottomU = topU + 7; + u8 topV = sdata->debugFont.v + 7; + u8 bottomV = topV + 7; + p->v[0].texCoords.u = topU; + p->v[0].texCoords.v = topV; + p->v[1].texCoords.u = bottomU; + p->v[1].texCoords.v = topV; + p->v[2].texCoords.u = topU; + p->v[2].texCoords.v = bottomV; + p->v[3].texCoords.u = bottomU; + p->v[3].texCoords.v = bottomV; + p->polyClut.self = sdata->debugFont.clut; + p->polyTpage.self = sdata->debugFont.tpage; + + AddPrimitive(p, sdata->gGT->pushBuffer_UI.ptrOT); + /*unsigned short uVar1; POLY_FT4* p; unsigned int *ot; unsigned int uVar4; @@ -37,5 +78,5 @@ void DECOMP_DebugFont_DrawNumbers(int index, int screenPosX, int screenPosY) p->tpage = sdata->debugFont.tpage; *(int*)p = *ot | 0x9000000; - *ot = (unsigned int)p & 0xffffff; + *ot = (unsigned int)p & 0xffffff;*/ } \ No newline at end of file diff --git a/decompile/General/DebugFont/DebugFont_Init.c b/decompile/General/DebugFont/DebugFont_Init.c index 1a9a71e7f..6f188cb5b 100644 --- a/decompile/General/DebugFont/DebugFont_Init.c +++ b/decompile/General/DebugFont/DebugFont_Init.c @@ -4,10 +4,15 @@ void DECOMP_DebugFont_Init(struct GameTracker* gGT) { struct Icon* debugFontIcon = gGT->ptrIcons[0x42]; - + if(debugFontIcon == 0) return; - - sdata->debugFont.UV = *(short*)&debugFontIcon->texLayout.u0; - sdata->debugFont.clut = debugFontIcon->texLayout.clut; - sdata->debugFont.tpage = debugFontIcon->texLayout.tpage; + + u8 u = debugFontIcon->texLayout.u0; + u8 v = debugFontIcon->texLayout.v0; + u16 clut = debugFontIcon->texLayout.clut; + u16 tpage = debugFontIcon->texLayout.tpage; + sdata->debugFont.u = u; + sdata->debugFont.v = v; + sdata->debugFont.clut = clut; + sdata->debugFont.tpage = tpage; } diff --git a/decompile/General/MAIN/MainFrame_RenderFrame.c b/decompile/General/MAIN/MainFrame_RenderFrame.c index 2b641ba9b..b07b8d9f3 100644 --- a/decompile/General/MAIN/MainFrame_RenderFrame.c +++ b/decompile/General/MAIN/MainFrame_RenderFrame.c @@ -1744,7 +1744,7 @@ void RenderSubmit(struct GameTracker* gGT) void* ot = &gGT->pushBuffer[0].ptrOT[0x3ff]; -#ifdef USE_ONLINE +#if 0 && defined(USE_ONLINE) void OnlineMirrorMode(u_long* ot); OnlineMirrorMode(ot); #endif diff --git a/decompile/General/SubmitName/SubmitName_DrawMenu.c b/decompile/General/SubmitName/SubmitName_DrawMenu.c index 99d091a89..24b000d15 100644 --- a/decompile/General/SubmitName/SubmitName_DrawMenu.c +++ b/decompile/General/SubmitName/SubmitName_DrawMenu.c @@ -190,7 +190,7 @@ short DECOMP_SubmitName_DrawMenu(u_short string) // subtract 1/8 from r.x // subtract 1/4 from r.w r.x = WIDE_PICK(32, 88); - r.w = WIDE_PICK(448, 336); + r.w = WIDE_34(448); r.y = 62; r.h = 2; diff --git a/decompile/General/UI/UI_AAA_BigBlock1.c b/decompile/General/UI/UI_AAA_BigBlock1.c index b5dc0ff9b..e7a99cf0c 100644 --- a/decompile/General/UI/UI_AAA_BigBlock1.c +++ b/decompile/General/UI/UI_AAA_BigBlock1.c @@ -1,6 +1,8 @@ #include #include "../prim.c" +#include "../DebugFont/DebugFont_Init.c" +#include "../DebugFont/DebugFont_DrawNumbers.c" #ifndef USE_ONLINE #include "UI_SaveLapTime.c" diff --git a/decompile/General/UI/UI_DrawSpeedBG.c b/decompile/General/UI/UI_DrawSpeedBG.c index 92f07bc72..d349cba98 100644 --- a/decompile/General/UI/UI_DrawSpeedBG.c +++ b/decompile/General/UI/UI_DrawSpeedBG.c @@ -2,19 +2,57 @@ // at bottom of file #ifdef USE_ONLINE -extern const Color DrawSpeedBG_Colors[11]; -extern const Point speedometerData[2][22]; +#define SPEEDO_GREEN MakeColor(0, 0xb5, 0) +#define SPEEDO_YELLOW MakeColor(0xdb, 0xb5, 0) +#define SPEEDO_RED MakeColor(0xdb, 0, 0) +#define SPEEDO_PINK MakeColor(0xd8, 0, 0xcb) +#define SPEEDO_PURPLE MakeColor(0xa4, 0x21, 0xff) +#define SPEEDO_BLUE MakeColor(0x18, 0x18, 0xf3) +const Color DrawSpeedBG_Colors[11] = +{ + SPEEDO_GREEN, SPEEDO_GREEN, + SPEEDO_GREEN, SPEEDO_YELLOW, + SPEEDO_RED, SPEEDO_RED, + SPEEDO_RED, SPEEDO_PINK, + SPEEDO_PURPLE, SPEEDO_PURPLE, + SPEEDO_BLUE, +}; + +const Point speedometerData[22] = +{ + { .x = WIDE_34(-65), .y = 16 }, { .x = WIDE_34(-54), .y = 13 }, + { .x = WIDE_34(-70), .y = 0 }, { .x = WIDE_34(-58), .y = 0 }, + { .x = WIDE_34(-65), .y = -16 }, { .x = WIDE_34(-54), .y = -13 }, + { .x = WIDE_34(-50), .y = -29 }, { .x = WIDE_34(-42), .y = -24 }, + { .x = WIDE_34(-25), .y = -39 }, { .x = WIDE_34(-21), .y = -32 }, + { .x = WIDE_34(0), .y = -42 }, { .x = WIDE_34(0), .y = -35 }, + { .x = WIDE_34(25), .y = -39 }, { .x = WIDE_34(21), .y = -32 }, + { .x = WIDE_34(50), .y = -29 }, { .x = WIDE_34(42), .y = -24 }, + { .x = WIDE_34(65), .y = -16 }, { .x = WIDE_34(54), .y = -13 }, + { .x = WIDE_34(70), .y = 0 }, { .x = WIDE_34(58), .y = 0 }, + { .x = WIDE_34(65), .y = 16 }, { .x = WIDE_34(54), .y = 13 }, +}; #else -extern const Color DrawSpeedBG_Colors[7]; +#define SPEEDO_GREEN MakeColor(0, 0xb5, 0) +#define SPEEDO_YELLOW MakeColor(0xff, 0xd1, 0) +#define SPEEDO_RED MakeColor(0xdb, 0, 0) + +const Color DrawSpeedBG_Colors[7] = +{ + SPEEDO_GREEN, SPEEDO_GREEN, + SPEEDO_GREEN, SPEEDO_GREEN, + SPEEDO_YELLOW, SPEEDO_RED, + SPEEDO_RED, +}; #endif // speedometer background void DECOMP_UI_DrawSpeedBG(void) { #ifdef USE_ONLINE - Point * vertexes = &speedometerData[0]; - Point * vertexesExtLine = &speedometerData[1]; - int pointCount = sizeof(speedometerData) / (sizeof(Point) * 2); + Point * vertexes = &speedometerData; + Point * vertexesExtLine = &speedometerData; + int pointCount = len(speedometerData); const short xOffset = 453; #else Point * vertexes = &data.speedometerBG_vertData[0]; @@ -100,18 +138,4 @@ void DECOMP_UI_DrawSpeedBG(void) p->p.v[2].pos.y = p2y; AddPrimitive(p, sdata->gGT->pushBuffer_UI.ptrOT); } -} - -#ifndef USE_ONLINE -#define SPEEDO_GREEN MakeColor(0, 0xb5, 0) -#define SPEEDO_YELLOW MakeColor(0xff, 0xd1, 0) -#define SPEEDO_RED MakeColor(0xdb, 0, 0) - -const Color DrawSpeedBG_Colors[7] = -{ - SPEEDO_GREEN, SPEEDO_GREEN, - SPEEDO_GREEN, SPEEDO_GREEN, - SPEEDO_YELLOW, SPEEDO_RED, - SPEEDO_RED, -}; -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/decompile/General/UI/UI_JumpMeter_Draw.c b/decompile/General/UI/UI_JumpMeter_Draw.c index 6ba00d621..a06a03fc4 100644 --- a/decompile/General/UI/UI_JumpMeter_Draw.c +++ b/decompile/General/UI/UI_JumpMeter_Draw.c @@ -89,8 +89,8 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver) #else *(u_int *)&p->r0 = 0x28ffffff; #endif - p->x1 = posX + WIDE_34(0xe); - p->x3 = posX + WIDE_34(0xe); + p->x1 = posX + WIDE_34(13); + p->x3 = posX + WIDE_34(13); p->x0 = box.x; p->y0 = box.y; p->y1 = box.y; diff --git a/decompile/General/zGlobal_DATA.c b/decompile/General/zGlobal_DATA.c index 133d3bd64..f5f0e2db3 100644 --- a/decompile/General/zGlobal_DATA.c +++ b/decompile/General/zGlobal_DATA.c @@ -1718,9 +1718,9 @@ struct Data data = .font_charPixWidth = { 0, // DEBUG (removed) - WIDE_PICK(17, 13), // BIG - WIDE_PICK(13, 10), // SMALL - WIDE_PICK(14, 11), // CREDITS + WIDE_34(17), // BIG + WIDE_34(13), // SMALL + WIDE_34(14), // CREDITS }, #if BUILD >= UsaRetail @@ -1736,9 +1736,9 @@ struct Data data = .font_puncPixWidth = { 0, // DEBUG (removed) - WIDE_PICK(11, 8), // BIG - WIDE_PICK(7, 5), // SMALL - WIDE_PICK(11, 8), // CREDITS + WIDE_34(11), // BIG + WIDE_34(7), // SMALL + WIDE_34(11), // CREDITS }, // starts at ascii 0x21 '!' diff --git a/decompile/buildList.txt b/decompile/buildList.txt index 8f732694a..6103e6809 100644 --- a/decompile/buildList.txt +++ b/decompile/buildList.txt @@ -231,7 +231,7 @@ common, exe, CTR_CycleTex_Model, 0x0, General/CTR/CTR_CycleTex_Model.c common, exe, CTR_MatrixToRot, 0x0, General/CTR/CTR_MatrixToRot.c // DebugFont -common, exe, DebugFont_Init, 0x0, General/DebugFont/DebugFont_Init.c General/DebugFont/DebugFont_DrawNumbers.c, DebugFont.bin +//common, exe, DebugFont_Init, 0x0, General/DebugFont/DebugFont_Init.c General/DebugFont/DebugFont_DrawNumbers.c, DebugFont.bin // DecalFont common, exe, DecalFont_GetLineWidth, 0x0, General/DecalFont/DecalFont_GetLineWidth.c @@ -372,8 +372,8 @@ common, exe, Music_Start, 0x0, General/HOWL/h116_Music_Start.c common, exe, Music_End, 0x0, General/HOWL/h117_Music_End.c common, exe, Music_GetHighestSongPlayIndex, 0x0, General/HOWL/h118_Music_GetHighestSongPlayIndex.c -// GTE_AudioLR_Inst -// GTE_AudioLR_Driver +// GTE_AudioLR_Inst +// GTE_AudioLR_Driver // GTE_GetSquaredLength common, exe, OtherFX_RecycleNew, 0x0, General/HOWL/h122_OtherFX_RecycleNew.c // OtherFX_RecycleMute @@ -512,7 +512,7 @@ common, exe, MEMCARD_ChecksumLoad, 0x0, General/MEMCARD/MEMCARD_ChecksumLoad.c common, exe, MEMCARD_StringInit, 0x0, General/MEMCARD/MEMCARD_StringInit.c common, exe, MEMCARD_StringSet, 0x0, General/MEMCARD/MEMCARD_StringSet.c common, exe, MEMCARD_InitCard, 0x0, General/MEMCARD/MEMCARD_InitCard.c -common, exe, MEMCARD_CloseCard, 0x0, General/MEMCARD/MEMCARD_CloseCard.c +common, exe, MEMCARD_CloseCard, 0x0, General/MEMCARD/MEMCARD_CloseCard.c common, exe, MEMCARD_GetNextSwEvent, 0x0, General/MEMCARD/MEMCARD_GetNextSwEvent.c common, exe, MEMCARD_GetNextHwEvent, 0x0, General/MEMCARD/MEMCARD_GetNextHwEvent.c common, exe, MEMCARD_WaitForHwEvent, 0x0, General/MEMCARD/MEMCARD_WaitForHwEvent.c diff --git a/include/common.h b/include/common.h index 7ecc843bd..06bd672a5 100644 --- a/include/common.h +++ b/include/common.h @@ -16,7 +16,7 @@ //#define USE_BIGQUEUE // Requires RAMEX: Extended loading queue //#define USE_HIGH1P // Requires BIGQUEUE: All high model drivers //#define USE_RANDOM // Requires HIGH1P: Character Randomizer -//#define USE_ONLINE // Requires HIGH1P: Online Multiplayer +#define USE_ONLINE // Requires HIGH1P: Online Multiplayer //#define USE_HIGHMP // Requires RAMEX: Multiplayer Maxed mod //#define USE_VR // Virtual Reality @@ -46,7 +46,7 @@ // param1 - normal // param2 - widescreen #ifdef USE_16BY9 -#define WIDE_34(x) (((x)*750)/1000) +#define WIDE_34(x) ((((x)*750) + 500)/1000) #define WIDE_PICK(x,y) (y) #else #define WIDE_34(x) (x) diff --git a/include/regionsEXE.h b/include/regionsEXE.h index ff9dab143..14d50bef4 100644 --- a/include/regionsEXE.h +++ b/include/regionsEXE.h @@ -3635,7 +3635,8 @@ struct sData #else // had to, we were desperate - short UV; + unsigned char u; + unsigned char v; short padding[3]; #endif