Ver Fonte

00171878 COL_PlayerBallCollision bugfix

DESKTOP-AB9OQPJ\RED-10 há 3 anos atrás
pai
commit
ff2db95971
2 ficheiros alterados com 132 adições e 60 exclusões
  1. 131 59
      jni/COL.cpp
  2. 1 1
      jni/CPlayer.cpp

+ 131 - 59
jni/COL.cpp

@@ -7,6 +7,77 @@
 #include "GU.h"
 #include "GL.h"
 #include "SNDGAME.h"
+#include "Util.h"
+struct TLimbInfo {
+  int field_0;
+  int field_4;
+};
+struct tBoneNodeInfo {
+  int i_0;
+  int i_4;
+};
+
+// 0033E918
+TLimbInfo COL_tLimbInfo[14] =
+    {
+        {20, 2},
+        {21, 20},
+        {5, 15},
+        {15, 9},
+        {9, 11},
+        {24, 34},
+        {34, 28},
+        {28, 30},
+        {12, 4},
+        {4, 8},
+        {8, 13},
+        {31, 23},
+        {23, 27},
+        {27, 32}};
+  tBoneNodeInfo COL_tBoneNodeInfo[42] = {
+    {0, 0},
+    {0, 0},
+    {1, 4096},
+    {0, 0},
+    {1, 3276},
+    {1, 3072},
+    {0, 0},
+    {0, 0},
+    {1, 2730},
+    {1, 3072},
+    {0, 0},
+    {1, 3072},
+    {1, 4096},
+    {1, 3276},
+    {0, 0},
+    {1, 3072},
+    {0, 0},
+    {0, 0},
+    {0, 3072},
+    {0, 3072},
+    {1, 4096},
+    {1, 8192},
+    {0, 0},
+    {1, 3276},
+    {1, 3072},
+    {0, 0},
+    {0, 0},
+    {1, 2730},
+    {1, 3072},
+    {0, 0},
+    {1, 3072},
+    {1, 4096},
+    {1, 3276},
+    {0, 0},
+    {1, 3072},
+    {0, 0},
+    {0, 0},
+    {0, 3072},
+    {0, 3072},
+    {0, 0},
+    {0, 0},
+    {0, 0}};
+
 void COL_PlayerBallCollideEvent(CPlayer *pPlayer_0, int i_1, bool &b_2) {
   TAnimData *tAnimData_r7;  // r7
   CPlayer *pPlarer_r0;      // r0
@@ -204,70 +275,71 @@ void COL_PlayerBallCollideEvent(CPlayer *pPlayer_0, int i_1, bool &b_2) {
     }
   }
 }
-// uint COL_PlayerBallCollision(CPlayer *player_0) {
-//   unsigned int iIndex_r4;       // r4
-//   int i_x_r1;                   // r1
-//   TLimbInfo *pTLimbInfo_r10;    // r10
-//   int i_y_r3;                   // r3
-//   TPoint v8;                    // d16
-//   int i_r9;                     // r12
-//   int i_r7;                     // r7
-//   int i_Distance_3D;            // [sp+3Ch] [bp-29Ch]
-//   TPoint3D tTPoint3Ds_48[42];   // [sp+48h] [bp-290h] BYREF
-//   TPoint3D tPoint_240;          // [sp+240h] [bp-98h] BYREF
-//   TPoint3D tPoint_250;          // [sp+250h] [bp-88h] BYREF
-//   TPoint3D tPoint_260;          // [sp+260h] [bp-78h] BYREF
-//   TPoint3D tPoint_270;          // [sp+270h] [bp-68h] BYREF
-//   uint8 b_flags_280[24] = {0};  // [sp+280h] [bp-58h]
 
-//   // 001718B6
-//   tPoint_270 = cBall.point3D_2C;
-//   tPoint_260 = cBall.ballPosPrev_4;
+//00171878
+uint COL_PlayerBallCollision(CPlayer *player_0) {
+  unsigned int iIndex_r4;       // r4
+  int i_x_r1;                   // r1
+  TLimbInfo *pTLimbInfo_r10;    // r10
+  int i_y_r3;                   // r3
+  TPoint v8;                    // d16
+  int i_r9;                     // r12
+  int i_r7;                     // r7
+  int i_Distance_3D;            // [sp+3Ch] [bp-29Ch]
+  TPoint3D tTPoint3Ds_48[42];   // [sp+48h] [bp-290h] BYREF
+  TPoint3D tPoint_240;          // [sp+240h] [bp-98h] BYREF
+  TPoint3D tPoint_250;          // [sp+250h] [bp-88h] BYREF
+  TPoint3D tPoint_260;          // [sp+260h] [bp-78h] BYREF
+  TPoint3D tPoint_270;          // [sp+270h] [bp-68h] BYREF
+  uint8 b_flags_280[0x2A] = {0};  // [sp+280h] [bp-58h]
 
-//   i_Distance_3D = XMATH_Distance3D(&tPoint_270, &tPoint_260);  // call
-//   001F3490 iIndex_r4 = 0;
+  // 001718B6
+  tPoint_270 = cBall.point3D_2C;
+  tPoint_260 = cBall.ballPosPrev_4;
 
-//   // 001718DA
-//   while (iIndex_r4 <= 0xD) {
-//     // 001718DE
-//     i_x_r1 = COL_tLimbInfo[iIndex_r4].field_0;
-//     if (!b_flags_280[i_x_r1])  // 001718E6
-//     {
-//       // 001718EC
-//       player_0->GetBonePosition(i_x_r1, &tTPoint3Ds_48[i_x_r1]);  // call
-//       001715EC i_x_r1 = COL_tLimbInfo[iIndex_r4].field_0; b_flags_280[i_x_r1]
-//       = 1;
-//     }
+  i_Distance_3D = XMATH_Distance3D(&tPoint_270, &tPoint_260);  // call 001F3490
+  iIndex_r4 = 0;
 
-//     // 00171904
-//     pTLimbInfo_r10 = &COL_tLimbInfo[iIndex_r4];
-//     i_y_r3 = pTLimbInfo_r10->field_4;
-//     if (!b_flags_280[i_y_r3])  // 0017190E
-//     {
-//       // 00171910
-//       player_0->GetBonePosition(pTLimbInfo_r10->field_4,
-//       &tTPoint3Ds_48[i_y_r3]);  // call 001715EC i_x_r1 =
-//       COL_tLimbInfo[iIndex_r4].field_0; i_y_r3 = pTLimbInfo_r10->field_4;
-//       b_flags_280[i_y_r3] = 1;
-//     }
+  // 001718DA
+  while (iIndex_r4 <= 0xD) {
+    // 001718DE
+    i_x_r1 = COL_tLimbInfo[iIndex_r4].field_0;
+    if (!b_flags_280[i_x_r1])  // 001718E6
+    {
+      // 001718EC
+      player_0->GetBonePosition(i_x_r1, &tTPoint3Ds_48[i_x_r1]);  // call 001715EC
+      //i_x_r1 = COL_tLimbInfo[iIndex_r4].field_0;
+      b_flags_280[i_x_r1] = 1;
+    }
 
-//     // 0017192C
-//     tPoint_240 = tTPoint3Ds_48[i_y_r3];
-//     tPoint_250 = tTPoint3Ds_48[i_x_r1];
+    // 00171904
+    pTLimbInfo_r10 = &COL_tLimbInfo[iIndex_r4];
+    i_y_r3 = pTLimbInfo_r10->field_4;
+    if (!b_flags_280[i_y_r3])  // 0017190E
+    {
+      // 00171910
+      player_0->GetBonePosition(pTLimbInfo_r10->field_4, &tTPoint3Ds_48[i_y_r3]);  // call 001715EC
+      // i_x_r1 = COL_tLimbInfo[iIndex_r4].field_0;
+      // i_y_r3 = pTLimbInfo_r10->field_4;
+      b_flags_280[i_y_r3] = 1;
+    }
 
-//     // 00171958
-//     i_r9 = XMATH_Distance3D(&tPoint_250, &tPoint_240);  // call 001F3490
-//     i_r7 = COL_tBoneNodeInfo[COL_tLimbInfo[iIndex_r4].field_0].i_4;
+    // 0017192C
+    tPoint_240 = tTPoint3Ds_48[i_y_r3];
+    tPoint_250 = tTPoint3Ds_48[i_x_r1];
 
-//     // 0017198A
-//     if (i_r7 < COL_tBoneNodeInfo[pTLimbInfo_r10->field_4].i_4)
-//       i_r7 = COL_tBoneNodeInfo[pTLimbInfo_r10->field_4].i_4;
+    // 00171958
+    uint u_r12 = XMATH_Distance3D(&tPoint_250, &tPoint_240);  // call 001F3490
+    i_r7 = COL_tBoneNodeInfo[COL_tLimbInfo[iIndex_r4].field_0].i_4;
 
-//     // 001719C4
-//     ++iIndex_r4;
-//     if (UTILCOL_CapsuleCapsuleCheck(tPoint_250, tPoint_240, tPoint_270,
-//     tPoint_260, i_r7, 0x1000, i_r9, i_Distance_3D))  // call 001787A0
-//       return iIndex_r4 - 1;
-//   }
-//   return -1;
-// }
+    // 0017198A
+    if (i_r7 < COL_tBoneNodeInfo[pTLimbInfo_r10->field_4].i_4)
+      i_r7 = COL_tBoneNodeInfo[pTLimbInfo_r10->field_4].i_4;
+
+    // 001719C4
+    ++iIndex_r4;
+    if (UTILCOL_CapsuleCapsuleCheck(tPoint_250, tPoint_240, tPoint_270, tPoint_260, i_r7, 0x1000, u_r12, i_Distance_3D))  // call 001787A0
+      return iIndex_r4 - 1;
+  }
+  return -1;
+}

+ 1 - 1
jni/CPlayer.cpp

@@ -766,7 +766,7 @@ void CPlayer::GetActionPoint(TPoint3D *pPoint3D1) {
 //-------------------------------------------------------------------------------------------------
 // 001715EC 经过单元测试,功能正常
 void CPlayer::GetBonePosition(int i1, TPoint3D *pPoint3D2) {
-  // LOGI("CPlayer::GetBonePosition %p %p", this, pPoint3D2);
+   LOGI("CPlayer::GetBonePosition %p %p%x", this, pPoint3D2,i1);
 }
 //-------------------------------------------------------------------------------------------------
 // 00171798