• 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

Revision107 (tree)
Time2015-09-12 18:08:37
Authorxops-mikan

Log Message

.bd1ファイルや.pd1ファイルが見つからない場合のエラー処理を修正

Change Summary

Incremental Difference

--- trunk/gamemain.cpp (revision 106)
+++ trunk/gamemain.cpp (revision 107)
@@ -158,20 +158,27 @@
158158
159159 int opening::Create()
160160 {
161+ int blockflag, pointflag;
162+
161163 //ブロックデータ読み込み
162- if( BlockData.LoadFiledata("data\\map10\\temp.bd1") ){
163- //block data open failed
164- return 1;
164+ blockflag = BlockData.LoadFiledata("data\\map10\\temp.bd1");
165+
166+ //ポイントデータ読み込み
167+ pointflag = PointData.LoadFiledata("data\\map10\\op.pd1");
168+
169+ //ファイル読み込みでエラーがあったら中断
170+ if( (blockflag != 0)||(pointflag != 0) ){
171+ //2bit : point data open failed
172+ //1bit : block data open failed
173+ return pointflag*2 + blockflag;
165174 }
175+
176+ //ブロックデータ初期化
166177 BlockData.CalculationBlockdata(false);
167178 d3dg->LoadMapdata(&BlockData, "data\\map10\\");
168179 CollD.InitCollision(&BlockData);
169180
170- //ポイントデータ読み込み
171- if( PointData.LoadFiledata("data\\map10\\op.pd1") ){
172- //point data open failed
173- return 2;
174- }
181+ //ポイントデータ初期化
175182 ObjMgr.LoadPointData();
176183 ObjMgr.SetPlayerID(MAX_HUMAN-1); //実在しない人をプレイヤーに(銃声のサウンド再生対策)
177184
@@ -378,6 +385,7 @@
378385 char path[MAX_PATH];
379386 char bdata[MAX_PATH];
380387 char pdata[MAX_PATH];
388+ int blockflag, pointflag;
381389
382390 //デモを決定し読み込む
383391 switch( GetRand(6) ){
@@ -406,19 +414,24 @@
406414 strcat(pdata, "demo.pd1");
407415
408416 //ブロックデータ読み込み
409- if( BlockData.LoadFiledata(bdata) ){
410- //block data open failed
411- return 1;
417+ blockflag = BlockData.LoadFiledata(bdata);
418+
419+ //ポイントデータ読み込み
420+ pointflag = PointData.LoadFiledata(pdata);
421+
422+ //ファイル読み込みでエラーがあったら中断
423+ if( (blockflag != 0)||(pointflag != 0) ){
424+ //2bit : point data open failed
425+ //1bit : block data open failed
426+ return pointflag*2 + blockflag;
412427 }
428+
429+ //ブロックデータ初期化
413430 BlockData.CalculationBlockdata(false);
414431 d3dg->LoadMapdata(&BlockData, path);
415432 CollD.InitCollision(&BlockData);
416433
417- //ポイントデータ読み込み
418- if( PointData.LoadFiledata(pdata) ){
419- //point data open failed
420- return 2;
421- }
434+ //ポイントデータ初期化
422435 ObjMgr.LoadPointData();
423436
424437 //AI設定
@@ -950,6 +963,7 @@
950963 char bdata[MAX_PATH];
951964 char pdata[MAX_PATH];
952965 char pdata2[MAX_PATH];
966+ int blockflag, pointflag;
953967
954968 //.bd1と.pd1のファイルパスを求める
955969 if( MIFdata.GetFiletype() == false ){
@@ -977,19 +991,24 @@
977991 Resource.LoadAddSmallObject(MIFdata.GetAddSmallobjectModelPath(), MIFdata.GetAddSmallobjectTexturePath(), MIFdata.GetAddSmallobjectSoundPath());
978992
979993 //ブロックデータ読み込み
980- if( BlockData.LoadFiledata(bdata) ){
981- //block data open failed
982- return 1;
994+ blockflag = BlockData.LoadFiledata(bdata);
995+
996+ //ポイントデータ読み込み
997+ pointflag = PointData.LoadFiledata(pdata);
998+
999+ //ファイル読み込みでエラーがあったら中断
1000+ if( (blockflag != 0)||(pointflag != 0) ){
1001+ //2bit : point data open failed
1002+ //1bit : block data open failed
1003+ return pointflag*2 + blockflag;
9831004 }
1005+
1006+ //ブロックデータ初期化
9841007 BlockData.CalculationBlockdata(MIFdata.GetScreenFlag());
9851008 d3dg->LoadMapdata(&BlockData, path);
9861009 CollD.InitCollision(&BlockData);
9871010
988- //ポイントデータ読み込み
989- if( PointData.LoadFiledata(pdata) ){
990- //point data open failed
991- return 2;
992- }
1011+ //ポイントデータ初期化
9931012 ObjMgr.LoadPointData();
9941013
9951014 //AI設定
@@ -3053,14 +3072,16 @@
30533072 //オープニング初期化
30543073 case STATE_CREATE_OPENING:
30553074 error = Opening->Create();
3056- if( error == 1 ){
3057- WindowCtrl->ErrorInfo("block data open failed");
3058- WindowCtrl->CloseWindow();
3075+ if( error != 0 ){
3076+ if( (error&0x0001) != 0 ){
3077+ WindowCtrl->ErrorInfo("block data open failed");
3078+ }
3079+ if( (error&0x0002) != 0 ){
3080+ WindowCtrl->ErrorInfo("point data open failed");
3081+ }
3082+ //WindowCtrl->CloseWindow();
3083+ GameState.PushBackSpaceKey();
30593084 }
3060- if( error == 2 ){
3061- WindowCtrl->ErrorInfo("point data open failed");
3062- WindowCtrl->CloseWindow();
3063- }
30643085 break;
30653086
30663087 //オープニング実行
@@ -3083,14 +3104,15 @@
30833104 //メニュー初期化
30843105 case STATE_CREATE_MENU:
30853106 error = MainMenu->Create();
3086- if( error == 1 ){
3087- WindowCtrl->ErrorInfo("block data open failed");
3107+ if( error != 0 ){
3108+ if( (error&0x0001) != 0 ){
3109+ WindowCtrl->ErrorInfo("block data open failed");
3110+ }
3111+ if( (error&0x0002) != 0 ){
3112+ WindowCtrl->ErrorInfo("point data open failed");
3113+ }
30883114 WindowCtrl->CloseWindow();
30893115 }
3090- if( error == 2 ){
3091- WindowCtrl->ErrorInfo("point data open failed");
3092- WindowCtrl->CloseWindow();
3093- }
30943116 break;
30953117
30963118 //メニュー実行
@@ -3138,14 +3160,15 @@
31383160 //メインゲーム初期化
31393161 case STATE_CREATE_MAINGAME:
31403162 error = MainGame->Create();
3141- if( error == 1 ){
3142- WindowCtrl->ErrorInfo("block data open failed");
3163+ if( error != 0 ){
3164+ if( (error&0x0001) != 0 ){
3165+ WindowCtrl->ErrorInfo("block data open failed");
3166+ }
3167+ if( (error&0x0002) != 0 ){
3168+ WindowCtrl->ErrorInfo("point data open failed");
3169+ }
31433170 WindowCtrl->CloseWindow();
31443171 }
3145- if( error == 2 ){
3146- WindowCtrl->ErrorInfo("point data open failed");
3147- WindowCtrl->CloseWindow();
3148- }
31493172 break;
31503173
31513174 //メインゲーム実行