• R/O
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javaandroidc++linuxc#windowsobjective-ccocoaqtpython誰得phprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。


コミットメタ情報

リビジョン351 (tree)
日時2023-02-07 23:16:27
作者xops-mikan

ログメッセージ

ゾンビの攻撃処理を修正、AIの一部設定値を定数化、人設定パラメーター追加

変更サマリ

差分

--- trunk/ai.cpp (revision 350)
+++ trunk/ai.cpp (revision 351)
@@ -568,36 +568,62 @@
568568
569569 float atanx, atany, r;
570570
571- //自分が手榴弾を持っていれば〜
572- if( weaponid == ID_WEAPON_GRENADE ){
573- if( zombie == false ){
574- float x = posx - tx;
575- float z = posz - tz;
576- float r = x * x + z * z;
577- float scale;
578- if( longattack == false ){ scale = 0.12f; }
579- else{ scale = 0.4f; }
571+ //ターゲットの位置を補正
572+ if( zombie == true ){ //ゾンビの場合
573+ float x = posx - tx;
574+ float z = posz - tz;
575+ float r = sqrtf(x * x + z * z);
576+ float scale;
577+ float mx, mz;
580578
581- //距離に応じて高さを変える
582- ty += (sqrtf(r) - 200.0f) * scale;
579+ if( r > 180.0f ){ r = 180.0f; } //もしかしたら 1800.0f 上限かも
580+
581+ //追従性のパラメーターを取得
582+ switch( Paraminfo.AItrackability ){
583+ case 0: scale = (0.05f * 2); break;
584+ case 1: scale = (0.10f * 2); break;
585+ case 2: scale = (0.13f * 2); break;
586+ case 3: scale = (0.17f * 2); break;
587+ default: scale = 0.0f;
583588 }
589+
590+ //敵の移動を見超す
591+ EnemyHuman->GetMovePos(&mx, NULL, &mz);
592+ tx += mx * r * scale;
593+ tz += mz * r * scale;
584594 }
585- else{
586- float mx, mz;
587- float scale;
588- EnemyHuman->GetMovePos(&mx, NULL, &mz);
589- if( longattack == false ){ scale = 1.5f; }
595+ else{ //ゾンビでない場合
596+ //自分が手榴弾を持っていれば〜
597+ if( weaponid == ID_WEAPON_GRENADE ){
598+ if( zombie == false ){
599+ float x = posx - tx;
600+ float z = posz - tz;
601+ float r = sqrtf(x * x + z * z);
602+ float scale;
603+ if( longattack == false ){ scale = 0.12f; }
604+ else{ scale = 0.4f; }
605+
606+ //距離に応じて高さを変える
607+ ty += (r - AI_CHECKSHORTATTACK_DIST) * scale;
608+ }
609+ }
590610 else{
591- float x = posx - tx;
592- float z = posz - tz;
593- float r = x * x + z * z;
611+ float mx, mz;
612+ float scale;
613+ EnemyHuman->GetMovePos(&mx, NULL, &mz);
614+ if( longattack == false ){ scale = 1.5f; }
615+ else{
616+ float x = posx - tx;
617+ float z = posz - tz;
618+ float r = sqrtf(x * x + z * z);
594619
595- scale = sqrtf(r) * 0.12f;
620+ scale = r * 0.12f;
621+ }
622+
623+ //敵の移動を見超す
624+ tx += mx * scale;
625+ tz += mz * scale;
596626 }
597-
598- //敵の移動を見超す
599- tx += mx * scale;
600- tz += mz * scale;
601627 }
602628
603629 //目標地点への角度を求める
@@ -784,11 +810,11 @@
784810 }
785811
786812 //距離に応じて近距離・遠距離を切り替える
787- // 200.0fピッタリで設定値維持
788- if( r < 200.0f * 200.0f ){
813+ // ※ AI_CHECKSHORTATTACK_DIST ピッタリで設定値維持
814+ if( r < AI_CHECKSHORTATTACK_DIST * AI_CHECKSHORTATTACK_DIST ){
789815 longattack = false;
790816 }
791- if( (r > 200.0f * 200.0f)&&(MoveNavi->GetRun2() == false) ){
817+ if( (r > AI_CHECKSHORTATTACK_DIST * AI_CHECKSHORTATTACK_DIST)&&(MoveNavi->GetRun2() == false) ){
792818 longattack = true;
793819 }
794820
@@ -1310,7 +1336,7 @@
13101336 for(int i=0; i<searchloops; i++){
13111337 int targetid = GetRand(MAX_HUMAN);
13121338
1313- if( CheckLookEnemy(targetid, A_rx, A_ry, 200.0f, NULL) == true ){
1339+ if( CheckLookEnemy(targetid, A_rx, A_ry, AI_CHECKSHORTATTACK_DIST, NULL) == true ){
13141340 longattack = false;
13151341 return 1;
13161342 }
@@ -1336,7 +1362,7 @@
13361362 for(int i=0; i<3; i++){
13371363 int targetid = GetRand(MAX_HUMAN);
13381364
1339- if( CheckLookEnemy(targetid, A_rx, A_ry, 200.0f, NULL) == true ){
1365+ if( CheckLookEnemy(targetid, A_rx, A_ry, AI_CHECKSHORTATTACK_DIST, NULL) == true ){
13401366 longattack = false;
13411367 return 1;
13421368 }
--- trunk/ai.h (revision 350)
+++ trunk/ai.h (revision 351)
@@ -39,13 +39,14 @@
3939 #define AI_SEARCH_RY DegreeToRadian(60) //!< 敵を発見する縦軸角度
4040 #define AI_ZOMBIEATTACK_ARMRY DegreeToRadian(-15) //!< ゾンビ攻撃時の腕の角度
4141
42-#define AI_ARRIVALDIST_PATH 5.0f //!< パスに到達したと判定する距離
43-#define AI_ARRIVALDIST_TRACKING 18.0f //!< 追尾対象に到達したと判定する距離
42+#define AI_ARRIVALDIST_PATH 5.0f //!< パスに到達したと判定する距離
43+#define AI_ARRIVALDIST_TRACKING 18.0f //!< 追尾対象に到達したと判定する距離
4444 #define AI_ARRIVALDIST_WALKTRACKING 24.0f //!< 追尾対象へ(走らずに)歩いて近づく距離
45-#define AI_CHECKJUMP_HEIGHT 0.3f //!< 前にブロックが無いか判定する高さ
46-#define AI_CHECKJUMP_DIST 2.0f //!< 前にブロックが無いか判定する距離
45+#define AI_CHECKJUMP_HEIGHT 0.3f //!< 前にブロックが無いか判定する高さ
46+#define AI_CHECKJUMP_DIST 2.0f //!< 前にブロックが無いか判定する距離
4747 #define AI_CHECKJUMP2_DIST 10.0f //!< 前にブロックが無いか判定する距離(優先的な走り)
48-#define AI_CHECKBULLET 20.0f //!< 弾が近くを通ったと判定する距離
48+#define AI_CHECKBULLET 20.0f //!< 弾が近くを通ったと判定する距離
49+#define AI_CHECKSHORTATTACK_DIST 200.0f //!< 近距離攻撃と判定する距離
4950
5051 #ifndef H_LAYERLEVEL
5152 #define H_LAYERLEVEL 3 //!< Select include file.
--- trunk/parameter.cpp (revision 350)
+++ trunk/parameter.cpp (revision 351)
@@ -81,6 +81,7 @@
8181 Human[0].model = 5;
8282 Human[0].hp = 120;
8383 Human[0].AIlevel = 3;
84+ Human[0].AItrackability = -1;
8485 Human[0].Weapon[0] = 21;
8586 Human[0].Weapon[1] = 8;
8687 Human[0].type = 0;
@@ -89,6 +90,7 @@
8990 Human[1].model = 5;
9091 Human[1].hp = 120;
9192 Human[1].AIlevel = 3;
93+ Human[1].AItrackability = -1;
9294 Human[1].Weapon[0] = 21;
9395 Human[1].Weapon[1] = 2;
9496 Human[1].type = 0;
@@ -97,6 +99,7 @@
9799 Human[2].model = 0;
98100 Human[2].hp = 110;
99101 Human[2].AIlevel = 2;
102+ Human[2].AItrackability = -1;
100103 Human[2].Weapon[0] = 3;
101104 Human[2].Weapon[1] = 6;
102105 Human[2].type = 0;
@@ -105,6 +108,7 @@
105108 Human[3].model = 0;
106109 Human[3].hp = 110;
107110 Human[3].AIlevel = 2;
111+ Human[3].AItrackability = -1;
108112 Human[3].Weapon[0] = 3;
109113 Human[3].Weapon[1] = 10;
110114 Human[3].type = 0;
@@ -113,6 +117,7 @@
113117 Human[4].model = 0;
114118 Human[4].hp = 110;
115119 Human[4].AIlevel = 2;
120+ Human[4].AItrackability = -1;
116121 Human[4].Weapon[0] = 3;
117122 Human[4].Weapon[1] = 2;
118123 Human[4].type = 0;
@@ -121,6 +126,7 @@
121126 Human[5].model = 0;
122127 Human[5].hp = 110;
123128 Human[5].AIlevel = 2;
129+ Human[5].AItrackability = -1;
124130 Human[5].Weapon[0] = 4;
125131 Human[5].Weapon[1] = 7;
126132 Human[5].type = 0;
@@ -129,6 +135,7 @@
129135 Human[6].model = 0;
130136 Human[6].hp = 110;
131137 Human[6].AIlevel = 2;
138+ Human[6].AItrackability = -1;
132139 Human[6].Weapon[0] = 4;
133140 Human[6].Weapon[1] = 2;
134141 Human[6].type = 0;
@@ -137,6 +144,7 @@
137144 Human[7].model = 0;
138145 Human[7].hp = 100;
139146 Human[7].AIlevel = 3;
147+ Human[7].AItrackability = -1;
140148 Human[7].Weapon[0] = 4;
141149 Human[7].Weapon[1] = 0;
142150 Human[7].type = 0;
@@ -145,6 +153,7 @@
145153 Human[8].model = 0;
146154 Human[8].hp = 110;
147155 Human[8].AIlevel = 3;
156+ Human[8].AItrackability = -1;
148157 Human[8].Weapon[0] = 22;
149158 Human[8].Weapon[1] = 14;
150159 Human[8].type = 0;
@@ -153,6 +162,7 @@
153162 Human[9].model = 5;
154163 Human[9].hp = 120;
155164 Human[9].AIlevel = 2;
165+ Human[9].AItrackability = -1;
156166 Human[9].Weapon[0] = 3;
157167 Human[9].Weapon[1] = 1;
158168 Human[9].type = 0;
@@ -161,6 +171,7 @@
161171 Human[10].model = 0;
162172 Human[10].hp = 2500;
163173 Human[10].AIlevel = 4;
174+ Human[10].AItrackability = -1;
164175 Human[10].Weapon[0] = 6;
165176 Human[10].Weapon[1] = 12;
166177 Human[10].type = 1;
@@ -169,6 +180,7 @@
169180 Human[11].model = 1;
170181 Human[11].hp = 100;
171182 Human[11].AIlevel = 1;
183+ Human[11].AItrackability = -1;
172184 Human[11].Weapon[0] = 18;
173185 Human[11].Weapon[1] = 0;
174186 Human[11].type = 0;
@@ -177,6 +189,7 @@
177189 Human[12].model = 0;
178190 Human[12].hp = 100;
179191 Human[12].AIlevel = 1;
192+ Human[12].AItrackability = -1;
180193 Human[12].Weapon[0] = 5;
181194 Human[12].Weapon[1] = 0;
182195 Human[12].type = 0;
@@ -185,6 +198,7 @@
185198 Human[13].model = 0;
186199 Human[13].hp = 100;
187200 Human[13].AIlevel = 0;
201+ Human[13].AItrackability = -1;
188202 Human[13].Weapon[0] = 0;
189203 Human[13].Weapon[1] = 0;
190204 Human[13].type = 0;
@@ -193,6 +207,7 @@
193207 Human[14].model = 2;
194208 Human[14].hp = 100;
195209 Human[14].AIlevel = 1;
210+ Human[14].AItrackability = -1;
196211 Human[14].Weapon[0] = 3;
197212 Human[14].Weapon[1] = 0;
198213 Human[14].type = 0;
@@ -201,6 +216,7 @@
201216 Human[15].model = 0;
202217 Human[15].hp = 100;
203218 Human[15].AIlevel = 0;
219+ Human[15].AItrackability = -1;
204220 Human[15].Weapon[0] = 0;
205221 Human[15].Weapon[1] = 0;
206222 Human[15].type = 0;
@@ -209,6 +225,7 @@
209225 Human[16].model = 0;
210226 Human[16].hp = 100;
211227 Human[16].AIlevel = 0;
228+ Human[16].AItrackability = -1;
212229 Human[16].Weapon[0] = 17;
213230 Human[16].Weapon[1] = 0;
214231 Human[16].type = 0;
@@ -217,6 +234,7 @@
217234 Human[17].model = 0;
218235 Human[17].hp = 100;
219236 Human[17].AIlevel = 1;
237+ Human[17].AItrackability = -1;
220238 Human[17].Weapon[0] = 17;
221239 Human[17].Weapon[1] = 10;
222240 Human[17].type = 0;
@@ -225,6 +243,7 @@
225243 Human[18].model = 3;
226244 Human[18].hp = 90;
227245 Human[18].AIlevel = 0;
246+ Human[18].AItrackability = -1;
228247 Human[18].Weapon[0] = 0;
229248 Human[18].Weapon[1] = 0;
230249 Human[18].type = 0;
@@ -233,6 +252,7 @@
233252 Human[19].model = 0;
234253 Human[19].hp = 100;
235254 Human[19].AIlevel = 0;
255+ Human[19].AItrackability = -1;
236256 Human[19].Weapon[0] = 0;
237257 Human[19].Weapon[1] = 0;
238258 Human[19].type = 0;
@@ -241,6 +261,7 @@
241261 Human[20].model = 0;
242262 Human[20].hp = 100;
243263 Human[20].AIlevel = 0;
264+ Human[20].AItrackability = -1;
244265 Human[20].Weapon[0] = 0;
245266 Human[20].Weapon[1] = 0;
246267 Human[20].type = 0;
@@ -249,6 +270,7 @@
249270 Human[21].model = 0;
250271 Human[21].hp = 100;
251272 Human[21].AIlevel = 0;
273+ Human[21].AItrackability = -1;
252274 Human[21].Weapon[0] = 0;
253275 Human[21].Weapon[1] = 0;
254276 Human[21].type = 0;
@@ -257,6 +279,7 @@
257279 Human[22].model = 1;
258280 Human[22].hp = 100;
259281 Human[22].AIlevel = 0;
282+ Human[22].AItrackability = -1;
260283 Human[22].Weapon[0] = 0;
261284 Human[22].Weapon[1] = 0;
262285 Human[22].type = 0;
@@ -265,6 +288,7 @@
265288 Human[23].model = 1;
266289 Human[23].hp = 100;
267290 Human[23].AIlevel = 0;
291+ Human[23].AItrackability = -1;
268292 Human[23].Weapon[0] = 0;
269293 Human[23].Weapon[1] = 0;
270294 Human[23].type = 0;
@@ -273,6 +297,7 @@
273297 Human[24].model = 1;
274298 Human[24].hp = 100;
275299 Human[24].AIlevel = 0;
300+ Human[24].AItrackability = -1;
276301 Human[24].Weapon[0] = 0;
277302 Human[24].Weapon[1] = 0;
278303 Human[24].type = 0;
@@ -281,6 +306,7 @@
281306 Human[25].model = 1;
282307 Human[25].hp = 100;
283308 Human[25].AIlevel = 0;
309+ Human[25].AItrackability = -1;
284310 Human[25].Weapon[0] = 0;
285311 Human[25].Weapon[1] = 0;
286312 Human[25].type = 0;
@@ -289,6 +315,7 @@
289315 Human[26].model = 4;
290316 Human[26].hp = 115;
291317 Human[26].AIlevel = 2;
318+ Human[26].AItrackability = -1;
292319 Human[26].Weapon[0] = 5;
293320 Human[26].Weapon[1] = 9;
294321 Human[26].type = 0;
@@ -297,6 +324,7 @@
297324 Human[27].model = 4;
298325 Human[27].hp = 115;
299326 Human[27].AIlevel = 2;
327+ Human[27].AItrackability = -1;
300328 Human[27].Weapon[0] = 5;
301329 Human[27].Weapon[1] = 12;
302330 Human[27].type = 0;
@@ -305,6 +333,7 @@
305333 Human[28].model = 4;
306334 Human[28].hp = 115;
307335 Human[28].AIlevel = 2;
336+ Human[28].AItrackability = -1;
308337 Human[28].Weapon[0] = 13;
309338 Human[28].Weapon[1] = 10;
310339 Human[28].type = 0;
@@ -313,6 +342,7 @@
313342 Human[29].model = 0;
314343 Human[29].hp = 1000;
315344 Human[29].AIlevel = 0;
345+ Human[29].AItrackability = 1;
316346 Human[29].Weapon[0] = 0;
317347 Human[29].Weapon[1] = 0;
318348 Human[29].type = 2;
@@ -321,6 +351,7 @@
321351 Human[30].model = 0;
322352 Human[30].hp = 1000;
323353 Human[30].AIlevel = 0;
354+ Human[30].AItrackability = 3;
324355 Human[30].Weapon[0] = 0;
325356 Human[30].Weapon[1] = 0;
326357 Human[30].type = 2;
@@ -329,6 +360,7 @@
329360 Human[31].model = 0;
330361 Human[31].hp = 1000;
331362 Human[31].AIlevel = 0;
363+ Human[31].AItrackability = 0;
332364 Human[31].Weapon[0] = 0;
333365 Human[31].Weapon[1] = 0;
334366 Human[31].type = 2;
@@ -337,6 +369,7 @@
337369 Human[32].model = 3;
338370 Human[32].hp = 950;
339371 Human[32].AIlevel = 0;
372+ Human[32].AItrackability = 2;
340373 Human[32].Weapon[0] = 0;
341374 Human[32].Weapon[1] = 0;
342375 Human[32].type = 2;
@@ -345,6 +378,7 @@
345378 Human[33].model = 0;
346379 Human[33].hp = 100;
347380 Human[33].AIlevel = 0;
381+ Human[33].AItrackability = -1;
348382 Human[33].Weapon[0] = 0;
349383 Human[33].Weapon[1] = 0;
350384 Human[33].type = 0;
@@ -353,6 +387,7 @@
353387 Human[34].model = 1;
354388 Human[34].hp = 100;
355389 Human[34].AIlevel = 1;
390+ Human[34].AItrackability = -1;
356391 Human[34].Weapon[0] = 17;
357392 Human[34].Weapon[1] = 0;
358393 Human[34].type = 0;
@@ -361,6 +396,7 @@
361396 Human[35].model = 0;
362397 Human[35].hp = 95;
363398 Human[35].AIlevel = 1;
399+ Human[35].AItrackability = -1;
364400 Human[35].Weapon[0] = 17;
365401 Human[35].Weapon[1] = 0;
366402 Human[35].type = 0;
@@ -369,6 +405,7 @@
369405 Human[36].model = 0;
370406 Human[36].hp = 100;
371407 Human[36].AIlevel = 0;
408+ Human[36].AItrackability = -1;
372409 Human[36].Weapon[0] = 0;
373410 Human[36].Weapon[1] = 0;
374411 Human[36].type = 0;
@@ -377,6 +414,7 @@
377414 Human[37].model = 1;
378415 Human[37].hp = 100;
379416 Human[37].AIlevel = 1;
417+ Human[37].AItrackability = -1;
380418 Human[37].Weapon[0] = 18;
381419 Human[37].Weapon[1] = 0;
382420 Human[37].type = 0;
@@ -385,6 +423,7 @@
385423 Human[38].model = 1;
386424 Human[38].hp = 100;
387425 Human[38].AIlevel = 1;
426+ Human[38].AItrackability = -1;
388427 Human[38].Weapon[0] = 6;
389428 Human[38].Weapon[1] = 0;
390429 Human[38].type = 0;
@@ -393,6 +432,7 @@
393432 Human[39].model = 0;
394433 Human[39].hp = 105;
395434 Human[39].AIlevel = 3;
435+ Human[39].AItrackability = -1;
396436 Human[39].Weapon[0] = 5;
397437 Human[39].Weapon[1] = 20;
398438 Human[39].type = 0;
@@ -401,6 +441,7 @@
401441 Human[40].model = 1;
402442 Human[40].hp = 105;
403443 Human[40].AIlevel = 3;
444+ Human[40].AItrackability = -1;
404445 Human[40].Weapon[0] = 21;
405446 Human[40].Weapon[1] = 0;
406447 Human[40].type = 0;
@@ -409,6 +450,7 @@
409450 Human[41].model = 0;
410451 Human[41].hp = 100;
411452 Human[41].AIlevel = 0;
453+ Human[41].AItrackability = -1;
412454 Human[41].Weapon[0] = 0;
413455 Human[41].Weapon[1] = 0;
414456 Human[41].type = 0;
@@ -417,6 +459,7 @@
417459 Human[42].model = 1;
418460 Human[42].hp = 100;
419461 Human[42].AIlevel = 4;
462+ Human[42].AItrackability = -1;
420463 Human[42].Weapon[0] = 22;
421464 Human[42].Weapon[1] = 0;
422465 Human[42].type = 0;
--- trunk/parameter.h (revision 350)
+++ trunk/parameter.h (revision 351)
@@ -59,12 +59,13 @@
5959 //! 人設定用の構造体
6060 typedef struct
6161 {
62- int texture; //!< テクスチャ番号
63- int model; //!< モデル番号
64- int hp; //!< 体力
65- int AIlevel; //!< AIレベル
62+ int texture; //!< テクスチャ番号
63+ int model; //!< モデル番号
64+ int hp; //!< 体力
65+ int AIlevel; //!< AIレベル
66+ int AItrackability; //!< AI攻撃時の追従性(ゾンビのみ)
6667 int Weapon[TOTAL_HAVEWEAPON]; //!< 武器
67- int type; //!< 種類
68+ int type; //!< 種類
6869 } HumanParameter;
6970
7071 //! 武器設定用の構造体