Skip to content

Commit 8b0d182

Browse files
author
Niko
committed
coll notes
1 parent 42eb769 commit 8b0d182

File tree

3 files changed

+76
-27
lines changed

3 files changed

+76
-27
lines changed

ghidra/COLL.c

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,10 +1982,14 @@ void FUN_8001ef50(int param_1,short *param_2,short *param_3,short *param_4)
19821982
// collision flag
19831983
sVar1 = param_2[3];
19841984

1985+
// Normal Vector
19851986
uVar6 = *(undefined4 *)(param_2 + 6);
19861987
iVar7 = *(int *)(param_2 + 8);
1988+
19871989
*(short *)(param_1 + 0x3c) = *(short *)(param_1 + 0x3c) + 1;
19881990
*(short *)(param_1 + 0x52) = sVar1;
1991+
1992+
// Normal Vector
19891993
*(undefined4 *)(param_1 + 0x54) = uVar6;
19901994
*(int *)(param_1 + 0x58) = iVar7;
19911995

@@ -1998,8 +2002,11 @@ void FUN_8001ef50(int param_1,short *param_2,short *param_3,short *param_4)
19982002

19992003
gte_ldR13R21(iVar11 * 0x10000 | uVar8 & 0xffff);
20002004
gte_ldR22R23(uVar12 & 0xffff | iVar14 * 0x10000);
2005+
2006+
// Normal Vector
20012007
gte_ldVXY0(param_1 + 0x54);
20022008
gte_ldVZ0(iVar7);
2009+
20032010
gte_mvmva_b(0,0,0,3,0);
20042011
iVar5 = gte_stMAC2();
20052012
iVar2 = gte_stMAC1();
@@ -2070,6 +2077,7 @@ void FUN_8001ef50(int param_1,short *param_2,short *param_3,short *param_4)
20702077
iVar2 = (int)*param_2;
20712078

20722079
// flag == 1
2080+
// if normalVec points X
20732081
if (*(short *)(param_1 + 0x52) == 1)
20742082
{
20752083
// X length vectors
@@ -2211,6 +2219,8 @@ void FUN_8001ef50(int param_1,short *param_2,short *param_3,short *param_4)
22112219
*(undefined4 *)(param_1 + 0xd0) = uVar6;
22122220
*(undefined4 *)(param_1 + 0xd4) = uVar4;
22132221
*(short *)(param_1 + 0x3e) = *(short *)(param_1 + 0x3e) + 1;
2222+
2223+
// Record Position (x2)
22142224
*(undefined4 *)(param_1 + 0x68) = *(undefined4 *)(param_1 + 0x4c);
22152225
*(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)(param_1 + 0x4c);
22162226
*(undefined2 *)(param_1 + 0x6c) = *(undefined2 *)(param_1 + 0x50);
@@ -2307,17 +2317,32 @@ void FUN_8001f2dc(int param_1,undefined4 *param_2,short *param_3,short *param_4)
23072317
if (iVar6 < 0) iVar6 = -iVar6;
23082318
if (iVar4 < 0) iVar4 = -iVar4;
23092319

2320+
// normalVec points X
23102321
sVar2 = 1;
2311-
if (iVar5 - iVar6 < 0) {
2322+
2323+
// if Y axis > X axis
2324+
if (iVar5 - iVar6 < 0)
2325+
{
2326+
// normalVec points X
23122327
sVar2 = 1;
2313-
if (-1 < iVar6 - iVar4) {
2328+
2329+
// Y axis > Z axis
2330+
if (-1 < iVar6 - iVar4)
2331+
{
2332+
// normalVec points Y
23142333
sVar2 = 3;
23152334
}
23162335
}
2317-
else if (-1 < iVar5 - iVar4) {
2336+
2337+
// (else means Y < X) &&
2338+
// if X > Z
2339+
else if (-1 < iVar5 - iVar4)
2340+
{
2341+
// normalVec points Z
23182342
sVar2 = 2;
23192343
}
23202344

2345+
// BspSearchVertex Flags (1,2,3)
23212346
*(short *)((int)param_2 + 6) = sVar2;
23222347

23232348
return;
@@ -2643,6 +2668,11 @@ undefined4 FUN_8001f928(undefined4 *param_1,undefined4 *param_2,undefined4 *para
26432668
int iVar10;
26442669

26452670
puVar2 = param_3;
2671+
2672+
// rearrange algorithm based on
2673+
// the direction the normalVec faces
2674+
2675+
// NormalVec Direction #3
26462676
if (*(short *)((int)param_1 + 6) == 3) {
26472677
iVar3 = (int)*(short *)(param_2 + 1);
26482678
iVar5 = *(short *)(param_3 + 1) - iVar3;
@@ -2670,6 +2700,8 @@ undefined4 FUN_8001f928(undefined4 *param_1,undefined4 *param_2,undefined4 *para
26702700
}
26712701
else {
26722702
iVar3 = (int)*(short *)param_2;
2703+
2704+
// NormalVec Direction #1
26732705
if (*(short *)((int)param_1 + 6) == 1) {
26742706
iVar5 = *(short *)param_3 - iVar3;
26752707
iVar9 = *(short *)param_4 - iVar3;
@@ -2695,6 +2727,9 @@ undefined4 FUN_8001f928(undefined4 *param_1,undefined4 *param_2,undefined4 *para
26952727
iVar4 = *(short *)((int)param_1 + 0x12) - iVar4;
26962728
}
26972729
else {
2730+
2731+
// NormalVec Direction #2
2732+
26982733
iVar3 = (int)*(short *)((int)param_2 + 2);
26992734
iVar5 = *(short *)((int)param_3 + 2) - iVar3;
27002735
iVar9 = *(short *)((int)param_4 + 2) - iVar3;
@@ -3327,7 +3362,9 @@ void FUN_80020410(undefined4 param_1,int param_2)
33273362
// quadblock, triangleID, search data
33283363
FUN_80020334(0,0,&DAT_1f800108);
33293364

3330-
// loop executes 0xF times
3365+
// loop 16 times (0xF -> 0)
3366+
// Check every 1/16th distance
3367+
// between CurrFrame and NextFrame
33313368
iVar14 = 0xf;
33323369
do
33333370
{
@@ -3342,6 +3379,9 @@ void FUN_80020410(undefined4 param_1,int param_2)
33423379
DAT_1f800148 = 0;
33433380
DAT_1f80018c = 0x1000;
33443381

3382+
// 1f800118: vec3 kartPosCurrFrame
3383+
// 1f800108: vec3 kartPosNextFrame
3384+
33453385
// kartCenter = vec3_originToCenter + driverPos (origin of model is bottom-center)
33463386
sVar9 = *(short *)(param_2 + 0x94) + (short)((uint)*(undefined4 *)(param_2 + 0x2d4) >> 8);
33473387
sVar10 = *(short *)(param_2 + 0x98) + (short)((uint)*(undefined4 *)(param_2 + 0x2d8) >> 8);
@@ -3443,7 +3483,8 @@ void FUN_80020410(undefined4 param_1,int param_2)
34433483

34443484
if (0 < DAT_1f80018c)
34453485
{
3446-
// increase position by velocity
3486+
// increase position by PARTIAL velocity,
3487+
// slowly increment one each frame of 16 checks
34473488
*(int *)(param_2 + 0x2d4) = *(int *)(param_2 + 0x2d4) + (iVar5 * DAT_1f80018c >> 0xc);
34483489
*(int *)(param_2 + 0x2d8) = *(int *)(param_2 + 0x2d8) + (iVar6 * DAT_1f80018c >> 0xc);
34493490
*(int *)(param_2 + 0x2dc) = *(int *)(param_2 + 0x2dc) + (iVar7 * DAT_1f80018c >> 0xc);

include/namespace_Coll.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ struct BspSearchVertex
1010
short pos[3];
1111

1212
// 0x6
13-
// FUN_8001ef50
13+
// FUN_8001f2dc - COLL_TestTriangle_GetNormalVector
14+
// FUN_8001ef50 - COLL_TestTriangle_FindAny
1415
u_short flags;
1516

1617
// 0x8

symbols/syms926.txt

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,36 @@
6565
8001cfec CDSYS_XAPauseForce
6666
8001d06c CDSYS_XAPauseAtEnd
6767

68-
// only stubbed in 926
68+
// only stubbed in 926 // Rename in-progress, NOT DONE
6969
8001d094 COLL_LevModelMeta
70-
8001d0c4 COLL_Instance
71-
8001d610 COLL_PerBspLeaf_CheckInstances
72-
8001d77c COLL_StartSearch_AI
73-
8001d944 COLL_StartSearch_Player
74-
8001eb0c COLL_SearchTree_FindQuadblock_Touching
75-
8001ebec COLL_SearchTree_FindX
76-
8001ede4 COLL_TestTriangle_FindClosest_Subfunction2
77-
8001ef1c COLL_TestTriangle_Unused
78-
8001ef50 COLL_TestTriangle_FindAny
79-
8001f2dc COLL_TestTriangle_GetNormalVector
80-
8001f41c COLL_PerQuadblock_CheckTriangles_Touching
81-
8001f5f0 COLL_PerBspLeaf_CheckQuadblocks_Touching
82-
8001f67c COLL_TestQuadblock_TwoTris
83-
8001f6f0 COLL_TestQuadblock_EightTris
70+
8001d0c4 COLL_Instance // NX_PerInstance_HitboxTestSelf
71+
8001d610 COLL_PerBspLeaf_CheckInstances // NX_PerBspLeaf_HitboxTestInstances
72+
73+
8001d77c COLL_StartSearch_AI // calls NX_PerBspLeaf_HitboxTestInstances (no quadblock)
74+
8001d944 COLL_StartSearch_Player // N2: This is the LAST collision check post-movement
75+
76+
8001eb0c COLL_SearchTree_FindQuadblock_Touching // calls N2_PerBspLeaf_HitboxTestQuadblocks
77+
8001ebec COLL_SearchTree_FindX // calls PerBspLeaf N2_Quadblock/Instance/N1_Quadblock/PROC_PerBspLeaf_CheckInstances
78+
79+
8001ede4 COLL_TestTriangle_FindClosest_Subfunction2 // N1 final test of triangle
80+
81+
8001ef1c COLL_TestTriangle_Unused // N2_PerTriangle_UNUSED
82+
8001ef50 COLL_TestTriangle_FindAny // N2_PerTriangle_HitboxTestSelf
83+
8001f2dc COLL_TestTriangle_GetNormalVector // NX_PerTriangle_GetNormalVector
84+
8001f41c COLL_PerQuadblock_CheckTriangles_Touching // N2_PerQuadblock_HitboxTestTriangles
85+
8001f5f0 COLL_PerBspLeaf_CheckQuadblocks_Touching // N2_PerBspLeaf_HitboxTestQuadblocks
86+
8001f67c COLL_TestQuadblock_TwoTris // NX_PerQuadblock_GetNormalVector_LoLOD
87+
8001f6f0 COLL_TestQuadblock_EightTris // NX_PerQuadblock_GetNormalVector_HiLOD
88+
8489
8001f7f0 COLL_ResetScratchpadCache
85-
8001f928 COLL_TestTriangle_FindClosest_Subfunction1
86-
8001fc40 COLL_TestTriangle_FindClosest
87-
80020064 COLL_PerQuadblock_CheckTriangles_NearPlayer
88-
800202a8 COLL_PerBspLeaf_CheckQuadblocks_NearPlayer
89-
80020334 COLL_TestTriangle_WithClosest
90-
80020410 COLL_StartSearch_NearPlayer
90+
91+
8001f928 COLL_TestTriangle_FindClosest_Subfunction1 // N1 reorder based on normal
92+
8001fc40 COLL_TestTriangle_FindClosest // N1_PerTriangle_HitboxTestSelf
93+
80020064 COLL_PerQuadblock_CheckTriangles_NearPlayer // N1_PerQuadblock_HitboxTestTriangles
94+
800202a8 COLL_PerBspLeaf_CheckQuadblocks_NearPlayer // N1_PerBspLeaf_HitboxTestQuadblocks
95+
80020334 COLL_TestTriangle_WithClosest // ---
96+
80020410 COLL_StartSearch_NearPlayer // N1: This tests 16 times, move position by 1/16th velocity
97+
9198
80020c58 COLL_Scrub // GetImpact_Player
9299

93100
80021500 CTR_Box_DrawWirePrims

0 commit comments

Comments
 (0)