X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 350 (tree) |
|---|---|
| Time | 2023-02-05 21:27:23 |
| Author | |
弾丸管理クラス(bullet)の弾速をint型からfloat型に変更、弾の当たり判定を修正
| @@ -2773,10 +2773,10 @@ | ||
| 2773 | 2773 | rotation_y = 0.0f; |
| 2774 | 2774 | attacks = 0; |
| 2775 | 2775 | penetration = 0; |
| 2776 | - speed = 0; | |
| 2776 | + speed = 0.0f; | |
| 2777 | 2777 | teamid = 0; |
| 2778 | 2778 | humanid = 0; |
| 2779 | - ontargetcnt = 0; | |
| 2779 | + ontargetcnt = 0.0f; | |
| 2780 | 2780 | cnt = 0; |
| 2781 | 2781 | } |
| 2782 | 2782 |
| @@ -2807,7 +2807,7 @@ | ||
| 2807 | 2807 | //! @param _humanid 人のデータ番号 |
| 2808 | 2808 | //! @param _ontargetcnt 命中時のカウント数 |
| 2809 | 2809 | //! @param init オブジェクトを初期化 |
| 2810 | -void bullet::SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, float _ontargetcnt, bool init) | |
| 2810 | +void bullet::SetParamData(int _attacks, int _penetration, float _speed, int _teamid, int _humanid, float _ontargetcnt, bool init) | |
| 2811 | 2811 | { |
| 2812 | 2812 | attacks = _attacks; |
| 2813 | 2813 | penetration = _penetration; |
| @@ -2843,7 +2843,7 @@ | ||
| 2843 | 2843 | //! @param _teamid チーム番号を受け取るポインタ(NULL可) |
| 2844 | 2844 | //! @param _humanid 人のデータ番号を受け取るポインタ(NULL可) |
| 2845 | 2845 | //! @param _ontargetcnt 命中時のカウント数を受け取るポインタ(NULL可) |
| 2846 | -void bullet::GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid, float *_ontargetcnt) | |
| 2846 | +void bullet::GetParamData(int *_attacks, int *_penetration, float *_speed, int *_teamid, int *_humanid, float *_ontargetcnt) | |
| 2847 | 2847 | { |
| 2848 | 2848 | if( _attacks != NULL ){ *_attacks = attacks; } |
| 2849 | 2849 | if( _penetration != NULL ){ *_penetration = penetration; } |
| @@ -303,7 +303,7 @@ | ||
| 303 | 303 | float rotation_y; //!< 回転角度 |
| 304 | 304 | int attacks; //!< 攻撃力 |
| 305 | 305 | int penetration; //!< 貫通力 |
| 306 | - int speed; //!< 弾速 | |
| 306 | + float speed; //!< 弾速 | |
| 307 | 307 | int teamid; //!< チーム番号 |
| 308 | 308 | int humanid; //!< 人のデータ番号 |
| 309 | 309 | float ontargetcnt; //!< 命中時のカウント数 |
| @@ -313,9 +313,9 @@ | ||
| 313 | 313 | bullet(int modelid = -1, int textureid = -1); |
| 314 | 314 | ~bullet(); |
| 315 | 315 | virtual void SetPosData(float x, float y, float z, float rx, float ry); |
| 316 | - virtual void SetParamData(int _attacks, int _penetration, int _speed, int _teamid, int _humanid, float _ontargetcnt, bool init); | |
| 316 | + virtual void SetParamData(int _attacks, int _penetration, float _speed, int _teamid, int _humanid, float _ontargetcnt, bool init); | |
| 317 | 317 | virtual void GetPosData(float *x, float *y, float *z, float *rx, float *ry); |
| 318 | - virtual void GetParamData(int *_attacks, int *_penetration, int *_speed, int *_teamid, int *_humanid, float *_ontargetcnt); | |
| 318 | + virtual void GetParamData(int *_attacks, int *_penetration, float *_speed, int *_teamid, int *_humanid, float *_ontargetcnt); | |
| 319 | 319 | virtual int ProcessObject(); |
| 320 | 320 | virtual void Render(class D3DGraphics *d3dg, bool NoModel); |
| 321 | 321 | }; |
| @@ -682,7 +682,7 @@ | ||
| 682 | 682 | float brx, bry; |
| 683 | 683 | int attacks; |
| 684 | 684 | int penetration; |
| 685 | - int speed; | |
| 685 | + float speed; | |
| 686 | 686 | int teamid; |
| 687 | 687 | int humanid; |
| 688 | 688 | float ontargetcnt; |
| @@ -703,12 +703,12 @@ | ||
| 703 | 703 | vz = sinf(brx)*cosf(bry); |
| 704 | 704 | |
| 705 | 705 | //マップとの当たり判定(弾道上にブロックがあるか) |
| 706 | - if( CollD->CheckALLBlockIntersectRay(bx, by, bz, vx, vy, vz, NULL, NULL, &Dist, (float)speed) == true ){ | |
| 706 | + if( CollD->CheckALLBlockIntersectRay(bx, by, bz, vx, vy, vz, NULL, NULL, &Dist, speed) == true ){ | |
| 707 | 707 | mapflag = 1; |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // BULLET_SPEEDSCALE定数 の分解能を算出 |
| 711 | - int maxcnt = (int)ceilf(speed / BULLET_SPEEDSCALE); | |
| 711 | + int maxcnt = (int)roundf(speed / BULLET_SPEEDSCALE); | |
| 712 | 712 | |
| 713 | 713 | // BULLET_SPEEDSCALE定数 の分解能で当たり判定 |
| 714 | 714 | for(int cnt=0; cnt<maxcnt; cnt++){ |
| @@ -720,9 +720,9 @@ | ||
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | float bvx, bvy, bvz; |
| 723 | - bvx = bx + vx * BULLET_SPEEDSCALE * cnt; | |
| 724 | - bvy = by + vy * BULLET_SPEEDSCALE * cnt; | |
| 725 | - bvz = bz + vz * BULLET_SPEEDSCALE * cnt; | |
| 723 | + bvx = bx + vx * BULLET_SPEEDSCALE * (cnt+1); | |
| 724 | + bvy = by + vy * BULLET_SPEEDSCALE * (cnt+1); | |
| 725 | + bvz = bz + vz * BULLET_SPEEDSCALE * (cnt+1); | |
| 726 | 726 | |
| 727 | 727 | //人との当たり判定 |
| 728 | 728 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -2015,7 +2015,7 @@ | ||
| 2015 | 2015 | |
| 2016 | 2016 | //銃弾を発射 |
| 2017 | 2017 | newbullet->SetPosData(pos_x, pos_y + WEAPONSHOT_HEIGHT, pos_z, rx2, ry2); |
| 2018 | - newbullet->SetParamData(attacks, ParamData.penetration, (int)((float)ParamData.speed * BULLET_SPEEDSCALE), teamid, human_id, ontargetcnt, true); | |
| 2018 | + newbullet->SetParamData(attacks, ParamData.penetration, (float)ParamData.speed * BULLET_SPEEDSCALE, teamid, human_id, ontargetcnt, true); | |
| 2019 | 2019 | newbullet->SetEnableFlag(true); |
| 2020 | 2020 | |
| 2021 | 2021 | //対人判定用リスト初期化 |
| @@ -2763,8 +2763,8 @@ | ||
| 2763 | 2763 | if( demomode == false ){ |
| 2764 | 2764 | //弾オブジェクトの処理 |
| 2765 | 2765 | for(int i=0; i<MAX_BULLET; i++){ |
| 2766 | - float bx, by, bz, brx, bry; | |
| 2767 | - int speed, teamid; | |
| 2766 | + float bx, by, bz, brx, bry, speed; | |
| 2767 | + int teamid; | |
| 2768 | 2768 | float mx, my, mz; |
| 2769 | 2769 | |
| 2770 | 2770 | CollideBullet(&BulletIndex[i]); //当たり判定を実行 |