X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 107 (tree) |
|---|---|
| Time | 2015-09-12 18:08:37 |
| Author | |
.bd1ファイルや.pd1ファイルが見つからない場合のエラー処理を修正
| @@ -158,20 +158,27 @@ | ||
| 158 | 158 | |
| 159 | 159 | int opening::Create() |
| 160 | 160 | { |
| 161 | + int blockflag, pointflag; | |
| 162 | + | |
| 161 | 163 | //ブロックデータ読み込み |
| 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; | |
| 165 | 174 | } |
| 175 | + | |
| 176 | + //ブロックデータ初期化 | |
| 166 | 177 | BlockData.CalculationBlockdata(false); |
| 167 | 178 | d3dg->LoadMapdata(&BlockData, "data\\map10\\"); |
| 168 | 179 | CollD.InitCollision(&BlockData); |
| 169 | 180 | |
| 170 | - //ポイントデータ読み込み | |
| 171 | - if( PointData.LoadFiledata("data\\map10\\op.pd1") ){ | |
| 172 | - //point data open failed | |
| 173 | - return 2; | |
| 174 | - } | |
| 181 | + //ポイントデータ初期化 | |
| 175 | 182 | ObjMgr.LoadPointData(); |
| 176 | 183 | ObjMgr.SetPlayerID(MAX_HUMAN-1); //実在しない人をプレイヤーに(銃声のサウンド再生対策) |
| 177 | 184 |
| @@ -378,6 +385,7 @@ | ||
| 378 | 385 | char path[MAX_PATH]; |
| 379 | 386 | char bdata[MAX_PATH]; |
| 380 | 387 | char pdata[MAX_PATH]; |
| 388 | + int blockflag, pointflag; | |
| 381 | 389 | |
| 382 | 390 | //デモを決定し読み込む |
| 383 | 391 | switch( GetRand(6) ){ |
| @@ -406,19 +414,24 @@ | ||
| 406 | 414 | strcat(pdata, "demo.pd1"); |
| 407 | 415 | |
| 408 | 416 | //ブロックデータ読み込み |
| 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; | |
| 412 | 427 | } |
| 428 | + | |
| 429 | + //ブロックデータ初期化 | |
| 413 | 430 | BlockData.CalculationBlockdata(false); |
| 414 | 431 | d3dg->LoadMapdata(&BlockData, path); |
| 415 | 432 | CollD.InitCollision(&BlockData); |
| 416 | 433 | |
| 417 | - //ポイントデータ読み込み | |
| 418 | - if( PointData.LoadFiledata(pdata) ){ | |
| 419 | - //point data open failed | |
| 420 | - return 2; | |
| 421 | - } | |
| 434 | + //ポイントデータ初期化 | |
| 422 | 435 | ObjMgr.LoadPointData(); |
| 423 | 436 | |
| 424 | 437 | //AI設定 |
| @@ -950,6 +963,7 @@ | ||
| 950 | 963 | char bdata[MAX_PATH]; |
| 951 | 964 | char pdata[MAX_PATH]; |
| 952 | 965 | char pdata2[MAX_PATH]; |
| 966 | + int blockflag, pointflag; | |
| 953 | 967 | |
| 954 | 968 | //.bd1と.pd1のファイルパスを求める |
| 955 | 969 | if( MIFdata.GetFiletype() == false ){ |
| @@ -977,19 +991,24 @@ | ||
| 977 | 991 | Resource.LoadAddSmallObject(MIFdata.GetAddSmallobjectModelPath(), MIFdata.GetAddSmallobjectTexturePath(), MIFdata.GetAddSmallobjectSoundPath()); |
| 978 | 992 | |
| 979 | 993 | //ブロックデータ読み込み |
| 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; | |
| 983 | 1004 | } |
| 1005 | + | |
| 1006 | + //ブロックデータ初期化 | |
| 984 | 1007 | BlockData.CalculationBlockdata(MIFdata.GetScreenFlag()); |
| 985 | 1008 | d3dg->LoadMapdata(&BlockData, path); |
| 986 | 1009 | CollD.InitCollision(&BlockData); |
| 987 | 1010 | |
| 988 | - //ポイントデータ読み込み | |
| 989 | - if( PointData.LoadFiledata(pdata) ){ | |
| 990 | - //point data open failed | |
| 991 | - return 2; | |
| 992 | - } | |
| 1011 | + //ポイントデータ初期化 | |
| 993 | 1012 | ObjMgr.LoadPointData(); |
| 994 | 1013 | |
| 995 | 1014 | //AI設定 |
| @@ -3053,14 +3072,16 @@ | ||
| 3053 | 3072 | //オープニング初期化 |
| 3054 | 3073 | case STATE_CREATE_OPENING: |
| 3055 | 3074 | 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(); | |
| 3059 | 3084 | } |
| 3060 | - if( error == 2 ){ | |
| 3061 | - WindowCtrl->ErrorInfo("point data open failed"); | |
| 3062 | - WindowCtrl->CloseWindow(); | |
| 3063 | - } | |
| 3064 | 3085 | break; |
| 3065 | 3086 | |
| 3066 | 3087 | //オープニング実行 |
| @@ -3083,14 +3104,15 @@ | ||
| 3083 | 3104 | //メニュー初期化 |
| 3084 | 3105 | case STATE_CREATE_MENU: |
| 3085 | 3106 | 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 | + } | |
| 3088 | 3114 | WindowCtrl->CloseWindow(); |
| 3089 | 3115 | } |
| 3090 | - if( error == 2 ){ | |
| 3091 | - WindowCtrl->ErrorInfo("point data open failed"); | |
| 3092 | - WindowCtrl->CloseWindow(); | |
| 3093 | - } | |
| 3094 | 3116 | break; |
| 3095 | 3117 | |
| 3096 | 3118 | //メニュー実行 |
| @@ -3138,14 +3160,15 @@ | ||
| 3138 | 3160 | //メインゲーム初期化 |
| 3139 | 3161 | case STATE_CREATE_MAINGAME: |
| 3140 | 3162 | 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 | + } | |
| 3143 | 3170 | WindowCtrl->CloseWindow(); |
| 3144 | 3171 | } |
| 3145 | - if( error == 2 ){ | |
| 3146 | - WindowCtrl->ErrorInfo("point data open failed"); | |
| 3147 | - WindowCtrl->CloseWindow(); | |
| 3148 | - } | |
| 3149 | 3172 | break; |
| 3150 | 3173 | |
| 3151 | 3174 | //メインゲーム実行 |