当前位置: 首页>>代码示例>>C++>>正文


C++ snd_play函数代码示例

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


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


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