Exemplo n.º 1
0
void item_spawn()
{
	if (itemCounter >= itemMax) return;
	
	VECTOR tempVector;
	vec_set(tempVector, vector(random(6400)-3200, random(6400)-3200, 0));
	if(vec_length(tempVector) < 400)
	{
		return;
	}
	
	tempVector.z = 5000;
	tempVector.z -= c_trace(tempVector, vector(tempVector.x, tempVector.y, -5000), SCAN_TEXTURE|IGNORE_PASSABLE|IGNORE_FLAG2) - ITEM_HEIGHT;
	if(hit.nz < 0.5)
	{
		return;
	}
	
	ENTITY *item;
	if(random(1.0) > 0.95)
		item = ent_create("woodthing.mdl", tempVector, item_wood);
	else
		item = ent_create("snowball.mdl", tempVector, item_snowball);
	item.pan = random(360);
	itemCounter++;
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
void ebHandsBgFly ()
{
	if (isEbWarghostAlive())
	{
		var handRadius = 500;
		
		snd_play(g_sndSparkle, 100, 0);

		ENTITY* hands [2];
		hands[0] = ent_create("warhand.mdl", vector(-handRadius, 500, 400), ebHandFlyL);
		hands[1] = ent_create("warhand.mdl", vector(handRadius, 500, 400), ebHandFlyR);	
	
		var t = maxv(g_facTimeEbHandsFlyMin, g_facTimeEbHandsFly * (5 + random(5))) * 16;
		
		snd_play(g_sndHandFlyBoth, 100, 0);
		
		while (t > 0)
		{
			t -= time_step;
			wait(1);
		}
		
		g_facTimeEbHandsFly *= g_facTimeEbHandsFlyDec;
		
		ebSndAttack();
		
		int i;
		var m = (1 + random(2)) * 16;
		for (i = 0; i < 2; i++)
		{
			(hands[i])->skill1 = 1;
			(hands[i])->skill2 = m;
		}
		
		while (m > 0)
		{
			m -= time_step;
			wait(1);
		}
		
		snd_play(g_sndSparkle, 100, 0);
		
		wait(-0.5);
		
		VECTOR v;
		vec_set(&v, player->x);
		v.z += 400;
		
		ent_create("warhand.mdl", &v, ebHandWatchSelect);
	}
	
	ptr_remove(my);
}
Exemplo n.º 4
0
void main()
{
	level_load("") ; // Load empty level 
	
	// Position the camera at x = -100 ( Back  a bit )
	camera.x = -100 ; 
	
	// Create the Earth Model , Position XYZ, Action update_Earth
	ent_create( "earth.mdl", vector( 0, 45, 30 ), update_Earth ) ; 
	
	// Create Cube Model and wrap Collision Zone to Model 
	ent_create( "cube.mdl", vector(0,0,0), c_setminmax ) ; 
}
Exemplo n.º 5
0
/*
 * void render_rain_new()
 * 
 * Allocates and initializes the rain state singleton.
 * After this call, rain can be permanently activated (and switched on/off)
 * by using render_rain_start()/render_rain_stop().
 */
void render_rain_new()
{
	RainState_singleton = (RainState *) sys_malloc(sizeof(RainState));
	
	// Set default values.
	RainState_singleton->fall_speed = vector(0, 0, 0);
	RainState_singleton->depth      = 3;                       // Immutable (planned later). (TODO: Adjustable depth, very easy).
	
	RainState_singleton->rain = mtl_create();
	effect_load(RainState_singleton->rain, "rain.fx");
	render_rain_set_speed(0.15, 0.2, 0.07);
	
	RainState_singleton->rain_levels = (ENTITY *) sys_malloc(sizeof(ENTITY) * RainState_singleton->depth);
	int i = 0;
	for(; i < RainState_singleton->depth; i++)
	{
		(RainState_singleton->rain_levels)[i] = ent_create( game_asset_get_object("__rain_cylinder.mdl"), nullvector, NULL);
		(RainState_singleton->rain_levels)[i]->scale_x = 2 + 8 * i;
		(RainState_singleton->rain_levels)[i]->scale_y = 2 + 8 * i;
		(RainState_singleton->rain_levels)[i]->scale_z = 100;
		(RainState_singleton->rain_levels)[i]->material = RainState_singleton->rain;
		(RainState_singleton->rain_levels)[i]->flags |= PASSABLE | SHOW;
	}
	
	RainState_singleton->state = 0;
}
Exemplo n.º 6
0
void doChopped (ENTITY* entHand, int lr, int fingerId)
{
	ENTITY* entFinger = ent_create(entHand->type, entHand->x, flyawaychoppedhand);
	
	entFinger->skill20 = lr;
	
	vec_set(entFinger->scale_x, entHand->scale_x);
	
	entFinger->frame = entHand->frame;
	entFinger->next_frame = entHand->next_frame;
	
	if (lr == 1)
		entFinger->material = g_mtlHandL;
	else
		entFinger->material = g_mtlHandR;
		
	entFinger->skill1 = fingerId;
	
	BOOL* arr = NULL;
	
	if (lr == 1) // left
		arr = g_handChopL;
	else // right
		arr = g_handChopR;
		
	int i;
	for (i = 0; i <= 5; i++)
		entFinger->vmask |= 1 << i;
	
	entFinger->vmask &= ~(1 << (4 - fingerId));
	
	snd_play(g_sndFingerChop, 100, 0);
}
Exemplo n.º 7
0
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);	
}
Exemplo n.º 8
0
action ebStartSpeech ()
{
	set(my, INVISIBLE | PASSABLE);
	
	// wait
	var t = 3 * 16;
	while (t > 0)
	{
		t -= time_step;
		wait(1);
	}
	
	if (g_ebSpeech)
	{
		g_ebSpeech = false;
		var h = snd_play(g_sndWarghostBattleSpeechStart, 100, 0);
		
		while (snd_playing(h))
			wait(1);
	}
	
	// switch warghost to model without hands
	if (g_entEbWarghost != NULL)
		ent_morph(g_entEbWarghost, "warghostChop.mdl");
		
	ent_create(NULL, nullvector, ebHandsBgFly);
	ptr_remove(my);
}
Exemplo n.º 9
0
BOOL crLottiUpdate (ENTITY* e)
{
	int m = (int)e->crState;
	BOOL b = true;
	
	switch (m)
	{
		case 0:   set(e, INVISIBLE); m++; break;
		
		case 1:   reset(e, INVISIBLE);
		          e->crSwordAtBelt = (random(100) < 20);
		          zorroMeshOptions(e, false, e->crSwordAtBelt, false);
		          e->material = g_mtlLotti;
		          e->crInit = random(100);
				  e->skill1 = e->pan;
				  
				  if (g_crRow > 1)
					e->crExploder = (random(100) < 20);
				  
				  m++;
				  
		case 2:   if (crLottiUpdateRaise(e)) m++; else break;
		
		case 3:   reset(e, TRANSLUCENT);
		          e->crTime = 64 + random(128);
		          m++;
		
		case 4:   if (crLottiUpdateIdle(e)) m++; else break;
		
		case 5:   zorroMeshOptions(e, false, false, true);
		          e->crTime = 8 + random(32);
		          m++;
		
		case 6:   if (crLottiUpdateAttack(e)) m++; else break;
		
		case 7:   if (e->crExploder)
		             vec_set(e->crAccel, vector(2.5 * (random(1) - 0.5), 2.5 * (random(1) - 0.5), 1 + random(2)));
		          else
		             vec_set(e->crAccel, vector(0.25 * (random(1) - 0.5), 0.25 * (random(1) - 0.5), 1 + random(2)));
					 
				  ent_playsound(e, g_sndJetpackCredits, 6000);
	
		          vec_to_angle(e.pan, e->crAccel);
		          e.tilt -= 90;
		          e->crTime = 10 + random(12);
		          e->crPercent = random(0.2);
				  m++;
				  
		case 8:   if (crLottiUpdateFly(e)) m++; else break;
		
		case 9:   ent_create("explo+13.tga", e->x, explo_sprite); m++; break;
		
		case 10:  ptr_remove(e); b = false; break;
	}
	
	e->crState = m;
	
	return b;
}
Exemplo n.º 10
0
void main()
{
	level_load("") ; // Load empty level 
	
	// Position the camera at x = -100 ( Back  a bit )
	camera.x = -100 ; 
	
	// Create the Earth Model , Position XYZ, Action update_Earth
	ent_create( "earth.mdl", vector( 0, 50, 35 ), update_Earth ) ; 
	
	int i = 0 ;
	for ( i = 45; i >= -45; i = i - 15 ) 
	{
		wait ( 100 ) ;
		ent_create( "cube.mdl", vector(0,i,0), c_setminmax ) ; 
	}

}
Exemplo n.º 11
0
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 );

}
Exemplo n.º 12
0
void main()
{	
	level_load(""); // Load an empty level
	
	camera.x = -100 ; // Back the Camera up a bit so we can see the Model

	// Create the Earth Model, at Position 0,0,0 , and run the Action update_Position
	ent_create("../earth.mdl", NULL, update_Position) ; 
}
Exemplo n.º 13
0
void main()
{
	level_load("") ; // Load empty level 
	
	// Position the camera at x = -100, y = 0, z = 22 ( Back and Up a bit )
	camera.x = -100 ;  camera.z = 22 ; 
	
	// Create the Earth Model , Position XYZ, Action update_Earth
	ent_create( "earth.mdl", vector( 0, 10, 40 ), update_Earth ) ; 
}
Exemplo n.º 14
0
void p_spark_colorful_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_colorfulspark);
	if(you) {
		vec_add(you.x,vector(60.425,91.578,0.000));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 15
0
void p_space_hole_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_spacehole);
	if(you) {
		vec_add(you.x,vector(414.936,660.420,69.408));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 16
0
void p_composition_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_composition);
	if(you) {
		vec_add(you.x,vector(-141.194,16.143,0.000));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 17
0
void p_double_helix_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_doublehelix);
	if(you) {
		vec_add(you.x,vector(-149.688,31.689,0.000));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 18
0
void p_fountain_1_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_fountain1);
	if(you) {
		vec_add(you.x,vector(-200.174,290.466,0.000));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 19
0
void p_fire_1_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_fire1);
	if(you) {
		vec_add(you.x,vector(-27.054,186.542,14.000));
		vec_set(you.pan,vector(32.498,-25.617,-3.110));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 20
0
void p_spiral_create(VECTOR *position) {
	if(!position)position = nullvector;
	wait(3);
	you = ent_create(NULL,position,emit_spiral);
	if(you) {
		vec_add(you.x,vector(371.551,349.278,0.000));
		vec_set(you.pan,vector(0.000,0.000,0.000));
		vec_set(you.scale_x,vector(1.000,1.000,1.000));
		set(you,PASSABLE);
		set(you,INVISIBLE);
	}
}
Exemplo n.º 21
0
void chicken()												// This function defines the chicken's behaviour
{
	my.animPercentage = integer(random(100));		// set the frame the animation is started on to a random value so the chickens are not in synch
	
	while(1)													// start the chicken's looping function. The following commands will be executed every tick in the game.
	{
	
		// cycle through the animation
	
		my.animPercentage += 2 * time_step;			// animPercentage determines how far through the animation we are (think of it as frame number)	
//																// It is increased here by a small amount that is multiplied by the speed the game runs at.
//																//	This ensures that the animation will run at the same speed for all players no matter how fast their computer is.

		if (my.animPercentage > 100) 					// when animPercentage reaches 100 we have played all the way through the animation. If this is the case
		{														// we need to reset some variables and choose a new animation to play:
			
			my.animPercentage -= 100;					// reset animPercentage
			my.eggLaid = 0;								// reset the eggLaid variable (this is a marker that prevents the chicken from laying more than 1 egg per animation)
				
//																// choose which animation to play next:
			my.animCycle = integer(random(3));		// generate a random number and assign it to the variable animCycle
			
			if (my.animCycle == 2)						// if animCycle is 2 the chicken will lay an egg, and 
			{
				snd_play(chickenSound, 100, 0);		// we need to start the egg laying sound now.
			}
		}
		
		switch (my.animCycle)														// this is where the animation actually gets played:
		{
			case 0:																		// if animCycle is 0 play the breathe animation
				ent_animate(me,"breathe",my.animPercentage,ANM_CYCLE);
				break;
				
			case 1:																		// if animCycle is 1 play the breathe and blink animation
				ent_animate(me,"blink",my.animPercentage,ANM_CYCLE);
				break;
				
			case 2:																		// if animCycle is 2:
				if ((my.animPercentage > 70) && (my.eggLaid == 0))			// are we more than 70% through the animation and we haven't made an egg?
				{
					
					ent_create ("egg.mdl", vector (my.x - 30, my.y, my.z - 50), egg);		// create an egg entity slightly behind and below the chicken
					my.eggLaid = 1;																		// set the eggLaid variable to 1 so we don't do this every tick from now on	
				}
				ent_animate(me,"layEgg",my.animPercentage,ANM_CYCLE);		// play the layEgg animation
				break;
		}
		
		wait(1);												// wait for the other entities to get updated so we don't crash the game.
	}
}
Exemplo n.º 22
0
void startDay()
{
	if(!player)
	{
		return;
	}
	
	dayOrNight = DAY;
	snd_play(sndDayStart, soundVolume, 0);
	on_space = NULL;
	on_mouse_left = NULL;
	ent_remove(player);
	mouse_mode = 0;
	ent_create("player.mdl", vector(-147, -44, 0), actPlayerMove);
	stopMusicGame();
	playMusicGameDay();
	show_dayhint();
}
Exemplo n.º 23
0
void startNight()
{
	if(!player)
	{
		return;
	}
	
	dayOrNight = NIGHT;
	snd_play(sndNightStart, soundVolume, 0);
	mouse_mode = 1;
	ent_remove(player);
	ent_create("player.mdl", vector(entHut.x, entHut.y, entHut.z + 200), actPlayerShoot);
	on_space = throwSnowball;
	on_mouse_left = throwSnowball;
	stopMusicGame();
	playMusicGameNight();
	show_nighthint();
}
Exemplo n.º 24
0
void eff_complexSmoke(STRING *smoke, VECTOR* pos, VECTOR* size, var density, var time)
{
	int i;
	var volume = abs(size.x * size.y * size.z);
	for(i = 0; i < 3 * density * (volume / 200000); i++)
	{
		VECTOR spawn;
		spawn.x = random(size.x) - 0.5 * size.x;
		spawn.y = random(size.y) - 0.5 * size.y;
		spawn.z = random(size.z) - 0.5 * size.z;
		vec_add(&spawn, pos);
		
		you = ent_create(smoke, &spawn, eff_complexSmokeSprite);
		you->skill1 = density;
		if(time >= 0)
		you->skill2 = total_ticks + time;
		else
		you->skill2 = -1;
	}
}
Exemplo n.º 25
0
// uses: durability, speed
action breaking_platform()
{
	ENTITY* ent = ent_create("platform_crumble.wmb", &my->x, NULL); //f**k it
	ent_preload(ent); //f**k it
	set(ent, INVISIBLE | PASSABLE); //f**k it
	
	set(my, is_platform);
	my->event = breaking_platform_evt;
	my->emask |= (ENABLE_IMPACT); 
	if (my->durability <= 0) my->durability = 0.5;
	if (my->speed <= 0)      my->speed = 2;
	
	while(!is(my, is_touched))
	{
		wait (1);
	}

	ent_playsound(me, sndPlatformCrumble, 1000);
	set(me, INVISIBLE | PASSABLE); //f**k it
	reset(ent, INVISIBLE | PASSABLE); //f**k it
	//ent_morph(me, "platform_crumble.wmb");
	wait (-(my->durability));

	ent->speed = my->speed; //f**k it
	ptr_remove(me); //f**k it
	me = ent; //f**k it
	//move downwards
	VECTOR vecSpeed;
	my->alpha = 100;
	set(my, TRANSLUCENT | PASSABLE);
	while(my->alpha != 0)
	{
		vec_set(&vecSpeed, vector(0,0, -(my->speed) * time_step));
		c_move(me, nullvector, &vecSpeed, IGNORE_MODELS | IGNORE_SPRITES | IGNORE_WORLD | IGNORE_PASSABLE | IGNORE_PASSENTS | IGNORE_MAPS);
		my->alpha = maxv(my->alpha - (my->speed * time_step * 0.5), 0);
		wait (1);
	}

	ptr_remove(me);
}
Exemplo n.º 26
0
void ebCreateHandJoints (ENTITY* entHand)
{
	if (entHand == NULL)
		return;
		
	BOOL* arr = NULL;
	
	if (entHand->skill20 == 1) // left
		arr = g_handChopL;
	else // right
		arr = g_handChopR;
		
	int i;
	for (i = 0; i < HAND_FINGERS; i++)
	{
		if (arr[i] == false)
		{
			char* j0 = _chr((g_handBoneFarNames->pstring)[i]);
			char* j1 = _chr((g_handBoneNearNames->pstring)[i]);
			
			VECTOR v0, v1, v;
			vec_for_bone(&v0, entHand, j0);
			vec_for_bone(&v1, entHand, j1);
			vec_lerp(&v, &v0, &v1, 0.5);
			
			if (entHand->skill20 != 0)
			{
				vec_to_ent(&v, entHand);
				v.x *= -1;
				vec_for_ent(&v, entHand);
			}
			
			ENTITY* e = ent_create("handjoint.mdl", &v, ebHandJoint);
			e->skill1 = i;
			e->skill2 = entHand;
		}
	}
}
Exemplo n.º 27
0
void main()
{

	level_load("") ; // Load empty level

	// place the camera at x = -100, y = 0, z = 22 ( Back and Up a bit )
	vec_set( camera.x,vector(-100, 0, 22) ) ;
	
	// Create the "earth.mdl", Position XYZ, Action update_Earth
	ent_create("earth.mdl", vector(pos_X, pos_Y, pos_Z), update_Earth);
 
   
   while (1) // While the game is running...
	{
		if ( key_space )	
		{
			create_Projectile(); // Call the Fuction to create new bullet entity
			wait(60); // Fire repeat rate
		}

	wait(1);
	}

}
Exemplo n.º 28
0
void create_Projectile() // This Function creates a bullet entity
{
	// Spawn Projectile 10 units in front of Player
	you = ent_create ("Cube.mdl", vector ( 0, pos_Y, pos_Z + 10 ), update_Projectile);
	your.scale_x = .2 ; your.scale_y = .2 ; your.scale_z = .2 ; // Scale it down to bullet size
}
Exemplo n.º 29
0
void createLetters()
{	
	var letterAscii ; // For storing ASCII value of each letter
	var letterY ; // For repositioning letters onscreen
	var letterZ ; 
	var entHandle = 0 ; // For keeping track of who's first in line
	var stringCount = 0 ; // For keeping track of how many letters to eliminate

	
	str_cpy( sourceString,"dillinger" ) ; // Load sequence of letters into sourceString

	stringCount = str_len( sourceString ) ; // Store the length of the String in stringCount
	
	letterAscii = str_to_asc(sourceString); 
	
	str_cpy( myFontString,sourceString ) ; 
	str_trunc(myFontString, (str_len(myFontString) - 1)) ;  // now myFontString == 1st Letter
	
	str_clip(sourceString,1);
	
	while ( stringCount != 0 ) // Continue until the string is empty
	{
// Assign screen position of letters so they appear in same pattern as keyboard layout QWERTY...
		switch (letterAscii)
		{
			case 97: // a
				letterY = 270 ; 
				letterZ = 230 ; 
				break ; 

			case 98: // b
				letterY = 0;
				letterZ = 160;
				break;

			case 99: // c
				letterY = 120;
				letterZ = 160;
				break;

			case 100: // d
				letterY = 150;
				letterZ = 230;
				break;
	
			case 101: // e
				letterY = 146;
				letterZ = 298;
				break;

			case 102: // f
				letterY = 92;
				letterZ = 230;
				break;
	
			case 103: // g
				letterY = -30;
				letterZ = 230;
				break;
	
			case 104: // h
				letterY = 30;
				letterZ = 230;
				break;
	
			case 105: // i
				letterY = -156;
				letterZ = 298;
				break;

			case 106: // j
				letterY = -90;
				letterZ = 230;
				break;

			case 107: // k
				letterY = -150;
				letterZ = 230;
				break;

			case 108: // l
				letterY = -210;
				letterZ = 230;
				break;

			case 109: // m
				letterY = -124;
				letterZ = 159;
				break;

			case 110: // n
				letterY = -56;
				letterZ = 160;
				break;

			case 111: // o
				letterY = -210;
				letterZ = 300;
				break;

			case 112: // p
				letterY = -266;
				letterZ = 300;
				break;

			case 113: // q
				letterY = 270;
				letterZ = 300;
				break;

			case 114: // r
				letterY = 84;
				letterZ = 300;
				break;

			case 115: // s
				letterY = 212;
				letterZ = 230;
				break;

			case 116: // t
				letterY = 28;
				letterZ = 298;
				break;

			case 117: // u
				letterY = -100;
				letterZ = 300;
				break;

			case 118: // v
				letterY = 60;
				letterZ = 160;
				break;

			case 119: // w
				letterY = 206;
				letterZ = 300;
				break;

			case 120: // x
				letterY = 180;
				letterZ = 160;
				break;

			case 121: // y
				letterY = -40;
				letterZ = 300;
				break;

			case 122: // z
				letterY = 242;
				letterZ = 160;
				break;

			}


		wait( 400 ) ; 
		me = ent_create("../Letters+26.tga", vector(0,letterY,letterZ), letter) ; // create a new letter entity and start its function
		my.ascii = letterAscii;		// stores the letter's ascii value
		my.previous = entHandle;		// inherits the previous letter's handle
		my.eliminated = 0;
		my.ambient = 100 ; 
		reset(my,INVISIBLE);
		entHandle = handle(me) ; // save the current letter's handle so it can be assigned to the next letter

		letterAscii = str_to_asc(sourceString); 
		
		str_cpy( myFontString,sourceString ) ;
		str_trunc(myFontString, (str_len(myFontString) - 1)) ;  // now myFontString == 1st Letter 

		str_clip(sourceString,1);
		}

	}
Exemplo n.º 30
0
void qlevel_load(STRING *filename)
{
	STRING *file = "#256";
	make_path(file, filename);
	if(!file_exists(file))
	{
		error("FIXIT! qlevel_load: File does not exist!");
		return;
	}
		
	level_load(NULL);
	
	int countEntity = ini_read_int(file, "Level Information", "EntityCount", 0);
	int countLight = ini_read_int(file, "Level Information", "LightCount", 0);
	int countFog = ini_read_int(file, "Level Information", "FogCount", 0);
	
	STRING *section = "#64";
	
	int i;
	char buffer[256];
	STRING *strTemp = "#128";
	for(i = 0; i < countEntity; i++)
	{
		diag("\nLoad :");
		str_cpy(section, "Entity ");
		str_cat(section, str_for_int(NULL, i));
		diag(section);
		
		ini_read_buffer(file, section, "Model", "error.mdl", buffer, 256);
		ENTITY *ent = ent_create(buffer, nullvector, qlevel_entity_init);
		ent->group = GROUP_LEVEL;
		ent->x = ini_read_float(file, section, "X", 0);
		ent->y = ini_read_float(file, section, "Y", 0);
		ent->z = ini_read_float(file, section, "Z", 0);
		
		ent->pan = ini_read_float(file, section, "Pan", 0);
		ent->tilt = ini_read_float(file, section, "Tilt", 0);
		ent->roll = ini_read_float(file, section, "Roll", 0);
		
		ent->scale_x = ini_read_float(file, section, "ScaleX", 0);
		ent->scale_y = ini_read_float(file, section, "ScaleY", 0);
		ent->scale_z = ini_read_float(file, section, "ScaleZ", 0);
		
		ent->lightrange = ini_read_float(file, section, "Lightrange", 0);
		
		int iActionCount = ini_read_int(file, section, "ActionCount", 0);
		int iA = 0;
		STRING *actionName = "#64";
		for(iA = 0; iA < iActionCount; iA++)
		{
			str_cpy(actionName, "Action");
			str_cat(actionName, str_for_int(NULL, iA));
			ini_read_buffer(file, section, actionName, "", buffer, 256);
			str_cpy(strTemp, buffer);
			diag("\nTry adding action '");
			diag(strTemp);
			diag("'...");
			if(actinfo_add(ent->string1, strTemp))
			{
				diag(" SUCCESS!\n\tTry getting function pointer...");
				void *fn = action_getptr(strTemp);
				if(fn != NULL)
				{
					diag(" SUCCESS!");
					scheduler_add(fn, ent);
				}
				else
				{
					diag(" FAILED!");				
				}
			}
			else
			{
				diag(" FAILED!");
			}
		}
		diag("\nEntity loaded!");
	}
}