X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 113 (tree) |
|---|---|
| Time | 2015-09-27 02:48:27 |
| Author | |
味方が発砲した弾の横切る音(hyu.wav)が再生される問題の修正
| @@ -229,15 +229,13 @@ | ||
| 229 | 229 | |
| 230 | 230 | //! @brief 3Dシーン主計算処理 |
| 231 | 231 | void D3Dscene::Process() |
| 232 | -{ | |
| 233 | - GameSound->PlayWorldSound(camera_x, camera_y, camera_z, camera_rx); | |
| 234 | -} | |
| 232 | +{} | |
| 235 | 233 | |
| 236 | 234 | //! @brief 3Dシーンサウンド再生処理 |
| 237 | 235 | void D3Dscene::Sound() |
| 238 | 236 | { |
| 239 | 237 | //サウンドを再生 |
| 240 | - GameSound->PlayWorldSound(camera_x, camera_y, camera_z, camera_rx); | |
| 238 | + GameSound->PlayWorldSound(camera_x, camera_y, camera_z, camera_rx, 1); | |
| 241 | 239 | } |
| 242 | 240 | |
| 243 | 241 | //! @brief 3Dシーン描画処理(3D) |
| @@ -1894,8 +1894,13 @@ | ||
| 1894 | 1894 | { |
| 1895 | 1895 | time = GetTimeMS(); |
| 1896 | 1896 | |
| 1897 | + //プレイヤーのチーム番号取得 | |
| 1898 | + int teamid; | |
| 1899 | + human *myHuman = ObjMgr.GetPlayerHumanObject(); | |
| 1900 | + myHuman->GetParamData(NULL, NULL, NULL, &teamid); | |
| 1901 | + | |
| 1897 | 1902 | //サウンドを再生 |
| 1898 | - GameSound->PlayWorldSound(camera_x, camera_y, camera_z, camera_rx); | |
| 1903 | + GameSound->PlayWorldSound(camera_x, camera_y, camera_z, camera_rx, teamid); | |
| 1899 | 1904 | |
| 1900 | 1905 | time_sound = GetTimeMS() - time; |
| 1901 | 1906 | } |
| @@ -89,7 +89,7 @@ | ||
| 89 | 89 | bool GetNewList(soundlist **plist); |
| 90 | 90 | int GetTargetList(soundlist **plist); |
| 91 | 91 | bool CheckApproach(soundlist *plist, float camera_x, float camera_y, float camera_z, float *min_x, float *min_y, float *min_z); |
| 92 | - void PlaySound(soundlist *plist, float camera_x, float camera_y, float camera_z); | |
| 92 | + void PlaySound(soundlist *plist, float camera_x, float camera_y, float camera_z, int teamID); | |
| 93 | 93 | |
| 94 | 94 | public: |
| 95 | 95 | SoundManager(SoundControl *in_SoundCtrl = NULL, ResourceManager *in_Resource = NULL, ParameterInfo *in_Param = NULL); |
| @@ -100,13 +100,13 @@ | ||
| 100 | 100 | bool HitMap(float x, float y, float z); |
| 101 | 101 | bool HitHuman(float x, float y, float z); |
| 102 | 102 | bool HitSmallObject(float x, float y, float z, int id); |
| 103 | - bool PassingBullet(float x, float y, float z, float move_x, float move_y, float move_z); | |
| 103 | + bool PassingBullet(float x, float y, float z, float move_x, float move_y, float move_z, int teamID); | |
| 104 | 104 | bool GrenadeBound(float x, float y, float z); |
| 105 | 105 | bool GrenadeExplosion(float x, float y, float z); |
| 106 | 106 | bool SetFootsteps(float x, float y, float z, int teamID); |
| 107 | 107 | bool ReloadWeapon(float x, float y, float z, int teamID); |
| 108 | 108 | int GetWorldSound(float pos_x, float pos_y, float pos_z, int teamID, soundlist *psoundlist); |
| 109 | - void PlayWorldSound(float camera_x, float camera_y, float camera_z, float camera_rx); | |
| 109 | + void PlayWorldSound(float camera_x, float camera_y, float camera_z, float camera_rx, int teamID); | |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | 112 | #endif |
| \ No newline at end of file |
| @@ -2271,7 +2271,7 @@ | ||
| 2271 | 2271 | //弾オブジェクトの処理 |
| 2272 | 2272 | for(int i=0; i<MAX_BULLET; i++){ |
| 2273 | 2273 | float bx, by, bz, brx, bry; |
| 2274 | - int speed; | |
| 2274 | + int speed, teamid; | |
| 2275 | 2275 | float mx, my, mz; |
| 2276 | 2276 | |
| 2277 | 2277 | CollideBullet(&BulletIndex[i]); //当たり判定を実行 |
| @@ -2279,12 +2279,12 @@ | ||
| 2279 | 2279 | |
| 2280 | 2280 | if( BulletIndex[i].GetEnableFlag() == true ){ |
| 2281 | 2281 | //弾の座標と角度を取得 |
| 2282 | - BulletIndex[i].GetParamData(NULL, NULL, &speed, NULL, NULL); | |
| 2282 | + BulletIndex[i].GetParamData(NULL, NULL, &speed, &teamid, NULL); | |
| 2283 | 2283 | BulletIndex[i].GetPosData(&bx, &by, &bz, &brx, &bry); |
| 2284 | 2284 | mx = cos(brx)*cos(bry)*speed; |
| 2285 | 2285 | my = sin(bry)*speed; |
| 2286 | 2286 | mz = sin(brx)*cos(bry)*speed; |
| 2287 | - GameSound->PassingBullet(bx, by, bz, mx, my, mz); | |
| 2287 | + GameSound->PassingBullet(bx, by, bz, mx, my, mz, teamid); | |
| 2288 | 2288 | } |
| 2289 | 2289 | } |
| 2290 | 2290 | } |
| @@ -162,9 +162,10 @@ | ||
| 162 | 162 | //! @param move_x 音源のX軸移動量 |
| 163 | 163 | //! @param move_y 音源のY軸移動量 |
| 164 | 164 | //! @param move_z 音源のZ軸移動量 |
| 165 | +//! @param teamID チーム番号 | |
| 165 | 166 | //! @return 成功:true 失敗:false |
| 166 | 167 | //! @attention move_x・move_y・move_zの移動量は、1フレーム分を指定してください。実際に座標が移動するわけではありません。 |
| 167 | -bool SoundManager::PassingBullet(float x, float y, float z, float move_x, float move_y, float move_z) | |
| 168 | +bool SoundManager::PassingBullet(float x, float y, float z, float move_x, float move_y, float move_z, int teamID) | |
| 168 | 169 | { |
| 169 | 170 | soundlist *plist = NULL; |
| 170 | 171 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -176,6 +177,7 @@ | ||
| 176 | 177 | plist->move_x = move_x; |
| 177 | 178 | plist->move_y = move_y; |
| 178 | 179 | plist->move_z = move_z; |
| 180 | + plist->teamid = teamID; | |
| 179 | 181 | |
| 180 | 182 | return true; |
| 181 | 183 | } |
| @@ -342,8 +344,9 @@ | ||
| 342 | 344 | //! @param camera_y カメラのY座標 |
| 343 | 345 | //! @param camera_z カメラのZ座標 |
| 344 | 346 | //! @param camera_rx カメラのX軸角度 (予約) |
| 347 | +//! @param teamID チーム番号 | |
| 345 | 348 | //! @warning 毎フレーム呼び出してください。 |
| 346 | -void SoundManager::PlayWorldSound(float camera_x, float camera_y, float camera_z, float camera_rx) | |
| 349 | +void SoundManager::PlayWorldSound(float camera_x, float camera_y, float camera_z, float camera_rx, int teamID) | |
| 347 | 350 | { |
| 348 | 351 | int lists; |
| 349 | 352 | soundlist *getlist = NULL; |
| @@ -371,7 +374,7 @@ | ||
| 371 | 374 | |
| 372 | 375 | //範囲内の音源ならば再生を試みる |
| 373 | 376 | if( x*x + y*y + z*z < MAX_SOUNDDIST*MAX_SOUNDDIST ){ |
| 374 | - PlaySound( &(getlist[i]), camera_x, camera_y, camera_z ); | |
| 377 | + PlaySound( &(getlist[i]), camera_x, camera_y, camera_z, teamID ); | |
| 375 | 378 | } |
| 376 | 379 | } |
| 377 | 380 | } |
| @@ -474,7 +477,8 @@ | ||
| 474 | 477 | //! @param camera_x カメラのX座標 |
| 475 | 478 | //! @param camera_y カメラのY座標 |
| 476 | 479 | //! @param camera_z カメラのZ座標 |
| 477 | -void SoundManager::PlaySound(soundlist *plist, float camera_x, float camera_y, float camera_z) | |
| 480 | +//! @param teamID チーム番号 | |
| 481 | +void SoundManager::PlaySound(soundlist *plist, float camera_x, float camera_y, float camera_z, int teamID) | |
| 478 | 482 | { |
| 479 | 483 | WeaponParameter WParam; |
| 480 | 484 | int hitsoundA, hitsoundB; |
| @@ -531,6 +535,9 @@ | ||
| 531 | 535 | |
| 532 | 536 | if( CheckApproach(plist, camera_x, camera_y, camera_z, &new_x, &new_y, &new_z) == false ){ return; } |
| 533 | 537 | |
| 538 | + //味方の弾なら何もせず終了 | |
| 539 | + if( plist->teamid == teamID ){ return; } | |
| 540 | + | |
| 534 | 541 | //そのまま再生して終了 |
| 535 | 542 | Resource->GetBulletSound(NULL, NULL, NULL, &passingsound, NULL, NULL); |
| 536 | 543 | SoundCtrl->Play3DSound(passingsound, new_x, new_y, new_z, MAX_SOUNDPASSING); |