From e871156301e08b7e400f767a3be806ccf32bd85e Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 22 Aug 2023 20:09:14 +0200 Subject: [PATCH] port: reduce or eliminate portal seams by slightly extending the portal scissor boxes --- src/game/bg.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/game/bg.c b/src/game/bg.c index 1e9257e52..5aaf0dbcf 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -46,6 +46,7 @@ #ifndef PLATFORM_N64 #include "preprocess.h" #include "system.h" +#include "video.h" #endif #define BGCMD_END 0x00 @@ -2221,6 +2222,19 @@ Gfx *bgScissorWithinViewportF(Gfx *gdl, f32 viewleft, f32 viewtop, f32 viewright Gfx *bgScissorWithinViewport(Gfx *gdl, s32 viewleft, s32 viewtop, s32 viewright, s32 viewbottom) { +#ifndef PLATFORM_N64 + const s32 xmargin = videoGetWidth() / SCREEN_320 - 1; + const s32 ymargin = videoGetHeight() / SCREEN_240 - 1; + if (xmargin > 0) { + viewleft -= xmargin; + viewright += xmargin; + } + if (ymargin > 0) { + viewtop -= ymargin; + viewbottom += ymargin; + } +#endif + if (viewleft < g_Vars.currentplayer->viewleft) { viewleft = g_Vars.currentplayer->viewleft; }