X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 187 (tree) |
|---|---|
| Time | 2017-10-29 11:13:14 |
| Author | |
ショットガン使用時の命中数・命中率計算を改善、死体として静止するまで銃弾・手榴弾・ゾンビ攻撃の当たり判定を行うように。
| @@ -1805,7 +1805,8 @@ | ||
| 1805 | 1805 | //プレイヤーのクラスを取得 |
| 1806 | 1806 | human *myHuman = ObjMgr.GetPlayerHumanObject(); |
| 1807 | 1807 | |
| 1808 | - int ontarget, kill, headshot; | |
| 1808 | + float ontarget; | |
| 1809 | + int kill, headshot; | |
| 1809 | 1810 | |
| 1810 | 1811 | //----------------------------------- |
| 1811 | 1812 |
| @@ -2918,15 +2919,19 @@ | ||
| 2918 | 2919 | |
| 2919 | 2920 | //暫定リザルト表示 |
| 2920 | 2921 | if( strcmp(NewCommand, "result") == 0 ){ |
| 2922 | + int intontarget; | |
| 2921 | 2923 | float rate; |
| 2924 | + | |
| 2925 | + //命中率計算 | |
| 2926 | + intontarget = (int)floor(MainGameInfo.ontarget); | |
| 2922 | 2927 | if( MainGameInfo.fire == 0 ){ |
| 2923 | 2928 | rate = 0.0f; |
| 2924 | 2929 | } |
| 2925 | 2930 | else{ |
| 2926 | - rate = (float)MainGameInfo.ontarget / MainGameInfo.fire * 100; | |
| 2931 | + rate = (float)intontarget / MainGameInfo.fire * 100; | |
| 2927 | 2932 | } |
| 2928 | 2933 | |
| 2929 | - sprintf(str, "Time %02d:%02d / Fired %d / On target %d", framecnt/(int)GAMEFPS/60, framecnt/(int)GAMEFPS%60, MainGameInfo.fire, MainGameInfo.ontarget); | |
| 2934 | + sprintf(str, "Time %02d:%02d / Fired %d / On target %d(%0.2f)", framecnt/(int)GAMEFPS/60, framecnt/(int)GAMEFPS%60, MainGameInfo.fire, intontarget, MainGameInfo.ontarget); | |
| 2930 | 2935 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), str); |
| 2931 | 2936 | sprintf(str, "AR rate %.1f%% / Kill %d / HS %d", rate, MainGameInfo.kill, MainGameInfo.headshot); |
| 2932 | 2937 | AddInfoConsole(d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), str); |
| @@ -3728,12 +3733,16 @@ | ||
| 3728 | 3733 | char mname[64]; |
| 3729 | 3734 | char str[32]; |
| 3730 | 3735 | float effectA = GetEffectAlphaLoop(framecnt, 1.0f, 0.8f, true); |
| 3736 | + int intontarget; | |
| 3731 | 3737 | float rate; |
| 3738 | + | |
| 3739 | + //命中率計算 | |
| 3740 | + intontarget = (int)floor(GameInfoData.ontarget); | |
| 3732 | 3741 | if( GameInfoData.fire == 0 ){ |
| 3733 | 3742 | rate = 0.0f; |
| 3734 | 3743 | } |
| 3735 | 3744 | else{ |
| 3736 | - rate = (float)GameInfoData.ontarget / GameInfoData.fire * 100; | |
| 3745 | + rate = (float)intontarget / GameInfoData.fire * 100; | |
| 3737 | 3746 | } |
| 3738 | 3747 | |
| 3739 | 3748 | //メモ:背景画像の描画は、自動的に行われる。 |
| @@ -3763,7 +3772,7 @@ | ||
| 3763 | 3772 | d3dg->Draw2DTextureFontText(SCREEN_WIDTH/2-strlen(str)*20/2, 210, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 20, 32); |
| 3764 | 3773 | sprintf(str, "Rounds fired %d", GameInfoData.fire); |
| 3765 | 3774 | d3dg->Draw2DTextureFontText(SCREEN_WIDTH/2-strlen(str)*20/2, 260, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 20, 32); |
| 3766 | - sprintf(str, "Rounds on target %d", GameInfoData.ontarget); | |
| 3775 | + sprintf(str, "Rounds on target %d", intontarget); | |
| 3767 | 3776 | d3dg->Draw2DTextureFontText(SCREEN_WIDTH/2-strlen(str)*20/2, 310, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 20, 32); |
| 3768 | 3777 | sprintf(str, "Accuracy rate %.1f%%", rate); |
| 3769 | 3778 | d3dg->Draw2DTextureFontText(SCREEN_WIDTH/2-strlen(str)*20/2, 360, str, d3dg->GetColorCode(1.0f,1.0f,1.0f,1.0f), 20, 32); |
| @@ -82,7 +82,7 @@ | ||
| 82 | 82 | bool missioncomplete; //!< ミッション完了 |
| 83 | 83 | unsigned int framecnt; //!< フレーム数 |
| 84 | 84 | int fire; //!< 射撃回数 |
| 85 | - int ontarget; //!< 命中数 | |
| 85 | + float ontarget; //!< 命中数 | |
| 86 | 86 | int kill; //!< 倒した敵の数 |
| 87 | 87 | int headshot; //!< 敵の頭部に命中した数 |
| 88 | 88 | }; |
| @@ -72,6 +72,13 @@ | ||
| 72 | 72 | GetModuleFileName(NULL, path, MAX_PATH); |
| 73 | 73 | PathRemoveFileSpec(path); |
| 74 | 74 | SetCurrentDirectory(path); |
| 75 | + | |
| 76 | + //char str[24]; | |
| 77 | + //GameConfig.GetPlayerName(str); | |
| 78 | + //MessageBox(NULL, str, "プレイヤー名", MB_OK); | |
| 79 | + char str[255]; | |
| 80 | + strcpy(str, "[Information]\nThe compiler is the Debug mode.\nIf release the software, Switch compiler to Release mode."); | |
| 81 | + MessageBox(NULL, str, GAMENAME, MB_OK); | |
| 75 | 82 | #endif |
| 76 | 83 | |
| 77 | 84 | #ifdef ENABLE_DEBUGLOG |
| @@ -89,10 +96,30 @@ | ||
| 89 | 96 | } |
| 90 | 97 | } |
| 91 | 98 | |
| 99 | + //ユーザー環境を出力 | |
| 100 | + GetOperatingEnvironment(); | |
| 101 | + | |
| 102 | + char infostr[64]; | |
| 103 | + | |
| 104 | + /* | |
| 92 | 105 | //ログに出力 |
| 106 | + sprintf(infostr, "%d個", __argc); | |
| 107 | + OutputLog.WriteLog(LOG_CHECK, "引数", infostr); | |
| 108 | + for(int i=0; i<__argc; i++){ | |
| 109 | + sprintf(infostr, "引数[%d]", i); | |
| 110 | + OutputLog.WriteLog(LOG_CHECK, infostr, __argv[i]); | |
| 111 | + } | |
| 112 | + */ | |
| 113 | + | |
| 114 | + //ログに出力 | |
| 93 | 115 | OutputLog.WriteLog(LOG_CHECK, "起動", "エントリーポイント開始"); |
| 94 | 116 | #endif |
| 95 | 117 | |
| 118 | +#ifdef _DEBUG | |
| 119 | + //ログに出力 | |
| 120 | + OutputLog.WriteLog(LOG_CHECK, "起動", "Visual C++ デバッグモード"); | |
| 121 | +#endif | |
| 122 | + | |
| 96 | 123 | //設定ファイル読み込み |
| 97 | 124 | if( GameConfig.LoadFile("config.dat") == 1 ){ |
| 98 | 125 | MainWindow.ErrorInfo("config data open failed"); |
| @@ -99,13 +126,16 @@ | ||
| 99 | 126 | return 1; |
| 100 | 127 | } |
| 101 | 128 | |
| 102 | -#ifdef _DEBUG | |
| 103 | - //char str[24]; | |
| 104 | - //GameConfig.GetPlayerName(str); | |
| 105 | - //MessageBox(NULL, str, "プレイヤー名", MB_OK); | |
| 106 | - char str[255]; | |
| 107 | - strcpy(str, "[Information]\nThe compiler is the Debug mode.\nIf release the software, Switch compiler to Release mode."); | |
| 108 | - MessageBox(NULL, str, GAMENAME, MB_OK); | |
| 129 | +#ifdef ENABLE_DEBUGLOG | |
| 130 | + //ログに出力 | |
| 131 | + sprintf(infostr, "解像度:%d x %d", SCREEN_WIDTH, SCREEN_HEIGHT); | |
| 132 | + OutputLog.WriteLog(LOG_CHECK, "環境", infostr); | |
| 133 | + if( GameConfig.GetFullscreenFlag() == false ){ | |
| 134 | + OutputLog.WriteLog(LOG_CHECK, "環境", "ウィンドウモード:ウィンドウ"); | |
| 135 | + } | |
| 136 | + else{ | |
| 137 | + OutputLog.WriteLog(LOG_CHECK, "環境", "ウィンドウモード:フルスクリーン"); | |
| 138 | + } | |
| 109 | 139 | #endif |
| 110 | 140 | |
| 111 | 141 | //ウィンドウ初期化 |
| @@ -190,9 +190,7 @@ | ||
| 190 | 190 | //else{ |
| 191 | 191 | hp = 0; |
| 192 | 192 | //} |
| 193 | -#ifdef HUMAN_DEADBODY_COLLISION | |
| 194 | 193 | deadstate = 0; |
| 195 | -#endif | |
| 196 | 194 | add_ry = 0.0f; |
| 197 | 195 | id_texture = -1; |
| 198 | 196 |
| @@ -258,9 +256,7 @@ | ||
| 258 | 256 | else{ |
| 259 | 257 | hp = 0; |
| 260 | 258 | } |
| 261 | -#ifdef HUMAN_DEADBODY_COLLISION | |
| 262 | 259 | deadstate = 0; |
| 263 | -#endif | |
| 264 | 260 | add_ry = 0.0f; |
| 265 | 261 | MoveFlag = 0x00; |
| 266 | 262 | MoveFlag_lt = MoveFlag; |
| @@ -313,13 +309,8 @@ | ||
| 313 | 309 | //! @warning 完全に静止した状態を「死体」と判定します。倒れている最中の人は対象に含まれないため、hp <= 0 が全て死体と判定されるとは限りません。 |
| 314 | 310 | bool human::GetDeadFlag() |
| 315 | 311 | { |
| 316 | -#ifdef HUMAN_DEADBODY_COLLISION | |
| 317 | 312 | if( deadstate == 5 ){ return true; } |
| 318 | 313 | return false; |
| 319 | -#else | |
| 320 | - if( hp <= 0 ){ return true; } | |
| 321 | - return false; | |
| 322 | -#endif | |
| 323 | 314 | } |
| 324 | 315 | |
| 325 | 316 | //! @brief チーム番号を設定(上書き) |
| @@ -1207,6 +1198,7 @@ | ||
| 1207 | 1198 | rotation_y += add_ry; |
| 1208 | 1199 | if( rotation_y >= DegreeToRadian(90) ){ |
| 1209 | 1200 | rotation_y = DegreeToRadian(90); |
| 1201 | + deadstate = 5; | |
| 1210 | 1202 | return 3; |
| 1211 | 1203 | } |
| 1212 | 1204 | return 2; |
| @@ -1216,6 +1208,7 @@ | ||
| 1216 | 1208 | rotation_y += add_ry; |
| 1217 | 1209 | if( rotation_y <= DegreeToRadian(-90) ){ |
| 1218 | 1210 | rotation_y = DegreeToRadian(-90); |
| 1211 | + deadstate = 5; | |
| 1219 | 1212 | return 3; |
| 1220 | 1213 | } |
| 1221 | 1214 | return 2; |
| @@ -1257,6 +1250,7 @@ | ||
| 1257 | 1250 | //スコープモードを解除 |
| 1258 | 1251 | SetDisableScope(); |
| 1259 | 1252 | |
| 1253 | + deadstate = 1; | |
| 1260 | 1254 | return 1; |
| 1261 | 1255 | } |
| 1262 | 1256 |
| @@ -1596,15 +1590,7 @@ | ||
| 1596 | 1590 | if( CollD == NULL ){ return 0; } |
| 1597 | 1591 | if( EnableFlag == false ){ return 0; } |
| 1598 | 1592 | |
| 1599 | -#ifdef HUMAN_DEADBODY_COLLISION | |
| 1600 | 1593 | if( deadstate == 5 ){ return 3; } |
| 1601 | -#else | |
| 1602 | - if( hp <= 0 ){ | |
| 1603 | - if( fabs(rotation_y) >= DegreeToRadian(90) ){ | |
| 1604 | - return 3; | |
| 1605 | - } | |
| 1606 | - } | |
| 1607 | -#endif | |
| 1608 | 1594 | |
| 1609 | 1595 | int WeaponReloadCnt; |
| 1610 | 1596 | float FallDistance; |
| @@ -2390,8 +2376,9 @@ | ||
| 2390 | 2376 | //! @param _speed 弾速 |
| 2391 | 2377 | //! @param _teamid チーム番号 |
| 2392 | 2378 | //! @param _humanid 人のデータ番号 |
| 2379 | +//! @param _ontargetcnt 命中時のカウント数 | |
| 2393 | 2380 | //! @param init オブジェクトを初期化 |
| 2394 | -void bullet::SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, bool init) | |
| 2381 | +void bullet::SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, float _ontargetcnt, bool init) | |
| 2395 | 2382 | { |
| 2396 | 2383 | attacks = _attacks; |
| 2397 | 2384 | penetration = _penetration; |
| @@ -2398,6 +2385,7 @@ | ||
| 2398 | 2385 | speed = _speed; |
| 2399 | 2386 | teamid = _teamid; |
| 2400 | 2387 | humanid = _humanid; |
| 2388 | + ontargetcnt = _ontargetcnt; | |
| 2401 | 2389 | |
| 2402 | 2390 | if( init == true ){ |
| 2403 | 2391 | cnt = 0; |
| @@ -2425,7 +2413,8 @@ | ||
| 2425 | 2413 | //! @param _speed 弾速を受け取るポインタ(NULL可) |
| 2426 | 2414 | //! @param _teamid チーム番号を受け取るポインタ(NULL可) |
| 2427 | 2415 | //! @param _humanid 人のデータ番号を受け取るポインタ(NULL可) |
| 2428 | -void bullet::GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid) | |
| 2416 | +//! @param _ontargetcnt 命中時のカウント数を受け取るポインタ(NULL可) | |
| 2417 | +void bullet::GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid, float *_ontargetcnt) | |
| 2429 | 2418 | { |
| 2430 | 2419 | if( _attacks != NULL ){ *_attacks = attacks; } |
| 2431 | 2420 | if( _penetration != NULL ){ *_penetration = penetration; } |
| @@ -2432,6 +2421,7 @@ | ||
| 2432 | 2421 | if( _speed != NULL ){ *_speed = speed; } |
| 2433 | 2422 | if( _teamid != NULL ){ *_teamid = teamid; } |
| 2434 | 2423 | if( _humanid != NULL ){ *_humanid = humanid; } |
| 2424 | + if( _ontargetcnt != NULL ){ *_ontargetcnt = ontargetcnt; } | |
| 2435 | 2425 | } |
| 2436 | 2426 | |
| 2437 | 2427 | //! @brief 計算を実行(弾の進行・時間消滅) |
| @@ -2493,9 +2483,10 @@ | ||
| 2493 | 2483 | //! @param speed 初速 |
| 2494 | 2484 | //! @param _teamid チーム番号 |
| 2495 | 2485 | //! @param _humanid 人のデータ番号 |
| 2486 | +//! @param _ontargetcnt 命中時のカウント数 | |
| 2496 | 2487 | //! @param init オブジェクトを初期化 |
| 2497 | 2488 | //! @attention 先に SetPosData() を実行してください。 |
| 2498 | -void grenade::SetParamData(float speed, int _teamid, int _humanid, bool init) | |
| 2489 | +void grenade::SetParamData(float speed, int _teamid, int _humanid, float _ontargetcnt, bool init) | |
| 2499 | 2490 | { |
| 2500 | 2491 | move_x = cos(rotation_x) * cos(rotation_y) * speed; |
| 2501 | 2492 | move_y = sin(rotation_y) * speed; |
| @@ -2502,6 +2493,7 @@ | ||
| 2502 | 2493 | move_z = sin(rotation_x) * cos(rotation_y) * speed; |
| 2503 | 2494 | teamid = _teamid; |
| 2504 | 2495 | humanid = _humanid; |
| 2496 | + ontargetcnt = _ontargetcnt; | |
| 2505 | 2497 | |
| 2506 | 2498 | if( init == true ){ |
| 2507 | 2499 | cnt = 0; |
| @@ -2512,11 +2504,13 @@ | ||
| 2512 | 2504 | //! @param _speed 速度を受け取るポインタ(NULL可) |
| 2513 | 2505 | //! @param _teamid チーム番号を受け取るポインタ(NULL可) |
| 2514 | 2506 | //! @param _humanid 人のデータ番号を受け取るポインタ(NULL可) |
| 2515 | -void grenade::GetParamData(float *_speed, int *_teamid, int *_humanid) | |
| 2507 | +//! @param _ontargetcnt 命中時のカウント数を受け取るポインタ(NULL可) | |
| 2508 | +void grenade::GetParamData(float *_speed, int *_teamid, int *_humanid, float *_ontargetcnt) | |
| 2516 | 2509 | { |
| 2517 | 2510 | if( _speed != NULL ){ *_speed = GetSpeed(); } |
| 2518 | 2511 | if( _teamid != NULL ){ *_teamid = teamid; } |
| 2519 | 2512 | if( _humanid != NULL ){ *_humanid = humanid; } |
| 2513 | + if( _ontargetcnt != NULL ){ *_ontargetcnt = ontargetcnt; } | |
| 2520 | 2514 | } |
| 2521 | 2515 | |
| 2522 | 2516 | //! @brief 速度を取得 |
| @@ -145,9 +145,7 @@ | ||
| 145 | 145 | int selectweapon; //!< 武器A/Bの選択 |
| 146 | 146 | int selectweaponcnt; //!< 武器の切り替えカウント |
| 147 | 147 | int hp; //!< 体力 |
| 148 | -#ifdef HUMAN_DEADBODY_COLLISION | |
| 149 | 148 | int deadstate; //!< 死体になっているか |
| 150 | -#endif | |
| 151 | 149 | float add_ry; //!< 死体の倒れる加速度 |
| 152 | 150 | float move_rx; //!< 移動角度 |
| 153 | 151 | int MoveFlag; //!< 移動方向を表すフラグ |
| @@ -290,6 +288,7 @@ | ||
| 290 | 288 | int speed; //!< 弾速 |
| 291 | 289 | int teamid; //!< チーム番号 |
| 292 | 290 | int humanid; //!< 人のデータ番号 |
| 291 | + float ontargetcnt; //!< 命中時のカウント数 | |
| 293 | 292 | int cnt; //!< カウント |
| 294 | 293 | |
| 295 | 294 | public: |
| @@ -296,9 +295,9 @@ | ||
| 296 | 295 | bullet(int modelid = -1, int textureid = -1); |
| 297 | 296 | ~bullet(); |
| 298 | 297 | virtual void SetPosData(float x, float y, float z, float rx, float ry); |
| 299 | - virtual void SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, bool init); | |
| 298 | + virtual void SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, float _ontargetcnt, bool init); | |
| 300 | 299 | virtual void GetPosData(float *x, float *y, float *z, float *rx, float *ry); |
| 301 | - virtual void GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid); | |
| 300 | + virtual void GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid, float *_ontargetcnt); | |
| 302 | 301 | virtual int RunFrame(); |
| 303 | 302 | virtual void Render(class D3DGraphics *d3dg); |
| 304 | 303 | }; |
| @@ -313,8 +312,8 @@ | ||
| 313 | 312 | public: |
| 314 | 313 | grenade(int modelid = -1, int textureid = -1); |
| 315 | 314 | ~grenade(); |
| 316 | - void SetParamData(float speed, int _teamid, int _humanid, bool init); | |
| 317 | - void GetParamData(float *_speed, int *_teamid, int *_humanid); | |
| 315 | + void SetParamData(float speed, int _teamid, int _humanid, float _ontargetcnt, bool init); | |
| 316 | + void GetParamData(float *_speed, int *_teamid, int *_humanid, float *_ontargetcnt); | |
| 318 | 317 | float GetSpeed(); |
| 319 | 318 | int RunFrame(class Collision *CollD); |
| 320 | 319 | virtual void Render(D3DGraphics *d3dg); |
| @@ -42,7 +42,7 @@ | ||
| 42 | 42 | EffectIndex = new effect[MAX_EFFECT]; |
| 43 | 43 | |
| 44 | 44 | framecnt = 0; |
| 45 | - Human_ontarget = new int[MAX_HUMAN]; | |
| 45 | + Human_ontarget = new float[MAX_HUMAN]; | |
| 46 | 46 | Human_kill = new int[MAX_HUMAN]; |
| 47 | 47 | Human_headshot = new int[MAX_HUMAN]; |
| 48 | 48 | Human_ShotFlag = new bool[MAX_HUMAN]; |
| @@ -648,6 +648,7 @@ | ||
| 648 | 648 | int speed; |
| 649 | 649 | int teamid; |
| 650 | 650 | int humanid; |
| 651 | + float ontargetcnt; | |
| 651 | 652 | float vx, vy, vz; |
| 652 | 653 | int HumanHead_id; |
| 653 | 654 | int HumanUp_id; |
| @@ -669,7 +670,7 @@ | ||
| 669 | 670 | |
| 670 | 671 | //弾丸の座標を取得し、ベクトルを算出。 |
| 671 | 672 | in_bullet->GetPosData(&bx, &by, &bz, &brx, &bry); |
| 672 | - in_bullet->GetParamData(&attacks, &penetration, &speed, &teamid, &humanid); | |
| 673 | + in_bullet->GetParamData(&attacks, &penetration, &speed, &teamid, &humanid, &ontargetcnt); | |
| 673 | 674 | vx = cos(brx)*cos(bry); |
| 674 | 675 | vy = sin(bry); |
| 675 | 676 | vz = sin(brx)*cos(bry); |
| @@ -712,9 +713,9 @@ | ||
| 712 | 713 | //その人自身が発砲した弾なら処理しない。 |
| 713 | 714 | if( i == humanid ){ continue; } |
| 714 | 715 | |
| 715 | - //使用されていないか、死亡していれば処理しない。 | |
| 716 | + //使用されていないか、死体ならば処理しない。 | |
| 716 | 717 | if( HumanIndex[i].GetEnableFlag() == false ){ continue; } |
| 717 | - if( HumanIndex[i].GetHP() <= 0 ){ continue; } | |
| 718 | + if( HumanIndex[i].GetDeadFlag() == true ){ continue; } | |
| 718 | 719 | |
| 719 | 720 | //既に当たった人なら、処理しない。 |
| 720 | 721 | if( BulletObj_HumanIndex[objectID].GetIndexFlag(i) == true ){ continue; } |
| @@ -816,7 +817,7 @@ | ||
| 816 | 817 | //人の頭との衝突距離が最短ならば〜 |
| 817 | 818 | if( (HumanHead_Dist <= speed)&&(HumanHead_Dist < map_Dist)&&(HumanHead_Dist < HumanUp_Dist)&&(HumanHead_Dist < HumanLeg_Dist)&&(HumanHead_Dist < SmallObject_Dist) ){ |
| 818 | 819 | //人に当たった処理 |
| 819 | - HitBulletHuman(HumanHead_id, 0, bx + vx*(HumanHead_Dist+TotalDist), by + vy*(HumanHead_Dist+TotalDist), bz + vz*(HumanHead_Dist+TotalDist), brx, attacks, humanid); | |
| 820 | + HitBulletHuman(HumanHead_id, 0, bx + vx*(HumanHead_Dist+TotalDist), by + vy*(HumanHead_Dist+TotalDist), bz + vz*(HumanHead_Dist+TotalDist), brx, attacks, humanid, ontargetcnt); | |
| 820 | 821 | |
| 821 | 822 | //対人判定用リスト設定 |
| 822 | 823 | BulletObj_HumanIndex[objectID].SetIndexFlag(HumanHead_id); |
| @@ -831,7 +832,7 @@ | ||
| 831 | 832 | //人の上半身との衝突距離が最短ならば〜 |
| 832 | 833 | if( (HumanUp_Dist <= speed)&&(HumanUp_Dist < map_Dist)&&(HumanUp_Dist < HumanHead_Dist)&&(HumanUp_Dist < HumanLeg_Dist)&&(HumanUp_Dist < SmallObject_Dist) ){ |
| 833 | 834 | //人に当たった処理 |
| 834 | - HitBulletHuman(HumanUp_id, 1, bx + vx*(HumanUp_Dist+TotalDist), by + vy*(HumanUp_Dist+TotalDist), bz + vz*(HumanUp_Dist+TotalDist), brx, attacks, humanid); | |
| 835 | + HitBulletHuman(HumanUp_id, 1, bx + vx*(HumanUp_Dist+TotalDist), by + vy*(HumanUp_Dist+TotalDist), bz + vz*(HumanUp_Dist+TotalDist), brx, attacks, humanid, ontargetcnt); | |
| 835 | 836 | |
| 836 | 837 | //対人判定用リスト設定 |
| 837 | 838 | BulletObj_HumanIndex[objectID].SetIndexFlag(HumanUp_id); |
| @@ -846,7 +847,7 @@ | ||
| 846 | 847 | //人の足との衝突距離が最短ならば〜 |
| 847 | 848 | if( (HumanLeg_Dist <= speed)&&(HumanLeg_Dist < map_Dist)&&(HumanLeg_Dist < HumanHead_Dist)&&(HumanLeg_Dist < HumanUp_Dist)&&(HumanLeg_Dist < SmallObject_Dist) ){ |
| 848 | 849 | //人に当たった処理 |
| 849 | - HitBulletHuman(HumanLeg_id, 2, bx + vx*(HumanLeg_Dist+TotalDist), by + vy*(HumanLeg_Dist+TotalDist), bz + vz*(HumanLeg_Dist+TotalDist), brx, attacks, humanid); | |
| 850 | + HitBulletHuman(HumanLeg_id, 2, bx + vx*(HumanLeg_Dist+TotalDist), by + vy*(HumanLeg_Dist+TotalDist), bz + vz*(HumanLeg_Dist+TotalDist), brx, attacks, humanid, ontargetcnt); | |
| 850 | 851 | |
| 851 | 852 | //対人判定用リスト設定 |
| 852 | 853 | BulletObj_HumanIndex[objectID].SetIndexFlag(HumanLeg_id); |
| @@ -887,7 +888,7 @@ | ||
| 887 | 888 | } |
| 888 | 889 | |
| 889 | 890 | //設定を適用(特に攻撃力・貫通力) |
| 890 | - in_bullet->SetParamData(attacks, penetration, speed, teamid, humanid, false); | |
| 891 | + in_bullet->SetParamData(attacks, penetration, speed, teamid, humanid, ontargetcnt, false); | |
| 891 | 892 | } |
| 892 | 893 | |
| 893 | 894 | return CollideFlag; |
| @@ -916,23 +917,28 @@ | ||
| 916 | 917 | //! @param brx 水平角度 |
| 917 | 918 | //! @param attacks 攻撃力 |
| 918 | 919 | //! @param Shothuman_id 発射した人の番号 |
| 919 | -void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id) | |
| 920 | +//! @param ontargetcnt 命中時のカウント数 | |
| 921 | +void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id, float ontargetcnt) | |
| 920 | 922 | { |
| 921 | 923 | int Shothuman_TeamID; |
| 922 | 924 | int HitHuman_TeamID; |
| 925 | + int hp_old; | |
| 923 | 926 | int damage = 0; |
| 924 | 927 | int paramid; |
| 925 | 928 | HumanParameter Paraminfo; |
| 926 | 929 | bool NotRobot; |
| 927 | 930 | |
| 928 | - //使用されていないか、死亡していれば処理しない。 | |
| 931 | + //使用されていないか、死体ならば処理しない。 | |
| 929 | 932 | if( HumanIndex[HitHuman_id].GetEnableFlag() == false ){ return; } |
| 930 | - if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ return; } | |
| 933 | + if( HumanIndex[HitHuman_id].GetDeadFlag() == true ){ return; } | |
| 931 | 934 | |
| 932 | 935 | //発射元と対象人物のチーム番号取得 |
| 933 | 936 | HumanIndex[Shothuman_id].GetParamData(NULL, NULL, NULL, &Shothuman_TeamID); |
| 934 | 937 | HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); |
| 935 | 938 | |
| 939 | + //ダメージ計算前のHP取得 | |
| 940 | + hp_old = HumanIndex[HitHuman_id].GetHP(); | |
| 941 | + | |
| 936 | 942 | //人にダメージと衝撃を与える |
| 937 | 943 | if( Hit_id == 0 ){ HumanIndex[HitHuman_id].HitBulletHead(attacks); } |
| 938 | 944 | if( Hit_id == 1 ){ HumanIndex[HitHuman_id].HitBulletUp(attacks); } |
| @@ -976,14 +982,15 @@ | ||
| 976 | 982 | GameSound->HitHuman(x, y, z, Shothuman_TeamID); |
| 977 | 983 | |
| 978 | 984 | //弾を発射した人の成果に加算 |
| 979 | - Human_ontarget[Shothuman_id] += 1; | |
| 985 | + Human_ontarget[Shothuman_id] += ontargetcnt; | |
| 980 | 986 | if( Hit_id == 0 ){ Human_headshot[Shothuman_id] += 1; } |
| 981 | - if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ | |
| 987 | + if( (hp_old > 0)&&(HumanIndex[HitHuman_id].GetHP() <= 0) ){ | |
| 988 | + //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 | |
| 982 | 989 | Human_kill[Shothuman_id] += 1; |
| 983 | 990 | } |
| 984 | 991 | |
| 985 | 992 | //ログ関係の処理 |
| 986 | - if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ | |
| 993 | + if( (hp_old > 0)&&(HumanIndex[HitHuman_id].GetHP() <= 0) ){ | |
| 987 | 994 | //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 |
| 988 | 995 | |
| 989 | 996 | int player_teamid; |
| @@ -1043,13 +1050,13 @@ | ||
| 1043 | 1050 | float gx, gy, gz; |
| 1044 | 1051 | int teamid, humanid; |
| 1045 | 1052 | in_grenade->GetPosData(&gx, &gy, &gz, NULL, NULL); |
| 1046 | - in_grenade->GetParamData(NULL, &teamid, &humanid); | |
| 1053 | + in_grenade->GetParamData(NULL, &teamid, &humanid, NULL); | |
| 1047 | 1054 | |
| 1048 | 1055 | //人に爆風の当たり判定 |
| 1049 | 1056 | for(int i=0; i<MAX_HUMAN; i++){ |
| 1050 | - //初期化されていないか、死亡していれば処理しない。 | |
| 1057 | + //初期化されていないか、死体ならば処理しない。 | |
| 1051 | 1058 | if( HumanIndex[i].GetEnableFlag() == false ){ continue; } |
| 1052 | - if( HumanIndex[i].GetHP() <= 0 ){ continue; } | |
| 1059 | + if( HumanIndex[i].GetDeadFlag() == true ){ continue; } | |
| 1053 | 1060 | |
| 1054 | 1061 | int HitHuman_TeamID; |
| 1055 | 1062 | float hx, hy, hz; |
| @@ -1094,6 +1101,11 @@ | ||
| 1094 | 1101 | } |
| 1095 | 1102 | |
| 1096 | 1103 | if( total_damage > 0 ){ |
| 1104 | + int hp_old; | |
| 1105 | + | |
| 1106 | + //ダメージ計算前のHP取得 | |
| 1107 | + hp_old = HumanIndex[i].GetHP(); | |
| 1108 | + | |
| 1097 | 1109 | //ダメージを反映 |
| 1098 | 1110 | HumanIndex[i].HitGrenadeExplosion(total_damage); |
| 1099 | 1111 |
| @@ -1147,7 +1159,7 @@ | ||
| 1147 | 1159 | HumanIndex[i].AddPosOrder(arx, ary, 2.2f/MAX_DAMAGE_GRENADE_DISTANCE * (MAX_DAMAGE_GRENADE_DISTANCE - sqrt(x*x + y*y + z*z))); |
| 1148 | 1160 | |
| 1149 | 1161 | //ログ関係の処理 |
| 1150 | - if( HumanIndex[i].GetHP() <= 0 ){ | |
| 1162 | + if( (hp_old > 0)&&(HumanIndex[i].GetHP() <= 0) ){ | |
| 1151 | 1163 | //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 |
| 1152 | 1164 | |
| 1153 | 1165 | int player_teamid; |
| @@ -1898,13 +1910,15 @@ | ||
| 1898 | 1910 | //(ショットガンなど)発射する弾の数分繰り返す |
| 1899 | 1911 | for(int i=0; i<ParamData.burst; i++){ |
| 1900 | 1912 | int attacks; |
| 1913 | + float ontargetcnt; | |
| 1901 | 1914 | float rx2, ry2; |
| 1902 | 1915 | |
| 1903 | 1916 | //(ショットガンなど)発射する弾が複数あれば |
| 1904 | 1917 | if( ParamData.burst > 1 ){ |
| 1905 | - //1個の弾あたりの攻撃力を算出 | |
| 1906 | - // 全弾合わせて、攻撃力の2倍になるようにする。 | |
| 1918 | + //1個の弾あたりの攻撃力と命中時のカウント数を算出 | |
| 1919 | + // 全弾合わせて、2倍になるようにする。 | |
| 1907 | 1920 | attacks = (int)( (float)ParamData.attacks / ((float)ParamData.burst/2) ); |
| 1921 | + ontargetcnt = 1.0f / ((float)ParamData.burst/2); | |
| 1908 | 1922 | |
| 1909 | 1923 | //さらに誤差を増やして拡散させる |
| 1910 | 1924 | int len; |
| @@ -1914,8 +1928,9 @@ | ||
| 1914 | 1928 | ry2 = ry + sin(a)*len * DegreeToRadian(0.15f); |
| 1915 | 1929 | } |
| 1916 | 1930 | else{ |
| 1917 | - //そのまま攻撃力へ反映 | |
| 1931 | + //そのまま攻撃力と命中時のカウント数を反映 | |
| 1918 | 1932 | attacks = ParamData.attacks; |
| 1933 | + ontargetcnt = 1.0f; | |
| 1919 | 1934 | |
| 1920 | 1935 | //発射誤差はそのまま |
| 1921 | 1936 | rx2 = rx; |
| @@ -1928,7 +1943,7 @@ | ||
| 1928 | 1943 | |
| 1929 | 1944 | //銃弾を発射 |
| 1930 | 1945 | newbullet->SetPosData(pos_x, pos_y + WEAPONSHOT_HEIGHT, pos_z, rx2, ry2); |
| 1931 | - newbullet->SetParamData(attacks, ParamData.penetration, ParamData.speed * BULLET_SPEEDSCALE, teamid, human_id, true); | |
| 1946 | + newbullet->SetParamData(attacks, ParamData.penetration, ParamData.speed * BULLET_SPEEDSCALE, teamid, human_id, ontargetcnt, true); | |
| 1932 | 1947 | newbullet->SetEnableFlag(true); |
| 1933 | 1948 | |
| 1934 | 1949 | //対人判定用リスト初期化 |
| @@ -1947,7 +1962,7 @@ | ||
| 1947 | 1962 | |
| 1948 | 1963 | //手榴弾発射 |
| 1949 | 1964 | newgrenade->SetPosData(pos_x, pos_y + WEAPONSHOT_HEIGHT, pos_z, rx, ry); |
| 1950 | - newgrenade->SetParamData(8.0f, teamid, human_id, true); | |
| 1965 | + newgrenade->SetParamData(8.0f, teamid, human_id, 1.0f, true); | |
| 1951 | 1966 | newgrenade->SetEnableFlag(true); |
| 1952 | 1967 | } |
| 1953 | 1968 |
| @@ -2207,7 +2222,7 @@ | ||
| 2207 | 2222 | if( MyHuman->GetEnableFlag() == false ){ return false; } |
| 2208 | 2223 | if( MyHuman->GetHP() <= 0 ){ return false; } |
| 2209 | 2224 | if( EnemyHuman->GetEnableFlag() == false ){ return false; } |
| 2210 | - if( EnemyHuman->GetHP() <= 0 ){ return false; } | |
| 2225 | + if( EnemyHuman->GetDeadFlag() == true ){ return false; } | |
| 2211 | 2226 | |
| 2212 | 2227 | float mx, my, mz, mrx, tx, ty, tz; |
| 2213 | 2228 | int mteam, tteam; |
| @@ -2250,7 +2265,7 @@ | ||
| 2250 | 2265 | |
| 2251 | 2266 | //使用されていないか、死亡していれば処理しない。 |
| 2252 | 2267 | if( EnemyHuman->GetEnableFlag() == false ){ return; } |
| 2253 | - if( EnemyHuman->GetHP() <= 0 ){ return; } | |
| 2268 | + if( EnemyHuman->GetDeadFlag() == true ){ return; } | |
| 2254 | 2269 | |
| 2255 | 2270 | int MyHuman_dataID, MyHuman_TeamID; |
| 2256 | 2271 | int EnemyHuman_dataID, EnemyHuman_TeamID; |
| @@ -2260,6 +2275,7 @@ | ||
| 2260 | 2275 | int paramid; |
| 2261 | 2276 | HumanParameter Paraminfo; |
| 2262 | 2277 | bool NotRobot; |
| 2278 | + int hp_old; | |
| 2263 | 2279 | |
| 2264 | 2280 | //ゾンビ側と攻撃を受ける側チーム番号取得 |
| 2265 | 2281 | MyHuman->GetParamData(NULL, &MyHuman_dataID, NULL, &MyHuman_TeamID); |
| @@ -2282,6 +2298,9 @@ | ||
| 2282 | 2298 | NotRobot = true; |
| 2283 | 2299 | } |
| 2284 | 2300 | |
| 2301 | + //ダメージ計算前のHP取得 | |
| 2302 | + hp_old = EnemyHuman->GetHP(); | |
| 2303 | + | |
| 2285 | 2304 | //ダメージなどを計算 |
| 2286 | 2305 | EnemyHuman->HitZombieAttack(); |
| 2287 | 2306 |
| @@ -2309,7 +2328,7 @@ | ||
| 2309 | 2328 | GameSound->HitHuman(tx, ty, tz, MyHuman_TeamID); |
| 2310 | 2329 | |
| 2311 | 2330 | //ログ関係の処理 |
| 2312 | - if( EnemyHuman->GetHP() <= 0 ){ | |
| 2331 | + if( (hp_old > 0)&&(EnemyHuman->GetHP() <= 0) ){ | |
| 2313 | 2332 | //ダメージ計算前に hp>0 でかつ、計算後に hp <= 0 なら、今回死亡した。 |
| 2314 | 2333 | |
| 2315 | 2334 | int player_teamid; |
| @@ -2505,7 +2524,7 @@ | ||
| 2505 | 2524 | { |
| 2506 | 2525 | //このフレームの戦歴を初期化 |
| 2507 | 2526 | for(int i=0; i<MAX_HUMAN; i++){ |
| 2508 | - Human_ontarget[i] = 0; | |
| 2527 | + Human_ontarget[i] = 0.0f; | |
| 2509 | 2528 | Human_kill[i] = 0; |
| 2510 | 2529 | Human_headshot[i] = 0; |
| 2511 | 2530 | } |
| @@ -2582,7 +2601,7 @@ | ||
| 2582 | 2601 | |
| 2583 | 2602 | if( BulletIndex[i].GetEnableFlag() == true ){ |
| 2584 | 2603 | //弾の座標と角度を取得 |
| 2585 | - BulletIndex[i].GetParamData(NULL, NULL, &speed, &teamid, NULL); | |
| 2604 | + BulletIndex[i].GetParamData(NULL, NULL, &speed, &teamid, NULL, NULL); | |
| 2586 | 2605 | BulletIndex[i].GetPosData(&bx, &by, &bz, &brx, &bry); |
| 2587 | 2606 | mx = cos(brx)*cos(bry)*speed; |
| 2588 | 2607 | my = sin(bry)*speed; |
| @@ -2638,7 +2657,7 @@ | ||
| 2638 | 2657 | float x, y, z; |
| 2639 | 2658 | int teamid; |
| 2640 | 2659 | GrenadeIndex[i].GetPosData(&x, &y, &z, NULL, NULL); |
| 2641 | - GrenadeIndex[i].GetParamData(NULL, &teamid, NULL); | |
| 2660 | + GrenadeIndex[i].GetParamData(NULL, &teamid, NULL, NULL); | |
| 2642 | 2661 | GameSound->GrenadeBound(x, y, z, teamid); |
| 2643 | 2662 | } |
| 2644 | 2663 | } |
| @@ -2697,7 +2716,7 @@ | ||
| 2697 | 2716 | //! @param kill 倒した敵の数を受け取るポインタ |
| 2698 | 2717 | //! @param headshot 敵の頭部に命中した数を受け取るポインタ |
| 2699 | 2718 | //! @return 成功:true 失敗:false |
| 2700 | -bool ObjectManager::GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot) | |
| 2719 | +bool ObjectManager::GetHumanShotInfo(int id, float *ontarget, int *kill, int *headshot) | |
| 2701 | 2720 | { |
| 2702 | 2721 | if( (id < 0)||(MAX_HUMAN-1 < id) ){ return false; } |
| 2703 | 2722 | *ontarget = Human_ontarget[id]; |
| @@ -81,7 +81,7 @@ | ||
| 81 | 81 | |
| 82 | 82 | unsigned int framecnt; //!< フレーム数のカウント |
| 83 | 83 | |
| 84 | - int *Human_ontarget; //!< 命中数 | |
| 84 | + float *Human_ontarget; //!< 命中数 | |
| 85 | 85 | int *Human_kill; //!< 倒した敵の数 |
| 86 | 86 | int *Human_headshot; //!< 敵の頭部に命中した数 |
| 87 | 87 | bool *Human_ShotFlag; //!< 発砲フラグ(マズルフラッシュ用) |
| @@ -112,7 +112,7 @@ | ||
| 112 | 112 | bool CollideHuman(human *in_humanA, human *in_humanB); |
| 113 | 113 | bool CollideBullet(bullet *in_bullet); |
| 114 | 114 | void HitBulletMap(float x, float y, float z, int teamID); |
| 115 | - void HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int humanid); | |
| 115 | + void HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int humanid, float ontargetcnt); | |
| 116 | 116 | void HitBulletSmallObject(int HitSmallObject_id, float x, float y, float z, int attacks, int teamID); |
| 117 | 117 | bool GrenadeExplosion(grenade *in_grenade); |
| 118 | 118 | void DeadEffect(human *in_human); |
| @@ -169,7 +169,7 @@ | ||
| 169 | 169 | int CheckGameOverorComplete(); |
| 170 | 170 | bool GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr); |
| 171 | 171 | int Process(int cmdF5id, bool demomode, float camera_rx, float camera_ry, bool screen); |
| 172 | - bool GetHumanShotInfo(int id, int *ontarget, int *kill, int *headshot); | |
| 172 | + bool GetHumanShotInfo(int id, float *ontarget, int *kill, int *headshot); | |
| 173 | 173 | void Render(float camera_x, float camera_y, float camera_z, int HidePlayer); |
| 174 | 174 | void RenderLog(int x, int y); |
| 175 | 175 | void Cleanup(); |