projects
/
gbajam21
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae9f843
)
test sprite scaling
master
author
John Tsiombikas
<nuclear@member.fsf.org>
Fri, 28 May 2021 07:48:40 +0000
(10:48 +0300)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Fri, 28 May 2021 07:48:40 +0000
(10:48 +0300)
src/gamescr.c
patch
|
blob
|
history
diff --git
a/src/gamescr.c
b/src/gamescr.c
index
023114b
..
5a84ee6
100644
(file)
--- 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 int32_t tunrot;
static int32_t tunmat[4], tunx, tuny;
+static int rune_dist = 16;
+
void gamescr(void)
{
int i;
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_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;
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));
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);
spr_transform(oam, 0, mat);