X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 112 (tree) |
|---|---|
| Time | 2015-09-26 20:16:28 |
| Author | |
Direct3Dデバイスをリセットする際、シーン自体をリセットしないように。 (フルスクリーン時 Alt + Tab キーなどの切り替えに完全対応)
| @@ -102,6 +102,7 @@ | ||
| 102 | 102 | opening(); |
| 103 | 103 | ~opening(); |
| 104 | 104 | int Create(); |
| 105 | + int Recovery(); | |
| 105 | 106 | void Input(); |
| 106 | 107 | void Process(); |
| 107 | 108 | void Destroy(); |
| @@ -111,6 +112,7 @@ | ||
| 111 | 112 | //! @details メニュー画面を管理します。 |
| 112 | 113 | class mainmenu : public D3Dscene |
| 113 | 114 | { |
| 115 | + char demopath[MAX_PATH]; //!< デモファイルのパス | |
| 114 | 116 | int mainmenu_mouseX; //!< メニュー画面マウスX座標 |
| 115 | 117 | int mainmenu_mouseY; //!< メニュー画面マウスY座標 |
| 116 | 118 | int mainmenu_scrollitems_official; //!< メニュー画面のスクロールしたアイテム数 |
| @@ -130,6 +132,7 @@ | ||
| 130 | 132 | mainmenu(); |
| 131 | 133 | ~mainmenu(); |
| 132 | 134 | int Create(); |
| 135 | + int Recovery(); | |
| 133 | 136 | void Input(); |
| 134 | 137 | void Process(); |
| 135 | 138 | void Destroy(); |
| @@ -148,6 +151,7 @@ | ||
| 148 | 151 | briefing(); |
| 149 | 152 | ~briefing(); |
| 150 | 153 | int Create(); |
| 154 | + int Recovery(); | |
| 151 | 155 | void Destroy(); |
| 152 | 156 | }; |
| 153 | 157 |
| @@ -214,6 +218,7 @@ | ||
| 214 | 218 | maingame(); |
| 215 | 219 | ~maingame(); |
| 216 | 220 | int Create(); |
| 221 | + int Recovery(); | |
| 217 | 222 | void Input(); |
| 218 | 223 | void Process(); |
| 219 | 224 | void Sound(); |
| @@ -181,12 +181,17 @@ | ||
| 181 | 181 | |
| 182 | 182 | #ifdef ENABLE_DEBUGLOG |
| 183 | 183 | //ログに出力 |
| 184 | - OutputLog.WriteLog(LOG_INIT, "グラフィック", "DirectX(リセット)"); | |
| 184 | + OutputLog.WriteLog(LOG_CHECK, "グラフィック", "DirectXデバイス消失"); | |
| 185 | 185 | #endif |
| 186 | 186 | |
| 187 | 187 | //リソース解放 |
| 188 | 188 | CleanupD3Dresource(); |
| 189 | 189 | |
| 190 | +#ifdef ENABLE_DEBUGLOG | |
| 191 | + //ログに出力 | |
| 192 | + OutputLog.WriteLog(LOG_INIT, "グラフィック", "DirectX(リセット)"); | |
| 193 | +#endif | |
| 194 | + | |
| 190 | 195 | D3DPRESENT_PARAMETERS d3dpp; |
| 191 | 196 | RECT rec; |
| 192 | 197 |
| @@ -1128,6 +1133,8 @@ | ||
| 1128 | 1133 | //! @brief マップデータを解放 |
| 1129 | 1134 | void D3DGraphics::CleanupMapdata() |
| 1130 | 1135 | { |
| 1136 | + if( (g_pVB == NULL)&&(bs == 0)&&(blockdata == NULL) ){ return; } | |
| 1137 | + | |
| 1131 | 1138 | //テクスチャを開放 |
| 1132 | 1139 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
| 1133 | 1140 | CleanupTexture(mapTextureID[i]); |
| @@ -539,7 +539,7 @@ | ||
| 539 | 539 | //! @param id Shiftキー:0 Ctrlキー:1 |
| 540 | 540 | //! @param *CodeL 左側キーのキーコードを受け取るポインタ |
| 541 | 541 | //! @param *CodeR 右側キーのキーコードを受け取るポインタ |
| 542 | -//! @return 成功:ture 失敗:false | |
| 542 | +//! @return 成功:true 失敗:false | |
| 543 | 543 | bool GetDoubleKeyCode(int id, int *CodeL, int *CodeR) |
| 544 | 544 | { |
| 545 | 545 | #ifdef INPUT_DIRECTINPUT |
| @@ -114,7 +114,7 @@ | ||
| 114 | 114 | int bulletmodel, bullettexture; |
| 115 | 115 | Resource->GetBulletModelTexture(&bulletmodel, &bullettexture); |
| 116 | 116 | for(int i=0; i<MAX_BULLET; i++){ |
| 117 | - BulletIndex[i].SetModel(bulletmodel, 1.0f); | |
| 117 | + BulletIndex[i].SetModel(bulletmodel, BULLET_SCALE); | |
| 118 | 118 | BulletIndex[i].SetTexture(bullettexture); |
| 119 | 119 | } |
| 120 | 120 |
| @@ -413,20 +413,20 @@ | ||
| 413 | 413 | return -1; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - for(int j=0; j<MAX_SMALLOBJECT; j++){ | |
| 417 | - if( SmallObjectIndex[j].GetEnableFlag() == false ){ | |
| 416 | + for(int i=0; i<MAX_SMALLOBJECT; i++){ | |
| 417 | + if( SmallObjectIndex[i].GetEnableFlag() == false ){ | |
| 418 | 418 | //初期化 |
| 419 | - SmallObjectIndex[j].SetPosData(data.x, data.y, data.z, data.r); | |
| 420 | - SmallObjectIndex[j].SetParamData(data.p2, data.p4, true); | |
| 421 | - SmallObjectIndex[j].SetModel(model, 5.0f); | |
| 422 | - SmallObjectIndex[j].SetTexture(texture); | |
| 423 | - SmallObjectIndex[j].SetEnableFlag(true); | |
| 419 | + SmallObjectIndex[i].SetPosData(data.x, data.y, data.z, data.r); | |
| 420 | + SmallObjectIndex[i].SetParamData(data.p2, data.p4, true); | |
| 421 | + SmallObjectIndex[i].SetModel(model, SMALLOBJECT_SCALE); | |
| 422 | + SmallObjectIndex[i].SetTexture(texture); | |
| 423 | + SmallObjectIndex[i].SetEnableFlag(true); | |
| 424 | 424 | |
| 425 | 425 | //位置修正フラグが有効ならば、マップと判定 |
| 426 | 426 | if( data.p3 !=0 ){ |
| 427 | - SmallObjectIndex[j].CollisionMap(CollD); | |
| 427 | + SmallObjectIndex[i].CollisionMap(CollD); | |
| 428 | 428 | } |
| 429 | - return j; | |
| 429 | + return i; | |
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | return -1; |
| @@ -453,7 +453,7 @@ | ||
| 453 | 453 | //初期化 |
| 454 | 454 | SmallObjectIndex[j].SetPosData(px, py, pz, rx); |
| 455 | 455 | SmallObjectIndex[j].SetParamData(paramID, 0, true); |
| 456 | - SmallObjectIndex[j].SetModel(model, 5.0f); | |
| 456 | + SmallObjectIndex[j].SetModel(model, SMALLOBJECT_SCALE); | |
| 457 | 457 | SmallObjectIndex[j].SetTexture(texture); |
| 458 | 458 | SmallObjectIndex[j].SetEnableFlag(true); |
| 459 | 459 |
| @@ -715,12 +715,12 @@ | ||
| 715 | 715 | |
| 716 | 716 | //当たり判定の大きさを取得 |
| 717 | 717 | if( id == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ |
| 718 | - decide = (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_SCALE; | |
| 718 | + decide = (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_COLLISIONSCALE; | |
| 719 | 719 | } |
| 720 | 720 | else{ |
| 721 | 721 | SmallObjectParameter Param; |
| 722 | 722 | GameParamInfo->GetSmallObject(id, &Param); |
| 723 | - decide = (float)Param.decide*SMALLOBJECT_SCALE; | |
| 723 | + decide = (float)Param.decide*SMALLOBJECT_COLLISIONSCALE; | |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | //当たり判定 |
| @@ -807,12 +807,12 @@ | ||
| 807 | 807 | |
| 808 | 808 | //当たり判定の大きさを取得 |
| 809 | 809 | if( id == TOTAL_PARAMETERINFO_SMALLOBJECT+1 -1 ){ |
| 810 | - decide = (int)( (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_SCALE ); | |
| 810 | + decide = (int)( (float)MIFdata->GetAddSmallobjectDecide()*SMALLOBJECT_COLLISIONSCALE ); | |
| 811 | 811 | } |
| 812 | 812 | else{ |
| 813 | 813 | SmallObjectParameter Param; |
| 814 | 814 | GameParamInfo->GetSmallObject(id, &Param); |
| 815 | - decide = (int)( (float)Param.decide*SMALLOBJECT_SCALE ); | |
| 815 | + decide = (int)( (float)Param.decide*SMALLOBJECT_COLLISIONSCALE ); | |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | //貫通力を計算 |
| @@ -1285,6 +1285,118 @@ | ||
| 1285 | 1285 | } |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | +//! @brief リソースの回復 | |
| 1289 | +//! @todo 全てのエフェクトが無効化する。 | |
| 1290 | +void ObjectManager::Recovery() | |
| 1291 | +{ | |
| 1292 | + //人のモデル番号を取得 | |
| 1293 | + int upmodel[TOTAL_UPMODE]; | |
| 1294 | + int armmodel[TOTAL_ARMMODE]; | |
| 1295 | + int legmodel; | |
| 1296 | + int walkmodel[TOTAL_WALKMODE]; | |
| 1297 | + int runmodel[TOTAL_RUNMODE]; | |
| 1298 | + Resource->GetHumanModel(upmodel, armmodel, &legmodel, walkmodel, runmodel); | |
| 1299 | + | |
| 1300 | + //人 | |
| 1301 | + int HumanID; | |
| 1302 | + int GetHumanFlag; | |
| 1303 | + HumanParameter HumanParam; | |
| 1304 | + for(int i=0; i<MAX_HUMAN; i++){ | |
| 1305 | + if( HumanIndex[i].GetEnableFlag() == true ){ | |
| 1306 | + HumanIndex[i].GetParamData(&HumanID, NULL, NULL, NULL); | |
| 1307 | + | |
| 1308 | + GetHumanFlag = GameParamInfo->GetHuman(HumanID, &HumanParam); | |
| 1309 | + | |
| 1310 | + if( GetHumanFlag == 0 ){ | |
| 1311 | + //人のテクスチャを登録 | |
| 1312 | + Resource->AddHumanTexture(HumanID); | |
| 1313 | + | |
| 1314 | + //読み込めなければ、前回読み込んだテクスチャ番号を利用 | |
| 1315 | + //読み込めれば、今回読み込むテクスチャ番号を上書き | |
| 1316 | + int id = Resource->GetHumanTexture(HumanID); | |
| 1317 | + if( id == -1 ){ | |
| 1318 | + id = AddHumanIndex_TextureID; | |
| 1319 | + } | |
| 1320 | + else{ | |
| 1321 | + AddHumanIndex_TextureID = id; | |
| 1322 | + } | |
| 1323 | + | |
| 1324 | + HumanIndex[i].SetTexture(id); | |
| 1325 | + HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel); | |
| 1326 | + } | |
| 1327 | + else{ | |
| 1328 | + //今回読み込むテクスチャ番号を上書き | |
| 1329 | + AddHumanIndex_TextureID = d3dg->GetMapTextureID(0); | |
| 1330 | + | |
| 1331 | + HumanIndex[i].SetTexture(AddHumanIndex_TextureID); | |
| 1332 | + HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel); | |
| 1333 | + } | |
| 1334 | + } | |
| 1335 | + } | |
| 1336 | + | |
| 1337 | + //武器 | |
| 1338 | + int WeaponID; | |
| 1339 | + int Weaponmodel, Weapontexture; | |
| 1340 | + for(int i=0; i<MAX_WEAPON; i++){ | |
| 1341 | + if( WeaponIndex[i].GetEnableFlag() == true ){ | |
| 1342 | + //設定値を取得 | |
| 1343 | + WeaponParameter WeaponParam; | |
| 1344 | + WeaponIndex[i].GetParamData(&WeaponID, NULL, NULL); | |
| 1345 | + if( Resource->GetWeaponModelTexture(WeaponID, &Weaponmodel, &Weapontexture) == 1 ){ continue; } | |
| 1346 | + if( GameParamInfo->GetWeapon(WeaponID, &WeaponParam) == 1 ){ continue; } | |
| 1347 | + | |
| 1348 | + //適用 | |
| 1349 | + WeaponIndex[i].SetModel(Weaponmodel, WeaponParam.size); | |
| 1350 | + WeaponIndex[i].SetTexture(Weapontexture); | |
| 1351 | + } | |
| 1352 | + } | |
| 1353 | + | |
| 1354 | + //小物 | |
| 1355 | + int SmallObjectID; | |
| 1356 | + int SmallObjectmodel, SmallObjecttexture; | |
| 1357 | + for(int i=0; i<MAX_SMALLOBJECT; i++){ | |
| 1358 | + if( SmallObjectIndex[i].GetEnableFlag() == true ){ | |
| 1359 | + //設定値を取得 | |
| 1360 | + SmallObjectIndex[i].GetParamData(&SmallObjectID, NULL); | |
| 1361 | + if( Resource->GetSmallObjectModelTexture(SmallObjectID, &SmallObjectmodel, &SmallObjecttexture) == 1 ){ continue; } | |
| 1362 | + | |
| 1363 | + //適用 | |
| 1364 | + SmallObjectIndex[i].SetModel(SmallObjectmodel, SMALLOBJECT_SCALE); | |
| 1365 | + SmallObjectIndex[i].SetTexture(SmallObjecttexture); | |
| 1366 | + } | |
| 1367 | + } | |
| 1368 | + | |
| 1369 | + //銃弾適用 | |
| 1370 | + int bulletmodel, bullettexture; | |
| 1371 | + Resource->GetBulletModelTexture(&bulletmodel, &bullettexture); | |
| 1372 | + for(int i=0; i<MAX_BULLET; i++){ | |
| 1373 | + BulletIndex[i].SetModel(bulletmodel, BULLET_SCALE); | |
| 1374 | + BulletIndex[i].SetTexture(bullettexture); | |
| 1375 | + } | |
| 1376 | + | |
| 1377 | + //手榴弾のリソースとモデルサイズを取得 | |
| 1378 | + int grenademodel, grenadetexture; | |
| 1379 | + float model_size = 1.0f; | |
| 1380 | + WeaponParameter ParamData; | |
| 1381 | + Resource->GetWeaponModelTexture(ID_WEAPON_GRENADE, &grenademodel, &grenadetexture); | |
| 1382 | + if( GameParamInfo->GetWeapon(ID_WEAPON_GRENADE, &ParamData) == 0 ){ | |
| 1383 | + model_size = ParamData.size; | |
| 1384 | + } | |
| 1385 | + | |
| 1386 | + //手榴弾適用 | |
| 1387 | + for(int i=0; i<MAX_GRENADE; i++){ | |
| 1388 | + GrenadeIndex[i].SetModel(grenademodel, model_size); | |
| 1389 | + GrenadeIndex[i].SetTexture(grenadetexture); | |
| 1390 | + } | |
| 1391 | + | |
| 1392 | + //全てのエフェクトを無効化 | |
| 1393 | + for(int i=0; i<MAX_EFFECT; i++){ | |
| 1394 | + if( EffectIndex[i].GetEnableFlag() == true ){ | |
| 1395 | + EffectIndex[i].SetEnableFlag(false); | |
| 1396 | + } | |
| 1397 | + } | |
| 1398 | +} | |
| 1399 | + | |
| 1288 | 1400 | //! @brief FF(同士討ち)有効化フラグを取得 |
| 1289 | 1401 | //! @return フラグ |
| 1290 | 1402 | bool ObjectManager::GetFriendlyFireFlag() |
| @@ -50,6 +50,7 @@ | ||
| 50 | 50 | ~scene(); |
| 51 | 51 | virtual void SetClass(StateMachine *in_GameState, D3DGraphics *in_d3dg, InputControl *in_inputCtrl); |
| 52 | 52 | virtual int Create(); |
| 53 | + virtual int Recovery(); | |
| 53 | 54 | virtual void Input(); |
| 54 | 55 | virtual void Process(); |
| 55 | 56 | virtual bool RenderMain(); |
| @@ -70,6 +71,7 @@ | ||
| 70 | 71 | D2Dscene(); |
| 71 | 72 | ~D2Dscene(); |
| 72 | 73 | virtual int Create(); |
| 74 | + virtual int Recovery(); | |
| 73 | 75 | virtual bool RenderMain(); |
| 74 | 76 | virtual void Destroy(); |
| 75 | 77 | }; |
| @@ -119,10 +119,13 @@ | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | //! @brief リソースをリセットする |
| 122 | -//! @return 失敗:1 それ以外:0 | |
| 122 | +//! @return 成功:0 失敗:-1 待機:1 | |
| 123 | 123 | //! @attention 通常は、描画処理に失敗した場合に限り呼び出してください。 |
| 124 | 124 | int ResetGame(WindowControl *WindowCtrl) |
| 125 | 125 | { |
| 126 | + //リストを正しく解放するため、予め呼ぶ。 | |
| 127 | + Resource.CleanupHumanTexture(); | |
| 128 | + | |
| 126 | 129 | int rtn = d3dg.ResetD3D(WindowCtrl); |
| 127 | 130 | |
| 128 | 131 | if( rtn == 0 ){ |
| @@ -134,18 +137,17 @@ | ||
| 134 | 137 | Resource.LoadBulletModelTexture(); |
| 135 | 138 | Resource.LoadEffectTexture(); |
| 136 | 139 | |
| 137 | - //現在の画面を再スタートさせる | |
| 138 | - GameState.PushF12Key(); | |
| 140 | + //WindowCtrl->ErrorInfo("Recovery..."); | |
| 141 | + return 0; | |
| 139 | 142 | } |
| 140 | 143 | if( rtn == 1 ){ |
| 141 | - // | |
| 144 | + return 1; | |
| 142 | 145 | } |
| 143 | - if( rtn == 2 ){ | |
| 146 | + //if( rtn == 2 ){ | |
| 144 | 147 | WindowCtrl->ErrorInfo("Resetに失敗しました"); |
| 145 | 148 | WindowCtrl->CloseWindow(); |
| 146 | - return 1; | |
| 147 | - } | |
| 148 | - return 0; | |
| 149 | + return -1; | |
| 150 | + //} | |
| 149 | 151 | } |
| 150 | 152 | |
| 151 | 153 | //! @brief 基本的な解放処理 |
| @@ -224,6 +226,22 @@ | ||
| 224 | 226 | return 0; |
| 225 | 227 | } |
| 226 | 228 | |
| 229 | +int opening::Recovery() | |
| 230 | +{ | |
| 231 | + //ブロックデータ初期化 | |
| 232 | + d3dg->LoadMapdata(&BlockData, "data\\map10\\"); | |
| 233 | + | |
| 234 | + //ポイントデータ初期化 | |
| 235 | + ObjMgr.Recovery(); | |
| 236 | + | |
| 237 | + //背景空読み込み | |
| 238 | + Resource.LoadSkyModelTexture(1); | |
| 239 | + | |
| 240 | + //opening_banner = d3dg->LoadTexture("banner.png", true, false); | |
| 241 | + | |
| 242 | + return 0; | |
| 243 | +} | |
| 244 | + | |
| 227 | 245 | void opening::Input() |
| 228 | 246 | { |
| 229 | 247 | inputCtrl->GetInputState(false); |
| @@ -392,6 +410,7 @@ | ||
| 392 | 410 | //! @brief コンストラクタ |
| 393 | 411 | mainmenu::mainmenu() |
| 394 | 412 | { |
| 413 | + demopath[0] = 0x00; | |
| 395 | 414 | mainmenu_scrollitems_official = 0; |
| 396 | 415 | mainmenu_scrollitems_addon = 0; |
| 397 | 416 | } |
| @@ -402,7 +421,6 @@ | ||
| 402 | 421 | |
| 403 | 422 | int mainmenu::Create() |
| 404 | 423 | { |
| 405 | - char path[MAX_PATH]; | |
| 406 | 424 | char bdata[MAX_PATH]; |
| 407 | 425 | char pdata[MAX_PATH]; |
| 408 | 426 | int blockflag, pointflag; |
| @@ -410,27 +428,27 @@ | ||
| 410 | 428 | //デモを決定し読み込む |
| 411 | 429 | switch( GetRand(6) ){ |
| 412 | 430 | case 0: |
| 413 | - strcpy(path, "data\\map2\\"); | |
| 431 | + strcpy(demopath, "data\\map2\\"); | |
| 414 | 432 | break; |
| 415 | 433 | case 1: |
| 416 | - strcpy(path, "data\\map4\\"); | |
| 434 | + strcpy(demopath, "data\\map4\\"); | |
| 417 | 435 | break; |
| 418 | 436 | case 2: |
| 419 | - strcpy(path, "data\\map5\\"); | |
| 437 | + strcpy(demopath, "data\\map5\\"); | |
| 420 | 438 | break; |
| 421 | 439 | case 3: |
| 422 | - strcpy(path, "data\\map7\\"); | |
| 440 | + strcpy(demopath, "data\\map7\\"); | |
| 423 | 441 | break; |
| 424 | 442 | case 4: |
| 425 | - strcpy(path, "data\\map8\\"); | |
| 443 | + strcpy(demopath, "data\\map8\\"); | |
| 426 | 444 | break; |
| 427 | 445 | case 5: |
| 428 | - strcpy(path, "data\\map16\\"); | |
| 446 | + strcpy(demopath, "data\\map16\\"); | |
| 429 | 447 | break; |
| 430 | 448 | } |
| 431 | - strcpy(bdata, path); | |
| 449 | + strcpy(bdata, demopath); | |
| 432 | 450 | strcat(bdata, "temp.bd1"); |
| 433 | - strcpy(pdata, path); | |
| 451 | + strcpy(pdata, demopath); | |
| 434 | 452 | strcat(pdata, "demo.pd1"); |
| 435 | 453 | |
| 436 | 454 | //ブロックデータ読み込み |
| @@ -448,7 +466,7 @@ | ||
| 448 | 466 | |
| 449 | 467 | //ブロックデータ初期化 |
| 450 | 468 | BlockData.CalculationBlockdata(false); |
| 451 | - d3dg->LoadMapdata(&BlockData, path); | |
| 469 | + d3dg->LoadMapdata(&BlockData, demopath); | |
| 452 | 470 | CollD.InitCollision(&BlockData); |
| 453 | 471 | |
| 454 | 472 | //ポイントデータ初期化 |
| @@ -498,6 +516,19 @@ | ||
| 498 | 516 | return 0; |
| 499 | 517 | } |
| 500 | 518 | |
| 519 | +int mainmenu::Recovery() | |
| 520 | +{ | |
| 521 | + //ブロックデータ初期化 | |
| 522 | + d3dg->LoadMapdata(&BlockData, demopath); | |
| 523 | + | |
| 524 | + //ポイントデータ初期化 | |
| 525 | + ObjMgr.Recovery(); | |
| 526 | + | |
| 527 | + gametitle = d3dg->LoadTexture("data\\title.dds", false, false); | |
| 528 | + | |
| 529 | + return 0; | |
| 530 | +} | |
| 531 | + | |
| 501 | 532 | void mainmenu::Input() |
| 502 | 533 | { |
| 503 | 534 | inputCtrl->GetInputState(false); |
| @@ -905,6 +936,32 @@ | ||
| 905 | 936 | return 0; |
| 906 | 937 | } |
| 907 | 938 | |
| 939 | +int briefing::Recovery() | |
| 940 | +{ | |
| 941 | + char PictureA[MAX_PATH]; | |
| 942 | + char PictureB[MAX_PATH]; | |
| 943 | + | |
| 944 | + //背景画像を取得 | |
| 945 | + gametitle = d3dg->LoadTexture("data\\title.dds", false, false); | |
| 946 | + | |
| 947 | + //ブリーフィング画像のファイルパス取得 | |
| 948 | + MIFdata.GetPicturefilePath(PictureA, PictureB); | |
| 949 | + | |
| 950 | + //ブリーフィング画像読み込み | |
| 951 | + if( strcmp(PictureB, "!") == 0 ){ | |
| 952 | + TwoTexture = false; | |
| 953 | + TextureA = d3dg->LoadTexture(PictureA, true, false); | |
| 954 | + TextureB = -1; | |
| 955 | + } | |
| 956 | + else{ | |
| 957 | + TwoTexture = true; | |
| 958 | + TextureA = d3dg->LoadTexture(PictureA, true, false); | |
| 959 | + TextureB = d3dg->LoadTexture(PictureB, true, false); | |
| 960 | + } | |
| 961 | + | |
| 962 | + return 0; | |
| 963 | +} | |
| 964 | + | |
| 908 | 965 | void briefing::Render2D() |
| 909 | 966 | { |
| 910 | 967 | float effectA = GetEffectAlphaLoop(framecnt, 0.8f, 0.7f, true); |
| @@ -947,7 +1004,8 @@ | ||
| 947 | 1004 | d3dg->Draw2DMSFontText(230, 180, MIFdata.GetBriefingText(), d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); |
| 948 | 1005 | } |
| 949 | 1006 | |
| 950 | -void briefing::Destroy(){ | |
| 1007 | +void briefing::Destroy() | |
| 1008 | +{ | |
| 951 | 1009 | //ブリーフィング画像を開放 |
| 952 | 1010 | d3dg->CleanupTexture(TextureA); |
| 953 | 1011 | d3dg->CleanupTexture(TextureB); |
| @@ -1105,6 +1163,43 @@ | ||
| 1105 | 1163 | return 0; |
| 1106 | 1164 | } |
| 1107 | 1165 | |
| 1166 | +int maingame::Recovery() | |
| 1167 | +{ | |
| 1168 | + char path[MAX_PATH]; | |
| 1169 | + char bdata[MAX_PATH]; //ダミー | |
| 1170 | + char pdata[MAX_PATH]; //ダミー | |
| 1171 | + | |
| 1172 | + //.bd1と.pd1のファイルパスを求める | |
| 1173 | + if( MIFdata.GetFiletype() == false ){ | |
| 1174 | + GameParamInfo.GetOfficialMission(MainGameInfo.selectmission_id, NULL, NULL, path, NULL); | |
| 1175 | + } | |
| 1176 | + else{ | |
| 1177 | + MIFdata.GetDatafilePath(bdata, pdata); | |
| 1178 | + | |
| 1179 | + strcpy(path, bdata); | |
| 1180 | + for(int i=strlen(path)-1; i>0; i--){ | |
| 1181 | + if( path[i] == '\\' ){ | |
| 1182 | + path[i+1] = 0x00; | |
| 1183 | + break; | |
| 1184 | + } | |
| 1185 | + } | |
| 1186 | + } | |
| 1187 | + | |
| 1188 | + //追加小物を読み込む | |
| 1189 | + Resource.LoadAddSmallObject(MIFdata.GetAddSmallobjectModelPath(), MIFdata.GetAddSmallobjectTexturePath(), MIFdata.GetAddSmallobjectSoundPath()); | |
| 1190 | + | |
| 1191 | + //ブロックデータ初期化 | |
| 1192 | + d3dg->LoadMapdata(&BlockData, path); | |
| 1193 | + | |
| 1194 | + //ポイントデータ初期化 | |
| 1195 | + ObjMgr.Recovery(); | |
| 1196 | + | |
| 1197 | + //背景空読み込み | |
| 1198 | + Resource.LoadSkyModelTexture(MIFdata.GetSkynumber()); | |
| 1199 | + | |
| 1200 | + return 0; | |
| 1201 | +} | |
| 1202 | + | |
| 1108 | 1203 | //! @brief 特定操作の入力をチェック |
| 1109 | 1204 | bool maingame::CheckInputControl(int CheckKey, int mode) |
| 1110 | 1205 | { |
| @@ -3111,7 +3206,12 @@ | ||
| 3111 | 3206 | Opening->Sound(); |
| 3112 | 3207 | if( (GameConfig.GetFrameskipFlag() == false)||(framecnt%2 == 0) ){ |
| 3113 | 3208 | if( Opening->RenderMain() == true ){ |
| 3114 | - ResetGame(WindowCtrl); | |
| 3209 | + if( ResetGame(WindowCtrl) == 0 ){ | |
| 3210 | + Opening->Recovery(); | |
| 3211 | + | |
| 3212 | + //現在の画面を再スタートさせる | |
| 3213 | + //GameState.PushF12Key(); | |
| 3214 | + } | |
| 3115 | 3215 | } |
| 3116 | 3216 | } |
| 3117 | 3217 | break; |
| @@ -3142,7 +3242,12 @@ | ||
| 3142 | 3242 | MainMenu->Sound(); |
| 3143 | 3243 | if( (GameConfig.GetFrameskipFlag() == false)||(framecnt%2 == 0) ){ |
| 3144 | 3244 | if( MainMenu->RenderMain() == true ){ |
| 3145 | - ResetGame(WindowCtrl); | |
| 3245 | + if( ResetGame(WindowCtrl) == 0 ){ | |
| 3246 | + MainMenu->Recovery(); | |
| 3247 | + | |
| 3248 | + //現在の画面を再スタートさせる | |
| 3249 | + //GameState.PushF12Key(); | |
| 3250 | + } | |
| 3146 | 3251 | } |
| 3147 | 3252 | } |
| 3148 | 3253 | break; |
| @@ -3167,7 +3272,12 @@ | ||
| 3167 | 3272 | Briefing->Process(); |
| 3168 | 3273 | if( (GameConfig.GetFrameskipFlag() == false)||(framecnt%2 == 0) ){ |
| 3169 | 3274 | if( Briefing->RenderMain() == true ){ |
| 3170 | - ResetGame(WindowCtrl); | |
| 3275 | + if( ResetGame(WindowCtrl) == 0 ){ | |
| 3276 | + Briefing->Recovery(); | |
| 3277 | + | |
| 3278 | + //現在の画面を再スタートさせる | |
| 3279 | + //GameState.PushF12Key(); | |
| 3280 | + } | |
| 3171 | 3281 | } |
| 3172 | 3282 | } |
| 3173 | 3283 | break; |
| @@ -3198,7 +3308,12 @@ | ||
| 3198 | 3308 | MainGame->Sound(); |
| 3199 | 3309 | if( (GameConfig.GetFrameskipFlag() == false)||(framecnt%2 == 0) ){ |
| 3200 | 3310 | if( MainGame->RenderMain() == true ){ |
| 3201 | - ResetGame(WindowCtrl); | |
| 3311 | + if( ResetGame(WindowCtrl) == 0 ){ | |
| 3312 | + MainGame->Recovery(); | |
| 3313 | + | |
| 3314 | + //現在の画面を再スタートさせる | |
| 3315 | + //GameState.PushF12Key(); | |
| 3316 | + } | |
| 3202 | 3317 | } |
| 3203 | 3318 | } |
| 3204 | 3319 | break; |
| @@ -3219,7 +3334,12 @@ | ||
| 3219 | 3334 | Result->Process(); |
| 3220 | 3335 | if( (GameConfig.GetFrameskipFlag() == false)||(framecnt%2 == 0) ){ |
| 3221 | 3336 | if( Result->RenderMain() == true ){ |
| 3222 | - ResetGame(WindowCtrl); | |
| 3337 | + if( ResetGame(WindowCtrl) == 0 ){ | |
| 3338 | + Result->Recovery(); | |
| 3339 | + | |
| 3340 | + //現在の画面を再スタートさせる | |
| 3341 | + //GameState.PushF12Key(); | |
| 3342 | + } | |
| 3223 | 3343 | } |
| 3224 | 3344 | } |
| 3225 | 3345 | break; |
| @@ -61,6 +61,12 @@ | ||
| 61 | 61 | return 0; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | +//! @brief シーン描画回復 | |
| 65 | +int scene::Recovery() | |
| 66 | +{ | |
| 67 | + return 0; | |
| 68 | +} | |
| 69 | + | |
| 64 | 70 | //! @brief シーン入力処理 |
| 65 | 71 | void scene::Input() |
| 66 | 72 | { |
| @@ -164,6 +170,15 @@ | ||
| 164 | 170 | return 0; |
| 165 | 171 | } |
| 166 | 172 | |
| 173 | +//! @brief シーン描画回復 | |
| 174 | +int D2Dscene::Recovery() | |
| 175 | +{ | |
| 176 | + //初期化 | |
| 177 | + gametitle = d3dg->LoadTexture("data\\title.dds", false, false); | |
| 178 | + if( gametitle == -1 ){ return 1; } | |
| 179 | + return 0; | |
| 180 | +} | |
| 181 | + | |
| 167 | 182 | //! @brief 2Dシーン描画処理(2D) |
| 168 | 183 | void D2Dscene::Render2D() |
| 169 | 184 | { |
| @@ -40,6 +40,9 @@ | ||
| 40 | 40 | #define MAX_GRENADE 32 //!< 手榴弾の最大数 |
| 41 | 41 | #define MAX_EFFECT 256 //!< エフェクトの最大数 |
| 42 | 42 | |
| 43 | +#define SMALLOBJECT_SCALE 5.0f //!< 小物の表示倍率 | |
| 44 | +#define BULLET_SCALE 1.0f //!< 銃弾の表示倍率 | |
| 45 | + | |
| 43 | 46 | #define WEAPONSHOT_HEIGHT (VIEW_HEIGHT) //!< 弾を発射する高さ |
| 44 | 47 | |
| 45 | 48 | #define TOTAL_WEAPON_AUTOBULLET 3 //!< 初期化時に自動的に補てんされる弾数(装弾数の何倍か) |
| @@ -51,7 +54,7 @@ | ||
| 51 | 54 | #define HUMAN_BULLETCOLLISION_LEG_H 10.0f //!< 足の当たり判定の高さ |
| 52 | 55 | #define HUMAN_BULLETCOLLISION_LEG_R 2.5f //!< 足の当たり判定の半径 |
| 53 | 56 | |
| 54 | -#define SMALLOBJECT_SCALE 0.13f //!< 小物当たり判定の倍率 | |
| 57 | +#define SMALLOBJECT_COLLISIONSCALE 0.13f //!< 小物当たり判定の倍率 | |
| 55 | 58 | |
| 56 | 59 | #ifndef H_LAYERLEVEL |
| 57 | 60 | #define H_LAYERLEVEL 3 //!< Select include file. |
| @@ -124,6 +127,7 @@ | ||
| 124 | 127 | int AddEffect(float pos_x, float pos_y, float pos_z, float move_x, float move_y, float move_z, float size, float rotation, int count, int texture, int settype); |
| 125 | 128 | int AddMapEffect(int id, int face, float pos_x, float pos_y, float pos_z, float size, float rotation, int count, int texture); |
| 126 | 129 | void LoadPointData(); |
| 130 | + void Recovery(); | |
| 127 | 131 | bool GetFriendlyFireFlag(); |
| 128 | 132 | void SetFriendlyFireFlag(bool flag); |
| 129 | 133 | int GetPlayerID(); |