• 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

Revision176 (tree)
Time2017-06-03 14:27:55
Authorxops-mikan

Log Message

「画面を暗く」フラグ有効時の描画処理を改善、コンソールのコマンドを1個追加(dark)

Change Summary

Incremental Difference

--- trunk/d3dgraphics-directx.cpp (revision 175)
+++ trunk/d3dgraphics-directx.cpp (revision 176)
@@ -409,8 +409,6 @@
409409 }
410410 if( id == -1 ){ return -1; }
411411
412- LPD3DXBUFFER pD3DXMtrlBuffer;
413-
414412 #ifdef ENABLE_PATH_DELIMITER_SLASH
415413 //パス区切り文字を変換
416414 filename = ChangePathDelimiter(filename);
@@ -418,25 +416,10 @@
418416
419417 //.xファイルをバッファーに読み込む
420418 if( FAILED( D3DXLoadMeshFromX( filename, D3DXMESH_SYSTEMMEM, pd3dDevice, NULL,
421- &pD3DXMtrlBuffer, NULL, &nummaterials[id], &pmesh[id] ) ) ) {
419+ NULL, NULL, &nummaterials[id], &pmesh[id] ) ) ) {
422420 return -1;
423421 }
424422
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-
440423 #ifdef ENABLE_DEBUGLOG
441424 //ログに出力
442425 OutputLog.WriteLog(LOG_COMPLETE, "", id);
@@ -494,13 +477,7 @@
494477 }
495478
496479 //マテリアル情報をコピー
497- int num = nummaterials[idA];
498480 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- }
504481
505482 //バッファーを取得
506483 pmesh[idA]->GetVertexBuffer(&pvbA);
@@ -539,8 +516,6 @@
539516 {
540517 if( (id < 0)||((MAX_MODEL -1) < id) ){ return; }
541518 if( pmesh[id] != NULL ){
542- delete [] pmaterials[id];
543-
544519 pmesh[id]->Release();
545520 pmesh[id] = NULL;
546521
@@ -1349,7 +1324,8 @@
13491324 //! @brief モデルファイルを描画
13501325 //! @param id_model モデル認識番号
13511326 //! @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)
13531329 {
13541330 //無効な引数が設定されていれば失敗
13551331 if( id_model == -1 ){ return; }
@@ -1358,20 +1334,42 @@
13581334 //指定したモデルが初期化されていなければ失敗
13591335 if( pmesh[id_model] == NULL) return;
13601336
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+
13611366 //描画
13621367 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- }
13731368 pmesh[id_model]->DrawSubset(i);
13741369 }
1370+
1371+ //ライティング無効化
1372+ pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
13751373 }
13761374
13771375 //! @brief 板を描画
--- trunk/d3dgraphics-opengl.cpp (revision 175)
+++ trunk/d3dgraphics-opengl.cpp (revision 176)
@@ -518,6 +518,7 @@
518518
519519 float *VertexAry = new float [polygons*6*3];
520520 float *ColorAry = new float [polygons*6*4];
521+ float *ColorGrayAry = new float [polygons*6*4];
521522 float *TexCoordAry = new float [polygons*6*2];
522523 int vid;
523524 int cnt = 0;
@@ -620,6 +621,13 @@
620621 for(int i=1; i<cnt; i++){
621622 memcpy(&(ColorAry[i*4]), ColorAry, sizeof(float)*4);
622623 }
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+ }
623631
624632 delete [] vertex;
625633 delete [] index;
@@ -628,6 +636,7 @@
628636 pmodel[id].polygons = polygons;
629637 pmodel[id].VertexAry = VertexAry;
630638 pmodel[id].ColorAry = ColorAry;
639+ pmodel[id].ColorGrayAry = ColorGrayAry;
631640 pmodel[id].TexCoordAry = TexCoordAry;
632641
633642 #ifdef ENABLE_DEBUGLOG
@@ -680,6 +689,7 @@
680689
681690 float *VertexAry = new float [numpA*6*3];
682691 float *ColorAry = new float [numpA*6*4];
692+ float *ColorGrayAry = new float [numpA*6*4];
683693 float *TexCoordAry = new float [numpA*6*2];
684694
685695 //各頂点を読み出し計算
@@ -695,6 +705,10 @@
695705 ColorAry[i*4 + 1] = pmodel[idA].ColorAry[i*4 + 1];
696706 ColorAry[i*4 + 2] = pmodel[idA].ColorAry[i*4 + 2];
697707 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];
698712 TexCoordAry[i*2 + 0] = pmodel[idA].TexCoordAry[i*2 + 0];
699713 TexCoordAry[i*2 + 1] = pmodel[idA].TexCoordAry[i*2 + 1];
700714 }
@@ -703,6 +717,7 @@
703717 pmodel[idN].polygons = numpA;
704718 pmodel[idN].VertexAry = VertexAry;
705719 pmodel[idN].ColorAry = ColorAry;
720+ pmodel[idN].ColorGrayAry = ColorGrayAry;
706721 pmodel[idN].TexCoordAry = TexCoordAry;
707722
708723 #ifdef ENABLE_DEBUGLOG
@@ -721,6 +736,7 @@
721736
722737 delete pmodel[id].VertexAry;
723738 delete pmodel[id].ColorAry;
739+ delete pmodel[id].ColorGrayAry;
724740 delete pmodel[id].TexCoordAry;
725741 pmodel[id].useflag = false;
726742
@@ -2051,7 +2067,8 @@
20512067 //! @brief モデルファイルを描画
20522068 //! @param id_model モデル認識番号
20532069 //! @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)
20552072 {
20562073 //無効な引数が設定されていれば失敗
20572074 if( id_model == -1 ){ return; }
@@ -2074,6 +2091,14 @@
20742091 SetTexture(id_texture);
20752092 }
20762093
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+
20772102 //配列有効化
20782103 glEnableClientState(GL_VERTEX_ARRAY);
20792104 glEnableClientState(GL_COLOR_ARRAY);
@@ -2081,7 +2106,7 @@
20812106
20822107 //描画
20832108 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);
20852110 glTexCoordPointer(2, GL_FLOAT, 0, pmodel[id_model].TexCoordAry);
20862111 glDrawArrays(GL_TRIANGLE_STRIP, 1, pmodel[id_model].polygons*6-2);
20872112
--- trunk/d3dgraphics.h (revision 175)
+++ trunk/d3dgraphics.h (revision 176)
@@ -135,6 +135,7 @@
135135 int polygons; //!< ポリゴン数
136136 float *VertexAry; //!< 頂点格納配列
137137 float *ColorAry; //!< 色格納配列
138+ float *ColorGrayAry; //!< 色格納配列(暗い)
138139 float *TexCoordAry; //!< テクスチャ座標格納配列
139140 };
140141
@@ -163,7 +164,6 @@
163164 float aspect; //!< 画面のアスペクト比
164165 bool fullscreenflag; //!< フルスクリーン表示
165166 LPD3DXMESH pmesh[MAX_MODEL]; //!< (Xファイル用)D3DXMESHのポインタ
166- D3DMATERIAL9* pmaterials[MAX_MODEL]; //!< (Xファイル用)D3DMATERIAL9のポインタ
167167 DWORD nummaterials[MAX_MODEL]; //!< (Xファイル用)マテリアル数
168168 LPDIRECT3DTEXTURE9 ptextures[MAX_TEXTURE]; //!< テクスチャを格納
169169
@@ -291,7 +291,7 @@
291291 void DrawMapdata(bool wireframe);
292292 int GetMapTextureID(int id);
293293 void CleanupMapdata();
294- void RenderModel(int id_model, int id_texture);
294+ void RenderModel(int id_model, int id_texture, bool darkflag);
295295 void RenderBoard(int id_texture, float alpha);
296296 void ScreenBrightness(int Width, int Height, int Brightness);
297297 void Centerline();
--- trunk/datafile.cpp (revision 175)
+++ trunk/datafile.cpp (revision 176)
@@ -176,9 +176,9 @@
176176 }
177177
178178 //! @brief ブロックデータの法線・影を算出する
179-//! @param screen ブロックを暗くする
179+//! @param darkflag ブロックを暗くする
180180 //! @attention LoadBlockdata()関数で読みこんだ後、一度だけ実行。
181-void BlockDataInterface::CalculationBlockdata(bool screen)
181+void BlockDataInterface::CalculationBlockdata(bool darkflag)
182182 {
183183 int vID[4];
184184 int uvID[4];
@@ -257,11 +257,11 @@
257257 //data[i].material[j].shadow = a/2 + 0.5f;
258258 a = sqrt(rx*rx + ry*ry + rz*rz) / 3.0f;
259259 data[i].material[j].shadow = a/2;
260- if( screen == false ){
260+ if( darkflag == false ){
261261 data[i].material[j].shadow += 0.5f;
262262 }
263263 else{
264- data[i].material[j].shadow += 0.2f;
264+ data[i].material[j].shadow += 0.3f;
265265 }
266266 }
267267 }
--- trunk/datafile.h (revision 175)
+++ trunk/datafile.h (revision 176)
@@ -112,7 +112,7 @@
112112 BlockDataInterface();
113113 ~BlockDataInterface();
114114 int LoadFiledata(char *fname);
115- void CalculationBlockdata(bool screen);
115+ void CalculationBlockdata(bool darkflag);
116116 int GetTexture(char *fname, int id);
117117 int Getdata(blockdata *out_data, int id);
118118 };
--- trunk/gamemain.cpp (revision 175)
+++ trunk/gamemain.cpp (revision 176)
@@ -282,7 +282,7 @@
282282 void opening::Process()
283283 {
284284 //オブジェクトマネージャーを実行
285- ObjMgr.Process(-1, false, camera_rx, camera_ry);
285+ ObjMgr.Process(-1, false, camera_rx, camera_ry, false);
286286
287287 //AIを実行
288288 for(int i=0; i<MAX_HUMAN; i++){
@@ -345,7 +345,7 @@
345345 //カメラ座標に背景空を描画
346346 d3dg->SetWorldTransform(camera_x, camera_y, camera_z, 0.0f, 0.0f, 2.0f);
347347 Resource.GetSkyModelTexture(&skymodel, &skytexture);
348- d3dg->RenderModel(skymodel, skytexture);
348+ d3dg->RenderModel(skymodel, skytexture, false);
349349
350350 //Zバッファを初期化
351351 d3dg->ResetZbuffer();
@@ -700,7 +700,7 @@
700700 void mainmenu::Process()
701701 {
702702 //オブジェクトマネージャーを実行
703- ObjMgr.Process(-1, true, camera_rx, camera_ry);
703+ ObjMgr.Process(-1, true, camera_rx, camera_ry, false);
704704
705705 //AIを実行
706706 for(int i=0; i<MAX_HUMAN; i++){
@@ -1096,11 +1096,11 @@
10961096 char pdata[MAX_PATH];
10971097 char pdata2[MAX_PATH];
10981098 int blockflag, pointflag;
1099- bool collisionflag, screenflag;
1099+ bool collisionflag;
11001100
11011101 //.bd1と.pd1のファイルパスを求める
11021102 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);
11041104
11051105 strcpy(bdata, path);
11061106 strcat(bdata, OFFICIALMISSION_BD1);
@@ -1111,7 +1111,7 @@
11111111 else{
11121112 MIFdata.GetDatafilePath(bdata, pdata);
11131113 collisionflag = MIFdata.GetCollisionFlag();
1114- screenflag = MIFdata.GetScreenFlag();
1114+ DarkScreenFlag = MIFdata.GetScreenFlag();
11151115
11161116 strcpy(path, bdata);
11171117 for(int i=strlen(path)-1; i>0; i--){
@@ -1139,7 +1139,7 @@
11391139 }
11401140
11411141 //ブロックデータ初期化
1142- BlockData.CalculationBlockdata(screenflag);
1142+ BlockData.CalculationBlockdata(DarkScreenFlag);
11431143 d3dg->LoadMapdata(&BlockData, path);
11441144 CollD.InitCollision(&BlockData);
11451145
@@ -1760,12 +1760,14 @@
17601760 GameParamInfo.GetWeapon(weaponid, &data);
17611761
17621762 //オブジェクトマネージャーを実行
1763+ int cmdF5id;
17631764 if( Cmd_F5 == true ){
1764- ObjMgr.Process( ObjMgr.GetPlayerID() , false, camera_rx, camera_ry);
1765+ cmdF5id = ObjMgr.GetPlayerID();
17651766 }
17661767 else{
1767- ObjMgr.Process(-1, false, camera_rx, camera_ry);
1768+ cmdF5id = -1;
17681769 }
1770+ ObjMgr.Process(cmdF5id, false, camera_rx, camera_ry, DarkScreenFlag);
17691771
17701772 //プレイヤーの戦歴を加算
17711773 ObjMgr.GetHumanShotInfo( ObjMgr.GetPlayerID(), &ontarget, &kill, &headshot);
@@ -1971,7 +1973,7 @@
19711973 //カメラ座標に背景空を描画
19721974 d3dg->SetWorldTransform(camera_x, camera_y, camera_z, 0.0f, 0.0f, 2.0f);
19731975 Resource.GetSkyModelTexture(&skymodel, &skytexture);
1974- d3dg->RenderModel(skymodel, skytexture);
1976+ d3dg->RenderModel(skymodel, skytexture, false);
19751977
19761978 //Zバッファを初期化
19771979 d3dg->ResetZbuffer();
@@ -2407,13 +2409,13 @@
24072409 GameParamInfo.GetWeapon(weapon_paramid[selectweapon], &weapon_paramdata);
24082410 Resource.GetWeaponModelTexture(weapon_paramid[selectweapon], &weaponmodel, &weapontexture);
24092411 d3dg->SetWorldTransformPlayerWeapon(true, camera_rx, camera_ry, DegreeToRadian(framecnt*2), weapon_paramdata.size);
2410- d3dg->RenderModel(weaponmodel, weapontexture);
2412+ d3dg->RenderModel(weaponmodel, weapontexture, false);
24112413
24122414 //(3D描画)所持している武器モデルの描画・サブ武器
24132415 GameParamInfo.GetWeapon(weapon_paramid[notselectweapon], &weapon_paramdata);
24142416 Resource.GetWeaponModelTexture(weapon_paramid[notselectweapon], &weaponmodel, &weapontexture);
24152417 d3dg->SetWorldTransformPlayerWeapon(false, camera_rx, camera_ry, 0.0f, weapon_paramdata.size);
2416- d3dg->RenderModel(weaponmodel, weapontexture);
2418+ d3dg->RenderModel(weaponmodel, weapontexture, false);
24172419 }
24182420
24192421 //-----------------------------------
@@ -2791,7 +2793,7 @@
27912793 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "help human result event ver");
27922794 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "mif bd1 pd1");
27932795 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");
27952797 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "ff revive kill <NUM> treat <NUM> nodamage <NUM>");
27962798 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "break <NUM> newobj <NUM>");
27972799 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop estop speed");
@@ -2872,7 +2874,7 @@
28722874 int MissionID = GameInfoData.selectmission_id;
28732875 char str2[MAX_PATH];
28742876 char str3[MAX_PATH];
2875- bool collisionflag;
2877+ bool collisionflag, screenflag;
28762878
28772879 //ヘッダー
28782880 if( AddonFlag == true ){ sprintf(str, "[Addon Mission] (MissionID:%d)", MissionID); }
@@ -2936,11 +2938,12 @@
29362938 //各設定値とFlag
29372939 if( AddonFlag == true ){
29382940 collisionflag = MIFdata.GetCollisionFlag();
2941+ screenflag = MIFdata.GetScreenFlag();
29392942 }
29402943 else{
2941- GameParamInfo.GetOfficialMission(MissionID, NULL, NULL, NULL, NULL, &collisionflag, NULL);
2944+ GameParamInfo.GetOfficialMission(MissionID, NULL, NULL, NULL, NULL, &collisionflag, &screenflag);
29422945 }
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);
29442947 AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), str);
29452948 }
29462949
@@ -3177,6 +3180,44 @@
31773180 }
31783181 }
31793182
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+
31803221 //全ての死者を蘇生する
31813222 if( strcmp(NewCommand, "revive") == 0 ){
31823223 for(int i=0; i<MAX_HUMAN; i++){
--- trunk/gamemain.h (revision 175)
+++ trunk/gamemain.h (revision 176)
@@ -164,6 +164,7 @@
164164 {
165165 //class EventControl Event[TOTAL_EVENTLINE]; //!< イベント制御クラス
166166 int SkyNumber; //!< 背景空番号
167+ bool DarkScreenFlag; //!< 画面を暗く
167168 float mouse_rx; //!< マウスによる水平軸角度
168169 float mouse_ry; //!< マウスによる垂直軸角度
169170 float view_rx; //!< マウス角度とカメラ角度の差(水平軸)
--- trunk/object.cpp (revision 175)
+++ trunk/object.cpp (revision 176)
@@ -45,6 +45,7 @@
4545 id_parameter = 0;
4646 id_model = -1;
4747 id_texture = -1;
48+ DarkModelFlag = false;
4849 }
4950
5051 //! @brief ディストラクタ
@@ -130,6 +131,13 @@
130131 return id_texture;
131132 }
132133
134+//! @brief モデルを暗くするフラグを設定
135+//! @param flag フラグ
136+void object::SetDarkModelFlag(bool flag)
137+{
138+ DarkModelFlag = flag;
139+}
140+
133141 //! @brief 計算を実行(自由落下など)
134142 int object::RunFrame()
135143 {
@@ -144,7 +152,7 @@
144152 if( EnableFlag == false ){ return; }
145153
146154 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);
148156 }
149157
150158 //! @brief コンストラクタ
@@ -1673,11 +1681,11 @@
16731681 if( DrawArm == false ){
16741682 //上半身を描画
16751683 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);
16771685
16781686 //足を描画
16791687 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);
16811689 }
16821690
16831691 //現在装備する武器のクラスを取得
@@ -1690,11 +1698,11 @@
16901698 float y = pos_y + cos(rotation_y)*16.0f;
16911699 float z = pos_z + sin(rotation_x*-1 - (float)M_PI/2)*sin(rotation_y)*16.0f;
16921700 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);
16941702 }
16951703 else if( nowweapon == NULL ){ //手ぶら
16961704 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);
16981706 }
16991707 else{ //何か武器を持っている
17001708 //武器のモデルとテクスチャを取得
@@ -1707,11 +1715,11 @@
17071715
17081716 //腕を描画
17091717 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);
17111719
17121720 //武器を描画
17131721 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);
17151723 }
17161724 }
17171725
@@ -2065,7 +2073,7 @@
20652073
20662074 //武器を描画
20672075 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);
20692077 }
20702078
20712079 //! @brief コンストラクタ
@@ -2300,7 +2308,7 @@
23002308
23012309 //描画
23022310 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);
23042312 }
23052313
23062314 //! @brief コンストラクタ
@@ -2418,7 +2426,7 @@
24182426
24192427 //描画
24202428 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);
24222430 }
24232431
24242432 //! @brief コンストラクタ
@@ -2551,7 +2559,7 @@
25512559
25522560 //描画
25532561 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);
25552563 }
25562564
25572565 //! @brief コンストラクタ
--- trunk/object.h (revision 175)
+++ trunk/object.h (revision 176)
@@ -100,6 +100,7 @@
100100 int id_parameter; //!< データの種類
101101 int id_model; //!< モデル認識番号
102102 int id_texture; //!< テクスチャ認識番号
103+ bool DarkModelFlag; //!< モデルを暗くする
103104 bool EnableFlag; //!< 有効化フラグ
104105
105106 public:
@@ -114,6 +115,7 @@
114115 virtual void GetModel(int *id, float *size);
115116 virtual void SetTexture(int id);
116117 virtual int GetTexture();
118+ virtual void SetDarkModelFlag(bool flag);
117119 virtual int RunFrame();
118120 virtual void Render(class D3DGraphics *d3dg);
119121 };
--- trunk/objectmanager.cpp (revision 175)
+++ trunk/objectmanager.cpp (revision 176)
@@ -2491,10 +2491,11 @@
24912491 //! @param demomode デモモード
24922492 //! @param camera_rx カメラの横軸角度
24932493 //! @param camera_ry カメラの縦軸角度
2494+//! @param screen 画面を暗くする
24942495 //! @return 常に 0
24952496 //! @attention 一般的に cmdF5id は、F5裏技使用中はプレイヤー番号(GetPlayerID()関数で取得)、未使用時は -1 を指定します。
24962497 //! @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)
24982499 {
24992500 //このフレームの戦歴を初期化
25002501 for(int i=0; i<MAX_HUMAN; i++){
@@ -2537,6 +2538,8 @@
25372538 ObjectLog->DiedHuman(-1, i, -1, teamid, player_teamid);
25382539 }
25392540
2541+ HumanIndex[i].SetDarkModelFlag(screen);
2542+
25402543 //足音
25412544 if( HumanIndex[i].GetMovemode(false) == 2 ){
25422545 //走る足音追加
@@ -2551,11 +2554,13 @@
25512554 //武器オブジェクトの処理
25522555 for(int i=0; i<MAX_WEAPON; i++){
25532556 WeaponIndex[i].RunFrame(CollD);
2557+ WeaponIndex[i].SetDarkModelFlag(screen);
25542558 }
25552559
25562560 //小物オブジェクトの処理
25572561 for(int i=0; i<MAX_SMALLOBJECT; i++){
25582562 SmallObjectIndex[i].RunFrame();
2563+ SmallObjectIndex[i].SetDarkModelFlag(screen);
25592564 }
25602565
25612566 if( demomode == false ){
@@ -2567,6 +2572,7 @@
25672572
25682573 CollideBullet(&BulletIndex[i]); //当たり判定を実行
25692574 BulletIndex[i].RunFrame(); //主計算
2575+ BulletIndex[i].SetDarkModelFlag(screen);
25702576
25712577 if( BulletIndex[i].GetEnableFlag() == true ){
25722578 //弾の座標と角度を取得
@@ -2606,6 +2612,7 @@
26062612 }
26072613 else{
26082614 EffectIndex[i].RunFrame(camera_rx, camera_ry);
2615+ EffectIndex[i].SetDarkModelFlag(screen);
26092616 }
26102617 }
26112618
@@ -2616,6 +2623,7 @@
26162623
26172624 //主計算
26182625 int rcr = GrenadeIndex[i].RunFrame(CollD);
2626+ GrenadeIndex[i].SetDarkModelFlag(screen);
26192627
26202628 //バウンド・跳ね返ったならば
26212629 if( rcr == 1 ){
--- trunk/objectmanager.h (revision 175)
+++ trunk/objectmanager.h (revision 176)
@@ -168,7 +168,7 @@
168168 bool HumanResuscitation(int id);
169169 int CheckGameOverorComplete();
170170 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);
172172 bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot);
173173 void Render(float camera_x, float camera_y, float camera_z, int HidePlayer);
174174 void RenderLog(int x, int y);