Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Converting to sprites
2009-07-02 04:33
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
Converting to sprites

Ok, so i have run into a problem.. hehe

I have 52 bmp pics, which are each the size of 2x2 C64 sprites.

So there's room for them all in 1 VIC bank..
Now problem is to convert them..

I tried Gang-Ed, but it only imports bmp as hires/mcol bitmap/char, and blows up the small image to fullscreen!

So i saved all the frames as a koala pr pic.. hahaha

Now i am stuck with 52 koala pics, that need to be transformed into 4 sprites each, bwahaha..

This is really silly..

What i really need is:

1) convert the 48x48 pixel bmp to 4 colors
2) convert this to 4 sprites

Is there an editor, where i can load bmp/gif into a sprite editor ? they have correct size, just need to be fixed to 4 cols.. which i can do with a batchconvert in thumbs plus (reduce nr of colors)

??

Thanks for any help!
 
... 56 posts hidden. Click here to view all posts....
 
2013-01-22 16:07
Magnar

Registered: Aug 2009
Posts: 61
@Burglar, still not working. Now I am using a GIF file with 48x63 pixels, 4 colors.

Gives error:
flex pass 1
.for (var ysprite = 0; ysprite < ysize; ysprite++) {
.for (var xsprite = 0; xsprite < xsize; xsprite++) {
.for (var i = 0; i < [3 * 21]; i++) {
.byte picture.getMulticolorByte(
^

Error: byte x coordinate out of range : 6

Sourcecode:

.var bgcolor= $000000
.var color0 = $ffffff
.var color1 = $696259
.var color2 = $000000
.var xsize = 48
.var ysize = 63

.pc = $3000 "Sprite Data"
spriteData:

:LoadSpriteFromPicture("C:\anna_1.gif",xsize,ysize,bgcolor,color0,color1,color2 )
:LoadSpriteFromPicture("C:\anna_2.gif",xsize,ysize,bgcolor,color0,color1,color2 )

.macro LoadSpriteFromPicture( filename,
xsize, ysize,
bgcolor, color0, color1, color2 ) {
.var picture = LoadPicture( filename, List().add(bgcolor, color0, color1, color2) )
.for (var ysprite = 0; ysprite < ysize; ysprite++) {
.for (var xsprite = 0; xsprite < xsize; xsprite++) {
.for (var i = 0; i < [3 * 21]; i++) {
.byte picture.getMulticolorByte(
[[xsprite * 3] + mod(i,21)],
[[ysprite * 21] + floor(i / 3)]
)
}
.byte 0
}
}
}
2013-01-22 16:17
Burglar

Registered: Dec 2004
Posts: 1101
.var xsize = 2
.var ysize = 3

xsize/ysize is in sprites, not pixels.
2013-01-22 18:50
Magnar

Registered: Aug 2009
Posts: 61
Unfortunately same error even after changing the xsize and ysize values.
2013-01-22 18:53
Cruzer

Registered: Dec 2001
Posts: 1048
Give my previous comment a chance :)
2013-01-22 20:03
Magnar

Registered: Aug 2009
Posts: 61
Got it to work by using lots of "for" statements.

However, the coloring is totally wrong. I would expect the LoadPicture with the list of added color values to be a search pattern through the GIF file and then arrange the multicolor byte in return according the order of the color array input.

Say, in the GIF; if I have $ff0000 as background, and I specify bgcolor=$ff0000 as first value, I would expect it to come into the sprite as the first value.

Now, it isn't and also it doesnt take all colors into consideration either. I lose the 3rd color in the convert process somehow.. Anyone? :)

Source:


.macro LoadSpriteFromPicture( filename, bgcolor, color0, color1, color2 ) {

.var picture = LoadPicture( filename, List().add(bgcolor, color0, color1, color2 ) )

.for (var y = 0; y <21; y++){
.for (var x = 0; x <3; x++){
.byte picture.getMulticolorByte(x,y)
}
}
.for (var y = 0; y <21; y++){
.for (var x = 3; x <6; x++){
.byte picture.getMulticolorByte(x,y)
}
}
.for (var y = 22; y <42; y++){
.for (var x = 0; x <3; x++){
.byte picture.getMulticolorByte(x,y)
}
}
.for (var y = 22; y <42; y++){
.for (var x = 3; x <6; x++){
.byte picture.getMulticolorByte(x,y)
}
}
.for (var y = 42; y <63; y++){
.for (var x = 0; x <3; x++){
.byte picture.getMulticolorByte(x,y)
}
}
.for (var y = 42; y <63; y++){
.for (var x = 3; x <6; x++){
.byte picture.getMulticolorByte(x,y)
}
}
2013-01-22 21:19
Burglar

Registered: Dec 2004
Posts: 1101
argh yes, what cruzer said ;) (serves me right by using a too large png that wouldnt give errors anyway, doh facepalm)

2013-01-22 22:06
Cruzer

Registered: Dec 2001
Posts: 1048
Finally someone listens :D
2013-01-22 22:28
Magnar

Registered: Aug 2009
Posts: 61
Guys, now you are both my heroes! :) I'll put down some serious greetz and credits to both of you for helping! THX!

2013-01-23 06:37
spider-j

Registered: Oct 2004
Posts: 498
Mh, this looks all too complicated for me. Should be easy to put this into two lines in a shell (or cmd if you are on windows).
1. Crop sprites from source bmp with ImageMagick
2. convert with bmp2sprite
2013-01-23 08:16
Bitbreaker

Registered: Oct 2002
Posts: 508
Gimp can export .spr as well. Also, somehow i don't get it why to introduce tools implemented as assembler-specific macros. A tool for all that is written in any language with a few lines of code in case. In my youth i drew sprites on quad paper and added the pixel values by mental arithmetic. Don't be such pussies and IDE-users :-)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
csabanw
Scrap/Genesis Project
DnP
zscs
RetroGL
lotus_skylight
DJ Gruby/TRiAD
Chico/Civitas
hedning/G★P
Guests online: 88
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.