Update sounds

This commit is contained in:
yvt 2014-03-22 01:37:14 +09:00
parent c0344c878a
commit 11a6e9d802
5 changed files with 107 additions and 39 deletions

View File

@ -3,7 +3,7 @@
All paks for development vesion
-------------------------------
http://yvt.jp/files/programs/osppaks/DevPaks25.zip
http://yvt.jp/files/programs/osppaks/DevPaks26.zip
These paks are not included in the source tree because they contains some
non-opensource materials and they seem too large to include in the git tree.

View File

@ -284,11 +284,27 @@ namespace spades {
audioDevice->RegisterSound("Sounds/Player/Wade6.wav");
audioDevice->RegisterSound("Sounds/Player/Wade7.wav");
audioDevice->RegisterSound("Sounds/Player/Wade8.wav");
audioDevice->RegisterSound("Sounds/Player/Run1.wav");
audioDevice->RegisterSound("Sounds/Player/Run2.wav");
audioDevice->RegisterSound("Sounds/Player/Run3.wav");
audioDevice->RegisterSound("Sounds/Player/Run4.wav");
audioDevice->RegisterSound("Sounds/Player/Run5.wav");
audioDevice->RegisterSound("Sounds/Player/Run6.wav");
audioDevice->RegisterSound("Sounds/Player/Run7.wav");
audioDevice->RegisterSound("Sounds/Player/Run8.wav");
audioDevice->RegisterSound("Sounds/Player/Run9.wav");
audioDevice->RegisterSound("Sounds/Player/Run10.wav");
audioDevice->RegisterSound("Sounds/Player/Run11.wav");
audioDevice->RegisterSound("Sounds/Player/Run12.wav");
audioDevice->RegisterSound("Sounds/Player/Jump.wav");
audioDevice->RegisterSound("Sounds/Player/Land.wav");
audioDevice->RegisterSound("Sounds/Player/WaterJump.wav");
audioDevice->RegisterSound("Sounds/Player/WaterLand.wav");
audioDevice->RegisterSound("Sounds/Weapons/SwitchLocal.wav");
audioDevice->RegisterSound("Sounds/Weapons/Switch.wav");
audioDevice->RegisterSound("Sounds/Weapons/Restock.wav");
audioDevice->RegisterSound("Sounds/Weapons/RestockLocal.wav");
audioDevice->RegisterSound("Sounds/Weapons/AimDownSightLocal.wav");
renderer->RegisterImage("Gfx/Ball.png");
renderer->RegisterModel("Models/Player/Dead.kv6");
renderer->RegisterImage("Gfx/Spotlight.tga");

View File

@ -190,8 +190,38 @@ namespace spades {
toolRaiseState = 0.f;
currentTool = player->GetTool();
// TODO: play tool change sound here,
// instead of Clinet's ToolChange(?)
// play tool change sound
if(player->IsLocalPlayer()) {
auto *audioDevice = client->GetAudioDevice();
Handle<IAudioChunk> c;
switch(player->GetTool()) {
case Player::ToolSpade:
c = audioDevice->RegisterSound("Sounds/Weapons/Spade/RaiseLocal.wav");
break;
case Player::ToolBlock:
c = audioDevice->RegisterSound("Sounds/Weapons/Block/RaiseLocal.wav");
break;
case Player::ToolWeapon:
switch(player->GetWeapon()->GetWeaponType()){
case RIFLE_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/Rifle/RaiseLocal.wav");
break;
case SMG_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/SMG/RaiseLocal.wav");
break;
case SHOTGUN_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/Shotgun/RaiseLocal.wav");
break;
}
break;
case Player::ToolGrenade:
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/RaiseLocal.wav");
break;
}
audioDevice->PlayLocal(c, MakeVector3(.4f, -.3f, .5f),
AudioParam());
}
}else if(toolRaiseState > 1.f){
toolRaiseState = 1.f;
}

View File

@ -388,6 +388,7 @@ namespace spades {
}else if(CheckKey(cg_keyAttack, name)){
weapInput.primary = down;
}else if(CheckKey(cg_keyAltAttack, name)){
auto lastVal = weapInput.secondary;
if(world->GetLocalPlayer()->IsToolWeapon() && (!cg_holdAimDownSight)){
if(down && !playerInput.sprint && !world->GetLocalPlayer()->GetWeapon()->IsReloading()){
weapInput.secondary = !weapInput.secondary;
@ -399,6 +400,14 @@ namespace spades {
weapInput.secondary = down;
}
}
if(world->GetLocalPlayer()->IsToolWeapon() && weapInput.secondary && !lastVal &&
world->GetLocalPlayer()->IsReadyToUseTool() &&
!world->GetLocalPlayer()->GetWeapon()->IsReloading()) {
AudioParam params;
params.volume = 0.08f;
Handle<IAudioChunk> chunk = audioDevice->RegisterSound("Sounds/Weapons/AimDownSightLocal.wav");
audioDevice->PlayLocal(chunk, MakeVector3(.4f, -.3f, .5f), params);
}
}else if(CheckKey(cg_keyReloadWeapon, name) && down){
Weapon *w = world->GetLocalPlayer()->GetWeapon();
if(w->GetAmmo() < w->GetClipSize() &&

View File

@ -575,6 +575,20 @@ namespace spades {
"Sounds/Player/Footstep7.wav",
"Sounds/Player/Footstep8.wav"
};
const char *rsnds[] = {
"Sounds/Player/Run1.wav",
"Sounds/Player/Run2.wav",
"Sounds/Player/Run3.wav",
"Sounds/Player/Run4.wav",
"Sounds/Player/Run5.wav",
"Sounds/Player/Run6.wav",
"Sounds/Player/Run7.wav",
"Sounds/Player/Run8.wav",
"Sounds/Player/Run9.wav",
"Sounds/Player/Run10.wav",
"Sounds/Player/Run11.wav",
"Sounds/Player/Run12.wav",
};
const char *wsnds[] = {
"Sounds/Player/Wade1.wav",
"Sounds/Player/Wade2.wav",
@ -585,11 +599,19 @@ namespace spades {
"Sounds/Player/Wade7.wav",
"Sounds/Player/Wade8.wav"
};
bool sprinting = clientPlayers[p->GetId()] ? clientPlayers[p->GetId()]->GetSprintState() > 0.5f : false;
Handle<IAudioChunk> c = p->GetWade() ?
audioDevice->RegisterSound(wsnds[(rand() >> 8) % 8]):
audioDevice->RegisterSound(snds[(rand() >> 8) % 8]);
audioDevice->Play(c, p->GetOrigin(),
AudioParam());
if(sprinting) {
AudioParam param;
param.volume *= clientPlayers[p->GetId()]->GetSprintState();
c = audioDevice->RegisterSound(rsnds[(rand() >> 8) % 12]);
audioDevice->Play(c, p->GetOrigin(),
param);
}
}
}
@ -639,31 +661,8 @@ namespace spades {
bool isLocal = p == world->GetLocalPlayer();
Handle<IAudioChunk> c;
if(isLocal){
switch(p->GetTool()) {
case Player::ToolSpade:
c = audioDevice->RegisterSound("Sounds/Weapons/Spade/RaiseLocal.wav");
break;
case Player::ToolBlock:
c = audioDevice->RegisterSound("Sounds/Weapons/Block/RaiseLocal.wav");
break;
case Player::ToolWeapon:
switch(p->GetWeapon()->GetWeaponType()){
case RIFLE_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/Rifle/RaiseLocal.wav");
break;
case SMG_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/SMG/RaiseLocal.wav");
break;
case SHOTGUN_WEAPON:
c = audioDevice->RegisterSound("Sounds/Weapons/Shotgun/RaiseLocal.wav");
break;
}
break;
case Player::ToolGrenade:
c = audioDevice->RegisterSound("Sounds/Weapons/Grenade/RaiseLocal.wav");
break;
}
// played by ClientPlayer::Update
return;
}else{
c = audioDevice->RegisterSound("Sounds/Weapons/Switch.wav");
}
@ -682,8 +681,8 @@ namespace spades {
if(!IsMuted()){
bool isLocal = p == world->GetLocalPlayer();
Handle<IAudioChunk> c = isLocal ?
audioDevice->RegisterSound("Sounds/Weapons/SwitchLocal.wav"):
audioDevice->RegisterSound("Sounds/Weapons/Switch.wav");
audioDevice->RegisterSound("Sounds/Weapons/RestockLocal.wav"):
audioDevice->RegisterSound("Sounds/Weapons/Restock.wav");
if(isLocal)
audioDevice->PlayLocal(c, MakeVector3(.4f, -.3f, .5f),
AudioParam());
@ -935,7 +934,7 @@ namespace spades {
AudioParam());
}else{
Handle<IAudioChunk> c;
switch(rand()%3){
switch((rand()>>6)%3){
case 0:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Flesh1.wav");
break;
@ -988,18 +987,22 @@ namespace spades {
AudioParam param;
param.volume = 2.f;
Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Block.wav");
audioDevice->Play(c, shiftedHitPos,
param);
Handle<IAudioChunk> c;
param.pitch = .9f + GetRandom() * 0.2f;
switch((rand() >> 6) & 3){
case 0:
case 1:
case 2:
case 3:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Water1.wav");
break;
case 1:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Water2.wav");
break;
case 2:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Water3.wav");
break;
case 3:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Water4.wav");
break;
}
audioDevice->Play(c, shiftedHitPos,
param);
@ -1009,13 +1012,23 @@ namespace spades {
if(!IsMuted()){
AudioParam param;
param.volume = 4.f;
param.volume = 2.f;
Handle<IAudioChunk> c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Block.wav");
Handle<IAudioChunk> c;
switch((rand() >> 6) & 3) {
case 0:
case 1:
case 2:
case 3:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Block.wav");
break;
}
audioDevice->Play(c, shiftedHitPos,
param);
param.pitch = .9f + GetRandom() * 0.2f;
param.volume = 2.f;
switch((rand() >> 6) & 3){
case 0:
c = audioDevice->RegisterSound("Sounds/Weapons/Impacts/Ricochet1.wav");