• 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

Revision138 (tree)
Time2016-08-02 23:37:55
Authorxops-mikan

Log Message

範囲外の武器を用いた謎人間(テクスチャ偽装人間)の表示に対応

Change Summary

Incremental Difference

--- trunk/parameter.h (revision 137)
+++ trunk/parameter.h (revision 138)
@@ -133,6 +133,7 @@
133133 HumanParameter *Human; //!< 人の情報を格納するポインタ
134134 char *HumanTexturePath[TOTAL_HUMANTEXTURE]; //!< 人のテクスチャを格納するポインタ
135135 WeaponParameter *Weapon; //!< 武器の情報を格納するポインタ
136+ WeaponParameter *BugWeapon; //!< バグ武器の情報を格納するポインタ
136137 SmallObjectParameter *SmallObject; //!< 小物の情報を格納するポインタ
137138 BulletParameter *Bullet; //!< 銃弾オブジェクトの情報を格納するポインタ
138139 char *missionname[TOTAL_OFFICIALMISSION]; //!< 標準ミッションのミッション識別名
@@ -149,6 +150,7 @@
149150 int GetHuman(int id, HumanParameter *out_data);
150151 int GetHumanTexturePath(int id, char *out_str);
151152 int GetWeapon(int id, WeaponParameter *out_data);
153+ int GetBugWeapon(int id, WeaponParameter *out_data);
152154 int GetSmallObject(int id, SmallObjectParameter *out_data);
153155 int GetBullet(int id, BulletParameter *out_data);
154156 int GetOfficialMission(int id, char *name, char *fullname, char* directory, char *txt);
--- trunk/resource.cpp (revision 137)
+++ trunk/resource.cpp (revision 138)
@@ -330,7 +330,9 @@
330330 //! @return 成功:0 失敗:1
331331 int ResourceManager::GetWeaponModelTexture(int id, int *model, int *texture)
332332 {
333- if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ return 1; }
333+ if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
334+ return GetBugWeaponModelTexture(id, model, texture);
335+ }
334336
335337 *model = weapon_model[id];
336338 *texture = weapon_texture[id];
@@ -337,6 +339,36 @@
337339 return 0;
338340 }
339341
342+//! @brief バグ武器のモデルとテクスチャを取得
343+//! @return 成功:0 失敗:1
344+//! @warning 先に GetWeaponModelTexture()関数 を実行して取得に失敗した時に限り、この関数を使ってください。
345+//! @attention バグ武器を追加する場合は、ParameterInfoクラスの GetBugWeapon() 関数も編集してください。
346+int ResourceManager::GetBugWeaponModelTexture(int id, int *model, int *texture)
347+{
348+ if( id == 23 ){
349+ *model = human_upmodel[0];
350+ *texture = d3dg->GetMapTextureID(0);
351+ return 0;
352+ }
353+ if( id == 24 ){
354+ *model = human_upmodel[0];
355+ *texture = d3dg->GetMapTextureID(3);
356+ return 0;
357+ }
358+ if( id == 30 ){
359+ *model = human_upmodel[0];
360+ *texture = d3dg->GetMapTextureID(2);
361+ return 0;
362+ }
363+ if( id == 53 ){
364+ *model = human_upmodel[0];
365+ *texture = d3dg->GetMapTextureID(8);
366+ return 0;
367+ }
368+
369+ return 1;
370+}
371+
340372 //! @brief 武器のモデルやテクスチャを一括解放
341373 void ResourceManager::CleanupWeaponModelTexture()
342374 {
--- trunk/objectmanager.h (revision 137)
+++ trunk/objectmanager.h (revision 138)
@@ -87,7 +87,7 @@
8787
8888 int Player_HumanID; //!< プレイヤーが操作する人オブジェクトのID
8989
90- int AddHumanIndex_TextureID; //!< 前回読み込んだテクスチャID
90+ bool *Human_FrameTextureRefresh; //!< 人のテクスチャリフレッシュフラグ(テクスチャ偽造人間(謎人間)用)
9191
9292 ParameterInfo *GameParamInfo; //!< ゲームの設定値
9393 D3DGraphics *d3dg; //!< 描画クラス
--- trunk/object.h (revision 137)
+++ trunk/object.h (revision 138)
@@ -109,7 +109,9 @@
109109 virtual void SetEnableFlag(bool flag);
110110 virtual bool GetEnableFlag();
111111 virtual void SetModel(int id, float size);
112+ virtual void GetModel(int *id, float *size);
112113 virtual void SetTexture(int id);
114+ virtual int GetTexture();
113115 virtual int RunFrame();
114116 virtual void Render(class D3DGraphics *d3dg);
115117 };
@@ -160,7 +162,7 @@
160162 void GunsightErrorRange();
161163 int CheckAndProcessDead(class Collision *CollD);
162164 void ControlProcess();
163- bool MapCollisionDetection(class Collision *CollD, class BlockDataInterface *inblockdata, float *FallDist);
165+ bool MapCollisionDetection(class Collision *CollD, class BlockDataInterface *inblockdata, float *FallDist, float *nowmove_x, float *nowmove_z);
164166
165167 public:
166168 human(class ParameterInfo *in_Param = NULL, float x = 0.0f, float y = 0.0f, float z = 0.0f, float rx = 0.0f, int id_param = -1, int dataid = 0, signed char p4 = 0, int team = 0, bool flag = false);
--- trunk/parameter.cpp (revision 137)
+++ trunk/parameter.cpp (revision 138)
@@ -42,6 +42,7 @@
4242 HumanTexturePath[i] = '\0';
4343 }
4444 Weapon = NULL;
45+ BugWeapon = NULL;
4546 SmallObject = NULL;
4647 Bullet = NULL;
4748 for(int i=0; i<TOTAL_OFFICIALMISSION; i++){
@@ -70,6 +71,7 @@
7071
7172 Human = new HumanParameter[TOTAL_PARAMETERINFO_HUMAN];
7273 Weapon = new WeaponParameter[TOTAL_PARAMETERINFO_WEAPON];
74+ BugWeapon = new WeaponParameter[1];
7375 SmallObject = new SmallObjectParameter[TOTAL_PARAMETERINFO_SMALLOBJECT];
7476 Bullet = new BulletParameter[TOTAL_PARAMETERINFO_BULLET];
7577 AIlevel = new AIParameter[TOTAL_PARAMETERINFO_AILEVEL];
@@ -1188,7 +1190,41 @@
11881190 Weapon[22].ChangeWeapon = -1;
11891191 Weapon[22].burst = 1;
11901192
1193+ //特殊なバグ武器用データ
1194+ BugWeapon[0].name = "BugWeapon";
1195+ BugWeapon[0].model = "";
1196+ BugWeapon[0].texture= "";
1197+ BugWeapon[0].attacks = 0;
1198+ BugWeapon[0].penetration = 0;
1199+ BugWeapon[0].blazings = 0;
1200+ BugWeapon[0].speed = 0;
1201+ BugWeapon[0].nbsmax = 0;
1202+ BugWeapon[0].reloads = 0;
1203+ BugWeapon[0].reaction = 0;
1204+ BugWeapon[0].ErrorRangeMIN = 0;
1205+ BugWeapon[0].ErrorRangeMAX = 0;
1206+ BugWeapon[0].mx = 0.0f;
1207+ BugWeapon[0].my = 0.0f;
1208+ BugWeapon[0].mz = 0.0f;
1209+ BugWeapon[0].flashx = 0.0f;
1210+ BugWeapon[0].flashy = 0.0f;
1211+ BugWeapon[0].flashz = 0.0f;
1212+ BugWeapon[0].yakkyou_px = 0.0f;
1213+ BugWeapon[0].yakkyou_py = 0.0f;
1214+ BugWeapon[0].yakkyou_pz = 0.0f;
1215+ BugWeapon[0].yakkyou_sx = 0.0f;
1216+ BugWeapon[0].yakkyou_sy = 0.0f;
1217+ BugWeapon[0].blazingmode = true;
1218+ BugWeapon[0].scopemode = 0;
1219+ BugWeapon[0].size = 9.0f;
1220+ BugWeapon[0].soundid = 0;
1221+ BugWeapon[0].soundvolume = 0;
1222+ BugWeapon[0].silencer = false;
1223+ BugWeapon[0].WeaponP = 1;
1224+ BugWeapon[0].ChangeWeapon = -1;
1225+ BugWeapon[0].burst = 0;
11911226
1227+
11921228 //缶
11931229 SmallObject[0].model = "./data/article/can.x";
11941230 SmallObject[0].texture = "./data/article/can.bmp";
@@ -1567,6 +1603,10 @@
15671603 delete [] Weapon;
15681604 Weapon = NULL;
15691605 }
1606+ if( BugWeapon != NULL ){
1607+ delete [] BugWeapon;
1608+ BugWeapon = NULL;
1609+ }
15701610 if( SmallObject != NULL ){
15711611 delete [] SmallObject;
15721612 SmallObject = NULL;
@@ -1616,12 +1656,31 @@
16161656 //! @return 成功:0 失敗:1
16171657 int ParameterInfo::GetWeapon(int id, WeaponParameter *out_data)
16181658 {
1619- if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){ return 1; }
1659+ if( (id < 0)||((TOTAL_PARAMETERINFO_WEAPON -1) < id ) ){
1660+ return GetBugWeapon(id, out_data);
1661+ }
16201662
16211663 *out_data = Weapon[id];
16221664 return 0;
16231665 }
16241666
1667+//! @brief 武器の設定を取得
1668+//! @param id 番号
1669+//! @param out_data 受け取るWeaponParameter型ポインタ
1670+//! @return 成功:0 失敗:1
1671+//! @warning 先に GetWeapon()関数 を実行して取得に失敗した時に限り、この関数を使ってください。
1672+//! @attention バグ武器を追加する場合は、ResourceManagerクラスの GetBugWeaponModelTexture() 関数も編集してください。
1673+int ParameterInfo::GetBugWeapon(int id, WeaponParameter *out_data)
1674+{
1675+ if( (id == 23)||(id == 24)||(id == 30)||(id == 53) ){
1676+ *out_data = BugWeapon[0];
1677+ return 0;
1678+ }
1679+
1680+ return 1;
1681+}
1682+
1683+
16251684 //! @brief 小物の設定を取得
16261685 //! @param id 番号
16271686 //! @param out_data 受け取るSmallObjectParameter型ポインタ
--- trunk/resource.h (revision 137)
+++ trunk/resource.h (revision 138)
@@ -99,6 +99,7 @@
9999 void CleanupHumanTexture();
100100 int LoadWeaponModelTexture();
101101 int GetWeaponModelTexture(int id, int *model, int *texture);
102+ int GetBugWeaponModelTexture(int id, int *model, int *texture);
102103 void CleanupWeaponModelTexture();
103104 int LoadWeaponSound();
104105 int GetWeaponSound(int id);
--- trunk/objectmanager.cpp (revision 137)
+++ trunk/objectmanager.cpp (revision 138)
@@ -49,7 +49,7 @@
4949 BulletObj_HumanIndex = new BulletObjectHumanIndex[MAX_BULLET];
5050 FriendlyFire = false;
5151 Player_HumanID = 0;
52- AddHumanIndex_TextureID = -1;
52+ Human_FrameTextureRefresh = new bool[MAX_HUMAN];
5353
5454 GameParamInfo = NULL;
5555 d3dg = NULL;
@@ -76,6 +76,7 @@
7676 if( Human_headshot != NULL ){ delete [] Human_headshot; }
7777 if( Human_ShotFlag != NULL ){ delete [] Human_ShotFlag; }
7878 if( BulletObj_HumanIndex != NULL ){ delete [] BulletObj_HumanIndex; }
79+ if( Human_FrameTextureRefresh != NULL ){ delete [] Human_FrameTextureRefresh; }
7980 }
8081
8182 //! @brief 参照するクラスを設定
@@ -168,19 +169,15 @@
168169 if( GetHumanFlag == 0 ){
169170 int id = Resource->GetHumanTexture(infodata.p2);
170171 if( id == -1 ){
171- id = AddHumanIndex_TextureID;
172+ //テクスチャが取得できなければ、リフレッシュフラグを有効にして毎フレーム取得
173+ Human_FrameTextureRefresh[j] = true;
172174 }
173- else{
174- AddHumanIndex_TextureID = id;
175- }
176175
177176 HumanIndex[j].SetTexture(id);
178177 HumanIndex[j].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
179178 }
180179 else{
181- AddHumanIndex_TextureID = d3dg->GetMapTextureID(0);
182-
183- HumanIndex[j].SetTexture(AddHumanIndex_TextureID);
180+ HumanIndex[j].SetTexture(d3dg->GetMapTextureID(0));
184181 HumanIndex[j].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
185182 }
186183 HumanIndex[j].SetEnableFlag(true);
@@ -262,24 +259,17 @@
262259 HumanIndex[i].SetPosData(px, py, pz, rx);
263260 HumanIndex[i].SetParamData(paramID, -1, 0, TeamID, true);
264261 if( GetHumanFlag == 0 ){
265- //読み込めなければ、前回読み込んだテクスチャ番号を利用
266- //読み込めれば、今回読み込むテクスチャ番号を上書き
267262 int id = Resource->GetHumanTexture(paramID);
268263 if( id == -1 ){
269- id = AddHumanIndex_TextureID;
264+ //テクスチャが取得できなければ、リフレッシュフラグを有効にして毎フレーム取得
265+ Human_FrameTextureRefresh[i] = true;
270266 }
271- else{
272- AddHumanIndex_TextureID = id;
273- }
274267
275268 HumanIndex[i].SetTexture(id);
276269 HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
277270 }
278271 else{
279- //今回読み込むテクスチャ番号を上書き
280- AddHumanIndex_TextureID = d3dg->GetMapTextureID(0);
281-
282- HumanIndex[i].SetTexture(AddHumanIndex_TextureID);
272+ HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0));
283273 HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
284274 }
285275 HumanIndex[i].SetEnableFlag(true);
@@ -1263,6 +1253,11 @@
12631253 FriendlyFire = false;
12641254 Player_HumanID = 0;
12651255
1256+ //人のテクスチャリフレッシュフラグ初期化
1257+ for(int i=0; i<MAX_HUMAN; i++){
1258+ Human_FrameTextureRefresh[i] = false;
1259+ }
1260+
12661261 /*
12671262 //人情報ポイントを探す
12681263 for(int i=0; i<PointData->GetTotaldatas(); i++){
@@ -1361,24 +1356,17 @@
13611356 //人のテクスチャを登録
13621357 Resource->AddHumanTexture(HumanID);
13631358
1364- //読み込めなければ、前回読み込んだテクスチャ番号を利用
1365- //読み込めれば、今回読み込むテクスチャ番号を上書き
13661359 int id = Resource->GetHumanTexture(HumanID);
13671360 if( id == -1 ){
1368- id = AddHumanIndex_TextureID;
1361+ //テクスチャが取得できなければ、リフレッシュフラグを有効にして毎フレーム取得
1362+ Human_FrameTextureRefresh[i] = true;
13691363 }
1370- else{
1371- AddHumanIndex_TextureID = id;
1372- }
13731364
13741365 HumanIndex[i].SetTexture(id);
13751366 HumanIndex[i].SetModel(upmodel[ HumanParam.model ], armmodel, legmodel, walkmodel, runmodel);
13761367 }
13771368 else{
1378- //今回読み込むテクスチャ番号を上書き
1379- AddHumanIndex_TextureID = d3dg->GetMapTextureID(0);
1380-
1381- HumanIndex[i].SetTexture(AddHumanIndex_TextureID);
1369+ HumanIndex[i].SetTexture(d3dg->GetMapTextureID(0));
13821370 HumanIndex[i].SetModel(upmodel[0], armmodel, legmodel, walkmodel, runmodel);
13831371 }
13841372 }
@@ -2544,6 +2532,26 @@
25442532 for(int i=0; i<MAX_HUMAN; i++){
25452533 bool DrawArm, player;
25462534
2535+ //人のテクスチャリフレッシュフラグが有効なら
2536+ if( Human_FrameTextureRefresh[i] == true ){
2537+ if( i > 0 ){
2538+ //前の人が持っている武器を取得
2539+ int WeaponType = HumanIndex[i-1].GetMainWeaponTypeNO();
2540+
2541+ if( WeaponType != ID_WEAPON_NONE ){
2542+ int model, texture;
2543+
2544+ //武器を持っていれば、その武器のテクスチャを適用
2545+ Resource->GetWeaponModelTexture(WeaponType, &model, &texture);
2546+ HumanIndex[i].SetTexture(texture);
2547+ }
2548+ else{
2549+ //手ぶらなら、人のテクスチャをそのまま反映
2550+ HumanIndex[i].SetTexture( HumanIndex[i-1].GetTexture() );
2551+ }
2552+ }
2553+ }
2554+
25472555 //腕の表示
25482556 if( HidePlayer == 0 ){
25492557 DrawArm = false;
--- trunk/object.cpp (revision 137)
+++ trunk/object.cpp (revision 138)
@@ -107,6 +107,15 @@
107107 model_size = size;
108108 }
109109
110+//! @brief モデルデータを取得
111+//! @param id モデル認識番号を受け取るポインタ(NULL可)
112+//! @param size 表示倍率を受け取るポインタ(NULL可)
113+void object::GetModel(int *id, float *size)
114+{
115+ if( id != NULL ){ *id = id_model; }
116+ if( size != NULL ){ *size = model_size; }
117+}
118+
110119 //! @brief テクスチャを設定
111120 //! @param id テクスチャ認識番号
112121 void object::SetTexture(int id)
@@ -114,6 +123,13 @@
114123 id_texture = id;
115124 }
116125
126+//! @brief テクスチャを取得
127+//! @return テクスチャ認識番号
128+int object::GetTexture()
129+{
130+ return id_texture;
131+}
132+
117133 //! @brief 計算を実行(自由落下など)
118134 int object::RunFrame()
119135 {
@@ -1254,8 +1270,10 @@
12541270 //! @param CollD Collisionクラスのポインタ
12551271 //! @param inblockdata BlockDataInterfaceクラスのポインタ
12561272 //! @param FallDist Y軸の移動量を取得するポインタ
1273+//! @param nowmove_x X軸の移動量を取得するポインタ
1274+//! @param nowmove_z Z軸の移動量を取得するポインタ
12571275 //! @return ブロックに埋まっている:true 埋まっていない:false
1258-bool human::MapCollisionDetection(class Collision *CollD, class BlockDataInterface *inblockdata, float *FallDist)
1276+bool human::MapCollisionDetection(class Collision *CollD, class BlockDataInterface *inblockdata, float *FallDist, float *nowmove_x, float *nowmove_z)
12591277 {
12601278 bool inside = false;
12611279 int id;
@@ -1470,6 +1488,9 @@
14701488 }
14711489 }
14721490
1491+ *nowmove_x = move_x;
1492+ *nowmove_z = move_z;
1493+
14731494 *FallDist = FallDistance;
14741495 return inside;
14751496 }
@@ -1495,6 +1516,7 @@
14951516 #endif
14961517
14971518 float FallDistance;
1519+ float nowmove_x, nowmove_z;
14981520 int CheckDead;
14991521
15001522 //武器切り替えカウント
@@ -1552,16 +1574,16 @@
15521574 ControlProcess();
15531575
15541576 //マップとの当たり判定
1555- MapCollisionDetection(CollD, inblockdata, &FallDistance);
1577+ MapCollisionDetection(CollD, inblockdata, &FallDistance, &nowmove_x, &nowmove_z);
15561578
15571579 //移動するなら
1558- if( (move_x*move_x + move_z*move_z) > 0.0f * 0.0f ){
1559- totalmove += sqrt(move_x*move_x + move_z*move_z);
1580+ if( (nowmove_x*nowmove_x + nowmove_z*nowmove_z) > 0.0f * 0.0f ){
1581+ totalmove += sqrt(nowmove_x*nowmove_x + nowmove_z*nowmove_z);
15601582 }
15611583
15621584 //座標移動
1563- pos_x += move_x;
1564- pos_z += move_z;
1585+ pos_x += nowmove_x;
1586+ pos_z += nowmove_z;
15651587
15661588 //移動量を減衰
15671589 move_x *= HUMAN_ATTENUATION;