#include <acknex.h>
#include <default.c>
ENTITY* FLOOR;
VECTOR box_rotation;
VECTOR centre = vector(0,0,0);
var dampener;
var c1;
var num_box;
var new_ball_delay;
var iveruntheIamFlyfunk;
STRING* num_box_string;
d3d_alpharef = 180;
typedef struct
{
var velx;
var vely;
var velz;
var lifetime;
ENTITY* model;
} box;
PANEL* panDisplay =
{
digits(35, 10, "smokes = %0.f", *, 1, num_box);
flags = VISIBLE;
}
function do_sprite(ENTITY* ThisModel,var xv,var yv,var zv)
{
while(ThisModel.skill25>0)
{
//wait(1); //wait 1 frame
ThisModel.skill25 -= 15; //reduce counter
if (random(100)>97)
{
ThisModel.skill25 += 150; //reduce counter
}
ThisModel.x += xv;
ThisModel.y += yv;
ThisModel.z += zv - (ThisModel.skill27/8);
ThisModel.skill27 += 1;
if (ThisModel.skill25>ThisModel.skill26)
{
ThisModel.scale_x = (ThisModel.skill25 * ThisModel.skill25)/14000;
ThisModel.scale_y = (ThisModel.skill25 * ThisModel.skill25)/14000;
}
if (ThisModel.skill25<10)
{
ThisModel.alpha = ThisModel.skill25*0.01;
}
wait(1);
}
ent_remove(ThisModel); //remove timed-out model
num_box -= 1;
}
function new_sprite(var xpos, var ypos, var zpos)
{
c1 = 0;
while (c1<15)
{
c1 += 1;
box my_box;
my_box.model = ent_create("bluspark.bmp",vector(xpos,ypos,zpos),NULL);
my_box.model.skill25 = 200+random(500);
//my_box.model.pan = 180 - angle1;
my_box.model.scale_x = 1.925;
my_box.model.scale_y = 1.925;
wait(1);
c_setminmax(my);
my_box.model.roll = 1;
my_box.velx = (random(25)-12.5)/2;
my_box.vely = (random(25)-12.5)/2;
my_box.velz = (-5+random(25))*5;
my_box.model.skill26 = 180 - random(100);
set(my_box.model,BRIGHT|OVERLAY|TRANSLUCENT|PASSABLE);
my_box.model.alpha = 50;
do_sprite(my_box.model,my_box.velx,my_box.vely,my_box.velz);
//my_box.model.scale_z = 10.925;
my_box.lifetime = 100;
num_box += 1;
wait(1);
}
}
function do_bomb(ENTITY* ThisModel)
{
while(ThisModel.skill25>0)
{
ThisModel.skill25 -= 2; //reduce counter
wait(1); //wait 1 frame
}
new_sprite(ThisModel.x,ThisModel.y,ThisModel.z);
ent_remove(ThisModel); //remove timed-out model
num_box -= 1;
}
function new_bomb()
{
box my_box;
my_box.model = ent_create("cube_smaller.mdl",vector(0,0,0),NULL);
my_box.model.x = 0;
my_box.model.y = 0;
my_box.model.z = 800;
my_box.model.scale_x = 16.925;
my_box.model.scale_y = 16.925;
my_box.model.scale_z = 16.925;
my_box.model.skill25 = 500 + random(1000);
wait(1);
c_setminmax(my_box.model);
//wait(1);
phent_settype (my_box.model, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my_box.model, 200, PH_SPHERE); // and its mass
phent_setfriction (my_box.model, 68); // set the friction
phent_setdamping (my_box.model, 5, 5); // set the damping
phent_setelasticity (my_box.model, 62, 12); // set the elasticity
dampener = 0.285;
phent_addvelglobal(my_box.model, vector((-50+random(100))*dampener,(-50+random(100))*dampener,(-5+random(10))*dampener), vector(100,0,0) );
do_bomb(my_box.model);
//wait(1);
}
function main()
{
video_mode=9;
fps_max = 60;
max_entities = 15000;
max_nexus = 100000;
level_load("");
vec_set(screen_color,vector(0,0,0));
wait(1);
ph_setautodisable(0.00001, 0.0002, 4, 41); // turn on and set default values
camera.ambient = -92;
FLOOR = ent_create ("plain3d1.mdl", vector(-400, 0, -4800), NULL); // create the floor
set(FLOOR,LIGHT);
camera.x = 5500;
camera.y = 20;
camera.z = 250;
camera.arc = 110;
camera.pan = 180;
FLOOR.scale_x=5000;
FLOOR.scale_y=5000;
FLOOR.scale_z=30;
FLOOR.z = -5;
FLOOR.red = 0;
FLOOR.green =0;
FLOOR.blue =0;
FLOOR.ambient = 25;
FLOOR.z=-50;
ph_setgravity (vector(0, 0, -886)); // set the gravity
while (1)
{
new_ball_delay -= 1;
// CONTROLS
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
camera.pan -= mouse_force.x * 26;
camera.tilt += mouse_force.y * 26;
mouse_pos.x = 160;
mouse_pos.y = 120;
if (key_cuu) camera.x -= 52 * time_step;
if (key_cud) camera.x += 52 * time_step;
if (key_cul) camera.y += 52 * time_step;
if (key_cur) camera.y -= 52 * time_step;
if (key_ins) camera.z -= 52 * time_step;
if (key_del) camera.z += 52 * time_step;
if (mouse_left)
{
camera.ambient += 1;
//bowling_ball();
}
if (mouse_right)
camera.ambient -= 1;
if (key_e)
{
if (new_ball_delay<0)
{
new_sprite(0,0,800);
new_ball_delay = 1;
}
}
if (random(100)>97)
{
new_bomb();
}
//on_e =
wait(1);
}
}