• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。


Commit MetaInfo

Revision171 (tree)
Time2017-04-17 01:49:32
Authorxops-mikan

Log Message

ResourceManagerのエラーチェックを改良(config.datが見つからないと強制終了する不具合対策)

Change Summary

Incremental Difference

--- trunk/resource.cpp (revision 170)
+++ trunk/resource.cpp (revision 171)
@@ -368,6 +368,8 @@
368368 //! @attention バグ武器を追加する場合は、ParameterInfoクラスの GetBugWeapon() 関数も編集してください。
369369 int ResourceManager::GetBugWeaponModelTexture(int id, int *model, int *texture)
370370 {
371+ if( d3dg == NULL ){ return 1; }
372+
371373 if( id == 23 ){
372374 *model = human_upmodel[0];
373375 *texture = d3dg->GetMapTextureID(0);
@@ -410,6 +412,8 @@
410412 //! @return 成功:0 失敗:1
411413 int ResourceManager::LoadWeaponSound()
412414 {
415+ if( SoundCtrl == NULL ){ return 1; }
416+
413417 int soundid[6];
414418 int reloadid;
415419
@@ -462,9 +466,10 @@
462466
463467 //! @brief 武器のサウンドを取得
464468 //! @param id 0以上で武器の認識番号、-1でリロード音
465-//! @return 成功:0 失敗:-1
469+//! @return 成功:データ番号 失敗:-1
466470 int ResourceManager::GetWeaponSound(int id)
467471 {
472+ if( SoundCtrl == NULL ){ return -1; }
468473 if( id == -1 ){ return weapon_reloadsound; }
469474
470475 if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ return -1; }
@@ -474,6 +479,8 @@
474479 //! @brief 武器のサウンドを一括解放
475480 void ResourceManager::CleanupWeaponSound()
476481 {
482+ if( SoundCtrl == NULL ){ return; }
483+
477484 for(int i=0; i<TOTAL_PARAMETERINFO_WEAPON; i++){
478485 SoundCtrl->CleanupSound(weapon_sound[i]);
479486 weapon_sound[i] = -1;
@@ -536,6 +543,8 @@
536543 //! @return 成功:0 失敗:1
537544 int ResourceManager::LoadSmallObjectSound()
538545 {
546+ if( SoundCtrl == NULL ){ return 1; }
547+
539548 int soundid[2];
540549
541550 //サウンドファイルをまとめて読み込む
@@ -567,9 +576,10 @@
567576
568577 //! @brief 小物のサウンドを取得
569578 //! @param id 小物の認識番号
570-//! @return 成功:0 失敗:-1
579+//! @return 成功:データ番号 失敗:-1
571580 int ResourceManager::GetSmallObjectSound(int id)
572581 {
582+ if( SoundCtrl == NULL ){ return -1; }
573583 if( (id < 0)||((TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1) < id ) ){ return -1; }
574584 return smallobject_sound[id];
575585 }
@@ -577,6 +587,8 @@
577587 //! @brief 小物のサウンドを一括解放
578588 void ResourceManager::CleanupSmallObjectSound()
579589 {
590+ if( SoundCtrl == NULL ){ return; }
591+
580592 for(int i=0; i<TOTAL_PARAMETERINFO_SMALLOBJECT+1; i++){
581593 SoundCtrl->CleanupSound(smallobject_sound[i]);
582594 smallobject_sound[i] = -1;
@@ -590,6 +602,9 @@
590602 //! @return 成功:0 失敗:1以上
591603 int ResourceManager::LoadAddSmallObject(char *modelpath, char *texturepath, char *soundpath)
592604 {
605+ if( d3dg == NULL ){ return 1; }
606+ if( SoundCtrl == NULL ){ return 1; }
607+
593608 int dataid = TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1;
594609 int cnt = 0;
595610
@@ -663,6 +678,8 @@
663678 //! @return 成功:0 失敗:1
664679 int ResourceManager::LoadScopeTexture()
665680 {
681+ if( d3dg == NULL ){ return 1; }
682+
666683 scopetexture = d3dg->LoadTexture("data\\scope.dds", false, false);
667684 if( scopetexture == -1 ){ return 1; }
668685 return 0;
@@ -678,6 +695,7 @@
678695 //! @brief スコープテクスチャを解放
679696 void ResourceManager::CleanupScopeTexture()
680697 {
698+ if( d3dg == NULL ){ return; }
681699 if( scopetexture == -1 ){ return; }
682700
683701 d3dg->CleanupTexture(scopetexture);
@@ -729,6 +747,8 @@
729747 //! @return 成功:0 失敗:1
730748 int ResourceManager::LoadBulletSound()
731749 {
750+ if( SoundCtrl == NULL ){ return 1; }
751+
732752 bullet_hitsoundA = SoundCtrl->LoadSound("data\\sound\\hit1.wav");
733753 bullet_hitsoundB = SoundCtrl->LoadSound("data\\sound\\hit3.wav");
734754 bullet_humanhitsound = SoundCtrl->LoadSound("data\\sound\\hit2.wav");
@@ -754,6 +774,8 @@
754774 //! @param grenadecco 手榴弾バウンド サウンド (NULL可)
755775 void ResourceManager::GetBulletSound(int *hitsoundA, int *hitsoundB, int *humanhitsound, int *passingsound, int *grenadebang, int *grenadecco)
756776 {
777+ if( SoundCtrl == NULL ){ return; }
778+
757779 if( hitsoundA != NULL ){ *hitsoundA = bullet_hitsoundA; }
758780 if( hitsoundB != NULL ){ *hitsoundB = bullet_hitsoundB; }
759781 if( humanhitsound != NULL ){ *humanhitsound = bullet_humanhitsound; }
@@ -765,6 +787,8 @@
765787 //! @brief 弾・手榴弾のサウンドを一括解放
766788 void ResourceManager::CleanupBulletSound()
767789 {
790+ if( SoundCtrl == NULL ){ return; }
791+
768792 SoundCtrl->CleanupSound(bullet_hitsoundA);
769793 SoundCtrl->CleanupSound(bullet_hitsoundB);
770794 SoundCtrl->CleanupSound(bullet_humanhitsound);