Skip to content

Commit

Permalink
Match 0.96% of mplib (54.68 KB) (doldecomp#1223)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Burns <52847440+r-burns@users.noreply.github.com>
  • Loading branch information
ribbanya and r-burns authored Feb 14, 2024
1 parent c4d58de commit 046d964
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 4 deletions.
6 changes: 3 additions & 3 deletions config/GALE01/scratches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,9 @@ done__func_80043BBC = OK:0x80043BBC; // author:BR- id:16itw updated:2022-08-15T0
wip__func_80046904 = OK:0x80046904; // author:BR- id:Y0BWC updated:2022-08-20T08:45:10.249034Z created:2022-08-19T05:46:53.545938Z
func_8004730C = OK:0x8004730C; // id:WrvQF updated:2022-02-24T04:43:04.318751Z created:2022-02-22T20:42:02.461972Z
mpColl_800477E0 = OK:0x800477E0; // author:Walnut356 id:QRCuA updated:2024-01-16T07:50:30.990181Z created:2024-01-15T06:21:42.048387Z
func_8004D164 = 100%:0x8004D164; // id:LavJZ updated:2023-03-30T19:44:57.012007Z created:2023-03-30T19:44:55.234045Z
func_8004E97C = 49.27%:0x8004E97C; // author:ribbanya id:HMlVj updated:2022-06-29T04:10:52.731148Z created:2022-06-29T00:50:26.92094Z
func_80054ED8 = 84.58%:0x80054ED8; // author:r-burns id:IcKS4 updated:2022-04-09T23:52:58.528765Z created:2022-04-09T21:43:36.99401Z
func_8004D164 = OK:0x8004D164; // id:LavJZ updated:2023-03-30T19:44:57.012007Z created:2023-03-30T19:44:55.234045Z
func_8004E97C = OK:0x8004E97C; // author:ribbanya id:HMlVj updated:2022-06-29T04:10:52.731148Z created:2022-06-29T00:50:26.92094Z
func_80054ED8 = OK:0x80054ED8; // author:r-burns id:IcKS4 updated:2022-04-09T23:52:58.528765Z created:2022-04-09T21:43:36.99401Z
func_8005A6F8 = 100%:0x8005A6F8; // author:ssbmcortex id:GBQEN updated:2022-11-26T04:29:18.672914Z created:2022-11-26T03:58:14.523128Z
func_8005A728 = 54.4%:0x8005A728; // author:VetriTheRetri id:SvV3B parent:3Jxhp updated:2022-12-18T19:03:25.171744Z created:2022-12-17T21:20:35.686389Z
func_8005A728 = 52.94%:0x8005A728; // author:davidgfb id:I4F5w parent:SvV3B updated:2022-12-18T12:38:06.9951Z created:2022-12-18T12:37:52.894306Z
Expand Down
119 changes: 119 additions & 0 deletions src/melee/mp/mplib.c
Original file line number Diff line number Diff line change
@@ -1 +1,120 @@
#include "mplib.h"

#include <dolphin/mtx/types.h>

static int mpLib_804D64B4;
static IntVec2* mpLib_804D64BC;

int mpLib_8004D164(void)
{
return mpLib_804D64B4;
}

bool mpLib_8004E97C(double arg0, double arg1, double arg2, double arg3,
double arg4, double arg5, double arg6, double arg7,
float* arg8, float* arg9)

{
bool b0 = false;
bool b1 = false;

if (arg2 <= arg0) {
if (((arg4 < arg2) && (arg6 < arg2)) ||
((arg0 < arg4 && (arg0 < arg6))))
{
return false;
}
} else if (((arg4 < arg0) && (arg6 < arg0)) ||
((arg2 < arg4 && (arg2 < arg6))))
{
return false;
}
if (arg3 < arg1) {
if (((arg5 < arg3) && (arg7 < arg3)) ||
((arg1 < arg5 && (arg1 < arg7))))
{
return false;
}
} else if (((arg5 < arg1) && (arg7 < arg1)) ||
((arg3 < arg5 && (arg3 < arg7))))
{
return false;
}
{
double n6 = arg3 - arg1;
double n5 = arg4 - arg0;
double n8 = arg2 - arg0;
double n7 = arg5 - arg1;
double n9 = n8 * n7 - n6 * n5;
if (n9 < 0) {
if (n9 < -0.1) {
return false;
}
b0 = true;
}
{
double n4 = n8 * (arg7 - arg3) - n6 * (arg6 - arg2);
if (0 < n4) {
if (0.1 < n4) {
return false;
}
b1 = true;
}
if ((0 != n9) || (0 != n4)) {
double n2 = n5 * (arg7 - arg3) - n7 * (arg6 - arg2);
if (n9 <= n2) {
if ((n9 < n2) && (n4 < n2)) {
return false;
}
} else if (n2 < n4) {
return false;
}
n2 = (arg6 - arg4);
n4 = (arg7 - arg5);
if ((((0 != n2) || (0 != n4)) && ((!b0 || (!b1)))) &&
((n9 < 0 || (!b1))))
{
double n3 = n2 * n6 - n4 * n8;
n9 = n3;
if (n3 < 0) {
n9 = -n3;
}
if (1e-4 < n9) {
n3 = (n2 * n7 - n4 * n5) / n3;
if (n3 <= 0) {
*arg8 = arg0;
*arg9 = arg1;
} else if (1 <= n3) {
*arg8 = arg2;
*arg9 = arg3;
} else {
*arg8 = (n8 * n3 + arg0);
*arg9 = (n6 * n3 + arg1);
}
return true;
}
}
}
}
}
return false;
}

bool mpLib_80054ED8(int line)
{
if (line == -1) {
return false;
}
if (line < 0 || line >= mpLib_804D64BC[0].x) {
OSReport("%s:%d:not found lineID=%d\n", __FILE__, 4636);
while (true) {
continue;
};
}
if (!(mpLib_804D64BC[line].y & 0x10000) ||
(mpLib_804D64BC[line].y & 0x40000))
{
return false;
}
return true;
}
2 changes: 1 addition & 1 deletion src/melee/mp/mplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/* 054C6C */ enum_t mpLib_80054C6C(int);
/* 054CEC */ u32 mpLib_80054CEC(enum_t);
/* 054DFC */ void mpLib_80054DFC(enum_t, Vec3*);
/* 054ED8 */ bool mpLib_80054ED8(s32);
/* 054ED8 */ bool mpLib_80054ED8(int);
/* 054F68 */ bool mpLib_80054F68(s32, s32);
/* 0552B0 */ void mpLib_800552B0(s16 x, HSD_JObj*, s16 z);
/* 055E9C */ void mpLib_80055E9C(s16 x);
Expand Down

0 comments on commit 046d964

Please sign in to comment.