English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 21 February 2016, 22:00   #1
attle
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.
Attached Images
 

Last edited by attle; 22 February 2016 at 06:18. Reason: fixed image
attle is offline  
Old 22 February 2016, 09:45   #2
losso
Registered User
 
losso's Avatar
 
Join Date: Oct 2013
Location: Hamburg
Posts: 69
Your data:

Code:
 | ..############.. | 
 | .##############. | 
 | ################ | 
 | ################ | 
 | ################ | 
 | ################ | 
 | ################ | 
 | .##############. | 
 | .##############. | 
 | ..############.. | 
 | ...#........#... | 
 | ..###......###.. | 
 | ..####....####.. | 
 | ..#..........#.. | 
 | ...#..#..#..#... | 
 | ....#.#..#.#.... | 
 | ..############.. | 
 | .#............#. | 
 | #..###....###..# | 
 | #..............# | 
 | #.####....####.# | 
 | ###..######..### | 
 | #.####....####.# | 
 | .#............#. | 
 | .##...####...##. | 
 | ..##........##.. | 
 | ...##########... | 
 | ..#..######..#.. | 
 | ..#...####...#.. | 
 | ..############.. | 
 | ...##########... | 
 | ....###..###.... |
…needs to be interleaved (currently, it’s one plane after the other). Does PPaint have a switch for that?
losso is offline  
Old 22 February 2016, 12:53   #3
attle
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?
Attached Images
 
attle is offline  
Old 22 February 2016, 16:57   #4
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
PicCon can save brushes as raw sprite data, you can find it on Aminet.
Leffmann is offline  
Old 23 February 2016, 09:28   #5
attle
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.
attle is offline  
Old 23 February 2016, 13:23   #6
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
Quote:
Originally Posted by velourfog View Post
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.
isn't that just because it includes both bitplanes in the same longword?
hooverphonique is offline  
Old 23 February 2016, 13:46   #7
attle
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
attle is offline  
Old 23 February 2016, 14:26   #8
Leffmann
 
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.
Leffmann is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08694 seconds with 16 queries