Skip to content

Commit

Permalink
Match setNearestBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
roeming committed Sep 7, 2023
1 parent 3abef94 commit 448d791
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/plugProjectNishimuraU/Ujia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,33 @@ void Obj::setBridgeSearch()
*/
void Obj::setNearestBridge()
{
this->mBridge = nullptr;
this->_2CC = 0.0f;
this->_2D0 = 0.0f;

if(ItemBridge::mgr)
{
f32 radius = C_PARMS->mGeneral.mTerritoryRadius.mValue;
radius = SQUARE(radius);
Iterator<BaseItem> i(ItemBridge::mgr);
CI_LOOP(i)
{
ItemBridge::Item* cBridge = static_cast<ItemBridge::Item*>(*i);
Vector3f v = (cBridge)->getStartPos();
float newRad = sqrDistanceXZ(mPosition, v);
if(newRad < radius)
{
mBridge = cBridge;
radius = newRad;
}
}
}

if (mBridge)
{
f32 width = mBridge->getStageWidth() - 20.0f;
_2CC = -(0.5f*width - (rand() * width / RAND_MAX));
}
/*
stwu r1, -0x50(r1)
mflr r0
Expand Down

0 comments on commit 448d791

Please sign in to comment.