match Creature::drawLODInfo

This commit is contained in:
PikHacker 2024-01-09 20:23:17 -05:00
parent 8053184f94
commit d3b5349c6f
2 changed files with 34 additions and 208 deletions

View File

@ -92,10 +92,10 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/flockMgr.cpp">flockMgr.cpp</a> | 7469 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellIterator.cpp">cellIterator.cpp</a> | 9325 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgrTraceMove.cpp">mapMgrTraceMove.cpp</a> | 9736 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 10813 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 11601 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemHole.cpp">itemHole.cpp</a> | 11707 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemHoney.cpp">itemHoney.cpp</a> | 12288 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemBigFountain.cpp">itemBigFountain.cpp</a> | 12667 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBreakGate.cpp">aiBreakGate.cpp</a> | 13962 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureLOD.cpp">creatureLOD.cpp</a> | 14138 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgrTraceMove.cpp">mapMgrTraceMove.cpp</a> | 9736 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureLOD.cpp">creatureLOD.cpp</a> | 10051 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 10813 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 11601 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemHole.cpp">itemHole.cpp</a> | 11707 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemHoney.cpp">itemHoney.cpp</a> | 12288 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemBigFountain.cpp">itemBigFountain.cpp</a> | 12667 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBreakGate.cpp">aiBreakGate.cpp</a> | 13962 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/texCaster.cpp">texCaster.cpp</a> | 14405 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCaveInfo.cpp">gameCaveInfo.cpp</a> | 15260 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 15455 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemRock.cpp">itemRock.cpp</a> | 17251 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemCave.cpp">itemCave.cpp</a> | 20160 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 20316 |

View File

@ -8,6 +8,8 @@
namespace Game {
bool AILOD::drawInfo;
/**
* @note Address: 0x801D7808
* @note Size: 0x1C
@ -42,17 +44,19 @@ void Creature::updateLOD(Game::AILODParm& parm)
if (parm.mIsCylinder) {
getLODCylinder(lodCylinder);
}
mLod.mFlags = AILOD_NULL;
int iStack[2];
int* pi = iStack;
bool shouldCull = true; // set to false if visible on any viewport
int v11 = 2;
// gonna have to play with the order of these probably
mLod.mFlags = AILOD_NULL;
bool shouldCull = true; // set to false if visible on any viewport
int vpStats[2];
Graphics* gfx = sys->mGfx;
int viewportCount = gfx->mActiveViewports;
int currFlag = 2;
for (int i = 0; i < viewportCount; i++) {
Viewport* vp = gfx->getViewport(i);
if (!vp->viewable()) {
*pi = 2;
vpStats[i] = 2;
} else {
Camera* camera = vp->mCamera;
if (parm.mIsCylinder) {
@ -69,19 +73,18 @@ void Creature::updateLOD(Game::AILODParm& parm)
f32 screenSize = camera->calcScreenSize(lodSphere);
if (screenSize > parm.mFar) {
*pi = 0;
vpStats[i] = 0;
} else {
if (screenSize > parm.mClose) {
*pi = 1;
vpStats[i] = 1;
} else {
*pi = 2;
vpStats[i] = 2;
}
}
if (*pi < v11) {
v11 = *pi;
if (vpStats[i] < currFlag) {
currFlag = vpStats[i];
}
}
pi++;
}
if (!(gameSystem->isMultiplayerMode() && (2 <= viewportCount))) {
@ -99,7 +102,7 @@ void Creature::updateLOD(Game::AILODParm& parm)
P2ASSERTLINE(176, vp1->mCamera);
Vector3f pos0 = *vp0->mCamera->getSoundPositionPtr();
Vector3f pos1 = *vp1->mCamera->getSoundPositionPtr();
if (sqrDistance(pos1, lodSphere.mPosition) < sqrDistance(pos0, lodSphere.mPosition)) {
if (pos1.sqrDistance(lodSphere.mPosition) < pos0.sqrDistance(lodSphere.mPosition)) {
mLod.mSndVpId = 0;
} else {
mLod.mSndVpId = 1;
@ -107,18 +110,20 @@ void Creature::updateLOD(Game::AILODParm& parm)
}
}
}
for (int i = 0; i < viewportCount; i++) {
gfx->getViewport(i)->viewable();
}
mLod.mFlags |= (u8)v11;
mLod.setFlag((u8)currFlag);
if (!shouldCull) {
mLod.mFlags |= AILOD_IsVisible;
mLod.setFlag(AILOD_IsVisible);
} else {
mLod.mFlags = AILOD_IsFar;
mLod.mFlags = (AILOD_IsFar);
}
if (0 < getCellPikiCount()) {
mLod.mFlags |= AILOD_PikiInCell;
mLod.setFlag(AILOD_PikiInCell);
}
/*
stwu r1, -0xa0(r1)
mflr r0
@ -418,7 +423,7 @@ void Creature::drawLODInfo(Graphics& gfx, Vector3f& position)
gfx.initPerspPrintf(gfx.mCurrentViewport);
const char* nearnessLabels[] = { "near", "mid", "far" };
u8 nearness = mLod.mFlags & (AILOD_IsMid | AILOD_IsFar);
int nearness = mLod.mFlags & (AILOD_IsMid | AILOD_IsFar);
switch (nearness) {
case AILOD_NULL:
info.mColorA.set(0, 10, 255, 255);
@ -433,198 +438,19 @@ void Creature::drawLODInfo(Graphics& gfx, Vector3f& position)
info.mColorB.set(200, 200, 200, 255);
break;
}
const char* flag4Text = "_";
if (mLod.mFlags & AILOD_IsVisible) {
flag4Text = "p";
}
const char* vp1VisibilityText = "x";
if (mLod.mFlags & AILOD_IsVisVP1) {
vp1VisibilityText = "v";
}
const char* vp0VisibilityText = "x";
if (mLod.mFlags & AILOD_IsVisVP0) {
vp0VisibilityText = "v";
}
gfx.perspPrintf(info, position, "[%s%s %s %s]", vp0VisibilityText, vp1VisibilityText, flag4Text, nearnessLabels[nearness]);
gfx.perspPrintf(info, position, "[%s%s %s %s]", (mLod.isFlag(AILOD_IsVisVP0)) ? "v" : "x",
(mLod.isFlag(AILOD_IsVisVP1)) ? "v" : "x", (mLod.isFlag(AILOD_PikiInCell)) ? "p" : "_", nearnessLabels[nearness]);
Camera* camera0 = sys->mGfx->getViewport(0)->mCamera;
Vector3f sizeOnScreenTextPosition;
sizeOnScreenTextPosition.x = position.x;
sizeOnScreenTextPosition.y = position.y + 15.0f;
sizeOnScreenTextPosition.z = position.z;
sizeOnScreenTextPosition = position;
sizeOnScreenTextPosition.y += 15.0f;
Sys::Sphere lodSphere;
getLODSphere(lodSphere);
gfx.perspPrintf(info, sizeOnScreenTextPosition, "<%f>", camera0->calcScreenSize(lodSphere));
}
/*
stwu r1, -0x60(r1)
mflr r0
stw r0, 0x64(r1)
stw r31, 0x5c(r1)
mr r31, r5
stw r30, 0x58(r1)
mr r30, r4
stw r29, 0x54(r1)
mr r29, r3
stw r28, 0x50(r1)
lbz r0, drawInfo__Q24Game5AILOD@sda21(r13)
cmplwi r0, 0
beq lbl_801D7E1C
lwz r3, systemFont__9JFWSystem@sda21(r13)
li r6, 0
li r0, 0xff
li r5, 0x66
lfs f0, lbl_80519768@sda21(r2)
li r4, 0x99
stw r3, 0x30(r1)
mr r3, r30
stw r6, 0x34(r1)
stw r6, 0x38(r1)
stw r6, 0x3c(r1)
stfs f0, 0x40(r1)
stb r5, 0x44(r1)
stb r4, 0x45(r1)
stb r0, 0x46(r1)
stb r0, 0x47(r1)
stb r6, 0x48(r1)
stb r5, 0x49(r1)
stb r0, 0x4a(r1)
stb r0, 0x4b(r1)
lwz r4, 0x25c(r30)
bl initPerspPrintf__8GraphicsFP8Viewport
lbz r0, 0xd8(r29)
lis r3, lbl_804807E4@ha
lwzu r5, lbl_804807E4@l(r3)
clrlwi r0, r0, 0x1e
lwz r4, 4(r3)
cmpwi r0, 1
lwz r3, 8(r3)
stw r5, 0x24(r1)
stw r4, 0x28(r1)
stw r3, 0x2c(r1)
beq lbl_801D7CEC
bge lbl_801D7CAC
cmpwi r0, 0
bge lbl_801D7CB8
b lbl_801D7D4C
lbl_801D7CAC:
cmpwi r0, 3
bge lbl_801D7D4C
b lbl_801D7D1C
lbl_801D7CB8:
li r4, 0xff
li r3, 0xc8
li r6, 0
li r5, 0xa
stb r6, 0x44(r1)
stb r5, 0x45(r1)
stb r4, 0x46(r1)
stb r4, 0x47(r1)
stb r3, 0x48(r1)
stb r3, 0x49(r1)
stb r3, 0x4a(r1)
stb r4, 0x4b(r1)
b lbl_801D7D4C
lbl_801D7CEC:
li r5, 0xc8
li r3, 0xff
li r4, 0
stb r5, 0x44(r1)
stb r5, 0x45(r1)
stb r4, 0x46(r1)
stb r3, 0x47(r1)
stb r5, 0x48(r1)
stb r5, 0x49(r1)
stb r5, 0x4a(r1)
stb r3, 0x4b(r1)
b lbl_801D7D4C
lbl_801D7D1C:
li r6, 0xff
li r3, 0xc8
li r5, 0xa
li r4, 0
stb r6, 0x44(r1)
stb r5, 0x45(r1)
stb r4, 0x46(r1)
stb r6, 0x47(r1)
stb r3, 0x48(r1)
stb r3, 0x49(r1)
stb r3, 0x4a(r1)
stb r6, 0x4b(r1)
lbl_801D7D4C:
lbz r4, 0xd8(r29)
addi r9, r2, lbl_80519770@sda21
rlwinm. r3, r4, 0, 0x1c, 0x1c
beq lbl_801D7D60
addi r9, r2, lbl_8051976C@sda21
lbl_801D7D60:
rlwinm. r3, r4, 0, 0x1a, 0x1a
addi r8, r2, lbl_80519778@sda21
beq lbl_801D7D70
addi r8, r2, lbl_80519774@sda21
lbl_801D7D70:
rlwinm. r3, r4, 0, 0x1b, 0x1b
lis r4, lbl_804807F0@ha
addi r6, r4, lbl_804807F0@l
mr r5, r31
mr r3, r30
addi r4, r1, 0x30
addi r7, r2, lbl_80519778@sda21
beq lbl_801D7D94
addi r7, r2, lbl_80519774@sda21
lbl_801D7D94:
slwi r0, r0, 2
addi r10, r1, 0x24
lwzx r10, r10, r0
crclr 6
bl "perspPrintf__8GraphicsFR15PerspPrintfInfoR10Vector3<f>Pce"
lwz r3, sys@sda21(r13)
li r4, 0
lwz r3, 0x24(r3)
bl getViewport__8GraphicsFi
lwz r28, 0x44(r3)
mr r3, r29
lfs f1, 0(r31)
addi r4, r1, 8
lfs f0, lbl_8051977C@sda21(r2)
stfs f1, 0x18(r1)
lfs f1, 4(r31)
stfs f1, 0x1c(r1)
fadds f0, f1, f0
lfs f1, 8(r31)
stfs f1, 0x20(r1)
stfs f0, 0x1c(r1)
lwz r12, 0(r29)
lwz r12, 0x140(r12)
mtctr r12
bctrl
mr r3, r28
addi r4, r1, 8
bl calcScreenSize__6CameraFRQ23Sys6Sphere
mr r3, r30
addi r4, r1, 0x30
addi r5, r1, 0x18
addi r6, r2, lbl_80519780@sda21
crset 6
bl "perspPrintf__8GraphicsFR15PerspPrintfInfoR10Vector3<f>Pce"
lbl_801D7E1C:
lwz r0, 0x64(r1)
lwz r31, 0x5c(r1)
lwz r30, 0x58(r1)
lwz r29, 0x54(r1)
lwz r28, 0x50(r1)
mtlr r0
addi r1, r1, 0x60
blr
*/
}
} // namespace Game