• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_play函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中snd_play函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_play函数的具体用法?C++ snd_play怎么用?C++ snd_play使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了snd_play函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: trigger_visible

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);
	}
}
开发者ID:Acknex,项目名称:Prince-of-Lotteria,代码行数:27,代码来源:trigger.c


示例2: msg_mines

int msg_mines (int n, int msg, int z) {		// space mines
	int sh, x, y;
	switch (msg) {
		case msg_update:
			objs[n].count = (objs[n].count + 1)&3; return (1);
		case msg_draw:
			sh = 0xf00 + 18 + objs[n].count/2;
			drawshape (&gamevp, sh, objs[n].x, objs[n].y); break;
		case msg_touch:
			switch (objs[z].kind) {
				case obj_player:
					if (class_cnt(class_shield)==0) {
						p_hit (2); snd_play (1,5);
						x = objs[n].x - 11; y = objs[n].y - 9;
						addobj (obj_explode3, x, y, 0, 0);
						explosion (objs[n].x, objs[n].y, 5);
						text ("You hit an enemy space mine!",0);
						killobj (n);
						}; break;
				case obj_shield:
					addobj (obj_explode2, objs[n].x, objs[n].y, 0, 0);
					explosion (objs[n].x, objs[n].y, 5);
					text ("Your shield was destroyed by a space mine",0);
					killobj (n); killobj (z); snd_play (1,5);
				};
		}; return (0);
	};
开发者ID:dos-games,项目名称:vanilla-kiloblaster,代码行数:27,代码来源:2b_objs.c


示例3: supernova_process

void supernova_process()
{
	int sn_stage;

	// if the supernova is running
	sn_stage = supernova_active();
	if(sn_stage) {
		Supernova_time -= flFrametime;

		// sound stuff
		if((Supernova_time <= SUPERNOVA_SOUND_1_TIME) && !Supernova_sound_1_played) {
			Supernova_sound_1_played = 1;
			snd_play(&Snds[SND_SUPERNOVA_1], 0.0f, 1.0f, SND_PRIORITY_MUST_PLAY);
		}
		if((Supernova_time <= SUPERNOVA_SOUND_2_TIME) && !Supernova_sound_2_played) {
			Supernova_sound_2_played = 1;
			snd_play(&Snds[SND_SUPERNOVA_2], 0.0f, 1.0f, SND_PRIORITY_MUST_PLAY);
		}

		// if we've crossed from stage 1 to stage 2 kill all particles and stick a bunch on the player ship
		if((sn_stage == 1) && (supernova_active() == 2)) {
			// first kill all active particles so we have a bunch of free ones
			particle_kill_all();
		}

		// if we're in stage 2, emit particles
		if((sn_stage >= 2) && (sn_stage != 5)) {
			supernova_do_particles();
		}

		// if we've got negative. the supernova is done
		if(Supernova_time < 0.0f) {
			Supernova_finished = 1;
			Supernova_fade_to_white += flFrametime;

			// start the dead popup
			if(Supernova_fade_to_white >= SUPERNOVA_FADE_TO_WHITE_TIME) {
				if(!Supernova_popup) {
					// main freespace 2 campaign? if so - end it now
					//
					// don't actually check for a specific campaign here since others may want to end this way but we
					// should test positive here if in campaign mode and sexp_end_campaign() got called - taylor
					if (Campaign_ending_via_supernova && (Game_mode & GM_CAMPAIGN_MODE) /*&& !stricmp(Campaign.filename, "freespace2")*/) {
						gameseq_post_event(GS_EVENT_END_CAMPAIGN);
					} else {
						popupdead_start();
					}
					Supernova_popup = 1;
				}
				Supernova_finished = 2;
			}
		}
	}
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:54,代码来源:supernova.cpp


示例4: ebHandsBgFly

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);
}
开发者ID:Acknex,项目名称:Prince-of-Lotteria,代码行数:53,代码来源:endboss.c


示例5: msg_shield

int msg_shield (int n, int msg, int z) {
	int sh;
	switch (msg) {
		case msg_update:
			if (objs[n].count2 >= 240)
				objs[n].count = (objs[n].count + 1)&3;
			move_obj (n, objs[0].x-2, objs[0].y-2);
			if (++objs[n].count2==340) killobj (n); return (1);
		case msg_draw:
			sh = 0x804 + objs[n].count/2;
			drawshape (&gamevp, sh, objs[n].x, objs[n].y); break;
		case msg_touch:
			switch (objs[z].kind) {
				case obj_enemy1:
				case obj_enemy2:
				case obj_enemy3:
				case obj_enemy4:
				case obj_enemy5:
				case obj_enemy6:
				case obj_enemy7:
				case obj_enemy8:
				case obj_enemy9:
				case obj_enemya:
				case obj_enemyb:
				case obj_enemyc:
				case obj_enemyd:
				case obj_enemye:
				case obj_enemyf:
				case obj_enemyg:
				case obj_enemyh:
				case obj_enemyi:
				case obj_enemyj:
				case obj_enemyk:
					snd_play (1,7);
					if (objs[z].count3 < 1) {
						killobj (z);
						}
					else {
						objs[z].xd = -objs[z].xd;
						objs[z].yd = -objs[z].yd;
						}; break;
				case obj_bullet2:
				case obj_spinner:
				case obj_laser:
					snd_play (1,7);
					explosion (objs[z].x, objs[z].y, 5);
					killobj (z);
				};
		}; return (0);
	};
开发者ID:dos-games,项目名称:vanilla-kiloblaster,代码行数:50,代码来源:2b_objs.c


示例6: ebStartSpeech

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);
}
开发者ID:Acknex,项目名称:Prince-of-Lotteria,代码行数:28,代码来源:endboss.c


示例7: mission_maybe_play_directive_success_sound

// Maybe play a directive success sound... need to poll since the sound is delayed from when
// the directive is actually satisfied.
void mission_maybe_play_directive_success_sound()
{
	if ( timestamp_elapsed(Mission_directive_sound_timestamp) ) {
		Mission_directive_sound_timestamp=0;
		snd_play( &Snds[SND_DIRECTIVE_COMPLETE] );
	}
}
开发者ID:Admiral-MS,项目名称:fs2open.github.com,代码行数:9,代码来源:missiongoals.cpp


示例8: playTaunt

void playTaunt(int index)
{
   if (g_num_taunts[index] > 0)
         {
      int sndIndex = 0;

      if (g_num_taunts[index] > 1) {
         sndIndex = (int) random(g_num_taunts[index]);
      }

      if (g_tauntHandles[index] != 0) {
         snd_stop(g_tauntHandles[index]);
         g_tauntHandles[index] = 0;
      }

      SOUND** sndArr = g_taunts[index];
      if (sndArr != null) {

         SOUND* snd = sndArr[sndIndex];
         if (snd != null) {
            g_tauntHandles[index] = snd_play(snd, g_tauntVolume, 0);
         }
      }
   }
}
开发者ID:Acknex,项目名称:Ackmania,代码行数:25,代码来源:taunts.c


示例9: snd_play

/*--------------------------------------------------------------------------------*
| <<< パンチ >>>
*---------------------------------------------------------------------------------*/
void	cPlayer::Punch(void)
{
	for(int i = 0; i < PLAYER_PUNCH_MAX; i++)
	{//一回目 左
												//二回目 右
		//--- パンチを出す処理 -----------------------------------------
		//
		int	aiKey[] = {KEY_LCTRL, KEY_RCTRL};

		// ↓キー入力があり、			↓パンチしてなく、			↓防御してない時にパンチが打てる
		if(pad.bKeyClick[aiKey[i]] && m_afPunchTime[i] == 0 && m_fGuardTime == 0)
		{
			m_afPunchTime[i] = PUNCH_TIME;		// パンチ時間に値を入れたら開始
			snd_play(SND_PUNCH);
		}

		//--- パンチを戻す処理 ------------------------------------------
		VALUE_TO_TARGET(m_afPunchTime[i], 0, PUNCH_SPEED);
		//--- ダメージ計算 ----------------------------------------------
		if(m_afPunchTime[i] > 0)				// パンチのアニメーションを進める。PUNCH_TIME が 0 になるまで。
		{										// 20は速度(大きくすると速くなる)
			CalcEnemyDamage(i);					// ここでダメージ計算
		}
	}
}
开发者ID:Github-J,项目名称:WinGames,代码行数:28,代码来源:Player.cpp


示例10: gamesnd_play_iface

void gamesnd_play_iface(int n)
{
	if (Snds_iface_handle[n] >= 0)
		snd_stop(Snds_iface_handle[n]);

	Snds_iface_handle[n] = snd_play(&Snds_iface[n]);
}
开发者ID:X3N0-Life-Form,项目名称:fs2open.github.com,代码行数:7,代码来源:gamesnd.cpp


示例11: raceintro_trigger

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();
	}
}
开发者ID:Acknex,项目名称:Ackmania,代码行数:34,代码来源:raceintro.c


示例12: doChopped

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);
}
开发者ID:Acknex,项目名称:Prince-of-Lotteria,代码行数:33,代码来源:endboss.c


示例13: ui_state_title

void ui_state_title(void)
{
    int x = 0, y = 0, dx = 1, dy = 1, w = 20, h = 20, i = 0;

    snd_play("sounds/intro-valkyrie.raw");

    while (1) {
        image_draw(0, 0, img_bg);
        image_draw(x, y, img_soldier);
        screen_show_buffer();

        if (y + h == SCREEN_HEIGHT && dy == 1) dy = -1;
        if (y == 0 && dy == -1) dy = 1;
        if (x + w == SCREEN_WIDTH && dx == 1) dx = -1;
        if (x == 0 && dx == -1) dx = 1;
        x += dx; y += dy;

        led_setup = (i++ / 10) % 2 ? 0xaa : 0x55;
        led_update();

        if ((btn_ignore = btn_read()) > 0) {
            ui_state = UI_GAME_SOLDIER;
            game_init();
            return;
        }
    }
}
开发者ID:evegard,项目名称:tdt4258,代码行数:27,代码来源:ui.c


示例14: TitleMenu

/*-----------------------------------------------------------------------------*
| <<< メニュー使用時のタイトル >>>
|	入力	iTex	= 表示するテクスチャー番号
|			iSound	= 左クリック時の効果音
|			bSw		= true : フェードアウト開始
|	戻り値	true	= モードが変わった
*-------------------------------------------------------------------------------*/
bool	TitleMenu(int	iTex,	int	iSound,	bool bSw)
{
	bool	bRet	= false;

	//--- 640×480 ドットの絵を表示 --------------------
	d3_tex_set(iTex);
	d3_2d_box_fill_tex_draw(&VEC2(0, 0), &VEC2(__SCR_W, __SCR_H), D3_COL((int)fCount, 255, 255, 255));

	//--- キー入力チェック --------------------------------------
	if(bSw)						// ここ、Title関数と違う
	{
		iFade = 1;
		snd_play(iSound);
	}
	//--- フィード ------------------------------------
	switch(iFade)
	{
	case -1:		//イン
		fCount += FADE_SPEED_;
		if(fCount >= 255.0f){ fCount = 255.0f; iFade = 0;}
		break;
	case 1:			//アウト
		fCount -= FADE_SPEED_;
		if(fCount <= 0.0f)
		{
			fCount = 0.0f;
			iFade  = -1;
			
				bRet	= true;
		}
		break;
	}
	return bRet;
}
开发者ID:Github-J,项目名称:WinGames,代码行数:41,代码来源:Title.cpp


示例15: hud_augment_shield_quadrant

// ------------------------------------------------------------------
// hud_augment_shield_quadrant()
//
// Transfer shield energy to a shield quadrant from the three other
//	quadrants.  Works by trying to transfer a fixed amount of shield
//	energy from the other three quadrants, taking the same percentage
// from each quadrant.
//
//	input:	objp			=>		object to perform shield transfer on
//				direction	=>		which quadrant to augment:
//										0 - right
//										1 - top
//										2 - bottom
//										3 - left
//
void hud_augment_shield_quadrant(object *objp, int direction)
{
	Assert(objp->type == OBJ_SHIP);

	ship *shipp = &Ships[objp->instance];
	ship_info *sip = &Ship_info[shipp->ship_info_index];
	float	xfer_amount, energy_avail, percent_to_take, delta;
	float	max_quadrant_val;
	int	i;

	if (sip->flags[Ship::Info_Flags::Model_point_shields]) {
		direction = sip->shield_point_augment_ctrls[direction];

		// The re-mapped direction can be -1 if this direction cannot be augmented
		if (direction < 0)
			return;
	}

	Assert(direction >= 0 && direction < objp->n_quadrants);
	
	xfer_amount = shipp->ship_max_shield_strength * SHIELD_TRANSFER_PERCENT;
	max_quadrant_val = get_max_shield_quad(objp);

	if ( (objp->shield_quadrant[direction] + xfer_amount) > max_quadrant_val )
		xfer_amount = max_quadrant_val - objp->shield_quadrant[direction];

	Assert(xfer_amount >= 0);
	if ( xfer_amount == 0 ) {
		// TODO: provide a feedback sound
		return;
	}
	else {
		snd_play( &Snds[SND_SHIELD_XFER_OK] );
	}

	energy_avail = 0.0f;
	for ( i = 0; i < objp->n_quadrants; i++ ) {
		if ( i == direction )
			continue;
		energy_avail += objp->shield_quadrant[i];
	}

	percent_to_take = xfer_amount/energy_avail;
	if ( percent_to_take > 1.0f )
		percent_to_take = 1.0f;

	for ( i = 0; i < objp->n_quadrants; i++ ) {
		if ( i == direction )
			continue;
		delta = percent_to_take * objp->shield_quadrant[i];
		objp->shield_quadrant[i] -= delta;
		Assert(objp->shield_quadrant[i] >= 0 );
		objp->shield_quadrant[direction] += delta;
		if ( objp->shield_quadrant[direction] > max_quadrant_val )
			objp->shield_quadrant[direction] = max_quadrant_val;
	}
}
开发者ID:rtoijala,项目名称:fs2open.github.com,代码行数:72,代码来源:hudshield.cpp


示例16: hud_add_ship_to_escort

// try to add a ship to the escort list, if slot available
void hud_add_ship_to_escort(int objnum, int supress_feedback)
{
	escort_info complete_escorts[MAX_COMPLETE_ESCORT_LIST];
	int num_complete_escorts, idx, found;

	// get complete escort list
	hud_create_complete_escort_list(complete_escorts, &num_complete_escorts);

	// check if ship is already on complete escort list
	found = 0;
	for (idx=0; idx<num_complete_escorts; idx++) {
		if (complete_escorts[idx].obj_signature == Objects[objnum].signature) {
			found = 1;
			break;
		}
	}

	// add new ship into complete list
	if ( !found ) {
		complete_escorts[num_complete_escorts].objnum = objnum;
		complete_escorts[num_complete_escorts].obj_signature = Objects[objnum].signature;
		complete_escorts[num_complete_escorts].priority = Ships[Objects[objnum].instance].escort_priority;

		// remove him from escort list
		Ships[Objects[objnum].instance].flags |= SF_ESCORT;

		num_complete_escorts++;
	}

	// sort escort list by priority
	insertion_sort(complete_escorts, num_complete_escorts, sizeof(escort_info), escort_compare_func);

	// merge list
	merge_escort_lists(complete_escorts, num_complete_escorts);

	// maybe do feedback
	if ( (Num_escort_ships == Max_escort_ships) && !supress_feedback) {
		found = 0;
		// search thru list for objnum
		for (idx=0; idx<Num_escort_ships; idx++) {
			if (Escort_ships[idx].objnum == objnum) {
				found = 1;
				break;
			}
		}

		if (!found) {
			HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Escort list is full with %d ships", 288), Num_escort_ships);
			snd_play( &Snds[SND_TARGET_FAIL]);
		}
	}

	hud_gauge_popup_start(HUD_ESCORT_VIEW);
}
开发者ID:svn2github,项目名称:FS2Open_Trunk,代码行数:55,代码来源:hudescort.cpp


示例17: chicken

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.
	}
}
开发者ID:Abbylester,项目名称:AKA,代码行数:52,代码来源:chicken.c


示例18: transfer_energy_weapon_common

void transfer_energy_weapon_common(object *objp, float from_field, float to_field, float *from_delta, float *to_delta, float max, float scale)
{
	float	delta;

	delta = from_field * ENERGY_DIVERT_DELTA * scale;

	if (to_field + *to_delta + delta > max)
		delta = max - to_field - *to_delta;

	if ( delta > 0 ) {
		if ( objp == Player_obj )
			snd_play( &Snds[SND_ENERGY_TRANS], 0.0f );

		if (delta > from_field)
			delta = from_field;

		*to_delta += delta;
		*from_delta -= delta;
	} else
		if ( objp == Player_obj )
			snd_play( &Snds[SND_ENERGY_TRANS_FAIL], 0.0f );
}
开发者ID:DahBlount,项目名称:Freespace-Open-Swifty,代码行数:22,代码来源:hudets.cpp


示例19: hud_update_reticle

// called once per frame to update the reticle gauges.  Makes calls to
// ship_dumbfire_threat() and ship_lock_threat() and updates Threat_flags.
void hud_update_reticle( player *pp )
{
	int rval;
	ship *shipp;

	// multiplayer clients won't call this routine
	if ( MULTIPLAYER_CLIENT || MULTI_OBSERVER(Net_players[MY_NET_PLAYER_NUM]))
		return;

	shipp = &Ships[Objects[pp->objnum].instance];

	if ( ship_dumbfire_threat(shipp) ) {
		pp->threat_flags |= THREAT_DUMBFIRE;
		pp->update_dumbfire_time = timestamp(THREAT_UPDATE_DUMBFIRE_TIME);
	}

	if ( timestamp_elapsed(pp->update_dumbfire_time) ) {
		pp->update_dumbfire_time = timestamp(THREAT_UPDATE_DUMBFIRE_TIME);
		pp->threat_flags &= ~THREAT_DUMBFIRE;
	}

	if ( timestamp_elapsed(pp->update_lock_time) ) {
		pp->threat_flags &= ~(THREAT_LOCK | THREAT_ATTEMPT_LOCK);
		pp->update_lock_time = timestamp(THREAT_UPDATE_LOCK_TIME);
		rval = ship_lock_threat(shipp);
		if ( rval == 1 ) {
			pp->threat_flags |= THREAT_ATTEMPT_LOCK;
		} else if ( rval == 2 ) {
			pp->threat_flags |= THREAT_LOCK;
		}
	}

	if(Player->threat_flags & THREAT_LOCK ) {
		// a less hacked up version of the missile launch warning
		hud_start_text_flash(XSTR("Launch", 1507), THREAT_LOCK_FLASH, fl2i(THREAT_LOCK_FLASH/2.0f));
	}

	if ( Player->threat_flags & (THREAT_ATTEMPT_LOCK) ) {
		if ( timestamp_elapsed(Threat_lock_timer) ) {
			Threat_lock_timer = timestamp(THREAT_LOCK_FLASH);
			
			Threat_lock_frame++;
			if ( Threat_lock_frame > 2 ) {
				Threat_lock_frame = 1;
			}
			if ( (Threat_lock_frame == 2) && (Player->threat_flags & THREAT_ATTEMPT_LOCK ) ) {
				snd_play( &Snds[ship_get_sound(Player_obj, SND_THREAT_FLASH)]);
			}
		}
	} 
}
开发者ID:X3N0-Life-Form,项目名称:fs2open.github.com,代码行数:53,代码来源:hudreticle.cpp


示例20: ebHandStone

		// Stone rain
		action ebHandStone () {
			set(me, PASSABLE);
			var randomFallSpeed = random(20);
			while(my.z > -100) {
				my.z -=(20+randomFallSpeed) * time_step;
				my.pan +=randomFallSpeed * time_step;
				my.tilt +=randomFallSpeed * time_step;
				my.roll +=randomFallSpeed * time_step;
				
				// Give player 2 seconds to recover from last hit
				if (g_playerJustBeenHit == 0) {
					
					// Stone hits player?
					if (vec_dist(player.x, my.x) < 30) {
						
						// Play sounds
						if (!snd_playing(vPlayerSndHandle))
							vPlayerSndHandle = snd_play(g_sndHitByStone, 100, 0);
						snd_play(g_sndStoneImpact, 100, 0);	
							
						player.PL_HEALTH -=1;
						ent_remove(me);
						
						g_playerJustBeenHit = 2;
						
						// Wait 2 seconds
						while(g_playerJustBeenHit > 0) {
							g_playerJustBeenHit -=1;
							wait(-1);
						}
						return;
					}
				}
				
				wait(1);
			}
			ent_remove(me);
		}
开发者ID:Acknex,项目名称:Prince-of-Lotteria,代码行数:39,代码来源:endboss.c



注:本文中的snd_play函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_power_change_state函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_pcm_sw_params_set_start_threshold函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap