X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 176 (tree) |
|---|---|
| Time | 2017-06-03 14:27:55 |
| Author | |
「画面を暗く」フラグ有効時の描画処理を改善、コンソールのコマンドを1個追加(dark)
| @@ -409,8 +409,6 @@ | ||
| 409 | 409 | } |
| 410 | 410 | if( id == -1 ){ return -1; } |
| 411 | 411 | |
| 412 | - LPD3DXBUFFER pD3DXMtrlBuffer; | |
| 413 | - | |
| 414 | 412 | #ifdef ENABLE_PATH_DELIMITER_SLASH |
| 415 | 413 | //パス区切り文字を変換 |
| 416 | 414 | filename = ChangePathDelimiter(filename); |
| @@ -418,25 +416,10 @@ | ||
| 418 | 416 | |
| 419 | 417 | //.xファイルをバッファーに読み込む |
| 420 | 418 | if( FAILED( D3DXLoadMeshFromX( filename, D3DXMESH_SYSTEMMEM, pd3dDevice, NULL, |
| 421 | - &pD3DXMtrlBuffer, NULL, &nummaterials[id], &pmesh[id] ) ) ) { | |
| 419 | + NULL, NULL, &nummaterials[id], &pmesh[id] ) ) ) { | |
| 422 | 420 | return -1; |
| 423 | 421 | } |
| 424 | 422 | |
| 425 | - //マテリアル情報を取得 | |
| 426 | - D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer(); | |
| 427 | - int num = nummaterials[id]; | |
| 428 | - pmaterials[id] = new D3DMATERIAL9[num]; | |
| 429 | - if( pmaterials[id] == NULL ) return -1; | |
| 430 | - | |
| 431 | - //構造体に代入 | |
| 432 | - for( int i=0; i<num; i=i+1 ){ | |
| 433 | - pmaterials[id][i] = d3dxMaterials[i].MatD3D; | |
| 434 | - pmaterials[id][i].Ambient = pmaterials[id][i].Diffuse; | |
| 435 | - } | |
| 436 | - | |
| 437 | - //バッファを開放 | |
| 438 | - pD3DXMtrlBuffer->Release(); | |
| 439 | - | |
| 440 | 423 | #ifdef ENABLE_DEBUGLOG |
| 441 | 424 | //ログに出力 |
| 442 | 425 | OutputLog.WriteLog(LOG_COMPLETE, "", id); |
| @@ -494,13 +477,7 @@ | ||
| 494 | 477 | } |
| 495 | 478 | |
| 496 | 479 | //マテリアル情報をコピー |
| 497 | - int num = nummaterials[idA]; | |
| 498 | 480 | nummaterials[idN] = nummaterials[idA]; |
| 499 | - pmaterials[idN] = new D3DMATERIAL9[num]; | |
| 500 | - if( pmaterials[idN] == NULL ) return -1; | |
| 501 | - for( int i=0; i<num; i=i+1 ){ | |
| 502 | - pmaterials[idN][i] = pmaterials[idA][i]; | |
| 503 | - } | |
| 504 | 481 | |
| 505 | 482 | //バッファーを取得 |
| 506 | 483 | pmesh[idA]->GetVertexBuffer(&pvbA); |
| @@ -539,8 +516,6 @@ | ||
| 539 | 516 | { |
| 540 | 517 | if( (id < 0)||((MAX_MODEL -1) < id) ){ return; } |
| 541 | 518 | if( pmesh[id] != NULL ){ |
| 542 | - delete [] pmaterials[id]; | |
| 543 | - | |
| 544 | 519 | pmesh[id]->Release(); |
| 545 | 520 | pmesh[id] = NULL; |
| 546 | 521 |
| @@ -1349,7 +1324,8 @@ | ||
| 1349 | 1324 | //! @brief モデルファイルを描画 |
| 1350 | 1325 | //! @param id_model モデル認識番号 |
| 1351 | 1326 | //! @param id_texture テクスチャ認識番号 |
| 1352 | -void D3DGraphics::RenderModel(int id_model, int id_texture) | |
| 1327 | +//! @param darkflag モデルを暗くする | |
| 1328 | +void D3DGraphics::RenderModel(int id_model, int id_texture, bool darkflag) | |
| 1353 | 1329 | { |
| 1354 | 1330 | //無効な引数が設定されていれば失敗 |
| 1355 | 1331 | if( id_model == -1 ){ return; } |
| @@ -1358,20 +1334,42 @@ | ||
| 1358 | 1334 | //指定したモデルが初期化されていなければ失敗 |
| 1359 | 1335 | if( pmesh[id_model] == NULL) return; |
| 1360 | 1336 | |
| 1337 | + float Brightness; | |
| 1338 | + | |
| 1339 | + if( darkflag == false ){ | |
| 1340 | + Brightness = 1.0f; | |
| 1341 | + } | |
| 1342 | + else{ | |
| 1343 | + Brightness = 0.8f; | |
| 1344 | + } | |
| 1345 | + | |
| 1346 | + //ライティング有効化 | |
| 1347 | + pd3dDevice->SetRenderState(D3DRS_LIGHTING, TRUE); | |
| 1348 | + | |
| 1349 | + //色合い設定 | |
| 1350 | + D3DMATERIAL9 mtrl; | |
| 1351 | + ZeroMemory(&mtrl, sizeof(mtrl)); | |
| 1352 | + mtrl.Emissive = D3DXCOLOR(Brightness, Brightness, Brightness, 1.0f); | |
| 1353 | + pd3dDevice->SetMaterial(&mtrl); | |
| 1354 | + | |
| 1355 | + //テクスチャ設定 | |
| 1356 | + if( id_texture == -1 ){ | |
| 1357 | + pd3dDevice->SetTexture(0, NULL); | |
| 1358 | + } | |
| 1359 | + else if( ptextures[id_texture] == NULL ){ | |
| 1360 | + pd3dDevice->SetTexture(0, NULL); | |
| 1361 | + } | |
| 1362 | + else{ | |
| 1363 | + pd3dDevice->SetTexture( 0, ptextures[id_texture] ); | |
| 1364 | + } | |
| 1365 | + | |
| 1361 | 1366 | //描画 |
| 1362 | 1367 | for(int i=0; i<(signed)nummaterials[id_model]; i=i+1){ |
| 1363 | - pd3dDevice->SetMaterial( &pmaterials[id_model][i] ); | |
| 1364 | - if( id_texture == -1 ){ | |
| 1365 | - pd3dDevice->SetTexture(0, NULL); | |
| 1366 | - } | |
| 1367 | - else if( ptextures[id_texture] == NULL ){ | |
| 1368 | - pd3dDevice->SetTexture(0, NULL); | |
| 1369 | - } | |
| 1370 | - else{ | |
| 1371 | - pd3dDevice->SetTexture( 0, ptextures[id_texture] ); | |
| 1372 | - } | |
| 1373 | 1368 | pmesh[id_model]->DrawSubset(i); |
| 1374 | 1369 | } |
| 1370 | + | |
| 1371 | + //ライティング無効化 | |
| 1372 | + pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE); | |
| 1375 | 1373 | } |
| 1376 | 1374 | |
| 1377 | 1375 | //! @brief 板を描画 |
| @@ -518,6 +518,7 @@ | ||
| 518 | 518 | |
| 519 | 519 | float *VertexAry = new float [polygons*6*3]; |
| 520 | 520 | float *ColorAry = new float [polygons*6*4]; |
| 521 | + float *ColorGrayAry = new float [polygons*6*4]; | |
| 521 | 522 | float *TexCoordAry = new float [polygons*6*2]; |
| 522 | 523 | int vid; |
| 523 | 524 | int cnt = 0; |
| @@ -620,6 +621,13 @@ | ||
| 620 | 621 | for(int i=1; i<cnt; i++){ |
| 621 | 622 | memcpy(&(ColorAry[i*4]), ColorAry, sizeof(float)*4); |
| 622 | 623 | } |
| 624 | + ColorGrayAry[0] = 0.8f; | |
| 625 | + ColorGrayAry[1] = 0.8f; | |
| 626 | + ColorGrayAry[2] = 0.8f; | |
| 627 | + ColorGrayAry[3] = 1.0f; | |
| 628 | + for(int i=1; i<cnt; i++){ | |
| 629 | + memcpy(&(ColorGrayAry[i*4]), ColorGrayAry, sizeof(float)*4); | |
| 630 | + } | |
| 623 | 631 | |
| 624 | 632 | delete [] vertex; |
| 625 | 633 | delete [] index; |
| @@ -628,6 +636,7 @@ | ||
| 628 | 636 | pmodel[id].polygons = polygons; |
| 629 | 637 | pmodel[id].VertexAry = VertexAry; |
| 630 | 638 | pmodel[id].ColorAry = ColorAry; |
| 639 | + pmodel[id].ColorGrayAry = ColorGrayAry; | |
| 631 | 640 | pmodel[id].TexCoordAry = TexCoordAry; |
| 632 | 641 | |
| 633 | 642 | #ifdef ENABLE_DEBUGLOG |
| @@ -680,6 +689,7 @@ | ||
| 680 | 689 | |
| 681 | 690 | float *VertexAry = new float [numpA*6*3]; |
| 682 | 691 | float *ColorAry = new float [numpA*6*4]; |
| 692 | + float *ColorGrayAry = new float [numpA*6*4]; | |
| 683 | 693 | float *TexCoordAry = new float [numpA*6*2]; |
| 684 | 694 | |
| 685 | 695 | //各頂点を読み出し計算 |
| @@ -695,6 +705,10 @@ | ||
| 695 | 705 | ColorAry[i*4 + 1] = pmodel[idA].ColorAry[i*4 + 1]; |
| 696 | 706 | ColorAry[i*4 + 2] = pmodel[idA].ColorAry[i*4 + 2]; |
| 697 | 707 | ColorAry[i*4 + 3] = pmodel[idA].ColorAry[i*4 + 3]; |
| 708 | + ColorGrayAry[i*4 + 0] = pmodel[idA].ColorGrayAry[i*4 + 0]; | |
| 709 | + ColorGrayAry[i*4 + 1] = pmodel[idA].ColorGrayAry[i*4 + 1]; | |
| 710 | + ColorGrayAry[i*4 + 2] = pmodel[idA].ColorGrayAry[i*4 + 2]; | |
| 711 | + ColorGrayAry[i*4 + 3] = pmodel[idA].ColorGrayAry[i*4 + 3]; | |
| 698 | 712 | TexCoordAry[i*2 + 0] = pmodel[idA].TexCoordAry[i*2 + 0]; |
| 699 | 713 | TexCoordAry[i*2 + 1] = pmodel[idA].TexCoordAry[i*2 + 1]; |
| 700 | 714 | } |
| @@ -703,6 +717,7 @@ | ||
| 703 | 717 | pmodel[idN].polygons = numpA; |
| 704 | 718 | pmodel[idN].VertexAry = VertexAry; |
| 705 | 719 | pmodel[idN].ColorAry = ColorAry; |
| 720 | + pmodel[idN].ColorGrayAry = ColorGrayAry; | |
| 706 | 721 | pmodel[idN].TexCoordAry = TexCoordAry; |
| 707 | 722 | |
| 708 | 723 | #ifdef ENABLE_DEBUGLOG |
| @@ -721,6 +736,7 @@ | ||
| 721 | 736 | |
| 722 | 737 | delete pmodel[id].VertexAry; |
| 723 | 738 | delete pmodel[id].ColorAry; |
| 739 | + delete pmodel[id].ColorGrayAry; | |
| 724 | 740 | delete pmodel[id].TexCoordAry; |
| 725 | 741 | pmodel[id].useflag = false; |
| 726 | 742 |
| @@ -2051,7 +2067,8 @@ | ||
| 2051 | 2067 | //! @brief モデルファイルを描画 |
| 2052 | 2068 | //! @param id_model モデル認識番号 |
| 2053 | 2069 | //! @param id_texture テクスチャ認識番号 |
| 2054 | -void D3DGraphics::RenderModel(int id_model, int id_texture) | |
| 2070 | +//! @param darkflag モデルを暗くする | |
| 2071 | +void D3DGraphics::RenderModel(int id_model, int id_texture, bool darkflag) | |
| 2055 | 2072 | { |
| 2056 | 2073 | //無効な引数が設定されていれば失敗 |
| 2057 | 2074 | if( id_model == -1 ){ return; } |
| @@ -2074,6 +2091,14 @@ | ||
| 2074 | 2091 | SetTexture(id_texture); |
| 2075 | 2092 | } |
| 2076 | 2093 | |
| 2094 | + float *ColorAry = NULL; | |
| 2095 | + if( darkflag == false ){ | |
| 2096 | + ColorAry = pmodel[id_model].ColorAry; | |
| 2097 | + } | |
| 2098 | + else{ | |
| 2099 | + ColorAry = pmodel[id_model].ColorGrayAry; | |
| 2100 | + } | |
| 2101 | + | |
| 2077 | 2102 | //配列有効化 |
| 2078 | 2103 | glEnableClientState(GL_VERTEX_ARRAY); |
| 2079 | 2104 | glEnableClientState(GL_COLOR_ARRAY); |
| @@ -2081,7 +2106,7 @@ | ||
| 2081 | 2106 | |
| 2082 | 2107 | //描画 |
| 2083 | 2108 | glVertexPointer(3, GL_FLOAT, 0, pmodel[id_model].VertexAry); |
| 2084 | - glColorPointer(4, GL_FLOAT, 0, pmodel[id_model].ColorAry); | |
| 2109 | + glColorPointer(4, GL_FLOAT, 0, ColorAry); | |
| 2085 | 2110 | glTexCoordPointer(2, GL_FLOAT, 0, pmodel[id_model].TexCoordAry); |
| 2086 | 2111 | glDrawArrays(GL_TRIANGLE_STRIP, 1, pmodel[id_model].polygons*6-2); |
| 2087 | 2112 |
| @@ -135,6 +135,7 @@ | ||
| 135 | 135 | int polygons; //!< ポリゴン数 |
| 136 | 136 | float *VertexAry; //!< 頂点格納配列 |
| 137 | 137 | float *ColorAry; //!< 色格納配列 |
| 138 | + float *ColorGrayAry; //!< 色格納配列(暗い) | |
| 138 | 139 | float *TexCoordAry; //!< テクスチャ座標格納配列 |
| 139 | 140 | }; |
| 140 | 141 |
| @@ -163,7 +164,6 @@ | ||
| 163 | 164 | float aspect; //!< 画面のアスペクト比 |
| 164 | 165 | bool fullscreenflag; //!< フルスクリーン表示 |
| 165 | 166 | LPD3DXMESH pmesh[MAX_MODEL]; //!< (Xファイル用)D3DXMESHのポインタ |
| 166 | - D3DMATERIAL9* pmaterials[MAX_MODEL]; //!< (Xファイル用)D3DMATERIAL9のポインタ | |
| 167 | 167 | DWORD nummaterials[MAX_MODEL]; //!< (Xファイル用)マテリアル数 |
| 168 | 168 | LPDIRECT3DTEXTURE9 ptextures[MAX_TEXTURE]; //!< テクスチャを格納 |
| 169 | 169 |
| @@ -291,7 +291,7 @@ | ||
| 291 | 291 | void DrawMapdata(bool wireframe); |
| 292 | 292 | int GetMapTextureID(int id); |
| 293 | 293 | void CleanupMapdata(); |
| 294 | - void RenderModel(int id_model, int id_texture); | |
| 294 | + void RenderModel(int id_model, int id_texture, bool darkflag); | |
| 295 | 295 | void RenderBoard(int id_texture, float alpha); |
| 296 | 296 | void ScreenBrightness(int Width, int Height, int Brightness); |
| 297 | 297 | void Centerline(); |
| @@ -176,9 +176,9 @@ | ||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | //! @brief ブロックデータの法線・影を算出する |
| 179 | -//! @param screen ブロックを暗くする | |
| 179 | +//! @param darkflag ブロックを暗くする | |
| 180 | 180 | //! @attention LoadBlockdata()関数で読みこんだ後、一度だけ実行。 |
| 181 | -void BlockDataInterface::CalculationBlockdata(bool screen) | |
| 181 | +void BlockDataInterface::CalculationBlockdata(bool darkflag) | |
| 182 | 182 | { |
| 183 | 183 | int vID[4]; |
| 184 | 184 | int uvID[4]; |
| @@ -257,11 +257,11 @@ | ||
| 257 | 257 | //data[i].material[j].shadow = a/2 + 0.5f; |
| 258 | 258 | a = sqrt(rx*rx + ry*ry + rz*rz) / 3.0f; |
| 259 | 259 | data[i].material[j].shadow = a/2; |
| 260 | - if( screen == false ){ | |
| 260 | + if( darkflag == false ){ | |
| 261 | 261 | data[i].material[j].shadow += 0.5f; |
| 262 | 262 | } |
| 263 | 263 | else{ |
| 264 | - data[i].material[j].shadow += 0.2f; | |
| 264 | + data[i].material[j].shadow += 0.3f; | |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } |
| @@ -112,7 +112,7 @@ | ||
| 112 | 112 | BlockDataInterface(); |
| 113 | 113 | ~BlockDataInterface(); |
| 114 | 114 | int LoadFiledata(char *fname); |
| 115 | - void CalculationBlockdata(bool screen); | |
| 115 | + void CalculationBlockdata(bool darkflag); | |
| 116 | 116 | int GetTexture(char *fname, int id); |
| 117 | 117 | int Getdata(blockdata *out_data, int id); |
| 118 | 118 | }; |
| @@ -282,7 +282,7 @@ | ||
| 282 | 282 | void opening::Process() |
| 283 | 283 | { |
| 284 | 284 | //オブジェクトマネージャーを実行 |
| 285 | - ObjMgr.Process(-1, false, camera_rx, camera_ry); | |
| 285 | + ObjMgr.Process(-1, false, camera_rx, camera_ry, false); | |
| 286 | 286 | |
| 287 | 287 | //AIを実行 |
| 288 | 288 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -345,7 +345,7 @@ | ||
| 345 | 345 | //カメラ座標に背景空を描画 |
| 346 | 346 | d3dg->SetWorldTransform(camera_x, camera_y, camera_z, 0.0f, 0.0f, 2.0f); |
| 347 | 347 | Resource.GetSkyModelTexture(&skymodel, &skytexture); |
| 348 | - d3dg->RenderModel(skymodel, skytexture); | |
| 348 | + d3dg->RenderModel(skymodel, skytexture, false); | |
| 349 | 349 | |
| 350 | 350 | //Zバッファを初期化 |
| 351 | 351 | d3dg->ResetZbuffer(); |
| @@ -700,7 +700,7 @@ | ||
| 700 | 700 | void mainmenu::Process() |
| 701 | 701 | { |
| 702 | 702 | //オブジェクトマネージャーを実行 |
| 703 | - ObjMgr.Process(-1, true, camera_rx, camera_ry); | |
| 703 | + ObjMgr.Process(-1, true, camera_rx, camera_ry, false); | |
| 704 | 704 | |
| 705 | 705 | //AIを実行 |
| 706 | 706 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -1096,11 +1096,11 @@ | ||
| 1096 | 1096 | char pdata[MAX_PATH]; |
| 1097 | 1097 | char pdata2[MAX_PATH]; |
| 1098 | 1098 | int blockflag, pointflag; |
| 1099 | - bool collisionflag, screenflag; | |
| 1099 | + bool collisionflag; | |
| 1100 | 1100 | |
| 1101 | 1101 | //.bd1と.pd1のファイルパスを求める |
| 1102 | 1102 | if( MIFdata.GetFiletype() == false ){ |
| 1103 | - GameParamInfo.GetOfficialMission(MainGameInfo.selectmission_id, NULL, NULL, path, pdata2, &collisionflag, &screenflag); | |
| 1103 | + GameParamInfo.GetOfficialMission(MainGameInfo.selectmission_id, NULL, NULL, path, pdata2, &collisionflag, &DarkScreenFlag); | |
| 1104 | 1104 | |
| 1105 | 1105 | strcpy(bdata, path); |
| 1106 | 1106 | strcat(bdata, OFFICIALMISSION_BD1); |
| @@ -1111,7 +1111,7 @@ | ||
| 1111 | 1111 | else{ |
| 1112 | 1112 | MIFdata.GetDatafilePath(bdata, pdata); |
| 1113 | 1113 | collisionflag = MIFdata.GetCollisionFlag(); |
| 1114 | - screenflag = MIFdata.GetScreenFlag(); | |
| 1114 | + DarkScreenFlag = MIFdata.GetScreenFlag(); | |
| 1115 | 1115 | |
| 1116 | 1116 | strcpy(path, bdata); |
| 1117 | 1117 | for(int i=strlen(path)-1; i>0; i--){ |
| @@ -1139,7 +1139,7 @@ | ||
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | //ブロックデータ初期化 |
| 1142 | - BlockData.CalculationBlockdata(screenflag); | |
| 1142 | + BlockData.CalculationBlockdata(DarkScreenFlag); | |
| 1143 | 1143 | d3dg->LoadMapdata(&BlockData, path); |
| 1144 | 1144 | CollD.InitCollision(&BlockData); |
| 1145 | 1145 |
| @@ -1760,12 +1760,14 @@ | ||
| 1760 | 1760 | GameParamInfo.GetWeapon(weaponid, &data); |
| 1761 | 1761 | |
| 1762 | 1762 | //オブジェクトマネージャーを実行 |
| 1763 | + int cmdF5id; | |
| 1763 | 1764 | if( Cmd_F5 == true ){ |
| 1764 | - ObjMgr.Process( ObjMgr.GetPlayerID() , false, camera_rx, camera_ry); | |
| 1765 | + cmdF5id = ObjMgr.GetPlayerID(); | |
| 1765 | 1766 | } |
| 1766 | 1767 | else{ |
| 1767 | - ObjMgr.Process(-1, false, camera_rx, camera_ry); | |
| 1768 | + cmdF5id = -1; | |
| 1768 | 1769 | } |
| 1770 | + ObjMgr.Process(cmdF5id, false, camera_rx, camera_ry, DarkScreenFlag); | |
| 1769 | 1771 | |
| 1770 | 1772 | //プレイヤーの戦歴を加算 |
| 1771 | 1773 | ObjMgr.GetHumanShotInfo( ObjMgr.GetPlayerID(), &ontarget, &kill, &headshot); |
| @@ -1971,7 +1973,7 @@ | ||
| 1971 | 1973 | //カメラ座標に背景空を描画 |
| 1972 | 1974 | d3dg->SetWorldTransform(camera_x, camera_y, camera_z, 0.0f, 0.0f, 2.0f); |
| 1973 | 1975 | Resource.GetSkyModelTexture(&skymodel, &skytexture); |
| 1974 | - d3dg->RenderModel(skymodel, skytexture); | |
| 1976 | + d3dg->RenderModel(skymodel, skytexture, false); | |
| 1975 | 1977 | |
| 1976 | 1978 | //Zバッファを初期化 |
| 1977 | 1979 | d3dg->ResetZbuffer(); |
| @@ -2407,13 +2409,13 @@ | ||
| 2407 | 2409 | GameParamInfo.GetWeapon(weapon_paramid[selectweapon], &weapon_paramdata); |
| 2408 | 2410 | Resource.GetWeaponModelTexture(weapon_paramid[selectweapon], &weaponmodel, &weapontexture); |
| 2409 | 2411 | d3dg->SetWorldTransformPlayerWeapon(true, camera_rx, camera_ry, DegreeToRadian(framecnt*2), weapon_paramdata.size); |
| 2410 | - d3dg->RenderModel(weaponmodel, weapontexture); | |
| 2412 | + d3dg->RenderModel(weaponmodel, weapontexture, false); | |
| 2411 | 2413 | |
| 2412 | 2414 | //(3D描画)所持している武器モデルの描画・サブ武器 |
| 2413 | 2415 | GameParamInfo.GetWeapon(weapon_paramid[notselectweapon], &weapon_paramdata); |
| 2414 | 2416 | Resource.GetWeaponModelTexture(weapon_paramid[notselectweapon], &weaponmodel, &weapontexture); |
| 2415 | 2417 | d3dg->SetWorldTransformPlayerWeapon(false, camera_rx, camera_ry, 0.0f, weapon_paramdata.size); |
| 2416 | - d3dg->RenderModel(weaponmodel, weapontexture); | |
| 2418 | + d3dg->RenderModel(weaponmodel, weapontexture, false); | |
| 2417 | 2419 | } |
| 2418 | 2420 | |
| 2419 | 2421 | //----------------------------------- |
| @@ -2791,7 +2793,7 @@ | ||
| 2791 | 2793 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event ver"); |
| 2792 | 2794 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "mif bd1 pd1"); |
| 2793 | 2795 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map aiinfo <NUM>"); |
| 2794 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "tag radar inmap sky <NUM>"); | |
| 2796 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "tag radar inmap sky <NUM> dark"); | |
| 2795 | 2797 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "ff revive kill <NUM> treat <NUM> nodamage <NUM>"); |
| 2796 | 2798 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "break <NUM> newobj <NUM>"); |
| 2797 | 2799 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop estop speed"); |
| @@ -2872,7 +2874,7 @@ | ||
| 2872 | 2874 | int MissionID = GameInfoData.selectmission_id; |
| 2873 | 2875 | char str2[MAX_PATH]; |
| 2874 | 2876 | char str3[MAX_PATH]; |
| 2875 | - bool collisionflag; | |
| 2877 | + bool collisionflag, screenflag; | |
| 2876 | 2878 | |
| 2877 | 2879 | //ヘッダー |
| 2878 | 2880 | if( AddonFlag == true ){ sprintf(str, "[Addon Mission] (MissionID:%d)", MissionID); } |
| @@ -2936,11 +2938,12 @@ | ||
| 2936 | 2938 | //各設定値とFlag |
| 2937 | 2939 | if( AddonFlag == true ){ |
| 2938 | 2940 | collisionflag = MIFdata.GetCollisionFlag(); |
| 2941 | + screenflag = MIFdata.GetScreenFlag(); | |
| 2939 | 2942 | } |
| 2940 | 2943 | else{ |
| 2941 | - GameParamInfo.GetOfficialMission(MissionID, NULL, NULL, NULL, NULL, &collisionflag, NULL); | |
| 2944 | + GameParamInfo.GetOfficialMission(MissionID, NULL, NULL, NULL, NULL, &collisionflag, &screenflag); | |
| 2942 | 2945 | } |
| 2943 | - sprintf(str, "Sky:%d CollisionFlag:%d NightFlag:%d", MIFdata.GetSkynumber(), (int)collisionflag, (int)MIFdata.GetScreenFlag()); | |
| 2946 | + sprintf(str, "Sky:%d CollisionFlag:%d DarkScreenFlag:%d", MIFdata.GetSkynumber(), (int)collisionflag, (int)screenflag); | |
| 2944 | 2947 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), str); |
| 2945 | 2948 | } |
| 2946 | 2949 |
| @@ -3177,6 +3180,44 @@ | ||
| 3177 | 3180 | } |
| 3178 | 3181 | } |
| 3179 | 3182 | |
| 3183 | + //画面を暗く | |
| 3184 | + if( strcmp(NewCommand, "dark") == 0 ){ | |
| 3185 | + char path[MAX_PATH]; | |
| 3186 | + char bdata[MAX_PATH]; | |
| 3187 | + char pdata[MAX_PATH]; | |
| 3188 | + | |
| 3189 | + //フラグ切り替え | |
| 3190 | + if( DarkScreenFlag == false ){ | |
| 3191 | + DarkScreenFlag = true; | |
| 3192 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Enable DarkScreen Flag."); | |
| 3193 | + } | |
| 3194 | + else{ | |
| 3195 | + DarkScreenFlag = false; | |
| 3196 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Disable DarkScreen Flag."); | |
| 3197 | + } | |
| 3198 | + | |
| 3199 | + //.bd1のファイルパスを求める | |
| 3200 | + if( MIFdata.GetFiletype() == false ){ | |
| 3201 | + GameParamInfo.GetOfficialMission(MainGameInfo.selectmission_id, NULL, NULL, path, NULL, NULL, NULL); | |
| 3202 | + } | |
| 3203 | + else{ | |
| 3204 | + MIFdata.GetDatafilePath(bdata, pdata); | |
| 3205 | + | |
| 3206 | + strcpy(path, bdata); | |
| 3207 | + for(int i=strlen(path)-1; i>0; i--){ | |
| 3208 | + if( path[i] == '\\' ){ | |
| 3209 | + path[i+1] = '\0'; | |
| 3210 | + break; | |
| 3211 | + } | |
| 3212 | + } | |
| 3213 | + } | |
| 3214 | + | |
| 3215 | + //ブロックデータ初期化 | |
| 3216 | + BlockData.CalculationBlockdata(DarkScreenFlag); | |
| 3217 | + d3dg->CleanupMapdata(); | |
| 3218 | + d3dg->LoadMapdata(&BlockData, path); | |
| 3219 | + } | |
| 3220 | + | |
| 3180 | 3221 | //全ての死者を蘇生する |
| 3181 | 3222 | if( strcmp(NewCommand, "revive") == 0 ){ |
| 3182 | 3223 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -164,6 +164,7 @@ | ||
| 164 | 164 | { |
| 165 | 165 | //class EventControl Event[TOTAL_EVENTLINE]; //!< イベント制御クラス |
| 166 | 166 | int SkyNumber; //!< 背景空番号 |
| 167 | + bool DarkScreenFlag; //!< 画面を暗く | |
| 167 | 168 | float mouse_rx; //!< マウスによる水平軸角度 |
| 168 | 169 | float mouse_ry; //!< マウスによる垂直軸角度 |
| 169 | 170 | float view_rx; //!< マウス角度とカメラ角度の差(水平軸) |
| @@ -45,6 +45,7 @@ | ||
| 45 | 45 | id_parameter = 0; |
| 46 | 46 | id_model = -1; |
| 47 | 47 | id_texture = -1; |
| 48 | + DarkModelFlag = false; | |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | //! @brief ディストラクタ |
| @@ -130,6 +131,13 @@ | ||
| 130 | 131 | return id_texture; |
| 131 | 132 | } |
| 132 | 133 | |
| 134 | +//! @brief モデルを暗くするフラグを設定 | |
| 135 | +//! @param flag フラグ | |
| 136 | +void object::SetDarkModelFlag(bool flag) | |
| 137 | +{ | |
| 138 | + DarkModelFlag = flag; | |
| 139 | +} | |
| 140 | + | |
| 133 | 141 | //! @brief 計算を実行(自由落下など) |
| 134 | 142 | int object::RunFrame() |
| 135 | 143 | { |
| @@ -144,7 +152,7 @@ | ||
| 144 | 152 | if( EnableFlag == false ){ return; } |
| 145 | 153 | |
| 146 | 154 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, rotation_x, 0.0f, model_size); |
| 147 | - d3dg->RenderModel(id_model, id_texture); | |
| 155 | + d3dg->RenderModel(id_model, id_texture, DarkModelFlag); | |
| 148 | 156 | } |
| 149 | 157 | |
| 150 | 158 | //! @brief コンストラクタ |
| @@ -1673,11 +1681,11 @@ | ||
| 1673 | 1681 | if( DrawArm == false ){ |
| 1674 | 1682 | //上半身を描画 |
| 1675 | 1683 | d3dg->SetWorldTransform(pos_x, pos_y - 1.0f, pos_z, rotation_x + (float)M_PI, rotation_y, upmodel_size); |
| 1676 | - d3dg->RenderModel(upmodel, id_texture); | |
| 1684 | + d3dg->RenderModel(upmodel, id_texture, DarkModelFlag); | |
| 1677 | 1685 | |
| 1678 | 1686 | //足を描画 |
| 1679 | 1687 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, legrx + (float)M_PI, rotation_y, legmodel_size); |
| 1680 | - d3dg->RenderModel(legmodel, id_texture); | |
| 1688 | + d3dg->RenderModel(legmodel, id_texture, DarkModelFlag); | |
| 1681 | 1689 | } |
| 1682 | 1690 | |
| 1683 | 1691 | //現在装備する武器のクラスを取得 |
| @@ -1690,11 +1698,11 @@ | ||
| 1690 | 1698 | float y = pos_y + cos(rotation_y)*16.0f; |
| 1691 | 1699 | float z = pos_z + sin(rotation_x*-1 - (float)M_PI/2)*sin(rotation_y)*16.0f; |
| 1692 | 1700 | d3dg->SetWorldTransform(x, y, z, rotation_x + (float)M_PI, armrotation_y + rotation_y, armmodel_size); |
| 1693 | - d3dg->RenderModel(armmodel, id_texture); | |
| 1701 | + d3dg->RenderModel(armmodel, id_texture, DarkModelFlag); | |
| 1694 | 1702 | } |
| 1695 | 1703 | else if( nowweapon == NULL ){ //手ぶら |
| 1696 | 1704 | d3dg->SetWorldTransform(pos_x, pos_y + 16.0f, pos_z, rotation_x + (float)M_PI, armry, armmodel_size); |
| 1697 | - d3dg->RenderModel(armmodel, id_texture); | |
| 1705 | + d3dg->RenderModel(armmodel, id_texture, DarkModelFlag); | |
| 1698 | 1706 | } |
| 1699 | 1707 | else{ //何か武器を持っている |
| 1700 | 1708 | //武器のモデルとテクスチャを取得 |
| @@ -1707,11 +1715,11 @@ | ||
| 1707 | 1715 | |
| 1708 | 1716 | //腕を描画 |
| 1709 | 1717 | d3dg->SetWorldTransform(pos_x, pos_y + 16.0f, pos_z, rotation_x + (float)M_PI, armry, armmodel_size); |
| 1710 | - d3dg->RenderModel(armmodel, id_texture); | |
| 1718 | + d3dg->RenderModel(armmodel, id_texture, DarkModelFlag); | |
| 1711 | 1719 | |
| 1712 | 1720 | //武器を描画 |
| 1713 | 1721 | d3dg->SetWorldTransformHumanWeapon(pos_x, pos_y + 16.0f, pos_z, paramdata.mx/10*-1, paramdata.my/10, paramdata.mz/10*-1, rotation_x + (float)M_PI, armry, paramdata.size); |
| 1714 | - d3dg->RenderModel(model, texture); | |
| 1722 | + d3dg->RenderModel(model, texture, DarkModelFlag); | |
| 1715 | 1723 | } |
| 1716 | 1724 | } |
| 1717 | 1725 |
| @@ -2065,7 +2073,7 @@ | ||
| 2065 | 2073 | |
| 2066 | 2074 | //武器を描画 |
| 2067 | 2075 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, rotation_x, 0.0f, (float)M_PI/2, model_size); |
| 2068 | - d3dg->RenderModel(id_model, id_texture); | |
| 2076 | + d3dg->RenderModel(id_model, id_texture, DarkModelFlag); | |
| 2069 | 2077 | } |
| 2070 | 2078 | |
| 2071 | 2079 | //! @brief コンストラクタ |
| @@ -2300,7 +2308,7 @@ | ||
| 2300 | 2308 | |
| 2301 | 2309 | //描画 |
| 2302 | 2310 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, rotation_x, rotation_y, model_size); |
| 2303 | - d3dg->RenderModel(id_model, id_texture); | |
| 2311 | + d3dg->RenderModel(id_model, id_texture, DarkModelFlag); | |
| 2304 | 2312 | } |
| 2305 | 2313 | |
| 2306 | 2314 | //! @brief コンストラクタ |
| @@ -2418,7 +2426,7 @@ | ||
| 2418 | 2426 | |
| 2419 | 2427 | //描画 |
| 2420 | 2428 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, (rotation_x * -1 - (float)M_PI/2), rotation_y, model_size); |
| 2421 | - d3dg->RenderModel(id_model, id_texture); | |
| 2429 | + d3dg->RenderModel(id_model, id_texture, false); | |
| 2422 | 2430 | } |
| 2423 | 2431 | |
| 2424 | 2432 | //! @brief コンストラクタ |
| @@ -2551,7 +2559,7 @@ | ||
| 2551 | 2559 | |
| 2552 | 2560 | //描画 |
| 2553 | 2561 | d3dg->SetWorldTransform(pos_x, pos_y, pos_z, (rotation_x * -1 - (float)M_PI/2), 0.0f, (float)M_PI/2, model_size); |
| 2554 | - d3dg->RenderModel(id_model, id_texture); | |
| 2562 | + d3dg->RenderModel(id_model, id_texture, DarkModelFlag); | |
| 2555 | 2563 | } |
| 2556 | 2564 | |
| 2557 | 2565 | //! @brief コンストラクタ |
| @@ -100,6 +100,7 @@ | ||
| 100 | 100 | int id_parameter; //!< データの種類 |
| 101 | 101 | int id_model; //!< モデル認識番号 |
| 102 | 102 | int id_texture; //!< テクスチャ認識番号 |
| 103 | + bool DarkModelFlag; //!< モデルを暗くする | |
| 103 | 104 | bool EnableFlag; //!< 有効化フラグ |
| 104 | 105 | |
| 105 | 106 | public: |
| @@ -114,6 +115,7 @@ | ||
| 114 | 115 | virtual void GetModel(int *id, float *size); |
| 115 | 116 | virtual void SetTexture(int id); |
| 116 | 117 | virtual int GetTexture(); |
| 118 | + virtual void SetDarkModelFlag(bool flag); | |
| 117 | 119 | virtual int RunFrame(); |
| 118 | 120 | virtual void Render(class D3DGraphics *d3dg); |
| 119 | 121 | }; |
| @@ -2491,10 +2491,11 @@ | ||
| 2491 | 2491 | //! @param demomode デモモード |
| 2492 | 2492 | //! @param camera_rx カメラの横軸角度 |
| 2493 | 2493 | //! @param camera_ry カメラの縦軸角度 |
| 2494 | +//! @param screen 画面を暗くする | |
| 2494 | 2495 | //! @return 常に 0 |
| 2495 | 2496 | //! @attention 一般的に cmdF5id は、F5裏技使用中はプレイヤー番号(GetPlayerID()関数で取得)、未使用時は -1 を指定します。 |
| 2496 | 2497 | //! @attention demomode は主にメニュー画面で使用します。有効にすると、銃弾・手榴弾を処理しません。 |
| 2497 | -int ObjectManager::Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry) | |
| 2498 | +int ObjectManager::Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry, bool screen) | |
| 2498 | 2499 | { |
| 2499 | 2500 | //このフレームの戦歴を初期化 |
| 2500 | 2501 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -2537,6 +2538,8 @@ | ||
| 2537 | 2538 | ObjectLog->DiedHuman(-1, i, -1, teamid, player_teamid); |
| 2538 | 2539 | } |
| 2539 | 2540 | |
| 2541 | + HumanIndex[i].SetDarkModelFlag(screen); | |
| 2542 | + | |
| 2540 | 2543 | //足音 |
| 2541 | 2544 | if( HumanIndex[i].GetMovemode(false) == 2 ){ |
| 2542 | 2545 | //走る足音追加 |
| @@ -2551,11 +2554,13 @@ | ||
| 2551 | 2554 | //武器オブジェクトの処理 |
| 2552 | 2555 | for(int i=0; i<MAX_WEAPON; i++){ |
| 2553 | 2556 | WeaponIndex[i].RunFrame(CollD); |
| 2557 | + WeaponIndex[i].SetDarkModelFlag(screen); | |
| 2554 | 2558 | } |
| 2555 | 2559 | |
| 2556 | 2560 | //小物オブジェクトの処理 |
| 2557 | 2561 | for(int i=0; i<MAX_SMALLOBJECT; i++){ |
| 2558 | 2562 | SmallObjectIndex[i].RunFrame(); |
| 2563 | + SmallObjectIndex[i].SetDarkModelFlag(screen); | |
| 2559 | 2564 | } |
| 2560 | 2565 | |
| 2561 | 2566 | if( demomode == false ){ |
| @@ -2567,6 +2572,7 @@ | ||
| 2567 | 2572 | |
| 2568 | 2573 | CollideBullet(&BulletIndex[i]); //当たり判定を実行 |
| 2569 | 2574 | BulletIndex[i].RunFrame(); //主計算 |
| 2575 | + BulletIndex[i].SetDarkModelFlag(screen); | |
| 2570 | 2576 | |
| 2571 | 2577 | if( BulletIndex[i].GetEnableFlag() == true ){ |
| 2572 | 2578 | //弾の座標と角度を取得 |
| @@ -2606,6 +2612,7 @@ | ||
| 2606 | 2612 | } |
| 2607 | 2613 | else{ |
| 2608 | 2614 | EffectIndex[i].RunFrame(camera_rx, camera_ry); |
| 2615 | + EffectIndex[i].SetDarkModelFlag(screen); | |
| 2609 | 2616 | } |
| 2610 | 2617 | } |
| 2611 | 2618 |
| @@ -2616,6 +2623,7 @@ | ||
| 2616 | 2623 | |
| 2617 | 2624 | //主計算 |
| 2618 | 2625 | int rcr = GrenadeIndex[i].RunFrame(CollD); |
| 2626 | + GrenadeIndex[i].SetDarkModelFlag(screen); | |
| 2619 | 2627 | |
| 2620 | 2628 | //バウンド・跳ね返ったならば |
| 2621 | 2629 | if( rcr == 1 ){ |
| @@ -168,7 +168,7 @@ | ||
| 168 | 168 | bool HumanResuscitation(int id); |
| 169 | 169 | int CheckGameOverorComplete(); |
| 170 | 170 | bool GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr); |
| 171 | - int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry); | |
| 171 | + int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry, bool screen); | |
| 172 | 172 | bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot); |
| 173 | 173 | void Render(float camera_x, float camera_y, float camera_z, int HidePlayer); |
| 174 | 174 | void RenderLog(int x, int y); |