X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 167 (tree) |
|---|---|
| Time | 2017-03-20 18:29:49 |
| Author | |
ObjectManagerのログ表示機能追加(infoコマンドで有効)、ENABLE_DEBUGCONSOLE定数未定義でコンパイルエラーとなる問題の修正
| @@ -2150,6 +2150,7 @@ | ||
| 2150 | 2150 | } |
| 2151 | 2151 | } |
| 2152 | 2152 | |
| 2153 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 2153 | 2154 | //デバック用・ゲーム情報の表示 |
| 2154 | 2155 | if( (ShowInfo_Debugmode == true)||(Camera_Debugmode == true) ){ |
| 2155 | 2156 | float move_x, move_y, move_z; |
| @@ -2172,6 +2173,7 @@ | ||
| 2172 | 2173 | d3dg->Draw2DTextureDebugFontText(10+1, 90+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); |
| 2173 | 2174 | d3dg->Draw2DTextureDebugFontText(10, 90, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f)); |
| 2174 | 2175 | } |
| 2176 | +#endif | |
| 2175 | 2177 | |
| 2176 | 2178 | //ゲーム実行速度の表示 |
| 2177 | 2179 | //int speed = (int)(fps / (1000.0f/GAMEFRAMEMS) * 100); |
| @@ -2289,6 +2291,13 @@ | ||
| 2289 | 2291 | d3dg->Draw2DMSFontTextCenter(0, SCREEN_HEIGHT - 140, SCREEN_WIDTH, 140, messtr, d3dg->GetColorCode(1.0f,1.0f,1.0f,effectA)); |
| 2290 | 2292 | } |
| 2291 | 2293 | |
| 2294 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 2295 | + //デバック用・ゲーム情報の表示 | |
| 2296 | + if( ShowInfo_Debugmode == true ){ | |
| 2297 | + ObjMgr.RenderLog(HUDA_WEAPON_POSX, HUDA_WEAPON_POSY-60); | |
| 2298 | + } | |
| 2299 | +#endif | |
| 2300 | + | |
| 2292 | 2301 | //リロード表示 |
| 2293 | 2302 | if( reloadcnt > 0 ){ |
| 2294 | 2303 | d3dg->Draw2DTextureFontText(SCREEN_WIDTH/2 - 145 +3, SCREEN_HEIGHT - 180+3, "RELOADING", d3dg->GetColorCode(0.2f,0.2f,0.2f,1.0f), 32, 34); |
| @@ -2341,6 +2350,7 @@ | ||
| 2341 | 2350 | } |
| 2342 | 2351 | } |
| 2343 | 2352 | |
| 2353 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 2344 | 2354 | //AIデバック情報表示 |
| 2345 | 2355 | if( AIdebuginfoID != -1 ){ |
| 2346 | 2356 | if( (0 <= AIdebuginfoID)&&(AIdebuginfoID < MAX_HUMAN) ){ |
| @@ -2375,6 +2385,7 @@ | ||
| 2375 | 2385 | d3dg->Draw2DTextureDebugFontText(20, 210, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); |
| 2376 | 2386 | } |
| 2377 | 2387 | } |
| 2388 | +#endif | |
| 2378 | 2389 | |
| 2379 | 2390 | |
| 2380 | 2391 | //----------------------------------- |
| @@ -2511,7 +2522,7 @@ | ||
| 2511 | 2522 | { |
| 2512 | 2523 | int RadarSize = 200; //レーダーの描画サイズ |
| 2513 | 2524 | int RadarPosX = SCREEN_WIDTH - RadarSize - 10; //レーダーの描画 X座標(左上基準) |
| 2514 | - int RadarPosY = 130; //レーダーの描画 Y座標(左上基準) | |
| 2525 | + int RadarPosY = 110; //レーダーの描画 Y座標(左上基準) | |
| 2515 | 2526 | float RadarWorldR = 300.0f; //レーダーにポイントする距離 |
| 2516 | 2527 | |
| 2517 | 2528 | float ecr = DISTANCE_CHECKPOINT / RadarWorldR * (RadarSize/2); |
| @@ -1537,7 +1537,7 @@ | ||
| 1537 | 1537 | //! @param AddCollisionFlag 追加の当たり判定フラグ |
| 1538 | 1538 | //! @param player 対象の人物がプレイヤーかどうか |
| 1539 | 1539 | //! @param F5mode 上昇機能(F5裏技)のフラグ (有効:true 無効:false) |
| 1540 | -//! @return 処理なし:0 通常処理:1 死亡して倒れ終わった直後:2 静止した死体:3 | |
| 1540 | +//! @return 処理なし:0 通常処理:1 死亡して倒れ終わった直後:2 静止した死体:3 地形により死亡した直後:4 | |
| 1541 | 1541 | int human::RunFrame(class Collision *CollD, class BlockDataInterface *inblockdata, bool AddCollisionFlag, bool player, bool F5mode) |
| 1542 | 1542 | { |
| 1543 | 1543 | if( CollD == NULL ){ return 0; } |
| @@ -1557,6 +1557,7 @@ | ||
| 1557 | 1557 | float FallDistance; |
| 1558 | 1558 | float nowmove_x, nowmove_z; |
| 1559 | 1559 | int CheckDead; |
| 1560 | + int hp_old; | |
| 1560 | 1561 | |
| 1561 | 1562 | //武器切り替えカウント |
| 1562 | 1563 | if( selectweaponcnt > 0 ){ |
| @@ -1583,6 +1584,7 @@ | ||
| 1583 | 1584 | ControlProcess(); |
| 1584 | 1585 | |
| 1585 | 1586 | //マップとの当たり判定 |
| 1587 | + hp_old = hp; | |
| 1586 | 1588 | MapCollisionDetection(CollD, inblockdata, AddCollisionFlag, &FallDistance, &nowmove_x, &nowmove_z); |
| 1587 | 1589 | |
| 1588 | 1590 | //移動するなら |
| @@ -1612,7 +1614,13 @@ | ||
| 1612 | 1614 | if( pos_y < HUMAN_DEADLINE ){ |
| 1613 | 1615 | pos_y = HUMAN_DEADLINE; |
| 1614 | 1616 | hp = 0; |
| 1617 | + return 4; | |
| 1615 | 1618 | } |
| 1619 | + | |
| 1620 | + //今回のマップとの当たり判定でHPがゼロになったなら、地形による死亡 | |
| 1621 | + if( (hp_old >0)&&(hp <= 0) ){ | |
| 1622 | + return 4; | |
| 1623 | + } | |
| 1616 | 1624 | } |
| 1617 | 1625 | |
| 1618 | 1626 |
| @@ -58,6 +58,10 @@ | ||
| 58 | 58 | BlockData = NULL; |
| 59 | 59 | PointData = NULL; |
| 60 | 60 | CollD = NULL; |
| 61 | + GameSound = NULL; | |
| 62 | + MIFdata = NULL; | |
| 63 | + | |
| 64 | + ObjectLog = new ObjectManagerLog; | |
| 61 | 65 | } |
| 62 | 66 | |
| 63 | 67 | //! @brief ディストラクタ |
| @@ -78,6 +82,8 @@ | ||
| 78 | 82 | if( Human_ShotFlag != NULL ){ delete [] Human_ShotFlag; } |
| 79 | 83 | if( BulletObj_HumanIndex != NULL ){ delete [] BulletObj_HumanIndex; } |
| 80 | 84 | if( Human_FrameTextureRefresh != NULL ){ delete [] Human_FrameTextureRefresh; } |
| 85 | + | |
| 86 | + if( ObjectLog != NULL ){ delete ObjectLog; } | |
| 81 | 87 | } |
| 82 | 88 | |
| 83 | 89 | //! @brief 参照するクラスを設定 |
| @@ -135,6 +141,8 @@ | ||
| 135 | 141 | } |
| 136 | 142 | } |
| 137 | 143 | } |
| 144 | + | |
| 145 | + ObjectLog->SetClass(d3dg); | |
| 138 | 146 | } |
| 139 | 147 | |
| 140 | 148 | //! @brief 人追加 |
| @@ -325,6 +333,11 @@ | ||
| 325 | 333 | HumanIndex[Humanindexid].SetWeapon(Weapon); |
| 326 | 334 | } |
| 327 | 335 | |
| 336 | + //ログ関係の処理 | |
| 337 | + int player_teamid; | |
| 338 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 339 | + ObjectLog->AddHuman(Humanindexid, TeamID, player_teamid); | |
| 340 | + | |
| 328 | 341 | return Humanindexid; |
| 329 | 342 | } |
| 330 | 343 |
| @@ -466,20 +479,24 @@ | ||
| 466 | 479 | return -1; |
| 467 | 480 | } |
| 468 | 481 | |
| 469 | - for(int j=0; j<MAX_SMALLOBJECT; j++){ | |
| 470 | - if( SmallObjectIndex[j].GetEnableFlag() == false ){ | |
| 482 | + for(int i=0; i<MAX_SMALLOBJECT; i++){ | |
| 483 | + if( SmallObjectIndex[i].GetEnableFlag() == false ){ | |
| 471 | 484 | //初期化 |
| 472 | - SmallObjectIndex[j].SetPosData(px, py, pz, rx); | |
| 473 | - SmallObjectIndex[j].SetParamData(paramID, 0, true); | |
| 474 | - SmallObjectIndex[j].SetModel(model, SMALLOBJECT_SCALE); | |
| 475 | - SmallObjectIndex[j].SetTexture(texture); | |
| 476 | - SmallObjectIndex[j].SetEnableFlag(true); | |
| 485 | + SmallObjectIndex[i].SetPosData(px, py, pz, rx); | |
| 486 | + SmallObjectIndex[i].SetParamData(paramID, 0, true); | |
| 487 | + SmallObjectIndex[i].SetModel(model, SMALLOBJECT_SCALE); | |
| 488 | + SmallObjectIndex[i].SetTexture(texture); | |
| 489 | + SmallObjectIndex[i].SetEnableFlag(true); | |
| 477 | 490 | |
| 478 | 491 | //位置修正フラグが有効ならば、マップと判定 |
| 479 | 492 | if( MapColl == true ){ |
| 480 | - SmallObjectIndex[j].CollisionMap(CollD); | |
| 493 | + SmallObjectIndex[i].CollisionMap(CollD); | |
| 481 | 494 | } |
| 482 | - return j; | |
| 495 | + | |
| 496 | + //ログ関係の処理 | |
| 497 | + ObjectLog->AddSmallObject(i); | |
| 498 | + | |
| 499 | + return i; | |
| 483 | 500 | } |
| 484 | 501 | } |
| 485 | 502 | return -1; |
| @@ -902,6 +919,7 @@ | ||
| 902 | 919 | void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id) |
| 903 | 920 | { |
| 904 | 921 | int Shothuman_TeamID; |
| 922 | + int HitHuman_TeamID; | |
| 905 | 923 | int damage = 0; |
| 906 | 924 | int paramid; |
| 907 | 925 | HumanParameter Paraminfo; |
| @@ -911,8 +929,9 @@ | ||
| 911 | 929 | if( HumanIndex[HitHuman_id].GetEnableFlag() == false ){ return; } |
| 912 | 930 | if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ return; } |
| 913 | 931 | |
| 914 | - //発射元のチーム番号取得 | |
| 932 | + //発射元と対象人物のチーム番号取得 | |
| 915 | 933 | HumanIndex[Shothuman_id].GetParamData(NULL, NULL, NULL, &Shothuman_TeamID); |
| 934 | + HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 916 | 935 | |
| 917 | 936 | //人にダメージと衝撃を与える |
| 918 | 937 | if( Hit_id == 0 ){ HumanIndex[HitHuman_id].HitBulletHead(attacks); } |
| @@ -921,9 +940,7 @@ | ||
| 921 | 940 | HumanIndex[HitHuman_id].AddPosOrder(brx, 0.0f, 1.0f); |
| 922 | 941 | |
| 923 | 942 | #ifdef ENABLE_BUG_TEAMID |
| 924 | - int HitHuman_TeamID; | |
| 925 | 943 | bool flag = true; |
| 926 | - HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 927 | 944 | |
| 928 | 945 | //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 |
| 929 | 946 | if( (HitHuman_TeamID < 0)&&(Shothuman_TeamID < 0) ){ |
| @@ -964,6 +981,16 @@ | ||
| 964 | 981 | if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ |
| 965 | 982 | Human_kill[Shothuman_id] += 1; |
| 966 | 983 | } |
| 984 | + | |
| 985 | + //ログ関係の処理 | |
| 986 | + if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ | |
| 987 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 | |
| 988 | + | |
| 989 | + int player_teamid; | |
| 990 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 991 | + | |
| 992 | + ObjectLog->DiedHuman(Shothuman_id, HitHuman_id, Shothuman_TeamID, HitHuman_TeamID, player_teamid); | |
| 993 | + } | |
| 967 | 994 | } |
| 968 | 995 | |
| 969 | 996 | //! @brief 弾が小物に当たった処理 |
| @@ -994,6 +1021,13 @@ | ||
| 994 | 1021 | int id; |
| 995 | 1022 | SmallObjectIndex[HitSmallObject_id].GetParamData(&id, NULL); |
| 996 | 1023 | GameSound->HitSmallObject(x, y, z, id, teamID); |
| 1024 | + | |
| 1025 | + //ログ関係の処理 | |
| 1026 | + hp = SmallObjectIndex[HitSmallObject_id].GetHP(); | |
| 1027 | + if( hp <= 0 ){ | |
| 1028 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回破壊された。 | |
| 1029 | + ObjectLog->BreakSmallObject(HitSmallObject_id); | |
| 1030 | + } | |
| 997 | 1031 | } |
| 998 | 1032 | |
| 999 | 1033 | //! @brief 手榴弾のダメージ判定と処理 |
| @@ -1017,6 +1051,7 @@ | ||
| 1017 | 1051 | if( HumanIndex[i].GetEnableFlag() == false ){ continue; } |
| 1018 | 1052 | if( HumanIndex[i].GetHP() <= 0 ){ continue; } |
| 1019 | 1053 | |
| 1054 | + int HitHuman_TeamID; | |
| 1020 | 1055 | float hx, hy, hz; |
| 1021 | 1056 | float x, y, z, r; |
| 1022 | 1057 |
| @@ -1062,10 +1097,10 @@ | ||
| 1062 | 1097 | //ダメージを反映 |
| 1063 | 1098 | HumanIndex[i].HitGrenadeExplosion(total_damage); |
| 1064 | 1099 | |
| 1100 | + HumanIndex[i].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 1101 | + | |
| 1065 | 1102 | #ifdef ENABLE_BUG_TEAMID |
| 1066 | - int HitHuman_TeamID; | |
| 1067 | 1103 | bool flag = true; |
| 1068 | - HumanIndex[i].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 1069 | 1104 | |
| 1070 | 1105 | //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 |
| 1071 | 1106 | if( (HitHuman_TeamID < 0)&&(teamid < 0) ){ |
| @@ -1111,6 +1146,16 @@ | ||
| 1111 | 1146 | //爆風による風圧 |
| 1112 | 1147 | HumanIndex[i].AddPosOrder(arx, ary, 2.2f/MAX_DAMAGE_GRENADE_DISTANCE * (MAX_DAMAGE_GRENADE_DISTANCE - sqrt(x*x + y*y + z*z))); |
| 1113 | 1148 | |
| 1149 | + //ログ関係の処理 | |
| 1150 | + if( HumanIndex[i].GetHP() <= 0 ){ | |
| 1151 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 | |
| 1152 | + | |
| 1153 | + int player_teamid; | |
| 1154 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 1155 | + | |
| 1156 | + ObjectLog->DiedHuman(humanid, i, teamid, HitHuman_TeamID, player_teamid); | |
| 1157 | + } | |
| 1158 | + | |
| 1114 | 1159 | returnflag = true; |
| 1115 | 1160 | } |
| 1116 | 1161 | } |
| @@ -1147,6 +1192,12 @@ | ||
| 1147 | 1192 | //小物から効果音を発する |
| 1148 | 1193 | GameSound->HitSmallObject(sx, sy, sz, id, teamid); |
| 1149 | 1194 | |
| 1195 | + //ログ関係の処理 | |
| 1196 | + if( SmallObjectIndex[i].GetHP() <= 0 ){ | |
| 1197 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回破壊された。 | |
| 1198 | + ObjectLog->BreakSmallObject(i); | |
| 1199 | + } | |
| 1200 | + | |
| 1150 | 1201 | returnflag = true; |
| 1151 | 1202 | } |
| 1152 | 1203 | } |
| @@ -1401,6 +1452,10 @@ | ||
| 1401 | 1452 | AddSmallObjectIndex(data); |
| 1402 | 1453 | } |
| 1403 | 1454 | } |
| 1455 | + | |
| 1456 | + //ログ関係の処理 | |
| 1457 | + ObjectLog->ClearLog(); | |
| 1458 | + ObjectLog->InfoLog("Set object..."); | |
| 1404 | 1459 | } |
| 1405 | 1460 | |
| 1406 | 1461 | //! @brief リソースの回復 |
| @@ -1515,6 +1570,9 @@ | ||
| 1515 | 1570 | EffectIndex[i].SetEnableFlag(false); |
| 1516 | 1571 | } |
| 1517 | 1572 | } |
| 1573 | + | |
| 1574 | + //ログ関係の処理 | |
| 1575 | + ObjectLog->InfoLog("Recovery object..."); | |
| 1518 | 1576 | } |
| 1519 | 1577 | |
| 1520 | 1578 | //! @brief 追加の当たり判定フラグを設定 |
| @@ -2194,14 +2252,16 @@ | ||
| 2194 | 2252 | if( EnemyHuman->GetEnableFlag() == false ){ return; } |
| 2195 | 2253 | if( EnemyHuman->GetHP() <= 0 ){ return; } |
| 2196 | 2254 | |
| 2197 | - int MyHuman_TeamID; | |
| 2255 | + int MyHuman_dataID, MyHuman_TeamID; | |
| 2256 | + int EnemyHuman_dataID, EnemyHuman_TeamID; | |
| 2198 | 2257 | float tx, ty, tz; |
| 2199 | 2258 | int paramid; |
| 2200 | 2259 | HumanParameter Paraminfo; |
| 2201 | 2260 | bool NotRobot; |
| 2202 | 2261 | |
| 2203 | - //ゾンビ側のチーム番号取得 | |
| 2204 | - MyHuman->GetParamData(NULL, NULL, NULL, &MyHuman_TeamID); | |
| 2262 | + //ゾンビ側と攻撃を受ける側チーム番号取得 | |
| 2263 | + MyHuman->GetParamData(NULL, &MyHuman_dataID, NULL, &MyHuman_TeamID); | |
| 2264 | + EnemyHuman->GetParamData(NULL, &EnemyHuman_dataID, NULL, &EnemyHuman_TeamID); | |
| 2205 | 2265 | |
| 2206 | 2266 | EnemyHuman->GetPosData(&tx, &ty, &tz, NULL); |
| 2207 | 2267 | ty += VIEW_HEIGHT; |
| @@ -2220,9 +2280,7 @@ | ||
| 2220 | 2280 | EnemyHuman->HitZombieAttack(); |
| 2221 | 2281 | |
| 2222 | 2282 | #ifdef ENABLE_BUG_TEAMID |
| 2223 | - int EnemyHuman_TeamID; | |
| 2224 | 2283 | bool flag = true; |
| 2225 | - EnemyHuman->GetParamData(NULL, NULL, NULL, &EnemyHuman_TeamID); | |
| 2226 | 2284 | |
| 2227 | 2285 | //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 |
| 2228 | 2286 | if( (EnemyHuman_TeamID < 0)&&(MyHuman_TeamID < 0) ){ |
| @@ -2243,6 +2301,16 @@ | ||
| 2243 | 2301 | |
| 2244 | 2302 | //効果音を再生 |
| 2245 | 2303 | GameSound->HitHuman(tx, ty, tz, MyHuman_TeamID); |
| 2304 | + | |
| 2305 | + //ログ関係の処理 | |
| 2306 | + if( EnemyHuman->GetHP() <= 0 ){ | |
| 2307 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 | |
| 2308 | + | |
| 2309 | + int player_teamid; | |
| 2310 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 2311 | + | |
| 2312 | + ObjectLog->DiedHuman(MyHuman_dataID, EnemyHuman_dataID, MyHuman_TeamID, EnemyHuman_TeamID, player_teamid); | |
| 2313 | + } | |
| 2246 | 2314 | } |
| 2247 | 2315 | |
| 2248 | 2316 | //! @brief 死者を蘇生する |
| @@ -2264,6 +2332,11 @@ | ||
| 2264 | 2332 | if( (id_param < 0)||( TOTAL_PARAMETERINFO_HUMAN-1 < id_param) ){ return false; } //謎人間なら処理しない |
| 2265 | 2333 | HumanIndex[id].SetParamData(id_param, dataid, p4, team, true); |
| 2266 | 2334 | |
| 2335 | + //ログ関係の処理 | |
| 2336 | + int player_teamid; | |
| 2337 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 2338 | + ObjectLog->ReviveHuman(id, team, player_teamid); | |
| 2339 | + | |
| 2267 | 2340 | return true; |
| 2268 | 2341 | } |
| 2269 | 2342 |
| @@ -2433,6 +2506,7 @@ | ||
| 2433 | 2506 | //人オブジェクトの処理 |
| 2434 | 2507 | for(int i=0; i<MAX_HUMAN; i++){ |
| 2435 | 2508 | bool cmdF5, player; |
| 2509 | + int rtn; | |
| 2436 | 2510 | |
| 2437 | 2511 | //プレイヤーかどうか判定 |
| 2438 | 2512 | if( Player_HumanID == i ){ |
| @@ -2449,11 +2523,20 @@ | ||
| 2449 | 2523 | cmdF5 = false; |
| 2450 | 2524 | } |
| 2451 | 2525 | |
| 2452 | - if( HumanIndex[i].RunFrame(CollD, BlockData, AddCollisionFlag, player, cmdF5) == 2 ){ | |
| 2526 | + rtn = HumanIndex[i].RunFrame(CollD, BlockData, AddCollisionFlag, player, cmdF5); | |
| 2527 | + if( rtn == 2 ){ | |
| 2453 | 2528 | //死亡時のエフェクト |
| 2454 | 2529 | DeadEffect(&(HumanIndex[i])); |
| 2455 | 2530 | } |
| 2531 | + if( rtn == 4 ){ | |
| 2532 | + int teamid, player_teamid; | |
| 2533 | + HumanIndex[i].GetParamData(NULL, NULL, NULL, &teamid); | |
| 2534 | + HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid); | |
| 2456 | 2535 | |
| 2536 | + //ログ関係の処理 | |
| 2537 | + ObjectLog->DiedHuman(-1, i, -1, teamid, player_teamid); | |
| 2538 | + } | |
| 2539 | + | |
| 2457 | 2540 | //足音 |
| 2458 | 2541 | if( HumanIndex[i].GetMovemode(false) == 2 ){ |
| 2459 | 2542 | //走る足音追加 |
| @@ -2578,6 +2661,9 @@ | ||
| 2578 | 2661 | } |
| 2579 | 2662 | } |
| 2580 | 2663 | |
| 2664 | + //ログ関係の処理 | |
| 2665 | + ObjectLog->Process(); | |
| 2666 | + | |
| 2581 | 2667 | framecnt += 1; |
| 2582 | 2668 | |
| 2583 | 2669 | return 0; |
| @@ -2748,6 +2834,14 @@ | ||
| 2748 | 2834 | } |
| 2749 | 2835 | } |
| 2750 | 2836 | |
| 2837 | +//! @brief オブジェクトログの描画処理 | |
| 2838 | +//! @param x 左上の x座標 | |
| 2839 | +//! @param y 左上の y座標 | |
| 2840 | +void ObjectManager::RenderLog(int x, int y) | |
| 2841 | +{ | |
| 2842 | + ObjectLog->Render(x, y); | |
| 2843 | +} | |
| 2844 | + | |
| 2751 | 2845 | //! @brief データの解放 |
| 2752 | 2846 | void ObjectManager::Cleanup() |
| 2753 | 2847 | { |
| @@ -2792,4 +2886,213 @@ | ||
| 2792 | 2886 | { |
| 2793 | 2887 | if( (id < 0)||(MAX_HUMAN <= id) ){ return; } |
| 2794 | 2888 | HumanIndex[id] = true; |
| 2889 | +} | |
| 2890 | + | |
| 2891 | +//! @brief コンストラクタ | |
| 2892 | +ObjectManagerLog::ObjectManagerLog() | |
| 2893 | +{ | |
| 2894 | + d3dg = NULL; | |
| 2895 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){ | |
| 2896 | + TextStr[i] = new char [MAX_OBJECTMANAGER_LOGLINES]; | |
| 2897 | + } | |
| 2898 | + ClearLog(); | |
| 2899 | +} | |
| 2900 | + | |
| 2901 | +//! @brief ディストラクタ | |
| 2902 | +ObjectManagerLog::~ObjectManagerLog() | |
| 2903 | +{ | |
| 2904 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){ | |
| 2905 | + delete [] TextStr[i]; | |
| 2906 | + } | |
| 2907 | +} | |
| 2908 | + | |
| 2909 | +//! @brief 参照するクラスを設定 | |
| 2910 | +//! @param in_d3dg 描画処理クラス | |
| 2911 | +//! @attention この関数で設定を行わないと、クラス自体が正しく機能しません。 | |
| 2912 | +void ObjectManagerLog::SetClass(D3DGraphics *in_d3dg) | |
| 2913 | +{ | |
| 2914 | + d3dg = in_d3dg; | |
| 2915 | +} | |
| 2916 | + | |
| 2917 | +//! @brief オブジェクトログを初期化 | |
| 2918 | +void ObjectManagerLog::ClearLog() | |
| 2919 | +{ | |
| 2920 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){ | |
| 2921 | + TextCnt[i] = -1; | |
| 2922 | + TextStr[i][0] = '\0'; | |
| 2923 | + TextColor[i] = 0; | |
| 2924 | + } | |
| 2925 | +} | |
| 2926 | + | |
| 2927 | +//! @brief 情報を追記 | |
| 2928 | +//! @param str 文字列 (改行コード:<b>不可</b>) | |
| 2929 | +void ObjectManagerLog::InfoLog(char *str) | |
| 2930 | +{ | |
| 2931 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, d3dg->GetColorCode(0.0f,1.0f,0.0f,1.0f)); | |
| 2932 | +} | |
| 2933 | + | |
| 2934 | +//! @brief 人を追加した | |
| 2935 | +//! @param humanID 人のID | |
| 2936 | +//! @param TeamID チーム番号 | |
| 2937 | +//! @param PlayerTeamID プレイヤーのチーム番号 | |
| 2938 | +void ObjectManagerLog::AddHuman(int humanID, int TeamID, int PlayerTeamID) | |
| 2939 | +{ | |
| 2940 | + char str[64]; | |
| 2941 | + int str_color; | |
| 2942 | + | |
| 2943 | + //文字の色を決定 | |
| 2944 | + if( PlayerTeamID == TeamID ){ str_color = d3dg->GetColorCode(0.0f,1.0f,1.0f,1.0f); } | |
| 2945 | + else{ str_color = d3dg->GetColorCode(1.0f,0.5f,0.0f,1.0f); } | |
| 2946 | + | |
| 2947 | + sprintf(str, "Added human[%d]", humanID); | |
| 2948 | + | |
| 2949 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, str_color); | |
| 2950 | +} | |
| 2951 | + | |
| 2952 | +//! @brief 人が死亡した | |
| 2953 | +//! @param ShothumanID 攻撃をした人のID | |
| 2954 | +//! @param HitHumanID 攻撃を受けた人のID | |
| 2955 | +//! @param ShothumanTeamID 攻撃をした人のチーム番号 | |
| 2956 | +//! @param HitHumanTeamID 攻撃を受けた人のチーム番号 | |
| 2957 | +//! @param PlayerTeamID プレイヤーのチーム番号 | |
| 2958 | +void ObjectManagerLog::DiedHuman(int ShothumanID, int HitHumanID, int ShothumanTeamID, int HitHumanTeamID, int PlayerTeamID) | |
| 2959 | +{ | |
| 2960 | + char str[64]; | |
| 2961 | + int str_color; | |
| 2962 | + | |
| 2963 | + //文字の色を決定 | |
| 2964 | + if( PlayerTeamID == HitHumanTeamID ){ str_color = d3dg->GetColorCode(1.0f,0.5f,0.0f,1.0f); } | |
| 2965 | + else{ str_color = d3dg->GetColorCode(0.0f,1.0f,1.0f,1.0f); } | |
| 2966 | + | |
| 2967 | + if( (ShothumanID == -1)||(ShothumanID == HitHumanID) ){ | |
| 2968 | + sprintf(str, "human[%d] died", HitHumanID); | |
| 2969 | + } | |
| 2970 | + else{ | |
| 2971 | + sprintf(str, "human[%d] killed human[%d]", ShothumanID, HitHumanID); | |
| 2972 | + | |
| 2973 | + //TK判定 | |
| 2974 | + if( ShothumanTeamID == HitHumanTeamID ){ | |
| 2975 | + strcat(str, " (TK)"); | |
| 2976 | + } | |
| 2977 | + } | |
| 2978 | + | |
| 2979 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, str_color); | |
| 2980 | +} | |
| 2981 | + | |
| 2982 | +//! @brief 人が蘇生した | |
| 2983 | +//! @param humanID 人のID | |
| 2984 | +//! @param TeamID チーム番号 | |
| 2985 | +//! @param PlayerTeamID プレイヤーのチーム番号 | |
| 2986 | +void ObjectManagerLog::ReviveHuman(int humanID, int TeamID, int PlayerTeamID) | |
| 2987 | +{ | |
| 2988 | + char str[64]; | |
| 2989 | + int str_color; | |
| 2990 | + | |
| 2991 | + //文字の色を決定 | |
| 2992 | + if( PlayerTeamID == TeamID ){ str_color = d3dg->GetColorCode(0.0f,1.0f,1.0f,1.0f); } | |
| 2993 | + else{ str_color = d3dg->GetColorCode(1.0f,0.5f,0.0f,1.0f); } | |
| 2994 | + | |
| 2995 | + sprintf(str, "Revived human[%d]", humanID); | |
| 2996 | + | |
| 2997 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, str_color); | |
| 2998 | +} | |
| 2999 | + | |
| 3000 | +//! @brief 小物を追加した | |
| 3001 | +//! @param objID 小物のID | |
| 3002 | +void ObjectManagerLog::AddSmallObject(int objID) | |
| 3003 | +{ | |
| 3004 | + char str[64]; | |
| 3005 | + sprintf(str, "Added SmallObject[%d]", objID); | |
| 3006 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 3007 | +} | |
| 3008 | + | |
| 3009 | +//! @brief 小物を破壊した | |
| 3010 | +//! @param objID 小物のID | |
| 3011 | +void ObjectManagerLog::BreakSmallObject(int objID) | |
| 3012 | +{ | |
| 3013 | + char str[64]; | |
| 3014 | + sprintf(str, "Breaked SmallObject[%d]", objID); | |
| 3015 | + AddTextLog(MAX_OBJECTMANAGER_LOGCNT, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f)); | |
| 3016 | +} | |
| 3017 | + | |
| 3018 | +//! @brief オブジェクトログ追加 | |
| 3019 | +//! @param cnt 描画フレーム数 | |
| 3020 | +//! @param str 文字列 (改行コード:<b>不可</b>) | |
| 3021 | +//! @param color 色 | |
| 3022 | +//! @return 1行上書き:true 追加のみ:false | |
| 3023 | +bool ObjectManagerLog::AddTextLog(int cnt, char *str, int color) | |
| 3024 | +{ | |
| 3025 | + //空いている行があるなら、その行に書いて終了 | |
| 3026 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){ | |
| 3027 | + if( TextCnt[i] == -1 ){ | |
| 3028 | + TextCnt[i] = cnt; | |
| 3029 | + strcpy(TextStr[i], str); | |
| 3030 | + TextColor[i] = color; | |
| 3031 | + return false; | |
| 3032 | + } | |
| 3033 | + } | |
| 3034 | + | |
| 3035 | + //空いている行がなければ、1行づつ詰める | |
| 3036 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN-1; i++){ | |
| 3037 | + TextCnt[i] = TextCnt[i+1]; | |
| 3038 | + strcpy(TextStr[i], TextStr[i+1]); | |
| 3039 | + TextColor[i] = TextColor[i+1]; | |
| 3040 | + } | |
| 3041 | + | |
| 3042 | + //最後の行に書く | |
| 3043 | + TextCnt[MAX_OBJECTMANAGER_LOGLEN-1] = cnt; | |
| 3044 | + strcpy(TextStr[MAX_OBJECTMANAGER_LOGLEN-1], str); | |
| 3045 | + TextColor[MAX_OBJECTMANAGER_LOGLEN-1] = color; | |
| 3046 | + return true; | |
| 3047 | +} | |
| 3048 | + | |
| 3049 | +//! @brief オブジェクトログの主計算処理 | |
| 3050 | +void ObjectManagerLog::Process() | |
| 3051 | +{ | |
| 3052 | + //各行ごとにカウント処理 | |
| 3053 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN; i++){ | |
| 3054 | + if( TextCnt[i] == 0 ){ | |
| 3055 | + TextCnt[i] = -1; | |
| 3056 | + TextStr[i][0] = '\0'; | |
| 3057 | + TextColor[i] = 0; | |
| 3058 | + } | |
| 3059 | + else if( TextCnt[i] > 0 ){ | |
| 3060 | + TextCnt[i] -= 1; | |
| 3061 | + } | |
| 3062 | + } | |
| 3063 | + | |
| 3064 | + //ゼロカウントの行を詰める | |
| 3065 | + for(int i=0; i<MAX_OBJECTMANAGER_LOGLEN-1; i++){ | |
| 3066 | + if( TextCnt[i] == 0 ){ | |
| 3067 | + for(int j=i; j<MAX_OBJECTMANAGER_LOGLEN-1; j++){ | |
| 3068 | + TextCnt[j] = TextCnt[j+1]; | |
| 3069 | + strcpy(TextStr[j], TextStr[j+1]); | |
| 3070 | + TextColor[j] = TextColor[j+1]; | |
| 3071 | + } | |
| 3072 | + | |
| 3073 | + //最後の行は空行に | |
| 3074 | + TextCnt[MAX_OBJECTMANAGER_LOGLEN-1] = -1; | |
| 3075 | + TextStr[MAX_OBJECTMANAGER_LOGLEN-1][0] = '\0'; | |
| 3076 | + TextColor[MAX_OBJECTMANAGER_LOGLEN-1] = 0; | |
| 3077 | + } | |
| 3078 | + } | |
| 3079 | +} | |
| 3080 | + | |
| 3081 | +//! @brief オブジェクトログの描画処理 | |
| 3082 | +//! @param x 左上の x座標 | |
| 3083 | +//! @param y 左上の y座標 | |
| 3084 | +//! @attention 上から逆順で描画されます。 | |
| 3085 | +void ObjectManagerLog::Render(int x, int y) | |
| 3086 | +{ | |
| 3087 | +#ifdef ENABLE_DEBUGCONSOLE | |
| 3088 | + if( d3dg == NULL ){ return; } | |
| 3089 | + | |
| 3090 | + for(int i=MAX_OBJECTMANAGER_LOGLEN-1; i>=0; i--){ | |
| 3091 | + if( TextCnt[i] >= 0 ){ | |
| 3092 | + d3dg->Draw2DTextureDebugFontText(x+2+1, y+2+1, TextStr[i], d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f)); | |
| 3093 | + d3dg->Draw2DTextureDebugFontText(x+2, y+2, TextStr[i], TextColor[i]); | |
| 3094 | + } | |
| 3095 | + y += 20; | |
| 3096 | + } | |
| 3097 | +#endif | |
| 2795 | 3098 | } |
| \ No newline at end of file |
| @@ -53,6 +53,10 @@ | ||
| 53 | 53 | |
| 54 | 54 | #define SMALLOBJECT_COLLISIONSCALE 0.13f //!< 小物当たり判定の倍率 |
| 55 | 55 | |
| 56 | +#define MAX_OBJECTMANAGER_LOGLEN 3 //!< オブジェクトログの最大行数 | |
| 57 | +#define MAX_OBJECTMANAGER_LOGLINES 64 //!< オブジェクトログの最大文字数 | |
| 58 | +#define MAX_OBJECTMANAGER_LOGCNT (int)(5.0f*GAMEFPS) //!< オブジェクトログの表示カウント数 | |
| 59 | + | |
| 56 | 60 | #ifndef H_LAYERLEVEL |
| 57 | 61 | #define H_LAYERLEVEL 3 //!< Select include file. |
| 58 | 62 | #endif |
| @@ -73,7 +77,7 @@ | ||
| 73 | 77 | class smallobject *SmallObjectIndex; //!< 小物オブジェクト |
| 74 | 78 | class bullet *BulletIndex; //!< 弾オブジェクト |
| 75 | 79 | class grenade *GrenadeIndex; //!< 手榴弾オブジェクト |
| 76 | - class effect *EffectIndex; //!< 手榴弾オブジェクト | |
| 80 | + class effect *EffectIndex; //!< 手榴弾オブジェクト | |
| 77 | 81 | |
| 78 | 82 | unsigned int framecnt; //!< フレーム数のカウント |
| 79 | 83 |
| @@ -99,6 +103,8 @@ | ||
| 99 | 103 | SoundManager *GameSound; //!< ゲーム効果音管理クラス |
| 100 | 104 | MIFInterface *MIFdata; //!< MIFコントロールクラス |
| 101 | 105 | |
| 106 | + class ObjectManagerLog *ObjectLog; //!< オブジェクトログクラス | |
| 107 | + | |
| 102 | 108 | int AddHumanIndex(pointdata data, pointdata infodata, bool RandomFlag); |
| 103 | 109 | int AddWeaponIndex(pointdata data); |
| 104 | 110 | int AddSmallObjectIndex(pointdata data); |
| @@ -165,6 +171,7 @@ | ||
| 165 | 171 | int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry); |
| 166 | 172 | bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot); |
| 167 | 173 | void Render(float camera_x, float camera_y, float camera_z, int HidePlayer); |
| 174 | + void RenderLog(int x, int y); | |
| 168 | 175 | void Cleanup(); |
| 169 | 176 | }; |
| 170 | 177 |
| @@ -182,4 +189,31 @@ | ||
| 182 | 189 | void SetIndexFlag(int id); |
| 183 | 190 | }; |
| 184 | 191 | |
| 192 | +//! @brief オブジェクトログクラス | |
| 193 | +//! @details オブジェクト管理クラス ObjectManager のログを記録・表示します。 | |
| 194 | +class ObjectManagerLog | |
| 195 | +{ | |
| 196 | + D3DGraphics *d3dg; //!< 描画クラス | |
| 197 | + | |
| 198 | + int TextCnt[MAX_OBJECTMANAGER_LOGLEN]; //!< フレーム数 | |
| 199 | + char *TextStr[MAX_OBJECTMANAGER_LOGLEN]; //!< 文字列 | |
| 200 | + int TextColor[MAX_OBJECTMANAGER_LOGLEN]; //!< 文字列の色 | |
| 201 | + | |
| 202 | + bool AddTextLog(int cnt, char *str, int color); | |
| 203 | + | |
| 204 | +public: | |
| 205 | + ObjectManagerLog(); | |
| 206 | + ~ObjectManagerLog(); | |
| 207 | + void SetClass(D3DGraphics *in_d3dg); | |
| 208 | + void ClearLog(); | |
| 209 | + void InfoLog(char *str); | |
| 210 | + void AddHuman(int humanID, int TeamID, int PlayerTeamID); | |
| 211 | + void DiedHuman(int ShothumanID, int HitHumanID, int ShothumanTeamID, int HitHumanTeamID, int PlayerTeamID); | |
| 212 | + void ReviveHuman(int humanID, int TeamID, int PlayerTeamID); | |
| 213 | + void AddSmallObject(int objID); | |
| 214 | + void BreakSmallObject(int objID); | |
| 215 | + void Process(); | |
| 216 | + void Render(int x, int y); | |
| 217 | +}; | |
| 218 | + | |
| 185 | 219 | #endif |
| \ No newline at end of file |