Ejemplo n.º 1
0
void Reset8910(register AY8910 *D,int First)
{
  static byte RegInit[16] =
  {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFD,
    0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00
  };
  int J;
#define ClockHz 4000000
  /* Reset state */
  memcpy(D->R,RegInit,sizeof(D->R));
  D->EPhase  = 0;
  D->Clock   = ClockHz>>4;
  D->First   = First;
  D->Sync    = AY8910_ASYNC;
  D->Changed = 0x00;
  D->EPeriod = 0;
  D->ECount  = 0;
  D->Latch   = 0x00;

  /* Set sound types */
  SetSound(0+First,SND_MELODIC);
  SetSound(1+First,SND_MELODIC);
  SetSound(2+First,SND_MELODIC);
  SetSound(3+First,SND_NOISE);
  SetSound(4+First,SND_NOISE);
  SetSound(5+First,SND_NOISE);

  /* Silence all channels */
  for(J=0;J<AY8910_CHANNELS;J++)
  {
    D->Freq[J]=D->Volume[J]=0;
    Sound(J+First,0,0);
  }
}
Ejemplo n.º 2
0
void CChar::NPC_OnHirePayMore( CItem * pGold, bool fHire )
{
	ADDTOCALLSTACK("CChar::NPC_OnHirePayMore");
	// We have been handed money.
	// similar to PC_STATUS

	CCharBase * pCharDef = Char_GetDef();
	unsigned int iWage = pCharDef->GetHireDayWage();
	CItemContainer	*pBank = GetBank();
	if ( !iWage || !pBank )
		return;

	if ( pGold )
	{
		if ( fHire )
		{
			pBank->m_itEqBankBox.m_Check_Amount = 0;	// zero any previous balance.
		}

		pBank->m_itEqBankBox.m_Check_Amount += pGold->GetAmount();
		Sound( pGold->GetDropSound( NULL ));
		pGold->Delete();
	}

	TCHAR *pszMsg = Str_GetTemp();
	sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_HIRE_TIME), pBank->m_itEqBankBox.m_Check_Amount / iWage);
	Speak(pszMsg);
}
Ejemplo n.º 3
0
int CChar::Use_PlayMusic( CItem * pInstrument, int iDifficultyToPlay )
{
	ADDTOCALLSTACK("CChar::Use_PlayMusic");
	// SKILL_ENTICEMENT, SKILL_MUSICIANSHIP,
	// ARGS:
	//	iDifficultyToPlay = 0-100
	// RETURN:
	//  >=0 = success
	//  -1 = too hard for u.
	//  -2 = can't play. no instrument.

	if ( !pInstrument )
	{
		pInstrument = ContentFind(RESOURCE_ID(RES_TYPEDEF, IT_MUSICAL), 0, 1);
		if ( !pInstrument )
		{
			SysMessageDefault(DEFMSG_MUSICANSHIP_NOTOOL);
			return -2;
		}
	}

	bool fSuccess = Skill_UseQuick(SKILL_MUSICIANSHIP, iDifficultyToPlay, (Skill_GetActive() != SKILL_MUSICIANSHIP));
	Sound(pInstrument->Use_Music(fSuccess));
	if ( fSuccess )
		return iDifficultyToPlay;	// success

	// Skill gain for SKILL_MUSICIANSHIP failure will need to be triggered
	// manually, since Skill_UseQuick isn't going to do it for us in this case
	if ( Skill_GetActive() == SKILL_MUSICIANSHIP )
		Skill_Experience(SKILL_MUSICIANSHIP, -iDifficultyToPlay);

	SysMessageDefault(DEFMSG_MUSICANSHIP_POOR);
	return -1;		// fail
}
Ejemplo n.º 4
0
func CheckForEnemies(Size)
{
	for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this)))
	{
		if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o))
			continue;
		
		o->AddBallHitEffect();
		o->Fling(0, -2);
		AddEffect("BallHitCD", o, 1, 15);
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(PV_Random(5,15),0),
			BlitMode = GFX_BLIT_Additive,
			Rotation = PV_Random(0,360),
			R = pR,
			G = pG,
			B = pB,
		};
		
		CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5);
		
		WeaponDamage(o, SpellDamage);
		Sound("Ball::ball_hit", false, 50);
	}
}
Ejemplo n.º 5
0
func KillBall()
{
	Sound("Ball::ball_die", false, 50);
	if(rangedummy)
		rangedummy->RemoveObject();
	RemoveObject();
}
void C4Vizatergo_Explode(ServerEntity_t *eVizatergo)
{
	Sound(eVizatergo,CHAN_AUTO,va("fx/explosion%i.wav",rand()%6+1),255,ATTN_NORM);

	Entity_RadiusDamage(eVizatergo,MONSTER_RANGE_NEAR,40,DAMAGE_TYPE_EXPLODE);
	Entity_Remove(eVizatergo);
}
Ejemplo n.º 7
0
void Point_EffectUse(ServerEntity_t *eEntity)
{
	switch(eEntity->local.style)
	{
		case 1:
			Entity_RadiusDamage(eEntity,MONSTER_RANGE_MEDIUM,eEntity->local.iDamage, eEntity->local.iDamageType);
			break;
		case 2:
			Engine.WriteByte(MSG_BROADCAST,SVC_TEMPENTITY);
			Engine.WriteByte(MSG_BROADCAST,CTE_GUNSHOT);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[0]);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[1]);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[2]);
			break;
		case 3:
			Engine.WriteByte(MSG_BROADCAST,SVC_TEMPENTITY);
			Engine.WriteByte(MSG_BROADCAST,CTE_TELEPORT);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[0]);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[1]);
			Engine.WriteCoord(MSG_BROADCAST,eEntity->v.origin[2]);
			break;
		default:
			Engine.Con_Warning("Unknown effect style! (%i)\n",eEntity->local.style);
	}

	if(eEntity->v.noise)
		Sound(eEntity,CHAN_ITEM,eEntity->v.noise,255,ATTN_NORM);
}
Ejemplo n.º 8
0
void CSounds::OnRender()
{
	// check for sound initialisation
	if(m_WaitForSoundJob)
	{
		if(m_SoundJob.Status() == CJob::STATE_DONE)
			m_WaitForSoundJob = false;
		else
			return;
	}

	// set listner pos
	Sound()->SetListenerPos(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y);

	// play sound from queue
	if(m_QueuePos > 0)
	{
		int64 Now = time_get();
		if(m_QueueWaitTime <= Now)
		{
			Play(m_aQueue[0].m_Channel, m_aQueue[0].m_SetId, 1.0f, vec2(0,0));
			m_QueueWaitTime = Now+time_freq()*3/10; // wait 300ms before playing the next one
			if(--m_QueuePos > 0)
				mem_move(m_aQueue, m_aQueue+1, m_QueuePos*sizeof(QueueEntry));
		}
	}
}
Ejemplo n.º 9
0
func Intro_PlaneHit()
{
	// Plane hit ground! Continue sequence.
	Sound("Objects::Plane::PlaneCrash", true);
	SetR(-90);
	var particles = Particles_Smoke(true);
	particles.Size = PV_Linear(PV_Random(20, 60), PV_Random(50, 100));
	CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-60, 60), PV_Random(-20,0), PV_Random(200, 500), particles, 20);
	particles.Size = PV_Linear(PV_Random(50, 80), PV_Random(100, 200));
	CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-20, 20), PV_Random(-20,0), PV_Random(100, 200), particles, 20);
	for (var iplr=0,plr; iplr<GetPlayerCount(C4PT_User); ++iplr)
	{
		plr = GetPlayerByIndex(iplr, C4PT_User);
		var icrew=0,crew;
		while (crew=GetCrew(plr, icrew++))
		{
			crew->Exit(0,-5, 0, Random(1)+1, Random(5)-6);
			crew->SetAction("Tumble");
		}
	}
	SetMeshMaterial("CrashedAirplane");
	this.MeshTransformation=Trans_Mul(Trans_Rotate(10,0,2,1), Airplane.MeshTransformation);
	this.Hit = this.intro_seq.plane_Hit;
	this.intro_seq.plane_crashed = true;
	this.intro_seq->ScheduleNext(50);
	return true;
}
Ejemplo n.º 10
0
func FxLifeStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
	
	var prt = {
		Size = 15,
		Alpha = PV_Linear(255, 0),
		Rotation = PV_Step(15, PV_Random(0, 360)),
		ForceY = GetGravity()
	};
	CreateParticle("SawbladePrt", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 40, prt, 6);
	
	var prt2 =	{
		Size = PV_Linear(2, 0),
	    ForceY = GetGravity(),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
	    R = 255,
	    G = PV_Linear(128,32),
	    B = PV_Random(0, 128, 2),
	    Alpha = PV_Random(255,0,3),
		BlitMode = GFX_BLIT_Additive,
	};
	
	CreateParticle("Flash", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 70, prt2, 20);
	
	Sound("sawblade_destroyed", false, 50);
	RemoveObject();
}
Ejemplo n.º 11
0
void CEngine::CreateSystems()
{
    AddSystem( Input() );
    AddSystem( Sound() );
	AddSystem( Physics() );
	AddSystem( Script() );	
}
Ejemplo n.º 12
0
protected func Initialize()
{
  SetVisibility(VIS_All());
  SetPlrView(GetOwner(), this());
  SetAction("Fly");
  Sound("Morse", 0,this(),100,0, 1);
}
Ejemplo n.º 13
0
Gib::Gib
	(
	str name,
	qboolean blood_trail,
	str bloodtrailname,
	str bloodspurtname,
	str bloodsplatname,
	float bloodsplatsize,
	float pitch
	)

   {
   setSize( Vector( "0 0 0" ), Vector( "0 0 0" ) );

	if ( name.length() )
		setModel( name.c_str() );

	setMoveType( MOVETYPE_GIB );
	setSolidType( SOLID_BBOX );
	takedamage = DAMAGE_YES;
   sprayed     = false;
   fadesplat   = true;
   scale       = 2.0f;

	next_bleed_time = 0;

	final_pitch	= pitch;

	if ( blood_trail )
		{
		// Make a blood emitter and bind it to the head
		blood = new Mover;
   
		if ( bloodtrailname.length() )
			blood->setModel( bloodtrailname.c_str() );

		blood->setMoveType( MOVETYPE_BOUNCE );
		blood->setSolidType( SOLID_NOT );
		blood->bind( this );

		// Save the blood spurt name

		if ( bloodspurtname.length() )
			blood_spurt_name = bloodspurtname;

		// Save the blood splat name

		if ( bloodsplatname.length() )
			blood_splat_name = bloodsplatname;

		blood_splat_size = bloodsplatsize;
		}
	else
		{
		blood = NULL;
		}

   Sound( "snd_decap", CHAN_BODY, 1, 300 );
   }
Ejemplo n.º 14
0
void Area_PlatformTouch(ServerEntity_t *eArea, ServerEntity_t *eOther) {
	if(eArea->local.flags == STATE_UP || eArea->local.flags == STATE_TOP)
		return;
	if((eOther->Monster.type != MONSTER_PLAYER) && eOther->v.health <= 0)
		return;
	if(eArea->v.nextthink > eArea->v.ltime)
		return;

	eArea->local.flags = STATE_UP;

	Area_Move(eArea, eArea->local.pos2, eArea->local.speed, Area_PlatformWait);

	if(eArea->local.cSoundStart)
		Sound(eArea,CHAN_BODY,eArea->local.cSoundStart,255,ATTN_NORM);
	if(eArea->local.cSoundMoving)
		Sound(eArea,CHAN_VOICE,eArea->local.cSoundMoving,255,ATTN_NORM);
}
Ejemplo n.º 15
0
void Area_ButtonDone(ServerEntity_t *eArea, ServerEntity_t *other) {
	eArea->local.flags = STATE_DOWN;
	eArea->local.value = 0;

	if (eArea->local.sound_stop) {
        Sound(eArea, CHAN_VOICE, eArea->local.sound_stop, 255, ATTN_NORM);
    }
}
Ejemplo n.º 16
0
void Area_PlatformUse(ServerEntity_t *eArea)
{
	if(eArea->local.flags == STATE_UP || eArea->local.flags == STATE_TOP) {
        return;
    }

	eArea->local.flags = STATE_UP;

	Area_Move(eArea,eArea->local.pos2,eArea->local.speed,Area_PlatformWait);

	if(eArea->local.cSoundStart) {
        Sound(eArea, CHAN_BODY, eArea->local.cSoundStart, 255, ATTN_NORM);
    }
	if(eArea->local.cSoundMoving) {
        Sound(eArea, CHAN_VOICE, eArea->local.cSoundMoving, 255, ATTN_NORM);
    }
}
Ejemplo n.º 17
0
public func RejectCollect(id idObj, object pObj)
{
  // Objekt ist Gold oder ein Sack voll Geld
  if(idObj != GOLD && idObj != MBAG) return();
  // Objekt wird von einem Clonk getragen
  if(Contained(pObj))
   if(GetOCF(Contained(pObj)) & OCF_CrewMember())
    {
    // Nicht für Banditen
    if(Contained(pObj)->~IsBandit()) return(Sound("Error", 1, 0, 0, GetOwner(pObj)+1));
    DoWealth(GetOwner(Contained(pObj)), GetValue(pObj));
    DoPoints(GetValue(pObj), GetOwner(Contained(pObj)));
    Sound("Cash", 1, 0,0, GetOwner(pObj));
    RemoveObject(pObj);
    return(1);
    }
}
Ejemplo n.º 18
0
func Script110()
{
  if(!Contained(GetHiRank(0))) { goto(110); return; }
  RemoveArrow();
  SetPlrShowControl(0,"___34_678_   34 678 ___3______");
  Sound("Ding");
  TutorialMessage("$TxtUsethiskeytoputdownt$");
}
Ejemplo n.º 19
0
IResource *SoundResourceLoader(const char *filename, ResourceManager *res, IMemoryPool *pool)
{
	UNUSED(res);

	Sound *sound = New(Sound());
	sound->Load(filename, res, pool);
	return sound;
}
Ejemplo n.º 20
0
func Hit() {
  var obj;
//  if(GetAction()ne"Falling") return(1);
  Sound("RockBreak*");
  // unten
	
  RemoveObject();
}
Ejemplo n.º 21
0
func Completion()
{
  Sound("Fire");
  SetAction("Burn1");
  SetPhase(Random(14));
  SetComDir(COMD_Down());
  return(1);
}
Ejemplo n.º 22
0
void CSounds::OnReset()
{
	if(Client()->State() >= IClient::STATE_ONLINE)
	{
		Sound()->StopAll();
		ClearQueue();
	}
}
Ejemplo n.º 23
0
/*** Loop ***/
void Loop( float elapsed )
{
    /* Input, Lógica, Sonido y Video */
    Input( elapsed );
    Logic( elapsed );
    Sound( elapsed );
    Video( elapsed );
}
Ejemplo n.º 24
0
global func FxStayNearCataTimer(pTarget, iEffectNumber)
{
	if(pTarget->GetX()<380 || pTarget->GetY()>340)
	{
		pTarget->SetPosition(500,200);
		Sound("Oops");
	}
}
Ejemplo n.º 25
0
func Script34()
{
	Sound("Ding");
	SetPlrShowControl(0,"0_2_______0123456789__2_______");
	TutorialMessage("$TxtUsecommandselectleft$");
	SetArrowToObj(valley_clnk);
	wait(15);
}
Ejemplo n.º 26
0
global func FxStayNearElevTimer(pTarget, iEffectNumber)
{
	if(pTarget->GetX()>300 || pTarget->GetY()>200)
	{
		pTarget->SetPosition(100,60);
		Sound("Oops");
	}
}
Ejemplo n.º 27
0
/**
 * @brief Starts playing the specified sound.
 * @param sound_id id of the sound to play
 */
void Sound::play(const SoundId& sound_id) {

  if (all_sounds.count(sound_id) == 0) {
    all_sounds[sound_id] = Sound(sound_id);
  }

  all_sounds[sound_id].start();
}
Ejemplo n.º 28
0
func Intro_2()
{
	// Plane drop sound when it enters view range
	if (this.plane->GetY() > 900)
		Sound("Goal_TreasureHunt::PlaneDrop", true);
	else
		ScheduleSame(2);
	return true;
}
Ejemplo n.º 29
0
void Discus_Catch(ServerEntity_t *ent, ServerEntity_t *discus)
{
	// [4/7/2012] Simplified ~hogsy
	ent->v.iPrimaryAmmo = ent->local.discus_ammo2++;

	Sound(ent,CHAN_WEAPON,"weapons/discus/discuscatch.wav",255,ATTN_NORM);

	Entity_Remove(discus);
}
Ejemplo n.º 30
0
func Script84()
{
  if (FindObject(HUT3)->GetBase()) return(goto(84));
  Sound("Applause");
  TutorialMessage("$TxtExcellent$");
  FindObject(SCRG)->Fulfill();
  SetNextMission("Tutorial.c4f\\Tutorial03.c4s", "$BtnNextTutorial$", "$BtnNextTutorialDesc$");
  return(1);
}