Author Topic: 24*24 sprites?  (Read 3926 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
24*24 sprites?
« 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
I'm not a nerd but I pretend:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 24*24 sprites?
« Reply #1 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:
  • Top-left
  • Middle-left
  • Bottom-left
  • Top-center
  • Middle-center
  • Bottom-center
  • Top-right
  • Middle-right
  • Bottom-right

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.
« Last Edit: December 16, 2010, 12:28:05 pm by Runer112 »

Offline Ti-DkS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 143
  • Rating: +21/-1
  • In retro, we trust !
    • View Profile
Re: 24*24 sprites?
« Reply #2 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

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: 24*24 sprites?
« Reply #3 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
« Last Edit: December 16, 2010, 01:26:20 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 24*24 sprites?
« Reply #4 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
« Last Edit: December 21, 2010, 05:05:11 pm by Runer112 »