X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 140 (tree) |
|---|---|
| Time | 2016-08-15 04:07:42 |
| Author | |
人のチーム番号を負数に設定した際のバグ(仕様)を再現、範囲外の武器を用いた処理を定数で無効化できるように。(標準では有効)
| @@ -104,9 +104,9 @@ | ||
| 104 | 104 | void SetHumanBlood(float x, float y, float z, int damage, bool CollideMap); |
| 105 | 105 | bool CollideHuman(human *in_humanA, human *in_humanB); |
| 106 | 106 | bool CollideBullet(bullet *in_bullet); |
| 107 | - void HitBulletMap(float x, float y, float z); | |
| 107 | + void HitBulletMap(float x, float y, float z, int teamID); | |
| 108 | 108 | void HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int humanid); |
| 109 | - void HitBulletSmallObject(int HitSmallObject_id, float x, float y, float z, int attacks); | |
| 109 | + void HitBulletSmallObject(int HitSmallObject_id, float x, float y, float z, int attacks, int teamID); | |
| 110 | 110 | bool GrenadeExplosion(grenade *in_grenade); |
| 111 | 111 | void DeadEffect(human *in_human); |
| 112 | 112 | bool CollideBlood(effect *in_effect, int *id, int *face, float *pos_x, float *pos_y, float *pos_z); |
| @@ -156,7 +156,7 @@ | ||
| 156 | 156 | bool CheatAddBullet(int human_id); |
| 157 | 157 | bool CheatNewWeapon(int human_id, int new_weaponID); |
| 158 | 158 | bool CheckZombieAttack(human* MyHuman, human* EnemyHuman); |
| 159 | - void HitZombieAttack(human* EnemyHuman); | |
| 159 | + void HitZombieAttack(human* MyHuman, human* EnemyHuman); | |
| 160 | 160 | bool HumanResuscitation(int id); |
| 161 | 161 | int CheckGameOverorComplete(); |
| 162 | 162 | bool GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr); |
| @@ -207,6 +207,7 @@ | ||
| 207 | 207 | virtual void HitBulletLeg(int attacks); |
| 208 | 208 | virtual void HitZombieAttack(); |
| 209 | 209 | virtual void HitGrenadeExplosion(int attacks); |
| 210 | + virtual void SetHitFlag(); | |
| 210 | 211 | virtual bool CheckHit(); |
| 211 | 212 | virtual float GetTotalMove(); |
| 212 | 213 | virtual int RunFrame(class Collision *CollD, class BlockDataInterface *inblockdata, bool F5mode); |
| @@ -308,7 +309,8 @@ | ||
| 308 | 309 | public: |
| 309 | 310 | grenade(int modelid = -1, int textureid = -1); |
| 310 | 311 | ~grenade(); |
| 311 | - void SetParamData(float speed, int _humanid, bool init); | |
| 312 | + void SetParamData(float speed, int _teamid, int _humanid, bool init); | |
| 313 | + void GetParamData(float *_speed, int *_teamid, int *_humanid); | |
| 312 | 314 | float GetSpeed(); |
| 313 | 315 | int RunFrame(class Collision *CollD); |
| 314 | 316 | virtual void Render(D3DGraphics *d3dg); |
| @@ -42,7 +42,9 @@ | ||
| 42 | 42 | HumanTexturePath[i] = '\0'; |
| 43 | 43 | } |
| 44 | 44 | Weapon = NULL; |
| 45 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 45 | 46 | BugWeapon = NULL; |
| 47 | +#endif | |
| 46 | 48 | SmallObject = NULL; |
| 47 | 49 | Bullet = NULL; |
| 48 | 50 | for(int i=0; i<TOTAL_OFFICIALMISSION; i++){ |
| @@ -71,7 +73,9 @@ | ||
| 71 | 73 | |
| 72 | 74 | Human = new HumanParameter[TOTAL_PARAMETERINFO_HUMAN]; |
| 73 | 75 | Weapon = new WeaponParameter[TOTAL_PARAMETERINFO_WEAPON]; |
| 76 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 74 | 77 | BugWeapon = new WeaponParameter[1]; |
| 78 | +#endif | |
| 75 | 79 | SmallObject = new SmallObjectParameter[TOTAL_PARAMETERINFO_SMALLOBJECT]; |
| 76 | 80 | Bullet = new BulletParameter[TOTAL_PARAMETERINFO_BULLET]; |
| 77 | 81 | AIlevel = new AIParameter[TOTAL_PARAMETERINFO_AILEVEL]; |
| @@ -1190,6 +1194,7 @@ | ||
| 1190 | 1194 | Weapon[22].ChangeWeapon = -1; |
| 1191 | 1195 | Weapon[22].burst = 1; |
| 1192 | 1196 | |
| 1197 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 1193 | 1198 | //特殊なバグ武器用データ |
| 1194 | 1199 | BugWeapon[0].name = "BugWeapon"; |
| 1195 | 1200 | BugWeapon[0].model = ""; |
| @@ -1223,6 +1228,7 @@ | ||
| 1223 | 1228 | BugWeapon[0].WeaponP = 1; |
| 1224 | 1229 | BugWeapon[0].ChangeWeapon = -1; |
| 1225 | 1230 | BugWeapon[0].burst = 0; |
| 1231 | +#endif | |
| 1226 | 1232 | |
| 1227 | 1233 | |
| 1228 | 1234 | //缶 |
| @@ -1603,10 +1609,12 @@ | ||
| 1603 | 1609 | delete [] Weapon; |
| 1604 | 1610 | Weapon = NULL; |
| 1605 | 1611 | } |
| 1612 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 1606 | 1613 | if( BugWeapon != NULL ){ |
| 1607 | 1614 | delete [] BugWeapon; |
| 1608 | 1615 | BugWeapon = NULL; |
| 1609 | 1616 | } |
| 1617 | +#endif | |
| 1610 | 1618 | if( SmallObject != NULL ){ |
| 1611 | 1619 | delete [] SmallObject; |
| 1612 | 1620 | SmallObject = NULL; |
| @@ -1657,7 +1665,11 @@ | ||
| 1657 | 1665 | int ParameterInfo::GetWeapon(int id, WeaponParameter *out_data) |
| 1658 | 1666 | { |
| 1659 | 1667 | if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ |
| 1668 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 1660 | 1669 | return GetBugWeapon(id, out_data); |
| 1670 | +#else | |
| 1671 | + return 1; | |
| 1672 | +#endif | |
| 1661 | 1673 | } |
| 1662 | 1674 | |
| 1663 | 1675 | *out_data = Weapon[id]; |
| @@ -1664,6 +1676,7 @@ | ||
| 1664 | 1676 | return 0; |
| 1665 | 1677 | } |
| 1666 | 1678 | |
| 1679 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 1667 | 1680 | //! @brief 武器の設定を取得 |
| 1668 | 1681 | //! @param id 番号 |
| 1669 | 1682 | //! @param out_data 受け取るWeaponParameter型ポインタ |
| @@ -1679,6 +1692,7 @@ | ||
| 1679 | 1692 | |
| 1680 | 1693 | return 1; |
| 1681 | 1694 | } |
| 1695 | +#endif | |
| 1682 | 1696 | |
| 1683 | 1697 | |
| 1684 | 1698 | //! @brief 小物の設定を取得 |
| @@ -103,8 +103,9 @@ | ||
| 103 | 103 | //! @param x 音源のX座標 |
| 104 | 104 | //! @param y 音源のY座標 |
| 105 | 105 | //! @param z 音源のZ座標 |
| 106 | +//! @param teamID チーム番号 | |
| 106 | 107 | //! @return 成功:true 失敗:false |
| 107 | -bool SoundManager::HitMap(float x, float y, float z) | |
| 108 | +bool SoundManager::HitMap(float x, float y, float z, int teamID) | |
| 108 | 109 | { |
| 109 | 110 | soundlist *plist = NULL; |
| 110 | 111 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -113,6 +114,7 @@ | ||
| 113 | 114 | plist->x = x; |
| 114 | 115 | plist->y = y; |
| 115 | 116 | plist->z = z; |
| 117 | + plist->teamid = teamID; | |
| 116 | 118 | |
| 117 | 119 | return true; |
| 118 | 120 | } |
| @@ -121,8 +123,9 @@ | ||
| 121 | 123 | //! @param x 音源のX座標 |
| 122 | 124 | //! @param y 音源のY座標 |
| 123 | 125 | //! @param z 音源のZ座標 |
| 126 | +//! @param teamID チーム番号 | |
| 124 | 127 | //! @return 成功:true 失敗:false |
| 125 | -bool SoundManager::HitHuman(float x, float y, float z) | |
| 128 | +bool SoundManager::HitHuman(float x, float y, float z, int teamID) | |
| 126 | 129 | { |
| 127 | 130 | soundlist *plist = NULL; |
| 128 | 131 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -131,6 +134,7 @@ | ||
| 131 | 134 | plist->x = x; |
| 132 | 135 | plist->y = y; |
| 133 | 136 | plist->z = z; |
| 137 | + plist->teamid = teamID; | |
| 134 | 138 | |
| 135 | 139 | return true; |
| 136 | 140 | } |
| @@ -140,8 +144,9 @@ | ||
| 140 | 144 | //! @param y 音源のY座標 |
| 141 | 145 | //! @param z 音源のZ座標 |
| 142 | 146 | //! @param id 小物の種類番号 |
| 147 | +//! @param teamID チーム番号 | |
| 143 | 148 | //! @return 成功:true 失敗:false |
| 144 | -bool SoundManager::HitSmallObject(float x, float y, float z, int id) | |
| 149 | +bool SoundManager::HitSmallObject(float x, float y, float z, int id, int teamID) | |
| 145 | 150 | { |
| 146 | 151 | soundlist *plist = NULL; |
| 147 | 152 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -151,6 +156,7 @@ | ||
| 151 | 156 | plist->x = x; |
| 152 | 157 | plist->y = y; |
| 153 | 158 | plist->z = z; |
| 159 | + plist->teamid = teamID; | |
| 154 | 160 | |
| 155 | 161 | return true; |
| 156 | 162 | } |
| @@ -186,8 +192,9 @@ | ||
| 186 | 192 | //! @param x 音源のX座標 |
| 187 | 193 | //! @param y 音源のY座標 |
| 188 | 194 | //! @param z 音源のZ座標 |
| 195 | +//! @param teamID チーム番号 | |
| 189 | 196 | //! @return 成功:true 失敗:false |
| 190 | -bool SoundManager::GrenadeBound(float x, float y, float z) | |
| 197 | +bool SoundManager::GrenadeBound(float x, float y, float z, int teamID) | |
| 191 | 198 | { |
| 192 | 199 | soundlist *plist = NULL; |
| 193 | 200 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -196,6 +203,7 @@ | ||
| 196 | 203 | plist->x = x; |
| 197 | 204 | plist->y = y; |
| 198 | 205 | plist->z = z; |
| 206 | + plist->teamid = teamID; | |
| 199 | 207 | |
| 200 | 208 | return true; |
| 201 | 209 | } |
| @@ -204,8 +212,9 @@ | ||
| 204 | 212 | //! @param x 音源のX座標 |
| 205 | 213 | //! @param y 音源のY座標 |
| 206 | 214 | //! @param z 音源のZ座標 |
| 215 | +//! @param teamID チーム番号 | |
| 207 | 216 | //! @return 成功:true 失敗:false |
| 208 | -bool SoundManager::GrenadeExplosion(float x, float y, float z) | |
| 217 | +bool SoundManager::GrenadeExplosion(float x, float y, float z, int teamID) | |
| 209 | 218 | { |
| 210 | 219 | soundlist *plist = NULL; |
| 211 | 220 | if( GetNewList(&plist) == false ){ return false; } |
| @@ -214,6 +223,7 @@ | ||
| 214 | 223 | plist->x = x; |
| 215 | 224 | plist->y = y; |
| 216 | 225 | plist->z = z; |
| 226 | + plist->teamid = teamID; | |
| 217 | 227 | |
| 218 | 228 | return true; |
| 219 | 229 | } |
| @@ -298,6 +308,15 @@ | ||
| 298 | 308 | continue; |
| 299 | 309 | } |
| 300 | 310 | |
| 311 | +#ifdef ENABLE_BUG_TEAMID | |
| 312 | + //チーム番号が負数、かつ音源のチーム番号が大きいなら、音源を無視 | |
| 313 | + if( (teamID < 0)&&(getlist[i].teamid < 0) ){ | |
| 314 | + if( teamID < getlist[i].teamid ){ | |
| 315 | + continue; | |
| 316 | + } | |
| 317 | + } | |
| 318 | +#endif | |
| 319 | + | |
| 301 | 320 | //銃弾ならば |
| 302 | 321 | if( getlist[i].paramid == BULLET ){ |
| 303 | 322 | float min_x, min_y, min_z; |
| @@ -688,7 +688,7 @@ | ||
| 688 | 688 | |
| 689 | 689 | if( actioncnt%50 == 0){ |
| 690 | 690 | if( ObjMgr->CheckZombieAttack(ctrlhuman, EnemyHuman) == true ){ |
| 691 | - ObjMgr->HitZombieAttack(EnemyHuman); | |
| 691 | + ObjMgr->HitZombieAttack(ctrlhuman, EnemyHuman); | |
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | } |
| @@ -99,7 +99,9 @@ | ||
| 99 | 99 | void CleanupHumanTexture(); |
| 100 | 100 | int LoadWeaponModelTexture(); |
| 101 | 101 | int GetWeaponModelTexture(int id, int *model, int *texture); |
| 102 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 102 | 103 | int GetBugWeaponModelTexture(int id, int *model, int *texture); |
| 104 | +#endif | |
| 103 | 105 | void CleanupWeaponModelTexture(); |
| 104 | 106 | int LoadWeaponSound(); |
| 105 | 107 | int GetWeaponSound(int id); |
| @@ -153,6 +153,12 @@ | ||
| 153 | 153 | Weapon[i] = NULL; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | +#ifndef ENABLE_BUG_HUMANWEAPON | |
| 157 | + if( GetHumanFlag != 0 ){ | |
| 158 | + return -1; | |
| 159 | + } | |
| 160 | +#endif | |
| 161 | + | |
| 156 | 162 | //人のモデル番号を取得 |
| 157 | 163 | int upmodel[TOTAL_UPMODE]; |
| 158 | 164 | int armmodel[TOTAL_ARMMODE]; |
| @@ -177,8 +183,10 @@ | ||
| 177 | 183 | HumanIndex[j].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel); |
| 178 | 184 | } |
| 179 | 185 | else{ |
| 186 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 180 | 187 | HumanIndex[j].SetTexture(d3dg->GetMapTextureID(0)); |
| 181 | 188 | HumanIndex[j].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel); |
| 189 | +#endif | |
| 182 | 190 | } |
| 183 | 191 | HumanIndex[j].SetEnableFlag(true); |
| 184 | 192 | Humanindexid = j; |
| @@ -245,6 +253,12 @@ | ||
| 245 | 253 | Weapon[i] = NULL; |
| 246 | 254 | } |
| 247 | 255 | |
| 256 | +#ifndef ENABLE_BUG_HUMANWEAPON | |
| 257 | + if( GetHumanFlag != 0 ){ | |
| 258 | + return -1; | |
| 259 | + } | |
| 260 | +#endif | |
| 261 | + | |
| 248 | 262 | //人のモデル番号を取得 |
| 249 | 263 | int upmodel[TOTAL_UPMODE]; |
| 250 | 264 | int armmodel[TOTAL_ARMMODE]; |
| @@ -269,8 +283,10 @@ | ||
| 269 | 283 | HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel); |
| 270 | 284 | } |
| 271 | 285 | else{ |
| 286 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 272 | 287 | HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0)); |
| 273 | 288 | HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel); |
| 289 | +#endif | |
| 274 | 290 | } |
| 275 | 291 | HumanIndex[i].SetEnableFlag(true); |
| 276 | 292 | Humanindexid = i; |
| @@ -744,7 +760,7 @@ | ||
| 744 | 760 | //マップとの衝突距離が最短ならば〜 |
| 745 | 761 | if( (map_Dist <= speed)&&(map_Dist < HumanHead_Dist)&&(map_Dist < HumanUp_Dist)&&(map_Dist < HumanLeg_Dist)&&(map_Dist < SmallObject_Dist) ){ |
| 746 | 762 | //弾がマップに当たった処理 |
| 747 | - HitBulletMap(bx + vx*(map_Dist+TotalDist), by + vy*(map_Dist+TotalDist), bz + vz*(map_Dist+TotalDist)); | |
| 763 | + HitBulletMap(bx + vx*(map_Dist+TotalDist), by + vy*(map_Dist+TotalDist), bz + vz*(map_Dist+TotalDist), teamid); | |
| 748 | 764 | |
| 749 | 765 | int Penetration_Dist; |
| 750 | 766 |
| @@ -816,7 +832,7 @@ | ||
| 816 | 832 | //小物との衝突距離が最短ならば〜 |
| 817 | 833 | if( (SmallObject_Dist <= speed)&&(SmallObject_Dist < map_Dist)&&(SmallObject_Dist < HumanHead_Dist)&&(SmallObject_Dist < HumanUp_Dist)&&(SmallObject_Dist < HumanLeg_Dist) ){ |
| 818 | 834 | //小物に当たった処理 |
| 819 | - HitBulletSmallObject(SmallObject_id, bx + vx*(SmallObject_Dist+TotalDist), by + vy*(SmallObject_Dist+TotalDist), bz + vz*(SmallObject_Dist+TotalDist), attacks); | |
| 835 | + HitBulletSmallObject(SmallObject_id, bx + vx*(SmallObject_Dist+TotalDist), by + vy*(SmallObject_Dist+TotalDist), bz + vz*(SmallObject_Dist+TotalDist), attacks, teamid); | |
| 820 | 836 | |
| 821 | 837 | //小物の種類番号を取得 |
| 822 | 838 | int id; |
| @@ -852,13 +868,14 @@ | ||
| 852 | 868 | //! @param x 着弾X座標 |
| 853 | 869 | //! @param y 着弾Y座標 |
| 854 | 870 | //! @param z 着弾Z座標 |
| 855 | -void ObjectManager::HitBulletMap(float x, float y, float z) | |
| 871 | +//! @param teamID 発射元のチーム番号 | |
| 872 | +void ObjectManager::HitBulletMap(float x, float y, float z, int teamID) | |
| 856 | 873 | { |
| 857 | 874 | //エフェクト(煙)を表示 |
| 858 | 875 | AddEffect(x, y, z, 0.0f, 0.05f, 0.0f, 5.0f, DegreeToRadian(10)*GetRand(18), (int)(GAMEFPS * 0.5f), Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_MAGNIFY); |
| 859 | 876 | |
| 860 | 877 | //効果音を再生 |
| 861 | - GameSound->HitMap(x, y, z); | |
| 878 | + GameSound->HitMap(x, y, z, teamID); | |
| 862 | 879 | } |
| 863 | 880 | |
| 864 | 881 | //! @brief 弾が人に当たった処理 |
| @@ -872,6 +889,7 @@ | ||
| 872 | 889 | //! @param Shothuman_id 発射した人の番号 |
| 873 | 890 | void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id) |
| 874 | 891 | { |
| 892 | + int Shothuman_TeamID; | |
| 875 | 893 | int damage = 0; |
| 876 | 894 | int paramid; |
| 877 | 895 | HumanParameter Paraminfo; |
| @@ -881,6 +899,9 @@ | ||
| 881 | 899 | if( HumanIndex[HitHuman_id].GetEnableFlag() == false ){ return; } |
| 882 | 900 | if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ return; } |
| 883 | 901 | |
| 902 | + //発射元のチーム番号取得 | |
| 903 | + HumanIndex[Shothuman_id].GetParamData(NULL, NULL, NULL, &Shothuman_TeamID); | |
| 904 | + | |
| 884 | 905 | //人にダメージと衝撃を与える |
| 885 | 906 | if( Hit_id == 0 ){ HumanIndex[HitHuman_id].HitBulletHead(attacks); } |
| 886 | 907 | if( Hit_id == 1 ){ HumanIndex[HitHuman_id].HitBulletUp(attacks); } |
| @@ -887,6 +908,25 @@ | ||
| 887 | 908 | if( Hit_id == 2 ){ HumanIndex[HitHuman_id].HitBulletLeg(attacks); } |
| 888 | 909 | HumanIndex[HitHuman_id].AddPosOrder(brx, 0.0f, 1.0f); |
| 889 | 910 | |
| 911 | +#ifdef ENABLE_BUG_TEAMID | |
| 912 | + int HitHuman_TeamID; | |
| 913 | + bool flag = true; | |
| 914 | + HumanIndex[HitHuman_id].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 915 | + | |
| 916 | + //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 | |
| 917 | + if( (HitHuman_TeamID < 0)&&(Shothuman_TeamID < 0) ){ | |
| 918 | + if( HitHuman_TeamID < Shothuman_TeamID ){ | |
| 919 | + flag = false; | |
| 920 | + } | |
| 921 | + } | |
| 922 | + | |
| 923 | + if( flag == true ){ | |
| 924 | + HumanIndex[HitHuman_id].SetHitFlag(); | |
| 925 | + } | |
| 926 | +#else | |
| 927 | + HumanIndex[HitHuman_id].SetHitFlag(); | |
| 928 | +#endif | |
| 929 | + | |
| 890 | 930 | //ロボットかどうか判定 |
| 891 | 931 | HumanIndex[HitHuman_id].GetParamData(¶mid, NULL, NULL, NULL); |
| 892 | 932 | GameParamInfo->GetHuman(paramid, &Paraminfo); |
| @@ -904,7 +944,7 @@ | ||
| 904 | 944 | SetHumanBlood(x, y, z, damage, NotRobot); |
| 905 | 945 | |
| 906 | 946 | //効果音を再生 |
| 907 | - GameSound->HitHuman(x, y, z); | |
| 947 | + GameSound->HitHuman(x, y, z, Shothuman_TeamID); | |
| 908 | 948 | |
| 909 | 949 | //弾を発射した人の成果に加算 |
| 910 | 950 | Human_ontarget[Shothuman_id] += 1; |
| @@ -920,7 +960,8 @@ | ||
| 920 | 960 | //! @param y 着弾Y座標 |
| 921 | 961 | //! @param z 着弾Z座標 |
| 922 | 962 | //! @param attacks 攻撃力 |
| 923 | -void ObjectManager::HitBulletSmallObject(int HitSmallObject_id, float x, float y, float z, int attacks) | |
| 963 | +//! @param teamID 発射元のチーム番号 | |
| 964 | +void ObjectManager::HitBulletSmallObject(int HitSmallObject_id, float x, float y, float z, int attacks, int teamID) | |
| 924 | 965 | { |
| 925 | 966 | int hp; |
| 926 | 967 |
| @@ -940,7 +981,7 @@ | ||
| 940 | 981 | //効果音を再生 |
| 941 | 982 | int id; |
| 942 | 983 | SmallObjectIndex[HitSmallObject_id].GetParamData(&id, NULL); |
| 943 | - GameSound->HitSmallObject(x, y, z, id); | |
| 984 | + GameSound->HitSmallObject(x, y, z, id, teamID); | |
| 944 | 985 | } |
| 945 | 986 | |
| 946 | 987 | //! @brief 手榴弾のダメージ判定と処理 |
| @@ -954,9 +995,9 @@ | ||
| 954 | 995 | |
| 955 | 996 | //座標を取得 |
| 956 | 997 | float gx, gy, gz; |
| 957 | - int humanid; | |
| 998 | + int teamid, humanid; | |
| 958 | 999 | in_grenade->GetPosData(&gx, &gy, &gz, NULL, NULL); |
| 959 | - in_grenade->GetParamData(NULL, NULL, NULL, NULL, &humanid); | |
| 1000 | + in_grenade->GetParamData(NULL, &teamid, &humanid); | |
| 960 | 1001 | |
| 961 | 1002 | //人に爆風の当たり判定 |
| 962 | 1003 | for(int i=0; i<MAX_HUMAN; i++){ |
| @@ -1009,6 +1050,25 @@ | ||
| 1009 | 1050 | //ダメージを反映 |
| 1010 | 1051 | HumanIndex[i].HitGrenadeExplosion(total_damage); |
| 1011 | 1052 | |
| 1053 | +#ifdef ENABLE_BUG_TEAMID | |
| 1054 | + int HitHuman_TeamID; | |
| 1055 | + bool flag = true; | |
| 1056 | + HumanIndex[i].GetParamData(NULL, NULL, NULL, &HitHuman_TeamID); | |
| 1057 | + | |
| 1058 | + //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 | |
| 1059 | + if( (HitHuman_TeamID < 0)&&(teamid < 0) ){ | |
| 1060 | + if( HitHuman_TeamID < teamid ){ | |
| 1061 | + flag = false; | |
| 1062 | + } | |
| 1063 | + } | |
| 1064 | + | |
| 1065 | + if( flag == true ){ | |
| 1066 | + HumanIndex[i].SetHitFlag(); | |
| 1067 | + } | |
| 1068 | +#else | |
| 1069 | + HumanIndex[i].SetHitFlag(); | |
| 1070 | +#endif | |
| 1071 | + | |
| 1012 | 1072 | float y2; |
| 1013 | 1073 | float arx, ary; |
| 1014 | 1074 |
| @@ -1073,7 +1133,7 @@ | ||
| 1073 | 1133 | SmallObjectIndex[i].HitGrenadeExplosion(damage); |
| 1074 | 1134 | |
| 1075 | 1135 | //小物から効果音を発する |
| 1076 | - GameSound->HitSmallObject(sx, sy, sz, id); | |
| 1136 | + GameSound->HitSmallObject(sx, sy, sz, id, teamid); | |
| 1077 | 1137 | |
| 1078 | 1138 | returnflag = true; |
| 1079 | 1139 | } |
| @@ -1090,7 +1150,7 @@ | ||
| 1090 | 1150 | AddEffect(gx+1.0f, gy+1.0f, gz-1.0f, 0.1f, 0.2f, -0.1f, 50.0f, rnd*-1, (int)GAMEFPS * 3, Resource->GetEffectSmokeTexture(), EFFECT_DISAPPEAR | EFFECT_ROTATION | EFFECT_TRANSLUCENT); |
| 1091 | 1151 | |
| 1092 | 1152 | //効果音を再生 |
| 1093 | - GameSound->GrenadeExplosion(gx, gy, gz); | |
| 1153 | + GameSound->GrenadeExplosion(gx, gy, gz, teamid); | |
| 1094 | 1154 | |
| 1095 | 1155 | return returnflag; |
| 1096 | 1156 | } |
| @@ -1352,6 +1412,13 @@ | ||
| 1352 | 1412 | |
| 1353 | 1413 | GetHumanFlag = GameParamInfo->GetHuman(HumanID, &HumanParam); |
| 1354 | 1414 | |
| 1415 | +#ifndef ENABLE_BUG_HUMANWEAPON | |
| 1416 | + if( GetHumanFlag != 0 ){ | |
| 1417 | + HumanIndex[i].SetEnableFlag(false); | |
| 1418 | + continue; | |
| 1419 | + } | |
| 1420 | +#endif | |
| 1421 | + | |
| 1355 | 1422 | if( GetHumanFlag == 0 ){ |
| 1356 | 1423 | //人のテクスチャを登録 |
| 1357 | 1424 | Resource->AddHumanTexture(HumanID); |
| @@ -1366,8 +1433,10 @@ | ||
| 1366 | 1433 | HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel); |
| 1367 | 1434 | } |
| 1368 | 1435 | else{ |
| 1436 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 1369 | 1437 | HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0)); |
| 1370 | 1438 | HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel); |
| 1439 | +#endif | |
| 1371 | 1440 | } |
| 1372 | 1441 | } |
| 1373 | 1442 | } |
| @@ -1800,7 +1869,7 @@ | ||
| 1800 | 1869 | |
| 1801 | 1870 | //手榴弾発射 |
| 1802 | 1871 | newgrenade->SetPosData(pos_x, pos_y + WEAPONSHOT_HEIGHT, pos_z, rx, ry); |
| 1803 | - newgrenade->SetParamData(8.0f, human_id, true); | |
| 1872 | + newgrenade->SetParamData(8.0f, teamid, human_id, true); | |
| 1804 | 1873 | newgrenade->SetEnableFlag(true); |
| 1805 | 1874 | } |
| 1806 | 1875 |
| @@ -2095,8 +2164,9 @@ | ||
| 2095 | 2164 | } |
| 2096 | 2165 | |
| 2097 | 2166 | //! @brief ゾンビの攻撃を受けた処理 |
| 2167 | +//! @param MyHuman 攻撃する人オブジェクト(ゾンビ側)のポインタ | |
| 2098 | 2168 | //! @param EnemyHuman 攻撃を受けた人オブジェクトのポインタ |
| 2099 | -void ObjectManager::HitZombieAttack(human* EnemyHuman) | |
| 2169 | +void ObjectManager::HitZombieAttack(human* MyHuman, human* EnemyHuman) | |
| 2100 | 2170 | { |
| 2101 | 2171 | if( EnemyHuman == NULL ){ return; } |
| 2102 | 2172 |
| @@ -2104,11 +2174,15 @@ | ||
| 2104 | 2174 | if( EnemyHuman->GetEnableFlag() == false ){ return; } |
| 2105 | 2175 | if( EnemyHuman->GetHP() <= 0 ){ return; } |
| 2106 | 2176 | |
| 2177 | + int MyHuman_TeamID; | |
| 2107 | 2178 | float tx, ty, tz; |
| 2108 | 2179 | int paramid; |
| 2109 | 2180 | HumanParameter Paraminfo; |
| 2110 | 2181 | bool NotRobot; |
| 2111 | 2182 | |
| 2183 | + //ゾンビ側のチーム番号取得 | |
| 2184 | + MyHuman->GetParamData(NULL, NULL, NULL, &MyHuman_TeamID); | |
| 2185 | + | |
| 2112 | 2186 | EnemyHuman->GetPosData(&tx, &ty, &tz, NULL); |
| 2113 | 2187 | ty += VIEW_HEIGHT; |
| 2114 | 2188 |
| @@ -2125,11 +2199,30 @@ | ||
| 2125 | 2199 | //ダメージなどを計算 |
| 2126 | 2200 | EnemyHuman->HitZombieAttack(); |
| 2127 | 2201 | |
| 2202 | +#ifdef ENABLE_BUG_TEAMID | |
| 2203 | + int EnemyHuman_TeamID; | |
| 2204 | + bool flag = true; | |
| 2205 | + EnemyHuman->GetParamData(NULL, NULL, NULL, &EnemyHuman_TeamID); | |
| 2206 | + | |
| 2207 | + //チーム番号が負数、かつチーム番号が大きいなら、フラグ無効 | |
| 2208 | + if( (EnemyHuman_TeamID < 0)&&(MyHuman_TeamID < 0) ){ | |
| 2209 | + if( EnemyHuman_TeamID < MyHuman_TeamID ){ | |
| 2210 | + flag = false; | |
| 2211 | + } | |
| 2212 | + } | |
| 2213 | + | |
| 2214 | + if( flag == true ){ | |
| 2215 | + EnemyHuman->SetHitFlag(); | |
| 2216 | + } | |
| 2217 | +#else | |
| 2218 | + EnemyHuman->SetHitFlag(); | |
| 2219 | +#endif | |
| 2220 | + | |
| 2128 | 2221 | //エフェクト(血)を表示 |
| 2129 | 2222 | SetHumanBlood(tx, ty, tz, HUMAN_DAMAGE_ZOMBIEU, NotRobot); |
| 2130 | 2223 | |
| 2131 | 2224 | //効果音を再生 |
| 2132 | - GameSound->HitHuman(tx, ty, tz); | |
| 2225 | + GameSound->HitHuman(tx, ty, tz, MyHuman_TeamID); | |
| 2133 | 2226 | } |
| 2134 | 2227 | |
| 2135 | 2228 | //! @brief 死者を蘇生する |
| @@ -2418,8 +2511,10 @@ | ||
| 2418 | 2511 | if( speed > 3.4f ){ |
| 2419 | 2512 | //座標を取得し、効果音再生 |
| 2420 | 2513 | float x, y, z; |
| 2514 | + int teamid; | |
| 2421 | 2515 | GrenadeIndex[i].GetPosData(&x, &y, &z, NULL, NULL); |
| 2422 | - GameSound->GrenadeBound(x, y, z); | |
| 2516 | + GrenadeIndex[i].GetParamData(NULL, &teamid, NULL); | |
| 2517 | + GameSound->GrenadeBound(x, y, z, teamid); | |
| 2423 | 2518 | } |
| 2424 | 2519 | } |
| 2425 | 2520 |
| @@ -816,7 +816,6 @@ | ||
| 816 | 816 | if( Invincible == false ){ |
| 817 | 817 | hp -= (int)((float)attacks * HUMAN_DAMAGE_HEAD); |
| 818 | 818 | } |
| 819 | - HitFlag = true; | |
| 820 | 819 | ReactionGunsightErrorRange = 15; |
| 821 | 820 | } |
| 822 | 821 |
| @@ -827,7 +826,6 @@ | ||
| 827 | 826 | if( Invincible == false ){ |
| 828 | 827 | hp -= (int)((float)attacks * HUMAN_DAMAGE_UP); |
| 829 | 828 | } |
| 830 | - HitFlag = true; | |
| 831 | 829 | ReactionGunsightErrorRange = 12; |
| 832 | 830 | } |
| 833 | 831 |
| @@ -838,7 +836,6 @@ | ||
| 838 | 836 | if( Invincible == false ){ |
| 839 | 837 | hp -= (int)((float)attacks * HUMAN_DAMAGE_LEG); |
| 840 | 838 | } |
| 841 | - HitFlag = true; | |
| 842 | 839 | ReactionGunsightErrorRange = 8; |
| 843 | 840 | } |
| 844 | 841 |
| @@ -848,7 +845,6 @@ | ||
| 848 | 845 | if( Invincible == false ){ |
| 849 | 846 | hp -= HUMAN_DAMAGE_ZOMBIEU + GetRand(HUMAN_DAMAGE_ZOMBIEA); |
| 850 | 847 | } |
| 851 | - HitFlag = true; | |
| 852 | 848 | ReactionGunsightErrorRange = 10; |
| 853 | 849 | } |
| 854 | 850 |
| @@ -860,10 +856,15 @@ | ||
| 860 | 856 | if( Invincible == false ){ |
| 861 | 857 | hp -= attacks; |
| 862 | 858 | } |
| 863 | - HitFlag = true; | |
| 864 | 859 | ReactionGunsightErrorRange = 10; |
| 865 | 860 | } |
| 866 | 861 | |
| 862 | +//! @brief 被弾フラグをセット | |
| 863 | +void human::SetHitFlag() | |
| 864 | +{ | |
| 865 | + HitFlag = true; | |
| 866 | +} | |
| 867 | + | |
| 867 | 868 | //! @brief 被弾したかチェックする |
| 868 | 869 | //! @return 被弾した:true 被弾してない:false |
| 869 | 870 | //! @attention 実行すると、フラグは false に初期化されます。 |
| @@ -2451,14 +2452,16 @@ | ||
| 2451 | 2452 | |
| 2452 | 2453 | //! @brief 座標と情報を設定 |
| 2453 | 2454 | //! @param speed 初速 |
| 2455 | +//! @param _teamid チーム番号 | |
| 2454 | 2456 | //! @param _humanid 人のデータ番号 |
| 2455 | 2457 | //! @param init オブジェクトを初期化 |
| 2456 | 2458 | //! @attention 先に SetPosData() を実行してください。 |
| 2457 | -void grenade::SetParamData(float speed, int _humanid, bool init) | |
| 2459 | +void grenade::SetParamData(float speed, int _teamid, int _humanid, bool init) | |
| 2458 | 2460 | { |
| 2459 | 2461 | move_x = cos(rotation_x) * cos(rotation_y) * speed; |
| 2460 | 2462 | move_y = sin(rotation_y) * speed; |
| 2461 | 2463 | move_z = sin(rotation_x) * cos(rotation_y) * speed; |
| 2464 | + teamid = _teamid; | |
| 2462 | 2465 | humanid = _humanid; |
| 2463 | 2466 | |
| 2464 | 2467 | if( init == true ){ |
| @@ -2466,6 +2469,17 @@ | ||
| 2466 | 2469 | } |
| 2467 | 2470 | } |
| 2468 | 2471 | |
| 2472 | +//! @brief 設定値を取得 | |
| 2473 | +//! @param _speed 速度を受け取るポインタ(NULL可) | |
| 2474 | +//! @param _teamid チーム番号を受け取るポインタ(NULL可) | |
| 2475 | +//! @param _humanid 人のデータ番号を受け取るポインタ(NULL可) | |
| 2476 | +void grenade::GetParamData(float *_speed, int *_teamid, int *_humanid) | |
| 2477 | +{ | |
| 2478 | + if( _speed != NULL ){ *_speed = GetSpeed(); } | |
| 2479 | + if( _teamid != NULL ){ *_teamid = teamid; } | |
| 2480 | + if( _humanid != NULL ){ *_humanid = humanid; } | |
| 2481 | +} | |
| 2482 | + | |
| 2469 | 2483 | //! @brief 速度を取得 |
| 2470 | 2484 | //! @return 速度 |
| 2471 | 2485 | float grenade::GetSpeed() |
| @@ -1484,7 +1484,7 @@ | ||
| 1484 | 1484 | for(int i=0; i<MAX_HUMAN; i++){ |
| 1485 | 1485 | human *EnemyHuman = ObjMgr.GeHumanObject(i); |
| 1486 | 1486 | if( ObjMgr.CheckZombieAttack(myHuman, EnemyHuman) == true ){ |
| 1487 | - ObjMgr.HitZombieAttack(EnemyHuman); | |
| 1487 | + ObjMgr.HitZombieAttack(myHuman, EnemyHuman); | |
| 1488 | 1488 | } |
| 1489 | 1489 | } |
| 1490 | 1490 | } |
| @@ -133,7 +133,9 @@ | ||
| 133 | 133 | HumanParameter *Human; //!< 人の情報を格納するポインタ |
| 134 | 134 | char *HumanTexturePath[TOTAL_HUMANTEXTURE]; //!< 人のテクスチャを格納するポインタ |
| 135 | 135 | WeaponParameter *Weapon; //!< 武器の情報を格納するポインタ |
| 136 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 136 | 137 | WeaponParameter *BugWeapon; //!< バグ武器の情報を格納するポインタ |
| 138 | +#endif | |
| 137 | 139 | SmallObjectParameter *SmallObject; //!< 小物の情報を格納するポインタ |
| 138 | 140 | BulletParameter *Bullet; //!< 銃弾オブジェクトの情報を格納するポインタ |
| 139 | 141 | char *missionname[TOTAL_OFFICIALMISSION]; //!< 標準ミッションのミッション識別名 |
| @@ -150,7 +152,9 @@ | ||
| 150 | 152 | int GetHuman(int id, HumanParameter *out_data); |
| 151 | 153 | int GetHumanTexturePath(int id, char *out_str); |
| 152 | 154 | int GetWeapon(int id, WeaponParameter *out_data); |
| 155 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 153 | 156 | int GetBugWeapon(int id, WeaponParameter *out_data); |
| 157 | +#endif | |
| 154 | 158 | int GetSmallObject(int id, SmallObjectParameter *out_data); |
| 155 | 159 | int GetBullet(int id, BulletParameter *out_data); |
| 156 | 160 | int GetOfficialMission(int id, char *name, char *fullname, char* directory, char *txt); |
| @@ -331,7 +331,11 @@ | ||
| 331 | 331 | int ResourceManager::GetWeaponModelTexture(int id, int *model, int *texture) |
| 332 | 332 | { |
| 333 | 333 | if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ |
| 334 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 334 | 335 | return GetBugWeaponModelTexture(id, model, texture); |
| 336 | +#else | |
| 337 | + return 1; | |
| 338 | +#endif | |
| 335 | 339 | } |
| 336 | 340 | |
| 337 | 341 | *model = weapon_model[id]; |
| @@ -339,6 +343,7 @@ | ||
| 339 | 343 | return 0; |
| 340 | 344 | } |
| 341 | 345 | |
| 346 | +#ifdef ENABLE_BUG_HUMANWEAPON | |
| 342 | 347 | //! @brief バグ武器のモデルとテクスチャを取得 |
| 343 | 348 | //! @return 成功:0 失敗:1 |
| 344 | 349 | //! @warning 先に GetWeaponModelTexture()関数 を実行して取得に失敗した時に限り、この関数を使ってください。 |
| @@ -368,6 +373,7 @@ | ||
| 368 | 373 | |
| 369 | 374 | return 1; |
| 370 | 375 | } |
| 376 | +#endif | |
| 371 | 377 | |
| 372 | 378 | //! @brief 武器のモデルやテクスチャを一括解放 |
| 373 | 379 | void ResourceManager::CleanupWeaponModelTexture() |
| @@ -97,12 +97,12 @@ | ||
| 97 | 97 | void SetClass(SoundControl *in_SoundCtrl, ResourceManager *in_Resource, ParameterInfo *in_Param); |
| 98 | 98 | void InitWorldSound(); |
| 99 | 99 | bool ShotWeapon(float x, float y, float z, int id, int teamID, bool player); |
| 100 | - bool HitMap(float x, float y, float z); | |
| 101 | - bool HitHuman(float x, float y, float z); | |
| 102 | - bool HitSmallObject(float x, float y, float z, int id); | |
| 100 | + bool HitMap(float x, float y, float z, int teamID); | |
| 101 | + bool HitHuman(float x, float y, float z, int teamID); | |
| 102 | + bool HitSmallObject(float x, float y, float z, int id, int teamID); | |
| 103 | 103 | bool PassingBullet(float x, float y, float z, float move_x, float move_y, float move_z, int teamID); |
| 104 | - bool GrenadeBound(float x, float y, float z); | |
| 105 | - bool GrenadeExplosion(float x, float y, float z); | |
| 104 | + bool GrenadeBound(float x, float y, float z, int teamID); | |
| 105 | + bool GrenadeExplosion(float x, float y, float z, int teamID); | |
| 106 | 106 | bool SetFootsteps(float x, float y, float z, int teamID); |
| 107 | 107 | bool ReloadWeapon(float x, float y, float z, int teamID); |
| 108 | 108 | int GetWorldSound(float pos_x, float pos_y, float pos_z, int teamID, soundlist *psoundlist); |
| @@ -64,6 +64,8 @@ | ||
| 64 | 64 | #include <math.h> |
| 65 | 65 | #include <string.h> |
| 66 | 66 | |
| 67 | +#define ENABLE_BUG_HUMANWEAPON //!< 範囲外の人・武器種類番号を用いたバグを再現する(コメント化で無効) | |
| 68 | +#define ENABLE_BUG_TEAMID //!< チーム番号を負数に設定した際のバグを再現する(コメント化で無効) | |
| 67 | 69 | #define ENABLE_DEBUGLOG //!< @brief デバック用ログ出力の有効化(コメント化で機能無効) |
| 68 | 70 | //#define PATH_DELIMITER_SLASH //!< パス区切り文字を、'\'から‘/’へ変換する。 |
| 69 | 71 |