void fill_simulation(simulation_t *simulation) { srand(time(NULL)); for (unsigned int i = 0; i < simulation->count; i++) { particle_t p; vec_fill(&p.position, get_random(8)-4, get_random(8)-4, get_random(8)-4); vec_fill(&p.velocity, 0, 0, 0); p.r = 1; p.g = 0; p.b = i / (float)simulation->count; p.mass = get_random(100) + 10; p.radius = 0.004*p.mass; simulation->src_buf[i] = p; simulation->dst_buf[i] = p; } }
void eff_expl_smoke() { set(me, TRANSLUCENT | LIGHT | ZNEAR | PASSABLE); vec_set(my.blue, vector(200,255,255)); my.alpha = 40; my.roll = random(360); vec_fill(my.scale_x, 0.4); while(my.alpha > 0) { my.alpha -= time_step * 2; my.roll += time_step * sign(ang(my.roll))*1; vec_fill(vecEffectsTemp, time_step *0.01); vec_add(my.scale_x, vecEffectsTemp); wait(1); } ent_remove ( me ); }
void eff_expl_wave() { set(me, TRANSLUCENT | DECAL | PASSABLE); my.alpha = 70; vec_fill(my.scale_x, 0.1); my.tilt = 90; my.pan = random(360); vec_fill(my.blue, 0); while(my.alpha > 0) { vec_fill(vecEffectsTemp, time_step * 2); vec_add(my.scale_x, vecEffectsTemp); my.alpha -= time_step * 7; wait (1); } ent_remove(me); }
void eff_expl_smoke2 () { set(me, TRANSLUCENT | ZNEAR | PASSABLE | LIGHT); my.roll = random(360); my.alpha = 100; my.scale_x = 0.2; my.scale_y = 0.7; my.skill1 = random(3)+2; vec_fill(my.blue, 30); while(my.alpha > 0) { if(my.alpha > 93 ) { vec_for_angle(vecEffectsTemp, vector( my.roll,0,0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, time_step * (my.alpha/my.skill1) * 0.4); vec_add(my.x, vecEffectsTemp); my.scale_y += vec_length(vecEffectsTemp)/46; my.alpha -= time_step * 3; } else { vec_for_angle(vecEffectsTemp, vector(my.roll, 0, 0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, time_step * (my.alpha/(my.skill1*2))); vec_add(my.x, vecEffectsTemp); my.scale_y += vec_length(vecEffectsTemp) / 5000; my.alpha -= time_step * 9; } wait(1); } ent_remove(me); return; }
void eff_expl_flash() { int i; set(me, BRIGHT | TRANSLUCENT | LIGHT | ZNEAR | PASSABLE); my.alpha = 50; my.roll = random(360); while(my.alpha < 100) { my.alpha += time_step * (random(20)+20); my.roll += time_step * sign(ang(my.roll)); vec_fill ( my.scale_x, my.alpha/13 ); wait(1); } for(i=0; i<4; i++) { ent_create("explFlash01.tga", my.x, eff_expl_flash_2); you = ent_create("explFlash02.tga", my.x, eff_expl_flash_2); if (i == 0) set(you, LIGHT); } for(i=0; i<5; i++) { ent_create ("explSmoke01.tga", my.x, eff_expl_smoke2); } effect(p_eff_expl_particle, 200, my.x, NULL); vec_add(my.scale_x, vector(3,3,3)); ent_create("explSmoke02.tga", my.x, eff_expl_smoke); while(my.alpha > 0) { my.alpha -= time_step * 25; my.roll += time_step * sign(ang(my.roll)); wait(1); } ent_remove(me); }
void eff_expl_flash_2() { set(me, BRIGHT | TRANSLUCENT | ZNEAR | PASSABLE); my.blue = 150; my.green = 235; my.red = 255; my.alpha = 0; my.roll = random(360); vec_fill(my.scale_x, 3); vec_for_angle(vecEffectsTemp, vector( my.roll, 0, 0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, 40); vec_add(vecEffectsTemp, my.x); vec_set(my.x, vecEffectsTemp); while(my.alpha < 100) { if (my.lightrange < 1000 ) my.lightrange += 2000 * time_step; my.alpha += time_step * (random(20)+20); my.roll += time_step * sign(ang(my.roll)); vec_normalize ( my.blue, 150 + random(105) ); wait(1); } ent_create("explSmoke02.tga", my.x, eff_expl_smoke); while(my.alpha > 0) { if (my.lightrange > 0) my.lightrange -= 500 * time_step; my.alpha -= time_step * 20; my.roll += time_step * sign(ang(my.roll))*5; wait(1); } while (my.lightrange > 0) { my.lightrange -= 500 * time_step; wait(1); } ent_remove(me); }
void main () { video_mode = 8; fps_max = 60; wait(2); bmap_zbuffer ( bmap_createblack(2048,2048,32) ); mouse_mode = 4; mouse_map = bmap_create ( "arrow_yellow.pcx" ); vec_fill ( &screen_color, 128 ); level_load ( "" ); camera->pan = -40; camera->tilt = -30; evnCameraLocate (); vec_set ( &colCameraBG, vector(150,150,150) ); camera->bg = pixel_for_vec ( &colCameraBG, 100, 8888 ); ENTITY *ent = ent_create ( CUBE_MDL, nullvector, NULL ); // Create style for the menues // CMMEMBER *myMenuStyle = cmstyle_create ( FONT *font, COLOR *colText, COLOR *colBack, COLOR *colOver ) FONT *fntTTF = font_create("Arial#16"); CMStyle *myMenuStyle01 = cmstyle_create ( fntTTF, vector(40,40,40), vector(250,250,250), vector(210,210,210) ); FONT *fntBitmap = font_create("ackfont.pcx"); CMStyle *myMenuStyle02 = cmstyle_create ( fntBitmap, vector(170,170,255), vector(30,20,0), vector(0,0,185) ); // Create a compact menu panel // PANEL *cmenu_create ( char *chrMember, var pos_x, var pos_y, var size_x, var layer, var flags, CMStyle *style ) PANEL *myMenu01 = cmenu_create ( "menu name.submenu=txtMain", 110, 20, 200, 1, SHOW, myMenuStyle01 ); PANEL *myMenu02 = cmenu_create ( "debug & statics.submenu=txtCMDebug", 500, 20, 200, 1, SHOW, myMenuStyle01 ); cmenu_modify ( myMenu02, 120, myMenuStyle02 ); bmpSky = bmap_create ( "sky_fu_256+6.tga" ); while ( !key_esc && !nExit ) { str_setchr ( strString, 1, random(32)+32 ); wait(1); } bmap_remove ( bmpSky ); bmpSky = NULL; bmap_remove ( mouse_map ); mouse_map = NULL; cmenu_remove ( myMenu01 ); sys_free ( myMenuStyle01 ); font_remove ( fntTTF ); cmenu_remove ( myMenu02 ); sys_free ( myMenuStyle02 ); font_remove ( fntBitmap ); sys_exit ( NULL ); }