• 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

Revision140 (tree)
Time2016-08-15 04:07:42
Authorxops-mikan

Log Message

人のチーム番号を負数に設定した際のバグ(仕様)を再現、範囲外の武器を用いた処理を定数で無効化できるように。(標準では有効)

Change Summary

Incremental Difference

--- trunk/objectmanager.h (revision 139)
+++ trunk/objectmanager.h (revision 140)
@@ -104,9 +104,9 @@
104104 void SetHumanBlood(float x, float y, float z, int damage, bool CollideMap);
105105 bool CollideHuman(human *in_humanA, human *in_humanB);
106106 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);
108108 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);
110110 bool GrenadeExplosion(grenade *in_grenade);
111111 void DeadEffect(human *in_human);
112112 bool CollideBlood(effect *in_effect, int *id, int *face, float *pos_x, float *pos_y, float *pos_z);
@@ -156,7 +156,7 @@
156156 bool CheatAddBullet(int human_id);
157157 bool CheatNewWeapon(int human_id, int new_weaponID);
158158 bool CheckZombieAttack(human* MyHuman, human* EnemyHuman);
159- void HitZombieAttack(human* EnemyHuman);
159+ void HitZombieAttack(human* MyHuman, human* EnemyHuman);
160160 bool HumanResuscitation(int id);
161161 int CheckGameOverorComplete();
162162 bool GetObjectInfoTag(float camera_x, float camera_y, float camera_z, float camera_rx, float camera_ry, int *color, char *infostr);
--- trunk/object.h (revision 139)
+++ trunk/object.h (revision 140)
@@ -207,6 +207,7 @@
207207 virtual void HitBulletLeg(int attacks);
208208 virtual void HitZombieAttack();
209209 virtual void HitGrenadeExplosion(int attacks);
210+ virtual void SetHitFlag();
210211 virtual bool CheckHit();
211212 virtual float GetTotalMove();
212213 virtual int RunFrame(class Collision *CollD, class BlockDataInterface *inblockdata, bool F5mode);
@@ -308,7 +309,8 @@
308309 public:
309310 grenade(int modelid = -1, int textureid = -1);
310311 ~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);
312314 float GetSpeed();
313315 int RunFrame(class Collision *CollD);
314316 virtual void Render(D3DGraphics *d3dg);
--- trunk/parameter.cpp (revision 139)
+++ trunk/parameter.cpp (revision 140)
@@ -42,7 +42,9 @@
4242 HumanTexturePath[i] = '\0';
4343 }
4444 Weapon = NULL;
45+#ifdef ENABLE_BUG_HUMANWEAPON
4546 BugWeapon = NULL;
47+#endif
4648 SmallObject = NULL;
4749 Bullet = NULL;
4850 for(int i=0; i<TOTAL_OFFICIALMISSION; i++){
@@ -71,7 +73,9 @@
7173
7274 Human = new HumanParameter[TOTAL_PARAMETERINFO_HUMAN];
7375 Weapon = new WeaponParameter[TOTAL_PARAMETERINFO_WEAPON];
76+#ifdef ENABLE_BUG_HUMANWEAPON
7477 BugWeapon = new WeaponParameter[1];
78+#endif
7579 SmallObject = new SmallObjectParameter[TOTAL_PARAMETERINFO_SMALLOBJECT];
7680 Bullet = new BulletParameter[TOTAL_PARAMETERINFO_BULLET];
7781 AIlevel = new AIParameter[TOTAL_PARAMETERINFO_AILEVEL];
@@ -1190,6 +1194,7 @@
11901194 Weapon[22].ChangeWeapon = -1;
11911195 Weapon[22].burst = 1;
11921196
1197+#ifdef ENABLE_BUG_HUMANWEAPON
11931198 //特殊なバグ武器用データ
11941199 BugWeapon[0].name = "BugWeapon";
11951200 BugWeapon[0].model = "";
@@ -1223,6 +1228,7 @@
12231228 BugWeapon[0].WeaponP = 1;
12241229 BugWeapon[0].ChangeWeapon = -1;
12251230 BugWeapon[0].burst = 0;
1231+#endif
12261232
12271233
12281234 //缶
@@ -1603,10 +1609,12 @@
16031609 delete [] Weapon;
16041610 Weapon = NULL;
16051611 }
1612+#ifdef ENABLE_BUG_HUMANWEAPON
16061613 if( BugWeapon != NULL ){
16071614 delete [] BugWeapon;
16081615 BugWeapon = NULL;
16091616 }
1617+#endif
16101618 if( SmallObject != NULL ){
16111619 delete [] SmallObject;
16121620 SmallObject = NULL;
@@ -1657,7 +1665,11 @@
16571665 int ParameterInfo::GetWeapon(int id, WeaponParameter *out_data)
16581666 {
16591667 if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
1668+#ifdef ENABLE_BUG_HUMANWEAPON
16601669 return GetBugWeapon(id, out_data);
1670+#else
1671+ return 1;
1672+#endif
16611673 }
16621674
16631675 *out_data = Weapon[id];
@@ -1664,6 +1676,7 @@
16641676 return 0;
16651677 }
16661678
1679+#ifdef ENABLE_BUG_HUMANWEAPON
16671680 //! @brief 武器の設定を取得
16681681 //! @param id 番号
16691682 //! @param out_data 受け取るWeaponParameter型ポインタ
@@ -1679,6 +1692,7 @@
16791692
16801693 return 1;
16811694 }
1695+#endif
16821696
16831697
16841698 //! @brief 小物の設定を取得
--- trunk/soundmanager.cpp (revision 139)
+++ trunk/soundmanager.cpp (revision 140)
@@ -103,8 +103,9 @@
103103 //! @param x 音源のX座標
104104 //! @param y 音源のY座標
105105 //! @param z 音源のZ座標
106+//! @param teamID チーム番号
106107 //! @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)
108109 {
109110 soundlist *plist = NULL;
110111 if( GetNewList(&plist) == false ){ return false; }
@@ -113,6 +114,7 @@
113114 plist->x = x;
114115 plist->y = y;
115116 plist->z = z;
117+ plist->teamid = teamID;
116118
117119 return true;
118120 }
@@ -121,8 +123,9 @@
121123 //! @param x 音源のX座標
122124 //! @param y 音源のY座標
123125 //! @param z 音源のZ座標
126+//! @param teamID チーム番号
124127 //! @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)
126129 {
127130 soundlist *plist = NULL;
128131 if( GetNewList(&plist) == false ){ return false; }
@@ -131,6 +134,7 @@
131134 plist->x = x;
132135 plist->y = y;
133136 plist->z = z;
137+ plist->teamid = teamID;
134138
135139 return true;
136140 }
@@ -140,8 +144,9 @@
140144 //! @param y 音源のY座標
141145 //! @param z 音源のZ座標
142146 //! @param id 小物の種類番号
147+//! @param teamID チーム番号
143148 //! @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)
145150 {
146151 soundlist *plist = NULL;
147152 if( GetNewList(&plist) == false ){ return false; }
@@ -151,6 +156,7 @@
151156 plist->x = x;
152157 plist->y = y;
153158 plist->z = z;
159+ plist->teamid = teamID;
154160
155161 return true;
156162 }
@@ -186,8 +192,9 @@
186192 //! @param x 音源のX座標
187193 //! @param y 音源のY座標
188194 //! @param z 音源のZ座標
195+//! @param teamID チーム番号
189196 //! @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)
191198 {
192199 soundlist *plist = NULL;
193200 if( GetNewList(&plist) == false ){ return false; }
@@ -196,6 +203,7 @@
196203 plist->x = x;
197204 plist->y = y;
198205 plist->z = z;
206+ plist->teamid = teamID;
199207
200208 return true;
201209 }
@@ -204,8 +212,9 @@
204212 //! @param x 音源のX座標
205213 //! @param y 音源のY座標
206214 //! @param z 音源のZ座標
215+//! @param teamID チーム番号
207216 //! @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)
209218 {
210219 soundlist *plist = NULL;
211220 if( GetNewList(&plist) == false ){ return false; }
@@ -214,6 +223,7 @@
214223 plist->x = x;
215224 plist->y = y;
216225 plist->z = z;
226+ plist->teamid = teamID;
217227
218228 return true;
219229 }
@@ -298,6 +308,15 @@
298308 continue;
299309 }
300310
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+
301320 //銃弾ならば
302321 if( getlist[i].paramid == BULLET ){
303322 float min_x, min_y, min_z;
--- trunk/ai.cpp (revision 139)
+++ trunk/ai.cpp (revision 140)
@@ -688,7 +688,7 @@
688688
689689 if( actioncnt%50 == 0){
690690 if( ObjMgr->CheckZombieAttack(ctrlhuman, EnemyHuman) == true ){
691- ObjMgr->HitZombieAttack(EnemyHuman);
691+ ObjMgr->HitZombieAttack(ctrlhuman, EnemyHuman);
692692 }
693693 }
694694 }
--- trunk/resource.h (revision 139)
+++ trunk/resource.h (revision 140)
@@ -99,7 +99,9 @@
9999 void CleanupHumanTexture();
100100 int LoadWeaponModelTexture();
101101 int GetWeaponModelTexture(int id, int *model, int *texture);
102+#ifdef ENABLE_BUG_HUMANWEAPON
102103 int GetBugWeaponModelTexture(int id, int *model, int *texture);
104+#endif
103105 void CleanupWeaponModelTexture();
104106 int LoadWeaponSound();
105107 int GetWeaponSound(int id);
--- trunk/objectmanager.cpp (revision 139)
+++ trunk/objectmanager.cpp (revision 140)
@@ -153,6 +153,12 @@
153153 Weapon[i] = NULL;
154154 }
155155
156+#ifndef ENABLE_BUG_HUMANWEAPON
157+ if( GetHumanFlag != 0 ){
158+ return -1;
159+ }
160+#endif
161+
156162 //人のモデル番号を取得
157163 int upmodel[TOTAL_UPMODE];
158164 int armmodel[TOTAL_ARMMODE];
@@ -177,8 +183,10 @@
177183 HumanIndex[j].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
178184 }
179185 else{
186+#ifdef ENABLE_BUG_HUMANWEAPON
180187 HumanIndex[j].SetTexture(d3dg->GetMapTextureID(0));
181188 HumanIndex[j].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
189+#endif
182190 }
183191 HumanIndex[j].SetEnableFlag(true);
184192 Humanindexid = j;
@@ -245,6 +253,12 @@
245253 Weapon[i] = NULL;
246254 }
247255
256+#ifndef ENABLE_BUG_HUMANWEAPON
257+ if( GetHumanFlag != 0 ){
258+ return -1;
259+ }
260+#endif
261+
248262 //人のモデル番号を取得
249263 int upmodel[TOTAL_UPMODE];
250264 int armmodel[TOTAL_ARMMODE];
@@ -269,8 +283,10 @@
269283 HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
270284 }
271285 else{
286+#ifdef ENABLE_BUG_HUMANWEAPON
272287 HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0));
273288 HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
289+#endif
274290 }
275291 HumanIndex[i].SetEnableFlag(true);
276292 Humanindexid = i;
@@ -744,7 +760,7 @@
744760 //マップとの衝突距離が最短ならば〜
745761 if( (map_Dist <= speed)&&(map_Dist < HumanHead_Dist)&&(map_Dist < HumanUp_Dist)&&(map_Dist < HumanLeg_Dist)&&(map_Dist < SmallObject_Dist) ){
746762 //弾がマップに当たった処理
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);
748764
749765 int Penetration_Dist;
750766
@@ -816,7 +832,7 @@
816832 //小物との衝突距離が最短ならば〜
817833 if( (SmallObject_Dist <= speed)&&(SmallObject_Dist < map_Dist)&&(SmallObject_Dist < HumanHead_Dist)&&(SmallObject_Dist < HumanUp_Dist)&&(SmallObject_Dist < HumanLeg_Dist) ){
818834 //小物に当たった処理
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);
820836
821837 //小物の種類番号を取得
822838 int id;
@@ -852,13 +868,14 @@
852868 //! @param x 着弾X座標
853869 //! @param y 着弾Y座標
854870 //! @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)
856873 {
857874 //エフェクト(煙)を表示
858875 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);
859876
860877 //効果音を再生
861- GameSound->HitMap(x, y, z);
878+ GameSound->HitMap(x, y, z, teamID);
862879 }
863880
864881 //! @brief 弾が人に当たった処理
@@ -872,6 +889,7 @@
872889 //! @param Shothuman_id 発射した人の番号
873890 void ObjectManager::HitBulletHuman(int HitHuman_id, int Hit_id, float x, float y, float z, float brx, int attacks, int Shothuman_id)
874891 {
892+ int Shothuman_TeamID;
875893 int damage = 0;
876894 int paramid;
877895 HumanParameter Paraminfo;
@@ -881,6 +899,9 @@
881899 if( HumanIndex[HitHuman_id].GetEnableFlag() == false ){ return; }
882900 if( HumanIndex[HitHuman_id].GetHP() <= 0 ){ return; }
883901
902+ //発射元のチーム番号取得
903+ HumanIndex[Shothuman_id].GetParamData(NULL, NULL, NULL, &Shothuman_TeamID);
904+
884905 //人にダメージと衝撃を与える
885906 if( Hit_id == 0 ){ HumanIndex[HitHuman_id].HitBulletHead(attacks); }
886907 if( Hit_id == 1 ){ HumanIndex[HitHuman_id].HitBulletUp(attacks); }
@@ -887,6 +908,25 @@
887908 if( Hit_id == 2 ){ HumanIndex[HitHuman_id].HitBulletLeg(attacks); }
888909 HumanIndex[HitHuman_id].AddPosOrder(brx, 0.0f, 1.0f);
889910
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+
890930 //ロボットかどうか判定
891931 HumanIndex[HitHuman_id].GetParamData(&paramid, NULL, NULL, NULL);
892932 GameParamInfo->GetHuman(paramid, &Paraminfo);
@@ -904,7 +944,7 @@
904944 SetHumanBlood(x, y, z, damage, NotRobot);
905945
906946 //効果音を再生
907- GameSound->HitHuman(x, y, z);
947+ GameSound->HitHuman(x, y, z, Shothuman_TeamID);
908948
909949 //弾を発射した人の成果に加算
910950 Human_ontarget[Shothuman_id] += 1;
@@ -920,7 +960,8 @@
920960 //! @param y 着弾Y座標
921961 //! @param z 着弾Z座標
922962 //! @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)
924965 {
925966 int hp;
926967
@@ -940,7 +981,7 @@
940981 //効果音を再生
941982 int id;
942983 SmallObjectIndex[HitSmallObject_id].GetParamData(&id, NULL);
943- GameSound->HitSmallObject(x, y, z, id);
984+ GameSound->HitSmallObject(x, y, z, id, teamID);
944985 }
945986
946987 //! @brief 手榴弾のダメージ判定と処理
@@ -954,9 +995,9 @@
954995
955996 //座標を取得
956997 float gx, gy, gz;
957- int humanid;
998+ int teamid, humanid;
958999 in_grenade->GetPosData(&gx, &gy, &gz, NULL, NULL);
959- in_grenade->GetParamData(NULL, NULL, NULL, NULL, &humanid);
1000+ in_grenade->GetParamData(NULL, &teamid, &humanid);
9601001
9611002 //人に爆風の当たり判定
9621003 for(int i=0; i<MAX_HUMAN; i++){
@@ -1009,6 +1050,25 @@
10091050 //ダメージを反映
10101051 HumanIndex[i].HitGrenadeExplosion(total_damage);
10111052
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+
10121072 float y2;
10131073 float arx, ary;
10141074
@@ -1073,7 +1133,7 @@
10731133 SmallObjectIndex[i].HitGrenadeExplosion(damage);
10741134
10751135 //小物から効果音を発する
1076- GameSound->HitSmallObject(sx, sy, sz, id);
1136+ GameSound->HitSmallObject(sx, sy, sz, id, teamid);
10771137
10781138 returnflag = true;
10791139 }
@@ -1090,7 +1150,7 @@
10901150 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);
10911151
10921152 //効果音を再生
1093- GameSound->GrenadeExplosion(gx, gy, gz);
1153+ GameSound->GrenadeExplosion(gx, gy, gz, teamid);
10941154
10951155 return returnflag;
10961156 }
@@ -1352,6 +1412,13 @@
13521412
13531413 GetHumanFlag = GameParamInfo->GetHuman(HumanID, &HumanParam);
13541414
1415+#ifndef ENABLE_BUG_HUMANWEAPON
1416+ if( GetHumanFlag != 0 ){
1417+ HumanIndex[i].SetEnableFlag(false);
1418+ continue;
1419+ }
1420+#endif
1421+
13551422 if( GetHumanFlag == 0 ){
13561423 //人のテクスチャを登録
13571424 Resource->AddHumanTexture(HumanID);
@@ -1366,8 +1433,10 @@
13661433 HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
13671434 }
13681435 else{
1436+#ifdef ENABLE_BUG_HUMANWEAPON
13691437 HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0));
13701438 HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
1439+#endif
13711440 }
13721441 }
13731442 }
@@ -1800,7 +1869,7 @@
18001869
18011870 //手榴弾発射
18021871 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);
18041873 newgrenade->SetEnableFlag(true);
18051874 }
18061875
@@ -2095,8 +2164,9 @@
20952164 }
20962165
20972166 //! @brief ゾンビの攻撃を受けた処理
2167+//! @param MyHuman 攻撃する人オブジェクト(ゾンビ側)のポインタ
20982168 //! @param EnemyHuman 攻撃を受けた人オブジェクトのポインタ
2099-void ObjectManager::HitZombieAttack(human* EnemyHuman)
2169+void ObjectManager::HitZombieAttack(human* MyHuman, human* EnemyHuman)
21002170 {
21012171 if( EnemyHuman == NULL ){ return; }
21022172
@@ -2104,11 +2174,15 @@
21042174 if( EnemyHuman->GetEnableFlag() == false ){ return; }
21052175 if( EnemyHuman->GetHP() <= 0 ){ return; }
21062176
2177+ int MyHuman_TeamID;
21072178 float tx, ty, tz;
21082179 int paramid;
21092180 HumanParameter Paraminfo;
21102181 bool NotRobot;
21112182
2183+ //ゾンビ側のチーム番号取得
2184+ MyHuman->GetParamData(NULL, NULL, NULL, &MyHuman_TeamID);
2185+
21122186 EnemyHuman->GetPosData(&tx, &ty, &tz, NULL);
21132187 ty += VIEW_HEIGHT;
21142188
@@ -2125,11 +2199,30 @@
21252199 //ダメージなどを計算
21262200 EnemyHuman->HitZombieAttack();
21272201
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+
21282221 //エフェクト(血)を表示
21292222 SetHumanBlood(tx, ty, tz, HUMAN_DAMAGE_ZOMBIEU, NotRobot);
21302223
21312224 //効果音を再生
2132- GameSound->HitHuman(tx, ty, tz);
2225+ GameSound->HitHuman(tx, ty, tz, MyHuman_TeamID);
21332226 }
21342227
21352228 //! @brief 死者を蘇生する
@@ -2418,8 +2511,10 @@
24182511 if( speed > 3.4f ){
24192512 //座標を取得し、効果音再生
24202513 float x, y, z;
2514+ int teamid;
24212515 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);
24232518 }
24242519 }
24252520
--- trunk/object.cpp (revision 139)
+++ trunk/object.cpp (revision 140)
@@ -816,7 +816,6 @@
816816 if( Invincible == false ){
817817 hp -= (int)((float)attacks * HUMAN_DAMAGE_HEAD);
818818 }
819- HitFlag = true;
820819 ReactionGunsightErrorRange = 15;
821820 }
822821
@@ -827,7 +826,6 @@
827826 if( Invincible == false ){
828827 hp -= (int)((float)attacks * HUMAN_DAMAGE_UP);
829828 }
830- HitFlag = true;
831829 ReactionGunsightErrorRange = 12;
832830 }
833831
@@ -838,7 +836,6 @@
838836 if( Invincible == false ){
839837 hp -= (int)((float)attacks * HUMAN_DAMAGE_LEG);
840838 }
841- HitFlag = true;
842839 ReactionGunsightErrorRange = 8;
843840 }
844841
@@ -848,7 +845,6 @@
848845 if( Invincible == false ){
849846 hp -= HUMAN_DAMAGE_ZOMBIEU + GetRand(HUMAN_DAMAGE_ZOMBIEA);
850847 }
851- HitFlag = true;
852848 ReactionGunsightErrorRange = 10;
853849 }
854850
@@ -860,10 +856,15 @@
860856 if( Invincible == false ){
861857 hp -= attacks;
862858 }
863- HitFlag = true;
864859 ReactionGunsightErrorRange = 10;
865860 }
866861
862+//! @brief 被弾フラグをセット
863+void human::SetHitFlag()
864+{
865+ HitFlag = true;
866+}
867+
867868 //! @brief 被弾したかチェックする
868869 //! @return 被弾した:true 被弾してない:false
869870 //! @attention 実行すると、フラグは false に初期化されます。
@@ -2451,14 +2452,16 @@
24512452
24522453 //! @brief 座標と情報を設定
24532454 //! @param speed 初速
2455+//! @param _teamid チーム番号
24542456 //! @param _humanid 人のデータ番号
24552457 //! @param init オブジェクトを初期化
24562458 //! @attention 先に SetPosData() を実行してください。
2457-void grenade::SetParamData(float speed, int _humanid, bool init)
2459+void grenade::SetParamData(float speed, int _teamid, int _humanid, bool init)
24582460 {
24592461 move_x = cos(rotation_x) * cos(rotation_y) * speed;
24602462 move_y = sin(rotation_y) * speed;
24612463 move_z = sin(rotation_x) * cos(rotation_y) * speed;
2464+ teamid = _teamid;
24622465 humanid = _humanid;
24632466
24642467 if( init == true ){
@@ -2466,6 +2469,17 @@
24662469 }
24672470 }
24682471
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+
24692483 //! @brief 速度を取得
24702484 //! @return 速度
24712485 float grenade::GetSpeed()
--- trunk/gamemain.cpp (revision 139)
+++ trunk/gamemain.cpp (revision 140)
@@ -1484,7 +1484,7 @@
14841484 for(int i=0; i<MAX_HUMAN; i++){
14851485 human *EnemyHuman = ObjMgr.GeHumanObject(i);
14861486 if( ObjMgr.CheckZombieAttack(myHuman, EnemyHuman) == true ){
1487- ObjMgr.HitZombieAttack(EnemyHuman);
1487+ ObjMgr.HitZombieAttack(myHuman, EnemyHuman);
14881488 }
14891489 }
14901490 }
--- trunk/parameter.h (revision 139)
+++ trunk/parameter.h (revision 140)
@@ -133,7 +133,9 @@
133133 HumanParameter *Human; //!< 人の情報を格納するポインタ
134134 char *HumanTexturePath[TOTAL_HUMANTEXTURE]; //!< 人のテクスチャを格納するポインタ
135135 WeaponParameter *Weapon; //!< 武器の情報を格納するポインタ
136+#ifdef ENABLE_BUG_HUMANWEAPON
136137 WeaponParameter *BugWeapon; //!< バグ武器の情報を格納するポインタ
138+#endif
137139 SmallObjectParameter *SmallObject; //!< 小物の情報を格納するポインタ
138140 BulletParameter *Bullet; //!< 銃弾オブジェクトの情報を格納するポインタ
139141 char *missionname[TOTAL_OFFICIALMISSION]; //!< 標準ミッションのミッション識別名
@@ -150,7 +152,9 @@
150152 int GetHuman(int id, HumanParameter *out_data);
151153 int GetHumanTexturePath(int id, char *out_str);
152154 int GetWeapon(int id, WeaponParameter *out_data);
155+#ifdef ENABLE_BUG_HUMANWEAPON
153156 int GetBugWeapon(int id, WeaponParameter *out_data);
157+#endif
154158 int GetSmallObject(int id, SmallObjectParameter *out_data);
155159 int GetBullet(int id, BulletParameter *out_data);
156160 int GetOfficialMission(int id, char *name, char *fullname, char* directory, char *txt);
--- trunk/resource.cpp (revision 139)
+++ trunk/resource.cpp (revision 140)
@@ -331,7 +331,11 @@
331331 int ResourceManager::GetWeaponModelTexture(int id, int *model, int *texture)
332332 {
333333 if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
334+#ifdef ENABLE_BUG_HUMANWEAPON
334335 return GetBugWeaponModelTexture(id, model, texture);
336+#else
337+ return 1;
338+#endif
335339 }
336340
337341 *model = weapon_model[id];
@@ -339,6 +343,7 @@
339343 return 0;
340344 }
341345
346+#ifdef ENABLE_BUG_HUMANWEAPON
342347 //! @brief バグ武器のモデルとテクスチャを取得
343348 //! @return 成功:0 失敗:1
344349 //! @warning 先に GetWeaponModelTexture()関数 を実行して取得に失敗した時に限り、この関数を使ってください。
@@ -368,6 +373,7 @@
368373
369374 return 1;
370375 }
376+#endif
371377
372378 //! @brief 武器のモデルやテクスチャを一括解放
373379 void ResourceManager::CleanupWeaponModelTexture()
--- trunk/soundmanager.h (revision 139)
+++ trunk/soundmanager.h (revision 140)
@@ -97,12 +97,12 @@
9797 void SetClass(SoundControl *in_SoundCtrl, ResourceManager *in_Resource, ParameterInfo *in_Param);
9898 void InitWorldSound();
9999 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);
103103 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);
106106 bool SetFootsteps(float x, float y, float z, int teamID);
107107 bool ReloadWeapon(float x, float y, float z, int teamID);
108108 int GetWorldSound(float pos_x, float pos_y, float pos_z, int teamID, soundlist *psoundlist);
--- trunk/main.h (revision 139)
+++ trunk/main.h (revision 140)
@@ -64,6 +64,8 @@
6464 #include <math.h>
6565 #include <string.h>
6666
67+#define ENABLE_BUG_HUMANWEAPON //!< 範囲外の人・武器種類番号を用いたバグを再現する(コメント化で無効)
68+#define ENABLE_BUG_TEAMID //!< チーム番号を負数に設定した際のバグを再現する(コメント化で無効)
6769 #define ENABLE_DEBUGLOG //!< @brief デバック用ログ出力の有効化(コメント化で機能無効)
6870 //#define PATH_DELIMITER_SLASH //!< パス区切り文字を、'\'から‘/’へ変換する。
6971