Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on December 16, 2010, 11:24:22 am

Title: 24*24 sprites?
Post by: aeTIos on December 16, 2010, 11:24:22 am
hi,

is there a good way for displaying 24*24 sprites without changing the hex code? because changing hex code for 24*24 is a lot of work :P
Title: Re: 24*24 sprites?
Post by: Runer112 on December 16, 2010, 11:47:22 am
There would be a way to shuffle around the sprite data at runtime, although that would result in unnecessary code bloating. The best thing to do is to just change the hex code yourself.

How many 24x24 sprites do you have? If it's only a few, you can probably just rearrange it manually. Alternatively, if you post the hex here, I'm sure someone can help you out with rearranging the hex. I would certainly try to help.

EDIT: If you have bitmaps of the sprites, those would probably provide the easiest way to convert the sprite into multiple 8x8 sprites.

EDIT 2: If you would rather shuffle around the sprite data at runtime, I wrote a routine to do this. The following code will take a 24x24 sprite at Pic1, form its equivalent 8x8 sprites at L₁, and then copy these back to Pic1. The resulting 9 sprites will occur in this order:

Code: [Select]
Pic1-3→P
L₁-1→O
3+1
While -1→A
24+1
While -1→B
{P+3→P}→{O+1→O}
B
End
P-72+1→P
A
End
conj(L₁,Pic1,72)

The routine is 99 bytes. Although it isn't too large, I myself would pre-rearrange the data and avoid the need for it.
Title: Re: 24*24 sprites?
Post by: Ti-DkS on December 16, 2010, 12:09:37 pm
Hi ! For my Metroid, where my Samus' sprites are 24*24 ones I display 4 8*8 sprites in square shape. At the moment it's the faster way I found... :D
Title: Re: 24*24 sprites?
Post by: aeTIos on December 16, 2010, 01:20:57 pm
Never mind, i found it just out myself:
Code: [Select]
[store pic info here]->pic1
0->X->Y
For(A,0,23
{A*3+Pic1}r->{A+Y*12+L6+X}r
{A*3+Pic1+2}->{A+Y*12+L6+X+2}
End
DispGraph
Repeat getKey
End
I think this is less than yours, Runer...
EDIT: compiled is it 202 bytes, without the picture information
Title: Re: 24*24 sprites?
Post by: Runer112 on December 16, 2010, 03:16:05 pm
Oh, I thought you wanted to split it up into 8x8 sprites so you could then use the built-in sprite routine to draw an array of 8x8 sprites. If you're fine with just copying the 24x24 sprites aligned to byte boundaries on the buffer, then may I suggest a routine like the following:

Syntax: sub(24S, Column (0-9), Row (0-40), Sprite pointer)

Code: (Size optimized, 59 bytes, ~0.0014 seconds at 6MHz) [Select]
Lbl 24S
  24+1
  Lbl 24L
  Return!If -1→r₄
  Copy(-1*3+r₃,r₄+r₂*12+r₁-12+L₆,3)
  r₄
Goto 24L

Code: (Speed optimized, 76 bytes, ~0.0011 seconds at 6MHz) [Select]
Lbl 24S
  +72→r₄
  ⁻()→r₅
  r₂*12+r₁-12+L₆→r₆
  r₃
  Lbl 24L
  Return!If +r₅
  Copy(+r₄,r₆+12→r₆,3)
Goto 24L