Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// draw_sprite_hdr(sprite,subimg,x,y,r,g,b)
- {
- var sprite, subimg, xposit, yposit, hdrRed, hdrGrn, hdrBlu;
- sprite = argument0;
- subimg = argument1;
- xposit = argument2;
- yposit = argument3;
- hdrRed = argument4;
- hdrGrn = argument5;
- hdrBlu = argument6;
- // normal draw mode for the first pass
- draw_set_blend_mode(bm_normal);
- do {
- // determine color blending for this pass and then draw the sprite using it
- color = make_color_rgb(min(max(0,hdrRed),255), min(max(0,hdrGrn),255), min(max(0,hdrBlu),255));
- draw_sprite_ext(sprite, subimg, xposit, yposit, 1, 1, 0, color, 1);
- // remove a full pass of light
- hdrRed -= 255;
- hdrGrn -= 255;
- hdrBlu -= 255;
- // every subsequent pass is drawn with additive blending
- draw_set_blend_mode(bm_add);
- // keep drawing until there is no more light
- } until (max(hdrRed, hdrGrn, hdrBlu) <= 0);
- // restore blend mode to normal
- draw_set_blend_mode(bm_normal);
- }
Advertisement
Add Comment
Please, Sign In to add comment