Jump to content
IGNORED

rapinit.s and asset.txt how-to display a 24-bit bmp file


Recommended Posts

Hi,

 

I got a friend who gots interest in Jaguar coding and I wanted to help. RB+ seems a language he liked so we played around with it. Most of things were very well documented and the examples are helpfull aswell. But getting a 24-bit bmp working seems to be harder then we thought. We did look at the invaders example. The backdrop a 24-bit bmp is converted to 16-bit at build time.

 

Looking at rapinit.s we did see the 24-bit support, but I suspect the 24-bit has to be converted in a way because it uses *4 instead of *3 in 24-bit. We did download gfxconv but had no luck as it seems only want to convert to 16bpp no matter what parameter we feed it.

 

attached is an 24-bit 352x240 24-bit bmp that is used as test file.

 

Any help would be nice.

 

rapinit.s

 

 

title - object 1
; value possible values description rb+ label to access
dc.l 1 ; ; How many sprites like this one do you want in the sprite list?
dc.l is_active ; is_active is_inactive ; Will the sprite be active on screen or inactive? ; R_sprite_active
dc.w 0,0 ; ; Put sprite this many pixels from left side of screen. ; R_sprite_x
dc.w 16,16 ; ; Put sprite this many pixels down from top of screen. ; R_sprite_y
dc.w 0,0 ; ; How many pixels will this sprite move automatically in x? ; R_sprite_xadd
dc.w 0,0 ; ; How many pixels will this sprite move automatically in x? ; R_sprite_xadd
dc.l 352 ; ; Width of sprite in pixels ; * R_sprite_width
dc.l 240 ; ; Height of sprite in pixels ; * R_sprite_height
dc.l is_normal ; is_normal is_flipped ; Will the sprite be mirrored in x? ; R_sprite_flip
dc.l 0 ; ; Collision box x offset - pixel distance from centre of sprite ; * R_sprite_coffx
dc.l 0 ; ; Collision box y offset - pixel distance from centre of sprite ; * R_sprite_coffy
dc.l 352/2 ; ; Width of collision box from centre in pixels ; * R_sprite_hbox
dc.l 240/2 ; ; Height of collision box from centre in pixels ; * R_sprite_vbox
dc.l SPRITE_TITLE ; ; Place in memory where the sprite lives: label from RAPAPP.S ; R_sprite_gfxbase
dc.l 24 ; 1 2 4 8 16 24 ; Sprite graphics type: 1,2,4,8,16 or 24 bit ; * R_sprite_?
dc.l is_RGB ; is_RGB is_cry ; Sprite graphics type. RGB or Atari's CRY format. ; * R_sprite_?
dc.l is_opaque ; is_trans is_opaque ; Trans for see-through background, opaque for solid background ; * R_sprite_?
dc.l 352*240*4 ; ; Size of sprite in bytes - used to find next frame of animation ; R_sprite_framesz
; Enter the x-size * the y-size and add the following next:
; /8 for 1bit
; /4 for 2bit
; /2 for 4bit
; nothing for 8bit
; *2 for 16bit
; *4 for 24bit
dc.l 352*4 ; ; Width of a single row of sprite pixels ; * R_sprite_bytewid
; Enter the x-size and add the following:
; /8 for 1bit
; /4 for 2bit
; /2 for 4bit
; nothing for 8bit
; *2 for 16bit
; *4 for 24bit
dc.l 0 ; ; Number of screen updates (VB) before the animation advances ; R_sprite_framedel
dc.l 0 ; ; Additional number of animation frames after the first ; R_sprite_maxframe
dc.l ani_rept ; ani_rept ani_once ; Loop theanimation or play a single time ; R_sprite_animloop
dc.l edge_wrap ; edge_wrap R_edge_kill ; What do you want to do if sprite leaves the edge of the screen? ; R_sprite_wrap
dc.l spr_inf ; spr_inf ; Want sprite to stay forever or a number of frames? ; R_sprite_timer
dc.l spr_linear ; spr_linear ; Use automatic movement above or use a tracking table. ; R_sprite_track
dc.l 0 ; ; If using above tracking table, input the loop point here ; R_sprite_tracktop
dc.l spr_unscale ; spr_unscale spr_scale ; Is the sprite going to be scaleable or not scaled? ; R_spr_scaled
dc.l 32 ; ; 32 is 1:1. 0-31 are scaled down, 33-255 are scaled up. ; R_sprite_scale_x
; It's probably best to think of the binary number %00100000...
; Adding numbers to the right increases the size fractionally...
; Adding them to the left increases buy a factor of one each time
; So %01000000 is scaled 2x bigger than the original
; %00010000 is scaled half size
; %00010001 is a tiny bit bigger than half size
dc.l 32 ; ; 32 is 1:1. 0-31 are scaled down, 33-255 are scaled up. ; R_sprite_scale_y
; See above for more info.
dc.l -1 ; ; Did the sprite collide with another? ; R_sprite_was_hit
; Set to not hit to begin with, used later to flag collisions
dc.l no_CLUT ; no_CLUT ; Define sprite colours. ; R_sprite_CLUT
; no_CLUT for 8, 16 and 24bit
; CLUT number 0 to 15 for 1, 2 and 4bit
dc.l can_hit ; can_hit cant_hit ; Want to be able to check if this sprite hits others? ; R_sprite_colchk
dc.l cd_keep ; cd_keep cd_remove ; What to do if a collision is detected. ; R_sprite_remhit
dc.l single ; single ; Bounding box for collision detect 'single'. Or address of table ; R_sprite_bboxlink
dc.l 1 ; ; Hit points before sprite is killed ; R_sprite_hitpoint
dc.l 0 ; ; Hit points inflicted upon other sprites ; R_sprite_damage
dc.l 352*4 ; ; Width of sprite within larger graphic. ; R_sprite_gwidth
; Enter the x-size and add the following:
; /8 for 1bit
; /4 for 2bit
; /2 for 4bit
; nothing for 8bit
; *2 for 16bit
; *4 for 24bit

 

assets.txt

 

 

ABS,SPRITE_TITLE,gfx_clut16,ASSETS\GFX\backdrop.bmp changed to ABS,SPRITE_TITLE,gfx_clut24,ASSETS\GFX\backdrop.bmp don't know if that's needed no much info about this.


' End of file.

 

rapapp.s

 

 

raptor_video_mode equ vidRGB16 ; tell RAPTOR we want RGB 16 mode changed this to vidRGB24

Title.bmp

Edited by TXG/MNX
Link to comment
Share on other sites

To be honest I'm not sure if anyone ever tested 24bit images in RB+. Problem is - I don't have time at the moment to look into the issue. I would suggest that you try using another tool that converts the 24bit image to raw jaguar format and import it as a raw asset in assets.txt - that way you can be sure the image gets imported properly. If that works at least it would indicate a bug in my converter.

 

The other solution of course would be to fall back to 16bit images as they usually don't make that huge a difference from 24bit ;).

 

(P.S. zipping up and uploading the project folder -minus the "build" folder- would help because then I won't have to set up a dummy project).

Link to comment
Share on other sites

I think I originally tried out 24 bit and may have also had problems. I can't really remember though.

 

It's true that you rarely need to use 24 bit. 16 bit should be plenty for most cases.

 

Things became much easier for me when I dug out my old copy of Paint Shop Pro 7 because that has nice easy "Convert to xx-bit" options in the "Colour" menu :)

 

Then just save as .BMP and away you go.....

Edited by Sporadic
Link to comment
Share on other sites

I spoke rubbish there.

 

What i've been doing for my high colour stuff is to save in PSP as 24bit (16 million) but in rapinit.s i told it that the sprite is 16bit ( *2 ) and in the assets.txt i've used gfx_clut16.

 

For whatever reason that works for me. I have a feeling that is the only way I could get anything 16 bit to display.

 

Once I saw it work I just accepted it and moved on to coding. I'll probably revisit at some point and downsize all the assets. I'm just happy it's working.

Link to comment
Share on other sites

You do realize 24 is 8*3, yes?

 

I know but rapinit.s has the following comment:

 

dc.l 352*240*4 ; ; Size of sprite in bytes - used to find next frame of animation ; R_sprite_framesz

; Enter the x-size * the y-size and add the following next:

; /8 for 1bit

; /4 for 2bit

; /2 for 4bit

; nothing for 8bit

; *2 for 16bit

; *4 for 24bit

 

So or I must feed it a 32bit file, convert 24bpp bmp only with what tool. Or it's going wrong somewhere else. I did try *3 aswell but also no luck ...

Link to comment
Share on other sites

I spoke rubbish there.

 

What i've been doing for my high colour stuff is to save in PSP as 24bit (16 million) but in rapinit.s i told it that the sprite is 16bit ( *2 ) and in the assets.txt i've used gfx_clut16.

 

For whatever reason that works for me. I have a feeling that is the only way I could get anything 16 bit to display.

 

Once I saw it work I just accepted it and moved on to coding. I'll probably revisit at some point and downsize all the assets. I'm just happy it's working.

 

downsizing the assets is not needed while they are converted to 16-bit at build time so not take the full 24bpp space but 16bpp I think.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...