MCPcopy Create free account
hub / github.com/doldecomp/mkdd / GetBeforeTarget

Method GetBeforeTarget

src/Yamamoto/KartTaeget.cpp:85–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85CLPoint *KartTarget::GetBeforeTarget(int idx, f32 *pLen)
86{
87 CLPoint *brosPoint;
88 KartBody *body = GetKartCtrl()->getKartBody(idx);
89 CLPoint *target;
90
91 if (GetKartCtrl()->IsMiniGame())
92 return nullptr;
93
94 JGeometry::TVec3f diff;
95 JGeometry::TVec3f pntPos;
96
97 f32 lenMax;
98 int pointCnt = mCenter->getPrevPointNumber();
99
100 for (int i = 0; i < pointCnt; i++)
101 {
102 brosPoint = mCenter->getPrevPoint(i);
103 brosPoint->getPosition(&pntPos);
104 diff.sub(body->mPos, pntPos);
105 f32 len = diff.length();
106 if (lenMax > len || i == 0)
107 {
108 lenMax = len;
109 target = brosPoint;
110 }
111 }
112 *pLen = lenMax;
113 return target;
114}
115
116void KartTarget::DoSearchTarget(int idx)
117{

Callers

nothing calls this directly

Calls 8

GetKartCtrlFunction · 0.85
IsMiniGameMethod · 0.80
getPrevPointNumberMethod · 0.80
getPrevPointMethod · 0.80
getKartBodyMethod · 0.45
getPositionMethod · 0.45
subMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected