EmOneGarand Posted April 4, 2022 Share Posted April 4, 2022 Are there any examples on how to use CLUT properly? I'm trying to convert several of my graphics to 8bpp to reduce their footprint but I'm running into the issue of it only showing one sprites proper palette while scrambling another. It also seems to change the color of my Text layer. How it looks How I'm trying to initialize the CLUT for two sprites, can you not load more then one CLUT at a time? void InitializeCoins() { jsfLoadClut((unsigned short *)STRPTR(SPRITE_DOGEBLK_clut), 0, 255); jsfLoadClut((unsigned short *)STRPTR(SPRITE_BYTEBLK_clut), 0, 255); } assets ABS,SPRITE_DOGEBLK,gfx_clut,ASSETS\GFX\doge_8bpp.bmp ABS,SPRITE_BYTEBLK,gfx_clut,ASSETS\GFX\byte_8bpp.bmp My rapinit entries for the objects ; Block1 dc.l 10 ; (REPEAT COUNTER) ; Create this many objects of this type (or 1 for a single object) dc.l is_active ; sprite_active ; sprite active flag dc.w 20,0 ; sprite_x ; 16.16 x value to position at dc.w 60,0 ; sprite_y ; 16.16 y value to position at dc.w 0,0 ; sprite_xadd ; 16.16 x addition for sprite movement dc.w 0,0 ; sprite_yadd ; 16.16 y addition for sprite movement dc.l 32 ; sprite_width ; width of sprite (in pixels) dc.l 32 ; sprite_height ; height of sprite (in pixels) dc.l is_normal ; sprite_flip ; flag for mirroring data left<>right dc.l 0 ; sprite_coffx ; x offset from center for collision box center dc.l 0 ; sprite_coffy ; y offset from center for collision box center dc.l 32/2 ; sprite_hbox ; width of collision box dc.l 32/2 ; sprite_vbox ; height of collision box dc.l SPRITE_DOGEBLK ; sprite_gfxbase ; start of bitmap data dc.l 8 ; (BIT DEPTH) ; bitmap depth (1/2/4/8/16/24) dc.l is_RGB ; (CRY/RGB) ; bitmap GFX type dc.l is_trans ; (TRANSPARENCY) ; bitmap TRANS flag dc.l 32*32 ; sprite_framesz ; size per frame in bytes of sprite data dc.l 32 ; sprite_bytewid ; width in bytes of one line of sprite data dc.l 3 ; sprite_animspd ; frame delay between animation changes dc.l 5 ; sprite_maxframe ; number of frames in animation chain dc.l ani_rept ; sprite_animloop ; repeat or play once dc.l !edge_wrap ; sprite_wrap ; wrap on screen exit, or remove dc.l spr_inf ; sprite_timer ; frames sprite is active for (or spr_inf) dc.l spr_linear ; sprite_track ; use 16.16 xadd/yadd or point to 16.16 x/y table dc.l 0 ; sprite_tracktop ; pointer to loop point in track table (if used) dc.l spr_unscale ; sprite_scaled ; flag for scaleable object dc.l 32 ; sprite_scale_x ; x scale factor (if scaled) dc.l 32 ; sprite_scale_y ; y scale factor (if scaled) dc.l -1 ; sprite_was_hit ; initially flagged as not hit dc.l 0 ; sprite_CLUT ; no_CLUT (8/16/24 bit) or CLUT (1/2/4 bit) dc.l can_hit ; sprite_colchk ; if sprite can collide with another dc.l cd_keep ; sprite_remhit ; flag to remove (or keep) on collision dc.l single ; sprite_bboxlink ; single for normal bounding box, else pointer to table dc.l 1 ; sprite_hitpoint ; Hitpoints before death dc.l 2 ; sprite_damage ; Hitpoints deducted from target dc.l 32 ; sprite_gwidth ; GFX width (of data) ; Block2 dc.l 9 ; (REPEAT COUNTER) ; Create this many objects of this type (or 1 for a single object) dc.l is_active ; sprite_active ; sprite active flag dc.w 35,0 ; sprite_x ; 16.16 x value to position at dc.w 32,0 ; sprite_y ; 16.16 y value to position at dc.w 0,0 ; sprite_xadd ; 16.16 x addition for sprite movement dc.w 0,0 ; sprite_yadd ; 16.16 y addition for sprite movement dc.l 32 ; sprite_width ; width of sprite (in pixels) dc.l 32 ; sprite_height ; height of sprite (in pixels) dc.l is_normal ; sprite_flip ; flag for mirroring data left<>right dc.l 0 ; sprite_coffx ; x offset from center for collision box center dc.l 0 ; sprite_coffy ; y offset from center for collision box center dc.l 32/2 ; sprite_hbox ; width of collision box dc.l 32/2 ; sprite_vbox ; height of collision box dc.l SPRITE_BYTEBLK ; sprite_gfxbase ; start of bitmap data dc.l 8 ; (BIT DEPTH) ; bitmap depth (1/2/4/8/16/24) dc.l is_RGB ; (CRY/RGB) ; bitmap GFX type dc.l is_trans ; (TRANSPARENCY) ; bitmap TRANS flag dc.l 32*32 ; sprite_framesz ; size per frame in bytes of sprite data dc.l 32 ; sprite_bytewid ; width in bytes of one line of sprite data dc.l 3 ; sprite_animspd ; frame delay between animation changes dc.l 5 ; sprite_maxframe ; number of frames in animation chain dc.l ani_rept ; sprite_animloop ; repeat or play once dc.l !edge_wrap ; sprite_wrap ; wrap on screen exit, or remove dc.l spr_inf ; sprite_timer ; frames sprite is active for (or spr_inf) dc.l spr_linear ; sprite_track ; use 16.16 xadd/yadd or point to 16.16 x/y table dc.l 0 ; sprite_tracktop ; pointer to loop point in track table (if used) dc.l spr_unscale ; sprite_scaled ; flag for scaleable object dc.l 32 ; sprite_scale_x ; x scale factor (if scaled) dc.l 32 ; sprite_scale_y ; y scale factor (if scaled) dc.l -1 ; sprite_was_hit ; initially flagged as not hit dc.l 15 ; sprite_CLUT ; no_CLUT (8/16/24 bit) or CLUT (1/2/4 bit) dc.l cant_hit ; sprite_colchk ; if sprite can collide with another dc.l cd_keep ; sprite_remhit ; flag to remove (or keep) on collision dc.l single ; sprite_bboxlink ; single for normal bounding box, else pointer to table dc.l 1 ; sprite_hitpoint ; Hitpoints before death dc.l 2 ; sprite_damage ; Hitpoints deducted from target dc.l 32 ; sprite_gwidth ; GFX width (of data) Quote Link to comment Share on other sites More sharing options...
Zerosquare Posted April 4, 2022 Share Posted April 4, 2022 (edited) The Object Processor only supports a single 8-bit CLUT, and it applies to all 8 bpp (or fewer) objects. Edited April 4, 2022 by Zerosquare Quote Link to comment Share on other sites More sharing options...
+CyranoJ Posted April 4, 2022 Share Posted April 4, 2022 Yes, this comes up all the time. You only have ONE 256c CLUT. 256c objects use CLUT0 (start at index 0->index 255) The 16 colour cluts are sub-sections of this (CLUT0 is colour index 0-15, CLUT1 is colour index 16-31, etc) You can only mix 256c objects if they all use the *same* clut. The text layer uses CLUT15 (The final 16 colours of the main clut) Quote Link to comment Share on other sites More sharing options...
42bs Posted April 4, 2022 Share Posted April 4, 2022 Or you reprogram the CLUT or parts at certain scan lines. 1 Quote Link to comment Share on other sites More sharing options...
EmOneGarand Posted April 4, 2022 Author Share Posted April 4, 2022 Alright, thanks using what you guys told me I was able to get a single clut for my current items by making a very long vertical sprite strip. Its the same width as the original sprite strips but now when I compile the game the sprite is offset on the X-axis and I'm unsure of why or how to fix it... I've included my files below if anybody would like to take a look to see why its doing this. blockchain_breaker.zip Quote Link to comment Share on other sites More sharing options...
tonma Posted April 5, 2022 Share Posted April 5, 2022 Hi, I've had this problem before and it comes from your 8 bit image. You only have 254 colors and with gimp the image is encoded differently than 255 colors. You need to exactly have 256 colors (0 -> 255) in the palette cf pictures. And you have in rapinit.s a "dc.l 31 ; sprite_width". I think it's for testing the x-offset but 32 works well. coins_8bpp.bmp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.