Retina Burn/Flash Bang

Posted By: Stansmedia

Retina Burn/Flash Bang - 02/11/06 18:37

Code:

// A white pcx, probably 1280x960 so its big enough for any screensize
bmap white_flash = <white.pcx>;

bmap screen_shot_map = <emptypanel.pcx>;// A 640x480 empty PCX
bmap screen_shot_map2 = <emptypanel2.pcx>;// A 800x600 empty PCX
bmap screen_shot_map3 = <emptypanel3.pcx>;// A 1024x768 empty PCX
bmap screen_shot_map4 = <emptypanel4.pcx>;// A 1280x960 empty PCX

panel respawn_flash
{
bmap = white_flash; // compass_map as panel background
pos_X = 0; pos_y = 0;
layer = 4; // we want the flash in front of the burn image
flags = VISIBLE,TRANSPARENT;
}

// copies the screen into a bitmap
function grab_screen() {
if(video_mode == 6) // 640x480
{
bmap_for_screen (screen_shot_map, 1, 0);
}
if(video_mode == 7) // 800x600
{
bmap_for_screen (screen_shot_map2, 1, 0);
}
if(video_mode == 8) // 1024x768
{
bmap_for_screen (screen_shot_map3, 1, 0);
}
if(video_mode == 9) // 1280x960
{
bmap_for_screen (screen_shot_map4, 1, 0);
}
wait (1); // wait 1 frame until the bitmap can be saved
}

panel respawn_burn
{
bmap = screen_shot_map;
pos_X = 0; pos_y = 0;
layer = 3; // we want the burn behind the flash
flags = VISIBLE,TRANSPARENT;
}

function flash()
{
if(video_mode == 6) // 640x480
{
respawn_burn.bmap = screen_shot_map;
}
if(video_mode == 7) // 800x600
{
respawn_burn.bmap = screen_shot_map2;
}
if(video_mode == 8) // 1024x768
{
respawn_burn.bmap = screen_shot_map3;
}
if(video_mode == 9) // 1280x960
{
respawn_burn.bmap = screen_shot_map4;
}
respawn_burn.alpha = 100;
respawn_flash.alpha = 100;
}

starter respawn_panel_control
{
while(1)
{
if(respawn_burn.alpha > 0)
{
respawn_burn.alpha -= time*2;
}
if(respawn_flash.alpha > 0)
{
respawn_flash.alpha -= time*3;
}
wait(1);
}
}



Put this at the top of your code, and when you want the magic to happen, just call the function:
Code:
 
grab_screen();
flash();


in your code. Make sure you dont have it in a loop, and you create the images i mentioned in comments.

The bigger the screen size, the longer it takes to capture the screen.. Theirs a small delay for me on 640x480 and 800x600 but after that it gets pretty laggy.
Posted By: Rhuarc

Re: Retina Burn/Flash Bang - 02/11/06 19:05

This would be easy to do in a DLL by grabbing the back buffer..... and avoid that lag.

Might throw something together for it...

-Rhuarc
Posted By: Grafton

Re: Retina Burn/Flash Bang - 02/11/06 20:57

Very cool BloodRed! The only problem is how long it takes to grab the screen.
You can scale the panels instead of using all the different sizes. Heres how I
implemented your idea;
Code:
 
bmap white_flash = <white.pcx>; //64x64 white pcx
bmap screen_shot_map = <emptypnl.pcx>;// A 640x480 empty PCX

panel respawn_flash
{
bmap = white_flash;
pos_X = 0; pos_y = 0;
layer = 4;
flags = transparent;
}

panel respawn_burn
{
bmap = screen_shot_map;
pos_X = 0; pos_y = 0;
layer = 3;
flags = transparent;
}

function flash()
{
bmap_for_screen (screen_shot_map, 1, 0);
wait (1); // wait 1 frame until the bitmap can be saved
respawn_burn.bmap = screen_shot_map;

respawn_burn.scale_x = screen_size.x / bmap_width(screen_shot_map);
respawn_burn.scale_y = screen_size.y / bmap_height(screen_shot_map);
respawn_burn.visible = on;
respawn_burn.alpha = 100;

respawn_flash.scale_x = screen_size.x / bmap_width(white_flash);
respawn_flash.scale_y = screen_size.y / bmap_height(white_flash);
respawn_flash.visible = on;
respawn_flash.alpha = 100;

while(respawn_burn.alpha > 0 || respawn_flash.alpha > 0)
{
if(respawn_burn.alpha > 0){respawn_burn.alpha -= time*2;}
if(respawn_flash.alpha > 0){respawn_flash.alpha -= time*3;}
wait(1);
}
respawn_burn.alpha = 0;
respawn_burn.visible = off;
respawn_flash.alpha = 0;
respawn_flash.visible = off;
}

on_f flash;




Scaling the panels this way seems to work fine!
Rhuarc, a backbuffer.dll would be nice! could be used for all sorts of things,
I hope you can find the time to follow up on it!

Thanks again for sharing your idea and code BloodRed, very cool effect!
Posted By: Zio

Re: Retina Burn/Flash Bang - 02/11/06 21:55

I'm not sure where it is but didn't Matt write a dll that did that a while back? Shouldn't be hard to dig up.
Posted By: Grafton

Re: Retina Burn/Flash Bang - 02/11/06 23:06

Yes, I found it. Its called render_view.dll. From the included readme:

"This is a simple Dll plugin that grabs the backbuffer render target and blits
it to an entity skin"

I am not sure how or even if we could use it to put the backbuffer to a panel
though.
Posted By: Stansmedia

Re: Retina Burn/Flash Bang - 02/11/06 23:22

Perhaps you could apply it to the skin of an model thats an entity on the screen. That might be a little weird tho.
Posted By: Matt_Coles

Re: Retina Burn/Flash Bang - 02/12/06 06:33

very nice effect! It would be interesting to see it combined with renderview.dll
Posted By: Matt_Aufderheide

Re: Retina Burn/Flash Bang - 02/12/06 07:34

PLEASE!! dont use my renderview.dll .. it is really slow..too slow to be used in a game i think. The main problem, for nayone who is interested, is that there is no easy way to transfer texturs genereated in the dll to the A6 interface.. so i have to use some slow D3DX function.. this is extremely slow...even if you use a very tiny texture.

The better way would be to write the rendering routine in the dll itself. Just take my source and modfiy it.. if you have my orginal dll source, someone can do this with some basic D3D knowledge. Just take the backbuffer, and instead of sing D3DXLoadSurfaceFromSurface, define a screen alinged quad and render this with a shader.
Posted By: Rhuarc

Re: Retina Burn/Flash Bang - 02/13/06 13:21

Quote:

PLEASE!! dont use my renderview.dll .. it is really slow..too slow to be used in a game i think. The main problem, for nayone who is interested, is that there is no easy way to transfer texturs genereated in the dll to the A6 interface.. so i have to use some slow D3DX function.. this is extremely slow...even if you use a very tiny texture.



Amen to that.

The better way would be to write the rendering routine in the dll itself. Just take my source and modfiy it.. if you have my orginal dll source, someone can do this with some basic D3D knowledge. Just take the backbuffer, and instead of sing D3DXLoadSurfaceFromSurface, define a screen alinged quad and render this with a shader.



This is how I would do it... just render a quad with the texture....
© 2024 lite-C Forums