var my_floor_ambient ()
{
if ( !me )
return 0;
// set ( my, LIGHT | UNLIT );
vec_set ( &my->blue, COLOR_WHITE );
VECTOR vPos;
vec_set ( &vPos, &my->x );
vPos.z -= 300 - my->min_z;
you = NULL;
var height = c_trace ( &my->x, &vPos, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | SCAN_TEXTURE );
if ( HIT_TARGET )
{
if ( you ) // if you exits, is a terrain for sure
{
if ( you->lightmap )
{
BMAP *bmpSkin1 = ent_getskin ( you, 1 );
var scale = bmap_width(you->lightmap) / bmap_width(bmpSkin1); //
var format = bmap_lock ( you->lightmap, 0 );
var cX = hit.u1 * scale;
var cY = hit.v1 * scale;
var pixel = pixel_for_bmap ( you->lightmap, cX, cY );
COLOR col;
pixel_to_vec ( &col, NULL, format, pixel );
vec_set ( &my->blue, &col );
// vec_set ( &col, COLOR_WHITE );
// pixel = pixel_for_vec ( &col, 100, format );
// pixel_to_bmap ( you->lightmap, cX, cY, pixel );
bmap_unlock ( you->lightmap );
set ( my, LIGHT | UNLIT );
}
}
else // hit a block
{
reset ( my, LIGHT | UNLIT );
// vec_set ( &my->blue, &hit.blue );
}
}
return height;
}