From 1f32c30da69e111c974527c0469db8753e1fcc38 Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Sun, 1 Sep 2024 17:31:46 +0200 Subject: [PATCH] draw_stripe : Domptage du gremelin --- src/moteur.c | 3 +++ src/moteur.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/moteur.c b/src/moteur.c index dce8a77..3bfa2a1 100644 --- a/src/moteur.c +++ b/src/moteur.c @@ -180,6 +180,7 @@ inline void __attribute__((always_inline)) draw_stripe(image_t *tex, int texSamp : "=r" (oneConst) : "r" (oneConst) ); + register int maxConst asm("r13") = viewport_w*viewport_h; for(int texPos = texSampleY; texPos < 64; ++texPos){ if(screenPos >= -texSize){ int vrampos = ffloor(screenPos)*vramSize+x; @@ -189,6 +190,8 @@ inline void __attribute__((always_inline)) draw_stripe(image_t *tex, int texSamp gint_vram[vrampos] = pix; vrampos += vramSize; oldPos += oneConst; + if(vrampos >= maxConst) + return; }while(oldPos < screenPos+texSize); } screenPos += texSize; diff --git a/src/moteur.h b/src/moteur.h index 11b8303..ef01e34 100644 --- a/src/moteur.h +++ b/src/moteur.h @@ -10,7 +10,7 @@ #define screen_w 396 #define screen_h 224 #define viewport_w 396 -#define viewport_h 224 +#define viewport_h 200 #define max_dist fix(32) //en tuiles << 16, actuellement 32 #define TINDEX_S 256