X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 171 (tree) |
|---|---|
| Time | 2017-04-17 01:49:32 |
| Author | |
ResourceManagerのエラーチェックを改良(config.datが見つからないと強制終了する不具合対策)
| @@ -368,6 +368,8 @@ | ||
| 368 | 368 | //! @attention バグ武器を追加する場合は、ParameterInfoクラスの GetBugWeapon() 関数も編集してください。 |
| 369 | 369 | int ResourceManager::GetBugWeaponModelTexture(int id, int *model, int *texture) |
| 370 | 370 | { |
| 371 | + if( d3dg == NULL ){ return 1; } | |
| 372 | + | |
| 371 | 373 | if( id == 23 ){ |
| 372 | 374 | *model = human_upmodel[0]; |
| 373 | 375 | *texture = d3dg->GetMapTextureID(0); |
| @@ -410,6 +412,8 @@ | ||
| 410 | 412 | //! @return 成功:0 失敗:1 |
| 411 | 413 | int ResourceManager::LoadWeaponSound() |
| 412 | 414 | { |
| 415 | + if( SoundCtrl == NULL ){ return 1; } | |
| 416 | + | |
| 413 | 417 | int soundid[6]; |
| 414 | 418 | int reloadid; |
| 415 | 419 |
| @@ -462,9 +466,10 @@ | ||
| 462 | 466 | |
| 463 | 467 | //! @brief 武器のサウンドを取得 |
| 464 | 468 | //! @param id 0以上で武器の認識番号、-1でリロード音 |
| 465 | -//! @return 成功:0 失敗:-1 | |
| 469 | +//! @return 成功:データ番号 失敗:-1 | |
| 466 | 470 | int ResourceManager::GetWeaponSound(int id) |
| 467 | 471 | { |
| 472 | + if( SoundCtrl == NULL ){ return -1; } | |
| 468 | 473 | if( id == -1 ){ return weapon_reloadsound; } |
| 469 | 474 | |
| 470 | 475 | if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ return -1; } |
| @@ -474,6 +479,8 @@ | ||
| 474 | 479 | //! @brief 武器のサウンドを一括解放 |
| 475 | 480 | void ResourceManager::CleanupWeaponSound() |
| 476 | 481 | { |
| 482 | + if( SoundCtrl == NULL ){ return; } | |
| 483 | + | |
| 477 | 484 | for(int i=0; i<TOTAL_PARAMETERINFO_WEAPON; i++){ |
| 478 | 485 | SoundCtrl->CleanupSound(weapon_sound[i]); |
| 479 | 486 | weapon_sound[i] = -1; |
| @@ -536,6 +543,8 @@ | ||
| 536 | 543 | //! @return 成功:0 失敗:1 |
| 537 | 544 | int ResourceManager::LoadSmallObjectSound() |
| 538 | 545 | { |
| 546 | + if( SoundCtrl == NULL ){ return 1; } | |
| 547 | + | |
| 539 | 548 | int soundid[2]; |
| 540 | 549 | |
| 541 | 550 | //サウンドファイルをまとめて読み込む |
| @@ -567,9 +576,10 @@ | ||
| 567 | 576 | |
| 568 | 577 | //! @brief 小物のサウンドを取得 |
| 569 | 578 | //! @param id 小物の認識番号 |
| 570 | -//! @return 成功:0 失敗:-1 | |
| 579 | +//! @return 成功:データ番号 失敗:-1 | |
| 571 | 580 | int ResourceManager::GetSmallObjectSound(int id) |
| 572 | 581 | { |
| 582 | + if( SoundCtrl == NULL ){ return -1; } | |
| 573 | 583 | if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1) < id ) ){ return -1; } |
| 574 | 584 | return smallobject_sound[id]; |
| 575 | 585 | } |
| @@ -577,6 +587,8 @@ | ||
| 577 | 587 | //! @brief 小物のサウンドを一括解放 |
| 578 | 588 | void ResourceManager::CleanupSmallObjectSound() |
| 579 | 589 | { |
| 590 | + if( SoundCtrl == NULL ){ return; } | |
| 591 | + | |
| 580 | 592 | for(int i=0; i<TOTAL_PARAMETERINFO_SMALLOBJECT+1; i++){ |
| 581 | 593 | SoundCtrl->CleanupSound(smallobject_sound[i]); |
| 582 | 594 | smallobject_sound[i] = -1; |
| @@ -590,6 +602,9 @@ | ||
| 590 | 602 | //! @return 成功:0 失敗:1以上 |
| 591 | 603 | int ResourceManager::LoadAddSmallObject(char *modelpath, char *texturepath, char *soundpath) |
| 592 | 604 | { |
| 605 | + if( d3dg == NULL ){ return 1; } | |
| 606 | + if( SoundCtrl == NULL ){ return 1; } | |
| 607 | + | |
| 593 | 608 | int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1; |
| 594 | 609 | int cnt = 0; |
| 595 | 610 |
| @@ -663,6 +678,8 @@ | ||
| 663 | 678 | //! @return 成功:0 失敗:1 |
| 664 | 679 | int ResourceManager::LoadScopeTexture() |
| 665 | 680 | { |
| 681 | + if( d3dg == NULL ){ return 1; } | |
| 682 | + | |
| 666 | 683 | scopetexture = d3dg->LoadTexture("data\\scope.dds", false, false); |
| 667 | 684 | if( scopetexture == -1 ){ return 1; } |
| 668 | 685 | return 0; |
| @@ -678,6 +695,7 @@ | ||
| 678 | 695 | //! @brief スコープテクスチャを解放 |
| 679 | 696 | void ResourceManager::CleanupScopeTexture() |
| 680 | 697 | { |
| 698 | + if( d3dg == NULL ){ return; } | |
| 681 | 699 | if( scopetexture == -1 ){ return; } |
| 682 | 700 | |
| 683 | 701 | d3dg->CleanupTexture(scopetexture); |
| @@ -729,6 +747,8 @@ | ||
| 729 | 747 | //! @return 成功:0 失敗:1 |
| 730 | 748 | int ResourceManager::LoadBulletSound() |
| 731 | 749 | { |
| 750 | + if( SoundCtrl == NULL ){ return 1; } | |
| 751 | + | |
| 732 | 752 | bullet_hitsoundA = SoundCtrl->LoadSound("data\\sound\\hit1.wav"); |
| 733 | 753 | bullet_hitsoundB = SoundCtrl->LoadSound("data\\sound\\hit3.wav"); |
| 734 | 754 | bullet_humanhitsound = SoundCtrl->LoadSound("data\\sound\\hit2.wav"); |
| @@ -754,6 +774,8 @@ | ||
| 754 | 774 | //! @param grenadecco 手榴弾バウンド サウンド (NULL可) |
| 755 | 775 | void ResourceManager::GetBulletSound(int *hitsoundA, int *hitsoundB, int *humanhitsound, int *passingsound, int *grenadebang, int *grenadecco) |
| 756 | 776 | { |
| 777 | + if( SoundCtrl == NULL ){ return; } | |
| 778 | + | |
| 757 | 779 | if( hitsoundA != NULL ){ *hitsoundA = bullet_hitsoundA; } |
| 758 | 780 | if( hitsoundB != NULL ){ *hitsoundB = bullet_hitsoundB; } |
| 759 | 781 | if( humanhitsound != NULL ){ *humanhitsound = bullet_humanhitsound; } |
| @@ -765,6 +787,8 @@ | ||
| 765 | 787 | //! @brief 弾・手榴弾のサウンドを一括解放 |
| 766 | 788 | void ResourceManager::CleanupBulletSound() |
| 767 | 789 | { |
| 790 | + if( SoundCtrl == NULL ){ return; } | |
| 791 | + | |
| 768 | 792 | SoundCtrl->CleanupSound(bullet_hitsoundA); |
| 769 | 793 | SoundCtrl->CleanupSound(bullet_hitsoundB); |
| 770 | 794 | SoundCtrl->CleanupSound(bullet_humanhitsound); |