Esempio n. 1
0
BOOL crLottiUpdateFly (ENTITY* e)
{
	VECTOR v, w;
	
	vec_set(&w, e->crAccel);
	vec_scale(&w, time_step);
	vec_add(e->crSpeed, &w);
	
	vec_set(&v, e->crSpeed);
	vec_scale(&v, time_step);
	vec_add(e->x, &v);
	
	VECTOR feet;
	
	feet.x = feet.y = 0;
	feet.z = 0.5 * e->min_z;
	
	vec_rotate(feet, e->pan);
	vec_add(feet, e->x);
	
	ent_animate(e, "drown", 5 * total_ticks + e->crInit, ANM_CYCLE);
	
	effect(credits_fire, 2, feet, e->crSpeed);
	
	// explode near screen border

	VECTOR v;
	vec_set(&v, e->x);
	
	vec_to_screen(&v, camera);
	
	return (v.x < e->crPercent * screen_size.x || v.x > (1 - e->crPercent) * screen_size.x ||
	        v.y < e->crPercent * screen_size.y || v.y > (1 - e->crPercent) * screen_size.y);
}
Esempio n. 2
0
int main(int argc, char **argl)
{
	while( !ready() ) wait(1.0);
	draw_pos.x = 25.0;
	draw_pos.y = 150.0;
	
	window_size_set(1280, 720);
	
	level_load( "td1\\arena.wmb" );
	vec_set( &camera->x, vector(876, 516, -79) );
	vec_set( &camera->pan, vector(112, 5, 0) );
	object_sky_create( "td1\\envy+6.tga", 1 );
	
	render_rain_new();

	on_1 = create_crt;
	on_2 = create_grain;
	on_3 = create_sepia;
	on_4 = create_vignette;
	on_5 = create_grayscale;
	on_6 = rain_on;
	on_7 = rain_off;
	
	while(!key_esc)
	{	
		draw_text(sstr, 10, 10, COLOR_PEACH);
		draw_text(sstr_mode, draw_pos.x, draw_pos.y, COLOR_BLEU_DE_FRANCE);
		
		camera->pan += 0.25 * time_step;
		
		wait(1.0);
	}
	
	sys_exit(0);
}
Esempio n. 3
0
void level_load_ext(STRING* _lvl) {
	if (_lvl != NULL) {
		if (panLoad == NULL) {
			on_level = on_level_event;
			on_level_load = on_level_loaded_event;
			panLoad = pan_create("", 100);
			vec_set(panLoad.blue, vector(8,8,8));
			pan_setdigits(panLoad, 0, 10, 10, "Loading...", font_create("Arial#30b"), 1, vDummy2);
			pan_setcolor(panLoad, 1, 1, vector(255,255,255));
			
			panLoadBar = pan_create("", 101);
			vec_set(panLoadBar.blue, vector(0,0,255));
		}
		
		panLoad.size_x = screen_size.x;
		panLoad.size_y = screen_size.y;
		panLoadBar.size_x = 0;
		panLoadBar.size_y = 40;
		panLoadBar.pos_x = 0;
		panLoadBar.pos_y = screen_size.y - 100;		
		set(panLoad, LIGHT | SHOW);
		set(panLoadBar, LIGHT | SHOW);
		
		wait(1);
		level_load(_lvl);
	}
}
Esempio n. 4
0
void item_fade()
{
	var vTicks = total_ticks;
	VECTOR vecDist;
	
	var fadeScale = my->scale_x;
	vec_set(&vecDist, &my->x);
	vec_sub(&vecDist, &player->x);
	while (my->scale_x > 0)
	{
		wait(1);
		//scale down item
		my->scale_x -= 0.1 * time_step * fadeScale;
		my->scale_y = my->scale_x;
		my->scale_z = my->scale_x;
		my->pan += (total_ticks - vTicks) * 10 * time_step;

		//move item towards player
		vec_set(&my->x, &vecDist);
		vec_scale(&my->x, my->scale_x / fadeScale);
		vec_add(&my->x, &player->x);
	}
	itemCounter--;
	ptr_remove(me);
}
Esempio n. 5
0
void bd_set_transitions(BDPhyloHmm *bdphmm) {
  int state;
  HMM *hmm = bdphmm->phmm->hmm;
  TreeNode *tree = bdphmm->phmm->mods[0]->tree;

  /* set transition probs based on mu, nu, and phi */
  for (state = 1; state < hmm->nstates; state++) {
    if (state == tree->nnodes)
      mm_set(hmm->transition_matrix, 0, state, bdphmm->nu * (1-bdphmm->phi));
    else 
      mm_set(hmm->transition_matrix, 0, state, bdphmm->nu * bdphmm->phi / 
             (hmm->nstates-2));
    mm_set(hmm->transition_matrix, state, 0, bdphmm->mu);
    mm_set(hmm->transition_matrix, state, state, 1-bdphmm->mu);
  }
  mm_set(hmm->transition_matrix, 0, 0, 1-bdphmm->nu);

  /* begin transitions */
  vec_set(hmm->begin_transitions, 0, 
          bdphmm->mu/(bdphmm->mu + bdphmm->nu));
  for (state = 1; state < hmm->nstates; state++) {
    if (state == tree->nnodes)
      vec_set(hmm->begin_transitions, state, bdphmm->nu * (1-bdphmm->phi)/
              (bdphmm->mu + bdphmm->nu));
    else 
      vec_set(hmm->begin_transitions, state, bdphmm->nu * bdphmm->phi /
              ((bdphmm->mu + bdphmm->nu) * (hmm->nstates-2)));
  }

  hmm_reset(hmm);
}
Esempio n. 6
0
void main() {
	video_mode = 9;
	max_entities = 30000;
	terrain_chunk = 0;
	level_load(NULL);
	random_seed(0);
	mouse_mode = 4;
	vec_set(camera.x, vector(-1101, -97, 800));
	vec_set(camera.pan, vector(4,-29,0));
	
	// Terrain
	BMAP* bmapHeightMap = generate_random_heightmap_noise(256, 256, 64);
	BMAP* bmapColorMap = heightmap_to_colormap(bmapHeightMap);
	ENTITY* entTerrain = terrain_from_heightmap(vector(0,0,-300), bmapHeightMap, 65, 65, 30, 0.4);
	ent_setskin(entTerrain, bmapColorMap, 2);
	entTerrain.material = mat_terrain_multi_texture;
	
	// Roads
	proc_city_create_skins();	
	List *points = roadnetwork_from_rectlangle(entTerrain.min_x + 100, entTerrain.min_y + 100, entTerrain.max_x - 50, entTerrain.max_y - 50, 200, 6);
	//List *points = roadnetwork_from_voronoi(30, entTerrain.min_x + 100, entTerrain.min_y + 100, entTerrain.max_x - 50, entTerrain.max_y - 50);
	List *intersections = roadnetwork_calculate(points);
	roadnetwork_join_near_intersections(intersections, 100); // Delete intersections which are too near to each other
	List *roadNetwork = roadnetwork_build(intersections, 300, true);
	
	// Parcels
	create_parcels(roadNetwork);
}
int test() {
	vector * vec = (vector *) malloc(sizeof(struct vector));
	vec_init(vec, 50);
	int i;

	for (i = 0; i < 14; i++) {
		vec_push(vec, i * 4 + 2);
	}

	vec_set(vec, 0, 1);
	printf("capacity = %zd, %zd\n", vec->capacity, vec->size);
	vec_set(vec, 39, 1);
	printf("capacity = %zd, %zd\n", vec->capacity, vec->size);
	vec_set(vec, 19, 2);
	printf("capacity = %zd, %zd\n", vec->capacity, vec->size);
	vec_set(vec, 45, 2);
	printf("capacity = %zd, %zd\n", vec->capacity, vec->size);

	printf("vec[3] = %d\n", vec_get(vec, 3));
	printf("vec[6] = %d\n", vec_get(vec, 6));
	printf("vec[666] = %d\n", vec_get(vec, 666));

	for (size_t i = 0; i < vec->size; i++) {
		printf("vec[%zd] = %d\n", i, vec->data[i]);
	}

	vec_free(vec);

	return 0;
}
Esempio n. 8
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;
}
Esempio n. 9
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);
	}
}
Esempio n. 10
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);
	}
}
Esempio n. 11
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);
	}
}
Esempio n. 12
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);
	}
}
Esempio n. 13
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);
	}
}
Esempio n. 14
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);
	}
}
Esempio n. 15
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);
	}
}
Esempio n. 16
0
ChapterData *ChapterDataCreate(const char *name, const char *internal_name,
                               const STRING *thumbnail_name, const COLOR *vsun_color,
						       const COLOR *vfog_color, const VECTOR *vfog_range,
						       const float vsun_light)
{
	ASSERT(internal_name, _chr("Fatal error in ChapterDataCreate(): A null char * pointer was given to the function, cannot create the data block."));
	ASSERT(strlen(internal_name) < CHAPTER_INAME_MAX_LENGTH, _chr("Fatal error in ChapterDataCreate(): Chapter name's length exceeds CHAPTER_INAME_MAX_LENGTH."));

	ChapterData *data     = (ChapterData *) sys_malloc(sizeof(ChapterData));
	data->chapter_name    = (char *)        sys_malloc(CHAPTER_NAME_MAX_LENGTH * sizeof(char));
	data->chapter_iname   = (char *)        sys_malloc(CHAPTER_INAME_MAX_LENGTH * sizeof(char));
	data->pad             = (float *)       sys_malloc(CHAPTER_PAD_VARS_MAX_LENGTH * sizeof(float));
	data->sun_light       = -1.0;

	// The chapter name can be left blank, whilist the chapter's internal name (its scene file)
	// must not be blank - each ChapterData struct has to be linked to a scene in some way.
	if(name)
		if(strlen(name) <= CHAPTER_NAME_MAX_LENGTH)
			strcpy(data->chapter_name, name);

	strcpy(data->chapter_iname, internal_name);

	// Continue to allocate and set up any additional parameters.
	if(thumbnail_name)
		if(file_exists(thumbnail_name))
			data->thumbnail = bmap_create(thumbnail_name);

	if(vsun_color)
	{
		data->sun_color     = (COLOR *) sys_malloc(sizeof(COLOR));
		vec_set(data->sun_color, vsun_color);
	}

	if(vfog_color)
	{
		data->fog_color     = (COLOR *) sys_malloc(sizeof(COLOR));
		vec_set(data->fog_color, vfog_color);

		if(vfog_range)
		{
			data->fog_range = (VECTOR *) sys_malloc(sizeof(VECTOR));
			vec_set(data->fog_range, vfog_range);
		}
	}

	if(vsun_light >= 0.0)
		data->sun_light = vsun_light;

	return data;
}
Esempio n. 17
0
static void get_camera_frame(vector x, vector y, vector z)
{
	matrix m;

	vec_set(x, 1.0f, 0.0f, 0.0f);
	vec_set(y, 0.0f, 1.0f, 0.0f);
	vec_set(z, 0.0f, 0.0f, 1.0f);

	mat_rotate(m, y, y_rot);
	mat_mul_vector(x, m, x);
	mat_mul_vector(z, m, z);

	mat_rotate(m, x, x_rot);
	mat_mul_vector(y, m, y);
	mat_mul_vector(z, m, z);
}
Esempio n. 18
0
action item_wood()
{
	vec_set(my->scale_x, vector(10, 10, 10));
	my->ENTITY_TYPE = LOGS;
	my->event = item_wood_evt;
	item_loop();	
}
Esempio n. 19
0
void creditsReset ()
{
	sky_active = 0;
	
	g_bCrFirstLotti = false;
	
	gui_hide();
	
	creditsFinished = 0;
	currentRow = 0;
	
	resetPpSwirl();
	
	camera->clip_far = 30000;
	
	vec_set(&g_vecCreditsCamShake, nullvector);
	
	snd_stopall(4);
	g_fhCreditsSong = 0;
	
	resetPpSwirl ();
	
	reset(g_txtCreditsSpace, SHOW);
	
	reset(creditsHead1, SHOW);
	reset(creditsHead2, SHOW);
	reset(creditsBody1, SHOW);
	reset(creditsBody2, SHOW);
	
	g_bCreditsAllExplode = false;
	
	on_space = NULL;
	
	level_load(NULL);
}
Esempio n. 20
0
/*
 * get_attack_board_xyz --
 *	Fill in a vector with the position of the center of an attack board,
 *	in world coordinates.
 */
void
get_attack_board_xyz(struct vector *p, int main_board, int attack_board)
{
	float x, y, z;

	if (ATTACK_BOARD_IS_UP(attack_board))
		x = -2.f*SQUARE_SIZE;
	else
		x = 2.f*SQUARE_SIZE;

	if (ATTACK_BOARD_IS_RIGHT(attack_board))
		y = 2.f*SQUARE_SIZE;
	else
		y = -2.f*SQUARE_SIZE;

	if (ATTACK_BOARD_IS_ABOVE(attack_board))
		z = ATTACK_BOARD_DISTANCE;
	else
		z = -ATTACK_BOARD_DISTANCE;

	z += MAIN_BOARD_DISTANCE - MAIN_BOARD_DISTANCE*main_board;

	x -= 2.f*SQUARE_SIZE;
	x += 2.f*SQUARE_SIZE*main_board;

	vec_set(p, x, y, z);
}
Esempio n. 21
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++;
}
Esempio n. 22
0
void
ui_set_modelview_matrix(struct matrix *mv)
{
	struct matrix ry, rx, rm;
	struct vector p, o;
	struct matrix c, t, r, v;

	mat_make_rotation_around_y(&ry, ui.rotation);
	mat_make_rotation_around_x(&rx, ui.tilt);
	mat_mul_copy(&rm, &ry, &rx);

	vec_zero(&o); /* look at */

	vec_set(&p, 0.f, 0.f, -ui.distance); /* camera position */
	mat_rotate(&p, &rm);

	mat_make_look_at(&c, &o, &p);

	vec_neg(&p);
	mat_make_translation_from_vec(&t, &p);
	mat_mul_copy(&v, &c, &t);

	mat_make_rotation_around_x(&r, -M_PI/2.);

	mat_mul_copy(mv, &v, &r);
}
Esempio n. 23
0
File: log.c Progetto: Acknex/TUST
// Initialize log
void log_init(STRING* _logFile) {
	txtLog = txt_create(LOG_LINES,999);
	txtLog.font = fontLog;
	txtLog.size_x = screen_size.x;
	txtLog.size_y = 100;
	set(txtLog, SHOW | OUTLINE);
	int i;
	for(i=0; i<txtLog.strings; i++) {
		(txtLog.pstring)[i] = str_create("#256");
	}

	// Color for log text
	vec_set(cLogColor, vector(255,255,255));

	// Log to file, too?
	if (_logFile != NULL) {
		nLogToFile = 1;
		str_cpy(strLogFile, _logFile);
	}
	
	// If logging to file, initialize file IO
	if (nLogToFile == 1) {
		log_write_header();
	}
}
Esempio n. 24
0
/*
 * void render_rain_start()
 * 
 * Lets the sky rain.
 */
void render_rain_start()
{
	proc_mode = PROC_LATE;	
	if( RainState_singleton )
	{
		RainState_singleton->state = 1 - RainState_singleton->state;
		
		int i = 0;
		
		if(RainState_singleton->state)
		{
			for(; i < RainState_singleton->depth; i++)
			    (RainState_singleton->rain_levels)[i]->flags &= ~INVISIBLE;
		}
		
		while(RainState_singleton->state != 0)
		{
			for(i = 0; i < RainState_singleton->depth; i++)
			{
				vec_set(&(RainState_singleton->rain_levels)[i]->x, &camera->x);
				(RainState_singleton->rain_levels)[i]->skill41 = floatv(2.1);		// Control visibility (0 to ~)
			}
			
			wait(1.0);
		}
	}
}
Esempio n. 25
0
void player_particles()
{
	VECTOR particle_pos[3];
	vec_set (particle_pos.x, player.x);
	particle_pos.z += 70; // place the healing particles above the characters' heads		
	effect(particle_void, 1, particle_pos, nullvector);
}
Esempio n. 26
0
void raceintro_trigger(ENTITY* ent, SOUND* snd, void *callback)
{
	var i;
	ent.flags2 |= SHOW;
	
	ent->pan = -100;

	snd_play(snd, 100, 0);

	ent->material = mtl_unlit;
	ent->ambient = 200;

	var i = 0;
	for(i = 0; i < g_raceintro_ticks; i += time_step) {

	   vec_set(ent.x, vector(0.5 * screen_size.x, 0.5 * screen_size.y, g_raceintro_offset + i*g_raceintro_speed));
		rel_for_screen(ent.x, camera);

		ent->pan += 2 *time_step;

		ent.u = 10*total_ticks;
		ent.v = 10*total_ticks;

		wait(1);
	}
	
	ent.flags2 &= ~SHOW;
	
	if(callback != NULL) {
		void tmp();
		tmp = callback;
		tmp();
	}
}
Esempio n. 27
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);	
}
Esempio n. 28
0
action trigger_visible ()
{
	VECTOR vecTemp;
	while(1)
	{
		vec_set(vecTemp, my.x);
		if (vec_to_screen(vecTemp, camera) != NULL) {
			switch(my.skill1)
			{
			case 0:
				snd_play(snd_narrator_start, 100, 0);
				break;
			case 1:
				snd_play(snd_narrator_sky, 100, 0);
				break;
			case 2:
				snd_play(snd_narrator_enemy, 100, 0);
				break;
			case 3:
				snd_play(snd_narrator_lottifant, 100, 0);
				break;
			}
			break;
		}
		wait(1);
	}
}
Esempio n. 29
0
void gui_init() {
	panJetpackBorder = pan_create("", 2);
	panJetpackBorder.bmap = bmapJetpackColor;
	panJetpack = pan_create("", 3);
	panJetpack.bmap = bmapJetpackBorder;
	
	panHeart1 = pan_create("", 2);
	panHeart2 = pan_create("", 2);
	panHeart3 = pan_create("", 2);
	panHeart1.bmap = bmapZorroLife;
	panHeart2.bmap = bmapZorroLife;
	panHeart3.bmap = bmapZorroLife;
	txtLifes = txt_create(1, 2);
	set(txtLifes, OUTLINE);
	txtLifes.font = font_create("Arial#32b");
		
	panA4Cube = pan_create("", 2);
	panA4Cube.bmap = bmapA4Cube;
	txtA4Cube = txt_create(1, 3);
	set(txtA4Cube, OUTLINE);
	txtA4Cube.font = font_create("Arial#32b");
	
	txtGameOver = txt_create(1, 10);
	set(txtGameOver, OUTLINE | CENTER_X | CENTER_Y);
	txtGameOver.font = font_create("Arial#90b");
	vec_set(txtGameOver.blue, vector(0,0,255));
	str_cpy((txtGameOver.pstring)[0], "Game Over");
}
Esempio n. 30
0
void
mat_make_look_at(struct matrix *m, const struct vector *o,
  const struct vector *p)
{
	struct vector n, u, v, t;
	struct matrix a;

	vec_sub(&n, p, o);

	vec_normalize(&n);

	/* v' = (0, 1, 0) */

	vec_set(&v, 0.f, 1.f, 0.f);

	/* v = v' - (v'*n)*n */

	vec_scalar_mul_copy(&t, &n, vec_dot_product(&v, &n));
	vec_sub_from(&v, &t);
	vec_normalize(&v);

	vec_cross_product(&u, &v, &n);
	vec_normalize(&u);

	m->m11 = u.x; m->m12 = u.y; m->m13 = u.z; m->m14 = 0.f;
	m->m21 = v.x; m->m22 = v.y; m->m23 = v.z; m->m24 = 0.f;
	m->m31 = n.x; m->m32 = n.y; m->m33 = n.z; m->m34 = 0.f;

	mat_make_translation(&a, -o->x, -o->y, -o->z);

	mat_mul(m, &a);
}