X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
修訂 | 89 (tree) |
---|---|
時間 | 2015-06-06 16:09:29 |
作者 | xops-mikan |
コンソールのコマンドを1個追加(ff)、メニュー画面では銃弾と手榴弾を処理しないように。
@@ -82,6 +82,8 @@ | ||
82 | 82 | int *Human_headshot; //!< 敵の頭部に命中した数 |
83 | 83 | bool *Human_ShotFlag; //!< 発砲フラグ(マズルフラッシュ用) |
84 | 84 | |
85 | + bool FriendlyFire; //!< FF(同士討ち)有効化 | |
86 | + | |
85 | 87 | int Player_HumanID; //!< プレイヤーが操作する人オブジェクトのID |
86 | 88 | |
87 | 89 | int AddHumanIndex_TextureID; //!< 前回読み込んだテクスチャID |
@@ -122,6 +124,8 @@ | ||
122 | 124 | 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); |
123 | 125 | int AddMapEffect(int id, int face, float pos_x, float pos_y, float pos_z, float size, float rotation, int count, int texture); |
124 | 126 | void LoadPointData(); |
127 | + bool GetFriendlyFireFlag(); | |
128 | + void SetFriendlyFireFlag(bool flag); | |
125 | 129 | int GetPlayerID(); |
126 | 130 | void SetPlayerID(int id); |
127 | 131 | human* GeHumanObject(int id); |
@@ -152,7 +156,7 @@ | ||
152 | 156 | bool HumanResuscitation(int id); |
153 | 157 | int CheckGameOverorComplete(); |
154 | 158 | bool GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr); |
155 | - int Process(int cmdF5id, float camera_rx, float camera_ry); | |
159 | + int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry); | |
156 | 160 | bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot); |
157 | 161 | void Render(float camera_x, float camera_y, float camera_z, int HidePlayer); |
158 | 162 | void Cleanup(); |
@@ -219,7 +219,7 @@ | ||
219 | 219 | void opening::Process() |
220 | 220 | { |
221 | 221 | //オブジェクトマネージャーを実行 |
222 | - ObjMgr.Process(-1, camera_rx, camera_ry); | |
222 | + ObjMgr.Process(-1, false, camera_rx, camera_ry); | |
223 | 223 | |
224 | 224 | //AIを実行 |
225 | 225 | for(int i=0; i<MAX_HUMAN; i++){ |
@@ -590,7 +590,7 @@ | ||
590 | 590 | void mainmenu::Process() |
591 | 591 | { |
592 | 592 | //オブジェクトマネージャーを実行 |
593 | - ObjMgr.Process(-1, camera_rx, camera_ry); | |
593 | + ObjMgr.Process(-1, true, camera_rx, camera_ry); | |
594 | 594 | |
595 | 595 | //AIを実行 |
596 | 596 | for(int i=0; i<MAX_HUMAN; i++){ |
@@ -1591,10 +1591,10 @@ | ||
1591 | 1591 | |
1592 | 1592 | //オブジェクトマネージャーを実行 |
1593 | 1593 | if( Cmd_F5 == true ){ |
1594 | - ObjMgr.Process( ObjMgr.GetPlayerID() , camera_rx, camera_ry); | |
1594 | + ObjMgr.Process( ObjMgr.GetPlayerID() , false, camera_rx, camera_ry); | |
1595 | 1595 | } |
1596 | 1596 | else{ |
1597 | - ObjMgr.Process(-1, camera_rx, camera_ry); | |
1597 | + ObjMgr.Process(-1, false, camera_rx, camera_ry); | |
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | //プレイヤーの戦歴を加算 |
@@ -2528,7 +2528,7 @@ | ||
2528 | 2528 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "info view center map"); |
2529 | 2529 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "tag radar inmap"); |
2530 | 2530 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "revive treat <NUM> nodamage <NUM>"); |
2531 | - AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "kill <NUM> break <NUM> newobj <NUM>"); | |
2531 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "kill <NUM> break <NUM> newobj <NUM> ff"); | |
2532 | 2532 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "bot nofight caution stop"); |
2533 | 2533 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "estop ss clear"); |
2534 | 2534 | } |
@@ -2785,6 +2785,18 @@ | ||
2785 | 2785 | } |
2786 | 2786 | } |
2787 | 2787 | |
2788 | + //FF(同士討ち)有効化 | |
2789 | + if( strcmp(NewCommand, "ff") == 0 ){ | |
2790 | + if( ObjMgr.GetFriendlyFireFlag() == false ){ | |
2791 | + ObjMgr.SetFriendlyFireFlag(true); | |
2792 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Enable Friendly Fire."); | |
2793 | + } | |
2794 | + else{ | |
2795 | + ObjMgr.SetFriendlyFireFlag(false); | |
2796 | + AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), "Disable Friendly Fire."); | |
2797 | + } | |
2798 | + } | |
2799 | + | |
2788 | 2800 | //プレイヤー操作をAI化 |
2789 | 2801 | if( strcmp(NewCommand, "bot") == 0 ){ |
2790 | 2802 | if( PlayerAI == false ){ |
@@ -46,6 +46,7 @@ | ||
46 | 46 | Human_kill = new int[MAX_HUMAN]; |
47 | 47 | Human_headshot = new int[MAX_HUMAN]; |
48 | 48 | Human_ShotFlag = new bool[MAX_HUMAN]; |
49 | + FriendlyFire = false; | |
49 | 50 | Player_HumanID = 0; |
50 | 51 | AddHumanIndex_TextureID = -1; |
51 | 52 |
@@ -657,6 +658,9 @@ | ||
657 | 658 | |
658 | 659 | //人との当たり判定 |
659 | 660 | for(int i=0; i<MAX_HUMAN; i++){ |
661 | + //その人自身が発砲した弾なら処理しない。 | |
662 | + if( i == humanid ){ continue; } | |
663 | + | |
660 | 664 | //使用されていないか、死亡していれば処理しない。 |
661 | 665 | if( HumanIndex[i].GetEnableFlag() == false ){ continue; } |
662 | 666 | if( HumanIndex[i].GetHP() <= 0 ){ continue; } |
@@ -667,8 +671,10 @@ | ||
667 | 671 | HumanIndex[i].GetPosData(&ox, &oy, &oz, NULL); |
668 | 672 | HumanIndex[i].GetParamData(NULL, NULL, NULL, &h_teamid); |
669 | 673 | |
670 | - //同じチーム番号(味方)なら処理しない | |
671 | - if( h_teamid == teamid ){ continue; } | |
674 | + if( FriendlyFire == false ){ | |
675 | + //同じチーム番号(味方)なら処理しない | |
676 | + if( h_teamid == teamid ){ continue; } | |
677 | + } | |
672 | 678 | |
673 | 679 | //頭の当たり判定 |
674 | 680 | if( CollideCylinderRay(ox, oy + HUMAN_BULLETCOLLISION_LEG_H + HUMAN_BULLETCOLLISION_UP_H, oz, HUMAN_BULLETCOLLISION_HEAD_R, HUMAN_BULLETCOLLISION_HEAD_H, bvx, bvy, bvz, vx, vy, vz, &Dist, (float)speed - TotalDist) == true ){ |
@@ -1204,6 +1210,7 @@ | ||
1204 | 1210 | //! @brief ポイントデータを元にオブジェクトを配置 |
1205 | 1211 | void ObjectManager::LoadPointData() |
1206 | 1212 | { |
1213 | + FriendlyFire = false; | |
1207 | 1214 | Player_HumanID = 0; |
1208 | 1215 | |
1209 | 1216 | /* |
@@ -1278,6 +1285,20 @@ | ||
1278 | 1285 | } |
1279 | 1286 | } |
1280 | 1287 | |
1288 | +//! @brief FF(同士討ち)有効化フラグを取得 | |
1289 | +//! @return フラグ | |
1290 | +bool ObjectManager::GetFriendlyFireFlag() | |
1291 | +{ | |
1292 | + return FriendlyFire; | |
1293 | +} | |
1294 | + | |
1295 | +//! @brief FF(同士討ち)有効化フラグを設定 | |
1296 | +//! @param flag フラグ | |
1297 | +void ObjectManager::SetFriendlyFireFlag(bool flag) | |
1298 | +{ | |
1299 | + FriendlyFire = flag; | |
1300 | +} | |
1301 | + | |
1281 | 1302 | //! @brief プレイヤー番号を取得 |
1282 | 1303 | //! @return プレイヤーのデータ番号 |
1283 | 1304 | int ObjectManager::GetPlayerID() |
@@ -2092,11 +2113,13 @@ | ||
2092 | 2113 | |
2093 | 2114 | //! @brief オブジェクトの主計算処理 |
2094 | 2115 | //! @param cmdF5id 上昇機能(F5裏技)させる人データ番号(-1で機能無効) |
2116 | +//! @param demomode デモモード | |
2095 | 2117 | //! @param camera_rx カメラの横軸角度 |
2096 | 2118 | //! @param camera_ry カメラの縦軸角度 |
2097 | 2119 | //! @return 常に 0 |
2098 | 2120 | //! @attention 一般的に cmdF5id は、F5裏技使用中はプレイヤー番号(GetPlayerID()関数で取得)、未使用時は -1 を指定します。 |
2099 | -int ObjectManager::Process(int cmdF5id, float camera_rx, float camera_ry) | |
2121 | +//! @attention demomode は主にメニュー画面で使用します。有効にすると、銃弾・手榴弾を処理しません。 | |
2122 | +int ObjectManager::Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry) | |
2100 | 2123 | { |
2101 | 2124 | //このフレームの戦歴を初期化 |
2102 | 2125 | for(int i=0; i<MAX_HUMAN; i++){ |
@@ -2132,25 +2155,35 @@ | ||
2132 | 2155 | SmallObjectIndex[i].RunFrame(); |
2133 | 2156 | } |
2134 | 2157 | |
2135 | - //弾オブジェクトの処理 | |
2136 | - for(int i=0; i<MAX_BULLET; i++){ | |
2137 | - float bx, by, bz, brx, bry; | |
2138 | - int speed; | |
2139 | - float mx, my, mz; | |
2158 | + if( demomode == false ){ | |
2159 | + //弾オブジェクトの処理 | |
2160 | + for(int i=0; i<MAX_BULLET; i++){ | |
2161 | + float bx, by, bz, brx, bry; | |
2162 | + int speed; | |
2163 | + float mx, my, mz; | |
2140 | 2164 | |
2141 | - CollideBullet(&BulletIndex[i]); //当たり判定を実行 | |
2142 | - BulletIndex[i].RunFrame(); //主計算 | |
2165 | + CollideBullet(&BulletIndex[i]); //当たり判定を実行 | |
2166 | + BulletIndex[i].RunFrame(); //主計算 | |
2143 | 2167 | |
2144 | - if( BulletIndex[i].GetEnableFlag() == true ){ | |
2145 | - //弾の座標と角度を取得 | |
2146 | - BulletIndex[i].GetParamData(NULL, NULL, &speed, NULL, NULL); | |
2147 | - BulletIndex[i].GetPosData(&bx, &by, &bz, &brx, &bry); | |
2148 | - mx = cos(brx)*cos(bry)*speed; | |
2149 | - my = sin(bry)*speed; | |
2150 | - mz = sin(brx)*cos(bry)*speed; | |
2151 | - GameSound->PassingBullet(bx, by, bz, mx, my, mz); | |
2168 | + if( BulletIndex[i].GetEnableFlag() == true ){ | |
2169 | + //弾の座標と角度を取得 | |
2170 | + BulletIndex[i].GetParamData(NULL, NULL, &speed, NULL, NULL); | |
2171 | + BulletIndex[i].GetPosData(&bx, &by, &bz, &brx, &bry); | |
2172 | + mx = cos(brx)*cos(bry)*speed; | |
2173 | + my = sin(bry)*speed; | |
2174 | + mz = sin(brx)*cos(bry)*speed; | |
2175 | + GameSound->PassingBullet(bx, by, bz, mx, my, mz); | |
2176 | + } | |
2152 | 2177 | } |
2153 | 2178 | } |
2179 | + else{ | |
2180 | + //全ての弾オブジェクトを消す | |
2181 | + for(int i=0; i<MAX_BULLET; i++){ | |
2182 | + if( BulletIndex[i].GetEnableFlag() == true ){ | |
2183 | + BulletIndex[i].SetEnableFlag(false); | |
2184 | + } | |
2185 | + } | |
2186 | + } | |
2154 | 2187 | |
2155 | 2188 | //武器を発砲した際のエフェクトを出す |
2156 | 2189 | for(int i=0; i<MAX_HUMAN; i++){ |
@@ -2173,28 +2206,38 @@ | ||
2173 | 2206 | } |
2174 | 2207 | } |
2175 | 2208 | |
2176 | - //手榴弾の処理 | |
2177 | - for(int i=0; i<MAX_GRENADE; i++){ | |
2178 | - float speed = GrenadeIndex[i].GetSpeed(); | |
2209 | + if( demomode == false ){ | |
2210 | + //手榴弾の処理 | |
2211 | + for(int i=0; i<MAX_GRENADE; i++){ | |
2212 | + float speed = GrenadeIndex[i].GetSpeed(); | |
2179 | 2213 | |
2180 | - //主計算 | |
2181 | - int rcr = GrenadeIndex[i].RunFrame(CollD); | |
2214 | + //主計算 | |
2215 | + int rcr = GrenadeIndex[i].RunFrame(CollD); | |
2182 | 2216 | |
2183 | - //バウンド・跳ね返ったならば | |
2184 | - if( rcr == 1 ){ | |
2185 | - if( speed > 3.4f ){ | |
2186 | - //座標を取得し、効果音再生 | |
2187 | - float x, y, z; | |
2188 | - GrenadeIndex[i].GetPosData(&x, &y, &z, NULL, NULL); | |
2189 | - GameSound->GrenadeBound(x, y, z); | |
2217 | + //バウンド・跳ね返ったならば | |
2218 | + if( rcr == 1 ){ | |
2219 | + if( speed > 3.4f ){ | |
2220 | + //座標を取得し、効果音再生 | |
2221 | + float x, y, z; | |
2222 | + GrenadeIndex[i].GetPosData(&x, &y, &z, NULL, NULL); | |
2223 | + GameSound->GrenadeBound(x, y, z); | |
2224 | + } | |
2190 | 2225 | } |
2191 | - } | |
2192 | 2226 | |
2193 | - //爆発したなら | |
2194 | - if( rcr == 2 ){ | |
2195 | - GrenadeExplosion(&(GrenadeIndex[i])); | |
2227 | + //爆発したなら | |
2228 | + if( rcr == 2 ){ | |
2229 | + GrenadeExplosion(&(GrenadeIndex[i])); | |
2230 | + } | |
2196 | 2231 | } |
2197 | 2232 | } |
2233 | + else{ | |
2234 | + //全ての手榴弾を消す | |
2235 | + for(int i=0; i<MAX_GRENADE; i++){ | |
2236 | + if( GrenadeIndex[i].GetEnableFlag() == true ){ | |
2237 | + GrenadeIndex[i].SetEnableFlag(false); | |
2238 | + } | |
2239 | + } | |
2240 | + } | |
2198 | 2241 | |
2199 | 2242 | |
2200 | 2243 | //武器を拾う処理 |