21 February 2016, 22:00 | #1 |
Registered User
Join Date: Aug 2012
Location: RAM:
Posts: 83
|
Sprite issues
Trying to learn Amiga C programming and I've run into an issue when displaying my hardware sprite. I am using this as a basis:
http://wiki.amigaos.net/wiki/Hardwar...Sprite_Example Trying to adapt this example to a 32-color palette, and use a sprite drawn with that palette. I used sprite 2, so colors 20-23. The palette was exported to C source with PPaint, the sprite too, and this is the result when it is displayed (see attached image) Sprite on the left, the correct brush I exported from is on the right. Full source here: http://pastebin.com/P2JaN0MW It does get the proper palette index, but the data is all jumbled around. Why is that? Should some special tool be used? I've tried exporting in PPaint, PicConv, ArtPro etc, sprite data is of course the same. Edit: I realised after posting, that the brush probably must be two bitplanes in depth. I re-saved it and the data was different, but the sprite still looks messed up. Last edited by attle; 22 February 2016 at 06:18. Reason: fixed image |
22 February 2016, 09:45 | #2 |
Registered User
Join Date: Oct 2013
Location: Hamburg
Posts: 69
|
Your data:
Code:
| ..############.. | | .##############. | | ################ | | ################ | | ################ | | ################ | | ################ | | .##############. | | .##############. | | ..############.. | | ...#........#... | | ..###......###.. | | ..####....####.. | | ..#..........#.. | | ...#..#..#..#... | | ....#.#..#.#.... | | ..############.. | | .#............#. | | #..###....###..# | | #..............# | | #.####....####.# | | ###..######..### | | #.####....####.# | | .#............#. | | .##...####...##. | | ..##........##.. | | ...##########... | | ..#..######..#.. | | ..#...####...#.. | | ..############.. | | ...##########... | | ....###..###.... | |
22 February 2016, 12:53 | #3 |
Registered User
Join Date: Aug 2012
Location: RAM:
Posts: 83
|
Yes, that's it.
If the image is reduced to one bitplane in PPaint instead, with the two sprite bitplanes laid out beside each other, and THEN exported as a brush to source, it works (thanks Menthos!) Kind of a hassle to draw sprites that way though! Is there really no tool for this? |
22 February 2016, 16:57 | #4 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
PicCon can save brushes as raw sprite data, you can find it on Aminet.
|
23 February 2016, 09:28 | #5 |
Registered User
Join Date: Aug 2012
Location: RAM:
Posts: 83
|
PicCon almost does what I want, but it saves the data in a ULONG array instead of UWORD. Not a big deal to fix in a text editor, but I may end up writing my own converter.
|
23 February 2016, 13:23 | #6 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
|
23 February 2016, 13:46 | #7 |
Registered User
Join Date: Aug 2012
Location: RAM:
Posts: 83
|
Maybe, I didn't try just casting to UWORD so I don't know if it will work.
http://amigadev.elowar.com/read/ADCD.../node00C5.html |
23 February 2016, 14:26 | #8 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
It doesn't matter what type it's declared as or casted from, as long as the data is in the right place and has the right format it will work. If you open the image settings panel then you can select sprite format and check the CTRLwords setting, and it will export as UWORD.
A better way is to export to object format and just pass it to the linker instead, that way you don't have to include your graphics as large arrays into your source code. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Settlers sprite | zdechlak | project.Sprites | 1 | 02 March 2019 10:55 |
Sprite collision help | Shatterhand | Coders. Blitz Basic | 8 | 12 December 2015 23:02 |
sprite overscan | jamiejamie | Coders. General | 11 | 02 February 2011 16:59 |
DIWSTART and sprite | Camionsauro | Coders. Tutorials | 3 | 22 April 2009 13:24 |
|
|