Use voices for infantry/cavalry units.

Make arrows quieter.
Handle order-related sounds via the GUI instead of simulation, to make
them player-specific and to reduce latency.

This was SVN commit r8254.
This commit is contained in:
Ykkrosh 2010-10-03 17:58:49 +00:00
parent aa32677784
commit 59c8ecfa3d
11 changed files with 123 additions and 10 deletions

View File

@ -9,8 +9,8 @@
<Looping>0</Looping>
<RandOrder>1</RandOrder>
<RandGain>1</RandGain>
<GainUpper>1</GainUpper>
<GainLower>0.8</GainLower>
<GainUpper>0.5</GainUpper>
<GainLower>0.4</GainLower>
<RandPitch>1</RandPitch>
<PitchUpper>1.1</PitchUpper>
<PitchLower>0.9</PitchLower>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<SoundGroup>
<Gain>1</Gain>
<Pitch>1</Pitch>
<Priority>100</Priority>
<ConeGain>1</ConeGain>
<ConeInner>360</ConeInner>
<ConeOuter>360</ConeOuter>
<Looping>0</Looping>
<RandOrder>1</RandOrder>
<RandGain>1</RandGain>
<GainUpper>1</GainUpper>
<GainLower>0.8</GainLower>
<RandPitch>1</RandPitch>
<PitchUpper>1.1</PitchUpper>
<PitchLower>0.9</PitchLower>
<Threshold>1</Threshold>
<Decay>3</Decay>
<Replacement>civ_male_Asyouwish_1.ogg</Replacement>
<Path>audio/voice/hellenes/civ</Path>
<Sound>civ_male_Asyouwish_1.ogg</Sound>
</SoundGroup>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<SoundGroup>
<Gain>1</Gain>
<Pitch>1</Pitch>
<Priority>100</Priority>
<ConeGain>1</ConeGain>
<ConeInner>360</ConeInner>
<ConeOuter>360</ConeOuter>
<Looping>0</Looping>
<RandOrder>1</RandOrder>
<RandGain>1</RandGain>
<GainUpper>1</GainUpper>
<GainLower>0.8</GainLower>
<RandPitch>1</RandPitch>
<PitchUpper>1.1</PitchUpper>
<PitchLower>0.9</PitchLower>
<Threshold>1</Threshold>
<Decay>3</Decay>
<Replacement>civ_male_attack_10.ogg</Replacement>
<Path>audio/voice/hellenes/civ</Path>
<Sound>civ_male_attack_10.ogg</Sound>
</SoundGroup>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<SoundGroup>
<Gain>1</Gain>
<Pitch>1</Pitch>
<Priority>100</Priority>
<ConeGain>1</ConeGain>
<ConeInner>360</ConeInner>
<ConeOuter>360</ConeOuter>
<Looping>0</Looping>
<RandOrder>1</RandOrder>
<RandGain>1</RandGain>
<GainUpper>1</GainUpper>
<GainLower>0.8</GainLower>
<RandPitch>1</RandPitch>
<PitchUpper>1.1</PitchUpper>
<PitchLower>0.9</PitchLower>
<Threshold>1</Threshold>
<Decay>3</Decay>
<Replacement>civ_male_yes_1.ogg</Replacement>
<Path>audio/voice/hellenes/civ</Path>
<Sound>civ_male_yes_1.ogg</Sound>
</SoundGroup>

View File

@ -202,6 +202,7 @@ function tryPlaceBuilding(queued)
"entities": selection,
"queued": queued
});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_repair", "entity": selection[0] });
return true;
}
@ -504,19 +505,23 @@ function handleInputAfterGui(ev)
case "move":
var target = Engine.GetTerrainAtPoint(ev.x, ev.y);
Engine.PostNetworkCommand({"type": "walk", "entities": selection, "x": target.x, "z": target.z, "queued": queued});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_walk", "entity": selection[0] });
return true;
case "attack":
Engine.PostNetworkCommand({"type": "attack", "entities": selection, "target": action.target, "queued": queued});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_attack", "entity": selection[0] });
return true;
case "build": // (same command as repair)
case "repair":
Engine.PostNetworkCommand({"type": "repair", "entities": selection, "target": action.target, "queued": queued});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_repair", "entity": selection[0] });
return true;
case "gather":
Engine.PostNetworkCommand({"type": "gather", "entities": selection, "target": action.target, "queued": queued});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_gather", "entity": selection[0] });
return true;
case "set-rallypoint":
@ -640,6 +645,7 @@ function handleMinimapEvent(target)
{
case "move":
Engine.PostNetworkCommand({"type": "walk", "entities": selection, "x": target.x, "z": target.z, "queued": queued});
Engine.GuiInterfaceCall("PlaySound", { "name": "order_walk", "entity": selection[0] });
return true;
case "set-rallypoint":

View File

@ -16,6 +16,18 @@ Formation.prototype.GetMemberCount = function()
return this.members.length;
};
/**
* Returns the 'primary' member of this formation (typically the most
* important unit type), for e.g. playing a representative sound.
* Returns undefined if no members.
* TODO: actually implement something like that; currently this just returns
* the arbitrary first one.
*/
Formation.prototype.GetPrimaryMember = function()
{
return this.members[0];
};
/**
* Initialise the members of this formation.
* Must only be called once.

View File

@ -362,6 +362,10 @@ GuiInterface.prototype.SetBuildingPlacementPreview = function(player, cmd)
GuiInterface.prototype.PlaySound = function(player, data)
{
// Ignore if no entity was passed
if (!data.entity)
return;
PlaySound(data.name, data.entity);
};

View File

@ -51,9 +51,8 @@ var UnitFsmSpec = {
// ignore when we're not in FORMATIONMEMBER
},
// Called when being told to walk as part of a formation
"Order.FormationWalk": function(msg) {
this.PlaySound("walk");
var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
cmpUnitMotion.MoveToFormationOffset(msg.data.target, msg.data.x, msg.data.z);
@ -65,15 +64,11 @@ var UnitFsmSpec = {
// (these will switch the unit out of formation mode)
"Order.Walk": function(msg) {
this.PlaySound("walk");
this.MoveToPoint(this.order.data.x, this.order.data.z);
this.SetNextState("INDIVIDUAL.WALKING");
},
"Order.WalkToTarget": function(msg) {
this.PlaySound("walk");
var ok = this.MoveToTarget(this.order.data.target);
if (ok)
{
@ -707,9 +702,24 @@ UnitAI.prototype.GetRunSpeed = function()
return cmpMotion.GetRunSpeed();
};
/**
* Play a sound appropriate to the current entity.
*/
UnitAI.prototype.PlaySound = function(name)
{
PlaySound(name, this.entity);
// If we're a formation controller, use the sounds from our first member
if (this.IsFormationController())
{
var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation);
var member = cmpFormation.GetPrimaryMember();
if (member)
PlaySound(name, member);
}
else
{
// Otherwise use our own sounds
PlaySound(name, this.entity);
}
};
UnitAI.prototype.SelectAnimation = function(name, once, speed, sound)

View File

@ -62,6 +62,11 @@
</Vision>
<Sound>
<SoundGroups>
<select>voice/hellenes/civ/civ_male_select.xml</select>
<order_walk>voice/hellenes/civ/civ_male_ack.xml</order_walk>
<order_attack>voice/hellenes/civ/civ_male_attack.xml</order_attack>
<order_gather>voice/hellenes/civ/civ_male_ack.xml</order_gather>
<order_repair>voice/hellenes/civ/civ_male_ack.xml</order_repair>
<walk>actor/mounted/movement/walk.xml</walk>
<run>actor/mounted/movement/walk.xml</run>
<attack>attack/weapon/sword.xml</attack>

View File

@ -64,7 +64,7 @@
<Builder>
<Rate>1.0</Rate>
<Entities datatype="tokens">
structures/{civ}_house
structures/{civ}_house
structures/{civ}_mill
structures/{civ}_farmstead
structures/{civ}_field
@ -83,6 +83,11 @@
</Builder>
<Sound>
<SoundGroups>
<select>voice/hellenes/civ/civ_male_select.xml</select>
<order_walk>voice/hellenes/civ/civ_male_ack.xml</order_walk>
<order_attack>voice/hellenes/civ/civ_male_attack.xml</order_attack>
<order_gather>voice/hellenes/civ/civ_male_ack.xml</order_gather>
<order_repair>voice/hellenes/civ/civ_male_ack.xml</order_repair>
<walk>actor/human/movement/walk.xml</walk>
<run>actor/human/movement/run.xml</run>
<attack>attack/weapon/sword.xml</attack>

View File

@ -54,6 +54,11 @@
</Vision>
<Sound>
<SoundGroups>
<select>voice/hellenes/civ/civ_male_select.xml</select>
<order_walk>voice/hellenes/civ/civ_male_ack.xml</order_walk>
<order_attack>voice/hellenes/civ/civ_male_attack.xml</order_attack>
<order_gather>voice/hellenes/civ/civ_male_ack.xml</order_gather>
<order_repair>voice/hellenes/civ/civ_male_ack.xml</order_repair>
<walk>actor/human/movement/walk.xml</walk>
<run>actor/human/movement/walk.xml</run>
<attack>attack/weapon/sword.xml</attack>