mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-06-08 12:28:35 -04:00
44db9bab77
* initial work
* more work
* progress
* Fixed slow fps
* Add Lywx changes
* Interp Works
* Test default tick/logic update
* Added missing include (#202)
* Added missing include
* More missing includes
---------
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
* test
* Revert "test"
This reverts commit 1a810d74cc.
* Interp Item box
* Actually interpolate item box
* fix clouds
* interp player?
* Test 2
* Fix mistake
* tag and fix item boxes
* tag fake item box and whatever func_800696CC is
* these aren't needed
* tag karts
* Slightly better falling rocks(still needs work)
* Tag Smoke and Dust
* Removed unneeded code from falling_rock
* tag whatever func_80051ABC is
* add missing rotate x coord
* GrandPrixBallon/kart shadow
* Green shells tag, and added comments I neglected to add before.
* doesn't compile on win
* Fixes
* Disabled camera interpolation
* Balloons fixes
* progress
* set_transform_matrix compiles
* Compile setTransformMatrix
* More transforms interp
* Add more interps
* matrix
* Matrix multi interp
* Fix interpolation camera bug
* Missing includes needed for Linux.
* Excluded access to HM64 Labs on Switch.
* interpolation tags for various objects
* Bowser castle statue flame interpolated.
* tag hedgehogs
* cloud interpolation
* Interpolated smoke particles from shells
* cloud interpolation refactor
* Interpolated snowflakes
* Interpolated penguins, also added comment tags to places I missed.
* tag Snowman interpolation
* Interpolated player reflection(sherbet land)
* Forgot to uncomment stuff while testing
* better tag
* tag leaves
* Set the default FPS to 30
* tag hud
* Fixed "Match Refresh Rate" option
* adjust draw distance
* remove innecessary rock tag
* rag rocks
* better tag
* Tagged player rank placement in HUD
* Tagged Bat, Boos, and TrashBin(Banshee Boardwalk objects)
* Refactor render_screens and fix editor raycast
* better object interpolation
* shift is not needed here
* fix tag
* fix tags
* mole comments
* comment
* Changed how shell flames are interpolated.
* interpolated ended scene fireworks.
* Tagged star particles in the ending scene
* Shell flames handled better.
* this isn't needed
* Fix multiplayer cameras
* Fixed loading battle maps.
* Tagged battle balloons
* Some fixes for battle mode
* No longer needed changes toAFinishline with the changes mega made.
* Tag finishline
* fix to make it compile with cmake 3.31
* changed mtxf_multiplication() to fix vert explosion in Desert & DK parkway.(provided by Coco.)
* fix memory leaks, avoid invalidate texture (#207)
* Fixed macos
* More stupid fixes
* update with main and update torch and lus and enable action on this branch
* Update FrameInterpolation.h
* Update FrameInterpolation.cpp
* fix some memory leak
* Update torch
* Update torch
* update torch and lus
* reduce texture import
* don't use fork of torch and lus
* Update torch
* Update torch
---------
Co-authored-by: Lywx <kiritodev01@gmail.com>
* Refactor World::Courses to unique_ptr (#211)
* wip course unique ptr
* Track unique_ptr : This probably compiles
* Finish impl Courses as unique_ptr
* Fix error
* Fixes
* More fixes
* Cleanup
* Remove old vars
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
* particle boat and train
* fix player particle interpolation
* add modify interpolation target fps in menu
* fix windows
* Update libultraship
* Fix logo interp
* Interp SetTextMatrix
* Fix freecam camera
* Clarify comment
* Clarify func
* fix linux compilation
* Update Thwomp.cpp
* Update Thwomp.h
* Update render.inc.c
* Update render.inc.c
* Update gbiMacro.c
* interp falling rock shadow
* Revert change that has no explanation
* Update code_80057C60.c
* Update code_80057C60.c
* Update GrandPrixBalloons.cpp
* Update Lakitu.cpp
* Update framebuffer_effects.c
* Update render_courses.c
---------
Co-authored-by: Sonic Dreamcaster <alejandro.asenjo88@gmail.com>
Co-authored-by: KiritoDv <kiritodev01@gmail.com>
Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com>
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Co-authored-by: coco875 <59367621+coco875@users.noreply.github.com>
Co-authored-by: coco875 <pereira.jannin@gmail.com>
211 lines
5.5 KiB
C
211 lines
5.5 KiB
C
#include <libultraship.h>
|
|
#include <macros.h>
|
|
#include <defines.h>
|
|
|
|
#include "code_800AF9B0.h"
|
|
|
|
#include "menu_items.h"
|
|
#include "memory.h"
|
|
#include "main.h"
|
|
#include "math_util.h"
|
|
#include <stdlib.h>
|
|
|
|
Lights1 D_800E8680 = gdSPDefLights1(31, 31, 31, 255, 255, 255, 40, 40, 20);
|
|
#ifdef TARGET_N64
|
|
/*** Data ***/
|
|
Ambient D_800E8680 = { {
|
|
{ 31, 31, 31 },
|
|
0,
|
|
{ 31, 31, 31 },
|
|
0,
|
|
} };
|
|
|
|
Light D_800E8688 = { {
|
|
{ 255, 255, 255 },
|
|
0,
|
|
{ 255, 255, 255 },
|
|
0,
|
|
{ 40, 40, 20 },
|
|
0,
|
|
} };
|
|
#endif
|
|
|
|
/*** BSS ****/
|
|
s16 D_8018EDB0;
|
|
s16 D_8018EDB2;
|
|
s16 D_8018EDB4;
|
|
Vtx D_8018EDB8[480];
|
|
Vtx D_8018EDBC[480];
|
|
|
|
/*** utils **/
|
|
#define SQ(x) ((x) * (x))
|
|
|
|
void func_800AF9B0(void) {
|
|
// D_8018EDB8 = (void*) calloc(480, sizeof(Vtx));
|
|
// D_8018EDBC = (void*) calloc(480, sizeof(Vtx));
|
|
}
|
|
|
|
// could be a normal vertex, not a color...
|
|
void func_800AF9E4(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s16 arg5, s32 arg6, s32 arg7) {
|
|
s32 r, g, b;
|
|
s32 i;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
(arg0 + i)->v.ob[0] = ((i % 2) * arg7) + arg6 - 504;
|
|
if (i / 2 == 0) {
|
|
(arg0 + i)->v.ob[1] = (arg2 * arg3) - 420;
|
|
} else {
|
|
(arg0 + i)->v.ob[1] = (arg2 * arg3) + arg3 - 420;
|
|
}
|
|
if (i % 2 == 0) {
|
|
(arg0 + i)->v.ob[1] += (f32) SQ(arg1) * -0.07f;
|
|
} else {
|
|
(arg0 + i)->v.ob[1] += (f32) SQ(arg1 + 1) * -0.07f;
|
|
}
|
|
|
|
(arg0 + i)->v.cn[0] = 0;
|
|
(arg0 + i)->v.cn[1] = 0;
|
|
(arg0 + i)->v.cn[2] = 120;
|
|
(arg0 + i)->v.cn[3] = 255;
|
|
|
|
if (i % 2 == 0) {
|
|
(arg0 + i)->v.ob[2] = arg4;
|
|
} else {
|
|
(arg0 + i)->v.ob[2] = arg5;
|
|
}
|
|
}
|
|
|
|
if ((((arg1 / 2) + (arg2 / 2)) & 1) == 0) {
|
|
r = g = b = 0;
|
|
} else {
|
|
r = g = b = 255;
|
|
}
|
|
|
|
gDPSetPrimColor(gDisplayListHead++, 0, 0, r, g, b, 255);
|
|
gDPPipeSync(gDisplayListHead++);
|
|
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(arg0), 4, 0);
|
|
gSP1Triangle(gDisplayListHead++, 1, 2, 0, 0);
|
|
gSP1Triangle(gDisplayListHead++, 3, 2, 1, 0);
|
|
}
|
|
|
|
void func_800AFC54(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]);
|
|
#ifdef NON_MATCHING
|
|
// guess on Vtx type?
|
|
void func_800AFC54(Vtx* arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4[3]) {
|
|
Vtx *a1, *a2, *a3;
|
|
s32 saved1, saved2, saved3;
|
|
f32 res;
|
|
s32 a, b, c, d, e, f;
|
|
f32 f14, f16, f18;
|
|
|
|
a1 = &arg0[arg1];
|
|
a2 = &arg0[arg2];
|
|
a3 = &arg0[arg3];
|
|
|
|
saved1 = a2->v.ob[0];
|
|
saved2 = a2->v.ob[1];
|
|
saved3 = a2->v.ob[2];
|
|
|
|
a = saved2 - a1->v.ob[1];
|
|
e = saved3 - a1->v.ob[2];
|
|
d = a3->v.ob[1] - saved2;
|
|
b = a3->v.ob[2] - saved3;
|
|
f = a3->v.ob[0] - saved1;
|
|
c = saved1 - a1->v.ob[0];
|
|
|
|
f14 = ((a) * (b)) - ((e) * (d));
|
|
f16 = ((e) * (f)) - ((c) * (b));
|
|
f18 = ((c) * (d)) - ((a) * (f));
|
|
|
|
res = sqrtf(SQ(f14) + SQ(f16) + SQ(f18));
|
|
|
|
if (res < 0.001) {
|
|
res = 0.001;
|
|
}
|
|
|
|
arg4[0] = f14 * (f32) (1.0 / res) * 120.0f;
|
|
arg4[1] = f16 * (f32) (1.0 / res) * 120.0f;
|
|
arg4[2] = f18 * (f32) (1.0 / res) * 120.0f;
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800AFC54.s")
|
|
#endif
|
|
|
|
void func_800AFE00(Vtx* arg0, Vec3s* arg1, s32 arg2, s32 arg3) {
|
|
s32 idx1;
|
|
s32 idx2;
|
|
s32 i;
|
|
Vtx* vtx;
|
|
s16 sp14[2][3];
|
|
|
|
idx1 = (arg2 == 0) ? 0 : arg2 - 1;
|
|
idx2 = (arg2 == arg3) ? arg3 : arg2 + 1;
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
sp14[0][i] = (arg1[idx1][i] + arg1[arg2][i]) / 2;
|
|
sp14[1][i] = (arg1[idx2][i] + arg1[arg2][i]) / 2;
|
|
}
|
|
|
|
for (idx2 = 0; idx2 < 0x1E0; idx2 += 0x30) {
|
|
for (i = 0; i < 4; i++) {
|
|
vtx = &arg0[i];
|
|
vtx[idx2 / 1].v.cn[0] = sp14[i % 2][0];
|
|
vtx[idx2 / 1].v.cn[1] = sp14[i % 2][1];
|
|
vtx[idx2 / 1].v.cn[2] = sp14[i % 2][2];
|
|
}
|
|
}
|
|
}
|
|
|
|
void func_800AFF58(Vtx* arg0) {
|
|
UNUSED u32 pad88[26];
|
|
s32 i, j;
|
|
s16 sp40[12][3];
|
|
|
|
for (i = 0, j = 0; i < ARRAY_COUNT(sp40); i++, j += 4) {
|
|
func_800AFC54(&arg0[j], 1, 2, 0, sp40[i]);
|
|
}
|
|
|
|
for (i = 0, j = 0; i < ARRAY_COUNT(sp40); i++, j += 4) {
|
|
func_800AFE00(&arg0[j], sp40, i, 11);
|
|
}
|
|
}
|
|
|
|
#ifdef NON_MATCHING
|
|
// Credit to SpazzyLemon for the updated and better attempt
|
|
void func_800B0004(void) {
|
|
Vtx* vtxs;
|
|
s32 res1, res2;
|
|
UNUSED u32 pad[0x5];
|
|
s32 i, j;
|
|
|
|
gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8680.l[0]), LIGHT_1);
|
|
gSPLight(gDisplayListHead++, VIRTUAL_TO_PHYSICAL2(&D_800E8680.a), LIGHT_2);
|
|
gSPNumLights(gDisplayListHead++, NUMLIGHTS_1);
|
|
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH);
|
|
gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE, PRIMITIVE, 0, SHADE, 0, 0, 0, 0,
|
|
SHADE);
|
|
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
|
|
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
|
|
|
|
vtxs = D_8018EDB4 % 2 ? D_8018EDB8 : D_8018EDBC;
|
|
D_8018EDB2 = 0x9C0;
|
|
for (i = 0; i < 10; i++) {
|
|
for (j = 0; j < 12; j++) {
|
|
res1 = sins(D_8018EDB0 - (j * D_8018EDB2)) * 84.0f * j * 0.18f;
|
|
res2 = sins(D_8018EDB0 - ((j + 1) * D_8018EDB2)) * 84.0f * (j + 1) * 0.18f;
|
|
func_800AF9E4(&vtxs[j * 4 + i * 48], j, i, 84, res1, res2, (j * 84), 84);
|
|
}
|
|
}
|
|
func_800AFF58(vtxs);
|
|
if (gTickVisuals) {
|
|
D_8018EDB0 += D_8018EDB2;
|
|
++D_8018EDB4;
|
|
}
|
|
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
|
|
gSPNumLights(gDisplayListHead++, NUMLIGHTS_1);
|
|
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
|
|
}
|
|
#else
|
|
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B0004.s")
|
|
#endif
|