mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:04:56 +00:00
More bug fixes
This commit is contained in:
@@ -481,18 +481,19 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
|
||||
float left = ControlMapper::GetAnalogInput(ControlMapper::ECommands::MapCircleLeft, input);
|
||||
float right = ControlMapper::GetAnalogInput(ControlMapper::ECommands::MapCircleRight, input);
|
||||
|
||||
float dirs[4] = {};
|
||||
bool mouseHeld = false;
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)]) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
mouseHeld = true;
|
||||
if (float(m_mouseDelta.x()) < 0.f)
|
||||
right += -m_mouseDelta.x();
|
||||
dirs[3] = -m_mouseDelta.x();
|
||||
else if (float(m_mouseDelta.x()) > 0.f)
|
||||
left += m_mouseDelta.x();
|
||||
dirs[2] = m_mouseDelta.x();
|
||||
if (float(m_mouseDelta.y()) < 0.f)
|
||||
up += -m_mouseDelta.y();
|
||||
dirs[0] = -m_mouseDelta.y();
|
||||
else if (float(m_mouseDelta.y()) > 0.f)
|
||||
down += m_mouseDelta.y();
|
||||
dirs[1] = m_mouseDelta.y();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,8 +512,7 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
|
||||
dirSlot = 3;
|
||||
}
|
||||
|
||||
float dirs[4] = {};
|
||||
dirs[dirSlot] = maxMag;
|
||||
dirs[dirSlot] += maxMag;
|
||||
|
||||
if (dirs[0] > 0.f || dirs[1] > 0.f || dirs[2] > 0.f || dirs[3] > 0.f || mouseHeld) {
|
||||
int flags = 0x0;
|
||||
@@ -596,14 +596,17 @@ void CAutoMapper::ProcessMapZoomInput(const CFinalInput& input, const CStateMana
|
||||
bool in = ControlMapper::GetDigitalInput(ControlMapper::ECommands::MapZoomIn, input);
|
||||
bool out = ControlMapper::GetDigitalInput(ControlMapper::ECommands::MapZoomOut, input);
|
||||
|
||||
float zoomSpeed = 1.f;
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
m_mapScroll += kbm->m_accumScroll - m_lastAccumScroll;
|
||||
m_lastAccumScroll = kbm->m_accumScroll;
|
||||
if (m_mapScroll.delta[1] > 0.0) {
|
||||
in = true;
|
||||
zoomSpeed = std::max(1.f, float(m_mapScroll.delta[1]));
|
||||
m_mapScroll.delta[1] = std::max(0.0, m_mapScroll.delta[1] - (15.0 / 60.0));
|
||||
} else if (m_mapScroll.delta[1] < 0.0) {
|
||||
out = true;
|
||||
zoomSpeed = std::max(1.f, float(-m_mapScroll.delta[1]));
|
||||
m_mapScroll.delta[1] = std::min(0.0, m_mapScroll.delta[1] + (15.0 / 60.0));
|
||||
}
|
||||
}
|
||||
@@ -634,7 +637,7 @@ void CAutoMapper::ProcessMapZoomInput(const CFinalInput& input, const CStateMana
|
||||
|
||||
x324_zoomState = nextZoomState;
|
||||
float delta = input.DeltaTime() * 60.f * (x1bc_state == EAutoMapperState::MapScreen ? 1.f : 4.f) *
|
||||
g_tweakAutoMapper->GetCamZoomUnitsPerFrame();
|
||||
g_tweakAutoMapper->GetCamZoomUnitsPerFrame() * zoomSpeed;
|
||||
float oldDist = xa8_renderStates[0].x18_camDist;
|
||||
if (x324_zoomState == EZoomState::In) {
|
||||
xa8_renderStates[0].x18_camDist = GetClampedMapScreenCameraDistance(xa8_renderStates[0].x18_camDist - delta);
|
||||
@@ -646,6 +649,8 @@ void CAutoMapper::ProcessMapZoomInput(const CFinalInput& input, const CStateMana
|
||||
x324_zoomState = EZoomState::Out;
|
||||
}
|
||||
|
||||
if (oldDist == xa8_renderStates[0].x18_camDist)
|
||||
m_mapScroll.delta[1] = 0.0;
|
||||
SetShouldZoomingSoundBePlaying(oldDist != xa8_renderStates[0].x18_camDist);
|
||||
}
|
||||
|
||||
@@ -657,7 +662,8 @@ void CAutoMapper::ProcessMapPanInput(const CFinalInput& input, const CStateManag
|
||||
|
||||
bool mouseHeld = false;
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[int(boo::EMouseButton::Secondary)]) {
|
||||
mouseHeld = true;
|
||||
if (float(m_mouseDelta.x()) < 0.f)
|
||||
right += -m_mouseDelta.x();
|
||||
|
||||
@@ -421,14 +421,14 @@ static bool PointInsideCircle(const zeus::CVector2f& point, const Circle2& circ,
|
||||
return intersect <= 0.f;
|
||||
}
|
||||
|
||||
static Circle2 UpdateSupport1(int idx, zeus::CVector2f** list, Support& support) {
|
||||
static Circle2 UpdateSupport1(int idx, const zeus::CVector2f** list, Support& support) {
|
||||
Circle2 ret = ExactCircle2(list[support.x4_[0]], list[idx]);
|
||||
support.x0_ = 2;
|
||||
support.x4_[1] = idx;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Circle2 UpdateSupport2(int idx, zeus::CVector2f** list, Support& support) {
|
||||
static Circle2 UpdateSupport2(int idx, const zeus::CVector2f** list, Support& support) {
|
||||
Circle2 circs[3] = {};
|
||||
float intersect;
|
||||
int circIdx = -1;
|
||||
@@ -441,12 +441,11 @@ static Circle2 UpdateSupport2(int idx, zeus::CVector2f** list, Support& support)
|
||||
}
|
||||
|
||||
circs[1] = ExactCircle2(list[support.x4_[1]], list[idx]);
|
||||
if (circs[1].x8_radiusSq < minRad && PointInsideCircle(*list[support.x4_[1]], circs[1], intersect)) {
|
||||
minRad = circs[1].x8_radiusSq;
|
||||
if (circs[1].x8_radiusSq < minRad && PointInsideCircle(*list[support.x4_[0]], circs[1], intersect)) {
|
||||
circIdx = 1;
|
||||
}
|
||||
|
||||
Circle2 ret = {};
|
||||
Circle2 ret;
|
||||
if (circIdx != -1) {
|
||||
ret = circs[circIdx];
|
||||
support.x4_[1 - circIdx] = idx;
|
||||
@@ -458,7 +457,7 @@ static Circle2 UpdateSupport2(int idx, zeus::CVector2f** list, Support& support)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Circle2 UpdateSupport3(int idx, zeus::CVector2f** list, Support& support) {
|
||||
static Circle2 UpdateSupport3(int idx, const zeus::CVector2f** list, Support& support) {
|
||||
Circle2 circs[6] = {};
|
||||
float intersect;
|
||||
int circIdxA = -1;
|
||||
@@ -576,15 +575,15 @@ static Circle2 UpdateSupport3(int idx, zeus::CVector2f** list, Support& support)
|
||||
return circs[circIdxA];
|
||||
}
|
||||
|
||||
typedef Circle2 (*FSupport)(int idx, zeus::CVector2f** list, Support& support);
|
||||
typedef Circle2 (*FSupport)(int idx, const zeus::CVector2f** list, Support& support);
|
||||
static const FSupport SupportFuncs[] = {nullptr, UpdateSupport1, UpdateSupport2, UpdateSupport3};
|
||||
|
||||
static Circle MinCircle(const std::vector<zeus::CVector2f>& coords) {
|
||||
Circle2 ret = {};
|
||||
if (coords.size() >= 1) {
|
||||
std::unique_ptr<zeus::CVector2f*[]> randArr(new zeus::CVector2f*[coords.size()]);
|
||||
std::unique_ptr<const zeus::CVector2f*[]> randArr(new const zeus::CVector2f*[coords.size()]);
|
||||
for (int i = 0; i < coords.size(); ++i)
|
||||
randArr[i] = const_cast<zeus::CVector2f*>(&coords[i]);
|
||||
randArr[i] = &coords[i];
|
||||
for (int i = coords.size() - 1; i >= 0; --i) {
|
||||
int shuf = rand() % (i + 1);
|
||||
if (shuf != i)
|
||||
|
||||
@@ -158,7 +158,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||
m_lastMouseCoord = mouseCoord;
|
||||
mouseDelta.x() *= g_Viewport.aspect;
|
||||
mouseDelta *= 100.f;
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[int(boo::EMouseButton::Secondary)]) {
|
||||
if (float(mouseDelta.x()) < 0.f)
|
||||
moveRight += -mouseDelta.x();
|
||||
else if (float(mouseDelta.x()) > 0.f)
|
||||
@@ -168,7 +169,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||
else if (float(mouseDelta.y()) > 0.f)
|
||||
moveBack += mouseDelta.y();
|
||||
}
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)]) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (float(mouseDelta.x()) < 0.f)
|
||||
circleRight += -mouseDelta.x();
|
||||
else if (float(mouseDelta.x()) > 0.f)
|
||||
|
||||
@@ -204,7 +204,7 @@ CPFRegion* CPFArea::FindClosestRegion(const zeus::CVector3f& point, u32 flags, u
|
||||
CPFRegion* ret = nullptr;
|
||||
for (rstl::prereserved_vector<CPFRegion*>* list : regionListList) {
|
||||
for (CPFRegion* region : *list) {
|
||||
if (region->Data()->GetCookie() != x34_curCookie) {
|
||||
if (region->Data()->GetCookie() != x34_regionFindCookie) {
|
||||
if (region->GetFlags() & 0xff & flags && (region->GetFlags() >> 16) & 0xff & indexMask &&
|
||||
region->IsPointInsidePaddedAABox(point, padding) && (isFlyer || region->PointHeight(point) < 3.f)) {
|
||||
if (region->FindBestPoint(x10_tmpPolyPoints, point, flags, padding * padding)) {
|
||||
@@ -215,10 +215,11 @@ CPFRegion* CPFArea::FindClosestRegion(const zeus::CVector3f& point, u32 flags, u
|
||||
x4_closestPoint = region->Data()->GetBestPoint();
|
||||
}
|
||||
}
|
||||
region->Data()->SetCookie(x34_curCookie);
|
||||
region->Data()->SetCookie(x34_regionFindCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
++x34_regionFindCookie;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class CPFArea {
|
||||
rstl::prereserved_vector<CPFRegion*>* x20_cachedRegionList = nullptr;
|
||||
zeus::CVector3f x24_cachedRegionListPoint;
|
||||
bool x30_hasCachedRegionList = false;
|
||||
s32 x34_curCookie = 0;
|
||||
s32 x34_regionFindCookie = 0;
|
||||
CPFBitSet x38_closedSet;
|
||||
CPFOpenList x78_openList;
|
||||
// u32 x138_;
|
||||
|
||||
Reference in New Issue
Block a user