diff options
| author | Trueffel <106771418+Trueffeloot@users.noreply.github.com> | 2025-11-15 17:37:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-15 18:37:50 +0200 |
| commit | 8799ed141d040447bc96ea6b971a22f7f6e923ed (patch) | |
| tree | f7ffeaf503737e4a15f3fc7961680687ebe95397 /src/d/d_menu_collect.cpp | |
| parent | fad2f41e33905926b768d16422371f1e1b63843d (diff) | |
Match remaining functions in d_menu_collect (#2809)
* match all funcs in d_menu_collect
* remove old nonmatching comments
Diffstat (limited to 'src/d/d_menu_collect.cpp')
| -rw-r--r-- | src/d/d_menu_collect.cpp | 144 |
1 files changed, 71 insertions, 73 deletions
diff --git a/src/d/d_menu_collect.cpp b/src/d/d_menu_collect.cpp index 161880df66..a9743414fa 100644 --- a/src/d/d_menu_collect.cpp +++ b/src/d/d_menu_collect.cpp @@ -729,8 +729,7 @@ void dMenu_Collect2D_c::setBackAlpha() { /* 801B1FAC-801B27EC 1AC8EC 0840+00 1/1 0/0 0/0 .text cursorMove__17dMenu_Collect2D_cFv */ -// NONMATCHING -// goto logic is wrong +// Not sure if this works without gotos void dMenu_Collect2D_c::cursorMove() { u8 dVar1 = mCursorX; u8 dVar2 = mCursorY; @@ -797,30 +796,27 @@ void dMenu_Collect2D_c::cursorMove() { LAB_802ba744: if (mpStick->checkUpTrigger()) { if (mCursorY != 0) { - bool bVar3; - restart_loop: - do { - mCursorY--; - if (mCursorY == 2) { - u8 local_3c[9] = {3,3,4,3,4,5,4,5,5}; - u8 local_48[9] = {2,1,2,0,1,2,0,1,0}; - for (int i = 0; i < 9; i++) { - if (getItemTag(local_3c[i], local_48[i], true)) { - mCursorX = local_3c[i]; - mCursorY = local_48[i]; - break; - } + begin: + mCursorY--; + if (mCursorY == 2) { + u8 local_3c[9] = {3,3,4,3,4,5,4,5,5}; + u8 local_48[9] = {2,1,2,0,1,2,0,1,0}; + for (int i = 0; i < 9; i++) { + if (getItemTag(local_3c[i], local_48[i], true)) { + mCursorX = local_3c[i]; + mCursorY = local_48[i]; + break; } } - if (dVar2 == 5) { - - if (dVar1 == 0) { - if (field_0x25a < 5) { - mCursorX = field_0x259; - mCursorY = field_0x25a; - break; - } - bVar3 = false; + } + if (dVar2 == 5) { + if (dVar1 == 0) { + if (field_0x25a < 5) { + mCursorX = field_0x259; + mCursorY = field_0x25a; + goto LAB_802bab54; + } else { + bool bVar3 = false; for (int i = 0; i < 4; i++) { if (getItemTag(i, mCursorY, true)) { mCursorX = i; @@ -834,73 +830,77 @@ LAB_802ba744: bVar3 = true; } if (bVar3) { - break; + goto LAB_802bab54; } - goto restart_loop; - } - if (field_0x25a < 5) { - mCursorX = field_0x259; - mCursorY = field_0x25a; - break; } - bVar3 = false; + } else if (field_0x25a < 5) { + mCursorX = field_0x259; + mCursorY = field_0x25a; + goto LAB_802bab54; + } else { + bool bVar4 = false; for (int i = 3; i < 7; i++) { if (getItemTag(i, mCursorY, true)) { mCursorX = i; - bVar3 = true; + bVar4 = true; break; } } if (mCursorY == 0) { mCursorX = dVar1; mCursorY = dVar2; - bVar3 = true; + bVar4 = true; + } + if (bVar4) { + goto LAB_802bab54; } } - } while (!bVar3); - if (!getItemTag(mCursorX, mCursorY, true)) { + goto begin; + } else { + if (getItemTag(mCursorX, mCursorY, true)) { + goto LAB_802bab54; + } if (mCursorY != 0) { - goto restart_loop; + goto begin; } + mCursorY = dVar2; } - mCursorY = dVar2; } - } else { - if (mpStick->checkDownTrigger()) { - if (mCursorY < 4) { - do { - mCursorY++; - if (mCursorY == 3) { - u8 local_50[8] = {3, 2, 3, 1, 2, 0, 1, 0}; - u8 local_58[8] = {3, 3, 4, 3, 4, 3, 4, 4}; - for (int i = 0; i < 8; i++) { - if (getItemTag(local_50[i], local_58[i], true)) { - mCursorX = local_50[i]; - mCursorY = local_58[i]; - break; - } + } else if (mpStick->checkDownTrigger()) { + if (mCursorY < 4) { + do { + mCursorY++; + if (mCursorY == 3) { + u8 local_50[8] = {3, 2, 3, 1, 2, 0, 1, 0}; + u8 local_58[8] = {3, 3, 4, 3, 4, 3, 4, 4}; + for (int i = 0; i < 8; i++) { + if (getItemTag(local_50[i], local_58[i], true)) { + mCursorX = local_50[i]; + mCursorY = local_58[i]; + break; } } - if (getItemTag(mCursorX, mCursorY, true)) { - goto LAB_802bab54; - } - } while (mCursorY < 4); - mCursorY = 5; - if (mCursorX <= 2) { - mCursorX = 0; - } else { - mCursorX = 1; } - } else if (mCursorY == 4) { - mCursorY = 5; - if (mCursorX <= 3) { - mCursorX = 0; - } else { - mCursorX = 1; + if (getItemTag(mCursorX, mCursorY, true)) { + goto LAB_802bab54; } + } while (mCursorY < 4); + mCursorY = 5; + if (mCursorX <= 2) { + mCursorX = 0; + } else { + mCursorX = 1; + } + } else if (mCursorY == 4) { + mCursorY = 5; + if (mCursorX <= 3) { + mCursorX = 0; + } else { + mCursorX = 1; } } } + LAB_802bab54: if (mCursorX != dVar1 || mCursorY != dVar2) { field_0x259 = dVar1; @@ -2594,22 +2594,20 @@ void dMenu_Collect3D_c::setupItem3D(Mtx param_0) { /* 801B7660-801B774C 1B1FA0 00EC+00 1/1 0/0 0/0 .text toItem3Dpos__17dMenu_Collect3D_cFfffP4cXyz */ -// NONMATCHING -// This is mostly matching like this using O2 but still regalloc (f29/f31). The main issue is the use of dVar12 #pragma push #pragma optimization_level 2 void dMenu_Collect3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz* param_3) { Mtx adStack_98; Mtx auStack_c8; - f32 dVar7 = + param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f); - f32 dVar11 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f); + param_1 = (2.0f * ((param_1 - -100.0f) / 448.0f) - 1.0f); calcViewMtx(adStack_98); MTXInverse(adStack_98, auStack_c8); f32 tangent = tan(0.39269909262657166); f32 dVar12 = -param_2; - cXyz cStack_d4((dVar7 * param_2) * (mDoGph_gInf_c::getAspect() * tangent), - (tangent * (dVar11 * dVar12)), dVar12); + cXyz cStack_d4((param_0 * param_2) * (mDoGph_gInf_c::getAspect() * tangent), + (tangent * (param_1 * dVar12)), dVar12); MTXMultVec(auStack_c8, &cStack_d4, param_3); } #pragma pop |
