X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
リビジョン | 327 (tree) |
---|---|
日時 | 2022-09-06 02:13:16 |
作者 | xops-mikan |
構造体の記述方法を修正、一部変数名を変更
@@ -34,7 +34,7 @@ | ||
34 | 34 | //! @brief コンストラクタ |
35 | 35 | Collision::Collision() |
36 | 36 | { |
37 | - blockdata = NULL; | |
37 | + BlockDataIF = NULL; | |
38 | 38 | cbdata = new Coll_Blockdata[MAX_BLOCKS]; |
39 | 39 | for(int i=0; i<MAX_BLOCKS; i++){ |
40 | 40 | cbdata[i].min_x = 0.0f; |
@@ -55,17 +55,17 @@ | ||
55 | 55 | } |
56 | 56 | |
57 | 57 | //! @brief ブロックデータを取り込む |
58 | -//! @param in_blockdata ブロックデータ | |
59 | -int Collision::InitCollision(BlockDataInterface* in_blockdata) | |
58 | +//! @param in_BlockDataIF ブロックデータ | |
59 | +int Collision::InitCollision(BlockDataInterface* in_BlockDataIF) | |
60 | 60 | { |
61 | 61 | int bs; |
62 | - struct blockdata data; | |
62 | + blockdata data; | |
63 | 63 | int vID[4]; |
64 | 64 | |
65 | - if( in_blockdata == NULL ){ return 1; } | |
66 | - blockdata = in_blockdata; | |
65 | + if( in_BlockDataIF == NULL ){ return 1; } | |
66 | + BlockDataIF = in_BlockDataIF; | |
67 | 67 | |
68 | - bs = blockdata->GetTotaldatas(); | |
68 | + bs = BlockDataIF->GetTotaldatas(); | |
69 | 69 | |
70 | 70 | for(int i=0; i<bs; i++){ |
71 | 71 | cbdata[i].BoardBlock = false; |
@@ -77,7 +77,7 @@ | ||
77 | 77 | float cz = 0.0f; |
78 | 78 | float x, y, z, rx, ry, r; |
79 | 79 | |
80 | - blockdata->Getdata(&data, i); | |
80 | + BlockDataIF->Getdata(&data, i); | |
81 | 81 | |
82 | 82 | //中心を求める |
83 | 83 | for(int j=0; j<8; j++){ |
@@ -243,15 +243,15 @@ | ||
243 | 243 | //! @attention 各当たり判定の関数から自動的に呼ばれます。 |
244 | 244 | bool Collision::CheckPolygonFront(int id, int face, float x, float y, float z) |
245 | 245 | { |
246 | - if( blockdata == NULL ){ return false; } | |
247 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return false; } | |
246 | + if( BlockDataIF == NULL ){ return false; } | |
247 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return false; } | |
248 | 248 | if( (face < 0)||(6 < face) ){ return false; } |
249 | 249 | |
250 | - struct blockdata bdata; | |
250 | + blockdata bdata; | |
251 | 251 | float vx, vy, vz; |
252 | 252 | float d; |
253 | 253 | |
254 | - blockdata->Getdata(&bdata, id); | |
254 | + BlockDataIF->Getdata(&bdata, id); | |
255 | 255 | |
256 | 256 | //面の中心を基準点に、座標のベクトルを求める |
257 | 257 | vx = cbdata[id].polygon_center_x[face] - x; |
@@ -274,15 +274,15 @@ | ||
274 | 274 | //! @return 表向き:true 裏向き:false |
275 | 275 | bool Collision::CheckPolygonFrontRx(int id, int face, float rx) |
276 | 276 | { |
277 | - if( blockdata == NULL ){ return false; } | |
278 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return false; } | |
277 | + if( BlockDataIF == NULL ){ return false; } | |
278 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return false; } | |
279 | 279 | if( (face < 0)||(6 < face) ){ return false; } |
280 | 280 | |
281 | - struct blockdata bdata; | |
281 | + blockdata bdata; | |
282 | 282 | float vx, vz; |
283 | 283 | float d; |
284 | 284 | |
285 | - blockdata->Getdata(&bdata, id); | |
285 | + BlockDataIF->Getdata(&bdata, id); | |
286 | 286 | |
287 | 287 | //ベクトル算出 |
288 | 288 | vx = cosf(rx); |
@@ -312,7 +312,7 @@ | ||
312 | 312 | //! @attention 各当たり判定の関数から自動的に呼ばれます。 |
313 | 313 | bool Collision::CheckIntersectTri(int blockid, int face, float RayPos_x, float RayPos_y, float RayPos_z, float RayDir_x, float RayDir_y, float RayDir_z, float *out_Dist) |
314 | 314 | { |
315 | - struct blockdata data; | |
315 | + blockdata data; | |
316 | 316 | int vID[4]; |
317 | 317 | float d1, d2; |
318 | 318 | float vx1, vy1, vz1; |
@@ -320,7 +320,7 @@ | ||
320 | 320 | float x, y, z; |
321 | 321 | float vx2, vy2, vz2; |
322 | 322 | |
323 | - blockdata->Getdata(&data, blockid); | |
323 | + BlockDataIF->Getdata(&data, blockid); | |
324 | 324 | blockdataface(face, vID, NULL); |
325 | 325 | |
326 | 326 | //内積 |
@@ -422,8 +422,8 @@ | ||
422 | 422 | //! @warning *planeid が返す表面(0〜5)は、複数の面が該当する場合でも、最初に見つけた1面のみ返します。 |
423 | 423 | bool Collision::CheckBlockInside(int blockid, float x, float y, float z, bool worldgroup, int *planeid) |
424 | 424 | { |
425 | - if( blockdata == NULL ){ return false; } | |
426 | - if( (blockid < 0)||(blockdata->GetTotaldatas() <= blockid) ){ return false; } | |
425 | + if( BlockDataIF == NULL ){ return false; } | |
426 | + if( (blockid < 0)||(BlockDataIF->GetTotaldatas() <= blockid) ){ return false; } | |
427 | 427 | |
428 | 428 | //板状のブロックは計算外 |
429 | 429 | if( cbdata[blockid].BoardBlock == true ){ return false; } |
@@ -470,9 +470,9 @@ | ||
470 | 470 | //! @return 埋っている:true 埋っていない:false |
471 | 471 | bool Collision::CheckALLBlockInside(float x, float y, float z) |
472 | 472 | { |
473 | - if( blockdata == NULL ){ return false; } | |
473 | + if( BlockDataIF == NULL ){ return false; } | |
474 | 474 | |
475 | - int bs = blockdata->GetTotaldatas(); | |
475 | + int bs = BlockDataIF->GetTotaldatas(); | |
476 | 476 | |
477 | 477 | for(int i=0; i<bs; i++){ |
478 | 478 | if( CheckBlockInside(i, x, y, z, true, NULL) == true ){ return true; } |
@@ -499,8 +499,8 @@ | ||
499 | 499 | //! @attention また、レイが複数のブロックに当たる場合は、レイの始点から一番近い判定を返します。 |
500 | 500 | bool Collision::CheckBlockIntersectRay(int blockid, float RayPos_x, float RayPos_y, float RayPos_z, float RayDir_x, float RayDir_y, float RayDir_z, int *face, float *Dist, float maxDist) |
501 | 501 | { |
502 | - if( blockdata == NULL ){ return false; } | |
503 | - if( (blockid < 0)||(blockdata->GetTotaldatas() <= blockid) ){ return false; } | |
502 | + if( BlockDataIF == NULL ){ return false; } | |
503 | + if( (blockid < 0)||(BlockDataIF->GetTotaldatas() <= blockid) ){ return false; } | |
504 | 504 | if( (RayDir_x == 0.0f)&&(RayDir_y == 0.0f)&&(RayDir_z == 0.0f) ){ return false; } |
505 | 505 | |
506 | 506 | float pDist; |
@@ -630,10 +630,10 @@ | ||
630 | 630 | //! @attention また、レイが複数のブロックに当たる場合は、<b>レイの始点から一番近い判定</b>を返します。 |
631 | 631 | bool Collision::CheckALLBlockIntersectRay(float RayPos_x, float RayPos_y, float RayPos_z, float RayDir_x, float RayDir_y, float RayDir_z, int *id, int *face, float *Dist, float maxDist) |
632 | 632 | { |
633 | - if( blockdata == NULL ){ return false; } | |
633 | + if( BlockDataIF == NULL ){ return false; } | |
634 | 634 | if( (RayDir_x == 0.0f)&&(RayDir_y == 0.0f)&&(RayDir_z == 0.0f) ){ return false; } |
635 | 635 | |
636 | - int bs = blockdata->GetTotaldatas(); | |
636 | + int bs = BlockDataIF->GetTotaldatas(); | |
637 | 637 | float pDist; |
638 | 638 | float min_pDist = FLT_MAX; |
639 | 639 | int min_blockid = -1; |
@@ -758,7 +758,7 @@ | ||
758 | 758 | //! @attention また、レイが複数のブロックに当たる場合は、<b>一番最初に発見した判定</b>を返します。 |
759 | 759 | bool Collision::CheckALLBlockIntersectDummyRay(float RayPos_x, float RayPos_y, float RayPos_z, float RayDir_x, float RayDir_y, float RayDir_z, int *id, int *face, float *Dist, float maxDist) |
760 | 760 | { |
761 | - if( blockdata == NULL ){ return false; } | |
761 | + if( BlockDataIF == NULL ){ return false; } | |
762 | 762 | if( maxDist <= 0.0f ){ return false; } |
763 | 763 | |
764 | 764 | float RayPos2_x = RayPos_x + RayDir_x * maxDist/2; |
@@ -819,12 +819,12 @@ | ||
819 | 819 | //! @brief ブロックに沿って移動するベクトルを求める |
820 | 820 | void Collision::ScratchVector(int id, int face, float in_vx, float in_vy, float in_vz, float *out_vx, float *out_vy, float *out_vz) |
821 | 821 | { |
822 | - if( blockdata == NULL ){ return; } | |
823 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return; } | |
822 | + if( BlockDataIF == NULL ){ return; } | |
823 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return; } | |
824 | 824 | if( (face < 0)||(6 < face) ){ return; } |
825 | 825 | |
826 | - struct blockdata bdata; | |
827 | - blockdata->Getdata(&bdata, id); | |
826 | + blockdata bdata; | |
827 | + BlockDataIF->Getdata(&bdata, id); | |
828 | 828 | |
829 | 829 | //内積 |
830 | 830 | float Dot = in_vx * bdata.material[face].vx + in_vy * bdata.material[face].vy + in_vz * bdata.material[face].vz; |
@@ -837,12 +837,12 @@ | ||
837 | 837 | //! @brief ブロックに反射するベクトルを求める |
838 | 838 | void Collision::ReflectVector(int id, int face, float in_vx, float in_vy, float in_vz, float *out_vx, float *out_vy, float *out_vz) |
839 | 839 | { |
840 | - if( blockdata == NULL ){ return; } | |
841 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return; } | |
840 | + if( BlockDataIF == NULL ){ return; } | |
841 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return; } | |
842 | 842 | if( (face < 0)||(6 < face) ){ return; } |
843 | 843 | |
844 | - struct blockdata bdata; | |
845 | - blockdata->Getdata(&bdata, id); | |
844 | + blockdata bdata; | |
845 | + BlockDataIF->Getdata(&bdata, id); | |
846 | 846 | |
847 | 847 | //内積 |
848 | 848 | float Dot = in_vx * bdata.material[face].vx + in_vy * bdata.material[face].vy + in_vz * bdata.material[face].vz; |
@@ -857,12 +857,12 @@ | ||
857 | 857 | //! @attention 表向き:0.0〜PI/2(0.0度〜90.0度)、裏向き:-0.0〜-PI/2(-0.0度〜-90.0度) |
858 | 858 | bool Collision::AngleVector(int id, int face, float in_vx, float in_vy, float in_vz, float *out_angle) |
859 | 859 | { |
860 | - if( blockdata == NULL ){ return false; } | |
861 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return false; } | |
860 | + if( BlockDataIF == NULL ){ return false; } | |
861 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return false; } | |
862 | 862 | if( (face < 0)||(6 < face) ){ return false; } |
863 | 863 | |
864 | - struct blockdata bdata; | |
865 | - blockdata->Getdata(&bdata, id); | |
864 | + blockdata bdata; | |
865 | + BlockDataIF->Getdata(&bdata, id); | |
866 | 866 | |
867 | 867 | float maxDist = sqrtf(in_vx*in_vx + in_vy*in_vy + in_vz*in_vz); |
868 | 868 | if( maxDist == 0.0f ){ return false; } |
@@ -881,14 +881,14 @@ | ||
881 | 881 | //! @attention 向き:0.0〜PI/2(0.0度〜90.0度) |
882 | 882 | bool Collision::ScratchAngleVector(int id, int face, float in_vx, float in_vy, float in_vz, float *out_vx, float *out_vy, float *out_vz, float *out_angle) |
883 | 883 | { |
884 | - if( blockdata == NULL ){ return false; } | |
885 | - if( (id < 0)||(blockdata->GetTotaldatas() <= id) ){ return false; } | |
884 | + if( BlockDataIF == NULL ){ return false; } | |
885 | + if( (id < 0)||(BlockDataIF->GetTotaldatas() <= id) ){ return false; } | |
886 | 886 | if( (face < 0)||(6 < face) ){ return false; } |
887 | 887 | |
888 | 888 | if( (in_vx == 0.0f)&&(in_vy == 0.0f)&&(in_vz == 0.0f) ){ return false; } |
889 | 889 | |
890 | - struct blockdata bdata; | |
891 | - blockdata->Getdata(&bdata, id); | |
890 | + blockdata bdata; | |
891 | + BlockDataIF->Getdata(&bdata, id); | |
892 | 892 | |
893 | 893 | //内積 |
894 | 894 | float Dot = in_vx * bdata.material[face].vx + in_vy * bdata.material[face].vy + in_vz * bdata.material[face].vz; |
@@ -42,7 +42,7 @@ | ||
42 | 42 | #include <float.h> |
43 | 43 | |
44 | 44 | //! 当たり判定用ブロックデータ構造体 |
45 | -struct Coll_Blockdata | |
45 | +typedef struct | |
46 | 46 | { |
47 | 47 | float x[8]; //!< ブロック X座標 |
48 | 48 | float y[8]; //!< ブロック Y座標 |
@@ -58,13 +58,13 @@ | ||
58 | 58 | float max_z; //!< ブロック Z座標の最大値 |
59 | 59 | bool BoardBlock; //!< ブロック が厚さ0で板状になっているか |
60 | 60 | int worldgroup; //!< 空間分割のグループ |
61 | -}; | |
61 | +} Coll_Blockdata; | |
62 | 62 | |
63 | 63 | //! @brief 当たり判定を行うクラス |
64 | 64 | //! @details マップとして使用されるブロックデータへの当たり判定(衝突検出)を行います。 |
65 | 65 | class Collision |
66 | 66 | { |
67 | - class BlockDataInterface* blockdata; //!< 読み込んだブロックデータが格納されたクラスへのポインタ | |
67 | + class BlockDataInterface* BlockDataIF; //!< 読み込んだブロックデータが格納されたクラスへのポインタ | |
68 | 68 | Coll_Blockdata *cbdata; //!< ブロックデータ |
69 | 69 | |
70 | 70 | bool CheckIntersectTri(int blockid, int face, float RayPos_x, float RayPos_y, float RayPos_z, float RayDir_x, float RayDir_y, float RayDir_z, float *out_Dist); |
@@ -72,7 +72,7 @@ | ||
72 | 72 | public: |
73 | 73 | Collision(); |
74 | 74 | ~Collision(); |
75 | - int InitCollision(BlockDataInterface* in_blockdata); | |
75 | + int InitCollision(BlockDataInterface* in_BlockDataIF); | |
76 | 76 | void GetBlockPosMINMAX(int id, float *min_x, float *min_y, float *min_z, float *max_x, float *max_y, float *max_z); |
77 | 77 | int GetWorldGroup(float x, float z); |
78 | 78 | bool CheckPolygonFront(int id, int face, float x, float y, float z); |
@@ -61,7 +61,7 @@ | ||
61 | 61 | hPSEnableTexture = NULL; |
62 | 62 | #endif |
63 | 63 | |
64 | - blockdata = NULL; | |
64 | + BlockDataIF = NULL; | |
65 | 65 | bs = 0; |
66 | 66 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
67 | 67 | mapTextureID[i] = -1; |
@@ -1330,28 +1330,28 @@ | ||
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | //! @brief マップデータを取り込む |
1333 | -//! @param in_blockdata ブロックデータ | |
1333 | +//! @param in_BlockDataIF ブロックデータ | |
1334 | 1334 | //! @param directory ブロックデータが存在するディレクトリ |
1335 | -void D3DGraphics::LoadMapdata(BlockDataInterface* in_blockdata, const char *directory) | |
1335 | +void D3DGraphics::LoadMapdata(BlockDataInterface* in_BlockDataIF, const char *directory) | |
1336 | 1336 | { |
1337 | 1337 | //ブロックデータが指定されていなければ、処理しない。 |
1338 | - if( in_blockdata == NULL ){ return; } | |
1338 | + if( in_BlockDataIF == NULL ){ return; } | |
1339 | 1339 | if( directory == NULL ){ return; } |
1340 | 1340 | |
1341 | 1341 | char fname[MAX_PATH]; |
1342 | 1342 | char fnamefull[MAX_PATH]; |
1343 | 1343 | //int bs; |
1344 | - struct blockdata data; | |
1344 | + blockdata data; | |
1345 | 1345 | int vID[4]; |
1346 | 1346 | int uvID[4]; |
1347 | 1347 | |
1348 | 1348 | //クラスを設定 |
1349 | - blockdata = in_blockdata; | |
1349 | + BlockDataIF = in_BlockDataIF; | |
1350 | 1350 | |
1351 | 1351 | //テクスチャ読み込み |
1352 | 1352 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
1353 | 1353 | //テクスチャ名を取得 |
1354 | - blockdata->GetTexture(fname, i); | |
1354 | + BlockDataIF->GetTexture(fname, i); | |
1355 | 1355 | |
1356 | 1356 | if( strcmp(fname, "") == 0 ){ //指定されていなければ、処理しない |
1357 | 1357 | mapTextureID[i] = -1; |
@@ -1373,7 +1373,7 @@ | ||
1373 | 1373 | VERTEXTXTA* pVertices; |
1374 | 1374 | |
1375 | 1375 | //ブロック数を取得 |
1376 | - bs = blockdata->GetTotaldatas(); | |
1376 | + bs = BlockDataIF->GetTotaldatas(); | |
1377 | 1377 | |
1378 | 1378 | //ブロック数分のバッファーを作成 |
1379 | 1379 | pd3dDevice->CreateVertexBuffer(bs*6*4*sizeof(VERTEXTXTA), 0, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, D3DPOOL_DEFAULT, &g_pVB, NULL); |
@@ -1380,7 +1380,7 @@ | ||
1380 | 1380 | |
1381 | 1381 | for(int i=0; i<bs; i++){ |
1382 | 1382 | //データを取得 |
1383 | - blockdata->Getdata(&data, i); | |
1383 | + BlockDataIF->Getdata(&data, i); | |
1384 | 1384 | |
1385 | 1385 | for(int j=0; j<6; j++){ |
1386 | 1386 | //面の頂点データの関連付けを取得 |
@@ -1412,11 +1412,11 @@ | ||
1412 | 1412 | } |
1413 | 1413 | #else |
1414 | 1414 | //ブロック数を取得 |
1415 | - bs = blockdata->GetTotaldatas(); | |
1415 | + bs = BlockDataIF->GetTotaldatas(); | |
1416 | 1416 | |
1417 | 1417 | for(int i=0; i<bs; i++){ |
1418 | 1418 | //データを取得 |
1419 | - blockdata->Getdata(&data, i); | |
1419 | + BlockDataIF->Getdata(&data, i); | |
1420 | 1420 | |
1421 | 1421 | for(int j=0; j<6; j++){ |
1422 | 1422 | //面の頂点データの関連付けを取得 |
@@ -1457,9 +1457,9 @@ | ||
1457 | 1457 | void D3DGraphics::RenderMapdata(bool wireframe) |
1458 | 1458 | { |
1459 | 1459 | //ブロックデータが読み込まれていなければ、処理しない。 |
1460 | - if( blockdata == NULL ){ return; } | |
1460 | + if( BlockDataIF == NULL ){ return; } | |
1461 | 1461 | |
1462 | - struct blockdata data; | |
1462 | + blockdata data; | |
1463 | 1463 | int textureID; |
1464 | 1464 | |
1465 | 1465 | if( wireframe == true ){ |
@@ -1467,7 +1467,7 @@ | ||
1467 | 1467 | |
1468 | 1468 | //ワイヤーフレーム表示 |
1469 | 1469 | for(int i=0; i<bs; i++){ |
1470 | - blockdata->Getdata(&data, i); | |
1470 | + BlockDataIF->Getdata(&data, i); | |
1471 | 1471 | Renderline(data.x[0], data.y[0], data.z[0], data.x[1], data.y[1], data.z[1], linecolor); |
1472 | 1472 | Renderline(data.x[1], data.y[1], data.z[1], data.x[2], data.y[2], data.z[2], linecolor); |
1473 | 1473 | Renderline(data.x[2], data.y[2], data.z[2], data.x[3], data.y[3], data.z[3], linecolor); |
@@ -1527,7 +1527,7 @@ | ||
1527 | 1527 | |
1528 | 1528 | for(int i=0; i<bs; i++){ |
1529 | 1529 | //データ取得 |
1530 | - blockdata->Getdata(&data, i); | |
1530 | + BlockDataIF->Getdata(&data, i); | |
1531 | 1531 | |
1532 | 1532 | for(int j=0; j<6; j++){ |
1533 | 1533 | //テクスチャ認識番号を取得 |
@@ -1579,7 +1579,7 @@ | ||
1579 | 1579 | |
1580 | 1580 | for(int i=0; i<bs; i++){ |
1581 | 1581 | //データ取得 |
1582 | - blockdata->Getdata(&data, i); | |
1582 | + BlockDataIF->Getdata(&data, i); | |
1583 | 1583 | |
1584 | 1584 | for(int j=0; j<6; j++){ |
1585 | 1585 | //テクスチャ認識番号を取得 |
@@ -1613,7 +1613,7 @@ | ||
1613 | 1613 | #ifdef BLOCKDATA_GPUMEMORY |
1614 | 1614 | if( g_pVB == NULL ){ return; } |
1615 | 1615 | #endif |
1616 | - if( (bs == 0)&&(blockdata == NULL) ){ return; } | |
1616 | + if( (bs == 0)&&(BlockDataIF == NULL) ){ return; } | |
1617 | 1617 | |
1618 | 1618 | //テクスチャを開放 |
1619 | 1619 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
@@ -1629,7 +1629,7 @@ | ||
1629 | 1629 | #endif |
1630 | 1630 | bs = 0; |
1631 | 1631 | |
1632 | - blockdata = NULL; | |
1632 | + BlockDataIF = NULL; | |
1633 | 1633 | |
1634 | 1634 | #ifdef ENABLE_DEBUGLOG |
1635 | 1635 | //ログに出力 |
@@ -72,7 +72,7 @@ | ||
72 | 72 | camera_ry = 0.0f; |
73 | 73 | viewangle = 0.0f; |
74 | 74 | |
75 | - blockdata = NULL; | |
75 | + BlockDataIF = NULL; | |
76 | 76 | bs = 0; |
77 | 77 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
78 | 78 | mapTextureID[i] = -1; |
@@ -2036,12 +2036,12 @@ | ||
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | //! @brief マップデータを取り込む |
2039 | -//! @param in_blockdata ブロックデータ | |
2039 | +//! @param in_BlockDataIF ブロックデータ | |
2040 | 2040 | //! @param directory ブロックデータが存在するディレクトリ |
2041 | -void D3DGraphics::LoadMapdata(BlockDataInterface* in_blockdata, const char *directory) | |
2041 | +void D3DGraphics::LoadMapdata(BlockDataInterface* in_BlockDataIF, const char *directory) | |
2042 | 2042 | { |
2043 | 2043 | //ブロックデータが指定されていなければ、処理しない。 |
2044 | - if( in_blockdata == NULL ){ return; } | |
2044 | + if( in_BlockDataIF == NULL ){ return; } | |
2045 | 2045 | if( directory == NULL ){ return; } |
2046 | 2046 | |
2047 | 2047 | char fname[MAX_PATH]; |
@@ -2048,15 +2048,15 @@ | ||
2048 | 2048 | char fnamefull[MAX_PATH]; |
2049 | 2049 | |
2050 | 2050 | //クラスを設定 |
2051 | - blockdata = in_blockdata; | |
2051 | + BlockDataIF = in_BlockDataIF; | |
2052 | 2052 | |
2053 | 2053 | //ブロック数を取得 |
2054 | - bs = blockdata->GetTotaldatas(); | |
2054 | + bs = BlockDataIF->GetTotaldatas(); | |
2055 | 2055 | |
2056 | 2056 | //テクスチャ読み込み |
2057 | 2057 | for(int i=0; i<TOTAL_BLOCKTEXTURE; i++){ |
2058 | 2058 | //テクスチャ名を取得 |
2059 | - blockdata->GetTexture(fname, i); | |
2059 | + BlockDataIF->GetTexture(fname, i); | |
2060 | 2060 | |
2061 | 2061 | if( strcmp(fname, "") == 0 ){ //指定されていなければ、処理しない |
2062 | 2062 | mapTextureID[i] = -1; |
@@ -2075,9 +2075,9 @@ | ||
2075 | 2075 | void D3DGraphics::RenderMapdata(bool wireframe) |
2076 | 2076 | { |
2077 | 2077 | //ブロックデータが読み込まれていなければ、処理しない。 |
2078 | - if( blockdata == NULL ){ return; } | |
2078 | + if( BlockDataIF == NULL ){ return; } | |
2079 | 2079 | |
2080 | - struct blockdata data; | |
2080 | + blockdata data; | |
2081 | 2081 | int textureID; |
2082 | 2082 | int vID[4]; |
2083 | 2083 | int uvID[4]; |
@@ -2090,7 +2090,7 @@ | ||
2090 | 2090 | |
2091 | 2091 | //ワイヤーフレーム表示 |
2092 | 2092 | for(int i=0; i<bs; i++){ |
2093 | - blockdata->Getdata(&data, i); | |
2093 | + BlockDataIF->Getdata(&data, i); | |
2094 | 2094 | Renderline(data.x[0], data.y[0], data.z[0], data.x[1], data.y[1], data.z[1], linecolor); |
2095 | 2095 | Renderline(data.x[1], data.y[1], data.z[1], data.x[2], data.y[2], data.z[2], linecolor); |
2096 | 2096 | Renderline(data.x[2], data.y[2], data.z[2], data.x[3], data.y[3], data.z[3], linecolor); |
@@ -2134,7 +2134,7 @@ | ||
2134 | 2134 | |
2135 | 2135 | for(int i=0; i<bs; i++){ |
2136 | 2136 | //データ取得 |
2137 | - blockdata->Getdata(&data, i); | |
2137 | + BlockDataIF->Getdata(&data, i); | |
2138 | 2138 | |
2139 | 2139 | for(int j=0; j<6; j++){ |
2140 | 2140 | //テクスチャ認識番号を取得 |
@@ -2210,7 +2210,7 @@ | ||
2210 | 2210 | |
2211 | 2211 | bs = 0; |
2212 | 2212 | |
2213 | - blockdata = NULL; | |
2213 | + BlockDataIF = NULL; | |
2214 | 2214 | } |
2215 | 2215 | |
2216 | 2216 | //! @brief モデルファイルを描画 |
@@ -115,16 +115,16 @@ | ||
115 | 115 | #if (GRAPHIC_ENGINE == 0)||(GRAPHIC_ENGINE == 1) |
116 | 116 | |
117 | 117 | //! 3Dポリゴン描画用構造体 |
118 | -struct VERTEXTXTA | |
118 | +typedef struct | |
119 | 119 | { |
120 | 120 | D3DXVECTOR3 position; //!< The position |
121 | 121 | DWORD color; //!< The color |
122 | 122 | FLOAT tu; //!< The texture coordinates |
123 | 123 | FLOAT tv; //!< The texture coordinates |
124 | -}; | |
124 | +} VERTEXTXTA; | |
125 | 125 | |
126 | 126 | //! 2Dポリゴン描画用構造体 |
127 | -struct TLVERTX | |
127 | +typedef struct | |
128 | 128 | { |
129 | 129 | FLOAT x; //!< position |
130 | 130 | FLOAT y; //!< position |
@@ -133,12 +133,12 @@ | ||
133 | 133 | D3DCOLOR color; //!< color |
134 | 134 | FLOAT tu; //!< texture coordinates |
135 | 135 | FLOAT tv; //!< texture coordinates |
136 | -}; | |
136 | +} TLVERTX; | |
137 | 137 | |
138 | 138 | #elif GRAPHIC_ENGINE == 8 |
139 | 139 | |
140 | 140 | //! モデルデータの頂点格納構造体 |
141 | -struct MODELVDATA | |
141 | +typedef struct | |
142 | 142 | { |
143 | 143 | float x; //!< position |
144 | 144 | float y; //!< position |
@@ -145,10 +145,10 @@ | ||
145 | 145 | float z; //!< position |
146 | 146 | float u; //!< texture coordinates |
147 | 147 | float v; //!< texture coordinates |
148 | -}; | |
148 | +} MODELVDATA; | |
149 | 149 | |
150 | 150 | //! モデルデータ構造体 |
151 | -struct MODELDATA | |
151 | +typedef struct | |
152 | 152 | { |
153 | 153 | bool useflag; //!< 有効化フラグ |
154 | 154 | int polygons; //!< ポリゴン数 |
@@ -156,16 +156,16 @@ | ||
156 | 156 | float *ColorAry; //!< 色格納配列 |
157 | 157 | float *ColorGrayAry; //!< 色格納配列(暗い) |
158 | 158 | float *TexCoordAry; //!< テクスチャ座標格納配列 |
159 | -}; | |
159 | +} MODELDATA; | |
160 | 160 | |
161 | 161 | //! テクスチャ構造体 |
162 | -struct TEXTUREDATA | |
162 | +typedef struct | |
163 | 163 | { |
164 | 164 | bool useflag; //!< 有効化フラグ |
165 | 165 | int width; //!< 幅 |
166 | 166 | int height; //!< 高さ |
167 | 167 | unsigned char *data; //!< 実データ |
168 | -}; | |
168 | +} TEXTUREDATA; | |
169 | 169 | |
170 | 170 | #endif //GRAPHIC_ENGINE |
171 | 171 |
@@ -202,7 +202,7 @@ | ||
202 | 202 | D3DXMATRIX VSViewProjMatrix; //!< 頂点シェーダーに与えた変換行列 |
203 | 203 | #endif |
204 | 204 | |
205 | - class BlockDataInterface* blockdata; //!< 読み込んだブロックデータを格納するクラスへのポインタ | |
205 | + class BlockDataInterface* BlockDataIF; //!< 読み込んだブロックデータを格納するクラスへのポインタ | |
206 | 206 | int bs; //!< ブロック数 |
207 | 207 | int mapTextureID[TOTAL_BLOCKTEXTURE]; //!< テクスチャ番号 |
208 | 208 | #ifdef BLOCKDATA_GPUMEMORY |
@@ -258,7 +258,7 @@ | ||
258 | 258 | float camera_ry; //!< カメラ回転角度 |
259 | 259 | float viewangle; //!< カメラの視野角 |
260 | 260 | |
261 | - class BlockDataInterface* blockdata; //!< 読み込んだブロックデータを格納するクラスへのポインタ | |
261 | + class BlockDataInterface* BlockDataIF; //!< 読み込んだブロックデータを格納するクラスへのポインタ | |
262 | 262 | int bs; //!< ブロック数 |
263 | 263 | int mapTextureID[TOTAL_BLOCKTEXTURE]; //!< テクスチャ番号 |
264 | 264 |
@@ -325,7 +325,7 @@ | ||
325 | 325 | void GetWorldTransformPos(float *x, float *y, float *z); |
326 | 326 | void SetFog(bool enablefog, int skynumber); |
327 | 327 | void SetCamera(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, float viewangle); |
328 | - void LoadMapdata(class BlockDataInterface* in_blockdata, const char *directory); | |
328 | + void LoadMapdata(class BlockDataInterface* in_BlockDataIF, const char *directory); | |
329 | 329 | void RenderMapdata(bool wireframe); |
330 | 330 | int GetMapTextureID(int id); |
331 | 331 | void CleanupMapdata(); |
@@ -57,7 +57,7 @@ | ||
57 | 57 | #include <ctype.h> |
58 | 58 | |
59 | 59 | //! ブロックデータ用構造体 (blockdata構造体で使用) |
60 | -struct b_material | |
60 | +typedef struct | |
61 | 61 | { |
62 | 62 | int textureID; //!< textureID |
63 | 63 | float u[4]; //!< textureUV-U |
@@ -69,9 +69,9 @@ | ||
69 | 69 | float vy; //!< normal vector |
70 | 70 | float vz; //!< normal vector |
71 | 71 | float shadow; //!< shadow |
72 | -}; | |
72 | +} b_material; | |
73 | 73 | //! ブロックデータ用構造体 |
74 | -struct blockdata | |
74 | +typedef struct | |
75 | 75 | { |
76 | 76 | int id; //!< DataID |
77 | 77 | float x[8]; //!< Position |
@@ -78,10 +78,10 @@ | ||
78 | 78 | float y[8]; //!< Position |
79 | 79 | float z[8]; //!< Position |
80 | 80 | b_material material[6]; //!< Material data |
81 | -}; | |
81 | +} blockdata; | |
82 | 82 | |
83 | 83 | //! ポイントデータ用構造体 |
84 | -struct pointdata | |
84 | +typedef struct | |
85 | 85 | { |
86 | 86 | int id; //!< DataID |
87 | 87 | float x; //!< Position |
@@ -92,10 +92,10 @@ | ||
92 | 92 | signed char p2; //!< Param |
93 | 93 | signed char p3; //!< Param |
94 | 94 | signed char p4; //!< Param |
95 | -}; | |
95 | +} pointdata; | |
96 | 96 | |
97 | 97 | //! 追加小物用の構造体 |
98 | -struct addsmallobject | |
98 | +typedef struct | |
99 | 99 | { |
100 | 100 | char modelpath[_MAX_PATH]; //!< モデルデータパス |
101 | 101 | char texturepath[_MAX_PATH]; //!< テクスチャパス |
@@ -103,7 +103,7 @@ | ||
103 | 103 | int hp; //!< 耐久力 |
104 | 104 | char soundpath[_MAX_PATH]; //!< サウンドデータパス |
105 | 105 | int jump; //!< 飛び具合 |
106 | -}; | |
106 | +} addsmallobject; | |
107 | 107 | |
108 | 108 | //! @brief データを管理するクラス(基底クラス) |
109 | 109 | //! @details ゲームのデータを、ファイルから読み込み処理するクラス群の基底クラスです。 |
@@ -41,13 +41,13 @@ | ||
41 | 41 | #include "main.h" |
42 | 42 | |
43 | 43 | //! イベントパラメーター用の構造体 |
44 | -struct EventParameter | |
44 | +typedef struct | |
45 | 45 | { |
46 | 46 | int endcnt; //!< 終了カウント |
47 | 47 | bool complete; //!< ミッション成功フラグ |
48 | 48 | int MessageID; //!< イベントメッセージ番号 |
49 | 49 | bool SetMessageID; //!< イベントメッセージフラグ |
50 | -}; | |
50 | +} EventParameter; | |
51 | 51 | |
52 | 52 | //! @brief イベントを処理するクラス |
53 | 53 | //! @details ミッションのイベントポイントを処理します。 |
@@ -101,7 +101,7 @@ | ||
101 | 101 | void CleanupGame(); |
102 | 102 | |
103 | 103 | //! ゲームの状態を受け渡しする構造体 |
104 | -struct GameInfo | |
104 | +typedef struct | |
105 | 105 | { |
106 | 106 | int selectmission_id; //!< 選択されたミッション |
107 | 107 | char mifpath[MAX_PATH]; //!< MIFファイルのパス |
@@ -111,11 +111,11 @@ | ||
111 | 111 | float ontarget; //!< 命中数 |
112 | 112 | int kill; //!< 倒した敵の数 |
113 | 113 | int headshot; //!< 敵の頭部に命中した数 |
114 | -}; | |
114 | +} GameInfo; | |
115 | 115 | |
116 | 116 | #ifdef ENABLE_MENUOPTIONS |
117 | 117 | //! メニューリンクテキスト構造体 |
118 | -struct MenuLinkTextData | |
118 | +typedef struct | |
119 | 119 | { |
120 | 120 | bool enable; //!< リンクテキストとしての有効化フラグ |
121 | 121 | int pos_x; //!< X座標 |
@@ -125,16 +125,16 @@ | ||
125 | 125 | int text_defaultcolor; //!< 標準の文字色 |
126 | 126 | int text_cursorcolor; //!< 選択時の文字色 |
127 | 127 | char text[32]; //!< テキスト |
128 | -}; | |
128 | +} MenuLinkTextData; | |
129 | 129 | #endif //ENABLE_MENUOPTIONS |
130 | 130 | |
131 | 131 | #ifdef ENABLE_DEBUGCONSOLE |
132 | 132 | //! コンソールを管理する構造体 |
133 | -struct ConsoleData | |
133 | +typedef struct | |
134 | 134 | { |
135 | 135 | int color; //!< 色 |
136 | 136 | char textdata[MAX_CONSOLELEN+1]; //!< 文字列 |
137 | -}; | |
137 | +} ConsoleData; | |
138 | 138 | #endif |
139 | 139 | |
140 | 140 | //! @brief オープニング画面管理クラス |
@@ -1567,7 +1567,7 @@ | ||
1567 | 1567 | (CollD->CheckALLBlockInside(pos_x + dist_x*2.0f, pos_y + HUMAN_MAPCOLLISION_CLIMBHEIGHT, pos_z + dist_z*2.0f) == false) |
1568 | 1568 | ){ |
1569 | 1569 | int id, face; |
1570 | - struct blockdata bdata; | |
1570 | + blockdata bdata; | |
1571 | 1571 | bool flag = false; |
1572 | 1572 | |
1573 | 1573 | //足元の面の角度を取得 |
@@ -1685,7 +1685,7 @@ | ||
1685 | 1685 | //地面に接地している場合の処理 |
1686 | 1686 | if( FallFlag == true ){ |
1687 | 1687 | int id, face; |
1688 | - struct blockdata bdata; | |
1688 | + blockdata bdata; | |
1689 | 1689 | bool flag = true; |
1690 | 1690 | |
1691 | 1691 | if( move_y < HUMAN_MAPCOLLISION_GROUND_HEIGHT ){ move_y_landing = true; } |
@@ -1819,7 +1819,7 @@ | ||
1819 | 1819 | else{ face_angle_per = 0.0f; } |
1820 | 1820 | |
1821 | 1821 | //ブロック面の法線ベクトル取得 |
1822 | - struct blockdata bdata; | |
1822 | + blockdata bdata; | |
1823 | 1823 | inblockdata->Getdata(&bdata, id); |
1824 | 1824 | face_vx = bdata.material[face].vx; |
1825 | 1825 | face_vy = bdata.material[face].vy; |
@@ -2703,7 +2703,7 @@ | ||
2703 | 2703 | |
2704 | 2704 | //足元にあるブロックのテクスチャー番号を取得する |
2705 | 2705 | if( block_id != -1 ){ |
2706 | - struct blockdata bdata; | |
2706 | + blockdata bdata; | |
2707 | 2707 | BlockData->Getdata(&bdata, block_id); |
2708 | 2708 | block_textureid = bdata.material[block_face].textureID; |
2709 | 2709 | } |
@@ -69,11 +69,11 @@ | ||
69 | 69 | #include "main.h" |
70 | 70 | |
71 | 71 | //! エフェクト描画計算用構造体 |
72 | -struct effectdata | |
72 | +typedef struct | |
73 | 73 | { |
74 | 74 | int id; //!< データ番号 |
75 | 75 | float dist; //!< 距離 |
76 | -}; | |
76 | +} effectdata; | |
77 | 77 | |
78 | 78 | //! @brief オブジェクト管理クラス |
79 | 79 | //! @details 各オブジェクトの初期化・計算・描画などを行い管理します。 |
@@ -57,7 +57,7 @@ | ||
57 | 57 | #include "main.h" |
58 | 58 | |
59 | 59 | //! 人設定用の構造体 |
60 | -struct HumanParameter | |
60 | +typedef struct | |
61 | 61 | { |
62 | 62 | int texture; //!< テクスチャ番号 |
63 | 63 | int model; //!< モデル番号 |
@@ -65,10 +65,10 @@ | ||
65 | 65 | int AIlevel; //!< AIレベル |
66 | 66 | int Weapon[TOTAL_HAVEWEAPON]; //!< 武器 |
67 | 67 | int type; //!< 種類 |
68 | -}; | |
68 | +} HumanParameter; | |
69 | 69 | |
70 | 70 | //! 武器設定用の構造体 |
71 | -struct WeaponParameter | |
71 | +typedef struct | |
72 | 72 | { |
73 | 73 | const char *name; //!< 武器名 |
74 | 74 | const char *model; //!< モデルファイル名 |
@@ -103,10 +103,10 @@ | ||
103 | 103 | int ChangeWeaponID; //!< 切り替える武器対象 |
104 | 104 | int ChangeWeaponCnt; //!< 武器切り替え時間 |
105 | 105 | int pellet; //!< 発射弾数(ペレット数) |
106 | -}; | |
106 | +} WeaponParameter; | |
107 | 107 | |
108 | 108 | //! 小物設定用の構造体 |
109 | -struct SmallObjectParameter | |
109 | +typedef struct | |
110 | 110 | { |
111 | 111 | const char *model; //!< モデル名 |
112 | 112 | const char *texture; //!< テクスチャ名 |
@@ -114,18 +114,18 @@ | ||
114 | 114 | int hp; //!< 耐久力 |
115 | 115 | int sound; //!< 命中時の効果音番号 |
116 | 116 | int jump; //!< 飛び具合 |
117 | -}; | |
117 | +} SmallObjectParameter; | |
118 | 118 | |
119 | 119 | //! 銃弾オブジェクト用の構造体 |
120 | -struct BulletParameter | |
120 | +typedef struct | |
121 | 121 | { |
122 | 122 | const char *model; //!< モデル名 |
123 | 123 | const char *texture; //!< テクスチャ名 |
124 | 124 | float size; //!< 描画倍率 |
125 | -}; | |
125 | +} BulletParameter; | |
126 | 126 | |
127 | 127 | //! 標準ミッション設定用の構造体 |
128 | -struct OfficialMissionParameter | |
128 | +typedef struct | |
129 | 129 | { |
130 | 130 | const char *name; //!< ミッション識別名 |
131 | 131 | const char *fullname; //!< ミッション正式名称 |
@@ -133,16 +133,16 @@ | ||
133 | 133 | const char *txt; //!< ファイル名(.pd1/.txt) |
134 | 134 | bool collision; //!< 追加の当たり判定を示すフラグ |
135 | 135 | bool screen; //!< 画面を暗くするフラグ |
136 | -}; | |
136 | +} OfficialMissionParameter; | |
137 | 137 | |
138 | 138 | //! AIレベルによる設定(性能値)用構造体 |
139 | -struct AIParameter | |
139 | +typedef struct | |
140 | 140 | { |
141 | 141 | int aiming; //!< エイミング能力 |
142 | 142 | int attack; //!< 攻撃性 |
143 | 143 | int search; //!< 発見能力 |
144 | 144 | int limitserror; //!< 許容誤差 |
145 | -}; | |
145 | +} AIParameter; | |
146 | 146 | |
147 | 147 | //! @brief 設定された値を管理するクラス |
148 | 148 | //! @details 予め固定された設定値を管理します。 |
@@ -70,7 +70,7 @@ | ||
70 | 70 | }; |
71 | 71 | |
72 | 72 | //! サウンドリスト用構造体 |
73 | -struct soundlist | |
73 | +typedef struct | |
74 | 74 | { |
75 | 75 | int paramid; //!< 音源の種類番号・SoundmgrID定数 |
76 | 76 | int dataid; //!< データ番号 |
@@ -82,7 +82,7 @@ | ||
82 | 82 | float move_z; //!< 1フレーム後の Z座標移動量 |
83 | 83 | int teamid; //!< チーム番号 |
84 | 84 | int cnt; //!< カウント値 |
85 | -}; | |
85 | +} soundlist; | |
86 | 86 | |
87 | 87 | //! @brief サウンド管理クラス |
88 | 88 | //! @details 各サウンドの初期化・計算・再生などを行い管理します。 |