diff options
Diffstat (limited to 'src/apDebug.cpp')
-rw-r--r-- | src/apDebug.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/apDebug.cpp b/src/apDebug.cpp index f485474..ee31c28 100644 --- a/src/apDebug.cpp +++ b/src/apDebug.cpp @@ -241,4 +241,72 @@ void APDebugDrawer::drawXlu() { p = p->next; } + + + // Now, the hardest one.. CollisionMgr_c! + fBase_c *fb = 0; + while ((fb = fBase_c::searchByBaseType(2, fb))) { + u8 *testMe = ((u8*)fb) + 0x1EC; + if (*((u32*)testMe) != 0x8030F6D0) + continue; + + u32 uptr = (u32)fb; + u8 r = u8((uptr>>16)&0xFF)+0x20; + u8 g = u8((uptr>>8)&0xFF)-0x30; + u8 b = u8(uptr&0xFF)+0x80; + u8 a = 0xFF; + + dStageActor_c *ac = (dStageActor_c*)fb; + + sensorBase_s *sensors[4] = { + ac->collMgr.pBelowInfo, ac->collMgr.pAboveInfo, + ac->collMgr.pAdjacentInfo, ac->collMgr.pAdjacentInfo}; + + for (int i = 0; i < 4; i++) { + sensorBase_s *s = sensors[i]; + if (!s) + continue; + + float mult = (i == 3) ? -1.0f : 1.0f; + + switch (s->flags & SENSOR_TYPE_MASK) { + case SENSOR_POINT: + GXBegin(GX_POINTS, GX_VTXFMT0, 1); + GXPosition3f32( + ac->pos.x + (mult * (s->asPoint()->x / 4096.0f)), + ac->pos.y + (s->asPoint()->y / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXEnd(); + break; + case SENSOR_LINE: + GXBegin(GX_LINES, GX_VTXFMT0, 2); + if (i < 2) { + GXPosition3f32( + ac->pos.x + (s->asLine()->lineA / 4096.0f), + ac->pos.y + (s->asLine()->distanceFromCenter / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32( + ac->pos.x + (s->asLine()->lineB / 4096.0f), + ac->pos.y + (s->asLine()->distanceFromCenter / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + } else { + GXPosition3f32( + ac->pos.x + (mult * (s->asLine()->distanceFromCenter / 4096.0f)), + ac->pos.y + (s->asLine()->lineA / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + GXPosition3f32( + ac->pos.x + (mult * (s->asLine()->distanceFromCenter / 4096.0f)), + ac->pos.y + (s->asLine()->lineB / 4096.0f), + 8005.0f); + GXColor4u8(r,g,b,a); + } + GXEnd(); + break; + } + } + } } |