• 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

Revision167 (tree)
Time2017-03-20 18:29:49
Authorxops-mikan

Log Message

ObjectManagerのログ表示機能追加(infoコマンドで有効)、ENABLE_DEBUGCONSOLE定数未定義でコンパイルエラーとなる問題の修正

Change Summary

Incremental Difference

--- trunk/gamemain.cpp (revision 166)
+++ trunk/gamemain.cpp (revision 167)
@@ -2150,6 +2150,7 @@
21502150 }
21512151 }
21522152
2153+#ifdef ENABLE_DEBUGCONSOLE
21532154 //デバック用・ゲーム情報の表示
21542155 if( (ShowInfo_Debugmode == true)||(Camera_Debugmode == true) ){
21552156 float move_x, move_y, move_z;
@@ -2172,6 +2173,7 @@
21722173 d3dg->Draw2DTextureDebugFontText(10+1, 90+1, str, d3dg->GetColorCode(0.1f,0.1f,0.1f,1.0f));
21732174 d3dg->Draw2DTextureDebugFontText(10, 90, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f));
21742175 }
2176+#endif
21752177
21762178 //ゲーム実行速度の表示
21772179 //int speed = (int)(fps / (1000.0f/GAMEFRAMEMS) * 100);
@@ -2289,6 +2291,13 @@
22892291 d3dg->Draw2DMSFontTextCenter(0, SCREEN_HEIGHT - 140, SCREEN_WIDTH, 140, messtr, d3dg->GetColorCode(1.0f,1.0f,1.0f,effectA));
22902292 }
22912293
2294+#ifdef ENABLE_DEBUGCONSOLE
2295+ //デバック用・ゲーム情報の表示
2296+ if( ShowInfo_Debugmode == true ){
2297+ ObjMgr.RenderLog(HUDA_WEAPON_POSX, HUDA_WEAPON_POSY-60);
2298+ }
2299+#endif
2300+
22922301 //リロード表示
22932302 if( reloadcnt > 0 ){
22942303 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 @@
23412350 }
23422351 }
23432352
2353+#ifdef ENABLE_DEBUGCONSOLE
23442354 //AIデバック情報表示
23452355 if( AIdebuginfoID != -1 ){
23462356 if( (0 <= AIdebuginfoID)&&(AIdebuginfoID < MAX_HUMAN) ){
@@ -2375,6 +2385,7 @@
23752385 d3dg->Draw2DTextureDebugFontText(20, 210, str, d3dg->GetColorCode(1.0f,1.0f,0.0f,1.0f));
23762386 }
23772387 }
2388+#endif
23782389
23792390
23802391 //-----------------------------------
@@ -2511,7 +2522,7 @@
25112522 {
25122523 int RadarSize = 200; //レーダーの描画サイズ
25132524 int RadarPosX = SCREEN_WIDTH - RadarSize - 10; //レーダーの描画 X座標(左上基準)
2514- int RadarPosY = 130; //レーダーの描画 Y座標(左上基準)
2525+ int RadarPosY = 110; //レーダーの描画 Y座標(左上基準)
25152526 float RadarWorldR = 300.0f; //レーダーにポイントする距離
25162527
25172528 float ecr = DISTANCE_CHECKPOINT / RadarWorldR * (RadarSize/2);
--- trunk/object.cpp (revision 166)
+++ trunk/object.cpp (revision 167)
@@ -1537,7 +1537,7 @@
15371537 //! @param AddCollisionFlag 追加の当たり判定フラグ
15381538 //! @param player 対象の人物がプレイヤーかどうか
15391539 //! @param F5mode 上昇機能(F5裏技)のフラグ (有効:true 無効:false)
1540-//! @return 処理なし:0 通常処理:1 死亡して倒れ終わった直後:2 静止した死体:3
1540+//! @return 処理なし:0 通常処理:1 死亡して倒れ終わった直後:2 静止した死体:3 地形により死亡した直後:4
15411541 int human::RunFrame(class Collision *CollD, class BlockDataInterface *inblockdata, bool AddCollisionFlag, bool player, bool F5mode)
15421542 {
15431543 if( CollD == NULL ){ return 0; }
@@ -1557,6 +1557,7 @@
15571557 float FallDistance;
15581558 float nowmove_x, nowmove_z;
15591559 int CheckDead;
1560+ int hp_old;
15601561
15611562 //武器切り替えカウント
15621563 if( selectweaponcnt > 0 ){
@@ -1583,6 +1584,7 @@
15831584 ControlProcess();
15841585
15851586 //マップとの当たり判定
1587+ hp_old = hp;
15861588 MapCollisionDetection(CollD, inblockdata, AddCollisionFlag, &FallDistance, &nowmove_x, &nowmove_z);
15871589
15881590 //移動するなら
@@ -1612,7 +1614,13 @@
16121614 if( pos_y < HUMAN_DEADLINE ){
16131615 pos_y = HUMAN_DEADLINE;
16141616 hp = 0;
1617+ return 4;
16151618 }
1619+
1620+ //今回のマップとの当たり判定でHPがゼロになったなら、地形による死亡
1621+ if( (hp_old >0)&&(hp <= 0) ){
1622+ return 4;
1623+ }
16161624 }
16171625
16181626
--- trunk/objectmanager.cpp (revision 166)
+++ trunk/objectmanager.cpp (revision 167)
@@ -58,6 +58,10 @@
5858 BlockData = NULL;
5959 PointData = NULL;
6060 CollD = NULL;
61+ GameSound = NULL;
62+ MIFdata = NULL;
63+
64+ ObjectLog = new ObjectManagerLog;
6165 }
6266
6367 //! @brief ディストラクタ
@@ -78,6 +82,8 @@
7882 if( Human_ShotFlag != NULL ){ delete [] Human_ShotFlag; }
7983 if( BulletObj_HumanIndex != NULL ){ delete [] BulletObj_HumanIndex; }
8084 if( Human_FrameTextureRefresh != NULL ){ delete [] Human_FrameTextureRefresh; }
85+
86+ if( ObjectLog != NULL ){ delete ObjectLog; }
8187 }
8288
8389 //! @brief 参照するクラスを設定
@@ -135,6 +141,8 @@
135141 }
136142 }
137143 }
144+
145+ ObjectLog->SetClass(d3dg);
138146 }
139147
140148 //! @brief 人追加
@@ -325,6 +333,11 @@
325333 HumanIndex[Humanindexid].SetWeapon(Weapon);
326334 }
327335
336+ //ログ関係の処理
337+ int player_teamid;
338+ HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid);
339+ ObjectLog->AddHuman(Humanindexid, TeamID, player_teamid);
340+
328341 return Humanindexid;
329342 }
330343
@@ -466,20 +479,24 @@
466479 return -1;
467480 }
468481
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 ){
471484 //初期化
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);
477490
478491 //位置修正フラグが有効ならば、マップと判定
479492 if( MapColl == true ){
480- SmallObjectIndex[j].CollisionMap(CollD);
493+ SmallObjectIndex[i].CollisionMap(CollD);
481494 }
482- return j;
495+
496+ //ログ関係の処理
497+ ObjectLog->AddSmallObject(i);
498+
499+ return i;
483500 }
484501 }
485502 return -1;
@@ -902,6 +919,7 @@
902919 void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id)
903920 {
904921 int Shothuman_TeamID;
922+ int HitHuman_TeamID;
905923 int damage = 0;
906924 int paramid;
907925 HumanParameter Paraminfo;
@@ -911,8 +929,9 @@
911929 if( HumanIndex[HitHuman_id].GetEnableFlag() == false ){ return; }
912930 if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ return; }
913931
914- //発射元のチーム番号取得
932+ //発射元と対象人物のチーム番号取得
915933 HumanIndex[Shothuman_id].GetParamData(NULL, NULL, NULL, &Shothuman_TeamID);
934+ HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID);
916935
917936 //人にダメージと衝撃を与える
918937 if( Hit_id == 0 ){ HumanIndex[HitHuman_id].HitBulletHead(attacks); }
@@ -921,9 +940,7 @@
921940 HumanIndex[HitHuman_id].AddPosOrder(brx, 0.0f, 1.0f);
922941
923942 #ifdef ENABLE_BUG_TEAMID
924- int HitHuman_TeamID;
925943 bool flag = true;
926- HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID);
927944
928945 //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効
929946 if( (HitHuman_TeamID < 0)&&(Shothuman_TeamID < 0) ){
@@ -964,6 +981,16 @@
964981 if( HumanIndex[HitHuman_id].GetHP() <= 0 ){
965982 Human_kill[Shothuman_id] += 1;
966983 }
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+ }
967994 }
968995
969996 //! @brief 弾が小物に当たった処理
@@ -994,6 +1021,13 @@
9941021 int id;
9951022 SmallObjectIndex[HitSmallObject_id].GetParamData(&id, NULL);
9961023 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+ }
9971031 }
9981032
9991033 //! @brief 手榴弾のダメージ判定と処理
@@ -1017,6 +1051,7 @@
10171051 if( HumanIndex[i].GetEnableFlag() == false ){ continue; }
10181052 if( HumanIndex[i].GetHP() <= 0 ){ continue; }
10191053
1054+ int HitHuman_TeamID;
10201055 float hx, hy, hz;
10211056 float x, y, z, r;
10221057
@@ -1062,10 +1097,10 @@
10621097 //ダメージを反映
10631098 HumanIndex[i].HitGrenadeExplosion(total_damage);
10641099
1100+ HumanIndex[i].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID);
1101+
10651102 #ifdef ENABLE_BUG_TEAMID
1066- int HitHuman_TeamID;
10671103 bool flag = true;
1068- HumanIndex[i].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID);
10691104
10701105 //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効
10711106 if( (HitHuman_TeamID < 0)&&(teamid < 0) ){
@@ -1111,6 +1146,16 @@
11111146 //爆風による風圧
11121147 HumanIndex[i].AddPosOrder(arx, ary, 2.2f/MAX_DAMAGE_GRENADE_DISTANCE * (MAX_DAMAGE_GRENADE_DISTANCE - sqrt(x*x + y*y + z*z)));
11131148
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+
11141159 returnflag = true;
11151160 }
11161161 }
@@ -1147,6 +1192,12 @@
11471192 //小物から効果音を発する
11481193 GameSound->HitSmallObject(sx, sy, sz, id, teamid);
11491194
1195+ //ログ関係の処理
1196+ if( SmallObjectIndex[i].GetHP() <= 0 ){
1197+ //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回破壊された。
1198+ ObjectLog->BreakSmallObject(i);
1199+ }
1200+
11501201 returnflag = true;
11511202 }
11521203 }
@@ -1401,6 +1452,10 @@
14011452 AddSmallObjectIndex(data);
14021453 }
14031454 }
1455+
1456+ //ログ関係の処理
1457+ ObjectLog->ClearLog();
1458+ ObjectLog->InfoLog("Set object...");
14041459 }
14051460
14061461 //! @brief リソースの回復
@@ -1515,6 +1570,9 @@
15151570 EffectIndex[i].SetEnableFlag(false);
15161571 }
15171572 }
1573+
1574+ //ログ関係の処理
1575+ ObjectLog->InfoLog("Recovery object...");
15181576 }
15191577
15201578 //! @brief 追加の当たり判定フラグを設定
@@ -2194,14 +2252,16 @@
21942252 if( EnemyHuman->GetEnableFlag() == false ){ return; }
21952253 if( EnemyHuman->GetHP() <= 0 ){ return; }
21962254
2197- int MyHuman_TeamID;
2255+ int MyHuman_dataID, MyHuman_TeamID;
2256+ int EnemyHuman_dataID, EnemyHuman_TeamID;
21982257 float tx, ty, tz;
21992258 int paramid;
22002259 HumanParameter Paraminfo;
22012260 bool NotRobot;
22022261
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);
22052265
22062266 EnemyHuman->GetPosData(&tx, &ty, &tz, NULL);
22072267 ty += VIEW_HEIGHT;
@@ -2220,9 +2280,7 @@
22202280 EnemyHuman->HitZombieAttack();
22212281
22222282 #ifdef ENABLE_BUG_TEAMID
2223- int EnemyHuman_TeamID;
22242283 bool flag = true;
2225- EnemyHuman->GetParamData(NULL, NULL, NULL, &EnemyHuman_TeamID);
22262284
22272285 //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効
22282286 if( (EnemyHuman_TeamID < 0)&&(MyHuman_TeamID < 0) ){
@@ -2243,6 +2301,16 @@
22432301
22442302 //効果音を再生
22452303 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+ }
22462314 }
22472315
22482316 //! @brief 死者を蘇生する
@@ -2264,6 +2332,11 @@
22642332 if( (id_param < 0)||( TOTAL_PARAMETERINFO_HUMAN-1 < id_param) ){ return false; } //謎人間なら処理しない
22652333 HumanIndex[id].SetParamData(id_param, dataid, p4, team, true);
22662334
2335+ //ログ関係の処理
2336+ int player_teamid;
2337+ HumanIndex[Player_HumanID].GetParamData(NULL, NULL, NULL, &player_teamid);
2338+ ObjectLog->ReviveHuman(id, team, player_teamid);
2339+
22672340 return true;
22682341 }
22692342
@@ -2433,6 +2506,7 @@
24332506 //人オブジェクトの処理
24342507 for(int i=0; i<MAX_HUMAN; i++){
24352508 bool cmdF5, player;
2509+ int rtn;
24362510
24372511 //プレイヤーかどうか判定
24382512 if( Player_HumanID == i ){
@@ -2449,11 +2523,20 @@
24492523 cmdF5 = false;
24502524 }
24512525
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 ){
24532528 //死亡時のエフェクト
24542529 DeadEffect(&(HumanIndex[i]));
24552530 }
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);
24562535
2536+ //ログ関係の処理
2537+ ObjectLog->DiedHuman(-1, i, -1, teamid, player_teamid);
2538+ }
2539+
24572540 //足音
24582541 if( HumanIndex[i].GetMovemode(false) == 2 ){
24592542 //走る足音追加
@@ -2578,6 +2661,9 @@
25782661 }
25792662 }
25802663
2664+ //ログ関係の処理
2665+ ObjectLog->Process();
2666+
25812667 framecnt += 1;
25822668
25832669 return 0;
@@ -2748,6 +2834,14 @@
27482834 }
27492835 }
27502836
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+
27512845 //! @brief データの解放
27522846 void ObjectManager::Cleanup()
27532847 {
@@ -2792,4 +2886,213 @@
27922886 {
27932887 if( (id < 0)||(MAX_HUMAN <= id) ){ return; }
27942888 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
27953098 }
\ No newline at end of file
--- trunk/objectmanager.h (revision 166)
+++ trunk/objectmanager.h (revision 167)
@@ -53,6 +53,10 @@
5353
5454 #define SMALLOBJECT_COLLISIONSCALE 0.13f //!< 小物当たり判定の倍率
5555
56+#define MAX_OBJECTMANAGER_LOGLEN 3 //!< オブジェクトログの最大行数
57+#define MAX_OBJECTMANAGER_LOGLINES 64 //!< オブジェクトログの最大文字数
58+#define MAX_OBJECTMANAGER_LOGCNT (int)(5.0f*GAMEFPS) //!< オブジェクトログの表示カウント数
59+
5660 #ifndef H_LAYERLEVEL
5761 #define H_LAYERLEVEL 3 //!< Select include file.
5862 #endif
@@ -73,7 +77,7 @@
7377 class smallobject *SmallObjectIndex; //!< 小物オブジェクト
7478 class bullet *BulletIndex; //!< 弾オブジェクト
7579 class grenade *GrenadeIndex; //!< 手榴弾オブジェクト
76- class effect *EffectIndex; //!< 手榴弾オブジェクト
80+ class effect *EffectIndex; //!< 手榴弾オブジェクト
7781
7882 unsigned int framecnt; //!< フレーム数のカウント
7983
@@ -99,6 +103,8 @@
99103 SoundManager *GameSound; //!< ゲーム効果音管理クラス
100104 MIFInterface *MIFdata; //!< MIFコントロールクラス
101105
106+ class ObjectManagerLog *ObjectLog; //!< オブジェクトログクラス
107+
102108 int AddHumanIndex(pointdata data, pointdata infodata, bool RandomFlag);
103109 int AddWeaponIndex(pointdata data);
104110 int AddSmallObjectIndex(pointdata data);
@@ -165,6 +171,7 @@
165171 int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry);
166172 bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot);
167173 void Render(float camera_x, float camera_y, float camera_z, int HidePlayer);
174+ void RenderLog(int x, int y);
168175 void Cleanup();
169176 };
170177
@@ -182,4 +189,31 @@
182189 void SetIndexFlag(int id);
183190 };
184191
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+
185219 #endif
\ No newline at end of file