Hi all,
having some problems again.
I'm trying to paint a blood splatter on a terrain skin at some position.
My problem is that the terrain skin is .pcx (I don't think its a problem) and my blood splatter is .tga with an alpha channel.
When I try bmap_blit there is no transparency, so I thought I'd paint myself, but failed again.
Here's what I'm using (COLOR and pixels):
typedef struct APIXEL {
COLOR pix;
var pixa;
} APIXEL;
APIXEL bloodSplatter1_pixels[32][32];
function readBloodSplatters() {
var i , j;
var bmapHandle = bmap_lock(bloodSplatter1_tga , 0);
for( j = 0; j < 32 ; j++ ) {
for( i = 0; i < 32; i++ ) {
pixel_to_vec( bloodSplatter1_pixels[i][j].pix , bloodSplatter1_pixels[i][j].pixa , bmapHandle , pixel_for_bmap( bloodSplatter1_tga , i , j ) );
}
}
bmap_unlock(bloodSplatter1_tga);
}
function placeBloodSplatter( VECTOR* posVec ) {
var i , j;
BMAP* terrainSkin = bmap_for_entity(terrainEntity,0);
var bmapHandle = bmap_lock(terrainSkin , 0);
posVec.x -= 16;
posVec.y -= 16;
if( posVec.x < 0 ) { posVec.x = 0; }
if( posVec.y < 0 ) { posVec.y = 0; }
if( posVec.x > 2016 ) { posVec.x = 2016; }
if( posVec.y > 2016 ) { posVec.y = 2016; }
for( j = 0; j < 32 ; j++ ) {
for( i = 0; i < 32; i++ ) {
pixel_to_bmap( terrainSkin , posVec.x + i , posVec.y + j , pixel_for_vec( bloodSplatter1_pixels[i][j].pix , bloodSplatter1_pixels[i][j].pixa , 8888 ) );
}
}
bmap_unlock(terrainSkin);
}
Even if I set the alpha to 10 by hand, for each pixel, the black is still black...
Anyone knows a solution?
Thanks.
EDIT:
I tried using 32bit tga for terrain skin and transparent patches appear on the terrain with the blood stain barely visible...Lol