summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/BPStructs.cpp
diff options
context:
space:
mode:
authorcrudelios <crudelios@gmail.com>2014-01-25 15:36:23 +0000
committercrudelios <crudelios@gmail.com>2014-01-25 15:36:23 +0000
commitcdfe58f7ede09ff11b13adf5a911da5a50927870 (patch)
tree2bfa5648dd67b949ed0b807e5f1707bcb6e59e2a /Source/Core/VideoCommon/BPStructs.cpp
parentdd42af9a7cf21420be028d6c9261dc3d0b361f73 (diff)
Rewrote bounding box algotithm. Fixes issues 5967, 6154, 6196, 6211.
Instead of being vertex-based, it is now primitive (point, line or dissected triangle) based, with proper clipping. Also, screen position is now calculated based on viewport values, instead of "guesstimating". This fixes many graphical glitches in Paper Mario: TTYD and Super Paper Mario. Also, the new code allows Mickey's Magical Mirror and Disney's Hide & Sneak to work (mostly) bug-free. I changed their inis to use bbox. These changes have a slight cost in performance when bbox is being used (rare), mostly due to the new clipping algorithm. Please check for any regressions or crashes.
Diffstat (limited to 'Source/Core/VideoCommon/BPStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 0a06829626..5482dae102 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -372,35 +372,15 @@ void BPWritten(const BPCmd& bp)
// -------------------------
case BPMEM_CLEARBBOX1:
case BPMEM_CLEARBBOX2:
+ // Don't compute bounding box if this frame is being skipped!
+ // Wrong but valid values are better than bogus values...
+ if (g_ActiveConfig.bUseBBox && !g_bSkipCurrentFrame)
{
- if(g_ActiveConfig.bUseBBox)
- {
- // Don't compute bounding box if this frame is being skipped!
- // Wrong but valid values are better than bogus values...
- if(g_bSkipCurrentFrame)
- break;
-
- if (bp.address == BPMEM_CLEARBBOX1)
- {
- int right = bp.newvalue >> 10;
- int left = bp.newvalue & 0x3ff;
+ u8 offset = bp.address & 2;
- // We should only set these if bbox is calculated properly.
- PixelEngine::bbox[0] = left;
- PixelEngine::bbox[1] = right;
- PixelEngine::bbox_active = true;
- }
- else
- {
- int bottom = bp.newvalue >> 10;
- int top = bp.newvalue & 0x3ff;
-
- // We should only set these if bbox is calculated properly.
- PixelEngine::bbox[2] = top;
- PixelEngine::bbox[3] = bottom;
- PixelEngine::bbox_active = true;
- }
- }
+ PixelEngine::bbox[offset] = bp.newvalue & 0x3ff;
+ PixelEngine::bbox[offset | 1] = bp.newvalue >> 10;
+ PixelEngine::bbox_active = true;
}
break;
case BPMEM_TEXINVALIDATE: