From: John Tsiombikas Date: Fri, 28 May 2021 07:48:40 +0000 (+0300) Subject: test sprite scaling X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=gbajam21;a=commitdiff_plain;h=e0ad011e797f4c9b789fb0be457e52fbe322202c test sprite scaling --- diff --git a/src/gamescr.c b/src/gamescr.c index 023114b..5a84ee6 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -27,6 +27,8 @@ static unsigned char rot; static int32_t tunrot; static int32_t tunmat[4], tunx, tuny; +static int rune_dist = 16; + void gamescr(void) { int i; @@ -199,8 +201,14 @@ static void vblank(void) if(bnstate & BN_LEFT) x -= gate_speed; if(bnstate & BN_RIGHT) x += gate_speed; - if(bnstate & BN_UP) y -= gate_speed; - if(bnstate & BN_DOWN) y += gate_speed; + if(bnstate & BN_UP) { + rune_dist += 2; + if(rune_dist > 0xff) rune_dist = 0xff; + } + if(bnstate & BN_DOWN) { + rune_dist -= 2; + if(rune_dist < 8) rune_dist = 8; + } if(x < 0) x = 0; if(x > 239) x = 239; @@ -217,10 +225,10 @@ static void vblank(void) spr_oam(oam, 0, 512, x - 64, y - 64, SPR_SZ64 | SPR_DBLSZ | SPR_ROTSCL | SPR_ROTSCL_SEL(0)); - mat[0] = COS(rot); - mat[1] = -SIN(rot); - mat[2] = SIN(rot); - mat[3] = COS(rot); + mat[0] = COS(rot) * rune_dist >> 4; + mat[1] = -SIN(rot) * rune_dist >> 4; + mat[2] = SIN(rot) * rune_dist >> 4; + mat[3] = COS(rot) * rune_dist >> 4; spr_transform(oam, 0, mat);